diff --git a/.github/workflows/r-cmd-check.yml b/.github/workflows/r-cmd-check.yml index 790348563..8ee1c320d 100644 --- a/.github/workflows/r-cmd-check.yml +++ b/.github/workflows/r-cmd-check.yml @@ -82,7 +82,7 @@ jobs: if: runner.os == 'Windows' id: get_package_version_windows run: | - $version = Rscript -e 'cat(as.character(packageVersion("torchvision")))' + $version = Rscript -e 'cat(as.character(packageVersion("torchvision")))' echo "TORCHVISION_PACKAGE_VERSION=$version" >> $env:GITHUB_ENV - name: Get torch cache path (Linux/macOS) diff --git a/.gitignore b/.gitignore index 0f6767c2a..3b9b1ba6c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ mlr3torch*.tgz *~ docs inst/doc -*.html **/.DS_Store /doc/ /Meta/ @@ -17,4 +16,11 @@ CRAN-SUBMISSION paper/data .idea/ .vsc/ -paper/data \ No newline at end of file +paper/data/ +paper/benchmark/registry +.vscode/ +paper/benchmark/registry-linux-cpu/ +paper/benchmark/registry-macos/ +paper/benchmark/registry-linux-gpu/ +paper/benchmark/registry-linux-gpu-optimizer/ +paper/benchmark/registry-linux-gpu-old/ diff --git a/R/learner_torch_methods.R b/R/learner_torch_methods.R index 19d9b7881..be414ef0b 100644 --- a/R/learner_torch_methods.R +++ b/R/learner_torch_methods.R @@ -27,7 +27,8 @@ learner_torch_train = function(self, private, super, task, param_vals) { stopf("Training Dataloader of Learner '%s' has length 0", self$id) } - network = private$.network(task, param_vals)$to(device = param_vals$device) + network = private$.network(task, param_vals) + network$to(device = param_vals$device) if (isTRUE(param_vals$jit_trace) && !inherits(network, "script_module")) { example = get_example_batch(loader_train)$x example = lapply(example, function(x) x$to(device = param_vals$device)) @@ -134,6 +135,8 @@ train_loop = function(ctx, cbs) { ctx$network$train() + forward = get_forward(ctx$network) + # if we increment epoch at the end of the loop it has the wrong value # during the final two callback stages ctx$epoch = 0L @@ -145,6 +148,7 @@ train_loop = function(ctx, cbs) { indices = list() train_iterator = dataloader_make_iter(ctx$loader_train) ctx$step = 0L + eval_train = eval_train_in_epoch(ctx) while (ctx$step < length(ctx$loader_train)) { ctx$step = ctx$step + 1 ctx$batch = dataloader_next(train_iterator) @@ -155,9 +159,9 @@ train_loop = function(ctx, cbs) { call("on_batch_begin") if (length(ctx$batch$x) == 1L) { - ctx$y_hat = ctx$network(ctx$batch$x[[1L]]) + ctx$y_hat = forward(ctx$batch$x[[1L]]) } else { - ctx$y_hat = do.call(ctx$network, ctx$batch$x) + ctx$y_hat = do.call(forward, ctx$batch$x) } loss = ctx$loss_fn(ctx$y_hat, ctx$batch$y) @@ -167,14 +171,16 @@ train_loop = function(ctx, cbs) { call("on_after_backward") ctx$last_loss = loss$item() - predictions[[length(predictions) + 1]] = ctx$y_hat$detach() - indices[[length(indices) + 1]] = as.integer(ctx$batch$.index$to(device = "cpu")) + if (eval_train) { + predictions[[length(predictions) + 1]] = ctx$y_hat$detach() + indices[[length(indices) + 1]] = as.integer(ctx$batch$.index$to(device = "cpu")) + } ctx$optimizer$step() call("on_batch_end") } - ctx$last_scores_train = if (eval_train_in_epoch(ctx)) { + ctx$last_scores_train = if (eval_train) { measure_prediction( pred_tensor = torch_cat(predictions, dim = 1L), measures = ctx$measures_train, diff --git a/R/nn.R b/R/nn.R index e8efe02c6..1e97e6b15 100644 --- a/R/nn.R +++ b/R/nn.R @@ -11,9 +11,5 @@ #' # is the same as: #' po2 = nn("linear") nn = function(.key, ...) { - args = list(...) - if (is.null(args$id)) { - args$id = .key - } - invoke(po, .obj = paste0("nn_", .key), .args = args) + invoke(po, .obj = paste0("nn_", .key), id = .key, ...) } diff --git a/R/utils.R b/R/utils.R index f318013f7..a7bde0e32 100644 --- a/R/utils.R +++ b/R/utils.R @@ -275,6 +275,23 @@ order_named_args = function(f, l) { l2 } +get_forward = function(net) { + if (inherits(net, "script_module")) { + is_training = net$is_training + trainforward = net$trainforward + evalforward = net$evalforward + function(...) { + if (is_training()) { + trainforward(...) + } else { + evalforward(...) + } + } + } else { + net$forward + } +} + #' @title Network Output Dimension #' @description @@ -314,7 +331,7 @@ all_or_none_ = function(...) { single_lazy_tensor = function(task) { identical(task$feature_types[, "type"][[1L]], "lazy_tensor") } - + n_num_features = function(task) { sum(task$feature_types$type %in% c("numeric", "integer")) } @@ -325,4 +342,4 @@ n_categ_features = function(task) { n_ltnsr_features = function(task) { sum(task$feature_types$type == "lazy_tensor") -} \ No newline at end of file +} diff --git a/man-roxygen/paramset_torchlearner.R b/man-roxygen/paramset_torchlearner.R index 46e62e5cb..1256d72f8 100644 --- a/man-roxygen/paramset_torchlearner.R +++ b/man-roxygen/paramset_torchlearner.R @@ -64,7 +64,7 @@ #' The batch size (required). #' * `shuffle` :: `logical(1)`\cr #' Whether to shuffle the instances in the dataset. This is initialized to `TRUE`, -#' which differs from the default (`FALSE`). +#' which differs from the default of the [`torch::dataloader`] which is `FALSE`. #' * `sampler` :: [`torch::sampler`]\cr #' Object that defines how the dataloader draw samples. #' * `batch_sampler` :: [`torch::sampler`]\cr @@ -91,4 +91,4 @@ #' * `worker_packages` :: `character()`\cr #' Which packages to load on the workers. #' -#' Also see `torch::dataloder` for more information. +#' Also see [`torch::dataloder`] for more information. diff --git a/mlr3torch-benchmark-5274609.out b/mlr3torch-benchmark-5274609.out new file mode 100644 index 000000000..cbe869271 --- /dev/null +++ b/mlr3torch-benchmark-5274609.out @@ -0,0 +1,75 @@ +[INFO] Extracting squashfs filesystem... +Parallel unsquashfs: Using 92 processors +57832 inodes (209999 blocks) to write + + +created 55975 files +created 6137 directories +created 1735 symlinks +created 0 devices +created 0 fifos +created 0 sockets + +========== +== CUDA == +========== + +CUDA Version 12.4.1 + +Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +This container image and its contents are governed by the NVIDIA Deep Learning Container License. +By pulling and using the container, you accept the terms and conditions of this license: +https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license + +A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience. + +WARNING: The NVIDIA Driver was not detected. GPU functionality will not be available. + Use the NVIDIA Container Toolkit to start this container with GPU support; see + https://docs.nvidia.com/datacenter/cloud-native/ . + +R version 4.5.0 (2025-04-11) +Platform: x86_64-pc-linux-gnu +Running under: Ubuntu 22.04.4 LTS + +Matrix products: default +BLAS: /usr/local/lib/R/lib/libRblas.so +LAPACK: /usr/local/lib/R/lib/libRlapack.so; LAPACK version 3.12.1 + +locale: + [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C + [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 + [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 + [7] LC_PAPER=en_US.UTF-8 LC_NAME=C + [9] LC_ADDRESS=C LC_TELEPHONE=C +[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C + +time zone: Etc/UTC +tzcode source: system (glibc) + +attached base packages: +[1] stats graphics grDevices utils datasets methods base + +loaded via a namespace (and not attached): +[1] compiler_4.5.0 + +Attaching package: ‘mlr3misc’ + +The following object is masked from ‘package:batchtools’: + + chunk + +Sourcing configuration file '/mnt/data/mlr3torch/paper/batchtools.conf.R' ... +Loading required package: checkmate +Created registry in '/mnt/data/mlr3torch/paper/benchmark/registry' using cluster functions 'Interactive' +Exporting new objects: 'time_rtorch' ... +Adding problem 'runtime_train' +Adding algorithm 'pytorch' +Adding algorithm 'rtorch' +Adding algorithm 'mlr3torch' +Adding 180 experiments ('runtime_train'[30] x 'rtorch'[2] x repls[3]) ... +Adding 180 experiments ('runtime_train'[30] x 'mlr3torch'[2] x repls[3]) ... +Adding 180 experiments ('runtime_train'[30] x 'pytorch'[2] x repls[3]) ... +Adding 180 experiments ('runtime_train'[30] x 'rtorch'[2] x repls[3]) ... +Adding 180 experiments ('runtime_train'[30] x 'mlr3torch'[2] x repls[3]) ... +Adding 180 experiments ('runtime_train'[30] x 'pytorch'[2] x repls[3]) ... diff --git a/mlr3torch-benchmark-5274611.out b/mlr3torch-benchmark-5274611.out new file mode 100644 index 000000000..476212e80 --- /dev/null +++ b/mlr3torch-benchmark-5274611.out @@ -0,0 +1,573 @@ +[INFO] Extracting squashfs filesystem... +Parallel unsquashfs: Using 92 processors +57832 inodes (209999 blocks) to write + + +created 55975 files +created 6137 directories +created 1735 symlinks +created 0 devices +created 0 fifos +created 0 sockets + +========== +== CUDA == +========== + +CUDA Version 12.4.1 + +Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +This container image and its contents are governed by the NVIDIA Deep Learning Container License. +By pulling and using the container, you accept the terms and conditions of this license: +https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license + +A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience. + +WARNING: The NVIDIA Driver was not detected. GPU functionality will not be available. + Use the NVIDIA Container Toolkit to start this container with GPU support; see + https://docs.nvidia.com/datacenter/cloud-native/ . + +Reading registry in read-write mode +Loading required package: checkmate +Sourcing configuration file '/mnt/data/mlr3torch/paper/batchtools.conf.R' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... diff --git a/mlr3torch-benchmark-5277868.out b/mlr3torch-benchmark-5277868.out new file mode 100644 index 000000000..8c502ff69 --- /dev/null +++ b/mlr3torch-benchmark-5277868.out @@ -0,0 +1,75 @@ +[INFO] Extracting squashfs filesystem... +Parallel unsquashfs: Using 18 processors +57832 inodes (209999 blocks) to write + + +created 55975 files +created 6137 directories +created 1735 symlinks +created 0 devices +created 0 fifos +created 0 sockets + +========== +== CUDA == +========== + +CUDA Version 12.4.1 + +Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +This container image and its contents are governed by the NVIDIA Deep Learning Container License. +By pulling and using the container, you accept the terms and conditions of this license: +https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license + +A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience. + +WARNING: The NVIDIA Driver was not detected. GPU functionality will not be available. + Use the NVIDIA Container Toolkit to start this container with GPU support; see + https://docs.nvidia.com/datacenter/cloud-native/ . + +R version 4.5.0 (2025-04-11) +Platform: x86_64-pc-linux-gnu +Running under: Ubuntu 22.04.4 LTS + +Matrix products: default +BLAS: /usr/local/lib/R/lib/libRblas.so +LAPACK: /usr/local/lib/R/lib/libRlapack.so; LAPACK version 3.12.1 + +locale: + [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C + [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 + [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 + [7] LC_PAPER=en_US.UTF-8 LC_NAME=C + [9] LC_ADDRESS=C LC_TELEPHONE=C +[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C + +time zone: Etc/UTC +tzcode source: system (glibc) + +attached base packages: +[1] stats graphics grDevices utils datasets methods base + +loaded via a namespace (and not attached): +[1] compiler_4.5.0 + +Attaching package: ‘mlr3misc’ + +The following object is masked from ‘package:batchtools’: + + chunk + +Sourcing configuration file '/mnt/data/mlr3torch/paper/batchtools.conf.R' ... +Loading required package: checkmate +Created registry in '/mnt/data/mlr3torch/paper/benchmark/registry' using cluster functions 'Interactive' +Exporting new objects: 'time_rtorch' ... +Adding problem 'runtime_train' +Adding algorithm 'pytorch' +Adding algorithm 'rtorch' +Adding algorithm 'mlr3torch' +Adding 180 experiments ('runtime_train'[30] x 'rtorch'[2] x repls[3]) ... +Adding 180 experiments ('runtime_train'[30] x 'mlr3torch'[2] x repls[3]) ... +Adding 180 experiments ('runtime_train'[30] x 'pytorch'[2] x repls[3]) ... +Adding 180 experiments ('runtime_train'[30] x 'rtorch'[2] x repls[3]) ... +Adding 180 experiments ('runtime_train'[30] x 'mlr3torch'[2] x repls[3]) ... +Adding 180 experiments ('runtime_train'[30] x 'pytorch'[2] x repls[3]) ... diff --git a/mlr3torch-benchmark-5277870.out b/mlr3torch-benchmark-5277870.out new file mode 100644 index 000000000..704ab0ec5 --- /dev/null +++ b/mlr3torch-benchmark-5277870.out @@ -0,0 +1,36 @@ +[INFO] Extracting squashfs filesystem... +Parallel unsquashfs: Using 18 processors +57832 inodes (209999 blocks) to write + + +created 55975 files +created 6137 directories +created 1735 symlinks +created 0 devices +created 0 fifos +created 0 sockets + +========== +== CUDA == +========== + +CUDA Version 12.4.1 + +Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +This container image and its contents are governed by the NVIDIA Deep Learning Container License. +By pulling and using the container, you accept the terms and conditions of this license: +https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license + +A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience. + +WARNING: The NVIDIA Driver was not detected. GPU functionality will not be available. + Use the NVIDIA Container Toolkit to start this container with GPU support; see + https://docs.nvidia.com/datacenter/cloud-native/ . + +Reading registry in read-write mode +Loading required package: checkmate +Sourcing configuration file '/mnt/data/mlr3torch/paper/batchtools.conf.R' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... +Submitting 1 jobs in 1 chunks using cluster functions 'Interactive' ... diff --git a/mlr3torch-paper-5285461.out b/mlr3torch-paper-5285461.out new file mode 100644 index 000000000..105fcacd2 --- /dev/null +++ b/mlr3torch-paper-5285461.out @@ -0,0 +1,27 @@ +[ERROR] No such file or directory: /dss/dssmcmlfs01/pr74ze/pr74ze-dss-0001/ru48nas2/sebffischer+mlr3torch-jss+latest.sqsh + +========== +== CUDA == +========== + +CUDA Version 12.4.1 + +Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +This container image and its contents are governed by the NVIDIA Deep Learning Container License. +By pulling and using the container, you accept the terms and conditions of this license: +https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license + +A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience. + + + +processing file: paper_code.Rmd +1/2 +2/2 [unnamed-chunk-1] +output file: paper_code.md + +[1] "paper_code.md" +Warning message: +In png(..., res = dpi, units = "in") : + unable to open connection to X11 display '' diff --git a/mlr3torch-paper-5294204.out b/mlr3torch-paper-5294204.out new file mode 100644 index 000000000..b29262af6 --- /dev/null +++ b/mlr3torch-paper-5294204.out @@ -0,0 +1,28 @@ +[ERROR] No such file or directory: /dss/dssmcmlfs01/pr74ze/pr74ze-dss-0001/ru48nas2/sebffischer+mlr3torch-jss+latest.sqsh + +========== +== CUDA == +========== + +CUDA Version 12.4.1 + +Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +This container image and its contents are governed by the NVIDIA Deep Learning Container License. +By pulling and using the container, you accept the terms and conditions of this license: +https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license + +A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience. + +bash: line 3: conda: command not found + + +processing file: paper_code.Rmd +1/2 +2/2 [unnamed-chunk-1] +output file: paper_code.md + +[1] "paper_code.md" +Warning message: +In png(..., res = dpi, units = "in") : + unable to open connection to X11 display '' diff --git a/paper/.Rprofile b/paper/.Rprofile new file mode 100644 index 000000000..6421479f6 --- /dev/null +++ b/paper/.Rprofile @@ -0,0 +1,18 @@ +# Setting HTTP User Agent to identify OS, such that P3M can detect compatibility +options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"]))) + +# Ensure curl is used for downloading packages +options(download.file.method = "curl") + +# Enable verbose output for curl and again set HHTP user agent +options(download.file.extra = paste( + # Follow redirects, show errors, and display the HTTP status and URL + '-fsSL -w "%{stderr}curl: HTTP %{http_code} %{url_effective}\n"', + # Configure the R user agent header to install Linux binary packages + sprintf('--header "User-Agent: R (%s)"', paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"])) +)) + +# for ubuntu: +options( + repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/jammy/latest") +) diff --git a/paper/README.md b/paper/README.md new file mode 100644 index 000000000..453c54a82 --- /dev/null +++ b/paper/README.md @@ -0,0 +1,118 @@ +# Reproducing the Results + +## Computational Environment + +To recreate the computational environment, you can download the docker image +`sebffischer/mlr3torch-jss:latest` from dockerhub. + +```bash +enroot import docker://index.docker.io#sebffischer/mlr3torch-jss:latest +``` + +Next, you can create a docker container from the image: + +For GPU: + +```bash +enroot create --name mlr3torch-jss sebffischer+mlr3torch-jss+gpu.sqsh +``` + +For CPU: + +```bash +enroot create --name mlr3torch-jss sebffischer+mlr3torch-jss+cpu.sqsh +``` + + +To start the container, run: + +```bash +enroot start \ + --mount < parent-dir-to-mlr3torch>:/mnt/data \ + mlr3torch-jss bash +``` + +## Running the Benchmark + +Note that while the benchmark uses `batchtools` for experiment management, we don't use it for job submission in order to ensure that all GPU and CPU benchmarks respectively are run on the same machine. + +### Running locally + +To run the benchmarks locally, go into `./paper` (to have the right `.Rprofile`). + +To initialize the benchmark experiment, run: + +```bash +Rscript benchmark/benchmark.R +``` + +To start the CPU experiments, run: +Note that it's important to have enough RAM, otherwise the benchmarks will be incomparable. + +```bash +Rscript benchmark/run_cpu.R +``` + +To start the GPU experiments, run: + +```bash +Rscript benchmark/run_gpu.R +``` + + +### Running on the cluster + +Exemplary slurm scripts are provided via `benchmark_init.sh`, `benchmark_cpu.sh`, and `benchmark_gpu.sh`. +These need to be adapted to the specific cluster and job submission system. + +### Running a subset of the Jobs + +To run a subset of the jobs, you can adjust the runner scripts to do something along the lines of: + +```r +reg = loadRegistry("~/mlr3torch/paper/benchmark/registry", writeable = TRUE) +tbl = unwrap(getJobTable(reg)) +ids = tbl[device == "cpu" & n_layers == 10 & latent == 250 & jit & optimizer == "adamw" & repl == 1, ]$job.id +for (id in sample(ids)) { + submitJobs(id) + Sys.sleep(0.1) +} +``` + +### Collecting the Results + +Once the benchmark experiments are finished, you can collect the results by running: + +```bash +Rscript benchmark/summarize.R +``` + +This will create the `benchmark/results.rds` file. + + +### Generating the Plots + +Simply run: + +```r +Rscript paper/plot_benchmark.R +``` + + +## Running the Paper Code + +In the docker container, run the following code from the `./paper` directory. +This requires access to an NVIDIA GPU. + +```r +knitr::knit('paper_code.Rmd') +``` + +We also provide a version of the paper code that runs on CPU only. +There, we set the epochs to 0 everywhere and the device to "cpu". + +TODOOOO + +```r +knitr::knit('paper_code_cheap.Rmd') +``` diff --git a/paper/batchtools.conf.R b/paper/batchtools.conf.R new file mode 100644 index 000000000..c1667d6e3 --- /dev/null +++ b/paper/batchtools.conf.R @@ -0,0 +1 @@ +cluster.functions = batchtools::makeClusterFunctionsInteractive() diff --git a/paper/benchmark/.python-version b/paper/benchmark/.python-version new file mode 100644 index 000000000..86f8c02eb --- /dev/null +++ b/paper/benchmark/.python-version @@ -0,0 +1 @@ +3.13.5 diff --git a/paper/benchmark/attic/benchmark2_cpu.R b/paper/benchmark/attic/benchmark2_cpu.R new file mode 100644 index 000000000..a5e013db3 --- /dev/null +++ b/paper/benchmark/attic/benchmark2_cpu.R @@ -0,0 +1,178 @@ +library(batchtools) +library(mlr3misc) + +reg = makeExperimentRegistry( + file.dir = here::here("paper", "benchmark", "registry_cpu"), + packages = "checkmate" +) +reg$cluster.functions = makeClusterFunctionsInteractive() + +source(here::here("paper/benchmark/time_rtorch.R")) + +batchExport(list( + time_rtorch = time_rtorch +)) + +addProblem( + "runtime_train", + data = NULL, + fun = function( + epochs, + batch_size, + n_layers, + latent, + n, + p, + optimizer, + device, + ... + ) { + problem = list( + epochs = assert_int(epochs), + batch_size = assert_int(batch_size), + n_layers = assert_int(n_layers), + latent = assert_int(latent), + n = assert_int(n), + p = assert_int(p), + optimizer = assert_choice( + optimizer, + c("ignite_adamw", "adamw", "sgd", "ignite_sgd") + ), + device = assert_choice(device, c("cuda", "cpu")) + ) + + problem + } +) + +addAlgorithm("pytorch", fun = function(instance, job, data, jit, ...) { + f = function(...) { + library(reticulate) + x = try( + { + reticulate::use_python("/usr/bin/python3", required = TRUE) + reticulate::source_python(here::here("paper/benchmark/time_pytorch.py")) + print(reticulate::py_config()) + time_pytorch(...) + }, + silent = TRUE + ) + print(x) + } + args = c(instance, list(seed = job$seed, jit = jit)) + #do.call(f, args) + callr::r(f, args = args) +}) + +addAlgorithm("rtorch", fun = function(instance, job, opt_type, jit, ...) { + assert_choice(opt_type, c("standard", "ignite")) + if (opt_type == "ignite") { + instance$optimizer = paste0("ignite_", instance$optimizer) + } + callr::r(time_rtorch, args = c(instance, list(seed = job$seed, jit = jit))) +}) + +addAlgorithm("mlr3torch", fun = function(instance, job, opt_type, jit, ...) { + if (opt_type == "ignite") { + instance$optimizer = paste0("ignite_", instance$optimizer) + } + callr::r( + time_rtorch, + args = c(instance, list(seed = job$seed, mlr3torch = TRUE, jit = jit)) + ) +}) + +# global config: +REPLS = 4L +EPOCHS = 20L +N = 2000L +P = 1000L + +# cuda experiments: + +problem_design = expand.grid( + list( + n = N, + p = P, + epochs = EPOCHS, + latent = c(1000, 2500, 5000), + optimizer = c("sgd", "adamw"), + batch_size = 32L, + device = "cuda", + n_layers = c(2L, 4L, 6L, 8L, 10L, 12L, 14L, 16L) + ), + stringsAsFactors = FALSE +) + + +addExperiments( + prob.designs = list( + runtime_train = problem_design + ), + algo.designs = list( + rtorch = data.frame( + jit = c(FALSE, TRUE), + opt_type = c("ignite"), + tag = "cuda_exp" + ), + mlr3torch = data.frame( + jit = c(FALSE, TRUE), + opt_type = c("ignite"), + tag = "cuda_exp" + ), + pytorch = data.frame( + jit = c(FALSE, TRUE), + tag = "cuda_exp" + ) + ), + repls = REPLS +) + +# cpu experiments: +# (need smaller networks, otherwise too expensive with the cuda config) + +problem_design = expand.grid( + list( + n = N, + p = P, + epochs = EPOCHS, + # factor 10 smaller than cuda + latent = c(100, 250, 500), + optimizer = c("sgd", "adamw"), + batch_size = 32L, + device = "cpu", + n_layers = c(2L, 4L, 6L, 8L, 10L, 12L, 14L, 16L) + ), + stringsAsFactors = FALSE +) + +addExperiments( + prob.designs = list( + runtime_train = problem_design + ), + algo.designs = list( + rtorch = data.frame( + jit = c(FALSE, TRUE), + opt_type = c("ignite"), + tag = "cpu_exp" + ), + mlr3torch = data.frame( + jit = c(FALSE, TRUE), + opt_type = c("ignite"), + tag = "cpu_exp" + ), + pytorch = data.frame( + jit = c(FALSE, TRUE), + tag = "cpu_exp" + ) + ), + repls = REPLS +) + + +tbl = unwrap(getJobTable()) +tbl = tbl[device == "cpu", ] +for (id in sample(tbl$job.id)) { + print(id) + submitJobs(id) +} \ No newline at end of file diff --git a/paper/benchmark/attic/benchmark_cpu.R b/paper/benchmark/attic/benchmark_cpu.R new file mode 100644 index 000000000..70b8360e9 --- /dev/null +++ b/paper/benchmark/attic/benchmark_cpu.R @@ -0,0 +1,166 @@ +library(batchtools) +library(mlr3misc) + +reg = makeExperimentRegistry( + file.dir = here::here("paper", "benchmark", "registry_cpu"), + packages = "checkmate" +) +reg$cluster.functions = makeClusterFunctionsInteractive() + +source(here::here("paper/benchmark/time_rtorch.R")) + +batchExport(list( + time_rtorch = time_rtorch +)) + +# The algorithm should return the total runtime needed for training, the SD, but also the performance of the training losses so we know it is all working +addProblem("runtime_train", + data = NULL, + fun = function(epochs, batch_size, n_layers, latent, n, p, optimizer, device, ...) { + problem = list( + epochs = assert_int(epochs), + batch_size = assert_int(batch_size), + n_layers = assert_int(n_layers), + latent = assert_int(latent), + n = assert_int(n), + p = assert_int(p), + optimizer = assert_choice(optimizer, c("ignite_adamw", "adamw", "sgd", "ignite_sgd")), + device = assert_choice(device, c("cuda", "cpu")) + ) + + problem + } +) + +# pytorch needs to be submitted with an active pytorch environment +addAlgorithm("pytorch", + fun = function(instance, job, data, jit, ...) { + f = function(...) { + library(reticulate) + x = try({ + reticulate::use_python("/usr/bin/python3", required = TRUE) + reticulate::source_python(here::here("paper/benchmark/time_pytorch.py")) + print(reticulate::py_config()) + time_pytorch(...) + }, silent = TRUE) + print(x) + + } + args = c(instance, list(seed = job$seed, jit = jit)) + #do.call(f, args) + callr::r(f, args = args) + } +) + +addAlgorithm("rtorch", + fun = function(instance, job, opt_type, jit,...) { + assert_choice(opt_type, c("standard", "ignite")) + if (opt_type == "ignite") { + instance$optimizer = paste0("ignite_", instance$optimizer) + } + #do.call(time_rtorch, args = c(instance, list(seed = job$seed, jit = jit))) + callr::r(time_rtorch, args = c(instance, list(seed = job$seed, jit = jit))) + } +) + +addAlgorithm("mlr3torch", + fun = function(instance, job, opt_type, jit, ...) { + if (opt_type == "ignite") { + instance$optimizer = paste0("ignite_", instance$optimizer) + } + do.call(time_rtorch, args = c(instance, list(seed = job$seed, mlr3torch = TRUE, jit = jit))) + #callr::r(time_rtorch, args = c(instance, list(seed = job$seed, mlr3torch = TRUE, jit = jit))) + } +) + +# global config: +REPLS = 4L +EPOCHS = 20L +N = 2000L +P = 1000L + +# cuda experiments: + + +problem_design = expand.grid(list( + n = N, + p = P, + epochs = EPOCHS, + latent = c(1000, 2500, 5000), + optimizer = c("sgd", "adamw"), + batch_size = 32L, + device = "cuda", + n_layers = c(2L, 4L, 6L, 8L, 10L, 12L, 14L, 16L) +), stringsAsFactors = FALSE) + + +addExperiments( + prob.designs = list( + runtime_train = problem_design + ), + algo.designs = list( + rtorch = data.frame( + jit = c(FALSE, TRUE), + opt_type = c("ignite"), + tag = "cuda_exp" + ), + mlr3torch = data.frame( + jit = c(FALSE, TRUE), + opt_type = c("ignite"), + tag = "cuda_exp" + ), + pytorch = data.frame( + jit = c(FALSE, TRUE), + tag = "cuda_exp" + ) + ), + repls = REPLS +) + +# cpu experiments: +# (need smaller networks, otherwise too expensive with the cuda config) + +problem_design = expand.grid(list( + n = N, + p = P, + epochs = EPOCHS, + # factor 10 smaller than cuda + latent = c(50, 100, 200), + optimizer = c("sgd", "adamw"), + batch_size = 32L, + device = "cpu", + n_layers = c(2L, 4L, 6L, 8L, 10L, 12L, 14L, 16L) +), stringsAsFactors = FALSE) + +addExperiments( + prob.designs = list( + runtime_train = problem_design + ), + algo.designs = list( + rtorch = data.frame( + jit = c(FALSE, TRUE), + opt_type = c("ignite"), + tag = "cpu_exp" + ), + mlr3torch = data.frame( + jit = c(FALSE, TRUE), + opt_type = c("ignite"), + tag = "cpu_exp" + ), + pytorch = data.frame( + jit = c(FALSE, TRUE), + tag = "cpu_exp" + ) + ), + repls = REPLS +) + +ids = sample(findJobs()[[1L]]) +tbl = unwrap(getJobTable()) +ids = tbl[device == "cpu" & n_layers == 10 & latent == 200 & jit & optimizer == "adamw" & repl == 1, ]$job.id +# there is a bug in batchtools that sorts the IDs +# when submitting them together +for (id in sample(ids)) { + submitJobs(id) + Sys.sleep(0.1) +} diff --git a/paper/benchmark/attic/mlr3torch.html b/paper/benchmark/attic/mlr3torch.html new file mode 100644 index 000000000..50133f75d --- /dev/null +++ b/paper/benchmark/attic/mlr3torch.html @@ -0,0 +1,4637 @@ + + + + +profvis + + + + + + + + + + + + + +
+
+
+ + + + diff --git a/paper/benchmark/attic/mlr3torch_files/d3-3.5.6/LICENSE b/paper/benchmark/attic/mlr3torch_files/d3-3.5.6/LICENSE new file mode 100644 index 000000000..f27c7e670 --- /dev/null +++ b/paper/benchmark/attic/mlr3torch_files/d3-3.5.6/LICENSE @@ -0,0 +1,26 @@ +Copyright (c) 2010-2015, Michael Bostock +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 Michael Bostock 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 MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/paper/benchmark/attic/mlr3torch_files/d3-3.5.6/d3.min.js b/paper/benchmark/attic/mlr3torch_files/d3-3.5.6/d3.min.js new file mode 100644 index 000000000..1984d1723 --- /dev/null +++ b/paper/benchmark/attic/mlr3torch_files/d3-3.5.6/d3.min.js @@ -0,0 +1,5 @@ +!function(){function n(n){return n&&(n.ownerDocument||n.document||n).documentElement}function t(n){return n&&(n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView)}function e(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function r(n){return null===n?0/0:+n}function u(n){return!isNaN(n)}function i(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function o(n){return n.length}function a(n){for(var t=1;n*t%1;)t*=10;return t}function c(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function l(){this._=Object.create(null)}function s(n){return(n+="")===pa||n[0]===va?va+n:n}function f(n){return(n+="")[0]===va?n.slice(1):n}function h(n){return s(n)in this._}function g(n){return(n=s(n))in this._&&delete this._[n]}function p(){var n=[];for(var t in this._)n.push(f(t));return n}function v(){var n=0;for(var t in this._)++n;return n}function d(){for(var n in this._)return!1;return!0}function m(){this._=Object.create(null)}function y(n){return n}function M(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function x(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=da.length;r>e;++e){var u=da[e]+t;if(u in n)return u}}function b(){}function _(){}function w(n){function t(){for(var t,r=e,u=-1,i=r.length;++ue;e++)for(var u,i=n[e],o=0,a=i.length;a>o;o++)(u=i[o])&&t(u,o,e);return n}function Z(n){return ya(n,Sa),n}function V(n){var t,e;return function(r,u,i){var o,a=n[i].update,c=a.length;for(i!=e&&(e=i,t=0),u>=t&&(t=u+1);!(o=a[t])&&++t0&&(n=n.slice(0,a));var l=ka.get(n);return l&&(n=l,c=B),a?t?u:r:t?b:i}function $(n,t){return function(e){var r=ta.event;ta.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{ta.event=r}}}function B(n,t){var e=$(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function W(e){var r=".dragsuppress-"+ ++Aa,u="click"+r,i=ta.select(t(e)).on("touchmove"+r,S).on("dragstart"+r,S).on("selectstart"+r,S);if(null==Ea&&(Ea="onselectstart"in e?!1:x(e.style,"userSelect")),Ea){var o=n(e).style,a=o[Ea];o[Ea]="none"}return function(n){if(i.on(r,null),Ea&&(o[Ea]=a),n){var t=function(){i.on(u,null)};i.on(u,function(){S(),t()},!0),setTimeout(t,0)}}}function J(n,e){e.changedTouches&&(e=e.changedTouches[0]);var r=n.ownerSVGElement||n;if(r.createSVGPoint){var u=r.createSVGPoint();if(0>Na){var i=t(n);if(i.scrollX||i.scrollY){r=ta.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Na=!(o.f||o.e),r.remove()}}return Na?(u.x=e.pageX,u.y=e.pageY):(u.x=e.clientX,u.y=e.clientY),u=u.matrixTransform(n.getScreenCTM().inverse()),[u.x,u.y]}var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}function G(){return ta.event.changedTouches[0].identifier}function K(n){return n>0?1:0>n?-1:0}function Q(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function nt(n){return n>1?0:-1>n?qa:Math.acos(n)}function tt(n){return n>1?Ra:-1>n?-Ra:Math.asin(n)}function et(n){return((n=Math.exp(n))-1/n)/2}function rt(n){return((n=Math.exp(n))+1/n)/2}function ut(n){return((n=Math.exp(2*n))-1)/(n+1)}function it(n){return(n=Math.sin(n/2))*n}function ot(){}function at(n,t,e){return this instanceof at?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof at?new at(n.h,n.s,n.l):bt(""+n,_t,at):new at(n,t,e)}function ct(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(o-i)*n/60:180>n?o:240>n?i+(o-i)*(240-n)/60:i}function u(n){return Math.round(255*r(n))}var i,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,i=2*e-o,new mt(u(n+120),u(n),u(n-120))}function lt(n,t,e){return this instanceof lt?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof lt?new lt(n.h,n.c,n.l):n instanceof ft?gt(n.l,n.a,n.b):gt((n=wt((n=ta.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new lt(n,t,e)}function st(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new ft(e,Math.cos(n*=Da)*t,Math.sin(n)*t)}function ft(n,t,e){return this instanceof ft?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof ft?new ft(n.l,n.a,n.b):n instanceof lt?st(n.h,n.c,n.l):wt((n=mt(n)).r,n.g,n.b):new ft(n,t,e)}function ht(n,t,e){var r=(n+16)/116,u=r+t/500,i=r-e/200;return u=pt(u)*Xa,r=pt(r)*$a,i=pt(i)*Ba,new mt(dt(3.2404542*u-1.5371385*r-.4985314*i),dt(-.969266*u+1.8760108*r+.041556*i),dt(.0556434*u-.2040259*r+1.0572252*i))}function gt(n,t,e){return n>0?new lt(Math.atan2(e,t)*Pa,Math.sqrt(t*t+e*e),n):new lt(0/0,0/0,n)}function pt(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function vt(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function dt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function mt(n,t,e){return this instanceof mt?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof mt?new mt(n.r,n.g,n.b):bt(""+n,mt,ct):new mt(n,t,e)}function yt(n){return new mt(n>>16,n>>8&255,255&n)}function Mt(n){return yt(n)+""}function xt(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function bt(n,t,e){var r,u,i,o=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(u=r[2].split(","),r[1]){case"hsl":return e(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(kt(u[0]),kt(u[1]),kt(u[2]))}return(i=Ga.get(n))?t(i.r,i.g,i.b):(null==n||"#"!==n.charAt(0)||isNaN(i=parseInt(n.slice(1),16))||(4===n.length?(o=(3840&i)>>4,o=o>>4|o,a=240&i,a=a>>4|a,c=15&i,c=c<<4|c):7===n.length&&(o=(16711680&i)>>16,a=(65280&i)>>8,c=255&i)),t(o,a,c))}function _t(n,t,e){var r,u,i=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-i,c=(o+i)/2;return a?(u=.5>c?a/(o+i):a/(2-o-i),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=0/0,u=c>0&&1>c?0:r),new at(r,u,c)}function wt(n,t,e){n=St(n),t=St(t),e=St(e);var r=vt((.4124564*n+.3575761*t+.1804375*e)/Xa),u=vt((.2126729*n+.7151522*t+.072175*e)/$a),i=vt((.0193339*n+.119192*t+.9503041*e)/Ba);return ft(116*u-16,500*(r-u),200*(u-i))}function St(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function kt(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function Et(n){return"function"==typeof n?n:function(){return n}}function At(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Nt(t,e,n,r)}}function Nt(n,t,e,r){function u(){var n,t=c.status;if(!t&&zt(c)||t>=200&&300>t||304===t){try{n=e.call(i,c)}catch(r){return void o.error.call(i,r)}o.load.call(i,n)}else o.error.call(i,c)}var i={},o=ta.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,l=null;return!this.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=u:c.onreadystatechange=function(){c.readyState>3&&u()},c.onprogress=function(n){var t=ta.event;ta.event=n;try{o.progress.call(i,c)}finally{ta.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.responseType=function(n){return arguments.length?(l=n,i):l},i.response=function(n){return e=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(ra(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var s in a)c.setRequestHeader(s,a[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),o.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},ta.rebind(i,o,"on"),null==r?i:i.get(Ct(r))}function Ct(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function zt(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function qt(){var n=Lt(),t=Tt()-n;t>24?(isFinite(t)&&(clearTimeout(tc),tc=setTimeout(qt,t)),nc=0):(nc=1,rc(qt))}function Lt(){var n=Date.now();for(ec=Ka;ec;)n>=ec.t&&(ec.f=ec.c(n-ec.t)),ec=ec.n;return n}function Tt(){for(var n,t=Ka,e=1/0;t;)t.f?t=n?n.n=t.n:Ka=t.n:(t.t8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Pt(n){var t=n.decimal,e=n.thousands,r=n.grouping,u=n.currency,i=r&&e?function(n,t){for(var u=n.length,i=[],o=0,a=r[0],c=0;u>0&&a>0&&(c+a+1>t&&(a=Math.max(1,t-c)),i.push(n.substring(u-=a,u+a)),!((c+=a+1)>t));)a=r[o=(o+1)%r.length];return i.reverse().join(e)}:y;return function(n){var e=ic.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"-",c=e[4]||"",l=e[5],s=+e[6],f=e[7],h=e[8],g=e[9],p=1,v="",d="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(l||"0"===r&&"="===o)&&(l=r="0",o="="),g){case"n":f=!0,g="g";break;case"%":p=100,d="%",g="f";break;case"p":p=100,d="%",g="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+g.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,g="r"}"$"===c&&(v=u[0],d=u[1]),"r"!=g||h||(g="g"),null!=h&&("g"==g?h=Math.max(1,Math.min(21,h)):("e"==g||"f"==g)&&(h=Math.max(0,Math.min(20,h)))),g=oc.get(g)||Ut;var M=l&&f;return function(n){var e=d;if(m&&n%1)return"";var u=0>n||0===n&&0>1/n?(n=-n,"-"):"-"===a?"":a;if(0>p){var c=ta.formatPrefix(n,h);n=c.scale(n),e=c.symbol+d}else n*=p;n=g(n,h);var x,b,_=n.lastIndexOf(".");if(0>_){var w=y?n.lastIndexOf("e"):-1;0>w?(x=n,b=""):(x=n.substring(0,w),b=n.substring(w))}else x=n.substring(0,_),b=t+n.substring(_+1);!l&&f&&(x=i(x,1/0));var S=v.length+x.length+b.length+(M?0:u.length),k=s>S?new Array(S=s-S+1).join(r):"";return M&&(x=i(k+x,k.length?s-b.length:1/0)),u+=v,n=x+b,("<"===o?u+n+k:">"===o?k+u+n:"^"===o?k.substring(0,S>>=1)+u+n+k.substring(S):u+(M?n:k+n))+e}}}function Ut(n){return n+""}function jt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ft(n,t,e){function r(t){var e=n(t),r=i(e,1);return r-t>t-e?e:r}function u(e){return t(e=n(new cc(e-1)),1),e}function i(n,e){return t(n=new cc(+n),e),n}function o(n,r,i){var o=u(n),a=[];if(i>1)for(;r>o;)e(o)%i||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{cc=jt;var r=new jt;return r._=n,o(r,t,e)}finally{cc=Date}}n.floor=n,n.round=r,n.ceil=u,n.offset=i,n.range=o;var c=n.utc=Ht(n);return c.floor=c,c.round=Ht(r),c.ceil=Ht(u),c.offset=Ht(i),c.range=a,n}function Ht(n){return function(t,e){try{cc=jt;var r=new jt;return r._=t,n(r,e)._}finally{cc=Date}}}function Ot(n){function t(n){function t(t){for(var e,u,i,o=[],a=-1,c=0;++aa;){if(r>=l)return-1;if(u=t.charCodeAt(a++),37===u){if(o=t.charAt(a++),i=C[o in sc?t.charAt(a++):o],!i||(r=i(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){x.lastIndex=0;var r=x.exec(t.slice(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){E.lastIndex=0;var r=E.exec(t.slice(e));return r?(n.m=A.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,N.c.toString(),t,r)}function c(n,t,r){return e(n,N.x.toString(),t,r)}function l(n,t,r){return e(n,N.X.toString(),t,r)}function s(n,t,e){var r=M.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{cc=jt;var t=new cc;return t._=n,r(t)}finally{cc=Date}}var r=t(n);return e.parse=function(n){try{cc=jt;var t=r.parse(n);return t&&t._}finally{cc=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ae;var M=ta.map(),x=Yt(v),b=Zt(v),_=Yt(d),w=Zt(d),S=Yt(m),k=Zt(m),E=Yt(y),A=Zt(y);p.forEach(function(n,t){M.set(n.toLowerCase(),t)});var N={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return It(n.getDate(),t,2)},e:function(n,t){return It(n.getDate(),t,2)},H:function(n,t){return It(n.getHours(),t,2)},I:function(n,t){return It(n.getHours()%12||12,t,2)},j:function(n,t){return It(1+ac.dayOfYear(n),t,3)},L:function(n,t){return It(n.getMilliseconds(),t,3)},m:function(n,t){return It(n.getMonth()+1,t,2)},M:function(n,t){return It(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return It(n.getSeconds(),t,2)},U:function(n,t){return It(ac.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return It(ac.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return It(n.getFullYear()%100,t,2)},Y:function(n,t){return It(n.getFullYear()%1e4,t,4)},Z:ie,"%":function(){return"%"}},C={a:r,A:u,b:i,B:o,c:a,d:Qt,e:Qt,H:te,I:te,j:ne,L:ue,m:Kt,M:ee,p:s,S:re,U:Xt,w:Vt,W:$t,x:c,X:l,y:Wt,Y:Bt,Z:Jt,"%":oe};return t}function It(n,t,e){var r=0>n?"-":"",u=(r?-n:n)+"",i=u.length;return r+(e>i?new Array(e-i+1).join(t)+u:u)}function Yt(n){return new RegExp("^(?:"+n.map(ta.requote).join("|")+")","i")}function Zt(n){for(var t=new l,e=-1,r=n.length;++e68?1900:2e3)}function Kt(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function Qt(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function ne(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function te(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function ee(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function re(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ue(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function ie(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=ga(t)/60|0,u=ga(t)%60;return e+It(r,"0",2)+It(u,"0",2)}function oe(n,t,e){hc.lastIndex=0;var r=hc.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ae(n){for(var t=n.length,e=-1;++e=0?1:-1,a=o*e,c=Math.cos(t),l=Math.sin(t),s=i*l,f=u*c+s*Math.cos(a),h=s*o*Math.sin(a);yc.add(Math.atan2(h,f)),r=n,u=c,i=l}var t,e,r,u,i;Mc.point=function(o,a){Mc.point=n,r=(t=o)*Da,u=Math.cos(a=(e=a)*Da/2+qa/4),i=Math.sin(a)},Mc.lineEnd=function(){n(t,e)}}function pe(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function ve(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function de(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function me(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function ye(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function Me(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function xe(n){return[Math.atan2(n[1],n[0]),tt(n[2])]}function be(n,t){return ga(n[0]-t[0])a;++a)u.point((e=n[a])[0],e[1]);return void u.lineEnd()}var c=new qe(e,n,null,!0),l=new qe(e,null,c,!1);c.o=l,i.push(c),o.push(l),c=new qe(r,n,null,!1),l=new qe(r,null,c,!0),c.o=l,i.push(c),o.push(l)}}),o.sort(t),ze(i),ze(o),i.length){for(var a=0,c=e,l=o.length;l>a;++a)o[a].e=c=!c;for(var s,f,h=i[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;s=g.z,u.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var a=0,l=s.length;l>a;++a)u.point((f=s[a])[0],f[1]);else r(g.x,g.n.x,1,u);g=g.n}else{if(p){s=g.p.z;for(var a=s.length-1;a>=0;--a)u.point((f=s[a])[0],f[1])}else r(g.x,g.p.x,-1,u);g=g.p}g=g.o,s=g.z,p=!p}while(!g.v);u.lineEnd()}}}function ze(n){if(t=n.length){for(var t,e,r=0,u=n[0];++r0){for(b||(i.polygonStart(),b=!0),i.lineStart();++o1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Te))}var g,p,v,d=t(i),m=u.invert(r[0],r[1]),y={point:o,lineStart:c,lineEnd:l,polygonStart:function(){y.point=s,y.lineStart=f,y.lineEnd=h,g=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=c,y.lineEnd=l,g=ta.merge(g);var n=Fe(m,p);g.length?(b||(i.polygonStart(),b=!0),Ce(g,De,n,e,i)):n&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),g=p=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},M=Re(),x=t(M),b=!1;return y}}function Te(n){return n.length>1}function Re(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:b,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function De(n,t){return((n=n.x)[0]<0?n[1]-Ra-Ca:Ra-n[1])-((t=t.x)[0]<0?t[1]-Ra-Ca:Ra-t[1])}function Pe(n){var t,e=0/0,r=0/0,u=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(i,o){var a=i>0?qa:-qa,c=ga(i-e);ga(c-qa)0?Ra:-Ra),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(i,r),t=0):u!==a&&c>=qa&&(ga(e-u)Ca?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(t))*Math.sin(n))/(u*i*o)):(t+r)/2}function je(n,t,e,r){var u;if(null==n)u=e*Ra,r.point(-qa,u),r.point(0,u),r.point(qa,u),r.point(qa,0),r.point(qa,-u),r.point(0,-u),r.point(-qa,-u),r.point(-qa,0),r.point(-qa,u);else if(ga(n[0]-t[0])>Ca){var i=n[0]a;++a){var l=t[a],s=l.length;if(s)for(var f=l[0],h=f[0],g=f[1]/2+qa/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===s&&(d=0),n=l[d];var m=n[0],y=n[1]/2+qa/4,M=Math.sin(y),x=Math.cos(y),b=m-h,_=b>=0?1:-1,w=_*b,S=w>qa,k=p*M;if(yc.add(Math.atan2(k*_*Math.sin(w),v*x+k*Math.cos(w))),i+=S?b+_*La:b,S^h>=e^m>=e){var E=de(pe(f),pe(n));Me(E);var A=de(u,E);Me(A);var N=(S^b>=0?-1:1)*tt(A[2]);(r>N||r===N&&(E[0]||E[1]))&&(o+=S^b>=0?1:-1)}if(!d++)break;h=m,p=M,v=x,f=n}}return(-Ca>i||Ca>i&&0>yc)^1&o}function He(n){function t(n,t){return Math.cos(n)*Math.cos(t)>i}function e(n){var e,i,c,l,s;return{lineStart:function(){l=c=!1,s=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=o?v?0:u(f,h):v?u(f+(0>f?qa:-qa),h):0;if(!e&&(l=c=v)&&n.lineStart(),v!==c&&(g=r(e,p),(be(e,g)||be(p,g))&&(p[0]+=Ca,p[1]+=Ca,v=t(p[0],p[1]))),v!==c)s=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(a&&e&&o^v){var m;d&i||!(m=r(p,e,!0))||(s=0,o?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&be(e,p)||n.point(p[0],p[1]),e=p,c=v,i=d},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return s|(l&&c)<<1}}}function r(n,t,e){var r=pe(n),u=pe(t),o=[1,0,0],a=de(r,u),c=ve(a,a),l=a[0],s=c-l*l;if(!s)return!e&&n;var f=i*c/s,h=-i*l/s,g=de(o,a),p=ye(o,f),v=ye(a,h);me(p,v);var d=g,m=ve(p,d),y=ve(d,d),M=m*m-y*(ve(p,p)-1);if(!(0>M)){var x=Math.sqrt(M),b=ye(d,(-m-x)/y);if(me(b,p),b=xe(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],E=t[1];w>S&&(_=w,w=S,S=_);var A=S-w,N=ga(A-qa)A;if(!N&&k>E&&(_=k,k=E,E=_),C?N?k+E>0^b[1]<(ga(b[0]-w)qa^(w<=b[0]&&b[0]<=S)){var z=ye(d,(-m+x)/y);return me(z,p),[b,xe(z)]}}}function u(t,e){var r=o?n:qa-n,u=0;return-r>t?u|=1:t>r&&(u|=2),-r>e?u|=4:e>r&&(u|=8),u}var i=Math.cos(n),o=i>0,a=ga(i)>Ca,c=gr(n,6*Da);return Le(t,e,c,o?[0,-n]:[-qa,n-qa])}function Oe(n,t,e,r){return function(u){var i,o=u.a,a=u.b,c=o.x,l=o.y,s=a.x,f=a.y,h=0,g=1,p=s-c,v=f-l;if(i=n-c,p||!(i>0)){if(i/=p,0>p){if(h>i)return;g>i&&(g=i)}else if(p>0){if(i>g)return;i>h&&(h=i)}if(i=e-c,p||!(0>i)){if(i/=p,0>p){if(i>g)return;i>h&&(h=i)}else if(p>0){if(h>i)return;g>i&&(g=i)}if(i=t-l,v||!(i>0)){if(i/=v,0>v){if(h>i)return;g>i&&(g=i)}else if(v>0){if(i>g)return;i>h&&(h=i)}if(i=r-l,v||!(0>i)){if(i/=v,0>v){if(i>g)return;i>h&&(h=i)}else if(v>0){if(h>i)return;g>i&&(g=i)}return h>0&&(u.a={x:c+h*p,y:l+h*v}),1>g&&(u.b={x:c+g*p,y:l+g*v}),u}}}}}}function Ie(n,t,e,r){function u(r,u){return ga(r[0]-n)0?0:3:ga(r[0]-e)0?2:1:ga(r[1]-t)0?1:0:u>0?3:2}function i(n,t){return o(n.x,t.x)}function o(n,t){var e=u(n,1),r=u(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=d.length,r=n[1],u=0;e>u;++u)for(var i,o=1,a=d[u],c=a.length,l=a[0];c>o;++o)i=a[o],l[1]<=r?i[1]>r&&Q(l,i,n)>0&&++t:i[1]<=r&&Q(l,i,n)<0&&--t,l=i;return 0!==t}function l(i,a,c,l){var s=0,f=0;if(null==i||(s=u(i,c))!==(f=u(a,c))||o(i,a)<0^c>0){do l.point(0===s||3===s?n:e,s>1?r:t);while((s=(s+c+4)%4)!==f)}else l.point(a[0],a[1])}function s(u,i){return u>=n&&e>=u&&i>=t&&r>=i}function f(n,t){s(n,t)&&a.point(n,t)}function h(){C.point=p,d&&d.push(m=[]),S=!0,w=!1,b=_=0/0}function g(){v&&(p(y,M),x&&w&&A.rejoin(),v.push(A.buffer())),C.point=f,w&&a.lineEnd()}function p(n,t){n=Math.max(-Tc,Math.min(Tc,n)),t=Math.max(-Tc,Math.min(Tc,t));var e=s(n,t);if(d&&m.push([n,t]),S)y=n,M=t,x=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};N(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,m,y,M,x,b,_,w,S,k,E=a,A=Re(),N=Oe(n,t,e,r),C={point:f,lineStart:h,lineEnd:g,polygonStart:function(){a=A,v=[],d=[],k=!0},polygonEnd:function(){a=E,v=ta.merge(v);var t=c([n,r]),e=k&&t,u=v.length;(e||u)&&(a.polygonStart(),e&&(a.lineStart(),l(null,null,1,a),a.lineEnd()),u&&Ce(v,i,t,l,a),a.polygonEnd()),v=d=m=null}};return C}}function Ye(n){var t=0,e=qa/3,r=ir(n),u=r(t,e);return u.parallels=function(n){return arguments.length?r(t=n[0]*qa/180,e=n[1]*qa/180):[t/qa*180,e/qa*180]},u}function Ze(n,t){function e(n,t){var e=Math.sqrt(i-2*u*Math.sin(t))/u;return[e*Math.sin(n*=u),o-e*Math.cos(n)]}var r=Math.sin(n),u=(r+Math.sin(t))/2,i=1+r*(2*u-r),o=Math.sqrt(i)/u;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/u,tt((i-(n*n+e*e)*u*u)/(2*u))]},e}function Ve(){function n(n,t){Dc+=u*n-r*t,r=n,u=t}var t,e,r,u;Hc.point=function(i,o){Hc.point=n,t=r=i,e=u=o},Hc.lineEnd=function(){n(t,e)}}function Xe(n,t){Pc>n&&(Pc=n),n>jc&&(jc=n),Uc>t&&(Uc=t),t>Fc&&(Fc=t)}function $e(){function n(n,t){o.push("M",n,",",t,i)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function u(){o.push("Z")}var i=Be(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return i=Be(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function Be(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function We(n,t){_c+=n,wc+=t,++Sc}function Je(){function n(n,r){var u=n-t,i=r-e,o=Math.sqrt(u*u+i*i);kc+=o*(t+n)/2,Ec+=o*(e+r)/2,Ac+=o,We(t=n,e=r)}var t,e;Ic.point=function(r,u){Ic.point=n,We(t=r,e=u)}}function Ge(){Ic.point=We}function Ke(){function n(n,t){var e=n-r,i=t-u,o=Math.sqrt(e*e+i*i);kc+=o*(r+n)/2,Ec+=o*(u+t)/2,Ac+=o,o=u*n-r*t,Nc+=o*(r+n),Cc+=o*(u+t),zc+=3*o,We(r=n,u=t)}var t,e,r,u;Ic.point=function(i,o){Ic.point=n,We(t=r=i,e=u=o)},Ic.lineEnd=function(){n(t,e)}}function Qe(n){function t(t,e){n.moveTo(t+o,e),n.arc(t,e,o,0,La)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function u(){a.point=t}function i(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:u,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=u,a.point=t},pointRadius:function(n){return o=n,a},result:b};return a}function nr(n){function t(n){return(a?r:e)(n)}function e(t){return rr(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){M=0/0,S.point=i,t.lineStart()}function i(e,r){var i=pe([e,r]),o=n(e,r);u(M,x,y,b,_,w,M=o[0],x=o[1],y=e,b=i[0],_=i[1],w=i[2],a,t),t.point(M,x)}function o(){S.point=e,t.lineEnd()}function c(){r(),S.point=l,S.lineEnd=s}function l(n,t){i(f=n,h=t),g=M,p=x,v=b,d=_,m=w,S.point=i}function s(){u(M,x,y,b,_,w,g,p,f,v,d,m,a,t),S.lineEnd=o,o()}var f,h,g,p,v,d,m,y,M,x,b,_,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=c +},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function u(t,e,r,a,c,l,s,f,h,g,p,v,d,m){var y=s-t,M=f-e,x=y*y+M*M;if(x>4*i&&d--){var b=a+g,_=c+p,w=l+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),E=ga(ga(w)-1)i||ga((y*z+M*q)/x-.5)>.3||o>a*g+c*p+l*v)&&(u(t,e,r,a,c,l,N,C,E,b/=S,_/=S,w,d,m),m.point(N,C),u(N,C,E,b,_,w,s,f,h,g,p,v,d,m))}}var i=.5,o=Math.cos(30*Da),a=16;return t.precision=function(n){return arguments.length?(a=(i=n*n)>0&&16,t):Math.sqrt(i)},t}function tr(n){var t=nr(function(t,e){return n([t*Pa,e*Pa])});return function(n){return or(t(n))}}function er(n){this.stream=n}function rr(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ur(n){return ir(function(){return n})()}function ir(n){function t(n){return n=a(n[0]*Da,n[1]*Da),[n[0]*h+c,l-n[1]*h]}function e(n){return n=a.invert((n[0]-c)/h,(l-n[1])/h),n&&[n[0]*Pa,n[1]*Pa]}function r(){a=Ae(o=lr(m,M,x),i);var n=i(v,d);return c=g-n[0]*h,l=p+n[1]*h,u()}function u(){return s&&(s.valid=!1,s=null),t}var i,o,a,c,l,s,f=nr(function(n,t){return n=i(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,M=0,x=0,b=Lc,_=y,w=null,S=null;return t.stream=function(n){return s&&(s.valid=!1),s=or(b(o,f(_(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(b=null==n?(w=n,Lc):He((w=+n)*Da),u()):w},t.clipExtent=function(n){return arguments.length?(S=n,_=n?Ie(n[0][0],n[0][1],n[1][0],n[1][1]):y,u()):S},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*Da,d=n[1]%360*Da,r()):[v*Pa,d*Pa]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Da,M=n[1]%360*Da,x=n.length>2?n[2]%360*Da:0,r()):[m*Pa,M*Pa,x*Pa]},ta.rebind(t,f,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function or(n){return rr(n,function(t,e){n.point(t*Da,e*Da)})}function ar(n,t){return[n,t]}function cr(n,t){return[n>qa?n-La:-qa>n?n+La:n,t]}function lr(n,t,e){return n?t||e?Ae(fr(n),hr(t,e)):fr(n):t||e?hr(t,e):cr}function sr(n){return function(t,e){return t+=n,[t>qa?t-La:-qa>t?t+La:t,e]}}function fr(n){var t=sr(n);return t.invert=sr(-n),t}function hr(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+a*u;return[Math.atan2(c*i-s*o,a*r-l*u),tt(s*i+c*o)]}var r=Math.cos(n),u=Math.sin(n),i=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*i-c*o;return[Math.atan2(c*i+l*o,a*r+s*u),tt(s*r-a*u)]},e}function gr(n,t){var e=Math.cos(n),r=Math.sin(n);return function(u,i,o,a){var c=o*t;null!=u?(u=pr(e,u),i=pr(e,i),(o>0?i>u:u>i)&&(u+=o*La)):(u=n+o*La,i=n-.5*c);for(var l,s=u;o>0?s>i:i>s;s-=c)a.point((l=xe([e,-r*Math.cos(s),-r*Math.sin(s)]))[0],l[1])}}function pr(n,t){var e=pe(t);e[0]-=n,Me(e);var r=nt(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Ca)%(2*Math.PI)}function vr(n,t,e){var r=ta.range(n,t-Ca,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function dr(n,t,e){var r=ta.range(n,t-Ca,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function mr(n){return n.source}function yr(n){return n.target}function Mr(n,t,e,r){var u=Math.cos(t),i=Math.sin(t),o=Math.cos(r),a=Math.sin(r),c=u*Math.cos(n),l=u*Math.sin(n),s=o*Math.cos(e),f=o*Math.sin(e),h=2*Math.asin(Math.sqrt(it(r-t)+u*o*it(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*s,u=e*l+t*f,o=e*i+t*a;return[Math.atan2(u,r)*Pa,Math.atan2(o,Math.sqrt(r*r+u*u))*Pa]}:function(){return[n*Pa,t*Pa]};return p.distance=h,p}function xr(){function n(n,u){var i=Math.sin(u*=Da),o=Math.cos(u),a=ga((n*=Da)-t),c=Math.cos(a);Yc+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*i-e*o*c)*a),e*i+r*o*c),t=n,e=i,r=o}var t,e,r;Zc.point=function(u,i){t=u*Da,e=Math.sin(i*=Da),r=Math.cos(i),Zc.point=n},Zc.lineEnd=function(){Zc.point=Zc.lineEnd=b}}function br(n,t){function e(t,e){var r=Math.cos(t),u=Math.cos(e),i=n(r*u);return[i*u*Math.sin(t),i*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),u=t(r),i=Math.sin(u),o=Math.cos(u);return[Math.atan2(n*i,r*o),Math.asin(r&&e*i/r)]},e}function _r(n,t){function e(n,t){o>0?-Ra+Ca>t&&(t=-Ra+Ca):t>Ra-Ca&&(t=Ra-Ca);var e=o/Math.pow(u(t),i);return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),u=function(n){return Math.tan(qa/4+n/2)},i=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(u(t)/u(n)),o=r*Math.pow(u(n),i)/i;return i?(e.invert=function(n,t){var e=o-t,r=K(i)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/i,2*Math.atan(Math.pow(o/r,1/i))-Ra]},e):Sr}function wr(n,t){function e(n,t){var e=i-t;return[e*Math.sin(u*n),i-e*Math.cos(u*n)]}var r=Math.cos(n),u=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),i=r/u+n;return ga(u)u;u++){for(;r>1&&Q(n[e[r-2]],n[e[r-1]],n[u])<=0;)--r;e[r++]=u}return e.slice(0,r)}function zr(n,t){return n[0]-t[0]||n[1]-t[1]}function qr(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Lr(n,t,e,r){var u=n[0],i=e[0],o=t[0]-u,a=r[0]-i,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(u-i))/(f*o-a*s);return[u+h*o,c+h*s]}function Tr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Rr(){tu(this),this.edge=this.site=this.circle=null}function Dr(n){var t=el.pop()||new Rr;return t.site=n,t}function Pr(n){Xr(n),Qc.remove(n),el.push(n),tu(n)}function Ur(n){var t=n.circle,e=t.x,r=t.cy,u={x:e,y:r},i=n.P,o=n.N,a=[n];Pr(n);for(var c=i;c.circle&&ga(e-c.circle.x)s;++s)l=a[s],c=a[s-1],Kr(l.edge,c.site,l.site,u);c=a[0],l=a[f-1],l.edge=Jr(c.site,l.site,null,u),Vr(c),Vr(l)}function jr(n){for(var t,e,r,u,i=n.x,o=n.y,a=Qc._;a;)if(r=Fr(a,o)-i,r>Ca)a=a.L;else{if(u=i-Hr(a,o),!(u>Ca)){r>-Ca?(t=a.P,e=a):u>-Ca?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Dr(n);if(Qc.insert(t,c),t||e){if(t===e)return Xr(t),e=Dr(t.site),Qc.insert(c,e),c.edge=e.edge=Jr(t.site,c.site),Vr(t),void Vr(e);if(!e)return void(c.edge=Jr(t.site,c.site));Xr(t),Xr(e);var l=t.site,s=l.x,f=l.y,h=n.x-s,g=n.y-f,p=e.site,v=p.x-s,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,M=v*v+d*d,x={x:(d*y-g*M)/m+s,y:(h*M-v*y)/m+f};Kr(e.edge,l,p,x),c.edge=Jr(l,n,null,x),e.edge=Jr(n,p,null,x),Vr(t),Vr(e)}}function Fr(n,t){var e=n.site,r=e.x,u=e.y,i=u-t;if(!i)return r;var o=n.P;if(!o)return-1/0;e=o.site;var a=e.x,c=e.y,l=c-t;if(!l)return a;var s=a-r,f=1/i-1/l,h=s/l;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*l)-c+l/2+u-i/2)))/f+r:(r+a)/2}function Hr(n,t){var e=n.N;if(e)return Fr(e,t);var r=n.site;return r.y===t?r.x:1/0}function Or(n){this.site=n,this.edges=[]}function Ir(n){for(var t,e,r,u,i,o,a,c,l,s,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=Kc,d=v.length;d--;)if(i=v[d],i&&i.prepare())for(a=i.edges,c=a.length,o=0;c>o;)s=a[o].end(),r=s.x,u=s.y,l=a[++o%c].start(),t=l.x,e=l.y,(ga(r-t)>Ca||ga(u-e)>Ca)&&(a.splice(o,0,new Qr(Gr(i.site,s,ga(r-f)Ca?{x:f,y:ga(t-f)Ca?{x:ga(e-p)Ca?{x:h,y:ga(t-h)Ca?{x:ga(e-g)=-za)){var g=c*c+l*l,p=s*s+f*f,v=(f*g-l*p)/h,d=(c*p-s*g)/h,f=d+a,m=rl.pop()||new Zr;m.arc=n,m.site=u,m.x=v+o,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,M=tl._;M;)if(m.yd||d>=a)return;if(h>p){if(i){if(i.y>=l)return}else i={x:d,y:c};e={x:d,y:l}}else{if(i){if(i.yr||r>1)if(h>p){if(i){if(i.y>=l)return}else i={x:(c-u)/r,y:c};e={x:(l-u)/r,y:l}}else{if(i){if(i.yg){if(i){if(i.x>=a)return}else i={x:o,y:r*o+u};e={x:a,y:r*a+u}}else{if(i){if(i.xi||f>o||r>h||u>g)){if(p=n.point){var p,v=t-n.x,d=e-n.y,m=v*v+d*d;if(c>m){var y=Math.sqrt(c=m);r=t-y,u=e-y,i=t+y,o=e+y,a=p}}for(var M=n.nodes,x=.5*(s+h),b=.5*(f+g),_=t>=x,w=e>=b,S=w<<1|_,k=S+4;k>S;++S)if(n=M[3&S])switch(3&S){case 0:l(n,s,f,x,b);break;case 1:l(n,x,f,h,b);break;case 2:l(n,s,b,x,g);break;case 3:l(n,x,b,h,g)}}}(n,r,u,i,o),a}function gu(n,t){n=ta.rgb(n),t=ta.rgb(t);var e=n.r,r=n.g,u=n.b,i=t.r-e,o=t.g-r,a=t.b-u;return function(n){return"#"+xt(Math.round(e+i*n))+xt(Math.round(r+o*n))+xt(Math.round(u+a*n))}}function pu(n,t){var e,r={},u={};for(e in n)e in t?r[e]=mu(n[e],t[e]):u[e]=n[e];for(e in t)e in n||(u[e]=t[e]);return function(n){for(e in r)u[e]=r[e](n);return u}}function vu(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function du(n,t){var e,r,u,i=il.lastIndex=ol.lastIndex=0,o=-1,a=[],c=[];for(n+="",t+="";(e=il.exec(n))&&(r=ol.exec(t));)(u=r.index)>i&&(u=t.slice(i,u),a[o]?a[o]+=u:a[++o]=u),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:vu(e,r)})),i=ol.lastIndex;return ir;++r)a[(e=c[r]).i]=e.x(n);return a.join("")})}function mu(n,t){for(var e,r=ta.interpolators.length;--r>=0&&!(e=ta.interpolators[r](n,t)););return e}function yu(n,t){var e,r=[],u=[],i=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(mu(n[e],t[e]));for(;i>e;++e)u[e]=n[e];for(;o>e;++e)u[e]=t[e];return function(n){for(e=0;a>e;++e)u[e]=r[e](n);return u}}function Mu(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function xu(n){return function(t){return 1-n(1-t)}}function bu(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function _u(n){return n*n}function wu(n){return n*n*n}function Su(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function ku(n){return function(t){return Math.pow(t,n)}}function Eu(n){return 1-Math.cos(n*Ra)}function Au(n){return Math.pow(2,10*(n-1))}function Nu(n){return 1-Math.sqrt(1-n*n)}function Cu(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/La*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*La/t)}}function zu(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function qu(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Lu(n,t){n=ta.hcl(n),t=ta.hcl(t);var e=n.h,r=n.c,u=n.l,i=t.h-e,o=t.c-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return st(e+i*n,r+o*n,u+a*n)+""}}function Tu(n,t){n=ta.hsl(n),t=ta.hsl(t);var e=n.h,r=n.s,u=n.l,i=t.h-e,o=t.s-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return ct(e+i*n,r+o*n,u+a*n)+""}}function Ru(n,t){n=ta.lab(n),t=ta.lab(t);var e=n.l,r=n.a,u=n.b,i=t.l-e,o=t.a-r,a=t.b-u;return function(n){return ht(e+i*n,r+o*n,u+a*n)+""}}function Du(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Pu(n){var t=[n.a,n.b],e=[n.c,n.d],r=ju(t),u=Uu(t,e),i=ju(Fu(e,t,-u))||0;t[0]*e[1]180?s+=360:s-l>180&&(l+=360),u.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:vu(l,s)})):s&&r.push(r.pop()+"rotate("+s+")"),f!=h?u.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:vu(f,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),u.push({i:e-4,x:vu(g[0],p[0])},{i:e-2,x:vu(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=u.length,function(n){for(var t,i=-1;++i=0;)e.push(u[r])}function Qu(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(i=n.children)&&(u=i.length))for(var u,i,o=-1;++oe;++e)(t=n[e][1])>u&&(r=e,u=t);return r}function si(n){return n.reduce(fi,0)}function fi(n,t){return n+t[1]}function hi(n,t){return gi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function gi(n,t){for(var e=-1,r=+n[0],u=(n[1]-r)/t,i=[];++e<=t;)i[e]=u*e+r;return i}function pi(n){return[ta.min(n),ta.max(n)]}function vi(n,t){return n.value-t.value}function di(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function mi(n,t){n._pack_next=t,t._pack_prev=n}function yi(n,t){var e=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>e*e+r*r}function Mi(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(l=e.length)){var e,r,u,i,o,a,c,l,s=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(xi),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(u=e[1],u.x=u.r,u.y=0,t(u),l>2))for(i=e[2],wi(r,u,i),t(i),di(r,i),r._pack_prev=i,di(i,u),u=r._pack_next,o=3;l>o;o++){wi(r,u,i=e[o]);var p=0,v=1,d=1;for(a=u._pack_next;a!==u;a=a._pack_next,v++)if(yi(a,i)){p=1;break}if(1==p)for(c=r._pack_prev;c!==a._pack_prev&&!yi(c,i);c=c._pack_prev,d++);p?(d>v||v==d&&u.ro;o++)i=e[o],i.x-=m,i.y-=y,M=Math.max(M,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=M,e.forEach(bi)}}function xi(n){n._pack_next=n._pack_prev=n}function bi(n){delete n._pack_next,delete n._pack_prev}function _i(n,t,e,r){var u=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,u)for(var i=-1,o=u.length;++i=0;)t=u[i],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function Ci(n,t,e){return n.a.parent===t.parent?n.a:e}function zi(n){return 1+ta.max(n,function(n){return n.y})}function qi(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Li(n){var t=n.children;return t&&t.length?Li(t[0]):n}function Ti(n){var t,e=n.children;return e&&(t=e.length)?Ti(e[t-1]):n}function Ri(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Di(n,t){var e=n.x+t[3],r=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function Pi(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Ui(n){return n.rangeExtent?n.rangeExtent():Pi(n.range())}function ji(n,t,e,r){var u=e(n[0],n[1]),i=r(t[0],t[1]);return function(n){return i(u(n))}}function Fi(n,t){var e,r=0,u=n.length-1,i=n[r],o=n[u];return i>o&&(e=r,r=u,u=e,e=i,i=o,o=e),n[r]=t.floor(i),n[u]=t.ceil(o),n}function Hi(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:ml}function Oi(n,t,e,r){var u=[],i=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]2?Oi:ji,c=r?Iu:Ou;return o=u(n,t,c,e),a=u(t,n,c,mu),i}function i(n){return o(n)}var o,a;return i.invert=function(n){return a(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(Du)},i.clamp=function(n){return arguments.length?(r=n,u()):r},i.interpolate=function(n){return arguments.length?(e=n,u()):e},i.ticks=function(t){return Xi(n,t)},i.tickFormat=function(t,e){return $i(n,t,e)},i.nice=function(t){return Zi(n,t),u()},i.copy=function(){return Ii(n,t,e,r)},u()}function Yi(n,t){return ta.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Zi(n,t){return Fi(n,Hi(Vi(n,t)[2]))}function Vi(n,t){null==t&&(t=10);var e=Pi(n),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),i=t/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function Xi(n,t){return ta.range.apply(ta,Vi(n,t))}function $i(n,t,e){var r=Vi(n,t);if(e){var u=ic.exec(e);if(u.shift(),"s"===u[8]){var i=ta.formatPrefix(Math.max(ga(r[0]),ga(r[1])));return u[7]||(u[7]="."+Bi(i.scale(r[2]))),u[8]="f",e=ta.format(u.join("")),function(n){return e(i.scale(n))+i.symbol}}u[7]||(u[7]="."+Wi(u[8],r)),e=u.join("")}else e=",."+Bi(r[2])+"f";return ta.format(e)}function Bi(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function Wi(n,t){var e=Bi(t[2]);return n in yl?Math.abs(e-Bi(Math.max(ga(t[0]),ga(t[1]))))+ +("e"!==n):e-2*("%"===n)}function Ji(n,t,e,r){function u(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(u(t))}return o.invert=function(t){return i(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(u)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(u)),o):t},o.nice=function(){var t=Fi(r.map(u),e?Math:xl);return n.domain(t),r=t.map(i),o},o.ticks=function(){var n=Pi(r),o=[],a=n[0],c=n[1],l=Math.floor(u(a)),s=Math.ceil(u(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;s>l;l++)for(var h=1;f>h;h++)o.push(i(l)*h);o.push(i(l))}else for(o.push(i(l));l++0;h--)o.push(i(l)*h);for(l=0;o[l]c;s--);o=o.slice(l,s)}return o},o.tickFormat=function(n,t){if(!arguments.length)return Ml;arguments.length<2?t=Ml:"function"!=typeof t&&(t=ta.format(t));var r,a=Math.max(.1,n/o.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/i(c(u(n)+r))<=a?t(n):""}},o.copy=function(){return Ji(n.copy(),t,e,r)},Yi(o,n)}function Gi(n,t,e){function r(t){return n(u(t))}var u=Ki(t),i=Ki(1/t);return r.invert=function(t){return i(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(u)),r):e},r.ticks=function(n){return Xi(e,n)},r.tickFormat=function(n,t){return $i(e,n,t)},r.nice=function(n){return r.domain(Zi(e,n))},r.exponent=function(o){return arguments.length?(u=Ki(t=o),i=Ki(1/t),n.domain(e.map(u)),r):t},r.copy=function(){return Gi(n.copy(),t,e)},Yi(r,n)}function Ki(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function Qi(n,t){function e(e){return i[((u.get(e)||("range"===t.t?u.set(e,n.push(e)):0/0))-1)%i.length]}function r(t,e){return ta.range(n.length).map(function(n){return t+e*n})}var u,i,o;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new l;for(var i,o=-1,a=r.length;++oe?[0/0,0/0]:[e>0?a[e-1]:n[0],et?0/0:t/i+n,[t,t+1/i]},r.copy=function(){return to(n,t,e)},u()}function eo(n,t){function e(e){return e>=e?t[ta.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return eo(n,t)},e}function ro(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Xi(n,t)},t.tickFormat=function(t,e){return $i(n,t,e)},t.copy=function(){return ro(n)},t}function uo(){return 0}function io(n){return n.innerRadius}function oo(n){return n.outerRadius}function ao(n){return n.startAngle}function co(n){return n.endAngle}function lo(n){return n&&n.padAngle}function so(n,t,e,r){return(n-e)*t-(t-r)*n>0?0:1}function fo(n,t,e,r,u){var i=n[0]-t[0],o=n[1]-t[1],a=(u?r:-r)/Math.sqrt(i*i+o*o),c=a*o,l=-a*i,s=n[0]+c,f=n[1]+l,h=t[0]+c,g=t[1]+l,p=(s+h)/2,v=(f+g)/2,d=h-s,m=g-f,y=d*d+m*m,M=e-r,x=s*g-h*f,b=(0>m?-1:1)*Math.sqrt(M*M*y-x*x),_=(x*m-d*b)/y,w=(-x*d-m*b)/y,S=(x*m+d*b)/y,k=(-x*d+m*b)/y,E=_-p,A=w-v,N=S-p,C=k-v;return E*E+A*A>N*N+C*C&&(_=S,w=k),[[_-c,w-l],[_*e/M,w*e/M]]}function ho(n){function t(t){function o(){l.push("M",i(n(s),a))}for(var c,l=[],s=[],f=-1,h=t.length,g=Et(e),p=Et(r);++f1&&u.push("H",r[0]),u.join("")}function mo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t1){a=t[1],i=n[c],c++,r+="C"+(u[0]+o[0])+","+(u[1]+o[1])+","+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1];for(var l=2;l9&&(u=3*t/Math.sqrt(u),o[a]=u*e,o[a+1]=u*r));for(a=-1;++a<=c;)u=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),i.push([u||0,o[a]*u||0]);return i}function To(n){return n.length<3?go(n):n[0]+_o(n,Lo(n))}function Ro(n){for(var t,e,r,u=-1,i=n.length;++ur)return s();var u=i[i.active];u&&(--i.count,delete i[i.active],u.event&&u.event.interrupt.call(n,n.__data__,u.index)),i.active=r,o.event&&o.event.start.call(n,n.__data__,t),o.tween.forEach(function(e,r){(r=r.call(n,n.__data__,t))&&v.push(r)}),h=o.ease,f=o.duration,ta.timer(function(){return p.c=l(e||1)?Ne:l,1},0,a)}function l(e){if(i.active!==r)return 1;for(var u=e/f,a=h(u),c=v.length;c>0;)v[--c].call(n,a);return u>=1?(o.event&&o.event.end.call(n,n.__data__,t),s()):void 0}function s(){return--i.count?delete i[r]:delete n[e],1}var f,h,g=o.delay,p=ec,v=[];return p.t=g+a,u>=g?c(u-g):void(p.c=c)},0,a)}}function Bo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function Wo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function Jo(n){return n.toISOString()}function Go(n,t,e){function r(t){return n(t)}function u(n,e){var r=n[1]-n[0],u=r/e,i=ta.bisect(Vl,u);return i==Vl.length?[t.year,Vi(n.map(function(n){return n/31536e6}),e)[2]]:i?t[u/Vl[i-1]1?{floor:function(t){for(;e(t=n.floor(t));)t=Ko(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=Ko(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Pi(r.domain()),i=null==n?u(e,10):"number"==typeof n?u(e,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(e[0],Ko(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return Go(n.copy(),t,e)},Yi(r,n)}function Ko(n){return new Date(n)}function Qo(n){return JSON.parse(n.responseText)}function na(n){var t=ua.createRange();return t.selectNode(ua.body),t.createContextualFragment(n.responseText)}var ta={version:"3.5.6"},ea=[].slice,ra=function(n){return ea.call(n)},ua=this.document;if(ua)try{ra(ua.documentElement.childNodes)[0].nodeType}catch(ia){ra=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}if(Date.now||(Date.now=function(){return+new Date}),ua)try{ua.createElement("DIV").style.setProperty("opacity",0,"")}catch(oa){var aa=this.Element.prototype,ca=aa.setAttribute,la=aa.setAttributeNS,sa=this.CSSStyleDeclaration.prototype,fa=sa.setProperty;aa.setAttribute=function(n,t){ca.call(this,n,t+"")},aa.setAttributeNS=function(n,t,e){la.call(this,n,t,e+"")},sa.setProperty=function(n,t,e){fa.call(this,n,t+"",e)}}ta.ascending=e,ta.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},ta.min=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u=r){e=r;break}for(;++ur&&(e=r)}else{for(;++u=r){e=r;break}for(;++ur&&(e=r)}return e},ta.max=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u=r){e=r;break}for(;++ue&&(e=r)}else{for(;++u=r){e=r;break}for(;++ue&&(e=r)}return e},ta.extent=function(n,t){var e,r,u,i=-1,o=n.length;if(1===arguments.length){for(;++i=r){e=u=r;break}for(;++ir&&(e=r),r>u&&(u=r))}else{for(;++i=r){e=u=r;break}for(;++ir&&(e=r),r>u&&(u=r))}return[e,u]},ta.sum=function(n,t){var e,r=0,i=n.length,o=-1;if(1===arguments.length)for(;++o1?c/(s-1):void 0},ta.deviation=function(){var n=ta.variance.apply(this,arguments);return n?Math.sqrt(n):n};var ha=i(e);ta.bisectLeft=ha.left,ta.bisect=ta.bisectRight=ha.right,ta.bisector=function(n){return i(1===n.length?function(t,r){return e(n(t),r)}:n)},ta.shuffle=function(n,t,e){(i=arguments.length)<3&&(e=n.length,2>i&&(t=0));for(var r,u,i=e-t;i;)u=Math.random()*i--|0,r=n[i+t],n[i+t]=n[u+t],n[u+t]=r;return n},ta.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},ta.pairs=function(n){for(var t,e=0,r=n.length-1,u=n[0],i=new Array(0>r?0:r);r>e;)i[e]=[t=u,u=n[++e]];return i},ta.zip=function(){if(!(r=arguments.length))return[];for(var n=-1,t=ta.min(arguments,o),e=new Array(t);++n=0;)for(r=n[u],t=r.length;--t>=0;)e[--o]=r[t];return e};var ga=Math.abs;ta.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e===1/0)throw new Error("infinite range");var r,u=[],i=a(ga(e)),o=-1;if(n*=i,t*=i,e*=i,0>e)for(;(r=n+e*++o)>t;)u.push(r/i);else for(;(r=n+e*++o)=i.length)return r?r.call(u,o):e?o.sort(e):o;for(var c,s,f,h,g=-1,p=o.length,v=i[a++],d=new l;++g=i.length)return n;var r=[],u=o[e++];return n.forEach(function(n,u){r.push({key:n,values:t(u,e)})}),u?r.sort(function(n,t){return u(n.key,t.key)}):r}var e,r,u={},i=[],o=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(ta.map,e,0),0)},u.key=function(n){return i.push(n),u},u.sortKeys=function(n){return o[i.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},ta.set=function(n){var t=new m;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},c(m,{has:h,add:function(n){return this._[s(n+="")]=!0,n},remove:g,values:p,size:v,empty:d,forEach:function(n){for(var t in this._)n.call(this,f(t))}}),ta.behavior={},ta.rebind=function(n,t){for(var e,r=1,u=arguments.length;++r=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},ta.event=null,ta.requote=function(n){return n.replace(ma,"\\$&")};var ma=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ya={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},Ma=function(n,t){return t.querySelector(n)},xa=function(n,t){return t.querySelectorAll(n)},ba=function(n,t){var e=n.matches||n[x(n,"matchesSelector")];return(ba=function(n,t){return e.call(n,t)})(n,t)};"function"==typeof Sizzle&&(Ma=function(n,t){return Sizzle(n,t)[0]||null},xa=Sizzle,ba=Sizzle.matchesSelector),ta.selection=function(){return ta.select(ua.documentElement)};var _a=ta.selection.prototype=[];_a.select=function(n){var t,e,r,u,i=[];n=N(n);for(var o=-1,a=this.length;++o=0&&(e=n.slice(0,t),n=n.slice(t+1)),wa.hasOwnProperty(e)?{space:wa[e],local:n}:n}},_a.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=ta.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(z(t,n[t]));return this}return this.each(z(n,t))},_a.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=T(n)).length,u=-1;if(t=e.classList){for(;++uu){if("string"!=typeof n){2>u&&(e="");for(r in n)this.each(P(r,n[r],e));return this}if(2>u){var i=this.node();return t(i).getComputedStyle(i,null).getPropertyValue(n)}r=""}return this.each(P(n,e,r))},_a.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(U(t,n[t]));return this}return this.each(U(n,t))},_a.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},_a.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},_a.append=function(n){return n=j(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},_a.insert=function(n,t){return n=j(n),t=N(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},_a.remove=function(){return this.each(F)},_a.data=function(n,t){function e(n,e){var r,u,i,o=n.length,f=e.length,h=Math.min(o,f),g=new Array(f),p=new Array(f),v=new Array(o);if(t){var d,m=new l,y=new Array(o);for(r=-1;++rr;++r)p[r]=H(e[r]);for(;o>r;++r)v[r]=n[r]}p.update=g,p.parentNode=g.parentNode=v.parentNode=n.parentNode,a.push(p),c.push(g),s.push(v)}var r,u,i=-1,o=this.length;if(!arguments.length){for(n=new Array(o=(r=this[0]).length);++ii;i++){u.push(t=[]),t.parentNode=(e=this[i]).parentNode;for(var a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return A(u)},_a.order=function(){for(var n=-1,t=this.length;++n=0;)(e=r[u])&&(i&&i!==e.nextSibling&&i.parentNode.insertBefore(e,i),i=e);return this},_a.sort=function(n){n=I.apply(this,arguments);for(var t=-1,e=this.length;++tn;n++)for(var e=this[n],r=0,u=e.length;u>r;r++){var i=e[r];if(i)return i}return null},_a.size=function(){var n=0;return Y(this,function(){++n}),n};var Sa=[];ta.selection.enter=Z,ta.selection.enter.prototype=Sa,Sa.append=_a.append,Sa.empty=_a.empty,Sa.node=_a.node,Sa.call=_a.call,Sa.size=_a.size,Sa.select=function(n){for(var t,e,r,u,i,o=[],a=-1,c=this.length;++ar){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(X(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(X(n,t,e))};var ka=ta.map({mouseenter:"mouseover",mouseleave:"mouseout"});ua&&ka.forEach(function(n){"on"+n in ua&&ka.remove(n)});var Ea,Aa=0;ta.mouse=function(n){return J(n,k())};var Na=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;ta.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=k().changedTouches),t)for(var r,u=0,i=t.length;i>u;++u)if((r=t[u]).identifier===e)return J(n,r)},ta.behavior.drag=function(){function n(){this.on("mousedown.drag",i).on("touchstart.drag",o)}function e(n,t,e,i,o){return function(){function a(){var n,e,r=t(h,v);r&&(n=r[0]-M[0],e=r[1]-M[1],p|=n|e,M=r,g({type:"drag",x:r[0]+l[0],y:r[1]+l[1],dx:n,dy:e}))}function c(){t(h,v)&&(m.on(i+d,null).on(o+d,null),y(p&&ta.event.target===f),g({type:"dragend"}))}var l,s=this,f=ta.event.target,h=s.parentNode,g=r.of(s,arguments),p=0,v=n(),d=".drag"+(null==v?"":"-"+v),m=ta.select(e(f)).on(i+d,a).on(o+d,c),y=W(f),M=t(h,v);u?(l=u.apply(s,arguments),l=[l.x-M[0],l.y-M[1]]):l=[0,0],g({type:"dragstart"})}}var r=E(n,"drag","dragstart","dragend"),u=null,i=e(b,ta.mouse,t,"mousemove","mouseup"),o=e(G,ta.touch,y,"touchmove","touchend");return n.origin=function(t){return arguments.length?(u=t,n):u},ta.rebind(n,r,"on")},ta.touches=function(n,t){return arguments.length<2&&(t=k().touches),t?ra(t).map(function(t){var e=J(n,t);return e.identifier=t.identifier,e}):[]};var Ca=1e-6,za=Ca*Ca,qa=Math.PI,La=2*qa,Ta=La-Ca,Ra=qa/2,Da=qa/180,Pa=180/qa,Ua=Math.SQRT2,ja=2,Fa=4;ta.interpolateZoom=function(n,t){function e(n){var t=n*y;if(m){var e=rt(v),o=i/(ja*h)*(e*ut(Ua*t+v)-et(v));return[r+o*l,u+o*s,i*e/rt(Ua*t+v)]}return[r+n*l,u+n*s,i*Math.exp(Ua*t)]}var r=n[0],u=n[1],i=n[2],o=t[0],a=t[1],c=t[2],l=o-r,s=a-u,f=l*l+s*s,h=Math.sqrt(f),g=(c*c-i*i+Fa*f)/(2*i*ja*h),p=(c*c-i*i-Fa*f)/(2*c*ja*h),v=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p),m=d-v,y=(m||Math.log(c/i))/Ua;return e.duration=1e3*y,e},ta.behavior.zoom=function(){function n(n){n.on(q,f).on(Oa+".zoom",g).on("dblclick.zoom",p).on(R,h)}function e(n){return[(n[0]-k.x)/k.k,(n[1]-k.y)/k.k]}function r(n){return[n[0]*k.k+k.x,n[1]*k.k+k.y]}function u(n){k.k=Math.max(N[0],Math.min(N[1],n))}function i(n,t){t=r(t),k.x+=n[0]-t[0],k.y+=n[1]-t[1]}function o(t,e,r,o){t.__chart__={x:k.x,y:k.y,k:k.k},u(Math.pow(2,o)),i(d=e,r),t=ta.select(t),C>0&&(t=t.transition().duration(C)),t.call(n.event)}function a(){b&&b.domain(x.range().map(function(n){return(n-k.x)/k.k}).map(x.invert)),w&&w.domain(_.range().map(function(n){return(n-k.y)/k.k}).map(_.invert))}function c(n){z++||n({type:"zoomstart"})}function l(n){a(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function s(n){--z||(n({type:"zoomend"}),d=null)}function f(){function n(){f=1,i(ta.mouse(u),g),l(a)}function r(){h.on(L,null).on(T,null),p(f&&ta.event.target===o),s(a)}var u=this,o=ta.event.target,a=D.of(u,arguments),f=0,h=ta.select(t(u)).on(L,n).on(T,r),g=e(ta.mouse(u)),p=W(u);Dl.call(u),c(a)}function h(){function n(){var n=ta.touches(p);return g=k.k,n.forEach(function(n){n.identifier in d&&(d[n.identifier]=e(n))}),n}function t(){var t=ta.event.target;ta.select(t).on(x,r).on(b,a),_.push(t);for(var e=ta.event.changedTouches,u=0,i=e.length;i>u;++u)d[e[u].identifier]=null;var c=n(),l=Date.now();if(1===c.length){if(500>l-M){var s=c[0];o(p,s,d[s.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),S()}M=l}else if(c.length>1){var s=c[0],f=c[1],h=s[0]-f[0],g=s[1]-f[1];m=h*h+g*g}}function r(){var n,t,e,r,o=ta.touches(p);Dl.call(p);for(var a=0,c=o.length;c>a;++a,r=null)if(e=o[a],r=d[e.identifier]){if(t)break;n=e,t=r}if(r){var s=(s=e[0]-n[0])*s+(s=e[1]-n[1])*s,f=m&&Math.sqrt(s/m);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+r[0])/2,(t[1]+r[1])/2],u(f*g)}M=null,i(n,t),l(v)}function a(){if(ta.event.touches.length){for(var t=ta.event.changedTouches,e=0,r=t.length;r>e;++e)delete d[t[e].identifier];for(var u in d)return void n()}ta.selectAll(_).on(y,null),w.on(q,f).on(R,h),E(),s(v)}var g,p=this,v=D.of(p,arguments),d={},m=0,y=".zoom-"+ta.event.changedTouches[0].identifier,x="touchmove"+y,b="touchend"+y,_=[],w=ta.select(p),E=W(p);t(),c(v),w.on(q,null).on(R,t)}function g(){var n=D.of(this,arguments);y?clearTimeout(y):(Dl.call(this),v=e(d=m||ta.mouse(this)),c(n)),y=setTimeout(function(){y=null,s(n)},50),S(),u(Math.pow(2,.002*Ha())*k.k),i(d,v),l(n)}function p(){var n=ta.mouse(this),t=Math.log(k.k)/Math.LN2;o(this,n,e(n),ta.event.shiftKey?Math.ceil(t)-1:Math.floor(t)+1)}var v,d,m,y,M,x,b,_,w,k={x:0,y:0,k:1},A=[960,500],N=Ia,C=250,z=0,q="mousedown.zoom",L="mousemove.zoom",T="mouseup.zoom",R="touchstart.zoom",D=E(n,"zoomstart","zoom","zoomend");return Oa||(Oa="onwheel"in ua?(Ha=function(){return-ta.event.deltaY*(ta.event.deltaMode?120:1)},"wheel"):"onmousewheel"in ua?(Ha=function(){return ta.event.wheelDelta},"mousewheel"):(Ha=function(){return-ta.event.detail},"MozMousePixelScroll")),n.event=function(n){n.each(function(){var n=D.of(this,arguments),t=k;Tl?ta.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},c(n)}).tween("zoom:zoom",function(){var e=A[0],r=A[1],u=d?d[0]:e/2,i=d?d[1]:r/2,o=ta.interpolateZoom([(u-k.x)/k.k,(i-k.y)/k.k,e/k.k],[(u-t.x)/t.k,(i-t.y)/t.k,e/t.k]);return function(t){var r=o(t),a=e/r[2];this.__chart__=k={x:u-r[0]*a,y:i-r[1]*a,k:a},l(n)}}).each("interrupt.zoom",function(){s(n)}).each("end.zoom",function(){s(n)}):(this.__chart__=k,c(n),l(n),s(n))})},n.translate=function(t){return arguments.length?(k={x:+t[0],y:+t[1],k:k.k},a(),n):[k.x,k.y]},n.scale=function(t){return arguments.length?(k={x:k.x,y:k.y,k:+t},a(),n):k.k},n.scaleExtent=function(t){return arguments.length?(N=null==t?Ia:[+t[0],+t[1]],n):N},n.center=function(t){return arguments.length?(m=t&&[+t[0],+t[1]],n):m},n.size=function(t){return arguments.length?(A=t&&[+t[0],+t[1]],n):A},n.duration=function(t){return arguments.length?(C=+t,n):C},n.x=function(t){return arguments.length?(b=t,x=t.copy(),k={x:0,y:0,k:1},n):b},n.y=function(t){return arguments.length?(w=t,_=t.copy(),k={x:0,y:0,k:1},n):w},ta.rebind(n,D,"on")};var Ha,Oa,Ia=[0,1/0];ta.color=ot,ot.prototype.toString=function(){return this.rgb()+""},ta.hsl=at;var Ya=at.prototype=new ot;Ya.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new at(this.h,this.s,this.l/n)},Ya.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new at(this.h,this.s,n*this.l)},Ya.rgb=function(){return ct(this.h,this.s,this.l)},ta.hcl=lt;var Za=lt.prototype=new ot;Za.brighter=function(n){return new lt(this.h,this.c,Math.min(100,this.l+Va*(arguments.length?n:1)))},Za.darker=function(n){return new lt(this.h,this.c,Math.max(0,this.l-Va*(arguments.length?n:1)))},Za.rgb=function(){return st(this.h,this.c,this.l).rgb()},ta.lab=ft;var Va=18,Xa=.95047,$a=1,Ba=1.08883,Wa=ft.prototype=new ot;Wa.brighter=function(n){return new ft(Math.min(100,this.l+Va*(arguments.length?n:1)),this.a,this.b)},Wa.darker=function(n){return new ft(Math.max(0,this.l-Va*(arguments.length?n:1)),this.a,this.b)},Wa.rgb=function(){return ht(this.l,this.a,this.b)},ta.rgb=mt;var Ja=mt.prototype=new ot;Ja.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,u=30;return t||e||r?(t&&u>t&&(t=u),e&&u>e&&(e=u),r&&u>r&&(r=u),new mt(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new mt(u,u,u)},Ja.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new mt(n*this.r,n*this.g,n*this.b)},Ja.hsl=function(){return _t(this.r,this.g,this.b)},Ja.toString=function(){return"#"+xt(this.r)+xt(this.g)+xt(this.b)};var Ga=ta.map({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});Ga.forEach(function(n,t){Ga.set(n,yt(t))}),ta.functor=Et,ta.xhr=At(y),ta.dsv=function(n,t){function e(n,e,i){arguments.length<3&&(i=e,e=null);var o=Nt(n,t,null==e?r:u(e),i);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:u(n)):e},o}function r(n){return e.parse(n.responseText)}function u(n){return function(t){return e.parse(t.responseText,n)}}function i(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),c=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var u=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(u(n),e)}:u})},e.parseRows=function(n,t){function e(){if(s>=l)return o;if(u)return u=!1,i;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++s;){var r=n.charCodeAt(s++),a=1;if(10===r)u=!0;else if(13===r)u=!0,10===n.charCodeAt(s)&&(++s,++a);else if(r!==c)continue;return n.slice(t,s-a)}return n.slice(t)}for(var r,u,i={},o={},a=[],l=n.length,s=0,f=0;(r=e())!==o;){for(var h=[];r!==i&&r!==o;)h.push(r),r=e();t&&null==(h=t(h,f++))||a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new m,u=[];return t.forEach(function(n){for(var t in n)r.has(t)||u.push(r.add(t))}),[u.map(o).join(n)].concat(t.map(function(t){return u.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(i).join("\n")},e},ta.csv=ta.dsv(",","text/csv"),ta.tsv=ta.dsv(" ","text/tab-separated-values");var Ka,Qa,nc,tc,ec,rc=this[x(this,"requestAnimationFrame")]||function(n){setTimeout(n,17)};ta.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var u=e+t,i={c:n,t:u,f:!1,n:null};Qa?Qa.n=i:Ka=i,Qa=i,nc||(tc=clearTimeout(tc),nc=1,rc(qt))},ta.timer.flush=function(){Lt(),Tt()},ta.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var uc=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Dt);ta.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=ta.round(n,Rt(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),uc[8+e/3]};var ic=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,oc=ta.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=ta.round(n,Rt(n,t))).toFixed(Math.max(0,Math.min(20,Rt(n*(1+1e-15),t))))}}),ac=ta.time={},cc=Date;jt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){lc.setUTCDate.apply(this._,arguments)},setDay:function(){lc.setUTCDay.apply(this._,arguments)},setFullYear:function(){lc.setUTCFullYear.apply(this._,arguments)},setHours:function(){lc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){lc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){lc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){lc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){lc.setUTCSeconds.apply(this._,arguments)},setTime:function(){lc.setTime.apply(this._,arguments)}};var lc=Date.prototype;ac.year=Ft(function(n){return n=ac.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ac.years=ac.year.range,ac.years.utc=ac.year.utc.range,ac.day=Ft(function(n){var t=new cc(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ac.days=ac.day.range,ac.days.utc=ac.day.utc.range,ac.dayOfYear=function(n){var t=ac.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=ac[n]=Ft(function(n){return(n=ac.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ac.year(n).getDay();return Math.floor((ac.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ac[n+"s"]=e.range,ac[n+"s"].utc=e.utc.range,ac[n+"OfYear"]=function(n){var e=ac.year(n).getDay();return Math.floor((ac.dayOfYear(n)+(e+t)%7)/7)}}),ac.week=ac.sunday,ac.weeks=ac.sunday.range,ac.weeks.utc=ac.sunday.utc.range,ac.weekOfYear=ac.sundayOfYear;var sc={"-":"",_:" ",0:"0"},fc=/^\s*\d+/,hc=/^%/;ta.locale=function(n){return{numberFormat:Pt(n),timeFormat:Ot(n)}};var gc=ta.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",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"]});ta.format=gc.numberFormat,ta.geo={},ce.prototype={s:0,t:0,add:function(n){le(n,this.t,pc),le(pc.s,this.s,this),this.s?this.t+=pc.t:this.s=pc.t +},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var pc=new ce;ta.geo.stream=function(n,t){n&&vc.hasOwnProperty(n.type)?vc[n.type](n,t):se(n,t)};var vc={Feature:function(n,t){se(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,u=e.length;++rn?4*qa+n:n,Mc.lineStart=Mc.lineEnd=Mc.point=b}};ta.geo.bounds=function(){function n(n,t){M.push(x=[s=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=pe([t*Da,e*Da]);if(m){var u=de(m,r),i=[u[1],-u[0],0],o=de(i,u);Me(o),o=xe(o);var c=t-p,l=c>0?1:-1,v=o[0]*Pa*l,d=ga(c)>180;if(d^(v>l*p&&l*t>v)){var y=o[1]*Pa;y>g&&(g=y)}else if(v=(v+360)%360-180,d^(v>l*p&&l*t>v)){var y=-o[1]*Pa;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(s>t&&(s=t),t>h&&(h=t)):t>p?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);m=r,p=t}function e(){b.point=t}function r(){x[0]=s,x[1]=h,b.point=n,m=null}function u(n,e){if(m){var r=n-p;y+=ga(r)>180?r+(r>0?360:-360):r}else v=n,d=e;Mc.point(n,e),t(n,e)}function i(){Mc.lineStart()}function o(){u(v,d),Mc.lineEnd(),ga(y)>Ca&&(s=-(h=180)),x[0]=s,x[1]=h,m=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nyc?(s=-(h=180),f=-(g=90)):y>Ca?g=90:-Ca>y&&(f=-90),x[0]=s,x[1]=h}};return function(n){g=h=-(s=f=1/0),M=[],ta.geo.stream(n,b);var t=M.length;if(t){M.sort(c);for(var e,r=1,u=M[0],i=[u];t>r;++r)e=M[r],l(e[0],u)||l(e[1],u)?(a(u[0],e[1])>a(u[0],u[1])&&(u[1]=e[1]),a(e[0],u[1])>a(u[0],u[1])&&(u[0]=e[0])):i.push(u=e);for(var o,e,p=-1/0,t=i.length-1,r=0,u=i[t];t>=r;u=e,++r)e=i[r],(o=a(u[1],e[0]))>p&&(p=o,s=e[0],h=u[1])}return M=x=null,1/0===s||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[s,f],[h,g]]}}(),ta.geo.centroid=function(n){xc=bc=_c=wc=Sc=kc=Ec=Ac=Nc=Cc=zc=0,ta.geo.stream(n,qc);var t=Nc,e=Cc,r=zc,u=t*t+e*e+r*r;return za>u&&(t=kc,e=Ec,r=Ac,Ca>bc&&(t=_c,e=wc,r=Sc),u=t*t+e*e+r*r,za>u)?[0/0,0/0]:[Math.atan2(e,t)*Pa,tt(r/Math.sqrt(u))*Pa]};var xc,bc,_c,wc,Sc,kc,Ec,Ac,Nc,Cc,zc,qc={sphere:b,point:_e,lineStart:Se,lineEnd:ke,polygonStart:function(){qc.lineStart=Ee},polygonEnd:function(){qc.lineStart=Se}},Lc=Le(Ne,Pe,je,[-qa,-qa/2]),Tc=1e9;ta.geo.clipExtent=function(){var n,t,e,r,u,i,o={stream:function(n){return u&&(u.valid=!1),u=i(n),u.valid=!0,u},extent:function(a){return arguments.length?(i=Ie(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),u&&(u.valid=!1,u=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(ta.geo.conicEqualArea=function(){return Ye(Ze)}).raw=Ze,ta.geo.albers=function(){return ta.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ta.geo.albersUsa=function(){function n(n){var i=n[0],o=n[1];return t=null,e(i,o),t||(r(i,o),t)||u(i,o),t}var t,e,r,u,i=ta.geo.albers(),o=ta.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=ta.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=i.scale(),e=i.translate(),r=(n[0]-e[0])/t,u=(n[1]-e[1])/t;return(u>=.12&&.234>u&&r>=-.425&&-.214>r?o:u>=.166&&.234>u&&r>=-.214&&-.115>r?a:i).invert(n)},n.stream=function(n){var t=i.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,u){t.point(n,u),e.point(n,u),r.point(n,u)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),a.precision(t),n):i.precision()},n.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),a.scale(t),n.translate(i.translate())):i.scale()},n.translate=function(t){if(!arguments.length)return i.translate();var l=i.scale(),s=+t[0],f=+t[1];return e=i.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=o.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Ca,f+.12*l+Ca],[s-.214*l-Ca,f+.234*l-Ca]]).stream(c).point,u=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Ca,f+.166*l+Ca],[s-.115*l-Ca,f+.234*l-Ca]]).stream(c).point,n},n.scale(1070)};var Rc,Dc,Pc,Uc,jc,Fc,Hc={point:b,lineStart:b,lineEnd:b,polygonStart:function(){Dc=0,Hc.lineStart=Ve},polygonEnd:function(){Hc.lineStart=Hc.lineEnd=Hc.point=b,Rc+=ga(Dc/2)}},Oc={point:Xe,lineStart:b,lineEnd:b,polygonStart:b,polygonEnd:b},Ic={point:We,lineStart:Je,lineEnd:Ge,polygonStart:function(){Ic.lineStart=Ke},polygonEnd:function(){Ic.point=We,Ic.lineStart=Je,Ic.lineEnd=Ge}};ta.geo.path=function(){function n(n){return n&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=u(i)),ta.geo.stream(n,o)),i.result()}function t(){return o=null,n}var e,r,u,i,o,a=4.5;return n.area=function(n){return Rc=0,ta.geo.stream(n,u(Hc)),Rc},n.centroid=function(n){return _c=wc=Sc=kc=Ec=Ac=Nc=Cc=zc=0,ta.geo.stream(n,u(Ic)),zc?[Nc/zc,Cc/zc]:Ac?[kc/Ac,Ec/Ac]:Sc?[_c/Sc,wc/Sc]:[0/0,0/0]},n.bounds=function(n){return jc=Fc=-(Pc=Uc=1/0),ta.geo.stream(n,u(Oc)),[[Pc,Uc],[jc,Fc]]},n.projection=function(n){return arguments.length?(u=(e=n)?n.stream||tr(n):y,t()):e},n.context=function(n){return arguments.length?(i=null==(r=n)?new $e:new Qe(n),"function"!=typeof a&&i.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(i.pointRadius(+t),+t),n):a},n.projection(ta.geo.albersUsa()).context(null)},ta.geo.transform=function(n){return{stream:function(t){var e=new er(t);for(var r in n)e[r]=n[r];return e}}},er.prototype={point:function(n,t){this.stream.point(n,t)},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()}},ta.geo.projection=ur,ta.geo.projectionMutator=ir,(ta.geo.equirectangular=function(){return ur(ar)}).raw=ar.invert=ar,ta.geo.rotation=function(n){function t(t){return t=n(t[0]*Da,t[1]*Da),t[0]*=Pa,t[1]*=Pa,t}return n=lr(n[0]%360*Da,n[1]*Da,n.length>2?n[2]*Da:0),t.invert=function(t){return t=n.invert(t[0]*Da,t[1]*Da),t[0]*=Pa,t[1]*=Pa,t},t},cr.invert=ar,ta.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=lr(-n[0]*Da,-n[1]*Da,0).invert,u=[];return e(null,null,1,{point:function(n,e){u.push(n=t(n,e)),n[0]*=Pa,n[1]*=Pa}}),{type:"Polygon",coordinates:[u]}}var t,e,r=[0,0],u=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=gr((t=+r)*Da,u*Da),n):t},n.precision=function(r){return arguments.length?(e=gr(t*Da,(u=+r)*Da),n):u},n.angle(90)},ta.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Da,u=n[1]*Da,i=t[1]*Da,o=Math.sin(r),a=Math.cos(r),c=Math.sin(u),l=Math.cos(u),s=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((e=f*o)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},ta.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return ta.range(Math.ceil(i/d)*d,u,d).map(h).concat(ta.range(Math.ceil(l/m)*m,c,m).map(g)).concat(ta.range(Math.ceil(r/p)*p,e,p).filter(function(n){return ga(n%d)>Ca}).map(s)).concat(ta.range(Math.ceil(a/v)*v,o,v).filter(function(n){return ga(n%m)>Ca}).map(f))}var e,r,u,i,o,a,c,l,s,f,h,g,p=10,v=p,d=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(g(c).slice(1),h(u).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(i=+t[0][0],u=+t[1][0],l=+t[0][1],c=+t[1][1],i>u&&(t=i,i=u,u=t),l>c&&(t=l,l=c,c=t),n.precision(y)):[[i,l],[u,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],m=+t[1],n):[d,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],v=+t[1],n):[p,v]},n.precision=function(t){return arguments.length?(y=+t,s=vr(a,o,90),f=dr(r,e,y),h=vr(l,c,90),g=dr(i,u,y),n):y},n.majorExtent([[-180,-90+Ca],[180,90-Ca]]).minorExtent([[-180,-80-Ca],[180,80+Ca]])},ta.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||u.apply(this,arguments)]}}var t,e,r=mr,u=yr;return n.distance=function(){return ta.geo.distance(t||r.apply(this,arguments),e||u.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(u=t,e="function"==typeof t?null:t,n):u},n.precision=function(){return arguments.length?n:0},n},ta.geo.interpolate=function(n,t){return Mr(n[0]*Da,n[1]*Da,t[0]*Da,t[1]*Da)},ta.geo.length=function(n){return Yc=0,ta.geo.stream(n,Zc),Yc};var Yc,Zc={sphere:b,point:b,lineStart:xr,lineEnd:b,polygonStart:b,polygonEnd:b},Vc=br(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(ta.geo.azimuthalEqualArea=function(){return ur(Vc)}).raw=Vc;var Xc=br(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},y);(ta.geo.azimuthalEquidistant=function(){return ur(Xc)}).raw=Xc,(ta.geo.conicConformal=function(){return Ye(_r)}).raw=_r,(ta.geo.conicEquidistant=function(){return Ye(wr)}).raw=wr;var $c=br(function(n){return 1/n},Math.atan);(ta.geo.gnomonic=function(){return ur($c)}).raw=$c,Sr.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Ra]},(ta.geo.mercator=function(){return kr(Sr)}).raw=Sr;var Bc=br(function(){return 1},Math.asin);(ta.geo.orthographic=function(){return ur(Bc)}).raw=Bc;var Wc=br(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(ta.geo.stereographic=function(){return ur(Wc)}).raw=Wc,Er.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Ra]},(ta.geo.transverseMercator=function(){var n=kr(Er),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Er,ta.geom={},ta.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,u=Et(e),i=Et(r),o=n.length,a=[],c=[];for(t=0;o>t;t++)a.push([+u.call(this,n[t],t),+i.call(this,n[t],t),t]);for(a.sort(zr),t=0;o>t;t++)c.push([a[t][0],-a[t][1]]);var l=Cr(a),s=Cr(c),f=s[0]===l[0],h=s[s.length-1]===l[l.length-1],g=[];for(t=l.length-1;t>=0;--t)g.push(n[a[l[t]][2]]);for(t=+f;t=r&&l.x<=i&&l.y>=u&&l.y<=o?[[r,o],[i,o],[i,u],[r,u]]:[];s.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(i(n,t)/Ca)*Ca,y:Math.round(o(n,t)/Ca)*Ca,i:t}})}var r=Ar,u=Nr,i=r,o=u,a=ul;return n?t(n):(t.links=function(n){return iu(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return iu(e(n)).cells.forEach(function(e,r){for(var u,i,o=e.site,a=e.edges.sort(Yr),c=-1,l=a.length,s=a[l-1].edge,f=s.l===o?s.r:s.l;++c=l,h=r>=s,g=h<<1|f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=su()),f?u=l:a=l,h?o=s:c=s,i(n,t,e,r,u,o,a,c)}var s,f,h,g,p,v,d,m,y,M=Et(a),x=Et(c);if(null!=t)v=t,d=e,m=r,y=u;else if(m=y=-(v=d=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)s=n[g],s.xm&&(m=s.x),s.y>y&&(y=s.y),f.push(s.x),h.push(s.y);else for(g=0;p>g;++g){var b=+M(s=n[g],g),_=+x(s,g);v>b&&(v=b),d>_&&(d=_),b>m&&(m=b),_>y&&(y=_),f.push(b),h.push(_)}var w=m-v,S=y-d;w>S?y=d+w:m=v+S;var k=su();if(k.add=function(n){i(k,n,+M(n,++g),+x(n,g),v,d,m,y)},k.visit=function(n){fu(n,k,v,d,m,y)},k.find=function(n){return hu(k,n[0],n[1],v,d,m,y)},g=-1,null==t){for(;++g=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=cl.get(e)||al,r=ll.get(r)||y,Mu(r(e.apply(null,ea.call(arguments,1))))},ta.interpolateHcl=Lu,ta.interpolateHsl=Tu,ta.interpolateLab=Ru,ta.interpolateRound=Du,ta.transform=function(n){var t=ua.createElementNS(ta.ns.prefix.svg,"g");return(ta.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Pu(e?e.matrix:sl)})(n)},Pu.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var sl={a:1,b:0,c:0,d:1,e:0,f:0};ta.interpolateTransform=Hu,ta.layout={},ta.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++ea*a/d){if(p>c){var l=t.charge/c;n.px-=i*l,n.py-=o*l}return!0}if(t.point&&c&&p>c){var l=t.pointCharge/c;n.px-=i*l,n.py-=o*l}}return!t.charge}}function t(n){n.px=ta.event.x,n.py=ta.event.y,a.resume()}var e,r,u,i,o,a={},c=ta.dispatch("start","tick","end"),l=[1,1],s=.9,f=fl,h=hl,g=-30,p=gl,v=.1,d=.64,m=[],M=[];return a.tick=function(){if((r*=.99)<.005)return c.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,p,d,y,x,b=m.length,_=M.length;for(e=0;_>e;++e)a=M[e],f=a.source,h=a.target,y=h.x-f.x,x=h.y-f.y,(p=y*y+x*x)&&(p=r*i[e]*((p=Math.sqrt(p))-u[e])/p,y*=p,x*=p,h.x-=y*(d=f.weight/(h.weight+f.weight)),h.y-=x*d,f.x+=y*(d=1-d),f.y+=x*d);if((d=r*v)&&(y=l[0]/2,x=l[1]/2,e=-1,d))for(;++e0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),ta.timer(a.tick)),a):r},a.start=function(){function n(n,r){if(!e){for(e=new Array(c),a=0;c>a;++a)e[a]=[];for(a=0;s>a;++a){var u=M[a];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var i,o=e[t],a=-1,l=o.length;++at;++t)(r=m[t]).index=t,r.weight=0;for(t=0;s>t;++t)r=M[t],"number"==typeof r.source&&(r.source=m[r.source]),"number"==typeof r.target&&(r.target=m[r.target]),++r.source.weight,++r.target.weight;for(t=0;c>t;++t)r=m[t],isNaN(r.x)&&(r.x=n("x",p)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof f)for(t=0;s>t;++t)u[t]=+f.call(this,M[t],t);else for(t=0;s>t;++t)u[t]=f;if(i=[],"function"==typeof h)for(t=0;s>t;++t)i[t]=+h.call(this,M[t],t);else for(t=0;s>t;++t)i[t]=h;if(o=[],"function"==typeof g)for(t=0;c>t;++t)o[t]=+g.call(this,m[t],t);else for(t=0;c>t;++t)o[t]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=ta.behavior.drag().origin(y).on("dragstart.force",Xu).on("drag.force",t).on("dragend.force",$u)),arguments.length?void this.on("mouseover.force",Bu).on("mouseout.force",Wu).call(e):e},ta.rebind(a,c,"on")};var fl=20,hl=1,gl=1/0;ta.layout.hierarchy=function(){function n(u){var i,o=[u],a=[];for(u.depth=0;null!=(i=o.pop());)if(a.push(i),(l=e.call(n,i,i.depth))&&(c=l.length)){for(var c,l,s;--c>=0;)o.push(s=l[c]),s.parent=i,s.depth=i.depth+1;r&&(i.value=0),i.children=l}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Qu(u,function(n){var e,u;t&&(e=n.children)&&e.sort(t),r&&(u=n.parent)&&(u.value+=n.value)}),a}var t=ei,e=ni,r=ti;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Ku(t,function(n){n.children&&(n.value=0)}),Qu(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},ta.layout.partition=function(){function n(t,e,r,u){var i=t.children;if(t.x=e,t.y=t.depth*u,t.dx=r,t.dy=u,i&&(o=i.length)){var o,a,c,l=-1;for(r=t.value?r/t.value:0;++lf?-1:1),p=(f-c*g)/ta.sum(l),v=ta.range(c),d=[];return null!=e&&v.sort(e===pl?function(n,t){return l[t]-l[n]}:function(n,t){return e(o[n],o[t])}),v.forEach(function(n){d[n]={data:o[n],value:a=l[n],startAngle:s,endAngle:s+=a*p+g,padAngle:h}}),d}var t=Number,e=pl,r=0,u=La,i=0;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(u=t,n):u},n.padAngle=function(t){return arguments.length?(i=t,n):i},n};var pl={};ta.layout.stack=function(){function n(a,c){if(!(h=a.length))return a;var l=a.map(function(e,r){return t.call(n,e,r)}),s=l.map(function(t){return t.map(function(t,e){return[i.call(n,t,e),o.call(n,t,e)]})}),f=e.call(n,s,c);l=ta.permute(l,f),s=ta.permute(s,f);var h,g,p,v,d=r.call(n,s,c),m=l[0].length;for(p=0;m>p;++p)for(u.call(n,l[0][p],v=d[p],s[0][p][1]),g=1;h>g;++g)u.call(n,l[g][p],v+=s[g-1][p][1],s[g][p][1]);return a}var t=y,e=ai,r=ci,u=oi,i=ui,o=ii;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:vl.get(t)||ai,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:dl.get(t)||ci,n):r},n.x=function(t){return arguments.length?(i=t,n):i},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(u=t,n):u},n};var vl=ta.map({"inside-out":function(n){var t,e,r=n.length,u=n.map(li),i=n.map(si),o=ta.range(r).sort(function(n,t){return u[n]-u[t]}),a=0,c=0,l=[],s=[];for(t=0;r>t;++t)e=o[t],c>a?(a+=i[e],l.push(e)):(c+=i[e],s.push(e));return s.reverse().concat(l)},reverse:function(n){return ta.range(n.length).reverse()},"default":ai}),dl=ta.map({silhouette:function(n){var t,e,r,u=n.length,i=n[0].length,o=[],a=0,c=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;i>e;++e)c[e]=(a-o[e])/2;return c},wiggle:function(n){var t,e,r,u,i,o,a,c,l,s=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(t=0,u=0;s>t;++t)u+=n[t][e][1];for(t=0,i=0,a=f[e][0]-f[e-1][0];s>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;i+=o*n[t][e][1]}g[e]=c-=u?i/u*a:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(n){var t,e,r,u=n.length,i=n[0].length,o=1/u,a=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];if(r)for(t=0;u>t;t++)n[t][e][1]/=r;else for(t=0;u>t;t++)n[t][e][1]=o}for(e=0;i>e;++e)a[e]=0;return a},zero:ci});ta.layout.histogram=function(){function n(n,i){for(var o,a,c=[],l=n.map(e,this),s=r.call(this,l,i),f=u.call(this,s,l,i),i=-1,h=l.length,g=f.length-1,p=t?1:1/h;++i0)for(i=-1;++i=s[0]&&a<=s[1]&&(o=c[ta.bisect(f,a,1,g)-1],o.y+=p,o.push(n[i]));return c}var t=!0,e=Number,r=pi,u=hi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=Et(t),n):r},n.bins=function(t){return arguments.length?(u="number"==typeof t?function(n){return gi(n,t)}:Et(t),n):u},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},ta.layout.pack=function(){function n(n,i){var o=e.call(this,n,i),a=o[0],c=u[0],l=u[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,Qu(a,function(n){n.r=+s(n.value)}),Qu(a,Mi),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;Qu(a,function(n){n.r+=f}),Qu(a,Mi),Qu(a,function(n){n.r-=f})}return _i(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),o}var t,e=ta.layout.hierarchy().sort(vi),r=0,u=[1,1];return n.size=function(t){return arguments.length?(u=t,n):u},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},Gu(n,e)},ta.layout.tree=function(){function n(n,u){var s=o.call(this,n,u),f=s[0],h=t(f);if(Qu(h,e),h.parent.m=-h.z,Ku(h,r),l)Ku(f,i);else{var g=f,p=f,v=f;Ku(f,function(n){n.xp.x&&(p=n),n.depth>v.depth&&(v=n)});var d=a(g,p)/2-g.x,m=c[0]/(p.x+a(p,g)/2+d),y=c[1]/(v.depth||1);Ku(f,function(n){n.x=(n.x+d)*m,n.y=n.depth*y})}return s}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var u,i=t.children,o=0,a=i.length;a>o;++o)r.push((i[o]=u={_:i[o],parent:t,children:(u=i[o].children)&&u.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=u);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){Ni(n);var i=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+a(n._,r._),n.m=n.z-i):n.z=i}else r&&(n.z=r.z+a(n._,r._));n.parent.A=u(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function u(n,t,e){if(t){for(var r,u=n,i=n,o=t,c=u.parent.children[0],l=u.m,s=i.m,f=o.m,h=c.m;o=Ei(o),u=ki(u),o&&u;)c=ki(c),i=Ei(i),i.a=n,r=o.z+f-u.z-l+a(o._,u._),r>0&&(Ai(Ci(o,n,e),n,r),l+=r,s+=r),f+=o.m,l+=u.m,h+=c.m,s+=i.m;o&&!Ei(i)&&(i.t=o,i.m+=f-s),u&&!ki(c)&&(c.t=u,c.m+=l-h,e=n)}return e}function i(n){n.x*=c[0],n.y=n.depth*c[1]}var o=ta.layout.hierarchy().sort(null).value(null),a=Si,c=[1,1],l=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(l=null==(c=t)?i:null,n):l?null:c},n.nodeSize=function(t){return arguments.length?(l=null==(c=t)?null:i,n):l?c:null},Gu(n,o)},ta.layout.cluster=function(){function n(n,i){var o,a=t.call(this,n,i),c=a[0],l=0;Qu(c,function(n){var t=n.children;t&&t.length?(n.x=qi(t),n.y=zi(t)):(n.x=o?l+=e(n,o):0,n.y=0,o=n)});var s=Li(c),f=Ti(c),h=s.x-e(s,f)/2,g=f.x+e(f,s)/2;return Qu(c,u?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=ta.layout.hierarchy().sort(null).value(null),e=Si,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},Gu(n,t)},ta.layout.treemap=function(){function n(n,t){for(var e,r,u=-1,i=n.length;++ut?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var i=e.children;if(i&&i.length){var o,a,c,l=f(e),s=[],h=i.slice(),p=1/0,v="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(n(h,l.dx*l.dy/e.value),s.area=0;(c=h.length)>0;)s.push(o=h[c-1]),s.area+=o.area,"squarify"!==g||(a=r(s,v))<=p?(h.pop(),p=a):(s.area-=s.pop().area,u(s,v,l,!1),v=Math.min(l.dx,l.dy),s.length=s.area=0,p=1/0);s.length&&(u(s,v,l,!0),s.length=s.area=0),i.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var i,o=f(t),a=r.slice(),c=[];for(n(a,o.dx*o.dy/t.value),c.area=0;i=a.pop();)c.push(i),c.area+=i.area,null!=i.z&&(u(c,i.z?o.dx:o.dy,o,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,u=0,i=1/0,o=-1,a=n.length;++oe&&(i=e),e>u&&(u=e));return r*=r,t*=t,r?Math.max(t*u*p/r,r/(t*i*p)):1/0}function u(n,t,e,r){var u,i=-1,o=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++ie.dx)&&(s=e.dx);++ie&&(t=1),1>e&&(n=0),function(){var e,r,u;do e=2*Math.random()-1,r=2*Math.random()-1,u=e*e+r*r;while(!u||u>1);return n+t*e*Math.sqrt(-2*Math.log(u)/u)}},logNormal:function(){var n=ta.random.normal.apply(ta,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=ta.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},ta.scale={};var ml={floor:y,ceil:y};ta.scale.linear=function(){return Ii([0,1],[0,1],mu,!1)};var yl={s:1,g:1,p:1,r:1,e:1};ta.scale.log=function(){return Ji(ta.scale.linear().domain([0,1]),10,!0,[1,10])};var Ml=ta.format(".0e"),xl={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};ta.scale.pow=function(){return Gi(ta.scale.linear(),1,[0,1])},ta.scale.sqrt=function(){return ta.scale.pow().exponent(.5)},ta.scale.ordinal=function(){return Qi([],{t:"range",a:[[]]})},ta.scale.category10=function(){return ta.scale.ordinal().range(bl)},ta.scale.category20=function(){return ta.scale.ordinal().range(_l)},ta.scale.category20b=function(){return ta.scale.ordinal().range(wl)},ta.scale.category20c=function(){return ta.scale.ordinal().range(Sl)};var bl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(Mt),_l=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(Mt),wl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(Mt),Sl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(Mt);ta.scale.quantile=function(){return no([],[])},ta.scale.quantize=function(){return to(0,1,[0,1])},ta.scale.threshold=function(){return eo([.5],[0,1])},ta.scale.identity=function(){return ro([0,1])},ta.svg={},ta.svg.arc=function(){function n(){var n=Math.max(0,+e.apply(this,arguments)),l=Math.max(0,+r.apply(this,arguments)),s=o.apply(this,arguments)-Ra,f=a.apply(this,arguments)-Ra,h=Math.abs(f-s),g=s>f?0:1;if(n>l&&(p=l,l=n,n=p),h>=Ta)return t(l,g)+(n?t(n,1-g):"")+"Z";var p,v,d,m,y,M,x,b,_,w,S,k,E=0,A=0,N=[];if((m=(+c.apply(this,arguments)||0)/2)&&(d=i===kl?Math.sqrt(n*n+l*l):+i.apply(this,arguments),g||(A*=-1),l&&(A=tt(d/l*Math.sin(m))),n&&(E=tt(d/n*Math.sin(m)))),l){y=l*Math.cos(s+A),M=l*Math.sin(s+A),x=l*Math.cos(f-A),b=l*Math.sin(f-A);var C=Math.abs(f-s-2*A)<=qa?0:1;if(A&&so(y,M,x,b)===g^C){var z=(s+f)/2;y=l*Math.cos(z),M=l*Math.sin(z),x=b=null}}else y=M=0;if(n){_=n*Math.cos(f-E),w=n*Math.sin(f-E),S=n*Math.cos(s+E),k=n*Math.sin(s+E);var q=Math.abs(s-f+2*E)<=qa?0:1;if(E&&so(_,w,S,k)===1-g^q){var L=(s+f)/2;_=n*Math.cos(L),w=n*Math.sin(L),S=k=null}}else _=w=0;if((p=Math.min(Math.abs(l-n)/2,+u.apply(this,arguments)))>.001){v=l>n^g?0:1;var T=null==S?[_,w]:null==x?[y,M]:Lr([y,M],[S,k],[x,b],[_,w]),R=y-T[0],D=M-T[1],P=x-T[0],U=b-T[1],j=1/Math.sin(Math.acos((R*P+D*U)/(Math.sqrt(R*R+D*D)*Math.sqrt(P*P+U*U)))/2),F=Math.sqrt(T[0]*T[0]+T[1]*T[1]);if(null!=x){var H=Math.min(p,(l-F)/(j+1)),O=fo(null==S?[_,w]:[S,k],[y,M],l,H,g),I=fo([x,b],[_,w],l,H,g);p===H?N.push("M",O[0],"A",H,",",H," 0 0,",v," ",O[1],"A",l,",",l," 0 ",1-g^so(O[1][0],O[1][1],I[1][0],I[1][1]),",",g," ",I[1],"A",H,",",H," 0 0,",v," ",I[0]):N.push("M",O[0],"A",H,",",H," 0 1,",v," ",I[0])}else N.push("M",y,",",M);if(null!=S){var Y=Math.min(p,(n-F)/(j-1)),Z=fo([y,M],[S,k],n,-Y,g),V=fo([_,w],null==x?[y,M]:[x,b],n,-Y,g);p===Y?N.push("L",V[0],"A",Y,",",Y," 0 0,",v," ",V[1],"A",n,",",n," 0 ",g^so(V[1][0],V[1][1],Z[1][0],Z[1][1]),",",1-g," ",Z[1],"A",Y,",",Y," 0 0,",v," ",Z[0]):N.push("L",V[0],"A",Y,",",Y," 0 0,",v," ",Z[0])}else N.push("L",_,",",w)}else N.push("M",y,",",M),null!=x&&N.push("A",l,",",l," 0 ",C,",",g," ",x,",",b),N.push("L",_,",",w),null!=S&&N.push("A",n,",",n," 0 ",q,",",1-g," ",S,",",k);return N.push("Z"),N.join("")}function t(n,t){return"M0,"+n+"A"+n+","+n+" 0 1,"+t+" 0,"+-n+"A"+n+","+n+" 0 1,"+t+" 0,"+n}var e=io,r=oo,u=uo,i=kl,o=ao,a=co,c=lo;return n.innerRadius=function(t){return arguments.length?(e=Et(t),n):e},n.outerRadius=function(t){return arguments.length?(r=Et(t),n):r},n.cornerRadius=function(t){return arguments.length?(u=Et(t),n):u},n.padRadius=function(t){return arguments.length?(i=t==kl?kl:Et(t),n):i},n.startAngle=function(t){return arguments.length?(o=Et(t),n):o},n.endAngle=function(t){return arguments.length?(a=Et(t),n):a},n.padAngle=function(t){return arguments.length?(c=Et(t),n):c},n.centroid=function(){var n=(+e.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-Ra;return[Math.cos(t)*n,Math.sin(t)*n]},n};var kl="auto";ta.svg.line=function(){return ho(y)};var El=ta.map({linear:go,"linear-closed":po,step:vo,"step-before":mo,"step-after":yo,basis:So,"basis-open":ko,"basis-closed":Eo,bundle:Ao,cardinal:bo,"cardinal-open":Mo,"cardinal-closed":xo,monotone:To});El.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var Al=[0,2/3,1/3,0],Nl=[0,1/3,2/3,0],Cl=[0,1/6,2/3,1/6];ta.svg.line.radial=function(){var n=ho(Ro);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},mo.reverse=yo,yo.reverse=mo,ta.svg.area=function(){return Do(y)},ta.svg.area.radial=function(){var n=Do(Ro);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},ta.svg.chord=function(){function n(n,a){var c=t(this,i,n,a),l=t(this,o,n,a);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,l)?u(c.r,c.p1,c.r,c.p0):u(c.r,c.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+u(l.r,l.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var u=t.call(n,e,r),i=a.call(n,u,r),o=c.call(n,u,r)-Ra,s=l.call(n,u,r)-Ra;return{r:i,a0:o,a1:s,p0:[i*Math.cos(o),i*Math.sin(o)],p1:[i*Math.cos(s),i*Math.sin(s)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>qa)+",1 "+t}function u(n,t,e,r){return"Q 0,0 "+r}var i=mr,o=yr,a=Po,c=ao,l=co;return n.radius=function(t){return arguments.length?(a=Et(t),n):a},n.source=function(t){return arguments.length?(i=Et(t),n):i},n.target=function(t){return arguments.length?(o=Et(t),n):o},n.startAngle=function(t){return arguments.length?(c=Et(t),n):c},n.endAngle=function(t){return arguments.length?(l=Et(t),n):l},n},ta.svg.diagonal=function(){function n(n,u){var i=t.call(this,n,u),o=e.call(this,n,u),a=(i.y+o.y)/2,c=[i,{x:i.x,y:a},{x:o.x,y:a},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=mr,e=yr,r=Uo;return n.source=function(e){return arguments.length?(t=Et(e),n):t},n.target=function(t){return arguments.length?(e=Et(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},ta.svg.diagonal.radial=function(){var n=ta.svg.diagonal(),t=Uo,e=n.projection;return n.projection=function(n){return arguments.length?e(jo(t=n)):t},n},ta.svg.symbol=function(){function n(n,r){return(zl.get(t.call(this,n,r))||Oo)(e.call(this,n,r))}var t=Ho,e=Fo;return n.type=function(e){return arguments.length?(t=Et(e),n):t},n.size=function(t){return arguments.length?(e=Et(t),n):e},n};var zl=ta.map({circle:Oo,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*Ll)),e=t*Ll;return"M0,"+-t+"L"+e+",0 0,"+t+" "+-e+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/ql),e=t*ql/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/ql),e=t*ql/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});ta.svg.symbolTypes=zl.keys();var ql=Math.sqrt(3),Ll=Math.tan(30*Da);_a.transition=function(n){for(var t,e,r=Tl||++Ul,u=Xo(n),i=[],o=Rl||{time:Date.now(),ease:Su,delay:0,duration:250},a=-1,c=this.length;++ai;i++){u.push(t=[]);for(var e=this[i],a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return Yo(u,this.namespace,this.id)},Pl.tween=function(n,t){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(n):Y(this,null==t?function(t){t[r][e].tween.remove(n)}:function(u){u[r][e].tween.set(n,t)})},Pl.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function u(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function i(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?Hu:mu,a=ta.ns.qualify(n);return Zo(this,"attr."+n,t,a.local?i:u)},Pl.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(u));return r&&function(n){this.setAttribute(u,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(u.space,u.local));return r&&function(n){this.setAttributeNS(u.space,u.local,r(n))}}var u=ta.ns.qualify(n);return this.tween("attr."+n,u.local?r:e)},Pl.style=function(n,e,r){function u(){this.style.removeProperty(n)}function i(e){return null==e?u:(e+="",function(){var u,i=t(this).getComputedStyle(this,null).getPropertyValue(n);return i!==e&&(u=mu(i,e),function(t){this.style.setProperty(n,u(t),r)})})}var o=arguments.length;if(3>o){if("string"!=typeof n){2>o&&(e="");for(r in n)this.style(r,n[r],e);return this}r=""}return Zo(this,"style."+n,e,i)},Pl.styleTween=function(n,e,r){function u(u,i){var o=e.call(this,u,i,t(this).getComputedStyle(this,null).getPropertyValue(n));return o&&function(t){this.style.setProperty(n,o(t),r)}}return arguments.length<3&&(r=""),this.tween("style."+n,u)},Pl.text=function(n){return Zo(this,"text",n,Vo)},Pl.remove=function(){var n=this.namespace;return this.each("end.transition",function(){var t;this[n].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Pl.ease=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].ease:("function"!=typeof n&&(n=ta.ease.apply(ta,arguments)),Y(this,function(r){r[e][t].ease=n}))},Pl.delay=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].delay:Y(this,"function"==typeof n?function(r,u,i){r[e][t].delay=+n.call(r,r.__data__,u,i)}:(n=+n,function(r){r[e][t].delay=n}))},Pl.duration=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].duration:Y(this,"function"==typeof n?function(r,u,i){r[e][t].duration=Math.max(1,n.call(r,r.__data__,u,i))}:(n=Math.max(1,n),function(r){r[e][t].duration=n}))},Pl.each=function(n,t){var e=this.id,r=this.namespace;if(arguments.length<2){var u=Rl,i=Tl;try{Tl=e,Y(this,function(t,u,i){Rl=t[r][e],n.call(t,t.__data__,u,i)})}finally{Rl=u,Tl=i}}else Y(this,function(u){var i=u[r][e];(i.event||(i.event=ta.dispatch("start","end","interrupt"))).on(n,t)});return this},Pl.transition=function(){for(var n,t,e,r,u=this.id,i=++Ul,o=this.namespace,a=[],c=0,l=this.length;l>c;c++){a.push(n=[]);for(var t=this[c],s=0,f=t.length;f>s;s++)(e=t[s])&&(r=e[o][u],$o(e,s,o,i,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),n.push(e)}return Yo(a,o,i)},ta.svg.axis=function(){function n(n){n.each(function(){var n,l=ta.select(this),s=this.__chart__||e,f=this.__chart__=e.copy(),h=null==c?f.ticks?f.ticks.apply(f,a):f.domain():c,g=null==t?f.tickFormat?f.tickFormat.apply(f,a):y:t,p=l.selectAll(".tick").data(h,f),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Ca),d=ta.transition(p.exit()).style("opacity",Ca).remove(),m=ta.transition(p.order()).style("opacity",1),M=Math.max(u,0)+o,x=Ui(f),b=l.selectAll(".domain").data([0]),_=(b.enter().append("path").attr("class","domain"),ta.transition(b));v.append("line"),v.append("text");var w,S,k,E,A=v.select("line"),N=m.select("line"),C=p.select("text").text(g),z=v.select("text"),q=m.select("text"),L="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(n=Bo,w="x",k="y",S="x2",E="y2",C.attr("dy",0>L?"0em":".71em").style("text-anchor","middle"),_.attr("d","M"+x[0]+","+L*i+"V0H"+x[1]+"V"+L*i)):(n=Wo,w="y",k="x",S="y2",E="x2",C.attr("dy",".32em").style("text-anchor",0>L?"end":"start"),_.attr("d","M"+L*i+","+x[0]+"H0V"+x[1]+"H"+L*i)),A.attr(E,L*u),z.attr(k,L*M),N.attr(S,0).attr(E,L*u),q.attr(w,0).attr(k,L*M),f.rangeBand){var T=f,R=T.rangeBand()/2;s=f=function(n){return T(n)+R}}else s.rangeBand?s=f:d.call(n,f,s);v.call(n,s,f),m.call(n,f,f)})}var t,e=ta.scale.linear(),r=jl,u=6,i=6,o=3,a=[10],c=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Fl?t+"":jl,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(u=+t,i=+arguments[e-1],n):u},n.innerTickSize=function(t){return arguments.length?(u=+t,n):u},n.outerTickSize=function(t){return arguments.length?(i=+t,n):i},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var jl="bottom",Fl={top:1,right:1,bottom:1,left:1};ta.svg.brush=function(){function n(t){t.each(function(){var t=ta.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",i).on("touchstart.brush",i),o=t.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=t.selectAll(".resize").data(v,y);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Hl[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var c,f=ta.transition(t),h=ta.transition(o);l&&(c=Ui(l),h.attr("x",c[0]).attr("width",c[1]-c[0]),r(f)),s&&(c=Ui(s),h.attr("y",c[0]).attr("height",c[1]-c[0]),u(f)),e(f)})}function e(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+f[+/e$/.test(n)]+","+h[+/^s/.test(n)]+")"})}function r(n){n.select(".extent").attr("x",f[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1]-f[0])}function u(n){n.select(".extent").attr("y",h[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function i(){function i(){32==ta.event.keyCode&&(C||(M=null,q[0]-=f[1],q[1]-=h[1],C=2),S())}function v(){32==ta.event.keyCode&&2==C&&(q[0]+=f[1],q[1]+=h[1],C=0,S())}function d(){var n=ta.mouse(b),t=!1;x&&(n[0]+=x[0],n[1]+=x[1]),C||(ta.event.altKey?(M||(M=[(f[0]+f[1])/2,(h[0]+h[1])/2]),q[0]=f[+(n[0]s?(u=r,r=s):u=s),v[0]!=r||v[1]!=u?(e?a=null:o=null,v[0]=r,v[1]=u,!0):void 0}function y(){d(),k.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),ta.select("body").style("cursor",null),L.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),z(),w({type:"brushend"})}var M,x,b=this,_=ta.select(ta.event.target),w=c.of(b,arguments),k=ta.select(b),E=_.datum(),A=!/^(n|s)$/.test(E)&&l,N=!/^(e|w)$/.test(E)&&s,C=_.classed("extent"),z=W(b),q=ta.mouse(b),L=ta.select(t(b)).on("keydown.brush",i).on("keyup.brush",v);if(ta.event.changedTouches?L.on("touchmove.brush",d).on("touchend.brush",y):L.on("mousemove.brush",d).on("mouseup.brush",y),k.interrupt().selectAll("*").interrupt(),C)q[0]=f[0]-q[0],q[1]=h[0]-q[1];else if(E){var T=+/w$/.test(E),R=+/^n/.test(E);x=[f[1-T]-q[0],h[1-R]-q[1]],q[0]=f[T],q[1]=h[R]}else ta.event.altKey&&(M=q.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),ta.select("body").style("cursor",_.style("cursor")),w({type:"brushstart"}),d()}var o,a,c=E(n,"brushstart","brush","brushend"),l=null,s=null,f=[0,0],h=[0,0],g=!0,p=!0,v=Ol[0];return n.event=function(n){n.each(function(){var n=c.of(this,arguments),t={x:f,y:h,i:o,j:a},e=this.__chart__||t;this.__chart__=t,Tl?ta.select(this).transition().each("start.brush",function(){o=e.i,a=e.j,f=e.x,h=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=yu(f,t.x),r=yu(h,t.y);return o=a=null,function(u){f=t.x=e(u),h=t.y=r(u),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=t.i,a=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(l=t,v=Ol[!l<<1|!s],n):l},n.y=function(t){return arguments.length?(s=t,v=Ol[!l<<1|!s],n):s},n.clamp=function(t){return arguments.length?(l&&s?(g=!!t[0],p=!!t[1]):l?g=!!t:s&&(p=!!t),n):l&&s?[g,p]:l?g:s?p:null},n.extent=function(t){var e,r,u,i,c;return arguments.length?(l&&(e=t[0],r=t[1],s&&(e=e[0],r=r[0]),o=[e,r],l.invert&&(e=l(e),r=l(r)),e>r&&(c=e,e=r,r=c),(e!=f[0]||r!=f[1])&&(f=[e,r])),s&&(u=t[0],i=t[1],l&&(u=u[1],i=i[1]),a=[u,i],s.invert&&(u=s(u),i=s(i)),u>i&&(c=u,u=i,i=c),(u!=h[0]||i!=h[1])&&(h=[u,i])),n):(l&&(o?(e=o[0],r=o[1]):(e=f[0],r=f[1],l.invert&&(e=l.invert(e),r=l.invert(r)),e>r&&(c=e,e=r,r=c))),s&&(a?(u=a[0],i=a[1]):(u=h[0],i=h[1],s.invert&&(u=s.invert(u),i=s.invert(i)),u>i&&(c=u,u=i,i=c))),l&&s?[[e,u],[r,i]]:l?[e,r]:s&&[u,i])},n.clear=function(){return n.empty()||(f=[0,0],h=[0,0],o=a=null),n},n.empty=function(){return!!l&&f[0]==f[1]||!!s&&h[0]==h[1]},ta.rebind(n,c,"on")};var Hl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ol=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Il=ac.format=gc.timeFormat,Yl=Il.utc,Zl=Yl("%Y-%m-%dT%H:%M:%S.%LZ");Il.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Jo:Zl,Jo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Jo.toString=Zl.toString,ac.second=Ft(function(n){return new cc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),ac.seconds=ac.second.range,ac.seconds.utc=ac.second.utc.range,ac.minute=Ft(function(n){return new cc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),ac.minutes=ac.minute.range,ac.minutes.utc=ac.minute.utc.range,ac.hour=Ft(function(n){var t=n.getTimezoneOffset()/60;return new cc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),ac.hours=ac.hour.range,ac.hours.utc=ac.hour.utc.range,ac.month=Ft(function(n){return n=ac.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),ac.months=ac.month.range,ac.months.utc=ac.month.utc.range;var Vl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Xl=[[ac.second,1],[ac.second,5],[ac.second,15],[ac.second,30],[ac.minute,1],[ac.minute,5],[ac.minute,15],[ac.minute,30],[ac.hour,1],[ac.hour,3],[ac.hour,6],[ac.hour,12],[ac.day,1],[ac.day,2],[ac.week,1],[ac.month,1],[ac.month,3],[ac.year,1]],$l=Il.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",Ne]]),Bl={range:function(n,t,e){return ta.range(Math.ceil(n/e)*e,+t,e).map(Ko)},floor:y,ceil:y};Xl.year=ac.year,ac.scale=function(){return Go(ta.scale.linear(),Xl,$l)};var Wl=Xl.map(function(n){return[n[0].utc,n[1]]}),Jl=Yl.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",Ne]]);Wl.year=ac.year.utc,ac.scale.utc=function(){return Go(ta.scale.linear(),Wl,Jl)},ta.text=At(function(n){return n.responseText}),ta.json=function(n,t){return Nt(n,"application/json",Qo,t)},ta.html=function(n,t){return Nt(n,"text/html",na,t)},ta.xml=At(function(n){return n.responseXML}),"function"==typeof define&&define.amd?define(ta):"object"==typeof module&&module.exports&&(module.exports=ta),this.d3=ta}(); \ No newline at end of file diff --git a/paper/benchmark/attic/mlr3torch_files/highlight-11.10.0/LICENSE b/paper/benchmark/attic/mlr3torch_files/highlight-11.10.0/LICENSE new file mode 100644 index 000000000..422deb735 --- /dev/null +++ b/paper/benchmark/attic/mlr3torch_files/highlight-11.10.0/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2006, Ivan Sagalaev +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. + * Neither the name of highlight.js nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/paper/benchmark/attic/mlr3torch_files/highlight-11.10.0/highlight.min.js b/paper/benchmark/attic/mlr3torch_files/highlight-11.10.0/highlight.min.js new file mode 100644 index 000000000..1af562cd1 --- /dev/null +++ b/paper/benchmark/attic/mlr3torch_files/highlight-11.10.0/highlight.min.js @@ -0,0 +1,334 @@ +/*! + Highlight.js v11.10.0 (git: 366a8bd012) + (c) 2006-2024 Josh Goebel and other contributors + License: BSD-3-Clause + */ +var hljs=function(){"use strict";function e(t){ +return t instanceof Map?t.clear=t.delete=t.set=()=>{ +throw Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=()=>{ +throw Error("set is read-only") +}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach((n=>{ +const i=t[n],s=typeof i;"object"!==s&&"function"!==s||Object.isFrozen(i)||e(i) +})),t}class t{constructor(e){ +void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1} +ignoreMatch(){this.isMatchIgnored=!0}}function n(e){ +return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'") +}function i(e,...t){const n=Object.create(null);for(const t in e)n[t]=e[t] +;return t.forEach((e=>{for(const t in e)n[t]=e[t]})),n}const s=e=>!!e.scope +;class o{constructor(e,t){ +this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){ +this.buffer+=n(e)}openNode(e){if(!s(e))return;const t=((e,{prefix:t})=>{ +if(e.startsWith("language:"))return e.replace("language:","language-") +;if(e.includes(".")){const n=e.split(".") +;return[`${t}${n.shift()}`,...n.map(((e,t)=>`${e}${"_".repeat(t+1)}`))].join(" ") +}return`${t}${e}`})(e.scope,{prefix:this.classPrefix});this.span(t)} +closeNode(e){s(e)&&(this.buffer+="")}value(){return this.buffer}span(e){ +this.buffer+=``}}const r=(e={})=>{const t={children:[]} +;return Object.assign(t,e),t};class a{constructor(){ +this.rootNode=r(),this.stack=[this.rootNode]}get top(){ +return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){ +this.top.children.push(e)}openNode(e){const t=r({scope:e}) +;this.add(t),this.stack.push(t)}closeNode(){ +if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){ +for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)} +walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){ +return"string"==typeof t?e.addText(t):t.children&&(e.openNode(t), +t.children.forEach((t=>this._walk(e,t))),e.closeNode(t)),e}static _collapse(e){ +"string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{ +a._collapse(e)})))}}class c extends a{constructor(e){super(),this.options=e} +addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){ +this.closeNode()}__addSublanguage(e,t){const n=e.root +;t&&(n.scope="language:"+t),this.add(n)}toHTML(){ +return new o(this,this.options).value()}finalize(){ +return this.closeAllNodes(),!0}}function l(e){ +return e?"string"==typeof e?e:e.source:null}function g(e){return h("(?=",e,")")} +function u(e){return h("(?:",e,")*")}function d(e){return h("(?:",e,")?")} +function h(...e){return e.map((e=>l(e))).join("")}function f(...e){const t=(e=>{ +const t=e[e.length-1] +;return"object"==typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{} +})(e);return"("+(t.capture?"":"?:")+e.map((e=>l(e))).join("|")+")"} +function p(e){return RegExp(e.toString()+"|").exec("").length-1} +const b=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./ +;function m(e,{joinWith:t}){let n=0;return e.map((e=>{n+=1;const t=n +;let i=l(e),s="";for(;i.length>0;){const e=b.exec(i);if(!e){s+=i;break} +s+=i.substring(0,e.index), +i=i.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?s+="\\"+(Number(e[1])+t):(s+=e[0], +"("===e[0]&&n++)}return s})).map((e=>`(${e})`)).join(t)} +const E="[a-zA-Z]\\w*",x="[a-zA-Z_]\\w*",w="\\b\\d+(\\.\\d+)?",y="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",_="\\b(0b[01]+)",O={ +begin:"\\\\[\\s\\S]",relevance:0},v={scope:"string",begin:"'",end:"'", +illegal:"\\n",contains:[O]},k={scope:"string",begin:'"',end:'"',illegal:"\\n", +contains:[O]},N=(e,t,n={})=>{const s=i({scope:"comment",begin:e,end:t, +contains:[]},n);s.contains.push({scope:"doctag", +begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)", +end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0}) +;const o=f("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/) +;return s.contains.push({begin:h(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s +},S=N("//","$"),M=N("/\\*","\\*/"),R=N("#","$");var j=Object.freeze({ +__proto__:null,APOS_STRING_MODE:v,BACKSLASH_ESCAPE:O,BINARY_NUMBER_MODE:{ +scope:"number",begin:_,relevance:0},BINARY_NUMBER_RE:_,COMMENT:N, +C_BLOCK_COMMENT_MODE:M,C_LINE_COMMENT_MODE:S,C_NUMBER_MODE:{scope:"number", +begin:y,relevance:0},C_NUMBER_RE:y,END_SAME_AS_BEGIN:e=>Object.assign(e,{ +"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{ +t.data._beginMatch!==e[1]&&t.ignoreMatch()}}),HASH_COMMENT_MODE:R,IDENT_RE:E, +MATCH_NOTHING_RE:/\b\B/,METHOD_GUARD:{begin:"\\.\\s*"+x,relevance:0}, +NUMBER_MODE:{scope:"number",begin:w,relevance:0},NUMBER_RE:w, +PHRASAL_WORDS_MODE:{ +begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ +},QUOTE_STRING_MODE:k,REGEXP_MODE:{scope:"regexp",begin:/\/(?=[^/\n]*\/)/, +end:/\/[gimuy]*/,contains:[O,{begin:/\[/,end:/\]/,relevance:0,contains:[O]}]}, +RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", +SHEBANG:(e={})=>{const t=/^#![ ]*\// +;return e.binary&&(e.begin=h(t,/.*\b/,e.binary,/\b.*/)),i({scope:"meta",begin:t, +end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)}, +TITLE_MODE:{scope:"title",begin:E,relevance:0},UNDERSCORE_IDENT_RE:x, +UNDERSCORE_TITLE_MODE:{scope:"title",begin:x,relevance:0}});function A(e,t){ +"."===e.input[e.index-1]&&t.ignoreMatch()}function I(e,t){ +void 0!==e.className&&(e.scope=e.className,delete e.className)}function T(e,t){ +t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)", +e.__beforeBegin=A,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords, +void 0===e.relevance&&(e.relevance=0))}function L(e,t){ +Array.isArray(e.illegal)&&(e.illegal=f(...e.illegal))}function B(e,t){ +if(e.match){ +if(e.begin||e.end)throw Error("begin & end are not supported with match") +;e.begin=e.match,delete e.match}}function P(e,t){ +void 0===e.relevance&&(e.relevance=1)}const D=(e,t)=>{if(!e.beforeMatch)return +;if(e.starts)throw Error("beforeMatch cannot be used with starts") +;const n=Object.assign({},e);Object.keys(e).forEach((t=>{delete e[t] +})),e.keywords=n.keywords,e.begin=h(n.beforeMatch,g(n.begin)),e.starts={ +relevance:0,contains:[Object.assign(n,{endsParent:!0})] +},e.relevance=0,delete n.beforeMatch +},H=["of","and","for","in","not","or","if","then","parent","list","value"],C="keyword" +;function $(e,t,n=C){const i=Object.create(null) +;return"string"==typeof e?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach((n=>{ +Object.assign(i,$(e[n],t,n))})),i;function s(e,n){ +t&&(n=n.map((e=>e.toLowerCase()))),n.forEach((t=>{const n=t.split("|") +;i[n[0]]=[e,U(n[0],n[1])]}))}}function U(e,t){ +return t?Number(t):(e=>H.includes(e.toLowerCase()))(e)?0:1}const z={},W=e=>{ +console.error(e)},X=(e,...t)=>{console.log("WARN: "+e,...t)},G=(e,t)=>{ +z[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),z[`${e}/${t}`]=!0) +},K=Error();function F(e,t,{key:n}){let i=0;const s=e[n],o={},r={} +;for(let e=1;e<=t.length;e++)r[e+i]=s[e],o[e+i]=!0,i+=p(t[e-1]) +;e[n]=r,e[n]._emit=o,e[n]._multi=!0}function Z(e){(e=>{ +e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope, +delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={ +_wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope +}),(e=>{if(Array.isArray(e.begin)){ +if(e.skip||e.excludeBegin||e.returnBegin)throw W("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), +K +;if("object"!=typeof e.beginScope||null===e.beginScope)throw W("beginScope must be object"), +K;F(e,e.begin,{key:"beginScope"}),e.begin=m(e.begin,{joinWith:""})}})(e),(e=>{ +if(Array.isArray(e.end)){ +if(e.skip||e.excludeEnd||e.returnEnd)throw W("skip, excludeEnd, returnEnd not compatible with endScope: {}"), +K +;if("object"!=typeof e.endScope||null===e.endScope)throw W("endScope must be object"), +K;F(e,e.end,{key:"endScope"}),e.end=m(e.end,{joinWith:""})}})(e)}function V(e){ +function t(t,n){ +return RegExp(l(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":"")) +}class n{constructor(){ +this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0} +addRule(e,t){ +t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]), +this.matchAt+=p(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null) +;const e=this.regexes.map((e=>e[1]));this.matcherRe=t(m(e,{joinWith:"|" +}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex +;const t=this.matcherRe.exec(e);if(!t)return null +;const n=t.findIndex(((e,t)=>t>0&&void 0!==e)),i=this.matchIndexes[n] +;return t.splice(0,n),Object.assign(t,i)}}class s{constructor(){ +this.rules=[],this.multiRegexes=[], +this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){ +if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n +;return this.rules.slice(e).forEach((([e,n])=>t.addRule(e,n))), +t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){ +return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){ +this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){ +const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex +;let n=t.exec(e) +;if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{ +const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)} +return n&&(this.regexIndex+=n.position+1, +this.regexIndex===this.count&&this.considerAll()),n}} +if(e.compilerExtensions||(e.compilerExtensions=[]), +e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.") +;return e.classNameAliases=i(e.classNameAliases||{}),function n(o,r){const a=o +;if(o.isCompiled)return a +;[I,B,Z,D].forEach((e=>e(o,r))),e.compilerExtensions.forEach((e=>e(o,r))), +o.__beforeBegin=null,[T,L,P].forEach((e=>e(o,r))),o.isCompiled=!0;let c=null +;return"object"==typeof o.keywords&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords), +c=o.keywords.$pattern, +delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=$(o.keywords,e.case_insensitive)), +a.keywordPatternRe=t(c,!0), +r&&(o.begin||(o.begin=/\B|\b/),a.beginRe=t(a.begin),o.end||o.endsWithParent||(o.end=/\B|\b/), +o.end&&(a.endRe=t(a.end)), +a.terminatorEnd=l(a.end)||"",o.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(o.end?"|":"")+r.terminatorEnd)), +o.illegal&&(a.illegalRe=t(o.illegal)), +o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>i(e,{ +variants:null},t)))),e.cachedVariants?e.cachedVariants:q(e)?i(e,{ +starts:e.starts?i(e.starts):null +}):Object.isFrozen(e)?i(e):e))("self"===e?o:e)))),o.contains.forEach((e=>{n(e,a) +})),o.starts&&n(o.starts,r),a.matcher=(e=>{const t=new s +;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin" +}))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end" +}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(a),a}(e)}function q(e){ +return!!e&&(e.endsWithParent||q(e.starts))}class J extends Error{ +constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}} +const Y=n,Q=i,ee=Symbol("nomatch"),te=n=>{ +const i=Object.create(null),s=Object.create(null),o=[];let r=!0 +;const a="Could not find the language '{}', did you forget to load/include a language module?",l={ +disableAutodetect:!0,name:"Plain text",contains:[]};let p={ +ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i, +languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-", +cssSelector:"pre code",languages:null,__emitter:c};function b(e){ +return p.noHighlightRe.test(e)}function m(e,t,n){let i="",s="" +;"object"==typeof t?(i=e, +n=t.ignoreIllegals,s=t.language):(G("10.7.0","highlight(lang, code, ...args) has been deprecated."), +G("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"), +s=e,i=t),void 0===n&&(n=!0);const o={code:i,language:s};N("before:highlight",o) +;const r=o.result?o.result:E(o.language,o.code,n) +;return r.code=o.code,N("after:highlight",r),r}function E(e,n,s,o){ +const c=Object.create(null);function l(){if(!N.keywords)return void M.addText(R) +;let e=0;N.keywordPatternRe.lastIndex=0;let t=N.keywordPatternRe.exec(R),n="" +;for(;t;){n+=R.substring(e,t.index) +;const s=_.case_insensitive?t[0].toLowerCase():t[0],o=(i=s,N.keywords[i]);if(o){ +const[e,i]=o +;if(M.addText(n),n="",c[s]=(c[s]||0)+1,c[s]<=7&&(j+=i),e.startsWith("_"))n+=t[0];else{ +const n=_.classNameAliases[e]||e;u(t[0],n)}}else n+=t[0] +;e=N.keywordPatternRe.lastIndex,t=N.keywordPatternRe.exec(R)}var i +;n+=R.substring(e),M.addText(n)}function g(){null!=N.subLanguage?(()=>{ +if(""===R)return;let e=null;if("string"==typeof N.subLanguage){ +if(!i[N.subLanguage])return void M.addText(R) +;e=E(N.subLanguage,R,!0,S[N.subLanguage]),S[N.subLanguage]=e._top +}else e=x(R,N.subLanguage.length?N.subLanguage:null) +;N.relevance>0&&(j+=e.relevance),M.__addSublanguage(e._emitter,e.language) +})():l(),R=""}function u(e,t){ +""!==e&&(M.startScope(t),M.addText(e),M.endScope())}function d(e,t){let n=1 +;const i=t.length-1;for(;n<=i;){if(!e._emit[n]){n++;continue} +const i=_.classNameAliases[e[n]]||e[n],s=t[n];i?u(s,i):(R=s,l(),R=""),n++}} +function h(e,t){ +return e.scope&&"string"==typeof e.scope&&M.openNode(_.classNameAliases[e.scope]||e.scope), +e.beginScope&&(e.beginScope._wrap?(u(R,_.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap), +R=""):e.beginScope._multi&&(d(e.beginScope,t),R="")),N=Object.create(e,{parent:{ +value:N}}),N}function f(e,n,i){let s=((e,t)=>{const n=e&&e.exec(t) +;return n&&0===n.index})(e.endRe,i);if(s){if(e["on:end"]){const i=new t(e) +;e["on:end"](n,i),i.isMatchIgnored&&(s=!1)}if(s){ +for(;e.endsParent&&e.parent;)e=e.parent;return e}} +if(e.endsWithParent)return f(e.parent,n,i)}function b(e){ +return 0===N.matcher.regexIndex?(R+=e[0],1):(T=!0,0)}function m(e){ +const t=e[0],i=n.substring(e.index),s=f(N,e,i);if(!s)return ee;const o=N +;N.endScope&&N.endScope._wrap?(g(), +u(t,N.endScope._wrap)):N.endScope&&N.endScope._multi?(g(), +d(N.endScope,e)):o.skip?R+=t:(o.returnEnd||o.excludeEnd||(R+=t), +g(),o.excludeEnd&&(R=t));do{ +N.scope&&M.closeNode(),N.skip||N.subLanguage||(j+=N.relevance),N=N.parent +}while(N!==s.parent);return s.starts&&h(s.starts,e),o.returnEnd?0:t.length} +let w={};function y(i,o){const a=o&&o[0];if(R+=i,null==a)return g(),0 +;if("begin"===w.type&&"end"===o.type&&w.index===o.index&&""===a){ +if(R+=n.slice(o.index,o.index+1),!r){const t=Error(`0 width match regex (${e})`) +;throw t.languageName=e,t.badRule=w.rule,t}return 1} +if(w=o,"begin"===o.type)return(e=>{ +const n=e[0],i=e.rule,s=new t(i),o=[i.__beforeBegin,i["on:begin"]] +;for(const t of o)if(t&&(t(e,s),s.isMatchIgnored))return b(n) +;return i.skip?R+=n:(i.excludeBegin&&(R+=n), +g(),i.returnBegin||i.excludeBegin||(R=n)),h(i,e),i.returnBegin?0:n.length})(o) +;if("illegal"===o.type&&!s){ +const e=Error('Illegal lexeme "'+a+'" for mode "'+(N.scope||"")+'"') +;throw e.mode=N,e}if("end"===o.type){const e=m(o);if(e!==ee)return e} +if("illegal"===o.type&&""===a)return 1 +;if(I>1e5&&I>3*o.index)throw Error("potential infinite loop, way more iterations than matches") +;return R+=a,a.length}const _=O(e) +;if(!_)throw W(a.replace("{}",e)),Error('Unknown language: "'+e+'"') +;const v=V(_);let k="",N=o||v;const S={},M=new p.__emitter(p);(()=>{const e=[] +;for(let t=N;t!==_;t=t.parent)t.scope&&e.unshift(t.scope) +;e.forEach((e=>M.openNode(e)))})();let R="",j=0,A=0,I=0,T=!1;try{ +if(_.__emitTokens)_.__emitTokens(n,M);else{for(N.matcher.considerAll();;){ +I++,T?T=!1:N.matcher.considerAll(),N.matcher.lastIndex=A +;const e=N.matcher.exec(n);if(!e)break;const t=y(n.substring(A,e.index),e) +;A=e.index+t}y(n.substring(A))}return M.finalize(),k=M.toHTML(),{language:e, +value:k,relevance:j,illegal:!1,_emitter:M,_top:N}}catch(t){ +if(t.message&&t.message.includes("Illegal"))return{language:e,value:Y(n), +illegal:!0,relevance:0,_illegalBy:{message:t.message,index:A, +context:n.slice(A-100,A+100),mode:t.mode,resultSoFar:k},_emitter:M};if(r)return{ +language:e,value:Y(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:N} +;throw t}}function x(e,t){t=t||p.languages||Object.keys(i);const n=(e=>{ +const t={value:Y(e),illegal:!1,relevance:0,_top:l,_emitter:new p.__emitter(p)} +;return t._emitter.addText(e),t})(e),s=t.filter(O).filter(k).map((t=>E(t,e,!1))) +;s.unshift(n);const o=s.sort(((e,t)=>{ +if(e.relevance!==t.relevance)return t.relevance-e.relevance +;if(e.language&&t.language){if(O(e.language).supersetOf===t.language)return 1 +;if(O(t.language).supersetOf===e.language)return-1}return 0})),[r,a]=o,c=r +;return c.secondBest=a,c}function w(e){let t=null;const n=(e=>{ +let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"" +;const n=p.languageDetectRe.exec(t);if(n){const t=O(n[1]) +;return t||(X(a.replace("{}",n[1])), +X("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"} +return t.split(/\s+/).find((e=>b(e)||O(e)))})(e);if(b(n))return +;if(N("before:highlightElement",{el:e,language:n +}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e) +;if(e.children.length>0&&(p.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), +console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), +console.warn("The element with unescaped HTML:"), +console.warn(e)),p.throwUnescapedHTML))throw new J("One of your code blocks includes unescaped HTML.",e.innerHTML) +;t=e;const i=t.textContent,o=n?m(i,{language:n,ignoreIllegals:!0}):x(i) +;e.innerHTML=o.value,e.dataset.highlighted="yes",((e,t,n)=>{const i=t&&s[t]||n +;e.classList.add("hljs"),e.classList.add("language-"+i) +})(e,n,o.language),e.result={language:o.language,re:o.relevance, +relevance:o.relevance},o.secondBest&&(e.secondBest={ +language:o.secondBest.language,relevance:o.secondBest.relevance +}),N("after:highlightElement",{el:e,result:o,text:i})}let y=!1;function _(){ +"loading"!==document.readyState?document.querySelectorAll(p.cssSelector).forEach(w):y=!0 +}function O(e){return e=(e||"").toLowerCase(),i[e]||i[s[e]]} +function v(e,{languageName:t}){"string"==typeof e&&(e=[e]),e.forEach((e=>{ +s[e.toLowerCase()]=t}))}function k(e){const t=O(e) +;return t&&!t.disableAutodetect}function N(e,t){const n=e;o.forEach((e=>{ +e[n]&&e[n](t)}))} +"undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{ +y&&_()}),!1),Object.assign(n,{highlight:m,highlightAuto:x,highlightAll:_, +highlightElement:w, +highlightBlock:e=>(G("10.7.0","highlightBlock will be removed entirely in v12.0"), +G("10.7.0","Please use highlightElement now."),w(e)),configure:e=>{p=Q(p,e)}, +initHighlighting:()=>{ +_(),G("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")}, +initHighlightingOnLoad:()=>{ +_(),G("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.") +},registerLanguage:(e,t)=>{let s=null;try{s=t(n)}catch(t){ +if(W("Language definition for '{}' could not be registered.".replace("{}",e)), +!r)throw t;W(t),s=l} +s.name||(s.name=e),i[e]=s,s.rawDefinition=t.bind(null,n),s.aliases&&v(s.aliases,{ +languageName:e})},unregisterLanguage:e=>{delete i[e] +;for(const t of Object.keys(s))s[t]===e&&delete s[t]}, +listLanguages:()=>Object.keys(i),getLanguage:O,registerAliases:v, +autoDetection:k,inherit:Q,addPlugin:e=>{(e=>{ +e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{ +e["before:highlightBlock"](Object.assign({block:t.el},t)) +}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{ +e["after:highlightBlock"](Object.assign({block:t.el},t))})})(e),o.push(e)}, +removePlugin:e=>{const t=o.indexOf(e);-1!==t&&o.splice(t,1)}}),n.debugMode=()=>{ +r=!1},n.safeMode=()=>{r=!0},n.versionString="11.10.0",n.regex={concat:h, +lookahead:g,either:f,optional:d,anyNumberOfTimes:u} +;for(const t in j)"object"==typeof j[t]&&e(j[t]);return Object.assign(n,j),n +},ne=te({});return ne.newInstance=()=>te({}),ne}() +;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs);/*! `r` grammar compiled for Highlight.js 11.10.0 */ +(()=>{var e=(()=>{"use strict";return e=>{ +const a=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,i=a.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,t=a.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/) +;return{name:"R",keywords:{$pattern:n, +keyword:"function if in break next repeat else for while", +literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10", +built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm" +},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/, +starts:{end:a.lookahead(a.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)), +endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{ +scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0 +}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}] +}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE], +variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/ +}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/ +}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/ +}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/ +}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/ +}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"', +relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{ +1:"operator",2:"number"},match:[s,i]},{scope:{1:"operator",2:"number"}, +match:[/%[^%]*%/,i]},{scope:{1:"punctuation",2:"number"},match:[t,i]},{scope:{ +2:"number"},match:[/[^a-zA-Z0-9._]|^/,i]}]},{scope:{3:"operator"}, +match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{ +match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:t},{begin:"`",end:"`", +contains:[{begin:/\\./}]}]}}})();hljs.registerLanguage("r",e)})(); \ No newline at end of file diff --git a/paper/benchmark/attic/mlr3torch_files/highlight-11.10.0/textmate.css b/paper/benchmark/attic/mlr3torch_files/highlight-11.10.0/textmate.css new file mode 100644 index 000000000..909bb5f38 --- /dev/null +++ b/paper/benchmark/attic/mlr3torch_files/highlight-11.10.0/textmate.css @@ -0,0 +1,28 @@ +.profvis-code span.hljs-operator, +.profvis-code span.hljs-paren { + color: rgb(104, 118, 135) +} + +.profvis-code span.hljs-literal { + color: rgb(88, 72, 246) +} + +.profvis-code span.hljs-number { + color: rgb(0, 0, 205); +} + +.profvis-code span.hljs-comment { + color: rgb(76, 136, 107); +} + +.profvis-code span.hljs-keyword { + color: rgb(0, 0, 255); +} + +.profvis-code span.hljs-identifier { + color: rgb(0, 0, 0); +} + +.profvis-code span.hljs-string { + color: rgb(3, 106, 7); +} diff --git a/paper/benchmark/attic/mlr3torch_files/htmltools-fill-0.5.8.1/fill.css b/paper/benchmark/attic/mlr3torch_files/htmltools-fill-0.5.8.1/fill.css new file mode 100644 index 000000000..841ea9d59 --- /dev/null +++ b/paper/benchmark/attic/mlr3torch_files/htmltools-fill-0.5.8.1/fill.css @@ -0,0 +1,21 @@ +@layer htmltools { + .html-fill-container { + display: flex; + flex-direction: column; + /* Prevent the container from expanding vertically or horizontally beyond its + parent's constraints. */ + min-height: 0; + min-width: 0; + } + .html-fill-container > .html-fill-item { + /* Fill items can grow and shrink freely within + available vertical space in fillable container */ + flex: 1 1 auto; + min-height: 0; + min-width: 0; + } + .html-fill-container > :not(.html-fill-item) { + /* Prevent shrinking or growing of non-fill items */ + flex: 0 0 auto; + } +} diff --git a/paper/benchmark/attic/mlr3torch_files/htmlwidgets-1.6.4/htmlwidgets.js b/paper/benchmark/attic/mlr3torch_files/htmlwidgets-1.6.4/htmlwidgets.js new file mode 100644 index 000000000..1067d029f --- /dev/null +++ b/paper/benchmark/attic/mlr3torch_files/htmlwidgets-1.6.4/htmlwidgets.js @@ -0,0 +1,901 @@ +(function() { + // If window.HTMLWidgets is already defined, then use it; otherwise create a + // new object. This allows preceding code to set options that affect the + // initialization process (though none currently exist). + window.HTMLWidgets = window.HTMLWidgets || {}; + + // See if we're running in a viewer pane. If not, we're in a web browser. + var viewerMode = window.HTMLWidgets.viewerMode = + /\bviewer_pane=1\b/.test(window.location); + + // See if we're running in Shiny mode. If not, it's a static document. + // Note that static widgets can appear in both Shiny and static modes, but + // obviously, Shiny widgets can only appear in Shiny apps/documents. + var shinyMode = window.HTMLWidgets.shinyMode = + typeof(window.Shiny) !== "undefined" && !!window.Shiny.outputBindings; + + // We can't count on jQuery being available, so we implement our own + // version if necessary. + function querySelectorAll(scope, selector) { + if (typeof(jQuery) !== "undefined" && scope instanceof jQuery) { + return scope.find(selector); + } + if (scope.querySelectorAll) { + return scope.querySelectorAll(selector); + } + } + + function asArray(value) { + if (value === null) + return []; + if ($.isArray(value)) + return value; + return [value]; + } + + // Implement jQuery's extend + function extend(target /*, ... */) { + if (arguments.length == 1) { + return target; + } + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var prop in source) { + if (source.hasOwnProperty(prop)) { + target[prop] = source[prop]; + } + } + } + return target; + } + + // IE8 doesn't support Array.forEach. + function forEach(values, callback, thisArg) { + if (values.forEach) { + values.forEach(callback, thisArg); + } else { + for (var i = 0; i < values.length; i++) { + callback.call(thisArg, values[i], i, values); + } + } + } + + // Replaces the specified method with the return value of funcSource. + // + // Note that funcSource should not BE the new method, it should be a function + // that RETURNS the new method. funcSource receives a single argument that is + // the overridden method, it can be called from the new method. The overridden + // method can be called like a regular function, it has the target permanently + // bound to it so "this" will work correctly. + function overrideMethod(target, methodName, funcSource) { + var superFunc = target[methodName] || function() {}; + var superFuncBound = function() { + return superFunc.apply(target, arguments); + }; + target[methodName] = funcSource(superFuncBound); + } + + // Add a method to delegator that, when invoked, calls + // delegatee.methodName. If there is no such method on + // the delegatee, but there was one on delegator before + // delegateMethod was called, then the original version + // is invoked instead. + // For example: + // + // var a = { + // method1: function() { console.log('a1'); } + // method2: function() { console.log('a2'); } + // }; + // var b = { + // method1: function() { console.log('b1'); } + // }; + // delegateMethod(a, b, "method1"); + // delegateMethod(a, b, "method2"); + // a.method1(); + // a.method2(); + // + // The output would be "b1", "a2". + function delegateMethod(delegator, delegatee, methodName) { + var inherited = delegator[methodName]; + delegator[methodName] = function() { + var target = delegatee; + var method = delegatee[methodName]; + + // The method doesn't exist on the delegatee. Instead, + // call the method on the delegator, if it exists. + if (!method) { + target = delegator; + method = inherited; + } + + if (method) { + return method.apply(target, arguments); + } + }; + } + + // Implement a vague facsimilie of jQuery's data method + function elementData(el, name, value) { + if (arguments.length == 2) { + return el["htmlwidget_data_" + name]; + } else if (arguments.length == 3) { + el["htmlwidget_data_" + name] = value; + return el; + } else { + throw new Error("Wrong number of arguments for elementData: " + + arguments.length); + } + } + + // http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex + function escapeRegExp(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + } + + function hasClass(el, className) { + var re = new RegExp("\\b" + escapeRegExp(className) + "\\b"); + return re.test(el.className); + } + + // elements - array (or array-like object) of HTML elements + // className - class name to test for + // include - if true, only return elements with given className; + // if false, only return elements *without* given className + function filterByClass(elements, className, include) { + var results = []; + for (var i = 0; i < elements.length; i++) { + if (hasClass(elements[i], className) == include) + results.push(elements[i]); + } + return results; + } + + function on(obj, eventName, func) { + if (obj.addEventListener) { + obj.addEventListener(eventName, func, false); + } else if (obj.attachEvent) { + obj.attachEvent(eventName, func); + } + } + + function off(obj, eventName, func) { + if (obj.removeEventListener) + obj.removeEventListener(eventName, func, false); + else if (obj.detachEvent) { + obj.detachEvent(eventName, func); + } + } + + // Translate array of values to top/right/bottom/left, as usual with + // the "padding" CSS property + // https://developer.mozilla.org/en-US/docs/Web/CSS/padding + function unpackPadding(value) { + if (typeof(value) === "number") + value = [value]; + if (value.length === 1) { + return {top: value[0], right: value[0], bottom: value[0], left: value[0]}; + } + if (value.length === 2) { + return {top: value[0], right: value[1], bottom: value[0], left: value[1]}; + } + if (value.length === 3) { + return {top: value[0], right: value[1], bottom: value[2], left: value[1]}; + } + if (value.length === 4) { + return {top: value[0], right: value[1], bottom: value[2], left: value[3]}; + } + } + + // Convert an unpacked padding object to a CSS value + function paddingToCss(paddingObj) { + return paddingObj.top + "px " + paddingObj.right + "px " + paddingObj.bottom + "px " + paddingObj.left + "px"; + } + + // Makes a number suitable for CSS + function px(x) { + if (typeof(x) === "number") + return x + "px"; + else + return x; + } + + // Retrieves runtime widget sizing information for an element. + // The return value is either null, or an object with fill, padding, + // defaultWidth, defaultHeight fields. + function sizingPolicy(el) { + var sizingEl = document.querySelector("script[data-for='" + el.id + "'][type='application/htmlwidget-sizing']"); + if (!sizingEl) + return null; + var sp = JSON.parse(sizingEl.textContent || sizingEl.text || "{}"); + if (viewerMode) { + return sp.viewer; + } else { + return sp.browser; + } + } + + // @param tasks Array of strings (or falsy value, in which case no-op). + // Each element must be a valid JavaScript expression that yields a + // function. Or, can be an array of objects with "code" and "data" + // properties; in this case, the "code" property should be a string + // of JS that's an expr that yields a function, and "data" should be + // an object that will be added as an additional argument when that + // function is called. + // @param target The object that will be "this" for each function + // execution. + // @param args Array of arguments to be passed to the functions. (The + // same arguments will be passed to all functions.) + function evalAndRun(tasks, target, args) { + if (tasks) { + forEach(tasks, function(task) { + var theseArgs = args; + if (typeof(task) === "object") { + theseArgs = theseArgs.concat([task.data]); + task = task.code; + } + var taskFunc = tryEval(task); + if (typeof(taskFunc) !== "function") { + throw new Error("Task must be a function! Source:\n" + task); + } + taskFunc.apply(target, theseArgs); + }); + } + } + + // Attempt eval() both with and without enclosing in parentheses. + // Note that enclosing coerces a function declaration into + // an expression that eval() can parse + // (otherwise, a SyntaxError is thrown) + function tryEval(code) { + var result = null; + try { + result = eval("(" + code + ")"); + } catch(error) { + if (!(error instanceof SyntaxError)) { + throw error; + } + try { + result = eval(code); + } catch(e) { + if (e instanceof SyntaxError) { + throw error; + } else { + throw e; + } + } + } + return result; + } + + function initSizing(el) { + var sizing = sizingPolicy(el); + if (!sizing) + return; + + var cel = document.getElementById("htmlwidget_container"); + if (!cel) + return; + + if (typeof(sizing.padding) !== "undefined") { + document.body.style.margin = "0"; + document.body.style.padding = paddingToCss(unpackPadding(sizing.padding)); + } + + if (sizing.fill) { + document.body.style.overflow = "hidden"; + document.body.style.width = "100%"; + document.body.style.height = "100%"; + document.documentElement.style.width = "100%"; + document.documentElement.style.height = "100%"; + cel.style.position = "absolute"; + var pad = unpackPadding(sizing.padding); + cel.style.top = pad.top + "px"; + cel.style.right = pad.right + "px"; + cel.style.bottom = pad.bottom + "px"; + cel.style.left = pad.left + "px"; + el.style.width = "100%"; + el.style.height = "100%"; + + return { + getWidth: function() { return cel.getBoundingClientRect().width; }, + getHeight: function() { return cel.getBoundingClientRect().height; } + }; + + } else { + el.style.width = px(sizing.width); + el.style.height = px(sizing.height); + + return { + getWidth: function() { return cel.getBoundingClientRect().width; }, + getHeight: function() { return cel.getBoundingClientRect().height; } + }; + } + } + + // Default implementations for methods + var defaults = { + find: function(scope) { + return querySelectorAll(scope, "." + this.name); + }, + renderError: function(el, err) { + var $el = $(el); + + this.clearError(el); + + // Add all these error classes, as Shiny does + var errClass = "shiny-output-error"; + if (err.type !== null) { + // use the classes of the error condition as CSS class names + errClass = errClass + " " + $.map(asArray(err.type), function(type) { + return errClass + "-" + type; + }).join(" "); + } + errClass = errClass + " htmlwidgets-error"; + + // Is el inline or block? If inline or inline-block, just display:none it + // and add an inline error. + var display = $el.css("display"); + $el.data("restore-display-mode", display); + + if (display === "inline" || display === "inline-block") { + $el.hide(); + if (err.message !== "") { + var errorSpan = $("").addClass(errClass); + errorSpan.text(err.message); + $el.after(errorSpan); + } + } else if (display === "block") { + // If block, add an error just after the el, set visibility:none on the + // el, and position the error to be on top of the el. + // Mark it with a unique ID and CSS class so we can remove it later. + $el.css("visibility", "hidden"); + if (err.message !== "") { + var errorDiv = $("
").addClass(errClass).css("position", "absolute") + .css("top", el.offsetTop) + .css("left", el.offsetLeft) + // setting width can push out the page size, forcing otherwise + // unnecessary scrollbars to appear and making it impossible for + // the element to shrink; so use max-width instead + .css("maxWidth", el.offsetWidth) + .css("height", el.offsetHeight); + errorDiv.text(err.message); + $el.after(errorDiv); + + // Really dumb way to keep the size/position of the error in sync with + // the parent element as the window is resized or whatever. + var intId = setInterval(function() { + if (!errorDiv[0].parentElement) { + clearInterval(intId); + return; + } + errorDiv + .css("top", el.offsetTop) + .css("left", el.offsetLeft) + .css("maxWidth", el.offsetWidth) + .css("height", el.offsetHeight); + }, 500); + } + } + }, + clearError: function(el) { + var $el = $(el); + var display = $el.data("restore-display-mode"); + $el.data("restore-display-mode", null); + + if (display === "inline" || display === "inline-block") { + if (display) + $el.css("display", display); + $(el.nextSibling).filter(".htmlwidgets-error").remove(); + } else if (display === "block"){ + $el.css("visibility", "inherit"); + $(el.nextSibling).filter(".htmlwidgets-error").remove(); + } + }, + sizing: {} + }; + + // Called by widget bindings to register a new type of widget. The definition + // object can contain the following properties: + // - name (required) - A string indicating the binding name, which will be + // used by default as the CSS classname to look for. + // - initialize (optional) - A function(el) that will be called once per + // widget element; if a value is returned, it will be passed as the third + // value to renderValue. + // - renderValue (required) - A function(el, data, initValue) that will be + // called with data. Static contexts will cause this to be called once per + // element; Shiny apps will cause this to be called multiple times per + // element, as the data changes. + window.HTMLWidgets.widget = function(definition) { + if (!definition.name) { + throw new Error("Widget must have a name"); + } + if (!definition.type) { + throw new Error("Widget must have a type"); + } + // Currently we only support output widgets + if (definition.type !== "output") { + throw new Error("Unrecognized widget type '" + definition.type + "'"); + } + // TODO: Verify that .name is a valid CSS classname + + // Support new-style instance-bound definitions. Old-style class-bound + // definitions have one widget "object" per widget per type/class of + // widget; the renderValue and resize methods on such widget objects + // take el and instance arguments, because the widget object can't + // store them. New-style instance-bound definitions have one widget + // object per widget instance; the definition that's passed in doesn't + // provide renderValue or resize methods at all, just the single method + // factory(el, width, height) + // which returns an object that has renderValue(x) and resize(w, h). + // This enables a far more natural programming style for the widget + // author, who can store per-instance state using either OO-style + // instance fields or functional-style closure variables (I guess this + // is in contrast to what can only be called C-style pseudo-OO which is + // what we required before). + if (definition.factory) { + definition = createLegacyDefinitionAdapter(definition); + } + + if (!definition.renderValue) { + throw new Error("Widget must have a renderValue function"); + } + + // For static rendering (non-Shiny), use a simple widget registration + // scheme. We also use this scheme for Shiny apps/documents that also + // contain static widgets. + window.HTMLWidgets.widgets = window.HTMLWidgets.widgets || []; + // Merge defaults into the definition; don't mutate the original definition. + var staticBinding = extend({}, defaults, definition); + overrideMethod(staticBinding, "find", function(superfunc) { + return function(scope) { + var results = superfunc(scope); + // Filter out Shiny outputs, we only want the static kind + return filterByClass(results, "html-widget-output", false); + }; + }); + window.HTMLWidgets.widgets.push(staticBinding); + + if (shinyMode) { + // Shiny is running. Register the definition with an output binding. + // The definition itself will not be the output binding, instead + // we will make an output binding object that delegates to the + // definition. This is because we foolishly used the same method + // name (renderValue) for htmlwidgets definition and Shiny bindings + // but they actually have quite different semantics (the Shiny + // bindings receive data that includes lots of metadata that it + // strips off before calling htmlwidgets renderValue). We can't + // just ignore the difference because in some widgets it's helpful + // to call this.renderValue() from inside of resize(), and if + // we're not delegating, then that call will go to the Shiny + // version instead of the htmlwidgets version. + + // Merge defaults with definition, without mutating either. + var bindingDef = extend({}, defaults, definition); + + // This object will be our actual Shiny binding. + var shinyBinding = new Shiny.OutputBinding(); + + // With a few exceptions, we'll want to simply use the bindingDef's + // version of methods if they are available, otherwise fall back to + // Shiny's defaults. NOTE: If Shiny's output bindings gain additional + // methods in the future, and we want them to be overrideable by + // HTMLWidget binding definitions, then we'll need to add them to this + // list. + delegateMethod(shinyBinding, bindingDef, "getId"); + delegateMethod(shinyBinding, bindingDef, "onValueChange"); + delegateMethod(shinyBinding, bindingDef, "onValueError"); + delegateMethod(shinyBinding, bindingDef, "renderError"); + delegateMethod(shinyBinding, bindingDef, "clearError"); + delegateMethod(shinyBinding, bindingDef, "showProgress"); + + // The find, renderValue, and resize are handled differently, because we + // want to actually decorate the behavior of the bindingDef methods. + + shinyBinding.find = function(scope) { + var results = bindingDef.find(scope); + + // Only return elements that are Shiny outputs, not static ones + var dynamicResults = results.filter(".html-widget-output"); + + // It's possible that whatever caused Shiny to think there might be + // new dynamic outputs, also caused there to be new static outputs. + // Since there might be lots of different htmlwidgets bindings, we + // schedule execution for later--no need to staticRender multiple + // times. + if (results.length !== dynamicResults.length) + scheduleStaticRender(); + + return dynamicResults; + }; + + // Wrap renderValue to handle initialization, which unfortunately isn't + // supported natively by Shiny at the time of this writing. + + shinyBinding.renderValue = function(el, data) { + Shiny.renderDependencies(data.deps); + // Resolve strings marked as javascript literals to objects + if (!(data.evals instanceof Array)) data.evals = [data.evals]; + for (var i = 0; data.evals && i < data.evals.length; i++) { + window.HTMLWidgets.evaluateStringMember(data.x, data.evals[i]); + } + if (!bindingDef.renderOnNullValue) { + if (data.x === null) { + el.style.visibility = "hidden"; + return; + } else { + el.style.visibility = "inherit"; + } + } + if (!elementData(el, "initialized")) { + initSizing(el); + + elementData(el, "initialized", true); + if (bindingDef.initialize) { + var rect = el.getBoundingClientRect(); + var result = bindingDef.initialize(el, rect.width, rect.height); + elementData(el, "init_result", result); + } + } + bindingDef.renderValue(el, data.x, elementData(el, "init_result")); + evalAndRun(data.jsHooks.render, elementData(el, "init_result"), [el, data.x]); + }; + + // Only override resize if bindingDef implements it + if (bindingDef.resize) { + shinyBinding.resize = function(el, width, height) { + // Shiny can call resize before initialize/renderValue have been + // called, which doesn't make sense for widgets. + if (elementData(el, "initialized")) { + bindingDef.resize(el, width, height, elementData(el, "init_result")); + } + }; + } + + Shiny.outputBindings.register(shinyBinding, bindingDef.name); + } + }; + + var scheduleStaticRenderTimerId = null; + function scheduleStaticRender() { + if (!scheduleStaticRenderTimerId) { + scheduleStaticRenderTimerId = setTimeout(function() { + scheduleStaticRenderTimerId = null; + window.HTMLWidgets.staticRender(); + }, 1); + } + } + + // Render static widgets after the document finishes loading + // Statically render all elements that are of this widget's class + window.HTMLWidgets.staticRender = function() { + var bindings = window.HTMLWidgets.widgets || []; + forEach(bindings, function(binding) { + var matches = binding.find(document.documentElement); + forEach(matches, function(el) { + var sizeObj = initSizing(el, binding); + + var getSize = function(el) { + if (sizeObj) { + return {w: sizeObj.getWidth(), h: sizeObj.getHeight()} + } else { + var rect = el.getBoundingClientRect(); + return {w: rect.width, h: rect.height} + } + }; + + if (hasClass(el, "html-widget-static-bound")) + return; + el.className = el.className + " html-widget-static-bound"; + + var initResult; + if (binding.initialize) { + var size = getSize(el); + initResult = binding.initialize(el, size.w, size.h); + elementData(el, "init_result", initResult); + } + + if (binding.resize) { + var lastSize = getSize(el); + var resizeHandler = function(e) { + var size = getSize(el); + if (size.w === 0 && size.h === 0) + return; + if (size.w === lastSize.w && size.h === lastSize.h) + return; + lastSize = size; + binding.resize(el, size.w, size.h, initResult); + }; + + on(window, "resize", resizeHandler); + + // This is needed for cases where we're running in a Shiny + // app, but the widget itself is not a Shiny output, but + // rather a simple static widget. One example of this is + // an rmarkdown document that has runtime:shiny and widget + // that isn't in a render function. Shiny only knows to + // call resize handlers for Shiny outputs, not for static + // widgets, so we do it ourselves. + if (window.jQuery) { + window.jQuery(document).on( + "shown.htmlwidgets shown.bs.tab.htmlwidgets shown.bs.collapse.htmlwidgets", + resizeHandler + ); + window.jQuery(document).on( + "hidden.htmlwidgets hidden.bs.tab.htmlwidgets hidden.bs.collapse.htmlwidgets", + resizeHandler + ); + } + + // This is needed for the specific case of ioslides, which + // flips slides between display:none and display:block. + // Ideally we would not have to have ioslide-specific code + // here, but rather have ioslides raise a generic event, + // but the rmarkdown package just went to CRAN so the + // window to getting that fixed may be long. + if (window.addEventListener) { + // It's OK to limit this to window.addEventListener + // browsers because ioslides itself only supports + // such browsers. + on(document, "slideenter", resizeHandler); + on(document, "slideleave", resizeHandler); + } + } + + var scriptData = document.querySelector("script[data-for='" + el.id + "'][type='application/json']"); + if (scriptData) { + var data = JSON.parse(scriptData.textContent || scriptData.text); + // Resolve strings marked as javascript literals to objects + if (!(data.evals instanceof Array)) data.evals = [data.evals]; + for (var k = 0; data.evals && k < data.evals.length; k++) { + window.HTMLWidgets.evaluateStringMember(data.x, data.evals[k]); + } + binding.renderValue(el, data.x, initResult); + evalAndRun(data.jsHooks.render, initResult, [el, data.x]); + } + }); + }); + + invokePostRenderHandlers(); + } + + + function has_jQuery3() { + if (!window.jQuery) { + return false; + } + var $version = window.jQuery.fn.jquery; + var $major_version = parseInt($version.split(".")[0]); + return $major_version >= 3; + } + + /* + / Shiny 1.4 bumped jQuery from 1.x to 3.x which means jQuery's + / on-ready handler (i.e., $(fn)) is now asyncronous (i.e., it now + / really means $(setTimeout(fn)). + / https://jquery.com/upgrade-guide/3.0/#breaking-change-document-ready-handlers-are-now-asynchronous + / + / Since Shiny uses $() to schedule initShiny, shiny>=1.4 calls initShiny + / one tick later than it did before, which means staticRender() is + / called renderValue() earlier than (advanced) widget authors might be expecting. + / https://github.com/rstudio/shiny/issues/2630 + / + / For a concrete example, leaflet has some methods (e.g., updateBounds) + / which reference Shiny methods registered in initShiny (e.g., setInputValue). + / Since leaflet is privy to this life-cycle, it knows to use setTimeout() to + / delay execution of those methods (until Shiny methods are ready) + / https://github.com/rstudio/leaflet/blob/18ec981/javascript/src/index.js#L266-L268 + / + / Ideally widget authors wouldn't need to use this setTimeout() hack that + / leaflet uses to call Shiny methods on a staticRender(). In the long run, + / the logic initShiny should be broken up so that method registration happens + / right away, but binding happens later. + */ + function maybeStaticRenderLater() { + if (shinyMode && has_jQuery3()) { + window.jQuery(window.HTMLWidgets.staticRender); + } else { + window.HTMLWidgets.staticRender(); + } + } + + if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", function() { + document.removeEventListener("DOMContentLoaded", arguments.callee, false); + maybeStaticRenderLater(); + }, false); + } else if (document.attachEvent) { + document.attachEvent("onreadystatechange", function() { + if (document.readyState === "complete") { + document.detachEvent("onreadystatechange", arguments.callee); + maybeStaticRenderLater(); + } + }); + } + + + window.HTMLWidgets.getAttachmentUrl = function(depname, key) { + // If no key, default to the first item + if (typeof(key) === "undefined") + key = 1; + + var link = document.getElementById(depname + "-" + key + "-attachment"); + if (!link) { + throw new Error("Attachment " + depname + "/" + key + " not found in document"); + } + return link.getAttribute("href"); + }; + + window.HTMLWidgets.dataframeToD3 = function(df) { + var names = []; + var length; + for (var name in df) { + if (df.hasOwnProperty(name)) + names.push(name); + if (typeof(df[name]) !== "object" || typeof(df[name].length) === "undefined") { + throw new Error("All fields must be arrays"); + } else if (typeof(length) !== "undefined" && length !== df[name].length) { + throw new Error("All fields must be arrays of the same length"); + } + length = df[name].length; + } + var results = []; + var item; + for (var row = 0; row < length; row++) { + item = {}; + for (var col = 0; col < names.length; col++) { + item[names[col]] = df[names[col]][row]; + } + results.push(item); + } + return results; + }; + + window.HTMLWidgets.transposeArray2D = function(array) { + if (array.length === 0) return array; + var newArray = array[0].map(function(col, i) { + return array.map(function(row) { + return row[i] + }) + }); + return newArray; + }; + // Split value at splitChar, but allow splitChar to be escaped + // using escapeChar. Any other characters escaped by escapeChar + // will be included as usual (including escapeChar itself). + function splitWithEscape(value, splitChar, escapeChar) { + var results = []; + var escapeMode = false; + var currentResult = ""; + for (var pos = 0; pos < value.length; pos++) { + if (!escapeMode) { + if (value[pos] === splitChar) { + results.push(currentResult); + currentResult = ""; + } else if (value[pos] === escapeChar) { + escapeMode = true; + } else { + currentResult += value[pos]; + } + } else { + currentResult += value[pos]; + escapeMode = false; + } + } + if (currentResult !== "") { + results.push(currentResult); + } + return results; + } + // Function authored by Yihui/JJ Allaire + window.HTMLWidgets.evaluateStringMember = function(o, member) { + var parts = splitWithEscape(member, '.', '\\'); + for (var i = 0, l = parts.length; i < l; i++) { + var part = parts[i]; + // part may be a character or 'numeric' member name + if (o !== null && typeof o === "object" && part in o) { + if (i == (l - 1)) { // if we are at the end of the line then evalulate + if (typeof o[part] === "string") + o[part] = tryEval(o[part]); + } else { // otherwise continue to next embedded object + o = o[part]; + } + } + } + }; + + // Retrieve the HTMLWidget instance (i.e. the return value of an + // HTMLWidget binding's initialize() or factory() function) + // associated with an element, or null if none. + window.HTMLWidgets.getInstance = function(el) { + return elementData(el, "init_result"); + }; + + // Finds the first element in the scope that matches the selector, + // and returns the HTMLWidget instance (i.e. the return value of + // an HTMLWidget binding's initialize() or factory() function) + // associated with that element, if any. If no element matches the + // selector, or the first matching element has no HTMLWidget + // instance associated with it, then null is returned. + // + // The scope argument is optional, and defaults to window.document. + window.HTMLWidgets.find = function(scope, selector) { + if (arguments.length == 1) { + selector = scope; + scope = document; + } + + var el = scope.querySelector(selector); + if (el === null) { + return null; + } else { + return window.HTMLWidgets.getInstance(el); + } + }; + + // Finds all elements in the scope that match the selector, and + // returns the HTMLWidget instances (i.e. the return values of + // an HTMLWidget binding's initialize() or factory() function) + // associated with the elements, in an array. If elements that + // match the selector don't have an associated HTMLWidget + // instance, the returned array will contain nulls. + // + // The scope argument is optional, and defaults to window.document. + window.HTMLWidgets.findAll = function(scope, selector) { + if (arguments.length == 1) { + selector = scope; + scope = document; + } + + var nodes = scope.querySelectorAll(selector); + var results = []; + for (var i = 0; i < nodes.length; i++) { + results.push(window.HTMLWidgets.getInstance(nodes[i])); + } + return results; + }; + + var postRenderHandlers = []; + function invokePostRenderHandlers() { + while (postRenderHandlers.length) { + var handler = postRenderHandlers.shift(); + if (handler) { + handler(); + } + } + } + + // Register the given callback function to be invoked after the + // next time static widgets are rendered. + window.HTMLWidgets.addPostRenderHandler = function(callback) { + postRenderHandlers.push(callback); + }; + + // Takes a new-style instance-bound definition, and returns an + // old-style class-bound definition. This saves us from having + // to rewrite all the logic in this file to accomodate both + // types of definitions. + function createLegacyDefinitionAdapter(defn) { + var result = { + name: defn.name, + type: defn.type, + initialize: function(el, width, height) { + return defn.factory(el, width, height); + }, + renderValue: function(el, x, instance) { + return instance.renderValue(x); + }, + resize: function(el, width, height, instance) { + return instance.resize(width, height); + } + }; + + if (defn.find) + result.find = defn.find; + if (defn.renderError) + result.renderError = defn.renderError; + if (defn.clearError) + result.clearError = defn.clearError; + + return result; + } +})(); diff --git a/paper/benchmark/attic/mlr3torch_files/jquery-3.7.1/AUTHORS.txt b/paper/benchmark/attic/mlr3torch_files/jquery-3.7.1/AUTHORS.txt new file mode 100644 index 000000000..648a3f0f4 --- /dev/null +++ b/paper/benchmark/attic/mlr3torch_files/jquery-3.7.1/AUTHORS.txt @@ -0,0 +1,371 @@ +John Resig +Gilles van den Hoven +Michael Geary +Stefan Petre +Yehuda Katz +Corey Jewett +Klaus Hartl +Franck Marcia +Jörn Zaefferer +Paul Bakaus +Brandon Aaron +Mike Alsup +Dave Methvin +Ed Engelhardt +Sean Catchpole +Paul Mclanahan +David Serduke +Richard D. Worth +Scott González +Ariel Flesler +Cheah Chu Yeow +Andrew Chalkley +Fabio Buffoni +Stefan Bauckmeier  +Jon Evans +TJ Holowaychuk +Riccardo De Agostini +Michael Bensoussan +Louis-Rémi Babé +Robert Katić +Damian Janowski +Anton Kovalyov +Dušan B. Jovanovic +Earle Castledine +Rich Dougherty +Kim Dalsgaard +Andrea Giammarchi +Fabian Jakobs +Mark Gibson +Karl Swedberg +Justin Meyer +Ben Alman +James Padolsey +David Petersen +Batiste Bieler +Jake Archibald +Alexander Farkas +Filipe Fortes +Rick Waldron +Neeraj Singh +Paul Irish +Iraê Carvalho +Matt Curry +Michael Monteleone +Noah Sloan +Tom Viner +J. Ryan Stinnett +Douglas Neiner +Adam J. Sontag +Heungsub Lee +Dave Reed +Carl Fürstenberg +Jacob Wright +Ralph Whitbeck +unknown +temp01 +Colin Snover +Jared Grippe +Ryan W Tenney +Alex Sexton +Pinhook +Ron Otten +Jephte Clain +Anton Matzneller +Dan Heberden +Henri Wiechers +Russell Holbrook +Julian Aubourg +Gianni Alessandro Chiappetta +Scott Jehl +James Burke +Jonas Pfenniger +Xavi Ramirez +Sylvester Keil +Brandon Sterne +Mathias Bynens +Lee Carpenter +Timmy Willison <4timmywil@gmail.com> +Corey Frang +Digitalxero +David Murdoch +Josh Varner +Charles McNulty +Jordan Boesch +Jess Thrysoee +Michael Murray +Alexis Abril +Rob Morgan +John Firebaugh +Sam Bisbee +Gilmore Davidson +Brian Brennan +Xavier Montillet +Daniel Pihlstrom +Sahab Yazdani +avaly +Scott Hughes +Mike Sherov +Greg Hazel +Schalk Neethling +Denis Knauf +Timo Tijhof +Steen Nielsen +Anton Ryzhov +Shi Chuan +Matt Mueller +Berker Peksag +Toby Brain +Justin +Daniel Herman +Oleg Gaidarenko +Rock Hymas +Richard Gibson +Rafaël Blais Masson +cmc3cn <59194618@qq.com> +Joe Presbrey +Sindre Sorhus +Arne de Bree +Vladislav Zarakovsky +Andrew E Monat +Oskari +Joao Henrique de Andrade Bruni +tsinha +Dominik D. Geyer +Matt Farmer +Trey Hunner +Jason Moon +Jeffery To +Kris Borchers +Vladimir Zhuravlev +Jacob Thornton +Chad Killingsworth +Vitya Muhachev +Nowres Rafid +David Benjamin +Alan Plum +Uri Gilad +Chris Faulkner +Marcel Greter +Elijah Manor +Daniel Chatfield +Daniel Gálvez +Nikita Govorov +Wesley Walser +Mike Pennisi +Matthias Jäggli +Devin Cooper +Markus Staab +Dave Riddle +Callum Macrae +Jonathan Sampson +Benjamin Truyman +Jay Merrifield +James Huston +Sai Lung Wong +Erick Ruiz de Chávez +David Bonner +Allen J Schmidt Jr +Akintayo Akinwunmi +MORGAN +Ismail Khair +Carl Danley +Mike Petrovich +Greg Lavallee +Tom H Fuertes +Roland Eckl +Yiming He +David Fox +Bennett Sorbo +Paul Ramos +Rod Vagg +Sebastian Burkhard +Zachary Adam Kaplan +Adam Coulombe +nanto_vi +nanto +Danil Somsikov +Ryunosuke SATO +Diego Tres +Jean Boussier +Andrew Plummer +Mark Raddatz +Pascal Borreli +Isaac Z. Schlueter +Karl Sieburg +Nguyen Phuc Lam +Dmitry Gusev +Steven Benner +Li Xudong +Michał Gołębiowski-Owczarek +Renato Oliveira dos Santos +Frederic Junod +Tom H Fuertes +Mitch Foley +ros3cin +Kyle Robinson Young +John Paul +Jason Bedard +Chris Talkington +Eddie Monge +Terry Jones +Jason Merino +Dan Burzo +Jeremy Dunck +Chris Price +Guy Bedford +njhamann +Goare Mao +Amey Sakhadeo +Mike Sidorov +Anthony Ryan +Lihan Li +George Kats +Dongseok Paeng +Ronny Springer +Ilya Kantor +Marian Sollmann +Chris Antaki +David Hong +Jakob Stoeck +Christopher Jones +Forbes Lindesay +S. Andrew Sheppard +Leonardo Balter +Rodrigo Rosenfeld Rosas +Daniel Husar +Philip Jägenstedt +John Hoven +Roman Reiß +Benjy Cui +Christian Kosmowski +David Corbacho +Liang Peng +TJ VanToll +Aurelio De Rosa +Senya Pugach +Dan Hart +Nazar Mokrynskyi +Benjamin Tan +Amit Merchant +Jason Bedard +Veaceslav Grimalschi +Richard McDaniel +Arthur Verschaeve +Shivaji Varma +Ben Toews +Bin Xin +Neftaly Hernandez +T.J. Crowder +Nicolas HENRY +Frederic Hemberger +Victor Homyakov +Aditya Raghavan +Anne-Gaelle Colom +Leonardo Braga +George Mauer +Stephen Edgar +Thomas Tortorini +Jörn Wagner +Jon Hester +Colin Frick +Winston Howes +Alexander O'Mara +Chris Rebert +Bastian Buchholz +Mu Haibao +Calvin Metcalf +Arthur Stolyar +Gabriel Schulhof +Gilad Peleg +Julian Alexander Murillo +Kevin Kirsche +Martin Naumann +Yongwoo Jeon +John-David Dalton +Marek Lewandowski +Bruno Pérel +Daniel Nill +Reed Loden +Sean Henderson +Gary Ye +Richard Kraaijenhagen +Connor Atherton +Christian Grete +Tom von Clef +Liza Ramo +Joelle Fleurantin +Steve Mao +Jon Dufresne +Jae Sung Park +Josh Soref +Saptak Sengupta +Henry Wong +Jun Sun +Martijn W. van der Lee +Devin Wilson +Damian Senn +Zack Hall +Vitaliy Terziev +Todor Prikumov +Bernhard M. Wiedemann +Jha Naman +Alexander Lisianoi +William Robinet +Joe Trumbull +Alexander K +Ralin Chimev +Felipe Sateler +Christophe Tafani-Dereeper +Manoj Kumar +David Broder-Rodgers +Alex Louden +Alex Padilla +karan-96 +南漂一卒 +Erik Lax +Boom Lee +Andreas Solleder +Pierre Spring +Shashanka Nataraj +CDAGaming +Matan Kotler-Berkowitz <205matan@gmail.com> +Jordan Beland +Henry Zhu +Nilton Cesar +basil.belokon +Andrey Meshkov +tmybr11 +Luis Emilio Velasco Sanchez +Ed S +Bert Zhang +Sébastien Règne +wartmanm <3869625+wartmanm@users.noreply.github.com> +Siddharth Dungarwal +abnud1 +Andrei Fangli +Marja Hölttä +buddh4 +Hoang +Wonseop Kim +Pat O'Callaghan +JuanMa Ruiz +Ahmed.S.ElAfifi +Christian Oliff +Christian Wenz +Sean Robinson +Jonathan +Pierre Grimaud +Beatriz Rezener +Natalia Sroka <37873210+natipo@users.noreply.github.com> +Wonhyoung Park +Dallas Fraser +fecore1 <89127124+fecore1@users.noreply.github.com> +ygj6 <7699524+ygj6@users.noreply.github.com> +Simon Legner +Vladimir Sitnikov +Anders Kaseorg +Alex +Timo Tijhof +Gabriela Gutierrez +Dimitri Papadopoulos Orfanos <3234522+DimitriPapadopoulos@users.noreply.github.com> diff --git a/paper/benchmark/attic/mlr3torch_files/jquery-3.7.1/jquery.min.js b/paper/benchmark/attic/mlr3torch_files/jquery-3.7.1/jquery.min.js new file mode 100644 index 000000000..7f37b5d99 --- /dev/null +++ b/paper/benchmark/attic/mlr3torch_files/jquery-3.7.1/jquery.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="",le.option=!!xe.lastChild;var ke={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n",""]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="
",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0 td { + border-top: 1px solid #444; + border-bottom: 1px solid #444; +} + +table.profvis-table tr > td { + padding-top: 0; + padding-bottom: 0; +} + +table.profvis-table tr.active { + background-color: #fdb; +} + +table.profvis-table .linenum { + color: #aaa; + padding: 0 15px; + font-family: monospace; + width: 25px; +} + +/* For unselectable and uncopyable text elements in table */ +table.profvis-table [data-pseudo-content]::before { + content: attr(data-pseudo-content); +} + +table.profvis-table .code { + white-space: pre-wrap; + margin: 0; + min-height: 1.25em; + line-height: 1.25; + width: auto; + font-family: monospace; + background: transparent; +} + + +table.profvis-table .time, table.profvis-table .percent { + padding: 0 5px; + text-align: right; + + min-width: 2em; + max-width: 2em; + overflow: hidden; + + padding-right: 10px; +} + +table.profvis-table .memory { + padding-right: 5px; +} + +table.profvis-table th.time { + text-align: center; +} + +table.profvis-table .memory { + padding: 0 5px; + text-align: right; + + min-width: 2em; + max-width: 4em; + overflow: hidden; + + padding-right: 10px; +} + +table.profvis-table .memory-right { + text-align: left; +} + +table.profvis-table th.memory { + text-align: center; +} + +table.profvis-table .timebar-cell { + padding-left: 0; + border-left: 1px solid #444; + min-width: 3em; + width: 3em; +} + +table.profvis-table .timebar-cell > .timebar { + background-color: #5A5A5A; + border-radius: 0px 2px 2px 0px; + line-height: 15px; +} + +table.profvis-table .membar-left-cell { + padding-left: 0; + padding-right: 0; + border-left: 0px solid black; + min-width: 0.5em; + width: 0.5em; +} + +table.profvis-table .membar-left-cell > .membar { + background-color: #A7A7A7; + float: right; + border-radius: 2px 0px 0px 2px; + line-height: 15px; +} + +table.profvis-table .membar-right-cell { + padding-left: 0; + border-left: 1px solid black; + min-width: 1em; + width: 1em; +} + +table.profvis-table .membar-right-cell > .membar { + background-color: #5A5A5A; + border-radius: 0px 2px 2px 0px; + line-height: 15px; +} + +.profvis-flamegraph .background { + fill: rgb(249, 249, 250); +} + +.profvis-flamegraph .cell .rect { + stroke: #000; + stroke-width: 0.25px; + fill: #fff; +} + +.profvis-flamegraph .cell.active .rect { + stroke-width: 0.75px; + fill: #ddd; +} + +.profvis-flamegraph .cell.highlighted .rect { + fill: #ffc; +} + +.profvis-flamegraph .cell.highlighted.active .rect { + fill: #fdb; +} + +.profvis-flamegraph .cell.output .rect { + fill: #eef; +} + +.profvis-flamegraph .cell.gc .rect { + fill: #ccc; +} + +.profvis-flamegraph .cell.stacktrace .rect { + fill: #eee; +} +.profvis-flamegraph .cell.stacktrace .profvis-label { + fill: #666; +} + +.profvis-flamegraph .cell.locked { + font-weight: bold; +} + +.profvis-flamegraph .cell.locked .rect { + stroke-width: 2px; +} + +.profvis-flamegraph .cell .profvis-label { + font-family: monospace; + font-size: 11px; + cursor: default; +} + + +.profvis-flamegraph .axis text { + font: 10px sans-serif; +} + +.profvis-flamegraph .axis path, +.profvis-flamegraph .axis line { + fill: none; + stroke: #000; + shape-rendering: crispEdges; +} + + +.profvis-flamegraph .profvis-tooltip rect { + fill: rgb(249, 249, 250); + stroke: #000; + opacity: 0.75; + stroke-opacity: 0.75; + stroke-width: 0.5; +} + +.profvis-flamegraph .profvis-tooltip text { + text-anchor: middle; + font-family: monospace; + font-size: 11px; +} + +.profvis-infobox { + position: absolute; + left: 8px; + top: 8px; + opacity: 0.8; + border-radius: 3px; + color: #f8f8f8; + background-color: #333; + padding: 5px 10px; + font-family: "Lucida Sans", "DejaVu Sans", "Lucida Grande", "Segoe UI", Verdana, Helvetica, sans-serif; + font-size: 11px; + line-height: 100%; + pointer-events: none; + min-width: 280px; +} + +.profvis-infobox table { + border-collapse: separate; + border-spacing: 2px; +} + + +.profvis-infobox table td { + padding: 1px; +} + +.profvis-infobox .infobox-title { + font-weight: bold; +} + +.profvis-message { + width: 100%; + height: 100%; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + -ms-flex-pack: center; + -webkit-justify-content: center; + justify-content: center; + -ms-flex-align: center; + -webkit-align-items: center; + align-items: center; + font-family: "Lucida Sans", "DejaVu Sans", "Lucida Grande", "Segoe UI", Verdana, Helvetica, sans-serif; + font-size: 11px; +} + +.profvis-message div { + color: #444; + height: 25%; +} + +.profvis-treetable { + top: 0px; + bottom: 0px; + left: 0px; + right: 0px; + position: absolute; + margin-top: 23px; + margin-bottom: 21px; + margin-right: 0px; + overflow: hidden; + font: 10px sans-serif; + color: #161616; + font-family: "Lucida Sans", "DejaVu Sans", "Lucida Grande", "Segoe UI", Verdana, Helvetica, sans-serif; + font-size: 11px; + overflow-y: auto; +} + +.profvis-treetable .results { + width: 100%; + table-layout: fixed; +} + +.profvis-treetable th { + font-weight: normal; + height: 18px; + background-color: #F8F9F8; + border-bottom: solid 1px #E4E4E4; + border-right: solid 1px #E4E4E4; + padding-left: 3px; + padding-right: 3px; +} + +.profvis-treetable td { + height: 18px; + border-bottom: solid 1px #E4E4E4; + border-right: solid 1px #E4E4E4; + padding-left: 3px; + padding-right: 3px; + overflow: hidden; + text-overflow: ellipsis; +} + +.profvis-treetable .action { + width: 18px; +} + +.profvis-treetable .memory { + width: 100px; + text-align: right; +} + +.profvis-treetable th { + cursor: default; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + overflow: hidden; +} + +.profvis-treetable th.memory { + text-align: center; +} + +.profvis-treetable .time { + width: 100px; + text-align: right; +} + +.profvis-treetable th.time { + text-align: center; +} + +.profvis-treetable .count { + text-align: right; +} + +.profvis-treetable th.count { + text-align: center; +} + +.profvis-treetable th.code-label { + text-align: left; + padding-left: 5px; +} + +.profvis-treetable td.label-pointer { + cursor: pointer; +} + +.profvis-treetable .label-text { + display: inline-block; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.profvis-treetable .path { + text-align: left; +} + +.profvis-treetable .treetable-expand > div { + display: inline-block; + width: 15px; +} + +.profvis-treetable .treetable-expand > div > div{ + width: 0px; + height: 0px; + margin-left: 3px; + margin-right: 6px; + border-top: 4px solid transparent; + border-left: 6px solid #161616; + border-bottom: 4px solid transparent; +} + +.profvis-treetable .treetable-collapse > div { + display: inline-block; + width: 15px; +} + +.profvis-treetable .treetable-collapse > div > div { + width: 0px; + height: 0px; + margin-left: 3px; + margin-right: 6px; + border-right: 4px solid transparent; + border-top: 6px solid #161616; + border-left: 4px solid transparent; + display: inline-block; +} + +.profvis-treetable .time-info { + padding: 0px; + padding-right: 2px; + text-align: right; +} + +.profvis-treetable .timebar { + width: 0px; + height: 14px; + background-color: #5A5A5A; + float: left; + border-radius: 2px 2px 2px 2px; + padding-top: 0px; + margin-top: 1px; +} + +.profvis-treetable .timecell { + padding-top: 2px; + padding-right: 3px; +} + +.profvis-treetable .memory-info { + padding-left: 0px; + padding-right: 2px; + text-align: right; +} + +.profvis-treetable .memory-info-right { + padding-left: 2px; + padding-right: 0px; + text-align: left; +} + +.profvis-treetable .memory-leftbar-wrapper { + float: left; + height: 14px; + width: 5px; +} + +.profvis-treetable .memory-leftbar { + width: 2px; + height: 14px; + background-color: #A7A7A7; + float: right; + border-radius: 1px 0px 0px 1px; +} + +.profvis-treetable .memory-rightbar { + width: 2px; + float: left; + height: 14px; + background-color: #5A5A5A; + border-radius: 0px 1px 1px 0px; +} + +.profvis-treetable .memory-cell { +} + +.profvis-treetable .memory-bar-container { + margin-right: 3px; +} + +.profvis-treetable .time-bar-container { + margin-right: 3px; +} diff --git a/paper/benchmark/attic/mlr3torch_files/profvis-0.3.6.9000/profvis.js b/paper/benchmark/attic/mlr3torch_files/profvis-0.3.6.9000/profvis.js new file mode 100644 index 000000000..4b6336458 --- /dev/null +++ b/paper/benchmark/attic/mlr3torch_files/profvis-0.3.6.9000/profvis.js @@ -0,0 +1,2656 @@ +/*jshint + undef:true, + browser:true, + devel: true, + jquery:true, + strict:false, + curly:false, + indent:2 +*/ +/*global profvis:true, d3, hljs */ + +profvis = (function() { + var profvis = {}; + + profvis.render = function(el, message) { + + function generateStatusBarButton(id, caption, active) { + var spacerImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAUCAYAAACnOeyiAAAAXklEQVR42mNgAIL///8zMYSGhjIDGYIMIiIMvECGMwMDN4M4kFEDUqIIZKwDMdSBjAsghj6Q8QPEMAAy/lOBoQekv4AYKkDGfgZeXl4RICOLQUtLiw3IUAJJMQIZ7AC2tU2tXJxOYgAAAABJRU5ErkJggg=='; + + var buttonHtml = + '
' + caption + '
' + + '
'; + + return buttonHtml; + } + + function generateStatusBar(el, onToogle) { + var $el = $(el); + + el.innerHTML = + generateStatusBarButton('flameGraphButton', 'Flame Graph', true) + + generateStatusBarButton('treetableButton', 'Data', false) + + 'Options ▾'; + + $el.find("span.options-button").on("click", function(e) { + e.preventDefault(); + e.stopPropagation(); + + vis.optionsPanel.toggleVisibility(); + }); + + var setStatusBarButtons = function(e) { + $(".info-block").removeClass("result-block-active"); + $(".info-block").addClass("result-block"); + e.addClass("result-block-active"); + }; + + $el.find("#flameGraphButton").on("click", function() { + setStatusBarButtons($(this)); + onToogle("flamegraph"); + }); + + $el.find("#treetableButton").on("click", function() { + setStatusBarButtons($(this)); + onToogle("treetable"); + }); + + return { + el: el + }; + } + + function generateFooter(el, onToogle) { + var $el = $(el); + + el.innerHTML = + '
Sample Interval: ' + + vis.interval + 'ms
' + + '
' + + // '' + (Math.round(vis.totalMem * 100) / 100) + 'MB' + + // ' / ' + + '' + vis.totalTime + 'ms' + + '
'; + + return { + el: el + }; + } + + function generateOptionsPanel(el, onOptionsChange) { + var $el = $(el); + + el.innerHTML = + '
' + + '' + + (vis.splitDir === "h" ? '☒' : '☐') + + ' Split horizontally' + + '
' + + '
' + + ' Hide internal function calls' + + '
' + + '
' + + ' Hide lines of code with zero time' + + '
' + + '
' + + ' Hide memory results' + + '
'; + + // Toggle the appearance of a checkbox and return the new checked state. + function toggleCheckbox($checkbox) { + // Use attr() instead of data(), because the latter tries to coerce to + // numbers, which complicates our comparisons. + var checked = $checkbox.attr("data-checked"); + + if (checked === "0") { + $checkbox.attr("data-checked", "1"); + $checkbox.html("☒"); + return true; + + } else { + $checkbox.attr("data-checked", "0"); + $checkbox.html("☐"); + return false; + } + } + + $el.find(".split-horizontal") + .on("click", function() { + var checked = toggleCheckbox($(this).find(".options-checkbox")); + onOptionsChange("split", checked); + }); + + $el.find(".hide-internal") + .on("click", function() { + var checked = toggleCheckbox($(this).find(".options-checkbox")); + onOptionsChange("internals", checked); + }); + + $el.find(".hide-memory") + .on("click", function() { + var checked = toggleCheckbox($(this).find(".options-checkbox")); + onOptionsChange("memory", checked); + }); + + // Make the "hide internal" option available or unavailable to users + function enableHideInternal() { + $el.find(".hide-internal").css("display", ""); + } + function disableHideInternal() { + $el.find(".hide-internal").css("display", "none"); + } + // By default, start with it unavailable; it's only relevant for Shiny + // apps. + disableHideInternal(); + + + $el.find(".hide-zero-row") + .on("click", function() { + var checked = toggleCheckbox($(this).find(".options-checkbox")); + + if (checked) { + vis.codeTable.hideZeroTimeRows(); + } else { + vis.codeTable.showZeroTimeRows(); + } + }); + + el.style.visibility = "hidden"; + function toggleVisibility(offset) { + if (el.style.visibility === "visible") { + el.style.visibility = "hidden"; + } else { + el.style.visibility = "visible"; + $(document).on("click", hideOnClickOutside); + } + } + + // Hide the panel when a click happens outside. This handler also removes + // itself after it fires. + function hideOnClickOutside(e) { + var $el = $(el); + if (!$el.is(e.target) && $el.has(e.target).length === 0) { + el.style.visibility = "hidden"; + // Unregister this event listener + $(document).off("click", hideOnClickOutside); + } + } + + return { + el: el, + toggleVisibility: toggleVisibility, + enableHideInternal: enableHideInternal, + disableHideInternal: disableHideInternal + }; + } + + function notifySourceFileMessage(d, details) { + if (window.parent.postMessage) { + window.parent.postMessage({ + source: "profvis", + message: "sourcefile", + file: d.filename, + normpath: d.normpath ? d.normpath : getNormPath(vis.files, d.filename), + line: d.linenum, + details: details + }, window.location.origin); + } + } + + function roundOneDecimalNum(number, decimals) { + return Math.round(number * 10) / 10; + } + + function roundOneDecimal(number, decimals) { + if (!number) return 0; + return roundOneDecimalNum(number).toFixed(1); + } + + // Generate the code table ---------------------------------------- + function generateCodeTable(el) { + var useMemory = false; + var content = d3.select(el); + + if (vis.fileLineStats.length === 0) { + content.append("div") + .attr("class", "profvis-message") + .append("div") + .text("(Sources not available)"); + } + + // One table for each file + var tables = content.selectAll("table") + .data(vis.fileLineStats) + .enter() + .append("table") + .attr("class", "profvis-table"); + + // Table headers + var headerRows = tables.append("tr"); + headerRows.append("th") + .attr("colspan", "2") + .attr("class", "filename") + .text(function(d) { return d.filename; }); + + var percentTooltip = "Percentage of tracked execution time"; + var percentMemTooltip = "Percentage of peak memory deallocation and allocation"; + + headerRows.append("th") + .attr("class", "table-memory memory") + .attr("colspan", "4") + .text("Memory"); + + headerRows.append("th") + .attr("class", "time") + .attr("colspan", "2") + .text("Time"); + + headerRows.append("th") + .attr("class", "spacing") + .attr("data-pseudo-content", "\u00a0"); + + // Insert each line of code + var rows = tables.selectAll("tr.code-row") + .data(function(d) { return d.lineData; }) + .enter() + .append("tr") + .attr("class", "code-row"); + + // Use pseudo-content and CSS content rule to make text unselectable and + // uncopyable. See https://danoc.me/blog/css-prevent-copy/ + rows.append("td") + .attr("class", "linenum") + .attr("data-pseudo-content", function(d) { return d.linenum; }); + + rows.append("td") + .attr("class", "code r") + .text(function(d) { return d.content; }) + .each(function() { hljs.highlightElement(this); }); + + rows.append("td") + .attr("class", "table-memory memory") + .attr("title", "Memory deallocation (MB)") + .attr("data-pseudo-content", + function(d) { return roundOneDecimalNum(d.sumMemDealloc) !== 0 ? roundOneDecimal(d.sumMemDealloc) : ""; }); + + rows.append("td") + .attr("class", "table-memory membar-left-cell") + .append("div") + .attr("class", "membar") + .attr("title", percentMemTooltip) + .style("width", function(d) { + var p = Math.min(Math.abs(Math.min(Math.round(d.propMemDealloc * 100), 0)), 100); + + // 8% is the minimal size that looks visually appealing while drawing an almost empty bar + p = roundOneDecimalNum(d.sumMemDealloc) !== 0 ? Math.max(p, 8) : 0; + return p + "%"; + }) + // Add the equivalent of   to be added with CSS content + .attr("data-pseudo-content", "\u00a0"); + + rows.append("td") + .attr("class", "table-memory membar-right-cell") + .append("div") + .attr("class", "membar") + .attr("title", percentMemTooltip) + .style("width", function(d) { + var p = Math.min(Math.max(Math.round(d.propMemAlloc * 100), 0), 100); + + // 4% is the minimal size that looks visually appealing while drawing an almost empty bar + p = roundOneDecimalNum(d.sumMemAlloc) !== 0 ? Math.max(p, 4) : 0; + return p + "%"; + }) + // Add the equivalent of   to be added with CSS content + .attr("data-pseudo-content", "\u00a0"); + + rows.append("td") + .attr("class", "table-memory memory memory-right") + .attr("title", "Memory allocation (MB)") + .attr("data-pseudo-content", + function(d) { return roundOneDecimalNum(d.sumMemAlloc) !== 0 ? roundOneDecimal(d.sumMemAlloc) : ""; }); + + rows.append("td") + .attr("class", "time") + .attr("title", "Total time (ms)") + .attr("data-pseudo-content", + function(d) { return Math.round(d.sumTime * 100) !== 0 ? (Math.round(d.sumTime * 100) / 100) : ""; }); + + rows.append("td") + .attr("class", "timebar-cell") + .append("div") + .attr("class", "timebar") + .attr("title", percentTooltip) + .style("width", function(d) { + return Math.round(d.propTime * 100) + "%"; + }) + // Add the equivalent of   to be added with CSS content + .attr("data-pseudo-content", "\u00a0"); + + rows.append("td") + .attr("class", "spacing") + .attr("data-pseudo-content", "\u00a0"); + + rows + .on("click", function(d) { + // Info box is only relevant when mousing over flamegraph + vis.infoBox.hide(); + highlighter.click(d); + notifySourceFileMessage(d, "select"); + }) + .on("mouseover", function(d) { + if (highlighter.isLocked()) return; + + // Info box is only relevant when mousing over flamegraph + vis.infoBox.hide(); + highlighter.hover(d); + }) + .on("mouseout", function(d) { + if (highlighter.isLocked()) return; + + highlighter.hover(null); + }) + .on("dblclick", function(d) { + notifySourceFileMessage(d, "open"); + }); + + function hideZeroTimeRows() { + rows + .filter(function(d) { return d.sumTime === 0; }) + .style("display", "none"); + } + + function showZeroTimeRows() { + rows + .filter(function(d) { return d.sumTime === 0; }) + .style("display", ""); + } + + function addLockHighlight(d) { + var target = d; + rows + .filter(function(d) { return d === target; } ) + .classed({ locked: true }); + } + + function clearLockHighlight() { + rows + .filter(".locked") + .classed({ locked: false }); + } + + function addActiveHighlight(d) { + // If we have filename and linenum, search for cells that match, and + // set them as "active". + var target = d; + if (target.filename && target.linenum) { + var tr = rows + .filter(function(d) { + return d.linenum === target.linenum && + d.filename === target.filename; + }) + .classed({ active: true }); + + tr.node().scrollIntoViewIfNeeded(); + } + } + + function clearActiveHighlight() { + rows + .filter(".active") + .classed({ active: false }); + } + + function enableScroll() { + // TODO: implement this + } + + function disableScroll() { + } + + function useMemoryResults() { + d3.selectAll(".table-memory").style("display", vis.hideMemory ? "none" : ""); + } + + return { + el: el, + hideZeroTimeRows: hideZeroTimeRows, + showZeroTimeRows: showZeroTimeRows, + addLockHighlight: addLockHighlight, + clearLockHighlight: clearLockHighlight, + addActiveHighlight: addActiveHighlight, + clearActiveHighlight: clearActiveHighlight, + enableScroll: enableScroll, + disableScroll: disableScroll, + useMemoryResults: useMemoryResults + }; + } + + + var highlighter = (function() { + // D3 data objects for the currently locked and active items + var lockItem = null; + var activeItem = null; + + function isLocked() { + return lockItem !== null; + } + + function currentLock() { + return lockItem; + } + + function currentActive() { + return activeItem; + } + + + // This is called when a flamegraph cell or a line of code is clicked on. + // Clicks also should trigger hover events. + function click(d) { + // If d is null (background is clicked), or if locked and this click + // is on the currently locked selection, just unlock and return. + if (d === null || (lockItem && d === lockItem)) { + lockItem = null; + vis.flameGraph.clearLockHighlight(); + vis.codeTable.clearLockHighlight(); + return; + } + + // If nothing currently locked, or if locked and this click is on + // something other than the currently locked selection, then lock the + // current selection. + lockItem = d; + + vis.flameGraph.clearLockHighlight(); + vis.codeTable.clearLockHighlight(); + hover(null); + + vis.flameGraph.addLockHighlight(d); + vis.codeTable.addLockHighlight(d); + hover(d); + } + + + function hover(d) { + activeItem = d; + + if (activeItem) { + vis.flameGraph.addActiveHighlight(activeItem); + vis.codeTable.addActiveHighlight(activeItem); + return; + } + + vis.flameGraph.clearActiveHighlight(); + vis.codeTable.clearActiveHighlight(); + } + + return { + isLocked: isLocked, + currentLock: currentLock, + currentActive: currentActive, + + click: click, + hover: hover + }; + })(); + + + // Generate the flame graph ----------------------------------------------- + function generateFlameGraph(el) { + el.innerHTML = ""; + + var stackHeight = 15; // Height of each layer on the stack, in pixels + var zoomMargin = 0.02; // Extra margin on sides when zooming to fit + + // Dimensions ----------------------------------------------------------- + + // Margin inside the svg where the plotting occurs + var dims = { + margin: { top: 0, right: 0, left: 0, bottom: 30 } + }; + dims.width = el.clientWidth - dims.margin.left - dims.margin.right; + dims.height = el.clientHeight - dims.margin.top - dims.margin.bottom; + + var domains = { + x: [ + d3.min(vis.prof, function(d) { return d.startTime; }), + d3.max(vis.prof, function(d) { return d.endTime; }) + ], + y: [ + d3.min(vis.prof, function(d) { return d.depth; }) - 1, + d3.max(vis.prof, function(d) { return d.depth; }) + ] + }; + // Slightly expand x domain + domains.x = expandRange(domains.x, zoomMargin); + + // Scales --------------------------------------------------------------- + var scales = { + x: d3.scale.linear() + .domain(domains.x) + .range([0, dims.width]), + + y: d3.scale.linear() + .domain(domains.y) + .range([dims.height, dims.height - (domains.y[1] - domains.y[0]) * stackHeight]), + + // This will be a function that, given a data point, returns the depth. + // This function can change; sometimes it returns the original depth, + // and sometimes it returns the collapsed depth. This isn't exactly a + // scale function, but it's close enough for our purposes. + getDepth: null + }; + + function useCollapsedDepth() { + scales.getDepth = function(d) { return d.depthCollapsed; }; + } + function useUncollapsedDepth() { + scales.getDepth = function(d) { return d.depth; }; + } + + useCollapsedDepth(); + + // SVG container objects ------------------------------------------------ + var svg = d3.select(el).append('svg'); + + var clipRect = svg.append("clipPath") + .attr("id", "clip-" + vis.el.id) + .append("rect"); + + var container = svg.append('g') + .attr("transform", "translate(" + dims.margin.left + "," + dims.margin.top + ")") + .attr("clip-path", "url(" + urlNoHash() + "#clip-" + vis.el.id + ")"); + + // Add a background rect so we have something to grab for zooming/panning + var backgroundRect = container.append("rect") + .attr("class", "background"); + + // Axes ------------------------------------------------------------ + var xAxis = d3.svg.axis() + .scale(scales.x) + .orient("bottom"); + + svg.append("g") + .attr("class", "x axis") + .call(xAxis); + + // Container sizing ----------------------------------------------------- + // Update dimensions of various container elements, based on the overall + // dimensions of the containing div. + function updateContainerSize() { + dims.width = el.clientWidth - dims.margin.left - dims.margin.right; + dims.height = el.clientHeight - dims.margin.top - dims.margin.bottom; + + svg + .attr('width', dims.width + dims.margin.left + dims.margin.right) + .attr('height', dims.height + dims.margin.top + dims.margin.bottom); + + clipRect + .attr("x", dims.margin.left) + .attr("y", dims.margin.top) + .attr("width", dims.width) + .attr("height", dims.height); + + backgroundRect + .attr("width", dims.width) + .attr("height", dims.height); + + svg.select(".x.axis") + .attr("transform", "translate(" + dims.margin.left + "," + dims.height + ")"); + } + + + // Redrawing ------------------------------------------------------------ + + // Redrawing is a little complicated. For performance reasons, the + // flamegraph cells that are offscreen aren't rendered; they're removed + // from the D3 selection of cells. However, when transitions are + // involved, it may be necssary to add objects in their correct + // off-screen starting locations before the transition, and then do the + // transition. Similarly, it may be necssary to transition objects to + // their correct off-screen ending positions. + // + // In order to handle this, whenever there's a transition, we need to + // have the scales for before the transition, and after. When a function + // invokes a transition, it will generally do the following: (1) save the + // previous scales, (2) modify the current scales, (3) call a redraw + // function. The redraw functions are customized for different types of + // transitions, and they will use the saved previous scales to position + // objects correctly for the transition. When there's no transition, the + // previous scales aren't needed, and the redrawImmediate() function + // should be used. + + // Cache cells for faster access (avoid a d3.select()) + var cells; + + // For a data element, return identifying key + function dataKey(d) { + return d.depth + "-" + d.startTime + "-" + d.endTime; + } + + // For transitions with animation, we need to have a copy of the previous + // scales in addition to the current ones. + var prevScales = {}; + function savePrevScales() { + prevScales = { + x: scales.x.copy(), + y: scales.y.copy(), + getDepth: scales.getDepth + }; + } + savePrevScales(); + + + // Returns a D3 selection of the cells that are within the plotting + // region, using a set of scales. + function selectActiveCells(scales) { + var xScale = scales.x; + var yScale = scales.y; + var depth = scales.getDepth; + var width = dims.width; + var height = dims.height; + + var data = vis.prof.filter(function(d) { + var depthVal = depth(d); + return !(xScale(d.endTime) < 0 || + xScale(d.startTime) > width || + depthVal === null || + yScale(depthVal - 1) < 0 || + yScale(depthVal) > height); + }); + + cells = container.selectAll("g.cell").data(data, dataKey); + + return cells; + } + + // Given an enter selection, add the rect and text objects, but don't + // position them. Returns a selection of the new elements. + // This should usually be called with addItems(sel.enter()) instead + // of sel.enter().call(addItems), because the latter returns the original + // enter selection, not the selection of elements, and can't be + // used for chaining more function calls on the selection. + function addItems(enterSelection) { + var cells = enterSelection.append("g") + .attr("class", "cell") + .classed("highlighted", function(d) { return d.filename !== null; }) + .call(addMouseEventHandlers); + + // Add CSS classes for highlighting cells with labels that match particular + // regex patterns. + var highlightPatterns = d3.entries(message.highlight); + highlightPatterns.map(function(item) { + var cssClass = item.key; + var regexp = new RegExp(item.value); + + cells.classed(cssClass, function(d) { + return d.label.search(regexp) !== -1; + }); + }); + + cells.append("rect") + .attr("class", "rect"); + + cells.append("text") + .attr("class", "profvis-label") + .text(function(d) { return d.label; }); + + return cells; + } + + // Given a selection, position the rects and labels, using a set of + // scales. + function positionItems(cells, scales) { + var xScale = scales.x; + var yScale = scales.y; + var depth = scales.getDepth; + + cells.select("rect") + .attr("width", function(d) { + return xScale(d.endTime) - xScale(d.startTime); + }) + .attr("height", yScale(0) - yScale(1)) + .attr("x", function(d) { return xScale(d.startTime); }) + .attr("y", function(d) { return yScale(depth(d)); }); + + cells.select("text") + .attr("x", function(d) { + // To place the labels, check if there's enough space to fit the + // label plus padding in the rect. (We already know the label fits + // without padding if we got here.) + // * If there's not enough space, simply center the label in the + // rect. + // * If there is enough space, keep the label within the rect, with + // padding. Try to left-align, keeping the label within the + // viewing area if possible. + + // Padding on left and right + var pad = 2; + + var textWidth = getLabelWidth(this, d.label.length); + var rectWidth = xScale(d.endTime) - xScale(d.startTime); + + if (textWidth + pad*2 > rectWidth) { + return xScale(d.startTime) + (rectWidth - textWidth) / 2; + } else { + return Math.min( + Math.max(0, xScale(d.startTime)) + pad, + xScale(d.endTime) - textWidth - pad + ); + } + }) + .attr("y", function(d) { return yScale(depth(d) - 0.8); }); + + return cells; + } + + + // Redraw without a transition (regular panning and zooming) + function redrawImmediate() { + cells = selectActiveCells(scales); + + cells.exit().remove(); + addItems(cells.enter()) + .call(addLockHighlightSelection, highlighter.currentLock()) + .call(addActiveHighlightSelection, highlighter.currentActive()); + cells.call(positionItems, scales); + cells.select('text') + .call(updateLabelVisibility); + svg.select(".x.axis").call(xAxis); + } + + // Redraw for double-click zooming, where there's a transition + function redrawZoom(duration) { + // Figure out if we're zooming in or out. This will determine when we + // recalculate the label visibility: before or after the transition. + var prevExtent = prevScales.x.domain()[1] - prevScales.x.domain()[0]; + var curExtent = scales.x.domain()[1] - scales.x.domain()[0]; + var zoomIn = curExtent < prevExtent; + + cells = selectActiveCells(scales); + + // Phase 1 + // Add the enter items, highlight them, and position them using the + // previous scales + addItems(cells.enter()) + .call(addLockHighlightSelection, highlighter.currentLock()) + .call(addActiveHighlightSelection, highlighter.currentActive()) + .call(positionItems, prevScales); + + // If zooming out, update label visibility. This will hide some labels + // now, before the transition, ensuring that they will never be larger + // than the box. + if (!zoomIn) { + cells.select('text') + .call(updateLabelVisibility); + } + + // Phase 2 + // Position the update (and enter) items using the new scales + cells + .transition().duration(duration) + .call(positionItems, scales); + + // Position the exit items using the new scales + cells.exit() + .transition().duration(duration) + .call(positionItems, scales); + + // Update x axis + svg.select(".x.axis") + .transition().duration(duration) + .call(xAxis); + + // Phase 3 + // If zooming in, update label visibility. This will hide some labels + // now, after the transition, ensuring that they will never be larger + // than the box. + if (zoomIn) { + cells.select('text') + .transition().delay(duration) + .call(updateLabelVisibility); + } + + // Remove the exit items + cells.exit() + .transition().delay(duration) + .remove(); + } + + // Redraw when internal functions are hidden + function redrawCollapse(exitDuration, updateDuration) { + cells = selectActiveCells(scales); + + // There are two subsets of the exit items: + // 1. Those that exit because depth is null. These should fade out. + // 2. Those that exit because they move off screen. These should wait + // for subset 1 to fade out, then move with a transition. + var fadeOutCells = cells.exit() + .filter(function(d) { return scales.getDepth(d) === null; }); + var moveOutCells = cells.exit() + .filter(function(d) { return scales.getDepth(d) !== null; }); + + // Phase 1 + // Add the enter items, highlight them, and position them using the + // previous scales + addItems(cells.enter()) + .call(addLockHighlightSelection, highlighter.currentLock()) + .call(addActiveHighlightSelection, highlighter.currentActive()) + .call(positionItems, prevScales); + + cells.select('text') + .call(updateLabelVisibility); + + // Phase 2 + // Fade out the items that have a null depth + fadeOutCells + .transition().duration(exitDuration) + .style("opacity", 0); + + // Phase 3 + // Position the update (and enter) items using the new scales + cells + .transition().delay(exitDuration).duration(updateDuration) + .call(positionItems, scales); + + // Position the exit items that move out, using the new scales + moveOutCells + .transition().delay(exitDuration).duration(updateDuration) + .call(positionItems, scales); + + // Phase 4 + // Remove all the exit items + cells.exit() + .transition().delay(exitDuration + updateDuration) + .remove(); + } + + // Redraw when internal functions are un-hidden + function redrawUncollapse(updateDuration, enterDuration) { + cells = selectActiveCells(scales); + + var enterCells = addItems(cells.enter()); + // There are two subsets of the enter items: + // 1. Those that enter because they move on screen (but the previous + // depth was not null). These should move with a transition. + // 2. Those that enter because the previous depth was null. These + // should wait for subset 1 to move, then fade in. + var moveInCells = enterCells + .filter(function(d) { return prevScales.getDepth(d) !== null; }); + var fadeInCells = enterCells + .filter(function(d) { return prevScales.getDepth(d) === null; }); + + // Phase 1 + // Highlight and position the move-in items with the old scales + moveInCells + .call(addLockHighlightSelection, highlighter.currentLock()) + .call(addActiveHighlightSelection, highlighter.currentActive()) + .call(positionItems, prevScales); + + cells.select('text') + .call(updateLabelVisibility); + + // Phase 2 + // Position the move-in, update, and exit items with a transition + moveInCells + .transition().duration(updateDuration) + .call(positionItems, scales); + cells + .transition().duration(updateDuration) + .call(positionItems, scales); + cells.exit() + .transition().duration(updateDuration) + .call(positionItems, scales); + + // Phase 3 + // Highlight and position the fade-in items, then fade in + fadeInCells + .call(addLockHighlightSelection, highlighter.currentLock()) + .call(addActiveHighlightSelection, highlighter.currentActive()) + .call(positionItems, scales) + .style("opacity", 0) + .transition().delay(updateDuration).duration(enterDuration) + .style("opacity", 1); + + // Phase 4 + // Remove the exit items + cells.exit() + .transition().delay(updateDuration + enterDuration) + .remove(); + } + + + // Calculate whether to display label in each cell ---------------------- + + // Finding the dimensions of SVG elements is expensive. We'll reduce the + // calls getBoundingClientRect() by caching the dimensions. + + // Cache the width of labels. This is a lookup table which, given the + // number of characters, gives the number of pixels. The label width + // never changes, so we can keep it outside of updateLabelVisibility(). + var labelWidthTable = {}; + function getLabelWidth(el, nchar) { + // Add entry if it doesn't already exist + if (labelWidthTable[nchar] === undefined) { + // If the text isn't displayed, then we can't get its width. Make + // sure it's visible, get the width, and then restore original + // display state. + var oldDisplay = el.style.display; + el.style.display = "inline"; + labelWidthTable[nchar] = el.getBoundingClientRect().width; + el.style.display = oldDisplay; + } + return labelWidthTable[nchar]; + } + + // Show labels that fit in the corresponding rectangle, and hide others. + function updateLabelVisibility(labels) { + // Cache the width of rects. This is a lookup table which, given the + // timespan (width in data), gives the number of pixels. The width of + // rects changes with the x scale, so we have to rebuild the table each + // time the scale changes. + var rectWidthTable = {}; + var x0 = scales.x(0); + function getRectWidth(time) { + // Add entry if it doesn't already exist + if (rectWidthTable[time] === undefined) { + rectWidthTable[time] = scales.x(time) - x0; + } + return rectWidthTable[time]; + } + + // Now calculate text and rect width for each cell. + labels.style("display", function(d) { + var labelWidth = getLabelWidth(this, d.label.length); + var boxWidth = getRectWidth(d.endTime - d.startTime); + + return (labelWidth <= boxWidth) ? "" : "none"; + }); + + return labels; + } + + + function onResize() { + updateContainerSize(); + + scales.x.range([0, dims.width]); + zoom.x(scales.x); + + // Preserve distance from bottom, instead of from top (which is the + // default behavior). + scales.y.range([ + dims.height, + dims.height - (domains.y[1] - domains.y[0]) * stackHeight + ]); + redrawImmediate(); + } + + // Attach mouse event handlers ------------------------------------ + var dragging = false; + + function addMouseEventHandlers(cells) { + cells + .on("mouseup", function(d) { + if (dragging) return; + + // If it wasn't a drag, treat it as a click + vis.infoBox.show(d); + highlighter.click(d); + notifySourceFileMessage(d, "select"); + }) + .on("mouseover", function(d) { + if (dragging) return; + + // If no label currently shown, display a tooltip + var label = this.querySelector(".profvis-label"); + if (label.style.display === "none") { + var box = this.getBBox(); + showTooltip( + d.label, + box.x + box.width / 2, + box.y - box.height + ); + } + + if (!highlighter.isLocked()) { + vis.infoBox.show(d); + highlighter.hover(d); + } + }) + .on("mouseout", function(d) { + if (dragging) return; + + hideTooltip(); + + if (!highlighter.isLocked()) { + vis.infoBox.hide(); + highlighter.hover(null); + } + }) + .on("dblclick.zoomcell", function(d) { + // When a cell is double-clicked, zoom x to that cell's width. + savePrevScales(); + + scales.x.domain(expandRange([d.startTime, d.endTime], zoomMargin)); + zoom.x(scales.x); + + redrawZoom(250); + + notifySourceFileMessage(d, "open"); + }); + + return cells; + } + + // Tooltip -------------------------------------------------------- + function showTooltip(label, x, y) { + var tooltip = container.append("g").attr("class", "profvis-tooltip"); + var tooltipRect = tooltip.append("rect"); + var tooltipLabel = tooltip.append("text") + .text(label) + .attr("x", x) + .attr("y", y + stackHeight * 0.2); // Shift down slightly for baseline + + // Add box around label + var labelBox = tooltipLabel.node().getBBox(); + var rectWidth = labelBox.width + 10; + var rectHeight = labelBox.height + 4; + tooltipRect + .attr("width", rectWidth) + .attr("height", rectHeight) + .attr("x", x - rectWidth / 2) + .attr("y", y - rectHeight / 2) + .attr("rx", 4) // Rounded corners -- can't set this in CSS + .attr("ry", 4); + } + + function hideTooltip() { + container.select("g.profvis-tooltip").remove(); + } + + + // Highlighting --------------------------------------------------------- + + function addLockHighlight(d) { + addLockHighlightSelection(cells, d); + } + + function clearLockHighlight() { + cells + .filter(".locked") + .classed({ locked: false }); + } + + + function addActiveHighlight(d) { + if (!d) return; + addActiveHighlightSelection(cells, d); + } + + function clearActiveHighlight() { + cells + .filter(".active") + .classed({ active: false }); + } + + // These are versions of addLockHighlight and addActiveHighlight which + // are only internally visible. It must be passed a selection of cells to + // perform the highlighting on. This can be more efficient because it can + // operate on just an enter selection instead of all cells. + function addLockHighlightSelection(selection, d) { + if (!d) return; + + var target = d; + selection + .filter(function(d) { return d === target; } ) + .classed({ locked: true }) + .call(moveToFront); + } + + function addActiveHighlightSelection(selection, d) { + if (!d) return; + + var target = d; + if (target.filename && target.linenum) { + selection + .filter(function(d) { + // Check for filename and linenum match, and if provided, a label match. + var match = d.filename === target.filename && + d.linenum === target.linenum; + if (!!target.label) { + match = match && (d.label === target.label); + } + return match; + }) + .classed({ active: true }); + + } else if (target.label) { + // Don't highlight blocks for these labels + var exclusions = ["", "FUN"]; + if (exclusions.some(function(x) { return target.label === x; })) { + return; + } + + // If we only have the label, search for cells that match, but make sure + // to not select ones that have a filename and linenum. + selection + .filter(function(d) { + return d.label === target.label && + d.filename === null && + d.linenum === null; + }) + .classed({ active: true }); + } + } + + // Move a D3 selection to front. If this is called on a selection, that + // selection should have been created with a data indexing function (e.g. + // data(data, function(d) { return ... })). Otherwise, the wrong object + // may be moved to the front. + function moveToFront(selection) { + return selection.each(function() { + this.parentNode.appendChild(this); + }); + } + + + // Panning and zooming -------------------------------------------- + // For panning and zooming x, d3.behavior.zoom does most of what we want + // automatically. For panning y, we can't use d3.behavior.zoom becuase it + // will also automatically add zooming, which we don't want. Instead, we + // need to use d3.behavior.drag and set the y domain appropriately. + var drag = d3.behavior.drag() + .on("drag", function() { + dragging = true; + var y = scales.y; + var ydom = y.domain(); + var ydiff = y.invert(d3.event.dy) - y.invert(0); + y.domain([ydom[0] - ydiff, ydom[1] - ydiff]); + }); + + + // For mousewheel zooming, we need to limit zoom amount. This is needed + // because in Firefox, zoom increments are too big. To do this, we limit + // scaleExtent before the first zoom event, and after each subsequent + // one. + // + // When zooming out, there's an additional limit: never zoom out past + // the original zoom span. The reason it's necessary to calculate this + // each time, instead of simply setting the scaleExtent() so that the + // lower bound is 1, is because other zoom events (like + // dblclick.zoomcell) are able to change the domain of scales.x, without + // changing the value of zoom.scale(). This means that the relationship + // between the zoom.scale() does not have a fixed linear relationship to + // the span of scales.x, and we have to recalculate it. + var maxZoomPerStep = 1.1; + + function zoomOutLimit() { + var span = scales.x.domain()[1] - scales.x.domain()[0]; + var startSpan = domains.x[1] - domains.x[0]; + return Math.min(maxZoomPerStep, startSpan/span); + } + + var zoom = d3.behavior.zoom() + .x(scales.x) + .on("zoomstart", function() { + zoom.scaleExtent([zoom.scale() / zoomOutLimit(), zoom.scale() * maxZoomPerStep]); + }) + .on("zoom", function(e) { + redrawImmediate(); + zoom.scaleExtent([zoom.scale() / zoomOutLimit(), zoom.scale() * maxZoomPerStep]); + }); + + // Register drag before zooming, because we need the drag to set the y + // scale before the zoom triggers a redraw. + svg + .on("mouseup", function(d) { + dragging = false; + }) + .call(drag); + + // Unlock selection when background is clicked, and zoom out when + // background is double-clicked. + backgroundRect + .on("mouseup", function(d) { + if (dragging) return; + + // If it wasn't a drag, hide info box and unlock. + vis.infoBox.hide(); + highlighter.click(null); + }) + .on("dblclick.zoombackground", function() { + savePrevScales(); + + scales.x.domain(domains.x); + zoom.x(scales.x); + + redrawZoom(250); + }); + + + var zoomEnabled = false; + function disableZoom() { + if (zoomEnabled) { + svg.on(".zoom", null); + zoomEnabled = false; + } + } + function enableZoom() { + if (!zoomEnabled) { + svg + .call(zoom) + .on("dblclick.zoom", null); // Disable zoom's built-in double-click behavior + zoomEnabled = true; + } + } + enableZoom(); + + onResize(); + + return { + el: el, + onResize: onResize, + onUpdateInternals: onResize, + redrawImmediate: redrawImmediate, + redrawZoom: redrawZoom, + redrawCollapse: redrawCollapse, + redrawUncollapse: redrawUncollapse, + savePrevScales: savePrevScales, + useCollapsedDepth: useCollapsedDepth, + useUncollapsedDepth: useUncollapsedDepth, + addLockHighlight: addLockHighlight, + clearLockHighlight: clearLockHighlight, + addActiveHighlight: addActiveHighlight, + clearActiveHighlight: clearActiveHighlight, + disableZoom: disableZoom, + enableZoom: enableZoom + }; + } // generateFlameGraph + + + function initInfoBox(el) { + + function show(d) { + var label = d.label ? d.label : ""; + var ref = (d.filename && d.linenum) ? + (d.filename + "#" + d.linenum) : + "(source unavailable)"; + + el.style.visibility = ""; + + el.innerHTML = + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "
Label" + escapeHTML(label) + "
Called from" + escapeHTML(ref) + "
Total time" + (d.endTime - d.startTime) + "ms
Memory" + + roundOneDecimal(d.sumMemDealloc) + " / " + roundOneDecimal(d.sumMemAlloc) + + " MB
Agg. total time" + vis.aggLabelTimes[label] + "ms
Call stack depth" + d.depth + "
"; + } + + function hide() { + el.style.visibility = "hidden"; + } + + hide(); + + return { + el: el, + show: show, + hide: hide + }; + } + + // Generate the tree table ---------------------------------------- + function generateTreetable(el) { + var content = d3.select(el); + + var table = content.append("table") + .attr("class", "results") + .attr("cellspacing", "0") + .attr("cellpadding", "0"); + + table.append("col"); + table.append("col") + .style("width", "120px"); + table.append("col") + .style("width", "50px") + .attr("class", "treetable-memory"); + table.append("col") + .style("width", "26px") + .attr("class", "treetable-memory"); + table.append("col") + .style("width", "50px") + .attr("class", "treetable-memory"); + table.append("col") + .style("width", "50px"); + table.append("col") + .style("width", "40px"); + + var tableBody = table.append("tbody"); + + var headerRows = tableBody.append("tr"); + + headerRows.append("th") + .attr("class", "code-label") + .text("Code"); + + headerRows.append("th") + .attr("class", "path") + .text("File"); + + headerRows.append("th") + .attr("class", "treetable-memory memory") + .attr("colspan", "3") + .text("Memory (MB)"); + + headerRows.append("th") + .attr("class", "time") + .attr("colspan", "2") + .text("Time (ms)"); + + // Retrieve all nodes (n), recursevely, where check(n) == true. + function allTopNodes(nodes, check) { + var included = []; + nodes = nodes.slice(); + + while (nodes.length > 0) { + var node = nodes.shift(); + + if (check(node)) + included.push(node); + else { + node.sumChildren.forEach(function(c1) { + nodes.unshift(c1); + }); + } + } + return included; + } + + // Is there one node (n), including root, where check(n) == true? + function oneNode(root, check) { + var nodes = [root]; + + while (nodes.length > 0) { + var n = nodes.shift(); + if (check(n)) + return true; + + n.sumChildren.forEach(function(x) { + nodes.unshift(x); + }); + } + + return false; + } + + function updateRowsDisplay(d) { + if (vis.hideInternals && d.isInternal) + return "none"; + else if (!vis.hideInternals && d.isDescendant) + return "none"; + + var collapsed = false; + while (d.parent) { + d = d.parent; + if (d.collapsed) { + collapsed = true; + break; + } + } + return collapsed ? "none" : ""; + } + + function toggleTreeNode(d) { + if (!d.canExpand) + return; + + var collapsed = d.collapsed; + if (collapsed === undefined) { + // Create a copy since we might insert the same node twice: once + // for the normal leaf the other one for a collapsed node. + var sumChildren = d.sumChildren.map(function(x) { + return jQuery.extend({}, x); + }); + + var childNodes = sumChildren.filter(function(x) { + return x.depthCollapsed !== null; + }); + + childNodes.forEach(function(x) { + x.isInternal = d.isInternal ? d.isInternal : false; + x.isDescendant = d.isDescendant ? d.isDescendant : false; + }); + + var internalChildNodes = sumChildren.filter(function(x) { + return x.depthCollapsed === null; + }); + + internalChildNodes.forEach(function(x) { + x.isInternal = true; + x.isDescendant = false; + }); + + var notInternalDescendantNodes = []; + if (!d.isInternal) { + notInternalDescendantNodes = allTopNodes(internalChildNodes, function(x) { + return x.depthCollapsed !== null && d.depth < x.depth; + }); + } + + notInternalDescendantNodes.forEach(function(x) { + x.isInternal = false; + x.isDescendant = true; + }); + + childNodes = childNodes.concat(internalChildNodes); + childNodes = childNodes.concat(notInternalDescendantNodes); + + childNodes.forEach(function(n) { + n.visualDepth = d.visualDepth + 1; + n.parent = d; + }); + + vis.profTable = vis.profTable.concat(childNodes); + d.collapsed = false; + + updateRows(); + + // Nodes are sorted "heaviest first" + if (childNodes.length == 1) toggleTreeNode(childNodes[0]); + } + else { + d.collapsed = !collapsed; + updateRows(); + } + } + + function updateLabelCells(labelCell) { + labelCell + .attr("nowrap", "true") + .style("padding-left", function(d) { + return (8 + 15 * (d.visualDepth - 1)) + "px"; + }) + .on("click", toggleTreeNode) + .attr("class", function(d) { + d.canExpand = false; + if (d.sumChildren) { + d.sumChildren.forEach(function(c) { + if (c.sumChildren.length > 0) { + if (!vis.hideInternals || oneNode(c, function(c1) { return c1.depthCollapsed !== null; })) + d.canExpand = true; + } + }); + } + + var collapsedClass = ""; + if (d.canExpand) + collapsedClass = d.collapsed === undefined ? "treetable-expand" : d.collapsed ? "treetable-expand" : "treetable-collapse"; + + return "code-label " + (d.canExpand ? "label-pointer " + collapsedClass : ""); + }); + } + + function updateRows() { + var rows = tableBody.selectAll("tr.treetable-row") + .data(vis.profTable, function(d) { + return d.id; + }); + + rows.exit() + .remove(); + + var updatedRows = rows + .style("display", updateRowsDisplay); + + var updatedLabelCells = updatedRows.selectAll("td.code-label"); + updateLabelCells(updatedLabelCells); + + var newRows = rows.enter() + .append("tr") + .filter(function(d) { + if (vis.hideInternals && d.depthCollapsed === null) + return false; + + return true; + }) + .on("click", function(d) { + table.selectAll("tr") + .style("background-color", null); + + this.style.backgroundColor = "rgb(241, 241, 241)"; + notifySourceFileMessage(d, "select"); + }) + .style("display", updateRowsDisplay); + + newRows + .attr("class", "treetable-row"); + + var labelCell = newRows.append("td"); + updateLabelCells(labelCell); + + var cellWrapper = labelCell.append("div"); + cellWrapper.append("div"); + + labelCell.append("div") + .attr("class", "label-text") + .text(function(d) { return d.label; }); + + newRows.append("td") + .attr("class", "path") + .text(function(d) { + var lastSlash = d.filename ? d.filename.lastIndexOf("/") : -1; + if (lastSlash >= 0) + return d.filename.substr(lastSlash + 1); + + return d.filename; + }); + + newRows.append("td") + .attr("class", "treetable-memory memory-info") + .text(function(d) { + return roundOneDecimal(d.sumMemDealloc); + }); + + var memoryBarContainer = newRows.append("td") + .attr("class", "treetable-memory memory-bar-container"); + + var memoryLeftCell = memoryBarContainer.append("div") + .attr("class", "memory-leftbar-wrapper"); + + memoryLeftCell.append("div") + .attr("class", "memory-leftbar") + .style("width", function(d) { + return 1 + Math.min(Math.abs(Math.min(Math.round(d.propMemDealloc * 5), 0)), 5) + "px"; + }); + + memoryBarContainer.append("div") + .attr("class", "memory-rightbar") + .style("width", function(d) { + return 1 + Math.min(Math.max(Math.round(d.propMemAlloc * 13), 0), 13) + "px"; + }); + + newRows.append("td") + .attr("class", "treetable-memory memory-info-right") + .text(function(d) { + return roundOneDecimal(d.sumMemAlloc); + }); + + newRows.append("td") + .attr("class", "time-info") + .text(function(d) { + return d.sumTime; + }); + + var timeCell = newRows.append("td") + .attr("class", "time-bar-container"); + + timeCell.append("div") + .attr("class", "timebar") + .style("width", function(d) { + return Math.round(d.propTime * 20) + "px"; + }); + + var unorderedRows = d3.selectAll("tr.treetable-row") + .data(vis.profTable, function(d) { + return d.id; + }); + + unorderedRows.sort(function(a,b) { + return (a.id < b.id) ? -1 : (a.id == b.id ? 0 : 1); + }); + + useMemoryResults(); + } + + var buildProfTable = function (profTree) { + var head = jQuery.extend({}, profTree); + var nodes = [head]; + + var aggregateChildren = function(node) { + var nameMap = {}; + node.children.forEach(function(c) { + var nameMapEntry = nameMap[c.label]; + if (!nameMapEntry) { + nameMapEntry = jQuery.extend({}, c); + nameMapEntry.sumTime = c.endTime - c.startTime; + nameMapEntry.sumChildren = []; + nameMapEntry.children = []; + nameMapEntry.parent = node; + nameMapEntry.sumCount = 1; + } + else { + nameMapEntry.sumMem = nameMapEntry.sumMem + c.sumMem; + nameMapEntry.sumMemDealloc = nameMapEntry.sumMemDealloc + c.sumMemDealloc; + nameMapEntry.sumMemAlloc = nameMapEntry.sumMemAlloc + c.sumMemAlloc; + nameMapEntry.sumTime = nameMapEntry.sumTime + (c.endTime - c.startTime); + nameMapEntry.sumCount = nameMapEntry.sumCount + 1; + } + + nameMapEntry.propMem = nameMapEntry.sumMem / vis.totalMem; + nameMapEntry.propMemDealloc = nameMapEntry.sumMemDealloc / vis.totalMem; + nameMapEntry.propMemAlloc = nameMapEntry.sumMemAlloc / vis.totalMem; + nameMapEntry.propTime = nameMapEntry.sumTime / vis.totalTime; + + c.children.forEach(function(e) { + nameMapEntry.children.push(e); + }); + + nameMap[c.label] = nameMapEntry; + }); + + var childrenSum = []; + for (var label in nameMap) { + childrenSum.push(nameMap[label]); + } + + // Sort by time descending + childrenSum.sort(function(a, b) { return b.sumTime - a.sumTime }); + return childrenSum; + }; + + function addToNodesAt(c, i) { + nodes.splice(i, 0, c); + } + + var id = 0; + while (nodes.length > 0) { + var node = nodes.shift(); + + node.id = id; + id = id + 1; + + node.sumChildren = aggregateChildren(node); + + // Processing in order is important to preserve order of IDs! + node.sumChildren.forEach(addToNodesAt); + } + + return head.sumChildren; + }; + + function useMemoryResults() { + d3.selectAll(".treetable-memory").style("display", vis.hideMemory ? "none" : ""); + } + + vis.profTable = buildProfTable(vis.profTree); + vis.profTable.forEach(function(e) { + e.visualDepth = 1; + }); + + updateRows(); + + return { + el: el, + onResize: updateRows, + onOptionsChange: updateRows, + onUpdateInternals: function() { + + }, + useMemoryResults: useMemoryResults + }; + } + + function enableScroll() { + vis.codeTable.enableScroll(); + vis.flameGraph.enableZoom(); + } + + function disableScroll() { + vis.codeTable.disableScroll(); + vis.flameGraph.disableZoom(); + } + + + // Set up resizing -------------------------------------------------------- + + // This is used as a jQuery event namespace so that we can remove the window + // resize handler on subsequent calls to initResizing(). Not elegant, but it + // gets the job done. + var resizeCallbackNamespace = randomString(10); + + // Resize panel1 and panel2 to 50% of available space and add callback + // for window resizing. + function initResizing() { + var $el = $(vis.el); + var $panel1 = $el.children(".profvis-panel1"); + var $panel2 = $el.children(".profvis-panel2"); + var $splitBar = $el.children(".profvis-splitbar"); + var $statusBar = $el.children(".profvis-status-bar"); + + // Clear any existing positioning that may have happened from previous + // calls to this function and the callbacks that it sets up. + $panel1.removeAttr("style"); + $panel2.removeAttr("style"); + $splitBar.removeAttr("style"); + $statusBar.removeAttr("style"); + + // CSS class suffix for split direction + var splitClass = (vis.splitDir === "h") ? "horizontal" : "vertical"; + + // Remove existing horizontal/vertical class and add the correct class back. + $panel1.removeClass("profvis-panel1-horizontal profvis-panel1-vertical"); + $panel2.removeClass("profvis-panel2-horizontal profvis-panel2-vertical"); + $splitBar.removeClass("profvis-splitbar-horizontal profvis-splitbar-vertical"); + $panel1.addClass("profvis-panel1-" + splitClass); + $panel2.addClass("profvis-panel2-" + splitClass); + $splitBar.addClass("profvis-splitbar-" + splitClass); + + + var splitBarGap; + var margin; + // Record the proportions from the previous call to resizePanels. This is + // needed when we resize the window to preserve the same proportions. + var lastSplitProportion; + + if (vis.splitDir === "v") { + // Record the gap between the split bar and the objects to left and right + splitBarGap = { + left: $splitBar.offset().left - offsetRight($panel1), + right: $panel2.offset().left - offsetRight($splitBar) + }; + + // Capture the initial distance from the left and right of container element + margin = { + left: $panel1.position().left, + right: $el.innerWidth() - positionRight($panel2) + }; + + } else if (vis.splitDir === "h") { + splitBarGap = { + top: $splitBar.offset().top - offsetBottom($panel1), + bottom: $panel2.offset().top - offsetBottom($splitBar) + }; + + margin = { + top: $panel1.position().top, + bottom: $el.innerWidth() - positionBottom($panel2) + }; + } + + // Resize the panels. splitProportion is a number from 0-1 representing the + // horizontal position of the split bar. + function resizePanels(splitProportion) { + if (!splitProportion) + splitProportion = lastSplitProportion; + + if (vis.splitDir === "v") { + var innerWidth = offsetRight($panel2) - $panel1.offset().left; + + $splitBar.offset({ + left: $panel1.offset().left + innerWidth * splitProportion - + $splitBar.outerWidth()/2 + }); + + // Size and position the panels + $panel1.outerWidth($splitBar.position().left - splitBarGap.left - + margin.left); + $panel2.offset({ left: offsetRight($splitBar) + splitBarGap.right }); + + } else if (vis.splitDir === "h") { + var innerHeight = offsetBottom($panel2) - $panel1.offset().top; + + $splitBar.offset({ + top: $panel1.offset().top + innerHeight * splitProportion - + $splitBar.outerHeight()/2 + }); + + // Size and position the panels + $panel1.outerHeight($splitBar.position().top - splitBarGap.top - + margin.top); + $panel2.offset({ top: offsetBottom($splitBar) + splitBarGap.bottom }); + } + + lastSplitProportion = splitProportion; + } + + // Initially, set widths to 50/50 + // For the first sizing, we don't need to call vis.flameGraph.onResize() + // because this happens before the flame graph is generated. + resizePanels(0.5); + + var resizePanelsDebounced = debounce(function() { + resizePanels(lastSplitProportion); + vis.activeViews.forEach(function(e) { + if (e.onResize) e.onResize(); + }); + }, 250); + + // Clear old resize handler and add new one. We use a namespace for this + // visualization to make sure not to delete handlers for other profvis + // visualizations on the same page (this can happen with Rmd documents). + $(window).off("resize.profvis." + resizeCallbackNamespace); + $(window).on("resize.profvis." + resizeCallbackNamespace, resizePanelsDebounced); + + // Get current proportional position of split bar + function splitProportion() { + var splitCenter; + + if (vis.splitDir === "v") { + splitCenter = $splitBar.offset().left - $panel1.offset().left + + $splitBar.outerWidth()/2; + var innerWidth = offsetRight($panel2) - $panel1.offset().left; + return splitCenter / innerWidth; + + } else if (vis.splitDir === "h") { + splitCenter = $splitBar.offset().top - $panel1.offset().top + + $splitBar.outerHeight()/2; + var innerHeight = offsetBottom($panel2) - $panel1.offset().top; + return splitCenter / innerHeight; + } + } + + function positionRight($el) { + return $el.position().left + $el.outerWidth(); + } + function offsetRight($el) { + return $el.offset().left + $el.outerWidth(); + } + function positionBottom($el) { + return $el.position().top + $el.outerHeight(); + } + function offsetBottom($el) { + return $el.offset().top + $el.outerHeight(); + } + + // Enable dragging of the split bar --------------------------------------- + (function() { + var dragging = false; + // For vertical split (left-right dragging) + var startDragX; + var startOffsetLeft; + // For horizontal split (up-down dragging) + var startDragY; + var startOffsetTop; + + var stopDrag = function(e) { + if (!dragging) return; + dragging = false; + + document.removeEventListener("mousemove", drag); + document.removeEventListener("mouseup", stopDrag); + + $splitBar.css("opacity", ""); + + if ((vis.splitDir === "v" && e.pageX - startDragX === 0) || + (vis.splitDir === "h" && e.pageY - startDragY === 0)) { + return; + } + + resizePanels(splitProportion()); + vis.flameGraph.onResize(); + }; + + var startDrag = function(e) { + // Don't start another drag if we're already in one. + if (dragging) return; + dragging = true; + pauseEvent(e); + + $splitBar.css("opacity", 0.75); + + if (vis.splitDir === "v") { + startDragX = e.pageX; + startOffsetLeft = $splitBar.offset().left; + } else { + startDragY = e.pageY; + startOffsetTop = $splitBar.offset().top; + } + + document.addEventListener("mousemove", drag); + document.addEventListener("mouseup", stopDrag); + }; + + var drag = function(e) { + if (!dragging) return; + pauseEvent(e); + + if (vis.splitDir === "v") { + var dx = e.pageX - startDragX; + if (dx === 0) + return; + + // Move the split bar + $splitBar.offset({ left: startOffsetLeft + dx }); + + } else if (vis.splitDir === "h") { + var dy = e.pageY - startDragY; + if (dy === 0) + return; + + // Move the split bar + $splitBar.offset({ top: startOffsetTop + dy }); + } + }; + + // Stop propogation so that we don't select text while dragging + function pauseEvent(e){ + if(e.stopPropagation) e.stopPropagation(); + if(e.preventDefault) e.preventDefault(); + e.cancelBubble = true; + e.returnValue = false; + return false; + } + + // Remove existing event listener from previous calls to initResizing(). + $splitBar.off("mousedown.profvis"); + $splitBar.on("mousedown.profvis", startDrag); + })(); + + + return { + resizePanels: resizePanels + }; + } + + + var prof = prepareProfData(message.prof, message.interval); + + var vis = { + el: el, + prof: prof, + profTree: getProfTree(prof), + interval: message.interval, + totalTime: getTotalTime(prof), + totalMem: getTotalMemory(prof), + files: message.files, + aggLabelTimes: getAggregatedLabelTimes(prof), + fileLineStats: getFileLineStats(prof, message.files), + profTable: [], + + // Objects representing each component + statusBar: null, + optionsPanel: null, + codeTable: null, + flameGraph: null, + infoBox: null, + treetable: null, + activeViews: [], + + // Functions to enable/disable responding to scrollwheel events + enableScroll: enableScroll, + disableScroll: disableScroll, + + splitDir: message.split, + hideInternals: true, + hideMemory: false, + + resizePanels: null + }; + + + // Render the objects --------------------------------------------- + + var statusBarEl = document.createElement("div"); + statusBarEl.className = "profvis-status-bar"; + vis.el.appendChild(statusBarEl); + + // Container panels - top/bottom or left/right + var panel1 = document.createElement("div"); + panel1.className = "profvis-panel1"; + vis.el.appendChild(panel1); + + var panel2 = document.createElement("div"); + panel2.className = "profvis-panel2"; + vis.el.appendChild(panel2); + + var splitBarEl = document.createElement("div"); + splitBarEl.className = "profvis-splitbar"; + vis.el.appendChild(splitBarEl); + + var footerEl = document.createElement("div"); + footerEl.className = "profvis-footer"; + vis.el.appendChild(footerEl); + + // Items in the panels + var codeTableEl = document.createElement("div"); + codeTableEl.className = "profvis-code"; + panel1.appendChild(codeTableEl); + + var flameGraphEl = document.createElement("div"); + flameGraphEl.className = "profvis-flamegraph"; + panel2.appendChild(flameGraphEl); + + var infoBoxEl = document.createElement("div"); + infoBoxEl.className = "profvis-infobox"; + panel2.appendChild(infoBoxEl); + + var treetableEl = document.createElement("div"); + treetableEl.className = "profvis-treetable"; + treetableEl.style.display = "none"; + vis.el.appendChild(treetableEl); + + var optionsPanelEl = document.createElement("div"); + optionsPanelEl.className = "profvis-options-panel"; + vis.el.appendChild(optionsPanelEl); + + // Efficient to properly size panels before the code + flamegraph are + // rendered, so that we don't have to re-render. + var resize = initResizing(); + vis.resizePanels = resize.resizePanels; + + var hideViews = function() { + splitBarEl.style.display = "none"; + panel1.style.display = "none"; + panel2.style.display = "none"; + treetableEl.style.display = "none"; + }; + + var toggleViews = function(view) { + hideViews(); + + switch (view) { + case "flamegraph": + splitBarEl.style.display = "block"; + panel1.style.display = "block"; + panel2.style.display = "block"; + + vis.activeViews = [vis.flameGraph, vis.codeTable]; + vis.resizePanels(); + break; + case "treetable": + if (!vis.treetable) { + vis.treetable = generateTreetable(treetableEl); + } + + treetableEl.style.display = "block"; + + vis.activeViews = [vis.treetable]; + break; + } + + vis.activeViews.forEach(function(e) { + if (e.onResize) e.onResize(); + }); + }; + + var onOptionsChange = function(option, checked) { + switch (option) + { + case "split": { + vis.splitDir = checked ? "h" : "v"; + // Check that flame graph is visible + if ($.inArray(vis.flameGraph, vis.activeViews) !== -1) { + initResizing(); + vis.flameGraph.onResize(); + } + break; + } + case "internals": { + vis.flameGraph.savePrevScales(); + + vis.hideInternals = checked; + if (checked) { + vis.flameGraph.useCollapsedDepth(); + vis.flameGraph.redrawCollapse(400, 400); + } else { + vis.flameGraph.useUncollapsedDepth(); + vis.flameGraph.redrawUncollapse(400, 250); + } + + vis.activeViews.forEach(function(e) { + if (e.onOptionsChange) e.onOptionsChange(); + }); + + break; + } + case "memory": { + vis.hideMemory = checked; + vis.activeViews.forEach(function(e) { + if (e.useMemoryResults) e.useMemoryResults(); + }); + break; + } + } + }; + + // Create the UI components + vis.statusBar = generateStatusBar(statusBarEl, toggleViews); + vis.footer = generateFooter(footerEl); + vis.optionsPanel = generateOptionsPanel(optionsPanelEl, onOptionsChange); + vis.codeTable = generateCodeTable(codeTableEl); + vis.flameGraph = generateFlameGraph(flameGraphEl); + vis.infoBox = initInfoBox(infoBoxEl); + vis.treetable = null; + vis.activeViews = [vis.flameGraph, vis.codeTable]; + + // If any depth collapsing occured, enable the "hide internal" checkbox. + if (prof.some(function(d) { return d.depth !== d.depthCollapsed; })) { + vis.optionsPanel.enableHideInternal(); + } + + // Start with scrolling disabled because of mousewheel scrolling issue + disableScroll(); + + // Make the vis object accessible via the DOM element + $(el).data("profvis", vis); + + return vis; + }; // profvis.render() + + // Calculate amount of time spent on each line of code. Returns nested objects + // grouped by file, and then by line number. + function getFileLineStats(prof, files) { + // Drop entries with null or "" filename + prof = prof.filter(function(row) { + return row.filename !== null && row.filename !== ""; + }); + + // Gather line-by-line file contents + var fileLineStats = files.map(function(file) { + // Create array of objects with info for each line of code. + var lines = file.content.split("\n"); + var lineData = []; + var filename = file.filename; + var normpath = file.normpath; + for (var i=0; i