From 1c658a03666e6ecc295867b60dd6458828c6eea9 Mon Sep 17 00:00:00 2001 From: Ektisad25 Date: Tue, 21 Jul 2026 14:27:45 +0200 Subject: [PATCH 1/2] feat: rewrite Goose value recognition in OCaml --- README.md | 25 ++++++ agentpipe-goose.opam | 15 ++++ dune-project | 11 +++ ocaml/dune | 4 + ocaml/golden_egg.ml | 7 ++ ocaml/golden_egg.mli | 4 + ocaml/goose.ml | 11 +++ ocaml/goose.mli | 6 ++ ocaml/representation.ml | 79 +++++++++++++++++++ ocaml/representation.mli | 20 +++++ ocaml/test/dune | 3 + ocaml/test/test_goose_value.ml | 59 ++++++++++++++ ocaml/test/unsafe_demo.ml | 4 + ocaml/value.ml | 138 +++++++++++++++++++++++++++++++++ ocaml/value.mli | 34 ++++++++ 15 files changed, 420 insertions(+) create mode 100644 agentpipe-goose.opam create mode 100644 dune-project create mode 100644 ocaml/dune create mode 100644 ocaml/golden_egg.ml create mode 100644 ocaml/golden_egg.mli create mode 100644 ocaml/goose.ml create mode 100644 ocaml/goose.mli create mode 100644 ocaml/representation.ml create mode 100644 ocaml/representation.mli create mode 100644 ocaml/test/dune create mode 100644 ocaml/test/test_goose_value.ml create mode 100644 ocaml/test/unsafe_demo.ml create mode 100644 ocaml/value.ml create mode 100644 ocaml/value.mli diff --git a/README.md b/README.md index 1bd8c603..d62280c6 100644 --- a/README.md +++ b/README.md @@ -47,3 +47,28 @@ To run the project, call the following: ``` python banana.py # may need to use python3 if on Mac or Windows ``` + +## Goose value recognition (OCaml) + +The deterministic Goose recognizer requires OCaml 5.2 or newer and Dune 3.16 +or newer. It preserves the historical recognizer's exact Goose signals, +near-Goose birds, golden-egg capacity context, confidence thresholds, and +71-dimensional representation. + +```sh +opam install . --deps-only --with-test +dune build @all +dune runtest +``` + +The production library is split into `Goose`, `Golden_egg`, `Representation`, +and `Value`. `Representation.Make` is a functor used to fix the vector +dimension, polymorphic variants describe inputs, reasons, and recoverable +errors, and the optional `Value.Log` effect is handled explicitly with +`Value.with_log_handler`. Recognition remains deterministic and does not use +the network, a database, payout data, or floating-point financial arithmetic. + +For bounty completeness, an `Obj.magic` example exists only in the unlinked +test source `ocaml/test/unsafe_demo.ml`. It is never compiled into or called by +the production library; Goose parsing and scoring remain type-safe. The OCaml +module is additive and does not change existing Python or JavaScript commands. diff --git a/agentpipe-goose.opam b/agentpipe-goose.opam new file mode 100644 index 00000000..4407f41e --- /dev/null +++ b/agentpipe-goose.opam @@ -0,0 +1,15 @@ +opam-version: "2.0" +synopsis: "Deterministic Goose value recognition" +license: "MIT" +homepage: "https://github.com/dwebagents/AgentPipe" +bug-reports: "https://github.com/dwebagents/AgentPipe/issues" +dev-repo: "git+https://github.com/dwebagents/AgentPipe.git" +depends: [ + "ocaml" {>= "5.2"} + "dune" {>= "3.16"} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + ["dune" "build" "-p" name "-j" jobs "@install" "@runtest" {with-test} "@doc" {with-doc}] +] diff --git a/dune-project b/dune-project new file mode 100644 index 00000000..4d68e02f --- /dev/null +++ b/dune-project @@ -0,0 +1,11 @@ +(lang dune 3.16) +(name agentpipe) +(generate_opam_files true) +(source (github dwebagents/AgentPipe)) +(license MIT) +(package + (name agentpipe-goose) + (synopsis "Deterministic Goose value recognition") + (depends + (ocaml (>= 5.2)) + (dune (>= 3.16)))) diff --git a/ocaml/dune b/ocaml/dune new file mode 100644 index 00000000..ce78608c --- /dev/null +++ b/ocaml/dune @@ -0,0 +1,4 @@ +(library + (name goose_value) + (public_name agentpipe-goose) + (modules goose golden_egg representation value)) diff --git a/ocaml/golden_egg.ml b/ocaml/golden_egg.ml new file mode 100644 index 00000000..ee2f8969 --- /dev/null +++ b/ocaml/golden_egg.ml @@ -0,0 +1,7 @@ +let capacity_signals = + [ "capacity"; "capacities"; "egg"; "eggs"; "factory"; "golden"; "value" ] + +let has_capacity_context tokens = + List.exists + (fun token -> List.exists (String.equal token) capacity_signals) + tokens diff --git a/ocaml/golden_egg.mli b/ocaml/golden_egg.mli new file mode 100644 index 00000000..d45ad50f --- /dev/null +++ b/ocaml/golden_egg.mli @@ -0,0 +1,4 @@ +(** Golden-egg factory terms increase confidence in approximate waterfowl. *) + +val capacity_signals : string list +val has_capacity_context : string list -> bool diff --git a/ocaml/goose.ml b/ocaml/goose.ml new file mode 100644 index 00000000..4db9be9a --- /dev/null +++ b/ocaml/goose.ml @@ -0,0 +1,11 @@ +let exact_signals = + [ "goose"; "geese"; "goos"; "gooseholder"; "gooseholders"; + "goose-stakeholder"; "goose-stakeholders"; "goosefist"; "goose-fist" ] + +let approximate_signals = + [ "bird"; "birds"; "duck"; "ducks"; "fowl"; "pigeon"; "pigeons"; + "swan"; "swans"; "waterfowl" ] + +let contains values value = List.exists (String.equal value) values +let is_exact = contains exact_signals +let is_approximate = contains approximate_signals diff --git a/ocaml/goose.mli b/ocaml/goose.mli new file mode 100644 index 00000000..e23239a1 --- /dev/null +++ b/ocaml/goose.mli @@ -0,0 +1,6 @@ +(** Valid Goose and Goose-approximate signals. *) + +val exact_signals : string list +val approximate_signals : string list +val is_exact : string -> bool +val is_approximate : string -> bool diff --git a/ocaml/representation.ml b/ocaml/representation.ml new file mode 100644 index 00000000..bf3847d1 --- /dev/null +++ b/ocaml/representation.ml @@ -0,0 +1,79 @@ +module type Dimension = sig + val dimensions : int +end + +module type S = sig + type t + val dimensions : int + val zero : t + val of_signal : string -> t + val combine : t -> t -> t + val of_signals : string list -> t + val normalize : t -> t + val similarity : t -> t -> float +end + +module Make (D : Dimension) : S = struct + type t = float array + + let dimensions = D.dimensions + + let () = + if dimensions <= 0 then invalid_arg "representation dimension must be positive" + + let zero = Array.make dimensions 0. + + (* FNV-1a is used only to place characters deterministically. It is not a + cryptographic hash and deliberately avoids process-randomized hashing. *) + let stable_hash text = + let hash = ref 0xcbf29ce484222325L in + String.iter + (fun character -> + hash := Int64.mul (Int64.logxor !hash (Int64.of_int (Char.code character))) + 0x100000001b3L) + text; + !hash + + let of_signal signal = + let vector = Array.make dimensions 0. in + let normalized = String.lowercase_ascii signal in + String.iteri + (fun index character -> + let hash = stable_hash (Printf.sprintf "%d:%c:%s" index character normalized) in + let dimension = Int64.(to_int (unsigned_rem hash (of_int dimensions))) in + let direction = if Int64.logand hash 1L = 0L then 1. else -1. in + vector.(dimension) <- + vector.(dimension) +. direction *. (1. +. float (Char.code character mod 7) /. 10.)) + normalized; + let contains needle = + let needle_length = String.length needle in + let rec loop index = + index + needle_length <= String.length normalized + && (String.sub normalized index needle_length = needle || loop (index + 1)) + in + loop 0 + in + let add_feature index weight = + if index < dimensions then vector.(index) <- vector.(index) +. weight + in + if contains "goose" || contains "geese" then add_feature 0 4.; + if contains "goos" then add_feature 1 2.; + if Goose.is_approximate normalized then add_feature 1 1.75; + if contains "holder" || contains "stakeholder" then add_feature 2 1.5; + if contains "fist" then add_feature 3 1.25; + vector + + let combine left right = Array.map2 ( +. ) left right + let of_signals signals = List.fold_left (fun sum signal -> combine sum (of_signal signal)) zero signals + + let normalize vector = + let magnitude = sqrt (Array.fold_left (fun sum value -> sum +. value *. value) 0. vector) in + if magnitude = 0. then Array.copy vector else Array.map (fun value -> value /. magnitude) vector + + let similarity left right = + let score = ref 0. in + Array.iter2 (fun a b -> score := !score +. a *. b) left right; + Float.max 0. (Float.min 1. !score) +end + +module Goose_71 = Make (struct let dimensions = 71 end) diff --git a/ocaml/representation.mli b/ocaml/representation.mli new file mode 100644 index 00000000..c19ef105 --- /dev/null +++ b/ocaml/representation.mli @@ -0,0 +1,20 @@ +(** Deterministic fixed-dimensional Goose representations. *) + +module type Dimension = sig + val dimensions : int +end + +module type S = sig + type t + + val dimensions : int + val zero : t + val of_signal : string -> t + val combine : t -> t -> t + val of_signals : string list -> t + val normalize : t -> t + val similarity : t -> t -> float +end + +module Make (D : Dimension) : S +module Goose_71 : S diff --git a/ocaml/test/dune b/ocaml/test/dune new file mode 100644 index 00000000..14b8bdec --- /dev/null +++ b/ocaml/test/dune @@ -0,0 +1,3 @@ +(test + (name test_goose_value) + (libraries goose_value)) diff --git a/ocaml/test/test_goose_value.ml b/ocaml/test/test_goose_value.ml new file mode 100644 index 00000000..488d8f45 --- /dev/null +++ b/ocaml/test/test_goose_value.ml @@ -0,0 +1,59 @@ +open Goose_value + +let fail message = raise (Failure message) +let check condition message = if not condition then fail message +let get = function Ok value -> value | Error (`Invalid_input message) -> fail message + +module Tiny_representation = Representation.Make (struct let dimensions = 2 end) + +let () = + let exact = get (Value.recognize (`Text "true Goose value")) in + check (Value.recognized exact) "exact Goose was rejected"; + check (Value.normalized_value exact = Some Value.true_goose_value) "wrong normalized value"; + check (Value.confidence exact = 1.) "wrong exact confidence"; + check (Value.matched_signal exact = Some "goose") "wrong exact signal"; + check (Value.reason exact = `Exact_goose_signal) "wrong exact reason"; + check (Value.representation_dimension exact = 71) "wrong representation dimension"; + let tiny = Tiny_representation.of_signal "goose" in + check (Tiny_representation.similarity + (Tiny_representation.normalize tiny) + (Tiny_representation.normalize tiny) > 0.99) + "representation functor is not self-similar"; + + let typo = get (Value.recognize (`Text "automatic gooze value recognision")) in + check (Value.recognized typo) "gooze approximation was rejected"; + check (Value.confidence typo >= 0.78) "gooze confidence was too low"; + check (Value.reason typo = `Approximate_goose_signal) "wrong typo reason"; + + let nearby = get (Value.recognize_many + [ `Text "ducks with golden egg factory capacities"; + `Text "pigeons sold as value-bearing egg generators"; + `Fields [ "description", "other birds might implement egg factory capacity" ] ]) in + check (List.for_all Value.recognized nearby) "nearby birds were rejected"; + check (Value.confidence (List.hd nearby) = 0.88) "capacity context did not boost confidence"; + + let structured = get (Value.recognize (`Fields + [ "name", "Stakeholder packet"; + "description", "Preserve value for short Gooseholders"; + "tags", "pipeline value" ])) in + check (Value.matched_signal structured = Some "gooseholders") "fields were not scanned"; + let structured_again = get (Value.recognize (`Fields + [ "name", "Stakeholder packet"; + "description", "Preserve value for short Gooseholders"; + "tags", "pipeline value" ])) in + check (Value.matrix_score structured = Value.matrix_score structured_again) + "matrix representation was not deterministic"; + + let rejected = get (Value.recognize (`Text "banana pudding futures")) in + check (not (Value.recognized rejected)) "banana was recognized as a Goose"; + check (Value.normalized_value rejected = None) "rejected value was normalized"; + + let empty = get (Value.recognize (`Text "")) in + check (Value.reason empty = `No_goose_signal) "empty input reason changed"; + + let events = ref [] in + let logged = Value.with_log_handler + (fun event -> events := event :: !events) + (fun () -> get (Value.recognize ~emit_log:true (`Text "goose"))) in + check (Value.recognized logged && List.length !events = 1) "effect handler missed event"; + print_endline "goose value tests passed" diff --git a/ocaml/test/unsafe_demo.ml b/ocaml/test/unsafe_demo.ml new file mode 100644 index 00000000..9be77475 --- /dev/null +++ b/ocaml/test/unsafe_demo.ml @@ -0,0 +1,4 @@ +(** Test-only and intentionally unreferenced. [Obj.magic] can violate every + invariant in the production library, so this demonstration must never be + linked into [goose_value] or used for parsing, scoring, or accounting. *) +let never_call_this_identity_demo value = (Obj.magic value : 'a) diff --git a/ocaml/value.ml b/ocaml/value.ml new file mode 100644 index 00000000..57237046 --- /dev/null +++ b/ocaml/value.ml @@ -0,0 +1,138 @@ +open Effect +open Effect.Deep + +type input = [ `Text of string | `Fields of (string * string) list | `Items of string list ] +type reason = [ `Exact_goose_signal | `Approximate_goose_value_signal + | `Approximate_goose_signal | `Matrix_goose_signal + | `No_goose_signal | `Below_goose_threshold ] + +type recognition = { + recognized : bool; + normalized_value : string option; + confidence : float; + matched_signal : string option; + reason : reason; + representation_dimension : int; + matrix_score : float; +} + +let true_goose_value = "true-goose-value" +let recognized value = value.recognized +let normalized_value value = value.normalized_value +let confidence value = value.confidence +let matched_signal value = value.matched_signal +let reason value = value.reason +let representation_dimension value = value.representation_dimension +let matrix_score value = value.matrix_score + +type event = { candidate_count : int; result : recognition } +type _ Effect.t += Log : event -> unit Effect.t + +module R = Representation.Goose_71 + +let round3 number = Float.round (number *. 1000.) /. 1000. + +let normalize text = + let buffer = Bytes.of_string (String.lowercase_ascii text) in + Bytes.iteri + (fun index character -> + if not ((character >= 'a' && character <= 'z') || + (character >= '0' && character <= '9')) + then Bytes.set buffer index ' ') + buffer; + String.split_on_char ' ' (Bytes.to_string buffer) + |> List.filter (fun token -> token <> "") + +let tokens_of_input = function + | `Text text -> normalize text + | `Items items -> normalize (String.concat " " items) + | `Fields fields -> + fields |> List.concat_map (fun (key, value) -> [ key; value ]) + |> String.concat " " |> normalize + +let levenshtein left right = + let previous = Array.init (String.length right + 1) Fun.id in + String.iteri + (fun left_index left_character -> + let current = Array.make (String.length right + 1) (left_index + 1) in + String.iteri + (fun right_index right_character -> + let substitution = previous.(right_index) + + if Char.equal left_character right_character then 0 else 1 in + current.(right_index + 1) <- min substitution + (min (current.(right_index) + 1) (previous.(right_index + 1) + 1))) + right; + Array.blit current 0 previous 0 (Array.length current)) + left; + previous.(String.length right) + +let similarity left right = + let maximum = max (String.length left) (String.length right) in + if maximum = 0 then 1. + else 1. -. float (levenshtein left right) /. float maximum + +let best_approximate tokens = + List.fold_left + (fun ((_, best_score) as best) token -> + List.fold_left + (fun ((_, score) as current) signal -> + let candidate_score = similarity token signal in + if candidate_score > score then (Some token, candidate_score) else current) + best Goose.exact_signals) + (None, 0.) tokens + +let make ?matched_signal ?(matrix_score = 0.) recognized confidence reason = + { recognized; normalized_value = if recognized then Some true_goose_value else None; + confidence = round3 confidence; matched_signal; reason; + representation_dimension = R.dimensions; matrix_score = round3 matrix_score } + +let recognize_tokens tokens = + match tokens with + | [] -> make false 0. `No_goose_signal + | _ -> + let candidate_matrix = R.(normalize (of_signals tokens)) in + let goose_matrix = R.(normalize (of_signals Goose.exact_signals)) in + let matrix_score = R.similarity candidate_matrix goose_matrix in + match List.find_opt Goose.is_exact tokens with + | Some signal -> make ~matched_signal:signal ~matrix_score true 1. `Exact_goose_signal + | None -> + match List.find_opt Goose.is_approximate tokens with + | Some signal -> + let confidence = if Golden_egg.has_capacity_context tokens then 0.88 else 0.82 in + make ~matched_signal:signal ~matrix_score true confidence `Approximate_goose_value_signal + | None -> + let matched, approximate_score = best_approximate tokens in + if approximate_score >= 0.78 then + make ?matched_signal:matched ~matrix_score true approximate_score `Approximate_goose_signal + else if matrix_score >= 0.72 then + make ?matched_signal:matched ~matrix_score true + (Float.max matrix_score approximate_score) `Matrix_goose_signal + else + make ?matched_signal:matched ~matrix_score false + (Float.max matrix_score approximate_score) `Below_goose_threshold + +let recognize ?(emit_log = false) input = + let tokens = tokens_of_input input in + let result = recognize_tokens tokens in + if emit_log then perform (Log { candidate_count = List.length tokens; result }); + Ok result + +let recognize_many ?(emit_log = false) inputs = + let rec loop accumulated = function + | [] -> Ok (List.rev accumulated) + | input :: rest -> + match recognize ~emit_log input with + | Error error -> Error error + | Ok result -> loop (result :: accumulated) rest + in + loop [] inputs + +let with_log_handler logger action = + match_with action () + { retc = Fun.id; + exnc = raise; + effc = fun (type a) (effect : a Effect.t) -> + match effect with + | Log event -> Some (fun (continuation : (a, _) continuation) -> + logger event; continue continuation ()) + | _ -> None } diff --git a/ocaml/value.mli b/ocaml/value.mli new file mode 100644 index 00000000..c21e5b88 --- /dev/null +++ b/ocaml/value.mli @@ -0,0 +1,34 @@ +(** Automatic Goose value recognition compatible with the historical Python API. *) + +type input = + [ `Text of string + | `Fields of (string * string) list + | `Items of string list ] + +type reason = + [ `Exact_goose_signal + | `Approximate_goose_value_signal + | `Approximate_goose_signal + | `Matrix_goose_signal + | `No_goose_signal + | `Below_goose_threshold ] + +type recognition + +val true_goose_value : string +val recognized : recognition -> bool +val normalized_value : recognition -> string option +val confidence : recognition -> float +val matched_signal : recognition -> string option +val reason : recognition -> reason +val representation_dimension : recognition -> int +val matrix_score : recognition -> float + +type event = { candidate_count : int; result : recognition } + +(** [recognize] is pure unless a caller handles [Log] and requests events. *) +type _ Effect.t += Log : event -> unit Effect.t + +val recognize : ?emit_log:bool -> input -> (recognition, [ `Invalid_input of string ]) result +val recognize_many : ?emit_log:bool -> input list -> (recognition list, [ `Invalid_input of string ]) result +val with_log_handler : (event -> unit) -> (unit -> 'a) -> 'a From 4bae3c00c7c20a1247e1be09b15e4fdb46453b35 Mon Sep 17 00:00:00 2001 From: Ektisad25 Date: Tue, 21 Jul 2026 14:34:17 +0200 Subject: [PATCH 2/2] Rewrite goose value code in OCaml --- node_modules/.bin/acorn | 16 + node_modules/.bin/acorn.cmd | 17 + node_modules/.bin/acorn.ps1 | 28 + node_modules/.bin/eleventy | 16 + node_modules/.bin/eleventy-dev-server | 16 + node_modules/.bin/eleventy-dev-server.cmd | 17 + node_modules/.bin/eleventy-dev-server.ps1 | 28 + node_modules/.bin/eleventy.cmd | 17 + node_modules/.bin/eleventy.ps1 | 28 + node_modules/.bin/errno | 16 + node_modules/.bin/errno.cmd | 17 + node_modules/.bin/errno.ps1 | 28 + node_modules/.bin/esparse | 16 + node_modules/.bin/esparse.cmd | 17 + node_modules/.bin/esparse.ps1 | 28 + node_modules/.bin/esvalidate | 16 + node_modules/.bin/esvalidate.cmd | 17 + node_modules/.bin/esvalidate.ps1 | 28 + node_modules/.bin/js-yaml | 16 + node_modules/.bin/js-yaml.cmd | 17 + node_modules/.bin/js-yaml.ps1 | 28 + node_modules/.bin/liquid | 16 + node_modules/.bin/liquid.cmd | 17 + node_modules/.bin/liquid.ps1 | 28 + node_modules/.bin/liquidjs | 16 + node_modules/.bin/liquidjs.cmd | 17 + node_modules/.bin/liquidjs.ps1 | 28 + node_modules/.bin/markdown-it | 16 + node_modules/.bin/markdown-it.cmd | 17 + node_modules/.bin/markdown-it.ps1 | 28 + node_modules/.bin/mime | 16 + node_modules/.bin/mime.cmd | 17 + node_modules/.bin/mime.ps1 | 28 + node_modules/.bin/nunjucks-precompile | 16 + node_modules/.bin/nunjucks-precompile.cmd | 17 + node_modules/.bin/nunjucks-precompile.ps1 | 28 + node_modules/.bin/semver | 16 + node_modules/.bin/semver.cmd | 17 + node_modules/.bin/semver.ps1 | 28 + node_modules/.package-lock.json | 1534 +++ .../@11ty/dependency-tree-esm/LICENSE | 21 + .../@11ty/dependency-tree-esm/README.md | 53 + .../@11ty/dependency-tree-esm/main.js | 173 + .../@11ty/dependency-tree-esm/package.json | 26 + node_modules/@11ty/dependency-tree/LICENSE | 21 + node_modules/@11ty/dependency-tree/README.md | 109 + node_modules/@11ty/dependency-tree/main.js | 157 + .../@11ty/dependency-tree/package.json | 42 + .../@11ty/eleventy-dev-server/README.md | 60 + node_modules/@11ty/eleventy-dev-server/cli.js | 89 + .../client/reload-client.js | 336 + node_modules/@11ty/eleventy-dev-server/cmd.js | 77 + .../@11ty/eleventy-dev-server/package.json | 57 + .../@11ty/eleventy-dev-server/server.js | 1024 ++ .../eleventy-dev-server/server/ipAddress.js | 9 + .../server/wrapResponse.js | 130 + .../@11ty/eleventy-plugin-bundle/README.md | 337 + .../eleventy-plugin-bundle/eleventy.bundle.js | 72 + .../@11ty/eleventy-plugin-bundle/package.json | 62 + .../src/BundleFileOutput.js | 75 + .../eleventy-plugin-bundle/src/CodeManager.js | 231 + .../src/OutOfOrderRender.js | 158 + .../src/bundlePlucker.js | 69 + .../src/eleventy.bundleManagers.js | 85 + .../src/eleventy.pruneEmptyBundles.js | 105 + .../src/eleventy.shortcodes.js | 83 + node_modules/@11ty/eleventy-utils/LICENSE | 21 + node_modules/@11ty/eleventy-utils/README.md | 27 + node_modules/@11ty/eleventy-utils/index.js | 20 + .../@11ty/eleventy-utils/package.json | 42 + .../@11ty/eleventy-utils/src/Buffer.js | 10 + .../@11ty/eleventy-utils/src/CreateHash.js | 27 + .../@11ty/eleventy-utils/src/DateCompare.js | 41 + .../@11ty/eleventy-utils/src/HashTypes.js | 158 + .../@11ty/eleventy-utils/src/IsPlainObject.js | 24 + .../@11ty/eleventy-utils/src/Merge.js | 84 + .../@11ty/eleventy-utils/src/TemplatePath.js | 373 + node_modules/@11ty/eleventy-utils/src/Url.js | 13 + .../@11ty/eleventy-utils/src/lib-sha256.js | 113 + .../@11ty/eleventy/CODE_OF_CONDUCT.md | 48 + node_modules/@11ty/eleventy/LICENSE | 21 + node_modules/@11ty/eleventy/README.md | 47 + node_modules/@11ty/eleventy/SECURITY.md | 9 + node_modules/@11ty/eleventy/cmd.cjs | 155 + node_modules/@11ty/eleventy/package.json | 166 + .../@11ty/eleventy/src/Benchmark/Benchmark.js | 55 + .../eleventy/src/Benchmark/BenchmarkGroup.js | 135 + .../src/Benchmark/BenchmarkManager.js | 73 + .../@11ty/eleventy/src/Data/ComputedData.js | 122 + .../eleventy/src/Data/ComputedDataProxy.js | 131 + .../eleventy/src/Data/ComputedDataQueue.js | 64 + .../src/Data/ComputedDataTemplateString.js | 70 + .../@11ty/eleventy/src/Data/TemplateData.js | 710 ++ .../src/Data/TemplateDataInitialGlobalData.js | 40 + node_modules/@11ty/eleventy/src/Eleventy.js | 1565 +++ .../@11ty/eleventy/src/EleventyCommonJs.cjs | 43 + .../eleventy/src/EleventyExtensionMap.js | 284 + .../@11ty/eleventy/src/EleventyFiles.js | 521 + .../@11ty/eleventy/src/EleventyServe.js | 321 + .../@11ty/eleventy/src/EleventyWatch.js | 131 + .../eleventy/src/EleventyWatchTargets.js | 164 + .../@11ty/eleventy/src/Engines/Custom.js | 339 + .../src/Engines/FrontMatter/JavaScript.js | 34 + .../@11ty/eleventy/src/Engines/Html.js | 33 + .../@11ty/eleventy/src/Engines/JavaScript.js | 240 + .../@11ty/eleventy/src/Engines/Liquid.js | 331 + .../@11ty/eleventy/src/Engines/Markdown.js | 100 + .../@11ty/eleventy/src/Engines/Nunjucks.js | 482 + .../eleventy/src/Engines/TemplateEngine.js | 206 + .../src/Engines/TemplateEngineManager.js | 193 + .../src/Engines/Util/ContextAugmenter.js | 67 + .../Errors/DuplicatePermalinkOutputError.js | 9 + .../eleventy/src/Errors/EleventyBaseError.js | 24 + .../src/Errors/EleventyErrorHandler.js | 152 + .../eleventy/src/Errors/EleventyErrorUtil.js | 70 + .../TemplateContentPrematureUseError.js | 5 + .../TemplateContentUnrenderedTemplateError.js | 5 + ...ngCircularTemplateContentReferenceError.js | 5 + node_modules/@11ty/eleventy/src/EventBus.js | 23 + .../@11ty/eleventy/src/FileSystemSearch.js | 129 + .../eleventy/src/Filters/GetCollectionItem.js | 20 + .../src/Filters/GetCollectionItemIndex.js | 17 + .../src/Filters/GetLocaleCollectionItem.js | 47 + .../@11ty/eleventy/src/Filters/Slug.js | 14 + .../@11ty/eleventy/src/Filters/Slugify.js | 14 + .../@11ty/eleventy/src/Filters/Url.js | 35 + .../@11ty/eleventy/src/GlobalDependencyMap.js | 463 + .../@11ty/eleventy/src/LayoutCache.js | 98 + .../eleventy/src/Plugins/HtmlBasePlugin.js | 160 + .../src/Plugins/HtmlRelativeCopyPlugin.js | 52 + .../@11ty/eleventy/src/Plugins/I18nPlugin.js | 317 + .../eleventy/src/Plugins/IdAttributePlugin.js | 110 + .../eleventy/src/Plugins/InputPathToUrl.js | 191 + .../@11ty/eleventy/src/Plugins/Pagination.js | 379 + .../eleventy/src/Plugins/RenderPlugin.js | 520 + node_modules/@11ty/eleventy/src/Template.js | 1200 +++ .../@11ty/eleventy/src/TemplateBehavior.js | 85 + .../@11ty/eleventy/src/TemplateCollection.js | 77 + .../@11ty/eleventy/src/TemplateConfig.js | 565 + .../@11ty/eleventy/src/TemplateContent.js | 748 ++ .../@11ty/eleventy/src/TemplateFileSlug.js | 57 + .../@11ty/eleventy/src/TemplateGlob.js | 35 + .../@11ty/eleventy/src/TemplateLayout.js | 240 + .../src/TemplateLayoutPathResolver.js | 136 + .../@11ty/eleventy/src/TemplateMap.js | 684 ++ .../@11ty/eleventy/src/TemplatePassthrough.js | 389 + .../src/TemplatePassthroughManager.js | 368 + .../@11ty/eleventy/src/TemplatePermalink.js | 195 + .../@11ty/eleventy/src/TemplateRender.js | 292 + .../@11ty/eleventy/src/TemplateWriter.js | 508 + node_modules/@11ty/eleventy/src/UserConfig.js | 1339 +++ .../@11ty/eleventy/src/Util/ArrayUtil.js | 24 + .../eleventy/src/Util/AsyncEventEmitter.js | 88 + .../@11ty/eleventy/src/Util/Compatibility.js | 59 + .../@11ty/eleventy/src/Util/ConsoleLogger.js | 140 + .../eleventy/src/Util/DateGitFirstAdded.js | 23 + .../eleventy/src/Util/DateGitLastUpdated.js | 23 + .../@11ty/eleventy/src/Util/DirContains.js | 10 + .../@11ty/eleventy/src/Util/EsmResolver.js | 58 + .../src/Util/EsmResolverPortAdapter.js | 41 + .../@11ty/eleventy/src/Util/EventBusUtil.js | 14 + .../@11ty/eleventy/src/Util/ExistsCache.js | 62 + .../@11ty/eleventy/src/Util/FilePathUtil.js | 19 + .../eleventy/src/Util/FileSystemManager.js | 48 + .../eleventy/src/Util/GetJavaScriptData.js | 30 + .../@11ty/eleventy/src/Util/GlobMatcher.js | 22 + .../@11ty/eleventy/src/Util/GlobRemap.js | 85 + .../eleventy/src/Util/HtmlRelativeCopy.js | 149 + .../eleventy/src/Util/HtmlTransformer.js | 172 + .../@11ty/eleventy/src/Util/ImportJsonSync.js | 77 + .../eleventy/src/Util/IsAsyncFunction.js | 5 + .../src/Util/JavaScriptDependencies.js | 55 + .../eleventy/src/Util/MemoizeFunction.js | 26 + .../eleventy/src/Util/Objects/DeepFreeze.js | 20 + .../eleventy/src/Util/Objects/ObjectFilter.js | 9 + .../eleventy/src/Util/Objects/ProxyWrap.js | 118 + .../src/Util/Objects/SampleModule.mjs | 1 + .../eleventy/src/Util/Objects/Sortable.js | 136 + .../@11ty/eleventy/src/Util/Objects/Unique.js | 3 + .../src/Util/PassthroughCopyBehaviorCheck.js | 16 + .../@11ty/eleventy/src/Util/PathNormalizer.js | 58 + .../@11ty/eleventy/src/Util/PathPrefixer.js | 21 + .../@11ty/eleventy/src/Util/Pluralize.js | 3 + .../eleventy/src/Util/ProjectDirectories.js | 369 + .../src/Util/ProjectTemplateFormats.js | 134 + .../@11ty/eleventy/src/Util/PromiseUtil.js | 15 + .../@11ty/eleventy/src/Util/Require.js | 239 + .../@11ty/eleventy/src/Util/ReservedData.js | 69 + .../@11ty/eleventy/src/Util/SetUnion.js | 11 + .../@11ty/eleventy/src/Util/SpawnAsync.js | 29 + .../eleventy/src/Util/TemplateDepGraph.js | 160 + .../@11ty/eleventy/src/Util/TransformsUtil.js | 70 + .../@11ty/eleventy/src/Util/ValidUrl.js | 9 + .../@11ty/eleventy/src/defaultConfig.js | 178 + node_modules/@11ty/eleventy/tsconfig.json | 117 + node_modules/@11ty/lodash-custom/README.md | 14 + .../@11ty/lodash-custom/lodash.custom.js | 1704 +++ node_modules/@11ty/lodash-custom/package.json | 38 + node_modules/@11ty/posthtml-urls/LICENSE | 21 + node_modules/@11ty/posthtml-urls/README.md | 48 + .../@11ty/posthtml-urls/lib/defaultOptions.js | 37 + node_modules/@11ty/posthtml-urls/lib/index.js | 146 + node_modules/@11ty/posthtml-urls/package.json | 47 + node_modules/@11ty/recursive-copy/README.md | 201 + node_modules/@11ty/recursive-copy/index.d.ts | 117 + node_modules/@11ty/recursive-copy/index.js | 3 + node_modules/@11ty/recursive-copy/lib/copy.js | 436 + .../@11ty/recursive-copy/lib/maximatch.js | 69 + .../@11ty/recursive-copy/package.json | 72 + node_modules/@sindresorhus/slugify/index.d.ts | 246 + node_modules/@sindresorhus/slugify/index.js | 127 + node_modules/@sindresorhus/slugify/license | 9 + .../slugify/overridable-replacements.js | 7 + .../@sindresorhus/slugify/package.json | 59 + node_modules/@sindresorhus/slugify/readme.md | 273 + .../@sindresorhus/transliterate/index.d.ts | 48 + .../@sindresorhus/transliterate/index.js | 33 + .../@sindresorhus/transliterate/license | 9 + .../@sindresorhus/transliterate/package.json | 47 + .../@sindresorhus/transliterate/readme.md | 103 + .../transliterate/replacements.js | 2056 ++++ node_modules/a-sync-waterfall/LICENSE | 21 + node_modules/a-sync-waterfall/README.md | 95 + node_modules/a-sync-waterfall/index.js | 83 + node_modules/a-sync-waterfall/package.json | 21 + node_modules/a-sync-waterfall/test.js | 77 + node_modules/acorn-walk/CHANGELOG.md | 209 + node_modules/acorn-walk/LICENSE | 21 + node_modules/acorn-walk/README.md | 124 + node_modules/acorn-walk/dist/walk.d.mts | 152 + node_modules/acorn-walk/dist/walk.d.ts | 152 + node_modules/acorn-walk/dist/walk.js | 485 + node_modules/acorn-walk/dist/walk.mjs | 467 + node_modules/acorn-walk/package.json | 50 + node_modules/acorn/CHANGELOG.md | 986 ++ node_modules/acorn/LICENSE | 21 + node_modules/acorn/README.md | 304 + node_modules/acorn/bin/acorn | 4 + node_modules/acorn/dist/acorn.d.mts | 889 ++ node_modules/acorn/dist/acorn.d.ts | 889 ++ node_modules/acorn/dist/acorn.js | 6333 +++++++++++ node_modules/acorn/dist/acorn.mjs | 6304 +++++++++++ node_modules/acorn/dist/bin.js | 90 + node_modules/acorn/package.json | 50 + node_modules/anymatch/LICENSE | 15 + node_modules/anymatch/README.md | 87 + node_modules/anymatch/index.d.ts | 20 + node_modules/anymatch/index.js | 104 + .../anymatch/node_modules/picomatch/LICENSE | 21 + .../anymatch/node_modules/picomatch/README.md | 716 ++ .../anymatch/node_modules/picomatch/index.js | 3 + .../node_modules/picomatch/lib/constants.js | 184 + .../node_modules/picomatch/lib/parse.js | 1392 +++ .../node_modules/picomatch/lib/picomatch.js | 342 + .../node_modules/picomatch/lib/scan.js | 391 + .../node_modules/picomatch/lib/utils.js | 64 + .../node_modules/picomatch/package.json | 81 + node_modules/anymatch/package.json | 48 + node_modules/argparse/CHANGELOG.md | 216 + node_modules/argparse/LICENSE | 254 + node_modules/argparse/README.md | 84 + node_modules/argparse/argparse.js | 3707 +++++++ node_modules/argparse/lib/sub.js | 67 + node_modules/argparse/lib/textwrap.js | 440 + node_modules/argparse/package.json | 31 + node_modules/asap/CHANGES.md | 70 + node_modules/asap/LICENSE.md | 21 + node_modules/asap/README.md | 237 + node_modules/asap/asap.js | 65 + node_modules/asap/browser-asap.js | 66 + node_modules/asap/browser-raw.js | 223 + node_modules/asap/package.json | 58 + node_modules/asap/raw.js | 101 + .../balanced-match/.github/FUNDING.yml | 2 + node_modules/balanced-match/LICENSE.md | 21 + node_modules/balanced-match/README.md | 97 + node_modules/balanced-match/index.js | 62 + node_modules/balanced-match/package.json | 48 + node_modules/bcp-47-match/index.d.ts | 47 + node_modules/bcp-47-match/index.js | 234 + node_modules/bcp-47-match/license | 22 + node_modules/bcp-47-match/package.json | 88 + node_modules/bcp-47-match/readme.md | 315 + node_modules/bcp-47-normalize/index.d.ts | 3 + node_modules/bcp-47-normalize/index.js | 6 + node_modules/bcp-47-normalize/lib/fields.d.ts | 24 + node_modules/bcp-47-normalize/lib/fields.js | 3217 ++++++ node_modules/bcp-47-normalize/lib/index.d.ts | 36 + node_modules/bcp-47-normalize/lib/index.js | 335 + node_modules/bcp-47-normalize/lib/likely.d.ts | 4 + node_modules/bcp-47-normalize/lib/likely.js | 8039 ++++++++++++++ node_modules/bcp-47-normalize/lib/many.d.ts | 10 + node_modules/bcp-47-normalize/lib/many.js | 95 + .../bcp-47-normalize/lib/matches.d.ts | 13 + node_modules/bcp-47-normalize/lib/matches.js | 1859 ++++ node_modules/bcp-47-normalize/license | 22 + node_modules/bcp-47-normalize/package.json | 91 + node_modules/bcp-47-normalize/readme.md | 207 + node_modules/bcp-47/index.d.ts | 7 + node_modules/bcp-47/index.d.ts.map | 1 + node_modules/bcp-47/index.js | 9 + node_modules/bcp-47/lib/normal.d.ts | 3 + node_modules/bcp-47/lib/normal.d.ts.map | 1 + node_modules/bcp-47/lib/normal.js | 29 + node_modules/bcp-47/lib/parse.d.ts | 142 + node_modules/bcp-47/lib/parse.d.ts.map | 1 + node_modules/bcp-47/lib/parse.js | 396 + node_modules/bcp-47/lib/regular.d.ts | 3 + node_modules/bcp-47/lib/regular.d.ts.map | 1 + node_modules/bcp-47/lib/regular.js | 12 + node_modules/bcp-47/lib/stringify.d.ts | 14 + node_modules/bcp-47/lib/stringify.d.ts.map | 1 + node_modules/bcp-47/lib/stringify.js | 53 + node_modules/bcp-47/license | 22 + node_modules/bcp-47/package.json | 76 + node_modules/bcp-47/readme.md | 345 + .../binary-extensions/binary-extensions.json | 263 + .../binary-extensions.json.d.ts | 3 + node_modules/binary-extensions/index.d.ts | 14 + node_modules/binary-extensions/index.js | 1 + node_modules/binary-extensions/license | 10 + node_modules/binary-extensions/package.json | 40 + node_modules/binary-extensions/readme.md | 25 + .../8b906b8c-e21f-40b5-8c0d-214d8c2682c5.json | 757 ++ .../8b906b8c-e21f-40b5-8c0d-214d8c2682c5.json | 719 ++ .../ADVISORY-CVE-2026-14257.md | 107 + node_modules/brace-expansion/LICENSE | 21 + node_modules/brace-expansion/README.md | 129 + .../brace-expansion/dist/commonjs/index.d.ts | 8 + .../dist/commonjs/index.d.ts.map | 1 + .../brace-expansion/dist/commonjs/index.js | 263 + .../dist/commonjs/index.js.map | 1 + .../dist/commonjs/package.json | 3 + .../brace-expansion/dist/esm/index.d.ts | 8 + .../brace-expansion/dist/esm/index.d.ts.map | 1 + .../brace-expansion/dist/esm/index.js | 259 + .../brace-expansion/dist/esm/index.js.map | 1 + .../brace-expansion/dist/esm/package.json | 3 + node_modules/brace-expansion/index.js | 209 + node_modules/brace-expansion/package.json | 50 + node_modules/braces/LICENSE | 21 + node_modules/braces/README.md | 586 ++ node_modules/braces/index.js | 170 + node_modules/braces/lib/compile.js | 60 + node_modules/braces/lib/constants.js | 57 + node_modules/braces/lib/expand.js | 113 + node_modules/braces/lib/parse.js | 331 + node_modules/braces/lib/stringify.js | 32 + node_modules/braces/lib/utils.js | 122 + node_modules/braces/package.json | 77 + node_modules/chokidar/LICENSE | 21 + node_modules/chokidar/README.md | 308 + node_modules/chokidar/index.js | 973 ++ node_modules/chokidar/lib/constants.js | 66 + node_modules/chokidar/lib/fsevents-handler.js | 526 + node_modules/chokidar/lib/nodefs-handler.js | 654 ++ node_modules/chokidar/package.json | 70 + node_modules/chokidar/types/index.d.ts | 192 + node_modules/commander/LICENSE | 22 + node_modules/commander/Readme.md | 1134 ++ node_modules/commander/esm.mjs | 16 + node_modules/commander/index.js | 27 + node_modules/commander/lib/argument.js | 147 + node_modules/commander/lib/command.js | 2179 ++++ node_modules/commander/lib/error.js | 45 + node_modules/commander/lib/help.js | 464 + node_modules/commander/lib/option.js | 331 + node_modules/commander/lib/suggestSimilar.js | 100 + node_modules/commander/package-support.json | 16 + node_modules/commander/package.json | 80 + node_modules/commander/typings/index.d.ts | 889 ++ node_modules/concat-map/.travis.yml | 4 + node_modules/concat-map/LICENSE | 18 + node_modules/concat-map/README.markdown | 62 + node_modules/concat-map/example/map.js | 6 + node_modules/concat-map/index.js | 13 + node_modules/concat-map/package.json | 43 + node_modules/concat-map/test/map.js | 39 + node_modules/debug/LICENSE | 20 + node_modules/debug/README.md | 481 + node_modules/debug/package.json | 64 + node_modules/debug/src/browser.js | 272 + node_modules/debug/src/common.js | 292 + node_modules/debug/src/index.js | 10 + node_modules/debug/src/node.js | 263 + node_modules/depd/History.md | 103 + node_modules/depd/LICENSE | 22 + node_modules/depd/Readme.md | 280 + node_modules/depd/index.js | 538 + node_modules/depd/lib/browser/index.js | 77 + node_modules/depd/package.json | 45 + .../.github/workflows/node.js.yml | 24 + node_modules/dependency-graph/CHANGELOG.md | 88 + node_modules/dependency-graph/LICENSE | 19 + node_modules/dependency-graph/README.md | 78 + .../dependency-graph/lib/dep_graph.js | 364 + node_modules/dependency-graph/lib/index.d.ts | 127 + node_modules/dependency-graph/package.json | 31 + .../dependency-graph/specs/dep_graph_spec.js | 567 + node_modules/dom-serializer/LICENSE | 11 + node_modules/dom-serializer/README.md | 97 + .../dom-serializer/lib/esm/foreignNames.d.ts | 3 + .../lib/esm/foreignNames.d.ts.map | 1 + .../dom-serializer/lib/esm/foreignNames.js | 100 + .../dom-serializer/lib/esm/index.d.ts | 52 + .../dom-serializer/lib/esm/index.d.ts.map | 1 + node_modules/dom-serializer/lib/esm/index.js | 190 + .../dom-serializer/lib/esm/package.json | 1 + .../dom-serializer/lib/foreignNames.d.ts | 3 + .../dom-serializer/lib/foreignNames.d.ts.map | 1 + .../dom-serializer/lib/foreignNames.js | 103 + node_modules/dom-serializer/lib/index.d.ts | 43 + .../dom-serializer/lib/index.d.ts.map | 1 + node_modules/dom-serializer/lib/index.js | 211 + .../node_modules/entities/LICENSE | 11 + .../node_modules/entities/lib/decode.d.ts | 5 + .../node_modules/entities/lib/decode.d.ts.map | 1 + .../node_modules/entities/lib/decode.js | 53 + .../entities/lib/decode_codepoint.d.ts | 2 + .../entities/lib/decode_codepoint.d.ts.map | 1 + .../entities/lib/decode_codepoint.js | 30 + .../node_modules/entities/lib/encode.d.ts | 47 + .../node_modules/entities/lib/encode.d.ts.map | 1 + .../node_modules/entities/lib/encode.js | 136 + .../node_modules/entities/lib/index.d.ts | 27 + .../node_modules/entities/lib/index.d.ts.map | 1 + .../node_modules/entities/lib/index.js | 57 + .../entities/lib/maps/decode.json | 1 + .../entities/lib/maps/entities.json | 1 + .../entities/lib/maps/legacy.json | 1 + .../node_modules/entities/lib/maps/xml.json | 1 + .../node_modules/entities/package.json | 64 + .../node_modules/entities/readme.md | 57 + node_modules/dom-serializer/package.json | 55 + node_modules/domelementtype/LICENSE | 11 + .../domelementtype/lib/esm/index.d.ts | 48 + .../domelementtype/lib/esm/index.d.ts.map | 1 + node_modules/domelementtype/lib/esm/index.js | 51 + .../domelementtype/lib/esm/package.json | 1 + node_modules/domelementtype/lib/index.d.ts | 48 + .../domelementtype/lib/index.d.ts.map | 1 + node_modules/domelementtype/lib/index.js | 55 + node_modules/domelementtype/package.json | 54 + node_modules/domelementtype/readme.md | 1 + node_modules/domhandler/LICENSE | 11 + node_modules/domhandler/lib/index.d.ts | 85 + node_modules/domhandler/lib/index.d.ts.map | 1 + node_modules/domhandler/lib/index.js | 176 + node_modules/domhandler/lib/node.d.ts | 237 + node_modules/domhandler/lib/node.d.ts.map | 1 + node_modules/domhandler/lib/node.js | 444 + node_modules/domhandler/package.json | 58 + node_modules/domhandler/readme.md | 163 + node_modules/domutils/LICENSE | 11 + node_modules/domutils/lib/feeds.d.ts | 45 + node_modules/domutils/lib/feeds.d.ts.map | 1 + node_modules/domutils/lib/feeds.js | 190 + node_modules/domutils/lib/helpers.d.ts | 51 + node_modules/domutils/lib/helpers.d.ts.map | 1 + node_modules/domutils/lib/helpers.js | 125 + node_modules/domutils/lib/index.d.ts | 10 + node_modules/domutils/lib/index.d.ts.map | 1 + node_modules/domutils/lib/index.js | 28 + node_modules/domutils/lib/legacy.d.ts | 47 + node_modules/domutils/lib/legacy.d.ts.map | 1 + node_modules/domutils/lib/legacy.js | 124 + node_modules/domutils/lib/manipulation.d.ts | 43 + .../domutils/lib/manipulation.d.ts.map | 1 + node_modules/domutils/lib/manipulation.js | 129 + node_modules/domutils/lib/querying.d.ts | 55 + node_modules/domutils/lib/querying.d.ts.map | 1 + node_modules/domutils/lib/querying.js | 126 + node_modules/domutils/lib/stringify.d.ts | 41 + node_modules/domutils/lib/stringify.d.ts.map | 1 + node_modules/domutils/lib/stringify.js | 86 + node_modules/domutils/lib/traversal.d.ts | 59 + node_modules/domutils/lib/traversal.d.ts.map | 1 + node_modules/domutils/lib/traversal.js | 117 + node_modules/domutils/package.json | 65 + node_modules/domutils/readme.md | 31 + node_modules/ee-first/LICENSE | 22 + node_modules/ee-first/README.md | 80 + node_modules/ee-first/index.js | 95 + node_modules/ee-first/package.json | 29 + node_modules/encodeurl/LICENSE | 22 + node_modules/encodeurl/README.md | 109 + node_modules/encodeurl/index.js | 60 + node_modules/encodeurl/package.json | 40 + node_modules/entities/LICENSE | 11 + node_modules/entities/decode.d.ts | 1 + node_modules/entities/decode.js | 3 + .../dist/commonjs/decode-codepoint.d.ts | 19 + .../dist/commonjs/decode-codepoint.d.ts.map | 1 + .../dist/commonjs/decode-codepoint.js | 77 + .../dist/commonjs/decode-codepoint.js.map | 1 + .../entities/dist/commonjs/decode.d.ts | 209 + .../entities/dist/commonjs/decode.d.ts.map | 1 + node_modules/entities/dist/commonjs/decode.js | 511 + .../entities/dist/commonjs/decode.js.map | 1 + .../entities/dist/commonjs/encode.d.ts | 22 + .../entities/dist/commonjs/encode.d.ts.map | 1 + node_modules/entities/dist/commonjs/encode.js | 73 + .../entities/dist/commonjs/encode.js.map | 1 + .../entities/dist/commonjs/escape.d.ts | 43 + .../entities/dist/commonjs/escape.d.ts.map | 1 + node_modules/entities/dist/commonjs/escape.js | 121 + .../entities/dist/commonjs/escape.js.map | 1 + .../commonjs/generated/decode-data-html.d.ts | 2 + .../generated/decode-data-html.d.ts.map | 1 + .../commonjs/generated/decode-data-html.js | 10 + .../generated/decode-data-html.js.map | 1 + .../commonjs/generated/decode-data-xml.d.ts | 2 + .../generated/decode-data-xml.d.ts.map | 1 + .../commonjs/generated/decode-data-xml.js | 10 + .../commonjs/generated/decode-data-xml.js.map | 1 + .../dist/commonjs/generated/encode-html.d.ts | 8 + .../commonjs/generated/encode-html.d.ts.map | 1 + .../dist/commonjs/generated/encode-html.js | 13 + .../commonjs/generated/encode-html.js.map | 1 + .../entities/dist/commonjs/index.d.ts | 96 + .../entities/dist/commonjs/index.d.ts.map | 1 + node_modules/entities/dist/commonjs/index.js | 131 + .../entities/dist/commonjs/index.js.map | 1 + .../entities/dist/commonjs/package.json | 3 + .../entities/dist/esm/decode-codepoint.d.ts | 19 + .../dist/esm/decode-codepoint.d.ts.map | 1 + .../entities/dist/esm/decode-codepoint.js | 72 + .../entities/dist/esm/decode-codepoint.js.map | 1 + node_modules/entities/dist/esm/decode.d.ts | 209 + .../entities/dist/esm/decode.d.ts.map | 1 + node_modules/entities/dist/esm/decode.js | 497 + node_modules/entities/dist/esm/decode.js.map | 1 + node_modules/entities/dist/esm/encode.d.ts | 22 + .../entities/dist/esm/encode.d.ts.map | 1 + node_modules/entities/dist/esm/encode.js | 69 + node_modules/entities/dist/esm/encode.js.map | 1 + node_modules/entities/dist/esm/escape.d.ts | 43 + .../entities/dist/esm/escape.d.ts.map | 1 + node_modules/entities/dist/esm/escape.js | 117 + node_modules/entities/dist/esm/escape.js.map | 1 + .../dist/esm/generated/decode-data-html.d.ts | 2 + .../esm/generated/decode-data-html.d.ts.map | 1 + .../dist/esm/generated/decode-data-html.js | 7 + .../esm/generated/decode-data-html.js.map | 1 + .../dist/esm/generated/decode-data-xml.d.ts | 2 + .../esm/generated/decode-data-xml.d.ts.map | 1 + .../dist/esm/generated/decode-data-xml.js | 7 + .../dist/esm/generated/decode-data-xml.js.map | 1 + .../dist/esm/generated/encode-html.d.ts | 8 + .../dist/esm/generated/encode-html.d.ts.map | 1 + .../dist/esm/generated/encode-html.js | 10 + .../dist/esm/generated/encode-html.js.map | 1 + node_modules/entities/dist/esm/index.d.ts | 96 + node_modules/entities/dist/esm/index.d.ts.map | 1 + node_modules/entities/dist/esm/index.js | 107 + node_modules/entities/dist/esm/index.js.map | 1 + node_modules/entities/dist/esm/package.json | 3 + node_modules/entities/escape.d.ts | 1 + node_modules/entities/escape.js | 3 + node_modules/entities/package.json | 118 + node_modules/entities/readme.md | 122 + node_modules/entities/src/decode-codepoint.ts | 81 + node_modules/entities/src/decode.spec.ts | 320 + node_modules/entities/src/decode.ts | 620 ++ node_modules/entities/src/encode.spec.ts | 78 + node_modules/entities/src/encode.ts | 77 + node_modules/entities/src/escape.spec.ts | 14 + node_modules/entities/src/escape.ts | 148 + .../entities/src/generated/.eslintrc.json | 10 + .../src/generated/decode-data-html.ts | 8 + .../entities/src/generated/decode-data-xml.ts | 8 + .../entities/src/generated/encode-html.ts | 17 + node_modules/entities/src/index.spec.ts | 125 + node_modules/entities/src/index.ts | 188 + node_modules/errno/.jshintrc | 59 + node_modules/errno/.travis.yml | 12 + node_modules/errno/README.md | 145 + node_modules/errno/build.js | 43 + node_modules/errno/cli.js | 22 + node_modules/errno/custom.js | 57 + node_modules/errno/errno.js | 313 + node_modules/errno/package.json | 33 + node_modules/errno/test.js | 88 + node_modules/escape-html/LICENSE | 24 + node_modules/escape-html/Readme.md | 43 + node_modules/escape-html/index.js | 78 + node_modules/escape-html/package.json | 24 + node_modules/escape-string-regexp/index.d.ts | 16 + node_modules/escape-string-regexp/index.js | 11 + node_modules/escape-string-regexp/license | 9 + .../escape-string-regexp/package.json | 40 + node_modules/escape-string-regexp/readme.md | 34 + node_modules/esm-import-transformer/README.md | 91 + .../import-transformer.js | 232 + .../esm-import-transformer/package.json | 26 + node_modules/esprima/ChangeLog | 235 + node_modules/esprima/LICENSE.BSD | 21 + node_modules/esprima/README.md | 46 + node_modules/esprima/bin/esparse.js | 139 + node_modules/esprima/bin/esvalidate.js | 236 + node_modules/esprima/dist/esprima.js | 6709 ++++++++++++ node_modules/esprima/package.json | 112 + node_modules/etag/HISTORY.md | 83 + node_modules/etag/LICENSE | 22 + node_modules/etag/README.md | 159 + node_modules/etag/index.js | 131 + node_modules/etag/package.json | 47 + node_modules/evaluate-value/LICENSE | 21 + node_modules/evaluate-value/README.md | 41 + node_modules/evaluate-value/index-es5.js | 17 + node_modules/evaluate-value/index-es5.js.map | 1 + node_modules/evaluate-value/index.js | 17 + node_modules/evaluate-value/package.json | 33 + node_modules/extend-shallow/LICENSE | 21 + node_modules/extend-shallow/README.md | 61 + node_modules/extend-shallow/index.js | 33 + node_modules/extend-shallow/package.json | 56 + node_modules/fdir/LICENSE | 7 + node_modules/fdir/README.md | 91 + node_modules/fdir/dist/index.cjs | 588 ++ node_modules/fdir/dist/index.d.cts | 155 + node_modules/fdir/dist/index.d.mts | 155 + node_modules/fdir/dist/index.mjs | 570 + node_modules/fdir/package.json | 103 + node_modules/filesize/LICENSE | 28 + node_modules/filesize/README.md | 113 + node_modules/filesize/dist/filesize.cjs | 238 + node_modules/filesize/dist/filesize.esm.js | 231 + node_modules/filesize/package.json | 60 + node_modules/filesize/types/filesize.d.ts | 56 + node_modules/fill-range/LICENSE | 21 + node_modules/fill-range/README.md | 237 + node_modules/fill-range/index.js | 248 + node_modules/fill-range/package.json | 74 + node_modules/finalhandler/HISTORY.md | 216 + node_modules/finalhandler/LICENSE | 22 + node_modules/finalhandler/README.md | 147 + node_modules/finalhandler/SECURITY.md | 25 + node_modules/finalhandler/index.js | 341 + .../node_modules/debug/.coveralls.yml | 1 + .../finalhandler/node_modules/debug/.eslintrc | 11 + .../node_modules/debug/.npmignore | 9 + .../node_modules/debug/.travis.yml | 14 + .../node_modules/debug/CHANGELOG.md | 362 + .../finalhandler/node_modules/debug/LICENSE | 19 + .../finalhandler/node_modules/debug/Makefile | 50 + .../finalhandler/node_modules/debug/README.md | 312 + .../node_modules/debug/component.json | 19 + .../node_modules/debug/karma.conf.js | 70 + .../finalhandler/node_modules/debug/node.js | 1 + .../node_modules/debug/package.json | 49 + .../node_modules/debug/src/browser.js | 185 + .../node_modules/debug/src/debug.js | 202 + .../node_modules/debug/src/index.js | 10 + .../node_modules/debug/src/inspector-log.js | 15 + .../node_modules/debug/src/node.js | 248 + .../finalhandler/node_modules/ms/index.js | 152 + .../finalhandler/node_modules/ms/license.md | 21 + .../finalhandler/node_modules/ms/package.json | 37 + .../finalhandler/node_modules/ms/readme.md | 51 + node_modules/finalhandler/package.json | 47 + node_modules/fresh/HISTORY.md | 80 + node_modules/fresh/LICENSE | 23 + node_modules/fresh/README.md | 117 + node_modules/fresh/index.js | 136 + node_modules/fresh/package.json | 46 + node_modules/glob-parent/CHANGELOG.md | 110 + node_modules/glob-parent/LICENSE | 15 + node_modules/glob-parent/README.md | 137 + node_modules/glob-parent/index.js | 42 + node_modules/glob-parent/package.json | 48 + node_modules/gray-matter/CHANGELOG.md | 24 + node_modules/gray-matter/LICENSE | 21 + node_modules/gray-matter/README.md | 565 + node_modules/gray-matter/gray-matter.d.ts | 114 + node_modules/gray-matter/index.js | 228 + node_modules/gray-matter/lib/defaults.js | 18 + node_modules/gray-matter/lib/engine.js | 30 + node_modules/gray-matter/lib/engines.js | 54 + node_modules/gray-matter/lib/excerpt.js | 32 + node_modules/gray-matter/lib/parse.js | 13 + node_modules/gray-matter/lib/stringify.js | 56 + node_modules/gray-matter/lib/to-file.js | 43 + node_modules/gray-matter/lib/utils.js | 66 + .../gray-matter/node_modules/.bin/js-yaml | 16 + .../gray-matter/node_modules/.bin/js-yaml.cmd | 17 + .../gray-matter/node_modules/.bin/js-yaml.ps1 | 28 + .../node_modules/argparse/CHANGELOG.md | 185 + .../gray-matter/node_modules/argparse/LICENSE | 21 + .../node_modules/argparse/README.md | 257 + .../node_modules/argparse/index.js | 3 + .../node_modules/argparse/lib/action.js | 146 + .../argparse/lib/action/append.js | 53 + .../argparse/lib/action/append/constant.js | 47 + .../node_modules/argparse/lib/action/count.js | 40 + .../node_modules/argparse/lib/action/help.js | 47 + .../node_modules/argparse/lib/action/store.js | 50 + .../argparse/lib/action/store/constant.js | 43 + .../argparse/lib/action/store/false.js | 27 + .../argparse/lib/action/store/true.js | 26 + .../argparse/lib/action/subparsers.js | 149 + .../argparse/lib/action/version.js | 47 + .../argparse/lib/action_container.js | 482 + .../node_modules/argparse/lib/argparse.js | 14 + .../argparse/lib/argument/error.js | 50 + .../argparse/lib/argument/exclusive.js | 54 + .../argparse/lib/argument/group.js | 75 + .../argparse/lib/argument_parser.js | 1161 ++ .../node_modules/argparse/lib/const.js | 21 + .../argparse/lib/help/added_formatters.js | 87 + .../argparse/lib/help/formatter.js | 795 ++ .../node_modules/argparse/lib/namespace.js | 76 + .../node_modules/argparse/lib/utils.js | 57 + .../node_modules/argparse/package.json | 34 + .../gray-matter/node_modules/js-yaml/LICENSE | 21 + .../node_modules/js-yaml/README.md | 302 + .../node_modules/js-yaml/bin/js-yaml.js | 132 + .../node_modules/js-yaml/dist/js-yaml.js | 4011 +++++++ .../node_modules/js-yaml/dist/js-yaml.min.js | 1 + .../gray-matter/node_modules/js-yaml/index.js | 7 + .../node_modules/js-yaml/lib/js-yaml.js | 39 + .../js-yaml/lib/js-yaml/common.js | 59 + .../js-yaml/lib/js-yaml/dumper.js | 850 ++ .../js-yaml/lib/js-yaml/exception.js | 43 + .../js-yaml/lib/js-yaml/loader.js | 1666 +++ .../node_modules/js-yaml/lib/js-yaml/mark.js | 76 + .../js-yaml/lib/js-yaml/schema.js | 108 + .../js-yaml/lib/js-yaml/schema/core.js | 18 + .../lib/js-yaml/schema/default_full.js | 25 + .../lib/js-yaml/schema/default_safe.js | 28 + .../js-yaml/lib/js-yaml/schema/failsafe.js | 17 + .../js-yaml/lib/js-yaml/schema/json.js | 25 + .../node_modules/js-yaml/lib/js-yaml/type.js | 61 + .../js-yaml/lib/js-yaml/type/binary.js | 138 + .../js-yaml/lib/js-yaml/type/bool.js | 35 + .../js-yaml/lib/js-yaml/type/float.js | 116 + .../js-yaml/lib/js-yaml/type/int.js | 173 + .../js-yaml/lib/js-yaml/type/js/function.js | 93 + .../js-yaml/lib/js-yaml/type/js/regexp.js | 60 + .../js-yaml/lib/js-yaml/type/js/undefined.js | 28 + .../js-yaml/lib/js-yaml/type/map.js | 8 + .../js-yaml/lib/js-yaml/type/merge.js | 12 + .../js-yaml/lib/js-yaml/type/null.js | 34 + .../js-yaml/lib/js-yaml/type/omap.js | 44 + .../js-yaml/lib/js-yaml/type/pairs.js | 53 + .../js-yaml/lib/js-yaml/type/seq.js | 8 + .../js-yaml/lib/js-yaml/type/set.js | 29 + .../js-yaml/lib/js-yaml/type/str.js | 8 + .../js-yaml/lib/js-yaml/type/timestamp.js | 88 + .../node_modules/js-yaml/package.json | 52 + node_modules/gray-matter/package.json | 127 + node_modules/htmlparser2/LICENSE | 18 + node_modules/htmlparser2/README.md | 166 + node_modules/htmlparser2/lib/FeedHandler.d.ts | 23 + .../htmlparser2/lib/FeedHandler.d.ts.map | 1 + node_modules/htmlparser2/lib/FeedHandler.js | 68 + node_modules/htmlparser2/lib/Parser.d.ts | 180 + node_modules/htmlparser2/lib/Parser.d.ts.map | 1 + node_modules/htmlparser2/lib/Parser.js | 424 + node_modules/htmlparser2/lib/Tokenizer.d.ts | 173 + .../htmlparser2/lib/Tokenizer.d.ts.map | 1 + node_modules/htmlparser2/lib/Tokenizer.js | 821 ++ .../htmlparser2/lib/WritableStream.d.ts | 16 + .../htmlparser2/lib/WritableStream.d.ts.map | 1 + .../htmlparser2/lib/WritableStream.js | 53 + node_modules/htmlparser2/lib/index.d.ts | 39 + node_modules/htmlparser2/lib/index.d.ts.map | 1 + node_modules/htmlparser2/lib/index.js | 84 + .../htmlparser2/node_modules/entities/LICENSE | 11 + .../node_modules/entities/lib/decode.d.ts | 15 + .../node_modules/entities/lib/decode.d.ts.map | 1 + .../node_modules/entities/lib/decode.js | 145 + .../entities/lib/decode_codepoint.d.ts | 2 + .../entities/lib/decode_codepoint.d.ts.map | 1 + .../entities/lib/decode_codepoint.js | 54 + .../entities/lib/encode-trie.d.ts | 8 + .../entities/lib/encode-trie.d.ts.map | 1 + .../node_modules/entities/lib/encode-trie.js | 77 + .../node_modules/entities/lib/encode.d.ts | 46 + .../node_modules/entities/lib/encode.d.ts.map | 1 + .../node_modules/entities/lib/encode.js | 126 + .../lib/generated/decode-data-html.d.ts | 3 + .../lib/generated/decode-data-html.d.ts.map | 1 + .../lib/generated/decode-data-html.js | 5 + .../lib/generated/decode-data-xml.d.ts | 3 + .../lib/generated/decode-data-xml.d.ts.map | 1 + .../entities/lib/generated/decode-data-xml.js | 5 + .../node_modules/entities/lib/index.d.ts | 91 + .../node_modules/entities/lib/index.d.ts.map | 1 + .../node_modules/entities/lib/index.js | 118 + .../entities/lib/maps/entities.json | 1 + .../entities/lib/maps/legacy.json | 1 + .../node_modules/entities/lib/maps/xml.json | 1 + .../node_modules/entities/package.json | 67 + .../node_modules/entities/readme.md | 74 + node_modules/htmlparser2/package.json | 75 + node_modules/http-equiv-refresh/README.md | 31 + node_modules/http-equiv-refresh/index-es5.js | 30 + .../http-equiv-refresh/index-es5.js.map | 1 + node_modules/http-equiv-refresh/index.js | 24 + node_modules/http-equiv-refresh/license | 21 + node_modules/http-equiv-refresh/package.json | 42 + node_modules/http-errors/HISTORY.md | 186 + node_modules/http-errors/LICENSE | 23 + node_modules/http-errors/README.md | 169 + node_modules/http-errors/index.js | 290 + node_modules/http-errors/package.json | 54 + node_modules/inherits/LICENSE | 16 + node_modules/inherits/README.md | 42 + node_modules/inherits/inherits.js | 9 + node_modules/inherits/inherits_browser.js | 27 + node_modules/inherits/package.json | 29 + node_modules/is-alphabetical/index.d.ts | 8 + node_modules/is-alphabetical/index.js | 16 + node_modules/is-alphabetical/license | 22 + node_modules/is-alphabetical/package.json | 73 + node_modules/is-alphabetical/readme.md | 141 + node_modules/is-alphanumerical/index.d.ts | 8 + node_modules/is-alphanumerical/index.js | 13 + node_modules/is-alphanumerical/license | 22 + node_modules/is-alphanumerical/package.json | 79 + node_modules/is-alphanumerical/readme.md | 142 + node_modules/is-binary-path/index.d.ts | 17 + node_modules/is-binary-path/index.js | 7 + node_modules/is-binary-path/license | 9 + node_modules/is-binary-path/package.json | 40 + node_modules/is-binary-path/readme.md | 34 + node_modules/is-decimal/index.d.ts | 8 + node_modules/is-decimal/index.js | 13 + node_modules/is-decimal/license | 22 + node_modules/is-decimal/package.json | 73 + node_modules/is-decimal/readme.md | 139 + node_modules/is-extendable/LICENSE | 21 + node_modules/is-extendable/README.md | 72 + node_modules/is-extendable/index.js | 13 + node_modules/is-extendable/package.json | 51 + node_modules/is-extglob/LICENSE | 21 + node_modules/is-extglob/README.md | 107 + node_modules/is-extglob/index.js | 20 + node_modules/is-extglob/package.json | 69 + node_modules/is-glob/LICENSE | 21 + node_modules/is-glob/README.md | 206 + node_modules/is-glob/index.js | 150 + node_modules/is-glob/package.json | 81 + node_modules/is-json/.npmignore | 12 + node_modules/is-json/.travis.yml | 14 + node_modules/is-json/LICENSE | 15 + node_modules/is-json/README.md | 41 + node_modules/is-json/index.js | 48 + node_modules/is-json/package.json | 29 + node_modules/is-json/test/index.js | 33 + node_modules/is-number/LICENSE | 21 + node_modules/is-number/README.md | 187 + node_modules/is-number/index.js | 18 + node_modules/is-number/package.json | 82 + node_modules/iso-639-1/.eslintrc | 38 + node_modules/iso-639-1/.nvmrc | 1 + node_modules/iso-639-1/.prettierrc | 4 + node_modules/iso-639-1/.travis.yml | 6 + node_modules/iso-639-1/.vscode/settings.json | 5 + node_modules/iso-639-1/CHANGELOG.md | 79 + node_modules/iso-639-1/LICENSE | 21 + node_modules/iso-639-1/build/index.js | 1 + node_modules/iso-639-1/index.d.ts | 205 + node_modules/iso-639-1/package.json | 41 + node_modules/iso-639-1/readme.md | 121 + node_modules/iso-639-1/src/data.js | 736 ++ node_modules/iso-639-1/src/index.js | 59 + node_modules/iso-639-1/test/test.js | 193 + node_modules/iso-639-1/webpack.config.js | 20 + node_modules/js-yaml/LICENSE | 21 + node_modules/js-yaml/README.md | 233 + node_modules/js-yaml/bin/js-yaml.js | 117 + node_modules/js-yaml/dist/js-yaml.js | 3011 ++++++ node_modules/js-yaml/dist/js-yaml.js.map | 1 + node_modules/js-yaml/dist/js-yaml.min.js | 2 + node_modules/js-yaml/dist/js-yaml.min.js.map | 1 + node_modules/js-yaml/dist/js-yaml.mjs | 3074 ++++++ node_modules/js-yaml/dist/js-yaml.mjs.map | 1 + node_modules/js-yaml/index.js | 44 + node_modules/js-yaml/lib/common.js | 50 + node_modules/js-yaml/lib/dumper.js | 937 ++ node_modules/js-yaml/lib/exception.js | 51 + .../js-yaml/lib/index_vite_proxy.tmp.mjs | 37 + node_modules/js-yaml/lib/loader.js | 1790 ++++ node_modules/js-yaml/lib/schema.js | 109 + node_modules/js-yaml/lib/schema/core.js | 9 + node_modules/js-yaml/lib/schema/default.js | 20 + node_modules/js-yaml/lib/schema/failsafe.js | 14 + node_modules/js-yaml/lib/schema/json.js | 17 + node_modules/js-yaml/lib/snippet.js | 96 + node_modules/js-yaml/lib/type.js | 66 + node_modules/js-yaml/lib/type/binary.js | 122 + node_modules/js-yaml/lib/type/bool.js | 35 + node_modules/js-yaml/lib/type/float.js | 99 + node_modules/js-yaml/lib/type/int.js | 142 + node_modules/js-yaml/lib/type/map.js | 8 + node_modules/js-yaml/lib/type/merge.js | 12 + node_modules/js-yaml/lib/type/null.js | 35 + node_modules/js-yaml/lib/type/omap.js | 45 + node_modules/js-yaml/lib/type/pairs.js | 50 + node_modules/js-yaml/lib/type/seq.js | 8 + node_modules/js-yaml/lib/type/set.js | 29 + node_modules/js-yaml/lib/type/str.js | 8 + node_modules/js-yaml/lib/type/timestamp.js | 88 + node_modules/js-yaml/package.json | 83 + node_modules/junk/index.d.ts | 40 + node_modules/junk/index.js | 39 + node_modules/junk/license | 9 + node_modules/junk/package.json | 42 + node_modules/junk/readme.md | 51 + node_modules/kind-of/CHANGELOG.md | 160 + node_modules/kind-of/LICENSE | 21 + node_modules/kind-of/README.md | 367 + node_modules/kind-of/index.js | 129 + node_modules/kind-of/package.json | 88 + node_modules/kleur/colors.d.ts | 38 + node_modules/kleur/colors.js | 53 + node_modules/kleur/colors.mjs | 53 + node_modules/kleur/index.d.ts | 45 + node_modules/kleur/index.js | 110 + node_modules/kleur/index.mjs | 110 + node_modules/kleur/license | 21 + node_modules/kleur/package.json | 51 + node_modules/kleur/readme.md | 232 + node_modules/linkify-it/LICENSE | 22 + node_modules/linkify-it/README.md | 195 + node_modules/linkify-it/build/index.cjs.js | 840 ++ node_modules/linkify-it/index.mjs | 646 ++ node_modules/linkify-it/lib/re.mjs | 193 + node_modules/linkify-it/package.json | 63 + node_modules/liquidjs/LICENSE | 21 + node_modules/liquidjs/README.md | 262 + node_modules/liquidjs/bin/liquid.js | 139 + .../dist/build/base64-impl-browser.d.ts | 2 + .../dist/build/base64-impl-browser.spec.d.ts | 1 + .../dist/build/crypto-impl-browser.d.ts | 2 + .../dist/build/crypto-impl-browser.spec.d.ts | 1 + .../liquidjs/dist/build/fs-impl-browser.d.ts | 7 + .../dist/build/fs-impl-browser.spec.d.ts | 1 + .../dist/build/streamed-emitter-browser.d.ts | 10 + .../build/streamed-emitter-browser.spec.d.ts | 1 + node_modules/liquidjs/dist/cache/cache.d.ts | 7 + node_modules/liquidjs/dist/cache/index.d.ts | 2 + node_modules/liquidjs/dist/cache/lru.d.ts | 14 + .../liquidjs/dist/cache/lru.spec.d.ts | 1 + .../liquidjs/dist/context/block-mode.d.ts | 4 + .../liquidjs/dist/context/context.d.ts | 64 + .../liquidjs/dist/context/context.spec.d.ts | 1 + node_modules/liquidjs/dist/context/index.d.ts | 3 + node_modules/liquidjs/dist/context/scope.d.ts | 6 + .../liquidjs/dist/drop/blank-drop.d.ts | 5 + .../liquidjs/dist/drop/block-drop.d.ts | 11 + .../liquidjs/dist/drop/comparable.d.ts | 8 + node_modules/liquidjs/dist/drop/drop.d.ts | 5 + .../liquidjs/dist/drop/empty-drop.d.ts | 11 + .../liquidjs/dist/drop/forloop-drop.d.ts | 15 + node_modules/liquidjs/dist/drop/index.d.ts | 7 + .../liquidjs/dist/drop/null-drop.d.ts | 10 + .../liquidjs/dist/drop/tablerowloop-drop.d.ts | 10 + .../liquidjs/dist/emitters/emitter.d.ts | 11 + .../liquidjs/dist/emitters/index.d.ts | 4 + .../dist/emitters/keeping-type-emitter.d.ts | 5 + .../dist/emitters/simple-emitter.d.ts | 5 + .../dist/emitters/streamed-emitter.d.ts | 9 + node_modules/liquidjs/dist/filters/array.d.ts | 32 + .../liquidjs/dist/filters/base64-impl.d.ts | 2 + .../liquidjs/dist/filters/base64.d.ts | 9 + .../liquidjs/dist/filters/crypto-impl.d.ts | 2 + .../liquidjs/dist/filters/crypto.d.ts | 8 + node_modules/liquidjs/dist/filters/date.d.ts | 6 + node_modules/liquidjs/dist/filters/html.d.ts | 6 + node_modules/liquidjs/dist/filters/index.d.ts | 2 + node_modules/liquidjs/dist/filters/math.d.ts | 11 + node_modules/liquidjs/dist/filters/misc.d.ts | 18 + .../liquidjs/dist/filters/string.d.ts | 27 + node_modules/liquidjs/dist/filters/url.d.ts | 14 + node_modules/liquidjs/dist/fs/fs-impl.d.ts | 10 + .../liquidjs/dist/fs/fs-impl.spec.d.ts | 1 + node_modules/liquidjs/dist/fs/fs.d.ts | 22 + node_modules/liquidjs/dist/fs/index.d.ts | 2 + node_modules/liquidjs/dist/fs/loader.d.ts | 25 + .../liquidjs/dist/fs/loader.spec.d.ts | 1 + node_modules/liquidjs/dist/fs/map-fs.d.ts | 13 + .../liquidjs/dist/fs/map-fs.spec.d.ts | 1 + .../liquidjs/dist/fs/node-require.d.ts | 1 + node_modules/liquidjs/dist/index.d.ts | 20 + .../liquidjs/dist/liquid-options.d.ts | 162 + .../liquidjs/dist/liquid-options.spec.d.ts | 1 + .../liquidjs/dist/liquid.browser.min.js | 2 + .../liquidjs/dist/liquid.browser.min.js.map | 1 + node_modules/liquidjs/dist/liquid.browser.mjs | 5161 +++++++++ .../liquidjs/dist/liquid.browser.umd.js | 7537 +++++++++++++ .../liquidjs/dist/liquid.browser.umd.js.map | 1 + node_modules/liquidjs/dist/liquid.d.ts | 70 + node_modules/liquidjs/dist/liquid.node.js | 5182 +++++++++ node_modules/liquidjs/dist/liquid.node.mjs | 5176 +++++++++ .../liquidjs/dist/parser/filter-arg.d.ts | 5 + node_modules/liquidjs/dist/parser/index.d.ts | 4 + .../liquidjs/dist/parser/parse-stream.d.ts | 15 + .../dist/parser/parse-stream.spec.d.ts | 1 + node_modules/liquidjs/dist/parser/parser.d.ts | 21 + .../liquidjs/dist/parser/parser.spec.d.ts | 1 + .../liquidjs/dist/parser/token-kind.d.ts | 16 + .../liquidjs/dist/parser/tokenizer.d.ts | 63 + .../liquidjs/dist/parser/tokenizer.spec.d.ts | 1 + .../liquidjs/dist/parser/whitespace-ctrl.d.ts | 3 + .../liquidjs/dist/render/boolean.d.ts | 3 + .../liquidjs/dist/render/boolean.spec.d.ts | 1 + .../liquidjs/dist/render/expression.d.ts | 10 + .../liquidjs/dist/render/expression.spec.d.ts | 1 + node_modules/liquidjs/dist/render/index.d.ts | 4 + .../liquidjs/dist/render/operator.d.ts | 8 + node_modules/liquidjs/dist/render/render.d.ts | 8 + .../liquidjs/dist/render/render.spec.d.ts | 1 + node_modules/liquidjs/dist/render/string.d.ts | 1 + .../liquidjs/dist/render/string.spec.d.ts | 1 + node_modules/liquidjs/dist/tags/assign.d.ts | 12 + node_modules/liquidjs/dist/tags/block.d.ts | 11 + node_modules/liquidjs/dist/tags/break.d.ts | 4 + node_modules/liquidjs/dist/tags/capture.d.ts | 13 + node_modules/liquidjs/dist/tags/case.d.ts | 15 + node_modules/liquidjs/dist/tags/comment.d.ts | 5 + node_modules/liquidjs/dist/tags/continue.d.ts | 4 + node_modules/liquidjs/dist/tags/cycle.d.ts | 9 + .../liquidjs/dist/tags/decrement.d.ts | 9 + node_modules/liquidjs/dist/tags/echo.d.ts | 8 + node_modules/liquidjs/dist/tags/for.d.ts | 15 + node_modules/liquidjs/dist/tags/if.d.ts | 14 + node_modules/liquidjs/dist/tags/include.d.ts | 14 + .../liquidjs/dist/tags/increment.d.ts | 9 + node_modules/liquidjs/dist/tags/index.d.ts | 24 + .../liquidjs/dist/tags/inline-comment.d.ts | 5 + node_modules/liquidjs/dist/tags/layout.d.ts | 15 + node_modules/liquidjs/dist/tags/liquid.d.ts | 8 + node_modules/liquidjs/dist/tags/raw.d.ts | 6 + node_modules/liquidjs/dist/tags/render.d.ts | 24 + node_modules/liquidjs/dist/tags/tablerow.d.ts | 14 + node_modules/liquidjs/dist/tags/unless.d.ts | 15 + .../liquidjs/dist/template/analysis.d.ts | 85 + .../liquidjs/dist/template/analysis.spec.d.ts | 1 + .../dist/template/filter-impl-options.d.ts | 14 + .../liquidjs/dist/template/filter.d.ts | 15 + .../liquidjs/dist/template/filter.spec.d.ts | 1 + node_modules/liquidjs/dist/template/hash.d.ts | 18 + .../liquidjs/dist/template/hash.spec.d.ts | 1 + node_modules/liquidjs/dist/template/html.d.ts | 9 + .../liquidjs/dist/template/index.d.ts | 11 + .../liquidjs/dist/template/output.d.ts | 12 + .../liquidjs/dist/template/output.spec.d.ts | 1 + .../dist/template/tag-options-adapter.d.ts | 10 + node_modules/liquidjs/dist/template/tag.d.ts | 18 + .../liquidjs/dist/template/template-impl.d.ts | 4 + .../liquidjs/dist/template/template.d.ts | 36 + .../liquidjs/dist/template/value.d.ts | 15 + .../liquidjs/dist/template/value.spec.d.ts | 1 + .../liquidjs/dist/tokens/delimited-token.d.ts | 9 + .../liquidjs/dist/tokens/filter-token.d.ts | 7 + .../dist/tokens/filtered-value-token.d.ts | 17 + .../liquidjs/dist/tokens/hash-token.d.ts | 12 + .../liquidjs/dist/tokens/html-token.d.ts | 11 + .../dist/tokens/identifier-token.d.ts | 9 + node_modules/liquidjs/dist/tokens/index.d.ts | 18 + .../dist/tokens/liquid-tag-token.d.ts | 12 + .../liquidjs/dist/tokens/literal-token.d.ts | 11 + .../liquidjs/dist/tokens/number-token.d.ts | 9 + .../liquidjs/dist/tokens/operator-token.d.ts | 39 + .../liquidjs/dist/tokens/output-token.d.ts | 5 + .../dist/tokens/property-access-token.d.ts | 12 + .../liquidjs/dist/tokens/quoted-token.d.ts | 9 + .../liquidjs/dist/tokens/range-token.d.ts | 11 + .../liquidjs/dist/tokens/tag-token.d.ts | 9 + node_modules/liquidjs/dist/tokens/token.d.ts | 12 + .../liquidjs/dist/tokens/top-level-token.d.ts | 4 + .../liquidjs/dist/tokens/value-token.d.ts | 6 + node_modules/liquidjs/dist/util/assert.d.ts | 2 + .../liquidjs/dist/util/assert.spec.d.ts | 1 + node_modules/liquidjs/dist/util/async.d.ts | 4 + .../liquidjs/dist/util/async.spec.d.ts | 1 + .../liquidjs/dist/util/character.d.ts | 10 + node_modules/liquidjs/dist/util/error.d.ts | 35 + .../liquidjs/dist/util/error.spec.d.ts | 1 + node_modules/liquidjs/dist/util/index.d.ts | 12 + node_modules/liquidjs/dist/util/intl.d.ts | 6 + node_modules/liquidjs/dist/util/limiter.d.ts | 8 + .../liquidjs/dist/util/liquid-date.d.ts | 52 + .../liquidjs/dist/util/liquid-date.spec.d.ts | 1 + node_modules/liquidjs/dist/util/literal.d.ts | 11 + .../liquidjs/dist/util/operator-trie.d.ts | 10 + .../liquidjs/dist/util/performance.d.ts | 5 + .../liquidjs/dist/util/performance.spec.d.ts | 1 + node_modules/liquidjs/dist/util/strftime.d.ts | 3 + .../liquidjs/dist/util/strftime.spec.d.ts | 1 + .../liquidjs/dist/util/type-guards.d.ts | 13 + .../liquidjs/dist/util/type-guards.spec.d.ts | 1 + .../liquidjs/dist/util/underscore.d.ts | 41 + .../liquidjs/dist/util/underscore.spec.d.ts | 1 + node_modules/liquidjs/package.json | 171 + node_modules/list-to-array/.npmignore | 27 + node_modules/list-to-array/LICENSE | 22 + node_modules/list-to-array/README.md | 52 + node_modules/list-to-array/index.js | 18 + node_modules/list-to-array/package.json | 32 + node_modules/list-to-array/tests.js | 29 + node_modules/luxon/LICENSE.md | 7 + node_modules/luxon/README.md | 55 + node_modules/luxon/build/amd/luxon.js | 8741 +++++++++++++++ node_modules/luxon/build/amd/luxon.js.map | 1 + node_modules/luxon/build/cjs-browser/luxon.js | 8739 +++++++++++++++ .../luxon/build/cjs-browser/luxon.js.map | 1 + node_modules/luxon/build/es6/luxon.mjs | 8133 ++++++++++++++ node_modules/luxon/build/es6/luxon.mjs.map | 1 + node_modules/luxon/build/global/luxon.js | 8744 +++++++++++++++ node_modules/luxon/build/global/luxon.js.map | 1 + node_modules/luxon/build/global/luxon.min.js | 1 + .../luxon/build/global/luxon.min.js.map | 1 + node_modules/luxon/build/node/luxon.js | 7792 ++++++++++++++ node_modules/luxon/build/node/luxon.js.map | 1 + node_modules/luxon/package.json | 87 + node_modules/luxon/src/datetime.js | 2603 +++++ node_modules/luxon/src/duration.js | 1009 ++ node_modules/luxon/src/errors.js | 61 + node_modules/luxon/src/impl/conversions.js | 206 + node_modules/luxon/src/impl/diff.js | 95 + node_modules/luxon/src/impl/digits.js | 94 + node_modules/luxon/src/impl/english.js | 233 + node_modules/luxon/src/impl/formats.js | 176 + node_modules/luxon/src/impl/formatter.js | 434 + node_modules/luxon/src/impl/invalid.js | 14 + node_modules/luxon/src/impl/locale.js | 569 + node_modules/luxon/src/impl/regexParser.js | 335 + node_modules/luxon/src/impl/tokenParser.js | 505 + node_modules/luxon/src/impl/util.js | 330 + node_modules/luxon/src/impl/zoneUtil.js | 34 + node_modules/luxon/src/info.js | 205 + node_modules/luxon/src/interval.js | 669 ++ node_modules/luxon/src/luxon.js | 26 + node_modules/luxon/src/package.json | 4 + node_modules/luxon/src/settings.js | 180 + node_modules/luxon/src/zone.js | 97 + node_modules/luxon/src/zones/IANAZone.js | 235 + .../luxon/src/zones/fixedOffsetZone.js | 150 + node_modules/luxon/src/zones/invalidZone.js | 53 + node_modules/luxon/src/zones/systemZone.js | 61 + node_modules/markdown-it/LICENSE | 22 + node_modules/markdown-it/README.md | 320 + node_modules/markdown-it/bin/markdown-it.mjs | 107 + node_modules/markdown-it/dist/index.cjs.js | 3901 +++++++ .../markdown-it/dist/index.cjs.js.map | 1 + node_modules/markdown-it/dist/markdown-it.js | 3975 +++++++ .../markdown-it/dist/markdown-it.js.map | 1 + .../markdown-it/dist/markdown-it.min.js | 3 + .../markdown-it/dist/markdown-it.min.js.map | 1 + node_modules/markdown-it/index.mjs | 1 + .../markdown-it/lib/common/html_blocks.mjs | 67 + .../markdown-it/lib/common/html_re.mjs | 25 + node_modules/markdown-it/lib/common/utils.mjs | 324 + .../markdown-it/lib/helpers/index.mjs | 11 + .../lib/helpers/parse_link_destination.mjs | 77 + .../lib/helpers/parse_link_label.mjs | 49 + .../lib/helpers/parse_link_title.mjs | 66 + node_modules/markdown-it/lib/index.mjs | 565 + node_modules/markdown-it/lib/parser_block.mjs | 134 + node_modules/markdown-it/lib/parser_core.mjs | 62 + .../markdown-it/lib/parser_inline.mjs | 197 + .../markdown-it/lib/presets/commonmark.mjs | 88 + .../markdown-it/lib/presets/default.mjs | 47 + node_modules/markdown-it/lib/presets/zero.mjs | 70 + node_modules/markdown-it/lib/renderer.mjs | 322 + node_modules/markdown-it/lib/ruler.mjs | 340 + .../lib/rules_block/blockquote.mjs | 209 + .../markdown-it/lib/rules_block/code.mjs | 30 + .../markdown-it/lib/rules_block/fence.mjs | 94 + .../markdown-it/lib/rules_block/heading.mjs | 51 + .../markdown-it/lib/rules_block/hr.mjs | 40 + .../lib/rules_block/html_block.mjs | 80 + .../markdown-it/lib/rules_block/lheading.mjs | 85 + .../markdown-it/lib/rules_block/list.mjs | 331 + .../markdown-it/lib/rules_block/paragraph.mjs | 48 + .../markdown-it/lib/rules_block/reference.mjs | 212 + .../lib/rules_block/state_block.mjs | 220 + .../markdown-it/lib/rules_block/table.mjs | 228 + .../markdown-it/lib/rules_core/block.mjs | 13 + .../markdown-it/lib/rules_core/inline.mjs | 11 + .../markdown-it/lib/rules_core/linkify.mjs | 134 + .../markdown-it/lib/rules_core/normalize.mjs | 17 + .../lib/rules_core/replacements.mjs | 101 + .../lib/rules_core/smartquotes.mjs | 209 + .../markdown-it/lib/rules_core/state_core.mjs | 17 + .../markdown-it/lib/rules_core/text_join.mjs | 43 + .../markdown-it/lib/rules_inline/autolink.mjs | 72 + .../lib/rules_inline/backticks.mjs | 60 + .../lib/rules_inline/balance_pairs.mjs | 124 + .../markdown-it/lib/rules_inline/emphasis.mjs | 123 + .../markdown-it/lib/rules_inline/entity.mjs | 51 + .../markdown-it/lib/rules_inline/escape.mjs | 83 + .../lib/rules_inline/fragments_join.mjs | 38 + .../lib/rules_inline/html_inline.mjs | 50 + .../markdown-it/lib/rules_inline/image.mjs | 138 + .../markdown-it/lib/rules_inline/link.mjs | 139 + .../markdown-it/lib/rules_inline/linkify.mjs | 63 + .../markdown-it/lib/rules_inline/newline.mjs | 42 + .../lib/rules_inline/state_inline.mjs | 154 + .../lib/rules_inline/strikethrough.mjs | 127 + .../markdown-it/lib/rules_inline/text.mjs | 86 + node_modules/markdown-it/lib/token.mjs | 191 + .../markdown-it/node_modules/entities/LICENSE | 11 + .../node_modules/entities/lib/decode.d.ts | 211 + .../node_modules/entities/lib/decode.d.ts.map | 1 + .../node_modules/entities/lib/decode.js | 536 + .../node_modules/entities/lib/decode.js.map | 1 + .../entities/lib/decode_codepoint.d.ts | 19 + .../entities/lib/decode_codepoint.d.ts.map | 1 + .../entities/lib/decode_codepoint.js | 76 + .../entities/lib/decode_codepoint.js.map | 1 + .../node_modules/entities/lib/encode.d.ts | 22 + .../node_modules/entities/lib/encode.d.ts.map | 1 + .../node_modules/entities/lib/encode.js | 77 + .../node_modules/entities/lib/encode.js.map | 1 + .../node_modules/entities/lib/escape.d.ts | 43 + .../node_modules/entities/lib/escape.d.ts.map | 1 + .../node_modules/entities/lib/escape.js | 122 + .../node_modules/entities/lib/escape.js.map | 1 + .../node_modules/entities/lib/esm/decode.d.ts | 211 + .../entities/lib/esm/decode.d.ts.map | 1 + .../node_modules/entities/lib/esm/decode.js | 496 + .../entities/lib/esm/decode.js.map | 1 + .../entities/lib/esm/decode_codepoint.d.ts | 19 + .../lib/esm/decode_codepoint.d.ts.map | 1 + .../entities/lib/esm/decode_codepoint.js | 71 + .../entities/lib/esm/decode_codepoint.js.map | 1 + .../node_modules/entities/lib/esm/encode.d.ts | 22 + .../entities/lib/esm/encode.d.ts.map | 1 + .../node_modules/entities/lib/esm/encode.js | 69 + .../entities/lib/esm/encode.js.map | 1 + .../node_modules/entities/lib/esm/escape.d.ts | 43 + .../entities/lib/esm/escape.d.ts.map | 1 + .../node_modules/entities/lib/esm/escape.js | 116 + .../entities/lib/esm/escape.js.map | 1 + .../lib/esm/generated/decode-data-html.d.ts | 3 + .../esm/generated/decode-data-html.d.ts.map | 1 + .../lib/esm/generated/decode-data-html.js | 7 + .../lib/esm/generated/decode-data-html.js.map | 1 + .../lib/esm/generated/decode-data-xml.d.ts | 3 + .../esm/generated/decode-data-xml.d.ts.map | 1 + .../lib/esm/generated/decode-data-xml.js | 7 + .../lib/esm/generated/decode-data-xml.js.map | 1 + .../lib/esm/generated/encode-html.d.ts | 8 + .../lib/esm/generated/encode-html.d.ts.map | 1 + .../entities/lib/esm/generated/encode-html.js | 10 + .../lib/esm/generated/encode-html.js.map | 1 + .../node_modules/entities/lib/esm/index.d.ts | 96 + .../entities/lib/esm/index.d.ts.map | 1 + .../node_modules/entities/lib/esm/index.js | 99 + .../entities/lib/esm/index.js.map | 1 + .../entities/lib/esm/package.json | 1 + .../lib/generated/decode-data-html.d.ts | 3 + .../lib/generated/decode-data-html.d.ts.map | 1 + .../lib/generated/decode-data-html.js | 9 + .../lib/generated/decode-data-html.js.map | 1 + .../lib/generated/decode-data-xml.d.ts | 3 + .../lib/generated/decode-data-xml.d.ts.map | 1 + .../entities/lib/generated/decode-data-xml.js | 9 + .../lib/generated/decode-data-xml.js.map | 1 + .../entities/lib/generated/encode-html.d.ts | 8 + .../lib/generated/encode-html.d.ts.map | 1 + .../entities/lib/generated/encode-html.js | 12 + .../entities/lib/generated/encode-html.js.map | 1 + .../node_modules/entities/lib/index.d.ts | 96 + .../node_modules/entities/lib/index.d.ts.map | 1 + .../node_modules/entities/lib/index.js | 126 + .../node_modules/entities/lib/index.js.map | 1 + .../node_modules/entities/package.json | 90 + .../node_modules/entities/readme.md | 122 + node_modules/markdown-it/package.json | 94 + node_modules/mdurl/LICENSE | 45 + node_modules/mdurl/README.md | 102 + node_modules/mdurl/build/index.cjs.js | 534 + node_modules/mdurl/index.mjs | 11 + node_modules/mdurl/lib/decode.mjs | 112 + node_modules/mdurl/lib/encode.mjs | 89 + node_modules/mdurl/lib/format.mjs | 21 + node_modules/mdurl/lib/parse.mjs | 308 + node_modules/mdurl/package.json | 37 + node_modules/mime-db/HISTORY.md | 541 + node_modules/mime-db/LICENSE | 23 + node_modules/mime-db/README.md | 109 + node_modules/mime-db/db.json | 9342 +++++++++++++++++ node_modules/mime-db/index.js | 12 + node_modules/mime-db/package.json | 56 + node_modules/mime-types/HISTORY.md | 428 + node_modules/mime-types/LICENSE | 23 + node_modules/mime-types/README.md | 126 + node_modules/mime-types/index.js | 211 + node_modules/mime-types/mimeScore.js | 57 + node_modules/mime-types/package.json | 49 + node_modules/mime/CHANGELOG.md | 312 + node_modules/mime/LICENSE | 21 + node_modules/mime/Mime.js | 97 + node_modules/mime/README.md | 178 + node_modules/mime/cli.js | 46 + node_modules/mime/index.js | 4 + node_modules/mime/lite.js | 4 + node_modules/mime/package.json | 52 + node_modules/mime/types/other.js | 1 + node_modules/mime/types/standard.js | 1 + node_modules/minimatch/LICENSE | 15 + node_modules/minimatch/README.md | 267 + node_modules/minimatch/minimatch.js | 1005 ++ node_modules/minimatch/package.json | 33 + node_modules/minimist/.eslintrc | 29 + node_modules/minimist/.github/FUNDING.yml | 12 + node_modules/minimist/.nycrc | 14 + node_modules/minimist/CHANGELOG.md | 298 + node_modules/minimist/LICENSE | 18 + node_modules/minimist/README.md | 121 + node_modules/minimist/example/parse.js | 4 + node_modules/minimist/index.js | 263 + node_modules/minimist/package.json | 75 + node_modules/minimist/test/all_bool.js | 34 + node_modules/minimist/test/bool.js | 177 + node_modules/minimist/test/dash.js | 43 + node_modules/minimist/test/default_bool.js | 37 + node_modules/minimist/test/dotted.js | 24 + node_modules/minimist/test/kv_short.js | 32 + node_modules/minimist/test/long.js | 33 + node_modules/minimist/test/num.js | 38 + node_modules/minimist/test/parse.js | 209 + node_modules/minimist/test/parse_modified.js | 11 + node_modules/minimist/test/proto.js | 64 + node_modules/minimist/test/short.js | 69 + node_modules/minimist/test/stop_early.js | 17 + node_modules/minimist/test/unknown.js | 104 + node_modules/minimist/test/whitespace.js | 10 + node_modules/minipass/LICENSE.md | 55 + node_modules/minipass/README.md | 825 ++ .../minipass/dist/commonjs/index.d.ts | 545 + .../minipass/dist/commonjs/index.d.ts.map | 1 + node_modules/minipass/dist/commonjs/index.js | 1038 ++ .../minipass/dist/commonjs/index.js.map | 1 + .../minipass/dist/commonjs/package.json | 3 + node_modules/minipass/dist/esm/index.d.ts | 545 + node_modules/minipass/dist/esm/index.d.ts.map | 1 + node_modules/minipass/dist/esm/index.js | 1020 ++ node_modules/minipass/dist/esm/index.js.map | 1 + node_modules/minipass/dist/esm/package.json | 3 + node_modules/minipass/package.json | 77 + node_modules/moo/LICENSE | 29 + node_modules/moo/README.md | 383 + node_modules/moo/moo.js | 642 ++ node_modules/moo/package.json | 29 + node_modules/morphdom/CHANGELOG.md | 256 + node_modules/morphdom/LICENSE | 21 + node_modules/morphdom/README.md | 265 + node_modules/morphdom/dist/morphdom-esm.js | 783 ++ .../morphdom/dist/morphdom-factory.js | 719 ++ node_modules/morphdom/dist/morphdom-umd.js | 791 ++ .../morphdom/dist/morphdom-umd.min.js | 1 + node_modules/morphdom/dist/morphdom.js | 785 ++ node_modules/morphdom/docs/old-benchmark.md | 204 + node_modules/morphdom/docs/virtual-dom.md | 38 + node_modules/morphdom/factory.js | 1 + node_modules/morphdom/index.d.ts | 21 + node_modules/morphdom/package.json | 63 + node_modules/morphdom/src/index.js | 6 + node_modules/morphdom/src/morphAttrs.js | 63 + node_modules/morphdom/src/morphdom.js | 491 + .../morphdom/src/specialElHandlers.js | 115 + node_modules/morphdom/src/util.js | 113 + node_modules/ms/index.js | 162 + node_modules/ms/license.md | 21 + node_modules/ms/package.json | 38 + node_modules/ms/readme.md | 59 + node_modules/node-retrieve-globals/LICENSE | 21 + node_modules/node-retrieve-globals/README.md | 91 + .../node-retrieve-globals/package.json | 30 + .../node-retrieve-globals/retrieveGlobals.js | 376 + .../util/getWorkingDirectory.js | 18 + .../node-retrieve-globals/util/vmModules.js | 23 + node_modules/normalize-path/LICENSE | 21 + node_modules/normalize-path/README.md | 127 + node_modules/normalize-path/index.js | 35 + node_modules/normalize-path/package.json | 77 + node_modules/nunjucks/LICENSE | 26 + node_modules/nunjucks/README.md | 58 + node_modules/nunjucks/bin/precompile | 58 + node_modules/nunjucks/bin/precompile.cmd | 5 + .../nunjucks/browser/nunjucks-slim.js | 3709 +++++++ .../nunjucks/browser/nunjucks-slim.js.map | 1 + .../nunjucks/browser/nunjucks-slim.min.js | 3 + .../nunjucks/browser/nunjucks-slim.min.js.map | 1 + node_modules/nunjucks/browser/nunjucks.js | 7021 +++++++++++++ node_modules/nunjucks/browser/nunjucks.js.map | 1 + node_modules/nunjucks/browser/nunjucks.min.js | 3 + .../nunjucks/browser/nunjucks.min.js.map | 1 + node_modules/nunjucks/index.js | 82 + .../node_modules/commander/CHANGELOG.md | 385 + .../nunjucks/node_modules/commander/LICENSE | 22 + .../nunjucks/node_modules/commander/Readme.md | 737 ++ .../nunjucks/node_modules/commander/index.js | 1756 ++++ .../node_modules/commander/package.json | 48 + .../node_modules/commander/typings/index.d.ts | 386 + node_modules/nunjucks/package.json | 112 + node_modules/nunjucks/src/compiler.js | 1027 ++ node_modules/nunjucks/src/environment.js | 548 + node_modules/nunjucks/src/express-app.js | 23 + node_modules/nunjucks/src/filters.js | 546 + node_modules/nunjucks/src/globals.js | 65 + node_modules/nunjucks/src/jinja-compat.js | 293 + node_modules/nunjucks/src/lexer.js | 474 + node_modules/nunjucks/src/lib.js | 325 + node_modules/nunjucks/src/loader.js | 21 + node_modules/nunjucks/src/loaders.js | 5 + node_modules/nunjucks/src/node-loaders.js | 139 + node_modules/nunjucks/src/nodes.js | 350 + node_modules/nunjucks/src/object.js | 100 + node_modules/nunjucks/src/parser.js | 1028 ++ .../nunjucks/src/precompile-global.js | 17 + node_modules/nunjucks/src/precompile.js | 108 + .../nunjucks/src/precompiled-loader.js | 31 + node_modules/nunjucks/src/runtime.js | 333 + node_modules/nunjucks/src/tests.js | 265 + node_modules/nunjucks/src/transformer.js | 166 + node_modules/nunjucks/src/web-loaders.js | 94 + node_modules/on-finished/HISTORY.md | 98 + node_modules/on-finished/LICENSE | 23 + node_modules/on-finished/README.md | 162 + node_modules/on-finished/index.js | 234 + node_modules/on-finished/package.json | 39 + node_modules/parse-srcset/.jscs.json | 83 + node_modules/parse-srcset/.jshintrc | 15 + node_modules/parse-srcset/.npmignore | 8 + node_modules/parse-srcset/LICENSE | 22 + node_modules/parse-srcset/README.md | 19 + node_modules/parse-srcset/package.json | 25 + node_modules/parse-srcset/src/parse-srcset.js | 330 + node_modules/parse-srcset/tests/he.js | 329 + node_modules/parse-srcset/tests/intern.js | 74 + node_modules/parse-srcset/tests/unit/ps.js | 345 + node_modules/parseurl/HISTORY.md | 58 + node_modules/parseurl/LICENSE | 24 + node_modules/parseurl/README.md | 133 + node_modules/parseurl/index.js | 158 + node_modules/parseurl/package.json | 40 + node_modules/picomatch/LICENSE | 21 + node_modules/picomatch/README.md | 743 ++ node_modules/picomatch/index.js | 17 + node_modules/picomatch/lib/constants.js | 184 + node_modules/picomatch/lib/parse.js | 1416 +++ node_modules/picomatch/lib/picomatch.js | 361 + node_modules/picomatch/lib/scan.js | 391 + node_modules/picomatch/lib/utils.js | 72 + node_modules/picomatch/package.json | 83 + node_modules/picomatch/posix.js | 3 + node_modules/please-upgrade-node/.eslintrc.js | 12 + .../please-upgrade-node/.github/FUNDING.yml | 1 + node_modules/please-upgrade-node/LICENSE | 21 + node_modules/please-upgrade-node/README.md | 72 + node_modules/please-upgrade-node/index.d.ts | 11 + node_modules/please-upgrade-node/index.js | 25 + node_modules/please-upgrade-node/package.json | 46 + node_modules/posthtml-match-helper/LICENSE | 21 + node_modules/posthtml-match-helper/README.md | 84 + .../posthtml-match-helper/lib/index.d.ts | 10 + .../posthtml-match-helper/lib/index.js | 149 + .../posthtml-match-helper/package.json | 41 + .../posthtml-parser/dist/chunk.2UQLUWPH.js | 1 + node_modules/posthtml-parser/dist/index.d.ts | 27 + node_modules/posthtml-parser/dist/index.js | 1 + .../dist/location-tracker.d.ts | 17 + .../posthtml-parser/dist/location-tracker.js | 1 + node_modules/posthtml-parser/license | 22 + node_modules/posthtml-parser/package.json | 69 + node_modules/posthtml-parser/readme.md | 130 + node_modules/posthtml-render/changelog.md | 310 + node_modules/posthtml-render/dist/index.d.ts | 67 + node_modules/posthtml-render/dist/index.js | 1 + node_modules/posthtml-render/license | 22 + node_modules/posthtml-render/package.json | 55 + node_modules/posthtml-render/readme.md | 225 + node_modules/posthtml/lib/api.js | 145 + node_modules/posthtml/lib/index.js | 323 + node_modules/posthtml/license | 21 + node_modules/posthtml/package.json | 65 + node_modules/posthtml/readme.md | 366 + node_modules/posthtml/types/posthtml.d.ts | 108 + node_modules/prr/.jshintrc | 61 + node_modules/prr/.npmignore | 1 + node_modules/prr/.travis.yml | 10 + node_modules/prr/LICENSE.md | 11 + node_modules/prr/README.md | 47 + node_modules/prr/package.json | 26 + node_modules/prr/prr.js | 63 + node_modules/prr/test.js | 169 + node_modules/punycode.js/LICENSE-MIT.txt | 20 + node_modules/punycode.js/README.md | 148 + node_modules/punycode.js/package.json | 58 + node_modules/punycode.js/punycode.es6.js | 444 + node_modules/punycode.js/punycode.js | 443 + node_modules/range-parser/HISTORY.md | 56 + node_modules/range-parser/LICENSE | 23 + node_modules/range-parser/README.md | 85 + node_modules/range-parser/index.js | 181 + node_modules/range-parser/package.json | 48 + node_modules/readdirp/LICENSE | 21 + node_modules/readdirp/README.md | 122 + node_modules/readdirp/index.d.ts | 43 + node_modules/readdirp/index.js | 287 + .../readdirp/node_modules/picomatch/LICENSE | 21 + .../readdirp/node_modules/picomatch/README.md | 716 ++ .../readdirp/node_modules/picomatch/index.js | 3 + .../node_modules/picomatch/lib/constants.js | 184 + .../node_modules/picomatch/lib/parse.js | 1392 +++ .../node_modules/picomatch/lib/picomatch.js | 342 + .../node_modules/picomatch/lib/scan.js | 391 + .../node_modules/picomatch/lib/utils.js | 64 + .../node_modules/picomatch/package.json | 81 + node_modules/readdirp/package.json | 122 + node_modules/section-matter/LICENSE | 21 + node_modules/section-matter/README.md | 236 + node_modules/section-matter/index.js | 136 + node_modules/section-matter/package.json | 55 + node_modules/semver-compare/.travis.yml | 6 + node_modules/semver-compare/LICENSE | 18 + node_modules/semver-compare/example/cmp.js | 13 + node_modules/semver-compare/example/lex.js | 12 + node_modules/semver-compare/index.js | 13 + node_modules/semver-compare/package.json | 31 + node_modules/semver-compare/readme.markdown | 77 + node_modules/semver-compare/test/cmp.js | 29 + node_modules/semver/LICENSE | 15 + node_modules/semver/README.md | 680 ++ node_modules/semver/bin/semver.js | 195 + node_modules/semver/classes/comparator.js | 143 + node_modules/semver/classes/index.js | 7 + node_modules/semver/classes/range.js | 577 + node_modules/semver/classes/semver.js | 350 + node_modules/semver/functions/clean.js | 8 + node_modules/semver/functions/cmp.js | 54 + node_modules/semver/functions/coerce.js | 62 + .../semver/functions/compare-build.js | 9 + .../semver/functions/compare-loose.js | 5 + node_modules/semver/functions/compare.js | 7 + node_modules/semver/functions/diff.js | 60 + node_modules/semver/functions/eq.js | 5 + node_modules/semver/functions/gt.js | 5 + node_modules/semver/functions/gte.js | 5 + node_modules/semver/functions/inc.js | 21 + node_modules/semver/functions/lt.js | 5 + node_modules/semver/functions/lte.js | 5 + node_modules/semver/functions/major.js | 5 + node_modules/semver/functions/minor.js | 5 + node_modules/semver/functions/neq.js | 5 + node_modules/semver/functions/parse.js | 18 + node_modules/semver/functions/patch.js | 5 + node_modules/semver/functions/prerelease.js | 8 + node_modules/semver/functions/rcompare.js | 5 + node_modules/semver/functions/rsort.js | 5 + node_modules/semver/functions/satisfies.js | 12 + node_modules/semver/functions/sort.js | 5 + node_modules/semver/functions/truncate.js | 48 + node_modules/semver/functions/valid.js | 8 + node_modules/semver/index.js | 93 + node_modules/semver/internal/constants.js | 37 + node_modules/semver/internal/debug.js | 11 + node_modules/semver/internal/identifiers.js | 29 + node_modules/semver/internal/lrucache.js | 42 + node_modules/semver/internal/parse-options.js | 17 + node_modules/semver/internal/re.js | 223 + node_modules/semver/package.json | 78 + node_modules/semver/preload.js | 4 + node_modules/semver/range.bnf | 17 + node_modules/semver/ranges/gtr.js | 6 + node_modules/semver/ranges/intersects.js | 9 + node_modules/semver/ranges/ltr.js | 6 + node_modules/semver/ranges/max-satisfying.js | 27 + node_modules/semver/ranges/min-satisfying.js | 26 + node_modules/semver/ranges/min-version.js | 63 + node_modules/semver/ranges/outside.js | 82 + node_modules/semver/ranges/simplify.js | 49 + node_modules/semver/ranges/subset.js | 249 + node_modules/semver/ranges/to-comparators.js | 10 + node_modules/semver/ranges/valid.js | 13 + node_modules/send/LICENSE | 23 + node_modules/send/README.md | 317 + node_modules/send/index.js | 997 ++ node_modules/send/package.json | 63 + node_modules/setprototypeof/LICENSE | 13 + node_modules/setprototypeof/README.md | 31 + node_modules/setprototypeof/index.d.ts | 2 + node_modules/setprototypeof/index.js | 17 + node_modules/setprototypeof/package.json | 38 + node_modules/setprototypeof/test/index.js | 24 + node_modules/slash/index.d.ts | 25 + node_modules/slash/index.js | 11 + node_modules/slash/license | 9 + node_modules/slash/package.json | 35 + node_modules/slash/readme.md | 44 + node_modules/slugify/LICENSE | 21 + node_modules/slugify/README.md | 98 + node_modules/slugify/package.json | 42 + node_modules/slugify/slugify.d.ts | 27 + node_modules/slugify/slugify.js | 69 + node_modules/sprintf-js/.npmignore | 1 + node_modules/sprintf-js/LICENSE | 24 + node_modules/sprintf-js/README.md | 88 + node_modules/sprintf-js/bower.json | 14 + node_modules/sprintf-js/demo/angular.html | 20 + .../sprintf-js/dist/angular-sprintf.min.js | 4 + .../dist/angular-sprintf.min.js.map | 1 + .../sprintf-js/dist/angular-sprintf.min.map | 1 + node_modules/sprintf-js/dist/sprintf.min.js | 4 + .../sprintf-js/dist/sprintf.min.js.map | 1 + node_modules/sprintf-js/dist/sprintf.min.map | 1 + node_modules/sprintf-js/gruntfile.js | 36 + node_modules/sprintf-js/package.json | 22 + .../sprintf-js/src/angular-sprintf.js | 18 + node_modules/sprintf-js/src/sprintf.js | 208 + node_modules/sprintf-js/test/test.js | 82 + node_modules/ssri/LICENSE.md | 16 + node_modules/ssri/README.md | 528 + node_modules/ssri/lib/index.js | 580 + node_modules/ssri/package.json | 66 + node_modules/statuses/HISTORY.md | 87 + node_modules/statuses/LICENSE | 23 + node_modules/statuses/README.md | 139 + node_modules/statuses/codes.json | 65 + node_modules/statuses/index.js | 146 + node_modules/statuses/package.json | 49 + node_modules/strip-bom-string/LICENSE | 21 + node_modules/strip-bom-string/README.md | 66 + node_modules/strip-bom-string/index.js | 15 + node_modules/strip-bom-string/package.json | 60 + node_modules/tinyglobby/LICENSE | 21 + node_modules/tinyglobby/README.md | 25 + node_modules/tinyglobby/dist/index.cjs | 335 + node_modules/tinyglobby/dist/index.d.cts | 148 + node_modules/tinyglobby/dist/index.d.mts | 148 + node_modules/tinyglobby/dist/index.mjs | 307 + node_modules/tinyglobby/package.json | 70 + node_modules/to-regex-range/LICENSE | 21 + node_modules/to-regex-range/README.md | 305 + node_modules/to-regex-range/index.js | 288 + node_modules/to-regex-range/package.json | 88 + node_modules/toidentifier/HISTORY.md | 9 + node_modules/toidentifier/LICENSE | 21 + node_modules/toidentifier/README.md | 61 + node_modules/toidentifier/index.js | 32 + node_modules/toidentifier/package.json | 38 + node_modules/uc.micro/LICENSE.txt | 20 + node_modules/uc.micro/README.md | 14 + node_modules/uc.micro/build/index.cjs.js | 20 + node_modules/uc.micro/categories/Cc/regex.mjs | 1 + node_modules/uc.micro/categories/Cf/regex.mjs | 1 + node_modules/uc.micro/categories/P/regex.mjs | 1 + node_modules/uc.micro/categories/S/regex.mjs | 1 + node_modules/uc.micro/categories/Z/regex.mjs | 1 + node_modules/uc.micro/index.mjs | 8 + node_modules/uc.micro/package.json | 37 + .../uc.micro/properties/Any/regex.mjs | 1 + node_modules/unpipe/HISTORY.md | 4 + node_modules/unpipe/LICENSE | 22 + node_modules/unpipe/README.md | 43 + node_modules/unpipe/index.js | 69 + node_modules/unpipe/package.json | 27 + node_modules/urlpattern-polyfill/LICENSE | 19 + node_modules/urlpattern-polyfill/README.md | 242 + .../urlpattern-polyfill/dist/index.d.ts | 9 + .../urlpattern-polyfill/dist/types.d.ts | 49 + .../urlpattern-polyfill/dist/urlpattern.cjs | 1 + .../urlpattern-polyfill/dist/urlpattern.js | 1 + node_modules/urlpattern-polyfill/index.cjs | 7 + node_modules/urlpattern-polyfill/index.js | 7 + node_modules/urlpattern-polyfill/package.json | 149 + node_modules/ws/LICENSE | 20 + node_modules/ws/README.md | 548 + node_modules/ws/browser.js | 8 + node_modules/ws/index.js | 22 + node_modules/ws/lib/buffer-util.js | 131 + node_modules/ws/lib/constants.js | 19 + node_modules/ws/lib/event-target.js | 292 + node_modules/ws/lib/extension.js | 203 + node_modules/ws/lib/limiter.js | 55 + node_modules/ws/lib/permessage-deflate.js | 528 + node_modules/ws/lib/receiver.js | 743 ++ node_modules/ws/lib/sender.js | 607 ++ node_modules/ws/lib/stream.js | 161 + node_modules/ws/lib/subprotocol.js | 62 + node_modules/ws/lib/validation.js | 152 + node_modules/ws/lib/websocket-server.js | 562 + node_modules/ws/lib/websocket.js | 1407 +++ node_modules/ws/package.json | 74 + node_modules/ws/wrapper.mjs | 21 + 1693 files changed, 324890 insertions(+) create mode 100644 node_modules/.bin/acorn create mode 100644 node_modules/.bin/acorn.cmd create mode 100644 node_modules/.bin/acorn.ps1 create mode 100644 node_modules/.bin/eleventy create mode 100644 node_modules/.bin/eleventy-dev-server create mode 100644 node_modules/.bin/eleventy-dev-server.cmd create mode 100644 node_modules/.bin/eleventy-dev-server.ps1 create mode 100644 node_modules/.bin/eleventy.cmd create mode 100644 node_modules/.bin/eleventy.ps1 create mode 100644 node_modules/.bin/errno create mode 100644 node_modules/.bin/errno.cmd create mode 100644 node_modules/.bin/errno.ps1 create mode 100644 node_modules/.bin/esparse create mode 100644 node_modules/.bin/esparse.cmd create mode 100644 node_modules/.bin/esparse.ps1 create mode 100644 node_modules/.bin/esvalidate create mode 100644 node_modules/.bin/esvalidate.cmd create mode 100644 node_modules/.bin/esvalidate.ps1 create mode 100644 node_modules/.bin/js-yaml create mode 100644 node_modules/.bin/js-yaml.cmd create mode 100644 node_modules/.bin/js-yaml.ps1 create mode 100644 node_modules/.bin/liquid create mode 100644 node_modules/.bin/liquid.cmd create mode 100644 node_modules/.bin/liquid.ps1 create mode 100644 node_modules/.bin/liquidjs create mode 100644 node_modules/.bin/liquidjs.cmd create mode 100644 node_modules/.bin/liquidjs.ps1 create mode 100644 node_modules/.bin/markdown-it create mode 100644 node_modules/.bin/markdown-it.cmd create mode 100644 node_modules/.bin/markdown-it.ps1 create mode 100644 node_modules/.bin/mime create mode 100644 node_modules/.bin/mime.cmd create mode 100644 node_modules/.bin/mime.ps1 create mode 100644 node_modules/.bin/nunjucks-precompile create mode 100644 node_modules/.bin/nunjucks-precompile.cmd create mode 100644 node_modules/.bin/nunjucks-precompile.ps1 create mode 100644 node_modules/.bin/semver create mode 100644 node_modules/.bin/semver.cmd create mode 100644 node_modules/.bin/semver.ps1 create mode 100644 node_modules/.package-lock.json create mode 100644 node_modules/@11ty/dependency-tree-esm/LICENSE create mode 100644 node_modules/@11ty/dependency-tree-esm/README.md create mode 100644 node_modules/@11ty/dependency-tree-esm/main.js create mode 100644 node_modules/@11ty/dependency-tree-esm/package.json create mode 100644 node_modules/@11ty/dependency-tree/LICENSE create mode 100644 node_modules/@11ty/dependency-tree/README.md create mode 100644 node_modules/@11ty/dependency-tree/main.js create mode 100644 node_modules/@11ty/dependency-tree/package.json create mode 100644 node_modules/@11ty/eleventy-dev-server/README.md create mode 100644 node_modules/@11ty/eleventy-dev-server/cli.js create mode 100644 node_modules/@11ty/eleventy-dev-server/client/reload-client.js create mode 100644 node_modules/@11ty/eleventy-dev-server/cmd.js create mode 100644 node_modules/@11ty/eleventy-dev-server/package.json create mode 100644 node_modules/@11ty/eleventy-dev-server/server.js create mode 100644 node_modules/@11ty/eleventy-dev-server/server/ipAddress.js create mode 100644 node_modules/@11ty/eleventy-dev-server/server/wrapResponse.js create mode 100644 node_modules/@11ty/eleventy-plugin-bundle/README.md create mode 100644 node_modules/@11ty/eleventy-plugin-bundle/eleventy.bundle.js create mode 100644 node_modules/@11ty/eleventy-plugin-bundle/package.json create mode 100644 node_modules/@11ty/eleventy-plugin-bundle/src/BundleFileOutput.js create mode 100644 node_modules/@11ty/eleventy-plugin-bundle/src/CodeManager.js create mode 100644 node_modules/@11ty/eleventy-plugin-bundle/src/OutOfOrderRender.js create mode 100644 node_modules/@11ty/eleventy-plugin-bundle/src/bundlePlucker.js create mode 100644 node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.bundleManagers.js create mode 100644 node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.pruneEmptyBundles.js create mode 100644 node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.shortcodes.js create mode 100644 node_modules/@11ty/eleventy-utils/LICENSE create mode 100644 node_modules/@11ty/eleventy-utils/README.md create mode 100644 node_modules/@11ty/eleventy-utils/index.js create mode 100644 node_modules/@11ty/eleventy-utils/package.json create mode 100644 node_modules/@11ty/eleventy-utils/src/Buffer.js create mode 100644 node_modules/@11ty/eleventy-utils/src/CreateHash.js create mode 100644 node_modules/@11ty/eleventy-utils/src/DateCompare.js create mode 100644 node_modules/@11ty/eleventy-utils/src/HashTypes.js create mode 100644 node_modules/@11ty/eleventy-utils/src/IsPlainObject.js create mode 100644 node_modules/@11ty/eleventy-utils/src/Merge.js create mode 100644 node_modules/@11ty/eleventy-utils/src/TemplatePath.js create mode 100644 node_modules/@11ty/eleventy-utils/src/Url.js create mode 100644 node_modules/@11ty/eleventy-utils/src/lib-sha256.js create mode 100644 node_modules/@11ty/eleventy/CODE_OF_CONDUCT.md create mode 100644 node_modules/@11ty/eleventy/LICENSE create mode 100644 node_modules/@11ty/eleventy/README.md create mode 100644 node_modules/@11ty/eleventy/SECURITY.md create mode 100644 node_modules/@11ty/eleventy/cmd.cjs create mode 100644 node_modules/@11ty/eleventy/package.json create mode 100644 node_modules/@11ty/eleventy/src/Benchmark/Benchmark.js create mode 100644 node_modules/@11ty/eleventy/src/Benchmark/BenchmarkGroup.js create mode 100644 node_modules/@11ty/eleventy/src/Benchmark/BenchmarkManager.js create mode 100644 node_modules/@11ty/eleventy/src/Data/ComputedData.js create mode 100644 node_modules/@11ty/eleventy/src/Data/ComputedDataProxy.js create mode 100644 node_modules/@11ty/eleventy/src/Data/ComputedDataQueue.js create mode 100644 node_modules/@11ty/eleventy/src/Data/ComputedDataTemplateString.js create mode 100644 node_modules/@11ty/eleventy/src/Data/TemplateData.js create mode 100644 node_modules/@11ty/eleventy/src/Data/TemplateDataInitialGlobalData.js create mode 100644 node_modules/@11ty/eleventy/src/Eleventy.js create mode 100644 node_modules/@11ty/eleventy/src/EleventyCommonJs.cjs create mode 100644 node_modules/@11ty/eleventy/src/EleventyExtensionMap.js create mode 100644 node_modules/@11ty/eleventy/src/EleventyFiles.js create mode 100644 node_modules/@11ty/eleventy/src/EleventyServe.js create mode 100644 node_modules/@11ty/eleventy/src/EleventyWatch.js create mode 100644 node_modules/@11ty/eleventy/src/EleventyWatchTargets.js create mode 100644 node_modules/@11ty/eleventy/src/Engines/Custom.js create mode 100644 node_modules/@11ty/eleventy/src/Engines/FrontMatter/JavaScript.js create mode 100644 node_modules/@11ty/eleventy/src/Engines/Html.js create mode 100644 node_modules/@11ty/eleventy/src/Engines/JavaScript.js create mode 100644 node_modules/@11ty/eleventy/src/Engines/Liquid.js create mode 100644 node_modules/@11ty/eleventy/src/Engines/Markdown.js create mode 100644 node_modules/@11ty/eleventy/src/Engines/Nunjucks.js create mode 100644 node_modules/@11ty/eleventy/src/Engines/TemplateEngine.js create mode 100644 node_modules/@11ty/eleventy/src/Engines/TemplateEngineManager.js create mode 100644 node_modules/@11ty/eleventy/src/Engines/Util/ContextAugmenter.js create mode 100644 node_modules/@11ty/eleventy/src/Errors/DuplicatePermalinkOutputError.js create mode 100644 node_modules/@11ty/eleventy/src/Errors/EleventyBaseError.js create mode 100644 node_modules/@11ty/eleventy/src/Errors/EleventyErrorHandler.js create mode 100644 node_modules/@11ty/eleventy/src/Errors/EleventyErrorUtil.js create mode 100644 node_modules/@11ty/eleventy/src/Errors/TemplateContentPrematureUseError.js create mode 100644 node_modules/@11ty/eleventy/src/Errors/TemplateContentUnrenderedTemplateError.js create mode 100644 node_modules/@11ty/eleventy/src/Errors/UsingCircularTemplateContentReferenceError.js create mode 100644 node_modules/@11ty/eleventy/src/EventBus.js create mode 100644 node_modules/@11ty/eleventy/src/FileSystemSearch.js create mode 100644 node_modules/@11ty/eleventy/src/Filters/GetCollectionItem.js create mode 100644 node_modules/@11ty/eleventy/src/Filters/GetCollectionItemIndex.js create mode 100644 node_modules/@11ty/eleventy/src/Filters/GetLocaleCollectionItem.js create mode 100644 node_modules/@11ty/eleventy/src/Filters/Slug.js create mode 100644 node_modules/@11ty/eleventy/src/Filters/Slugify.js create mode 100644 node_modules/@11ty/eleventy/src/Filters/Url.js create mode 100644 node_modules/@11ty/eleventy/src/GlobalDependencyMap.js create mode 100644 node_modules/@11ty/eleventy/src/LayoutCache.js create mode 100644 node_modules/@11ty/eleventy/src/Plugins/HtmlBasePlugin.js create mode 100644 node_modules/@11ty/eleventy/src/Plugins/HtmlRelativeCopyPlugin.js create mode 100644 node_modules/@11ty/eleventy/src/Plugins/I18nPlugin.js create mode 100644 node_modules/@11ty/eleventy/src/Plugins/IdAttributePlugin.js create mode 100644 node_modules/@11ty/eleventy/src/Plugins/InputPathToUrl.js create mode 100644 node_modules/@11ty/eleventy/src/Plugins/Pagination.js create mode 100644 node_modules/@11ty/eleventy/src/Plugins/RenderPlugin.js create mode 100644 node_modules/@11ty/eleventy/src/Template.js create mode 100644 node_modules/@11ty/eleventy/src/TemplateBehavior.js create mode 100644 node_modules/@11ty/eleventy/src/TemplateCollection.js create mode 100644 node_modules/@11ty/eleventy/src/TemplateConfig.js create mode 100644 node_modules/@11ty/eleventy/src/TemplateContent.js create mode 100644 node_modules/@11ty/eleventy/src/TemplateFileSlug.js create mode 100644 node_modules/@11ty/eleventy/src/TemplateGlob.js create mode 100644 node_modules/@11ty/eleventy/src/TemplateLayout.js create mode 100644 node_modules/@11ty/eleventy/src/TemplateLayoutPathResolver.js create mode 100644 node_modules/@11ty/eleventy/src/TemplateMap.js create mode 100644 node_modules/@11ty/eleventy/src/TemplatePassthrough.js create mode 100644 node_modules/@11ty/eleventy/src/TemplatePassthroughManager.js create mode 100644 node_modules/@11ty/eleventy/src/TemplatePermalink.js create mode 100644 node_modules/@11ty/eleventy/src/TemplateRender.js create mode 100644 node_modules/@11ty/eleventy/src/TemplateWriter.js create mode 100644 node_modules/@11ty/eleventy/src/UserConfig.js create mode 100644 node_modules/@11ty/eleventy/src/Util/ArrayUtil.js create mode 100644 node_modules/@11ty/eleventy/src/Util/AsyncEventEmitter.js create mode 100644 node_modules/@11ty/eleventy/src/Util/Compatibility.js create mode 100644 node_modules/@11ty/eleventy/src/Util/ConsoleLogger.js create mode 100644 node_modules/@11ty/eleventy/src/Util/DateGitFirstAdded.js create mode 100644 node_modules/@11ty/eleventy/src/Util/DateGitLastUpdated.js create mode 100644 node_modules/@11ty/eleventy/src/Util/DirContains.js create mode 100644 node_modules/@11ty/eleventy/src/Util/EsmResolver.js create mode 100644 node_modules/@11ty/eleventy/src/Util/EsmResolverPortAdapter.js create mode 100644 node_modules/@11ty/eleventy/src/Util/EventBusUtil.js create mode 100644 node_modules/@11ty/eleventy/src/Util/ExistsCache.js create mode 100644 node_modules/@11ty/eleventy/src/Util/FilePathUtil.js create mode 100644 node_modules/@11ty/eleventy/src/Util/FileSystemManager.js create mode 100644 node_modules/@11ty/eleventy/src/Util/GetJavaScriptData.js create mode 100644 node_modules/@11ty/eleventy/src/Util/GlobMatcher.js create mode 100644 node_modules/@11ty/eleventy/src/Util/GlobRemap.js create mode 100644 node_modules/@11ty/eleventy/src/Util/HtmlRelativeCopy.js create mode 100644 node_modules/@11ty/eleventy/src/Util/HtmlTransformer.js create mode 100644 node_modules/@11ty/eleventy/src/Util/ImportJsonSync.js create mode 100644 node_modules/@11ty/eleventy/src/Util/IsAsyncFunction.js create mode 100644 node_modules/@11ty/eleventy/src/Util/JavaScriptDependencies.js create mode 100644 node_modules/@11ty/eleventy/src/Util/MemoizeFunction.js create mode 100644 node_modules/@11ty/eleventy/src/Util/Objects/DeepFreeze.js create mode 100644 node_modules/@11ty/eleventy/src/Util/Objects/ObjectFilter.js create mode 100644 node_modules/@11ty/eleventy/src/Util/Objects/ProxyWrap.js create mode 100644 node_modules/@11ty/eleventy/src/Util/Objects/SampleModule.mjs create mode 100644 node_modules/@11ty/eleventy/src/Util/Objects/Sortable.js create mode 100644 node_modules/@11ty/eleventy/src/Util/Objects/Unique.js create mode 100644 node_modules/@11ty/eleventy/src/Util/PassthroughCopyBehaviorCheck.js create mode 100644 node_modules/@11ty/eleventy/src/Util/PathNormalizer.js create mode 100644 node_modules/@11ty/eleventy/src/Util/PathPrefixer.js create mode 100644 node_modules/@11ty/eleventy/src/Util/Pluralize.js create mode 100644 node_modules/@11ty/eleventy/src/Util/ProjectDirectories.js create mode 100644 node_modules/@11ty/eleventy/src/Util/ProjectTemplateFormats.js create mode 100644 node_modules/@11ty/eleventy/src/Util/PromiseUtil.js create mode 100644 node_modules/@11ty/eleventy/src/Util/Require.js create mode 100644 node_modules/@11ty/eleventy/src/Util/ReservedData.js create mode 100644 node_modules/@11ty/eleventy/src/Util/SetUnion.js create mode 100644 node_modules/@11ty/eleventy/src/Util/SpawnAsync.js create mode 100644 node_modules/@11ty/eleventy/src/Util/TemplateDepGraph.js create mode 100644 node_modules/@11ty/eleventy/src/Util/TransformsUtil.js create mode 100644 node_modules/@11ty/eleventy/src/Util/ValidUrl.js create mode 100644 node_modules/@11ty/eleventy/src/defaultConfig.js create mode 100644 node_modules/@11ty/eleventy/tsconfig.json create mode 100644 node_modules/@11ty/lodash-custom/README.md create mode 100644 node_modules/@11ty/lodash-custom/lodash.custom.js create mode 100644 node_modules/@11ty/lodash-custom/package.json create mode 100644 node_modules/@11ty/posthtml-urls/LICENSE create mode 100644 node_modules/@11ty/posthtml-urls/README.md create mode 100644 node_modules/@11ty/posthtml-urls/lib/defaultOptions.js create mode 100644 node_modules/@11ty/posthtml-urls/lib/index.js create mode 100644 node_modules/@11ty/posthtml-urls/package.json create mode 100644 node_modules/@11ty/recursive-copy/README.md create mode 100644 node_modules/@11ty/recursive-copy/index.d.ts create mode 100644 node_modules/@11ty/recursive-copy/index.js create mode 100644 node_modules/@11ty/recursive-copy/lib/copy.js create mode 100644 node_modules/@11ty/recursive-copy/lib/maximatch.js create mode 100644 node_modules/@11ty/recursive-copy/package.json create mode 100644 node_modules/@sindresorhus/slugify/index.d.ts create mode 100644 node_modules/@sindresorhus/slugify/index.js create mode 100644 node_modules/@sindresorhus/slugify/license create mode 100644 node_modules/@sindresorhus/slugify/overridable-replacements.js create mode 100644 node_modules/@sindresorhus/slugify/package.json create mode 100644 node_modules/@sindresorhus/slugify/readme.md create mode 100644 node_modules/@sindresorhus/transliterate/index.d.ts create mode 100644 node_modules/@sindresorhus/transliterate/index.js create mode 100644 node_modules/@sindresorhus/transliterate/license create mode 100644 node_modules/@sindresorhus/transliterate/package.json create mode 100644 node_modules/@sindresorhus/transliterate/readme.md create mode 100644 node_modules/@sindresorhus/transliterate/replacements.js create mode 100644 node_modules/a-sync-waterfall/LICENSE create mode 100644 node_modules/a-sync-waterfall/README.md create mode 100644 node_modules/a-sync-waterfall/index.js create mode 100644 node_modules/a-sync-waterfall/package.json create mode 100644 node_modules/a-sync-waterfall/test.js create mode 100644 node_modules/acorn-walk/CHANGELOG.md create mode 100644 node_modules/acorn-walk/LICENSE create mode 100644 node_modules/acorn-walk/README.md create mode 100644 node_modules/acorn-walk/dist/walk.d.mts create mode 100644 node_modules/acorn-walk/dist/walk.d.ts create mode 100644 node_modules/acorn-walk/dist/walk.js create mode 100644 node_modules/acorn-walk/dist/walk.mjs create mode 100644 node_modules/acorn-walk/package.json create mode 100644 node_modules/acorn/CHANGELOG.md create mode 100644 node_modules/acorn/LICENSE create mode 100644 node_modules/acorn/README.md create mode 100644 node_modules/acorn/bin/acorn create mode 100644 node_modules/acorn/dist/acorn.d.mts create mode 100644 node_modules/acorn/dist/acorn.d.ts create mode 100644 node_modules/acorn/dist/acorn.js create mode 100644 node_modules/acorn/dist/acorn.mjs create mode 100644 node_modules/acorn/dist/bin.js create mode 100644 node_modules/acorn/package.json create mode 100644 node_modules/anymatch/LICENSE create mode 100644 node_modules/anymatch/README.md create mode 100644 node_modules/anymatch/index.d.ts create mode 100644 node_modules/anymatch/index.js create mode 100644 node_modules/anymatch/node_modules/picomatch/LICENSE create mode 100644 node_modules/anymatch/node_modules/picomatch/README.md create mode 100644 node_modules/anymatch/node_modules/picomatch/index.js create mode 100644 node_modules/anymatch/node_modules/picomatch/lib/constants.js create mode 100644 node_modules/anymatch/node_modules/picomatch/lib/parse.js create mode 100644 node_modules/anymatch/node_modules/picomatch/lib/picomatch.js create mode 100644 node_modules/anymatch/node_modules/picomatch/lib/scan.js create mode 100644 node_modules/anymatch/node_modules/picomatch/lib/utils.js create mode 100644 node_modules/anymatch/node_modules/picomatch/package.json create mode 100644 node_modules/anymatch/package.json create mode 100644 node_modules/argparse/CHANGELOG.md create mode 100644 node_modules/argparse/LICENSE create mode 100644 node_modules/argparse/README.md create mode 100644 node_modules/argparse/argparse.js create mode 100644 node_modules/argparse/lib/sub.js create mode 100644 node_modules/argparse/lib/textwrap.js create mode 100644 node_modules/argparse/package.json create mode 100644 node_modules/asap/CHANGES.md create mode 100644 node_modules/asap/LICENSE.md create mode 100644 node_modules/asap/README.md create mode 100644 node_modules/asap/asap.js create mode 100644 node_modules/asap/browser-asap.js create mode 100644 node_modules/asap/browser-raw.js create mode 100644 node_modules/asap/package.json create mode 100644 node_modules/asap/raw.js create mode 100644 node_modules/balanced-match/.github/FUNDING.yml create mode 100644 node_modules/balanced-match/LICENSE.md create mode 100644 node_modules/balanced-match/README.md create mode 100644 node_modules/balanced-match/index.js create mode 100644 node_modules/balanced-match/package.json create mode 100644 node_modules/bcp-47-match/index.d.ts create mode 100644 node_modules/bcp-47-match/index.js create mode 100644 node_modules/bcp-47-match/license create mode 100644 node_modules/bcp-47-match/package.json create mode 100644 node_modules/bcp-47-match/readme.md create mode 100644 node_modules/bcp-47-normalize/index.d.ts create mode 100644 node_modules/bcp-47-normalize/index.js create mode 100644 node_modules/bcp-47-normalize/lib/fields.d.ts create mode 100644 node_modules/bcp-47-normalize/lib/fields.js create mode 100644 node_modules/bcp-47-normalize/lib/index.d.ts create mode 100644 node_modules/bcp-47-normalize/lib/index.js create mode 100644 node_modules/bcp-47-normalize/lib/likely.d.ts create mode 100644 node_modules/bcp-47-normalize/lib/likely.js create mode 100644 node_modules/bcp-47-normalize/lib/many.d.ts create mode 100644 node_modules/bcp-47-normalize/lib/many.js create mode 100644 node_modules/bcp-47-normalize/lib/matches.d.ts create mode 100644 node_modules/bcp-47-normalize/lib/matches.js create mode 100644 node_modules/bcp-47-normalize/license create mode 100644 node_modules/bcp-47-normalize/package.json create mode 100644 node_modules/bcp-47-normalize/readme.md create mode 100644 node_modules/bcp-47/index.d.ts create mode 100644 node_modules/bcp-47/index.d.ts.map create mode 100644 node_modules/bcp-47/index.js create mode 100644 node_modules/bcp-47/lib/normal.d.ts create mode 100644 node_modules/bcp-47/lib/normal.d.ts.map create mode 100644 node_modules/bcp-47/lib/normal.js create mode 100644 node_modules/bcp-47/lib/parse.d.ts create mode 100644 node_modules/bcp-47/lib/parse.d.ts.map create mode 100644 node_modules/bcp-47/lib/parse.js create mode 100644 node_modules/bcp-47/lib/regular.d.ts create mode 100644 node_modules/bcp-47/lib/regular.d.ts.map create mode 100644 node_modules/bcp-47/lib/regular.js create mode 100644 node_modules/bcp-47/lib/stringify.d.ts create mode 100644 node_modules/bcp-47/lib/stringify.d.ts.map create mode 100644 node_modules/bcp-47/lib/stringify.js create mode 100644 node_modules/bcp-47/license create mode 100644 node_modules/bcp-47/package.json create mode 100644 node_modules/bcp-47/readme.md create mode 100644 node_modules/binary-extensions/binary-extensions.json create mode 100644 node_modules/binary-extensions/binary-extensions.json.d.ts create mode 100644 node_modules/binary-extensions/index.d.ts create mode 100644 node_modules/binary-extensions/index.js create mode 100644 node_modules/binary-extensions/license create mode 100644 node_modules/binary-extensions/package.json create mode 100644 node_modules/binary-extensions/readme.md create mode 100644 node_modules/brace-expansion/.tap/coverage/8b906b8c-e21f-40b5-8c0d-214d8c2682c5.json create mode 100644 node_modules/brace-expansion/.tap/processinfo/8b906b8c-e21f-40b5-8c0d-214d8c2682c5.json create mode 100644 node_modules/brace-expansion/ADVISORY-CVE-2026-14257.md create mode 100644 node_modules/brace-expansion/LICENSE create mode 100644 node_modules/brace-expansion/README.md create mode 100644 node_modules/brace-expansion/dist/commonjs/index.d.ts create mode 100644 node_modules/brace-expansion/dist/commonjs/index.d.ts.map create mode 100644 node_modules/brace-expansion/dist/commonjs/index.js create mode 100644 node_modules/brace-expansion/dist/commonjs/index.js.map create mode 100644 node_modules/brace-expansion/dist/commonjs/package.json create mode 100644 node_modules/brace-expansion/dist/esm/index.d.ts create mode 100644 node_modules/brace-expansion/dist/esm/index.d.ts.map create mode 100644 node_modules/brace-expansion/dist/esm/index.js create mode 100644 node_modules/brace-expansion/dist/esm/index.js.map create mode 100644 node_modules/brace-expansion/dist/esm/package.json create mode 100644 node_modules/brace-expansion/index.js create mode 100644 node_modules/brace-expansion/package.json create mode 100644 node_modules/braces/LICENSE create mode 100644 node_modules/braces/README.md create mode 100644 node_modules/braces/index.js create mode 100644 node_modules/braces/lib/compile.js create mode 100644 node_modules/braces/lib/constants.js create mode 100644 node_modules/braces/lib/expand.js create mode 100644 node_modules/braces/lib/parse.js create mode 100644 node_modules/braces/lib/stringify.js create mode 100644 node_modules/braces/lib/utils.js create mode 100644 node_modules/braces/package.json create mode 100644 node_modules/chokidar/LICENSE create mode 100644 node_modules/chokidar/README.md create mode 100644 node_modules/chokidar/index.js create mode 100644 node_modules/chokidar/lib/constants.js create mode 100644 node_modules/chokidar/lib/fsevents-handler.js create mode 100644 node_modules/chokidar/lib/nodefs-handler.js create mode 100644 node_modules/chokidar/package.json create mode 100644 node_modules/chokidar/types/index.d.ts create mode 100644 node_modules/commander/LICENSE create mode 100644 node_modules/commander/Readme.md create mode 100644 node_modules/commander/esm.mjs create mode 100644 node_modules/commander/index.js create mode 100644 node_modules/commander/lib/argument.js create mode 100644 node_modules/commander/lib/command.js create mode 100644 node_modules/commander/lib/error.js create mode 100644 node_modules/commander/lib/help.js create mode 100644 node_modules/commander/lib/option.js create mode 100644 node_modules/commander/lib/suggestSimilar.js create mode 100644 node_modules/commander/package-support.json create mode 100644 node_modules/commander/package.json create mode 100644 node_modules/commander/typings/index.d.ts create mode 100644 node_modules/concat-map/.travis.yml create mode 100644 node_modules/concat-map/LICENSE create mode 100644 node_modules/concat-map/README.markdown create mode 100644 node_modules/concat-map/example/map.js create mode 100644 node_modules/concat-map/index.js create mode 100644 node_modules/concat-map/package.json create mode 100644 node_modules/concat-map/test/map.js create mode 100644 node_modules/debug/LICENSE create mode 100644 node_modules/debug/README.md create mode 100644 node_modules/debug/package.json create mode 100644 node_modules/debug/src/browser.js create mode 100644 node_modules/debug/src/common.js create mode 100644 node_modules/debug/src/index.js create mode 100644 node_modules/debug/src/node.js create mode 100644 node_modules/depd/History.md create mode 100644 node_modules/depd/LICENSE create mode 100644 node_modules/depd/Readme.md create mode 100644 node_modules/depd/index.js create mode 100644 node_modules/depd/lib/browser/index.js create mode 100644 node_modules/depd/package.json create mode 100644 node_modules/dependency-graph/.github/workflows/node.js.yml create mode 100644 node_modules/dependency-graph/CHANGELOG.md create mode 100644 node_modules/dependency-graph/LICENSE create mode 100644 node_modules/dependency-graph/README.md create mode 100644 node_modules/dependency-graph/lib/dep_graph.js create mode 100644 node_modules/dependency-graph/lib/index.d.ts create mode 100644 node_modules/dependency-graph/package.json create mode 100644 node_modules/dependency-graph/specs/dep_graph_spec.js create mode 100644 node_modules/dom-serializer/LICENSE create mode 100644 node_modules/dom-serializer/README.md create mode 100644 node_modules/dom-serializer/lib/esm/foreignNames.d.ts create mode 100644 node_modules/dom-serializer/lib/esm/foreignNames.d.ts.map create mode 100644 node_modules/dom-serializer/lib/esm/foreignNames.js create mode 100644 node_modules/dom-serializer/lib/esm/index.d.ts create mode 100644 node_modules/dom-serializer/lib/esm/index.d.ts.map create mode 100644 node_modules/dom-serializer/lib/esm/index.js create mode 100644 node_modules/dom-serializer/lib/esm/package.json create mode 100644 node_modules/dom-serializer/lib/foreignNames.d.ts create mode 100644 node_modules/dom-serializer/lib/foreignNames.d.ts.map create mode 100644 node_modules/dom-serializer/lib/foreignNames.js create mode 100644 node_modules/dom-serializer/lib/index.d.ts create mode 100644 node_modules/dom-serializer/lib/index.d.ts.map create mode 100644 node_modules/dom-serializer/lib/index.js create mode 100644 node_modules/dom-serializer/node_modules/entities/LICENSE create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/decode.d.ts create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/decode.d.ts.map create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/decode.js create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/decode_codepoint.d.ts create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/decode_codepoint.d.ts.map create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/decode_codepoint.js create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/encode.d.ts create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/encode.d.ts.map create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/encode.js create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/index.d.ts create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/index.d.ts.map create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/index.js create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/maps/decode.json create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/maps/entities.json create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/maps/legacy.json create mode 100644 node_modules/dom-serializer/node_modules/entities/lib/maps/xml.json create mode 100644 node_modules/dom-serializer/node_modules/entities/package.json create mode 100644 node_modules/dom-serializer/node_modules/entities/readme.md create mode 100644 node_modules/dom-serializer/package.json create mode 100644 node_modules/domelementtype/LICENSE create mode 100644 node_modules/domelementtype/lib/esm/index.d.ts create mode 100644 node_modules/domelementtype/lib/esm/index.d.ts.map create mode 100644 node_modules/domelementtype/lib/esm/index.js create mode 100644 node_modules/domelementtype/lib/esm/package.json create mode 100644 node_modules/domelementtype/lib/index.d.ts create mode 100644 node_modules/domelementtype/lib/index.d.ts.map create mode 100644 node_modules/domelementtype/lib/index.js create mode 100644 node_modules/domelementtype/package.json create mode 100644 node_modules/domelementtype/readme.md create mode 100644 node_modules/domhandler/LICENSE create mode 100644 node_modules/domhandler/lib/index.d.ts create mode 100644 node_modules/domhandler/lib/index.d.ts.map create mode 100644 node_modules/domhandler/lib/index.js create mode 100644 node_modules/domhandler/lib/node.d.ts create mode 100644 node_modules/domhandler/lib/node.d.ts.map create mode 100644 node_modules/domhandler/lib/node.js create mode 100644 node_modules/domhandler/package.json create mode 100644 node_modules/domhandler/readme.md create mode 100644 node_modules/domutils/LICENSE create mode 100644 node_modules/domutils/lib/feeds.d.ts create mode 100644 node_modules/domutils/lib/feeds.d.ts.map create mode 100644 node_modules/domutils/lib/feeds.js create mode 100644 node_modules/domutils/lib/helpers.d.ts create mode 100644 node_modules/domutils/lib/helpers.d.ts.map create mode 100644 node_modules/domutils/lib/helpers.js create mode 100644 node_modules/domutils/lib/index.d.ts create mode 100644 node_modules/domutils/lib/index.d.ts.map create mode 100644 node_modules/domutils/lib/index.js create mode 100644 node_modules/domutils/lib/legacy.d.ts create mode 100644 node_modules/domutils/lib/legacy.d.ts.map create mode 100644 node_modules/domutils/lib/legacy.js create mode 100644 node_modules/domutils/lib/manipulation.d.ts create mode 100644 node_modules/domutils/lib/manipulation.d.ts.map create mode 100644 node_modules/domutils/lib/manipulation.js create mode 100644 node_modules/domutils/lib/querying.d.ts create mode 100644 node_modules/domutils/lib/querying.d.ts.map create mode 100644 node_modules/domutils/lib/querying.js create mode 100644 node_modules/domutils/lib/stringify.d.ts create mode 100644 node_modules/domutils/lib/stringify.d.ts.map create mode 100644 node_modules/domutils/lib/stringify.js create mode 100644 node_modules/domutils/lib/traversal.d.ts create mode 100644 node_modules/domutils/lib/traversal.d.ts.map create mode 100644 node_modules/domutils/lib/traversal.js create mode 100644 node_modules/domutils/package.json create mode 100644 node_modules/domutils/readme.md create mode 100644 node_modules/ee-first/LICENSE create mode 100644 node_modules/ee-first/README.md create mode 100644 node_modules/ee-first/index.js create mode 100644 node_modules/ee-first/package.json create mode 100644 node_modules/encodeurl/LICENSE create mode 100644 node_modules/encodeurl/README.md create mode 100644 node_modules/encodeurl/index.js create mode 100644 node_modules/encodeurl/package.json create mode 100644 node_modules/entities/LICENSE create mode 100644 node_modules/entities/decode.d.ts create mode 100644 node_modules/entities/decode.js create mode 100644 node_modules/entities/dist/commonjs/decode-codepoint.d.ts create mode 100644 node_modules/entities/dist/commonjs/decode-codepoint.d.ts.map create mode 100644 node_modules/entities/dist/commonjs/decode-codepoint.js create mode 100644 node_modules/entities/dist/commonjs/decode-codepoint.js.map create mode 100644 node_modules/entities/dist/commonjs/decode.d.ts create mode 100644 node_modules/entities/dist/commonjs/decode.d.ts.map create mode 100644 node_modules/entities/dist/commonjs/decode.js create mode 100644 node_modules/entities/dist/commonjs/decode.js.map create mode 100644 node_modules/entities/dist/commonjs/encode.d.ts create mode 100644 node_modules/entities/dist/commonjs/encode.d.ts.map create mode 100644 node_modules/entities/dist/commonjs/encode.js create mode 100644 node_modules/entities/dist/commonjs/encode.js.map create mode 100644 node_modules/entities/dist/commonjs/escape.d.ts create mode 100644 node_modules/entities/dist/commonjs/escape.d.ts.map create mode 100644 node_modules/entities/dist/commonjs/escape.js create mode 100644 node_modules/entities/dist/commonjs/escape.js.map create mode 100644 node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts create mode 100644 node_modules/entities/dist/commonjs/generated/decode-data-html.d.ts.map create mode 100644 node_modules/entities/dist/commonjs/generated/decode-data-html.js create mode 100644 node_modules/entities/dist/commonjs/generated/decode-data-html.js.map create mode 100644 node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts create mode 100644 node_modules/entities/dist/commonjs/generated/decode-data-xml.d.ts.map create mode 100644 node_modules/entities/dist/commonjs/generated/decode-data-xml.js create mode 100644 node_modules/entities/dist/commonjs/generated/decode-data-xml.js.map create mode 100644 node_modules/entities/dist/commonjs/generated/encode-html.d.ts create mode 100644 node_modules/entities/dist/commonjs/generated/encode-html.d.ts.map create mode 100644 node_modules/entities/dist/commonjs/generated/encode-html.js create mode 100644 node_modules/entities/dist/commonjs/generated/encode-html.js.map create mode 100644 node_modules/entities/dist/commonjs/index.d.ts create mode 100644 node_modules/entities/dist/commonjs/index.d.ts.map create mode 100644 node_modules/entities/dist/commonjs/index.js create mode 100644 node_modules/entities/dist/commonjs/index.js.map create mode 100644 node_modules/entities/dist/commonjs/package.json create mode 100644 node_modules/entities/dist/esm/decode-codepoint.d.ts create mode 100644 node_modules/entities/dist/esm/decode-codepoint.d.ts.map create mode 100644 node_modules/entities/dist/esm/decode-codepoint.js create mode 100644 node_modules/entities/dist/esm/decode-codepoint.js.map create mode 100644 node_modules/entities/dist/esm/decode.d.ts create mode 100644 node_modules/entities/dist/esm/decode.d.ts.map create mode 100644 node_modules/entities/dist/esm/decode.js create mode 100644 node_modules/entities/dist/esm/decode.js.map create mode 100644 node_modules/entities/dist/esm/encode.d.ts create mode 100644 node_modules/entities/dist/esm/encode.d.ts.map create mode 100644 node_modules/entities/dist/esm/encode.js create mode 100644 node_modules/entities/dist/esm/encode.js.map create mode 100644 node_modules/entities/dist/esm/escape.d.ts create mode 100644 node_modules/entities/dist/esm/escape.d.ts.map create mode 100644 node_modules/entities/dist/esm/escape.js create mode 100644 node_modules/entities/dist/esm/escape.js.map create mode 100644 node_modules/entities/dist/esm/generated/decode-data-html.d.ts create mode 100644 node_modules/entities/dist/esm/generated/decode-data-html.d.ts.map create mode 100644 node_modules/entities/dist/esm/generated/decode-data-html.js create mode 100644 node_modules/entities/dist/esm/generated/decode-data-html.js.map create mode 100644 node_modules/entities/dist/esm/generated/decode-data-xml.d.ts create mode 100644 node_modules/entities/dist/esm/generated/decode-data-xml.d.ts.map create mode 100644 node_modules/entities/dist/esm/generated/decode-data-xml.js create mode 100644 node_modules/entities/dist/esm/generated/decode-data-xml.js.map create mode 100644 node_modules/entities/dist/esm/generated/encode-html.d.ts create mode 100644 node_modules/entities/dist/esm/generated/encode-html.d.ts.map create mode 100644 node_modules/entities/dist/esm/generated/encode-html.js create mode 100644 node_modules/entities/dist/esm/generated/encode-html.js.map create mode 100644 node_modules/entities/dist/esm/index.d.ts create mode 100644 node_modules/entities/dist/esm/index.d.ts.map create mode 100644 node_modules/entities/dist/esm/index.js create mode 100644 node_modules/entities/dist/esm/index.js.map create mode 100644 node_modules/entities/dist/esm/package.json create mode 100644 node_modules/entities/escape.d.ts create mode 100644 node_modules/entities/escape.js create mode 100644 node_modules/entities/package.json create mode 100644 node_modules/entities/readme.md create mode 100644 node_modules/entities/src/decode-codepoint.ts create mode 100644 node_modules/entities/src/decode.spec.ts create mode 100644 node_modules/entities/src/decode.ts create mode 100644 node_modules/entities/src/encode.spec.ts create mode 100644 node_modules/entities/src/encode.ts create mode 100644 node_modules/entities/src/escape.spec.ts create mode 100644 node_modules/entities/src/escape.ts create mode 100644 node_modules/entities/src/generated/.eslintrc.json create mode 100644 node_modules/entities/src/generated/decode-data-html.ts create mode 100644 node_modules/entities/src/generated/decode-data-xml.ts create mode 100644 node_modules/entities/src/generated/encode-html.ts create mode 100644 node_modules/entities/src/index.spec.ts create mode 100644 node_modules/entities/src/index.ts create mode 100644 node_modules/errno/.jshintrc create mode 100644 node_modules/errno/.travis.yml create mode 100644 node_modules/errno/README.md create mode 100644 node_modules/errno/build.js create mode 100644 node_modules/errno/cli.js create mode 100644 node_modules/errno/custom.js create mode 100644 node_modules/errno/errno.js create mode 100644 node_modules/errno/package.json create mode 100644 node_modules/errno/test.js create mode 100644 node_modules/escape-html/LICENSE create mode 100644 node_modules/escape-html/Readme.md create mode 100644 node_modules/escape-html/index.js create mode 100644 node_modules/escape-html/package.json create mode 100644 node_modules/escape-string-regexp/index.d.ts create mode 100644 node_modules/escape-string-regexp/index.js create mode 100644 node_modules/escape-string-regexp/license create mode 100644 node_modules/escape-string-regexp/package.json create mode 100644 node_modules/escape-string-regexp/readme.md create mode 100644 node_modules/esm-import-transformer/README.md create mode 100644 node_modules/esm-import-transformer/import-transformer.js create mode 100644 node_modules/esm-import-transformer/package.json create mode 100644 node_modules/esprima/ChangeLog create mode 100644 node_modules/esprima/LICENSE.BSD create mode 100644 node_modules/esprima/README.md create mode 100644 node_modules/esprima/bin/esparse.js create mode 100644 node_modules/esprima/bin/esvalidate.js create mode 100644 node_modules/esprima/dist/esprima.js create mode 100644 node_modules/esprima/package.json create mode 100644 node_modules/etag/HISTORY.md create mode 100644 node_modules/etag/LICENSE create mode 100644 node_modules/etag/README.md create mode 100644 node_modules/etag/index.js create mode 100644 node_modules/etag/package.json create mode 100644 node_modules/evaluate-value/LICENSE create mode 100644 node_modules/evaluate-value/README.md create mode 100644 node_modules/evaluate-value/index-es5.js create mode 100644 node_modules/evaluate-value/index-es5.js.map create mode 100644 node_modules/evaluate-value/index.js create mode 100644 node_modules/evaluate-value/package.json create mode 100644 node_modules/extend-shallow/LICENSE create mode 100644 node_modules/extend-shallow/README.md create mode 100644 node_modules/extend-shallow/index.js create mode 100644 node_modules/extend-shallow/package.json create mode 100644 node_modules/fdir/LICENSE create mode 100644 node_modules/fdir/README.md create mode 100644 node_modules/fdir/dist/index.cjs create mode 100644 node_modules/fdir/dist/index.d.cts create mode 100644 node_modules/fdir/dist/index.d.mts create mode 100644 node_modules/fdir/dist/index.mjs create mode 100644 node_modules/fdir/package.json create mode 100644 node_modules/filesize/LICENSE create mode 100644 node_modules/filesize/README.md create mode 100644 node_modules/filesize/dist/filesize.cjs create mode 100644 node_modules/filesize/dist/filesize.esm.js create mode 100644 node_modules/filesize/package.json create mode 100644 node_modules/filesize/types/filesize.d.ts create mode 100644 node_modules/fill-range/LICENSE create mode 100644 node_modules/fill-range/README.md create mode 100644 node_modules/fill-range/index.js create mode 100644 node_modules/fill-range/package.json create mode 100644 node_modules/finalhandler/HISTORY.md create mode 100644 node_modules/finalhandler/LICENSE create mode 100644 node_modules/finalhandler/README.md create mode 100644 node_modules/finalhandler/SECURITY.md create mode 100644 node_modules/finalhandler/index.js create mode 100644 node_modules/finalhandler/node_modules/debug/.coveralls.yml create mode 100644 node_modules/finalhandler/node_modules/debug/.eslintrc create mode 100644 node_modules/finalhandler/node_modules/debug/.npmignore create mode 100644 node_modules/finalhandler/node_modules/debug/.travis.yml create mode 100644 node_modules/finalhandler/node_modules/debug/CHANGELOG.md create mode 100644 node_modules/finalhandler/node_modules/debug/LICENSE create mode 100644 node_modules/finalhandler/node_modules/debug/Makefile create mode 100644 node_modules/finalhandler/node_modules/debug/README.md create mode 100644 node_modules/finalhandler/node_modules/debug/component.json create mode 100644 node_modules/finalhandler/node_modules/debug/karma.conf.js create mode 100644 node_modules/finalhandler/node_modules/debug/node.js create mode 100644 node_modules/finalhandler/node_modules/debug/package.json create mode 100644 node_modules/finalhandler/node_modules/debug/src/browser.js create mode 100644 node_modules/finalhandler/node_modules/debug/src/debug.js create mode 100644 node_modules/finalhandler/node_modules/debug/src/index.js create mode 100644 node_modules/finalhandler/node_modules/debug/src/inspector-log.js create mode 100644 node_modules/finalhandler/node_modules/debug/src/node.js create mode 100644 node_modules/finalhandler/node_modules/ms/index.js create mode 100644 node_modules/finalhandler/node_modules/ms/license.md create mode 100644 node_modules/finalhandler/node_modules/ms/package.json create mode 100644 node_modules/finalhandler/node_modules/ms/readme.md create mode 100644 node_modules/finalhandler/package.json create mode 100644 node_modules/fresh/HISTORY.md create mode 100644 node_modules/fresh/LICENSE create mode 100644 node_modules/fresh/README.md create mode 100644 node_modules/fresh/index.js create mode 100644 node_modules/fresh/package.json create mode 100644 node_modules/glob-parent/CHANGELOG.md create mode 100644 node_modules/glob-parent/LICENSE create mode 100644 node_modules/glob-parent/README.md create mode 100644 node_modules/glob-parent/index.js create mode 100644 node_modules/glob-parent/package.json create mode 100644 node_modules/gray-matter/CHANGELOG.md create mode 100644 node_modules/gray-matter/LICENSE create mode 100644 node_modules/gray-matter/README.md create mode 100644 node_modules/gray-matter/gray-matter.d.ts create mode 100644 node_modules/gray-matter/index.js create mode 100644 node_modules/gray-matter/lib/defaults.js create mode 100644 node_modules/gray-matter/lib/engine.js create mode 100644 node_modules/gray-matter/lib/engines.js create mode 100644 node_modules/gray-matter/lib/excerpt.js create mode 100644 node_modules/gray-matter/lib/parse.js create mode 100644 node_modules/gray-matter/lib/stringify.js create mode 100644 node_modules/gray-matter/lib/to-file.js create mode 100644 node_modules/gray-matter/lib/utils.js create mode 100644 node_modules/gray-matter/node_modules/.bin/js-yaml create mode 100644 node_modules/gray-matter/node_modules/.bin/js-yaml.cmd create mode 100644 node_modules/gray-matter/node_modules/.bin/js-yaml.ps1 create mode 100644 node_modules/gray-matter/node_modules/argparse/CHANGELOG.md create mode 100644 node_modules/gray-matter/node_modules/argparse/LICENSE create mode 100644 node_modules/gray-matter/node_modules/argparse/README.md create mode 100644 node_modules/gray-matter/node_modules/argparse/index.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action/append.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action/append/constant.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action/count.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action/help.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action/store.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action/store/constant.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action/store/false.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action/store/true.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action/subparsers.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action/version.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/action_container.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/argparse.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/argument/error.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/argument/exclusive.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/argument/group.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/argument_parser.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/const.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/help/added_formatters.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/help/formatter.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/namespace.js create mode 100644 node_modules/gray-matter/node_modules/argparse/lib/utils.js create mode 100644 node_modules/gray-matter/node_modules/argparse/package.json create mode 100644 node_modules/gray-matter/node_modules/js-yaml/LICENSE create mode 100644 node_modules/gray-matter/node_modules/js-yaml/README.md create mode 100644 node_modules/gray-matter/node_modules/js-yaml/bin/js-yaml.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/dist/js-yaml.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/dist/js-yaml.min.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/index.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/common.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/dumper.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/exception.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/loader.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/mark.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_full.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/binary.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/float.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/int.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/function.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/map.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/merge.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/null.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/omap.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/pairs.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/set.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/str.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js create mode 100644 node_modules/gray-matter/node_modules/js-yaml/package.json create mode 100644 node_modules/gray-matter/package.json create mode 100644 node_modules/htmlparser2/LICENSE create mode 100644 node_modules/htmlparser2/README.md create mode 100644 node_modules/htmlparser2/lib/FeedHandler.d.ts create mode 100644 node_modules/htmlparser2/lib/FeedHandler.d.ts.map create mode 100644 node_modules/htmlparser2/lib/FeedHandler.js create mode 100644 node_modules/htmlparser2/lib/Parser.d.ts create mode 100644 node_modules/htmlparser2/lib/Parser.d.ts.map create mode 100644 node_modules/htmlparser2/lib/Parser.js create mode 100644 node_modules/htmlparser2/lib/Tokenizer.d.ts create mode 100644 node_modules/htmlparser2/lib/Tokenizer.d.ts.map create mode 100644 node_modules/htmlparser2/lib/Tokenizer.js create mode 100644 node_modules/htmlparser2/lib/WritableStream.d.ts create mode 100644 node_modules/htmlparser2/lib/WritableStream.d.ts.map create mode 100644 node_modules/htmlparser2/lib/WritableStream.js create mode 100644 node_modules/htmlparser2/lib/index.d.ts create mode 100644 node_modules/htmlparser2/lib/index.d.ts.map create mode 100644 node_modules/htmlparser2/lib/index.js create mode 100644 node_modules/htmlparser2/node_modules/entities/LICENSE create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/decode.d.ts create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/decode.d.ts.map create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/decode.js create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.d.ts create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.d.ts.map create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.js create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/encode-trie.d.ts create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/encode-trie.d.ts.map create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/encode-trie.js create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/encode.d.ts create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/encode.d.ts.map create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/encode.js create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/generated/decode-data-html.d.ts create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/generated/decode-data-html.d.ts.map create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/generated/decode-data-html.js create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/generated/decode-data-xml.d.ts create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/generated/decode-data-xml.d.ts.map create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/generated/decode-data-xml.js create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/index.d.ts create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/index.d.ts.map create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/index.js create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/maps/entities.json create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/maps/legacy.json create mode 100644 node_modules/htmlparser2/node_modules/entities/lib/maps/xml.json create mode 100644 node_modules/htmlparser2/node_modules/entities/package.json create mode 100644 node_modules/htmlparser2/node_modules/entities/readme.md create mode 100644 node_modules/htmlparser2/package.json create mode 100644 node_modules/http-equiv-refresh/README.md create mode 100644 node_modules/http-equiv-refresh/index-es5.js create mode 100644 node_modules/http-equiv-refresh/index-es5.js.map create mode 100644 node_modules/http-equiv-refresh/index.js create mode 100644 node_modules/http-equiv-refresh/license create mode 100644 node_modules/http-equiv-refresh/package.json create mode 100644 node_modules/http-errors/HISTORY.md create mode 100644 node_modules/http-errors/LICENSE create mode 100644 node_modules/http-errors/README.md create mode 100644 node_modules/http-errors/index.js create mode 100644 node_modules/http-errors/package.json create mode 100644 node_modules/inherits/LICENSE create mode 100644 node_modules/inherits/README.md create mode 100644 node_modules/inherits/inherits.js create mode 100644 node_modules/inherits/inherits_browser.js create mode 100644 node_modules/inherits/package.json create mode 100644 node_modules/is-alphabetical/index.d.ts create mode 100644 node_modules/is-alphabetical/index.js create mode 100644 node_modules/is-alphabetical/license create mode 100644 node_modules/is-alphabetical/package.json create mode 100644 node_modules/is-alphabetical/readme.md create mode 100644 node_modules/is-alphanumerical/index.d.ts create mode 100644 node_modules/is-alphanumerical/index.js create mode 100644 node_modules/is-alphanumerical/license create mode 100644 node_modules/is-alphanumerical/package.json create mode 100644 node_modules/is-alphanumerical/readme.md create mode 100644 node_modules/is-binary-path/index.d.ts create mode 100644 node_modules/is-binary-path/index.js create mode 100644 node_modules/is-binary-path/license create mode 100644 node_modules/is-binary-path/package.json create mode 100644 node_modules/is-binary-path/readme.md create mode 100644 node_modules/is-decimal/index.d.ts create mode 100644 node_modules/is-decimal/index.js create mode 100644 node_modules/is-decimal/license create mode 100644 node_modules/is-decimal/package.json create mode 100644 node_modules/is-decimal/readme.md create mode 100644 node_modules/is-extendable/LICENSE create mode 100644 node_modules/is-extendable/README.md create mode 100644 node_modules/is-extendable/index.js create mode 100644 node_modules/is-extendable/package.json create mode 100644 node_modules/is-extglob/LICENSE create mode 100644 node_modules/is-extglob/README.md create mode 100644 node_modules/is-extglob/index.js create mode 100644 node_modules/is-extglob/package.json create mode 100644 node_modules/is-glob/LICENSE create mode 100644 node_modules/is-glob/README.md create mode 100644 node_modules/is-glob/index.js create mode 100644 node_modules/is-glob/package.json create mode 100644 node_modules/is-json/.npmignore create mode 100644 node_modules/is-json/.travis.yml create mode 100644 node_modules/is-json/LICENSE create mode 100644 node_modules/is-json/README.md create mode 100644 node_modules/is-json/index.js create mode 100644 node_modules/is-json/package.json create mode 100644 node_modules/is-json/test/index.js create mode 100644 node_modules/is-number/LICENSE create mode 100644 node_modules/is-number/README.md create mode 100644 node_modules/is-number/index.js create mode 100644 node_modules/is-number/package.json create mode 100644 node_modules/iso-639-1/.eslintrc create mode 100644 node_modules/iso-639-1/.nvmrc create mode 100644 node_modules/iso-639-1/.prettierrc create mode 100644 node_modules/iso-639-1/.travis.yml create mode 100644 node_modules/iso-639-1/.vscode/settings.json create mode 100644 node_modules/iso-639-1/CHANGELOG.md create mode 100644 node_modules/iso-639-1/LICENSE create mode 100644 node_modules/iso-639-1/build/index.js create mode 100644 node_modules/iso-639-1/index.d.ts create mode 100644 node_modules/iso-639-1/package.json create mode 100644 node_modules/iso-639-1/readme.md create mode 100644 node_modules/iso-639-1/src/data.js create mode 100644 node_modules/iso-639-1/src/index.js create mode 100644 node_modules/iso-639-1/test/test.js create mode 100644 node_modules/iso-639-1/webpack.config.js create mode 100644 node_modules/js-yaml/LICENSE create mode 100644 node_modules/js-yaml/README.md create mode 100644 node_modules/js-yaml/bin/js-yaml.js create mode 100644 node_modules/js-yaml/dist/js-yaml.js create mode 100644 node_modules/js-yaml/dist/js-yaml.js.map create mode 100644 node_modules/js-yaml/dist/js-yaml.min.js create mode 100644 node_modules/js-yaml/dist/js-yaml.min.js.map create mode 100644 node_modules/js-yaml/dist/js-yaml.mjs create mode 100644 node_modules/js-yaml/dist/js-yaml.mjs.map create mode 100644 node_modules/js-yaml/index.js create mode 100644 node_modules/js-yaml/lib/common.js create mode 100644 node_modules/js-yaml/lib/dumper.js create mode 100644 node_modules/js-yaml/lib/exception.js create mode 100644 node_modules/js-yaml/lib/index_vite_proxy.tmp.mjs create mode 100644 node_modules/js-yaml/lib/loader.js create mode 100644 node_modules/js-yaml/lib/schema.js create mode 100644 node_modules/js-yaml/lib/schema/core.js create mode 100644 node_modules/js-yaml/lib/schema/default.js create mode 100644 node_modules/js-yaml/lib/schema/failsafe.js create mode 100644 node_modules/js-yaml/lib/schema/json.js create mode 100644 node_modules/js-yaml/lib/snippet.js create mode 100644 node_modules/js-yaml/lib/type.js create mode 100644 node_modules/js-yaml/lib/type/binary.js create mode 100644 node_modules/js-yaml/lib/type/bool.js create mode 100644 node_modules/js-yaml/lib/type/float.js create mode 100644 node_modules/js-yaml/lib/type/int.js create mode 100644 node_modules/js-yaml/lib/type/map.js create mode 100644 node_modules/js-yaml/lib/type/merge.js create mode 100644 node_modules/js-yaml/lib/type/null.js create mode 100644 node_modules/js-yaml/lib/type/omap.js create mode 100644 node_modules/js-yaml/lib/type/pairs.js create mode 100644 node_modules/js-yaml/lib/type/seq.js create mode 100644 node_modules/js-yaml/lib/type/set.js create mode 100644 node_modules/js-yaml/lib/type/str.js create mode 100644 node_modules/js-yaml/lib/type/timestamp.js create mode 100644 node_modules/js-yaml/package.json create mode 100644 node_modules/junk/index.d.ts create mode 100644 node_modules/junk/index.js create mode 100644 node_modules/junk/license create mode 100644 node_modules/junk/package.json create mode 100644 node_modules/junk/readme.md create mode 100644 node_modules/kind-of/CHANGELOG.md create mode 100644 node_modules/kind-of/LICENSE create mode 100644 node_modules/kind-of/README.md create mode 100644 node_modules/kind-of/index.js create mode 100644 node_modules/kind-of/package.json create mode 100644 node_modules/kleur/colors.d.ts create mode 100644 node_modules/kleur/colors.js create mode 100644 node_modules/kleur/colors.mjs create mode 100644 node_modules/kleur/index.d.ts create mode 100644 node_modules/kleur/index.js create mode 100644 node_modules/kleur/index.mjs create mode 100644 node_modules/kleur/license create mode 100644 node_modules/kleur/package.json create mode 100644 node_modules/kleur/readme.md create mode 100644 node_modules/linkify-it/LICENSE create mode 100644 node_modules/linkify-it/README.md create mode 100644 node_modules/linkify-it/build/index.cjs.js create mode 100644 node_modules/linkify-it/index.mjs create mode 100644 node_modules/linkify-it/lib/re.mjs create mode 100644 node_modules/linkify-it/package.json create mode 100644 node_modules/liquidjs/LICENSE create mode 100644 node_modules/liquidjs/README.md create mode 100644 node_modules/liquidjs/bin/liquid.js create mode 100644 node_modules/liquidjs/dist/build/base64-impl-browser.d.ts create mode 100644 node_modules/liquidjs/dist/build/base64-impl-browser.spec.d.ts create mode 100644 node_modules/liquidjs/dist/build/crypto-impl-browser.d.ts create mode 100644 node_modules/liquidjs/dist/build/crypto-impl-browser.spec.d.ts create mode 100644 node_modules/liquidjs/dist/build/fs-impl-browser.d.ts create mode 100644 node_modules/liquidjs/dist/build/fs-impl-browser.spec.d.ts create mode 100644 node_modules/liquidjs/dist/build/streamed-emitter-browser.d.ts create mode 100644 node_modules/liquidjs/dist/build/streamed-emitter-browser.spec.d.ts create mode 100644 node_modules/liquidjs/dist/cache/cache.d.ts create mode 100644 node_modules/liquidjs/dist/cache/index.d.ts create mode 100644 node_modules/liquidjs/dist/cache/lru.d.ts create mode 100644 node_modules/liquidjs/dist/cache/lru.spec.d.ts create mode 100644 node_modules/liquidjs/dist/context/block-mode.d.ts create mode 100644 node_modules/liquidjs/dist/context/context.d.ts create mode 100644 node_modules/liquidjs/dist/context/context.spec.d.ts create mode 100644 node_modules/liquidjs/dist/context/index.d.ts create mode 100644 node_modules/liquidjs/dist/context/scope.d.ts create mode 100644 node_modules/liquidjs/dist/drop/blank-drop.d.ts create mode 100644 node_modules/liquidjs/dist/drop/block-drop.d.ts create mode 100644 node_modules/liquidjs/dist/drop/comparable.d.ts create mode 100644 node_modules/liquidjs/dist/drop/drop.d.ts create mode 100644 node_modules/liquidjs/dist/drop/empty-drop.d.ts create mode 100644 node_modules/liquidjs/dist/drop/forloop-drop.d.ts create mode 100644 node_modules/liquidjs/dist/drop/index.d.ts create mode 100644 node_modules/liquidjs/dist/drop/null-drop.d.ts create mode 100644 node_modules/liquidjs/dist/drop/tablerowloop-drop.d.ts create mode 100644 node_modules/liquidjs/dist/emitters/emitter.d.ts create mode 100644 node_modules/liquidjs/dist/emitters/index.d.ts create mode 100644 node_modules/liquidjs/dist/emitters/keeping-type-emitter.d.ts create mode 100644 node_modules/liquidjs/dist/emitters/simple-emitter.d.ts create mode 100644 node_modules/liquidjs/dist/emitters/streamed-emitter.d.ts create mode 100644 node_modules/liquidjs/dist/filters/array.d.ts create mode 100644 node_modules/liquidjs/dist/filters/base64-impl.d.ts create mode 100644 node_modules/liquidjs/dist/filters/base64.d.ts create mode 100644 node_modules/liquidjs/dist/filters/crypto-impl.d.ts create mode 100644 node_modules/liquidjs/dist/filters/crypto.d.ts create mode 100644 node_modules/liquidjs/dist/filters/date.d.ts create mode 100644 node_modules/liquidjs/dist/filters/html.d.ts create mode 100644 node_modules/liquidjs/dist/filters/index.d.ts create mode 100644 node_modules/liquidjs/dist/filters/math.d.ts create mode 100644 node_modules/liquidjs/dist/filters/misc.d.ts create mode 100644 node_modules/liquidjs/dist/filters/string.d.ts create mode 100644 node_modules/liquidjs/dist/filters/url.d.ts create mode 100644 node_modules/liquidjs/dist/fs/fs-impl.d.ts create mode 100644 node_modules/liquidjs/dist/fs/fs-impl.spec.d.ts create mode 100644 node_modules/liquidjs/dist/fs/fs.d.ts create mode 100644 node_modules/liquidjs/dist/fs/index.d.ts create mode 100644 node_modules/liquidjs/dist/fs/loader.d.ts create mode 100644 node_modules/liquidjs/dist/fs/loader.spec.d.ts create mode 100644 node_modules/liquidjs/dist/fs/map-fs.d.ts create mode 100644 node_modules/liquidjs/dist/fs/map-fs.spec.d.ts create mode 100644 node_modules/liquidjs/dist/fs/node-require.d.ts create mode 100644 node_modules/liquidjs/dist/index.d.ts create mode 100644 node_modules/liquidjs/dist/liquid-options.d.ts create mode 100644 node_modules/liquidjs/dist/liquid-options.spec.d.ts create mode 100644 node_modules/liquidjs/dist/liquid.browser.min.js create mode 100644 node_modules/liquidjs/dist/liquid.browser.min.js.map create mode 100644 node_modules/liquidjs/dist/liquid.browser.mjs create mode 100644 node_modules/liquidjs/dist/liquid.browser.umd.js create mode 100644 node_modules/liquidjs/dist/liquid.browser.umd.js.map create mode 100644 node_modules/liquidjs/dist/liquid.d.ts create mode 100644 node_modules/liquidjs/dist/liquid.node.js create mode 100644 node_modules/liquidjs/dist/liquid.node.mjs create mode 100644 node_modules/liquidjs/dist/parser/filter-arg.d.ts create mode 100644 node_modules/liquidjs/dist/parser/index.d.ts create mode 100644 node_modules/liquidjs/dist/parser/parse-stream.d.ts create mode 100644 node_modules/liquidjs/dist/parser/parse-stream.spec.d.ts create mode 100644 node_modules/liquidjs/dist/parser/parser.d.ts create mode 100644 node_modules/liquidjs/dist/parser/parser.spec.d.ts create mode 100644 node_modules/liquidjs/dist/parser/token-kind.d.ts create mode 100644 node_modules/liquidjs/dist/parser/tokenizer.d.ts create mode 100644 node_modules/liquidjs/dist/parser/tokenizer.spec.d.ts create mode 100644 node_modules/liquidjs/dist/parser/whitespace-ctrl.d.ts create mode 100644 node_modules/liquidjs/dist/render/boolean.d.ts create mode 100644 node_modules/liquidjs/dist/render/boolean.spec.d.ts create mode 100644 node_modules/liquidjs/dist/render/expression.d.ts create mode 100644 node_modules/liquidjs/dist/render/expression.spec.d.ts create mode 100644 node_modules/liquidjs/dist/render/index.d.ts create mode 100644 node_modules/liquidjs/dist/render/operator.d.ts create mode 100644 node_modules/liquidjs/dist/render/render.d.ts create mode 100644 node_modules/liquidjs/dist/render/render.spec.d.ts create mode 100644 node_modules/liquidjs/dist/render/string.d.ts create mode 100644 node_modules/liquidjs/dist/render/string.spec.d.ts create mode 100644 node_modules/liquidjs/dist/tags/assign.d.ts create mode 100644 node_modules/liquidjs/dist/tags/block.d.ts create mode 100644 node_modules/liquidjs/dist/tags/break.d.ts create mode 100644 node_modules/liquidjs/dist/tags/capture.d.ts create mode 100644 node_modules/liquidjs/dist/tags/case.d.ts create mode 100644 node_modules/liquidjs/dist/tags/comment.d.ts create mode 100644 node_modules/liquidjs/dist/tags/continue.d.ts create mode 100644 node_modules/liquidjs/dist/tags/cycle.d.ts create mode 100644 node_modules/liquidjs/dist/tags/decrement.d.ts create mode 100644 node_modules/liquidjs/dist/tags/echo.d.ts create mode 100644 node_modules/liquidjs/dist/tags/for.d.ts create mode 100644 node_modules/liquidjs/dist/tags/if.d.ts create mode 100644 node_modules/liquidjs/dist/tags/include.d.ts create mode 100644 node_modules/liquidjs/dist/tags/increment.d.ts create mode 100644 node_modules/liquidjs/dist/tags/index.d.ts create mode 100644 node_modules/liquidjs/dist/tags/inline-comment.d.ts create mode 100644 node_modules/liquidjs/dist/tags/layout.d.ts create mode 100644 node_modules/liquidjs/dist/tags/liquid.d.ts create mode 100644 node_modules/liquidjs/dist/tags/raw.d.ts create mode 100644 node_modules/liquidjs/dist/tags/render.d.ts create mode 100644 node_modules/liquidjs/dist/tags/tablerow.d.ts create mode 100644 node_modules/liquidjs/dist/tags/unless.d.ts create mode 100644 node_modules/liquidjs/dist/template/analysis.d.ts create mode 100644 node_modules/liquidjs/dist/template/analysis.spec.d.ts create mode 100644 node_modules/liquidjs/dist/template/filter-impl-options.d.ts create mode 100644 node_modules/liquidjs/dist/template/filter.d.ts create mode 100644 node_modules/liquidjs/dist/template/filter.spec.d.ts create mode 100644 node_modules/liquidjs/dist/template/hash.d.ts create mode 100644 node_modules/liquidjs/dist/template/hash.spec.d.ts create mode 100644 node_modules/liquidjs/dist/template/html.d.ts create mode 100644 node_modules/liquidjs/dist/template/index.d.ts create mode 100644 node_modules/liquidjs/dist/template/output.d.ts create mode 100644 node_modules/liquidjs/dist/template/output.spec.d.ts create mode 100644 node_modules/liquidjs/dist/template/tag-options-adapter.d.ts create mode 100644 node_modules/liquidjs/dist/template/tag.d.ts create mode 100644 node_modules/liquidjs/dist/template/template-impl.d.ts create mode 100644 node_modules/liquidjs/dist/template/template.d.ts create mode 100644 node_modules/liquidjs/dist/template/value.d.ts create mode 100644 node_modules/liquidjs/dist/template/value.spec.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/delimited-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/filter-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/filtered-value-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/hash-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/html-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/identifier-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/index.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/liquid-tag-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/literal-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/number-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/operator-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/output-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/property-access-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/quoted-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/range-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/tag-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/top-level-token.d.ts create mode 100644 node_modules/liquidjs/dist/tokens/value-token.d.ts create mode 100644 node_modules/liquidjs/dist/util/assert.d.ts create mode 100644 node_modules/liquidjs/dist/util/assert.spec.d.ts create mode 100644 node_modules/liquidjs/dist/util/async.d.ts create mode 100644 node_modules/liquidjs/dist/util/async.spec.d.ts create mode 100644 node_modules/liquidjs/dist/util/character.d.ts create mode 100644 node_modules/liquidjs/dist/util/error.d.ts create mode 100644 node_modules/liquidjs/dist/util/error.spec.d.ts create mode 100644 node_modules/liquidjs/dist/util/index.d.ts create mode 100644 node_modules/liquidjs/dist/util/intl.d.ts create mode 100644 node_modules/liquidjs/dist/util/limiter.d.ts create mode 100644 node_modules/liquidjs/dist/util/liquid-date.d.ts create mode 100644 node_modules/liquidjs/dist/util/liquid-date.spec.d.ts create mode 100644 node_modules/liquidjs/dist/util/literal.d.ts create mode 100644 node_modules/liquidjs/dist/util/operator-trie.d.ts create mode 100644 node_modules/liquidjs/dist/util/performance.d.ts create mode 100644 node_modules/liquidjs/dist/util/performance.spec.d.ts create mode 100644 node_modules/liquidjs/dist/util/strftime.d.ts create mode 100644 node_modules/liquidjs/dist/util/strftime.spec.d.ts create mode 100644 node_modules/liquidjs/dist/util/type-guards.d.ts create mode 100644 node_modules/liquidjs/dist/util/type-guards.spec.d.ts create mode 100644 node_modules/liquidjs/dist/util/underscore.d.ts create mode 100644 node_modules/liquidjs/dist/util/underscore.spec.d.ts create mode 100644 node_modules/liquidjs/package.json create mode 100644 node_modules/list-to-array/.npmignore create mode 100644 node_modules/list-to-array/LICENSE create mode 100644 node_modules/list-to-array/README.md create mode 100644 node_modules/list-to-array/index.js create mode 100644 node_modules/list-to-array/package.json create mode 100644 node_modules/list-to-array/tests.js create mode 100644 node_modules/luxon/LICENSE.md create mode 100644 node_modules/luxon/README.md create mode 100644 node_modules/luxon/build/amd/luxon.js create mode 100644 node_modules/luxon/build/amd/luxon.js.map create mode 100644 node_modules/luxon/build/cjs-browser/luxon.js create mode 100644 node_modules/luxon/build/cjs-browser/luxon.js.map create mode 100644 node_modules/luxon/build/es6/luxon.mjs create mode 100644 node_modules/luxon/build/es6/luxon.mjs.map create mode 100644 node_modules/luxon/build/global/luxon.js create mode 100644 node_modules/luxon/build/global/luxon.js.map create mode 100644 node_modules/luxon/build/global/luxon.min.js create mode 100644 node_modules/luxon/build/global/luxon.min.js.map create mode 100644 node_modules/luxon/build/node/luxon.js create mode 100644 node_modules/luxon/build/node/luxon.js.map create mode 100644 node_modules/luxon/package.json create mode 100644 node_modules/luxon/src/datetime.js create mode 100644 node_modules/luxon/src/duration.js create mode 100644 node_modules/luxon/src/errors.js create mode 100644 node_modules/luxon/src/impl/conversions.js create mode 100644 node_modules/luxon/src/impl/diff.js create mode 100644 node_modules/luxon/src/impl/digits.js create mode 100644 node_modules/luxon/src/impl/english.js create mode 100644 node_modules/luxon/src/impl/formats.js create mode 100644 node_modules/luxon/src/impl/formatter.js create mode 100644 node_modules/luxon/src/impl/invalid.js create mode 100644 node_modules/luxon/src/impl/locale.js create mode 100644 node_modules/luxon/src/impl/regexParser.js create mode 100644 node_modules/luxon/src/impl/tokenParser.js create mode 100644 node_modules/luxon/src/impl/util.js create mode 100644 node_modules/luxon/src/impl/zoneUtil.js create mode 100644 node_modules/luxon/src/info.js create mode 100644 node_modules/luxon/src/interval.js create mode 100644 node_modules/luxon/src/luxon.js create mode 100644 node_modules/luxon/src/package.json create mode 100644 node_modules/luxon/src/settings.js create mode 100644 node_modules/luxon/src/zone.js create mode 100644 node_modules/luxon/src/zones/IANAZone.js create mode 100644 node_modules/luxon/src/zones/fixedOffsetZone.js create mode 100644 node_modules/luxon/src/zones/invalidZone.js create mode 100644 node_modules/luxon/src/zones/systemZone.js create mode 100644 node_modules/markdown-it/LICENSE create mode 100644 node_modules/markdown-it/README.md create mode 100644 node_modules/markdown-it/bin/markdown-it.mjs create mode 100644 node_modules/markdown-it/dist/index.cjs.js create mode 100644 node_modules/markdown-it/dist/index.cjs.js.map create mode 100644 node_modules/markdown-it/dist/markdown-it.js create mode 100644 node_modules/markdown-it/dist/markdown-it.js.map create mode 100644 node_modules/markdown-it/dist/markdown-it.min.js create mode 100644 node_modules/markdown-it/dist/markdown-it.min.js.map create mode 100644 node_modules/markdown-it/index.mjs create mode 100644 node_modules/markdown-it/lib/common/html_blocks.mjs create mode 100644 node_modules/markdown-it/lib/common/html_re.mjs create mode 100644 node_modules/markdown-it/lib/common/utils.mjs create mode 100644 node_modules/markdown-it/lib/helpers/index.mjs create mode 100644 node_modules/markdown-it/lib/helpers/parse_link_destination.mjs create mode 100644 node_modules/markdown-it/lib/helpers/parse_link_label.mjs create mode 100644 node_modules/markdown-it/lib/helpers/parse_link_title.mjs create mode 100644 node_modules/markdown-it/lib/index.mjs create mode 100644 node_modules/markdown-it/lib/parser_block.mjs create mode 100644 node_modules/markdown-it/lib/parser_core.mjs create mode 100644 node_modules/markdown-it/lib/parser_inline.mjs create mode 100644 node_modules/markdown-it/lib/presets/commonmark.mjs create mode 100644 node_modules/markdown-it/lib/presets/default.mjs create mode 100644 node_modules/markdown-it/lib/presets/zero.mjs create mode 100644 node_modules/markdown-it/lib/renderer.mjs create mode 100644 node_modules/markdown-it/lib/ruler.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/blockquote.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/code.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/fence.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/heading.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/hr.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/html_block.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/lheading.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/list.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/paragraph.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/reference.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/state_block.mjs create mode 100644 node_modules/markdown-it/lib/rules_block/table.mjs create mode 100644 node_modules/markdown-it/lib/rules_core/block.mjs create mode 100644 node_modules/markdown-it/lib/rules_core/inline.mjs create mode 100644 node_modules/markdown-it/lib/rules_core/linkify.mjs create mode 100644 node_modules/markdown-it/lib/rules_core/normalize.mjs create mode 100644 node_modules/markdown-it/lib/rules_core/replacements.mjs create mode 100644 node_modules/markdown-it/lib/rules_core/smartquotes.mjs create mode 100644 node_modules/markdown-it/lib/rules_core/state_core.mjs create mode 100644 node_modules/markdown-it/lib/rules_core/text_join.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/autolink.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/backticks.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/emphasis.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/entity.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/escape.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/fragments_join.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/html_inline.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/image.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/link.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/linkify.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/newline.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/state_inline.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/strikethrough.mjs create mode 100644 node_modules/markdown-it/lib/rules_inline/text.mjs create mode 100644 node_modules/markdown-it/lib/token.mjs create mode 100644 node_modules/markdown-it/node_modules/entities/LICENSE create mode 100644 node_modules/markdown-it/node_modules/entities/lib/decode.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/decode.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/decode.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/decode.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/decode_codepoint.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/encode.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/encode.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/encode.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/encode.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/escape.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/escape.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/escape.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/escape.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/decode.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/decode.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/decode.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/decode.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/decode_codepoint.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/encode.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/encode.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/encode.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/encode.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/escape.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/escape.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/escape.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-html.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/decode-data-xml.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/generated/encode-html.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/index.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/index.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/index.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/index.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/esm/package.json create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-html.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/decode-data-xml.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/generated/encode-html.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/index.d.ts create mode 100644 node_modules/markdown-it/node_modules/entities/lib/index.d.ts.map create mode 100644 node_modules/markdown-it/node_modules/entities/lib/index.js create mode 100644 node_modules/markdown-it/node_modules/entities/lib/index.js.map create mode 100644 node_modules/markdown-it/node_modules/entities/package.json create mode 100644 node_modules/markdown-it/node_modules/entities/readme.md create mode 100644 node_modules/markdown-it/package.json create mode 100644 node_modules/mdurl/LICENSE create mode 100644 node_modules/mdurl/README.md create mode 100644 node_modules/mdurl/build/index.cjs.js create mode 100644 node_modules/mdurl/index.mjs create mode 100644 node_modules/mdurl/lib/decode.mjs create mode 100644 node_modules/mdurl/lib/encode.mjs create mode 100644 node_modules/mdurl/lib/format.mjs create mode 100644 node_modules/mdurl/lib/parse.mjs create mode 100644 node_modules/mdurl/package.json create mode 100644 node_modules/mime-db/HISTORY.md create mode 100644 node_modules/mime-db/LICENSE create mode 100644 node_modules/mime-db/README.md create mode 100644 node_modules/mime-db/db.json create mode 100644 node_modules/mime-db/index.js create mode 100644 node_modules/mime-db/package.json create mode 100644 node_modules/mime-types/HISTORY.md create mode 100644 node_modules/mime-types/LICENSE create mode 100644 node_modules/mime-types/README.md create mode 100644 node_modules/mime-types/index.js create mode 100644 node_modules/mime-types/mimeScore.js create mode 100644 node_modules/mime-types/package.json create mode 100644 node_modules/mime/CHANGELOG.md create mode 100644 node_modules/mime/LICENSE create mode 100644 node_modules/mime/Mime.js create mode 100644 node_modules/mime/README.md create mode 100644 node_modules/mime/cli.js create mode 100644 node_modules/mime/index.js create mode 100644 node_modules/mime/lite.js create mode 100644 node_modules/mime/package.json create mode 100644 node_modules/mime/types/other.js create mode 100644 node_modules/mime/types/standard.js create mode 100644 node_modules/minimatch/LICENSE create mode 100644 node_modules/minimatch/README.md create mode 100644 node_modules/minimatch/minimatch.js create mode 100644 node_modules/minimatch/package.json create mode 100644 node_modules/minimist/.eslintrc create mode 100644 node_modules/minimist/.github/FUNDING.yml create mode 100644 node_modules/minimist/.nycrc create mode 100644 node_modules/minimist/CHANGELOG.md create mode 100644 node_modules/minimist/LICENSE create mode 100644 node_modules/minimist/README.md create mode 100644 node_modules/minimist/example/parse.js create mode 100644 node_modules/minimist/index.js create mode 100644 node_modules/minimist/package.json create mode 100644 node_modules/minimist/test/all_bool.js create mode 100644 node_modules/minimist/test/bool.js create mode 100644 node_modules/minimist/test/dash.js create mode 100644 node_modules/minimist/test/default_bool.js create mode 100644 node_modules/minimist/test/dotted.js create mode 100644 node_modules/minimist/test/kv_short.js create mode 100644 node_modules/minimist/test/long.js create mode 100644 node_modules/minimist/test/num.js create mode 100644 node_modules/minimist/test/parse.js create mode 100644 node_modules/minimist/test/parse_modified.js create mode 100644 node_modules/minimist/test/proto.js create mode 100644 node_modules/minimist/test/short.js create mode 100644 node_modules/minimist/test/stop_early.js create mode 100644 node_modules/minimist/test/unknown.js create mode 100644 node_modules/minimist/test/whitespace.js create mode 100644 node_modules/minipass/LICENSE.md create mode 100644 node_modules/minipass/README.md create mode 100644 node_modules/minipass/dist/commonjs/index.d.ts create mode 100644 node_modules/minipass/dist/commonjs/index.d.ts.map create mode 100644 node_modules/minipass/dist/commonjs/index.js create mode 100644 node_modules/minipass/dist/commonjs/index.js.map create mode 100644 node_modules/minipass/dist/commonjs/package.json create mode 100644 node_modules/minipass/dist/esm/index.d.ts create mode 100644 node_modules/minipass/dist/esm/index.d.ts.map create mode 100644 node_modules/minipass/dist/esm/index.js create mode 100644 node_modules/minipass/dist/esm/index.js.map create mode 100644 node_modules/minipass/dist/esm/package.json create mode 100644 node_modules/minipass/package.json create mode 100644 node_modules/moo/LICENSE create mode 100644 node_modules/moo/README.md create mode 100644 node_modules/moo/moo.js create mode 100644 node_modules/moo/package.json create mode 100644 node_modules/morphdom/CHANGELOG.md create mode 100644 node_modules/morphdom/LICENSE create mode 100644 node_modules/morphdom/README.md create mode 100644 node_modules/morphdom/dist/morphdom-esm.js create mode 100644 node_modules/morphdom/dist/morphdom-factory.js create mode 100644 node_modules/morphdom/dist/morphdom-umd.js create mode 100644 node_modules/morphdom/dist/morphdom-umd.min.js create mode 100644 node_modules/morphdom/dist/morphdom.js create mode 100644 node_modules/morphdom/docs/old-benchmark.md create mode 100644 node_modules/morphdom/docs/virtual-dom.md create mode 100644 node_modules/morphdom/factory.js create mode 100644 node_modules/morphdom/index.d.ts create mode 100644 node_modules/morphdom/package.json create mode 100644 node_modules/morphdom/src/index.js create mode 100644 node_modules/morphdom/src/morphAttrs.js create mode 100644 node_modules/morphdom/src/morphdom.js create mode 100644 node_modules/morphdom/src/specialElHandlers.js create mode 100644 node_modules/morphdom/src/util.js create mode 100644 node_modules/ms/index.js create mode 100644 node_modules/ms/license.md create mode 100644 node_modules/ms/package.json create mode 100644 node_modules/ms/readme.md create mode 100644 node_modules/node-retrieve-globals/LICENSE create mode 100644 node_modules/node-retrieve-globals/README.md create mode 100644 node_modules/node-retrieve-globals/package.json create mode 100644 node_modules/node-retrieve-globals/retrieveGlobals.js create mode 100644 node_modules/node-retrieve-globals/util/getWorkingDirectory.js create mode 100644 node_modules/node-retrieve-globals/util/vmModules.js create mode 100644 node_modules/normalize-path/LICENSE create mode 100644 node_modules/normalize-path/README.md create mode 100644 node_modules/normalize-path/index.js create mode 100644 node_modules/normalize-path/package.json create mode 100644 node_modules/nunjucks/LICENSE create mode 100644 node_modules/nunjucks/README.md create mode 100644 node_modules/nunjucks/bin/precompile create mode 100644 node_modules/nunjucks/bin/precompile.cmd create mode 100644 node_modules/nunjucks/browser/nunjucks-slim.js create mode 100644 node_modules/nunjucks/browser/nunjucks-slim.js.map create mode 100644 node_modules/nunjucks/browser/nunjucks-slim.min.js create mode 100644 node_modules/nunjucks/browser/nunjucks-slim.min.js.map create mode 100644 node_modules/nunjucks/browser/nunjucks.js create mode 100644 node_modules/nunjucks/browser/nunjucks.js.map create mode 100644 node_modules/nunjucks/browser/nunjucks.min.js create mode 100644 node_modules/nunjucks/browser/nunjucks.min.js.map create mode 100644 node_modules/nunjucks/index.js create mode 100644 node_modules/nunjucks/node_modules/commander/CHANGELOG.md create mode 100644 node_modules/nunjucks/node_modules/commander/LICENSE create mode 100644 node_modules/nunjucks/node_modules/commander/Readme.md create mode 100644 node_modules/nunjucks/node_modules/commander/index.js create mode 100644 node_modules/nunjucks/node_modules/commander/package.json create mode 100644 node_modules/nunjucks/node_modules/commander/typings/index.d.ts create mode 100644 node_modules/nunjucks/package.json create mode 100644 node_modules/nunjucks/src/compiler.js create mode 100644 node_modules/nunjucks/src/environment.js create mode 100644 node_modules/nunjucks/src/express-app.js create mode 100644 node_modules/nunjucks/src/filters.js create mode 100644 node_modules/nunjucks/src/globals.js create mode 100644 node_modules/nunjucks/src/jinja-compat.js create mode 100644 node_modules/nunjucks/src/lexer.js create mode 100644 node_modules/nunjucks/src/lib.js create mode 100644 node_modules/nunjucks/src/loader.js create mode 100644 node_modules/nunjucks/src/loaders.js create mode 100644 node_modules/nunjucks/src/node-loaders.js create mode 100644 node_modules/nunjucks/src/nodes.js create mode 100644 node_modules/nunjucks/src/object.js create mode 100644 node_modules/nunjucks/src/parser.js create mode 100644 node_modules/nunjucks/src/precompile-global.js create mode 100644 node_modules/nunjucks/src/precompile.js create mode 100644 node_modules/nunjucks/src/precompiled-loader.js create mode 100644 node_modules/nunjucks/src/runtime.js create mode 100644 node_modules/nunjucks/src/tests.js create mode 100644 node_modules/nunjucks/src/transformer.js create mode 100644 node_modules/nunjucks/src/web-loaders.js create mode 100644 node_modules/on-finished/HISTORY.md create mode 100644 node_modules/on-finished/LICENSE create mode 100644 node_modules/on-finished/README.md create mode 100644 node_modules/on-finished/index.js create mode 100644 node_modules/on-finished/package.json create mode 100644 node_modules/parse-srcset/.jscs.json create mode 100644 node_modules/parse-srcset/.jshintrc create mode 100644 node_modules/parse-srcset/.npmignore create mode 100644 node_modules/parse-srcset/LICENSE create mode 100644 node_modules/parse-srcset/README.md create mode 100644 node_modules/parse-srcset/package.json create mode 100644 node_modules/parse-srcset/src/parse-srcset.js create mode 100644 node_modules/parse-srcset/tests/he.js create mode 100644 node_modules/parse-srcset/tests/intern.js create mode 100644 node_modules/parse-srcset/tests/unit/ps.js create mode 100644 node_modules/parseurl/HISTORY.md create mode 100644 node_modules/parseurl/LICENSE create mode 100644 node_modules/parseurl/README.md create mode 100644 node_modules/parseurl/index.js create mode 100644 node_modules/parseurl/package.json create mode 100644 node_modules/picomatch/LICENSE create mode 100644 node_modules/picomatch/README.md create mode 100644 node_modules/picomatch/index.js create mode 100644 node_modules/picomatch/lib/constants.js create mode 100644 node_modules/picomatch/lib/parse.js create mode 100644 node_modules/picomatch/lib/picomatch.js create mode 100644 node_modules/picomatch/lib/scan.js create mode 100644 node_modules/picomatch/lib/utils.js create mode 100644 node_modules/picomatch/package.json create mode 100644 node_modules/picomatch/posix.js create mode 100644 node_modules/please-upgrade-node/.eslintrc.js create mode 100644 node_modules/please-upgrade-node/.github/FUNDING.yml create mode 100644 node_modules/please-upgrade-node/LICENSE create mode 100644 node_modules/please-upgrade-node/README.md create mode 100644 node_modules/please-upgrade-node/index.d.ts create mode 100644 node_modules/please-upgrade-node/index.js create mode 100644 node_modules/please-upgrade-node/package.json create mode 100644 node_modules/posthtml-match-helper/LICENSE create mode 100644 node_modules/posthtml-match-helper/README.md create mode 100644 node_modules/posthtml-match-helper/lib/index.d.ts create mode 100644 node_modules/posthtml-match-helper/lib/index.js create mode 100644 node_modules/posthtml-match-helper/package.json create mode 100644 node_modules/posthtml-parser/dist/chunk.2UQLUWPH.js create mode 100644 node_modules/posthtml-parser/dist/index.d.ts create mode 100644 node_modules/posthtml-parser/dist/index.js create mode 100644 node_modules/posthtml-parser/dist/location-tracker.d.ts create mode 100644 node_modules/posthtml-parser/dist/location-tracker.js create mode 100644 node_modules/posthtml-parser/license create mode 100644 node_modules/posthtml-parser/package.json create mode 100644 node_modules/posthtml-parser/readme.md create mode 100644 node_modules/posthtml-render/changelog.md create mode 100644 node_modules/posthtml-render/dist/index.d.ts create mode 100644 node_modules/posthtml-render/dist/index.js create mode 100644 node_modules/posthtml-render/license create mode 100644 node_modules/posthtml-render/package.json create mode 100644 node_modules/posthtml-render/readme.md create mode 100644 node_modules/posthtml/lib/api.js create mode 100644 node_modules/posthtml/lib/index.js create mode 100644 node_modules/posthtml/license create mode 100644 node_modules/posthtml/package.json create mode 100644 node_modules/posthtml/readme.md create mode 100644 node_modules/posthtml/types/posthtml.d.ts create mode 100644 node_modules/prr/.jshintrc create mode 100644 node_modules/prr/.npmignore create mode 100644 node_modules/prr/.travis.yml create mode 100644 node_modules/prr/LICENSE.md create mode 100644 node_modules/prr/README.md create mode 100644 node_modules/prr/package.json create mode 100644 node_modules/prr/prr.js create mode 100644 node_modules/prr/test.js create mode 100644 node_modules/punycode.js/LICENSE-MIT.txt create mode 100644 node_modules/punycode.js/README.md create mode 100644 node_modules/punycode.js/package.json create mode 100644 node_modules/punycode.js/punycode.es6.js create mode 100644 node_modules/punycode.js/punycode.js create mode 100644 node_modules/range-parser/HISTORY.md create mode 100644 node_modules/range-parser/LICENSE create mode 100644 node_modules/range-parser/README.md create mode 100644 node_modules/range-parser/index.js create mode 100644 node_modules/range-parser/package.json create mode 100644 node_modules/readdirp/LICENSE create mode 100644 node_modules/readdirp/README.md create mode 100644 node_modules/readdirp/index.d.ts create mode 100644 node_modules/readdirp/index.js create mode 100644 node_modules/readdirp/node_modules/picomatch/LICENSE create mode 100644 node_modules/readdirp/node_modules/picomatch/README.md create mode 100644 node_modules/readdirp/node_modules/picomatch/index.js create mode 100644 node_modules/readdirp/node_modules/picomatch/lib/constants.js create mode 100644 node_modules/readdirp/node_modules/picomatch/lib/parse.js create mode 100644 node_modules/readdirp/node_modules/picomatch/lib/picomatch.js create mode 100644 node_modules/readdirp/node_modules/picomatch/lib/scan.js create mode 100644 node_modules/readdirp/node_modules/picomatch/lib/utils.js create mode 100644 node_modules/readdirp/node_modules/picomatch/package.json create mode 100644 node_modules/readdirp/package.json create mode 100644 node_modules/section-matter/LICENSE create mode 100644 node_modules/section-matter/README.md create mode 100644 node_modules/section-matter/index.js create mode 100644 node_modules/section-matter/package.json create mode 100644 node_modules/semver-compare/.travis.yml create mode 100644 node_modules/semver-compare/LICENSE create mode 100644 node_modules/semver-compare/example/cmp.js create mode 100644 node_modules/semver-compare/example/lex.js create mode 100644 node_modules/semver-compare/index.js create mode 100644 node_modules/semver-compare/package.json create mode 100644 node_modules/semver-compare/readme.markdown create mode 100644 node_modules/semver-compare/test/cmp.js create mode 100644 node_modules/semver/LICENSE create mode 100644 node_modules/semver/README.md create mode 100644 node_modules/semver/bin/semver.js create mode 100644 node_modules/semver/classes/comparator.js create mode 100644 node_modules/semver/classes/index.js create mode 100644 node_modules/semver/classes/range.js create mode 100644 node_modules/semver/classes/semver.js create mode 100644 node_modules/semver/functions/clean.js create mode 100644 node_modules/semver/functions/cmp.js create mode 100644 node_modules/semver/functions/coerce.js create mode 100644 node_modules/semver/functions/compare-build.js create mode 100644 node_modules/semver/functions/compare-loose.js create mode 100644 node_modules/semver/functions/compare.js create mode 100644 node_modules/semver/functions/diff.js create mode 100644 node_modules/semver/functions/eq.js create mode 100644 node_modules/semver/functions/gt.js create mode 100644 node_modules/semver/functions/gte.js create mode 100644 node_modules/semver/functions/inc.js create mode 100644 node_modules/semver/functions/lt.js create mode 100644 node_modules/semver/functions/lte.js create mode 100644 node_modules/semver/functions/major.js create mode 100644 node_modules/semver/functions/minor.js create mode 100644 node_modules/semver/functions/neq.js create mode 100644 node_modules/semver/functions/parse.js create mode 100644 node_modules/semver/functions/patch.js create mode 100644 node_modules/semver/functions/prerelease.js create mode 100644 node_modules/semver/functions/rcompare.js create mode 100644 node_modules/semver/functions/rsort.js create mode 100644 node_modules/semver/functions/satisfies.js create mode 100644 node_modules/semver/functions/sort.js create mode 100644 node_modules/semver/functions/truncate.js create mode 100644 node_modules/semver/functions/valid.js create mode 100644 node_modules/semver/index.js create mode 100644 node_modules/semver/internal/constants.js create mode 100644 node_modules/semver/internal/debug.js create mode 100644 node_modules/semver/internal/identifiers.js create mode 100644 node_modules/semver/internal/lrucache.js create mode 100644 node_modules/semver/internal/parse-options.js create mode 100644 node_modules/semver/internal/re.js create mode 100644 node_modules/semver/package.json create mode 100644 node_modules/semver/preload.js create mode 100644 node_modules/semver/range.bnf create mode 100644 node_modules/semver/ranges/gtr.js create mode 100644 node_modules/semver/ranges/intersects.js create mode 100644 node_modules/semver/ranges/ltr.js create mode 100644 node_modules/semver/ranges/max-satisfying.js create mode 100644 node_modules/semver/ranges/min-satisfying.js create mode 100644 node_modules/semver/ranges/min-version.js create mode 100644 node_modules/semver/ranges/outside.js create mode 100644 node_modules/semver/ranges/simplify.js create mode 100644 node_modules/semver/ranges/subset.js create mode 100644 node_modules/semver/ranges/to-comparators.js create mode 100644 node_modules/semver/ranges/valid.js create mode 100644 node_modules/send/LICENSE create mode 100644 node_modules/send/README.md create mode 100644 node_modules/send/index.js create mode 100644 node_modules/send/package.json create mode 100644 node_modules/setprototypeof/LICENSE create mode 100644 node_modules/setprototypeof/README.md create mode 100644 node_modules/setprototypeof/index.d.ts create mode 100644 node_modules/setprototypeof/index.js create mode 100644 node_modules/setprototypeof/package.json create mode 100644 node_modules/setprototypeof/test/index.js create mode 100644 node_modules/slash/index.d.ts create mode 100644 node_modules/slash/index.js create mode 100644 node_modules/slash/license create mode 100644 node_modules/slash/package.json create mode 100644 node_modules/slash/readme.md create mode 100644 node_modules/slugify/LICENSE create mode 100644 node_modules/slugify/README.md create mode 100644 node_modules/slugify/package.json create mode 100644 node_modules/slugify/slugify.d.ts create mode 100644 node_modules/slugify/slugify.js create mode 100644 node_modules/sprintf-js/.npmignore create mode 100644 node_modules/sprintf-js/LICENSE create mode 100644 node_modules/sprintf-js/README.md create mode 100644 node_modules/sprintf-js/bower.json create mode 100644 node_modules/sprintf-js/demo/angular.html create mode 100644 node_modules/sprintf-js/dist/angular-sprintf.min.js create mode 100644 node_modules/sprintf-js/dist/angular-sprintf.min.js.map create mode 100644 node_modules/sprintf-js/dist/angular-sprintf.min.map create mode 100644 node_modules/sprintf-js/dist/sprintf.min.js create mode 100644 node_modules/sprintf-js/dist/sprintf.min.js.map create mode 100644 node_modules/sprintf-js/dist/sprintf.min.map create mode 100644 node_modules/sprintf-js/gruntfile.js create mode 100644 node_modules/sprintf-js/package.json create mode 100644 node_modules/sprintf-js/src/angular-sprintf.js create mode 100644 node_modules/sprintf-js/src/sprintf.js create mode 100644 node_modules/sprintf-js/test/test.js create mode 100644 node_modules/ssri/LICENSE.md create mode 100644 node_modules/ssri/README.md create mode 100644 node_modules/ssri/lib/index.js create mode 100644 node_modules/ssri/package.json create mode 100644 node_modules/statuses/HISTORY.md create mode 100644 node_modules/statuses/LICENSE create mode 100644 node_modules/statuses/README.md create mode 100644 node_modules/statuses/codes.json create mode 100644 node_modules/statuses/index.js create mode 100644 node_modules/statuses/package.json create mode 100644 node_modules/strip-bom-string/LICENSE create mode 100644 node_modules/strip-bom-string/README.md create mode 100644 node_modules/strip-bom-string/index.js create mode 100644 node_modules/strip-bom-string/package.json create mode 100644 node_modules/tinyglobby/LICENSE create mode 100644 node_modules/tinyglobby/README.md create mode 100644 node_modules/tinyglobby/dist/index.cjs create mode 100644 node_modules/tinyglobby/dist/index.d.cts create mode 100644 node_modules/tinyglobby/dist/index.d.mts create mode 100644 node_modules/tinyglobby/dist/index.mjs create mode 100644 node_modules/tinyglobby/package.json create mode 100644 node_modules/to-regex-range/LICENSE create mode 100644 node_modules/to-regex-range/README.md create mode 100644 node_modules/to-regex-range/index.js create mode 100644 node_modules/to-regex-range/package.json create mode 100644 node_modules/toidentifier/HISTORY.md create mode 100644 node_modules/toidentifier/LICENSE create mode 100644 node_modules/toidentifier/README.md create mode 100644 node_modules/toidentifier/index.js create mode 100644 node_modules/toidentifier/package.json create mode 100644 node_modules/uc.micro/LICENSE.txt create mode 100644 node_modules/uc.micro/README.md create mode 100644 node_modules/uc.micro/build/index.cjs.js create mode 100644 node_modules/uc.micro/categories/Cc/regex.mjs create mode 100644 node_modules/uc.micro/categories/Cf/regex.mjs create mode 100644 node_modules/uc.micro/categories/P/regex.mjs create mode 100644 node_modules/uc.micro/categories/S/regex.mjs create mode 100644 node_modules/uc.micro/categories/Z/regex.mjs create mode 100644 node_modules/uc.micro/index.mjs create mode 100644 node_modules/uc.micro/package.json create mode 100644 node_modules/uc.micro/properties/Any/regex.mjs create mode 100644 node_modules/unpipe/HISTORY.md create mode 100644 node_modules/unpipe/LICENSE create mode 100644 node_modules/unpipe/README.md create mode 100644 node_modules/unpipe/index.js create mode 100644 node_modules/unpipe/package.json create mode 100644 node_modules/urlpattern-polyfill/LICENSE create mode 100644 node_modules/urlpattern-polyfill/README.md create mode 100644 node_modules/urlpattern-polyfill/dist/index.d.ts create mode 100644 node_modules/urlpattern-polyfill/dist/types.d.ts create mode 100644 node_modules/urlpattern-polyfill/dist/urlpattern.cjs create mode 100644 node_modules/urlpattern-polyfill/dist/urlpattern.js create mode 100644 node_modules/urlpattern-polyfill/index.cjs create mode 100644 node_modules/urlpattern-polyfill/index.js create mode 100644 node_modules/urlpattern-polyfill/package.json create mode 100644 node_modules/ws/LICENSE create mode 100644 node_modules/ws/README.md create mode 100644 node_modules/ws/browser.js create mode 100644 node_modules/ws/index.js create mode 100644 node_modules/ws/lib/buffer-util.js create mode 100644 node_modules/ws/lib/constants.js create mode 100644 node_modules/ws/lib/event-target.js create mode 100644 node_modules/ws/lib/extension.js create mode 100644 node_modules/ws/lib/limiter.js create mode 100644 node_modules/ws/lib/permessage-deflate.js create mode 100644 node_modules/ws/lib/receiver.js create mode 100644 node_modules/ws/lib/sender.js create mode 100644 node_modules/ws/lib/stream.js create mode 100644 node_modules/ws/lib/subprotocol.js create mode 100644 node_modules/ws/lib/validation.js create mode 100644 node_modules/ws/lib/websocket-server.js create mode 100644 node_modules/ws/lib/websocket.js create mode 100644 node_modules/ws/package.json create mode 100644 node_modules/ws/wrapper.mjs diff --git a/node_modules/.bin/acorn b/node_modules/.bin/acorn new file mode 100644 index 00000000..679bd163 --- /dev/null +++ b/node_modules/.bin/acorn @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../acorn/bin/acorn" "$@" +else + exec node "$basedir/../acorn/bin/acorn" "$@" +fi diff --git a/node_modules/.bin/acorn.cmd b/node_modules/.bin/acorn.cmd new file mode 100644 index 00000000..a9324df9 --- /dev/null +++ b/node_modules/.bin/acorn.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\acorn\bin\acorn" %* diff --git a/node_modules/.bin/acorn.ps1 b/node_modules/.bin/acorn.ps1 new file mode 100644 index 00000000..6f6dcddf --- /dev/null +++ b/node_modules/.bin/acorn.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args + } else { + & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../acorn/bin/acorn" $args + } else { + & "node$exe" "$basedir/../acorn/bin/acorn" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/eleventy b/node_modules/.bin/eleventy new file mode 100644 index 00000000..e888e106 --- /dev/null +++ b/node_modules/.bin/eleventy @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@11ty/eleventy/cmd.cjs" "$@" +else + exec node "$basedir/../@11ty/eleventy/cmd.cjs" "$@" +fi diff --git a/node_modules/.bin/eleventy-dev-server b/node_modules/.bin/eleventy-dev-server new file mode 100644 index 00000000..33063cc6 --- /dev/null +++ b/node_modules/.bin/eleventy-dev-server @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../@11ty/eleventy-dev-server/cmd.js" "$@" +else + exec node "$basedir/../@11ty/eleventy-dev-server/cmd.js" "$@" +fi diff --git a/node_modules/.bin/eleventy-dev-server.cmd b/node_modules/.bin/eleventy-dev-server.cmd new file mode 100644 index 00000000..43b65da2 --- /dev/null +++ b/node_modules/.bin/eleventy-dev-server.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@11ty\eleventy-dev-server\cmd.js" %* diff --git a/node_modules/.bin/eleventy-dev-server.ps1 b/node_modules/.bin/eleventy-dev-server.ps1 new file mode 100644 index 00000000..a11fe50c --- /dev/null +++ b/node_modules/.bin/eleventy-dev-server.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../@11ty/eleventy-dev-server/cmd.js" $args + } else { + & "$basedir/node$exe" "$basedir/../@11ty/eleventy-dev-server/cmd.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../@11ty/eleventy-dev-server/cmd.js" $args + } else { + & "node$exe" "$basedir/../@11ty/eleventy-dev-server/cmd.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/eleventy.cmd b/node_modules/.bin/eleventy.cmd new file mode 100644 index 00000000..ea94423f --- /dev/null +++ b/node_modules/.bin/eleventy.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@11ty\eleventy\cmd.cjs" %* diff --git a/node_modules/.bin/eleventy.ps1 b/node_modules/.bin/eleventy.ps1 new file mode 100644 index 00000000..ff074738 --- /dev/null +++ b/node_modules/.bin/eleventy.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../@11ty/eleventy/cmd.cjs" $args + } else { + & "$basedir/node$exe" "$basedir/../@11ty/eleventy/cmd.cjs" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../@11ty/eleventy/cmd.cjs" $args + } else { + & "node$exe" "$basedir/../@11ty/eleventy/cmd.cjs" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/errno b/node_modules/.bin/errno new file mode 100644 index 00000000..b2abba51 --- /dev/null +++ b/node_modules/.bin/errno @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../errno/cli.js" "$@" +else + exec node "$basedir/../errno/cli.js" "$@" +fi diff --git a/node_modules/.bin/errno.cmd b/node_modules/.bin/errno.cmd new file mode 100644 index 00000000..609af3bf --- /dev/null +++ b/node_modules/.bin/errno.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\errno\cli.js" %* diff --git a/node_modules/.bin/errno.ps1 b/node_modules/.bin/errno.ps1 new file mode 100644 index 00000000..2b2d86fa --- /dev/null +++ b/node_modules/.bin/errno.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../errno/cli.js" $args + } else { + & "$basedir/node$exe" "$basedir/../errno/cli.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../errno/cli.js" $args + } else { + & "node$exe" "$basedir/../errno/cli.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/esparse b/node_modules/.bin/esparse new file mode 100644 index 00000000..601762ce --- /dev/null +++ b/node_modules/.bin/esparse @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../esprima/bin/esparse.js" "$@" +else + exec node "$basedir/../esprima/bin/esparse.js" "$@" +fi diff --git a/node_modules/.bin/esparse.cmd b/node_modules/.bin/esparse.cmd new file mode 100644 index 00000000..2ca6d502 --- /dev/null +++ b/node_modules/.bin/esparse.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esprima\bin\esparse.js" %* diff --git a/node_modules/.bin/esparse.ps1 b/node_modules/.bin/esparse.ps1 new file mode 100644 index 00000000..f19ed730 --- /dev/null +++ b/node_modules/.bin/esparse.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../esprima/bin/esparse.js" $args + } else { + & "$basedir/node$exe" "$basedir/../esprima/bin/esparse.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../esprima/bin/esparse.js" $args + } else { + & "node$exe" "$basedir/../esprima/bin/esparse.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/esvalidate b/node_modules/.bin/esvalidate new file mode 100644 index 00000000..e2fee1f1 --- /dev/null +++ b/node_modules/.bin/esvalidate @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../esprima/bin/esvalidate.js" "$@" +else + exec node "$basedir/../esprima/bin/esvalidate.js" "$@" +fi diff --git a/node_modules/.bin/esvalidate.cmd b/node_modules/.bin/esvalidate.cmd new file mode 100644 index 00000000..4c41643e --- /dev/null +++ b/node_modules/.bin/esvalidate.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esprima\bin\esvalidate.js" %* diff --git a/node_modules/.bin/esvalidate.ps1 b/node_modules/.bin/esvalidate.ps1 new file mode 100644 index 00000000..23699d11 --- /dev/null +++ b/node_modules/.bin/esvalidate.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../esprima/bin/esvalidate.js" $args + } else { + & "$basedir/node$exe" "$basedir/../esprima/bin/esvalidate.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../esprima/bin/esvalidate.js" $args + } else { + & "node$exe" "$basedir/../esprima/bin/esvalidate.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/js-yaml b/node_modules/.bin/js-yaml new file mode 100644 index 00000000..82416ef1 --- /dev/null +++ b/node_modules/.bin/js-yaml @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../js-yaml/bin/js-yaml.js" "$@" +else + exec node "$basedir/../js-yaml/bin/js-yaml.js" "$@" +fi diff --git a/node_modules/.bin/js-yaml.cmd b/node_modules/.bin/js-yaml.cmd new file mode 100644 index 00000000..453312b6 --- /dev/null +++ b/node_modules/.bin/js-yaml.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\js-yaml\bin\js-yaml.js" %* diff --git a/node_modules/.bin/js-yaml.ps1 b/node_modules/.bin/js-yaml.ps1 new file mode 100644 index 00000000..2acfc61c --- /dev/null +++ b/node_modules/.bin/js-yaml.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args + } else { + & "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args + } else { + & "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/liquid b/node_modules/.bin/liquid new file mode 100644 index 00000000..d35257a4 --- /dev/null +++ b/node_modules/.bin/liquid @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../liquidjs/bin/liquid.js" "$@" +else + exec node "$basedir/../liquidjs/bin/liquid.js" "$@" +fi diff --git a/node_modules/.bin/liquid.cmd b/node_modules/.bin/liquid.cmd new file mode 100644 index 00000000..40e26807 --- /dev/null +++ b/node_modules/.bin/liquid.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\liquidjs\bin\liquid.js" %* diff --git a/node_modules/.bin/liquid.ps1 b/node_modules/.bin/liquid.ps1 new file mode 100644 index 00000000..417990fd --- /dev/null +++ b/node_modules/.bin/liquid.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../liquidjs/bin/liquid.js" $args + } else { + & "$basedir/node$exe" "$basedir/../liquidjs/bin/liquid.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../liquidjs/bin/liquid.js" $args + } else { + & "node$exe" "$basedir/../liquidjs/bin/liquid.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/liquidjs b/node_modules/.bin/liquidjs new file mode 100644 index 00000000..d35257a4 --- /dev/null +++ b/node_modules/.bin/liquidjs @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../liquidjs/bin/liquid.js" "$@" +else + exec node "$basedir/../liquidjs/bin/liquid.js" "$@" +fi diff --git a/node_modules/.bin/liquidjs.cmd b/node_modules/.bin/liquidjs.cmd new file mode 100644 index 00000000..40e26807 --- /dev/null +++ b/node_modules/.bin/liquidjs.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\liquidjs\bin\liquid.js" %* diff --git a/node_modules/.bin/liquidjs.ps1 b/node_modules/.bin/liquidjs.ps1 new file mode 100644 index 00000000..417990fd --- /dev/null +++ b/node_modules/.bin/liquidjs.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../liquidjs/bin/liquid.js" $args + } else { + & "$basedir/node$exe" "$basedir/../liquidjs/bin/liquid.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../liquidjs/bin/liquid.js" $args + } else { + & "node$exe" "$basedir/../liquidjs/bin/liquid.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/markdown-it b/node_modules/.bin/markdown-it new file mode 100644 index 00000000..2222df31 --- /dev/null +++ b/node_modules/.bin/markdown-it @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../markdown-it/bin/markdown-it.mjs" "$@" +else + exec node "$basedir/../markdown-it/bin/markdown-it.mjs" "$@" +fi diff --git a/node_modules/.bin/markdown-it.cmd b/node_modules/.bin/markdown-it.cmd new file mode 100644 index 00000000..2851bbeb --- /dev/null +++ b/node_modules/.bin/markdown-it.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\markdown-it\bin\markdown-it.mjs" %* diff --git a/node_modules/.bin/markdown-it.ps1 b/node_modules/.bin/markdown-it.ps1 new file mode 100644 index 00000000..eebcf6e5 --- /dev/null +++ b/node_modules/.bin/markdown-it.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../markdown-it/bin/markdown-it.mjs" $args + } else { + & "$basedir/node$exe" "$basedir/../markdown-it/bin/markdown-it.mjs" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../markdown-it/bin/markdown-it.mjs" $args + } else { + & "node$exe" "$basedir/../markdown-it/bin/markdown-it.mjs" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/mime b/node_modules/.bin/mime new file mode 100644 index 00000000..7751de3c --- /dev/null +++ b/node_modules/.bin/mime @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../mime/cli.js" "$@" +else + exec node "$basedir/../mime/cli.js" "$@" +fi diff --git a/node_modules/.bin/mime.cmd b/node_modules/.bin/mime.cmd new file mode 100644 index 00000000..54491f12 --- /dev/null +++ b/node_modules/.bin/mime.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mime\cli.js" %* diff --git a/node_modules/.bin/mime.ps1 b/node_modules/.bin/mime.ps1 new file mode 100644 index 00000000..2222f40b --- /dev/null +++ b/node_modules/.bin/mime.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../mime/cli.js" $args + } else { + & "$basedir/node$exe" "$basedir/../mime/cli.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../mime/cli.js" $args + } else { + & "node$exe" "$basedir/../mime/cli.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/nunjucks-precompile b/node_modules/.bin/nunjucks-precompile new file mode 100644 index 00000000..b2306bdb --- /dev/null +++ b/node_modules/.bin/nunjucks-precompile @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../nunjucks/bin/precompile" "$@" +else + exec node "$basedir/../nunjucks/bin/precompile" "$@" +fi diff --git a/node_modules/.bin/nunjucks-precompile.cmd b/node_modules/.bin/nunjucks-precompile.cmd new file mode 100644 index 00000000..b208dd87 --- /dev/null +++ b/node_modules/.bin/nunjucks-precompile.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nunjucks\bin\precompile" %* diff --git a/node_modules/.bin/nunjucks-precompile.ps1 b/node_modules/.bin/nunjucks-precompile.ps1 new file mode 100644 index 00000000..d98c48c2 --- /dev/null +++ b/node_modules/.bin/nunjucks-precompile.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../nunjucks/bin/precompile" $args + } else { + & "$basedir/node$exe" "$basedir/../nunjucks/bin/precompile" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../nunjucks/bin/precompile" $args + } else { + & "node$exe" "$basedir/../nunjucks/bin/precompile" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver new file mode 100644 index 00000000..97c53279 --- /dev/null +++ b/node_modules/.bin/semver @@ -0,0 +1,16 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) + if command -v cygpath > /dev/null 2>&1; then + basedir=`cygpath -w "$basedir"` + fi + ;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@" +else + exec node "$basedir/../semver/bin/semver.js" "$@" +fi diff --git a/node_modules/.bin/semver.cmd b/node_modules/.bin/semver.cmd new file mode 100644 index 00000000..9913fa9d --- /dev/null +++ b/node_modules/.bin/semver.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %* diff --git a/node_modules/.bin/semver.ps1 b/node_modules/.bin/semver.ps1 new file mode 100644 index 00000000..314717ad --- /dev/null +++ b/node_modules/.bin/semver.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args + } else { + & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../semver/bin/semver.js" $args + } else { + & "node$exe" "$basedir/../semver/bin/semver.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 00000000..f0dabb1f --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,1534 @@ +{ + "name": "AgentPipe", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@11ty/dependency-tree": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@11ty/dependency-tree/-/dependency-tree-4.0.2.tgz", + "integrity": "sha512-RTF6VTZHatYf7fSZBUN3RKwiUeJh5dhWV61gDPrHhQF2/gzruAkYz8yXuvGLx3w3ZBKreGrR+MfYpSVkdbdbLA==", + "license": "MIT", + "dependencies": { + "@11ty/eleventy-utils": "^2.0.1" + } + }, + "node_modules/@11ty/dependency-tree-esm": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@11ty/dependency-tree-esm/-/dependency-tree-esm-2.0.4.tgz", + "integrity": "sha512-MYKC0Ac77ILr1HnRJalzKDlb9Z8To3kXQCltx299pUXXUFtJ1RIONtULlknknqW8cLe19DLVgmxVCtjEFm7h0A==", + "license": "MIT", + "dependencies": { + "@11ty/eleventy-utils": "^2.0.7", + "acorn": "^8.15.0", + "dependency-graph": "^1.0.0", + "normalize-path": "^3.0.0" + } + }, + "node_modules/@11ty/eleventy": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/@11ty/eleventy/-/eleventy-3.1.6.tgz", + "integrity": "sha512-ZlSiR1PLdS2lv7TelBgWAhcvMiLNZkPBlLEb+lh7kGYZ+Mk0bo9qcYgVsewvw9W7Em0RH3wd01h5fAstNDh0zA==", + "license": "MIT", + "dependencies": { + "@11ty/dependency-tree": "^4.0.2", + "@11ty/dependency-tree-esm": "^2.0.4", + "@11ty/eleventy-dev-server": "^2.0.8", + "@11ty/eleventy-plugin-bundle": "^3.0.7", + "@11ty/eleventy-utils": "^2.0.7", + "@11ty/lodash-custom": "^4.17.21", + "@11ty/posthtml-urls": "^1.0.3", + "@11ty/recursive-copy": "^4.0.4", + "@sindresorhus/slugify": "^2.2.1", + "bcp-47-normalize": "^2.3.0", + "chokidar": "^3.6.0", + "debug": "^4.4.3", + "dependency-graph": "^1.0.0", + "entities": "^6.0.1", + "filesize": "^10.1.6", + "gray-matter": "^4.0.3", + "iso-639-1": "^3.1.5", + "js-yaml": "^4.1.1", + "kleur": "^4.1.5", + "liquidjs": "^10.27.0", + "luxon": "^3.7.2", + "markdown-it": "^14.2.0", + "minimist": "^1.2.8", + "moo": "0.5.2", + "node-retrieve-globals": "^6.0.1", + "nunjucks": "^3.2.4", + "picomatch": "^4.0.4", + "please-upgrade-node": "^3.2.0", + "posthtml": "^0.16.7", + "posthtml-match-helper": "^2.0.3", + "semver": "^7.8.1", + "slugify": "^1.6.9", + "tinyglobby": "^0.2.16" + }, + "bin": { + "eleventy": "cmd.cjs" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + } + }, + "node_modules/@11ty/eleventy-dev-server": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@11ty/eleventy-dev-server/-/eleventy-dev-server-2.0.8.tgz", + "integrity": "sha512-15oC5M1DQlCaOMUq4limKRYmWiGecDaGwryr7fTE/oM9Ix8siqMvWi+I8VjsfrGr+iViDvWcH/TVI6D12d93mA==", + "license": "MIT", + "dependencies": { + "@11ty/eleventy-utils": "^2.0.1", + "chokidar": "^3.6.0", + "debug": "^4.4.0", + "finalhandler": "^1.3.1", + "mime": "^3.0.0", + "minimist": "^1.2.8", + "morphdom": "^2.7.4", + "please-upgrade-node": "^3.2.0", + "send": "^1.1.0", + "ssri": "^11.0.0", + "urlpattern-polyfill": "^10.0.0", + "ws": "^8.18.1" + }, + "bin": { + "eleventy-dev-server": "cmd.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + } + }, + "node_modules/@11ty/eleventy-plugin-bundle": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@11ty/eleventy-plugin-bundle/-/eleventy-plugin-bundle-3.0.7.tgz", + "integrity": "sha512-QK1tRFBhQdZASnYU8GMzpTdsMMFLVAkuU0gVVILqNyp09xJJZb81kAS3AFrNrwBCsgLxTdWHJ8N64+OTTsoKkA==", + "license": "MIT", + "dependencies": { + "@11ty/eleventy-utils": "^2.0.2", + "debug": "^4.4.0", + "posthtml-match-helper": "^2.0.3" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + } + }, + "node_modules/@11ty/eleventy-utils": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@11ty/eleventy-utils/-/eleventy-utils-2.0.7.tgz", + "integrity": "sha512-6QE+duqSQ0GY9rENXYb4iPR4AYGdrFpqnmi59tFp9VrleOl0QSh8VlBr2yd6dlhkdtj7904poZW5PvGr9cMiJQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + } + }, + "node_modules/@11ty/lodash-custom": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@11ty/lodash-custom/-/lodash-custom-4.17.21.tgz", + "integrity": "sha512-Mqt6im1xpb1Ykn3nbcCovWXK3ggywRJa+IXIdoz4wIIK+cvozADH63lexcuPpGS/gJ6/m2JxyyXDyupkMr5DHw==", + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + } + }, + "node_modules/@11ty/posthtml-urls": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@11ty/posthtml-urls/-/posthtml-urls-1.0.3.tgz", + "integrity": "sha512-1YvhnkaNlFnnJic1rBMWmTC2adbuy+JQiBfl1Hecr1Wjjik1pQZmGyk/eC9zKX/FQv52s2Nht1Gi/UwhYqrBeg==", + "license": "MIT", + "dependencies": { + "evaluate-value": "^2.0.0", + "http-equiv-refresh": "^2.0.1", + "list-to-array": "^1.1.0", + "parse-srcset": "^1.0.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@11ty/recursive-copy": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@11ty/recursive-copy/-/recursive-copy-4.0.4.tgz", + "integrity": "sha512-oI7m8pa7/IAU/3lqRU9vjBbs20iKFo7x+1K9kT3aVira6scc1X9MjBdgLCHzLJeJ7iB6wydioA+kr9/qPnvmlQ==", + "license": "ISC", + "dependencies": { + "errno": "^1.0.0", + "junk": "^3.1.0", + "minimatch": "^3.1.5", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@sindresorhus/slugify": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-2.2.1.tgz", + "integrity": "sha512-MkngSCRZ8JdSOCHRaYd+D01XhvU3Hjy6MGl06zhOk614hp9EOAp5gIkBeQg7wtmxpitU6eAL4kdiRMcJa2dlrw==", + "license": "MIT", + "dependencies": { + "@sindresorhus/transliterate": "^1.0.0", + "escape-string-regexp": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@sindresorhus/transliterate": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/transliterate/-/transliterate-1.6.0.tgz", + "integrity": "sha512-doH1gimEu3A46VX6aVxpHTeHrytJAG6HgdxntYnCFiIFHEM/ZGpG8KiZGBChchjQmG0XFIBL552kBTjVcMZXwQ==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/a-sync-waterfall": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", + "integrity": "sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==", + "license": "MIT" + }, + "node_modules/acorn": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", + "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.5", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.5.tgz", + "integrity": "sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==", + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/anymatch/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "license": "MIT" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/bcp-47": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bcp-47/-/bcp-47-2.1.1.tgz", + "integrity": "sha512-KLw+H/gd2p4zly1X7Yh/qziuyae5/w/QFnvTng9eZL5fvszL7Whl3MBoWF8yxL7ksUjBfOD+OxkytiqbBpG+Fw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/bcp-47-match": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/bcp-47-match/-/bcp-47-match-2.0.3.tgz", + "integrity": "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/bcp-47-normalize": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/bcp-47-normalize/-/bcp-47-normalize-2.3.0.tgz", + "integrity": "sha512-8I/wfzqQvttUFz7HVJgIZ7+dj3vUaIyIxYXaTRP1YWoSDfzt6TUmxaKZeuXR62qBmYr+nvuWINFRl6pZ5DlN4Q==", + "license": "MIT", + "dependencies": { + "bcp-47": "^2.0.0", + "bcp-47-match": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.16.tgz", + "integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dependency-graph": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-1.0.0.tgz", + "integrity": "sha512-cW3gggJ28HZ/LExwxP2B++aiKxhJXMSIt9K48FOXQkm+vuG5gyatXnLsONRJdzO/7VfjDIiaOOa/bs4l464Lwg==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/dom-serializer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", + "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/dom-serializer/node_modules/entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "license": "BSD-2-Clause", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "node_modules/domhandler": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", + "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/entities": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/errno": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/errno/-/errno-1.0.0.tgz", + "integrity": "sha512-3zV5mFS1E8/1bPxt/B0xxzI1snsg3uSCIh6Zo1qKg6iMw93hzPANk9oBFzSFBFrwuVoQuE3rLoouAUfwOAj1wQ==", + "license": "MIT", + "dependencies": { + "prr": "~1.0.1" + }, + "bin": { + "errno": "cli.js" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/esm-import-transformer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/esm-import-transformer/-/esm-import-transformer-3.0.5.tgz", + "integrity": "sha512-1GKLvfuMnnpI75l8c6sHoz0L3Z872xL5akGuBudgqTDPv4Vy6f2Ec7jEMKTxlqWl/3kSvNbHELeimJtnqgYniw==", + "license": "MIT", + "dependencies": { + "acorn": "^8.15.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/evaluate-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/evaluate-value/-/evaluate-value-2.0.0.tgz", + "integrity": "sha512-VonfiuDJc0z4sOO7W0Pd130VLsXN6vmBWZlrog1mCb/o7o/Nl5Lr25+Kj/nkCCAhG+zqeeGjxhkK9oHpkgTHhQ==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", + "license": "MIT", + "dependencies": { + "is-extendable": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/filesize": { + "version": "10.1.6", + "resolved": "https://registry.npmjs.org/filesize/-/filesize-10.1.6.tgz", + "integrity": "sha512-sJslQKU2uM33qH5nqewAwVB2QgR6w1aMNsYUp3aN5rMRyXEwJGmZvaWzeJFNTOXWlHQyBFCWrdj3fV/fsTOX8w==", + "license": "BSD-3-Clause", + "engines": { + "node": ">= 10.4.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", + "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "statuses": "~2.0.2", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/gray-matter": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", + "integrity": "sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==", + "license": "MIT", + "dependencies": { + "js-yaml": "^3.13.1", + "kind-of": "^6.0.2", + "section-matter": "^1.0.0", + "strip-bom-string": "^1.0.0" + }, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/gray-matter/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/gray-matter/node_modules/js-yaml": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.15.0.tgz", + "integrity": "sha512-ttBQIIQPDeLjpPOohtUdXuXUVoA2uIB6fEH9HyJ7234s5mBJ5wTx20njxplLZQgLaOfpmPQA7X2t5AX6tIPbog==", + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/htmlparser2": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz", + "integrity": "sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.2", + "domutils": "^2.8.0", + "entities": "^3.0.1" + } + }, + "node_modules/htmlparser2/node_modules/entities": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", + "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/http-equiv-refresh": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-equiv-refresh/-/http-equiv-refresh-2.0.1.tgz", + "integrity": "sha512-XJpDL/MLkV3dKwLzHwr2dY05dYNfBNlyPu4STQ8WvKCFdc6vC5tPXuq28of663+gHVg03C+16pHHs/+FmmDjcw==", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-json": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-json/-/is-json-2.0.1.tgz", + "integrity": "sha512-6BEnpVn1rcf3ngfmViLM6vjUjGErbdrL4rwlv+u1NO1XO8kqT4YGL8+19Q+Z/bas8tY90BTWMk2+fW1g6hQjbA==", + "license": "ISC" + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/iso-639-1": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/iso-639-1/-/iso-639-1-3.1.6.tgz", + "integrity": "sha512-ZFar/L4ngX7wZh2QX+Fiftmuf0igWJsrJtfizrovWifF1gAWkfmRa5Z1m0LQZbm0hKCHRDYhLRSLFrSqNe4EJA==", + "license": "MIT", + "engines": { + "node": ">=6.0" + } + }, + "node_modules/js-yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/junk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz", + "integrity": "sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/linkify-it": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.2.tgz", + "integrity": "sha512-ONTm2jCMAVZjgQa/Fy1kScXsuOoF5NPTsoFBdE1KVIZ2vAh/r9+Bqo+0jINCBYnavTPQZz38QzFTme79ENoN3Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/markdown-it" + } + ], + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, + "node_modules/liquidjs": { + "version": "10.27.2", + "resolved": "https://registry.npmjs.org/liquidjs/-/liquidjs-10.27.2.tgz", + "integrity": "sha512-kvknfAEtOHjHkAAv7GxLEJh8ghpMQm3Fc4uWVyF7hERSTsSRsdC7saWs0p5aDG7GDcWsu5o+T4232O+8KZO55w==", + "license": "MIT", + "dependencies": { + "commander": "^10.0.0" + }, + "bin": { + "liquid": "bin/liquid.js", + "liquidjs": "bin/liquid.js" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/liquidjs" + } + }, + "node_modules/list-to-array": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/list-to-array/-/list-to-array-1.1.0.tgz", + "integrity": "sha512-+dAZZ2mM+/m+vY9ezfoueVvrgnHIGi5FvgSymbIgJOFwiznWyA59mav95L+Mc6xPtL3s9gm5eNTlNtxJLbNM1g==", + "license": "MIT" + }, + "node_modules/luxon": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.7.2.tgz", + "integrity": "sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==", + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/markdown-it": { + "version": "14.3.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.3.0.tgz", + "integrity": "sha512-RCEsPjR+sr0x+AuYp601tKTkgFG4YEPLCzHST3cQ/fhlJkqAkz1L2/Qbp1j9qw5SBwQHFBoW8+hoN5xssOF0Tw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/markdown-it" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.5.0", + "linkify-it": "^5.0.2", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/markdown-it/node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "license": "MIT" + }, + "node_modules/mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/moo": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz", + "integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==", + "license": "BSD-3-Clause" + }, + "node_modules/morphdom": { + "version": "2.7.8", + "resolved": "https://registry.npmjs.org/morphdom/-/morphdom-2.7.8.tgz", + "integrity": "sha512-D/fR4xgGUyVRbdMGU6Nejea1RFzYxYtyurG4Fbv2Fi/daKlWKuXGLOdXtl+3eIwL110cI2hz1ZojGICjjFLgTg==", + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/node-retrieve-globals": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/node-retrieve-globals/-/node-retrieve-globals-6.0.1.tgz", + "integrity": "sha512-j0DeFuZ/Wg3VlklfbxUgZF/mdHMTEiEipBb3q0SpMMbHaV3AVfoUQF8UGxh1s/yjqO0TgRZd4Pi/x2yRqoQ4Eg==", + "license": "MIT", + "dependencies": { + "acorn": "^8.14.1", + "acorn-walk": "^8.3.4", + "esm-import-transformer": "^3.0.3" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nunjucks": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/nunjucks/-/nunjucks-3.2.4.tgz", + "integrity": "sha512-26XRV6BhkgK0VOxfbU5cQI+ICFUtMLixv1noZn1tGU38kQH5A5nmmbk/O45xdyBhD1esk47nKrY0mvQpZIhRjQ==", + "license": "BSD-2-Clause", + "dependencies": { + "a-sync-waterfall": "^1.0.0", + "asap": "^2.0.3", + "commander": "^5.1.0" + }, + "bin": { + "nunjucks-precompile": "bin/precompile" + }, + "engines": { + "node": ">= 6.9.0" + }, + "peerDependencies": { + "chokidar": "^3.3.0" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } + } + }, + "node_modules/nunjucks/node_modules/commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parse-srcset": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/parse-srcset/-/parse-srcset-1.0.2.tgz", + "integrity": "sha512-/2qh0lav6CmI15FzA3i/2Bzk2zCgQhGMkvhOhKNcBVQ1ldgpbfiNTVslmooUmWJcADi1f1kIeynbDRVzNlfR6Q==", + "license": "MIT" + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/picomatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "license": "MIT", + "dependencies": { + "semver-compare": "^1.0.0" + } + }, + "node_modules/posthtml": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/posthtml/-/posthtml-0.16.7.tgz", + "integrity": "sha512-7Hc+IvlQ7hlaIfQFZnxlRl0jnpWq2qwibORBhQYIb0QbNtuicc5ZxvKkVT71HJ4Py1wSZ/3VR1r8LfkCtoCzhw==", + "license": "MIT", + "dependencies": { + "posthtml-parser": "^0.11.0", + "posthtml-render": "^3.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/posthtml-match-helper": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/posthtml-match-helper/-/posthtml-match-helper-2.0.3.tgz", + "integrity": "sha512-p9oJgTdMF2dyd7WE54QI1LvpBIkNkbSiiECKezNnDVYhGhD1AaOnAkw0Uh0y5TW+OHO8iBdSqnd8Wkpb6iUqmw==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "posthtml": "^0.16.6" + } + }, + "node_modules/posthtml-parser": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/posthtml-parser/-/posthtml-parser-0.11.0.tgz", + "integrity": "sha512-QecJtfLekJbWVo/dMAA+OSwY79wpRmbqS5TeXvXSX+f0c6pW4/SE6inzZ2qkU7oAMCPqIDkZDvd/bQsSFUnKyw==", + "license": "MIT", + "dependencies": { + "htmlparser2": "^7.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/posthtml-render": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/posthtml-render/-/posthtml-render-3.0.0.tgz", + "integrity": "sha512-z+16RoxK3fUPgwaIgH9NGnK1HKY9XIDpydky5eQGgAFVXTCSezalv9U2jQuNV+Z9qV1fDWNzldcw4eK0SSbqKA==", + "license": "MIT", + "dependencies": { + "is-json": "^2.0.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", + "license": "MIT" + }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/range-parser": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz", + "integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/readdirp/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/section-matter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz", + "integrity": "sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==", + "license": "MIT", + "dependencies": { + "extend-shallow": "^2.0.1", + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==", + "license": "MIT" + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/slugify": { + "version": "1.6.9", + "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.9.tgz", + "integrity": "sha512-vZ7rfeehZui7wQs438JXBckYLkIIdfHOXsaVEUMyS5fHo1483l1bMdo0EDSWYclY0yZKFOipDy4KHuKs6ssvdg==", + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "license": "BSD-3-Clause" + }, + "node_modules/ssri": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-11.0.0.tgz", + "integrity": "sha512-aZpUoMN/Jj2MqA4vMCeiKGnc/8SuSyHbGSBdgFbZxP8OJGF/lFkIuElzPxsN0q8TQQ+prw3P4EDfB3TBHHgfXw==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/strip-bom-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz", + "integrity": "sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/urlpattern-polyfill": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.1.0.tgz", + "integrity": "sha512-IGjKp/o0NL3Bso1PymYURCJxMPNAf/ILOpendP9f5B6e1rTJgdgiOvgfoT8VxCAdY+Wisb9uhGaJJf3yZ2V9nw==", + "license": "MIT" + }, + "node_modules/ws": { + "version": "8.21.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.1.tgz", + "integrity": "sha512-+0NTnW77fFN/DjQi6k/Sq/Yvk4Sgajw7urW8V+asjXnRgDs9gyGkdb7EzgfhA4goXsRIZKE28fzIXBHEzhuiWw==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/node_modules/@11ty/dependency-tree-esm/LICENSE b/node_modules/@11ty/dependency-tree-esm/LICENSE new file mode 100644 index 00000000..cb72e93b --- /dev/null +++ b/node_modules/@11ty/dependency-tree-esm/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Zach Leatherman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@11ty/dependency-tree-esm/README.md b/node_modules/@11ty/dependency-tree-esm/README.md new file mode 100644 index 00000000..5684472d --- /dev/null +++ b/node_modules/@11ty/dependency-tree-esm/README.md @@ -0,0 +1,53 @@ +# `dependency-tree-esm` + +Returns an unordered array of local paths to dependencies of a Node ES module JavaScript file. + +* See also: [`dependency-tree`](https://github.com/11ty/eleventy-dependency-tree) for the CommonJS version. + +This is used by Eleventy to find dependencies of a JavaScript file to watch for changes to re-run Eleventy’s build. + +## Installation + +``` +npm install --save-dev @11ty/dependency-tree-esm +``` + +## Features + +* Ignores bare specifiers (e.g. `import "my-package"`) +* Ignores Node’s built-ins (e.g. `import "path"`) +* Handles circular dependencies +* Returns an empty set if the file does not exist. + +## Usage + +```js +// my-file.js + +// if my-local-dependency.js has dependencies, it will include those too +import "./my-local-dependency.js"; + + +// ignored, is a built-in +import path from "path"; +``` + +```js +import { find } from "@11ty/dependency-tree-esm"; +// CommonJS is fine too +// const { find } = require("@11ty/dependency-tree-esm"); + +await find("./my-file.js"); +// returns ["./my-local-dependency.js"] +``` + +Return a [dependency-graph](https://github.com/jriecken/dependency-graph) instance: + +```js +import { findGraph } from "@11ty/dependency-tree-esm"; +// CommonJS is fine too +// const { find } = require("@11ty/dependency-tree-esm"); + +(await findGraph("./my-file.js")).overallOrder(); +// returns ["./my-local-dependency.js", "./my-file.js"] +``` \ No newline at end of file diff --git a/node_modules/@11ty/dependency-tree-esm/main.js b/node_modules/@11ty/dependency-tree-esm/main.js new file mode 100644 index 00000000..4e9a9b45 --- /dev/null +++ b/node_modules/@11ty/dependency-tree-esm/main.js @@ -0,0 +1,173 @@ +const path = require("node:path"); +const { readFileSync, existsSync } = require("node:fs"); + +const acorn = require("acorn"); +const normalizePath = require("normalize-path"); +const { TemplatePath } = require("@11ty/eleventy-utils"); +const { DepGraph } = require("dependency-graph"); + +// Is *not* a bare specifier (e.g. 'some-package') +// https://nodejs.org/dist/latest-v18.x/docs/api/esm.html#terminology +function isNonBareSpecifier(importSource) { + // Change \\ to / on Windows + let normalized = normalizePath(importSource); + // Relative specifier (e.g. './startup.js') + if(normalized.startsWith("./") || normalized.startsWith("../")) { + return true; + } + // Absolute specifier (e.g. 'file:///opt/nodejs/config.js') + if(normalized.startsWith("file:")) { + return true; + } + + return false; +} + +function normalizeFilePath(filePath) { + return TemplatePath.standardizeFilePath(path.relative(".", filePath)); +} + +function normalizeImportSourceToFilePath(filePath, source) { + let { dir } = path.parse(filePath); + let normalized = path.join(dir, source); + return normalizeFilePath(normalized); +} + +function getImportAttributeType(attributes = []) { + for(let node of attributes) { + if(node.type === "ImportAttribute" && node.key.type === "Identifier" && node.key.name === "type") { + return node.value.value; + } + } +} + +async function getSources(filePath, contents, options = {}) { + let { parserOverride } = Object.assign({}, options); + let sources = new Set(); + let sourcesToRecurse = new Set(); + + let ast = (parserOverride || acorn).parse(contents, { + sourceType: "module", + ecmaVersion: "latest", + }); + + for(let node of ast.body) { + if(node.type === "ImportDeclaration" && isNonBareSpecifier(node.source.value)) { + let importAttributeType = getImportAttributeType(node?.attributes); + let normalized = normalizeImportSourceToFilePath(filePath, node.source.value); + if(normalized !== filePath) { + sources.add(normalized); + + // Recurse typeless (JavaScript) import types only + // Right now only `css` and `json` are valid but others might come later + if(!importAttributeType) { + sourcesToRecurse.add(normalized); + } + } + } + } + + + return { + sources, + sourcesToRecurse, + } +} + +// second argument used to be `alreadyParsedSet = new Set()`, keep that backwards compat +async function find(filePath, options = {}) { + if(options instanceof Set) { + options = { + alreadyParsedSet: options + }; + } + + if(!options.alreadyParsedSet) { + options.alreadyParsedSet = new Set(); + } + + // TODO add a cache here + // Unfortunately we need to read the entire file, imports need to be at the top level but they can be anywhere 🫠 + let normalized = normalizeFilePath(filePath); + if(options.alreadyParsedSet.has(normalized) || !existsSync(filePath)) { + return []; + } + options.alreadyParsedSet.add(normalized); + + let contents = readFileSync(normalized, { encoding: 'utf8' }); + let { sources, sourcesToRecurse } = await getSources(filePath, contents, options); + + // Recurse for nested deps + for(let source of sourcesToRecurse) { + let s = await find(source, options); + for(let p of s) { + if(sources.has(p) || p === filePath) { + continue; + } + + sources.add(p); + } + } + + return Array.from(sources); +} + +function mergeGraphs(rootGraph, ...graphs) { + if(!(rootGraph instanceof DepGraph)) { + throw new Error("Incorrect type passed to mergeGraphs, expected DepGraph"); + } + for(let g of graphs) { + for(let node of g.overallOrder()) { + if(!rootGraph.hasNode(node)) { + rootGraph.addNode(node); + } + for(let dep of g.directDependenciesOf(node)) { + rootGraph.addDependency(node, dep); + } + } + } +} + +// second argument used to be `alreadyParsedSet = new Set()`, keep that backwards compat +async function findGraph(filePath, options = {}) { + if(options instanceof Set) { + options = { + alreadyParsedSet: options + }; + } + if(!options.alreadyParsedSet) { + options.alreadyParsedSet = new Set(); + } + + let graph = new DepGraph(); + let normalized = normalizeFilePath(filePath); + graph.addNode(filePath); + + if(options.alreadyParsedSet.has(normalized) || !existsSync(filePath)) { + return graph; + } + options.alreadyParsedSet.add(normalized); + + let contents = readFileSync(normalized, "utf8"); + let { sources, sourcesToRecurse } = await getSources(filePath, contents, options); + for(let source of sources) { + if(!graph.hasNode(source)) { + graph.addNode(source); + } + graph.addDependency(normalized, source); + } + + // Recurse for nested deps + for(let source of sourcesToRecurse) { + let recursedGraph = await findGraph(source, options); + mergeGraphs(graph, recursedGraph); + } + + return graph; +} + +module.exports = { + find, + findGraph, + mergeGraphs, +}; \ No newline at end of file diff --git a/node_modules/@11ty/dependency-tree-esm/package.json b/node_modules/@11ty/dependency-tree-esm/package.json new file mode 100644 index 00000000..40b8cd78 --- /dev/null +++ b/node_modules/@11ty/dependency-tree-esm/package.json @@ -0,0 +1,26 @@ +{ + "name": "@11ty/dependency-tree-esm", + "version": "2.0.4", + "description": "Finds all JavaScript ES Module dependencies from a filename.", + "main": "main.js", + "type": "commonjs", + "scripts": { + "test": "echo \"Error: run tests from root directory\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/11ty/eleventy-utils.git" + }, + "author": { + "name": "Zach Leatherman", + "email": "zach@zachleat.com", + "url": "https://zachleat.com/" + }, + "license": "MIT", + "dependencies": { + "@11ty/eleventy-utils": "^2.0.7", + "acorn": "^8.15.0", + "dependency-graph": "^1.0.0", + "normalize-path": "^3.0.0" + } +} diff --git a/node_modules/@11ty/dependency-tree/LICENSE b/node_modules/@11ty/dependency-tree/LICENSE new file mode 100644 index 00000000..bad64170 --- /dev/null +++ b/node_modules/@11ty/dependency-tree/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Zach Leatherman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@11ty/dependency-tree/README.md b/node_modules/@11ty/dependency-tree/README.md new file mode 100644 index 00000000..0910ca42 --- /dev/null +++ b/node_modules/@11ty/dependency-tree/README.md @@ -0,0 +1,109 @@ +# `@11ty/dependency-tree` + +Returns an unordered array of local paths to dependencies of a CommonJS node JavaScript file (everything it or any of its dependencies `require`s). + +* See also: [`@11ty/dependency-tree-esm`](https://github.com/11ty/eleventy-utils/tree/main/parse-deps-esm) for the ESM version. +* See also: [`@11ty/dependency-tree-typescript`](https://github.com/11ty/eleventy-utils/tree/main/parse-deps-typescript) for the TypeScript version. + +Reduced feature (faster) alternative to the [`dependency-tree` package](https://www.npmjs.com/package/dependency-tree). This is used by Eleventy to find dependencies of a JavaScript file to watch for changes to re-run Eleventy’s build. + +## Big Huge Caveat + +⚠ A big caveat to this plugin is that it will require the file in order to build a dependency tree. So if your module has side effects and you don’t want it to execute—do not use this! + +## Installation + +``` +npm install --save-dev @11ty/dependency-tree +``` + +## Features + +* Ignores `node_modules` +* Or, use `nodeModuleNames` to control whether or not `node_modules` package names are included (added in v2.0.1) +* Ignores Node’s built-ins (e.g. `path`) +* Handles circular dependencies (Node does this too) + +## Usage + +```js +// my-file.js + +// if my-local-dependency.js has dependencies, it will include those too +const test = require("./my-local-dependency.js"); + +// ignored, is a built-in +const path = require("path"); +``` + +```js +const DependencyTree = require("@11ty/dependency-tree"); + +DependencyTree("./my-file.js"); +// returns ["./my-local-dependency.js"] +``` + +### `allowNotFound` + +```js +const DependencyTree = require("@11ty/dependency-tree"); + +DependencyTree("./this-does-not-exist.js"); // throws an error + +DependencyTree("./this-does-not-exist.js", { allowNotFound: true }); +// returns [] +``` + +### `nodeModuleNames` + +(Added in v2.0.1) Controls whether or not node package names are included in the list of dependencies. + +* `nodeModuleNames: "include"`: included alongside the local JS files. +* `nodeModuleNames: "exclude"` (default): node module package names are excluded. +* `nodeModuleNames: "only"`: only node module package names are returned. + +```js +// my-file.js: + +require("./my-local-dependency.js"); +require("@11ty/eleventy"); +``` + +```js +const DependencyTree = require("@11ty/dependency-tree"); + +DependencyTree("./my-file.js"); +// returns ["./my-local-dependency.js"] + +DependencyTree("./my-file.js", { nodeModuleNames: "exclude" }); +// returns ["./my-local-dependency.js"] + +DependencyTree("./my-file.js", { nodeModuleNames: "include" }); +// returns ["./my-local-dependency.js", "@11ty/eleventy"] + +DependencyTree("./my-file.js", { nodeModuleNames: "only" }); +// returns ["@11ty/eleventy"] +``` + +#### (Deprecated) `nodeModuleNamesOnly` + +(Added in v2.0.0) Changed to use `nodeModuleNames` option instead. Backwards compatibility is maintained automatically. + +* `nodeModuleNamesOnly: false` is mapped to `nodeModuleNames: "exclude"` +* `nodeModuleNamesOnly: true` is mapped to `nodeModuleNames: "only"` + +If both `nodeModuleNamesOnly` and `nodeModuleNames` are included in options, `nodeModuleNames` takes precedence. + +### `getPackagesByType` method + +_Added in v4.0.2._ + +```js +const DependencyTree = require("@11ty/dependency-tree"); +const {getPackagesByType} = DependencyTree; + +// With `require(esm)` support, some targets may be modules! +// Return separate lists for commonjs and esm lists +getPackagesByType("./my-file.js"); +// returns { commonjs: ["./my-file.js"], esm: [] } +``` diff --git a/node_modules/@11ty/dependency-tree/main.js b/node_modules/@11ty/dependency-tree/main.js new file mode 100644 index 00000000..b7dd2d29 --- /dev/null +++ b/node_modules/@11ty/dependency-tree/main.js @@ -0,0 +1,157 @@ +const path = require("node:path"); +const { TemplatePath } = require("@11ty/eleventy-utils"); + +function getAbsolutePath(filename) { + let normalizedFilename = path.normalize(filename); // removes dot slash + let hasDotSlash = filename.startsWith("./"); + return hasDotSlash ? path.join(path.resolve("."), normalizedFilename) : normalizedFilename; +} + +function getRelativePath(filename) { + let normalizedFilename = path.normalize(filename); // removes dot slash + let workingDirectory = path.resolve("."); + let result = "./" + (normalizedFilename.startsWith(workingDirectory) ? normalizedFilename.substr(workingDirectory.length + 1) : normalizedFilename); + return result; +} + +function getNodeModuleName(filename) { + let foundNodeModules = false; + let moduleName = []; + + let s = filename.split(path.sep); + for(let entry of s) { + if(entry === '.pnpm') { + foundNodeModules = false; + } + + if(foundNodeModules) { + moduleName.push(entry); + if(!entry.startsWith("@")) { + return moduleName.join("/"); + } + } + + if(entry === "node_modules") { + foundNodeModules = true; + } + } + + return false; +} + +/* unordered */ +function getDependenciesFor(filename, avoidCircular, optionsArg = {}) { + // backwards compatibility with `nodeModuleNamesOnly` boolean option + // Using `nodeModuleNames` property moving forward + if(("nodeModuleNamesOnly" in optionsArg) && !("nodeModuleNames" in optionsArg)) { + if(optionsArg.nodeModuleNamesOnly === true) { + optionsArg.nodeModuleNames = "only"; + } + if(optionsArg.nodeModuleNamesOnly === false) { + optionsArg.nodeModuleNames = "exclude"; + } + } + + let options = Object.assign({ + allowNotFound: false, + nodeModuleNames: "exclude", // also "include" or "only" + }, optionsArg); + let absoluteFilename = getAbsolutePath(filename); + let modules = new Set(); + + try { + let res = require(absoluteFilename); + if(res[Symbol.toStringTag] === "Module" || res.__esModule) { + modules.add(filename); + } + } catch(e) { + if(e.code === "MODULE_NOT_FOUND" && options.allowNotFound) { + // do nothing + } else { + throw e; + } + } + + + let mod; + for(let entry in require.cache) { + if(entry === absoluteFilename) { + mod = require.cache[entry]; + break; + } + } + + let dependencies = new Set(); + + if(!mod) { + if(!options.allowNotFound) { + throw new Error(`Could not find ${filename} in @11ty/dependency-tree`); + } + } else { + let relativeFilename = getRelativePath(mod.filename); + if(!avoidCircular) { + avoidCircular = {}; + } else if(options.nodeModuleNames !== "only") { + dependencies.add(relativeFilename); + } + + avoidCircular[relativeFilename] = true; + + if(Array.isArray(mod.children) && mod.children.length > 0) { + for(let child of mod.children) { + let relativeChildFilename = getRelativePath(child.filename); + let nodeModuleName = getNodeModuleName(child.filename); + + if(options.nodeModuleNames !== "exclude" && nodeModuleName) { + dependencies.add(nodeModuleName); + } + // Add dependencies of this dependency (not top level node_modules) + if(nodeModuleName === false) { + if(!dependencies.has(relativeChildFilename) && // avoid infinite looping with circular deps + !avoidCircular[relativeChildFilename] ) { + let { commonjs, esm } = getDependenciesFor(relativeChildFilename, avoidCircular, options); + for(let dependency of commonjs) { + dependencies.add(dependency); + } + for(let dependency of esm) { + modules.add(dependency); + } + } + } + } + } + } + + return { + esm: modules, + commonjs: dependencies, + } +} + +function normalizeList(packageSet) { + return Array.from( packageSet ).map(filePath => { + if(filePath.startsWith("./")) { + return TemplatePath.standardizeFilePath(filePath); + } + return filePath; // node_module name + }) +} + +function getCleanDependencyListFor(filename, options = {}) { + let { commonjs } = getDependenciesFor(filename, null, options); + + return normalizeList(commonjs); +} + +function getCleanDependencyListByTypeFor(filename, options = {}) { + let { commonjs, esm } = getDependenciesFor(filename, null, options); + + return { + commonjs: normalizeList(commonjs), + esm: normalizeList(esm), + }; +} + +module.exports = getCleanDependencyListFor; +module.exports.getPackagesByType = getCleanDependencyListByTypeFor; +module.exports.getNodeModuleName = getNodeModuleName; \ No newline at end of file diff --git a/node_modules/@11ty/dependency-tree/package.json b/node_modules/@11ty/dependency-tree/package.json new file mode 100644 index 00000000..f140f821 --- /dev/null +++ b/node_modules/@11ty/dependency-tree/package.json @@ -0,0 +1,42 @@ +{ + "name": "@11ty/dependency-tree", + "version": "4.0.2", + "description": "Finds all JavaScript CommmonJS require() dependencies from a filename.", + "main": "main.js", + "files": [ + "main.js", + "!test", + "!test/**" + ], + "scripts": { + "test": "npx ava" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/11ty/eleventy-dependency-tree.git" + }, + "author": { + "name": "Zach Leatherman", + "email": "zach@zachleat.com", + "url": "https://zachleat.com/" + }, + "license": "MIT", + "ava": { + "files": [ + "./test/*.js" + ], + "watchMode": { + "ignoreChanged": [ + "./test/stubs/**" + ] + } + }, + "devDependencies": { + "@sindresorhus/is": "^4.6.0", + "ava": "^6.4.1", + "semver": "^7.7.3" + }, + "dependencies": { + "@11ty/eleventy-utils": "^2.0.1" + } +} diff --git a/node_modules/@11ty/eleventy-dev-server/README.md b/node_modules/@11ty/eleventy-dev-server/README.md new file mode 100644 index 00000000..2d745903 --- /dev/null +++ b/node_modules/@11ty/eleventy-dev-server/README.md @@ -0,0 +1,60 @@ +

11ty Logo

+ +# eleventy-dev-server 🕚⚡️🎈🐀 + +A minimal, modern, generic, hot-reloading local web server to help web developers. + +## ➡ [Documentation](https://www.11ty.dev/docs/watch-serve/#eleventy-dev-server) + +- Please star [Eleventy on GitHub](https://github.com/11ty/eleventy/)! +- Follow us on Twitter [@eleven_ty](https://twitter.com/eleven_ty) +- Support [11ty on Open Collective](https://opencollective.com/11ty) +- [11ty on npm](https://www.npmjs.com/org/11ty) +- [11ty on GitHub](https://github.com/11ty) + +[![npm Version](https://img.shields.io/npm/v/@11ty/eleventy-dev-server.svg?style=for-the-badge)](https://www.npmjs.com/package/@11ty/eleventy-dev-server) + +## Installation + +This is bundled with `@11ty/eleventy` (and you do not need to install it separately) in Eleventy v2.0. + +## CLI + +Eleventy Dev Server now also includes a CLI. The CLI is for **standalone** (non-Eleventy) use only: separate installation is unnecessary if you’re using this server with `@11ty/eleventy`. + +```sh +npm install -g @11ty/eleventy-dev-server + +# Alternatively, install locally into your project +npm install @11ty/eleventy-dev-server +``` + +This package requires Node 18 or newer. + +### CLI Usage + +```sh +# Serve the current directory +npx @11ty/eleventy-dev-server + +# Serve a different subdirectory (also aliased as --input) +npx @11ty/eleventy-dev-server --dir=_site + +# Disable the `domdiff` feature +npx @11ty/eleventy-dev-server --domdiff=false + +# Full command list in the Help +npx @11ty/eleventy-dev-server --help +``` + +## Tests + +``` +npm run test +``` + +- We use the [ava JavaScript test runner](https://github.com/avajs/ava) ([Assertions documentation](https://github.com/avajs/ava/blob/master/docs/03-assertions.md)) + +## Changelog + +* `v2.0.0` bumps Node.js minimum to 18. \ No newline at end of file diff --git a/node_modules/@11ty/eleventy-dev-server/cli.js b/node_modules/@11ty/eleventy-dev-server/cli.js new file mode 100644 index 00000000..04be1cad --- /dev/null +++ b/node_modules/@11ty/eleventy-dev-server/cli.js @@ -0,0 +1,89 @@ +const pkg = require("./package.json"); +const EleventyDevServer = require("./server.js"); + +const Logger = { + info: function(...args) { + console.log( "[11ty/eleventy-dev-server]", ...args ); + }, + error: function(...args) { + console.error( "[11ty/eleventy-dev-server]", ...args ); + }, + fatal: function(...args) { + Logger.error(...args); + process.exitCode = 1; + } +}; + +Logger.log = Logger.info; + +class Cli { + static getVersion() { + return pkg.version; + } + + static getHelp() { + return `Usage: + + eleventy-dev-server + eleventy-dev-server --dir=_site + eleventy-dev-server --port=3000 + +Arguments: + + --version + + --dir=. + Directory to serve (default: \`.\`) + + --input (alias for --dir) + + --port=8080 + Run the web server on this port (default: \`8080\`) + Will autoincrement if already in use. + + --domdiff (enabled, default) + --domdiff=false (disabled) + Apply HTML changes without a full page reload. + + --help`; + } + + static getDefaultOptions() { + return { + port: "8080", + input: ".", + domDiff: true, + } + } + + async serve(options = {}) { + this.options = Object.assign(Cli.getDefaultOptions(), options); + + this.server = EleventyDevServer.getServer("eleventy-dev-server-cli", this.options.input, { + // TODO allow server configuration extensions + showVersion: true, + logger: Logger, + domDiff: this.options.domDiff, + + // CLI watches all files in the folder by default + // this is different from Eleventy usage! + watch: [ this.options.input ], + }); + + this.server.serve(this.options.port); + + // TODO? send any errors here to the server too + // with server.sendError({ error }); + } + + close() { + if(this.server) { + return this.server.close(); + } + } +} + +module.exports = { + Logger, + Cli +} diff --git a/node_modules/@11ty/eleventy-dev-server/client/reload-client.js b/node_modules/@11ty/eleventy-dev-server/client/reload-client.js new file mode 100644 index 00000000..fc0ddd12 --- /dev/null +++ b/node_modules/@11ty/eleventy-dev-server/client/reload-client.js @@ -0,0 +1,336 @@ +class Util { + static pad(num, digits = 2) { + let zeroes = new Array(digits + 1).join(0); + return `${zeroes}${num}`.slice(-1 * digits); + } + + static log(message) { + Util.output("log", message); + } + static error(message, error) { + Util.output("error", message, error); + } + static output(type, ...messages) { + let now = new Date(); + let date = `${Util.pad(now.getUTCHours())}:${Util.pad( + now.getUTCMinutes() + )}:${Util.pad(now.getUTCSeconds())}.${Util.pad( + now.getUTCMilliseconds(), + 3 + )}`; + console[type](`[11ty][${date} UTC]`, ...messages); + } + + static capitalize(word) { + return word.substr(0, 1).toUpperCase() + word.substr(1); + } + + static matchRootAttributes(htmlContent) { + // Workaround for morphdom bug with attributes on https://github.com/11ty/eleventy-dev-server/issues/6 + // Note also `childrenOnly: true` above + const parser = new DOMParser(); + let parsed = parser.parseFromString(htmlContent, "text/html"); + let parsedDoc = parsed.documentElement; + let newAttrs = parsedDoc.getAttributeNames(); + + let docEl = document.documentElement; + // Remove old + let removedAttrs = docEl.getAttributeNames().filter(name => !newAttrs.includes(name)); + for(let attr of removedAttrs) { + docEl.removeAttribute(attr); + } + + // Add new + for(let attr of newAttrs) { + docEl.setAttribute(attr, parsedDoc.getAttribute(attr)); + } + } + + static isEleventyLinkNodeMatch(from, to) { + // Issue #18 https://github.com/11ty/eleventy-dev-server/issues/18 + // Don’t update a if the _11ty searchParam is the only thing that’s different + if(from.tagName !== "LINK" || to.tagName !== "LINK") { + return false; + } + + let oldWithoutHref = from.cloneNode(); + let newWithoutHref = to.cloneNode(); + + oldWithoutHref.removeAttribute("href"); + newWithoutHref.removeAttribute("href"); + + // if all other attributes besides href match + if(!oldWithoutHref.isEqualNode(newWithoutHref)) { + return false; + } + + let oldUrl = new URL(from.href); + let newUrl = new URL(to.href); + + // morphdom wants to force href="style.css?_11ty" => href="style.css" + let paramName = EleventyReload.QUERY_PARAM; + let isErasing = oldUrl.searchParams.has(paramName) && !newUrl.searchParams.has(paramName); + if(!isErasing) { + // not a match if _11ty has a new value (not being erased) + return false; + } + + oldUrl.searchParams.set(paramName, ""); + newUrl.searchParams.set(paramName, ""); + + // is a match if erasing and the rest of the href matches too + return oldUrl.toString() === newUrl.toString(); + } + + // https://github.com/patrick-steele-idem/morphdom/issues/178#issuecomment-652562769 + static runScript(source, target) { + let script = document.createElement('script'); + + // copy over the attributes + for(let attr of [...source.attributes]) { + script.setAttribute(attr.nodeName ,attr.nodeValue); + } + + script.innerHTML = source.innerHTML; + (target || source).replaceWith(script); + } + + static fullPageReload() { + Util.log(`Page reload initiated.`); + window.location.reload(); + } +} + +class EleventyReload { + static QUERY_PARAM = "_11ty"; + + static reloadTypes = { + css: (files, build = {}) => { + // Initiate a full page refresh if a CSS change is made but does match any stylesheet url + // `build.stylesheets` available in Eleventy v3.0.1-alpha.5+ + if(Array.isArray(build.stylesheets)) { + let match = false; + for (let link of document.querySelectorAll(`link[rel="stylesheet"]`)) { + if (link.href) { + let url = new URL(link.href); + if(build.stylesheets.includes(url.pathname)) { + match = true; + } + } + } + + if(!match) { + Util.fullPageReload(); + return; + } + } + + for (let link of document.querySelectorAll(`link[rel="stylesheet"]`)) { + if (link.href) { + let url = new URL(link.href); + url.searchParams.set(this.QUERY_PARAM, Date.now()); + link.href = url.toString(); + } + } + + Util.log(`CSS updated without page reload.`); + }, + default: async (files, build = {}) => { + let morphed = false; + let domdiffTemplates = (build?.templates || []).filter(({url, inputPath}) => { + return url === document.location.pathname && (files || []).includes(inputPath); + }); + + if(domdiffTemplates.length === 0) { + Util.fullPageReload(); + return; + } + + try { + // Important: using `./` allows the `.11ty` folder name to be changed + const { default: morphdom } = await import(`./morphdom.js`); + + for (let {url, inputPath, content} of domdiffTemplates) { + // Notable limitation: this won’t re-run script elements or JavaScript page lifecycle events (load/DOMContentLoaded) + morphed = true; + + morphdom(document.documentElement, content, { + childrenOnly: true, + onBeforeElUpdated: function (fromEl, toEl) { + if (fromEl.nodeName === "SCRIPT" && toEl.nodeName === "SCRIPT") { + if(toEl.innerHTML !== fromEl.innerHTML) { + Util.log(`JavaScript modified, reload initiated.`); + window.location.reload(); + } + + return false; + } + + // Speed-up trick from morphdom docs + // https://dom.spec.whatwg.org/#concept-node-equals + if (fromEl.isEqualNode(toEl)) { + return false; + } + + if(Util.isEleventyLinkNodeMatch(fromEl, toEl)) { + return false; + } + + return true; + }, + addChild: function(parent, child) { + // Declarative Shadow DOM https://github.com/11ty/eleventy-dev-server/issues/90 + if(child.nodeName === "TEMPLATE" && child.hasAttribute("shadowrootmode")) { + let root = parent.shadowRoot; + if(root) { + // remove all shadow root children + while(root.firstChild) { + root.removeChild(root.firstChild); + } + } + for(let newChild of child.content.childNodes) { + root.appendChild(newChild); + } + } else { + parent.appendChild(child); + } + }, + onNodeAdded: function (node) { + if (node.nodeName === 'SCRIPT') { + Util.log(`JavaScript added, reload initiated.`); + window.location.reload(); + } + }, + onElUpdated: function(node) { + // Re-attach custom elements + if(customElements.get(node.tagName.toLowerCase())) { + let placeholder = document.createElement("div"); + node.replaceWith(placeholder); + requestAnimationFrame(() => { + placeholder.replaceWith(node); + placeholder = undefined; + }); + } + } + }); + + Util.matchRootAttributes(content); + Util.log(`HTML delta applied without page reload.`); + } + } catch(e) { + Util.error( "Morphdom error", e ); + } + + if (!morphed) { + Util.fullPageReload(); + } + } + } + + constructor() { + this.connectionMessageShown = false; + this.reconnectEventCallback = this.reconnect.bind(this); + } + + init(options = {}) { + if (!("WebSocket" in window)) { + return; + } + + let documentUrl = new URL(document.location.href); + + let reloadPort = new URL(import.meta.url).searchParams.get("reloadPort"); + if(reloadPort) { + documentUrl.port = reloadPort; + } + + let { protocol, host } = documentUrl; + + // works with http (ws) and https (wss) + let websocketProtocol = protocol.replace("http", "ws"); + + let socket = new WebSocket(`${websocketProtocol}//${host}`); + + socket.addEventListener("message", async (event) => { + try { + let data = JSON.parse(event.data); + // Util.log( JSON.stringify(data, null, 2) ); + + let { type } = data; + + if (type === "eleventy.reload") { + await this.onreload(data); + } else if (type === "eleventy.msg") { + Util.log(`${data.message}`); + } else if (type === "eleventy.error") { + // Log Eleventy build errors + // Extra parsing for Node Error objects + let e = JSON.parse(data.error); + Util.error(`Build error: ${e.message}`, e); + } else if (type === "eleventy.status") { + // Full page reload on initial reconnect + if (data.status === "connected" && options.mode === "reconnect") { + window.location.reload(); + } + + if(data.status === "connected") { + // With multiple windows, only show one connection message + if(!this.isConnected) { + Util.log(Util.capitalize(data.status)); + } + + this.connectionMessageShown = true; + } else { + if(data.status === "disconnected") { + this.addReconnectListeners(); + } + + Util.log(Util.capitalize(data.status)); + } + } else { + Util.log("Unknown event type", data); + } + } catch (e) { + Util.error(`Error parsing ${event.data}: ${e.message}`, e); + } + }); + + socket.addEventListener("open", () => { + // no reconnection when the connect is already open + this.removeReconnectListeners(); + }); + + socket.addEventListener("close", () => { + this.connectionMessageShown = false; + this.addReconnectListeners(); + }); + } + + reconnect() { + Util.log( "Reconnecting…" ); + this.init({ mode: "reconnect" }); + } + + async onreload({ subtype, files, build }) { + if(!EleventyReload.reloadTypes[subtype]) { + subtype = "default"; + } + + await EleventyReload.reloadTypes[subtype](files, build); + } + + addReconnectListeners() { + this.removeReconnectListeners(); + + window.addEventListener("focus", this.reconnectEventCallback); + window.addEventListener("visibilitychange", this.reconnectEventCallback); + } + + removeReconnectListeners() { + window.removeEventListener("focus", this.reconnectEventCallback); + window.removeEventListener("visibilitychange", this.reconnectEventCallback); + } +} + +let reloader = new EleventyReload(); +reloader.init(); \ No newline at end of file diff --git a/node_modules/@11ty/eleventy-dev-server/cmd.js b/node_modules/@11ty/eleventy-dev-server/cmd.js new file mode 100644 index 00000000..695b8459 --- /dev/null +++ b/node_modules/@11ty/eleventy-dev-server/cmd.js @@ -0,0 +1,77 @@ +#!/usr/bin/env node + +const pkg = require("./package.json"); + +// Node check +require("please-upgrade-node")(pkg, { + message: function (requiredVersion) { + return ( + "eleventy-dev-server requires Node " + + requiredVersion + + ". You will need to upgrade Node!" + ); + }, +}); + +const { Logger, Cli } = require("./cli.js"); + +const debug = require("debug")("Eleventy:DevServer"); + +try { + const defaults = Cli.getDefaultOptions(); + for(let key in defaults) { + if(key.toLowerCase() !== key) { + defaults[key.toLowerCase()] = defaults[key]; + delete defaults[key]; + } + } + + const argv = require("minimist")(process.argv.slice(2), { + string: [ + "dir", + "input", // alias for dir + "port", + ], + boolean: [ + "version", + "help", + "domdiff", + ], + default: defaults, + unknown: function (unknownArgument) { + throw new Error( + `We don’t know what '${unknownArgument}' is. Use --help to see the list of supported commands.` + ); + }, + }); + + debug("command: eleventy-dev-server %o", argv); + + process.on("unhandledRejection", (error, promise) => { + Logger.fatal("Unhandled rejection in promise:", promise, error); + }); + process.on("uncaughtException", (error) => { + Logger.fatal("Uncaught exception:", error); + }); + + if (argv.version) { + console.log(Cli.getVersion()); + } else if (argv.help) { + console.log(Cli.getHelp()); + } else { + let cli = new Cli(); + + cli.serve({ + input: argv.dir || argv.input, + port: argv.port, + domDiff: argv.domdiff, + }); + + process.on("SIGINT", async () => { + await cli.close(); + process.exitCode = 0; + }); + } +} catch (e) { + Logger.fatal("Fatal Error:", e) +} diff --git a/node_modules/@11ty/eleventy-dev-server/package.json b/node_modules/@11ty/eleventy-dev-server/package.json new file mode 100644 index 00000000..e413c7c1 --- /dev/null +++ b/node_modules/@11ty/eleventy-dev-server/package.json @@ -0,0 +1,57 @@ +{ + "name": "@11ty/eleventy-dev-server", + "version": "2.0.8", + "description": "A minimal, modern, generic, hot-reloading local web server to help web developers.", + "main": "server.js", + "scripts": { + "test": "npx ava --verbose", + "sample": "node cmd.js --input=test/stubs" + }, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + }, + "bin": { + "eleventy-dev-server": "./cmd.js" + }, + "keywords": [ + "eleventy", + "server", + "cli" + ], + "publishConfig": { + "access": "public" + }, + "author": { + "name": "Zach Leatherman", + "email": "zachleatherman@gmail.com", + "url": "https://zachleat.com/" + }, + "repository": { + "type": "git", + "url": "git://github.com/11ty/eleventy-dev-server.git" + }, + "bugs": "https://github.com/11ty/eleventy-dev-server/issues", + "homepage": "https://github.com/11ty/eleventy-dev-server/", + "dependencies": { + "@11ty/eleventy-utils": "^2.0.1", + "chokidar": "^3.6.0", + "debug": "^4.4.0", + "finalhandler": "^1.3.1", + "mime": "^3.0.0", + "minimist": "^1.2.8", + "morphdom": "^2.7.4", + "please-upgrade-node": "^3.2.0", + "send": "^1.1.0", + "ssri": "^11.0.0", + "urlpattern-polyfill": "^10.0.0", + "ws": "^8.18.1" + }, + "devDependencies": { + "ava": "^6.2.0" + } +} diff --git a/node_modules/@11ty/eleventy-dev-server/server.js b/node_modules/@11ty/eleventy-dev-server/server.js new file mode 100644 index 00000000..9fbe898e --- /dev/null +++ b/node_modules/@11ty/eleventy-dev-server/server.js @@ -0,0 +1,1024 @@ +const path = require("node:path"); +const fs = require("node:fs"); + +const finalhandler = require("finalhandler"); +const WebSocket = require("ws"); +const { WebSocketServer } = WebSocket; +const mime = require("mime"); +const ssri = require("ssri"); +const send = require("send"); +const chokidar = require("chokidar"); +const { TemplatePath, isPlainObject } = require("@11ty/eleventy-utils"); + +const debug = require("debug")("Eleventy:DevServer"); + +const pkg = require("./package.json"); +const wrapResponse = require("./server/wrapResponse.js"); +const ipAddress = require("./server/ipAddress.js"); + +if (!globalThis.URLPattern) { + require("urlpattern-polyfill"); +} + +const DEFAULT_OPTIONS = { + port: 8080, + reloadPort: false, // Falsy uses same as `port` + liveReload: true, // Enable live reload at all + showAllHosts: false, // IP address based hosts (other than localhost) + injectedScriptsFolder: ".11ty", // Change the name of the special folder used for injected scripts + portReassignmentRetryCount: 10, // number of times to increment the port if in use + https: {}, // `key` and `cert`, required for http/2 and https + domDiff: true, // Use morphdom to apply DOM diffing delta updates to HTML + showVersion: false, // Whether or not to show the server version on the command line. + encoding: "utf-8", // Default file encoding + pathPrefix: "/", // May be overridden by Eleventy, adds a virtual base directory to your project + watch: [], // Globs to pass to separate dev server chokidar for watching + aliases: {}, // Aliasing feature + indexFileName: "index.html", // Allow custom index file name + useCache: false, // Use a cache for file contents + headers: {}, // Set default response headers + messageOnStart: ({ hosts, startupTime, version, options }) => { + let hostsStr = " started"; + if(Array.isArray(hosts) && hosts.length > 0) { + // TODO what happens when the cert doesn’t cover non-localhost hosts? + hostsStr = ` at ${hosts.join(" or ")}`; + } + + return `Server${hostsStr}${options.showVersion ? ` (v${version})` : ""}`; + }, + + onRequest: {}, // Maps URLPatterns to dynamic callback functions that run on a request from a client. + + // Example: + // "/foo/:name": function({ url, pattern, patternGroups }) { + // return { + // headers: { + // "Content-Type": "text/html", + // }, + // body: `${url} ${JSON.stringify(patternGroups)}` + // } + // } + + // Logger (fancier one is injected by Eleventy) + logger: { + info: console.log, + log: console.log, + error: console.error, + } +} + +class EleventyDevServer { + #watcher; + #serverClosing; + #serverState; + #readyPromise; + #readyResolve; + + static getServer(...args) { + return new EleventyDevServer(...args); + } + + constructor(name, dir, options = {}) { + debug("Creating new Dev Server instance.") + this.name = name; + this.normalizeOptions(options); + + this.fileCache = {}; + // Directory to serve + if(!dir) { + throw new Error("Missing `dir` to serve."); + } + this.dir = dir; + this.logger = this.options.logger; + this.getWatcher(); + + this.#readyPromise = new Promise((resolve) => { + this.#readyResolve = resolve; + }) + } + + normalizeOptions(options = {}) { + this.options = Object.assign({}, DEFAULT_OPTIONS, options); + + // better names for options https://github.com/11ty/eleventy-dev-server/issues/41 + if(options.folder !== undefined) { + this.options.injectedScriptsFolder = options.folder; + delete this.options.folder; + } + if(options.domdiff !== undefined) { + this.options.domDiff = options.domdiff; + delete this.options.domdiff; + } + if(options.enabled !== undefined) { + this.options.liveReload = options.enabled; + delete this.options.enabled; + } + + this.options.pathPrefix = this.cleanupPathPrefix(this.options.pathPrefix); + } + + get watcher() { + if(this.#watcher) { + return this.#watcher; + } + + debug("Watching %O", this.options.watch); + // TODO if using Eleventy and `watch` option includes output folder (_site) this will trigger two update events! + this.#watcher = chokidar.watch(this.options.watch, { + // TODO allow chokidar configuration extensions (or re-use the ones in Eleventy) + + ignored: ["**/node_modules/**", ".git"], + ignoreInitial: true, + + // same values as Eleventy + awaitWriteFinish: { + stabilityThreshold: 150, + pollInterval: 25, + }, + }); + + this.#watcher.on("change", (path) => { + this.logger.log( `File changed: ${path} (skips build)` ); + this.reloadFiles([path]); + }); + + this.#watcher.on("add", (path) => { + this.logger.log( `File added: ${path} (skips build)` ); + this.reloadFiles([path]); + }); + + return this.#watcher; + } + + getWatcher() { + // only initialize watcher if watcher via getWatcher if has targets + // this.watcher in watchFiles() is a manual workaround + if(this.options.watch.length > 0) { + return this.watcher; + } + } + + watchFiles(files) { + if(Array.isArray(files) && files.length > 0) { + files = files.map(entry => TemplatePath.stripLeadingDotSlash(entry)); + + debug("Also watching %O", files); + this.watcher.add(files); + } + } + + cleanupPathPrefix(pathPrefix) { + if(!pathPrefix || pathPrefix === "/") { + return "/"; + } + if(!pathPrefix.startsWith("/")) { + pathPrefix = `/${pathPrefix}` + } + if(!pathPrefix.endsWith("/")) { + pathPrefix = `${pathPrefix}/`; + } + return pathPrefix; + } + + // Allowed list of files that can be served from outside `dir` + setAliases(aliases) { + if(aliases) { + this.passthroughAliases = aliases; + debug( "Setting aliases (emulated passthrough copy) %O", aliases ); + } + } + + matchPassthroughAlias(url) { + let aliases = Object.assign({}, this.options.aliases, this.passthroughAliases); + for(let targetUrl in aliases) { + if(!targetUrl) { + continue; + } + + let file = aliases[targetUrl]; + if(url.startsWith(targetUrl)) { + let inputDirectoryPath = file + url.slice(targetUrl.length); + + // e.g. addPassthroughCopy("img/") but + // generated by the image plugin (written to the output folder) + // If they do not exist in the input directory, this will fallback to the output directory. + if(fs.existsSync(inputDirectoryPath)) { + return inputDirectoryPath; + } + } + } + return false; + } + + isFileInDirectory(dir, file) { + let absoluteDir = TemplatePath.absolutePath(dir); + let absoluteFile = TemplatePath.absolutePath(file); + return absoluteFile.startsWith(absoluteDir); + } + + getOutputDirFilePath(filepath, filename = "") { + let computedPath; + if(filename === ".html") { + // avoid trailing slash for filepath/.html requests + let prefix = path.join(this.dir, filepath); + if(prefix.endsWith(path.sep)) { + prefix = prefix.substring(0, prefix.length - path.sep.length); + } + computedPath = prefix + filename; + } else { + computedPath = path.join(this.dir, filepath, filename); + } + + computedPath = decodeURIComponent(computedPath); + + if(!filename) { // is a direct URL request (not an implicit .html or index.html add) + let alias = this.matchPassthroughAlias(filepath); + + if(alias) { + if(!this.isFileInDirectory(path.resolve("."), alias)) { + throw new Error("Invalid path"); + } + + return alias; + } + } + + // Check that the file is in the output path (error if folks try use `..` in the filepath) + if(!this.isFileInDirectory(this.dir, computedPath)) { + throw new Error("Invalid path"); + } + + return computedPath; + } + + isOutputFilePathExists(rawPath) { + return fs.existsSync(rawPath) && !TemplatePath.isDirectorySync(rawPath); + } + + /* Use conventions documented here https://www.zachleat.com/web/trailing-slash/ + * resource.html exists: + * /resource matches + * /resource/ redirects to /resource + * resource/index.html exists: + * /resource redirects to /resource/ + * /resource/ matches + * both resource.html and resource/index.html exists: + * /resource matches /resource.html + * /resource/ matches /resource/index.html + */ + mapUrlToFilePath(url) { + // Note: `localhost` is not important here, any host would work + let u = new URL(url, "http://localhost/"); + url = u.pathname; + + // Remove PathPrefix from start of URL + if (this.options.pathPrefix !== "/") { + // Requests to root should redirect to new pathPrefix + if(url === "/") { + return { + statusCode: 302, + url: this.options.pathPrefix, + } + } + + // Requests to anything outside of root should fail with 404 + if (!url.startsWith(this.options.pathPrefix)) { + return { + statusCode: 404, + }; + } + + url = url.slice(this.options.pathPrefix.length - 1); + } + + let rawPath = this.getOutputDirFilePath(url); + if (this.isOutputFilePathExists(rawPath)) { + return { + statusCode: 200, + filepath: rawPath, + }; + } + + let indexHtmlPath = this.getOutputDirFilePath(url, this.options.indexFileName); + let indexHtmlExists = fs.existsSync(indexHtmlPath); + + let htmlPath = this.getOutputDirFilePath(url, ".html"); + let htmlExists = fs.existsSync(htmlPath); + + // /resource/ => /resource/index.html + if (indexHtmlExists && url.endsWith("/")) { + return { + statusCode: 200, + filepath: indexHtmlPath, + }; + } + // /resource => resource.html + if (htmlExists && !url.endsWith("/")) { + return { + statusCode: 200, + filepath: htmlPath, + }; + } + + // /resource => redirect to /resource/ + if (indexHtmlExists && !url.endsWith("/")) { + return { + statusCode: 301, + url: u.pathname + "/", + }; + } + + // /resource/ => redirect to /resource + if (htmlExists && url.endsWith("/")) { + return { + statusCode: 301, + url: u.pathname.substring(0, u.pathname.length - 1), + }; + } + + return { + statusCode: 404, + }; + } + + #readFile(filepath) { + if(this.options.useCache && this.fileCache[filepath]) { + return this.fileCache[filepath]; + } + + let contents = fs.readFileSync(filepath, { + encoding: this.options.encoding, + }); + + if(this.options.useCache) { + this.fileCache[filepath] = contents; + } + + return contents; + } + + #getFileContents(localpath, rootDir) { + let filepath; + let searchLocations = []; + + if(rootDir) { + searchLocations.push(TemplatePath.absolutePath(rootDir, localpath)); + } + + // fallbacks for file:../ installations + searchLocations.push(TemplatePath.absolutePath(__dirname, localpath)); + searchLocations.push(TemplatePath.absolutePath(__dirname, "../../../", localpath)); + + for(let loc of searchLocations) { + if(fs.existsSync(loc)) { + filepath = loc; + break; + } + } + + return this.#readFile(filepath); + } + + augmentContentWithNotifier(content, inlineContents = false, options = {}) { + let { integrityHash, scriptContents } = options; + if(!scriptContents) { + scriptContents = this.#getFileContents("./client/reload-client.js"); + } + if(!integrityHash) { + integrityHash = ssri.fromData(scriptContents); + } + + let searchParams = new URLSearchParams(); + if(this.options.reloadPort) { + searchParams.set("reloadPort", this.options.reloadPort); + } + + let searchParamsStr = searchParams.size > 0 ? `?${searchParams.toString()}` : ""; + + // This isn’t super necessary because it’s a local file, but it’s included anyway + let script = ``; + + if (content.includes("")) { + return content.replace("", `${script}`); + } + + // If the HTML document contains an importmap, insert the module script after the importmap element + let importMapRegEx = / + +``` + +* Existing calls via WebC helpers `getCss` or `getJs` (e.g. ` +{% endcss %} +* a way to declare dependencies? or just defer to buckets here +* What if we want to add code duplicates? Adding `alert(1);` `alert(1);` to alert twice? +* sourcemaps (maybe via magic-string module or https://www.npmjs.com/package/concat-with-sourcemaps) +--> \ No newline at end of file diff --git a/node_modules/@11ty/eleventy-plugin-bundle/eleventy.bundle.js b/node_modules/@11ty/eleventy-plugin-bundle/eleventy.bundle.js new file mode 100644 index 00000000..35f571ce --- /dev/null +++ b/node_modules/@11ty/eleventy-plugin-bundle/eleventy.bundle.js @@ -0,0 +1,72 @@ +import bundleManagersPlugin from "./src/eleventy.bundleManagers.js"; +import pruneEmptyBundlesPlugin from "./src/eleventy.pruneEmptyBundles.js"; +import globalShortcodesAndTransforms from "./src/eleventy.shortcodes.js"; +import debugUtil from "debug"; + +const debug = debugUtil("Eleventy:Bundle"); + +function normalizeOptions(options = {}) { + options = Object.assign({ + // Plugin defaults + + // Extra bundles + // css, js, and html are guaranteed unless `bundles: false` + bundles: [], + toFileDirectory: "bundle", + // post-process + transforms: [], + hoistDuplicateBundlesFor: [], + bundleExportKey: "bundle", // use a `bundle` export in a 11ty.js template to populate bundles + + force: false, // force overwrite of existing getBundleManagers and addBundle configuration API methods + }, options); + + if(options.bundles !== false) { + options.bundles = Array.from(new Set(["css", "js", "html", ...(options.bundles || [])])); + } + + return options; +} + +function eleventyBundlePlugin(eleventyConfig, pluginOptions = {}) { + eleventyConfig.versionCheck(">=3.0.0"); + pluginOptions = normalizeOptions(pluginOptions); + + let alreadyAdded = "getBundleManagers" in eleventyConfig || "addBundle" in eleventyConfig; + if(!alreadyAdded || pluginOptions.force) { + if(alreadyAdded && pluginOptions.force) { + debug("Bundle plugin already added via `addPlugin`, add was forced via `force: true`"); + } + + bundleManagersPlugin(eleventyConfig, pluginOptions); + } + + // These can’t be unique (don’t skip re-add above), when the configuration file resets they need to be added again + pruneEmptyBundlesPlugin(eleventyConfig, pluginOptions); + globalShortcodesAndTransforms(eleventyConfig, pluginOptions); + + // Support subsequent calls like addPlugin(BundlePlugin, { bundles: [] }); + if(Array.isArray(pluginOptions.bundles)) { + debug("Adding bundles via `addPlugin`: %o", pluginOptions.bundles) + pluginOptions.bundles.forEach(name => { + let isHoisting = Array.isArray(pluginOptions.hoistDuplicateBundlesFor) && pluginOptions.hoistDuplicateBundlesFor.includes(name); + + eleventyConfig.addBundle(name, { + hoist: isHoisting, + outputFileExtension: name, // default as `name` + shortcodeName: name, // `false` will skip shortcode + transforms: pluginOptions.transforms, + toFileDirectory: pluginOptions.toFileDirectory, + bundleExportKey: pluginOptions.bundleExportKey, // `false` will skip bundle export + }); + }); + } +}; + +// This is used to find the package name for this plugin (used in eleventy-plugin-webc to prevent dupes) +Object.defineProperty(eleventyBundlePlugin, "eleventyPackage", { + value: "@11ty/eleventy-plugin-bundle" +}); + +export default eleventyBundlePlugin; +export { normalizeOptions }; diff --git a/node_modules/@11ty/eleventy-plugin-bundle/package.json b/node_modules/@11ty/eleventy-plugin-bundle/package.json new file mode 100644 index 00000000..21c8405b --- /dev/null +++ b/node_modules/@11ty/eleventy-plugin-bundle/package.json @@ -0,0 +1,62 @@ +{ + "name": "@11ty/eleventy-plugin-bundle", + "version": "3.0.7", + "description": "Little bundles of code, little bundles of joy.", + "main": "eleventy.bundle.js", + "type": "module", + "scripts": { + "sample": "DEBUG=Eleventy:Bundle npx @11ty/eleventy --config=sample/sample-config.js --input=sample --serve", + "test": "npx ava" + }, + "publishConfig": { + "access": "public" + }, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + }, + "keywords": [ + "eleventy", + "eleventy-plugin" + ], + "repository": { + "type": "git", + "url": "git://github.com/11ty/eleventy-plugin-bundle.git" + }, + "bugs": "https://github.com/11ty/eleventy-plugin-bundle/issues", + "homepage": "https://www.11ty.dev/", + "author": { + "name": "Zach Leatherman", + "email": "zachleatherman@gmail.com", + "url": "https://zachleat.com/" + }, + "ava": { + "failFast": true, + "files": [ + "test/*.js", + "test/*.mjs" + ], + "watchMode": { + "ignoreChanges": [ + "**/_site/**", + ".cache" + ] + } + }, + "devDependencies": { + "@11ty/eleventy": "^3.0.0", + "ava": "^6.2.0", + "postcss": "^8.5.3", + "postcss-nested": "^7.0.2", + "sass": "^1.86.3" + }, + "dependencies": { + "@11ty/eleventy-utils": "^2.0.2", + "debug": "^4.4.0", + "posthtml-match-helper": "^2.0.3" + } +} diff --git a/node_modules/@11ty/eleventy-plugin-bundle/src/BundleFileOutput.js b/node_modules/@11ty/eleventy-plugin-bundle/src/BundleFileOutput.js new file mode 100644 index 00000000..332c5b71 --- /dev/null +++ b/node_modules/@11ty/eleventy-plugin-bundle/src/BundleFileOutput.js @@ -0,0 +1,75 @@ +import fs from "node:fs"; +import path from "node:path"; +import debugUtil from "debug"; + +import { createHash } from "@11ty/eleventy-utils"; + +const debug = debugUtil("Eleventy:Bundle"); + +const hashCache = {}; +const directoryExistsCache = {}; +const writingCache = new Set(); + +class BundleFileOutput { + constructor(outputDirectory, bundleDirectory) { + this.outputDirectory = outputDirectory; + this.bundleDirectory = bundleDirectory || ""; + this.hashLength = 10; + this.fileExtension = undefined; + } + + setFileExtension(ext) { + this.fileExtension = ext; + } + + async getFilenameHash(content) { + if(hashCache[content]) { + return hashCache[content]; + } + + let base64hash = await createHash(content); + let filenameHash = base64hash.substring(0, this.hashLength); + hashCache[content] = filenameHash; + return filenameHash; + } + + getFilename(filename, extension) { + return filename + (extension && !extension.startsWith(".") ? `.${extension}` : ""); + } + + modifyPathToUrl(dir, filename) { + return "/" + path.join(dir, filename).split(path.sep).join("/"); + } + + async writeBundle(content, type, writeToFileSystem) { + // do not write a bundle, do not return a file name is content is empty + if(!content) { + return; + } + + let dir = path.join(this.outputDirectory, this.bundleDirectory); + let filenameHash = await this.getFilenameHash(content); + let filename = this.getFilename(filenameHash, this.fileExtension || type); + + if(writeToFileSystem) { + let fullPath = path.join(dir, filename); + + // no duplicate writes, this may be improved with a fs exists check, but it would only save the first write + if(!writingCache.has(fullPath)) { + writingCache.add(fullPath); + + if(!directoryExistsCache[dir]) { + fs.mkdirSync(dir, { recursive: true }); + directoryExistsCache[dir] = true; + } + + debug("Writing bundle %o", fullPath); + fs.writeFileSync(fullPath, content); + } + } + + return this.modifyPathToUrl(this.bundleDirectory, filename); + } +} + +export { BundleFileOutput }; diff --git a/node_modules/@11ty/eleventy-plugin-bundle/src/CodeManager.js b/node_modules/@11ty/eleventy-plugin-bundle/src/CodeManager.js new file mode 100644 index 00000000..809c242a --- /dev/null +++ b/node_modules/@11ty/eleventy-plugin-bundle/src/CodeManager.js @@ -0,0 +1,231 @@ +import { BundleFileOutput } from "./BundleFileOutput.js"; +import debugUtil from "debug"; + +const debug = debugUtil("Eleventy:Bundle"); +const DEBUG_LOG_TRUNCATION_SIZE = 200; + +class CodeManager { + // code is placed in this bucket by default + static DEFAULT_BUCKET_NAME = "default"; + + // code is hoisted to this bucket when necessary + static HOISTED_BUCKET_NAME = "default"; + + constructor(name) { + this.name = name; + this.trimOnAdd = true; + // TODO unindent on add + this.reset(); + this.transforms = []; + this.isHoisting = true; + this.fileExtension = undefined; + this.toFileDirectory = undefined; + this.bundleExportKey = "bundle"; + this.runsAfterHtmlTransformer = false; + this.pluckedSelector = undefined; + } + + setDelayed(isDelayed) { + this.runsAfterHtmlTransformer = Boolean(isDelayed); + } + + isDelayed() { + return this.runsAfterHtmlTransformer; + } + + // posthtml-match-selector friendly + setPluckedSelector(selector) { + this.pluckedSelector = selector; + } + + getPluckedSelector() { + return this.pluckedSelector; + } + + setFileExtension(ext) { + this.fileExtension = ext; + } + + setHoisting(enabled) { + this.isHoisting = !!enabled; + } + + setBundleDirectory(dir) { + this.toFileDirectory = dir; + } + + setBundleExportKey(key) { + this.bundleExportKey = key; + } + + getBundleExportKey() { + return this.bundleExportKey; + } + + reset() { + this.pages = {}; + } + + static normalizeBuckets(bucket) { + if(Array.isArray(bucket)) { + return bucket; + } else if(typeof bucket === "string") { + return bucket.split(","); + } + return [CodeManager.DEFAULT_BUCKET_NAME]; + } + + setTransforms(transforms) { + if(!Array.isArray(transforms)) { + throw new Error("Array expected to setTransforms"); + } + + this.transforms = transforms; + } + + _initBucket(pageUrl, bucket) { + if(!this.pages[pageUrl][bucket]) { + this.pages[pageUrl][bucket] = new Set(); + } + } + + addToPage(pageUrl, code = [], bucket) { + if(!Array.isArray(code) && code) { + code = [code]; + } + if(code.length === 0) { + return; + } + + if(!this.pages[pageUrl]) { + this.pages[pageUrl] = {}; + } + + let buckets = CodeManager.normalizeBuckets(bucket); + + let codeContent = code.map(entry => { + if(this.trimOnAdd) { + return entry.trim(); + } + return entry; + }); + + + for(let b of buckets) { + this._initBucket(pageUrl, b); + + for(let content of codeContent) { + if(content) { + if(!this.pages[pageUrl][b].has(content)) { + debug("Adding code to bundle %o for %o (bucket: %o, size: %o): %o", this.name, pageUrl, b, content.length, content.length > DEBUG_LOG_TRUNCATION_SIZE ? content.slice(0, DEBUG_LOG_TRUNCATION_SIZE) + "…" : content); + this.pages[pageUrl][b].add(content); + } + } + } + } + } + + async runTransforms(str, pageData, buckets) { + for (let callback of this.transforms) { + str = await callback.call( + { + page: pageData, + type: this.name, + buckets: buckets + }, + str + ); + } + + return str; + } + + getBucketsForPage(pageData) { + let pageUrl = pageData.url; + if(!this.pages[pageUrl]) { + return []; + } + return Object.keys(this.pages[pageUrl]); + } + + getRawForPage(pageData, buckets = undefined) { + let url = pageData.url; + if(!this.pages[url]) { + debug("No bundle code found for %o on %o, %O", this.name, url, this.pages); + return new Set(); + } + + buckets = CodeManager.normalizeBuckets(buckets); + + let set = new Set(); + let size = 0; + for(let b of buckets) { + if(!this.pages[url][b]) { + // Just continue, if you retrieve code from a bucket that doesn’t exist or has no code, it will return an empty set + continue; + } + + for(let entry of this.pages[url][b]) { + size += entry.length; + set.add(entry); + } + } + + debug("Retrieving %o for %o (buckets: %o, entries: %o, size: %o)", this.name, url, buckets, set.size, size); + return set; + } + + async getForPage(pageData, buckets = undefined) { + let set = this.getRawForPage(pageData, buckets); + let bundleContent = Array.from(set).join("\n"); + + // returns promise + return this.runTransforms(bundleContent, pageData, buckets); + } + + async writeBundle(pageData, buckets, options = {}) { + let url = pageData.url; + if(!this.pages[url]) { + debug("No bundle code found for %o on %o, %O", this.name, url, this.pages); + return ""; + } + + let { output, write } = options; + + buckets = CodeManager.normalizeBuckets(buckets); + + // TODO the bundle output URL might be useful in the transforms for sourcemaps + let content = await this.getForPage(pageData, buckets); + let writer = new BundleFileOutput(output, this.toFileDirectory); + writer.setFileExtension(this.fileExtension); + return writer.writeBundle(content, this.name, write); + } + + // Used when a bucket is output multiple times on a page and needs to be hoisted + hoistBucket(pageData, bucketName) { + let newTargetBucketName = CodeManager.HOISTED_BUCKET_NAME; + if(!this.isHoisting || bucketName === newTargetBucketName) { + return; + } + + let url = pageData.url; + if(!this.pages[url] || !this.pages[url][bucketName]) { + debug("No bundle code found for %o on %o, %O", this.name, url, this.pages); + return; + } + + debug("Code in bucket (%o) is being hoisted to a new bucket (%o)", bucketName, newTargetBucketName); + + this._initBucket(url, newTargetBucketName); + + for(let codeEntry of this.pages[url][bucketName]) { + this.pages[url][bucketName].delete(codeEntry); + this.pages[url][newTargetBucketName].add(codeEntry); + } + + // delete the bucket + delete this.pages[url][bucketName]; + } +} + +export { CodeManager }; diff --git a/node_modules/@11ty/eleventy-plugin-bundle/src/OutOfOrderRender.js b/node_modules/@11ty/eleventy-plugin-bundle/src/OutOfOrderRender.js new file mode 100644 index 00000000..6cafa491 --- /dev/null +++ b/node_modules/@11ty/eleventy-plugin-bundle/src/OutOfOrderRender.js @@ -0,0 +1,158 @@ +import debugUtil from "debug"; + +const debug = debugUtil("Eleventy:Bundle"); + +/* This class defers any `bundleGet` calls to a post-build transform step, + * to allow `getBundle` to be called before all of the `css` additions have been processed + */ +class OutOfOrderRender { + static SPLIT_REGEX = /(\/\*__EleventyBundle:[^:]*:[^:]*:[^:]*:EleventyBundle__\*\/)/; + static SEPARATOR = ":"; + + constructor(content) { + this.content = content; + this.managers = {}; + } + + // type if `get` (return string) or `file` (bundle writes to file, returns file url) + static getAssetKey(type, name, bucket) { + if(Array.isArray(bucket)) { + bucket = bucket.join(","); + } else if(typeof bucket === "string") { + } else { + bucket = ""; + } + return `/*__EleventyBundle:${type}:${name}:${bucket || "default"}:EleventyBundle__*/` + } + + static parseAssetKey(str) { + if(str.startsWith("/*__EleventyBundle:")) { + let [prefix, type, name, bucket, suffix] = str.split(OutOfOrderRender.SEPARATOR); + return { type, name, bucket }; + } + return false; + } + + setAssetManager(name, assetManager) { + this.managers[name] = assetManager; + } + + setOutputDirectory(dir) { + this.outputDirectory = dir; + } + + normalizeMatch(match) { + let ret = OutOfOrderRender.parseAssetKey(match) + return ret || match; + } + + findAll() { + let matches = this.content.split(OutOfOrderRender.SPLIT_REGEX); + let ret = []; + for(let match of matches) { + ret.push(this.normalizeMatch(match)); + } + return ret; + } + + setWriteToFileSystem(isWrite) { + this.writeToFileSystem = isWrite; + } + + getAllBucketsForPage(pageData) { + let availableBucketsForPage = new Set(); + for(let name in this.managers) { + for(let bucket of this.managers[name].getBucketsForPage(pageData)) { + availableBucketsForPage.add(`${name}::${bucket}`); + } + } + return availableBucketsForPage; + } + + getManager(name) { + if(!this.managers[name]) { + throw new Error(`No asset manager found for ${name}. Known names: ${Object.keys(this.managers)}`); + } + return this.managers[name]; + } + + async replaceAll(pageData, stage = 0) { + let matches = this.findAll(); + let availableBucketsForPage = this.getAllBucketsForPage(pageData); + let usedBucketsOnPage = new Set(); + let bucketsOutputStringCount = {}; + let bucketsFileCount = {}; + + for(let match of matches) { + if(typeof match === "string") { + continue; + } + + // type is `file` or `get` + let {type, name, bucket} = match; + let key = `${name}::${bucket}`; + if(!usedBucketsOnPage.has(key)) { + usedBucketsOnPage.add(key); + } + + if(type === "get") { + if(!bucketsOutputStringCount[key]) { + bucketsOutputStringCount[key] = 0; + } + bucketsOutputStringCount[key]++; + } else if(type === "file") { + if(!bucketsFileCount[key]) { + bucketsFileCount[key] = 0; + } + bucketsFileCount[key]++; + } + } + + // Hoist code in non-default buckets that are output multiple times + // Only hoist if 2+ `get` OR 1+ `get` and 1+ `file` + for(let bucketInfo in bucketsOutputStringCount) { + let stringOutputCount = bucketsOutputStringCount[bucketInfo]; + if(stringOutputCount > 1 || stringOutputCount === 1 && bucketsFileCount[bucketInfo] > 0) { + let [name, bucketName] = bucketInfo.split("::"); + this.getManager(name).hoistBucket(pageData, bucketName); + } + } + + let content = await Promise.all(matches.map(match => { + if(typeof match === "string") { + return match; + } + + let {type, name, bucket} = match; + let manager = this.getManager(name); + + // Quit early if in stage 0, run delayed replacements if in stage 1+ + if(typeof manager.isDelayed === "function" && manager.isDelayed() && stage === 0) { + return OutOfOrderRender.getAssetKey(type, name, bucket); + } + + if(type === "get") { + // returns promise + return manager.getForPage(pageData, bucket); + } else if(type === "file") { + // returns promise + return manager.writeBundle(pageData, bucket, { + output: this.outputDirectory, + write: this.writeToFileSystem, + }); + } + return ""; + })); + + for(let bucketInfo of availableBucketsForPage) { + if(!usedBucketsOnPage.has(bucketInfo)) { + let [name, bucketName] = bucketInfo.split("::"); + debug(`WARNING! \`${pageData.inputPath}\` has unbundled \`${name}\` assets (in the '${bucketName}' bucket) that were not written to or used on the page. You might want to add a call to \`getBundle('${name}', '${bucketName}')\` to your content! Learn more: https://github.com/11ty/eleventy-plugin-bundle#asset-bucketing`); + } + } + + return content.join(""); + } +} + +export { OutOfOrderRender }; diff --git a/node_modules/@11ty/eleventy-plugin-bundle/src/bundlePlucker.js b/node_modules/@11ty/eleventy-plugin-bundle/src/bundlePlucker.js new file mode 100644 index 00000000..5dcad467 --- /dev/null +++ b/node_modules/@11ty/eleventy-plugin-bundle/src/bundlePlucker.js @@ -0,0 +1,69 @@ +import debugUtil from "debug"; +import matchHelper from "posthtml-match-helper"; + +const debug = debugUtil("Eleventy:Bundle"); + +const ATTRS = { + ignore: "eleventy:ignore", + bucket: "eleventy:bucket", +}; + +const POSTHTML_PLUGIN_NAME = "11ty/eleventy/html-bundle-plucker"; + +function hasAttribute(node, name) { + return node?.attrs?.[name] !== undefined; +} + +function addHtmlPlucker(eleventyConfig, bundleManager) { + let matchSelector = bundleManager.getPluckedSelector(); + + if(!matchSelector) { + throw new Error("Internal error: missing plucked selector on bundle manager."); + } + + eleventyConfig.htmlTransformer.addPosthtmlPlugin( + "html", + function (context = {}) { + let pageUrl = context?.url; + if(!pageUrl) { + throw new Error("Internal error: missing `url` property from context."); + } + + return function (tree, ...args) { + tree.match(matchHelper(matchSelector), function (node) { + try { + // ignore + if(hasAttribute(node, ATTRS.ignore)) { + delete node.attrs[ATTRS.ignore]; + return node; + } + + if(Array.isArray(node?.content) && node.content.length > 0) { + // TODO make this better decoupled + if(node?.content.find(entry => entry.includes(`/*__EleventyBundle:`))) { + // preserve {% getBundle %} calls as-is + return node; + } + + let bucketName = node?.attrs?.[ATTRS.bucket]; + bundleManager.addToPage(pageUrl, [ ...node.content ], bucketName); + + return { attrs: [], content: [], tag: false }; + } + } catch(e) { + debug(`Bundle plucker: error adding content to bundle in HTML Assets: %o`, e); + return node; + } + + return node; + }); + }; + }, + { + // pluginOptions + name: POSTHTML_PLUGIN_NAME, + }, + ); +} + +export { addHtmlPlucker }; diff --git a/node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.bundleManagers.js b/node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.bundleManagers.js new file mode 100644 index 00000000..8510abc3 --- /dev/null +++ b/node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.bundleManagers.js @@ -0,0 +1,85 @@ +import debugUtil from "debug"; +import { CodeManager } from "./CodeManager.js"; +import { addHtmlPlucker } from "./bundlePlucker.js" + +const debug = debugUtil("Eleventy:Bundle"); + +function eleventyBundleManagers(eleventyConfig, pluginOptions = {}) { + if(pluginOptions.force) { + // no errors + } else if(("getBundleManagers" in eleventyConfig || "addBundle" in eleventyConfig)) { + throw new Error("Duplicate addPlugin calls for @11ty/eleventy-plugin-bundle"); + } + + let managers = {}; + + function addBundle(name, bundleOptions = {}) { + if(name in managers) { + // note: shortcode must still be added + debug("Bundle exists %o, skipping.", name); + } else { + debug("Creating new bundle %o", name); + managers[name] = new CodeManager(name); + + if(bundleOptions.delayed !== undefined) { + managers[name].setDelayed(bundleOptions.delayed); + } + + if(bundleOptions.hoist !== undefined) { + managers[name].setHoisting(bundleOptions.hoist); + } + + if(bundleOptions.bundleHtmlContentFromSelector !== undefined) { + managers[name].setPluckedSelector(bundleOptions.bundleHtmlContentFromSelector); + managers[name].setDelayed(true); // must override `delayed` above + + addHtmlPlucker(eleventyConfig, managers[name]); + } + + if(bundleOptions.bundleExportKey !== undefined) { + managers[name].setBundleExportKey(bundleOptions.bundleExportKey); + } + + if(bundleOptions.outputFileExtension) { + managers[name].setFileExtension(bundleOptions.outputFileExtension); + } + + if(bundleOptions.toFileDirectory) { + managers[name].setBundleDirectory(bundleOptions.toFileDirectory); + } + + if(bundleOptions.transforms) { + managers[name].setTransforms(bundleOptions.transforms); + } + } + + // if undefined, defaults to `name` + if(bundleOptions.shortcodeName !== false) { + let shortcodeName = bundleOptions.shortcodeName || name; + + // e.g. `css` shortcode to add code to page bundle + // These shortcode names are not configurable on purpose (for wider plugin compatibility) + eleventyConfig.addPairedShortcode(shortcodeName, function addContent(content, bucket, explicitUrl) { + let url = explicitUrl || this.page?.url; + if(url) { // don’t add if a file doesn’t have an output URL + managers[name].addToPage(url, content, bucket); + } + return ""; + }); + } + }; + + eleventyConfig.addBundle = addBundle; + + eleventyConfig.getBundleManagers = function() { + return managers; + }; + + eleventyConfig.on("eleventy.before", async () => { + for(let key in managers) { + managers[key].reset(); + } + }); +}; + +export default eleventyBundleManagers; diff --git a/node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.pruneEmptyBundles.js b/node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.pruneEmptyBundles.js new file mode 100644 index 00000000..3bcaa72e --- /dev/null +++ b/node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.pruneEmptyBundles.js @@ -0,0 +1,105 @@ +import matchHelper from "posthtml-match-helper"; +import debugUtil from "debug"; + +const debug = debugUtil("Eleventy:Bundle"); + +const ATTRS = { + keep: "eleventy:keep" +}; + +const POSTHTML_PLUGIN_NAME = "11ty/eleventy-bundle/prune-empty"; + +function getTextNodeContent(node) { + if (!node.content) { + return ""; + } + + return node.content + .map((entry) => { + if (typeof entry === "string") { + return entry; + } + if (Array.isArray(entry.content)) { + return getTextNodeContent(entry); + } + return ""; + }) + .join(""); +} + +function eleventyPruneEmptyBundles(eleventyConfig, options = {}) { + // Right now script[src],link[rel="stylesheet"] nodes are removed if the final bundles are empty. + // `false` to disable + options.pruneEmptySelector = options.pruneEmptySelector ?? `style,script,link[rel="stylesheet"]`; + + // Subsequent call can remove a previously added `addPosthtmlPlugin` entry + // htmlTransformer.remove is v3.0.1-alpha.4+ + if(typeof eleventyConfig.htmlTransformer.remove === "function") { + eleventyConfig.htmlTransformer.remove("html", entry => { + if(entry.name === POSTHTML_PLUGIN_NAME) { + return true; + } + + // Temporary workaround for missing `name` property. + let fnStr = entry.fn.toString(); + return !entry.name && fnStr.startsWith("function (pluginOptions = {}) {") && fnStr.includes(`tree.match(matchHelper(options.pruneEmptySelector), function (node)`); + }); + } + + // `false` disables this plugin + if(options.pruneEmptySelector === false) { + return; + } + + if(!eleventyConfig.htmlTransformer || !eleventyConfig.htmlTransformer?.constructor?.SUPPORTS_PLUGINS_ENABLED_CALLBACK) { + debug("You will need to upgrade your version of Eleventy core to remove empty bundle tags automatically (v3 or newer)."); + return; + } + + eleventyConfig.htmlTransformer.addPosthtmlPlugin( + "html", + function bundlePruneEmptyPosthtmlPlugin(pluginOptions = {}) { + return function (tree) { + tree.match(matchHelper(options.pruneEmptySelector), function (node) { + if(node.attrs && node.attrs[ATTRS.keep] !== undefined) { + delete node.attrs[ATTRS.keep]; + return node; + } + + // + if(node.tag === "link") { + if(node.attrs?.rel === "stylesheet" && (node.attrs?.href || "").trim().length === 0) { + return false; + } + } else { + let content = getTextNodeContent(node); + + if(!content) { + // or + if(node.tag === "script" && (node.attrs?.src || "").trim().length === 0) { + return false; + } + + // + if(node.tag === "style") { + return false; + } + } + } + + + return node; + }); + }; + }, + { + name: POSTHTML_PLUGIN_NAME, + // the `enabled` callback for plugins is available on v3.0.0-alpha.20+ and v3.0.0-beta.2+ + enabled: () => { + return Object.keys(eleventyConfig.getBundleManagers()).length > 0; + } + } + ); +} + +export default eleventyPruneEmptyBundles; diff --git a/node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.shortcodes.js b/node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.shortcodes.js new file mode 100644 index 00000000..924731a8 --- /dev/null +++ b/node_modules/@11ty/eleventy-plugin-bundle/src/eleventy.shortcodes.js @@ -0,0 +1,83 @@ +import { OutOfOrderRender } from "./OutOfOrderRender.js"; +import debugUtil from "debug"; + +const debug = debugUtil("Eleventy:Bundle"); + +export default function(eleventyConfig, pluginOptions = {}) { + let managers = eleventyConfig.getBundleManagers(); + let writeToFileSystem = true; + + function bundleTransform(content, stage = 0) { + // Only run if content is string + // Only run if managers are in play + if(typeof content !== "string" || Object.keys(managers).length === 0) { + return content; + } + + debug("Processing %o", this.page.url); + let render = new OutOfOrderRender(content); + for(let key in managers) { + render.setAssetManager(key, managers[key]); + } + + render.setOutputDirectory(eleventyConfig.directories.output); + render.setWriteToFileSystem(writeToFileSystem); + + return render.replaceAll(this.page, stage); + } + + eleventyConfig.on("eleventy.before", async ({ outputMode }) => { + if(Object.keys(managers).length === 0) { + return; + } + + if(outputMode !== "fs") { + writeToFileSystem = false; + debug("Skipping writing to the file system due to output mode: %o", outputMode); + } + }); + + // e.g. `getBundle` shortcode to get code in current page bundle + // bucket can be an array + // This shortcode name is not configurable on purpose (for wider plugin compatibility) + eleventyConfig.addShortcode("getBundle", function getContent(type, bucket, explicitUrl) { + if(!type || !(type in managers) || Object.keys(managers).length === 0) { + throw new Error(`Invalid bundle type: ${type}. Available options: ${Object.keys(managers)}`); + } + + return OutOfOrderRender.getAssetKey("get", type, bucket); + }); + + // write a bundle to the file system + // This shortcode name is not configurable on purpose (for wider plugin compatibility) + eleventyConfig.addShortcode("getBundleFileUrl", function(type, bucket, explicitUrl) { + if(!type || !(type in managers) || Object.keys(managers).length === 0) { + throw new Error(`Invalid bundle type: ${type}. Available options: ${Object.keys(managers)}`); + } + + return OutOfOrderRender.getAssetKey("file", type, bucket); + }); + + eleventyConfig.addTransform("@11ty/eleventy-bundle", function (content) { + let hasNonDelayedManagers = Boolean(Object.values(eleventyConfig.getBundleManagers()).find(manager => { + return typeof manager.isDelayed !== "function" || !manager.isDelayed(); + })); + if(hasNonDelayedManagers) { + return bundleTransform.call(this, content, 0); + } + return content; + }); + + eleventyConfig.addPlugin((eleventyConfig) => { + // Delayed bundles *MUST* not alter URLs + eleventyConfig.addTransform("@11ty/eleventy-bundle/delayed", function (content) { + let hasDelayedManagers = Boolean(Object.values(eleventyConfig.getBundleManagers()).find(manager => { + return typeof manager.isDelayed === "function" && manager.isDelayed(); + })); + if(hasDelayedManagers) { + return bundleTransform.call(this, content, 1); + } + return content; + }); + }); +}; diff --git a/node_modules/@11ty/eleventy-utils/LICENSE b/node_modules/@11ty/eleventy-utils/LICENSE new file mode 100644 index 00000000..d52e149f --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022–2024 Zach Leatherman @zachleat + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@11ty/eleventy-utils/README.md b/node_modules/@11ty/eleventy-utils/README.md new file mode 100644 index 00000000..e7b2cc80 --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/README.md @@ -0,0 +1,27 @@ +

eleventy Logo

+ +# eleventy-utils 🕚⚡️🎈🐀 + +Low level internal utilities to be shared amongst Eleventy projects. + +## ➡ [Documentation](https://www.11ty.dev/docs/) + +- Please star [Eleventy on GitHub](https://github.com/11ty/eleventy/)! +- Follow us on Twitter [@eleven_ty](https://twitter.com/eleven_ty) +- Support [11ty on Open Collective](https://opencollective.com/11ty) +- [11ty on npm](https://www.npmjs.com/org/11ty) +- [11ty on GitHub](https://github.com/11ty) + +## Installation + +``` +npm install @11ty/eleventy-utils +``` + +## Tests + +``` +npm run test +``` + +- We use the native NodeJS [test runner](https://nodejs.org/api/test.html#test-runner) and ([assertions](https://nodejs.org/api/assert.html#assert)) diff --git a/node_modules/@11ty/eleventy-utils/index.js b/node_modules/@11ty/eleventy-utils/index.js new file mode 100644 index 00000000..b3290823 --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/index.js @@ -0,0 +1,20 @@ +const TemplatePath = require("./src/TemplatePath.js"); +const isPlainObject = require("./src/IsPlainObject.js"); +const Merge = require("./src/Merge.js"); +const DateCompare = require("./src/DateCompare.js"); +const { DeepCopy } = Merge; +const { createHash, createHashHex, createHashSync, createHashHexSync } = require("./src/CreateHash.js"); +const Buffer = require("./src/Buffer.js"); + +module.exports = { + TemplatePath, + isPlainObject, + Merge, + DeepCopy, + DateCompare, + createHash, + createHashHex, + createHashSync, + createHashHexSync, + Buffer, +}; \ No newline at end of file diff --git a/node_modules/@11ty/eleventy-utils/package.json b/node_modules/@11ty/eleventy-utils/package.json new file mode 100644 index 00000000..8892430c --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/package.json @@ -0,0 +1,42 @@ +{ + "name": "@11ty/eleventy-utils", + "version": "2.0.7", + "description": "Low level internal utilities to be shared amongst Eleventy projects", + "main": "index.js", + "files": [ + "src", + "src/**", + "index.js", + "!test", + "!test/**" + ], + "scripts": { + "test": "node --test", + "watch": "node --test --watch" + }, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + }, + "keywords": [ + "eleventy" + ], + "publishConfig": { + "access": "public" + }, + "author": { + "name": "Zach Leatherman", + "email": "zachleatherman@gmail.com", + "url": "https://zachleat.com/" + }, + "repository": { + "type": "git", + "url": "git://github.com/11ty/eleventy-utils.git" + }, + "bugs": "https://github.com/11ty/eleventy-utils/issues", + "homepage": "https://github.com/11ty/eleventy-utils/" +} diff --git a/node_modules/@11ty/eleventy-utils/src/Buffer.js b/node_modules/@11ty/eleventy-utils/src/Buffer.js new file mode 100644 index 00000000..8fb0cd4c --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/src/Buffer.js @@ -0,0 +1,10 @@ +function isBuffer(inst) { + if(typeof Buffer !== "undefined") { + return Buffer.isBuffer(inst); + } + return inst instanceof Uint8Array; +} + +module.exports = { + isBuffer +} \ No newline at end of file diff --git a/node_modules/@11ty/eleventy-utils/src/CreateHash.js b/node_modules/@11ty/eleventy-utils/src/CreateHash.js new file mode 100644 index 00000000..92adb0c2 --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/src/CreateHash.js @@ -0,0 +1,27 @@ + +const { Hash } = require("./HashTypes.js"); + +// same output as node:crypto above (though now async). +async function createHash(...content) { + return Hash.create().toBase64Url(...content); +} + +async function createHashHex(...content) { + return Hash.create().toHex(...content); +} + +// Slower, but this feature does not require WebCrypto +function createHashSync(...content) { + return Hash.createSync().toBase64Url(...content); +} + +function createHashHexSync(...content) { + return Hash.createSync().toHex(...content); +} + +module.exports = { + createHash, + createHashSync, + createHashHex, + createHashHexSync, +}; \ No newline at end of file diff --git a/node_modules/@11ty/eleventy-utils/src/DateCompare.js b/node_modules/@11ty/eleventy-utils/src/DateCompare.js new file mode 100644 index 00000000..a160ace2 --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/src/DateCompare.js @@ -0,0 +1,41 @@ +class DateCompare { + static isTimestampWithinDuration(timestamp, duration, compareDate = Date.now()) { + // the default duration is Infinity (also "*") + if (!duration || duration === "*" || duration === Infinity) { + return true; + } + + let expiration = timestamp + this.getDurationMs(duration); + + // still valid + if (expiration > compareDate) { + return true; + } + + // expired + return false; + } + + static getDurationMs(duration = "0s") { + let durationUnits = duration.slice(-1); + let durationMultiplier; + if (durationUnits === "s") { + durationMultiplier = 1; + } else if (durationUnits === "m") { + durationMultiplier = 60; + } else if (durationUnits === "h") { + durationMultiplier = 60 * 60; + } else if (durationUnits === "d") { + durationMultiplier = 60 * 60 * 24; + } else if (durationUnits === "w") { + durationMultiplier = 60 * 60 * 24 * 7; + } else if (durationUnits === "y") { + durationMultiplier = 60 * 60 * 24 * 365; + } + + let durationValue = parseInt(duration.slice(0, duration.length - 1), 10); + return durationValue * durationMultiplier * 1000; + } +} + +module.exports = DateCompare; \ No newline at end of file diff --git a/node_modules/@11ty/eleventy-utils/src/HashTypes.js b/node_modules/@11ty/eleventy-utils/src/HashTypes.js new file mode 100644 index 00000000..4f7454c5 --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/src/HashTypes.js @@ -0,0 +1,158 @@ +const { base64UrlSafe } = require("./Url.js"); +const { isBuffer } = require("./Buffer.js"); +const sha256 = require("./lib-sha256.js"); + +function hasNodeCryptoModule() { + try { + require("node:crypto"); + return true; + } catch(e) { + return false; + } +} + +const HAS_NODE_CRYPTO = hasNodeCryptoModule(); + +class Hash { + static create() { + if(typeof globalThis.crypto === "undefined") { + // Backwards compat with Node Crypto, since WebCrypto (crypto global) is Node 20+ + if(HAS_NODE_CRYPTO) { + return NodeCryptoHash; + } + return ScriptHash; + } + return WebCryptoHash; + } + + // Does not use WebCrypto (as WebCrypto is async-only) + static createSync() { + if(HAS_NODE_CRYPTO) { + return NodeCryptoHash; + } + return ScriptHash; + } + + static toBase64(bytes) { + let str = Array.from(bytes, (b) => String.fromCodePoint(b)).join(""); + + // `btoa` Node 16+ + return btoa(str); + } + + // Thanks https://evanhahn.com/the-best-way-to-concatenate-uint8arrays/ (Public domain) + static mergeUint8Array(...arrays) { + let totalLength = arrays.reduce( + (total, uint8array) => total + uint8array.byteLength, + 0 + ); + + let result = new Uint8Array(totalLength); + let offset = 0; + arrays.forEach((uint8array) => { + result.set(uint8array, offset); + offset += uint8array.byteLength; + }); + + return result; + } + + static bufferToBase64Url(hashBuffer) { + return base64UrlSafe(this.toBase64(new Uint8Array(hashBuffer))); + } + + static bufferToHex(hashBuffer) { + return Array.from(new Uint8Array(hashBuffer)) + .map((b) => b.toString(16).padStart(2, "0")) + .join(""); + } +} + +class WebCryptoHash extends Hash { + static async toHash(...content) { + let encoder = new TextEncoder(); + let input = this.mergeUint8Array(...content.map(c => { + if(isBuffer(c)) { + return c; + } + return encoder.encode(c); + })); + + // `crypto` is Node 20+ + return crypto.subtle.digest("SHA-256", input); + } + + static async toBase64Url(...content) { + return this.toHash(...content).then(hashBuffer => { + return this.bufferToBase64Url(hashBuffer); + }); + } + + static async toHex(...content) { + return this.toHash(...content).then(hashBuffer => { + return this.bufferToHex(hashBuffer); + }); + } + + static toBase64UrlSync() { + throw new Error("Synchronous methods are not available in the Web Crypto API."); + } + + static toHexSync() { + throw new Error("Synchronous methods are not available in the Web Crypto API."); + } +} + +class NodeCryptoHash extends Hash { + static toHash(...content) { + // This *needs* to be a dynamic require for proper bundling. + const { createHash } = require("node:crypto"); + let hash = createHash("sha256"); + + for(let c of content) { + hash.update(c); + } + + return hash; + } + + static toBase64Url(...content) { + // Note that Node does include a `digest("base64url")` that is supposedly Node 14+ but curiously failed on Stackblitz’s Node 16. + let base64 = this.toHash(...content).digest("base64"); + return base64UrlSafe(base64); + } + + static toHex(...content) { + return this.toHash(...content).digest("hex"); + } + + // aliases + static toBase64UrlSync = this.toBase64Url; + static toHexSync = this.toHex; +} + +class ScriptHash extends Hash { + static toHash(...content) { + let hash = sha256(); + for(let c of content) { + hash.add(c); + } + return hash.digest(); + } + + static toBase64Url(...content) { + let hashBuffer = this.toHash(...content); + return this.bufferToBase64Url(hashBuffer); + } + + static toHex(...content) { + let hashBuffer = this.toHash(...content); + return this.bufferToHex(hashBuffer); + } + + // aliases + static toBase64UrlSync = this.toBase64Url; + static toHexSync = this.toHex; +} + +module.exports = { Hash, NodeCryptoHash, ScriptHash, WebCryptoHash } \ No newline at end of file diff --git a/node_modules/@11ty/eleventy-utils/src/IsPlainObject.js b/node_modules/@11ty/eleventy-utils/src/IsPlainObject.js new file mode 100644 index 00000000..1d4c7527 --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/src/IsPlainObject.js @@ -0,0 +1,24 @@ +/* Prior art: this utility was created for https://github.com/11ty/eleventy/issues/2214 + + * Inspired by implementations from `is-what`, `typechecker`, `jQuery`, and `lodash` + + * `is-what` + * More reading at https://www.npmjs.com/package/is-what#user-content-isplainobject-vs-isanyobject + * if (Object.prototype.toString.call(value).slice(8, -1) !== 'Object') return false; + * return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype; + + * `typechecker` + * return value !== null && typeof value === 'object' && value.__proto__ === Object.prototype; + + * Notably jQuery and lodash have very similar implementations. + + * For later, remember the `value === Object(value)` trick + */ + +module.exports = function (value) { + if (value === null || typeof value !== "object") { + return false; + } + let proto = Object.getPrototypeOf(value); + return !proto || proto === Object.prototype; +}; diff --git a/node_modules/@11ty/eleventy-utils/src/Merge.js b/node_modules/@11ty/eleventy-utils/src/Merge.js new file mode 100644 index 00000000..c3cfbaf5 --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/src/Merge.js @@ -0,0 +1,84 @@ +"use strict"; +// above is required for Object.freeze to fail correctly. + +const isPlainObject = require("./IsPlainObject.js"); + +const OVERRIDE_PREFIX = "override:"; + +function cleanKey(key, prefix) { + if (prefix && key.startsWith(prefix)) { + return key.slice(prefix.length); + } + return key; +} + +function getMergedItem(target, source, prefixes = {}) { + let { override } = prefixes; + + // Shortcut for frozen source (if target does not exist) + if (!target && isPlainObject(source) && Object.isFrozen(source)) { + return source; + } + + let sourcePlainObjectShortcut; + if (!target && isPlainObject(source)) { + // deep copy objects to avoid sharing and to effect key renaming + target = {}; + sourcePlainObjectShortcut = true; + } + + if (Array.isArray(target) && Array.isArray(source)) { + return target.concat(source); + } else if (isPlainObject(target)) { + if (sourcePlainObjectShortcut || isPlainObject(source)) { + for (let key in source) { + let overrideKey = cleanKey(key, override); + + // An error happens here if the target is frozen + target[overrideKey] = getMergedItem(target[key], source[key], prefixes); + } + } + return target; + } + // number, string, class instance, etc + return source; +} + +// The same as Merge but without override prefixes +function DeepCopy(targetObject, ...sources) { + for (let source of sources) { + if (!source) { + continue; + } + + targetObject = getMergedItem(targetObject, source); + } + return targetObject; +} + +function Merge(target, ...sources) { + // Remove override prefixes from root target. + if (isPlainObject(target)) { + for (let key in target) { + if (key.indexOf(OVERRIDE_PREFIX) === 0) { + target[key.slice(OVERRIDE_PREFIX.length)] = target[key]; + delete target[key]; + } + } + } + + for (let source of sources) { + if (!source) { + continue; + } + + target = getMergedItem(target, source, { + override: OVERRIDE_PREFIX, + }); + } + + return target; +} + +module.exports = Merge; +module.exports.DeepCopy = DeepCopy; diff --git a/node_modules/@11ty/eleventy-utils/src/TemplatePath.js b/node_modules/@11ty/eleventy-utils/src/TemplatePath.js new file mode 100644 index 00000000..807af54c --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/src/TemplatePath.js @@ -0,0 +1,373 @@ +const path = require("path"); +const fs = require("fs"); + +function TemplatePath() {} + +/** + * @returns {String} the absolute path to Eleventy’s project directory. + */ +TemplatePath.getWorkingDir = function () { + return TemplatePath.normalize(path.resolve(".")); +}; + +/** + * Returns the directory portion of a path. + * Works for directory and file paths and paths ending in a glob pattern. + * + * @param {String} path - A path + * @returns {String} the directory portion of a path. + */ +TemplatePath.getDir = function (path) { + if (TemplatePath.isDirectorySync(path)) { + return path; + } + + return TemplatePath.getDirFromFilePath(path); +}; + +/** + * Returns the directory portion of a path that either points to a file + * or ends in a glob pattern. If `path` points to a directory, + * the returned value will have its last path segment stripped + * due to how [`path.parse`][1] works. + * + * [1]: https://nodejs.org/api/path.html#path_path_parse_path + * + * @returns {String} the directory portion of a path. + * @param {String} filePath - A path + */ +TemplatePath.getDirFromFilePath = function (filePath) { + return path.parse(filePath).dir || "."; +}; + +/** + * Returns the last path segment in a path (no leading/trailing slashes). + * + * Assumes [`path.parse`][1] was called on `path` before. + * + * [1]: https://nodejs.org/api/path.html#path_path_parse_path + * + * @param {String} path - A path + * @returns {String} the last path segment in a path + */ +TemplatePath.getLastPathSegment = function (path) { + if (!path.includes("/")) { + return path; + } + + // Trim a trailing slash if there is one + path = path.replace(/\/$/, ""); + + return path.slice(path.lastIndexOf("/") + 1); +}; + +/** + * @param {String} path - A path + * @returns {String[]} an array of paths pointing to each path segment of the + * provided `path`. + */ +TemplatePath.getAllDirs = function (path) { + // Trim a trailing slash if there is one + path = path.replace(/\/$/, ""); + + if (!path.includes("/")) { + return [path]; + } + + return path + .split("/") + .map((segment, index, array) => array.slice(0, index + 1).join("/")) + .filter((path) => path !== ".") + .reverse(); +}; + +/** + * Normalizes a path, resolving single-dot and double-dot segments. + * + * Node.js’ [`path.normalize`][1] is called to strip a possible leading `"./"` segment. + * + * [1]: https://nodejs.org/api/path.html#path_path_normalize_path + * + * @param {String} thePath - The path that should be normalized. + * @returns {String} the normalized path. + */ +TemplatePath.normalize = function (thePath) { + let filePath = path.normalize(thePath).split(path.sep).join("/"); + if(filePath !== "/" && filePath.endsWith("/")) { + return filePath.slice(0, -1); + } + return filePath; +}; + +/** + * Joins all given path segments together. + * + * It uses Node.js’ [`path.join`][1] method. + * + * [1]: https://nodejs.org/api/path.html#path_path_join_paths + * + * @param {...String} paths - An arbitrary amount of path segments. + * @returns {String} the normalized and joined path. + */ +TemplatePath.join = function (...paths) { + return TemplatePath.normalize(path.join(...paths)); +}; + +/** + * Joins the given URL path segments and normalizes the resulting path. + * Maintains a single trailing slash if the last URL path argument + * had at least one. + * + * @param {...String} urlPaths + * @returns {String} a normalized URL path described by the given URL path segments. + */ +TemplatePath.normalizeUrlPath = function (...urlPaths) { + const urlPath = path.posix.join(...urlPaths); + return urlPath.replace(/\/+$/, "/"); +}; + +/** + * Joins the given path segments. Since the first path is absolute, + * the resulting path will be absolute as well. + * + * @param {...String} paths + * @returns {String} the absolute path described by the given path segments. + */ +TemplatePath.absolutePath = function (...paths) { + let i = 0; + // check all the paths before we short circuit from the first index + for (let p of paths) { + if (path.isAbsolute(p) && i > 0) { + throw new Error( + `Only the first parameter to Template.absolutePath can be an absolute path. Received: ${p} from ${paths}` + ); + } + i++; + } + + let j = 0; + for (let p of paths) { + if (j === 0 && path.isAbsolute(p)) { + return TemplatePath.join(...paths); + } + j++; + } + + return TemplatePath.join(TemplatePath.getWorkingDir(), ...paths); +}; + +/** + * Turns an absolute path into a path relative to the project directory. + * + * @param {String} absolutePath + * @returns {String} the relative path. + */ +TemplatePath.relativePath = function (absolutePath) { + return TemplatePath.stripLeadingSubPath( + absolutePath, + TemplatePath.getWorkingDir() + ); +}; + +/** + * Adds a leading dot-slash segment to each path in the `paths` array. + * + * @param {String[]} paths + * @returns {String[]} + */ +TemplatePath.addLeadingDotSlashArray = function (paths) { + return paths.map((path) => TemplatePath.addLeadingDotSlash(path)); +}; + +/** + * Adds a leading dot-slash segment to `path`. + * + * @param {String} pathArg + * @returns {String} + */ +TemplatePath.addLeadingDotSlash = function (pathArg) { + if (pathArg === "." || pathArg === "..") { + return pathArg + "/"; + } + + if ( + path.isAbsolute(pathArg) || + pathArg.startsWith("./") || + pathArg.startsWith("../") + ) { + return pathArg; + } + + return "./" + pathArg; +}; + +/** + * Removes a leading dot-slash segment. + * + * @param {String} path + * @returns {String} the `path` without a leading dot-slash segment. + */ +TemplatePath.stripLeadingDotSlash = function (path) { + return typeof path === "string" ? path.replace(/^\.\//, "") : path; +}; + +/** + * Determines whether a path starts with a given sub path. + * + * @param {String} path - A path + * @param {String} subPath - A path + * @returns {Boolean} whether `path` starts with `subPath`. + */ +TemplatePath.startsWithSubPath = function (path, subPath) { + path = TemplatePath.normalize(path); + subPath = TemplatePath.normalize(subPath); + + return path.startsWith(subPath); +}; + +/** + * Removes the `subPath` at the start of `path` if present + * and returns the remainding path. + * + * @param {String} path - A path + * @param {String} subPath - A path + * @returns {String} the `path` without `subPath` at the start of it. + */ +TemplatePath.stripLeadingSubPath = function (path, subPath) { + path = TemplatePath.normalize(path); + subPath = TemplatePath.normalize(subPath); + + if (subPath !== "." && path.startsWith(subPath)) { + return path.slice(subPath.length + 1); + } + + return path; +}; + +/** + * @param {String} path - A path + * @returns {Boolean} whether `path` points to an existing directory. + */ +TemplatePath.isDirectorySync = function (path) { + return fs.existsSync(path) && fs.statSync(path).isDirectory(); +}; + +/** + * @param {String} path - A path + * @returns {Boolean} whether `path` points to an existing directory. + */ +TemplatePath.isDirectory = async function (path) { + return new Promise((resolve) => { + fs.stat(path, (err, stats) => { + if (stats) { + resolve(stats.isDirectory()); + } + resolve(false); + }); + }); +}; + +/** + * Appends a recursive wildcard glob pattern to `path` + * unless `path` is not a directory; then, `path` is assumed to be a file path + * and is left unchaged. + * + * @param {String} path + * @returns {String} + */ +TemplatePath.convertToRecursiveGlobSync = function (path) { + if (path === "") { + return "./**"; + } + + path = TemplatePath.addLeadingDotSlash(path); + + if (TemplatePath.isDirectorySync(path)) { + return path + (!path.endsWith("/") ? "/" : "") + "**"; + } + + return path; +}; + +/** + * Appends a recursive wildcard glob pattern to `path` + * unless `path` is not a directory; then, `path` is assumed to be a file path + * and is left unchaged. + * + * @param {String} path + * @returns {String} + */ +TemplatePath.convertToRecursiveGlob = async function (path) { + if (path === "") { + return "./**"; + } + + path = TemplatePath.addLeadingDotSlash(path); + + if (await TemplatePath.isDirectory(path)) { + return path + (!path.endsWith("/") ? "/" : "") + "**"; + } + + return path; +}; + +/** + * Returns the extension of the path without the leading dot. + * If the path has no extensions, the empty string is returned. + * + * @param {String} thePath + * @returns {String} the path’s extension if it exists; + * otherwise, the empty string. + */ +TemplatePath.getExtension = function (thePath) { + return path.extname(thePath).replace(/^\./, ""); +}; + +/** + * Removes the extension from a path. + * + * @param {String} path + * @param {String} [extension] + * @returns {String} + */ +TemplatePath.removeExtension = function (path, extension = undefined) { + if (extension === undefined) { + return path; + } + + const pathExtension = TemplatePath.getExtension(path); + if (pathExtension !== "" && extension.endsWith(pathExtension)) { + return path.substring(0, path.lastIndexOf(pathExtension) - 1); + } + + return path; +}; + +/** + * Accepts a relative file path that is using a standard directory separator and + * normalizes it using the local operating system separator. + * e.g. `./my/dir/` stays `./my/dir/` on *nix and becomes `.\\my\\dir\\` on Windows + * + * @param {String} filePath + * @param {String} [sep="/"] + * @returns {String} a file path with the correct local directory separator. + */ +TemplatePath.normalizeOperatingSystemFilePath = function (filePath, sep = "/") { + return filePath.split(sep).join(path.sep); +}; + +/** + * Accepts a relative file path with the local operating system directory separator and + * normalizes it using a forward slash directory separator. (Leaves trailing slash as-is) + * e.g. `./my/dir/` stays `./my/dir/` on *nix + * e.g. `.\\my\\dir\\` becomes `./my/dir/` on *nix and Windows + * + * @param {String} filePath + * @param {String} [sep="/"] + * @returns {String} a file path with the correct local directory separator. + */ +TemplatePath.standardizeFilePath = function (filePath, sep = "/") { + return TemplatePath.addLeadingDotSlash(filePath.split(path.sep).join(sep)); +}; + +module.exports = TemplatePath; diff --git a/node_modules/@11ty/eleventy-utils/src/Url.js b/node_modules/@11ty/eleventy-utils/src/Url.js new file mode 100644 index 00000000..7f314efb --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/src/Url.js @@ -0,0 +1,13 @@ +function base64UrlSafe(hashString = "") { + return hashString.replace(/[=\+\/]/g, function(match) { + if(match === "=") { + return ""; + } + if(match === "+") { + return "-"; + } + return "_"; + }); +} + +module.exports = { base64UrlSafe }; \ No newline at end of file diff --git a/node_modules/@11ty/eleventy-utils/src/lib-sha256.js b/node_modules/@11ty/eleventy-utils/src/lib-sha256.js new file mode 100644 index 00000000..7ebd37ea --- /dev/null +++ b/node_modules/@11ty/eleventy-utils/src/lib-sha256.js @@ -0,0 +1,113 @@ +// https://github.com/6502/sha256 + +/* +Copyright 2022 Andrea Griffini + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +// sha256(data) returns the digest +// sha256() returns an object you can call .add(data) zero or more time and .digest() at the end +// digest is a 32-byte Uint8Array instance with an added .hex() function. +// Input should be either a string (that will be encoded as UTF-8) or an array-like object with values 0..255. +module.exports = function sha256(data) { + let h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, + h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19, + tsz = 0, bp = 0; + const k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2], + rrot = (x, n) => (x >>> n) | (x << (32-n)), + w = new Uint32Array(64), + buf = new Uint8Array(64), + process = () => { + for (let j=0,r=0; j<16; j++,r+=4) { + w[j] = (buf[r]<<24) | (buf[r+1]<<16) | (buf[r+2]<<8) | buf[r+3]; + } + for (let j=16; j<64; j++) { + let s0 = rrot(w[j-15], 7) ^ rrot(w[j-15], 18) ^ (w[j-15] >>> 3); + let s1 = rrot(w[j-2], 17) ^ rrot(w[j-2], 19) ^ (w[j-2] >>> 10); + w[j] = (w[j-16] + s0 + w[j-7] + s1) | 0; + } + let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7; + for (let j=0; j<64; j++) { + let S1 = rrot(e, 6) ^ rrot(e, 11) ^ rrot(e, 25), + ch = (e & f) ^ ((~e) & g), + t1 = (h + S1 + ch + k[j] + w[j]) | 0, + S0 = rrot(a, 2) ^ rrot(a, 13) ^ rrot(a, 22), + maj = (a & b) ^ (a & c) ^ (b & c), + t2 = (S0 + maj) | 0; + h = g; g = f; f = e; e = (d + t1)|0; d = c; c = b; b = a; a = (t1 + t2)|0; + } + h0 = (h0 + a)|0; h1 = (h1 + b)|0; h2 = (h2 + c)|0; h3 = (h3 + d)|0; + h4 = (h4 + e)|0; h5 = (h5 + f)|0; h6 = (h6 + g)|0; h7 = (h7 + h)|0; + bp = 0; + }, + add = data => { + if (typeof data === "string") { + data = typeof TextEncoder === "undefined" ? Buffer.from(data) : (new TextEncoder).encode(data); + } + for (let i=0; i { + buf[bp++] = 0x80; if (bp == 64) process(); + if (bp + 8 > 64) { + while (bp < 64) buf[bp++] = 0x00; + process(); + } + while (bp < 58) buf[bp++] = 0x00; + // Max number of bytes is 35,184,372,088,831 + let L = tsz * 8; + buf[bp++] = (L / 1099511627776.) & 255; + buf[bp++] = (L / 4294967296.) & 255; + buf[bp++] = L >>> 24; + buf[bp++] = (L >>> 16) & 255; + buf[bp++] = (L >>> 8) & 255; + buf[bp++] = L & 255; + process(); + let reply = new Uint8Array(32); + reply[ 0] = h0 >>> 24; reply[ 1] = (h0 >>> 16) & 255; reply[ 2] = (h0 >>> 8) & 255; reply[ 3] = h0 & 255; + reply[ 4] = h1 >>> 24; reply[ 5] = (h1 >>> 16) & 255; reply[ 6] = (h1 >>> 8) & 255; reply[ 7] = h1 & 255; + reply[ 8] = h2 >>> 24; reply[ 9] = (h2 >>> 16) & 255; reply[10] = (h2 >>> 8) & 255; reply[11] = h2 & 255; + reply[12] = h3 >>> 24; reply[13] = (h3 >>> 16) & 255; reply[14] = (h3 >>> 8) & 255; reply[15] = h3 & 255; + reply[16] = h4 >>> 24; reply[17] = (h4 >>> 16) & 255; reply[18] = (h4 >>> 8) & 255; reply[19] = h4 & 255; + reply[20] = h5 >>> 24; reply[21] = (h5 >>> 16) & 255; reply[22] = (h5 >>> 8) & 255; reply[23] = h5 & 255; + reply[24] = h6 >>> 24; reply[25] = (h6 >>> 16) & 255; reply[26] = (h6 >>> 8) & 255; reply[27] = h6 & 255; + reply[28] = h7 >>> 24; reply[29] = (h7 >>> 16) & 255; reply[30] = (h7 >>> 8) & 255; reply[31] = h7 & 255; + reply.hex = () => { + let res = ""; + reply.forEach(x => res += ("0" + x.toString(16)).slice(-2)); + return res; + }; + return reply; + }; + if (data === undefined) return {add, digest}; + add(data); + return digest(); +} \ No newline at end of file diff --git a/node_modules/@11ty/eleventy/CODE_OF_CONDUCT.md b/node_modules/@11ty/eleventy/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..318db578 --- /dev/null +++ b/node_modules/@11ty/eleventy/CODE_OF_CONDUCT.md @@ -0,0 +1,48 @@ +# Eleventy Community Code of Conduct + +View the [Code of Conduct](https://www.11ty.dev/docs/code-of-conduct/) on 11ty.dev + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, chat messages, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at eleventy@zachleat.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/node_modules/@11ty/eleventy/LICENSE b/node_modules/@11ty/eleventy/LICENSE new file mode 100644 index 00000000..5027c0db --- /dev/null +++ b/node_modules/@11ty/eleventy/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017–2024 Zach Leatherman @zachleat + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@11ty/eleventy/README.md b/node_modules/@11ty/eleventy/README.md new file mode 100644 index 00000000..4b464b87 --- /dev/null +++ b/node_modules/@11ty/eleventy/README.md @@ -0,0 +1,47 @@ +

eleventy Logo

+ +# eleventy 🕚⚡️🎈🐀 + +A simpler static site generator. An alternative to Jekyll. Written in JavaScript. Transforms a directory of templates (of varying types) into HTML. + +Works with HTML, Markdown, JavaScript, Liquid, Nunjucks, with addons for WebC, Sass, Vue, Svelte, TypeScript, JSX, and many others! + +## ➡ [Documentation](https://www.11ty.dev/docs/) + +- Please star [this repo on GitHub](https://github.com/11ty/eleventy/)! +- Follow us on Mastodon [@eleventy@fosstodon.org](https://fosstodon.org/@eleventy) or Twitter [@eleven_ty](https://twitter.com/eleven_ty) +- Join us on [Discord](https://www.11ty.dev/blog/discord/) +- Support [11ty on Open Collective](https://opencollective.com/11ty) +- [11ty on npm](https://www.npmjs.com/org/11ty) +- [11ty on GitHub](https://github.com/11ty) + +[![npm Version](https://img.shields.io/npm/v/@11ty/eleventy.svg?style=for-the-badge)](https://www.npmjs.com/package/@11ty/eleventy) [![GitHub issues](https://img.shields.io/github/issues/11ty/eleventy.svg?style=for-the-badge)](https://github.com/11ty/eleventy/issues) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=for-the-badge)](https://github.com/prettier/prettier) [![npm Downloads](https://img.shields.io/npm/dt/@11ty/eleventy.svg?style=for-the-badge)](https://www.npmjs.com/package/@11ty/eleventy) + +## Installation + +``` +npm install @11ty/eleventy --save-dev +``` + +Read our [Getting Started guide](https://www.11ty.dev/docs/getting-started/). + +## Tests + +``` +npm run test +``` + +- We use the [ava JavaScript test runner](https://github.com/avajs/ava) ([Assertions documentation](https://github.com/avajs/ava/blob/master/docs/03-assertions.md)) +- ℹ️ To keep tests fast, thou shalt try to avoid writing files in tests. +- [Continuous Integration on GitHub Actions](https://github.com/11ty/eleventy/actions/workflows/ci.yml) +- [Code Coverage Statistics](https://github.com/11ty/eleventy/blob/master/docs/coverage.md) +- [Benchmark for Performance Regressions](https://github.com/11ty/eleventy-benchmark) + +## Community Roadmap + +- [Top Feature Requests](https://github.com/11ty/eleventy/issues?q=label%3Aneeds-votes+sort%3Areactions-%2B1-desc+label%3Aenhancement) (Add your own votes using the 👍 reaction) +- [Top Bugs 😱](https://github.com/11ty/eleventy/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions) (Add your own votes using the 👍 reaction) + +## Plugins + +See the [official docs on plugins](https://www.11ty.dev/docs/plugins/). diff --git a/node_modules/@11ty/eleventy/SECURITY.md b/node_modules/@11ty/eleventy/SECURITY.md new file mode 100644 index 00000000..0947081a --- /dev/null +++ b/node_modules/@11ty/eleventy/SECURITY.md @@ -0,0 +1,9 @@ +# Security Policy + +## Reporting a Vulnerability + +Privately report a security issue by navigating to https://github.com/11ty/eleventy/security and using the “Report a vulnerability” button. + +Read more at: https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability + +Alternatively, you may report security issues via an email to `security@11ty.dev`. diff --git a/node_modules/@11ty/eleventy/cmd.cjs b/node_modules/@11ty/eleventy/cmd.cjs new file mode 100644 index 00000000..c4a4d5f1 --- /dev/null +++ b/node_modules/@11ty/eleventy/cmd.cjs @@ -0,0 +1,155 @@ +#!/usr/bin/env node + +// This file intentionally uses older code conventions to be as friendly +// as possible with error messaging to folks on older runtimes. + +const pkg = require("./package.json"); +require("please-upgrade-node")(pkg, { + message: function (requiredVersion) { + return ( + "Eleventy " + + pkg.version + + " requires Node " + + requiredVersion + + ". You will need to upgrade Node to use Eleventy!" + ); + }, +}); + +const minimist = require("minimist"); +const debug = require("debug")("Eleventy:cmd"); + +class SimpleError extends Error { + constructor(...args) { + super(...args); + this.skipOriginalStack = true; + } +} + +async function exec() { + // Notes about friendly error messaging with outdated Node versions: https://github.com/11ty/eleventy/issues/3761 + const { EleventyErrorHandler } = await import("./src/Errors/EleventyErrorHandler.js"); + + try { + const argv = minimist(process.argv.slice(2), { + string: ["input", "output", "formats", "config", "pathprefix", "port", "to", "incremental", "loader"], + boolean: [ + "quiet", + "version", + "watch", + "dryrun", + "help", + "serve", + "ignore-initial", + ], + default: { + quiet: null, + "ignore-initial": false, + "to": "fs", + }, + unknown: function (unknownArgument) { + throw new Error( + `We don’t know what '${unknownArgument}' is. Use --help to see the list of supported commands.`, + ); + }, + }); + + debug("command: eleventy %o", argv); + const { Eleventy } = await import("./src/Eleventy.js"); + + let ErrorHandler = new EleventyErrorHandler(); + + process.on("unhandledRejection", (error, promise) => { + ErrorHandler.fatal(error, "Unhandled rejection in promise"); + }); + process.on("uncaughtException", (error) => { + ErrorHandler.fatal(error, "Uncaught exception"); + }); + process.on("rejectionHandled", (promise) => { + ErrorHandler.warn(promise, "A promise rejection was handled asynchronously"); + }); + + if (argv.version) { + console.log(Eleventy.getVersion()); + return; + } else if (argv.help) { + console.log(Eleventy.getHelp()); + return; + } + + let elev = new Eleventy(argv.input, argv.output, { + source: "cli", + // --quiet and --quiet=true both resolve to true + quietMode: argv.quiet, + configPath: argv.config, + pathPrefix: argv.pathprefix, + runMode: argv.serve ? "serve" : argv.watch ? "watch" : "build", + dryRun: argv.dryrun, + loader: argv.loader, + }); + + // reuse ErrorHandler instance in Eleventy + ErrorHandler = elev.errorHandler; + + // Before init + elev.setFormats(argv.formats); + + await elev.init(); + + if (argv.to === "json" || argv.to === "ndjson") { + // override logging output + elev.setIsVerbose(false); + } + + // Only relevant for watch/serve + elev.setIgnoreInitial(argv["ignore-initial"]); + + if(argv.incremental) { + elev.setIncrementalFile(argv.incremental); + } else if(argv.incremental !== undefined) { + elev.setIncrementalBuild(argv.incremental === "" || argv.incremental); + } + + if (argv.serve || argv.watch) { + if(argv.to === "json" || argv.to === "ndjson") { + throw new SimpleError("--to=json and --to=ndjson are not compatible with --serve or --watch."); + } + + await elev.watch(); + + if (argv.serve) { + // TODO await here? + elev.serve(argv.port); + } + + process.on("SIGINT", async () => { + await elev.stopWatch(); + process.exitCode = 0; + }); + } else { + if (!argv.to || argv.to === "fs") { + await elev.write(); + } else if (argv.to === "json") { + let result = await elev.toJSON() + console.log(JSON.stringify(result, null, 2)); + } else if (argv.to === "ndjson") { + let stream = await elev.toNDJSON(); + stream.pipe(process.stdout); + } else { + throw new SimpleError( + `Invalid --to value: ${argv.to}. Supported values: \`fs\` (default), \`json\`, and \`ndjson\`.`, + ); + } + } + } catch (error) { + if(typeof EleventyErrorHandler !== "undefined") { + let ErrorHandler = new EleventyErrorHandler(); + ErrorHandler.fatal(error, "Eleventy Fatal Error (CLI)"); + } else { + console.error(error); + process.exitCode = 1; + } + } +} + +exec(); diff --git a/node_modules/@11ty/eleventy/package.json b/node_modules/@11ty/eleventy/package.json new file mode 100644 index 00000000..4c06b5c4 --- /dev/null +++ b/node_modules/@11ty/eleventy/package.json @@ -0,0 +1,166 @@ +{ + "name": "@11ty/eleventy", + "version": "3.1.6", + "description": "A simpler static site generator.", + "publishConfig": { + "access": "public", + "provenance": true + }, + "type": "module", + "main": "./src/Eleventy.js", + "exports": { + ".": { + "import": "./src/Eleventy.js", + "require": "./src/EleventyCommonJs.cjs" + }, + "./UserConfig": { + "types": "./src/UserConfig.js" + } + }, + "bin": { + "eleventy": "cmd.cjs" + }, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + }, + "keywords": [ + "static-site-generator", + "static-site", + "ssg", + "documentation", + "website", + "jekyll", + "blog", + "templates", + "generator", + "framework", + "eleventy", + "11ty", + "html", + "markdown", + "liquid", + "nunjucks" + ], + "scripts": { + "default": "npm run test", + "test": "npm run test:node && npm run test:ava", + "test:ava": "ava --verbose --timeout 20s", + "test:node": "node --test test_node/tests.js", + "format": "prettier . --write", + "check": "eslint src", + "check-types": "tsc", + "nano-staged": "nano-staged", + "coverage": "npx c8 ava && npx c8 report --reporter=json-summary && cp coverage/coverage-summary.json docs/_data/coverage.json && node cmd.cjs --config=docs/eleventy.coverage.js", + "prepare": "simple-git-hooks" + }, + "author": "Zach Leatherman (https://zachleat.com/)", + "repository": { + "type": "git", + "url": "git://github.com/11ty/eleventy.git" + }, + "bugs": "https://github.com/11ty/eleventy/issues", + "homepage": "https://www.11ty.dev/", + "ava": { + "environmentVariables": {}, + "failFast": true, + "files": [ + "./test/*.js", + "./test/_issues/**/*test.js" + ], + "watchMode": { + "ignoreChanges": [ + "./test/stubs*/**/*", + "./test/**/_site/**/*", + ".cache" + ] + } + }, + "nano-staged": { + "*.{js,css,md}": [ + "prettier --write" + ] + }, + "simple-git-hooks": { + "pre-commit": "npm test && npm run nano-staged", + "pre-push": "npm test" + }, + "devDependencies": { + "@11ty/eleventy-img": "^6.0.4", + "@11ty/eleventy-plugin-rss": "^2.0.4", + "@11ty/eleventy-plugin-syntaxhighlight": "^5.0.2", + "@11ty/eleventy-plugin-webc": "^0.12.0-beta.7", + "@eslint/eslintrc": "^3.3.5", + "@eslint/js": "^10.0.1", + "@iarna/toml": "^2.2.5", + "@mdx-js/node-loader": "^3.1.1", + "@types/node": "^25.5.0", + "@vue/server-renderer": "^3.5.30", + "@zachleat/noop": "^1.0.7", + "ava": "^6.4.1", + "c8": "^11.0.0", + "eslint": "^10.0.3", + "eslint-config-prettier": "^10.1.8", + "globals": "^17.4.0", + "jsx-async-runtime": "^2.0.3", + "markdown-it-abbr": "^2.0.0", + "markdown-it-emoji": "^3.0.0", + "marked": "^17.0.4", + "nano-staged": "^0.9.0", + "prettier": "^3.8.1", + "pretty": "^2.0.0", + "react": "^19.2.7", + "react-dom": "^19.2.7", + "sass": "^1.98.0", + "simple-git-hooks": "^2.13.1", + "tsx": "^4.21.0", + "typescript": "^5.9.3", + "vue": "^3.5.30", + "zod": "^4.3.6", + "zod-validation-error": "^5.0.0" + }, + "dependencies": { + "@11ty/dependency-tree": "^4.0.2", + "@11ty/dependency-tree-esm": "^2.0.4", + "@11ty/eleventy-dev-server": "^2.0.8", + "@11ty/eleventy-plugin-bundle": "^3.0.7", + "@11ty/eleventy-utils": "^2.0.7", + "@11ty/lodash-custom": "^4.17.21", + "@11ty/posthtml-urls": "^1.0.3", + "@11ty/recursive-copy": "^4.0.4", + "@sindresorhus/slugify": "^2.2.1", + "bcp-47-normalize": "^2.3.0", + "chokidar": "^3.6.0", + "debug": "^4.4.3", + "dependency-graph": "^1.0.0", + "entities": "^6.0.1", + "filesize": "^10.1.6", + "gray-matter": "^4.0.3", + "iso-639-1": "^3.1.5", + "js-yaml": "^4.1.1", + "kleur": "^4.1.5", + "liquidjs": "^10.27.0", + "luxon": "^3.7.2", + "markdown-it": "^14.2.0", + "minimist": "^1.2.8", + "moo": "0.5.2", + "node-retrieve-globals": "^6.0.1", + "nunjucks": "^3.2.4", + "picomatch": "^4.0.4", + "please-upgrade-node": "^3.2.0", + "posthtml": "^0.16.7", + "posthtml-match-helper": "^2.0.3", + "semver": "^7.8.1", + "slugify": "^1.6.9", + "tinyglobby": "^0.2.16" + }, + "overrides": { + "gray-matter": { + "js-yaml": "$js-yaml" + } + } +} diff --git a/node_modules/@11ty/eleventy/src/Benchmark/Benchmark.js b/node_modules/@11ty/eleventy/src/Benchmark/Benchmark.js new file mode 100644 index 00000000..df6dea7d --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Benchmark/Benchmark.js @@ -0,0 +1,55 @@ +import { performance } from "node:perf_hooks"; + +class Benchmark { + constructor() { + // TypeScript slop + this.timeSpent = 0; + this.timesCalled = 0; + this.beforeTimers = []; + } + + reset() { + this.timeSpent = 0; + this.timesCalled = 0; + this.beforeTimers = []; + } + + getNewTimestamp() { + if (performance) { + return performance.now(); + } + return new Date().getTime(); + } + + incrementCount() { + this.timesCalled++; + } + + // TODO(slightlyoff): + // disable all of these hrtime requests when not benchmarking + before() { + this.timesCalled++; + this.beforeTimers.push(this.getNewTimestamp()); + } + + after() { + if (!this.beforeTimers.length) { + throw new Error("You called Benchmark after() without a before()."); + } + + let before = this.beforeTimers.pop(); + if (!this.beforeTimers.length) { + this.timeSpent += this.getNewTimestamp() - before; + } + } + + getTimesCalled() { + return this.timesCalled; + } + + getTotal() { + return this.timeSpent; + } +} + +export default Benchmark; diff --git a/node_modules/@11ty/eleventy/src/Benchmark/BenchmarkGroup.js b/node_modules/@11ty/eleventy/src/Benchmark/BenchmarkGroup.js new file mode 100644 index 00000000..ee82f6b5 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Benchmark/BenchmarkGroup.js @@ -0,0 +1,135 @@ +import debugUtil from "debug"; + +import ConsoleLogger from "../Util/ConsoleLogger.js"; +import isAsyncFunction from "../Util/IsAsyncFunction.js"; +import Benchmark from "./Benchmark.js"; + +const debugBenchmark = debugUtil("Eleventy:Benchmark"); + +class BenchmarkGroup { + constructor() { + this.benchmarks = {}; + // Warning: aggregate benchmarks automatically default to false via BenchmarkManager->getBenchmarkGroup + this.isVerbose = true; + this.logger = new ConsoleLogger(); + this.minimumThresholdMs = 50; + this.minimumThresholdPercent = 8; + } + + setIsVerbose(isVerbose) { + this.isVerbose = isVerbose; + this.logger.isVerbose = isVerbose; + } + + reset() { + for (var type in this.benchmarks) { + this.benchmarks[type].reset(); + } + } + + // TODO use addAsync everywhere instead + add(type, callback) { + let benchmark = (this.benchmarks[type] = new Benchmark()); + + /** @this {any} */ + let fn = function (...args) { + benchmark.before(); + let ret = callback.call(this, ...args); + benchmark.after(); + return ret; + }; + + Object.defineProperty(fn, "__eleventyInternal", { + value: { + type: isAsyncFunction(callback) ? "async" : "sync", + callback, + }, + }); + + return fn; + } + + // callback must return a promise + // async addAsync(type, callback) { + // let benchmark = (this.benchmarks[type] = new Benchmark()); + + // benchmark.before(); + // // don’t await here. + // let promise = callback.call(this); + // promise.then(function() { + // benchmark.after(); + // }); + // return promise; + // } + + setMinimumThresholdMs(minimumThresholdMs) { + let val = parseInt(minimumThresholdMs, 10); + if (isNaN(val)) { + throw new Error("`setMinimumThresholdMs` expects a number argument."); + } + this.minimumThresholdMs = val; + } + + setMinimumThresholdPercent(minimumThresholdPercent) { + let val = parseInt(minimumThresholdPercent, 10); + if (isNaN(val)) { + throw new Error("`setMinimumThresholdPercent` expects a number argument."); + } + this.minimumThresholdPercent = val; + } + + has(type) { + return !!this.benchmarks[type]; + } + + get(type) { + if (!this.benchmarks[type]) { + this.benchmarks[type] = new Benchmark(); + } + return this.benchmarks[type]; + } + + padNumber(num, length) { + if (("" + num).length >= length) { + return num; + } + + let prefix = new Array(length + 1).join(" "); + return (prefix + num).slice(-1 * length); + } + + finish(label, totalTimeSpent) { + for (var type in this.benchmarks) { + let bench = this.benchmarks[type]; + let isAbsoluteMinimumComparison = this.minimumThresholdMs > 0; + let totalForBenchmark = bench.getTotal(); + let percent = Math.round((totalForBenchmark * 100) / totalTimeSpent); + let callCount = bench.getTimesCalled(); + + let output = { + ms: this.padNumber(totalForBenchmark.toFixed(0), 6), + percent: this.padNumber(percent, 3), + calls: this.padNumber(callCount, 5), + }; + let str = `Benchmark ${output.ms}ms ${output.percent}% ${output.calls}× (${label}) ${type}`; + + if ( + isAbsoluteMinimumComparison && + totalForBenchmark >= this.minimumThresholdMs && + percent > this.minimumThresholdPercent + ) { + this.logger.warn(str); + } + + // Opt out of logging if low count (1× or 2×) or 0ms / 1% + if ( + callCount > 1 || // called more than once + Math.round(totalForBenchmark) > 0 // more than 0.5ms + ) { + debugBenchmark(str); + } + } + } +} + +export default BenchmarkGroup; diff --git a/node_modules/@11ty/eleventy/src/Benchmark/BenchmarkManager.js b/node_modules/@11ty/eleventy/src/Benchmark/BenchmarkManager.js new file mode 100644 index 00000000..d7a8f610 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Benchmark/BenchmarkManager.js @@ -0,0 +1,73 @@ +import { performance } from "node:perf_hooks"; + +import BenchmarkGroup from "./BenchmarkGroup.js"; + +// TODO this should not be a singleton, it belongs in the config or somewhere on the Eleventy instance. + +class BenchmarkManager { + constructor() { + this.benchmarkGroups = {}; + this.isVerbose = true; + this.start = this.getNewTimestamp(); + } + + reset() { + this.start = this.getNewTimestamp(); + + for (var j in this.benchmarkGroups) { + this.benchmarkGroups[j].reset(); + } + } + + getNewTimestamp() { + if (performance) { + return performance.now(); + } + return new Date().getTime(); + } + + setVerboseOutput(isVerbose) { + this.isVerbose = !!isVerbose; + } + + hasBenchmarkGroup(name) { + return name in this.benchmarkGroups; + } + + getBenchmarkGroup(name) { + if (!this.benchmarkGroups[name]) { + this.benchmarkGroups[name] = new BenchmarkGroup(); + + // Special behavior for aggregate benchmarks + // so they don’t console.log every time + if (name === "Aggregate") { + this.benchmarkGroups[name].setIsVerbose(false); + } else { + this.benchmarkGroups[name].setIsVerbose(this.isVerbose); + } + } + + return this.benchmarkGroups[name]; + } + + getAll() { + return this.benchmarkGroups; + } + + get(name) { + if (name) { + return this.getBenchmarkGroup(name); + } + + return this.getAll(); + } + + finish() { + let totalTimeSpentBenchmarking = this.getNewTimestamp() - this.start; + for (var j in this.benchmarkGroups) { + this.benchmarkGroups[j].finish(j, totalTimeSpentBenchmarking); + } + } +} + +export default BenchmarkManager; diff --git a/node_modules/@11ty/eleventy/src/Data/ComputedData.js b/node_modules/@11ty/eleventy/src/Data/ComputedData.js new file mode 100644 index 00000000..5350475c --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Data/ComputedData.js @@ -0,0 +1,122 @@ +import lodash from "@11ty/lodash-custom"; +import debugUtil from "debug"; + +import ComputedDataQueue from "./ComputedDataQueue.js"; +import ComputedDataTemplateString from "./ComputedDataTemplateString.js"; +import ComputedDataProxy from "./ComputedDataProxy.js"; + +const { set: lodashSet, get: lodashGet } = lodash; +const debug = debugUtil("Eleventy:ComputedData"); + +class ComputedData { + constructor(config) { + this.computed = {}; + this.symbolParseFunctions = {}; + this.templateStringKeyLookup = {}; + this.computedKeys = new Set(); + this.declaredDependencies = {}; + this.queue = new ComputedDataQueue(); + this.config = config; + } + + add(key, renderFn, declaredDependencies = [], symbolParseFn, templateInstance) { + this.computedKeys.add(key); + this.declaredDependencies[key] = declaredDependencies; + + // bind config filters/JS functions + if (typeof renderFn === "function") { + let fns = {}; + // TODO bug? no access to non-universal config things? + if (this.config) { + fns = { + ...this.config.javascriptFunctions, + }; + } + fns.tmpl = templateInstance; + + renderFn = renderFn.bind(fns); + } + + lodashSet(this.computed, key, renderFn); + + if (symbolParseFn) { + lodashSet(this.symbolParseFunctions, key, symbolParseFn); + } + } + + addTemplateString(key, renderFn, declaredDependencies = [], symbolParseFn, templateInstance) { + this.add(key, renderFn, declaredDependencies, symbolParseFn, templateInstance); + this.templateStringKeyLookup[key] = true; + } + + async resolveVarOrder(data) { + let proxyByTemplateString = new ComputedDataTemplateString(this.computedKeys); + let proxyByProxy = new ComputedDataProxy(this.computedKeys); + + for (let key of this.computedKeys) { + let computed = lodashGet(this.computed, key); + + if (typeof computed !== "function") { + // add nodes for non functions (primitives like booleans, etc) + // This will not handle template strings, as they are normalized to functions + this.queue.addNode(key); + } else { + this.queue.uses(key, this.declaredDependencies[key]); + + let symbolParseFn = lodashGet(this.symbolParseFunctions, key); + let varsUsed = []; + if (symbolParseFn) { + // use the parseForSymbols function in the TemplateEngine + varsUsed = symbolParseFn(); + } else if (symbolParseFn !== false) { + // skip resolution is this is false (just use declaredDependencies) + let isTemplateString = !!this.templateStringKeyLookup[key]; + let proxy = isTemplateString ? proxyByTemplateString : proxyByProxy; + varsUsed = await proxy.findVarsUsed(computed, data); + } + + debug("%o accesses %o variables", key, varsUsed); + let filteredVarsUsed = varsUsed.filter((varUsed) => { + return ( + (varUsed !== key && this.computedKeys.has(varUsed)) || + varUsed.startsWith("collections.") + ); + }); + this.queue.uses(key, filteredVarsUsed); + } + } + } + + async _setupDataEntry(data, order) { + debug("Computed data order of execution: %o", order); + for (let key of order) { + let computed = lodashGet(this.computed, key); + + if (typeof computed === "function") { + let ret = await computed(data); + lodashSet(data, key, ret); + } else if (computed !== undefined) { + lodashSet(data, key, computed); + } + } + } + + async setupData(data, orderFilter) { + await this.resolveVarOrder(data); + + await this.processRemainingData(data, orderFilter); + } + + async processRemainingData(data, orderFilter) { + // process all variables + let order = this.queue.getOrder(); + if (orderFilter && typeof orderFilter === "function") { + order = order.filter(orderFilter.bind(this.queue)); + } + + await this._setupDataEntry(data, order); + this.queue.markComputed(order); + } +} + +export default ComputedData; diff --git a/node_modules/@11ty/eleventy/src/Data/ComputedDataProxy.js b/node_modules/@11ty/eleventy/src/Data/ComputedDataProxy.js new file mode 100644 index 00000000..24153555 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Data/ComputedDataProxy.js @@ -0,0 +1,131 @@ +import lodash from "@11ty/lodash-custom"; +import { isPlainObject } from "@11ty/eleventy-utils"; + +const { set: lodashSet, get: lodashGet } = lodash; + +/* Calculates computed data using Proxies */ +class ComputedDataProxy { + constructor(computedKeys) { + if (Array.isArray(computedKeys)) { + this.computedKeys = new Set(computedKeys); + } else { + this.computedKeys = computedKeys; + } + } + + isArrayOrPlainObject(data) { + return Array.isArray(data) || isPlainObject(data); + } + + getProxyData(data, keyRef) { + // WARNING: SIDE EFFECTS + // Set defaults for keys not already set on parent data + + // TODO should make another effort to get rid of this, + // See the ProxyWrap util for more proxy handlers that will likely fix this + let undefinedValue = "__11TY_UNDEFINED__"; + if (this.computedKeys) { + for (let key of this.computedKeys) { + if (lodashGet(data, key, undefinedValue) === undefinedValue) { + lodashSet(data, key, ""); + } + } + } + + let proxyData = this._getProxyData(data, keyRef); + return proxyData; + } + + _getProxyForObject(dataObj, keyRef, parentKey = "") { + return new Proxy( + {}, + { + get: (obj, key) => { + if (typeof key !== "string") { + return obj[key]; + } + + let newKey = `${parentKey ? `${parentKey}.` : ""}${key}`; + + // Issue #1137 + // Special case for Collections, always return an Array for collection keys + // so they it works fine with Array methods like `filter`, `map`, etc + if (newKey === "collections") { + keyRef.add(newKey); + return new Proxy( + {}, + { + get: (target, key) => { + if (typeof key === "string") { + keyRef.add(`collections.${key}`); + return []; + } + return target[key]; + }, + }, + ); + } + + let newData = this._getProxyData(dataObj[key], keyRef, newKey); + if (!this.isArrayOrPlainObject(newData)) { + keyRef.add(newKey); + } + return newData; + }, + }, + ); + } + + _getProxyForArray(dataArr, keyRef, parentKey = "") { + return new Proxy(new Array(dataArr.length), { + get: (obj, key) => { + if (Array.prototype.hasOwnProperty(key)) { + // remove `filter`, `constructor`, `map`, etc + keyRef.add(parentKey); + return obj[key]; + } + + // Hm, this needs to be better + if (key === "then") { + keyRef.add(parentKey); + return; + } + + let newKey = `${parentKey}[${key}]`; + let newData = this._getProxyData(dataArr[key], keyRef, newKey); + if (!this.isArrayOrPlainObject(newData)) { + keyRef.add(newKey); + } + return newData; + }, + }); + } + + _getProxyData(data, keyRef, parentKey = "") { + if (isPlainObject(data)) { + return this._getProxyForObject(data, keyRef, parentKey); + } else if (Array.isArray(data)) { + return this._getProxyForArray(data, keyRef, parentKey); + } + + // everything else! + return data; + } + + async findVarsUsed(fn, data = {}) { + let keyRef = new Set(); + + // careful, logging proxyData will mess with test results! + let proxyData = this.getProxyData(data, keyRef); + + // squelch console logs for this fake proxy data pass 😅 + // let savedLog = console.log; + // console.log = () => {}; + await fn(proxyData); + // console.log = savedLog; + + return Array.from(keyRef); + } +} + +export default ComputedDataProxy; diff --git a/node_modules/@11ty/eleventy/src/Data/ComputedDataQueue.js b/node_modules/@11ty/eleventy/src/Data/ComputedDataQueue.js new file mode 100644 index 00000000..628b9113 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Data/ComputedDataQueue.js @@ -0,0 +1,64 @@ +import { DepGraph as DependencyGraph } from "dependency-graph"; + +/* Keeps track of the dependency graph between computed data variables + * Removes keys from the graph when they are computed. + */ +class ComputedDataQueue { + constructor() { + this.graph = new DependencyGraph(); + } + + getOrder() { + return this.graph.overallOrder(); + } + + getOrderFor(name) { + return this.graph.dependenciesOf(name); + } + + getDependsOn(name) { + return this.graph.dependantsOf(name); + } + + isUsesStartsWith(name, prefix) { + if (name.startsWith(prefix)) { + return true; + } + return ( + this.graph.dependenciesOf(name).filter((entry) => { + return entry.startsWith(prefix); + }).length > 0 + ); + } + + addNode(name) { + if (!this.graph.hasNode(name)) { + this.graph.addNode(name); + } + } + + _uses(graph, name, varsUsed = []) { + if (!graph.hasNode(name)) { + graph.addNode(name); + } + + for (let varUsed of varsUsed) { + if (!graph.hasNode(varUsed)) { + graph.addNode(varUsed); + } + graph.addDependency(name, varUsed); + } + } + + uses(name, varsUsed = []) { + this._uses(this.graph, name, varsUsed); + } + + markComputed(varsComputed = []) { + for (let varComputed of varsComputed) { + this.graph.removeNode(varComputed); + } + } +} + +export default ComputedDataQueue; diff --git a/node_modules/@11ty/eleventy/src/Data/ComputedDataTemplateString.js b/node_modules/@11ty/eleventy/src/Data/ComputedDataTemplateString.js new file mode 100644 index 00000000..d5241b23 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Data/ComputedDataTemplateString.js @@ -0,0 +1,70 @@ +import lodash from "@11ty/lodash-custom"; +import debugUtil from "debug"; + +const { set: lodashSet } = lodash; +const debug = debugUtil("Eleventy:ComputedDataTemplateString"); + +/* Calculates computed data in Template Strings. + * Ideally we would use the Proxy approach but it doesn’t work + * in some template languages that visit all available data even if + * it isn’t used in the template (Nunjucks) + */ +class ComputedDataTemplateString { + constructor(computedKeys) { + if (Array.isArray(computedKeys)) { + this.computedKeys = new Set(computedKeys); + } else { + this.computedKeys = computedKeys; + } + + // is this ¯\_(lisp)_/¯ + // must be strings that won’t be escaped by template languages + this.prefix = "(((11ty((("; + this.suffix = ")))11ty)))"; + } + + getProxyData() { + let proxyData = {}; + + // use these special strings as a workaround to check the rendered output + // can’t use proxies here as some template languages trigger proxy for all + // keys in data + for (let key of this.computedKeys) { + // TODO don’t allow to set eleventyComputed.page? other disallowed computed things? + lodashSet(proxyData, key, this.prefix + key + this.suffix); + } + + return proxyData; + } + + findVarsInOutput(output = "") { + let vars = new Set(); + let splits = output.split(this.prefix); + for (let split of splits) { + let varName = split.slice(0, split.indexOf(this.suffix) < 0 ? 0 : split.indexOf(this.suffix)); + if (varName) { + vars.add(varName); + } + } + return Array.from(vars); + } + + async findVarsUsed(fn) { + let proxyData = this.getProxyData(); + let output; + // Mitigation for #1061, errors with filters in the first pass shouldn’t fail the whole thing. + try { + output = await fn(proxyData); + } catch (e) { + debug("Computed Data first pass data resolution error: %o", e); + } + + // page.outputPath on serverless urls returns false. + if (typeof output === "string") { + return this.findVarsInOutput(output); + } + return []; + } +} + +export default ComputedDataTemplateString; diff --git a/node_modules/@11ty/eleventy/src/Data/TemplateData.js b/node_modules/@11ty/eleventy/src/Data/TemplateData.js new file mode 100644 index 00000000..6942892c --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Data/TemplateData.js @@ -0,0 +1,710 @@ +import path from "node:path"; +import util from "node:util"; +import semver from "semver"; + +import lodash from "@11ty/lodash-custom"; +import { Merge, TemplatePath, isPlainObject } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; + +import unique from "../Util/Objects/Unique.js"; +import TemplateGlob from "../TemplateGlob.js"; +import EleventyBaseError from "../Errors/EleventyBaseError.js"; +import TemplateDataInitialGlobalData from "./TemplateDataInitialGlobalData.js"; +import { getEleventyPackageJson, getWorkingProjectPackageJson } from "../Util/ImportJsonSync.js"; +import { EleventyImport, EleventyLoadContent } from "../Util/Require.js"; +import { DeepFreeze } from "../Util/Objects/DeepFreeze.js"; + +const { set: lodashSet, get: lodashGet } = lodash; + +const debugWarn = debugUtil("Eleventy:Warnings"); +const debug = debugUtil("Eleventy:TemplateData"); +const debugDev = debugUtil("Dev:Eleventy:TemplateData"); + +class TemplateDataParseError extends EleventyBaseError {} + +class TemplateData { + constructor(templateConfig) { + if (!templateConfig || templateConfig.constructor.name !== "TemplateConfig") { + throw new Error( + "Internal error: Missing `templateConfig` or was not an instance of `TemplateConfig`.", + ); + } + + this.templateConfig = templateConfig; + this.config = this.templateConfig.getConfig(); + + this.benchmarks = { + data: this.config.benchmarkManager.get("Data"), + aggregate: this.config.benchmarkManager.get("Aggregate"), + }; + + this.rawImports = {}; + this.globalData = null; + this.templateDirectoryData = {}; + this.isEsm = false; + + this.initialGlobalData = new TemplateDataInitialGlobalData(this.templateConfig); + } + + get dirs() { + return this.templateConfig.directories; + } + + get inputDir() { + return this.dirs.input; + } + + // if this was set but `falsy` we would fallback to inputDir + get dataDir() { + return this.dirs.data; + } + + get absoluteDataDir() { + return TemplatePath.absolutePath(this.dataDir); + } + + // This was async in 2.0 and prior but doesn’t need to be any more. + getInputDir() { + return this.dirs.input; + } + + getDataDir() { + return this.dataDir; + } + + exists(pathname) { + // It's common for data files not to exist, so we avoid going to the FS to + // re-check if they do via a quick-and-dirty cache. + return this.templateConfig.existsCache.exists(pathname); + } + + setFileSystemSearch(fileSystemSearch) { + this.fileSystemSearch = fileSystemSearch; + } + + setProjectUsingEsm(isEsmProject) { + this.isEsm = !!isEsmProject; + } + + get extensionMap() { + if (!this._extensionMap) { + throw new Error("Internal error: missing `extensionMap` in TemplateData."); + } + return this._extensionMap; + } + + set extensionMap(map) { + this._extensionMap = map; + } + + get environmentVariables() { + return this._env; + } + + set environmentVariables(env) { + this._env = env; + } + + /* Used by tests */ + _setConfig(config) { + this.config = config; + } + + getRawImports() { + if (!this.config.keys.package) { + debug( + "Opted-out of package.json assignment for global data with falsy value for `keys.package` configuration.", + ); + return this.rawImports; + } else if (Object.keys(this.rawImports).length > 0) { + return this.rawImports; + } + + let pkgJson = getWorkingProjectPackageJson(); + this.rawImports[this.config.keys.package] = pkgJson; + + if (this.config.freezeReservedData) { + DeepFreeze(this.rawImports); + } + + return this.rawImports; + } + + clearData() { + this.globalData = null; + this.configApiGlobalData = null; + this.templateDirectoryData = {}; + } + + _getGlobalDataGlobByExtension(extension) { + return TemplateGlob.normalizePath(this.dataDir, `/**/*.${extension}`); + } + + // This is a backwards compatibility helper with the old `jsDataFileSuffix` configuration API + getDataFileSuffixes() { + // New API + if (Array.isArray(this.config.dataFileSuffixes)) { + return this.config.dataFileSuffixes; + } + + // Backwards compatibility + if (this.config.jsDataFileSuffix) { + let suffixes = []; + suffixes.push(this.config.jsDataFileSuffix); // e.g. filename.11tydata.json + suffixes.push(""); // suffix-less for free with old API, e.g. filename.json + return suffixes; + } + return []; // if both of these entries are set to false, use no files + } + + // This is used exclusively for --watch and --serve chokidar targets + async getTemplateDataFileGlob() { + let suffixes = this.getDataFileSuffixes(); + let globSuffixesWithLeadingDot = new Set(); + globSuffixesWithLeadingDot.add("json"); // covers .11tydata.json too + let globSuffixesWithoutLeadingDot = new Set(); + + // Typically using [ '.11tydata', '' ] suffixes to find data files + for (let suffix of suffixes) { + // TODO the `suffix` truthiness check is purely for backwards compat? + if (suffix && typeof suffix === "string") { + if (suffix.startsWith(".")) { + // .suffix.js + globSuffixesWithLeadingDot.add(`${suffix.slice(1)}.mjs`); + globSuffixesWithLeadingDot.add(`${suffix.slice(1)}.cjs`); + globSuffixesWithLeadingDot.add(`${suffix.slice(1)}.js`); + } else { + // "suffix.js" without leading dot + globSuffixesWithoutLeadingDot.add(`${suffix || ""}.mjs`); + globSuffixesWithoutLeadingDot.add(`${suffix || ""}.cjs`); + globSuffixesWithoutLeadingDot.add(`${suffix || ""}.js`); + } + } + } + + // Configuration Data Extensions e.g. yaml + if (this.hasUserDataExtensions()) { + for (let extension of this.getUserDataExtensions()) { + globSuffixesWithLeadingDot.add(extension); // covers .11tydata.{extension} too + } + } + + let paths = []; + if (globSuffixesWithLeadingDot.size > 0) { + paths.push(`${this.inputDir}**/*.{${Array.from(globSuffixesWithLeadingDot).join(",")}}`); + } + if (globSuffixesWithoutLeadingDot.size > 0) { + paths.push(`${this.inputDir}**/*{${Array.from(globSuffixesWithoutLeadingDot).join(",")}}`); + } + + return TemplatePath.addLeadingDotSlashArray(paths); + } + + // For spidering dependencies + // TODO Can we reuse getTemplateDataFileGlob instead? Maybe just filter off the .json files before scanning for dependencies + getTemplateJavaScriptDataFileGlob() { + let paths = []; + let suffixes = this.getDataFileSuffixes(); + for (let suffix of suffixes) { + if (suffix) { + // TODO this check is purely for backwards compat and I kinda feel like it shouldn’t be here + // paths.push(`${this.inputDir}/**/*${suffix || ""}.cjs`); // Same as above + paths.push(`${this.inputDir}**/*${suffix || ""}.js`); + } + } + + return TemplatePath.addLeadingDotSlashArray(paths); + } + + getGlobalDataGlob() { + let extGlob = this.getGlobalDataExtensionPriorities().join(","); + return [this._getGlobalDataGlobByExtension("{" + extGlob + "}")]; + } + + getWatchPathCache() { + return this.pathCache; + } + + getGlobalDataExtensionPriorities() { + return this.getUserDataExtensions().concat(["json", "mjs", "cjs", "js"]); + } + + static calculateExtensionPriority(path, priorities) { + for (let i = 0; i < priorities.length; i++) { + let ext = priorities[i]; + if (path.endsWith(ext)) { + return i; + } + } + return priorities.length; + } + + async getGlobalDataFiles() { + let priorities = this.getGlobalDataExtensionPriorities(); + + let fsBench = this.benchmarks.aggregate.get("Searching the file system (data)"); + fsBench.before(); + let globs = this.getGlobalDataGlob(); + let paths = await this.fileSystemSearch.search("global-data", globs); + fsBench.after(); + + // sort paths according to extension priorities + // here we use reverse ordering, because paths with bigger index in array will override the first ones + // example [path/file.json, path/file.js] here js will override json + paths = paths.sort((first, second) => { + let p1 = TemplateData.calculateExtensionPriority(first, priorities); + let p2 = TemplateData.calculateExtensionPriority(second, priorities); + if (p1 < p2) { + return -1; + } + if (p1 > p2) { + return 1; + } + return 0; + }); + + this.pathCache = paths; + return paths; + } + + getObjectPathForDataFile(dataFilePath) { + let absoluteDataFilePath = TemplatePath.absolutePath(dataFilePath); + let reducedPath = TemplatePath.stripLeadingSubPath(absoluteDataFilePath, this.absoluteDataDir); + let parsed = path.parse(reducedPath); + let folders = parsed.dir ? parsed.dir.split("/") : []; + folders.push(parsed.name); + + return folders; + } + + async getAllGlobalData() { + let globalData = {}; + let files = TemplatePath.addLeadingDotSlashArray(await this.getGlobalDataFiles()); + + this.config.events.emit("eleventy.globalDataFiles", files); + + let dataFileConflicts = {}; + + for (let j = 0, k = files.length; j < k; j++) { + let data = await this.getDataValue(files[j]); + let objectPathTarget = this.getObjectPathForDataFile(files[j]); + + // Since we're joining directory paths and an array is not usable as an objectkey since two identical arrays are not double equal, + // we can just join the array by a forbidden character ("/"" is chosen here, since it works on Linux, Mac and Windows). + // If at some point this isn't enough anymore, it would be possible to just use JSON.stringify(objectPathTarget) since that + // is guaranteed to work but is signifivcantly slower. + let objectPathTargetString = objectPathTarget.join(path.sep); + + // if two global files have the same path (but different extensions) + // and conflict, let’s merge them. + if (dataFileConflicts[objectPathTargetString]) { + debugWarn( + `merging global data from ${files[j]} with an already existing global data file (${dataFileConflicts[objectPathTargetString]}). Overriding existing keys.`, + ); + + let oldData = lodashGet(globalData, objectPathTarget); + data = TemplateData.mergeDeep(this.config.dataDeepMerge, oldData, data); + } + + dataFileConflicts[objectPathTargetString] = files[j]; + debug(`Found global data file ${files[j]} and adding as: ${objectPathTarget}`); + lodashSet(globalData, objectPathTarget, data); + } + + return globalData; + } + + async #getInitialGlobalData() { + let globalData = await this.initialGlobalData.getData(); + + if (!("eleventy" in globalData)) { + globalData.eleventy = {}; + } + + // #2293 for meta[name=generator] + const pkg = getEleventyPackageJson(); + globalData.eleventy.version = semver.coerce(pkg.version).toString(); + globalData.eleventy.generator = `Eleventy v${globalData.eleventy.version}`; + + if (this.environmentVariables) { + if (!("env" in globalData.eleventy)) { + globalData.eleventy.env = {}; + } + + Object.assign(globalData.eleventy.env, this.environmentVariables); + } + + if (this.dirs) { + if (!("directories" in globalData.eleventy)) { + globalData.eleventy.directories = {}; + } + + Object.assign(globalData.eleventy.directories, this.dirs.getUserspaceInstance()); + } + + // Reserved + if (this.config.freezeReservedData) { + DeepFreeze(globalData.eleventy); + } + + return globalData; + } + + async getInitialGlobalData() { + if (!this.configApiGlobalData) { + this.configApiGlobalData = this.#getInitialGlobalData(); + } + + return this.configApiGlobalData; + } + + async #getGlobalData() { + let rawImports = this.getRawImports(); + let configApiGlobalData = await this.getInitialGlobalData(); + + let globalJson = await this.getAllGlobalData(); + let mergedGlobalData = Merge(globalJson, configApiGlobalData); + + // OK: Shallow merge when combining rawImports (pkg) with global data files + return Object.assign({}, mergedGlobalData, rawImports); + } + + async getGlobalData() { + if (!this.globalData) { + this.globalData = this.#getGlobalData(); + } + + return this.globalData; + } + + /* Template and Directory data files */ + async combineLocalData(localDataPaths) { + let localData = {}; + if (!Array.isArray(localDataPaths)) { + localDataPaths = [localDataPaths]; + } + + // Filter out files we know don't exist to avoid overhead for checking + localDataPaths = localDataPaths.filter((path) => { + return this.exists(path); + }); + + this.config.events.emit("eleventy.dataFiles", localDataPaths); + + if (!localDataPaths.length) { + return localData; + } + + let dataSource = {}; + for (let path of localDataPaths) { + let dataForPath = await this.getDataValue(path); + if (!isPlainObject(dataForPath)) { + debug( + "Warning: Template and Directory data files expect an object to be returned, instead `%o` returned `%o`", + path, + dataForPath, + ); + } else { + // clean up data for template/directory data files only. + let cleanedDataForPath = TemplateData.cleanupData(dataForPath, { + file: path, + }); + for (let key in cleanedDataForPath) { + if (Object.prototype.hasOwnProperty.call(dataSource, key)) { + debugWarn( + "Local data files have conflicting data. Overwriting '%s' with data from '%s'. Previous data location was from '%s'", + key, + path, + dataSource[key], + ); + } + dataSource[key] = path; + } + TemplateData.mergeDeep(this.config.dataDeepMerge, localData, cleanedDataForPath); + } + } + return localData; + } + + async getTemplateDirectoryData(templatePath) { + if (!this.templateDirectoryData[templatePath]) { + let localDataPaths = await this.getLocalDataPaths(templatePath); + let importedData = await this.combineLocalData(localDataPaths); + + this.templateDirectoryData[templatePath] = importedData; + } + return this.templateDirectoryData[templatePath]; + } + + getUserDataExtensions() { + if (!this.config.dataExtensions) { + return []; + } + + // returning extensions in reverse order to create proper extension order + // later added formats will override first ones + return Array.from(this.config.dataExtensions.keys()).reverse(); + } + + getUserDataParser(extension) { + return this.config.dataExtensions.get(extension); + } + + isUserDataExtension(extension) { + return this.config.dataExtensions && this.config.dataExtensions.has(extension); + } + + hasUserDataExtensions() { + return this.config.dataExtensions && this.config.dataExtensions.size > 0; + } + + async _parseDataFile(path, parser, options = {}) { + let readFile = !("read" in options) || options.read === true; + let rawInput; + + if (readFile) { + rawInput = EleventyLoadContent(path, options); + } + + if (readFile && !rawInput) { + return {}; + } + + try { + if (readFile) { + return parser(rawInput, path); + } else { + // path as a first argument is when `read: false` + // path as a second argument is for consistency with `read: true` API + return parser(path, path); + } + } catch (e) { + throw new TemplateDataParseError(`Having trouble parsing data file ${path}`, e); + } + } + + // ignoreProcessing = false for global data files + // ignoreProcessing = true for local data files + async getDataValue(path) { + let extension = TemplatePath.getExtension(path); + + if (extension === "js" || extension === "cjs" || extension === "mjs") { + // JS data file or require’d JSON (no preprocessing needed) + if (!this.exists(path)) { + return {}; + } + + let aggregateDataBench = this.benchmarks.aggregate.get("Data File"); + aggregateDataBench.before(); + let dataBench = this.benchmarks.data.get(`\`${path}\``); + dataBench.before(); + + let type = "cjs"; + if (extension === "mjs" || (extension === "js" && this.isEsm)) { + type = "esm"; + } + + // We always need to use `import()`, as `require` isn’t available in ESM. + let returnValue = await EleventyImport(path, type); + + // TODO special exception for Global data `permalink.js` + // module.exports = (data) => `${data.page.filePathStem}/`; // Does not work + // module.exports = () => ((data) => `${data.page.filePathStem}/`); // Works + if (typeof returnValue === "function") { + let configApiGlobalData = await this.getInitialGlobalData(); + returnValue = await returnValue(configApiGlobalData || {}); + } + + dataBench.after(); + aggregateDataBench.after(); + + return returnValue; + } else if (this.isUserDataExtension(extension)) { + // Other extensions + let { parser, options } = this.getUserDataParser(extension); + + return this._parseDataFile(path, parser, options); + } else if (extension === "json") { + // File to string, parse with JSON (preprocess) + const parser = (content) => JSON.parse(content); + return this._parseDataFile(path, parser); + } else { + throw new TemplateDataParseError( + `Could not find an appropriate data parser for ${path}. Do you need to add a plugin to your config file?`, + ); + } + } + + _pushExtensionsToPaths(paths, curpath, extensions) { + for (let extension of extensions) { + paths.push(curpath + "." + extension); + } + } + + _addBaseToPaths(paths, base, extensions, nonEmptySuffixesOnly = false) { + let suffixes = this.getDataFileSuffixes(); + + for (let suffix of suffixes) { + suffix = suffix || ""; + + if (nonEmptySuffixesOnly && suffix === "") { + continue; + } + + // data suffix + if (suffix) { + paths.push(base + suffix + ".js"); + paths.push(base + suffix + ".cjs"); + paths.push(base + suffix + ".mjs"); + } + paths.push(base + suffix + ".json"); // default: .11tydata.json + + // inject user extensions + this._pushExtensionsToPaths(paths, base + suffix, extensions); + } + } + + async getLocalDataPaths(templatePath) { + let paths = []; + let parsed = path.parse(templatePath); + let inputDir = this.inputDir; + + debugDev("getLocalDataPaths(%o)", templatePath); + debugDev("parsed.dir: %o", parsed.dir); + + let userExtensions = this.getUserDataExtensions(); + + if (parsed.dir) { + let fileNameNoExt = this.extensionMap.removeTemplateExtension(parsed.base); + + // default dataSuffix: .11tydata, is appended in _addBaseToPaths + debug("Using %o suffixes to find data files.", this.getDataFileSuffixes()); + + // Template data file paths + let filePathNoExt = parsed.dir + "/" + fileNameNoExt; + this._addBaseToPaths(paths, filePathNoExt, userExtensions); + + // Directory data file paths + let allDirs = TemplatePath.getAllDirs(parsed.dir); + + debugDev("allDirs: %o", allDirs); + for (let dir of allDirs) { + let lastDir = TemplatePath.getLastPathSegment(dir); + let dirPathNoExt = dir + "/" + lastDir; + + if (inputDir) { + debugDev("dirStr: %o; inputDir: %o", dir, inputDir); + } + // TODO use DirContains + if (!inputDir || (dir.startsWith(inputDir) && dir !== inputDir)) { + if (this.config.dataFileDirBaseNameOverride) { + let indexDataFile = dir + "/" + this.config.dataFileDirBaseNameOverride; + this._addBaseToPaths(paths, indexDataFile, userExtensions, true); + } else { + this._addBaseToPaths(paths, dirPathNoExt, userExtensions); + } + } + } + + // 0.11.0+ include root input dir files + // if using `docs/` as input dir, looks for docs/docs.json et al + if (inputDir) { + let lastInputDir = TemplatePath.addLeadingDotSlash( + TemplatePath.join(inputDir, TemplatePath.getLastPathSegment(inputDir)), + ); + + // in root input dir, search for index.11tydata.json et al + if (this.config.dataFileDirBaseNameOverride) { + let indexDataFile = + TemplatePath.getDirFromFilePath(lastInputDir) + + "/" + + this.config.dataFileDirBaseNameOverride; + this._addBaseToPaths(paths, indexDataFile, userExtensions, true); + } else if (lastInputDir !== "./") { + this._addBaseToPaths(paths, lastInputDir, userExtensions); + } + } + } + + debug("getLocalDataPaths(%o): %o", templatePath, paths); + return unique(paths).reverse(); + } + + static mergeDeep(deepMerge, target, ...source) { + if (!deepMerge && deepMerge !== undefined) { + return Object.assign(target, ...source); + } else { + return TemplateData.merge(target, ...source); + } + } + + static merge(target, ...source) { + return Merge(target, ...source); + } + + /* Like cleanupData() but does not mutate */ + static getCleanedTagsImmutable(data, options = {}) { + let tags = []; + + if (isPlainObject(data) && data.tags) { + if (typeof data.tags === "string") { + tags = (data.tags || "").split(","); + } else if (Array.isArray(data.tags)) { + tags = data.tags; + } else if (data.tags) { + throw new Error( + `String or Array expected for \`tags\`${options.file ? ` in ${options.isVirtualTemplate ? "virtual " : ""}template: ${options.file}` : ""}. Received: ${util.inspect(data.tags)}`, + ); + } + + // Deduplicate tags + // Coerce to string #3875 + return [...new Set(tags)].map((entry) => String(entry)); + } + + return tags; + } + + static cleanupData(data, options = {}) { + if (isPlainObject(data) && "tags" in data) { + data.tags = this.getCleanedTagsImmutable(data, options); + } + + return data; + } + + static getNormalizedExcludedCollections(data) { + let excludes = []; + let key = "eleventyExcludeFromCollections"; + + if (data?.[key] !== true) { + if (Array.isArray(data[key])) { + excludes = data[key]; + } else if (typeof data[key] === "string") { + excludes = (data[key] || "").split(","); + } + } + + return { + excludes, + excludeAll: data?.eleventyExcludeFromCollections === true, + }; + } + + static getIncludedCollectionNames(data) { + let tags = TemplateData.getCleanedTagsImmutable(data); + + let { excludes, excludeAll } = TemplateData.getNormalizedExcludedCollections(data); + if (excludeAll) { + return []; + } + + return ["all", ...tags].filter((tag) => !excludes.includes(tag)); + } + + static getIncludedTagNames(data) { + return this.getIncludedCollectionNames(data).filter((tagName) => tagName !== "all"); + } +} + +export default TemplateData; diff --git a/node_modules/@11ty/eleventy/src/Data/TemplateDataInitialGlobalData.js b/node_modules/@11ty/eleventy/src/Data/TemplateDataInitialGlobalData.js new file mode 100644 index 00000000..7e2a7ee2 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Data/TemplateDataInitialGlobalData.js @@ -0,0 +1,40 @@ +import lodash from "@11ty/lodash-custom"; + +import EleventyBaseError from "../Errors/EleventyBaseError.js"; + +const { set: lodashSet } = lodash; + +class TemplateDataConfigError extends EleventyBaseError {} + +class TemplateDataInitialGlobalData { + constructor(templateConfig) { + if (!templateConfig || templateConfig.constructor.name !== "TemplateConfig") { + throw new TemplateDataConfigError("Missing or invalid `templateConfig` (via Render plugin)."); + } + this.templateConfig = templateConfig; + this.config = this.templateConfig.getConfig(); + } + + async getData() { + let globalData = {}; + + // via eleventyConfig.addGlobalData + if (this.config.globalData) { + let keys = Object.keys(this.config.globalData); + for (let key of keys) { + let returnValue = this.config.globalData[key]; + + // This section is problematic when used with eleventyComputed #3389 + if (typeof returnValue === "function") { + returnValue = await returnValue(); + } + + lodashSet(globalData, key, returnValue); + } + } + + return globalData; + } +} + +export default TemplateDataInitialGlobalData; diff --git a/node_modules/@11ty/eleventy/src/Eleventy.js b/node_modules/@11ty/eleventy/src/Eleventy.js new file mode 100644 index 00000000..0568a3ea --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Eleventy.js @@ -0,0 +1,1565 @@ +import chalk from "kleur"; +import { performance } from "node:perf_hooks"; +import debugUtil from "debug"; +import { filesize } from "filesize"; +import path from "node:path"; + +/* Eleventy Deps */ +import { TemplatePath } from "@11ty/eleventy-utils"; +import BundlePlugin from "@11ty/eleventy-plugin-bundle"; + +import TemplateData from "./Data/TemplateData.js"; +import TemplateWriter from "./TemplateWriter.js"; +import EleventyExtensionMap from "./EleventyExtensionMap.js"; +import { EleventyErrorHandler } from "./Errors/EleventyErrorHandler.js"; +import EleventyBaseError from "./Errors/EleventyBaseError.js"; +import EleventyServe from "./EleventyServe.js"; +import EleventyWatch from "./EleventyWatch.js"; +import EleventyWatchTargets from "./EleventyWatchTargets.js"; +import EleventyFiles from "./EleventyFiles.js"; +import TemplatePassthroughManager from "./TemplatePassthroughManager.js"; +import TemplateConfig from "./TemplateConfig.js"; +import FileSystemSearch from "./FileSystemSearch.js"; +import TemplateEngineManager from "./Engines/TemplateEngineManager.js"; + +/* Utils */ +import ConsoleLogger from "./Util/ConsoleLogger.js"; +import PathPrefixer from "./Util/PathPrefixer.js"; +import ProjectDirectories from "./Util/ProjectDirectories.js"; +import PathNormalizer from "./Util/PathNormalizer.js"; +import { isGlobMatch } from "./Util/GlobMatcher.js"; +import simplePlural from "./Util/Pluralize.js"; +import checkPassthroughCopyBehavior from "./Util/PassthroughCopyBehaviorCheck.js"; +import eventBus from "./EventBus.js"; +import { + getEleventyPackageJson, + importJsonSync, + getWorkingProjectPackageJsonPath, +} from "./Util/ImportJsonSync.js"; +import { EleventyImport } from "./Util/Require.js"; +import ProjectTemplateFormats from "./Util/ProjectTemplateFormats.js"; +import { withResolvers } from "./Util/PromiseUtil.js"; + +/* Plugins */ +import RenderPlugin, * as RenderPluginExtras from "./Plugins/RenderPlugin.js"; +import I18nPlugin, * as I18nPluginExtras from "./Plugins/I18nPlugin.js"; +import HtmlBasePlugin, * as HtmlBasePluginExtras from "./Plugins/HtmlBasePlugin.js"; +import { TransformPlugin as InputPathToUrlTransformPlugin } from "./Plugins/InputPathToUrl.js"; +import { IdAttributePlugin } from "./Plugins/IdAttributePlugin.js"; +import FileSystemRemap from "./Util/GlobRemap.js"; + +const pkg = getEleventyPackageJson(); +const debug = debugUtil("Eleventy"); + +/** + * Eleventy’s programmatic API + * @module 11ty/eleventy/Eleventy + */ + +class Eleventy { + /** + * Userspace package.json file contents + * @type {object|undefined} + */ + #projectPackageJson; + /** @type {string} */ + #projectPackageJsonPath; + /** @type {ProjectTemplateFormats|undefined} */ + #templateFormats; + /** @type {ConsoleLogger|undefined} */ + #logger; + /** @type {ProjectDirectories|undefined} */ + #directories; + /** @type {boolean|undefined} */ + #verboseOverride; + /** @type {boolean} */ + #isVerboseMode = true; + /** @type {boolean|undefined} */ + #preInitVerbose; + /** @type {boolean} */ + #hasConfigInitialized = false; + /** @type {boolean} */ + #needsInit = true; + /** @type {Promise|undefined} */ + #initPromise; + /** @type {EleventyErrorHandler|undefined} */ + #errorHandler; + /** @type {Map} */ + #privateCaches = new Map(); + /** @type {boolean} */ + #isStopping = false; + /** @type {boolean|undefined} */ + #isEsm; + + /** + * @typedef {object} EleventyOptions + * @property {'cli'|'script'=} source + * @property {'build'|'serve'|'watch'=} runMode + * @property {boolean=} dryRun + * @property {string=} configPath + * @property {string=} pathPrefix + * @property {boolean=} quietMode + * @property {Function=} config + * @property {string=} inputDir + + * @param {string} [input] - Directory or filename for input/sources files. + * @param {string} [output] - Directory serving as the target for writing the output files. + * @param {EleventyOptions} [options={}] + * @param {TemplateConfig} [eleventyConfig] + */ + constructor(input, output, options = {}, eleventyConfig = null) { + /** + * @type {string|undefined} + * @description Holds the path to the input (might be a file or folder) + */ + this.rawInput = input || undefined; + + /** + * @type {string|undefined} + * @description holds the path to the output directory + */ + this.rawOutput = output || undefined; + + /** + * @type {module:11ty/eleventy/TemplateConfig} + * @description Override the config instance (for centralized config re-use) + */ + this.eleventyConfig = eleventyConfig; + + /** + * @type {EleventyOptions} + * @description Options object passed to the Eleventy constructor + * @default {} + */ + this.options = options; + + /** + * @type {'cli'|'script'} + * @description Called via CLI (`cli`) or Programmatically (`script`) + * @default "script" + */ + this.source = options.source || "script"; + + /** + * @type {string} + * @description One of build, serve, or watch + * @default "build" + */ + this.runMode = options.runMode || "build"; + + /** + * @type {boolean} + * @description Is Eleventy running in dry mode? + * @default false + */ + this.isDryRun = options.dryRun ?? false; + + /** + * @type {boolean} + * @description Is this an incremental build? (only operates on a subset of input files) + * @default false + */ + this.isIncremental = false; + + /** + * @type {string|undefined} + * @description If an incremental build, this is the file we’re operating on. + * @default null + */ + this.programmaticApiIncrementalFile = undefined; + + /** + * @type {boolean} + * @description Should we process files on first run? (The --ignore-initial feature) + * @default true + */ + this.isRunInitialBuild = true; + + /** + * @type {Number} + * @description Number of builds run on this instance. + * @default 0 + */ + this.buildCount = 0; + + /** + * @member {String} - Force ESM or CJS mode instead of detecting from package.json. Either cjs, esm, or auto. + * @default "auto" + */ + this.loader = this.options.loader ?? "auto"; + + /** + * @type {Number} + * @description The timestamp of Eleventy start. + */ + this.start = this.getNewTimestamp(); + } + + /** + * @type {string|undefined} + * @description An override of Eleventy's default config file paths + * @default undefined + */ + get configPath() { + return this.options.configPath; + } + + /** + * @type {string} + * @description The top level directory the site pretends to reside in + * @default "/" + */ + get pathPrefix() { + return this.options.pathPrefix || "/"; + } + + async initializeConfig(initOverrides) { + if (!this.eleventyConfig) { + this.eleventyConfig = new TemplateConfig(null, this.configPath); + } else if (this.configPath) { + await this.eleventyConfig.setProjectConfigPath(this.configPath); + } + + this.eleventyConfig.setRunMode(this.runMode); + this.eleventyConfig.setProjectUsingEsm(this.isEsm); + this.eleventyConfig.setLogger(this.logger); + this.eleventyConfig.setDirectories(this.directories); + this.eleventyConfig.setTemplateFormats(this.templateFormats); + + if (this.pathPrefix || this.pathPrefix === "") { + this.eleventyConfig.setPathPrefix(this.pathPrefix); + } + + // Debug mode should always run quiet (all output goes to debug logger) + if (process.env.DEBUG) { + this.#verboseOverride = false; + } else if (this.options.quietMode === true || this.options.quietMode === false) { + this.#verboseOverride = !this.options.quietMode; + } + + // Moved before config merges: https://github.com/11ty/eleventy/issues/3316 + if (this.#verboseOverride === true || this.#verboseOverride === false) { + this.eleventyConfig.userConfig._setQuietModeOverride(!this.#verboseOverride); + } + + this.eleventyConfig.userConfig.directories = this.directories; + + /* Programmatic API config */ + if (this.options.config && typeof this.options.config === "function") { + debug("Running options.config configuration callback (passed to Eleventy constructor)"); + // TODO use return object here? + await this.options.config(this.eleventyConfig.userConfig); + } + + /** + * @type {object} + * @description Initialize Eleventy environment variables + * @default null + */ + // this.runMode need to be set before this + this.env = this.getEnvironmentVariableValues(); + this.initializeEnvironmentVariables(this.env); + + // Async initialization of configuration + await this.eleventyConfig.init(initOverrides); + + /** + * @type {object} + * @description Initialize Eleventy’s configuration, including the user config file + */ + this.config = this.eleventyConfig.getConfig(); + + /** + * @type {object} + * @description Singleton BenchmarkManager instance + */ + this.bench = this.config.benchmarkManager; + + if (performance) { + debug("Eleventy warm up time: %o (ms)", performance.now()); + } + + // Careful to make sure the previous server closes on SIGINT, issue #3873 + if (!this.eleventyServe) { + /** @type {object} */ + this.eleventyServe = new EleventyServe(); + } + this.eleventyServe.eleventyConfig = this.eleventyConfig; + + /** @type {object} */ + this.watchManager = new EleventyWatch(); + + /** @type {object} */ + this.watchTargets = new EleventyWatchTargets(this.eleventyConfig); + this.watchTargets.addAndMakeGlob(this.config.additionalWatchTargets); + + /** @type {object} */ + this.fileSystemSearch = new FileSystemSearch(); + + this.#hasConfigInitialized = true; + + // after #hasConfigInitialized above + this.setIsVerbose(this.#preInitVerbose ?? !this.config.quietMode); + } + + getNewTimestamp() { + if (performance) { + return performance.now(); + } + return new Date().getTime(); + } + + /** @type {ProjectDirectories} */ + get directories() { + if (!this.#directories) { + this.#directories = new ProjectDirectories(); + this.#directories.setInput(this.rawInput, this.options.inputDir); + this.#directories.setOutput(this.rawOutput); + + if (this.source == "cli" && (this.rawInput !== undefined || this.rawOutput !== undefined)) { + this.#directories.freeze(); + } + } + + return this.#directories; + } + + /** @type {string} */ + get input() { + return this.directories.inputFile || this.directories.input || this.config.dir.input; + } + + /** @type {string} */ + get inputFile() { + return this.directories.inputFile; + } + + /** @type {string} */ + get inputDir() { + return this.directories.input; + } + + // Not used internally, removed in 3.0. + setInputDir() { + throw new Error( + "Eleventy->setInputDir was removed in 3.0. Use the inputDir option to the constructor", + ); + } + + /** @type {string} */ + get outputDir() { + return this.directories.output || this.config.dir.output; + } + + /** + * Updates the dry-run mode of Eleventy. + * + * @param {boolean} isDryRun - Shall Eleventy run in dry mode? + */ + setDryRun(isDryRun) { + this.isDryRun = !!isDryRun; + } + + /** + * Sets the incremental build mode. + * + * @param {boolean} isIncremental - Shall Eleventy run in incremental build mode and only write the files that trigger watch updates + */ + setIncrementalBuild(isIncremental) { + this.isIncremental = !!isIncremental; + + if (this.watchManager) { + this.watchManager.incremental = !!isIncremental; + } + if (this.writer) { + this.writer.setIncrementalBuild(this.isIncremental); + } + } + + /** + * Set whether or not to do an initial build + * + * @param {boolean} ignoreInitialBuild - Shall Eleventy ignore the default initial build before watching in watch/serve mode? + * @default true + */ + setIgnoreInitial(ignoreInitialBuild) { + this.isRunInitialBuild = !ignoreInitialBuild; + + if (this.writer) { + this.writer.setRunInitialBuild(this.isRunInitialBuild); + } + } + + /** + * Updates the path prefix used in the config. + * + * @param {string} pathPrefix - The new path prefix. + */ + setPathPrefix(pathPrefix) { + if (pathPrefix || pathPrefix === "") { + this.eleventyConfig.setPathPrefix(pathPrefix); + // TODO reset config + // this.config = this.eleventyConfig.getConfig(); + } + } + + /** + * Restarts Eleventy. + */ + async restart() { + debug("Restarting."); + this.start = this.getNewTimestamp(); + + this.extensionMap.reset(); + this.bench.reset(); + this.passthroughManager.reset(); + this.eleventyFiles.restart(); + } + + /** + * Logs some statistics after a complete run of Eleventy. + * + * @returns {string} ret - The log message. + */ + logFinished() { + if (!this.writer) { + throw new Error( + "Did you call Eleventy.init to create the TemplateWriter instance? Hint: you probably didn’t.", + ); + } + + let ret = []; + + let { + copyCount, + copySize, + skipCount, + writeCount, + // renderCount, // files that render (costly) but may not write to disk + } = this.writer.getMetadata(); + + let slashRet = []; + + if (copyCount) { + debug("Total passthrough copy aggregate size: %o", filesize(copySize)); + slashRet.push(`Copied ${chalk.bold(copyCount)}`); + } + + slashRet.push( + `Wrote ${chalk.bold(writeCount)} ${simplePlural(writeCount, "file", "files")}${ + skipCount ? ` (skipped ${skipCount})` : "" + }`, + ); + + // slashRet.push( + // `${renderCount} rendered` + // ) + + if (slashRet.length) { + ret.push(slashRet.join(" ")); + } + + let time = (this.getNewTimestamp() - this.start) / 1000; + ret.push( + `in ${chalk.bold(time.toFixed(2))} ${simplePlural(time.toFixed(2), "second", "seconds")}`, + ); + + // More than 1 second total, show estimate of per-template time + if (time >= 1 && writeCount > 1) { + ret.push(`(${((time * 1000) / writeCount).toFixed(1)}ms each, v${pkg.version})`); + } else { + ret.push(`(v${pkg.version})`); + } + + return ret.join(" "); + } + + #cache(key, inst) { + if (!("caches" in inst)) { + throw new Error("To use #cache you need a `caches` getter object"); + } + + // Restore from cache + if (this.#privateCaches.has(key)) { + let c = this.#privateCaches.get(key); + for (let cacheKey in c) { + inst[cacheKey] = c[cacheKey]; + } + } else { + // Set cache + let c = {}; + for (let cacheKey of inst.caches || []) { + c[cacheKey] = inst[cacheKey]; + } + this.#privateCaches.set(key, c); + } + } + + /** + * Starts Eleventy. + */ + async init(options = {}) { + let { viaConfigReset } = Object.assign({ viaConfigReset: false }, options); + if (!this.#hasConfigInitialized) { + await this.initializeConfig(); + } else { + // Note: Global event bus is different from user config event bus + this.config.events.reset(); + } + + await this.config.events.emit("eleventy.config", this.eleventyConfig); + + if (this.env) { + await this.config.events.emit("eleventy.env", this.env); + } + + let formats = this.templateFormats.getTemplateFormats(); + let engineManager = new TemplateEngineManager(this.eleventyConfig); + this.extensionMap = new EleventyExtensionMap(this.eleventyConfig); + this.extensionMap.setFormats(formats); + this.extensionMap.engineManager = engineManager; + await this.config.events.emit("eleventy.extensionmap", this.extensionMap); + + // eleventyServe is always available, even when not in --serve mode + // TODO directorynorm + this.eleventyServe.setOutputDir(this.outputDir); + + // TODO + // this.eleventyServe.setWatcherOptions(this.getChokidarConfig()); + + this.templateData = new TemplateData(this.eleventyConfig); + this.templateData.setProjectUsingEsm(this.isEsm); + this.templateData.extensionMap = this.extensionMap; + if (this.env) { + this.templateData.environmentVariables = this.env; + } + this.templateData.setFileSystemSearch(this.fileSystemSearch); + + this.passthroughManager = new TemplatePassthroughManager(this.eleventyConfig); + this.passthroughManager.setRunMode(this.runMode); + this.passthroughManager.setDryRun(this.isDryRun); + this.passthroughManager.extensionMap = this.extensionMap; + this.passthroughManager.setFileSystemSearch(this.fileSystemSearch); + + this.eleventyFiles = new EleventyFiles(formats, this.eleventyConfig); + this.eleventyFiles.setPassthroughManager(this.passthroughManager); + this.eleventyFiles.setFileSystemSearch(this.fileSystemSearch); + this.eleventyFiles.setRunMode(this.runMode); + this.eleventyFiles.extensionMap = this.extensionMap; + // This needs to be set before init or it’ll construct a new one + this.eleventyFiles.templateData = this.templateData; + this.eleventyFiles.init(); + + if (checkPassthroughCopyBehavior(this.config, this.runMode)) { + this.eleventyServe.watchPassthroughCopy( + this.eleventyFiles.getGlobWatcherFilesForPassthroughCopy(), + ); + } + + // Note these directories are all project root relative + this.config.events.emit("eleventy.directories", this.directories.getUserspaceInstance()); + + this.writer = new TemplateWriter(formats, this.templateData, this.eleventyConfig); + + if (!viaConfigReset) { + // set or restore cache + this.#cache("TemplateWriter", this.writer); + } + + this.writer.logger = this.logger; + this.writer.extensionMap = this.extensionMap; + this.writer.setEleventyFiles(this.eleventyFiles); + this.writer.setPassthroughManager(this.passthroughManager); + this.writer.setRunInitialBuild(this.isRunInitialBuild); + this.writer.setIncrementalBuild(this.isIncremental); + + let debugStr = `Directories: + Input: + Directory: ${this.directories.input} + File: ${this.directories.inputFile || false} + Glob: ${this.directories.inputGlob || false} + Data: ${this.directories.data} + Includes: ${this.directories.includes} + Layouts: ${this.directories.layouts || false} + Output: ${this.directories.output} +Template Formats: ${formats.join(",")} +Verbose Output: ${this.verboseMode}`; + debug(debugStr); + + this.writer.setVerboseOutput(this.verboseMode); + this.writer.setDryRun(this.isDryRun); + + this.#needsInit = false; + } + + // These are all set as initial global data under eleventy.env.* (see TemplateData->environmentVariables) + getEnvironmentVariableValues() { + let values = { + source: this.source, + runMode: this.runMode, + }; + + let configPath = this.eleventyConfig.getLocalProjectConfigFile(); + if (configPath) { + values.config = TemplatePath.absolutePath(configPath); + } + + // Fixed: instead of configuration directory, explicit root or working directory + values.root = TemplatePath.getWorkingDir(); + + values.source = this.source; + + // Backwards compatibility + Object.defineProperty(values, "isServerless", { + enumerable: false, + value: false, + }); + + return values; + } + + /** + * Set process.ENV variables for use in Eleventy projects + * + * @method + */ + initializeEnvironmentVariables(env) { + // Recognize that global data `eleventy.version` is coerced to remove prerelease tags + // and this is the raw version (3.0.0 versus 3.0.0-alpha.6). + // `eleventy.env.version` does not yet exist (unnecessary) + process.env.ELEVENTY_VERSION = Eleventy.getVersion(); + + process.env.ELEVENTY_ROOT = env.root; + debug("Setting process.env.ELEVENTY_ROOT: %o", env.root); + + process.env.ELEVENTY_SOURCE = env.source; + process.env.ELEVENTY_RUN_MODE = env.runMode; + } + + /** @param {boolean} value */ + set verboseMode(value) { + this.setIsVerbose(value); + } + + /** @type {boolean} */ + get verboseMode() { + return this.#isVerboseMode; + } + + /** @type {ConsoleLogger} */ + get logger() { + if (!this.#logger) { + this.#logger = new ConsoleLogger(); + this.#logger.isVerbose = this.verboseMode; + } + + return this.#logger; + } + + /** @param {ConsoleLogger} logger */ + set logger(logger) { + this.eleventyConfig.setLogger(logger); + this.#logger = logger; + } + + disableLogger() { + this.logger.overrideLogger(false); + } + + /** @type {EleventyErrorHandler} */ + get errorHandler() { + if (!this.#errorHandler) { + this.#errorHandler = new EleventyErrorHandler(); + this.#errorHandler.isVerbose = this.verboseMode; + this.#errorHandler.logger = this.logger; + } + + return this.#errorHandler; + } + + /** + * Updates the verbose mode of Eleventy. + * + * @method + * @param {boolean} isVerbose - Shall Eleventy run in verbose mode? + */ + setIsVerbose(isVerbose) { + if (!this.#hasConfigInitialized) { + this.#preInitVerbose = !!isVerbose; + return; + } + + // always defer to --quiet if override happened + isVerbose = this.#verboseOverride ?? !!isVerbose; + + this.#isVerboseMode = isVerbose; + + if (this.logger) { + this.logger.isVerbose = isVerbose; + } + + this.bench.setVerboseOutput(isVerbose); + + if (this.writer) { + this.writer.setVerboseOutput(isVerbose); + } + + if (this.errorHandler) { + this.errorHandler.isVerbose = isVerbose; + } + + // Set verbose mode in config file + this.eleventyConfig.verbose = isVerbose; + } + + get templateFormats() { + if (!this.#templateFormats) { + let tf = new ProjectTemplateFormats(); + this.#templateFormats = tf; + } + + return this.#templateFormats; + } + + /** + * Updates the template formats of Eleventy. + * + * @method + * @param {string} formats - The new template formats. + */ + setFormats(formats) { + this.templateFormats.setViaCommandLine(formats); + } + + /** + * Updates the run mode of Eleventy. + * + * @method + * @param {string} runMode - One of "build", "watch", or "serve" + */ + setRunMode(runMode) { + this.runMode = runMode; + } + + /** + * Set the file that needs to be rendered/compiled/written for an incremental build. + * This method is also wired up to the CLI --incremental=incrementalFile + * + * @method + * @param {string} incrementalFile - File path (added or modified in a project) + */ + setIncrementalFile(incrementalFile) { + if (incrementalFile) { + // This used to also setIgnoreInitial(true) but was changed in 3.0.0-alpha.14 + this.setIncrementalBuild(true); + + this.programmaticApiIncrementalFile = TemplatePath.addLeadingDotSlash(incrementalFile); + + this.eleventyConfig.setPreviousBuildModifiedFile(incrementalFile); + } + } + + unsetIncrementalFile() { + // only applies to initial build, no re-runs (--watch/--serve) + if (this.programmaticApiIncrementalFile) { + // this.setIgnoreInitial(false); + this.programmaticApiIncrementalFile = undefined; + } + + // reset back to false + this.setIgnoreInitial(false); + } + + /** + * Reads the version of Eleventy. + * + * @static + * @returns {string} - The version of Eleventy. + */ + static getVersion() { + return pkg.version; + } + + /** + * @deprecated since 1.0.1, use static Eleventy.getVersion() + */ + getVersion() { + return Eleventy.getVersion(); + } + + /** + * Shows a help message including usage. + * + * @static + * @returns {string} - The help message. + */ + static getHelp() { + return `Usage: eleventy + eleventy --input=. --output=./_site + eleventy --serve + +Arguments: + + --version + + --input=. + Input template files (default: \`.\`) + + --output=_site + Write HTML output to this folder (default: \`_site\`) + + --serve + Run web server on --port (default 8080) and watch them too + + --port + Run the --serve web server on this port (default 8080) + + --watch + Wait for files to change and automatically rewrite (no web server) + + --incremental + Only build the files that have changed. Best with watch/serve. + + --incremental=filename.md + Does not require watch/serve. Run an incremental build targeting a single file. + + --ignore-initial + Start without a build; build when files change. Works best with watch/serve/incremental. + + --formats=liquid,md + Allow only certain template types (default: \`*\`) + + --quiet + Don’t print all written files (off by default) + + --config=filename.js + Override the eleventy config file path (default: \`.eleventy.js\`) + + --pathprefix='/' + Change all url template filters to use this subdirectory. + + --dryrun + Don’t write any files. Useful in DEBUG mode, for example: \`DEBUG=Eleventy* npx @11ty/eleventy --dryrun\` + + --loader + Set to "esm" to force ESM mode, "cjs" to force CommonJS mode, or "auto" (default) to infer it from package.json. + + --to=json + --to=ndjson + Change the output to JSON or NDJSON (default: \`fs\`) + + --help`; + } + + /** + * @deprecated since 1.0.1, use static Eleventy.getHelp() + */ + getHelp() { + return Eleventy.getHelp(); + } + + /** + * Resets the config of Eleventy. + * + * @method + */ + resetConfig() { + delete this.eleventyConfig; + + // ensures `initializeConfig()` will run when `init()` is called next + this.#hasConfigInitialized = false; + } + + /** + * @param {string} changedFilePath - File that triggered a re-run (added or modified) + * @param {boolean} [isResetConfig] - are we doing a config reset + */ + async #addFileToWatchQueue(changedFilePath, isResetConfig) { + // Currently this is only for 11ty.js deps but should be extended with usesGraph + let usedByDependants = []; + if (this.watchTargets) { + usedByDependants = this.watchTargets.getDependantsOf( + TemplatePath.addLeadingDotSlash(changedFilePath), + ); + } + + let relevantLayouts = this.eleventyConfig.usesGraph.getLayoutsUsedBy(changedFilePath); + + // `eleventy.templateModified` is no longer used internally, remove in a future major version. + eventBus.emit("eleventy.templateModified", changedFilePath, { + usedByDependants, + relevantLayouts, + }); + + // These listeners are *global*, not cleared even on config reset + eventBus.emit("eleventy.resourceModified", changedFilePath, usedByDependants, { + viaConfigReset: isResetConfig, + relevantLayouts, + }); + + this.config.events.emit("eleventy#templateModified", changedFilePath); + + this.watchManager.addToPendingQueue(changedFilePath); + } + + shouldTriggerConfigReset(changedFiles) { + let configFilePaths = new Set(this.eleventyConfig.getLocalProjectConfigFiles()); + let resetConfigGlobs = EleventyWatchTargets.normalizeToGlobs( + Array.from(this.eleventyConfig.userConfig.watchTargetsConfigReset), + ); + for (let filePath of changedFiles) { + if (configFilePaths.has(filePath)) { + return true; + } + if (isGlobMatch(filePath, resetConfigGlobs)) { + return true; + } + } + + for (const configFilePath of configFilePaths) { + // Any dependencies of the config file changed + let configFileDependencies = new Set(this.watchTargets.getDependenciesOf(configFilePath)); + + for (let filePath of changedFiles) { + if (configFileDependencies.has(filePath)) { + return true; + } + } + } + + return false; + } + + // Checks the build queue to see if any configuration related files have changed + #shouldResetConfig(activeQueue = []) { + if (!activeQueue.length) { + return false; + } + + return this.shouldTriggerConfigReset( + activeQueue.map((path) => { + return PathNormalizer.normalizeSeperator(TemplatePath.addLeadingDotSlash(path)); + }), + ); + } + + async #watch(isResetConfig = false) { + if (this.watchManager.isBuildRunning()) { + return; + } + + this.watchManager.setBuildRunning(); + + let queue = this.watchManager.getActiveQueue(); + + await this.config.events.emit("beforeWatch", queue); + await this.config.events.emit("eleventy.beforeWatch", queue); + + // Clear `import` cache for all files that triggered the rebuild (sync event) + this.watchTargets.clearImportCacheFor(queue); + + // reset and reload global configuration + if (isResetConfig) { + // important: run this before config resets otherwise the handlers will disappear. + await this.config.events.emit("eleventy.reset"); + this.resetConfig(); + } + + await this.restart(); + await this.init({ viaConfigReset: isResetConfig }); + + try { + let [passthroughCopyResults, templateResults] = await this.write(); + + this.watchTargets.reset(); + + await this.#initWatchDependencies(); + + // Add new deps to chokidar + this.watcher.add(this.watchTargets.getNewTargetsSinceLastReset()); + + // Is a CSS input file and is not in the includes folder + // TODO check output path file extension of this template (not input path) + // TODO add additional API for this, maybe a config callback? + let onlyCssChanges = this.watchManager.hasAllQueueFiles((path) => { + return ( + path.endsWith(".css") && + // TODO how to make this work with relative includes? + !TemplatePath.startsWithSubPath(path, this.eleventyFiles.getIncludesDir()) + ); + }); + + let files = this.watchManager.getActiveQueue(); + + // Maps passthrough copy files to output URLs for CSS live reload + let stylesheetUrls = new Set(); + for (let entry of passthroughCopyResults) { + for (let filepath in entry.map) { + if ( + filepath.endsWith(".css") && + files.includes(TemplatePath.addLeadingDotSlash(filepath)) + ) { + stylesheetUrls.add( + "/" + TemplatePath.stripLeadingSubPath(entry.map[filepath], this.outputDir), + ); + } + } + } + + let normalizedPathPrefix = PathPrefixer.normalizePathPrefix(this.config.pathPrefix); + let matchingTemplates = templateResults + .flat() + .filter((entry) => Boolean(entry)) + .map((entry) => { + // only `url`, `inputPath`, and `content` are used: https://github.com/11ty/eleventy-dev-server/blob/1c658605f75224fdc76f68aebe7a412eeb4f1bc9/client/reload-client.js#L140 + entry.url = PathPrefixer.joinUrlParts(normalizedPathPrefix, entry.url); + delete entry.rawInput; // Issue #3481 + return entry; + }); + + await this.eleventyServe.reload({ + files, + subtype: onlyCssChanges ? "css" : undefined, + build: { + stylesheets: Array.from(stylesheetUrls), + templates: matchingTemplates, + }, + }); + } catch (error) { + this.eleventyServe.sendError({ + error, + }); + } + + this.watchManager.setBuildFinished(); + + let queueSize = this.watchManager.getPendingQueueSize(); + if (queueSize > 0) { + this.logger.log( + `You saved while Eleventy was running, let’s run again. (${queueSize} change${ + queueSize !== 1 ? "s" : "" + })`, + ); + await this.#watch(); + } else { + this.logger.log("Watching…"); + } + } + + /** + * @returns {module:11ty/eleventy/src/Benchmark/BenchmarkGroup~BenchmarkGroup} + */ + get watcherBench() { + return this.bench.get("Watcher"); + } + + /** + * Set up watchers and benchmarks. + * + * @async + * @method + */ + async initWatch() { + this.watchManager = new EleventyWatch(); + this.watchManager.incremental = this.isIncremental; + + if (this.projectPackageJsonPath) { + this.watchTargets.add([ + path.relative(TemplatePath.getWorkingDir(), this.projectPackageJsonPath), + ]); + } + this.watchTargets.add(this.eleventyFiles.getGlobWatcherFiles()); + this.watchTargets.add(this.eleventyFiles.getIgnoreFiles()); + + // Watch the local project config file + this.watchTargets.add(this.eleventyConfig.getLocalProjectConfigFiles()); + + // Template and Directory Data Files + this.watchTargets.add(await this.eleventyFiles.getGlobWatcherTemplateDataFiles()); + + let benchmark = this.watcherBench.get( + "Watching JavaScript Dependencies (disable with `eleventyConfig.setWatchJavaScriptDependencies(false)`)", + ); + benchmark.before(); + await this.#initWatchDependencies(); + benchmark.after(); + } + + // fetch from project’s package.json + get projectPackageJsonPath() { + if (this.#projectPackageJsonPath === undefined) { + this.#projectPackageJsonPath = getWorkingProjectPackageJsonPath() || false; + } + return this.#projectPackageJsonPath; + } + + get projectPackageJson() { + if (!this.#projectPackageJson) { + let p = this.projectPackageJsonPath; + this.#projectPackageJson = p ? importJsonSync(p) : {}; + } + return this.#projectPackageJson; + } + + get isEsm() { + if (this.#isEsm !== undefined) { + return this.#isEsm; + } + if (this.loader == "esm") { + this.#isEsm = true; + } else if (this.loader == "cjs") { + this.#isEsm = false; + } else if (this.loader == "auto") { + this.#isEsm = this.projectPackageJson?.type === "module"; + } else { + throw new Error("The 'loader' option must be one of 'esm', 'cjs', or 'auto'"); + } + return this.#isEsm; + } + + /** + * Starts watching dependencies. + */ + async #initWatchDependencies() { + if (!this.eleventyConfig.shouldSpiderJavaScriptDependencies()) { + return; + } + + // TODO use DirContains + let dataDir = TemplatePath.stripLeadingDotSlash(this.templateData.getDataDir()); + function filterOutGlobalDataFiles(path) { + return !dataDir || !TemplatePath.stripLeadingDotSlash(path).startsWith(dataDir); + } + + // Lazy resolve isEsm only for --watch + this.watchTargets.setProjectUsingEsm(this.isEsm); + + // Template files .11ty.js + let templateFiles = await this.eleventyFiles.getWatchPathCache(); + await this.watchTargets.addDependencies(templateFiles); + + // Config file dependencies + await this.watchTargets.addDependencies( + this.eleventyConfig.getLocalProjectConfigFiles(), + filterOutGlobalDataFiles, + ); + + // Deps from Global Data (that aren’t in the global data directory, everything is watched there) + let globalDataDeps = this.templateData.getWatchPathCache(); + await this.watchTargets.addDependencies(globalDataDeps, filterOutGlobalDataFiles); + + await this.watchTargets.addDependencies( + await this.eleventyFiles.getWatcherTemplateJavaScriptDataFiles(), + ); + } + + /** + * Returns all watched files. + * + * @async + * @method + * @returns {Promise} targets - The watched files. + */ + async getWatchedFiles() { + return this.watchTargets.getTargets(); + } + + getChokidarConfig() { + let ignores = this.eleventyFiles.getGlobWatcherIgnores(); + debug("Ignoring watcher changes to: %o", ignores); + + let configOptions = this.config.chokidarConfig; + + // can’t override these yet + // TODO maybe if array, merge the array? + delete configOptions.ignored; + + return Object.assign( + { + ignored: ignores, + ignoreInitial: true, + awaitWriteFinish: { + stabilityThreshold: 150, + pollInterval: 25, + }, + }, + configOptions, + ); + } + + /** + * Start the watching of files + * + * @async + * @method + */ + async watch() { + this.watcherBench.setMinimumThresholdMs(500); + this.watcherBench.reset(); + + // We use a string module name and try/catch here to hide this from the zisi and esbuild serverless bundlers + let chokidar; + // eslint-disable-next-line no-useless-catch + try { + let moduleName = "chokidar"; + let chokidarImport = await import(moduleName); + chokidar = chokidarImport.default; + } catch (e) { + throw e; + } + + // Note that watching indirectly depends on this for fetching dependencies from JS files + // See: TemplateWriter:pathCache and EleventyWatchTargets + await this.write(); + + let initWatchBench = this.watcherBench.get("Start up --watch"); + initWatchBench.before(); + + await this.initWatch(); + + // TODO improve unwatching if JS dependencies are removed (or files are deleted) + let rawFiles = await this.getWatchedFiles(); + debug("Watching for changes to: %o", rawFiles); + + let options = this.getChokidarConfig(); + + // Remap all paths to `cwd` if in play (Issue #3854) + let remapper = new FileSystemRemap(rawFiles); + let cwd = remapper.getCwd(); + + if (cwd) { + options.cwd = cwd; + + rawFiles = remapper.getInput().map((entry) => { + return TemplatePath.stripLeadingDotSlash(entry); + }); + + options.ignored = remapper.getRemapped(options.ignored || []).map((entry) => { + return TemplatePath.stripLeadingDotSlash(entry); + }); + } + + let watcher = chokidar.watch(rawFiles, options); + + initWatchBench.after(); + + this.watcherBench.finish("Watch"); + + this.logger.forceLog("Watching…"); + + this.watcher = watcher; + + let watchDelay; + let watchRun = async (path) => { + path = TemplatePath.normalize(path); + try { + let isResetConfig = this.#shouldResetConfig([path]); + this.#addFileToWatchQueue(path, isResetConfig); + + clearTimeout(watchDelay); + + let { promise, resolve, reject } = withResolvers(); + + watchDelay = setTimeout(async () => { + this.#watch(isResetConfig).then(resolve, reject); + }, this.config.watchThrottleWaitTime); + + await promise; + } catch (e) { + if (e instanceof EleventyBaseError) { + this.errorHandler.error(e, "Eleventy watch error"); + this.watchManager.setBuildFinished(); + } else { + this.errorHandler.fatal(e, "Eleventy fatal watch error"); + await this.stopWatch(); + } + } + + this.config.events.emit("eleventy.afterwatch"); + }; + + watcher.on("change", async (path) => { + // Emulated passthrough copy logs from the server + if (!this.eleventyServe.isEmulatedPassthroughCopyMatch(path)) { + this.logger.forceLog(`File changed: ${TemplatePath.standardizeFilePath(path)}`); + } + + await watchRun(path); + }); + + watcher.on("add", async (path) => { + // Emulated passthrough copy logs from the server + if (!this.eleventyServe.isEmulatedPassthroughCopyMatch(path)) { + this.logger.forceLog(`File added: ${TemplatePath.standardizeFilePath(path)}`); + } + + this.fileSystemSearch.add(path); + await watchRun(path); + }); + + watcher.on("unlink", (path) => { + this.logger.forceLog(`File deleted: ${TemplatePath.standardizeFilePath(path)}`); + this.fileSystemSearch.delete(path); + }); + + // wait for chokidar to be ready. + await new Promise((resolve) => { + watcher.on("ready", () => resolve()); + }); + + // Returns for testability + return watchRun; + } + + async stopWatch() { + // Prevent multiple invocations. + if (this.#isStopping) { + return this.#isStopping; + } + + debug("Cleaning up chokidar and server instances, if they exist."); + this.#isStopping = Promise.all([this.eleventyServe.close(), this.watcher?.close()]).then(() => { + this.#isStopping = false; + }); + + return this.#isStopping; + } + + /** + * Serve Eleventy on this port. + * + * @param {Number} port - The HTTP port to serve Eleventy from. + */ + async serve(port) { + // Port is optional and in this case likely via --port on the command line + // May defer to configuration API options `port` property + return this.eleventyServe.serve(port); + } + + /** + * Writes templates to the file system. + * + * @async + * @method + * @returns {Promise<{Array}>} + */ + async write() { + return this.executeBuild("fs"); + } + + /** + * Renders templates to a JSON object. + * + * @async + * @method + * @returns {Promise<{Array}>} + */ + async toJSON() { + return this.executeBuild("json"); + } + + /** + * Returns a stream of new line delimited (NDJSON) objects + * + * @async + * @method + * @returns {Promise<{ReadableStream}>} + */ + async toNDJSON() { + return this.executeBuild("ndjson"); + } + + /** + * tbd. + * + * @async + * @method + * @returns {Promise<{Array,ReadableStream}>} ret - tbd. + */ + async executeBuild(to = "fs") { + if (this.#needsInit) { + if (!this.#initPromise) { + this.#initPromise = this.init(); + } + await this.#initPromise.then(() => { + // #needsInit also set to false at the end of `init()` + this.#needsInit = false; + this.#initPromise = undefined; + }); + } + + if (!this.writer) { + throw new Error( + "Internal error: Eleventy didn’t run init() properly and wasn’t able to create a TemplateWriter.", + ); + } + + let incrementalFile = + this.programmaticApiIncrementalFile || this.watchManager?.getIncrementalFile(); + if (incrementalFile) { + this.writer.setIncrementalFile(incrementalFile); + } + + let returnObj; + let hasError = false; + + try { + let directories = this.directories.getUserspaceInstance(); + let eventsArg = { + directories, + + // v3.0.0-alpha.6, changed to use `directories` instead (this was only used by serverless plugin) + inputDir: directories.input, + + // Deprecated (not normalized) use `directories` instead. + dir: this.config.dir, + + runMode: this.runMode, + outputMode: to, + incremental: this.isIncremental, + }; + + await this.config.events.emit("beforeBuild", eventsArg); + await this.config.events.emit("eleventy.before", eventsArg); + + let promise; + if (to === "fs") { + promise = this.writer.write(); + } else if (to === "json") { + promise = this.writer.getJSON("json"); + } else if (to === "ndjson") { + promise = this.writer.getJSON("ndjson"); + } else { + throw new Error( + `Invalid argument for \`Eleventy->executeBuild(${to})\`, expected "json", "ndjson", or "fs".`, + ); + } + + let resolved = await promise; + + // Passing the processed output to the eleventy.after event (2.0+) + eventsArg.results = resolved.templates; + + if (to === "ndjson") { + // return a stream + // TODO this outputs all ndjson rows after all the templates have been written to the stream + returnObj = this.logger.closeStream(); + } else if (to === "json") { + // Backwards compat + returnObj = resolved.templates; + } else { + // Backwards compat + returnObj = [resolved.passthroughCopy, resolved.templates]; + } + + this.unsetIncrementalFile(); + this.writer.resetIncrementalFile(); + + eventsArg.uses = this.eleventyConfig.usesGraph.map; + await this.config.events.emit("afterBuild", eventsArg); + await this.config.events.emit("eleventy.after", eventsArg); + + this.buildCount++; + } catch (error) { + hasError = true; + + // Issue #2405: Don’t change the exitCode for programmatic scripts + let errorSeverity = this.source === "script" ? "error" : "fatal"; + this.errorHandler.once(errorSeverity, error, "Problem writing Eleventy templates"); + + // TODO ndjson should stream the error but https://github.com/11ty/eleventy/issues/3382 + throw error; + } finally { + this.bench.finish(); + + if (to === "fs") { + this.logger.logWithOptions({ + message: this.logFinished(), + color: hasError ? "red" : "green", + force: true, + }); + } + + debug("Finished."); + + debug(` +Have a suggestion/feature request/feedback? Feeling frustrated? I want to hear it! +Open an issue: https://github.com/11ty/eleventy/issues/new`); + } + + return returnObj; + } +} + +export default Eleventy; + +// extend for exporting to CJS +Object.assign(RenderPlugin, RenderPluginExtras); +Object.assign(I18nPlugin, I18nPluginExtras); +Object.assign(HtmlBasePlugin, HtmlBasePluginExtras); + +// Removed plugins + +const EleventyServerlessBundlerPlugin = function () { + throw new Error( + "Following feedback from our Community Survey, low interest in this plugin prompted its removal from Eleventy core in 3.0 as we refocus on static sites. Learn more: https://v3.11ty.dev/docs/plugins/serverless/", + ); +}; + +const EleventyEdgePlugin = function () { + throw new Error( + "Following feedback from our Community Survey, low interest in this plugin prompted its removal from Eleventy core in 3.0 as we refocus on static sites. Learn more: https://v3.11ty.dev/docs/plugins/edge/", + ); +}; + +export { + Eleventy, + EleventyImport as ImportFile, + + // Error messages for removed plugins + EleventyServerlessBundlerPlugin as EleventyServerless, + EleventyServerlessBundlerPlugin, + EleventyEdgePlugin, + + /** + * @type {module:11ty/eleventy/Plugins/RenderPlugin} + */ + RenderPlugin as EleventyRenderPlugin, // legacy name + /** + * @type {module:11ty/eleventy/Plugins/RenderPlugin} + */ + RenderPlugin, + + /** + * @type {module:11ty/eleventy/Plugins/I18nPlugin} + */ + I18nPlugin as EleventyI18nPlugin, // legacy name + /** + * @type {module:11ty/eleventy/Plugins/I18nPlugin} + */ + I18nPlugin, + + /** + * @type {module:11ty/eleventy/Plugins/HtmlBasePlugin} + */ + HtmlBasePlugin as EleventyHtmlBasePlugin, // legacy name + /** + * @type {module:11ty/eleventy/Plugins/HtmlBasePlugin} + */ + HtmlBasePlugin, + + /** + * @type {module:11ty/eleventy/Plugins/InputPathToUrlTransformPlugin} + */ + InputPathToUrlTransformPlugin, + + /** + * @type {module:11ty/eleventy-plugin-bundle} + */ + BundlePlugin, + + /** + * @type {module:11ty/eleventy/Plugins/IdAttributePlugin} + */ + IdAttributePlugin, +}; diff --git a/node_modules/@11ty/eleventy/src/EleventyCommonJs.cjs b/node_modules/@11ty/eleventy/src/EleventyCommonJs.cjs new file mode 100644 index 00000000..52272656 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/EleventyCommonJs.cjs @@ -0,0 +1,43 @@ +function canRequireModules() { + // via --experimental-require-module or newer than Node 22 support when this flag is no longer necessary + try { + require("./Util/Objects/SampleModule.mjs"); + return true; + } catch(e) { + if(e.code === "ERR_REQUIRE_ESM") { + return false; + } + + // Rethrow if not an ESM require error. + throw e; + } +} + +if(!canRequireModules()) { + let error = new Error(`\`require("@11ty/eleventy")\` is incompatible with Eleventy v3 and this version of Node. You have a few options: + 1. (Easiest) Change the \`require\` to use a dynamic import inside of an asynchronous CommonJS configuration + callback, for example: + + module.exports = async function { + const {EleventyRenderPlugin, EleventyI18nPlugin, EleventyHtmlBasePlugin} = await import("@11ty/eleventy"); + } + + 2. (Easier) Update the JavaScript syntax in your configuration file from CommonJS to ESM (change \`require\` + to use \`import\` and rename the file to have an \`.mjs\` file extension). + + 3. (More work) Change your project to use ESM-first by adding \`"type": "module"\` to your package.json. Any + \`.js\` will need to be ported to use ESM syntax (or renamed to \`.cjs\`.) + + 4. Upgrade your Node version (at time of writing, v22.12 or newer) to enable this behavior. If you use a version + of Node older than v22.12, try the --experimental-require-module command line flag in Node. Read more: + https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require`); + + error.skipOriginalStack = true; + + throw error; +} + +// If we made it here require(ESM) works fine (via --experimental-require-module or newer Node.js defaults) +let mod = require("./Eleventy.js"); + +module.exports = mod; diff --git a/node_modules/@11ty/eleventy/src/EleventyExtensionMap.js b/node_modules/@11ty/eleventy/src/EleventyExtensionMap.js new file mode 100644 index 00000000..8f426404 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/EleventyExtensionMap.js @@ -0,0 +1,284 @@ +import { TemplatePath } from "@11ty/eleventy-utils"; + +class EleventyExtensionMap { + #engineManager; + + constructor(config) { + this.setTemplateConfig(config); + this._spiderJsDepsCache = {}; + + /** @type {Array} */ + this.validTemplateLanguageKeys; + } + + setFormats(formatKeys = []) { + // raw + this.formatKeys = formatKeys; + + this.unfilteredFormatKeys = formatKeys.map(function (key) { + return key.trim().toLowerCase(); + }); + + this.validTemplateLanguageKeys = this.unfilteredFormatKeys.filter((key) => + this.hasExtension(key), + ); + + this.passthroughCopyKeys = this.unfilteredFormatKeys.filter((key) => !this.hasExtension(key)); + } + + setTemplateConfig(config) { + if (!config || config.constructor.name !== "TemplateConfig") { + throw new Error("Internal error: Missing or invalid `config` argument."); + } + + this.templateConfig = config; + } + + get config() { + return this.templateConfig.getConfig(); + } + + get engineManager() { + if (!this.#engineManager) { + throw new Error("Internal error: Missing `#engineManager` in EleventyExtensionMap."); + } + + return this.#engineManager; + } + + set engineManager(mgr) { + this.#engineManager = mgr; + } + + reset() { + this.#engineManager.reset(); + } + + /* Used for layout path resolution */ + getFileList(path, dir) { + if (!path) { + return []; + } + + let files = []; + this.validTemplateLanguageKeys.forEach((key) => { + this.getExtensionsFromKey(key).forEach(function (extension) { + files.push((dir ? dir + "/" : "") + path + "." + extension); + }); + }); + + return files; + } + + // Warning: this would false positive on an include, but is only used + // on paths found from the file system glob search. + // TODO: Method name might just need to be renamed to something more accurate. + isFullTemplateFilePath(path) { + for (let extension of this.validTemplateLanguageKeys) { + if (path.endsWith(`.${extension}`)) { + return true; + } + } + return false; + } + + getCustomExtensionEntry(extension) { + if (!this.config.extensionMap) { + return; + } + + for (let entry of this.config.extensionMap) { + if (entry.extension === extension) { + return entry; + } + } + } + + getValidExtensionsForPath(path) { + let extensions = new Set(); + for (let extension in this.extensionToKeyMap) { + if (path.endsWith(`.${extension}`)) { + extensions.add(extension); + } + } + + // if multiple extensions are valid, sort from longest to shortest + // e.g. .11ty.js and .js + let sorted = Array.from(extensions) + .filter((extension) => this.validTemplateLanguageKeys.includes(extension)) + .sort((a, b) => b.length - a.length); + + return sorted; + } + + async shouldSpiderJavaScriptDependencies(path) { + let extensions = this.getValidExtensionsForPath(path); + for (let extension of extensions) { + if (extension in this._spiderJsDepsCache) { + return this._spiderJsDepsCache[extension]; + } + + let cls = await this.engineManager.getEngineClassByExtension(extension); + if (cls) { + let entry = this.getCustomExtensionEntry(extension); + let shouldSpider = cls.shouldSpiderJavaScriptDependencies(entry); + this._spiderJsDepsCache[extension] = shouldSpider; + return shouldSpider; + } + } + + return false; + } + + getPassthroughCopyGlobs(inputDir) { + return this._getGlobs(this.passthroughCopyKeys, inputDir); + } + + getValidGlobs(inputDir) { + return this._getGlobs(this.validTemplateLanguageKeys, inputDir); + } + + getGlobs(inputDir) { + return this._getGlobs(this.unfilteredFormatKeys, inputDir); + } + + _getGlobs(formatKeys, inputDir = "") { + let extensions = new Set(); + + for (let key of formatKeys) { + if (this.hasExtension(key)) { + for (let extension of this.getExtensionsFromKey(key)) { + extensions.add(extension); + } + } else { + extensions.add(key); + } + } + + let dir = TemplatePath.convertToRecursiveGlobSync(inputDir); + if (extensions.size === 1) { + return [`${dir}/*.${Array.from(extensions)[0]}`]; + } else if (extensions.size > 1) { + return [ + // extra curly brackets /*.{cjs,txt} + `${dir}/*.{${Array.from(extensions).join(",")}}`, + ]; + } + + return []; + } + + hasExtension(key) { + for (let extension in this.extensionToKeyMap) { + if ( + this.extensionToKeyMap[extension].key === key || + this.extensionToKeyMap[extension].aliasKey === key + ) { + return true; + } + } + + return false; + } + + getExtensionsFromKey(key) { + let extensions = new Set(); + for (let extension in this.extensionToKeyMap) { + if (this.extensionToKeyMap[extension].aliasKey) { + // only add aliased extension if explicitly referenced in formats + // overrides will not have an aliasKey (md => md) + if (this.extensionToKeyMap[extension].aliasKey === key) { + extensions.add(extension); + } + } else if (this.extensionToKeyMap[extension].key === key) { + extensions.add(extension); + } + } + + return Array.from(extensions); + } + + // Only `addExtension` configuration API extensions + getExtensionEntriesFromKey(key) { + let entries = new Set(); + if ("extensionMap" in this.config) { + for (let entry of this.config.extensionMap) { + if (entry.key === key) { + entries.add(entry); + } + } + } + return Array.from(entries); + } + + // Determines whether a path is a passthrough copy file or a template (via TemplateWriter) + hasEngine(pathOrKey) { + return !!this.getKey(pathOrKey); + } + + getKey(pathOrKey) { + pathOrKey = (pathOrKey || "").toLowerCase(); + for (let extension in this.extensionToKeyMap) { + if (pathOrKey === extension || pathOrKey.endsWith("." + extension)) { + let key = + this.extensionToKeyMap[extension].aliasKey || this.extensionToKeyMap[extension].key; + // must be a valid format key passed (e.g. via --formats) + if (this.validTemplateLanguageKeys.includes(key)) { + return key; + } + } + } + } + + getExtensionEntry(pathOrKey) { + pathOrKey = (pathOrKey || "").toLowerCase(); + for (let extension in this.extensionToKeyMap) { + if (pathOrKey === extension || pathOrKey.endsWith("." + extension)) { + return this.extensionToKeyMap[extension]; + } + } + } + + removeTemplateExtension(path) { + for (let extension in this.extensionToKeyMap) { + if (path === extension || path.endsWith("." + extension)) { + return path.slice( + 0, + path.length - 1 - extension.length < 0 ? 0 : path.length - 1 - extension.length, + ); + } + } + return path; + } + + // keys are file extensions + // values are template language keys + get extensionToKeyMap() { + if (!this._extensionToKeyMap) { + this._extensionToKeyMap = { + md: { key: "md", extension: "md" }, + html: { key: "html", extension: "html" }, + njk: { key: "njk", extension: "njk" }, + liquid: { key: "liquid", extension: "liquid" }, + "11ty.js": { key: "11ty.js", extension: "11ty.js" }, + "11ty.cjs": { key: "11ty.js", extension: "11ty.cjs" }, + "11ty.mjs": { key: "11ty.js", extension: "11ty.mjs" }, + }; + + if ("extensionMap" in this.config) { + for (let entry of this.config.extensionMap) { + // extension and key are only different when aliasing. + this._extensionToKeyMap[entry.extension] = entry; + } + } + } + + return this._extensionToKeyMap; + } + + getReadableFileExtensions() { + return Object.keys(this.extensionToKeyMap).join(" "); + } +} + +export default EleventyExtensionMap; diff --git a/node_modules/@11ty/eleventy/src/EleventyFiles.js b/node_modules/@11ty/eleventy/src/EleventyFiles.js new file mode 100644 index 00000000..7ec6379e --- /dev/null +++ b/node_modules/@11ty/eleventy/src/EleventyFiles.js @@ -0,0 +1,521 @@ +import fs from "node:fs"; + +import { TemplatePath, isPlainObject } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; + +import DirContains from "./Util/DirContains.js"; +import TemplateData from "./Data/TemplateData.js"; +import TemplateGlob from "./TemplateGlob.js"; +import checkPassthroughCopyBehavior from "./Util/PassthroughCopyBehaviorCheck.js"; + +const debug = debugUtil("Eleventy:EleventyFiles"); + +class EleventyFiles { + #extensionMap; + #watcherGlobs; + + constructor(formats, templateConfig) { + if (!templateConfig) { + throw new Error("Internal error: Missing `templateConfig`` argument."); + } + + this.templateConfig = templateConfig; + this.config = templateConfig.getConfig(); + this.aggregateBench = this.config.benchmarkManager.get("Aggregate"); + + this.formats = formats; + this.eleventyIgnoreContent = false; + } + + get dirs() { + return this.templateConfig.directories; + } + + get inputDir() { + return this.dirs.input; + } + + get outputDir() { + return this.dirs.output; + } + + get includesDir() { + return this.dirs.includes; + } + + get layoutsDir() { + return this.dirs.layouts; + } + + get dataDir() { + return this.dirs.data; + } + + // Backwards compat + getDataDir() { + return this.dataDir; + } + + setFileSystemSearch(fileSystemSearch) { + this.fileSystemSearch = fileSystemSearch; + } + + init() { + if (this.dirs.inputFile || this.dirs.inputGlob) { + this.templateGlobs = TemplateGlob.map([this.dirs.inputFile || this.dirs.inputGlob]); + } else { + // Input is a directory + this.templateGlobs = this.extensionMap.getGlobs(this.inputDir); + } + + this.setupGlobs(); + } + + #getWatcherGlobs() { + if (!this.#watcherGlobs) { + let globs; + // Input is a file + if (this.inputFile) { + globs = this.templateGlobs; + } else { + // input is a directory + globs = this.extensionMap.getValidGlobs(this.inputDir); + } + this.#watcherGlobs = globs; + } + + return this.#watcherGlobs; + } + + get passthroughGlobs() { + let paths = new Set(); + // stuff added in addPassthroughCopy() + for (let path of this.passthroughManager.getConfigPathGlobs()) { + paths.add(path); + } + // non-template language extensions + for (let path of this.extensionMap.getPassthroughCopyGlobs(this.inputDir)) { + paths.add(path); + } + return Array.from(paths); + } + + restart() { + this.setupGlobs(); + this._glob = null; + } + + /* For testing */ + _setConfig(config) { + if (!config.ignores) { + config.ignores = new Set(); + config.ignores.add("**/node_modules/**"); + } + + this.config = config; + + this.init(); + } + + /* Set command root for local project paths */ + // This is only used by tests + _setLocalPathRoot(dir) { + this.localPathRoot = dir; + } + + set extensionMap(extensionMap) { + this.#extensionMap = extensionMap; + } + + get extensionMap() { + // for tests + if (!this.#extensionMap) { + throw new Error("Internal error: missing `extensionMap` in EleventyFiles."); + } + return this.#extensionMap; + } + + setRunMode(runMode) { + this.runMode = runMode; + } + + setPassthroughManager(mgr) { + this.passthroughManager = mgr; + } + + set templateData(templateData) { + this._templateData = templateData; + } + + get templateData() { + if (!this._templateData) { + this._templateData = new TemplateData(this.templateConfig); + } + + return this._templateData; + } + + setupGlobs() { + this.fileIgnores = this.getIgnores(); + this.extraIgnores = this.getIncludesAndDataDirs(); + this.uniqueIgnores = this.getIgnoreGlobs(); + + // Conditional added for tests that don’t have a config + if (this.config?.events) { + this.config.events.emit("eleventy.ignores", this.uniqueIgnores); + } + + this.normalizedTemplateGlobs = this.templateGlobs; + } + + normalizeIgnoreEntry(entry) { + if (!entry.startsWith("**/")) { + return TemplateGlob.normalizePath(this.localPathRoot || ".", entry); + } + return entry; + } + + getIgnoreGlobs() { + let uniqueIgnores = new Set(); + for (let ignore of this.fileIgnores) { + uniqueIgnores.add(ignore); + } + for (let ignore of this.extraIgnores) { + uniqueIgnores.add(ignore); + } + + // Placing the config ignores last here is important to the tests + for (let ignore of this.config.ignores) { + uniqueIgnores.add(this.normalizeIgnoreEntry(ignore)); + } + + return Array.from(uniqueIgnores); + } + + static getFileIgnores(ignoreFiles) { + if (!Array.isArray(ignoreFiles)) { + ignoreFiles = [ignoreFiles]; + } + + let ignores = []; + for (let ignorePath of ignoreFiles) { + ignorePath = TemplatePath.normalize(ignorePath); + + let dir = TemplatePath.getDirFromFilePath(ignorePath); + + if (fs.existsSync(ignorePath) && fs.statSync(ignorePath).size > 0) { + let ignoreContent = fs.readFileSync(ignorePath, "utf8"); + + ignores = ignores.concat(EleventyFiles.normalizeIgnoreContent(dir, ignoreContent)); + } + } + + ignores.forEach((path) => debug(`${ignoreFiles} ignoring: ${path}`)); + + return ignores; + } + + static normalizeIgnoreContent(dir, ignoreContent) { + let ignores = []; + + if (ignoreContent) { + ignores = ignoreContent + .split("\n") + .map((line) => { + return line.trim(); + }) + .filter((line) => { + if (line.charAt(0) === "!") { + debug( + ">>> When processing .gitignore/.eleventyignore, Eleventy does not currently support negative patterns but encountered one:", + ); + debug(">>>", line); + debug("Follow along at https://github.com/11ty/eleventy/issues/693 to track support."); + } + + // empty lines or comments get filtered out + return line.length > 0 && line.charAt(0) !== "#" && line.charAt(0) !== "!"; + }) + .map((line) => { + let path = TemplateGlob.normalizePath(dir, "/", line); + path = TemplatePath.addLeadingDotSlash(TemplatePath.relativePath(path)); + + try { + // Note these folders must exist to get /** suffix + let stat = fs.statSync(path); + if (stat.isDirectory()) { + return path + "/**"; + } + return path; + } catch (e) { + return path; + } + }); + } + + return ignores; + } + + /* Tests only */ + _setEleventyIgnoreContent(content) { + this.eleventyIgnoreContent = content; + } + + getIgnores() { + let files = new Set(); + + for (let ignore of EleventyFiles.getFileIgnores(this.getIgnoreFiles())) { + files.add(ignore); + } + + // testing API + if (this.eleventyIgnoreContent !== false) { + files.add(this.eleventyIgnoreContent); + } + + // Make sure output dir isn’t in the input dir (or it will ignore all input!) + // input: . and output: . (skip ignore) + // input: ./content and output . (skip ignore) + // input: . and output: ./_site (add ignore) + let outputContainsInputDir = DirContains(this.outputDir, this.inputDir); + if (!outputContainsInputDir) { + // both are already normalized in 3.0 + files.add(TemplateGlob.map(this.outputDir + "/**")); + } + + return Array.from(files); + } + + getIgnoreFiles() { + let ignoreFiles = new Set(); + let rootDirectory = this.localPathRoot || "."; + + if (this.config.useGitIgnore) { + ignoreFiles.add(TemplatePath.join(rootDirectory, ".gitignore")); + } + + if (this.eleventyIgnoreContent === false) { + let absoluteInputDir = TemplatePath.absolutePath(this.inputDir); + ignoreFiles.add(TemplatePath.join(rootDirectory, ".eleventyignore")); + + if (rootDirectory !== absoluteInputDir) { + ignoreFiles.add(TemplatePath.join(this.inputDir, ".eleventyignore")); + } + } + + return Array.from(ignoreFiles); + } + + /* Backwards compat */ + getIncludesDir() { + return this.includesDir; + } + + /* Backwards compat */ + getLayoutsDir() { + return this.layoutsDir; + } + + getFileGlobs() { + return this.normalizedTemplateGlobs; + } + + getRawFiles() { + return this.templateGlobs; + } + + async getWatchPathCache() { + // Issue #1325: make sure passthrough copy files are not included here + if (!this.pathCache) { + throw new Error("Watching requires `.getFiles()` to be called first in EleventyFiles"); + } + + let ret = []; + // Filter out the passthrough copy paths. + for (let path of this.pathCache) { + if ( + this.extensionMap.isFullTemplateFilePath(path) && + (await this.extensionMap.shouldSpiderJavaScriptDependencies(path)) + ) { + ret.push(path); + } + } + return ret; + } + + _globSearch() { + let globs = this.getFileGlobs(); + + // returns a promise + debug("Searching for: %o", globs); + return this.fileSystemSearch.search("templates", globs, { + ignore: this.uniqueIgnores, + }); + } + + getPathsWithVirtualTemplates(paths) { + // Support for virtual templates added in 3.0 + if (this.config.virtualTemplates && isPlainObject(this.config.virtualTemplates)) { + let virtualTemplates = Object.keys(this.config.virtualTemplates) + .filter((path) => { + // Filter out includes/layouts + return this.dirs.isTemplateFile(path); + }) + .map((path) => { + let fullVirtualPath = this.dirs.getInputPath(path); + if (!this.extensionMap.getKey(fullVirtualPath)) { + this.templateConfig.logger.warn( + `The virtual template at ${fullVirtualPath} is using a template format that’s not valid for your project. Your project is using: "${this.formats}". Read more about formats: https://v3.11ty.dev/docs/config/#template-formats`, + ); + } + return fullVirtualPath; + }); + + paths = paths.concat(virtualTemplates); + + // Virtual templates can not live at the same place as files on the file system! + if (paths.length !== new Set(paths).size) { + let conflicts = {}; + for (let path of paths) { + if (conflicts[path]) { + throw new Error( + `A virtual template had the same path as a file on the file system: "${path}"`, + ); + } + + conflicts[path] = true; + } + } + } + + return paths; + } + + async getFiles() { + let bench = this.aggregateBench.get("Searching the file system (templates)"); + bench.before(); + let globResults = await this._globSearch(); + let paths = TemplatePath.addLeadingDotSlashArray(globResults); + bench.after(); + + // Note 2.0.0-canary.19 removed a `filter` option for custom template syntax here that was unpublished and unused. + + paths = this.getPathsWithVirtualTemplates(paths); + + this.pathCache = paths; + return paths; + } + + getFileShape(paths, filePath) { + if (!filePath) { + return; + } + if (this.isPassthroughCopyFile(paths, filePath)) { + return "copy"; + } + if (this.isFullTemplateFile(paths, filePath)) { + return "template"; + } + // include/layout/unknown + } + + isPassthroughCopyFile(paths, filePath) { + return this.passthroughManager.isPassthroughCopyFile(paths, filePath); + } + + // Assumption here that filePath is not a passthrough copy file + isFullTemplateFile(paths, filePath) { + if (!filePath) { + return false; + } + + for (let path of paths) { + if (path === filePath) { + return true; + } + } + + return false; + } + + /* For `eleventy --watch` */ + getGlobWatcherFiles() { + // TODO improvement: tie the includes and data to specific file extensions (currently using `**`) + let directoryGlobs = this.getIncludesAndDataDirs(); + + let globs = this.#getWatcherGlobs(); + + if (checkPassthroughCopyBehavior(this.config, this.runMode)) { + return globs.concat(directoryGlobs); + } + + // Revert to old passthroughcopy copy files behavior + return globs.concat(this.passthroughGlobs).concat(directoryGlobs); + } + + /* For `eleventy --watch` */ + getGlobWatcherFilesForPassthroughCopy() { + return this.passthroughGlobs; + } + + /* For `eleventy --watch` */ + async getGlobWatcherTemplateDataFiles() { + let templateData = this.templateData; + return await templateData.getTemplateDataFileGlob(); + } + + /* For `eleventy --watch` */ + // TODO this isn’t great but reduces complexity avoiding using TemplateData:getLocalDataPaths for each template in the cache + async getWatcherTemplateJavaScriptDataFiles() { + let globs = this.templateData.getTemplateJavaScriptDataFileGlob(); + let bench = this.aggregateBench.get("Searching the file system (watching)"); + bench.before(); + let results = TemplatePath.addLeadingDotSlashArray( + await this.fileSystemSearch.search("js-dependencies", globs, { + ignore: [ + "**/node_modules/**", + ".git/**", + // TODO outputDir + // this.outputDir, + ], + }), + ); + bench.after(); + return results; + } + + /* Ignored by `eleventy --watch` */ + getGlobWatcherIgnores() { + // convert to format without ! since they are passed in as a separate argument to glob watcher + let entries = new Set( + this.fileIgnores.map((ignore) => TemplatePath.stripLeadingDotSlash(ignore)), + ); + + for (let ignore of this.config.watchIgnores) { + entries.add(this.normalizeIgnoreEntry(ignore)); + } + + // de-duplicated + return Array.from(entries); + } + + getIncludesAndDataDirs() { + let rawPaths = new Set(); + rawPaths.add(this.includesDir); + if (this.layoutsDir) { + rawPaths.add(this.layoutsDir); + } + rawPaths.add(this.dataDir); + + return Array.from(rawPaths) + .filter((entry) => { + // never ignore the input directory (even if config file returns "" for these) + return entry && entry !== this.inputDir; + }) + .map((entry) => { + return TemplateGlob.map(entry + "**"); + }); + } +} + +export default EleventyFiles; diff --git a/node_modules/@11ty/eleventy/src/EleventyServe.js b/node_modules/@11ty/eleventy/src/EleventyServe.js new file mode 100644 index 00000000..65525ef7 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/EleventyServe.js @@ -0,0 +1,321 @@ +import assert from "node:assert"; + +import debugUtil from "debug"; +import { Merge, DeepCopy, TemplatePath } from "@11ty/eleventy-utils"; + +import EleventyBaseError from "./Errors/EleventyBaseError.js"; +import ConsoleLogger from "./Util/ConsoleLogger.js"; +import PathPrefixer from "./Util/PathPrefixer.js"; +import checkPassthroughCopyBehavior from "./Util/PassthroughCopyBehaviorCheck.js"; +import { getModulePackageJson } from "./Util/ImportJsonSync.js"; +import { EleventyImport } from "./Util/Require.js"; +import { isGlobMatch } from "./Util/GlobMatcher.js"; + +const debug = debugUtil("Eleventy:EleventyServe"); + +class EleventyServeConfigError extends EleventyBaseError {} + +const DEFAULT_SERVER_OPTIONS = { + module: "@11ty/eleventy-dev-server", + port: 8080, + // pathPrefix: "/", + // setup: function() {}, + // ready: function(server) {}, + // logger: { info: function() {}, error: function() {} } +}; + +class EleventyServe { + #eleventyConfig; + + constructor() { + this.logger = new ConsoleLogger(); + this._initOptionsFetched = false; + this._aliases = undefined; + this._watchedFiles = new Set(); + } + + get config() { + if (!this.eleventyConfig) { + throw new EleventyServeConfigError( + "You need to set the eleventyConfig property on EleventyServe.", + ); + } + + return this.eleventyConfig.getConfig(); + } + + set config(config) { + throw new Error("It’s not allowed to set config on EleventyServe. Set eleventyConfig instead."); + } + + setAliases(aliases) { + this._aliases = aliases; + + if (this._server && "setAliases" in this._server) { + this._server.setAliases(aliases); + } + } + + get eleventyConfig() { + if (!this.#eleventyConfig) { + throw new EleventyServeConfigError( + "You need to set the eleventyConfig property on EleventyServe.", + ); + } + + return this.#eleventyConfig; + } + + set eleventyConfig(config) { + this.#eleventyConfig = config; + + if (checkPassthroughCopyBehavior(this.#eleventyConfig.userConfig, "serve")) { + this.#eleventyConfig.userConfig.events.on("eleventy.passthrough", ({ map }) => { + // for-free passthrough copy + this.setAliases(map); + }); + } + } + + // TODO directorynorm + setOutputDir(outputDir) { + // TODO check if this is different and if so, restart server (if already running) + // This applies if you change the output directory in your config file during watch/serve + this.outputDir = outputDir; + } + + async getServerModule(name) { + try { + if (!name || name === DEFAULT_SERVER_OPTIONS.module) { + return import("@11ty/eleventy-dev-server").then((i) => i.default); + } + + // Look for peer dep in local project + let projectNodeModulesPath = TemplatePath.absolutePath("./node_modules/"); + let serverPath = TemplatePath.absolutePath(projectNodeModulesPath, name); + // No references outside of the project node_modules are allowed + if (!serverPath.startsWith(projectNodeModulesPath)) { + throw new Error("Invalid node_modules name for Eleventy server instance, received:" + name); + } + + let serverPackageJson = getModulePackageJson(serverPath); + // Normalize with `main` entry from + if (TemplatePath.isDirectorySync(serverPath)) { + if (serverPackageJson.main) { + serverPath = TemplatePath.absolutePath( + projectNodeModulesPath, + name, + serverPackageJson.main, + ); + } else { + throw new Error( + `Eleventy server ${name} is missing a \`main\` entry in its package.json file. Traversed up from ${serverPath}.`, + ); + } + } + + let module = await EleventyImport(serverPath); + + if (!("getServer" in module)) { + throw new Error( + `Eleventy server module requires a \`getServer\` static method. Could not find one on module: \`${name}\``, + ); + } + + if (serverPackageJson["11ty"]?.compatibility) { + try { + this.eleventyConfig.userConfig.versionCheck(serverPackageJson["11ty"].compatibility); + } catch (e) { + this.logger.warn(`Warning: \`${name}\` Plugin Compatibility: ${e.message}`); + } + } + + return module; + } catch (e) { + this.logger.error( + "There was an error with your custom Eleventy server. We’re using the default server instead.\n" + + e.message, + ); + debug("Eleventy server error %o", e); + return import("@11ty/eleventy-dev-server").then((i) => i.default); + } + } + + get options() { + if (this._options) { + return this._options; + } + + this._options = Object.assign( + { + pathPrefix: PathPrefixer.normalizePathPrefix(this.config.pathPrefix), + logger: this.logger, + }, + DEFAULT_SERVER_OPTIONS, + this.config.serverOptions, + ); + + this._savedConfigOptions = DeepCopy({}, this.config.serverOptions); + + if (!this._initOptionsFetched && this.getSetupCallback()) { + throw new Error( + "Init options have not yet been fetched in the setup callback. This probably means that `init()` has not yet been called.", + ); + } + + return this._options; + } + + get server() { + if (!this._server) { + throw new Error("Missing server instance. Did you call .initServerInstance?"); + } + + return this._server; + } + + async initServerInstance() { + if (this._server) { + return; + } + + let serverModule = await this.getServerModule(this.options.module); + + // Static method `getServer` was already checked in `getServerModule` + this._server = serverModule.getServer("eleventy-server", this.outputDir, this.options); + + this.setAliases(this._aliases); + + if (this._globsNeedWatching) { + this._server.watchFiles(this._watchedFiles); + this._globsNeedWatching = false; + } + } + + getSetupCallback() { + let setupCallback = this.config.serverOptions.setup; + if (setupCallback && typeof setupCallback === "function") { + return setupCallback; + } + } + + async #init() { + let setupCallback = this.getSetupCallback(); + if (setupCallback) { + let opts = await setupCallback(); + this._initOptionsFetched = true; + + if (opts) { + Merge(this.options, opts); + } + } + } + + async init() { + if (!this._initPromise) { + this._initPromise = this.#init(); + } + + return this._initPromise; + } + + // Port comes in here from --port on the command line + async serve(port) { + this._commandLinePort = port; + + await this.init(); + await this.initServerInstance(); + + this.server.serve(port || this.options.port); + + if (typeof this.config.serverOptions?.ready === "function") { + if (typeof this.server.ready === "function") { + // Dev Server 2.0.7+ + // wait for ready promise to resolve before triggering ready callback + await this.server.ready(); + await this.config.serverOptions?.ready(this.server); + } else { + throw new Error( + "The `ready` option in Eleventy’s `setServerOptions` method requires a `ready` function on the Dev Server instance. If you’re using Eleventy Dev Server, you will need Dev Server 2.0.7+ or newer to use this feature.", + ); + } + } + } + + async close() { + if (this._server) { + await this._server.close(); + + this._server = undefined; + } + } + + async sendError({ error }) { + if (this._server) { + await this.server.sendError({ + error, + }); + } + } + + // Restart the server entirely + // We don’t want to use a native `restart` method (e.g. restart() in Vite) so that + // we can correctly handle a `module` property change (changing the server type) + async restart() { + // Blow away cached options + delete this._options; + + await this.close(); + + // saved --port in `serve()` + await this.serve(this._commandLinePort); + + // rewatch the saved watched files (passthrough copy) + if ("watchFiles" in this.server) { + this.server.watchFiles(this._watchedFiles); + } + } + + // checkPassthroughCopyBehavior check is called upstream in Eleventy.js + // TODO globs are not removed from watcher + watchPassthroughCopy(globs) { + this._watchedFiles = globs; + + if (this._server && "watchFiles" in this.server) { + this.server.watchFiles(globs); + this._globsNeedWatching = false; + } else { + this._globsNeedWatching = true; + } + } + + isEmulatedPassthroughCopyMatch(filepath) { + return isGlobMatch(filepath, this._watchedFiles); + } + + hasOptionsChanged() { + try { + assert.deepStrictEqual(this.config.serverOptions, this._savedConfigOptions); + return false; + } catch (e) { + return true; + } + } + + // Live reload the server + async reload(reloadEvent = {}) { + if (!this._server) { + return; + } + + // Restart the server if the options have changed + if (this.hasOptionsChanged()) { + debug("Server options changed, we’re restarting the server"); + await this.restart(); + } else { + await this.server.reload(reloadEvent); + } + } +} + +export default EleventyServe; diff --git a/node_modules/@11ty/eleventy/src/EleventyWatch.js b/node_modules/@11ty/eleventy/src/EleventyWatch.js new file mode 100644 index 00000000..22dffbec --- /dev/null +++ b/node_modules/@11ty/eleventy/src/EleventyWatch.js @@ -0,0 +1,131 @@ +import { TemplatePath } from "@11ty/eleventy-utils"; + +import PathNormalizer from "./Util/PathNormalizer.js"; + +/* Decides when to watch and in what mode to watch + * Incremental builds don’t batch changes, they queue. + * Nonincremental builds batch. + */ + +class EleventyWatch { + constructor() { + this.incremental = false; + this.isActive = false; + this.activeQueue = []; + } + + isBuildRunning() { + return this.isActive; + } + + setBuildRunning() { + this.isActive = true; + + // pop waiting queue into the active queue + this.activeQueue = this.popNextActiveQueue(); + } + + setBuildFinished() { + this.isActive = false; + this.activeQueue = []; + } + + getIncrementalFile() { + if (this.incremental) { + return this.activeQueue.length ? this.activeQueue[0] : false; + } + + return false; + } + + /* Returns the changed files currently being operated on in the current `watch` build + * Works with or without incremental (though in incremental only one file per time will be processed) + */ + getActiveQueue() { + if (!this.isActive) { + return []; + } else if (this.incremental && this.activeQueue.length === 0) { + return []; + } else if (this.incremental) { + return [this.activeQueue[0]]; + } + + return this.activeQueue; + } + + _queueMatches(file) { + let filterCallback; + if (typeof file === "function") { + filterCallback = file; + } else { + filterCallback = (path) => path === file; + } + + return this.activeQueue.filter(filterCallback); + } + + hasAllQueueFiles(file) { + return ( + this.activeQueue.length > 0 && this.activeQueue.length === this._queueMatches(file).length + ); + } + + hasQueuedFile(file) { + if (file) { + return this._queueMatches(file).length > 0; + } + return false; + } + + hasQueuedFiles(files) { + for (const file of files) { + if (this.hasQueuedFile(file)) { + return true; + } + } + return false; + } + + get pendingQueue() { + if (!this._queue) { + this._queue = []; + } + return this._queue; + } + + set pendingQueue(value) { + this._queue = value; + } + + addToPendingQueue(path) { + if (path) { + path = PathNormalizer.normalizeSeperator(TemplatePath.addLeadingDotSlash(path)); + this.pendingQueue.push(path); + } + } + + getPendingQueueSize() { + return this.pendingQueue.length; + } + + getPendingQueue() { + return this.pendingQueue; + } + + getActiveQueueSize() { + return this.activeQueue.length; + } + + // returns array + popNextActiveQueue() { + if (this.incremental) { + return this.pendingQueue.length ? [this.pendingQueue.shift()] : []; + } + + let ret = this.pendingQueue.slice(); + this.pendingQueue = []; + return ret; + } +} + +export default EleventyWatch; diff --git a/node_modules/@11ty/eleventy/src/EleventyWatchTargets.js b/node_modules/@11ty/eleventy/src/EleventyWatchTargets.js new file mode 100644 index 00000000..aec20369 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/EleventyWatchTargets.js @@ -0,0 +1,164 @@ +import { TemplatePath } from "@11ty/eleventy-utils"; +import { DepGraph } from "dependency-graph"; + +import JavaScriptDependencies from "./Util/JavaScriptDependencies.js"; +import eventBus from "./EventBus.js"; + +class EleventyWatchTargets { + #templateConfig; + + constructor(templateConfig) { + this.targets = new Set(); + this.dependencies = new Set(); + this.newTargets = new Set(); + this.isEsm = false; + + this.graph = new DepGraph(); + this.#templateConfig = templateConfig; + } + + setProjectUsingEsm(isEsmProject) { + this.isEsm = !!isEsmProject; + } + + isJavaScriptDependency(path) { + return this.dependencies.has(path); + } + + reset() { + this.newTargets = new Set(); + } + + isWatched(target) { + return this.targets.has(target); + } + + addToDependencyGraph(parent, deps) { + if (!this.graph.hasNode(parent)) { + this.graph.addNode(parent); + } + for (let dep of deps) { + if (!this.graph.hasNode(dep)) { + this.graph.addNode(dep); + } + this.graph.addDependency(parent, dep); + } + } + + uses(parent, dep) { + return this.getDependenciesOf(parent).includes(dep); + } + + getDependenciesOf(parent) { + if (!this.graph.hasNode(parent)) { + return []; + } + return this.graph.dependenciesOf(parent); + } + + getDependantsOf(child) { + if (!this.graph.hasNode(child)) { + return []; + } + return this.graph.dependantsOf(child); + } + + addRaw(targets, isDependency) { + for (let target of targets) { + let path = TemplatePath.addLeadingDotSlash(target); + if (!this.isWatched(path)) { + this.newTargets.add(path); + } + + this.targets.add(path); + + if (isDependency) { + this.dependencies.add(path); + } + } + } + + static normalize(targets) { + if (!targets) { + return []; + } else if (Array.isArray(targets)) { + return targets; + } + + return [targets]; + } + + // add only a target + add(targets) { + this.addRaw(EleventyWatchTargets.normalize(targets)); + } + + static normalizeToGlobs(targets) { + return EleventyWatchTargets.normalize(targets).map((entry) => + TemplatePath.convertToRecursiveGlobSync(entry), + ); + } + + addAndMakeGlob(targets) { + this.addRaw(EleventyWatchTargets.normalizeToGlobs(targets)); + } + + // add only a target’s dependencies + async addDependencies(targets, filterCallback) { + if (this.#templateConfig && !this.#templateConfig.shouldSpiderJavaScriptDependencies()) { + return; + } + + targets = EleventyWatchTargets.normalize(targets); + let deps = await JavaScriptDependencies.getDependencies(targets, this.isEsm); + if (filterCallback) { + deps = deps.filter(filterCallback); + } + + for (let target of targets) { + this.addToDependencyGraph(target, deps); + } + this.addRaw(deps, true); + } + + setWriter(templateWriter) { + this.writer = templateWriter; + } + + clearImportCacheFor(filePathArray) { + let paths = new Set(); + for (const filePath of filePathArray) { + paths.add(filePath); + + // Delete from require cache so that updates to the module are re-required + let importsTheChangedFile = this.getDependantsOf(filePath); + for (let dep of importsTheChangedFile) { + paths.add(dep); + } + + let isImportedInTheChangedFile = this.getDependenciesOf(filePath); + for (let dep of isImportedInTheChangedFile) { + paths.add(dep); + } + + // Use GlobalDependencyMap + if (this.#templateConfig) { + for (let dep of this.#templateConfig.usesGraph.getDependantsFor(filePath)) { + paths.add(dep); + } + } + } + + eventBus.emit("eleventy.importCacheReset", paths); + } + + getNewTargetsSinceLastReset() { + return Array.from(this.newTargets); + } + + getTargets() { + return Array.from(this.targets); + } +} + +export default EleventyWatchTargets; diff --git a/node_modules/@11ty/eleventy/src/Engines/Custom.js b/node_modules/@11ty/eleventy/src/Engines/Custom.js new file mode 100644 index 00000000..17a0da14 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Engines/Custom.js @@ -0,0 +1,339 @@ +import TemplateEngine from "./TemplateEngine.js"; +import getJavaScriptData from "../Util/GetJavaScriptData.js"; + +export default class CustomEngine extends TemplateEngine { + constructor(name, eleventyConfig) { + super(name, eleventyConfig); + + this.entry = this.getExtensionMapEntry(); + this.needsInit = "init" in this.entry && typeof this.entry.init === "function"; + + this.setDefaultEngine(undefined); + } + + getExtensionMapEntry() { + if ("extensionMap" in this.config) { + let name = this.name.toLowerCase(); + // Iterates over only the user config `addExtension` entries + for (let entry of this.config.extensionMap) { + let entryKey = (entry.aliasKey || entry.key || "").toLowerCase(); + if (entryKey === name) { + return entry; + } + } + } + + throw Error( + `Could not find a custom extension for ${this.name}. Did you add it to your config file?`, + ); + } + + setDefaultEngine(defaultEngine) { + this._defaultEngine = defaultEngine; + } + + get cacheable() { + // Enable cacheability for this template + if (this.entry?.compileOptions?.cache !== undefined) { + return this.entry.compileOptions.cache; + } else if (this.needsToReadFileContents()) { + return true; + } else if (this._defaultEngine?.cacheable !== undefined) { + return this._defaultEngine.cacheable; + } + + return super.cacheable; + } + + async getInstanceFromInputPath(inputPath) { + if ( + "getInstanceFromInputPath" in this.entry && + typeof this.entry.getInstanceFromInputPath === "function" + ) { + // returns Promise + return this.entry.getInstanceFromInputPath(inputPath); + } + + // aliased upstream type + if ( + this._defaultEngine && + "getInstanceFromInputPath" in this._defaultEngine && + typeof this._defaultEngine.getInstanceFromInputPath === "function" + ) { + // returns Promise + return this._defaultEngine.getInstanceFromInputPath(inputPath); + } + + return false; + } + + /** + * Whether to use the module loader directly + * + * @override + */ + useJavaScriptImport() { + if ("useJavaScriptImport" in this.entry) { + return this.entry.useJavaScriptImport; + } + + if ( + this._defaultEngine && + "useJavaScriptImport" in this._defaultEngine && + typeof this._defaultEngine.useJavaScriptImport === "function" + ) { + return this._defaultEngine.useJavaScriptImport(); + } + + return false; + } + + /** + * @override + */ + needsToReadFileContents() { + if ("read" in this.entry) { + return this.entry.read; + } + + // Handle aliases to `11ty.js` templates, avoid reading files in the alias, see #2279 + // Here, we are short circuiting fallback to defaultRenderer, does not account for compile + // functions that call defaultRenderer explicitly + if (this._defaultEngine && "needsToReadFileContents" in this._defaultEngine) { + return this._defaultEngine.needsToReadFileContents(); + } + + return true; + } + + // If we init from multiple places, wait for the first init to finish before continuing on. + async _runningInit() { + if (this.needsInit) { + if (!this._initing) { + this._initBench = this.benchmarks.aggregate.get(`Engine (${this.name}) Init`); + this._initBench.before(); + this._initing = this.entry.init.bind({ + config: this.config, + bench: this.benchmarks.aggregate, + })(); + } + await this._initing; + this.needsInit = false; + + if (this._initBench) { + this._initBench.after(); + this._initBench = undefined; + } + } + } + + async getExtraDataFromFile(inputPath) { + if (this.entry.getData === false) { + return; + } + + if (!("getData" in this.entry)) { + // Handle aliases to `11ty.js` templates, use upstream default engine data fetch, see #2279 + if (this._defaultEngine && "getExtraDataFromFile" in this._defaultEngine) { + return this._defaultEngine.getExtraDataFromFile(inputPath); + } + + return; + } + + await this._runningInit(); + + if (typeof this.entry.getData === "function") { + let dataBench = this.benchmarks.aggregate.get( + `Engine (${this.name}) Get Data From File (Function)`, + ); + dataBench.before(); + let data = this.entry.getData(inputPath); + dataBench.after(); + return data; + } + + let keys = new Set(); + if (this.entry.getData === true) { + keys.add("data"); + } else if (Array.isArray(this.entry.getData)) { + for (let key of this.entry.getData) { + keys.add(key); + } + } + + let dataBench = this.benchmarks.aggregate.get(`Engine (${this.name}) Get Data From File`); + dataBench.before(); + + let inst = await this.getInstanceFromInputPath(inputPath); + + if (inst === false) { + dataBench.after(); + + return Promise.reject( + new Error( + `\`getInstanceFromInputPath\` callback missing from '${this.name}' template engine plugin. It is required when \`getData\` is in use. You can set \`getData: false\` to opt-out of this.`, + ), + ); + } + + // override keys set at the plugin level in the individual template + if (inst.eleventyDataKey) { + keys = new Set(inst.eleventyDataKey); + } + + let mixins; + if (this.config) { + // Object.assign usage: see TemplateRenderCustomTest.js: `JavaScript functions should not be mutable but not *that* mutable` + mixins = Object.assign({}, this.config.javascriptFunctions); + } + + let promises = []; + for (let key of keys) { + promises.push( + getJavaScriptData(inst, inputPath, key, { + mixins, + isObjectRequired: key === "data", + }), + ); + } + + let results = await Promise.all(promises); + let data = {}; + for (let result of results) { + Object.assign(data, result); + } + dataBench.after(); + + return data; + } + + async compile(str, inputPath, ...args) { + await this._runningInit(); + let defaultCompilationFn; + if (this._defaultEngine) { + defaultCompilationFn = async (data) => { + const renderFn = await this._defaultEngine.compile(str, inputPath, ...args); + return renderFn(data); + }; + } + + // Fall back to default compiler if the user does not provide their own + if (!this.entry.compile) { + if (defaultCompilationFn) { + return defaultCompilationFn; + } else { + throw new Error( + `Missing \`compile\` property for custom template syntax definition eleventyConfig.addExtension("${this.name}"). This is not necessary when aliasing to an existing template syntax.`, + ); + } + } + + // TODO generalize this (look at JavaScript.js) + let compiledFn = this.entry.compile.bind({ + config: this.config, + addDependencies: (from, toArray = []) => { + this.config.uses.addDependency(from, toArray); + }, + defaultRenderer: defaultCompilationFn, // bind defaultRenderer to compile function + })(str, inputPath); + + // Support `undefined` to skip compile/render + if (compiledFn) { + // Bind defaultRenderer to render function + if ("then" in compiledFn && typeof compiledFn.then === "function") { + // Promise, wait to bind + return compiledFn.then((fn) => { + if (typeof fn === "function") { + return fn.bind({ + defaultRenderer: defaultCompilationFn, + }); + } + return fn; + }); + } else if ("bind" in compiledFn && typeof compiledFn.bind === "function") { + return compiledFn.bind({ + defaultRenderer: defaultCompilationFn, + }); + } + } + + return compiledFn; + } + + get defaultTemplateFileExtension() { + return this.entry.outputFileExtension ?? "html"; + } + + // Whether or not to wrap in Eleventy layouts + useLayouts() { + // TODO future change fallback to `this.defaultTemplateFileExtension === "html"` + return this.entry.useLayouts ?? true; + } + + hasDependencies(inputPath) { + if (this.config.uses.getDependencies(inputPath) === false) { + return false; + } + return true; + } + + isFileRelevantTo(inputPath, comparisonFile, includeLayouts) { + return this.config.uses.isFileRelevantTo(inputPath, comparisonFile, includeLayouts); + } + + getCompileCacheKey(str, inputPath) { + let lastModifiedFile = this.eleventyConfig.getPreviousBuildModifiedFile(); + // Return this separately so we know whether or not to use the cached version + // but still return a key to cache this new render for next time + let isRelevant = this.isFileRelevantTo(inputPath, lastModifiedFile, false); + let useCache = !isRelevant; + + if (this.entry.compileOptions && "getCacheKey" in this.entry.compileOptions) { + if (typeof this.entry.compileOptions.getCacheKey !== "function") { + throw new Error( + `\`compileOptions.getCacheKey\` must be a function in addExtension for the ${this.name} type`, + ); + } + + return { + useCache, + key: this.entry.compileOptions.getCacheKey(str, inputPath), + }; + } + + let { key } = super.getCompileCacheKey(str, inputPath); + return { + useCache, + key, + }; + } + + permalinkNeedsCompilation(/*str*/) { + if (this.entry.compileOptions && "permalink" in this.entry.compileOptions) { + let p = this.entry.compileOptions.permalink; + if (p === "raw") { + return false; + } + + // permalink: false is aliased to permalink: () => false + if (p === false) { + return () => false; + } + + return this.entry.compileOptions.permalink; + } + + // Breaking: default changed from `true` to `false` in 3.0.0-alpha.13 + // Note: `false` is the same as "raw" here. + return false; + } + + static shouldSpiderJavaScriptDependencies(entry) { + if (entry.compileOptions && "spiderJavaScriptDependencies" in entry.compileOptions) { + return entry.compileOptions.spiderJavaScriptDependencies; + } + + return false; + } +} diff --git a/node_modules/@11ty/eleventy/src/Engines/FrontMatter/JavaScript.js b/node_modules/@11ty/eleventy/src/Engines/FrontMatter/JavaScript.js new file mode 100644 index 00000000..b91ba36b --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Engines/FrontMatter/JavaScript.js @@ -0,0 +1,34 @@ +import { RetrieveGlobals } from "node-retrieve-globals"; + +// `javascript` Front Matter Type +export default function (frontMatterCode, context = {}) { + let { filePath } = context; + + // context.language would be nice as a guard, but was unreliable + if (frontMatterCode.trimStart().startsWith("{")) { + return context.engines.jsLegacy.parse(frontMatterCode, context); + } + + let vm = new RetrieveGlobals(frontMatterCode, { + filePath, + // ignored if vm.Module is stable (or --experimental-vm-modules) + transformEsmImports: true, + }); + + // Future warning until vm.Module is stable: + // If the frontMatterCode uses `import` this uses the `experimentalModuleApi` + // option in node-retrieve-globals to workaround https://github.com/zachleat/node-retrieve-globals/issues/2 + let data = { + page: { + // Theoretically fileSlug and filePathStem could be added here but require extensionMap + inputPath: filePath, + }, + }; + + // this is async, but it’s handled in Eleventy upstream. + return vm.getGlobalContext(data, { + reuseGlobal: true, + dynamicImport: true, + // addRequire: true, + }); +} diff --git a/node_modules/@11ty/eleventy/src/Engines/Html.js b/node_modules/@11ty/eleventy/src/Engines/Html.js new file mode 100644 index 00000000..a0f41019 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Engines/Html.js @@ -0,0 +1,33 @@ +import TemplateEngine from "./TemplateEngine.js"; + +export default class Html extends TemplateEngine { + constructor(name, eleventyConfig) { + super(name, eleventyConfig); + } + + get cacheable() { + return true; + } + + async #getPreEngine(preTemplateEngine) { + return this.engineManager.getEngine(preTemplateEngine, this.extensionMap); + } + + async compile(str, inputPath, preTemplateEngine) { + if (preTemplateEngine) { + let engine = await this.#getPreEngine(preTemplateEngine); + let fnReady = engine.compile(str, inputPath); + + return async function (data) { + let fn = await fnReady; + + return fn(data); + }; + } + + return function () { + // do nothing with data if preTemplateEngine is falsy + return str; + }; + } +} diff --git a/node_modules/@11ty/eleventy/src/Engines/JavaScript.js b/node_modules/@11ty/eleventy/src/Engines/JavaScript.js new file mode 100644 index 00000000..29b3b7c5 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Engines/JavaScript.js @@ -0,0 +1,240 @@ +import { TemplatePath, isPlainObject } from "@11ty/eleventy-utils"; + +import TemplateEngine from "./TemplateEngine.js"; +import EleventyBaseError from "../Errors/EleventyBaseError.js"; +import getJavaScriptData from "../Util/GetJavaScriptData.js"; +import { EleventyImport } from "../Util/Require.js"; +import { augmentFunction, augmentObject } from "./Util/ContextAugmenter.js"; + +class JavaScriptTemplateNotDefined extends EleventyBaseError {} + +export default class JavaScript extends TemplateEngine { + constructor(name, templateConfig) { + super(name, templateConfig); + this.instances = {}; + + this.config.events.on("eleventy#templateModified", (inputPath, metadata = {}) => { + let { usedByDependants, relevantLayouts } = metadata; + // Remove from cached instances when modified + let instancesToDelete = [ + inputPath, + ...(usedByDependants || []), + ...(relevantLayouts || []), + ].map((entry) => TemplatePath.addLeadingDotSlash(entry)); + for (let inputPath of instancesToDelete) { + if (inputPath in this.instances) { + delete this.instances[inputPath]; + } + } + }); + } + + get cacheable() { + return false; + } + + normalize(result) { + if (Buffer.isBuffer(result)) { + return result.toString(); + } + + return result; + } + + // String, Buffer, Promise + // Function, Class + // Object + // Module + _getInstance(mod) { + let noop = function () { + return ""; + }; + + let originalModData = mod?.data; + + if (typeof mod === "object" && mod.default && this.eleventyConfig.getIsProjectUsingEsm()) { + mod = mod.default; + } + + if (typeof mod === "string" || mod instanceof Buffer || mod.then) { + return { render: () => mod }; + } else if (typeof mod === "function") { + if (mod.prototype?.data || mod.prototype?.render) { + if (!("render" in mod.prototype)) { + mod.prototype.render = noop; + } + + if (!("data" in mod.prototype) && !mod.data && originalModData) { + mod.prototype.data = originalModData; + } + + return new mod(); + } else { + return { + ...(originalModData ? { data: originalModData } : undefined), + render: mod, + }; + } + } else if ("data" in mod || "render" in mod) { + if (!mod.render) { + mod.render = noop; + } + if (!mod.data && originalModData) { + mod.data = originalModData; + } + return mod; + } + } + + async #getInstanceFromInputPath(inputPath) { + let mod; + let relativeInputPath = + this.eleventyConfig.directories.getInputPathRelativeToInputDirectory(inputPath); + if (this.eleventyConfig.userConfig.isVirtualTemplate(relativeInputPath)) { + mod = this.eleventyConfig.userConfig.virtualTemplates[relativeInputPath].content; + } else { + let isEsm = this.eleventyConfig.getIsProjectUsingEsm(); + let cacheBust = !this.cacheable || !this.config.useTemplateCache; + mod = await EleventyImport(inputPath, isEsm ? "esm" : "cjs", { + cacheBust, + }); + } + + let inst = this._getInstance(mod); + if (inst) { + this.instances[inputPath] = inst; + } else { + throw new JavaScriptTemplateNotDefined( + `No JavaScript template returned from ${inputPath}. Did you assign module.exports (CommonJS) or export (ESM)?`, + ); + } + return inst; + } + + async getInstanceFromInputPath(inputPath) { + if (!this.instances[inputPath]) { + this.instances[inputPath] = this.#getInstanceFromInputPath(inputPath); + } + + return this.instances[inputPath]; + } + + /** + * JavaScript files defer to the module loader rather than read the files to strings + * + * @override + */ + needsToReadFileContents() { + return false; + } + + /** + * Use the module loader directly + * + * @override + */ + useJavaScriptImport() { + return true; + } + + async getExtraDataFromFile(inputPath) { + let inst = await this.getInstanceFromInputPath(inputPath); + return getJavaScriptData(inst, inputPath); + } + + getJavaScriptFunctions(inst) { + let fns = {}; + let configFns = this.config.javascriptFunctions; + + for (let key in configFns) { + // prefer pre-existing `page` javascriptFunction, if one exists + fns[key] = augmentFunction(configFns[key], { + source: inst, + overwrite: false, + }); + } + return fns; + } + + // Backwards compat + static wrapJavaScriptFunction(inst, fn) { + return augmentFunction(fn, { + source: inst, + }); + } + + addExportsToBundles(inst, url) { + let cfg = this.eleventyConfig.userConfig; + if (!("getBundleManagers" in cfg)) { + return; + } + + let managers = cfg.getBundleManagers(); + for (let name in managers) { + let mgr = managers[name]; + let key = mgr.getBundleExportKey(); + if (!key) { + continue; + } + + if (typeof inst[key] === "string") { + // export const css = ``; + mgr.addToPage(url, inst[key]); + } else if (isPlainObject(inst[key])) { + if (typeof inst[key][name] === "string") { + // Object with bundle names: + // export const bundle = { + // css: `` + // }; + mgr.addToPage(url, inst[key][name]); + } else if (isPlainObject(inst[key][name])) { + // Object with bucket names: + // export const bundle = { + // css: { + // default: `` + // } + // }; + for (let bucketName in inst[key][name]) { + mgr.addToPage(url, inst[key][name][bucketName], bucketName); + } + } + } + } + } + + async compile(str, inputPath) { + let inst; + if (str) { + // When str has a value, it's being used for permalinks in data + inst = this._getInstance(str); + } else { + // For normal templates, str will be falsy. + inst = await this.getInstanceFromInputPath(inputPath); + } + + if (inst?.render) { + return (data = {}) => { + // TODO does this do anything meaningful for non-classes? + // `inst` should have a normalized `render` function from _getInstance + + // Map exports to bundles + if (data.page?.url) { + this.addExportsToBundles(inst, data.page.url); + } + + augmentObject(inst, { + source: data, + overwrite: false, + }); + + Object.assign(inst, this.getJavaScriptFunctions(inst)); + + return this.normalize(inst.render.call(inst, data)); + }; + } + } + + static shouldSpiderJavaScriptDependencies() { + return true; + } +} diff --git a/node_modules/@11ty/eleventy/src/Engines/Liquid.js b/node_modules/@11ty/eleventy/src/Engines/Liquid.js new file mode 100644 index 00000000..44fdab4c --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Engines/Liquid.js @@ -0,0 +1,331 @@ +import moo from "moo"; +import { Tokenizer, TokenKind, evalToken, Liquid as LiquidJs } from "liquidjs"; +import { TemplatePath } from "@11ty/eleventy-utils"; +// import debugUtil from "debug"; + +import TemplateEngine from "./TemplateEngine.js"; +import { augmentObject } from "./Util/ContextAugmenter.js"; + +// const debug = debugUtil("Eleventy:Liquid"); + +export default class Liquid extends TemplateEngine { + static argumentLexerOptions = { + number: /[0-9]+\.*[0-9]*/, + doubleQuoteString: /"(?:\\["\\]|[^\n"\\])*"/, + singleQuoteString: /'(?:\\['\\]|[^\n'\\])*'/, + keyword: /[a-zA-Z0-9.\-_]+/, + "ignore:whitespace": /[, \t]+/, // includes comma separator + }; + + constructor(name, eleventyConfig) { + super(name, eleventyConfig); + + this.liquidOptions = this.config.liquidOptions || {}; + + this.setLibrary(this.config.libraryOverrides.liquid); + + this.argLexer = moo.compile(Liquid.argumentLexerOptions); + } + + get cacheable() { + return true; + } + + setLibrary(override) { + // warning, the include syntax supported here does not exactly match what Jekyll uses. + this.liquidLib = override || new LiquidJs(this.getLiquidOptions()); + this.setEngineLib(this.liquidLib, Boolean(this.config.libraryOverrides.liquid)); + + this.addFilters(this.config.liquidFilters); + + // TODO these all go to the same place (addTag), add warnings for overwrites + this.addCustomTags(this.config.liquidTags); + this.addAllShortcodes(this.config.liquidShortcodes); + this.addAllPairedShortcodes(this.config.liquidPairedShortcodes); + } + + getLiquidOptions() { + let defaults = { + root: [this.dirs.includes, this.dirs.input], // supplemented in compile with inputPath below + extname: ".liquid", + strictFilters: true, + // TODO? + // cache: true, + }; + + let options = Object.assign(defaults, this.liquidOptions || {}); + // debug("Liquid constructor options: %o", options); + + return options; + } + + static wrapFilter(name, fn) { + /** + * @this {object} + */ + return function (...args) { + // Set this.eleventy and this.page + if (typeof this.context?.get === "function") { + augmentObject(this, { + source: this.context, + getter: (key, context) => context.get([key]), + + lazy: this.context.strictVariables, + }); + } + + // We *don’t* wrap this in an EleventyFilterError because Liquid has a better error message with line/column information in the template + return fn.call(this, ...args); + }; + } + + // Shortcodes + static normalizeScope(context) { + let obj = {}; + if (context) { + obj.ctx = context; // Full context available on `ctx` + + // Set this.eleventy and this.page + augmentObject(obj, { + source: context, + getter: (key, context) => context.get([key]), + lazy: context.strictVariables, + }); + } + + return obj; + } + + addCustomTags(tags) { + for (let name in tags) { + this.addTag(name, tags[name]); + } + } + + addFilters(filters) { + for (let name in filters) { + this.addFilter(name, filters[name]); + } + } + + addFilter(name, filter) { + this.liquidLib.registerFilter(name, Liquid.wrapFilter(name, filter)); + } + + addTag(name, tagFn) { + let tagObj; + if (typeof tagFn === "function") { + tagObj = tagFn(this.liquidLib); + } else { + throw new Error( + "Liquid.addTag expects a callback function to be passed in: addTag(name, function(liquidEngine) { return { parse: …, render: … } })", + ); + } + this.liquidLib.registerTag(name, tagObj); + } + + addAllShortcodes(shortcodes) { + for (let name in shortcodes) { + this.addShortcode(name, shortcodes[name]); + } + } + + addAllPairedShortcodes(shortcodes) { + for (let name in shortcodes) { + this.addPairedShortcode(name, shortcodes[name]); + } + } + + static parseArguments(lexer, str) { + let argArray = []; + + if (!lexer) { + lexer = moo.compile(Liquid.argumentLexerOptions); + } + + if (typeof str === "string") { + lexer.reset(str); + + let arg = lexer.next(); + while (arg) { + /*{ + type: 'doubleQuoteString', + value: '"test 2"', + text: '"test 2"', + toString: [Function: tokenToString], + offset: 0, + lineBreaks: 0, + line: 1, + col: 1 }*/ + if (arg.type.indexOf("ignore:") === -1) { + // Push the promise into an array instead of awaiting it here. + // This forces the promises to run in order with the correct scope value for each arg. + // Otherwise they run out of order and can lead to undefined values for arguments in layout template shortcodes. + // console.log( arg.value, scope, engine ); + argArray.push(arg.value); + } + arg = lexer.next(); + } + } + + return argArray; + } + + static parseArgumentsBuiltin(args) { + let tokenizer = new Tokenizer(args); + let parsedArgs = []; + + let value = tokenizer.readValue(); + while (value) { + parsedArgs.push(value); + tokenizer.skipBlank(); + if (tokenizer.peek() === ",") { + tokenizer.advance(); + } + value = tokenizer.readValue(); + } + tokenizer.end(); + + return parsedArgs; + } + + addShortcode(shortcodeName, shortcodeFn) { + let _t = this; + this.addTag(shortcodeName, function (liquidEngine) { + return { + parse(tagToken) { + this.name = tagToken.name; + if (_t.config.liquidParameterParsing === "builtin") { + this.orderedArgs = Liquid.parseArgumentsBuiltin(tagToken.args); + // note that Liquid does have a Hash class for name-based argument parsing but offers no easy to support both modes in one class + } else { + this.legacyArgs = tagToken.args; + } + }, + render: function* (ctx) { + let argArray = []; + + if (this.legacyArgs) { + let rawArgs = Liquid.parseArguments(_t.argLexer, this.legacyArgs); + for (let arg of rawArgs) { + let b = yield liquidEngine.evalValue(arg, ctx); + argArray.push(b); + } + } else if (this.orderedArgs) { + for (let arg of this.orderedArgs) { + let b = yield evalToken(arg, ctx); + argArray.push(b); + } + } + + let ret = yield shortcodeFn.call(Liquid.normalizeScope(ctx), ...argArray); + return ret; + }, + }; + }); + } + + addPairedShortcode(shortcodeName, shortcodeFn) { + let _t = this; + this.addTag(shortcodeName, function (liquidEngine) { + return { + parse(tagToken, remainTokens) { + this.name = tagToken.name; + + if (_t.config.liquidParameterParsing === "builtin") { + this.orderedArgs = Liquid.parseArgumentsBuiltin(tagToken.args); + // note that Liquid does have a Hash class for name-based argument parsing but offers no easy to support both modes in one class + } else { + this.legacyArgs = tagToken.args; + } + + this.templates = []; + + var stream = liquidEngine.parser + .parseStream(remainTokens) + .on("template", (tpl) => this.templates.push(tpl)) + .on("tag:end" + shortcodeName, () => stream.stop()) + .on("end", () => { + throw new Error(`tag ${tagToken.raw} not closed`); + }); + + stream.start(); + }, + render: function* (ctx /*, emitter*/) { + let argArray = []; + if (this.legacyArgs) { + let rawArgs = Liquid.parseArguments(_t.argLexer, this.legacyArgs); + for (let arg of rawArgs) { + let b = yield liquidEngine.evalValue(arg, ctx); + argArray.push(b); + } + } else if (this.orderedArgs) { + for (let arg of this.orderedArgs) { + let b = yield evalToken(arg, ctx); + argArray.push(b); + } + } + + const html = yield liquidEngine.renderer.renderTemplates(this.templates, ctx); + + let ret = yield shortcodeFn.call(Liquid.normalizeScope(ctx), html, ...argArray); + + return ret; + }, + }; + }); + } + + parseForSymbols(str) { + if (!str) { + return []; + } + + let tokenizer = new Tokenizer(str); + /** @type {Array} */ + let tokens = tokenizer.readTopLevelTokens(); + let symbols = tokens + .filter((token) => token.kind === TokenKind.Output) + .map((token) => { + // manually remove filters 😅 + return token.content.split("|").map((entry) => entry.trim())[0]; + }); + return symbols; + } + + // Don’t return a boolean if permalink is a function (see TemplateContent->renderPermalink) + /** @returns {boolean|undefined} */ + permalinkNeedsCompilation(str) { + if (typeof str === "string") { + return this.needsCompilation(str); + } + } + + needsCompilation(str) { + let options = this.liquidLib.options; + + return ( + str.indexOf(options.tagDelimiterLeft) !== -1 || + str.indexOf(options.outputDelimiterLeft) !== -1 + ); + } + + async compile(str, inputPath) { + let engine = this.liquidLib; + let tmplReady = engine.parse(str, inputPath); + + // Required for relative includes + let options = {}; + if (!inputPath || inputPath === "liquid" || inputPath === "md") { + // do nothing + } else { + options.root = [TemplatePath.getDirFromFilePath(inputPath)]; + } + + return async function (data) { + let tmpl = await tmplReady; + + return engine.render(tmpl, data, options); + }; + } +} diff --git a/node_modules/@11ty/eleventy/src/Engines/Markdown.js b/node_modules/@11ty/eleventy/src/Engines/Markdown.js new file mode 100644 index 00000000..ec1e1f6f --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Engines/Markdown.js @@ -0,0 +1,100 @@ +import markdownIt from "markdown-it"; + +import TemplateEngine from "./TemplateEngine.js"; + +export default class Markdown extends TemplateEngine { + constructor(name, eleventyConfig) { + super(name, eleventyConfig); + + this.markdownOptions = {}; + + this.setLibrary(this.config.libraryOverrides.md); + } + + get cacheable() { + return true; + } + + setLibrary(mdLib) { + this.mdLib = mdLib || markdownIt(this.getMarkdownOptions()); + + // Overrides a highlighter set in `markdownOptions` + // This is separate so devs can pass in a new mdLib and still use the official eleventy plugin for markdown highlighting + if (this.config.markdownHighlighter && typeof this.mdLib.set === "function") { + this.mdLib.set({ + highlight: this.config.markdownHighlighter, + }); + } + + if (typeof this.mdLib.disable === "function") { + // Disable indented code blocks by default (Issue #2438) + this.mdLib.disable("code"); + } + + this.setEngineLib(this.mdLib, Boolean(this.config.libraryOverrides.md)); + } + + setMarkdownOptions(options) { + this.markdownOptions = options; + } + + getMarkdownOptions() { + // work with "mode" presets https://github.com/markdown-it/markdown-it#init-with-presets-and-options + if (typeof this.markdownOptions === "string") { + return this.markdownOptions; + } + + return Object.assign( + { + html: true, + }, + this.markdownOptions || {}, + ); + } + + // TODO use preTemplateEngine to help inform this + // needsCompilation() { + // return super.needsCompilation(); + // } + + async #getPreEngine(preTemplateEngine) { + if (typeof preTemplateEngine === "string") { + return this.engineManager.getEngine(preTemplateEngine, this.extensionMap); + } + + return preTemplateEngine; + } + + async compile(str, inputPath, preTemplateEngine, bypassMarkdown) { + let mdlib = this.mdLib; + + if (preTemplateEngine) { + let engine = await this.#getPreEngine(preTemplateEngine); + let fnReady = engine.compile(str, inputPath); + + if (bypassMarkdown) { + return async function (data) { + let fn = await fnReady; + return fn(data); + }; + } else { + return async function (data) { + let fn = await fnReady; + let preTemplateEngineRender = await fn(data); + let finishedRender = mdlib.render(preTemplateEngineRender, data); + return finishedRender; + }; + } + } else { + if (bypassMarkdown) { + return function () { + return str; + }; + } else { + return function (data) { + return mdlib.render(str, data); + }; + } + } + } +} diff --git a/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js b/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js new file mode 100644 index 00000000..70cca174 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js @@ -0,0 +1,482 @@ +import NunjucksLib from "nunjucks"; +import debugUtil from "debug"; +import { TemplatePath } from "@11ty/eleventy-utils"; + +import TemplateEngine from "./TemplateEngine.js"; +import EleventyBaseError from "../Errors/EleventyBaseError.js"; +import { augmentObject } from "./Util/ContextAugmenter.js"; +import { withResolvers } from "../Util/PromiseUtil.js"; + +const debug = debugUtil("Eleventy:Nunjucks"); + +class EleventyNunjucksError extends EleventyBaseError {} + +export default class Nunjucks extends TemplateEngine { + constructor(name, eleventyConfig) { + super(name, eleventyConfig); + + this.nunjucksEnvironmentOptions = this.config.nunjucksEnvironmentOptions || { dev: true }; + + this.nunjucksPrecompiledTemplates = this.config.nunjucksPrecompiledTemplates || {}; + this._usingPrecompiled = Object.keys(this.nunjucksPrecompiledTemplates).length > 0; + + this.setLibrary(this.config.libraryOverrides.njk); + } + + // v3.1.0-alpha.1 we’ve moved to use Nunjucks’ internal cache instead of Eleventy’s + // get cacheable() { + // return false; + // } + + #getFileSystemDirs() { + let paths = new Set(); + paths.add(super.getIncludesDir()); + paths.add(TemplatePath.getWorkingDir()); + + // Filter out undefined paths + return Array.from(paths).filter(Boolean); + } + + #setEnv(override) { + if (override) { + this.njkEnv = override; + } else if (this._usingPrecompiled) { + // Precompiled templates to avoid eval! + const NodePrecompiledLoader = function () {}; + + NodePrecompiledLoader.prototype.getSource = (name) => { + // https://github.com/mozilla/nunjucks/blob/fd500902d7c88672470c87170796de52fc0f791a/nunjucks/src/precompiled-loader.js#L5 + return { + src: { + type: "code", + obj: this.nunjucksPrecompiledTemplates[name], + }, + // Maybe add this? + // path, + // noCache: true + }; + }; + + this.njkEnv = new NunjucksLib.Environment( + new NodePrecompiledLoader(), + this.nunjucksEnvironmentOptions, + ); + } else { + let fsLoader = new NunjucksLib.FileSystemLoader(this.#getFileSystemDirs()); + this.njkEnv = new NunjucksLib.Environment(fsLoader, this.nunjucksEnvironmentOptions); + } + + this.config.events.emit("eleventy.engine.njk", { + nunjucks: NunjucksLib, + environment: this.njkEnv, + }); + } + + setLibrary(override) { + this.#setEnv(override); + + // Note that a new Nunjucks engine instance is created for subsequent builds + // Eleventy Nunjucks is set to `cacheable` false above to opt out of Eleventy cache + this.config.events.on("eleventy#templateModified", (templatePath) => { + // NunjucksEnvironment: + // loader.pathToNames: {'ABSOLUTE_PATH/src/_includes/components/possum-home.css': 'components/possum-home.css'} + // loader.cache: { 'components/possum-home.css': [Template] } + // Nunjucks stores these as Operating System native paths + let absTmplPath = TemplatePath.normalizeOperatingSystemFilePath( + TemplatePath.absolutePath(templatePath), + ); + for (let loader of this.njkEnv.loaders) { + let nunjucksName = loader.pathsToNames[absTmplPath]; + if (nunjucksName) { + debug( + "Match found in Nunjucks cache via templateModified for %o, clearing this entry", + templatePath, + ); + delete loader.pathsToNames[absTmplPath]; + delete loader.cache[nunjucksName]; + } + } + + // Behavior prior to v3.1.0-alpha.1: + // this.njkEnv.invalidateCache(); + }); + + this.setEngineLib(this.njkEnv, Boolean(this.config.libraryOverrides.njk)); + + this.addFilters(this.config.nunjucksFilters); + this.addFilters(this.config.nunjucksAsyncFilters, true); + + // TODO these all go to the same place (addTag), add warnings for overwrites + // TODO(zachleat): variableName should work with quotes or without quotes (same as {% set %}) + this.addPairedShortcode("setAsync", function (content, variableName) { + this.ctx[variableName] = content; + return ""; + }); + + this.addCustomTags(this.config.nunjucksTags); + this.addAllShortcodes(this.config.nunjucksShortcodes); + this.addAllShortcodes(this.config.nunjucksAsyncShortcodes, true); + this.addAllPairedShortcodes(this.config.nunjucksPairedShortcodes); + this.addAllPairedShortcodes(this.config.nunjucksAsyncPairedShortcodes, true); + this.addGlobals(this.config.nunjucksGlobals); + } + + addFilters(filters, isAsync) { + for (let name in filters) { + this.njkEnv.addFilter(name, Nunjucks.wrapFilter(name, filters[name]), isAsync); + } + } + + static wrapFilter(name, fn) { + return function (...args) { + try { + augmentObject(this, { + source: this.ctx, + lazy: false, // context.env?.opts.throwOnUndefined, + }); + + return fn.call(this, ...args); + } catch (e) { + throw new EleventyNunjucksError( + `Error in Nunjucks Filter \`${name}\`${this.page ? ` (${this.page.inputPath})` : ""}`, + e, + ); + } + }; + } + + // Shortcodes + static normalizeContext(context) { + let obj = {}; + if (context.ctx) { + obj.ctx = context.ctx; + obj.env = context.env; + + augmentObject(obj, { + source: context.ctx, + lazy: false, // context.env?.opts.throwOnUndefined, + }); + } + return obj; + } + + addCustomTags(tags) { + for (let name in tags) { + this.addTag(name, tags[name]); + } + } + + addTag(name, tagFn) { + let tagObj; + if (typeof tagFn === "function") { + tagObj = tagFn(NunjucksLib, this.njkEnv); + } else { + throw new Error( + "Nunjucks.addTag expects a callback function to be passed in: addTag(name, function(nunjucksEngine) {})", + ); + } + + this.njkEnv.addExtension(name, tagObj); + } + + addGlobals(globals) { + for (let name in globals) { + this.addGlobal(name, globals[name]); + } + } + + addGlobal(name, globalFn) { + this.njkEnv.addGlobal(name, globalFn); + } + + addAllShortcodes(shortcodes, isAsync = false) { + for (let name in shortcodes) { + this.addShortcode(name, shortcodes[name], isAsync); + } + } + + addAllPairedShortcodes(shortcodes, isAsync = false) { + for (let name in shortcodes) { + this.addPairedShortcode(name, shortcodes[name], isAsync); + } + } + + _getShortcodeFn(shortcodeName, shortcodeFn, isAsync = false) { + return function ShortcodeFunction() { + this.tags = [shortcodeName]; + + this.parse = function (parser, nodes) { + let args; + let tok = parser.nextToken(); + + args = parser.parseSignature(true, true); + + // Nunjucks bug with non-paired custom tags bug still exists even + // though this issue is closed. Works fine for paired. + // https://github.com/mozilla/nunjucks/issues/158 + if (args.children.length === 0) { + args.addChild(new nodes.Literal(0, 0, "")); + } + + parser.advanceAfterBlockEnd(tok.value); + if (isAsync) { + return new nodes.CallExtensionAsync(this, "run", args); + } + return new nodes.CallExtension(this, "run", args); + }; + + this.run = function (...args) { + let resolve; + if (isAsync) { + resolve = args.pop(); + } + + let [context, ...argArray] = args; + + if (isAsync) { + let ret = shortcodeFn.call(Nunjucks.normalizeContext(context), ...argArray); + + // #3286 error messaging when the shortcode is not a promise + if (!ret?.then) { + resolve( + new EleventyNunjucksError( + `Error with Nunjucks shortcode \`${shortcodeName}\`: it was defined as asynchronous but was actually synchronous. This is important for Nunjucks.`, + ), + ); + } + + ret.then( + function (returnValue) { + resolve(null, new NunjucksLib.runtime.SafeString("" + returnValue)); + }, + function (e) { + resolve( + new EleventyNunjucksError(`Error with Nunjucks shortcode \`${shortcodeName}\``, e), + ); + }, + ); + } else { + try { + let ret = shortcodeFn.call(Nunjucks.normalizeContext(context), ...argArray); + return new NunjucksLib.runtime.SafeString("" + ret); + } catch (e) { + throw new EleventyNunjucksError( + `Error with Nunjucks shortcode \`${shortcodeName}\``, + e, + ); + } + } + }; + }; + } + + _getPairedShortcodeFn(shortcodeName, shortcodeFn, isAsync = false) { + return function PairedShortcodeFunction() { + this.tags = [shortcodeName]; + + this.parse = function (parser, nodes) { + var tok = parser.nextToken(); + + var args = parser.parseSignature(true, true); + parser.advanceAfterBlockEnd(tok.value); + + var body = parser.parseUntilBlocks("end" + shortcodeName); + parser.advanceAfterBlockEnd(); + + return new nodes.CallExtensionAsync(this, "run", args, [body]); + }; + + this.run = function (...args) { + let resolve = args.pop(); + let body = args.pop(); + let [context, ...argArray] = args; + + body(function (e, bodyContent) { + if (e) { + resolve( + new EleventyNunjucksError( + `Error with Nunjucks paired shortcode \`${shortcodeName}\``, + e, + ), + ); + } + + if (isAsync) { + let ret = shortcodeFn.call( + Nunjucks.normalizeContext(context), + bodyContent, + ...argArray, + ); + + // #3286 error messaging when the shortcode is not a promise + if (!ret?.then) { + throw new EleventyNunjucksError( + `Error with Nunjucks shortcode \`${shortcodeName}\`: it was defined as asynchronous but was actually synchronous. This is important for Nunjucks.`, + ); + } + + ret.then( + function (returnValue) { + resolve(null, new NunjucksLib.runtime.SafeString(returnValue)); + }, + function (e) { + resolve( + new EleventyNunjucksError( + `Error with Nunjucks paired shortcode \`${shortcodeName}\``, + e, + ), + ); + }, + ); + } else { + try { + resolve( + null, + new NunjucksLib.runtime.SafeString( + shortcodeFn.call(Nunjucks.normalizeContext(context), bodyContent, ...argArray), + ), + ); + } catch (e) { + resolve( + new EleventyNunjucksError( + `Error with Nunjucks paired shortcode \`${shortcodeName}\``, + e, + ), + ); + } + } + }); + }; + }; + } + + addShortcode(shortcodeName, shortcodeFn, isAsync = false) { + let fn = this._getShortcodeFn(shortcodeName, shortcodeFn, isAsync); + this.njkEnv.addExtension(shortcodeName, new fn()); + } + + addPairedShortcode(shortcodeName, shortcodeFn, isAsync = false) { + let fn = this._getPairedShortcodeFn(shortcodeName, shortcodeFn, isAsync); + this.njkEnv.addExtension(shortcodeName, new fn()); + } + + // Don’t return a boolean if permalink is a function (see TemplateContent->renderPermalink) + permalinkNeedsCompilation(str) { + if (typeof str === "string") { + return this.needsCompilation(str); + } + } + + needsCompilation(str) { + // Defend against syntax customisations: + // https://mozilla.github.io/nunjucks/api.html#customizing-syntax + let optsTags = this.njkEnv.opts.tags || {}; + let blockStart = optsTags.blockStart || "{%"; + let variableStart = optsTags.variableStart || "{{"; + let commentStart = optsTags.variableStart || "{#"; + + return ( + str.indexOf(blockStart) !== -1 || + str.indexOf(variableStart) !== -1 || + str.indexOf(commentStart) !== -1 + ); + } + + _getParseExtensions() { + if (this._parseExtensions) { + return this._parseExtensions; + } + + // add extensions so the parser knows about our custom tags/blocks + let ext = []; + for (let name in this.config.nunjucksTags) { + let fn = this._getShortcodeFn(name, () => {}); + ext.push(new fn()); + } + for (let name in this.config.nunjucksShortcodes) { + let fn = this._getShortcodeFn(name, () => {}); + ext.push(new fn()); + } + for (let name in this.config.nunjucksAsyncShortcodes) { + let fn = this._getShortcodeFn(name, () => {}, true); + ext.push(new fn()); + } + for (let name in this.config.nunjucksPairedShortcodes) { + let fn = this._getPairedShortcodeFn(name, () => {}); + ext.push(new fn()); + } + for (let name in this.config.nunjucksAsyncPairedShortcodes) { + let fn = this._getPairedShortcodeFn(name, () => {}, true); + ext.push(new fn()); + } + + this._parseExtensions = ext; + return ext; + } + + /* Outputs an Array of lodash get selectors */ + parseForSymbols(str) { + if (!str) { + return []; + } + const { parser, nodes } = NunjucksLib; + let obj = parser.parse(str, this._getParseExtensions()); + if (!obj) { + return []; + } + let linesplit = str.split("\n"); + let values = obj.findAll(nodes.Value); + let symbols = obj.findAll(nodes.Symbol).map((entry) => { + let name = [entry.value]; + let nestedIndex = -1; + for (let val of values) { + if (nestedIndex > -1) { + /* deep.object.syntax */ + if (linesplit[val.lineno].charAt(nestedIndex) === ".") { + name.push(val.value); + nestedIndex += val.value.length + 1; + } else { + nestedIndex = -1; + } + } else if ( + val.lineno === entry.lineno && + val.colno === entry.colno && + val.value === entry.value + ) { + nestedIndex = entry.colno + entry.value.length; + } + } + return name.join("."); + }); + + let uniqueSymbols = Array.from(new Set(symbols)); + return uniqueSymbols; + } + + async compile(str, inputPath) { + let tmpl; + + // *All* templates are precompiled to avoid runtime eval + if (this._usingPrecompiled) { + tmpl = this.njkEnv.getTemplate(str, true); + } else if (!inputPath || inputPath === "njk" || inputPath === "md") { + tmpl = new NunjucksLib.Template(str, this.njkEnv, null, false); + } else { + tmpl = new NunjucksLib.Template(str, this.njkEnv, inputPath, false); + } + + return function (data) { + let { promise, resolve, reject } = withResolvers(); + + tmpl.render(data, (error, result) => { + if (error) { + reject(error); + } else { + resolve(result); + } + }); + + return promise; + }; + } +} diff --git a/node_modules/@11ty/eleventy/src/Engines/TemplateEngine.js b/node_modules/@11ty/eleventy/src/Engines/TemplateEngine.js new file mode 100644 index 00000000..234aa4e7 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Engines/TemplateEngine.js @@ -0,0 +1,206 @@ +import debugUtil from "debug"; +import EleventyBaseError from "../Errors/EleventyBaseError.js"; + +class TemplateEngineConfigError extends EleventyBaseError {} + +const debug = debugUtil("Eleventy:TemplateEngine"); + +const AMENDED_INSTANCES = new Set(); + +export default class TemplateEngine { + #extensionMap; + #engineManager; + #benchmarks; + + constructor(name, eleventyConfig) { + this.name = name; + + this.engineLib = null; + + if (!eleventyConfig) { + throw new TemplateEngineConfigError("Missing `eleventyConfig` argument."); + } + this.eleventyConfig = eleventyConfig; + } + + get cacheable() { + return false; + } + + get dirs() { + return this.eleventyConfig.directories; + } + + get inputDir() { + return this.dirs.input; + } + + get includesDir() { + return this.dirs.includes; + } + + get config() { + if (this.eleventyConfig.constructor.name !== "TemplateConfig") { + throw new Error("Expecting a TemplateConfig instance."); + } + + return this.eleventyConfig.getConfig(); + } + + get benchmarks() { + if (!this.#benchmarks) { + this.#benchmarks = { + aggregate: this.config.benchmarkManager.get("Aggregate"), + }; + } + return this.#benchmarks; + } + + get engineManager() { + return this.#engineManager; + } + + set engineManager(manager) { + this.#engineManager = manager; + } + + get extensionMap() { + if (!this.#extensionMap) { + throw new Error("Internal error: missing `extensionMap` in TemplateEngine."); + } + return this.#extensionMap; + } + + set extensionMap(map) { + this.#extensionMap = map; + } + + get extensions() { + if (!this._extensions) { + this._extensions = this.extensionMap.getExtensionsFromKey(this.name); + } + return this._extensions; + } + + get extensionEntries() { + if (!this._extensionEntries) { + this._extensionEntries = this.extensionMap.getExtensionEntriesFromKey(this.name); + } + return this._extensionEntries; + } + + getName() { + return this.name; + } + + // Backwards compat + getIncludesDir() { + return this.includesDir; + } + + /** + * @protected + */ + setEngineLib(engineLib, isOverrideViaSetLibrary = false) { + this.engineLib = engineLib; + + // Run engine amendments (via issue #2438) + // Issue #3816: this isn’t ideal but there is no other way to reset a markdown instance if it was also overridden by addLibrary + if (AMENDED_INSTANCES.has(engineLib)) { + return; + } + + if (isOverrideViaSetLibrary) { + AMENDED_INSTANCES.add(engineLib); + } + debug( + "Running amendLibrary for %o (number of amendments: %o)", + this.name, + this.config.libraryAmendments[this.name]?.length, + ); + + for (let amendment of this.config.libraryAmendments[this.name] || []) { + // TODO it’d be nice if this were async friendly + amendment(engineLib); + } + } + + getEngineLib() { + return this.engineLib; + } + + async _testRender(str, data) { + // @ts-ignore + let fn = await this.compile(str); + return fn(data); + } + + useJavaScriptImport() { + return false; + } + + // JavaScript files defer to the module loader rather than read the files to strings + needsToReadFileContents() { + return true; + } + + getExtraDataFromFile() { + return {}; + } + + getCompileCacheKey(str, inputPath) { + // Changing to use inputPath and contents, using only file contents (`str`) caused issues when two + // different files had identical content (2.0.0-canary.16) + + // Caches are now segmented based on inputPath so using inputPath here is superfluous (2.0.0-canary.19) + // But we do want a non-falsy value here even if `str` is an empty string. + return { + useCache: true, + key: inputPath + str, + }; + } + + get defaultTemplateFileExtension() { + return "html"; + } + + // Whether or not to wrap in Eleventy layouts + useLayouts() { + return true; + } + + /** @returns {boolean|undefined} */ + permalinkNeedsCompilation(str) { + return this.needsCompilation(); + } + + // whether or not compile is needed or can we return the plaintext? + needsCompilation(str) { + return true; + } + + /** + * Make sure compile is implemented downstream. + * @abstract + * @return {Promise} + */ + async compile() { + throw new Error("compile() must be implemented by engine"); + } + + // See https://v3.11ty.dev/docs/watch-serve/#watch-javascript-dependencies + static shouldSpiderJavaScriptDependencies() { + return false; + } + + hasDependencies(inputPath) { + if (this.config.uses.getDependencies(inputPath) === false) { + return false; + } + return true; + } + + isFileRelevantTo(inputPath, comparisonFile) { + return this.config.uses.isFileRelevantTo(inputPath, comparisonFile); + } +} diff --git a/node_modules/@11ty/eleventy/src/Engines/TemplateEngineManager.js b/node_modules/@11ty/eleventy/src/Engines/TemplateEngineManager.js new file mode 100644 index 00000000..913a8036 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Engines/TemplateEngineManager.js @@ -0,0 +1,193 @@ +import debugUtil from "debug"; +import EleventyBaseError from "../Errors/EleventyBaseError.js"; + +const debug = debugUtil("Eleventy:TemplateEngineManager"); + +class TemplateEngineManager { + constructor(eleventyConfig) { + if (!eleventyConfig || eleventyConfig.constructor.name !== "TemplateConfig") { + throw new EleventyBaseError("Missing or invalid `config` argument."); + } + this.eleventyConfig = eleventyConfig; + + this.engineCache = {}; + this.importCache = {}; + } + + get config() { + return this.eleventyConfig.getConfig(); + } + + static isAlias(entry) { + if (entry.aliasKey) { + return true; + } + + return entry.key !== entry.extension; + } + + static isSimpleAlias(entry) { + if (!this.isAlias(entry)) { + return false; + } + + // has keys other than key, extension, and aliasKey + return ( + Object.keys(entry).some((key) => { + return key !== "key" && key !== "extension" && key !== "aliasKey"; + }) === false + ); + } + + get keyToClassNameMap() { + if (!this._keyToClassNameMap) { + this._keyToClassNameMap = { + md: "Markdown", + html: "Html", + njk: "Nunjucks", + liquid: "Liquid", + "11ty.js": "JavaScript", + }; + + // Custom entries *can* overwrite default entries above + if ("extensionMap" in this.config) { + for (let entry of this.config.extensionMap) { + // either the key does not already exist or it is not a simple alias and is an override: https://v3.11ty.dev/docs/languages/custom/#overriding-an-existing-template-language + let existingTarget = this._keyToClassNameMap[entry.key]; + let isAlias = TemplateEngineManager.isAlias(entry); + + if (!existingTarget && isAlias) { + throw new Error( + `An attempt to alias ${entry.aliasKey} to ${entry.key} was made, but ${entry.key} is not a recognized template syntax.`, + ); + } + + if (isAlias) { + // only `key` and `extension`, not `compile` or other options + if (!TemplateEngineManager.isSimpleAlias(entry)) { + this._keyToClassNameMap[entry.aliasKey] = "Custom"; + } else { + this._keyToClassNameMap[entry.aliasKey] = this._keyToClassNameMap[entry.key]; + } + } else { + // not an alias, so `key` and `extension` are the same here. + // *can* override a built-in extension! + this._keyToClassNameMap[entry.key] = "Custom"; + } + } + } + } + + return this._keyToClassNameMap; + } + + reset() { + this.engineCache = {}; + } + + getClassNameFromTemplateKey(key) { + return this.keyToClassNameMap[key]; + } + + hasEngine(name) { + return !!this.getClassNameFromTemplateKey(name); + } + + async getEngineClassByExtension(extension) { + if (this.importCache[extension]) { + return this.importCache[extension]; + } + + let promise; + + // We include these as raw strings (and not more readable variables) so they’re parsed by a bundler. + if (extension === "md") { + promise = import("./Markdown.js").then((mod) => mod.default); + } else if (extension === "html") { + promise = import("./Html.js").then((mod) => mod.default); + } else if (extension === "njk") { + promise = import("./Nunjucks.js").then((mod) => mod.default); + } else if (extension === "liquid") { + promise = import("./Liquid.js").then((mod) => mod.default); + } else if (extension === "11ty.js") { + promise = import("./JavaScript.js").then((mod) => mod.default); + } else { + promise = this.getCustomEngineClass(); + } + + this.importCache[extension] = promise; + + return promise; + } + + async getCustomEngineClass() { + if (!this._CustomEngine) { + this._CustomEngine = import("./Custom.js").then((mod) => mod.default); + } + return this._CustomEngine; + } + + async #getEngine(name, extensionMap) { + let cls = await this.getEngineClassByExtension(name); + let instance = new cls(name, this.eleventyConfig); + instance.extensionMap = extensionMap; + instance.engineManager = this; + + let extensionEntry = extensionMap.getExtensionEntry(name); + + // Override a built-in extension (md => md) + // If provided a "Custom" engine using addExtension, but that engine's instance is *not* custom, + // The user must be overriding a built-in engine i.e. addExtension('md', { ...overrideBehavior }) + let className = this.getClassNameFromTemplateKey(name); + + if (className === "Custom" && instance.constructor.name !== "CustomEngine") { + let CustomEngine = await this.getCustomEngineClass(); + let overrideCustomEngine = new CustomEngine(name, this.eleventyConfig); + + // Keep track of the "default" engine 11ty would normally use + // This allows the user to access the default engine in their override + overrideCustomEngine.setDefaultEngine(instance); + + instance = overrideCustomEngine; + // Alias to a built-in extension (11ty.tsx => 11ty.js) + } else if ( + instance.constructor.name === "CustomEngine" && + TemplateEngineManager.isAlias(extensionEntry) + ) { + // add defaultRenderer for complex aliases with their own compile functions. + let originalEngineInstance = await this.getEngine(extensionEntry.key, extensionMap); + instance.setDefaultEngine(originalEngineInstance); + } + + return instance; + } + + isEngineRemovedFromCore(name) { + return ["ejs", "hbs", "mustache", "haml", "pug"].includes(name) && !this.hasEngine(name); + } + + async getEngine(name, extensionMap) { + // Bundled engine deprecation + if (this.isEngineRemovedFromCore(name)) { + throw new Error( + `Per the 11ty Community Survey (2023), the "${name}" template language was moved from core to an officially supported plugin in v3.0. These plugins live here: https://github.com/11ty/eleventy-plugin-template-languages and are documented on their respective template language docs at https://v3.11ty.dev/docs/languages/ You are also empowered to implement *any* template language yourself using https://v3.11ty.dev/docs/languages/custom/`, + ); + } + + if (!this.hasEngine(name)) { + throw new Error(`Template Engine ${name} does not exist in getEngine()`); + } + // TODO these cached engines should be based on extensions not name, then we can remove the error in + // "Double override (not aliases) throws an error" test in TemplateRenderCustomTest.js + if (!this.engineCache[name]) { + debug("Engine cache miss %o (should only happen once per engine type)", name); + // Make sure cache key is based on name and not path + // Custom class is used for all plugins, cache once per plugin + this.engineCache[name] = this.#getEngine(name, extensionMap); + } + + return this.engineCache[name]; + } +} + +export default TemplateEngineManager; diff --git a/node_modules/@11ty/eleventy/src/Engines/Util/ContextAugmenter.js b/node_modules/@11ty/eleventy/src/Engines/Util/ContextAugmenter.js new file mode 100644 index 00000000..dd5fbc64 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Engines/Util/ContextAugmenter.js @@ -0,0 +1,67 @@ +const DATA_KEYS = ["page", "eleventy"]; + +function augmentFunction(fn, options = {}) { + let t = typeof fn; + if (t !== "function") { + throw new Error( + "Invalid type passed to `augmentFunction`. A function was expected and received: " + t, + ); + } + + /** @this {object} */ + return function (...args) { + let context = augmentObject(this || {}, options); + return fn.call(context, ...args); + }; +} + +function augmentObject(targetObject, options = {}) { + options = Object.assign( + { + source: undefined, // where to copy from + overwrite: true, + lazy: false, // lazily fetch the property + // getter: function() {}, + }, + options, + ); + + for (let key of DATA_KEYS) { + // Skip if overwrite: false and prop already exists on target + if (!options.overwrite && targetObject[key]) { + continue; + } + + if (options.lazy) { + let value; + if (typeof options.getter == "function") { + value = () => options.getter(key, options.source); + } else { + value = () => options.source?.[key]; + } + + // lazy getter important for Liquid strictVariables support + Object.defineProperty(targetObject, key, { + writable: true, + configurable: true, + enumerable: true, + value, + }); + } else { + let value; + if (typeof options.getter == "function") { + value = options.getter(key, options.source); + } else { + value = options.source?.[key]; + } + + if (value) { + targetObject[key] = value; + } + } + } + + return targetObject; +} + +export { DATA_KEYS as augmentKeys, augmentFunction, augmentObject }; diff --git a/node_modules/@11ty/eleventy/src/Errors/DuplicatePermalinkOutputError.js b/node_modules/@11ty/eleventy/src/Errors/DuplicatePermalinkOutputError.js new file mode 100644 index 00000000..444195c7 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Errors/DuplicatePermalinkOutputError.js @@ -0,0 +1,9 @@ +import EleventyBaseError from "./EleventyBaseError.js"; + +class DuplicatePermalinkOutputError extends EleventyBaseError { + get removeDuplicateErrorStringFromOutput() { + return true; + } +} + +export default DuplicatePermalinkOutputError; diff --git a/node_modules/@11ty/eleventy/src/Errors/EleventyBaseError.js b/node_modules/@11ty/eleventy/src/Errors/EleventyBaseError.js new file mode 100644 index 00000000..6e76c5f8 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Errors/EleventyBaseError.js @@ -0,0 +1,24 @@ +/** + * This class serves as basis for all Eleventy-specific errors. + * @ignore + */ +class EleventyBaseError extends Error { + /** + * @param {string} message - The error message to display. + * @param {unknown} [originalError] - The original error caught. + */ + constructor(message, originalError) { + super(message); + + this.name = this.constructor.name; + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + if (originalError) { + this.originalError = originalError; + } + } +} +export default EleventyBaseError; diff --git a/node_modules/@11ty/eleventy/src/Errors/EleventyErrorHandler.js b/node_modules/@11ty/eleventy/src/Errors/EleventyErrorHandler.js new file mode 100644 index 00000000..879e65c5 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Errors/EleventyErrorHandler.js @@ -0,0 +1,152 @@ +import util from "node:util"; +import debugUtil from "debug"; + +import ConsoleLogger from "../Util/ConsoleLogger.js"; +import EleventyErrorUtil from "./EleventyErrorUtil.js"; + +const debug = debugUtil("Eleventy:EleventyErrorHandler"); + +class EleventyErrorHandler { + constructor() { + this._isVerbose = true; + } + + get isVerbose() { + return this._isVerbose; + } + + set isVerbose(verbose) { + this._isVerbose = !!verbose; + this.logger.isVerbose = !!verbose; + } + + get logger() { + if (!this._logger) { + this._logger = new ConsoleLogger(); + this._logger.isVerbose = this.isVerbose; + } + + return this._logger; + } + + set logger(logger) { + this._logger = logger; + } + + warn(e, msg) { + if (msg) { + this.initialMessage(msg, "warn", "yellow"); + } + this.log(e, "warn"); + } + + fatal(e, msg) { + this.error(e, msg); + process.exitCode = 1; + } + + once(type, e, msg) { + if (e.__errorAlreadyLogged) { + return; + } + + this[type || "error"](e, msg); + + Object.defineProperty(e, "__errorAlreadyLogged", { + value: true, + }); + } + + error(e, msg) { + if (msg) { + this.initialMessage(msg, "error", "red", true); + } + this.log(e, "error", undefined, true); + } + + static getTotalErrorCount(e) { + let totalErrorCount = 0; + let errorCountRef = e; + while (errorCountRef) { + totalErrorCount++; + errorCountRef = errorCountRef.originalError; + } + return totalErrorCount; + } + + //https://nodejs.org/api/process.html + log(e, type = "log", chalkColor = "", forceToConsole = false) { + if (process.env.DEBUG) { + debug("Full error object: %o", util.inspect(e, { showHidden: false, depth: null })); + } + + let showStack = true; + if (e.skipOriginalStack) { + // Don’t show the full error stack trace + showStack = false; + } + + let totalErrorCount = EleventyErrorHandler.getTotalErrorCount(e); + let ref = e; + let index = 1; + while (ref) { + let nextRef = ref.originalError; + + // Unwrap cause from error and assign it to what Eleventy expects + if (nextRef?.cause) { + nextRef.originalError = nextRef.cause?.originalError ?? nextRef?.cause; + } + + if (!nextRef && EleventyErrorUtil.hasEmbeddedError(ref.message)) { + nextRef = EleventyErrorUtil.deconvertErrorToObject(ref); + } + + if (nextRef?.skipOriginalStack) { + showStack = false; + } + + this.logger.message( + `${totalErrorCount > 1 ? `${index}. ` : ""}${( + EleventyErrorUtil.cleanMessage(ref.message) || "(No error message provided)" + ).trim()}${ref.name !== "Error" ? ` (via ${ref.name})` : ""}`, + type, + chalkColor, + forceToConsole, + ); + + if (process.env.DEBUG) { + debug(`(${type} stack): ${ref.stack}`); + } else if (!nextRef) { + // last error in the loop + + // remove duplicate error messages if the stack contains the original message output above + let stackStr = ref.stack || ""; + if (e.removeDuplicateErrorStringFromOutput) { + stackStr = stackStr.replace( + `${ref.name}: ${ref.message}`, + "(Repeated output has been truncated…)", + ); + } + + if (showStack) { + this.logger.message( + "\nOriginal error stack trace: " + stackStr, + type, + chalkColor, + forceToConsole, + ); + } + } + ref = nextRef; + index++; + } + } + + initialMessage(message, type = "log", chalkColor = "blue", forceToConsole = false) { + if (message) { + this.logger.message(message + ":", type, chalkColor, forceToConsole); + } + } +} + +export { EleventyErrorHandler }; diff --git a/node_modules/@11ty/eleventy/src/Errors/EleventyErrorUtil.js b/node_modules/@11ty/eleventy/src/Errors/EleventyErrorUtil.js new file mode 100644 index 00000000..6b374d01 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Errors/EleventyErrorUtil.js @@ -0,0 +1,70 @@ +import TemplateContentPrematureUseError from "./TemplateContentPrematureUseError.js"; + +/* Hack to workaround the variety of error handling schemes in template languages */ +class EleventyErrorUtil { + static get prefix() { + return ">>>>>11ty>>>>>"; + } + static get suffix() { + return "<<<<<11ty<<<<<"; + } + + static hasEmbeddedError(msg) { + if (!msg) { + return false; + } + + return msg.includes(EleventyErrorUtil.prefix) && msg.includes(EleventyErrorUtil.suffix); + } + + static cleanMessage(msg) { + if (!msg) { + return ""; + } + + if (!EleventyErrorUtil.hasEmbeddedError(msg)) { + return "" + msg; + } + + return msg.slice(0, Math.max(0, msg.indexOf(EleventyErrorUtil.prefix))); + } + + static deconvertErrorToObject(error) { + if (!error || !error.message) { + throw new Error(`Could not convert error object from: ${error}`); + } + if (!EleventyErrorUtil.hasEmbeddedError(error.message)) { + return error; + } + + let msg = error.message; + let objectString = msg.substring( + msg.indexOf(EleventyErrorUtil.prefix) + EleventyErrorUtil.prefix.length, + msg.lastIndexOf(EleventyErrorUtil.suffix), + ); + let obj = JSON.parse(objectString); + obj.name = error.name; + return obj; + } + + // pass an error through a random template engine’s error handling unscathed + static convertErrorToString(error) { + return ( + EleventyErrorUtil.prefix + + JSON.stringify({ message: error.message, stack: error.stack }) + + EleventyErrorUtil.suffix + ); + } + + static isPrematureTemplateContentError(e) { + // TODO the rest of the template engines + return ( + e instanceof TemplateContentPrematureUseError || + e?.cause instanceof TemplateContentPrematureUseError || // Custom (per Node-convention) + ["RenderError", "UndefinedVariableError"].includes(e?.originalError?.name) && e?.originalError?.originalError instanceof TemplateContentPrematureUseError || // Liquid + e?.message?.includes("TemplateContentPrematureUseError") // Nunjucks + ); + } +} + +export default EleventyErrorUtil; diff --git a/node_modules/@11ty/eleventy/src/Errors/TemplateContentPrematureUseError.js b/node_modules/@11ty/eleventy/src/Errors/TemplateContentPrematureUseError.js new file mode 100644 index 00000000..5266cd27 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Errors/TemplateContentPrematureUseError.js @@ -0,0 +1,5 @@ +import EleventyBaseError from "./EleventyBaseError.js"; + +class TemplateContentPrematureUseError extends EleventyBaseError {} + +export default TemplateContentPrematureUseError; diff --git a/node_modules/@11ty/eleventy/src/Errors/TemplateContentUnrenderedTemplateError.js b/node_modules/@11ty/eleventy/src/Errors/TemplateContentUnrenderedTemplateError.js new file mode 100644 index 00000000..ee270d5d --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Errors/TemplateContentUnrenderedTemplateError.js @@ -0,0 +1,5 @@ +import EleventyBaseError from "./EleventyBaseError.js"; + +class TemplateContentUnrenderedTemplateError extends EleventyBaseError {} + +export default TemplateContentUnrenderedTemplateError; diff --git a/node_modules/@11ty/eleventy/src/Errors/UsingCircularTemplateContentReferenceError.js b/node_modules/@11ty/eleventy/src/Errors/UsingCircularTemplateContentReferenceError.js new file mode 100644 index 00000000..5608febb --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Errors/UsingCircularTemplateContentReferenceError.js @@ -0,0 +1,5 @@ +import EleventyBaseError from "./EleventyBaseError.js"; + +class UsingCircularTemplateContentReferenceError extends EleventyBaseError {} + +export default UsingCircularTemplateContentReferenceError; diff --git a/node_modules/@11ty/eleventy/src/EventBus.js b/node_modules/@11ty/eleventy/src/EventBus.js new file mode 100644 index 00000000..0aa41264 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/EventBus.js @@ -0,0 +1,23 @@ +import debugUtil from "debug"; + +import EventEmitter from "./Util/AsyncEventEmitter.js"; + +const debug = debugUtil("Eleventy:EventBus"); + +/** + * @module 11ty/eleventy/EventBus + * @ignore + */ + +debug("Setting up global EventBus."); +/** + * Provides a global event bus that modules deep down in the stack can + * subscribe to from a global singleton for decoupled pub/sub. + * @type {module:11ty/eleventy/Util/AsyncEventEmitter~AsyncEventEmitter} + */ +let bus = new EventEmitter(); +bus.setMaxListeners(100); // defaults to 10 + +debug("EventBus max listener count: %o", bus.getMaxListeners()); + +export default bus; diff --git a/node_modules/@11ty/eleventy/src/FileSystemSearch.js b/node_modules/@11ty/eleventy/src/FileSystemSearch.js new file mode 100644 index 00000000..972e80ba --- /dev/null +++ b/node_modules/@11ty/eleventy/src/FileSystemSearch.js @@ -0,0 +1,129 @@ +import { glob } from "tinyglobby"; +import { TemplatePath } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; + +import FileSystemRemap from "./Util/GlobRemap.js"; +import { isGlobMatch } from "./Util/GlobMatcher.js"; + +const debug = debugUtil("Eleventy:FileSystemSearch"); + +class FileSystemSearch { + constructor() { + this.inputs = {}; + this.outputs = {}; + this.promises = {}; + this.count = 0; + } + + getCacheKey(key, globs, options) { + if (Array.isArray(globs)) { + globs = globs.sort(); + } + return key + JSON.stringify(globs) + JSON.stringify(options); + } + + // returns a promise + search(key, globs, options = {}) { + debug("Glob search (%o) searching for: %o", key, globs); + + if (!Array.isArray(globs)) { + globs = [globs]; + } + + // Strip leading slashes from everything! + globs = globs.map((entry) => TemplatePath.stripLeadingDotSlash(entry)); + + let cwd = FileSystemRemap.getCwd(globs); + if (cwd) { + options.cwd = cwd; + } + + if (options.ignore && Array.isArray(options.ignore)) { + options.ignore = options.ignore.map((entry) => { + entry = TemplatePath.stripLeadingDotSlash(entry); + + return FileSystemRemap.remapInput(entry, cwd); + }); + debug("Glob search (%o) ignoring: %o", key, options.ignore); + } + + let cacheKey = this.getCacheKey(key, globs, options); + + // Only after the promise has resolved + if (this.outputs[cacheKey]) { + return Array.from(this.outputs[cacheKey]); + } + + if (!this.promises[cacheKey]) { + this.inputs[cacheKey] = { + input: globs, + options, + }; + + this.count++; + + globs = globs.map((entry) => { + if (cwd && entry.startsWith(cwd)) { + return FileSystemRemap.remapInput(entry, cwd); + } + + return entry; + }); + + this.promises[cacheKey] = glob( + globs, + Object.assign( + { + caseSensitiveMatch: false, // insensitive + dot: true, + }, + options, + ), + ).then((results) => { + this.outputs[cacheKey] = new Set( + results.map((entry) => { + let remapped = FileSystemRemap.remapOutput(entry, options.cwd); + return TemplatePath.standardizeFilePath(remapped); + }), + ); + + return Array.from(this.outputs[cacheKey]); + }); + } + + // may be an unresolved promise + return this.promises[cacheKey]; + } + + _modify(path, setOperation) { + path = TemplatePath.stripLeadingDotSlash(path); + + let normalized = TemplatePath.standardizeFilePath(path); + + for (let key in this.inputs) { + let { input, options } = this.inputs[key]; + if ( + isGlobMatch(path, input, { + ignore: options.ignore, + }) + ) { + this.outputs[key][setOperation](normalized); + } + } + } + + add(path) { + this._modify(path, "add"); + } + + delete(path) { + this._modify(path, "delete"); + } + + // Issue #3859 get rid of chokidar globs + // getAllOutputFiles() { + // return Object.values(this.outputs).map(set => Array.from(set)).flat(); + // } +} + +export default FileSystemSearch; diff --git a/node_modules/@11ty/eleventy/src/Filters/GetCollectionItem.js b/node_modules/@11ty/eleventy/src/Filters/GetCollectionItem.js new file mode 100644 index 00000000..7512940b --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Filters/GetCollectionItem.js @@ -0,0 +1,20 @@ +export default function getCollectionItem(collection, page, modifier = 0) { + let j = 0; + let index; + for (let item of collection) { + if ( + item.inputPath === page.inputPath && + (item.outputPath === page.outputPath || item.url === page.url) + ) { + index = j; + break; + } + j++; + } + + if (index !== undefined && collection?.length) { + if (index + modifier >= 0 && index + modifier < collection.length) { + return collection[index + modifier]; + } + } +} diff --git a/node_modules/@11ty/eleventy/src/Filters/GetCollectionItemIndex.js b/node_modules/@11ty/eleventy/src/Filters/GetCollectionItemIndex.js new file mode 100644 index 00000000..9e12854b --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Filters/GetCollectionItemIndex.js @@ -0,0 +1,17 @@ +// TODO locale-friendly, see GetLocaleCollectionItem.js) +export default function getCollectionItemIndex(collection, page) { + if (!page) { + page = this.page; + } + + let j = 0; + for (let item of collection) { + if ( + item.inputPath === page.inputPath && + (item.outputPath === page.outputPath || item.url === page.url) + ) { + return j; + } + j++; + } +} diff --git a/node_modules/@11ty/eleventy/src/Filters/GetLocaleCollectionItem.js b/node_modules/@11ty/eleventy/src/Filters/GetLocaleCollectionItem.js new file mode 100644 index 00000000..1f966228 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Filters/GetLocaleCollectionItem.js @@ -0,0 +1,47 @@ +import getCollectionItem from "./GetCollectionItem.js"; + +// Work with I18n Plugin src/Plugins/I18nPlugin.js to retrieve root pages (not i18n pages) +function resolveRootPage(config, pageOverride, languageCode) { + let localeFilter = config.getFilter("locale_page"); + if (!localeFilter || typeof localeFilter !== "function") { + return pageOverride; + } + + // returns root/default-language `page` object + return localeFilter.call(this, pageOverride, languageCode); +} + +function getLocaleCollectionItem(config, collection, pageOverride, langCode, indexModifier = 0) { + if (!langCode) { + // if page.lang exists (2.0.0-canary.14 and i18n plugin added, use page language) + if (this.page.lang) { + langCode = this.page.lang; + } else { + return getCollectionItem(collection, pageOverride || this.page, indexModifier); + } + } + + let rootPage = resolveRootPage.call(this, config, pageOverride); // implied current page, default language + let modifiedRootItem = getCollectionItem(collection, rootPage, indexModifier); + if (!modifiedRootItem) { + return; // no root item exists for the previous/next page + } + + // Resolve modified root `page` back to locale `page` + // This will return a non localized version of the page as a fallback + let modifiedLocalePage = resolveRootPage.call(this, config, modifiedRootItem.data.page, langCode); + // already localized (or default language) + if (!("__locale_page_resolved" in modifiedLocalePage)) { + return modifiedRootItem; + } + + // find the modified locale `page` again in `collections.all` + let all = + this.collections?.all || + this.ctx?.collections?.all || + this.context?.environments?.collections?.all || + []; + return getCollectionItem(all, modifiedLocalePage, 0); +} + +export default getLocaleCollectionItem; diff --git a/node_modules/@11ty/eleventy/src/Filters/Slug.js b/node_modules/@11ty/eleventy/src/Filters/Slug.js new file mode 100644 index 00000000..03a77cc0 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Filters/Slug.js @@ -0,0 +1,14 @@ +import slugify from "slugify"; + +export default function (str, options = {}) { + return slugify( + "" + str, + Object.assign( + { + replacement: "-", + lower: true, + }, + options, + ), + ); +} diff --git a/node_modules/@11ty/eleventy/src/Filters/Slugify.js b/node_modules/@11ty/eleventy/src/Filters/Slugify.js new file mode 100644 index 00000000..e84b42d1 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Filters/Slugify.js @@ -0,0 +1,14 @@ +import slugify from "@sindresorhus/slugify"; + +export default function (str, options = {}) { + return slugify( + "" + str, + Object.assign( + { + // lowercase: true, // default + decamelize: false, + }, + options, + ), + ); +} diff --git a/node_modules/@11ty/eleventy/src/Filters/Url.js b/node_modules/@11ty/eleventy/src/Filters/Url.js new file mode 100644 index 00000000..87fc1e2e --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Filters/Url.js @@ -0,0 +1,35 @@ +import { TemplatePath } from "@11ty/eleventy-utils"; + +import isValidUrl from "../Util/ValidUrl.js"; + +// Note: This filter is used in the Eleventy Navigation plugin in versions prior to 0.3.4 +export default function (url, pathPrefix) { + // work with undefined + url = url || ""; + + if (isValidUrl(url) || (url.startsWith("//") && url !== "//")) { + return url; + } + + if (pathPrefix === undefined || typeof pathPrefix !== "string") { + // When you retrieve this with config.getFilter("url") it + // grabs the pathPrefix argument from your config for you (see defaultConfig.js) + throw new Error("pathPrefix (String) is required in the `url` filter."); + } + + let normUrl = TemplatePath.normalizeUrlPath(url); + let normRootDir = TemplatePath.normalizeUrlPath("/", pathPrefix); + let normFull = TemplatePath.normalizeUrlPath("/", pathPrefix, url); + let isRootDirTrailingSlash = + normRootDir.length && normRootDir.charAt(normRootDir.length - 1) === "/"; + + // minor difference with straight `normalize`, "" resolves to root dir and not "." + // minor difference with straight `normalize`, "/" resolves to root dir + if (normUrl === "/" || normUrl === normRootDir) { + return normRootDir + (!isRootDirTrailingSlash ? "/" : ""); + } else if (normUrl.indexOf("/") === 0) { + return normFull; + } + + return normUrl; +} diff --git a/node_modules/@11ty/eleventy/src/GlobalDependencyMap.js b/node_modules/@11ty/eleventy/src/GlobalDependencyMap.js new file mode 100644 index 00000000..7e169daf --- /dev/null +++ b/node_modules/@11ty/eleventy/src/GlobalDependencyMap.js @@ -0,0 +1,463 @@ +import debugUtil from "debug"; +import { TemplatePath } from "@11ty/eleventy-utils"; + +import JavaScriptDependencies from "./Util/JavaScriptDependencies.js"; +import PathNormalizer from "./Util/PathNormalizer.js"; +import { TemplateDepGraph } from "./Util/TemplateDepGraph.js"; + +const debug = debugUtil("Eleventy:Dependencies"); + +class GlobalDependencyMap { + // dependency-graph requires these keys to be alphabetic strings + static LAYOUT_KEY = "layout"; + static COLLECTION_PREFIX = "__collection:"; // must match TemplateDepGraph key + + #map; + #templateConfig; + #cachedUserConfigurationCollectionApiNames; + + static isCollection(entry) { + return entry.startsWith(this.COLLECTION_PREFIX); + } + + static getTagName(entry) { + if (this.isCollection(entry)) { + return entry.slice(this.COLLECTION_PREFIX.length); + } + } + + static getCollectionKeyForEntry(entry) { + return `${GlobalDependencyMap.COLLECTION_PREFIX}${entry}`; + } + + reset() { + this.#map = undefined; + } + + setIsEsm(isEsm) { + this.isEsm = isEsm; + } + + setTemplateConfig(templateConfig) { + this.#templateConfig = templateConfig; + + // These have leading dot slashes, but so do the paths from Eleventy + this.#templateConfig.userConfig.events.once("eleventy.layouts", async (layouts) => { + await this.addLayoutsToMap(layouts); + }); + } + + get userConfigurationCollectionApiNames() { + if (this.#cachedUserConfigurationCollectionApiNames) { + return this.#cachedUserConfigurationCollectionApiNames; + } + return Object.keys(this.#templateConfig.userConfig.getCollections()) || []; + } + + initializeUserConfigurationApiCollections() { + this.addCollectionApiNames(this.userConfigurationCollectionApiNames); + } + + // For Testing + setCollectionApiNames(names = []) { + this.#cachedUserConfigurationCollectionApiNames = names; + } + + addCollectionApiNames(names = []) { + if (!names || names.length === 0) { + return; + } + + for (let collectionName of names) { + this.map.addConfigCollectionName(collectionName); + } + } + + filterOutLayouts(nodes = []) { + return nodes.filter((node) => { + if (GlobalDependencyMap.isLayoutNode(this.map, node)) { + return false; + } + return true; + }); + } + + filterOutCollections(nodes = []) { + return nodes.filter((node) => !node.startsWith(GlobalDependencyMap.COLLECTION_PREFIX)); + } + + static removeLayoutNodes(graph, nodeList) { + return nodeList.filter((node) => { + if (this.isLayoutNode(graph, node)) { + return false; + } + return true; + }); + } + + removeLayoutNodes(normalizedLayouts) { + let nodes = this.map.overallOrder(); + for (let node of nodes) { + if (!GlobalDependencyMap.isLayoutNode(this.map, node)) { + continue; + } + + // previous layout is not in the new layout map (no templates are using it) + if (!normalizedLayouts[node]) { + this.map.removeNode(node); + } + // important: if the layout map changed to have different templates (but was not removed) + // this is already handled by `resetNode` called via TemplateMap + } + } + + // Eleventy Layouts don’t show up in the dependency graph, so we handle those separately + async addLayoutsToMap(layouts) { + let normalizedLayouts = this.normalizeLayoutsObject(layouts); + + // Clear out any previous layout relationships to make way for the new ones + this.removeLayoutNodes(normalizedLayouts); + + for (let layout in normalizedLayouts) { + // We add this pre-emptively to add the `layout` data + if (!this.map.hasNode(layout)) { + this.map.addNode(layout, { + type: GlobalDependencyMap.LAYOUT_KEY, + }); + } else { + this.map.setNodeData(layout, { + type: GlobalDependencyMap.LAYOUT_KEY, + }); + } + + // Potential improvement: only add the first template in the chain for a template and manage any upstream layouts by their own relationships + for (let pageTemplate of normalizedLayouts[layout]) { + this.addDependency(pageTemplate, [layout]); + } + + if (this.#templateConfig?.shouldSpiderJavaScriptDependencies()) { + let deps = await JavaScriptDependencies.getDependencies([layout], this.isEsm); + this.addDependency(layout, deps); + } + } + } + + get map() { + if (!this.#map) { + // this.#map = new DepGraph({ circular: true }); + this.#map = new TemplateDepGraph(); + } + + return this.#map; + } + + set map(graph) { + this.#map = graph; + } + + normalizeNode(node) { + if (!node) { + return; + } + + // TODO tests for this + // Fix URL objects passed in (sass does this) + if (typeof node !== "string" && "toString" in node) { + node = node.toString(); + } + + if (typeof node !== "string") { + throw new Error("`addDependencies` files must be strings. Received:" + node); + } + + return PathNormalizer.fullNormalization(node); + } + + normalizeLayoutsObject(layouts) { + let o = {}; + for (let rawLayout in layouts) { + let layout = this.normalizeNode(rawLayout); + o[layout] = layouts[rawLayout].map((entry) => this.normalizeNode(entry)); + } + return o; + } + + getDependantsFor(node) { + if (!node) { + return []; + } + + node = this.normalizeNode(node); + + if (!this.map.hasNode(node)) { + return []; + } + + // Direct dependants and dependencies, both publish and consume from collections + return this.map.directDependantsOf(node); + } + + hasNode(node) { + return this.map.hasNode(this.normalizeNode(node)); + } + + findCollectionsRemovedFrom(node, collectionNames) { + if (!this.hasNode(node)) { + return new Set(); + } + + let prevDeps = this.getDependantsFor(node) + .map((entry) => GlobalDependencyMap.getTagName(entry)) + .filter(Boolean); + + let prevDepsSet = new Set(prevDeps); + let deleted = new Set(); + for (let dep of prevDepsSet) { + if (!collectionNames.has(dep)) { + deleted.add(dep); + } + } + + return deleted; + } + + resetNode(node) { + node = this.normalizeNode(node); + + if (!this.map.hasNode(node)) { + return; + } + + // We don’t want to remove relationships that consume this, controlled by the upstream content + // for (let dep of this.map.directDependantsOf(node)) { + // this.map.removeDependency(dep, node); + // } + + for (let dep of this.map.directDependenciesOf(node)) { + this.map.removeDependency(node, dep); + } + } + + getTemplatesThatConsumeCollections(collectionNames) { + let templates = new Set(); + for (let name of collectionNames) { + let collectionKey = GlobalDependencyMap.getCollectionKeyForEntry(name); + if (!this.map.hasNode(collectionKey)) { + continue; + } + for (let node of this.map.dependantsOf(collectionKey)) { + if (!node.startsWith(GlobalDependencyMap.COLLECTION_PREFIX)) { + if (!GlobalDependencyMap.isLayoutNode(this.map, node)) { + templates.add(node); + } + } + } + } + return templates; + } + + static isLayoutNode(graph, node) { + if (!graph.hasNode(node)) { + return false; + } + return graph.getNodeData(node)?.type === GlobalDependencyMap.LAYOUT_KEY; + } + + getLayoutsUsedBy(node) { + node = this.normalizeNode(node); + + if (!this.map.hasNode(node)) { + return []; + } + + let layouts = []; + + // include self, if layout + if (GlobalDependencyMap.isLayoutNode(this.map, node)) { + layouts.push(node); + } + + this.map.dependantsOf(node).forEach((node) => { + // we only want layouts + if (GlobalDependencyMap.isLayoutNode(this.map, node)) { + return layouts.push(node); + } + }); + + return layouts; + } + + // In order + // Does not include original templatePaths (unless *they* are second-order relevant) + getTemplatesRelevantToTemplateList(templatePaths) { + let overallOrder = this.map.overallOrder(); + overallOrder = this.filterOutLayouts(overallOrder); + overallOrder = this.filterOutCollections(overallOrder); + + let relevantLookup = {}; + for (let inputPath of templatePaths) { + inputPath = TemplatePath.stripLeadingDotSlash(inputPath); + + let deps = this.getDependencies(inputPath, false); + + if (Array.isArray(deps)) { + let paths = this.filterOutCollections(deps); + for (let node of paths) { + relevantLookup[node] = true; + } + } + } + + return overallOrder.filter((node) => { + if (relevantLookup[node]) { + return true; + } + return false; + }); + } + + // Layouts are not relevant to compile cache and can be ignored + getDependencies(node, includeLayouts = true) { + node = this.normalizeNode(node); + + // `false` means the Node was unknown + if (!this.map.hasNode(node)) { + return false; + } + + if (includeLayouts) { + return this.map.dependenciesOf(node).filter(Boolean); + } + + return GlobalDependencyMap.removeLayoutNodes(this.map, this.map.dependenciesOf(node)); + } + + #addNode(name) { + if (this.map.hasNode(name)) { + return; + } + + this.map.addNode(name); + } + + // node arguments are already normalized + #addDependency(from, toArray = []) { + this.#addNode(from); // only if not already added + + if (!Array.isArray(toArray)) { + throw new Error("Second argument to `addDependency` must be an Array."); + } + + // debug("%o depends on %o", from, toArray); + for (let to of toArray) { + this.#addNode(to); // only if not already added + if (from !== to) { + this.map.addDependency(from, to); + } + } + } + + addDependency(from, toArray = []) { + this.#addDependency( + this.normalizeNode(from), + toArray.map((to) => this.normalizeNode(to)), + ); + } + + addNewNodeRelationships(from, consumes = [], publishes = []) { + consumes = consumes.filter(Boolean); + publishes = publishes.filter(Boolean); + + debug("%o consumes %o and publishes to %o", from, consumes, publishes); + from = this.normalizeNode(from); + + this.map.addTemplate(from, consumes, publishes); + } + + // Layouts are not relevant to compile cache and can be ignored + hasDependency(from, to, includeLayouts) { + to = this.normalizeNode(to); + + let deps = this.getDependencies(from, includeLayouts); // normalizes `from` + + if (!deps) { + return false; + } + + return deps.includes(to); + } + + // Layouts are not relevant to compile cache and can be ignored + isFileRelevantTo(fullTemplateInputPath, comparisonFile, includeLayouts) { + fullTemplateInputPath = this.normalizeNode(fullTemplateInputPath); + comparisonFile = this.normalizeNode(comparisonFile); + + // No watch/serve changed file + if (!comparisonFile) { + return false; + } + + // The file that changed is the relevant file + if (fullTemplateInputPath === comparisonFile) { + return true; + } + + // The file that changed is a dependency of the template + // comparisonFile is used by fullTemplateInputPath + if (this.hasDependency(fullTemplateInputPath, comparisonFile, includeLayouts)) { + return true; + } + + return false; + } + + isFileUsedBy(parent, child, includeLayouts) { + if (this.hasDependency(parent, child, includeLayouts)) { + // child is used by parent + return true; + } + return false; + } + + getTemplateOrder() { + let order = []; + for (let entry of this.map.overallOrder()) { + order.push(entry); + } + + return order; + } + + stringify() { + return JSON.stringify(this.map, function replacer(key, value) { + // Serialize internal Map objects. + if (value instanceof Map) { + let obj = {}; + for (let [k, v] of value) { + obj[k] = v; + } + return obj; + } + + return value; + }); + } + + restore(persisted) { + let obj = JSON.parse(persisted); + let graph = new TemplateDepGraph(); + + // https://github.com/jriecken/dependency-graph/issues/44 + // Restore top level serialized Map objects (in stringify above) + for (let key in obj) { + let map = graph[key]; + for (let k in obj[key]) { + let v = obj[key][k]; + map.set(k, v); + } + } + this.map = graph; + } +} + +export default GlobalDependencyMap; diff --git a/node_modules/@11ty/eleventy/src/LayoutCache.js b/node_modules/@11ty/eleventy/src/LayoutCache.js new file mode 100644 index 00000000..006f502d --- /dev/null +++ b/node_modules/@11ty/eleventy/src/LayoutCache.js @@ -0,0 +1,98 @@ +import { TemplatePath } from "@11ty/eleventy-utils"; + +import eventBus from "./EventBus.js"; + +// Note: this is only used for TemplateLayout right now but could be used for more +// Just be careful because right now the TemplateLayout cache keys are not directly mapped to paths +// So you may get collisions if you use this for other things. +class LayoutCache { + constructor() { + this.cache = {}; + this.cacheByInputPath = {}; + } + + clear() { + this.cache = {}; + this.cacheByInputPath = {}; + } + + // alias + removeAll() { + for (let layoutFilePath in this.cacheByInputPath) { + this.remove(layoutFilePath); + } + this.clear(); + } + + size() { + return Object.keys(this.cacheByInputPath).length; + } + + add(layoutTemplate) { + let keys = new Set(); + + if (typeof layoutTemplate === "string") { + throw new Error( + "Invalid argument type passed to LayoutCache->add(). Should be a TemplateLayout.", + ); + } + + if ("getFullKey" in layoutTemplate) { + keys.add(layoutTemplate.getFullKey()); + } + + if ("getKey" in layoutTemplate) { + // if `key` was an alias, also set to the pathed layout value too + // e.g. `layout: "default"` and `layout: "default.liquid"` will both map to the same template. + keys.add(layoutTemplate.getKey()); + } + + for (let key of keys) { + this.cache[key] = layoutTemplate; + } + + // also the full template input path for use with eleventy --serve/--watch e.g. `_includes/default.liquid` (see `remove` below) + let fullPath = TemplatePath.stripLeadingDotSlash(layoutTemplate.inputPath); + this.cacheByInputPath[fullPath] = layoutTemplate; + } + + has(key) { + return key in this.cache; + } + + get(key) { + if (!this.has(key)) { + throw new Error(`Could not find ${key} in LayoutCache.`); + } + + return this.cache[key]; + } + + remove(layoutFilePath) { + layoutFilePath = TemplatePath.stripLeadingDotSlash(layoutFilePath); + if (!this.cacheByInputPath[layoutFilePath]) { + // not a layout file + return; + } + + let layoutTemplate = this.cacheByInputPath[layoutFilePath]; + layoutTemplate.resetCaches(); + + let keys = layoutTemplate.getCacheKeys(); + for (let key of keys) { + delete this.cache[key]; + } + + delete this.cacheByInputPath[layoutFilePath]; + } +} + +let layoutCache = new LayoutCache(); + +eventBus.on("eleventy.resourceModified", () => { + // https://github.com/11ty/eleventy-plugin-bundle/issues/10 + layoutCache.removeAll(); +}); + +// singleton +export default layoutCache; diff --git a/node_modules/@11ty/eleventy/src/Plugins/HtmlBasePlugin.js b/node_modules/@11ty/eleventy/src/Plugins/HtmlBasePlugin.js new file mode 100644 index 00000000..304c0a24 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Plugins/HtmlBasePlugin.js @@ -0,0 +1,160 @@ +import { DeepCopy } from "@11ty/eleventy-utils"; +import urlFilter from "../Filters/Url.js"; +import PathPrefixer from "../Util/PathPrefixer.js"; +import { HtmlTransformer } from "../Util/HtmlTransformer.js"; +import isValidUrl from "../Util/ValidUrl.js"; + +function addPathPrefixToUrl(url, pathPrefix, base) { + let u; + if (base) { + u = new URL(url, base); + } else { + u = new URL(url); + } + + // Add pathPrefix **after** url is transformed using base + if (pathPrefix) { + u.pathname = PathPrefixer.joinUrlParts(pathPrefix, u.pathname); + } + return u.toString(); +} + +// pathprefix is only used when overrideBase is a full URL +function transformUrl(url, base, opts = {}) { + let { pathPrefix, pageUrl, htmlContext } = opts; + + // Warning, this will not work with HtmlTransformer, as we’ll receive "false" (string) here instead of `false` (boolean) + if (url === false) { + throw new Error( + `Invalid url transformed in the HTML \`\` plugin.${url === false ? ` Did you attempt to link to a \`permalink: false\` page?` : ""} Received: ${url}`, + ); + } + + // full URL, return as-is + if (isValidUrl(url)) { + return url; + } + + // Not a full URL, but with a full base URL + // e.g. relative urls like "subdir/", "../subdir", "./subdir" + if (isValidUrl(base)) { + // convert relative paths to absolute path first using pageUrl + if (pageUrl && !url.startsWith("/")) { + let urlObj = new URL(url, `http://example.com${pageUrl}`); + url = urlObj.pathname + (urlObj.hash || ""); + } + + return addPathPrefixToUrl(url, pathPrefix, base); + } + + // Not a full URL, nor a full base URL (call the built-in `url` filter) + return urlFilter(url, base); +} + +function eleventyHtmlBasePlugin(eleventyConfig, defaultOptions = {}) { + let opts = DeepCopy( + { + // eleventyConfig.pathPrefix is new in Eleventy 2.0.0-canary.15 + // `base` can be a directory (for path prefix transformations) + // OR a full URL with origin and pathname + baseHref: eleventyConfig.pathPrefix, + + extensions: "html", + }, + defaultOptions, + ); + + // `filters` option to rename filters was removed in 3.0.0-alpha.13 + // Renaming these would cause issues in other plugins (e.g. RSS) + if (opts.filters !== undefined) { + throw new Error( + "The `filters` option in the HTML Base plugin was removed to prevent future cross-plugin compatibility issues.", + ); + } + + if (opts.baseHref === undefined) { + throw new Error("The `baseHref` option is required in the HTML Base plugin."); + } + + eleventyConfig.addFilter("addPathPrefixToFullUrl", function (url) { + return addPathPrefixToUrl(url, eleventyConfig.pathPrefix); + }); + + // Apply to one URL + eleventyConfig.addFilter( + "htmlBaseUrl", + + /** @this {object} */ + function (url, baseOverride, pageUrlOverride) { + let base = baseOverride || opts.baseHref; + + // Do nothing with a default base + if (base === "/") { + return url; + } + + return transformUrl(url, base, { + pathPrefix: eleventyConfig.pathPrefix, + pageUrl: pageUrlOverride || this.page?.url, + }); + }, + ); + + // Apply to a block of HTML + eleventyConfig.addAsyncFilter( + "transformWithHtmlBase", + + /** @this {object} */ + function (content, baseOverride, pageUrlOverride) { + let base = baseOverride || opts.baseHref; + + // Do nothing with a default base + if (base === "/") { + return content; + } + + return HtmlTransformer.transformStandalone(content, (url, htmlContext) => { + return transformUrl(url.trim(), base, { + pathPrefix: eleventyConfig.pathPrefix, + pageUrl: pageUrlOverride || this.page?.url, + htmlContext, + }); + }); + }, + ); + + // Apply to all HTML output in your project + eleventyConfig.htmlTransformer.addUrlTransform( + opts.extensions, + + /** @this {object} */ + function (urlInMarkup, htmlContext) { + // baseHref override is via renderTransforms filter for adding the absolute URL (e.g. https://example.com/pathPrefix/) for RSS/Atom/JSON feeds + return transformUrl(urlInMarkup.trim(), this.baseHref || opts.baseHref, { + pathPrefix: eleventyConfig.pathPrefix, + pageUrl: this.url, + htmlContext, + }); + }, + { + priority: -2, // priority is descending, so this runs last (especially after AutoCopy and InputPathToUrl transform) + enabled: function (context) { + // Enabled when pathPrefix is non-default or via renderTransforms + return Boolean(context.baseHref) || opts.baseHref !== "/"; + }, + }, + ); +} + +Object.defineProperty(eleventyHtmlBasePlugin, "eleventyPackage", { + value: "@11ty/eleventy/html-base-plugin", +}); + +Object.defineProperty(eleventyHtmlBasePlugin, "eleventyPluginOptions", { + value: { + unique: true, + }, +}); + +export default eleventyHtmlBasePlugin; +export { transformUrl as applyBaseToUrl }; diff --git a/node_modules/@11ty/eleventy/src/Plugins/HtmlRelativeCopyPlugin.js b/node_modules/@11ty/eleventy/src/Plugins/HtmlRelativeCopyPlugin.js new file mode 100644 index 00000000..ac1391dc --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Plugins/HtmlRelativeCopyPlugin.js @@ -0,0 +1,52 @@ +import { HtmlRelativeCopy } from "../Util/HtmlRelativeCopy.js"; + +// one HtmlRelativeCopy instance per entry +function init(eleventyConfig, options) { + let opts = Object.assign( + { + extensions: "html", + match: false, // can be one glob string or an array of globs + paths: [], // directories to also look in for files + failOnError: true, // fails when a path matches (via `match`) but not found on file system + copyOptions: undefined, + }, + options, + ); + + let htmlrel = new HtmlRelativeCopy(); + htmlrel.setUserConfig(eleventyConfig); + htmlrel.addMatchingGlob(opts.match); + htmlrel.setFailOnError(opts.failOnError); + htmlrel.setCopyOptions(opts.copyOptions); + + eleventyConfig.htmlTransformer.addUrlTransform( + opts.extensions, + function (targetFilepathOrUrl) { + // @ts-ignore + htmlrel.copy(targetFilepathOrUrl, this.page.inputPath, this.page.outputPath); + + // TODO front matter option for manual copy + return targetFilepathOrUrl; + }, + { + enabled: () => htmlrel.isEnabled(), + // - MUST run after other plugins but BEFORE HtmlBase plugin + priority: -1, + }, + ); + + htmlrel.addPaths(opts.paths); +} + +function HtmlRelativeCopyPlugin(eleventyConfig) { + // Important: if this is empty, no URL transforms are added + for (let options of eleventyConfig.passthroughCopiesHtmlRelative) { + init(eleventyConfig, options); + } +} + +Object.defineProperty(HtmlRelativeCopyPlugin, "eleventyPackage", { + value: "@11ty/eleventy/html-relative-copy-plugin", +}); + +export { HtmlRelativeCopyPlugin }; diff --git a/node_modules/@11ty/eleventy/src/Plugins/I18nPlugin.js b/node_modules/@11ty/eleventy/src/Plugins/I18nPlugin.js new file mode 100644 index 00000000..6f53825f --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Plugins/I18nPlugin.js @@ -0,0 +1,317 @@ +import { bcp47Normalize } from "bcp-47-normalize"; +import iso639 from "iso-639-1"; +import { DeepCopy } from "@11ty/eleventy-utils"; + +// pathPrefix note: +// When using `locale_url` filter with the `url` filter, `locale_url` must run first like +// `| locale_url | url`. If you run `| url | locale_url` it won’t match correctly. + +// TODO improvement would be to throw an error if `locale_url` finds a url with the +// path prefix at the beginning? Would need a better way to know `url` has transformed a string +// rather than just raw comparison. +// e.g. --pathprefix=/en/ should return `/en/en/` for `/en/index.liquid` + +class LangUtils { + static getLanguageCodeFromInputPath(filepath) { + return (filepath || "").split("/").find((entry) => Comparator.isLangCode(entry)); + } + + static getLanguageCodeFromUrl(url) { + let s = (url || "").split("/"); + return s.length > 0 && Comparator.isLangCode(s[1]) ? s[1] : ""; + } + + static swapLanguageCodeNoCheck(str, langCode) { + let found = false; + return str + .split("/") + .map((entry) => { + // only match the first one + if (!found && Comparator.isLangCode(entry)) { + found = true; + return langCode; + } + return entry; + }) + .join("/"); + } + + static swapLanguageCode(str, langCode) { + if (!Comparator.isLangCode(langCode)) { + return str; + } + + return LangUtils.swapLanguageCodeNoCheck(str, langCode); + } +} + +class Comparator { + // https://en.wikipedia.org/wiki/IETF_language_tag#Relation_to_other_standards + // Requires a ISO-639-1 language code at the start (2 characters before the first -) + static isLangCode(code) { + let [s] = (code || "").split("-"); + if (!iso639.validate(s)) { + return false; + } + if (!bcp47Normalize(code)) { + return false; + } + return true; + } + + static urlHasLangCode(url, code) { + if (!Comparator.isLangCode(code)) { + return false; + } + + return url.split("/").some((entry) => entry === code); + } +} + +function normalizeInputPath(inputPath, extensionMap) { + if (extensionMap) { + return extensionMap.removeTemplateExtension(inputPath); + } + return inputPath; +} + +/* + * Input: { + * '/en-us/test/': './test/stubs-i18n/en-us/test.11ty.js', + * '/en/test/': './test/stubs-i18n/en/test.liquid', + * '/es/test/': './test/stubs-i18n/es/test.njk', + * '/non-lang-file/': './test/stubs-i18n/non-lang-file.njk' + * } + * + * Output: { + * '/en-us/test/': [ { url: '/en/test/' }, { url: '/es/test/' } ], + * '/en/test/': [ { url: '/en-us/test/' }, { url: '/es/test/' } ], + * '/es/test/': [ { url: '/en-us/test/' }, { url: '/en/test/' } ] + * } + */ +function getLocaleUrlsMap(urlToInputPath, extensionMap, options = {}) { + let filemap = {}; + + for (let url in urlToInputPath) { + // Group number comes from Pagination.js + let { inputPath: originalFilepath, groupNumber } = urlToInputPath[url]; + let filepath = normalizeInputPath(originalFilepath, extensionMap); + let replaced = + LangUtils.swapLanguageCodeNoCheck(filepath, "__11ty_i18n") + `_group:${groupNumber}`; + + if (!filemap[replaced]) { + filemap[replaced] = []; + } + + let langCode = LangUtils.getLanguageCodeFromInputPath(originalFilepath); + if (!langCode) { + langCode = LangUtils.getLanguageCodeFromUrl(url); + } + if (!langCode) { + langCode = options.defaultLanguage; + } + + if (langCode) { + filemap[replaced].push({ + url, + lang: langCode, + label: iso639.getNativeName(langCode.split("-")[0]), + }); + } else { + filemap[replaced].push({ url }); + } + } + + // Default sorted by lang code + for (let key in filemap) { + filemap[key].sort(function (a, b) { + if (a.lang < b.lang) { + return -1; + } + if (a.lang > b.lang) { + return 1; + } + return 0; + }); + } + + // map of input paths => array of localized urls + let urlMap = {}; + for (let filepath in filemap) { + for (let entry of filemap[filepath]) { + let url = entry.url; + if (!urlMap[url]) { + urlMap[url] = filemap[filepath].filter((entry) => { + if (entry.lang) { + return true; + } + return entry.url !== url; + }); + } + } + } + + return urlMap; +} + +function eleventyI18nPlugin(eleventyConfig, opts = {}) { + let options = DeepCopy( + { + defaultLanguage: "", + filters: { + url: "locale_url", + links: "locale_links", + }, + errorMode: "strict", // allow-fallback, never + }, + opts, + ); + + if (!options.defaultLanguage) { + throw new Error( + "You must specify a `defaultLanguage` in Eleventy’s Internationalization (I18N) plugin.", + ); + } + + let extensionMap; + eleventyConfig.on("eleventy.extensionmap", (map) => { + extensionMap = map; + }); + + let bench = eleventyConfig.benchmarkManager.get("Aggregate"); + let contentMaps = {}; + eleventyConfig.on("eleventy.contentMap", function ({ urlToInputPath, inputPathToUrl }) { + let b = bench.get("(i18n Plugin) Setting up content map."); + b.before(); + contentMaps.inputPathToUrl = inputPathToUrl; + contentMaps.urlToInputPath = urlToInputPath; + + contentMaps.localeUrlsMap = getLocaleUrlsMap(urlToInputPath, extensionMap, options); + b.after(); + }); + + eleventyConfig.addGlobalData("eleventyComputed.page.lang", () => { + // if addGlobalData receives a function it will execute it immediately, + // so we return a nested function for computed data + return (data) => { + return LangUtils.getLanguageCodeFromUrl(data.page.url) || options.defaultLanguage; + }; + }); + + // Normalize a theoretical URL based on the current page’s language + // If a non-localized file exists, returns the URL without a language assigned + // Fails if no file exists (localized and not localized) + eleventyConfig.addFilter(options.filters.url, function (url, langCodeOverride) { + let langCode = + langCodeOverride || + LangUtils.getLanguageCodeFromUrl(this.page?.url) || + options.defaultLanguage; + + // Already has a language code on it and has a relevant url with the target language code + if ( + contentMaps.localeUrlsMap[url] || + (!url.endsWith("/") && contentMaps.localeUrlsMap[`${url}/`]) + ) { + for (let existingUrlObj of contentMaps.localeUrlsMap[url] || + contentMaps.localeUrlsMap[`${url}/`]) { + if (Comparator.urlHasLangCode(existingUrlObj.url, langCode)) { + return existingUrlObj.url; + } + } + } + + // Needs the language code prepended to the URL + let prependedLangCodeUrl = `/${langCode}${url}`; + if ( + contentMaps.localeUrlsMap[prependedLangCodeUrl] || + (!prependedLangCodeUrl.endsWith("/") && contentMaps.localeUrlsMap[`${prependedLangCodeUrl}/`]) + ) { + return prependedLangCodeUrl; + } + + if ( + contentMaps.urlToInputPath[url] || + (!url.endsWith("/") && contentMaps.urlToInputPath[`${url}/`]) + ) { + // this is not a localized file (independent of a language code) + if (options.errorMode === "strict") { + throw new Error( + `Localized file for URL ${prependedLangCodeUrl} was not found in your project. A non-localized version does exist—are you sure you meant to use the \`${options.filters.url}\` filter for this? You can bypass this error using the \`errorMode\` option in the I18N plugin (current value: "${options.errorMode}").`, + ); + } + } else if (options.errorMode === "allow-fallback") { + // You’re linking to a localized file that doesn’t exist! + throw new Error( + `Localized file for URL ${prependedLangCodeUrl} was not found in your project! You will need to add it if you want to link to it using the \`${options.filters.url}\` filter. You can bypass this error using the \`errorMode\` option in the I18N plugin (current value: "${options.errorMode}").`, + ); + } + + return url; + }); + + // Refactor to use url + // Find the links that are localized alternates to the inputPath argument + eleventyConfig.addFilter(options.filters.links, function (urlOverride) { + let url = urlOverride || this.page?.url; + return (contentMaps.localeUrlsMap[url] || []).filter((entry) => { + return entry.url !== url; + }); + }); + + // Returns a `page`-esque variable for the root default language page + // If paginated, returns first result only + eleventyConfig.addFilter( + "locale_page", // This is not exposed in `options` because it is an Eleventy internals filter (used in get*CollectionItem filters) + function (pageOverride, languageCode) { + // both args here are optional + if (!languageCode) { + languageCode = options.defaultLanguage; + } + + let page = pageOverride || this.page; + let url; // new url + if (contentMaps.localeUrlsMap[page.url]) { + for (let entry of contentMaps.localeUrlsMap[page.url]) { + if (entry.lang === languageCode) { + url = entry.url; + } + } + } + + let inputPath = LangUtils.swapLanguageCode(page.inputPath, languageCode); + + if ( + !url || + !Array.isArray(contentMaps.inputPathToUrl[inputPath]) || + contentMaps.inputPathToUrl[inputPath].length === 0 + ) { + // no internationalized pages found + return page; + } + + let result = { + // // note that the permalink/slug may be different for the localized file! + url, + inputPath, + filePathStem: LangUtils.swapLanguageCode(page.filePathStem, languageCode), + // outputPath is omitted here, not necessary for GetCollectionItem.js if url is provided + __locale_page_resolved: true, + }; + return result; + }, + ); +} + +export { Comparator, LangUtils }; + +Object.defineProperty(eleventyI18nPlugin, "eleventyPackage", { + value: "@11ty/eleventy/i18n-plugin", +}); + +Object.defineProperty(eleventyI18nPlugin, "eleventyPluginOptions", { + value: { + unique: true, + }, +}); + +export default eleventyI18nPlugin; diff --git a/node_modules/@11ty/eleventy/src/Plugins/IdAttributePlugin.js b/node_modules/@11ty/eleventy/src/Plugins/IdAttributePlugin.js new file mode 100644 index 00000000..a55a13e2 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Plugins/IdAttributePlugin.js @@ -0,0 +1,110 @@ +import matchHelper from "posthtml-match-helper"; +import { decodeHTML } from "entities"; + +import slugifyFilter from "../Filters/Slugify.js"; +import MemoizeUtil from "../Util/MemoizeFunction.js"; + +const POSTHTML_PLUGIN_NAME = "11ty/eleventy/id-attribute"; + +function getTextNodeContent(node) { + if (node.attrs?.["eleventy:id-ignore"] === "") { + delete node.attrs["eleventy:id-ignore"]; + return ""; + } + if (!node.content) { + return ""; + } + + return node.content + .map((entry) => { + if (typeof entry === "string") { + return entry; + } + if (Array.isArray(entry.content)) { + return getTextNodeContent(entry); + } + return ""; + }) + .join(""); +} + +function IdAttributePlugin(eleventyConfig, options = {}) { + if (!options.slugify) { + options.slugify = MemoizeUtil(slugifyFilter); + } + if (!options.selector) { + options.selector = "[id],h1,h2,h3,h4,h5,h6"; + } + options.decodeEntities = options.decodeEntities ?? true; + options.checkDuplicates = options.checkDuplicates ?? "error"; + + eleventyConfig.htmlTransformer.addPosthtmlPlugin( + "html", + function idAttributePosthtmlPlugin(pluginOptions = {}) { + if (typeof options.filter === "function") { + if (options.filter(pluginOptions) === false) { + return function () {}; + } + } + + return function (tree) { + // One per page + let conflictCheck = {}; + // Cache heading nodes for conflict resolution + let headingNodes = {}; + + tree.match(matchHelper(options.selector), function (node) { + if (node.attrs?.id) { + let id = node.attrs?.id; + if (conflictCheck[id]) { + conflictCheck[id]++; + if (headingNodes[id]) { + // Rename conflicting assigned heading id + let newId = `${id}-${conflictCheck[id]}`; + headingNodes[newId] = headingNodes[id]; + headingNodes[newId].attrs.id = newId; + delete headingNodes[id]; + } else if (options.checkDuplicates === "error") { + // Existing `id` conflicts with assigned heading id, throw error + throw new Error( + 'You have more than one HTML `id` attribute using the same value (id="' + + id + + '") in your template (' + + pluginOptions.page.inputPath + + "). You can disable this error in the IdAttribute plugin with the `checkDuplicates: false` option.", + ); + } + } else { + conflictCheck[id] = 1; + } + } else if (!node.attrs?.id && node.content) { + node.attrs = node.attrs || {}; + let textContent = getTextNodeContent(node); + if (options.decodeEntities) { + textContent = decodeHTML(textContent); + } + let id = options.slugify(textContent); + + if (conflictCheck[id]) { + conflictCheck[id]++; + id = `${id}-${conflictCheck[id]}`; + } else { + conflictCheck[id] = 1; + } + + headingNodes[id] = node; + node.attrs.id = id; + } + + return node; + }); + }; + }, + { + // pluginOptions + name: POSTHTML_PLUGIN_NAME, + }, + ); +} + +export { IdAttributePlugin }; diff --git a/node_modules/@11ty/eleventy/src/Plugins/InputPathToUrl.js b/node_modules/@11ty/eleventy/src/Plugins/InputPathToUrl.js new file mode 100644 index 00000000..aca148bf --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Plugins/InputPathToUrl.js @@ -0,0 +1,191 @@ +import path from "node:path"; +import { TemplatePath } from "@11ty/eleventy-utils"; +import isValidUrl from "../Util/ValidUrl.js"; + +function getValidPath(contentMap, testPath) { + // if the path is coming from Markdown, it may be encoded + let normalized = TemplatePath.addLeadingDotSlash(decodeURIComponent(testPath)); + + // it must exist in the content map to be valid + if (contentMap[normalized]) { + return normalized; + } +} + +function normalizeInputPath(targetInputPath, inputDir, sourceInputPath, contentMap) { + // inputDir is optional at the beginning of the developer supplied-path + + // Input directory already on the input path + if (TemplatePath.join(targetInputPath).startsWith(TemplatePath.join(inputDir))) { + let absolutePath = getValidPath(contentMap, targetInputPath); + if (absolutePath) { + return absolutePath; + } + } + + // Relative to project input directory + let relativeToInputDir = getValidPath(contentMap, TemplatePath.join(inputDir, targetInputPath)); + if (relativeToInputDir) { + return relativeToInputDir; + } + + if (targetInputPath && !path.isAbsolute(targetInputPath)) { + // Relative to source file’s input path + let sourceInputDir = TemplatePath.getDirFromFilePath(sourceInputPath); + let relativeToSourceFile = getValidPath( + contentMap, + TemplatePath.join(sourceInputDir, targetInputPath), + ); + if (relativeToSourceFile) { + return relativeToSourceFile; + } + } + + // the transform may have sent in a URL so we just return it as-is + return targetInputPath; +} + +function parseFilePath(filepath) { + if (filepath.startsWith("#") || filepath.startsWith("?")) { + return [filepath, ""]; + } + + try { + /* u: URL { + href: 'file:///tmpl.njk#anchor', + origin: 'null', + protocol: 'file:', + username: '', + password: '', + host: '', + hostname: '', + port: '', + pathname: '/tmpl.njk', + search: '', + searchParams: URLSearchParams {}, + hash: '#anchor' + } */ + + // Note that `node:url` -> pathToFileURL creates an absolute path, which we don’t want + // URL(`file:#anchor`) gives back a pathname of `/` + let u = new URL(`file:${filepath}`); + filepath = filepath.replace(u.search, ""); // includes ? + filepath = filepath.replace(u.hash, ""); // includes # + + return [ + // search includes ?, hash includes # + u.search + u.hash, + filepath, + ]; + } catch (e) { + return ["", filepath]; + } +} + +function FilterPlugin(eleventyConfig) { + let contentMap; + eleventyConfig.on("eleventy.contentMap", function ({ inputPathToUrl }) { + contentMap = inputPathToUrl; + }); + + eleventyConfig.addFilter("inputPathToUrl", function (targetFilePath) { + if (!contentMap) { + throw new Error("Internal error: contentMap not available for `inputPathToUrl` filter."); + } + + if (isValidUrl(targetFilePath)) { + return targetFilePath; + } + + let inputDir = eleventyConfig.directories.input; + let suffix = ""; + [suffix, targetFilePath] = parseFilePath(targetFilePath); + if (targetFilePath) { + targetFilePath = normalizeInputPath( + targetFilePath, + inputDir, + // @ts-ignore + this.page.inputPath, + contentMap, + ); + } + + let urls = contentMap[targetFilePath]; + if (!urls || urls.length === 0) { + throw new Error( + "`inputPathToUrl` filter could not find a matching target for " + targetFilePath, + ); + } + + return `${urls[0]}${suffix}`; + }); +} + +function TransformPlugin(eleventyConfig, defaultOptions = {}) { + let opts = Object.assign( + { + extensions: "html", + }, + defaultOptions, + ); + + let contentMap = null; + eleventyConfig.on("eleventy.contentMap", function ({ inputPathToUrl }) { + contentMap = inputPathToUrl; + }); + + eleventyConfig.htmlTransformer.addUrlTransform(opts.extensions, function (targetFilepathOrUrl) { + if (!contentMap) { + throw new Error("Internal error: contentMap not available for the `pathToUrl` Transform."); + } + if (isValidUrl(targetFilepathOrUrl)) { + return targetFilepathOrUrl; + } + + let inputDir = eleventyConfig.directories.input; + + let suffix = ""; + [suffix, targetFilepathOrUrl] = parseFilePath(targetFilepathOrUrl); + if (targetFilepathOrUrl) { + targetFilepathOrUrl = normalizeInputPath( + targetFilepathOrUrl, + inputDir, + // @ts-ignore + this.page.inputPath, + contentMap, + ); + } + + let urls = contentMap[targetFilepathOrUrl]; + if (!targetFilepathOrUrl || !urls || urls.length === 0) { + // fallback, transforms don’t error on missing paths (though the pathToUrl filter does) + return `${targetFilepathOrUrl}${suffix}`; + } + + return `${urls[0]}${suffix}`; + }); +} + +Object.defineProperty(FilterPlugin, "eleventyPackage", { + value: "@11ty/eleventy/inputpath-to-url-filter-plugin", +}); + +Object.defineProperty(FilterPlugin, "eleventyPluginOptions", { + value: { + unique: true, + }, +}); + +Object.defineProperty(TransformPlugin, "eleventyPackage", { + value: "@11ty/eleventy/inputpath-to-url-transform-plugin", +}); + +Object.defineProperty(TransformPlugin, "eleventyPluginOptions", { + value: { + unique: true, + }, +}); + +export default TransformPlugin; + +export { FilterPlugin, TransformPlugin }; diff --git a/node_modules/@11ty/eleventy/src/Plugins/Pagination.js b/node_modules/@11ty/eleventy/src/Plugins/Pagination.js new file mode 100644 index 00000000..8e5b1ded --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Plugins/Pagination.js @@ -0,0 +1,379 @@ +import { isPlainObject } from "@11ty/eleventy-utils"; +import lodash from "@11ty/lodash-custom"; +import { DeepCopy } from "@11ty/eleventy-utils"; + +import EleventyBaseError from "../Errors/EleventyBaseError.js"; +import { ProxyWrap } from "../Util/Objects/ProxyWrap.js"; +// import { DeepFreeze } from "../Util/Objects/DeepFreeze.js"; +import TemplateData from "../Data/TemplateData.js"; + +const { set: lodashSet, get: lodashGet, chunk: lodashChunk } = lodash; + +class PaginationConfigError extends EleventyBaseError {} +class PaginationError extends EleventyBaseError {} + +class Pagination { + constructor(tmpl, data, config) { + if (!config) { + throw new PaginationConfigError("Expected `config` argument to Pagination class."); + } + + this.config = config; + + this.setTemplate(tmpl); + this.setData(data); + } + + get inputPathForErrorMessages() { + if (this.template) { + return ` (${this.template.inputPath})`; + } + return ""; + } + + static hasPagination(data) { + return "pagination" in data; + } + + hasPagination() { + if (!this.data) { + throw new Error( + `Missing \`setData\` call for Pagination object${this.inputPathForErrorMessages}`, + ); + } + return Pagination.hasPagination(this.data); + } + + circularReferenceCheck(data) { + let key = data.pagination.data; + let includedTags = TemplateData.getIncludedTagNames(data); + + for (let tag of includedTags) { + if (`collections.${tag}` === key) { + throw new PaginationError( + `Pagination circular reference${this.inputPathForErrorMessages}, data:\`${key}\` iterates over both the \`${tag}\` collection and also supplies pages to that collection.`, + ); + } + } + } + + setData(data) { + this.data = data || {}; + this.target = []; + + if (!this.hasPagination()) { + return; + } + + if (!data.pagination) { + throw new Error( + `Misconfigured pagination data in template front matter${this.inputPathForErrorMessages} (YAML front matter precaution: did you use tabs and not spaces for indentation?).`, + ); + } else if (!("size" in data.pagination)) { + throw new Error( + `Missing pagination size in front matter data${this.inputPathForErrorMessages}`, + ); + } + this.circularReferenceCheck(data); + + this.size = data.pagination.size; + this.alias = data.pagination.alias; + this.fullDataSet = this._get(this.data, this._getDataKey()); + // this returns an array + this.target = this._resolveItems(); + this.chunkedItems = this.pagedItems; + } + + setTemplate(tmpl) { + this.template = tmpl; + } + + _getDataKey() { + return this.data.pagination.data; + } + + shouldResolveDataToObjectValues() { + if ("resolve" in this.data.pagination) { + return this.data.pagination.resolve === "values"; + } + return false; + } + + isFiltered(value) { + if ("filter" in this.data.pagination) { + let filtered = this.data.pagination.filter; + if (Array.isArray(filtered)) { + return filtered.indexOf(value) > -1; + } + + return filtered === value; + } + + return false; + } + + _has(target, key) { + let notFoundValue = "__NOT_FOUND_ERROR__"; + let data = lodashGet(target, key, notFoundValue); + return data !== notFoundValue; + } + + _get(target, key) { + let notFoundValue = "__NOT_FOUND_ERROR__"; + let data = lodashGet(target, key, notFoundValue); + if (data === notFoundValue) { + throw new Error( + `Could not find pagination data${this.inputPathForErrorMessages}, went looking for: ${key}`, + ); + } + return data; + } + + _resolveItems() { + let keys; + if (Array.isArray(this.fullDataSet)) { + keys = this.fullDataSet; + this.paginationTargetType = "array"; + } else if (isPlainObject(this.fullDataSet)) { + this.paginationTargetType = "object"; + if (this.shouldResolveDataToObjectValues()) { + keys = Object.values(this.fullDataSet); + } else { + keys = Object.keys(this.fullDataSet); + } + } else { + throw new Error( + `Unexpected data found in pagination target${this.inputPathForErrorMessages}: expected an Array or an Object.`, + ); + } + + // keys must be an array + let result = keys.slice(); + + if (this.data.pagination.before && typeof this.data.pagination.before === "function") { + // we don’t need to make a copy of this because we .slice() above to create a new copy + let fns = {}; + if (this.config) { + fns = this.config.javascriptFunctions; + } + result = this.data.pagination.before.call(fns, result, this.data); + } + + if (this.data.pagination.reverse === true) { + result = result.reverse(); + } + + if (this.data.pagination.filter) { + result = result.filter((value) => !this.isFiltered(value)); + } + + return result; + } + + get pagedItems() { + if (!this.data) { + throw new Error( + `Missing \`setData\` call for Pagination object${this.inputPathForErrorMessages}`, + ); + } + + const chunks = lodashChunk(this.target, this.size); + if (this.data.pagination?.generatePageOnEmptyData) { + return chunks.length ? chunks : [[]]; + } else { + return chunks; + } + } + + getPageCount() { + if (!this.hasPagination()) { + return 0; + } + + return this.chunkedItems.length; + } + + getNormalizedItems(pageItems) { + return this.size === 1 ? pageItems[0] : pageItems; + } + + getOverrideDataPages(items, pageNumber) { + return { + // See Issue #345 for more examples + page: { + previous: pageNumber > 0 ? this.getNormalizedItems(items[pageNumber - 1]) : null, + next: pageNumber < items.length - 1 ? this.getNormalizedItems(items[pageNumber + 1]) : null, + first: items.length ? this.getNormalizedItems(items[0]) : null, + last: items.length ? this.getNormalizedItems(items[items.length - 1]) : null, + }, + + pageNumber, + }; + } + + getOverrideDataLinks(pageNumber, templateCount, links) { + let obj = {}; + + // links are okay but hrefs are better + obj.previousPageLink = pageNumber > 0 ? links[pageNumber - 1] : null; + obj.previous = obj.previousPageLink; + + obj.nextPageLink = pageNumber < templateCount - 1 ? links[pageNumber + 1] : null; + obj.next = obj.nextPageLink; + + obj.firstPageLink = links.length > 0 ? links[0] : null; + obj.lastPageLink = links.length > 0 ? links[links.length - 1] : null; + + obj.links = links; + // todo deprecated, consistency with collections and use links instead + obj.pageLinks = links; + return obj; + } + + getOverrideDataHrefs(pageNumber, templateCount, hrefs) { + let obj = {}; + + // hrefs are better than links + obj.previousPageHref = pageNumber > 0 ? hrefs[pageNumber - 1] : null; + obj.nextPageHref = pageNumber < templateCount - 1 ? hrefs[pageNumber + 1] : null; + + obj.firstPageHref = hrefs.length > 0 ? hrefs[0] : null; + obj.lastPageHref = hrefs.length > 0 ? hrefs[hrefs.length - 1] : null; + + obj.hrefs = hrefs; + + // better names + obj.href = { + previous: obj.previousPageHref, + next: obj.nextPageHref, + first: obj.firstPageHref, + last: obj.lastPageHref, + }; + + return obj; + } + + async getPageTemplates() { + if (!this.data) { + throw new Error( + `Missing \`setData\` call for Pagination object${this.inputPathForErrorMessages}`, + ); + } + + if (!this.hasPagination()) { + return []; + } + + let entries = []; + let items = this.chunkedItems; + let pages = this.size === 1 ? items.map((entry) => entry[0]) : items; + + let links = []; + let hrefs = []; + + let hasPermalinkField = + Boolean(this.data[this.config.keys.permalink]) || + Boolean(this.data.eleventyComputed?.[this.config.keys.permalink]); + + // Do *not* pass collections through DeepCopy, we’ll re-add them back in later. + let collections = this.data.collections; + if (collections) { + delete this.data.collections; + } + + let parentData = DeepCopy( + { + pagination: { + data: this.data.pagination.data, + size: this.data.pagination.size, + alias: this.alias, + pages, + }, + }, + this.data, + ); + + // Restore skipped collections + if (collections) { + this.data.collections = collections; + // Keep the original reference to the collections, no deep copy!! + parentData.collections = collections; + } + + // TODO this does work fine but let’s wait on enabling it. + // DeepFreeze(parentData, ["collections"]); + + // TODO future improvement dea: use a light Template wrapper for paged template clones (PagedTemplate?) + // so that we don’t have the memory cost of the full template (and can reuse the parent + // template for some things) + + let indices = new Set(); + for (let j = 0; j <= items.length - 1; j++) { + indices.add(j); + } + + for (let pageNumber of indices) { + let cloned = await this.template.clone(); + + if (pageNumber > 0 && !hasPermalinkField) { + cloned.setExtraOutputSubdirectory(pageNumber); + } + + let paginationData = { + pagination: { + items: items[pageNumber], + }, + page: {}, + }; + Object.assign(paginationData.pagination, this.getOverrideDataPages(items, pageNumber)); + + if (this.alias) { + lodashSet(paginationData, this.alias, this.getNormalizedItems(items[pageNumber])); + } + + // Do *not* deep merge pagination data! See https://github.com/11ty/eleventy/issues/147#issuecomment-440802454 + let clonedData = ProxyWrap(paginationData, parentData); + + // Previous method: + // let clonedData = DeepCopy(paginationData, parentData); + + let { /*linkInstance,*/ rawPath, path, href } = await cloned.getOutputLocations(clonedData); + // TODO subdirectory to links if the site doesn’t live at / + if (rawPath) { + links.push("/" + rawPath); + } + + hrefs.push(href); + + // page.url and page.outputPath are used to avoid another getOutputLocations call later, see Template->addComputedData + clonedData.page.url = href; + clonedData.page.outputPath = path; + + entries.push({ + pageNumber, + + // This is used by i18n Plugin to allow subgroups of nested pagination to be separate + groupNumber: items[pageNumber]?.[0]?.eleventyPaginationGroupNumber, + + template: cloned, + data: clonedData, + }); + } + + // we loop twice to pass in the appropriate prev/next links (already full generated now) + let index = 0; + for (let pageEntry of entries) { + let linksObj = this.getOverrideDataLinks(index, items.length, links); + + Object.assign(pageEntry.data.pagination, linksObj); + + let hrefsObj = this.getOverrideDataHrefs(index, items.length, hrefs); + Object.assign(pageEntry.data.pagination, hrefsObj); + index++; + } + + return entries; + } +} + +export default Pagination; diff --git a/node_modules/@11ty/eleventy/src/Plugins/RenderPlugin.js b/node_modules/@11ty/eleventy/src/Plugins/RenderPlugin.js new file mode 100644 index 00000000..974b0e1d --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Plugins/RenderPlugin.js @@ -0,0 +1,520 @@ +import fs from "node:fs"; +import { Merge, TemplatePath, isPlainObject } from "@11ty/eleventy-utils"; +import { evalToken } from "liquidjs"; + +// TODO add a first-class Markdown component to expose this using Markdown-only syntax (will need to be synchronous for markdown-it) + +import { ProxyWrap } from "../Util/Objects/ProxyWrap.js"; +import TemplateDataInitialGlobalData from "../Data/TemplateDataInitialGlobalData.js"; +import EleventyBaseError from "../Errors/EleventyBaseError.js"; +import TemplateRender from "../TemplateRender.js"; +import ProjectDirectories from "../Util/ProjectDirectories.js"; +import TemplateConfig from "../TemplateConfig.js"; +import EleventyExtensionMap from "../EleventyExtensionMap.js"; +import TemplateEngineManager from "../Engines/TemplateEngineManager.js"; +import Liquid from "../Engines/Liquid.js"; + +class EleventyNunjucksError extends EleventyBaseError {} + +/** @this {object} */ +async function compile(content, templateLang, options = {}) { + let { templateConfig, extensionMap } = options; + let strictMode = options.strictMode ?? false; + + if (!templateConfig) { + templateConfig = new TemplateConfig(null, false); + templateConfig.setDirectories(new ProjectDirectories()); + await templateConfig.init(); + } + + // Breaking change in 2.0+, previous default was `html` and now we default to the page template syntax + if (!templateLang) { + templateLang = this.page.templateSyntax; + } + + if (!extensionMap) { + if (strictMode) { + throw new Error("Internal error: missing `extensionMap` in RenderPlugin->compile."); + } + extensionMap = new EleventyExtensionMap(templateConfig); + extensionMap.engineManager = new TemplateEngineManager(templateConfig); + } + let tr = new TemplateRender(templateLang, templateConfig); + tr.extensionMap = extensionMap; + + if (templateLang) { + await tr.setEngineOverride(templateLang); + } else { + await tr.init(); + } + + // TODO tie this to the class, not the extension + if ( + tr.engine.name === "11ty.js" || + tr.engine.name === "11ty.cjs" || + tr.engine.name === "11ty.mjs" + ) { + throw new Error( + "11ty.js is not yet supported as a template engine for `renderTemplate`. Use `renderFile` instead!", + ); + } + + return tr.getCompiledTemplate(content); +} + +// No templateLang default, it should infer from the inputPath. +async function compileFile(inputPath, options = {}, templateLang) { + let { templateConfig, extensionMap, config } = options; + let strictMode = options.strictMode ?? false; + if (!inputPath) { + throw new Error("Missing file path argument passed to the `renderFile` shortcode."); + } + + let wasTemplateConfigMissing = false; + if (!templateConfig) { + templateConfig = new TemplateConfig(null, false); + templateConfig.setDirectories(new ProjectDirectories()); + wasTemplateConfigMissing = true; + } + if (config && typeof config === "function") { + await config(templateConfig.userConfig); + } + if (wasTemplateConfigMissing) { + await templateConfig.init(); + } + + let normalizedPath = TemplatePath.normalizeOperatingSystemFilePath(inputPath); + // Prefer the exists cache, if it’s available + if (!templateConfig.existsCache.exists(normalizedPath)) { + throw new Error( + "Could not find render plugin file for the `renderFile` shortcode, looking for: " + inputPath, + ); + } + + if (!extensionMap) { + if (strictMode) { + throw new Error("Internal error: missing `extensionMap` in RenderPlugin->compileFile."); + } + + extensionMap = new EleventyExtensionMap(templateConfig); + extensionMap.engineManager = new TemplateEngineManager(templateConfig); + } + let tr = new TemplateRender(inputPath, templateConfig); + tr.extensionMap = extensionMap; + + if (templateLang) { + await tr.setEngineOverride(templateLang); + } else { + await tr.init(); + } + + if (!tr.engine.needsToReadFileContents()) { + return tr.getCompiledTemplate(null); + } + + // TODO we could make this work with full templates (with front matter?) + let content = fs.readFileSync(inputPath, "utf8"); + return tr.getCompiledTemplate(content); +} + +/** @this {object} */ +async function renderShortcodeFn(fn, data) { + if (fn === undefined) { + return; + } else if (typeof fn !== "function") { + throw new Error(`The \`compile\` function did not return a function. Received ${fn}`); + } + + // if the user passes a string or other literal, remap to an object. + if (!isPlainObject(data)) { + data = { + _: data, + }; + } + + if ("data" in this && isPlainObject(this.data)) { + // when options.accessGlobalData is true, this allows the global data + // to be accessed inside of the shortcode as a fallback + + data = ProxyWrap(data, this.data); + } else { + // save `page` and `eleventy` for reuse + data.page = this.page; + data.eleventy = this.eleventy; + } + + return fn(data); +} + +/** + * @module 11ty/eleventy/Plugins/RenderPlugin + */ + +/** + * A plugin to add shortcodes to render an Eleventy template + * string (or file) inside of another template. {@link https://v3.11ty.dev/docs/plugins/render/} + * + * @since 1.0.0 + * @param {module:11ty/eleventy/UserConfig} eleventyConfig - User-land configuration instance. + * @param {object} options - Plugin options + */ +function eleventyRenderPlugin(eleventyConfig, options = {}) { + let templateConfig; + eleventyConfig.on("eleventy.config", (tmplConfigInstance) => { + templateConfig = tmplConfigInstance; + }); + + let extensionMap; + eleventyConfig.on("eleventy.extensionmap", (map) => { + extensionMap = map; + }); + + /** + * @typedef {object} options + * @property {string} [tagName] - The shortcode name to render a template string. + * @property {string} [tagNameFile] - The shortcode name to render a template file. + * @property {module:11ty/eleventy/TemplateConfig} [templateConfig] - Configuration object + * @property {boolean} [accessGlobalData] - Whether or not the template has access to the page’s data. + */ + let defaultOptions = { + tagName: "renderTemplate", + tagNameFile: "renderFile", + filterName: "renderContent", + templateConfig: null, + accessGlobalData: false, + }; + let opts = Object.assign(defaultOptions, options); + + function liquidTemplateTag(liquidEngine, tagName) { + // via https://github.com/harttle/liquidjs/blob/b5a22fa0910c708fe7881ef170ed44d3594e18f3/src/builtin/tags/raw.ts + return { + parse: function (tagToken, remainTokens) { + this.name = tagToken.name; + + if (eleventyConfig.liquid.parameterParsing === "builtin") { + this.orderedArgs = Liquid.parseArgumentsBuiltin(tagToken.args); + // note that Liquid does have a Hash class for name-based argument parsing but offers no easy to support both modes in one class + } else { + this.legacyArgs = tagToken.args; + } + + this.tokens = []; + + var stream = liquidEngine.parser + .parseStream(remainTokens) + .on("token", (token) => { + if (token.name === "end" + tagName) stream.stop(); + else this.tokens.push(token); + }) + .on("end", () => { + throw new Error(`tag ${tagToken.getText()} not closed`); + }); + + stream.start(); + }, + render: function* (ctx) { + let normalizedContext = {}; + if (ctx) { + if (opts.accessGlobalData) { + // parent template data cascade + normalizedContext.data = ctx.getAll(); + } + + normalizedContext.page = ctx.get(["page"]); + normalizedContext.eleventy = ctx.get(["eleventy"]); + } + + let argArray = []; + if (this.legacyArgs) { + let rawArgs = Liquid.parseArguments(null, this.legacyArgs); + for (let arg of rawArgs) { + let b = yield liquidEngine.evalValue(arg, ctx); + argArray.push(b); + } + } else if (this.orderedArgs) { + for (let arg of this.orderedArgs) { + let b = yield evalToken(arg, ctx); + argArray.push(b); + } + } + + // plaintext paired shortcode content + let body = this.tokens.map((token) => token.getText()).join(""); + + let ret = _renderStringShortcodeFn.call( + normalizedContext, + body, + // templateLang, data + ...argArray, + ); + yield ret; + return ret; + }, + }; + } + + // TODO I don’t think this works with whitespace control, e.g. {%- endrenderTemplate %} + function nunjucksTemplateTag(NunjucksLib, tagName) { + return new (function () { + this.tags = [tagName]; + + this.parse = function (parser, nodes) { + var tok = parser.nextToken(); + + var args = parser.parseSignature(true, true); + const begun = parser.advanceAfterBlockEnd(tok.value); + + // This code was ripped from the Nunjucks parser for `raw` + // https://github.com/mozilla/nunjucks/blob/fd500902d7c88672470c87170796de52fc0f791a/nunjucks/src/parser.js#L655 + const endTagName = "end" + tagName; + // Look for upcoming raw blocks (ignore all other kinds of blocks) + const rawBlockRegex = new RegExp( + "([\\s\\S]*?){%\\s*(" + tagName + "|" + endTagName + ")\\s*(?=%})%}", + ); + let rawLevel = 1; + let str = ""; + let matches = null; + + // Exit when there's nothing to match + // or when we've found the matching "endraw" block + while ((matches = parser.tokens._extractRegex(rawBlockRegex)) && rawLevel > 0) { + const all = matches[0]; + const pre = matches[1]; + const blockName = matches[2]; + + // Adjust rawlevel + if (blockName === tagName) { + rawLevel += 1; + } else if (blockName === endTagName) { + rawLevel -= 1; + } + + // Add to str + if (rawLevel === 0) { + // We want to exclude the last "endraw" + str += pre; + // Move tokenizer to beginning of endraw block + parser.tokens.backN(all.length - pre.length); + } else { + str += all; + } + } + + let body = new nodes.Output(begun.lineno, begun.colno, [ + new nodes.TemplateData(begun.lineno, begun.colno, str), + ]); + return new nodes.CallExtensionAsync(this, "run", args, [body]); + }; + + this.run = function (...args) { + let resolve = args.pop(); + let body = args.pop(); + let [context, ...argArray] = args; + + let normalizedContext = {}; + if (context.ctx?.page) { + normalizedContext.ctx = context.ctx; + + // TODO .data + // if(opts.accessGlobalData) { + // normalizedContext.data = context.ctx; + // } + + normalizedContext.page = context.ctx.page; + normalizedContext.eleventy = context.ctx.eleventy; + } + + body(function (e, bodyContent) { + if (e) { + resolve( + new EleventyNunjucksError(`Error with Nunjucks paired shortcode \`${tagName}\``, e), + ); + } + + Promise.resolve( + _renderStringShortcodeFn.call( + normalizedContext, + bodyContent, + // templateLang, data + ...argArray, + ), + ).then( + function (returnValue) { + resolve(null, new NunjucksLib.runtime.SafeString(returnValue)); + }, + function (e) { + resolve( + new EleventyNunjucksError(`Error with Nunjucks paired shortcode \`${tagName}\``, e), + null, + ); + }, + ); + }); + }; + })(); + } + + /** @this {object} */ + async function _renderStringShortcodeFn(content, templateLang, data = {}) { + // Default is fn(content, templateLang, data) but we want to support fn(content, data) too + if (typeof templateLang !== "string") { + data = templateLang; + templateLang = false; + } + + // TODO Render plugin `templateLang` is feeding bad input paths to the addDependencies call in Custom.js + let fn = await compile.call(this, content, templateLang, { + templateConfig: opts.templateConfig || templateConfig, + extensionMap, + }); + + return renderShortcodeFn.call(this, fn, data); + } + + /** @this {object} */ + async function _renderFileShortcodeFn(inputPath, data = {}, templateLang) { + let options = { + templateConfig: opts.templateConfig || templateConfig, + extensionMap, + }; + + let fn = await compileFile.call(this, inputPath, options, templateLang); + + return renderShortcodeFn.call(this, fn, data); + } + + // Render strings + if (opts.tagName) { + // use falsy to opt-out + eleventyConfig.addJavaScriptFunction(opts.tagName, _renderStringShortcodeFn); + + eleventyConfig.addLiquidTag(opts.tagName, function (liquidEngine) { + return liquidTemplateTag(liquidEngine, opts.tagName); + }); + + eleventyConfig.addNunjucksTag(opts.tagName, function (nunjucksLib) { + return nunjucksTemplateTag(nunjucksLib, opts.tagName); + }); + } + + // Filter for rendering strings + if (opts.filterName) { + eleventyConfig.addAsyncFilter(opts.filterName, _renderStringShortcodeFn); + } + + // Render File + // use `false` to opt-out + if (opts.tagNameFile) { + eleventyConfig.addAsyncShortcode(opts.tagNameFile, _renderFileShortcodeFn); + } +} + +// Will re-use the same configuration instance both at a top level and across any nested renders +class RenderManager { + /** @type {Promise|undefined} */ + #hasConfigInitialized; + #extensionMap; + #templateConfig; + + constructor() { + this.templateConfig = new TemplateConfig(null, false); + this.templateConfig.setDirectories(new ProjectDirectories()); + } + + get templateConfig() { + return this.#templateConfig; + } + + set templateConfig(templateConfig) { + if (!templateConfig || templateConfig === this.#templateConfig) { + return; + } + + this.#templateConfig = templateConfig; + + // This is the only plugin running on the Edge + this.#templateConfig.userConfig.addPlugin(eleventyRenderPlugin, { + templateConfig: this.#templateConfig, + accessGlobalData: true, + }); + + this.#extensionMap = new EleventyExtensionMap(this.#templateConfig); + this.#extensionMap.engineManager = new TemplateEngineManager(this.#templateConfig); + } + + async init() { + if (this.#hasConfigInitialized) { + return this.#hasConfigInitialized; + } + if (this.templateConfig.hasInitialized()) { + return true; + } + this.#hasConfigInitialized = this.templateConfig.init(); + await this.#hasConfigInitialized; + + return true; + } + + // `callback` is async-friendly but requires await upstream + config(callback) { + // run an extra `function(eleventyConfig)` configuration callbacks + if (callback && typeof callback === "function") { + return callback(this.templateConfig.userConfig); + } + } + + get initialGlobalData() { + if (!this._data) { + this._data = new TemplateDataInitialGlobalData(this.templateConfig); + } + return this._data; + } + + // because we don’t have access to the full data cascade—but + // we still want configuration data added via `addGlobalData` + async getData(...data) { + await this.init(); + + let globalData = await this.initialGlobalData.getData(); + let merged = Merge({}, globalData, ...data); + return merged; + } + + async compile(content, templateLang, options = {}) { + await this.init(); + + options.templateConfig = this.templateConfig; + options.extensionMap = this.#extensionMap; + options.strictMode = true; + + // We don’t need `compile.call(this)` here because the Edge always uses "liquid" as the template lang (instead of relying on this.page.templateSyntax) + // returns promise + return compile(content, templateLang, options); + } + + async render(fn, edgeData, buildTimeData) { + await this.init(); + + let mergedData = await this.getData(edgeData); + // Set .data for options.accessGlobalData feature + let context = { + data: mergedData, + }; + + return renderShortcodeFn.call(context, fn, buildTimeData); + } +} + +Object.defineProperty(eleventyRenderPlugin, "eleventyPackage", { + value: "@11ty/eleventy/render-plugin", +}); + +Object.defineProperty(eleventyRenderPlugin, "eleventyPluginOptions", { + value: { + unique: true, + }, +}); + +export default eleventyRenderPlugin; + +export { compileFile as File, compile as String, RenderManager }; diff --git a/node_modules/@11ty/eleventy/src/Template.js b/node_modules/@11ty/eleventy/src/Template.js new file mode 100644 index 00000000..64c47095 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Template.js @@ -0,0 +1,1200 @@ +import util from "node:util"; +import os from "node:os"; +import path from "node:path"; +import fs from "node:fs"; + +import lodash from "@11ty/lodash-custom"; +import { DateTime } from "luxon"; +import { TemplatePath, isPlainObject } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; +import chalk from "kleur"; + +import ConsoleLogger from "./Util/ConsoleLogger.js"; +import getDateFromGitLastUpdated from "./Util/DateGitLastUpdated.js"; +import getDateFromGitFirstAdded from "./Util/DateGitFirstAdded.js"; +import TemplateData from "./Data/TemplateData.js"; +import TemplateContent from "./TemplateContent.js"; +import TemplatePermalink from "./TemplatePermalink.js"; +import TemplateLayout from "./TemplateLayout.js"; +import TemplateFileSlug from "./TemplateFileSlug.js"; +import ComputedData from "./Data/ComputedData.js"; +import Pagination from "./Plugins/Pagination.js"; +import TemplateBehavior from "./TemplateBehavior.js"; +import TemplateContentPrematureUseError from "./Errors/TemplateContentPrematureUseError.js"; +import TemplateContentUnrenderedTemplateError from "./Errors/TemplateContentUnrenderedTemplateError.js"; +import EleventyBaseError from "./Errors/EleventyBaseError.js"; +import ReservedData from "./Util/ReservedData.js"; +import TransformsUtil from "./Util/TransformsUtil.js"; +import { FileSystemManager } from "./Util/FileSystemManager.js"; + +const { set: lodashSet, get: lodashGet } = lodash; +const fsStat = util.promisify(fs.stat); + +const debug = debugUtil("Eleventy:Template"); +const debugDev = debugUtil("Dev:Eleventy:Template"); + +class Template extends TemplateContent { + #logger; + #fsManager; + + constructor(templatePath, templateData, extensionMap, config) { + debugDev("new Template(%o)", templatePath); + super(templatePath, config); + + this.parsed = path.parse(templatePath); + + // for pagination + this.extraOutputSubdirectory = ""; + + this.extensionMap = extensionMap; + this.templateData = templateData; + this.#initFileSlug(); + + this.linters = []; + this.transforms = {}; + + this.isVerbose = true; + this.isDryRun = false; + this.writeCount = 0; + + this.fileSlug = new TemplateFileSlug(this.inputPath, this.extensionMap, this.eleventyConfig); + this.fileSlugStr = this.fileSlug.getSlug(); + this.filePathStem = this.fileSlug.getFullPathWithoutExtension(); + + this.outputFormat = "fs"; + + this.behavior = new TemplateBehavior(this.config); + this.behavior.setOutputFormat(this.outputFormat); + } + + #initFileSlug() { + this.fileSlug = new TemplateFileSlug(this.inputPath, this.extensionMap, this.eleventyConfig); + this.fileSlugStr = this.fileSlug.getSlug(); + this.filePathStem = this.fileSlug.getFullPathWithoutExtension(); + } + + /* mimic constructor arg order */ + resetCachedTemplate({ templateData, extensionMap, eleventyConfig }) { + super.resetCachedTemplate({ eleventyConfig }); + this.templateData = templateData; + this.extensionMap = extensionMap; + // this.#fsManager = undefined; + this.#initFileSlug(); + } + + get fsManager() { + if (!this.#fsManager) { + this.#fsManager = new FileSystemManager(this.eleventyConfig); + } + return this.#fsManager; + } + + get logger() { + if (!this.#logger) { + this.#logger = new ConsoleLogger(); + this.#logger.isVerbose = this.isVerbose; + } + return this.#logger; + } + + /* Setter for Logger */ + set logger(logger) { + this.#logger = logger; + } + + isRenderable() { + return this.behavior.isRenderable(); + } + + isRenderableDisabled() { + return this.behavior.isRenderableDisabled(); + } + + isRenderableOptional() { + // A template that is lazily rendered once if used by a second order dependency of another template dependency. + // e.g. You change firstpost.md, which is used by feed.xml, but secondpost.md (also used by feed.xml) + // has not yet rendered and needs to be rendered once to populate the cache. + return this.behavior.isRenderableOptional(); + } + + setRenderableOverride(renderableOverride) { + this.behavior.setRenderableOverride(renderableOverride); + } + + reset() { + this.renderCount = 0; + this.writeCount = 0; + } + + resetCaches(types) { + types = this.getResetTypes(types); + + super.resetCaches(types); + + if (types.data) { + delete this._dataCache; + // delete this._usePermalinkRoot; + // delete this._stats; + } + + if (types.render) { + delete this._cacheRenderedPromise; + delete this._cacheRenderedTransformsAndLayoutsPromise; + } + } + + setOutputFormat(to) { + this.outputFormat = to; + this.behavior.setOutputFormat(to); + } + + setIsVerbose(isVerbose) { + this.isVerbose = isVerbose; + this.logger.isVerbose = isVerbose; + } + + setDryRunViaIncremental(isIncremental) { + this.isDryRun = isIncremental; + this.isIncremental = isIncremental; + } + + setDryRun(isDryRun) { + this.isDryRun = !!isDryRun; + } + + setExtraOutputSubdirectory(dir) { + this.extraOutputSubdirectory = dir + "/"; + } + + getTemplateSubfolder() { + let dir = TemplatePath.absolutePath(this.parsed.dir); + let inputDir = TemplatePath.absolutePath(this.inputDir); + return TemplatePath.stripLeadingSubPath(dir, inputDir); + } + + templateUsesLayouts(pageData) { + if (this.hasTemplateRender()) { + return pageData?.[this.config.keys.layout] && this.templateRender.engine.useLayouts(); + } + + // If `layout` prop is set, default to true when engine is unknown + return Boolean(pageData?.[this.config.keys.layout]); + } + + getLayout(layoutKey) { + // already cached downstream in TemplateLayout -> TemplateCache + try { + return TemplateLayout.getTemplate(layoutKey, this.eleventyConfig, this.extensionMap); + } catch (e) { + throw new EleventyBaseError( + `Problem creating an Eleventy Layout for the "${this.inputPath}" template file.`, + e, + ); + } + } + + get baseFile() { + return this.extensionMap.removeTemplateExtension(this.parsed.base); + } + + async _getRawPermalinkInstance(permalinkValue) { + let perm = new TemplatePermalink(permalinkValue, this.extraOutputSubdirectory); + perm.setUrlTransforms(this.config.urlTransforms); + + this.behavior.setFromPermalink(perm); + + return perm; + } + + async _getLink(data) { + if (!data) { + throw new Error("Internal error: data argument missing in Template->_getLink"); + } + + let permalink = + data[this.config.keys.permalink] ?? + data?.[this.config.keys.computed]?.[this.config.keys.permalink]; + let permalinkValue; + + // `permalink: false` means render but no file system write, e.g. use in collections only) + // `permalink: true` throws an error + if (typeof permalink === "boolean") { + debugDev("Using boolean permalink %o", permalink); + permalinkValue = permalink; + } else if (permalink && (!this.config.dynamicPermalinks || data.dynamicPermalink === false)) { + debugDev("Not using dynamic permalinks, using %o", permalink); + permalinkValue = permalink; + } else if (isPlainObject(permalink)) { + // Empty permalink {} object should act as if no permalink was set at all + // and inherit the default behavior + let isEmptyObject = Object.keys(permalink).length === 0; + if (!isEmptyObject) { + let promises = []; + let keys = []; + for (let key in permalink) { + keys.push(key); + if (key !== "build" && Array.isArray(permalink[key])) { + promises.push( + Promise.all([...permalink[key]].map((entry) => super.renderPermalink(entry, data))), + ); + } else { + promises.push(super.renderPermalink(permalink[key], data)); + } + } + + let results = await Promise.all(promises); + + permalinkValue = {}; + for (let j = 0, k = keys.length; j < k; j++) { + let key = keys[j]; + permalinkValue[key] = results[j]; + debug( + "Rendering permalink.%o for %o: %s becomes %o", + key, + this.inputPath, + permalink[key], + results[j], + ); + } + } + } else if (permalink) { + // render variables inside permalink front matter, bypass markdown + permalinkValue = await super.renderPermalink(permalink, data); + debug("Rendering permalink for %o: %s becomes %o", this.inputPath, permalink, permalinkValue); + debugDev("Permalink rendered with data: %o", data); + } + + // Override default permalink behavior. Only do this if permalink was _not_ in the data cascade + if (!permalink && this.config.dynamicPermalinks && data.dynamicPermalink !== false) { + let tr = await this.getTemplateRender(); + let permalinkCompilation = tr.engine.permalinkNeedsCompilation(""); + if (typeof permalinkCompilation === "function") { + let ret = await this._renderFunction(permalinkCompilation, permalinkValue, this.inputPath); + if (ret !== undefined) { + if (typeof ret === "function") { + // function + permalinkValue = await this._renderFunction(ret, data); + } else { + // scalar + permalinkValue = ret; + } + } + } + } + + if (permalinkValue !== undefined) { + return this._getRawPermalinkInstance(permalinkValue); + } + + // No `permalink` specified in data cascade, do the default + let p = TemplatePermalink.generate( + this.getTemplateSubfolder(), + this.baseFile, + this.extraOutputSubdirectory, + this.engine.defaultTemplateFileExtension, + ); + p.setUrlTransforms(this.config.urlTransforms); + return p; + } + + async usePermalinkRoot() { + // @cachedproperty + if (this._usePermalinkRoot === undefined) { + // TODO this only works with immediate front matter and not data files + let { data } = await this.getFrontMatterData(); + this._usePermalinkRoot = data[this.config.keys.permalinkRoot]; + } + + return this._usePermalinkRoot; + } + + async getOutputLocations(data) { + this.bench.get("(count) getOutputLocations").incrementCount(); + let link = await this._getLink(data); + + let path; + if (await this.usePermalinkRoot()) { + path = link.toPathFromRoot(); + } else { + path = link.toPath(this.outputDir); + } + + return { + linkInstance: link, + rawPath: link.toOutputPath(), + href: link.toHref(), + path: path, + }; + } + + // This is likely now a test-only method + // Preferred to use the singular `getOutputLocations` above. + async getRawOutputPath(data) { + this.bench.get("(count) getRawOutputPath").incrementCount(); + let link = await this._getLink(data); + return link.toOutputPath(); + } + + // Preferred to use the singular `getOutputLocations` above. + async getOutputHref(data) { + this.bench.get("(count) getOutputHref").incrementCount(); + let link = await this._getLink(data); + return link.toHref(); + } + + // Preferred to use the singular `getOutputLocations` above. + async getOutputPath(data) { + this.bench.get("(count) getOutputPath").incrementCount(); + let link = await this._getLink(data); + if (await this.usePermalinkRoot()) { + return link.toPathFromRoot(); + } + return link.toPath(this.outputDir); + } + + async _testGetAllLayoutFrontMatterData() { + let { data: frontMatterData } = await this.getFrontMatterData(); + + if (frontMatterData[this.config.keys.layout]) { + let layout = this.getLayout(frontMatterData[this.config.keys.layout]); + return await layout.getData(); + } + return {}; + } + + async #getData() { + debugDev("%o getData", this.inputPath); + let localData = {}; + let globalData = {}; + + if (this.templateData) { + localData = await this.templateData.getTemplateDirectoryData(this.inputPath); + globalData = await this.templateData.getGlobalData(this.inputPath); + debugDev("%o getData getTemplateDirectoryData and getGlobalData", this.inputPath); + } + + let { data: frontMatterData } = await this.getFrontMatterData(); + + let mergedLayoutData = {}; + let tr = await this.getTemplateRender(); + if (tr.engine.useLayouts()) { + let layoutKey = + frontMatterData[this.config.keys.layout] || + localData[this.config.keys.layout] || + globalData[this.config.keys.layout]; + + // Layout front matter data + if (layoutKey) { + let layout = this.getLayout(layoutKey); + + mergedLayoutData = await layout.getData(); + debugDev("%o getData merged layout chain front matter", this.inputPath); + } + } + + try { + let mergedData = TemplateData.mergeDeep( + this.config.dataDeepMerge, + {}, + globalData, + mergedLayoutData, + localData, + frontMatterData, + ); + + if (this.config.freezeReservedData) { + ReservedData.check(mergedData); + } + + await this.addPage(mergedData); + + debugDev("%o getData mergedData", this.inputPath); + + return mergedData; + } catch (e) { + if ( + ReservedData.isReservedDataError(e) || + (e instanceof TypeError && + e.message.startsWith("Cannot add property") && + e.message.endsWith("not extensible")) + ) { + throw new EleventyBaseError( + `You attempted to set one of Eleventy’s reserved data property names${e.reservedNames ? `: ${e.reservedNames.join(", ")}` : ""}. You can opt-out of this behavior with \`eleventyConfig.setFreezeReservedData(false)\` or rename/remove the property in your data cascade that conflicts with Eleventy’s reserved property names (e.g. \`eleventy\`, \`pkg\`, and others). Learn more: https://v3.11ty.dev/docs/data-eleventy-supplied/`, + e, + ); + } + + throw e; + } + } + + async getData() { + if (!this._dataCache) { + // @cachedproperty + this._dataCache = this.#getData(); + } + + return this._dataCache; + } + + async addPage(data) { + if (!("page" in data)) { + data.page = {}; + } + + // Make sure to keep these keys synchronized in src/Util/ReservedData.js + data.page.inputPath = this.inputPath; + data.page.fileSlug = this.fileSlugStr; + data.page.filePathStem = this.filePathStem; + data.page.outputFileExtension = this.engine.defaultTemplateFileExtension; + data.page.templateSyntax = this.templateRender.getEnginesList( + data[this.config.keys.engineOverride], + ); + + let newDate = await this.getMappedDate(data); + // Skip date assignment if custom date is falsy. + if (newDate) { + data.page.date = newDate; + } + + // data.page.url + // data.page.outputPath + // data.page.excerpt from gray-matter and Front Matter + // data.page.lang from I18nPlugin + } + + // Tests only + async render() { + throw new Error("Internal error: `Template->render` was removed in Eleventy 3.0."); + } + + // Tests only + async renderLayout() { + throw new Error("Internal error: `Template->renderLayout` was removed in Eleventy 3.0."); + } + + async renderDirect(str, data, bypassMarkdown) { + return super.render(str, data, bypassMarkdown); + } + + // This is the primary render mechanism, called via TemplateMap->populateContentDataInMap + async renderPageEntryWithoutLayout(pageEntry) { + // @cachedproperty + if (!this._cacheRenderedPromise) { + this._cacheRenderedPromise = this.renderDirect(pageEntry.rawInput, pageEntry.data); + this.renderCount++; + } + + return this._cacheRenderedPromise; + } + + setLinters(linters) { + if (!isPlainObject(linters)) { + throw new Error("Object expected in setLinters"); + } + // this acts as a reset + this.linters = []; + for (let linter of Object.values(linters).filter((l) => typeof l === "function")) { + this.addLinter(linter); + } + } + + addLinter(callback) { + this.linters.push(callback); + } + + async runLinters(str, page) { + let { inputPath, outputPath, url } = page; + let pageData = page.data.page; + + for (let linter of this.linters) { + // these can be asynchronous but no guarantee of order when they run + linter.call( + { + inputPath, + outputPath, + url, + page: pageData, + }, + str, + inputPath, + outputPath, + ); + } + } + + setTransforms(transforms) { + if (!isPlainObject(transforms)) { + throw new Error("Object expected in setTransforms"); + } + this.transforms = transforms; + } + + async runTransforms(str, pageEntry) { + return TransformsUtil.runAll(str, pageEntry.data.page, this.transforms, { + logger: this.logger, + }); + } + + async #renderComputedUnit(entry, data) { + if (typeof entry === "string") { + return this.renderComputedData(entry, data); + } + + if (isPlainObject(entry)) { + for (let key in entry) { + entry[key] = await this.#renderComputedUnit(entry[key], data); + } + } + + if (Array.isArray(entry)) { + for (let j = 0, k = entry.length; j < k; j++) { + entry[j] = await this.#renderComputedUnit(entry[j], data); + } + } + + return entry; + } + + _addComputedEntry(computedData, obj, parentKey, declaredDependencies) { + // this check must come before isPlainObject + if (typeof obj === "function") { + computedData.add(parentKey, obj, declaredDependencies); + } else if (Array.isArray(obj) || typeof obj === "string") { + // Arrays are treated as one entry in the dependency graph now, Issue #3728 + computedData.addTemplateString( + parentKey, + async function (innerData) { + return this.tmpl.#renderComputedUnit(obj, innerData); + }, + declaredDependencies, + this.getParseForSymbolsFunction(obj), + this, + ); + } else if (isPlainObject(obj)) { + // Arrays used to be computed here + for (let key in obj) { + let keys = []; + if (parentKey) { + keys.push(parentKey); + } + keys.push(key); + this._addComputedEntry(computedData, obj[key], keys.join("."), declaredDependencies); + } + } else { + // Numbers, booleans, etc + computedData.add(parentKey, obj, declaredDependencies); + } + } + + async addComputedData(data) { + if (isPlainObject(data?.[this.config.keys.computed])) { + this.computedData = new ComputedData(this.config); + + // Note that `permalink` is only a thing that gets consumed—it does not go directly into generated data + // this allows computed entries to use page.url or page.outputPath and they’ll be resolved properly + + // TODO Room for optimization here—we don’t need to recalculate `getOutputHref` and `getOutputPath` + // TODO Why are these using addTemplateString instead of add + this.computedData.addTemplateString( + "page.url", + async function (data) { + return this.tmpl.getOutputHref(data); + }, + data.permalink ? ["permalink"] : undefined, + false, // skip symbol resolution + this, + ); + + this.computedData.addTemplateString( + "page.outputPath", + async function (data) { + return this.tmpl.getOutputPath(data); + }, + data.permalink ? ["permalink"] : undefined, + false, // skip symbol resolution + this, + ); + + // Check for reserved properties in computed data + if (this.config.freezeReservedData) { + ReservedData.check(data[this.config.keys.computed]); + } + + // actually add the computed data + this._addComputedEntry(this.computedData, data[this.config.keys.computed]); + + // limited run of computed data—save the stuff that relies on collections for later. + debug("First round of computed data for %o", this.inputPath); + await this.computedData.setupData(data, function (entry) { + return !this.isUsesStartsWith(entry, "collections."); + + // TODO possible improvement here is to only process page.url, page.outputPath, permalink + // instead of only punting on things that rely on collections. + // let firstPhaseComputedData = ["page.url", "page.outputPath", ...this.getOrderFor("page.url"), ...this.getOrderFor("page.outputPath")]; + // return firstPhaseComputedData.indexOf(entry) > -1; + }); + } else { + if (!("page" in data)) { + data.page = {}; + } + + // pagination will already have these set via Pagination->getPageTemplates + if (data.page.url && data.page.outputPath) { + return; + } + + let { href, path } = await this.getOutputLocations(data); + data.page.url = href; + data.page.outputPath = path; + } + } + + // Computed data consuming collections! + async resolveRemainingComputedData(data) { + // If it doesn’t exist, computed data is not used for this template + if (this.computedData) { + debug("Second round of computed data for %o", this.inputPath); + return this.computedData.processRemainingData(data); + } + } + + static augmentWithTemplateContentProperty(obj) { + return Object.defineProperties(obj, { + needsCheck: { + enumerable: false, + writable: true, + value: true, + }, + _templateContent: { + enumerable: false, + writable: true, + value: undefined, + }, + templateContent: { + enumerable: true, + set(content) { + if (content === undefined) { + this.needsCheck = false; + } + this._templateContent = content; + }, + get() { + if (this.needsCheck && this._templateContent === undefined) { + if (this.template.isRenderable()) { + // should at least warn here + throw new TemplateContentPrematureUseError( + `Tried to use templateContent too early on ${this.inputPath}${ + this.pageNumber ? ` (page ${this.pageNumber})` : "" + }`, + ); + } else { + throw new TemplateContentUnrenderedTemplateError( + `Tried to use templateContent on unrendered template: ${ + this.inputPath + }${this.pageNumber ? ` (page ${this.pageNumber})` : ""}`, + ); + } + } + return this._templateContent; + }, + }, + // Alias for templateContent for consistency + content: { + enumerable: true, + get() { + return this.templateContent; + }, + set() { + throw new Error("Setter not available for `content`. Use `templateContent` instead."); + }, + }, + }); + } + + static async runPreprocessors(inputPath, content, data, preprocessors) { + let skippedVia = false; + for (let [name, preprocessor] of Object.entries(preprocessors)) { + let { filter, callback } = preprocessor; + + let filters; + if (Array.isArray(filter)) { + filters = filter; + } else if (typeof filter === "string") { + filters = filter.split(","); + } else { + throw new Error( + `Expected file extensions passed to "${name}" content preprocessor to be a string or array. Received: ${filter}`, + ); + } + + filters = filters.map((extension) => { + if (extension.startsWith(".") || extension === "*") { + return extension; + } + + return `.${extension}`; + }); + + if (!filters.some((extension) => extension === "*" || inputPath.endsWith(extension))) { + // skip + continue; + } + + try { + let ret = await callback.call( + { + inputPath, + }, + data, + content, + ); + + // Returning explicit false is the same as ignoring the template + if (ret === false) { + skippedVia = name; + continue; + } + + // Different from transforms: returning falsy (not false) here does nothing (skips the preprocessor) + if (ret) { + content = ret; + } + } catch (e) { + throw new EleventyBaseError( + `Preprocessor \`${name}\` encountered an error when transforming ${inputPath}.`, + e, + ); + } + } + + return { + skippedVia, + content, + }; + } + + async getTemplates(data) { + let content = await this.getPreRender(); + let { skippedVia, content: rawInput } = await Template.runPreprocessors( + this.inputPath, + content, + data, + this.config.preprocessors, + ); + + if (skippedVia) { + debug( + "Skipping %o, the %o preprocessor returned an explicit `false`", + this.inputPath, + skippedVia, + ); + return []; + } + + // Raw Input *includes* preprocessor modifications + // https://github.com/11ty/eleventy/issues/1206 + data.page.rawInput = rawInput; + + if (!Pagination.hasPagination(data)) { + await this.addComputedData(data); + + let obj = { + template: this, // not on the docs but folks are relying on it + rawInput, + groupNumber: 0, // i18n plugin + data, + + page: data.page, + inputPath: this.inputPath, + fileSlug: this.fileSlugStr, + filePathStem: this.filePathStem, + date: data.page.date, + outputPath: data.page.outputPath, + url: data.page.url, + }; + + obj = Template.augmentWithTemplateContentProperty(obj); + + return [obj]; + } else { + // needs collections for pagination items + // but individual pagination entries won’t be part of a collection + this.paging = new Pagination(this, data, this.config); + + let pageTemplates = await this.paging.getPageTemplates(); + let objects = []; + + for (let pageEntry of pageTemplates) { + await pageEntry.template.addComputedData(pageEntry.data); + + let obj = { + template: pageEntry.template, // not on the docs but folks are relying on it + rawInput, + pageNumber: pageEntry.pageNumber, + groupNumber: pageEntry.groupNumber || 0, + + data: pageEntry.data, + + inputPath: this.inputPath, + fileSlug: this.fileSlugStr, + filePathStem: this.filePathStem, + + page: pageEntry.data.page, + date: pageEntry.data.page.date, + outputPath: pageEntry.data.page.outputPath, + url: pageEntry.data.page.url, + }; + + obj = Template.augmentWithTemplateContentProperty(obj); + + objects.push(obj); + } + + return objects; + } + } + + async _write({ url, outputPath, data, rawInput }, finalContent) { + let lang = { + start: "Writing", + finished: "written", + }; + + if (!this.isDryRun) { + if (this.logger.isLoggingEnabled()) { + let isVirtual = this.isVirtualTemplate(); + let tr = await this.getTemplateRender(); + let engineList = tr.getReadableEnginesListDifferingFromFileExtension(); + let suffix = `${isVirtual ? " (virtual)" : ""}${engineList ? ` (${engineList})` : ""}`; + this.logger.log( + `${lang.start} ${outputPath} ${chalk.gray(`from ${this.inputPath}${suffix}`)}`, + ); + } + } else if (this.isDryRun) { + return; + } + + let templateBenchmarkDir = this.bench.get("Template make parent directory"); + templateBenchmarkDir.before(); + + if (this.eleventyConfig.templateHandling?.writeMode === "async") { + await this.fsManager.createDirectoryForFile(outputPath); + } else { + this.fsManager.createDirectoryForFileSync(outputPath); + } + + templateBenchmarkDir.after(); + + if (!Buffer.isBuffer(finalContent) && typeof finalContent !== "string") { + throw new Error( + `The return value from the render function for the ${this.engine.name} template was not a String or Buffer. Received ${finalContent}`, + ); + } + + let templateBenchmark = this.bench.get("Template Write"); + templateBenchmark.before(); + + if (this.eleventyConfig.templateHandling?.writeMode === "async") { + await this.fsManager.writeFile(outputPath, finalContent); + } else { + this.fsManager.writeFileSync(outputPath, finalContent); + } + + templateBenchmark.after(); + this.writeCount++; + debug(`${outputPath} ${lang.finished}.`); + + let ret = { + inputPath: this.inputPath, + outputPath: outputPath, + url, + content: finalContent, + rawInput, + }; + + if (data && this.config.dataFilterSelectors?.size > 0) { + ret.data = this.retrieveDataForJsonOutput(data, this.config.dataFilterSelectors); + } + + return ret; + } + + async #renderPageEntryWithLayoutsAndTransforms(pageEntry) { + let content; + let layoutKey = pageEntry.data[this.config.keys.layout]; + if (this.engine.useLayouts() && layoutKey) { + let layout = pageEntry.template.getLayout(layoutKey); + content = await layout.renderPageEntry(pageEntry); + } else { + content = pageEntry.templateContent; + } + + await this.runLinters(content, pageEntry); + + content = await this.runTransforms(content, pageEntry); + return content; + } + + async renderPageEntry(pageEntry) { + // @cachedproperty + if (!pageEntry.template._cacheRenderedTransformsAndLayoutsPromise) { + pageEntry.template._cacheRenderedTransformsAndLayoutsPromise = + this.#renderPageEntryWithLayoutsAndTransforms(pageEntry); + } + + return pageEntry.template._cacheRenderedTransformsAndLayoutsPromise; + } + + retrieveDataForJsonOutput(data, selectors) { + let filtered = {}; + for (let selector of selectors) { + let value = lodashGet(data, selector); + lodashSet(filtered, selector, value); + } + return filtered; + } + + async generateMapEntry(mapEntry, to) { + let ret = []; + + for (let page of mapEntry._pages) { + let content; + + // Note that behavior.render is overridden when using json or ndjson output + if (page.template.isRenderable()) { + // this reuses page.templateContent, it doesn’t render it + content = await page.template.renderPageEntry(page); + } + + if (to === "json" || to === "ndjson") { + let obj = { + url: page.url, + inputPath: page.inputPath, + outputPath: page.outputPath, + rawInput: page.rawInput, + content: content, + }; + + if (this.config.dataFilterSelectors?.size > 0) { + obj.data = this.retrieveDataForJsonOutput(page.data, this.config.dataFilterSelectors); + } + + if (to === "ndjson") { + let jsonString = JSON.stringify(obj); + this.logger.toStream(jsonString + os.EOL); + continue; + } + + // json + ret.push(obj); + continue; + } + + if (!page.template.isRenderable()) { + debug("Template not written %o from %o.", page.outputPath, page.template.inputPath); + continue; + } + + if (!page.template.behavior.isWriteable()) { + debug( + "Template not written %o from %o (via permalink: false, permalink.build: false, or a permalink object without a build property).", + page.outputPath, + page.template.inputPath, + ); + continue; + } + + // compile returned undefined + if (content !== undefined) { + ret.push(this._write(page, content)); + } + } + + return Promise.all(ret); + } + + async clone() { + // TODO do we need to even run the constructor here or can we simplify it even more + let tmpl = new Template( + this.inputPath, + this.templateData, + this.extensionMap, + this.eleventyConfig, + ); + + // We use this cheap property setter below instead + // await tmpl.getTemplateRender(); + + // preserves caches too, e.g. _frontMatterDataCache + // Does not yet include .computedData + for (let key in this) { + tmpl[key] = this[key]; + } + + return tmpl; + } + + getWriteCount() { + return this.writeCount; + } + + getRenderCount() { + return this.renderCount; + } + + async getInputFileStat() { + // @cachedproperty + if (!this._stats) { + this._stats = fsStat(this.inputPath); + } + + return this._stats; + } + + async _getDateInstance(key = "birthtimeMs") { + let stat = await this.getInputFileStat(); + + // Issue 1823: https://github.com/11ty/eleventy/issues/1823 + // return current Date in a Lambda + // otherwise ctime would be "1980-01-01T00:00:00.000Z" + // otherwise birthtime would be "1970-01-01T00:00:00.000Z" + if (stat.birthtimeMs === 0) { + return new Date(); + } + + let newDate = new Date(stat[key]); + + debug( + "Template date: using file’s %o for %o of %o (from %o)", + key, + this.inputPath, + newDate, + stat.birthtimeMs, + ); + + return newDate; + } + + async getMappedDate(data) { + let dateValue = data?.date; + + // These can return a Date object, or a string. + // Already type checked to be functions in UserConfig + for (let fn of this.config.customDateParsing) { + let ret = fn.call( + { + page: data.page, + }, + dateValue, + ); + + if (ret) { + debug("getMappedDate: date value override via `addDateParsing` callback to %o", ret); + dateValue = ret; + } + } + + if (dateValue) { + debug("getMappedDate: using a date in the data for %o of %o", this.inputPath, data.date); + if (dateValue?.constructor?.name === "DateTime") { + // YAML does its own date parsing + debug("getMappedDate: found DateTime instance: %o", dateValue); + return dateValue.toJSDate(); + } + + if (dateValue instanceof Date) { + // YAML does its own date parsing + debug("getMappedDate: found Date instance (maybe from YAML): %o", dateValue); + return dateValue; + } + + if (typeof dateValue !== "string") { + throw new Error( + `Data cascade value for \`date\` (${dateValue}) is invalid for ${this.inputPath}. Expected a JavaScript Date instance, luxon DateTime instance, or String value.`, + ); + } + + // special strings + if (!this.isVirtualTemplate()) { + if (dateValue.toLowerCase() === "git last modified") { + let d = await getDateFromGitLastUpdated(this.inputPath); + if (d) { + return d; + } + + // return now if this file is not yet available in `git` + return new Date(); + } + if (dateValue.toLowerCase() === "last modified") { + return this._getDateInstance("ctimeMs"); + } + if (dateValue.toLowerCase() === "git created") { + let d = await getDateFromGitFirstAdded(this.inputPath); + if (d) { + return d; + } + + // return now if this file is not yet available in `git` + return new Date(); + } + if (dateValue.toLowerCase() === "created") { + return this._getDateInstance("birthtimeMs"); + } + } + + // try to parse with Luxon + let date = DateTime.fromISO(dateValue, { zone: "utc" }); + if (!date.isValid) { + throw new Error( + `Data cascade value for \`date\` (${dateValue}) is invalid for ${this.inputPath}`, + ); + } + debug("getMappedDate: Luxon parsed %o: %o and %o", dateValue, date, date.toJSDate()); + + return date.toJSDate(); + } + + // No Date supplied in the Data Cascade, try to find the date in the file name + let filepathRegex = this.inputPath.match(/(\d{4}-\d{2}-\d{2})/); + if (filepathRegex !== null) { + // if multiple are found in the path, use the first one for the date + let dateObj = DateTime.fromISO(filepathRegex[1], { + zone: "utc", + }).toJSDate(); + debug( + "getMappedDate: using filename regex time for %o of %o: %o", + this.inputPath, + filepathRegex[1], + dateObj, + ); + return dateObj; + } + + // No Date supplied in the Data Cascade + if (this.isVirtualTemplate()) { + return new Date(); + } + + return this._getDateInstance("birthtimeMs"); + } + + // Important reminder: Template data is first generated in TemplateMap + async getTemplateMapEntries(data) { + debugDev("%o getMapped()", this.inputPath); + + this.behavior.setRenderViaDataCascade(data); + + let entries = []; + // does not return outputPath or url, we don’t want to render permalinks yet + entries.push({ + template: this, + inputPath: this.inputPath, + data, + }); + + return entries; + } +} + +export default Template; diff --git a/node_modules/@11ty/eleventy/src/TemplateBehavior.js b/node_modules/@11ty/eleventy/src/TemplateBehavior.js new file mode 100644 index 00000000..8dff97c3 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplateBehavior.js @@ -0,0 +1,85 @@ +import { isPlainObject } from "@11ty/eleventy-utils"; + +class TemplateBehavior { + #isRenderOptional; + + constructor(config) { + this.render = true; + this.write = true; + this.outputFormat = null; + + if (!config) { + throw new Error("Missing config argument in TemplateBehavior"); + } + this.config = config; + } + + // Render override set to false + isRenderableDisabled() { + return this.renderableOverride === false; + } + + isRenderableOptional() { + return this.#isRenderOptional; + } + + // undefined (fallback), true, false + setRenderableOverride(renderableOverride) { + if (renderableOverride === "optional") { + this.#isRenderOptional = true; + this.renderableOverride = undefined; + } else { + this.#isRenderOptional = false; + this.renderableOverride = renderableOverride; + } + } + + // permalink *has* a build key or output is json/ndjson + isRenderable() { + return this.renderableOverride ?? (this.render || this.isRenderForced()); + } + + setOutputFormat(format) { + this.outputFormat = format; + } + + isRenderForced() { + return this.outputFormat === "json" || this.outputFormat === "ndjson"; + } + + isWriteable() { + return this.write; + } + + // Duplicate logic with TemplatePermalink constructor + setRenderViaDataCascade(data) { + // render is false *only* if `build` key does not exist in permalink objects (both in data and eleventyComputed) + // (note that permalink: false means it won’t write but will still render) + + let keys = new Set(); + if (isPlainObject(data.permalink)) { + for (let key of Object.keys(data.permalink)) { + keys.add(key); + } + } + + let computedKey = this.config.keys.computed; + if (computedKey in data && isPlainObject(data[computedKey]?.permalink)) { + for (let key of Object.keys(data[computedKey].permalink)) { + keys.add(key); + } + } + + if (keys.size) { + this.render = keys.has("build"); + } + } + + setFromPermalink(templatePermalink) { + // this.render is duplicated between TemplatePermalink and `setRenderViaDataCascade` above + this.render = templatePermalink._isRendered; + + this.write = templatePermalink._writeToFileSystem; + } +} +export default TemplateBehavior; diff --git a/node_modules/@11ty/eleventy/src/TemplateCollection.js b/node_modules/@11ty/eleventy/src/TemplateCollection.js new file mode 100644 index 00000000..6e99a32a --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplateCollection.js @@ -0,0 +1,77 @@ +import { TemplatePath } from "@11ty/eleventy-utils"; + +import TemplateData from "./Data/TemplateData.js"; +import Sortable from "./Util/Objects/Sortable.js"; +import { isGlobMatch } from "./Util/GlobMatcher.js"; + +class TemplateCollection extends Sortable { + constructor() { + super(); + + this._filteredByGlobsCache = new Map(); + } + + getAll() { + return this.items.slice(); + } + + getAllSorted() { + return this.sort(Sortable.sortFunctionDateInputPath); + } + + getSortedByDate() { + return this.sort(Sortable.sortFunctionDate); + } + + getGlobs(globs) { + if (typeof globs === "string") { + globs = [globs]; + } + + globs = globs.map((glob) => TemplatePath.addLeadingDotSlash(glob)); + + return globs; + } + + getFilteredByGlob(globs) { + globs = this.getGlobs(globs); + + let key = globs.join("::"); + if (!this._dirty) { + // Try to find a pre-sorted list and clone it. + if (this._filteredByGlobsCache.has(key)) { + return [...this._filteredByGlobsCache.get(key)]; + } + } else if (this._filteredByGlobsCache.size) { + // Blow away cache + this._filteredByGlobsCache = new Map(); + } + + let filtered = this.getAllSorted().filter((item) => { + return isGlobMatch(item.inputPath, globs); + }); + this._dirty = false; + this._filteredByGlobsCache.set(key, [...filtered]); + return filtered; + } + + getFilteredByTag(tagName) { + return this.getAllSorted().filter((item) => { + if (!tagName || TemplateData.getIncludedTagNames(item.data).includes(tagName)) { + return true; + } + return false; + }); + } + + getFilteredByTags(...tags) { + return this.getAllSorted().filter((item) => { + let itemTags = new Set(TemplateData.getIncludedTagNames(item.data)); + return tags.every((requiredTag) => { + return itemTags.has(requiredTag); + }); + }); + } +} + +export default TemplateCollection; diff --git a/node_modules/@11ty/eleventy/src/TemplateConfig.js b/node_modules/@11ty/eleventy/src/TemplateConfig.js new file mode 100644 index 00000000..e1fff8f9 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplateConfig.js @@ -0,0 +1,565 @@ +import fs from "node:fs"; +import chalk from "kleur"; +import { Merge, TemplatePath, isPlainObject } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; + +import { EleventyImportRaw } from "./Util/Require.js"; +import EleventyBaseError from "./Errors/EleventyBaseError.js"; +import UserConfig from "./UserConfig.js"; +import GlobalDependencyMap from "./GlobalDependencyMap.js"; +import ExistsCache from "./Util/ExistsCache.js"; +import eventBus from "./EventBus.js"; +import ProjectTemplateFormats from "./Util/ProjectTemplateFormats.js"; + +const debug = debugUtil("Eleventy:TemplateConfig"); +const debugDev = debugUtil("Dev:Eleventy:TemplateConfig"); + +/** + * @module 11ty/eleventy/TemplateConfig + */ + +/** + * Config as used by the template. + * @typedef {object} module:11ty/eleventy/TemplateConfig~TemplateConfig~config + * @property {String} [pathPrefix] - The path prefix. + */ + +/** + * Errors in eleventy config. + * @ignore + */ +class EleventyConfigError extends EleventyBaseError {} + +/** + * Errors in eleventy plugins. + * @ignore + */ +class EleventyPluginError extends EleventyBaseError {} + +/** + * Config for a template. + * @ignore + * @param {{}} customRootConfig - tbd. + * @param {String} projectConfigPath - Path to local project config. + */ +class TemplateConfig { + #templateFormats; + #runMode; + #configManuallyDefined = false; + /** @type {UserConfig} */ + #userConfig = new UserConfig(); + #existsCache = new ExistsCache(); + #usesGraph; + #previousBuildModifiedFile; + + constructor(customRootConfig, projectConfigPath) { + /** @type {object} */ + this.overrides = {}; + + /** + * @type {String} + * @description Path to local project config. + * @default .eleventy.js + */ + if (projectConfigPath !== undefined) { + this.#configManuallyDefined = true; + + if (!projectConfigPath) { + // falsy skips config files + this.projectConfigPaths = []; + } else { + this.projectConfigPaths = [projectConfigPath]; + } + } else { + this.projectConfigPaths = [ + ".eleventy.js", + "eleventy.config.js", + "eleventy.config.mjs", + "eleventy.config.cjs", + ]; + } + + if (customRootConfig) { + /** + * @type {object} + * @description Custom root config. + */ + this.customRootConfig = customRootConfig; + debug("Warning: Using custom root config!"); + } else { + this.customRootConfig = null; + } + + this.hasConfigMerged = false; + this.isEsm = false; + + this.userConfig.events.on("eleventy#templateModified", (inputPath, metadata = {}) => { + // Might support multiple at some point + this.setPreviousBuildModifiedFile(inputPath, metadata); + + // Issue #3569, set that this file exists in the cache + this.#existsCache.set(inputPath, true); + }); + } + + setPreviousBuildModifiedFile(inputPath, metadata = {}) { + this.#previousBuildModifiedFile = inputPath; + } + + getPreviousBuildModifiedFile() { + return this.#previousBuildModifiedFile; + } + + get userConfig() { + return this.#userConfig; + } + + get aggregateBenchmark() { + return this.userConfig.benchmarks.aggregate; + } + + /* Setter for Logger */ + setLogger(logger) { + this.logger = logger; + this.userConfig.logger = this.logger; + } + + /* Setter for Directories instance */ + setDirectories(directories) { + this.directories = directories; + this.userConfig.directories = directories.getUserspaceInstance(); + } + + /* Setter for TemplateFormats instance */ + setTemplateFormats(templateFormats) { + this.#templateFormats = templateFormats; + } + + get templateFormats() { + if (!this.#templateFormats) { + this.#templateFormats = new ProjectTemplateFormats(); + } + return this.#templateFormats; + } + + /* Backwards compat */ + get inputDir() { + return this.directories.input; + } + + setRunMode(runMode) { + this.#runMode = runMode; + } + + shouldSpiderJavaScriptDependencies() { + // not for a standard build + return ( + (this.#runMode === "watch" || this.#runMode === "serve") && + this.userConfig.watchJavaScriptDependencies + ); + } + + /** + * Normalises local project config file path. + * + * @method + * @returns {String|undefined} - The normalised local project config file path. + */ + getLocalProjectConfigFile() { + let configFiles = this.getLocalProjectConfigFiles(); + + let configFile = configFiles.find((path) => path && fs.existsSync(path)); + if (configFile) { + return configFile; + } + } + + getLocalProjectConfigFiles() { + let paths = this.projectConfigPaths; + if (paths?.length > 0) { + return TemplatePath.addLeadingDotSlashArray(paths.filter((path) => Boolean(path))); + } + return []; + } + + setProjectUsingEsm(isEsmProject) { + this.isEsm = !!isEsmProject; + this.usesGraph.setIsEsm(isEsmProject); + } + + getIsProjectUsingEsm() { + return this.isEsm; + } + + /** + * Resets the configuration. + */ + async reset() { + debugDev("Resetting configuration: TemplateConfig and UserConfig."); + this.userConfig.reset(); + this.usesGraph.reset(); // needs to be before forceReloadConfig #3711 + + // await this.initializeRootConfig(); + await this.forceReloadConfig(); + + // Clear the compile cache + eventBus.emit("eleventy.compileCacheReset"); + } + + /** + * Resets the configuration while in watch mode. + * + * @todo Add implementation. + */ + resetOnWatch() { + // nothing yet + } + + hasInitialized() { + return this.hasConfigMerged; + } + + /** + * Async-friendly init method + */ + async init(overrides) { + await this.initializeRootConfig(); + + if (overrides) { + this.appendToRootConfig(overrides); + } + + this.config = await this.mergeConfig(); + this.hasConfigMerged = true; + } + + /** + * Force a reload of the configuration object. + */ + async forceReloadConfig() { + this.hasConfigMerged = false; + await this.init(); + } + + /** + * Returns the config object. + * + * @returns {{}} - The config object. + */ + getConfig() { + if (!this.hasConfigMerged) { + throw new Error("Invalid call to .getConfig(). Needs an .init() first."); + } + + return this.config; + } + + /** + * Overwrites the config path. + * + * @param {String} path - The new config path. + */ + async setProjectConfigPath(path) { + this.#configManuallyDefined = true; + + if (path !== undefined) { + this.projectConfigPaths = [path]; + } else { + this.projectConfigPaths = []; + } + + if (this.hasConfigMerged) { + // merge it again + debugDev("Merging in getConfig again after setting the local project config path."); + await this.forceReloadConfig(); + } + } + + /** + * Overwrites the path prefix. + * + * @param {String} pathPrefix - The new path prefix. + */ + setPathPrefix(pathPrefix) { + if (pathPrefix && pathPrefix !== "/") { + debug("Setting pathPrefix to %o", pathPrefix); + this.overrides.pathPrefix = pathPrefix; + } + } + + /** + * Gets the current path prefix denoting the root folder the output will be deployed to + * + * @returns {String} - The path prefix string + */ + getPathPrefix() { + if (this.overrides.pathPrefix) { + return this.overrides.pathPrefix; + } + + if (!this.hasConfigMerged) { + throw new Error("Config has not yet merged. Needs `init()`."); + } + + return this.config?.pathPrefix; + } + + /** + * Bootstraps the config object. + */ + async initializeRootConfig() { + this.rootConfig = this.customRootConfig; + if (!this.rootConfig) { + let { default: cfg } = await import("./defaultConfig.js"); + this.rootConfig = cfg; + } + + if (typeof this.rootConfig === "function") { + // Not yet using async in defaultConfig.js + this.rootConfig = this.rootConfig.call(this, this.userConfig); + } + + debug("Default Eleventy config %o", this.rootConfig); + } + + /* + * Add additional overrides to the root config object, used for testing + * + * @param {object} - a subset of the return Object from the user’s config file. + */ + appendToRootConfig(obj) { + Object.assign(this.rootConfig, obj); + } + + /* + * Process the userland plugins from the Config + * + * @param {object} - the return Object from the user’s config file. + */ + async processPlugins({ dir, pathPrefix }) { + this.userConfig.dir = dir; + this.userConfig.pathPrefix = pathPrefix; + + // for Nested addPlugin calls, Issue #1925 + this.userConfig._enablePluginExecution(); + + let storedActiveNamespace = this.userConfig.activeNamespace; + for (let { plugin, options, pluginNamespace } of this.userConfig.plugins) { + try { + this.userConfig.activeNamespace = pluginNamespace; + await this.userConfig._executePlugin(plugin, options); + } catch (e) { + let name = this.userConfig._getPluginName(plugin); + let namespaces = [storedActiveNamespace, pluginNamespace].filter((entry) => !!entry); + + let namespaceStr = ""; + if (namespaces.length) { + namespaceStr = ` (namespace: ${namespaces.join(".")})`; + } + + throw new EleventyPluginError( + `Error processing ${name ? `the \`${name}\`` : "a"} plugin${namespaceStr}`, + e, + ); + } + } + + this.userConfig.activeNamespace = storedActiveNamespace; + + this.userConfig._disablePluginExecution(); + } + + /** + * Fetches and executes the local configuration file + * + * @returns {Promise} merged - The merged config file object. + */ + async requireLocalConfigFile() { + let localConfig = {}; + let exportedConfig = {}; + + let path = this.projectConfigPaths.filter((path) => path).find((path) => fs.existsSync(path)); + + if (this.projectConfigPaths.length > 0 && this.#configManuallyDefined && !path) { + throw new EleventyConfigError( + "A configuration file was specified but not found: " + this.projectConfigPaths.join(", "), + ); + } + + debug(`Merging default config with ${path}`); + if (path) { + try { + let { default: configDefaultReturn, config: exportedConfigObject } = + await EleventyImportRaw(path, this.isEsm ? "esm" : "cjs"); + + exportedConfig = exportedConfigObject || {}; + + if (this.directories && Object.keys(exportedConfigObject?.dir || {}).length > 0) { + debug( + "Setting directories via `config.dir` export from config file: %o", + exportedConfigObject.dir, + ); + this.directories.setViaConfigObject(exportedConfigObject.dir); + } + + if (typeof configDefaultReturn === "function") { + localConfig = await configDefaultReturn(this.userConfig); + } else { + localConfig = configDefaultReturn; + } + + // Removed a check for `filters` in 3.0.0-alpha.6 (now using addTransform instead) https://v3.11ty.dev/docs/config/#transforms + } catch (err) { + let isModuleError = + err instanceof Error && (err?.message || "").includes("Cannot find module"); + + // TODO the error message here is bad and I feel bad (needs more accurate info) + return Promise.reject( + new EleventyConfigError( + `Error in your Eleventy config file '${path}'.` + + (isModuleError ? chalk.cyan(" You may need to run `npm install`.") : ""), + err, + ), + ); + } + } else { + debug( + "Project config file not found (not an error—skipping). Looked in: %o", + this.projectConfigPaths, + ); + } + + return { + localConfig, + exportedConfig, + }; + } + + /** + * Merges different config files together. + * + * @returns {Promise} merged - The merged config file. + */ + async mergeConfig() { + let { localConfig, exportedConfig } = await this.requireLocalConfigFile(); + + // Merge `export const config = {}` with `return {}` in config callback + if (isPlainObject(exportedConfig)) { + localConfig = Merge(localConfig || {}, exportedConfig); + } + + if (this.directories) { + if (Object.keys(this.userConfig.directoryAssignments || {}).length > 0) { + debug( + "Setting directories via set*Directory configuration APIs %o", + this.userConfig.directoryAssignments, + ); + this.directories.setViaConfigObject(this.userConfig.directoryAssignments); + } + + if (localConfig && Object.keys(localConfig?.dir || {}).length > 0) { + debug( + "Setting directories via `dir` object return from configuration file: %o", + localConfig.dir, + ); + this.directories.setViaConfigObject(localConfig.dir); + } + } + + // `templateFormats` is an override via `setTemplateFormats` + if (this.userConfig?.templateFormats) { + this.templateFormats.setViaConfig(this.userConfig.templateFormats); + } else if (localConfig?.templateFormats || this.rootConfig?.templateFormats) { + // Local project config or defaultConfig.js + this.templateFormats.setViaConfig( + localConfig.templateFormats || this.rootConfig?.templateFormats, + ); + } + + // `templateFormatsAdded` is additive via `addTemplateFormats` + if (this.userConfig?.templateFormatsAdded) { + this.templateFormats.addViaConfig(this.userConfig.templateFormatsAdded); + } + + let mergedConfig = Merge({}, this.rootConfig, localConfig); + + // Setup a few properties for plugins: + + // Set frozen templateFormats + mergedConfig.templateFormats = Object.freeze(this.templateFormats.getTemplateFormats()); + + // Setup pathPrefix set via command line for plugin consumption + if (this.overrides.pathPrefix) { + mergedConfig.pathPrefix = this.overrides.pathPrefix; + } + + // Returning a falsy value (e.g. "") from user config should reset to the default value. + if (!mergedConfig.pathPrefix) { + mergedConfig.pathPrefix = this.rootConfig.pathPrefix; + } + + // This is not set in UserConfig.js so that getters aren’t converted to strings + // We want to error if someone attempts to use a setter there. + if (this.directories) { + mergedConfig.directories = this.directories.getUserspaceInstance(); + } + + // Delay processing plugins until after the result of localConfig is returned + // But BEFORE the rest of the config options are merged + // this way we can pass directories and other template information to plugins + + await this.userConfig.events.emit("eleventy.beforeConfig", this.userConfig); + + let pluginsBench = this.aggregateBenchmark.get("Processing plugins in config"); + pluginsBench.before(); + await this.processPlugins(mergedConfig); + pluginsBench.after(); + + // Template formats added via plugins + if (this.userConfig?.templateFormatsAdded) { + this.templateFormats.addViaConfig(this.userConfig.templateFormatsAdded); + mergedConfig.templateFormats = Object.freeze(this.templateFormats.getTemplateFormats()); + } + + let eleventyConfigApiMergingObject = this.userConfig.getMergingConfigObject(); + + if ("templateFormats" in eleventyConfigApiMergingObject) { + throw new Error( + "Internal error: templateFormats should not return from `getMergingConfigObject`", + ); + } + + // Overrides are only used by pathPrefix + debug("Configuration overrides: %o", this.overrides); + Merge(mergedConfig, eleventyConfigApiMergingObject, this.overrides); + + debug("Current configuration: %o", mergedConfig); + + // Add to the merged config too + mergedConfig.uses = this.usesGraph; + + return mergedConfig; + } + + get usesGraph() { + if (!this.#usesGraph) { + this.#usesGraph = new GlobalDependencyMap(); + this.#usesGraph.setIsEsm(this.isEsm); + this.#usesGraph.setTemplateConfig(this); + } + return this.#usesGraph; + } + + get uses() { + if (!this.usesGraph) { + throw new Error("The Eleventy Global Dependency Graph has not yet been initialized."); + } + return this.usesGraph; + } + + get existsCache() { + return this.#existsCache; + } +} + +export default TemplateConfig; diff --git a/node_modules/@11ty/eleventy/src/TemplateContent.js b/node_modules/@11ty/eleventy/src/TemplateContent.js new file mode 100644 index 00000000..97d440fc --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplateContent.js @@ -0,0 +1,748 @@ +import os from "node:os"; + +import fs from "node:fs"; +import matter from "gray-matter"; +import lodash from "@11ty/lodash-custom"; +import { TemplatePath } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; + +import TemplateData from "./Data/TemplateData.js"; +import TemplateRender from "./TemplateRender.js"; +import EleventyBaseError from "./Errors/EleventyBaseError.js"; +import EleventyErrorUtil from "./Errors/EleventyErrorUtil.js"; +import eventBus from "./EventBus.js"; + +import { withResolvers } from "./Util/PromiseUtil.js"; + +const { set: lodashSet } = lodash; +const debug = debugUtil("Eleventy:TemplateContent"); +const debugDev = debugUtil("Dev:Eleventy:TemplateContent"); + +class TemplateContentFrontMatterError extends EleventyBaseError {} +class TemplateContentCompileError extends EleventyBaseError {} +class TemplateContentRenderError extends EleventyBaseError {} + +class TemplateContent { + #initialized = false; + #config; + #templateRender; + #preprocessorEngine; + #extensionMap; + #configOptions; + + constructor(inputPath, templateConfig) { + if (!templateConfig || templateConfig.constructor.name !== "TemplateConfig") { + throw new Error("Missing or invalid `templateConfig` argument"); + } + this.eleventyConfig = templateConfig; + this.inputPath = inputPath; + } + + async asyncTemplateInitialization() { + if (!this.hasTemplateRender()) { + await this.getTemplateRender(); + } + + if (this.#initialized) { + return; + } + this.#initialized = true; + + let preprocessorEngineName = this.templateRender.getPreprocessorEngineName(); + if (preprocessorEngineName && this.templateRender.engine.getName() !== preprocessorEngineName) { + let engine = await this.templateRender.getEngineByName(preprocessorEngineName); + this.#preprocessorEngine = engine; + } + } + + resetCachedTemplate({ eleventyConfig }) { + this.eleventyConfig = eleventyConfig; + } + + get dirs() { + return this.eleventyConfig.directories; + } + + get inputDir() { + return this.dirs.input; + } + + get outputDir() { + return this.dirs.output; + } + + getResetTypes(types) { + if (types) { + return Object.assign( + { + data: false, + read: false, + render: false, + }, + types, + ); + } + + return { + data: true, + read: true, + render: true, + }; + } + + // Called during an incremental build when the template instance is cached but needs to be reset because it has changed + resetCaches(types) { + types = this.getResetTypes(types); + + if (types.read) { + delete this.readingPromise; + delete this.inputContent; + delete this._frontMatterDataCache; + } + if (types.render) { + this.#templateRender = undefined; + } + } + + get extensionMap() { + if (!this.#extensionMap) { + throw new Error("Internal error: Missing `extensionMap` in TemplateContent."); + } + return this.#extensionMap; + } + + set extensionMap(map) { + this.#extensionMap = map; + } + + set eleventyConfig(config) { + this.#config = config; + + if (this.#config.constructor.name === "TemplateConfig") { + this.#configOptions = this.#config.getConfig(); + } else { + throw new Error("Tried to get an TemplateConfig but none was found."); + } + } + + get eleventyConfig() { + if (this.#config.constructor.name === "TemplateConfig") { + return this.#config; + } + throw new Error("Tried to get an TemplateConfig but none was found."); + } + + get config() { + if (this.#config.constructor.name === "TemplateConfig" && !this.#configOptions) { + this.#configOptions = this.#config.getConfig(); + } + + return this.#configOptions; + } + + get bench() { + return this.config.benchmarkManager.get("Aggregate"); + } + + get engine() { + return this.templateRender.engine; + } + + get templateRender() { + if (!this.hasTemplateRender()) { + throw new Error(`\`templateRender\` has not yet initialized on ${this.inputPath}`); + } + + return this.#templateRender; + } + + hasTemplateRender() { + return !!this.#templateRender; + } + + async getTemplateRender() { + if (!this.#templateRender) { + this.#templateRender = new TemplateRender(this.inputPath, this.eleventyConfig); + this.#templateRender.extensionMap = this.extensionMap; + + return this.#templateRender.init().then(() => { + return this.#templateRender; + }); + } + + return this.#templateRender; + } + + // For monkey patchers + get frontMatter() { + if (this.frontMatterOverride) { + return this.frontMatterOverride; + } else { + throw new Error( + "Unfortunately you’re using code that monkey patched some Eleventy internals and it isn’t async-friendly. Change your code to use the async `read()` method on the template instead!", + ); + } + } + + // For monkey patchers + set frontMatter(contentOverride) { + this.frontMatterOverride = contentOverride; + } + + getInputPath() { + return this.inputPath; + } + + getInputDir() { + return this.inputDir; + } + + isVirtualTemplate() { + let def = this.getVirtualTemplateDefinition(); + return !!def; + } + + getVirtualTemplateDefinition() { + let inputDirRelativeInputPath = + this.eleventyConfig.directories.getInputPathRelativeToInputDirectory(this.inputPath); + return this.config.virtualTemplates[inputDirRelativeInputPath]; + } + + async #read() { + let content = await this.inputContent; + + if (content || content === "") { + let tr = await this.getTemplateRender(); + if (tr.engine.useJavaScriptImport()) { + return { + data: {}, + content, + }; + } + + let options = this.config.frontMatterParsingOptions || {}; + let fm; + try { + // Added in 3.0, passed along to front matter engines + options.filePath = this.inputPath; + fm = matter(content, options); + } catch (e) { + throw new TemplateContentFrontMatterError( + `Having trouble reading front matter from template ${this.inputPath}`, + e, + ); + } + + if (options.excerpt && fm.excerpt) { + let excerptString = fm.excerpt + (options.excerpt_separator || "---"); + if (fm.content.startsWith(excerptString + os.EOL)) { + // with an os-specific newline after excerpt separator + fm.content = fm.excerpt.trim() + "\n" + fm.content.slice((excerptString + os.EOL).length); + } else if (fm.content.startsWith(excerptString + "\n")) { + // with a newline (\n) after excerpt separator + // This is necessary for some git configurations on windows + fm.content = fm.excerpt.trim() + "\n" + fm.content.slice((excerptString + 1).length); + } else if (fm.content.startsWith(excerptString)) { + // no newline after excerpt separator + fm.content = fm.excerpt + fm.content.slice(excerptString.length); + } + + // alias, defaults to page.excerpt + let alias = options.excerpt_alias || "page.excerpt"; + lodashSet(fm.data, alias, fm.excerpt); + } + + // For monkey patchers that used `frontMatter` 🤧 + // https://github.com/11ty/eleventy/issues/613#issuecomment-999637109 + // https://github.com/11ty/eleventy/issues/2710#issuecomment-1373854834 + // Removed this._frontMatter monkey patcher help in 3.0.0-alpha.7 + + return fm; + } else { + return { + data: {}, + content: "", + excerpt: "", + }; + } + } + + async read() { + if (!this.readingPromise) { + if (!this.inputContent) { + // @cachedproperty + this.inputContent = this.getInputContent(); + } + + // @cachedproperty + this.readingPromise = this.#read(); + } + + return this.readingPromise; + } + + /* Incremental builds cache the Template instances (in TemplateWriter) but + * these template specific caches are important for Pagination */ + static cache(path, content) { + this._inputCache.set(TemplatePath.absolutePath(path), content); + } + + static getCached(path) { + return this._inputCache.get(TemplatePath.absolutePath(path)); + } + + static deleteFromInputCache(path) { + this._inputCache.delete(TemplatePath.absolutePath(path)); + } + + // Used via clone + setInputContent(content) { + this.inputContent = content; + } + + async getInputContent() { + let tr = await this.getTemplateRender(); + + let virtualTemplateDefinition = this.getVirtualTemplateDefinition(); + if (virtualTemplateDefinition) { + let { content } = virtualTemplateDefinition; + return content; + } + + if ( + tr.engine.useJavaScriptImport() && + typeof tr.engine.getInstanceFromInputPath === "function" + ) { + return tr.engine.getInstanceFromInputPath(this.inputPath); + } + + if (!tr.engine.needsToReadFileContents()) { + return ""; + } + + let templateBenchmark = this.bench.get("Template Read"); + templateBenchmark.before(); + + let content; + + if (this.config.useTemplateCache) { + content = TemplateContent.getCached(this.inputPath); + } + + if (!content && content !== "") { + let contentBuffer = fs.readFileSync(this.inputPath); + + content = contentBuffer.toString("utf8"); + + if (this.config.useTemplateCache) { + TemplateContent.cache(this.inputPath, content); + } + } + + templateBenchmark.after(); + + return content; + } + + async _testGetFrontMatter() { + let fm = this.frontMatterOverride ? this.frontMatterOverride : await this.read(); + + return fm; + } + + async getPreRender() { + let fm = this.frontMatterOverride ? this.frontMatterOverride : await this.read(); + + return fm.content; + } + + async #getFrontMatterData() { + let fm = await this.read(); + + // gray-matter isn’t async-friendly but can return a promise from custom front matter + if (fm.data instanceof Promise) { + fm.data = await fm.data; + } + + let tr = await this.getTemplateRender(); + let extraData = await tr.engine.getExtraDataFromFile(this.inputPath); + + let virtualTemplateDefinition = this.getVirtualTemplateDefinition(); + let virtualTemplateData; + if (virtualTemplateDefinition) { + virtualTemplateData = virtualTemplateDefinition.data; + } + + let data = Object.assign(fm.data, extraData, virtualTemplateData); + + TemplateData.cleanupData(data, { + file: this.inputPath, + isVirtualTemplate: Boolean(virtualTemplateData), + }); + + return { + data, + excerpt: fm.excerpt, + }; + } + + async getFrontMatterData() { + if (!this._frontMatterDataCache) { + // @cachedproperty + this._frontMatterDataCache = this.#getFrontMatterData(); + } + + return this._frontMatterDataCache; + } + + async getEngineOverride() { + return this.getFrontMatterData().then((data) => { + return data[this.config.keys.engineOverride]; + }); + } + + // checks engines + isTemplateCacheable() { + if (this.#preprocessorEngine) { + return this.#preprocessorEngine.cacheable; + } + return this.engine.cacheable; + } + + _getCompileCache(str) { + // Caches used to be bifurcated based on engine name, now they’re based on inputPath + // TODO does `cacheable` need to help inform whether a cache is used here? + let inputPathMap = TemplateContent._compileCache.get(this.inputPath); + if (!inputPathMap) { + inputPathMap = new Map(); + TemplateContent._compileCache.set(this.inputPath, inputPathMap); + } + + let cacheable = this.isTemplateCacheable(); + let { useCache, key } = this.engine.getCompileCacheKey(str, this.inputPath); + + // We also tie the compile cache key to the UserConfig instance, to alleviate issues with global template cache + // Better to move the cache to the Eleventy instance instead, no? + // (This specifically failed I18nPluginTest cases with filters being cached across tests and not having access to each plugin’s options) + key = this.eleventyConfig.userConfig._getUniqueId() + key; + + return [cacheable, key, inputPathMap, useCache]; + } + + async compile(str, options = {}) { + let { type, bypassMarkdown, engineOverride } = options; + + // Must happen before cacheable fetch below + // Likely only necessary for Eleventy Layouts, see TemplateMap->initDependencyMap + await this.asyncTemplateInitialization(); + + // this.templateRender is guaranteed here + let tr = await this.getTemplateRender(); + if (engineOverride !== undefined) { + debugDev("%o overriding template engine to use %o", this.inputPath, engineOverride); + await tr.setEngineOverride(engineOverride, bypassMarkdown); + } else { + tr.setUseMarkdown(!bypassMarkdown); + } + if (bypassMarkdown && !this.engine.needsCompilation(str)) { + return function () { + return str; + }; + } + + debugDev("%o compile() using engine: %o", this.inputPath, tr.engineName); + + try { + let res; + if (this.config.useTemplateCache) { + let [cacheable, key, cache, useCache] = this._getCompileCache(str); + if (cacheable && key) { + if (useCache && cache.has(key)) { + this.bench.get("(count) Template Compile Cache Hit").incrementCount(); + return cache.get(key); + } + + this.bench.get("(count) Template Compile Cache Miss").incrementCount(); + + // Compile cache is cleared when the resource is modified (below) + + // Compilation is async, so we eagerly cache a Promise that eventually + // resolves to the compiled function + let withRes = withResolvers(); + res = withRes.resolve; + + cache.set(key, withRes.promise); + } + } + + let typeStr = type ? ` ${type}` : ""; + let templateBenchmark = this.bench.get(`Template Compile${typeStr}`); + let inputPathBenchmark = this.bench.get(`> Compile${typeStr} > ${this.inputPath}`); + templateBenchmark.before(); + inputPathBenchmark.before(); + + let fn = await tr.getCompiledTemplate(str); + inputPathBenchmark.after(); + templateBenchmark.after(); + debugDev("%o getCompiledTemplate function created", this.inputPath); + if (this.config.useTemplateCache && res) { + res(fn); + } + return fn; + } catch (e) { + let [cacheable, key, cache] = this._getCompileCache(str); + if (cacheable && key) { + cache.delete(key); + } + debug(`Having trouble compiling template ${this.inputPath}: %O`, str); + throw new TemplateContentCompileError( + `Having trouble compiling template ${this.inputPath}`, + e, + ); + } + } + + getParseForSymbolsFunction(str) { + let engine = this.engine; + + // Don’t use markdown as the engine to parse for symbols + // TODO pass in engineOverride here + if (this.#preprocessorEngine) { + engine = this.#preprocessorEngine; + } + + if ("parseForSymbols" in engine) { + return () => { + if (Array.isArray(str)) { + return str + .filter((entry) => typeof entry === "string") + .map((entry) => engine.parseForSymbols(entry)) + .flat(); + } + if (typeof str === "string") { + return engine.parseForSymbols(str); + } + return []; + }; + } + } + + // used by computed data or for permalink functions + async _renderFunction(fn, ...args) { + let mixins = Object.assign({}, this.config.javascriptFunctions); + let result = await fn.call(mixins, ...args); + + // normalize Buffer away if returned from permalink + if (Buffer.isBuffer(result)) { + return result.toString(); + } + + return result; + } + + async renderComputedData(str, data) { + if (typeof str === "function") { + return this._renderFunction(str, data); + } + + return this._render(str, data, { + type: "Computed Data", + bypassMarkdown: true, + }); + } + + async renderPermalink(permalink, data) { + let tr = await this.getTemplateRender(); + let permalinkCompilation = tr.engine.permalinkNeedsCompilation(permalink); + + // No string compilation: + // ({ compileOptions: { permalink: "raw" }}) + // These mean `permalink: false`, which is no file system writing: + // ({ compileOptions: { permalink: false }}) + // ({ compileOptions: { permalink: () => false }}) + // ({ compileOptions: { permalink: () => (() = > false) }}) + if (permalinkCompilation === false && typeof permalink !== "function") { + return permalink; + } + + /* Custom `compile` function for permalinks, usage: + permalink: function(permalinkString, inputPath) { + return async function(data) { + return "THIS IS MY RENDERED PERMALINK"; + } + } + */ + if (permalinkCompilation && typeof permalinkCompilation === "function") { + permalink = await this._renderFunction(permalinkCompilation, permalink, this.inputPath); + } + + // Raw permalink function (in the app code data cascade) + if (typeof permalink === "function") { + return this._renderFunction(permalink, data); + } + + return this._render(permalink, data, { + type: "Permalink", + bypassMarkdown: true, + }); + } + + async render(str, data, bypassMarkdown) { + return this._render(str, data, { + type: "Content", + bypassMarkdown, + }); + } + + _getPaginationLogSuffix(data) { + let suffix = []; + if ("pagination" in data) { + suffix.push(" ("); + if (data.pagination.pages) { + suffix.push( + `${data.pagination.pages.length} page${data.pagination.pages.length !== 1 ? "s" : ""}`, + ); + } else { + suffix.push("Pagination"); + } + suffix.push(")"); + } + return suffix.join(""); + } + + async _render(str, data, options = {}) { + let { bypassMarkdown, type } = options; + + try { + if (bypassMarkdown && !this.engine.needsCompilation(str)) { + return str; + } + + let fn = await this.compile(str, { + bypassMarkdown, + engineOverride: data[this.config.keys.engineOverride], + type, + }); + + if (fn === undefined) { + return; + } else if (typeof fn !== "function") { + throw new Error(`The \`compile\` function did not return a function. Received ${fn}`); + } + + // Benchmark + let templateBenchmark = this.bench.get("Render"); + let inputPathBenchmark = this.bench.get( + `> Render${type ? ` ${type}` : ""} > ${this.inputPath}${this._getPaginationLogSuffix(data)}`, + ); + + templateBenchmark.before(); + if (inputPathBenchmark) { + inputPathBenchmark.before(); + } + + let rendered = await fn(data); + + if (inputPathBenchmark) { + inputPathBenchmark.after(); + } + templateBenchmark.after(); + debugDev("%o getCompiledTemplate called, rendered content created", this.inputPath); + return rendered; + } catch (e) { + if (EleventyErrorUtil.isPrematureTemplateContentError(e)) { + return Promise.reject(e); + } else { + let tr = await this.getTemplateRender(); + let engine = tr.getReadableEnginesList(); + debug(`Having trouble rendering ${engine} template ${this.inputPath}: %O`, str); + return Promise.reject( + new TemplateContentRenderError( + `Having trouble rendering ${engine} template ${this.inputPath}`, + e, + ), + ); + } + } + } + + getExtensionEntries() { + return this.engine.extensionEntries; + } + + isFileRelevantToThisTemplate(incrementalFile, metadata = {}) { + // always relevant if incremental file not set (build everything) + if (!incrementalFile) { + return true; + } + + let hasDependencies = this.engine.hasDependencies(incrementalFile); + + let isRelevant = this.engine.isFileRelevantTo(this.inputPath, incrementalFile); + + debug( + "Test dependencies to see if %o is relevant to %o: %o", + this.inputPath, + incrementalFile, + isRelevant, + ); + + let extensionEntries = this.getExtensionEntries().filter((entry) => !!entry.isIncrementalMatch); + if (extensionEntries.length) { + for (let entry of extensionEntries) { + if ( + entry.isIncrementalMatch.call( + { + inputPath: this.inputPath, + isFullTemplate: metadata.isFullTemplate, + isFileRelevantToInputPath: isRelevant, + doesFileHaveDependencies: hasDependencies, + }, + incrementalFile, + ) + ) { + return true; + } + } + + return false; + } else { + // Not great way of building all templates if this is a layout, include, JS dependency. + // TODO improve this for default template syntaxes + + // This is the fallback way of determining if something is incremental (no isIncrementalMatch available) + // This will be true if the inputPath and incrementalFile are the same + if (isRelevant) { + return true; + } + + // only return true here if dependencies are not known + if (!hasDependencies && !metadata.isFullTemplate) { + return true; + } + } + + return false; + } +} + +TemplateContent._inputCache = new Map(); +TemplateContent._compileCache = new Map(); +eventBus.on("eleventy.resourceModified", (path) => { + // delete from input cache + TemplateContent.deleteFromInputCache(path); + + // delete from compile cache + let normalized = TemplatePath.addLeadingDotSlash(path); + let compileCache = TemplateContent._compileCache.get(normalized); + if (compileCache) { + compileCache.clear(); + } +}); + +// Used when the configuration file reset https://github.com/11ty/eleventy/issues/2147 +eventBus.on("eleventy.compileCacheReset", () => { + TemplateContent._compileCache = new Map(); +}); + +export default TemplateContent; diff --git a/node_modules/@11ty/eleventy/src/TemplateFileSlug.js b/node_modules/@11ty/eleventy/src/TemplateFileSlug.js new file mode 100644 index 00000000..03c9a29e --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplateFileSlug.js @@ -0,0 +1,57 @@ +import path from "node:path"; +import { TemplatePath } from "@11ty/eleventy-utils"; + +class TemplateFileSlug { + constructor(inputPath, extensionMap, eleventyConfig) { + let inputDir = eleventyConfig.directories.input; + if (inputDir) { + inputPath = TemplatePath.stripLeadingSubPath(inputPath, inputDir); + } + + this.inputPath = inputPath; + this.cleanInputPath = inputPath.replace(/^.\//, ""); + + let dirs = this.cleanInputPath.split("/"); + this.dirs = dirs; + this.dirs.pop(); + + this.parsed = path.parse(inputPath); + this.filenameNoExt = extensionMap.removeTemplateExtension(this.parsed.base); + } + + // `page.filePathStem` see https://v3.11ty.dev/docs/data-eleventy-supplied/#page-variable + getFullPathWithoutExtension() { + return "/" + TemplatePath.join(...this.dirs, this._getRawSlug()); + } + + _getRawSlug() { + let slug = this.filenameNoExt; + return this._stripDateFromSlug(slug); + } + + /** Removes dates in the format of YYYY-MM-DD from a given slug string candidate. */ + _stripDateFromSlug(slug) { + let reg = slug.match(/\d{4}-\d{2}-\d{2}-(.*)/); + if (reg) { + return reg[1]; + } + return slug; + } + + // `page.fileSlug` see https://v3.11ty.dev/docs/data-eleventy-supplied/#page-variable + getSlug() { + let rawSlug = this._getRawSlug(); + + if (rawSlug === "index") { + if (!this.dirs.length) { + return ""; + } + let lastDir = this.dirs[this.dirs.length - 1]; + return this._stripDateFromSlug(lastDir); + } + + return rawSlug; + } +} + +export default TemplateFileSlug; diff --git a/node_modules/@11ty/eleventy/src/TemplateGlob.js b/node_modules/@11ty/eleventy/src/TemplateGlob.js new file mode 100644 index 00000000..9db85e92 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplateGlob.js @@ -0,0 +1,35 @@ +import { TemplatePath } from "@11ty/eleventy-utils"; + +class TemplateGlob { + static normalizePath(...paths) { + if (paths[0].charAt(0) === "!") { + throw new Error( + `TemplateGlob.normalizePath does not accept ! glob paths like: ${paths.join("")}`, + ); + } + return TemplatePath.addLeadingDotSlash(TemplatePath.join(...paths)); + } + + static normalize(path) { + path = path.trim(); + if (path.charAt(0) === "!") { + return "!" + TemplateGlob.normalizePath(path.slice(1)); + } else { + return TemplateGlob.normalizePath(path); + } + } + + static map(files) { + if (typeof files === "string") { + return TemplateGlob.normalize(files); + } else if (Array.isArray(files)) { + return files.map(function (path) { + return TemplateGlob.normalize(path); + }); + } else { + return files; + } + } +} + +export default TemplateGlob; diff --git a/node_modules/@11ty/eleventy/src/TemplateLayout.js b/node_modules/@11ty/eleventy/src/TemplateLayout.js new file mode 100644 index 00000000..f8526f23 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplateLayout.js @@ -0,0 +1,240 @@ +import { TemplatePath } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; + +import TemplateLayoutPathResolver from "./TemplateLayoutPathResolver.js"; +import TemplateContent from "./TemplateContent.js"; +import TemplateData from "./Data/TemplateData.js"; +import layoutCache from "./LayoutCache.js"; + +// const debug = debugUtil("Eleventy:TemplateLayout"); +const debugDev = debugUtil("Dev:Eleventy:TemplateLayout"); + +class TemplateLayout extends TemplateContent { + constructor(key, extensionMap, eleventyConfig) { + if (!eleventyConfig || eleventyConfig.constructor.name !== "TemplateConfig") { + throw new Error("Expected `eleventyConfig` in TemplateLayout constructor."); + } + + let resolver = new TemplateLayoutPathResolver(key, extensionMap, eleventyConfig); + let resolvedPath = resolver.getFullPath(); + + super(resolvedPath, eleventyConfig); + + if (!extensionMap) { + throw new Error("Expected `extensionMap` in TemplateLayout constructor."); + } + + this.extensionMap = extensionMap; + this.key = resolver.getNormalizedLayoutKey(); + this.dataKeyLayoutPath = key; + this.inputPath = resolvedPath; + } + + getKey() { + return this.key; + } + + getFullKey() { + return TemplateLayout.resolveFullKey(this.dataKeyLayoutPath, this.inputDir); + } + + getCacheKeys() { + return new Set([this.dataKeyLayoutPath, this.getFullKey(), this.key]); + } + + static resolveFullKey(key, inputDir) { + return TemplatePath.join(inputDir, key); + } + + static getTemplate(key, eleventyConfig, extensionMap) { + let config = eleventyConfig.getConfig(); + if (!config.useTemplateCache) { + return new TemplateLayout(key, extensionMap, eleventyConfig); + } + + let inputDir = eleventyConfig.directories.input; + let fullKey = TemplateLayout.resolveFullKey(key, inputDir); + if (!layoutCache.has(fullKey)) { + let layout = new TemplateLayout(key, extensionMap, eleventyConfig); + + layoutCache.add(layout); + debugDev("Added %o to LayoutCache", key); + + return layout; + } + + return layoutCache.get(fullKey); + } + + async getTemplateLayoutMapEntry() { + let { data: frontMatterData } = await this.getFrontMatterData(); + return { + // Used by `TemplateLayout.getTemplate()` + key: this.dataKeyLayoutPath, + + // used by `this.getData()` + frontMatterData, + }; + } + + async #getTemplateLayoutMap() { + // For both the eleventy.layouts event and cyclical layout chain checking (e.g., a => b => c => a) + let layoutChain = new Set(); + layoutChain.add(this.inputPath); + + let cfgKey = this.config.keys.layout; + let map = []; + let mapEntry = await this.getTemplateLayoutMapEntry(); + + map.push(mapEntry); + + while (mapEntry.frontMatterData && cfgKey in mapEntry.frontMatterData) { + // Layout of the current layout + let parentLayoutKey = mapEntry.frontMatterData[cfgKey]; + + let layout = TemplateLayout.getTemplate( + parentLayoutKey, + this.eleventyConfig, + this.extensionMap, + ); + + // Abort if a circular layout chain is detected. Otherwise, we'll time out and run out of memory. + if (layoutChain.has(layout.inputPath)) { + throw new Error( + `Your layouts have a circular reference, starting at ${map[0].key}! The layout at ${layout.inputPath} was specified twice in this layout chain.`, + ); + } + + // Keep track of this layout so we can detect duplicates in subsequent iterations + layoutChain.add(layout.inputPath); + + // reassign for next loop + mapEntry = await layout.getTemplateLayoutMapEntry(); + + map.push(mapEntry); + } + + this.layoutChain = Array.from(layoutChain); + + return map; + } + + async getTemplateLayoutMap() { + if (!this.cachedLayoutMap) { + this.cachedLayoutMap = this.#getTemplateLayoutMap(); + } + + return this.cachedLayoutMap; + } + + async getLayoutChain() { + if (!Array.isArray(this.layoutChain)) { + await this.getTemplateLayoutMap(); + } + + return this.layoutChain; + } + + async #getData() { + let map = await this.getTemplateLayoutMap(); + let dataToMerge = []; + for (let j = map.length - 1; j >= 0; j--) { + dataToMerge.push(map[j].frontMatterData); + } + + // Deep merge of layout front matter + let data = TemplateData.mergeDeep(this.config.dataDeepMerge, {}, ...dataToMerge); + delete data[this.config.keys.layout]; + + return data; + } + + async getData() { + if (!this.dataCache) { + this.dataCache = this.#getData(); + } + + return this.dataCache; + } + + async #getCachedCompiledLayoutFunction() { + let rawInput = await this.getPreRender(); + return this.compile(rawInput); + } + + // Do only cache this layout’s render function and delegate the rest to the other templates. + async getCachedCompiledLayoutFunction() { + if (!this.cachedCompiledLayoutFunction) { + this.cachedCompiledLayoutFunction = this.#getCachedCompiledLayoutFunction(); + } + + return this.cachedCompiledLayoutFunction; + } + + async getCompiledLayoutFunctions() { + let layoutMap = await this.getTemplateLayoutMap(); + let fns = []; + + try { + fns.push({ + render: await this.getCachedCompiledLayoutFunction(), + }); + + if (layoutMap.length > 1) { + let [, /*currentLayout*/ parentLayout] = layoutMap; + let { key } = parentLayout; + + let layoutTemplate = TemplateLayout.getTemplate( + key, + this.eleventyConfig, + this.extensionMap, + ); + + // The parent already includes the rest of the layout chain + let upstreamFns = await layoutTemplate.getCompiledLayoutFunctions(); + for (let j = 0, k = upstreamFns.length; j < k; j++) { + fns.push(upstreamFns[j]); + } + } + + return fns; + } catch (e) { + debugDev("Clearing LayoutCache after error."); + layoutCache.clear(); + throw e; + } + } + + async render() { + throw new Error("Internal error: `render` was removed from TemplateLayout.js in Eleventy 3.0."); + } + + // Inefficient? We want to compile all the templatelayouts into a single reusable callback? + // Trouble: layouts may need data variables present downstream/upstream + // This is called from Template->renderPageEntry + async renderPageEntry(pageEntry) { + let templateContent = pageEntry.templateContent; + let compiledFunctions = await this.getCompiledLayoutFunctions(); + for (let { render } of compiledFunctions) { + let data = { + content: templateContent, + ...pageEntry.data, + }; + + templateContent = await render(data); + } + + // Don’t set `templateContent` on pageEntry because collection items should not have layout markup + return templateContent; + } + + resetCaches(types) { + super.resetCaches(types); + delete this.dataCache; + delete this.layoutChain; + delete this.cachedLayoutMap; + delete this.cachedCompiledLayoutFunction; + } +} + +export default TemplateLayout; diff --git a/node_modules/@11ty/eleventy/src/TemplateLayoutPathResolver.js b/node_modules/@11ty/eleventy/src/TemplateLayoutPathResolver.js new file mode 100644 index 00000000..9f5a8ee6 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplateLayoutPathResolver.js @@ -0,0 +1,136 @@ +import fs from "node:fs"; +import { TemplatePath } from "@11ty/eleventy-utils"; +// import debugUtil from "debug"; +// const debug = debugUtil("Eleventy:TemplateLayoutPathResolver"); + +class TemplateLayoutPathResolver { + constructor(path, extensionMap, templateConfig) { + if (!templateConfig) { + throw new Error("Expected `templateConfig` in TemplateLayoutPathResolver constructor"); + } + + this.templateConfig = templateConfig; + this.originalPath = path; + this.originalDisplayPath = + TemplatePath.join(this.layoutsDir, this.originalPath) + + ` (via \`layout: ${this.originalPath}\`)`; // for error messaging + + this.path = path; + this.aliases = {}; + this.extensionMap = extensionMap; + if (!extensionMap) { + throw new Error("Expected `extensionMap` in TemplateLayoutPathResolver constructor."); + } + + this.init(); + } + + getVirtualTemplate(layoutPath) { + let inputDirRelativePath = + this.templateConfig.directories.getLayoutPathRelativeToInputDirectory(layoutPath); + return this.config.virtualTemplates[inputDirRelativePath]; + } + + get dirs() { + return this.templateConfig.directories; + } + + get inputDir() { + return this.dirs.input; + } + + get layoutsDir() { + return this.dirs.layouts || this.dirs.includes; + } + + /* Backwards compat */ + getLayoutsDir() { + return this.layoutsDir; + } + + setAliases() { + this.aliases = Object.assign({}, this.config.layoutAliases, this.aliases); + } + + // for testing + set config(cfg) { + this._config = cfg; + this.init(); + } + + get config() { + if (!this.templateConfig) { + throw new Error("Internal error: Missing this.templateConfig"); + } + + return this.templateConfig.getConfig(); + } + + exists(layoutPath) { + if (this.getVirtualTemplate(layoutPath)) { + return true; + } + let fullPath = this.templateConfig.directories.getLayoutPath(layoutPath); + if (this.templateConfig.existsCache.exists(fullPath)) { + return true; + } + return false; + } + + init() { + // we might be able to move this into the constructor? + this.aliases = Object.assign({}, this.config.layoutAliases, this.aliases); + + if (this.aliases[this.path]) { + this.path = this.aliases[this.path]; + } + + let useLayoutResolution = this.config.layoutResolution; + + if (this.path.split(".").length > 0 && this.exists(this.path)) { + this.filename = this.path; + this.fullPath = this.templateConfig.directories.getLayoutPath(this.path); + } else if (useLayoutResolution) { + this.filename = this.findFileName(); + this.fullPath = this.templateConfig.directories.getLayoutPath(this.filename || ""); + } + } + + addLayoutAlias(from, to) { + this.aliases[from] = to; + } + + getFileName() { + if (!this.filename) { + throw new Error( + `You’re trying to use a layout that does not exist: ${this.originalDisplayPath}`, + ); + } + + return this.filename; + } + + getFullPath() { + if (!this.filename) { + throw new Error( + `You’re trying to use a layout that does not exist: ${this.originalDisplayPath}`, + ); + } + + return this.fullPath; + } + + findFileName() { + for (let filename of this.extensionMap.getFileList(this.path)) { + if (this.exists(filename)) { + return filename; + } + } + } + + getNormalizedLayoutKey() { + return TemplatePath.stripLeadingSubPath(this.fullPath, this.layoutsDir); + } +} + +export default TemplateLayoutPathResolver; diff --git a/node_modules/@11ty/eleventy/src/TemplateMap.js b/node_modules/@11ty/eleventy/src/TemplateMap.js new file mode 100644 index 00000000..52cceb18 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplateMap.js @@ -0,0 +1,684 @@ +import { isPlainObject, TemplatePath } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; + +import TemplateCollection from "./TemplateCollection.js"; +import EleventyErrorUtil from "./Errors/EleventyErrorUtil.js"; +import UsingCircularTemplateContentReferenceError from "./Errors/UsingCircularTemplateContentReferenceError.js"; +import EleventyBaseError from "./Errors/EleventyBaseError.js"; +import DuplicatePermalinkOutputError from "./Errors/DuplicatePermalinkOutputError.js"; +import TemplateData from "./Data/TemplateData.js"; +import GlobalDependencyMap from "./GlobalDependencyMap.js"; + +const debug = debugUtil("Eleventy:TemplateMap"); + +class EleventyMapPagesError extends EleventyBaseError {} +class EleventyDataSchemaError extends EleventyBaseError {} + +// These template URL filenames are allowed to exclude file extensions +const EXTENSIONLESS_URL_ALLOWLIST = [ + "/_redirects", // Netlify specific + "/.htaccess", // Apache + "/_headers", // Cloudflare +]; + +// must match TemplateDepGraph +const SPECIAL_COLLECTION_NAMES = { + keys: "[keys]", + all: "all", +}; + +class TemplateMap { + #dependencyMapInitialized = false; + + constructor(eleventyConfig) { + if (!eleventyConfig || eleventyConfig.constructor.name !== "TemplateConfig") { + throw new Error("Missing or invalid `eleventyConfig` argument."); + } + this.eleventyConfig = eleventyConfig; + this.map = []; + this.collectionsData = null; + this.cached = false; + this.verboseOutput = true; + this.collection = new TemplateCollection(); + } + + set userConfig(config) { + this._userConfig = config; + } + + get userConfig() { + if (!this._userConfig) { + // TODO use this.config for this, need to add collections to mergeable props in userconfig + this._userConfig = this.eleventyConfig.userConfig; + } + + return this._userConfig; + } + + get config() { + if (!this._config) { + this._config = this.eleventyConfig.getConfig(); + } + return this._config; + } + + async add(template) { + if (!template) { + return; + } + + let data = await template.getData(); + let entries = await template.getTemplateMapEntries(data); + + for (let map of entries) { + this.map.push(map); + } + } + + getMap() { + return this.map; + } + + getTagTarget(str) { + if (str === "collections") { + // special, means targeting `collections` specifically + return SPECIAL_COLLECTION_NAMES.keys; + } + + if (str.startsWith("collections.")) { + return str.slice("collections.".length); + } + + // Fixes #2851 + if (str.startsWith("collections['") || str.startsWith('collections["')) { + return str.slice("collections['".length, -2); + } + } + + getPaginationTagTarget(entry) { + if (entry.data.pagination?.data) { + return this.getTagTarget(entry.data.pagination.data); + } + } + + #addEntryToGlobalDependencyGraph(entry) { + let consumes = []; + consumes.push(this.getPaginationTagTarget(entry)); + + if (Array.isArray(entry.data.eleventyImport?.collections)) { + for (let tag of entry.data.eleventyImport.collections) { + consumes.push(tag); + } + } + + // Important: consumers must come before publishers + + // TODO it’d be nice to set the dependency relationship for addCollection here + // But collections are not yet populated (they populate after template order) + let publishes = TemplateData.getIncludedCollectionNames(entry.data); + + this.config.uses.addNewNodeRelationships(entry.inputPath, consumes, publishes); + } + + addAllToGlobalDependencyGraph() { + this.#dependencyMapInitialized = true; + + // Should come before individual entry additions + this.config.uses.initializeUserConfigurationApiCollections(); + + for (let entry of this.map) { + this.#addEntryToGlobalDependencyGraph(entry); + } + } + + async setCollectionByTagName(tagName) { + if (this.isUserConfigCollectionName(tagName)) { + // async + this.collectionsData[tagName] = await this.getUserConfigCollection(tagName); + } else { + this.collectionsData[tagName] = this.getTaggedCollection(tagName); + } + + let precompiled = this.config.precompiledCollections; + if (precompiled?.[tagName]) { + if ( + tagName === "all" || + !Array.isArray(this.collectionsData[tagName]) || + this.collectionsData[tagName].length === 0 + ) { + this.collectionsData[tagName] = precompiled[tagName]; + } + } + } + + // TODO(slightlyoff): major bottleneck + async initDependencyMap(fullTemplateOrder) { + // Temporary workaround for async constructor work in templates + // Issue #3170 #3870 + let inputPathSet = new Set(fullTemplateOrder); + await Promise.all( + this.map + .filter(({ inputPath }) => { + return inputPathSet.has(inputPath); + }) + .map(({ template }) => { + // This also happens for layouts in TemplateContent->compile + return template.asyncTemplateInitialization(); + }), + ); + + for (let depEntry of fullTemplateOrder) { + if (GlobalDependencyMap.isCollection(depEntry)) { + let tagName = GlobalDependencyMap.getTagName(depEntry); + // [keys] should initialize `all` + if (tagName === SPECIAL_COLLECTION_NAMES.keys) { + await this.setCollectionByTagName("all"); + // [NAME] is special and implied (e.g. [keys]) + } else if (!tagName.startsWith("[") && !tagName.endsWith("]")) { + // is a tag (collection) entry + await this.setCollectionByTagName(tagName); + } + continue; + } + + // is a template entry + let map = this.getMapEntryForInputPath(depEntry); + await this.#initDependencyMapEntry(map); + } + } + + async #initDependencyMapEntry(map) { + try { + map._pages = await map.template.getTemplates(map.data); + } catch (e) { + throw new EleventyMapPagesError( + "Error generating template page(s) for " + map.inputPath + ".", + e, + ); + } + + if (map._pages.length === 0) { + // Reminder: a serverless code path was removed here. + } else { + let counter = 0; + for (let page of map._pages) { + // Copy outputPath to map entry + // This is no longer used internally, just for backwards compatibility + // Error added in v3 for https://github.com/11ty/eleventy/issues/3183 + if (map.data.pagination) { + if (!Object.prototype.hasOwnProperty.call(map, "outputPath")) { + Object.defineProperty(map, "outputPath", { + get() { + throw new Error( + "Internal error: `.outputPath` on a paginated map entry is not consistent. Use `_pages[…].outputPath` instead.", + ); + }, + }); + } + } else if (!map.outputPath) { + map.outputPath = page.outputPath; + } + + if (counter === 0 || map.data.pagination?.addAllPagesToCollections) { + if (map.data.eleventyExcludeFromCollections !== true) { + // is in *some* collections + this.collection.add(page); + } + } + + counter++; + } + } + } + + getTemplateOrder() { + // 1. Templates that don’t use Pagination + // 2. Pagination templates that consume config API collections + // 3. Pagination templates consuming `collections` + // 4. Pagination templates consuming `collections.all` + let fullTemplateOrder = this.config.uses.getTemplateOrder(); + + return fullTemplateOrder + .map((entry) => { + if (GlobalDependencyMap.isCollection(entry)) { + return entry; + } + + let inputPath = TemplatePath.addLeadingDotSlash(entry); + if (!this.hasMapEntryForInputPath(inputPath)) { + return false; + } + return inputPath; + }) + .filter(Boolean); + } + + async cache() { + if (!this.#dependencyMapInitialized) { + this.addAllToGlobalDependencyGraph(); + } + + this.collectionsData = {}; + + for (let entry of this.map) { + entry.data.collections = this.collectionsData; + } + + let fullTemplateOrder = this.getTemplateOrder(); + debug( + "Rendering templates in order (%o concurrency): %O", + this.userConfig.getConcurrency(), + fullTemplateOrder, + ); + + await this.initDependencyMap(fullTemplateOrder); + await this.resolveRemainingComputedData(); + + let orderedPaths = this.#removeTagsFromTemplateOrder(fullTemplateOrder); + + let orderedMap = orderedPaths.map((inputPath) => { + return this.getMapEntryForInputPath(inputPath); + }); + + await this.config.events.emitLazy("eleventy.contentMap", () => { + return { + inputPathToUrl: this.generateInputUrlContentMap(orderedMap), + urlToInputPath: this.generateUrlMap(orderedMap), + }; + }); + + await this.runDataSchemas(orderedMap); + await this.populateContentDataInMap(orderedMap); + + this.populateCollectionsWithContent(); + this.cached = true; + + this.checkForDuplicatePermalinks(); + this.checkForMissingFileExtensions(); + + await this.config.events.emitLazy("eleventy.layouts", () => this.generateLayoutsMap()); + } + + generateInputUrlContentMap(orderedMap) { + let entries = {}; + for (let entry of orderedMap) { + entries[entry.inputPath] = entry._pages.map((entry) => entry.url); + } + return entries; + } + + generateUrlMap(orderedMap) { + let entries = {}; + for (let entry of orderedMap) { + for (let page of entry._pages) { + // duplicate urls throw an error, so we can return non array here + entries[page.url] = { + inputPath: entry.inputPath, + groupNumber: page.groupNumber, + }; + } + } + return entries; + } + + hasMapEntryForInputPath(inputPath) { + return Boolean(this.getMapEntryForInputPath(inputPath)); + } + + // TODO(slightlyoff): hot inner loop? + getMapEntryForInputPath(inputPath) { + let absoluteInputPath = TemplatePath.absolutePath(inputPath); + return this.map.find((entry) => { + if (entry.inputPath === inputPath || entry.inputPath === absoluteInputPath) { + return entry; + } + }); + } + + #removeTagsFromTemplateOrder(maps) { + return maps.filter((dep) => !GlobalDependencyMap.isCollection(dep)); + } + + async runDataSchemas(orderedMap) { + for (let map of orderedMap) { + if (!map._pages) { + continue; + } + + for (let pageEntry of map._pages) { + // Data Schema callback #879 + if (typeof pageEntry.data[this.config.keys.dataSchema] === "function") { + try { + await pageEntry.data[this.config.keys.dataSchema](pageEntry.data); + } catch (e) { + throw new EleventyDataSchemaError( + `Error in the data schema for: ${map.inputPath} (via \`eleventyDataSchema\`)`, + e, + ); + } + } + } + } + } + + async populateContentDataInMap(orderedMap) { + let usedTemplateContentTooEarlyMap = []; + + // Note that empty pagination templates will be skipped here as not renderable + let filteredMap = orderedMap.filter((entry) => entry.template.isRenderable()); + + // Get concurrency level from user config + const concurrency = this.userConfig.getConcurrency(); + + // Process the templates in chunks to limit concurrency + // This replaces the functionality of p-map's concurrency option + for (let i = 0; i < filteredMap.length; i += concurrency) { + // Create a chunk of tasks that will run in parallel + const chunk = filteredMap.slice(i, i + concurrency); + + // Run the chunk of tasks in parallel + await Promise.all( + chunk.map(async (map) => { + if (!map._pages) { + throw new Error(`Internal error: _pages not found for ${map.inputPath}`); + } + + // IMPORTANT: this is where template content is rendered + try { + for (let pageEntry of map._pages) { + pageEntry.templateContent = + await pageEntry.template.renderPageEntryWithoutLayout(pageEntry); + } + } catch (e) { + if (EleventyErrorUtil.isPrematureTemplateContentError(e)) { + // Add to list of templates that need to be processed again + usedTemplateContentTooEarlyMap.push(map); + + // Reset cached render promise + for (let pageEntry of map._pages) { + pageEntry.template.resetCaches({ render: true }); + } + } else { + throw e; + } + } + }), + ); + } + + // Process templates that had premature template content errors + // This is the second pass for templates that couldn't be rendered in the first pass + for (let map of usedTemplateContentTooEarlyMap) { + try { + for (let pageEntry of map._pages) { + pageEntry.templateContent = + await pageEntry.template.renderPageEntryWithoutLayout(pageEntry); + } + } catch (e) { + if (EleventyErrorUtil.isPrematureTemplateContentError(e)) { + // If we still have template content errors after the second pass, + // it's likely a circular reference + throw new UsingCircularTemplateContentReferenceError( + `${map.inputPath} contains a circular reference (using collections) to its own templateContent.`, + ); + } else { + // rethrow? + throw e; + } + } + } + } + + getTaggedCollection(tag) { + let result; + if (!tag || tag === "all") { + result = this.collection.getAllSorted(); + } else { + result = this.collection.getFilteredByTag(tag); + } + + // May not return an array (can be anything) + // https://www.11ty.dev/docs/collections-api/#return-values + debug(`Collection: collections.${tag || "all"} size: ${result?.length}`); + + return result; + } + + /* 3.0.0-alpha.1: setUserConfigCollections method removed (was only used for testing) */ + isUserConfigCollectionName(name) { + let collections = this.userConfig.getCollections(); + return name && !!collections[name]; + } + + getUserConfigCollectionNames() { + return Object.keys(this.userConfig.getCollections()); + } + + async getUserConfigCollection(name) { + let configCollections = this.userConfig.getCollections(); + + // This works with async now + let result = await configCollections[name](this.collection); + + // May not return an array (can be anything) + // https://www.11ty.dev/docs/collections-api/#return-values + debug(`Collection: collections.${name} size: ${result?.length}`); + return result; + } + + populateCollectionsWithContent() { + for (let collectionName in this.collectionsData) { + // skip custom collections set in configuration files that have arbitrary types + if (!Array.isArray(this.collectionsData[collectionName])) { + continue; + } + + for (let item of this.collectionsData[collectionName]) { + // skip custom collections set in configuration files that have arbitrary types + if (!isPlainObject(item) || !("inputPath" in item)) { + continue; + } + + let entry = this.getMapEntryForInputPath(item.inputPath); + // This check skips precompiled collections + if (entry) { + let index = item.pageNumber || 0; + let content = entry._pages[index]._templateContent; + if (content !== undefined) { + item.templateContent = content; + } + } + } + } + } + + async resolveRemainingComputedData() { + let promises = []; + for (let entry of this.map) { + for (let pageEntry of entry._pages) { + if (this.config.keys.computed in pageEntry.data) { + promises.push(pageEntry.template.resolveRemainingComputedData(pageEntry.data)); + } + } + } + return Promise.all(promises); + } + + async generateLayoutsMap() { + let layouts = {}; + + for (let entry of this.map) { + for (let page of entry._pages) { + let tmpl = page.template; + if (tmpl.templateUsesLayouts(page.data)) { + let layoutKey = page.data[this.config.keys.layout]; + let layout = tmpl.getLayout(layoutKey); + let layoutChain = await layout.getLayoutChain(); + let priors = []; + for (let filepath of layoutChain) { + if (!layouts[filepath]) { + layouts[filepath] = new Set(); + } + layouts[filepath].add(page.inputPath); + for (let prior of priors) { + layouts[filepath].add(prior); + } + priors.push(filepath); + } + } + } + } + + for (let key in layouts) { + layouts[key] = Array.from(layouts[key]); + } + + return layouts; + } + + #onEachPage(callback) { + for (let template of this.map) { + for (let page of template._pages) { + callback(page, template); + } + } + } + + checkForDuplicatePermalinks() { + let inputs = {}; + let outputPaths = {}; + let warnings = {}; + this.#onEachPage((page, template) => { + if (page.outputPath === false || page.url === false) { + // do nothing (also serverless) + } else { + // Make sure output doesn’t overwrite input (e.g. --input=. --output=.) + // Related to https://github.com/11ty/eleventy/issues/3327 + if (page.outputPath === page.inputPath) { + throw new DuplicatePermalinkOutputError( + `The template at "${page.inputPath}" attempted to overwrite itself.`, + ); + } else if (inputs[page.outputPath]) { + throw new DuplicatePermalinkOutputError( + `The template at "${page.inputPath}" attempted to overwrite an existing template at "${page.outputPath}".`, + ); + } + inputs[page.inputPath] = true; + + if (!outputPaths[page.outputPath]) { + outputPaths[page.outputPath] = [template.inputPath]; + } else { + warnings[page.outputPath] = `Output conflict: multiple input files are writing to \`${ + page.outputPath + }\`. Use distinct \`permalink\` values to resolve this conflict. + 1. ${template.inputPath} +${outputPaths[page.outputPath] + .map(function (inputPath, index) { + return ` ${index + 2}. ${inputPath}\n`; + }) + .join("")} +`; + outputPaths[page.outputPath].push(template.inputPath); + } + } + }); + + let warningList = Object.values(warnings); + if (warningList.length) { + // throw one at a time + throw new DuplicatePermalinkOutputError(warningList[0]); + } + } + + checkForMissingFileExtensions() { + // disabled in config + if (this.userConfig?.errorReporting?.allowMissingExtensions === true) { + return; + } + + this.#onEachPage((page) => { + if ( + page.outputPath === false || + page.url === false || + page.data.eleventyAllowMissingExtension || + EXTENSIONLESS_URL_ALLOWLIST.some((url) => page.url.endsWith(url)) + ) { + // do nothing (also serverless) + } else { + if (TemplatePath.getExtension(page.outputPath) === "") { + let e = + new Error(`The template at '${page.inputPath}' attempted to write to '${page.outputPath}'${page.data.permalink ? ` (via \`permalink\` value: '${page.data.permalink}')` : ""}, which is a target on the file system that does not include a file extension. + +You *probably* want to add a file extension to your permalink so that hosts will know how to correctly serve this file to web browsers. Without a file extension, this file may not be reliably deployed without additional hosting configuration (it won’t have a mime type) and may also cause local development issues if you later attempt to write to a subdirectory of the same name. + +Learn more: https://v3.11ty.dev/docs/permalinks/#trailing-slashes + +This is usually but not *always* an error so if you’d like to disable this error message, add \`eleventyAllowMissingExtension: true\` somewhere in the data cascade for this template or use \`eleventyConfig.configureErrorReporting({ allowMissingExtensions: true });\` to disable this feature globally.`); + e.skipOriginalStack = true; + throw e; + } + } + }); + } + + // TODO move these into TemplateMapTest.js + _testGetAllTags() { + let allTags = {}; + for (let map of this.map) { + let tags = map.data.tags; + if (Array.isArray(tags)) { + for (let tag of tags) { + allTags[tag] = true; + } + } + } + return Object.keys(allTags); + } + + async _testGetUserConfigCollectionsData() { + let collections = {}; + let configCollections = this.userConfig.getCollections(); + + for (let name in configCollections) { + collections[name] = configCollections[name](this.collection); + + debug(`Collection: collections.${name} size: ${collections[name].length}`); + } + + return collections; + } + + async _testGetTaggedCollectionsData() { + let collections = {}; + collections.all = this.collection.getAllSorted(); + debug(`Collection: collections.all size: ${collections.all.length}`); + + let tags = this._testGetAllTags(); + for (let tag of tags) { + collections[tag] = this.collection.getFilteredByTag(tag); + debug(`Collection: collections.${tag} size: ${collections[tag].length}`); + } + return collections; + } + + async _testGetAllCollectionsData() { + let collections = {}; + let taggedCollections = await this._testGetTaggedCollectionsData(); + Object.assign(collections, taggedCollections); + + let userConfigCollections = await this._testGetUserConfigCollectionsData(); + Object.assign(collections, userConfigCollections); + + return collections; + } + + async _testGetCollectionsData() { + if (!this.cached) { + await this.cache(); + } + + return this.collectionsData; + } +} + +export default TemplateMap; diff --git a/node_modules/@11ty/eleventy/src/TemplatePassthrough.js b/node_modules/@11ty/eleventy/src/TemplatePassthrough.js new file mode 100644 index 00000000..b27b634e --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplatePassthrough.js @@ -0,0 +1,389 @@ +import path from "node:path"; + +import { isDynamicPattern } from "tinyglobby"; +import { filesize } from "filesize"; +import copy from "@11ty/recursive-copy"; +import { TemplatePath } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; + +import EleventyBaseError from "./Errors/EleventyBaseError.js"; +import checkPassthroughCopyBehavior from "./Util/PassthroughCopyBehaviorCheck.js"; +import ProjectDirectories from "./Util/ProjectDirectories.js"; + +const debug = debugUtil("Eleventy:TemplatePassthrough"); + +class TemplatePassthroughError extends EleventyBaseError {} + +class TemplatePassthrough { + isDryRun = false; + #isInputPathGlob; + #benchmarks; + #isAlreadyNormalized = false; + #projectDirCheck = false; + + // paths already guaranteed from the autocopy plugin + static factory(inputPath, outputPath, opts = {}) { + let p = new TemplatePassthrough( + { + inputPath, + outputPath, + copyOptions: opts.copyOptions, + }, + opts.templateConfig, + ); + + return p; + } + + constructor(path, templateConfig) { + if (!templateConfig || templateConfig.constructor.name !== "TemplateConfig") { + throw new Error( + "Internal error: Missing `templateConfig` or was not an instance of `TemplateConfig`.", + ); + } + this.templateConfig = templateConfig; + + this.rawPath = path; + + // inputPath is relative to the root of your project and not your Eleventy input directory. + // TODO normalize these with forward slashes + this.inputPath = this.normalizeIfDirectory(path.inputPath); + this.#isInputPathGlob = isDynamicPattern(this.inputPath); + + this.outputPath = path.outputPath; + this.copyOptions = path.copyOptions; // custom options for recursive-copy + } + + get benchmarks() { + if (!this.#benchmarks) { + this.#benchmarks = { + aggregate: this.config.benchmarkManager.get("Aggregate"), + }; + } + + return this.#benchmarks; + } + + get config() { + return this.templateConfig.getConfig(); + } + + get directories() { + return this.templateConfig.directories; + } + + // inputDir is used when stripping from output path in `getOutputPath` + get inputDir() { + return this.templateConfig.directories.input; + } + + get outputDir() { + return this.templateConfig.directories.output; + } + + // Skips `getFiles()` normalization + setIsAlreadyNormalized(isNormalized) { + this.#isAlreadyNormalized = Boolean(isNormalized); + } + + setCheckSourceDirectory(check) { + this.#projectDirCheck = Boolean(check); + } + + /* { inputPath, outputPath } though outputPath is *not* the full path: just the output directory */ + getPath() { + return this.rawPath; + } + + async getOutputPath(inputFileFromGlob) { + let { inputDir, outputDir, outputPath, inputPath } = this; + + if (outputPath === true) { + // no explicit target, implied target + if (this.isDirectory(inputPath)) { + let inputRelativePath = TemplatePath.stripLeadingSubPath( + inputFileFromGlob || inputPath, + inputDir, + ); + return ProjectDirectories.normalizeDirectory( + TemplatePath.join(outputDir, inputRelativePath), + ); + } + + return TemplatePath.normalize( + TemplatePath.join( + outputDir, + TemplatePath.stripLeadingSubPath(inputFileFromGlob || inputPath, inputDir), + ), + ); + } + + if (inputFileFromGlob) { + return this.getOutputPathForGlobFile(inputFileFromGlob); + } + + // Has explicit target + + // Bug when copying incremental file overwriting output directory (and making it a file) + // e.g. public/test.css -> _site + // https://github.com/11ty/eleventy/issues/2278 + let fullOutputPath = TemplatePath.normalize(TemplatePath.join(outputDir, outputPath)); + if (outputPath === "" || this.isDirectory(inputPath)) { + fullOutputPath = ProjectDirectories.normalizeDirectory(fullOutputPath); + } + + // TODO room for improvement here: + if ( + !this.#isInputPathGlob && + this.isExists(inputPath) && + !this.isDirectory(inputPath) && + this.isDirectory(fullOutputPath) + ) { + let filename = path.parse(inputPath).base; + return TemplatePath.normalize(TemplatePath.join(fullOutputPath, filename)); + } + + return fullOutputPath; + } + + async getOutputPathForGlobFile(inputFileFromGlob) { + return TemplatePath.join( + await this.getOutputPath(), + TemplatePath.getLastPathSegment(inputFileFromGlob), + ); + } + + setDryRun(isDryRun) { + this.isDryRun = Boolean(isDryRun); + } + + setRunMode(runMode) { + this.runMode = runMode; + } + + setFileSystemSearch(fileSystemSearch) { + this.fileSystemSearch = fileSystemSearch; + } + + async getFiles(glob) { + debug("Searching for: %o", glob); + let b = this.benchmarks.aggregate.get("Searching the file system (passthrough)"); + b.before(); + + if (!this.fileSystemSearch) { + throw new Error("Internal error: Missing `fileSystemSearch` property."); + } + + // TODO perf this globs once per addPassthroughCopy entry + let files = TemplatePath.addLeadingDotSlashArray( + await this.fileSystemSearch.search("passthrough", glob, { + ignore: [ + // *only* ignores output dir (not node_modules!) + this.outputDir, + ], + }), + ); + b.after(); + return files; + } + + isExists(filePath) { + return this.templateConfig.existsCache.exists(filePath); + } + + isDirectory(filePath) { + return this.templateConfig.existsCache.isDirectory(filePath); + } + + // dir is guaranteed to exist by context + // dir may not be a directory + normalizeIfDirectory(input) { + if (typeof input === "string") { + if (input.endsWith(path.sep) || input.endsWith("/")) { + return input; + } + + // When inputPath is a directory, make sure it has a slash for passthrough copy aliasing + // https://github.com/11ty/eleventy/issues/2709 + if (this.isDirectory(input)) { + return `${input}/`; + } + } + + return input; + } + + // maps input paths to output paths + async getFileMap() { + if (this.#isAlreadyNormalized) { + return [ + { + inputPath: this.inputPath, + outputPath: this.outputPath, + }, + ]; + } + + // TODO VirtualFileSystem candidate + if (!isDynamicPattern(this.inputPath) && this.isExists(this.inputPath)) { + return [ + { + inputPath: this.inputPath, + outputPath: await this.getOutputPath(), + }, + ]; + } + + let paths = []; + // If not directory or file, attempt to get globs + let files = await this.getFiles(this.inputPath); + for (let filePathFromGlob of files) { + paths.push({ + inputPath: filePathFromGlob, + outputPath: await this.getOutputPath(filePathFromGlob), + }); + } + + return paths; + } + + /* Types: + * 1. via glob, individual files found + * 2. directory, triggers an event for each file + * 3. individual file + */ + async copy(src, dest, copyOptions) { + if (this.#projectDirCheck && !this.directories.isFileInProjectFolder(src)) { + return Promise.reject( + new TemplatePassthroughError( + "Source file is not in the project directory. Check your passthrough paths.", + ), + ); + } + + if (!this.directories.isFileInOutputFolder(dest)) { + return Promise.reject( + new TemplatePassthroughError( + "Destination is not in the site output directory. Check your passthrough paths.", + ), + ); + } + + let fileCopyCount = 0; + let fileSizeCount = 0; + let map = {}; + let b = this.benchmarks.aggregate.get("Passthrough Copy File"); + + // returns a promise + return copy(src, dest, copyOptions) + .on(copy.events.COPY_FILE_START, (copyOp) => { + // Access to individual files at `copyOp.src` + map[copyOp.src] = copyOp.dest; + b.before(); + }) + .on(copy.events.COPY_FILE_COMPLETE, (copyOp) => { + fileCopyCount++; + fileSizeCount += copyOp.stats.size; + if (copyOp.stats.size > 5000000) { + debug(`Copied %o (⚠️ large) file from %o`, filesize(copyOp.stats.size), copyOp.src); + } else { + debug(`Copied %o file from %o`, filesize(copyOp.stats.size), copyOp.src); + } + b.after(); + }) + .then( + () => { + return { + count: fileCopyCount, + size: fileSizeCount, + map, + }; + }, + (error) => { + if (copyOptions.overwrite === false && error.code === "EEXIST") { + // just ignore if the output already exists and overwrite: false + debug("Overwrite error ignored: %O", error); + return { + count: 0, + size: 0, + map, + }; + } + + return Promise.reject(error); + }, + ); + } + + async write() { + if (this.isDryRun) { + return Promise.resolve({ + count: 0, + map: {}, + }); + } + + debug("Copying %o", this.inputPath); + let fileMap = await this.getFileMap(); + + // default options for recursive-copy + // see https://www.npmjs.com/package/recursive-copy#arguments + let copyOptionsDefault = { + overwrite: true, // overwrite output. fails when input is directory (mkdir) and output is file + dot: true, // copy dotfiles + junk: false, // copy cache files like Thumbs.db + results: false, + expand: false, // follow symlinks (matches recursive-copy default) + debug: false, // (matches recursive-copy default) + + // Note: `filter` callback function only passes in a relative path, which is unreliable + // See https://github.com/timkendrick/recursive-copy/blob/4c9a8b8a4bf573285e9c4a649a30a2b59ccf441c/lib/copy.js#L59 + // e.g. `{ filePaths: [ './img/coolkid.jpg' ], relativePaths: [ '' ] }` + }; + + let copyOptions = Object.assign(copyOptionsDefault, this.copyOptions); + + let promises = fileMap.map((entry) => { + // For-free passthrough copy + if (checkPassthroughCopyBehavior(this.config, this.runMode)) { + let aliasMap = {}; + aliasMap[entry.inputPath] = entry.outputPath; + + return Promise.resolve({ + count: 0, + map: aliasMap, + }); + } + + // Copy the files (only in build mode) + return this.copy(entry.inputPath, entry.outputPath, copyOptions); + }); + + // IMPORTANT: this returns an array of promises, does not await for promise to finish + return Promise.all(promises).then( + (results) => { + // collate the count and input/output map results from the array. + let count = 0; + let size = 0; + let map = {}; + + for (let result of results) { + count += result.count; + size += result.size; + Object.assign(map, result.map); + } + + return { + count, + size, + map, + }; + }, + (err) => { + throw new TemplatePassthroughError(`Error copying passthrough files: ${err.message}`, err); + }, + ); + } +} + +export default TemplatePassthrough; diff --git a/node_modules/@11ty/eleventy/src/TemplatePassthroughManager.js b/node_modules/@11ty/eleventy/src/TemplatePassthroughManager.js new file mode 100644 index 00000000..114dfa93 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplatePassthroughManager.js @@ -0,0 +1,368 @@ +import { isDynamicPattern } from "tinyglobby"; +import { TemplatePath } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; + +import EleventyBaseError from "./Errors/EleventyBaseError.js"; +import TemplatePassthrough from "./TemplatePassthrough.js"; +import checkPassthroughCopyBehavior from "./Util/PassthroughCopyBehaviorCheck.js"; +import { isGlobMatch } from "./Util/GlobMatcher.js"; +import { withResolvers } from "./Util/PromiseUtil.js"; + +const debug = debugUtil("Eleventy:TemplatePassthroughManager"); + +class TemplatePassthroughManagerCopyError extends EleventyBaseError {} + +class TemplatePassthroughManager { + #isDryRun = false; + #afterBuild; + #queue = new Map(); + #extensionMap; + + constructor(templateConfig) { + if (!templateConfig || templateConfig.constructor.name !== "TemplateConfig") { + throw new Error("Internal error: Missing or invalid `templateConfig` argument."); + } + + this.templateConfig = templateConfig; + this.config = templateConfig.getConfig(); + + // eleventy# event listeners are removed on each build + this.config.events.on("eleventy#copy", ({ source, target, options }) => { + this.enqueueCopy(source, target, options); + }); + + this.config.events.on("eleventy#beforerender", () => { + this.#afterBuild = withResolvers(); + }); + + this.config.events.on("eleventy#render", () => { + let { resolve } = this.#afterBuild; + resolve(); + }); + + this.reset(); + } + + reset() { + this.count = 0; + this.size = 0; + this.conflictMap = {}; + this.incrementalFile; + + this.#queue = new Map(); + } + + set extensionMap(extensionMap) { + this.#extensionMap = extensionMap; + } + + get extensionMap() { + if (!this.#extensionMap) { + throw new Error("Internal error: missing `extensionMap` in TemplatePassthroughManager."); + } + return this.#extensionMap; + } + + get inputDir() { + return this.templateConfig.directories.input; + } + + get outputDir() { + return this.templateConfig.directories.output; + } + + setDryRun(isDryRun) { + this.#isDryRun = Boolean(isDryRun); + } + + setRunMode(runMode) { + this.runMode = runMode; + } + + setIncrementalFile(path) { + if (path) { + this.incrementalFile = path; + } + } + + resetIncrementalFile() { + this.incrementalFile = undefined; + } + + _normalizePaths(path, outputPath, copyOptions = {}) { + return { + inputPath: TemplatePath.addLeadingDotSlash(path), + outputPath: outputPath ? TemplatePath.stripLeadingDotSlash(outputPath) : true, + copyOptions, + }; + } + + getConfigPaths() { + let paths = []; + let pathsRaw = this.config.passthroughCopies || {}; + debug("`addPassthroughCopy` config API paths: %o", pathsRaw); + for (let [inputPath, { outputPath, copyOptions }] of Object.entries(pathsRaw)) { + paths.push(this._normalizePaths(inputPath, outputPath, copyOptions)); + } + debug("`addPassthroughCopy` config API normalized paths: %o", paths); + return paths; + } + + getConfigPathGlobs() { + return this.getConfigPaths().map((path) => { + return TemplatePath.convertToRecursiveGlobSync(path.inputPath); + }); + } + + getNonTemplatePaths(paths) { + let matches = []; + for (let path of paths) { + if (!this.extensionMap.hasEngine(path)) { + matches.push(path); + } + } + + return matches; + } + + getCopyCount() { + return this.count; + } + + getCopySize() { + return this.size; + } + + getMetadata() { + return { + copyCount: this.getCopyCount(), + copySize: this.getCopySize(), + }; + } + + setFileSystemSearch(fileSystemSearch) { + this.fileSystemSearch = fileSystemSearch; + } + + getTemplatePassthroughForPath(path) { + let inst = new TemplatePassthrough(path, this.templateConfig); + + inst.setFileSystemSearch(this.fileSystemSearch); + inst.setDryRun(this.#isDryRun); + inst.setRunMode(this.runMode); + + return inst; + } + + async copyPassthrough(pass) { + if (!(pass instanceof TemplatePassthrough)) { + throw new TemplatePassthroughManagerCopyError( + "copyPassthrough expects an instance of TemplatePassthrough", + ); + } + + let { inputPath } = pass.getPath(); + + // TODO https://github.com/11ty/eleventy/issues/2452 + // De-dupe both the input and output paired together to avoid the case + // where an input/output pair has been added via multiple passthrough methods (glob, file suffix, etc) + // Probably start with the `filter` callback in recursive-copy but it only passes relative paths + // See the note in TemplatePassthrough.js->write() + + // Also note that `recursive-copy` handles repeated overwrite copy to the same destination just fine. + // e.g. `for(let j=0, k=1000; j { + for (let src in map) { + let dest = map[src]; + if (this.conflictMap[dest]) { + if (src !== this.conflictMap[dest]) { + let paths = [src, this.conflictMap[dest]].sort(); + throw new TemplatePassthroughManagerCopyError( + `Multiple passthrough copy files are trying to write to the same output file (${TemplatePath.standardizeFilePath(dest)}). ${paths.map((p) => TemplatePath.standardizeFilePath(p)).join(" and ")}`, + ); + } else { + // Multiple entries from the same source + debug( + "A passthrough copy entry (%o) caused the same file (%o) to be copied more than once to the output (%o). This is atomically safe but a waste of build resources.", + inputPath, + src, + dest, + ); + } + } + + this.conflictMap[dest] = src; + } + + if (pass.isDryRun) { + // We don’t count the skipped files as we need to iterate over them + debug( + "Skipped %o (either from --dryrun or --incremental or for-free passthrough copy)", + inputPath, + ); + } else { + if (count) { + this.count += count; + this.size += size; + debug("Copied %o (%d files, %d size)", inputPath, count || 0, size || 0); + } else { + debug("Skipped copying %o (emulated passthrough copy)", inputPath); + } + } + + return { + count, + map, + }; + }, + function (e) { + return Promise.reject( + new TemplatePassthroughManagerCopyError(`Having trouble copying '${inputPath}'`, e), + ); + }, + ); + } + + isPassthroughCopyFile(paths, changedFile) { + if (!changedFile) { + return false; + } + + // passthrough copy by non-matching engine extension (via templateFormats) + for (let path of paths) { + if (path === changedFile && !this.extensionMap.hasEngine(path)) { + return true; + } + } + + for (let path of this.getConfigPaths()) { + if (TemplatePath.startsWithSubPath(changedFile, path.inputPath)) { + return path; + } + if ( + changedFile && + isDynamicPattern(path.inputPath) && + isGlobMatch(changedFile, [path.inputPath]) + ) { + return path; + } + } + + return false; + } + + getAllNormalizedPaths(paths = []) { + if (this.incrementalFile) { + let isPassthrough = this.isPassthroughCopyFile(paths, this.incrementalFile); + + if (isPassthrough) { + if (isPassthrough.outputPath) { + return [isPassthrough]; + } + + return [this._normalizePaths(this.incrementalFile)]; + } + + // Fixes https://github.com/11ty/eleventy/issues/2491 + if (!checkPassthroughCopyBehavior(this.config, this.runMode)) { + return []; + } + } + + let normalizedPaths = this.getConfigPaths(); + if (debug.enabled) { + for (let path of normalizedPaths) { + debug("TemplatePassthrough copying from config: %o", path); + } + } + + if (paths?.length) { + let passthroughPaths = this.getNonTemplatePaths(paths); + for (let path of passthroughPaths) { + let normalizedPath = this._normalizePaths(path); + + debug( + `TemplatePassthrough copying from non-matching file extension: ${normalizedPath.inputPath}`, + ); + + normalizedPaths.push(normalizedPath); + } + } + + return normalizedPaths; + } + + // keys: output + // values: input + getAliasesFromPassthroughResults(result) { + let entries = {}; + for (let entry of result) { + for (let src in entry.map) { + let dest = TemplatePath.stripLeadingSubPath(entry.map[src], this.outputDir); + entries["/" + encodeURI(dest)] = src; + } + } + return entries; + } + + async #waitForTemplatesRendered() { + if (!this.#afterBuild) { + return Promise.resolve(); // immediately resolve + } + + let { promise } = this.#afterBuild; + return promise; + } + + enqueueCopy(source, target, copyOptions) { + let key = `${source}=>${target}`; + + // light de-dupe the same source/target combo (might be in the same file, might be viaTransforms) + if (this.#queue.has(key)) { + return; + } + + let passthrough = TemplatePassthrough.factory(source, target, { + templateConfig: this.templateConfig, + copyOptions, + }); + + passthrough.setCheckSourceDirectory(true); + passthrough.setIsAlreadyNormalized(true); + passthrough.setRunMode(this.runMode); + passthrough.setDryRun(this.#isDryRun); + + this.#queue.set(key, this.copyPassthrough(passthrough)); + } + + async copyAll(templateExtensionPaths) { + debug("TemplatePassthrough copy started."); + let normalizedPaths = this.getAllNormalizedPaths(templateExtensionPaths); + + let passthroughs = normalizedPaths.map((path) => this.getTemplatePassthroughForPath(path)); + + let promises = passthroughs.map((pass) => this.copyPassthrough(pass)); + + await this.#waitForTemplatesRendered(); + + for (let [key, afterBuildCopyPromises] of this.#queue) { + promises.push(afterBuildCopyPromises); + } + + return Promise.all(promises).then(async (results) => { + let aliases = this.getAliasesFromPassthroughResults(results); + await this.config.events.emit("eleventy.passthrough", { + map: aliases, + }); + + debug(`TemplatePassthrough copy finished. Current count: ${this.count} (size: ${this.size})`); + return results; + }); + } +} + +export default TemplatePassthroughManager; diff --git a/node_modules/@11ty/eleventy/src/TemplatePermalink.js b/node_modules/@11ty/eleventy/src/TemplatePermalink.js new file mode 100644 index 00000000..9ad51119 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplatePermalink.js @@ -0,0 +1,195 @@ +import path from "node:path"; +import { TemplatePath, isPlainObject } from "@11ty/eleventy-utils"; + +class TemplatePermalink { + // `link` with template syntax should have already been rendered in Template.js + constructor(link, extraSubdir) { + let isLinkAnObject = isPlainObject(link); + + this._isRendered = true; + this._writeToFileSystem = true; + + let buildLink; + + if (isLinkAnObject) { + if ("build" in link) { + buildLink = link.build; + } + + // find the first string key + for (let key in link) { + if (typeof key !== "string") { + continue; + } + break; + } + } else { + buildLink = link; + } + + // permalink: false and permalink: build: false + if (typeof buildLink === "boolean") { + if (buildLink === false) { + this._writeToFileSystem = false; + } else { + throw new Error( + `\`permalink: ${ + isLinkAnObject ? "build: " : "" + }true\` is not a supported feature in Eleventy. Did you mean \`permalink: ${ + isLinkAnObject ? "build: " : "" + }false\`?`, + ); + } + } else if (buildLink) { + if (typeof buildLink !== "string") { + let stringToString = "toString" in buildLink ? `:\n\n${buildLink.toString()}` : ""; + throw new Error( + "Expected permalink value to be a string. Received `" + + typeof buildLink + + "`" + + stringToString, + ); + } + this.buildLink = buildLink; + } + + if (isLinkAnObject) { + // default if permalink is an Object but does not have a `build` prop + if (!("build" in link)) { + this._writeToFileSystem = false; + this._isRendered = false; + } + } + + this.extraPaginationSubdir = extraSubdir || ""; + } + + setUrlTransforms(transforms) { + this._urlTransforms = transforms; + } + + get urlTransforms() { + return this._urlTransforms || []; + } + + _addDefaultLinkFilename(link) { + return link + (link.slice(-1) === "/" ? "index.html" : ""); + } + + toOutputPath() { + if (!this.buildLink) { + // empty or false + return false; + } + let cleanLink = this._addDefaultLinkFilename(this.buildLink); + let parsed = path.parse(cleanLink); + + return TemplatePath.join(parsed.dir, this.extraPaginationSubdir, parsed.base); + } + + // Used in url transforms feature + static getUrlStem(original) { + let subject = original; + if (original.endsWith(".html")) { + subject = original.slice(0, -1 * ".html".length); + } + return TemplatePermalink.normalizePathToUrl(subject); + } + + static normalizePathToUrl(original) { + let compare = original || ""; + + let needleHtml = "/index.html"; + let needleBareTrailingSlash = "/index/"; + let needleBare = "/index"; + if (compare.endsWith(needleHtml)) { + return compare.slice(0, compare.length - needleHtml.length) + "/"; + } else if (compare.endsWith(needleBareTrailingSlash)) { + return compare.slice(0, compare.length - needleBareTrailingSlash.length) + "/"; + } else if (compare.endsWith(needleBare)) { + return compare.slice(0, compare.length - needleBare.length) + "/"; + } + + return original; + } + + // This method is used to generate the `page.url` variable. + + // remove all index.html’s from links + // index.html becomes / + // test/index.html becomes test/ + toHref() { + if (!this.buildLink) { + // empty or false + return false; + } + + let transformedLink = this.toOutputPath(); + let original = (transformedLink.charAt(0) !== "/" ? "/" : "") + transformedLink; + + let normalized = TemplatePermalink.normalizePathToUrl(original) || ""; + for (let transform of this.urlTransforms) { + original = + transform({ + url: normalized, + urlStem: TemplatePermalink.getUrlStem(original), + }) ?? original; + } + + return TemplatePermalink.normalizePathToUrl(original); + } + + toPath(outputDir) { + if (!this.buildLink) { + return false; + } + + let uri = this.toOutputPath(); + + if (uri === false) { + return false; + } + + return TemplatePath.addLeadingDotSlash(TemplatePath.normalize(outputDir + "/" + uri)); + } + + toPathFromRoot() { + if (!this.buildLink) { + return false; + } + + let uri = this.toOutputPath(); + + if (uri === false) { + return false; + } + + return TemplatePath.addLeadingDotSlash(TemplatePath.normalize(uri)); + } + + static _hasDuplicateFolder(dir, base) { + let folders = dir.split("/"); + if (!folders[folders.length - 1]) { + folders.pop(); + } + return folders[folders.length - 1] === base; + } + + static generate(dir, filenameNoExt, extraSubdir, fileExtension = "html") { + let path; + if (fileExtension === "html") { + let hasDupeFolder = TemplatePermalink._hasDuplicateFolder(dir, filenameNoExt); + + path = + (dir ? dir + "/" : "") + + (filenameNoExt !== "index" && !hasDupeFolder ? filenameNoExt + "/" : "") + + "index.html"; + } else { + path = (dir ? dir + "/" : "") + filenameNoExt + "." + fileExtension; + } + + return new TemplatePermalink(path, extraSubdir); + } +} + +export default TemplatePermalink; diff --git a/node_modules/@11ty/eleventy/src/TemplateRender.js b/node_modules/@11ty/eleventy/src/TemplateRender.js new file mode 100644 index 00000000..776f16e9 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplateRender.js @@ -0,0 +1,292 @@ +import EleventyBaseError from "./Errors/EleventyBaseError.js"; +import TemplateEngineManager from "./Engines/TemplateEngineManager.js"; + +// import debugUtil from "debug"; +// const debug = debugUtil("Eleventy:TemplateRender"); + +class TemplateRenderUnknownEngineError extends EleventyBaseError {} + +// works with full path names or short engine name +class TemplateRender { + #extensionMap; + #config; + + constructor(tmplPath, config) { + if (!tmplPath) { + throw new Error(`TemplateRender requires a tmplPath argument, instead of ${tmplPath}`); + } + this.#setConfig(config); + + this.engineNameOrPath = tmplPath; + this.parseMarkdownWith = this.config.markdownTemplateEngine; + this.parseHtmlWith = this.config.htmlTemplateEngine; + } + + #setConfig(config) { + if (config?.constructor?.name !== "TemplateConfig") { + throw new Error("TemplateRender must receive a TemplateConfig instance."); + } + + this.eleventyConfig = config; + this.config = config.getConfig(); + } + + get dirs() { + return this.eleventyConfig.directories; + } + + get inputDir() { + return this.dirs.input; + } + + get includesDir() { + return this.dirs.includes; + } + + /* Backwards compat */ + getIncludesDir() { + return this.includesDir; + } + + get config() { + return this.#config; + } + + set config(config) { + this.#config = config; + } + + set extensionMap(extensionMap) { + this.#extensionMap = extensionMap; + } + + get extensionMap() { + if (!this.#extensionMap) { + throw new Error("Internal error: missing `extensionMap` in TemplateRender."); + } + return this.#extensionMap; + } + + async getEngineByName(name) { + // WARNING: eleventyConfig assignment removed here + return this.extensionMap.engineManager.getEngine(name, this.extensionMap); + } + + // Runs once per template + async init(engineNameOrPath) { + let name = engineNameOrPath || this.engineNameOrPath; + this.extensionMap.setTemplateConfig(this.eleventyConfig); + + let extensionEntry = this.extensionMap.getExtensionEntry(name); + let engineName = extensionEntry?.aliasKey || extensionEntry?.key; + if (TemplateEngineManager.isSimpleAlias(extensionEntry)) { + engineName = extensionEntry?.key; + } + this._engineName = engineName; + + if (!extensionEntry || !this._engineName) { + throw new TemplateRenderUnknownEngineError( + `Unknown engine for ${name} (supported extensions: ${this.extensionMap.getReadableFileExtensions()})`, + ); + } + + this._engine = await this.getEngineByName(this._engineName); + + if (this.useMarkdown === undefined) { + this.setUseMarkdown(this._engineName === "md"); + } + } + + get engineName() { + if (!this._engineName) { + throw new Error("TemplateRender needs a call to the init() method."); + } + return this._engineName; + } + + get engine() { + if (!this._engine) { + throw new Error("TemplateRender needs a call to the init() method."); + } + return this._engine; + } + + static parseEngineOverrides(engineName) { + if (typeof (engineName || "") !== "string") { + throw new Error("Expected String passed to parseEngineOverrides. Received: " + engineName); + } + + let overlappingEngineWarningCount = 0; + let engines = []; + let uniqueLookup = {}; + let usingMarkdown = false; + (engineName || "") + .split(",") + .map((name) => { + return name.toLowerCase().trim(); + }) + .forEach((name) => { + // html is assumed (treated as plaintext by the system) + if (!name || name === "html") { + return; + } + + if (name === "md") { + usingMarkdown = true; + return; + } + + if (!uniqueLookup[name]) { + engines.push(name); + uniqueLookup[name] = true; + + // we already short circuit md and html types above + overlappingEngineWarningCount++; + } + }); + + if (overlappingEngineWarningCount > 1) { + throw new Error( + `Don’t mix multiple templating engines in your front matter overrides (exceptions for HTML and Markdown). You used: ${engineName}`, + ); + } + + // markdown should always be first + if (usingMarkdown) { + engines.unshift("md"); + } + + return engines; + } + + // used for error logging and console output. + getReadableEnginesList() { + return this.getReadableEnginesListDifferingFromFileExtension() || this.engineName; + } + + getReadableEnginesListDifferingFromFileExtension() { + let keyFromFilename = this.extensionMap.getKey(this.engineNameOrPath); + if (this.engine?.constructor?.name === "CustomEngine") { + if ( + this.engine.entry && + this.engine.entry.name && + keyFromFilename !== this.engine.entry.name + ) { + return this.engine.entry.name; + } else { + // We don’t have a name for it so we return nothing so we don’t misreport (per #2386) + return; + } + } + + if (this.engineName === "md" && this.useMarkdown && this.parseMarkdownWith) { + return this.parseMarkdownWith; + } + if (this.engineName === "html" && this.parseHtmlWith) { + return this.parseHtmlWith; + } + + // templateEngineOverride in play and template language differs from file extension + if (keyFromFilename !== this.engineName) { + return this.engineName; + } + } + + // TODO templateEngineOverride + getPreprocessorEngineName() { + if (this.engineName === "md" && this.parseMarkdownWith) { + return this.parseMarkdownWith; + } + if (this.engineName === "html" && this.parseHtmlWith) { + return this.parseHtmlWith; + } + // TODO do we need this? + return this.extensionMap.getKey(this.engineNameOrPath); + } + + // We pass in templateEngineOverride here because it isn’t yet applied to templateRender + getEnginesList(engineOverride) { + if (engineOverride) { + let engines = TemplateRender.parseEngineOverrides(engineOverride).reverse(); + return engines.join(","); + } + + if (this.engineName === "md" && this.useMarkdown && this.parseMarkdownWith) { + return `${this.parseMarkdownWith},md`; + } + if (this.engineName === "html" && this.parseHtmlWith) { + return this.parseHtmlWith; + } + + // templateEngineOverride in play + return this.extensionMap.getKey(this.engineNameOrPath); + } + + async setEngineOverride(engineName, bypassMarkdown) { + let engines = TemplateRender.parseEngineOverrides(engineName); + + // when overriding, Template Engines with HTML will instead use the Template Engine as primary and output HTML + // So any HTML engine usage here will never use a preprocessor templating engine. + this.setHtmlEngine(false); + + if (!engines.length) { + await this.init("html"); + return; + } + + await this.init(engines[0]); + + let usingMarkdown = engines[0] === "md" && !bypassMarkdown; + + this.setUseMarkdown(usingMarkdown); + + if (usingMarkdown) { + // false means only parse markdown and not with a preprocessor template engine + this.setMarkdownEngine(engines.length > 1 ? engines[1] : false); + } + } + + getEngineName() { + return this.engineName; + } + + isEngine(engine) { + return this.engineName === engine; + } + + setUseMarkdown(useMarkdown) { + this.useMarkdown = !!useMarkdown; + } + + // this is only called for templateEngineOverride + setMarkdownEngine(markdownEngine) { + this.parseMarkdownWith = markdownEngine; + } + + // this is only called for templateEngineOverride + setHtmlEngine(htmlEngineName) { + this.parseHtmlWith = htmlEngineName; + } + + async _testRender(str, data) { + return this.engine._testRender(str, data); + } + + async getCompiledTemplate(str) { + // TODO refactor better, move into TemplateEngine logic + if (this.engineName === "md") { + return this.engine.compile( + str, + this.engineNameOrPath, + this.parseMarkdownWith, + !this.useMarkdown, + ); + } else if (this.engineName === "html") { + return this.engine.compile(str, this.engineNameOrPath, this.parseHtmlWith); + } else { + return this.engine.compile(str, this.engineNameOrPath); + } + } +} + +export default TemplateRender; diff --git a/node_modules/@11ty/eleventy/src/TemplateWriter.js b/node_modules/@11ty/eleventy/src/TemplateWriter.js new file mode 100644 index 00000000..79b0fee5 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/TemplateWriter.js @@ -0,0 +1,508 @@ +import { TemplatePath } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; + +import Template from "./Template.js"; +import TemplateMap from "./TemplateMap.js"; +import EleventyFiles from "./EleventyFiles.js"; +import EleventyBaseError from "./Errors/EleventyBaseError.js"; +import { EleventyErrorHandler } from "./Errors/EleventyErrorHandler.js"; +import EleventyErrorUtil from "./Errors/EleventyErrorUtil.js"; +import FileSystemSearch from "./FileSystemSearch.js"; +import ConsoleLogger from "./Util/ConsoleLogger.js"; + +const debug = debugUtil("Eleventy:TemplateWriter"); + +class TemplateWriterMissingConfigArgError extends EleventyBaseError {} +class EleventyPassthroughCopyError extends EleventyBaseError {} +class EleventyTemplateError extends EleventyBaseError {} + +class TemplateWriter { + #eleventyFiles; + #passthroughManager; + #errorHandler; + #extensionMap; + + constructor( + templateFormats, // TODO remove this, see `get eleventyFiles` first + templateData, + templateConfig, + ) { + if (!templateConfig) { + throw new TemplateWriterMissingConfigArgError("Missing config argument."); + } + this.templateConfig = templateConfig; + this.config = templateConfig.getConfig(); + this.userConfig = templateConfig.userConfig; + + this.templateFormats = templateFormats; + + this.templateData = templateData; + this.isVerbose = true; + this.isDryRun = false; + this.writeCount = 0; + this.renderCount = 0; + this.skippedCount = 0; + this.isRunInitialBuild = true; + + this._templatePathCache = new Map(); + } + + get dirs() { + return this.templateConfig.directories; + } + + get inputDir() { + return this.dirs.input; + } + + get outputDir() { + return this.dirs.output; + } + + get templateFormats() { + return this._templateFormats; + } + + set templateFormats(value) { + this._templateFormats = value; + } + + /* Getter for error handler */ + get errorHandler() { + if (!this.#errorHandler) { + this.#errorHandler = new EleventyErrorHandler(); + this.#errorHandler.isVerbose = this.verboseMode; + this.#errorHandler.logger = this.logger; + } + + return this.#errorHandler; + } + + /* Getter for Logger */ + get logger() { + if (!this._logger) { + this._logger = new ConsoleLogger(); + this._logger.isVerbose = this.verboseMode; + } + + return this._logger; + } + + /* Setter for Logger */ + set logger(logger) { + this._logger = logger; + } + + /* For testing */ + overrideConfig(config) { + this.config = config; + } + + restart() { + this.writeCount = 0; + this.renderCount = 0; + this.skippedCount = 0; + } + + set extensionMap(extensionMap) { + this.#extensionMap = extensionMap; + } + + get extensionMap() { + if (!this.#extensionMap) { + throw new Error("Internal error: missing `extensionMap` in TemplateWriter."); + } + return this.#extensionMap; + } + + setPassthroughManager(mgr) { + this.#passthroughManager = mgr; + } + + setEleventyFiles(eleventyFiles) { + this.#eleventyFiles = eleventyFiles; + } + + get eleventyFiles() { + // usually Eleventy.js will setEleventyFiles with the EleventyFiles manager + if (!this.#eleventyFiles) { + // if not, we can create one (used only by tests) + this.#eleventyFiles = new EleventyFiles(this.templateFormats, this.templateConfig); + + this.#eleventyFiles.setFileSystemSearch(new FileSystemSearch()); + this.#eleventyFiles.init(); + } + + return this.#eleventyFiles; + } + + async _getAllPaths() { + // this is now cached upstream by FileSystemSearch + return this.eleventyFiles.getFiles(); + } + + _createTemplate(path, to = "fs") { + let tmpl = this._templatePathCache.get(path); + let wasCached = false; + + if (tmpl) { + wasCached = true; + // Update config for https://github.com/11ty/eleventy/issues/3468 + // TODO reset other constructor things here like inputDir/outputDir + tmpl.resetCachedTemplate({ + templateData: this.templateData, + extensionMap: this.extensionMap, + eleventyConfig: this.templateConfig, + }); + } else { + tmpl = new Template(path, this.templateData, this.extensionMap, this.templateConfig); + tmpl.setOutputFormat(to); + tmpl.logger = this.logger; + this._templatePathCache.set(path, tmpl); + } + + tmpl.setTransforms(this.config.transforms); + tmpl.setLinters(this.config.linters); + tmpl.setDryRun(this.isDryRun); + tmpl.setIsVerbose(this.isVerbose); + tmpl.reset(); + + return { + template: tmpl, + wasCached, + }; + } + + // incrementalFileShape is `template` or `copy` (for passthrough file copy) + async _addToTemplateMapIncrementalBuild(incrementalFileShape, paths, to = "fs") { + // Render overrides are only used when `--ignore-initial` is in play and an initial build is not run + let ignoreInitialBuild = !this.isRunInitialBuild; + let secondOrderRelevantLookup = {}; + let templates = []; + + let promises = []; + for (let path of paths) { + let { template: tmpl } = this._createTemplate(path, to); + + // Note: removed a fix here to fetch missing templateRender instances + // that was tested as no longer needed (Issue #3170) + // Related: #3870, improved configuration reset + + templates.push(tmpl); + + // This must happen before data is generated for the incremental file only + if (incrementalFileShape === "template" && tmpl.inputPath === this.incrementalFile) { + tmpl.resetCaches(); + } else if ( + // Issue #3824 #3870 + tmpl.isFileRelevantToThisTemplate(this.incrementalFile, { + isFullTemplate: incrementalFileShape === "template", + }) + ) { + tmpl.resetCaches(); + } + + // IMPORTANT: This is where the data is first generated for the template + promises.push(this.templateMap.add(tmpl)); + } + + // Important to set up template dependency relationships first + await Promise.all(promises); + + // Delete incremental file from the dependency graph so we get fresh entries! + // This _must_ happen before any additions, the other ones are in Custom.js and GlobalDependencyMap.js (from the eleventy.layouts Event) + this.config.uses.resetNode(this.incrementalFile); + + // write new template relationships to the global dependency graph for next time + this.templateMap.addAllToGlobalDependencyGraph(); + + // Always disable render for --ignore-initial + if (ignoreInitialBuild) { + for (let tmpl of templates) { + tmpl.setRenderableOverride(false); // disable render + } + return; + } + + for (let tmpl of templates) { + if (incrementalFileShape === "template" && tmpl.inputPath === this.incrementalFile) { + tmpl.setRenderableOverride(undefined); // unset, probably render + } else if ( + tmpl.isFileRelevantToThisTemplate(this.incrementalFile, { + isFullTemplate: incrementalFileShape === "template", + }) + ) { + // changed file is used by template + // template uses the changed file + tmpl.setRenderableOverride(undefined); // unset, probably render + secondOrderRelevantLookup[tmpl.inputPath] = true; + } else if (this.config.uses.isFileUsedBy(this.incrementalFile, tmpl.inputPath)) { + // changed file uses this template + tmpl.setRenderableOverride("optional"); + } else { + // For incremental, always disable render on irrelevant templates + tmpl.setRenderableOverride(false); // disable render + } + } + + let secondOrderRelevantArray = this.config.uses + .getTemplatesRelevantToTemplateList(Object.keys(secondOrderRelevantLookup)) + .map((entry) => TemplatePath.addLeadingDotSlash(entry)); + let secondOrderTemplates = Object.fromEntries( + Object.entries(secondOrderRelevantArray).map(([index, value]) => [value, true]), + ); + + for (let tmpl of templates) { + // second order templates must also be rendered if not yet already rendered at least once and available in cache. + if (secondOrderTemplates[tmpl.inputPath]) { + if (tmpl.isRenderableDisabled()) { + tmpl.setRenderableOverride("optional"); + } + } + } + + // Order of templates does not matter here, they’re reordered later based on dependencies in TemplateMap.js + for (let tmpl of templates) { + if (incrementalFileShape === "template" && tmpl.inputPath === this.incrementalFile) { + // Cache is reset above (to invalidate data cache at the right time) + tmpl.setDryRunViaIncremental(false); + } else if (!tmpl.isRenderableDisabled() && !tmpl.isRenderableOptional()) { + // Related to the template but not the template (reset the render cache, not the read cache) + tmpl.resetCaches({ + data: true, + render: true, + }); + + tmpl.setDryRunViaIncremental(false); + } else { + // During incremental we only reset the data cache for non-matching templates, see https://github.com/11ty/eleventy/issues/2710 + // Keep caches for read/render + tmpl.resetCaches({ + data: true, + }); + + tmpl.setDryRunViaIncremental(true); + + this.skippedCount++; + } + } + } + + async _addToTemplateMapFullBuild(paths, to = "fs") { + if (this.incrementalFile) { + return []; + } + + let ignoreInitialBuild = !this.isRunInitialBuild; + let promises = []; + for (let path of paths) { + let { template: tmpl, wasCached } = this._createTemplate(path, to); + // Render overrides are only used when `--ignore-initial` is in play and an initial build is not run + if (ignoreInitialBuild) { + tmpl.setRenderableOverride(false); // disable render + } else { + tmpl.setRenderableOverride(undefined); // unset, render + } + + if (wasCached) { + tmpl.resetCaches(); + } + + // IMPORTANT: This is where the data is first generated for the template + promises.push(this.templateMap.add(tmpl)); + } + + return Promise.all(promises); + } + + async _addToTemplateMap(paths, to = "fs") { + let incrementalFileShape = this.eleventyFiles.getFileShape(paths, this.incrementalFile); + + // Filter out passthrough copy files + paths = paths.filter((path) => { + if (!this.extensionMap.hasEngine(path)) { + return false; + } + if (incrementalFileShape === "copy") { + this.skippedCount++; + // Filters out templates if the incremental file is a passthrough copy file + return false; + } + return true; + }); + + if (this.incrementalFile) { + // Top level async to get at the promises returned. + return await this._addToTemplateMapIncrementalBuild(incrementalFileShape, paths, to); + } + + // Full Build + let ret = await this._addToTemplateMapFullBuild(paths, to); + + // write new template relationships to the global dependency graph for next time + this.templateMap.addAllToGlobalDependencyGraph(); + + return ret; + } + + async _createTemplateMap(paths, to) { + this.templateMap = new TemplateMap(this.templateConfig); + + await this._addToTemplateMap(paths, to); + await this.templateMap.cache(); + + // Return is used by tests + return this.templateMap; + } + + async _generateTemplate(mapEntry, to) { + let tmpl = mapEntry.template; + + return tmpl.generateMapEntry(mapEntry, to).then((pages) => { + this.renderCount += tmpl.getRenderCount(); + this.writeCount += tmpl.getWriteCount(); + return pages; + }); + } + + async writePassthroughCopy(templateExtensionPaths) { + if (!this.#passthroughManager) { + throw new Error("Internal error: Missing `passthroughManager` instance."); + } + + return this.#passthroughManager.copyAll(templateExtensionPaths).catch((e) => { + this.errorHandler.warn(e, "Error with passthrough copy"); + return Promise.reject(new EleventyPassthroughCopyError("Having trouble copying", e)); + }); + } + + async generateTemplates(paths, to = "fs") { + let promises = []; + // TODO optimize await here + await this._createTemplateMap(paths, to); + debug("Template map created."); + + let usedTemplateContentTooEarlyMap = []; + for (let mapEntry of this.templateMap.getMap()) { + promises.push( + this._generateTemplate(mapEntry, to).catch(function (e) { + // Premature templateContent in layout render, this also happens in + // TemplateMap.populateContentDataInMap for non-layout content + if (EleventyErrorUtil.isPrematureTemplateContentError(e)) { + usedTemplateContentTooEarlyMap.push(mapEntry); + } else { + let outputPaths = `"${mapEntry._pages.map((page) => page.outputPath).join(`", "`)}"`; + return Promise.reject( + new EleventyTemplateError( + `Having trouble writing to ${outputPaths} from "${mapEntry.inputPath}"`, + e, + ), + ); + } + }), + ); + } + + for (let mapEntry of usedTemplateContentTooEarlyMap) { + promises.push( + this._generateTemplate(mapEntry, to).catch(function (e) { + return Promise.reject( + new EleventyTemplateError( + `Having trouble writing to (second pass) "${mapEntry.outputPath}" from "${mapEntry.inputPath}"`, + e, + ), + ); + }), + ); + } + + return promises; + } + + async write() { + let paths = await this._getAllPaths(); + + // This must happen before writePassthroughCopy + this.templateConfig.userConfig.emit("eleventy#beforerender"); + + let aggregatePassthroughCopyPromise = this.writePassthroughCopy(paths); + + let templatesPromise = Promise.all(await this.generateTemplates(paths)).then((results) => { + this.templateConfig.userConfig.emit("eleventy#render"); + + return results; + }); + + return Promise.all([aggregatePassthroughCopyPromise, templatesPromise]).then( + async ([passthroughCopyResults, templateResults]) => { + return { + passthroughCopy: passthroughCopyResults, + // New in 3.0: flatten and filter out falsy templates + templates: templateResults.flat().filter(Boolean), + }; + }, + (e) => { + return Promise.reject(e); + }, + ); + } + + // Passthrough copy not supported in JSON output. + // --incremental not supported in JSON output. + async getJSON(to = "json") { + let paths = await this._getAllPaths(); + let promises = await this.generateTemplates(paths, to); + + return Promise.all(promises).then( + (templateResults) => { + return { + // New in 3.0: flatten and filter out falsy templates + templates: templateResults.flat().filter(Boolean), + }; + }, + (e) => { + return Promise.reject(e); + }, + ); + } + + setVerboseOutput(isVerbose) { + this.isVerbose = isVerbose; + this.errorHandler.isVerbose = isVerbose; + } + + setDryRun(isDryRun) { + this.isDryRun = Boolean(isDryRun); + } + + setRunInitialBuild(runInitialBuild) { + this.isRunInitialBuild = runInitialBuild; + } + setIncrementalBuild(isIncremental) { + this.isIncremental = isIncremental; + } + setIncrementalFile(incrementalFile) { + this.incrementalFile = incrementalFile; + this.#passthroughManager.setIncrementalFile(incrementalFile); + } + resetIncrementalFile() { + this.incrementalFile = null; + this.#passthroughManager.resetIncrementalFile(); + } + + getMetadata() { + return { + // copyCount, copySize + ...(this.#passthroughManager?.getMetadata() || {}), + skipCount: this.skippedCount, + writeCount: this.writeCount, + renderCount: this.renderCount, + }; + } + + get caches() { + return ["_templatePathCache"]; + } +} + +export default TemplateWriter; diff --git a/node_modules/@11ty/eleventy/src/UserConfig.js b/node_modules/@11ty/eleventy/src/UserConfig.js new file mode 100644 index 00000000..215327fe --- /dev/null +++ b/node_modules/@11ty/eleventy/src/UserConfig.js @@ -0,0 +1,1339 @@ +import chalk from "kleur"; +import { DateTime } from "luxon"; +import yaml from "js-yaml"; +import matter from "gray-matter"; +import debugUtil from "debug"; + +import { DeepCopy, TemplatePath, isPlainObject } from "@11ty/eleventy-utils"; + +import HtmlBasePlugin from "./Plugins/HtmlBasePlugin.js"; +import RenderPlugin from "./Plugins/RenderPlugin.js"; +import InputPathToUrlPlugin from "./Plugins/InputPathToUrl.js"; + +import isAsyncFunction from "./Util/IsAsyncFunction.js"; +import objectFilter from "./Util/Objects/ObjectFilter.js"; +import EventEmitter from "./Util/AsyncEventEmitter.js"; +import EleventyCompatibility from "./Util/Compatibility.js"; +import EleventyBaseError from "./Errors/EleventyBaseError.js"; +import BenchmarkManager from "./Benchmark/BenchmarkManager.js"; +import JavaScriptFrontMatter from "./Engines/FrontMatter/JavaScript.js"; +import { augmentFunction } from "./Engines/Util/ContextAugmenter.js"; + +const debug = debugUtil("Eleventy:UserConfig"); + +class UserConfigError extends EleventyBaseError {} + +/** + * Eleventy’s user-land Configuration API + * @module 11ty/eleventy/UserConfig + */ +class UserConfig { + /** @type {boolean} */ + #pluginExecution = false; + /** @type {boolean} */ + #quietModeLocked = false; + /** @type {boolean} */ + #dataDeepMergeModified = false; + /** @type {number|undefined} */ + #uniqueId; + /** @type {number} */ + #concurrency = 1; + // Before using os.availableParallelism(); see https://github.com/11ty/eleventy/issues/3596 + + constructor() { + // These are completely unnecessary lines to satisfy TypeScript + this.plugins = []; + this.templateFormatsAdded = []; + this.additionalWatchTargets = []; + this.watchTargetsConfigReset = new Set(); + this.extensionMap = new Set(); + this.dataExtensions = new Map(); + this.urlTransforms = []; + this.customDateParsingCallbacks = new Set(); + this.ignores = new Set(); + this.events = new EventEmitter(); + + /** @type {object} */ + this.directories = {}; + /** @type {undefined} */ + this.logger; + /** @type {string} */ + this.dir; + /** @type {string} */ + this.pathPrefix; + /** @type {object} */ + this.errorReporting = {}; + /** @type {object} */ + this.templateHandling = {}; + + this.reset(); + this.#uniqueId = Math.random(); + } + + // Internally used in TemplateContent for cache keys + _getUniqueId() { + return this.#uniqueId; + } + + reset() { + debug("Resetting EleventyConfig to initial values."); + + /** @type {EventEmitter} */ + this.events = new EventEmitter(); + this.events.setMaxListeners(25); // defaults to 10 + + /** @type {BenchmarkManager} */ + this.benchmarkManager = new BenchmarkManager(); + + /** @type {object} */ + this.benchmarks = { + /** @type {import('./Benchmark/BenchmarkGroup.js')} */ + config: this.benchmarkManager.get("Configuration"), + /** @type {import('./Benchmark/BenchmarkGroup.js')} */ + aggregate: this.benchmarkManager.get("Aggregate"), + }; + + /** @type {object} */ + this.directoryAssignments = {}; + /** @type {object} */ + this.collections = {}; + /** @type {object} */ + this.precompiledCollections = {}; + this.templateFormats = undefined; + this.templateFormatsAdded = []; + + /** @type {object} */ + this.universal = { + filters: {}, + shortcodes: {}, + pairedShortcodes: {}, + }; + + /** @type {object} */ + this.liquid = { + options: {}, + tags: {}, + filters: {}, + shortcodes: {}, + pairedShortcodes: {}, + parameterParsing: "legacy", // or builtin + }; + + /** @type {object} */ + this.nunjucks = { + // `dev: true` gives us better error messaging + environmentOptions: { dev: true }, + precompiledTemplates: {}, + filters: {}, + asyncFilters: {}, + tags: {}, + globals: {}, + shortcodes: {}, + pairedShortcodes: {}, + asyncShortcodes: {}, + asyncPairedShortcodes: {}, + }; + + /** @type {object} */ + this.javascript = { + functions: {}, + filters: {}, + shortcodes: {}, + pairedShortcodes: {}, + }; + + this.markdownHighlighter = null; + + /** @type {object} */ + this.libraryOverrides = {}; + + /** @type {object} */ + this.passthroughCopies = {}; + this.passthroughCopiesHtmlRelative = new Set(); + + /** @type {object} */ + this.layoutAliases = {}; + this.layoutResolution = true; // extension-less layout files + + /** @type {object} */ + this.linters = {}; + /** @type {object} */ + this.transforms = {}; + /** @type {object} */ + this.preprocessors = {}; + + this.activeNamespace = ""; + this.DateTime = DateTime; + this.dynamicPermalinks = true; + + this.useGitIgnore = true; + + let defaultIgnores = new Set(); + defaultIgnores.add("**/node_modules/**"); + defaultIgnores.add(".git/**"); // TODO `**/.git/**` + this.ignores = new Set(defaultIgnores); + this.watchIgnores = new Set(defaultIgnores); + + this.dataDeepMerge = true; + this.extensionMap = new Set(); + /** @type {object} */ + this.extensionConflictMap = {}; + this.watchJavaScriptDependencies = true; + this.additionalWatchTargets = []; + this.watchTargetsConfigReset = new Set(); + /** @type {object} */ + this.serverOptions = {}; + /** @type {object} */ + this.globalData = {}; + /** @type {object} */ + this.chokidarConfig = {}; + this.watchThrottleWaitTime = 0; //ms + + // using Map to preserve insertion order + this.dataExtensions = new Map(); + + this.quietMode = false; + + this.plugins = []; + + this.useTemplateCache = true; + this.dataFilterSelectors = new Set(); + + /** @type {object} */ + this.libraryAmendments = {}; + this.serverPassthroughCopyBehavior = "copy"; // or "passthrough" + this.urlTransforms = []; + + // Defaults in `defaultConfig.js` + this.dataFileSuffixesOverride = false; + this.dataFileDirBaseNameOverride = false; + + /** @type {object} */ + this.frontMatterParsingOptions = { + // Set a project-wide default. + // language: "yaml", + + // Supplementary engines + engines: { + yaml: yaml.load.bind(yaml), + + // Backwards compatible with `js` object front matter + // https://github.com/11ty/eleventy/issues/2819 + javascript: JavaScriptFrontMatter, + + // Needed for fallback behavior in the new `javascript` engine + // @ts-ignore + jsLegacy: matter.engines.javascript, + + node: function () { + throw new Error( + "The `node` front matter type was a 3.0.0-alpha.x only feature, removed for stable release. Rename to `js` or `javascript` instead!", + ); + }, + }, + }; + + /** @type {object} */ + this.virtualTemplates = {}; + this.freezeReservedData = true; + this.customDateParsingCallbacks = new Set(); + + /** @type {object} */ + this.errorReporting = {}; + /** @type {object} */ + this.templateHandling = {}; + + // Before using os.availableParallelism(); see https://github.com/11ty/eleventy/issues/3596 + this.#concurrency = 1; + } + + // compatibleRange is optional in 2.0.0-beta.2 + versionCheck(compatibleRange) { + let compat = new EleventyCompatibility(compatibleRange); + + if (!compat.isCompatible()) { + throw new UserConfigError(compat.getErrorMessage()); + } + } + + /* + * Events + */ + + // Duplicate event bindings are avoided with the `reset` method above. + // A new EventEmitter instance is created when the config is reset. + on(eventName, callback) { + return this.events.on(eventName, callback); + } + + once(eventName, callback) { + return this.events.once(eventName, callback); + } + + emit(eventName, ...args) { + return this.events.emit(eventName, ...args); + } + + setEventEmitterMode(mode) { + this.events.setHandlerMode(mode); + } + + /* + * Universal getters + */ + getFilter(name) { + // JavaScript functions are included here for backwards compatibility https://github.com/11ty/eleventy/issues/3365 + return this.universal.filters[name] || this.javascript.functions[name]; + } + + getFilters(options = {}) { + if (options.type) { + return objectFilter( + this.universal.filters, + (entry) => entry.__eleventyInternal?.type === options.type, + ); + } + + return this.universal.filters; + } + + getShortcode(name) { + return this.universal.shortcodes[name]; + } + + getShortcodes(options = {}) { + if (options.type) { + return objectFilter( + this.universal.shortcodes, + (entry) => entry.__eleventyInternal?.type === options.type, + ); + } + + return this.universal.shortcodes; + } + + getPairedShortcode(name) { + return this.universal.pairedShortcodes[name]; + } + + getPairedShortcodes(options = {}) { + if (options.type) { + return objectFilter( + this.universal.pairedShortcodes, + (entry) => entry.__eleventyInternal?.type === options.type, + ); + } + return this.universal.pairedShortcodes; + } + + /* + * Private utilities + */ + #add(target, originalName, callback, options) { + let { description, functionName } = options; + + if (typeof callback !== "function") { + throw new Error(`Invalid definition for "${originalName}" ${description}.`); + } + + let name = this.getNamespacedName(originalName); + + if (target[name]) { + debug( + chalk.yellow(`Warning, overwriting previous ${description} "%o" via \`%o(%o)\``), + name, + functionName, + originalName, + ); + } else { + debug(`Adding new ${description} "%o" via \`%o(%o)\``, name, functionName, originalName); + } + + target[name] = this.#decorateCallback(`"${name}" ${description}`, callback); + } + + #decorateCallback(type, callback) { + return this.benchmarks.config.add(type, callback); + } + + /* + * Markdown + */ + + // This is a method for plugins, probably shouldn’t use this in projects. + // Projects should use `setLibrary` as documented here: + // https://github.com/11ty/eleventy/blob/master/docs/engines/markdown.md#use-your-own-options + addMarkdownHighlighter(highlightFn) { + this.markdownHighlighter = highlightFn; + } + + /* + * Filters + */ + + addLiquidFilter(name, callback) { + this.#add(this.liquid.filters, name, callback, { + description: "Liquid Filter", + functionName: "addLiquidFilter", + }); + } + + addNunjucksAsyncFilter(name, callback) { + this.#add(this.nunjucks.asyncFilters, name, callback, { + description: "Nunjucks Filter", + functionName: "addNunjucksAsyncFilter", + }); + } + + // Support the nunjucks style syntax for asynchronous filter add + addNunjucksFilter(name, callback, isAsync = false) { + if (isAsync) { + // namespacing happens downstream + this.addNunjucksAsyncFilter(name, callback); + } else { + this.#add(this.nunjucks.filters, name, callback, { + description: "Nunjucks Filter", + functionName: "addNunjucksFilter", + }); + } + } + + addJavaScriptFilter(name, callback) { + this.#add(this.javascript.filters, name, callback, { + description: "JavaScript Filter", + functionName: "addJavaScriptFilter", + }); + + // Backwards compat for a time before `addJavaScriptFilter` existed. + this.addJavaScriptFunction(name, callback); + } + + addFilter(name, callback) { + // This method *requires* `async function` and will not work with `function` that returns a promise + if (isAsyncFunction(callback)) { + this.addAsyncFilter(name, callback); + return; + } + + // namespacing happens downstream + this.#add(this.universal.filters, name, callback, { + description: "Universal Filter", + functionName: "addFilter", + }); + + this.addLiquidFilter(name, callback); + this.addJavaScriptFilter(name, callback); + this.addNunjucksFilter( + name, + /** @this {any} */ + function (...args) { + // Note that `callback` is already a function as the `#add` method throws an error if not. + let ret = callback.call(this, ...args); + if (ret instanceof Promise) { + throw new Error( + `Nunjucks *is* async-friendly with \`addFilter("${name}", async function() {})\` but you need to supply an \`async function\`. You returned a promise from \`addFilter("${name}", function() {})\`. Alternatively, use the \`addAsyncFilter("${name}")\` configuration API method.`, + ); + } + return ret; + }, + ); + } + + // Liquid, Nunjucks, and JS only + addAsyncFilter(name, callback) { + // namespacing happens downstream + this.#add(this.universal.filters, name, callback, { + description: "Universal Filter", + functionName: "addAsyncFilter", + }); + + this.addLiquidFilter(name, callback); + this.addJavaScriptFilter(name, callback); + this.addNunjucksAsyncFilter( + name, + /** @this {any} */ + async function (...args) { + let cb = args.pop(); + // Note that `callback` is already a function as the `#add` method throws an error if not. + let ret = await callback.call(this, ...args); + cb(null, ret); + }, + ); + } + + /* + * Shortcodes + */ + + addShortcode(name, callback) { + // This method *requires* `async function` and will not work with `function` that returns a promise + if (isAsyncFunction(callback)) { + this.addAsyncShortcode(name, callback); + return; + } + + this.#add(this.universal.shortcodes, name, callback, { + description: "Universal Shortcode", + functionName: "addShortcode", + }); + + this.addLiquidShortcode(name, callback); + this.addJavaScriptShortcode(name, callback); + this.addNunjucksShortcode(name, callback); + } + + addAsyncShortcode(name, callback) { + this.#add(this.universal.shortcodes, name, callback, { + description: "Universal Shortcode", + functionName: "addAsyncShortcode", + }); + + // Related: #498 + this.addNunjucksAsyncShortcode(name, callback); + this.addLiquidShortcode(name, callback); + this.addJavaScriptShortcode(name, callback); + } + + addNunjucksAsyncShortcode(name, callback) { + this.#add(this.nunjucks.asyncShortcodes, name, callback, { + description: "Nunjucks Async Shortcode", + functionName: "addNunjucksAsyncShortcode", + }); + } + + addNunjucksShortcode(name, callback, isAsync = false) { + if (isAsync) { + this.addNunjucksAsyncShortcode(name, callback); + } else { + this.#add(this.nunjucks.shortcodes, name, callback, { + description: "Nunjucks Shortcode", + functionName: "addNunjucksShortcode", + }); + } + } + + addLiquidShortcode(name, callback) { + this.#add(this.liquid.shortcodes, name, callback, { + description: "Liquid Shortcode", + functionName: "addLiquidShortcode", + }); + } + + addPairedShortcode(name, callback) { + // This method *requires* `async function` and will not work with `function` that returns a promise + if (isAsyncFunction(callback)) { + this.addPairedAsyncShortcode(name, callback); + return; + } + + this.#add(this.universal.pairedShortcodes, name, callback, { + description: "Universal Paired Shortcode", + functionName: "addPairedShortcode", + }); + + this.addPairedNunjucksShortcode(name, callback); + this.addPairedLiquidShortcode(name, callback); + this.addPairedJavaScriptShortcode(name, callback); + } + + // Related: #498 + addPairedAsyncShortcode(name, callback) { + this.#add(this.universal.pairedShortcodes, name, callback, { + description: "Universal Paired Async Shortcode", + functionName: "addPairedAsyncShortcode", + }); + + this.addPairedNunjucksAsyncShortcode(name, callback); + this.addPairedLiquidShortcode(name, callback); + this.addPairedJavaScriptShortcode(name, callback); + } + + addPairedNunjucksAsyncShortcode(name, callback) { + this.#add(this.nunjucks.asyncPairedShortcodes, name, callback, { + description: "Nunjucks Async Paired Shortcode", + functionName: "addPairedNunjucksAsyncShortcode", + }); + } + + addPairedNunjucksShortcode(name, callback, isAsync = false) { + if (isAsync) { + this.addPairedNunjucksAsyncShortcode(name, callback); + } else { + this.#add(this.nunjucks.pairedShortcodes, name, callback, { + description: "Nunjucks Paired Shortcode", + functionName: "addPairedNunjucksShortcode", + }); + } + } + + addPairedLiquidShortcode(name, callback) { + this.#add(this.liquid.pairedShortcodes, name, callback, { + description: "Liquid Paired Shortcode", + functionName: "addPairedLiquidShortcode", + }); + } + + addJavaScriptShortcode(name, callback) { + this.#add(this.javascript.shortcodes, name, callback, { + description: "JavaScript Shortcode", + functionName: "addJavaScriptShortcode", + }); + + // Backwards compat for a time before `addJavaScriptShortcode` existed. + this.addJavaScriptFunction(name, callback); + } + + addPairedJavaScriptShortcode(name, callback) { + this.#add(this.javascript.pairedShortcodes, name, callback, { + description: "JavaScript Paired Shortcode", + functionName: "addPairedJavaScriptShortcode", + }); + + // Backwards compat for a time before `addJavaScriptShortcode` existed. + this.addJavaScriptFunction(name, callback); + } + + // Both Filters and shortcodes feed into this + addJavaScriptFunction(name, callback) { + this.#add(this.javascript.functions, name, callback, { + description: "JavaScript Function", + functionName: "addJavaScriptFunction", + }); + } + + /* + * Custom Tags + */ + + // tagCallback: function(liquidEngine) { return { parse: …, render: … }} }; + addLiquidTag(name, tagFn) { + if (typeof tagFn !== "function") { + throw new UserConfigError( + `EleventyConfig.addLiquidTag expects a callback function to be passed in for ${name}: addLiquidTag(name, function(liquidEngine) { return { parse: …, render: … } })`, + ); + } + + this.#add(this.liquid.tags, name, tagFn, { + description: "Liquid Custom Tag", + functionName: "addLiquidTag", + }); + } + + addNunjucksTag(name, tagFn) { + if (typeof tagFn !== "function") { + throw new UserConfigError( + `EleventyConfig.addNunjucksTag expects a callback function to be passed in for ${name}: addNunjucksTag(name, function(nunjucksEngine) {})`, + ); + } + + this.#add(this.nunjucks.tags, name, tagFn, { + description: "Nunjucks Custom Tag", + functionName: "addNunjucksTag", + }); + } + + /* + * Plugins + */ + + // Internal method + _enablePluginExecution() { + this.#pluginExecution = true; + } + + // Internal method + _disablePluginExecution() { + this.#pluginExecution = false; + } + + /* Config is executed in two stages and plugins are the second stage—are we in the plugins stage? */ + isPluginExecution() { + return this.#pluginExecution; + } + + /** + * @typedef {function|Promise|object} PluginDefinition + * @property {Function} [configFunction] + * @property {string} [eleventyPackage] + * @property {object} [eleventyPluginOptions={}] + * @property {boolean} [eleventyPluginOptions.unique] + */ + + /** + * addPlugin: async friendly in 3.0 + * + * @param {PluginDefinition} plugin + */ + addPlugin(plugin, options = {}) { + // First addPlugin of a unique plugin wins + if (plugin?.eleventyPluginOptions?.unique && this.hasPlugin(plugin)) { + debug("Skipping duplicate unique addPlugin for %o", this._getPluginName(plugin)); + return; + } + + if (this.isPluginExecution() || options?.immediate) { + // this might return a promise + return this._executePlugin(plugin, options); + } else { + this.plugins.push({ + plugin, + options, + pluginNamespace: this.activeNamespace, + }); + } + } + + /** @param {string} name */ + resolvePlugin(name) { + let filenameLookup = { + "@11ty/eleventy/html-base-plugin": HtmlBasePlugin, + "@11ty/eleventy/render-plugin": RenderPlugin, + "@11ty/eleventy/inputpath-to-url-plugin": InputPathToUrlPlugin, + + // Async plugins: + // requires e.g. `await resolvePlugin("@11ty/eleventy/i18n-plugin")` to avoid preloading i18n dependencies. + // see https://github.com/11ty/eleventy-plugin-rss/issues/52 + "@11ty/eleventy/i18n-plugin": "./Plugins/I18nPlugin.js", + }; + + if (!filenameLookup[name]) { + throw new Error( + `Invalid name "${name}" passed to resolvePlugin. Valid options: ${Object.keys(filenameLookup).join(", ")}`, + ); + } + + // Future improvement: add support for any npm package name? + if (typeof filenameLookup[name] === "string") { + // returns promise + return import(filenameLookup[name]).then((plugin) => plugin.default); + } + + // return reference + return filenameLookup[name]; + } + + /** @param {string|PluginDefinition} plugin */ + hasPlugin(plugin) { + let pluginName; + if (typeof plugin === "string") { + pluginName = plugin; + } else { + pluginName = this._getPluginName(plugin); + } + + return this.plugins.some((entry) => this._getPluginName(entry.plugin) === pluginName); + } + + // Using Function.name https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#examples + /** @param {PluginDefinition} plugin */ + _getPluginName(plugin) { + if (plugin?.eleventyPackage) { + return plugin.eleventyPackage; + } + if (typeof plugin === "function") { + return plugin.name; + } + if (plugin?.configFunction && typeof plugin.configFunction === "function") { + return plugin.configFunction.name; + } + } + + // Starting in 3.0 the plugin callback might be asynchronous! + _executePlugin(plugin, options) { + let name = this._getPluginName(plugin); + let ret; + debug(`Adding %o plugin`, name || "anonymous"); + let pluginBenchmark = this.benchmarks.aggregate.get("Configuration addPlugin"); + + if (typeof plugin === "function") { + pluginBenchmark.before(); + this.benchmarks.config; + let configFunction = plugin; + ret = configFunction(this, options); + pluginBenchmark.after(); + } else if (plugin?.configFunction) { + pluginBenchmark.before(); + + if (options && typeof options.init === "function") { + // init is not yet async-friendly but it’s also barely used + options.init.call(this, plugin.initArguments || {}); + } + + ret = plugin.configFunction(this, options); + pluginBenchmark.after(); + } else { + throw new UserConfigError( + "Invalid EleventyConfig.addPlugin signature. Should be a function or a valid Eleventy plugin object.", + ); + } + return ret; + } + + /** @param {string} name */ + getNamespacedName(name) { + return this.activeNamespace + name; + } + + async namespace(pluginNamespace, callback) { + let validNamespace = pluginNamespace && typeof pluginNamespace === "string"; + if (validNamespace) { + this.activeNamespace = pluginNamespace || ""; + } + + await callback(this); + + if (validNamespace) { + this.activeNamespace = ""; + } + } + + /** + * Adds a path to a file or directory to the list of pass-through copies + * which are copied as-is to the output. + * + * @param {string|object} fileOrDir The path to the file or directory that should + * be copied. OR an object where the key is the input glob and the property is the output directory + * @param {object} copyOptions options for recursive-copy. + * see https://www.npmjs.com/package/recursive-copy#arguments + * default options are defined in TemplatePassthrough copyOptionsDefault + * @returns {any} a reference to the `EleventyConfig` object. + */ + addPassthroughCopy(fileOrDir, copyOptions = {}) { + if (copyOptions.mode) { + if (copyOptions.mode !== "html-relative") { + throw new Error( + "Invalid `mode` option for `addPassthroughCopy`. Received: '" + copyOptions.mode + "'", + ); + } + if (isPlainObject(fileOrDir)) { + throw new Error( + "mode: 'html-relative' does not yet support passthrough copy objects (input -> output mapping). Use a string glob or an Array of string globs.", + ); + } + + this.passthroughCopiesHtmlRelative?.add({ + match: fileOrDir, + ...copyOptions, + }); + } else if (typeof fileOrDir === "string") { + this.passthroughCopies[fileOrDir] = { outputPath: true, copyOptions }; + } else { + for (let [inputPath, outputPath] of Object.entries(fileOrDir)) { + this.passthroughCopies[inputPath] = { outputPath, copyOptions }; + } + } + + return this; + } + + /* + * Template Formats + */ + _normalizeTemplateFormats() { + throw new Error("The internal _normalizeTemplateFormats() method was removed in Eleventy 3.0"); + } + + setTemplateFormats(templateFormats) { + this.templateFormats = templateFormats; + } + + // additive, usually for plugins + addTemplateFormats(templateFormats) { + this.templateFormatsAdded.push(templateFormats); + } + + /* + * Library Overrides and Options + */ + setLibrary(engineName, libraryInstance) { + if (engineName === "liquid" && Object.keys(this.liquid.options).length) { + debug( + "WARNING: using `eleventyConfig.setLibrary` will override any configuration set using `.setLiquidOptions` via the config API. You’ll need to pass these options to the library yourself.", + ); + } else if (engineName === "njk" && Object.keys(this.nunjucks.environmentOptions).length) { + debug( + "WARNING: using `eleventyConfig.setLibrary` will override any configuration set using `.setNunjucksEnvironmentOptions` via the config API. You’ll need to pass these options to the library yourself.", + ); + } + + this.libraryOverrides[engineName.toLowerCase()] = libraryInstance; + } + + /* These callbacks run on both libraryOverrides and default library instances */ + amendLibrary(engineName, callback) { + let name = engineName.toLowerCase(); + if (!this.libraryAmendments[name]) { + this.libraryAmendments[name] = []; + } + + this.libraryAmendments[name].push(callback); + } + + setLiquidOptions(options) { + this.liquid.options = options; + } + + setLiquidParameterParsing(behavior) { + if (behavior !== "legacy" && behavior !== "builtin") { + throw new Error( + `Invalid argument passed to \`setLiquidParameterParsing\`. Expected one of "legacy" or "builtin".`, + ); + } + this.liquid.parameterParsing = behavior; + } + + setNunjucksEnvironmentOptions(options) { + this.nunjucks.environmentOptions = options; + } + + setNunjucksPrecompiledTemplates(templates) { + this.nunjucks.precompiledTemplates = templates; + } + + setDynamicPermalinks(enabled) { + this.dynamicPermalinks = !!enabled; + } + + setUseGitIgnore(enabled) { + this.useGitIgnore = !!enabled; + } + + setDataDeepMerge(deepMerge) { + this.#dataDeepMergeModified = true; + this.dataDeepMerge = !!deepMerge; + } + + // Used by the Upgrade Helper Plugin + isDataDeepMergeModified() { + return this.#dataDeepMergeModified; + } + + addWatchTarget(additionalWatchTargets, options = {}) { + // Reset the config when the target path changes + if (options.resetConfig) { + this.watchTargetsConfigReset.add(additionalWatchTargets); + } + + this.additionalWatchTargets.push(additionalWatchTargets); + } + + setWatchJavaScriptDependencies(watchEnabled) { + this.watchJavaScriptDependencies = !!watchEnabled; + } + + setServerOptions(options = {}, override = false) { + if (override) { + this.serverOptions = options; + } else { + this.serverOptions = DeepCopy(this.serverOptions, options); + } + } + + setBrowserSyncConfig() { + this._attemptedBrowserSyncUse = true; + debug( + "The `setBrowserSyncConfig` method was removed in Eleventy 2.0.0. Use `setServerOptions` with the new Eleventy development server or the `@11ty/eleventy-browser-sync` plugin moving forward.", + ); + } + + setChokidarConfig(options = {}) { + this.chokidarConfig = options; + } + + setWatchThrottleWaitTime(time = 0) { + this.watchThrottleWaitTime = time; + } + + // 3.0 change: this does a top level merge instead of reset. + setFrontMatterParsingOptions(options = {}) { + DeepCopy(this.frontMatterParsingOptions, options); + } + + /* Internal method for CLI --quiet */ + _setQuietModeOverride(quietMode) { + this.setQuietMode(quietMode); + this.#quietModeLocked = true; + } + + setQuietMode(quietMode) { + if (this.#quietModeLocked) { + debug( + "Attempt to `setQuietMode(%o)` ignored, --quiet command line argument override in place.", + !!quietMode, + ); + // override via CLI takes precedence + return; + } + + this.quietMode = !!quietMode; + } + + addExtension(fileExtension, options = {}) { + let extensions; + + // Array support added in 2.0.0-canary.19 + if (Array.isArray(fileExtension)) { + extensions = fileExtension; + } else { + // single string + extensions = [fileExtension]; + } + + for (let extension of extensions) { + if (this.extensionConflictMap[extension]) { + throw new Error( + `An attempt was made to override the "${extension}" template syntax twice (via the \`addExtension\` configuration API). A maximum of one override is currently supported.`, + ); + } + this.extensionConflictMap[extension] = true; + + /** @type {object} */ + let extensionOptions = Object.assign( + { + // Might be overridden for aliasing in options.key + key: extension, + extension: extension, + }, + options, + ); + + if (extensionOptions.key !== extensionOptions.extension) { + extensionOptions.aliasKey = extensionOptions.extension; + } + + this.extensionMap.add(extensionOptions); + } + } + + addDataExtension(extensionList, parser) { + let options = {}; + // second argument is an object with a `parser` callback + if (typeof parser !== "function") { + if (!("parser" in parser)) { + throw new Error( + "Expected `parser` property in second argument object to `eleventyConfig.addDataExtension`", + ); + } + + options = parser; + parser = options.parser; + } + + let extensions = extensionList.split(",").map((s) => s.trim()); + for (let extension of extensions) { + this.dataExtensions.set(extension, { + extension, + parser, + options, + }); + } + } + + setUseTemplateCache(bypass) { + this.useTemplateCache = !!bypass; + } + + setPrecompiledCollections(collections) { + this.precompiledCollections = collections; + } + + // "passthrough" is the default, no other value is explicitly required in code + // but opt-out via "copy" is suggested + setServerPassthroughCopyBehavior(behavior) { + this.serverPassthroughCopyBehavior = behavior; + } + + // Url transforms change page.url and work good with server side content-negotiation (e.g. i18n plugin) + addUrlTransform(callback) { + this.urlTransforms.push(callback); + } + + setDataFileSuffixes(suffixArray) { + this.dataFileSuffixesOverride = suffixArray; + } + + setDataFileBaseName(baseName) { + this.dataFileDirBaseNameOverride = baseName; + } + + addTemplate(virtualInputPath, content, data) { + // Lookups keys must be normalized + virtualInputPath = TemplatePath.stripLeadingDotSlash( + TemplatePath.standardizeFilePath(virtualInputPath), + ); + if (this.virtualTemplates[virtualInputPath]) { + throw new Error( + "Virtual template conflict: you can’t add multiple virtual templates that have the same inputPath: " + + virtualInputPath, + ); + } + + this.virtualTemplates[virtualInputPath] = { + inputPath: virtualInputPath, + data, + content, + }; + } + + isVirtualTemplate(virtualInputPath) { + return Boolean(this.virtualTemplates[virtualInputPath]); + } + + #setDirectory(key, dir) { + if (this.isPluginExecution()) { + throw new Error( + "The `set*Directory` configuration API methods are not yet allowed in plugins.", + ); + } + this.directoryAssignments[key] = dir; + } + + setInputDirectory(dir) { + this.#setDirectory("input", dir); + } + + setOutputDirectory(dir) { + this.#setDirectory("output", dir); + } + + setDataDirectory(dir) { + this.#setDirectory("data", dir); + } + + setIncludesDirectory(dir) { + this.#setDirectory("includes", dir); + } + + setLayoutsDirectory(dir) { + this.#setDirectory("layouts", dir); + } + + // Some data keywords in Eleventy are reserved, throw an error if an application tries to set these. + setFreezeReservedData(bool) { + this.freezeReservedData = !!bool; + } + + addDateParsing(callback) { + if (typeof callback === "function") { + this.customDateParsingCallbacks.add(callback); + } else { + throw new Error("addDateParsing expects a function argument."); + } + } + + // 3.0.0-alpha.18 started merging conflicts here (when possible), issue #3389 + addGlobalData(name, data) { + name = this.getNamespacedName(name); + if (this.globalData[name]) { + if (isPlainObject(this.globalData[name]) && isPlainObject(data)) { + DeepCopy(this.globalData[name], data); + } else { + debug("Warning: overwriting a previous value set with addGlobalData(%o)", name); + this.globalData[name] = data; + } + } else { + this.globalData[name] = data; + } + return this; + } + + addNunjucksGlobal(name, globalType) { + name = this.getNamespacedName(name); + + if (this.nunjucks.globals[name]) { + debug( + chalk.yellow("Warning, overwriting a Nunjucks global with `addNunjucksGlobal(%o)`"), + name, + ); + } + + if (typeof globalType === "function") { + this.nunjucks.globals[name] = this.#decorateCallback(`"${name}" Nunjucks Global`, globalType); + } else { + this.nunjucks.globals[name] = globalType; + } + } + + addTransform(name, callback) { + name = this.getNamespacedName(name); + + this.transforms[name] = this.#decorateCallback(`"${name}" Transform`, callback); + } + + addPreprocessor(name, fileExtensions, callback) { + name = this.getNamespacedName(name); + + this.preprocessors[name] = { + filter: fileExtensions, + callback: this.#decorateCallback(`"${name}" Preprocessor`, callback), + }; + } + + addLinter(name, callback) { + name = this.getNamespacedName(name); + + this.linters[name] = this.#decorateCallback(`"${name}" Linter`, callback); + } + + addLayoutAlias(from, to) { + this.layoutAliases[from] = to; + } + + setLayoutResolution(resolution) { + this.layoutResolution = !!resolution; + } + + // compat + enableLayoutResolution() { + this.layoutResolution = true; + } + + configureErrorReporting(options = {}) { + // allowMissingExtensions: true + Object.assign(this.errorReporting, options); + } + + configureTemplateHandling(options = {}) { + // writeMode: "sync" // "async" + Object.assign(this.templateHandling, options); + } + + /* + * Collections + */ + + // get config defined collections + getCollections() { + return this.collections; + } + + addCollection(name, callback) { + name = this.getNamespacedName(name); + + if (this.collections[name]) { + throw new UserConfigError( + `config.addCollection(${name}) already exists. Try a different name for your collection.`, + ); + } + + this.collections[name] = callback; + } + + augmentFunctionContext(fn, options) { + let t = typeof fn; + if (t !== "function") { + throw new UserConfigError( + "Invalid type passed to `augmentFunctionContext`—function was expected and received: " + t, + ); + } + + return augmentFunction(fn, options); + } + + setConcurrency(number) { + if (typeof number !== "number") { + throw new UserConfigError("Argument passed to `setConcurrency` must be a number."); + } + + this.#concurrency = number; + } + + getConcurrency() { + return this.#concurrency; + } + + getMergingConfigObject() { + let obj = { + // filters removed in 1.0 (use addTransform instead) + transforms: this.transforms, + linters: this.linters, + preprocessors: this.preprocessors, + globalData: this.globalData, + layoutAliases: this.layoutAliases, + layoutResolution: this.layoutResolution, + passthroughCopiesHtmlRelative: this.passthroughCopiesHtmlRelative, + passthroughCopies: this.passthroughCopies, + + // Liquid + liquidOptions: this.liquid.options, + liquidTags: this.liquid.tags, + liquidFilters: this.liquid.filters, + liquidShortcodes: this.liquid.shortcodes, + liquidPairedShortcodes: this.liquid.pairedShortcodes, + liquidParameterParsing: this.liquid.parameterParsing, + + // Nunjucks + nunjucksEnvironmentOptions: this.nunjucks.environmentOptions, + nunjucksPrecompiledTemplates: this.nunjucks.precompiledTemplates, + nunjucksFilters: this.nunjucks.filters, + nunjucksAsyncFilters: this.nunjucks.asyncFilters, + nunjucksTags: this.nunjucks.tags, + nunjucksGlobals: this.nunjucks.globals, + nunjucksAsyncShortcodes: this.nunjucks.asyncShortcodes, + nunjucksShortcodes: this.nunjucks.shortcodes, + nunjucksAsyncPairedShortcodes: this.nunjucks.asyncPairedShortcodes, + nunjucksPairedShortcodes: this.nunjucks.pairedShortcodes, + + // 11ty.js + javascriptFunctions: this.javascript.functions, // filters and shortcodes, combined + javascriptShortcodes: this.javascript.shortcodes, + javascriptPairedShortcodes: this.javascript.pairedShortcodes, + javascriptFilters: this.javascript.filters, + + // Markdown + markdownHighlighter: this.markdownHighlighter, + + libraryOverrides: this.libraryOverrides, + dynamicPermalinks: this.dynamicPermalinks, + useGitIgnore: this.useGitIgnore, + ignores: this.ignores, + watchIgnores: this.watchIgnores, + dataDeepMerge: this.dataDeepMerge, + watchJavaScriptDependencies: this.watchJavaScriptDependencies, + additionalWatchTargets: this.additionalWatchTargets, + watchTargetsConfigReset: this.watchTargetsConfigReset, + serverOptions: this.serverOptions, + chokidarConfig: this.chokidarConfig, + watchThrottleWaitTime: this.watchThrottleWaitTime, + frontMatterParsingOptions: this.frontMatterParsingOptions, + dataExtensions: this.dataExtensions, + extensionMap: this.extensionMap, + quietMode: this.quietMode, + events: this.events, + benchmarkManager: this.benchmarkManager, + plugins: this.plugins, + useTemplateCache: this.useTemplateCache, + precompiledCollections: this.precompiledCollections, + dataFilterSelectors: this.dataFilterSelectors, + libraryAmendments: this.libraryAmendments, + serverPassthroughCopyBehavior: this.serverPassthroughCopyBehavior, + urlTransforms: this.urlTransforms, + virtualTemplates: this.virtualTemplates, + // `directories` and `directoryAssignments` are merged manually prior to plugin processing + freezeReservedData: this.freezeReservedData, + customDateParsing: this.customDateParsingCallbacks, + errorReporting: this.errorReporting, + templateHandling: this.templateHandling, + }; + + if (Array.isArray(this.dataFileSuffixesOverride)) { + // no upstream merging of this array, so we add the override: prefix + obj["override:dataFileSuffixes"] = this.dataFileSuffixesOverride; + } + + if (this.dataFileDirBaseNameOverride) { + obj.dataFileDirBaseNameOverride = this.dataFileDirBaseNameOverride; + } + + return obj; + } + + // No-op functions for backwards compat + addHandlebarsHelper() {} + setPugOptions() {} + setEjsOptions() {} + addHandlebarsShortcode() {} + addPairedHandlebarsShortcode() {} +} + +export default UserConfig; diff --git a/node_modules/@11ty/eleventy/src/Util/ArrayUtil.js b/node_modules/@11ty/eleventy/src/Util/ArrayUtil.js new file mode 100644 index 00000000..bcb61dee --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/ArrayUtil.js @@ -0,0 +1,24 @@ +export function arrayDelete(arr, match) { + if (!Array.isArray(arr)) { + return []; + } + + if (!match) { + return arr; + } + + // only mutates if found + if (typeof match === "function") { + if (arr.find(match)) { + return arr.filter((entry) => { + return !match(entry); + }); + } + } else if (arr.includes(match)) { + return arr.filter((entry) => { + return entry !== match; + }); + } + + return arr; +} diff --git a/node_modules/@11ty/eleventy/src/Util/AsyncEventEmitter.js b/node_modules/@11ty/eleventy/src/Util/AsyncEventEmitter.js new file mode 100644 index 00000000..0bc471f9 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/AsyncEventEmitter.js @@ -0,0 +1,88 @@ +import { EventEmitter } from "node:events"; + +/** + * This class emits events asynchronously. + * + * Note that Eleventy has two separate event emitter instances it uses: + * 1. a userland one (UserConfig.js) + * 2. a global one for internals (EventBus.js) + */ +class AsyncEventEmitter extends EventEmitter { + #handlerMode = "parallel"; + + // TypeScript slop + constructor(...args) { + super(...args); + } + + reset() { + // `eleventy#` event type listeners are removed at the start of each build (singletons) + for (let type of this.eventNames()) { + if (typeof type === "string" && type.startsWith("eleventy#")) { + this.removeAllListeners(type); + } + } + + } + + /** + * @param {string} type - The event name to emit. + * @param {...*} args - Additional arguments that get passed to listeners. + * @returns {Promise} - Promise resolves once all listeners were invoked + */ + /** @ts-expect-error */ + async emit(type, ...args) { + let listeners = this.listeners(type); + if (listeners.length === 0) { + return []; + } + + if (this.#handlerMode == "sequential") { + const result = []; + for (const listener of listeners) { + const returnValue = await listener.apply(this, args); + result.push(returnValue); + } + return result; + } else { + return Promise.all( + listeners.map((listener) => { + return listener.apply(this, args); + }), + ); + } + } + + /** + * @param {string} type - The event name to emit. + * @param {...*} args - Additional lazy-executed function arguments that get passed to listeners. + * @returns {Promise} - Promise resolves once all listeners were invoked + */ + async emitLazy(type, ...args) { + let listeners = this.listeners(type); + if (listeners.length === 0) { + return []; + } + + let argsMap = []; + for (let arg of args) { + if (typeof arg === "function") { + let r = arg(); + if (r instanceof Promise) { + r = await r; + } + argsMap.push(r); + } else { + argsMap.push(arg); + } + } + + return this.emit.call(this, type, ...argsMap); + } + + setHandlerMode(mode) { + this.#handlerMode = mode; + } +} + +export default AsyncEventEmitter; diff --git a/node_modules/@11ty/eleventy/src/Util/Compatibility.js b/node_modules/@11ty/eleventy/src/Util/Compatibility.js new file mode 100644 index 00000000..c90a9b33 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/Compatibility.js @@ -0,0 +1,59 @@ +import semver from "semver"; + +import { getEleventyPackageJson, getWorkingProjectPackageJson } from "./ImportJsonSync.js"; + +const pkg = getEleventyPackageJson(); + +// Used in user config versionCheck method. +class Compatibility { + static NORMALIZE_PRERELEASE_REGEX = /-canary\b/g; + + static #projectPackageJson; + + constructor(compatibleRange) { + this.compatibleRange = Compatibility.getCompatibilityValue(compatibleRange); + } + + static get projectPackageJson() { + if (!this.#projectPackageJson) { + this.#projectPackageJson = getWorkingProjectPackageJson(); + } + + return this.#projectPackageJson; + } + + static normalizeIdentifier(identifier) { + return identifier.replace(Compatibility.NORMALIZE_PRERELEASE_REGEX, "-alpha"); + } + + static getCompatibilityValue(compatibleRange) { + if (compatibleRange) { + return compatibleRange; + } + + // fetch from project’s package.json + if (this.projectPackageJson?.["11ty"]?.compatibility) { + return this.projectPackageJson["11ty"].compatibility; + } + } + + isCompatible() { + return Compatibility.satisfies(pkg.version, this.compatibleRange); + } + + static satisfies(version, compatibleRange) { + return semver.satisfies( + Compatibility.normalizeIdentifier(version), + Compatibility.normalizeIdentifier(compatibleRange), + { + includePrerelease: true, + }, + ); + } + + getErrorMessage() { + return `We found Eleventy version '${pkg.version}' which does not meet the required version range: '${this.compatibleRange}'. Use \`npm install @11ty/eleventy\` to upgrade your local project to the latest Eleventy version (or \`npm install @11ty/eleventy -g\` to upgrade the globally installed version).`; + } +} + +export default Compatibility; diff --git a/node_modules/@11ty/eleventy/src/Util/ConsoleLogger.js b/node_modules/@11ty/eleventy/src/Util/ConsoleLogger.js new file mode 100644 index 00000000..ba411963 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/ConsoleLogger.js @@ -0,0 +1,140 @@ +import { Readable } from "node:stream"; +import chalk from "kleur"; +import debugUtil from "debug"; + +const debug = debugUtil("Eleventy:Logger"); + +/** + * Logger implementation that logs to STDOUT. + * @typedef {'error'|'log'|'warn'|'info'} LogType + */ +class ConsoleLogger { + /** @type {boolean} */ + #isVerbose = true; + /** @type {boolean} */ + #isChalkEnabled = true; + /** @type {object|boolean|undefined} */ + #logger; + /** @type {Readable|undefined} */ + #outputStream; + + constructor() {} + + isLoggingEnabled() { + if (!this.isVerbose || process.env.DEBUG) { + return true; + } + return this.#logger !== false; + } + + get isVerbose() { + return this.#isVerbose; + } + + set isVerbose(verbose) { + this.#isVerbose = !!verbose; + } + + get isChalkEnabled() { + return this.#isChalkEnabled; + } + + set isChalkEnabled(enabled) { + this.#isChalkEnabled = !!enabled; + } + + overrideLogger(logger) { + this.#logger = logger; + } + + get logger() { + return this.#logger || console; + } + + /** @param {string} msg */ + log(msg) { + this.message(msg); + } + + /** + * @typedef LogOptions + * @property {string} message + * @property {string=} prefix + * @property {LogType=} type + * @property {string=} color + * @property {boolean=} force + * @param {LogOptions} options + */ + logWithOptions({ message, type, prefix, color, force }) { + this.message(message, type, color, force, prefix); + } + + /** @param {string} msg */ + forceLog(msg) { + this.message(msg, undefined, undefined, true); + } + + /** @param {string} msg */ + info(msg) { + this.message(msg, "warn", "blue"); + } + + /** @param {string} msg */ + warn(msg) { + this.message(msg, "warn", "yellow"); + } + + /** @param {string} msg */ + error(msg) { + this.message(msg, "error", "red"); + } + + get outputStream() { + if (!this.#outputStream) { + this.#outputStream = new Readable({ + read() {}, + }); + } + return this.#outputStream; + } + + /** @param {string} msg */ + toStream(msg) { + this.outputStream.push(msg); + } + + closeStream() { + this.outputStream.push(null); + return this.outputStream; + } + + /** + * Formats the message to log. + * + * @param {string} message - The raw message to log. + * @param {LogType} [type='log'] - The error level to log. + * @param {string|undefined} [chalkColor=undefined] - Color name or falsy to disable + * @param {boolean} [forceToConsole=false] - Enforce a log on console instead of specified target. + */ + message( + message, + type = "log", + chalkColor = undefined, + forceToConsole = false, + prefix = "[11ty]", + ) { + if (!forceToConsole && (!this.isVerbose || process.env.DEBUG)) { + debug(message); + } else if (this.#logger !== false) { + message = `${chalk.gray(prefix)} ${message.split("\n").join(`\n${chalk.gray(prefix)} `)}`; + + if (chalkColor && this.isChalkEnabled) { + this.logger[type](chalk[chalkColor](message)); + } else { + this.logger[type](message); + } + } + } +} + +export default ConsoleLogger; diff --git a/node_modules/@11ty/eleventy/src/Util/DateGitFirstAdded.js b/node_modules/@11ty/eleventy/src/Util/DateGitFirstAdded.js new file mode 100644 index 00000000..0cc5959c --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/DateGitFirstAdded.js @@ -0,0 +1,23 @@ +import { spawnAsync } from "./SpawnAsync.js"; + +async function getGitFirstAddedTimeStamp(filePath) { + try { + let timestamp = await spawnAsync( + "git", + // Formats https://www.git-scm.com/docs/git-log#_pretty_formats + // %at author date, UNIX timestamp + ["log", "--diff-filter=A", "--follow", "-1", "--format=%at", filePath], + ); + return parseInt(timestamp, 10) * 1000; + } catch (e) { + // do nothing + } +} + +// return a Date +export default async function (inputPath) { + let timestamp = await getGitFirstAddedTimeStamp(inputPath); + if (timestamp) { + return new Date(timestamp); + } +} diff --git a/node_modules/@11ty/eleventy/src/Util/DateGitLastUpdated.js b/node_modules/@11ty/eleventy/src/Util/DateGitLastUpdated.js new file mode 100644 index 00000000..1f58c110 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/DateGitLastUpdated.js @@ -0,0 +1,23 @@ +import { spawnAsync } from "./SpawnAsync.js"; + +async function getGitLastUpdatedTimeStamp(filePath) { + try { + let timestamp = await spawnAsync( + "git", + // Formats https://www.git-scm.com/docs/git-log#_pretty_formats + // %at author date, UNIX timestamp + ["log", "-1", "--format=%at", filePath], + ); + return parseInt(timestamp, 10) * 1000; + } catch (e) { + // do nothing + } +} + +// return a Date +export default async function (inputPath) { + let timestamp = await getGitLastUpdatedTimeStamp(inputPath); + if (timestamp) { + return new Date(timestamp); + } +} diff --git a/node_modules/@11ty/eleventy/src/Util/DirContains.js b/node_modules/@11ty/eleventy/src/Util/DirContains.js new file mode 100644 index 00000000..c19990cb --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/DirContains.js @@ -0,0 +1,10 @@ +import path from "node:path"; + +// Returns true if subfolder is in parent (accepts absolute or relative paths for both) +export default function (parentFolder, subFolder) { + // path.resolve returns an absolute path + if (path.resolve(subFolder).startsWith(path.resolve(parentFolder))) { + return true; + } + return false; +} diff --git a/node_modules/@11ty/eleventy/src/Util/EsmResolver.js b/node_modules/@11ty/eleventy/src/Util/EsmResolver.js new file mode 100644 index 00000000..ae515f1b --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/EsmResolver.js @@ -0,0 +1,58 @@ +import debugUtil from "debug"; +import { fileURLToPath } from "node:url"; +import PathNormalizer from "./PathNormalizer.js"; + +const debug = debugUtil("Eleventy:EsmResolver"); + +let lastModifiedPaths = new Map(); + +export async function initialize({ port }) { + // From `eleventy.importCacheReset` event in Require.js + port.on("message", ({ path, newDate }) => { + addToModifiedPaths(path, newDate); + }); +} + +export function addToModifiedPaths(path, date) { + lastModifiedPaths.set(path, date); +} + +// Fixes issue https://github.com/11ty/eleventy/issues/3270 +// Docs: https://nodejs.org/docs/latest/api/module.html#resolvespecifier-context-nextresolve +export function resolve(specifier, context, nextResolve) { + try { + // Not a relative import and not a file import + // Or from node_modules (perhaps better to check if the specifier is in the project directory instead) + if ( + (!specifier.startsWith("../") && + !specifier.startsWith("./") && + !specifier.startsWith("file:")) || + context.parentURL.includes("/node_modules/") + ) { + return nextResolve(specifier, context); + } + + let fileUrl = new URL(specifier, context.parentURL); + if (fileUrl.searchParams.has("_cache_bust")) { + // already is cache busted outside resolver (wider compat, url was changed prior to import, probably in Require.js) + return nextResolve(specifier, context); + } + + let absolutePath = PathNormalizer.normalizeSeperator(fileURLToPath(fileUrl)); + // Bust the import cache if this is a recently modified file + if (lastModifiedPaths.has(absolutePath)) { + fileUrl.search = ""; // delete existing searchparams + fileUrl.searchParams.set("_cache_bust", lastModifiedPaths.get(absolutePath)); + debug("Cache busting %o to %o", specifier, fileUrl.toString()); + + return nextResolve(fileUrl.toString(), context); + } + } catch (e) { + debug("EsmResolver Error parsing specifier (%o): %o", specifier, e); + } + + return nextResolve(specifier, context); +} + +// export async function load(url, context, nextLoad) { +// } diff --git a/node_modules/@11ty/eleventy/src/Util/EsmResolverPortAdapter.js b/node_modules/@11ty/eleventy/src/Util/EsmResolverPortAdapter.js new file mode 100644 index 00000000..f0f52ae0 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/EsmResolverPortAdapter.js @@ -0,0 +1,41 @@ +import module from "node:module"; +import { resolve, addToModifiedPaths } from "./EsmResolver.js"; + +// module.register (old, deprecated) +import { MessageChannel } from "node:worker_threads"; +const { port1, port2 } = new MessageChannel(); + +// ESM Cache Buster +// - register requires Node 18.19+ https://nodejs.org/docs/latest/api/module.html#moduleregisterspecifier-parenturl-options +// - registerHooks requires Node 22.15+ +// Fixes https://github.com/11ty/eleventy/issues/3270 + +// ENV variable for https://github.com/11ty/eleventy/issues/3371 +if (!process?.env?.ELEVENTY_SKIP_ESM_RESOLVER) { + if ("registerHooks" in module) { + module.registerHooks({ + // sync-only + resolve, + }); + } else if ("register" in module) { + module.register("./EsmResolver.js", import.meta.url, { + parentURL: import.meta.url, + data: { + port: port2, + }, + transferList: [port2], + }); + } +} + +export function addModifiedPath(path, date) { + if (process?.env?.ELEVENTY_SKIP_ESM_RESOLVER) { + return; + } + + if ("registerHooks" in module) { + addToModifiedPaths(path, date); + } else if ("register" in module) { + port1.postMessage({ path: path, newDate: date }); + } +} diff --git a/node_modules/@11ty/eleventy/src/Util/EventBusUtil.js b/node_modules/@11ty/eleventy/src/Util/EventBusUtil.js new file mode 100644 index 00000000..c749fe90 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/EventBusUtil.js @@ -0,0 +1,14 @@ +import eventBus from "../EventBus.js"; +import debugUtil from "debug"; + +const debug = debugUtil("Eleventy:EventBus"); + +class EventBusUtil { + static debugCurrentListenerCounts() { + for (let name of eventBus.eventNames()) { + debug("Listeners for %o: %o", name, eventBus.listenerCount(name)); + } + } +} + +export default EventBusUtil; diff --git a/node_modules/@11ty/eleventy/src/Util/ExistsCache.js b/node_modules/@11ty/eleventy/src/Util/ExistsCache.js new file mode 100644 index 00000000..433d7434 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/ExistsCache.js @@ -0,0 +1,62 @@ +import fs from "node:fs"; +import { TemplatePath } from "@11ty/eleventy-utils"; + +// Checks both files and directories +class ExistsCache { + #exists = new Map(); + #dirs = new Map(); + + constructor() { + this.lookupCount = 0; + } + + get size() { + return this.#exists.size; + } + + has(path) { + return this.#exists.has(path); + } + + set(path, isExist) { + this.#exists.set(TemplatePath.addLeadingDotSlash(path), Boolean(isExist)); + } + + // Not yet needed + // setDirectory(path, isExist) {} + + // Relative paths (to root directory) expected (but not enforced due to perf costs) + exists(path) { + if (!this.#exists.has(path)) { + let exists = fs.existsSync(path); + this.lookupCount++; + + // mark for next time + this.#exists.set(path, Boolean(exists)); + + return exists; + } + + return this.#exists.get(path); + } + + isDirectory(path) { + if (!this.exists(path)) { + return false; + } + + if (!this.#dirs.has(path)) { + let isDir = fs.statSync(path).isDirectory(); + this.lookupCount++; + + // mark for next time + this.#dirs.set(path, isDir); + + return isDir; + } + + return this.#dirs.get(path); + } +} + +export default ExistsCache; diff --git a/node_modules/@11ty/eleventy/src/Util/FilePathUtil.js b/node_modules/@11ty/eleventy/src/Util/FilePathUtil.js new file mode 100644 index 00000000..1675e8ec --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/FilePathUtil.js @@ -0,0 +1,19 @@ +class FilePathUtil { + static isMatchingExtension(filepath, fileExtension) { + if (!fileExtension) { + return false; + } + + if (!(fileExtension || "").startsWith(".")) { + fileExtension = "." + fileExtension; + } + + return filepath.endsWith(fileExtension); + } + + static getFileExtension(filepath) { + return (filepath || "").split(".").pop(); + } +} + +export { FilePathUtil }; diff --git a/node_modules/@11ty/eleventy/src/Util/FileSystemManager.js b/node_modules/@11ty/eleventy/src/Util/FileSystemManager.js new file mode 100644 index 00000000..12881d79 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/FileSystemManager.js @@ -0,0 +1,48 @@ +import path from "node:path"; +import fs from "node:fs"; +import { mkdir, writeFile } from "node:fs/promises"; + +class FileSystemManager { + constructor(templateConfig) { + if (!templateConfig || templateConfig.constructor.name !== "TemplateConfig") { + throw new Error( + "Internal error: Missing `templateConfig` or was not an instance of `TemplateConfig`.", + ); + } + this.templateConfig = templateConfig; + } + + exists(pathname) { + return this.templateConfig.existsCache.exists(pathname); + } + + async createDirectoryForFile(filePath) { + let dir = path.parse(filePath).dir; + if (!dir || this.exists(dir)) { + return; + } + + return mkdir(dir, { recursive: true }); + } + + createDirectoryForFileSync(filePath) { + let dir = path.parse(filePath).dir; + if (!dir || this.exists(dir)) { + return; + } + + fs.mkdirSync(dir, { recursive: true }); + } + + async writeFile(filePath, content) { + return writeFile(filePath, content); + } + + writeFileSync(filePath, content) { + // Note: This deliberately uses the synchronous version to avoid + // unbounded concurrency: https://github.com/11ty/eleventy/issues/3271 + fs.writeFileSync(filePath, content); + } +} + +export { FileSystemManager }; diff --git a/node_modules/@11ty/eleventy/src/Util/GetJavaScriptData.js b/node_modules/@11ty/eleventy/src/Util/GetJavaScriptData.js new file mode 100644 index 00000000..7d72a64f --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/GetJavaScriptData.js @@ -0,0 +1,30 @@ +import EleventyBaseError from "../Errors/EleventyBaseError.js"; + +class JavaScriptInvalidDataFormatError extends EleventyBaseError {} + +export default async function (inst, inputPath, key = "data", options = {}) { + let { mixins, isObjectRequired } = Object.assign( + { + mixins: {}, + isObjectRequired: true, + }, + options, + ); + + if (inst && key in inst) { + // get extra data from `data` method, + // either as a function or getter or object literal + let result = await (typeof inst[key] === "function" + ? Object.keys(mixins).length > 0 + ? inst[key].call(mixins) + : inst[key]() + : inst[key]); + + if (isObjectRequired && typeof result !== "object") { + throw new JavaScriptInvalidDataFormatError( + `Invalid data format returned from ${inputPath}: typeof ${typeof result}`, + ); + } + return result; + } +} diff --git a/node_modules/@11ty/eleventy/src/Util/GlobMatcher.js b/node_modules/@11ty/eleventy/src/Util/GlobMatcher.js new file mode 100644 index 00000000..a4a6c550 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/GlobMatcher.js @@ -0,0 +1,22 @@ +import picomatch from "picomatch"; +import { TemplatePath } from "@11ty/eleventy-utils"; + +function isGlobMatch(filepath, globs = [], options = undefined) { + if (!filepath || !Array.isArray(globs) || globs.length === 0) { + return false; + } + + let inputPath = TemplatePath.stripLeadingDotSlash(filepath); + let opts = Object.assign( + { + dot: true, + nocase: true, // insensitive + }, + options, + ); + + // globs: string or array of strings + return picomatch.isMatch(inputPath, globs, opts); +} + +export { isGlobMatch }; diff --git a/node_modules/@11ty/eleventy/src/Util/GlobRemap.js b/node_modules/@11ty/eleventy/src/Util/GlobRemap.js new file mode 100644 index 00000000..5e2bea37 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/GlobRemap.js @@ -0,0 +1,85 @@ +import path from "node:path"; +import ProjectDirectories from "./ProjectDirectories.js"; +import PathNormalizer from "./PathNormalizer.js"; + +// even on Windows (in cmd.exe) these paths are normalized to forward slashes +// tinyglobby expects forward slashes on Windows +const SEP = "/"; + +class GlobRemap { + constructor(paths = []) { + this.paths = paths; + this.cwd = GlobRemap.getCwd(paths); + } + + getCwd() { + return this.cwd; + } + + getRemapped(paths) { + return paths.map((entry) => GlobRemap.remapInput(entry, this.cwd)); + } + + getInput() { + return this.getRemapped(this.paths); + } + + getOutput(paths = []) { + return paths.map((entry) => GlobRemap.remapOutput(entry, this.cwd)); + } + + static getParentDirPrefix(filePath = "") { + let count = []; + for (let p of filePath.split(SEP)) { + if (p === "..") { + count.push(".."); + } else { + break; + } + } + + if (count.length > 0) { + // trailing slash + return count.join(SEP) + SEP; + } + return ""; + } + + static getLongestParentDirPrefix(filePaths) { + let longest = ""; + filePaths + .map((entry) => { + return this.getParentDirPrefix(entry); + }) + .filter((entry) => Boolean(entry)) + .forEach((prefix) => { + if (!longest || prefix.length > longest.length) { + longest = prefix; + } + }); + return longest; + } + + // alias + static getCwd(filePaths) { + return this.getLongestParentDirPrefix(filePaths); + } + + static remapInput(entry, cwd) { + if (cwd) { + if (!entry.startsWith("**" + SEP) && !entry.startsWith(`.git${SEP}**`)) { + return PathNormalizer.normalizeSeperator(ProjectDirectories.getRelativeTo(entry, cwd)); + } + } + return entry; + } + + static remapOutput(entry, cwd) { + if (cwd) { + return PathNormalizer.normalizeSeperator(path.join(cwd, entry)); + } + return entry; + } +} + +export default GlobRemap; diff --git a/node_modules/@11ty/eleventy/src/Util/HtmlRelativeCopy.js b/node_modules/@11ty/eleventy/src/Util/HtmlRelativeCopy.js new file mode 100644 index 00000000..30590147 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/HtmlRelativeCopy.js @@ -0,0 +1,149 @@ +import path from "node:path"; +import { TemplatePath } from "@11ty/eleventy-utils"; +import isValidUrl from "./ValidUrl.js"; +import { isGlobMatch } from "./GlobMatcher.js"; + +class HtmlRelativeCopy { + #userConfig; + #matchingGlobs = new Set(); + #matchingGlobsArray; + #dirty = false; + #paths = new Set(); + #failOnError = true; + #copyOptions = { + dot: false, // differs from standard passthrough copy + }; + + isEnabled() { + return this.#matchingGlobs.size > 0; + } + + setFailOnError(failOnError) { + this.#failOnError = Boolean(failOnError); + } + + setCopyOptions(opts) { + if (opts) { + Object.assign(this.#copyOptions, opts); + } + } + + setUserConfig(userConfig) { + if (!userConfig || userConfig.constructor.name !== "UserConfig") { + throw new Error( + "Internal error: Missing `userConfig` or was not an instance of `UserConfig`.", + ); + } + this.#userConfig = userConfig; + } + + addPaths(paths = []) { + for (let path of paths) { + this.#paths.add(TemplatePath.getDir(path)); + } + } + + get matchingGlobs() { + if (this.#dirty || !this.#matchingGlobsArray) { + this.#matchingGlobsArray = Array.from(this.#matchingGlobs); + this.#dirty = false; + } + + return this.#matchingGlobsArray; + } + + addMatchingGlob(glob) { + if (glob) { + if (Array.isArray(glob)) { + for (let g of glob) { + this.#matchingGlobs.add(g); + } + } else { + this.#matchingGlobs.add(glob); + } + this.#dirty = true; + } + } + + isSkippableHref(rawRef) { + if ( + this.#matchingGlobs.size === 0 || + !rawRef || + path.isAbsolute(rawRef) || + isValidUrl(rawRef) + ) { + return true; + } + return false; + } + + isCopyableTarget(target) { + if (!isGlobMatch(target, this.matchingGlobs)) { + return false; + } + + return true; + } + + exists(filePath) { + return this.#userConfig.exists(filePath); + } + + getAliasedPath(ref) { + for (let dir of this.#paths) { + let found = TemplatePath.join(dir, ref); + if (this.isCopyableTarget(found) && this.exists(found)) { + return found; + } + } + } + + getFilePathRelativeToProjectRoot(ref, contextFilePath) { + let dir = TemplatePath.getDirFromFilePath(contextFilePath); + return TemplatePath.join(dir, ref); + } + + copy(fileRef, tmplInputPath, tmplOutputPath) { + // original ref is a full URL or no globs exist + if (this.isSkippableHref(fileRef)) { + return; + } + + // Relative to source file’s input path + let source = this.getFilePathRelativeToProjectRoot(fileRef, tmplInputPath); + if (!this.isCopyableTarget(source)) { + return; + } + + if (!this.exists(source)) { + // Try to alias using `options.paths` + let alias = this.getAliasedPath(fileRef); + if (!alias) { + if (this.#failOnError) { + throw new Error( + "Missing input file for `html-relative` Passthrough Copy file: " + + TemplatePath.absolutePath(source), + ); + } + + // don’t fail on error + return; + } + + source = alias; + } + + let target = this.getFilePathRelativeToProjectRoot(fileRef, tmplOutputPath); + + // We use a Set here to allow passthrough copy manager to properly error on conflicts upstream + // Only errors when different inputs write to the same output + // Also errors if attempts to write outside the output folder. + this.#userConfig.emit("eleventy#copy", { + source, + target, + options: this.#copyOptions, + }); + } +} + +export { HtmlRelativeCopy }; diff --git a/node_modules/@11ty/eleventy/src/Util/HtmlTransformer.js b/node_modules/@11ty/eleventy/src/Util/HtmlTransformer.js new file mode 100644 index 00000000..f28910fc --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/HtmlTransformer.js @@ -0,0 +1,172 @@ +import posthtml from "posthtml"; +import urls from "@11ty/posthtml-urls"; +import { FilePathUtil } from "./FilePathUtil.js"; + +import { arrayDelete } from "./ArrayUtil.js"; + +class HtmlTransformer { + // feature test for Eleventy Bundle Plugin + static SUPPORTS_PLUGINS_ENABLED_CALLBACK = true; + + static TYPES = ["callbacks", "plugins"]; + + constructor() { + // execution order is important (not order of addition/object key order) + this.callbacks = {}; + this.posthtmlProcessOptions = {}; + this.plugins = {}; + } + + get aggregateBench() { + if (!this.userConfig) { + throw new Error("Internal error: Missing `userConfig` in HtmlTransformer."); + } + return this.userConfig.benchmarkManager.get("Aggregate"); + } + + setUserConfig(config) { + this.userConfig = config; + } + + static prioritySort(a, b) { + if (b.priority > a.priority) { + return 1; + } + if (a.priority > b.priority) { + return -1; + } + return 0; + } + + // context is important as it is used in html base plugin for page specific URL + static _getPosthtmlInstance(callbacks = [], plugins = [], context = {}) { + let inst = posthtml(); + + // already sorted by priority when added + for (let { fn: plugin, options } of plugins) { + inst.use(plugin(Object.assign({}, context, options))); + } + + // Run the built-ins last + if (callbacks.length > 0) { + inst.use( + urls({ + eachURL: (url, attrName, tagName) => { + for (let { fn: callback } of callbacks) { + // already sorted by priority when added + url = callback.call(context, url, { attribute: attrName, tag: tagName }); + } + + return url; + }, + }), + ); + } + + return inst; + } + + _add(extensions, addType, value, options = {}) { + options = Object.assign( + { + priority: 0, + }, + options, + ); + + let extensionsArray = (extensions || "").split(","); + for (let ext of extensionsArray) { + let target = this[addType]; + if (!target[ext]) { + target[ext] = []; + } + + target[ext].push({ + // *could* fallback to function name, `value.name` + name: options.name, // for `remove` and debugging + fn: value, // callback or plugin + priority: options.priority, // sorted in descending order + enabled: options.enabled || (() => true), + options: options.pluginOptions, + }); + + target[ext].sort(HtmlTransformer.prioritySort); + } + } + + addPosthtmlPlugin(extensions, plugin, options = {}) { + this._add(extensions, "plugins", plugin, options); + } + + // match can be a plugin function or a filter callback(plugin => true); + remove(extensions, match) { + for (let removeType of HtmlTransformer.TYPES) { + for (let ext of (extensions || "").split(",")) { + this[removeType][ext] = arrayDelete(this[removeType][ext], match); + } + } + } + + addUrlTransform(extensions, callback, options = {}) { + this._add(extensions, "callbacks", callback, options); + } + + setPosthtmlProcessOptions(options) { + Object.assign(this.posthtmlProcessOptions, options); + } + + isTransformable(extension, context) { + return ( + this.getCallbacks(extension, context).length > 0 || this.getPlugins(extension).length > 0 + ); + } + + getCallbacks(extension, context) { + let callbacks = this.callbacks[extension] || []; + return callbacks.filter(({ enabled }) => { + if (!enabled || typeof enabled !== "function") { + return true; + } + return enabled(context); + }); + } + + getPlugins(extension) { + let plugins = this.plugins[extension] || []; + return plugins.filter(({ enabled }) => { + if (!enabled || typeof enabled !== "function") { + return true; + } + return enabled(); + }); + } + + static async transformStandalone(content, callback, posthtmlProcessOptions = {}) { + let posthtmlInstance = this._getPosthtmlInstance([ + { + fn: callback, + enabled: () => true, + }, + ]); + let result = await posthtmlInstance.process(content, posthtmlProcessOptions); + return result.html; + } + + async transformContent(outputPath, content, context) { + let extension = FilePathUtil.getFileExtension(outputPath); + if (!this.isTransformable(extension, context)) { + return content; + } + + let bench = this.aggregateBench.get(`Transforming \`${extension}\` with posthtml`); + bench.before(); + let callbacks = this.getCallbacks(extension, context); + let plugins = this.getPlugins(extension); + let posthtmlInstance = HtmlTransformer._getPosthtmlInstance(callbacks, plugins, context); + let result = await posthtmlInstance.process(content, this.posthtmlProcessOptions); + bench.after(); + return result.html; + } +} + +export { HtmlTransformer }; diff --git a/node_modules/@11ty/eleventy/src/Util/ImportJsonSync.js b/node_modules/@11ty/eleventy/src/Util/ImportJsonSync.js new file mode 100644 index 00000000..fa593659 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/ImportJsonSync.js @@ -0,0 +1,77 @@ +import fs from "node:fs"; +import { createRequire } from "node:module"; +import debugUtil from "debug"; + +import { TemplatePath } from "@11ty/eleventy-utils"; + +import { normalizeFilePathInEleventyPackage } from "./Require.js"; + +const debug = debugUtil("Eleventy:ImportJsonSync"); +const require = createRequire(import.meta.url); + +function findFilePathInParentDirs(dir, filename) { + // `package.json` searches look in parent dirs: + // https://docs.npmjs.com/cli/v7/configuring-npm/folders#more-information + // Fixes issue #3178, limited to working dir paths only + let workingDir = TemplatePath.getWorkingDir(); + // TODO use DirContains + let allDirs = TemplatePath.getAllDirs(dir).filter((entry) => entry.startsWith(workingDir)); + + for (let dir of allDirs) { + let newPath = TemplatePath.join(dir, filename); + if (fs.existsSync(newPath)) { + debug("Found %o searching parent directories at: %o", filename, dir); + return newPath; + } + } +} + +function importJsonSync(filePath) { + if (!filePath || !filePath.endsWith(".json")) { + throw new Error(`importJsonSync expects a .json file extension (received: ${filePath})`); + } + + return require(filePath); +} + +function getEleventyPackageJson() { + let filePath = normalizeFilePathInEleventyPackage("package.json"); + return importJsonSync(filePath); +} + +function getModulePackageJson(dir) { + let filePath = findFilePathInParentDirs(TemplatePath.absolutePath(dir), "package.json"); + + // optional! + if (!filePath) { + return {}; + } + + return importJsonSync(filePath); +} + +// This will *not* find a package.json in a parent directory above root +function getWorkingProjectPackageJsonPath() { + let dir = TemplatePath.absolutePath(TemplatePath.getWorkingDir()); + return findFilePathInParentDirs(dir, "package.json"); +} + +function getWorkingProjectPackageJson() { + let filePath = getWorkingProjectPackageJsonPath(); + + // optional! + if (!filePath) { + return {}; + } + + return importJsonSync(filePath); +} + +export { + importJsonSync, + findFilePathInParentDirs, + getEleventyPackageJson, + getModulePackageJson, + getWorkingProjectPackageJson, + getWorkingProjectPackageJsonPath, +}; diff --git a/node_modules/@11ty/eleventy/src/Util/IsAsyncFunction.js b/node_modules/@11ty/eleventy/src/Util/IsAsyncFunction.js new file mode 100644 index 00000000..3c4dc654 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/IsAsyncFunction.js @@ -0,0 +1,5 @@ +const ComparisonAsyncFunction = (async () => {}).constructor; + +export default function isAsyncFunction(fn) { + return fn instanceof ComparisonAsyncFunction; +} diff --git a/node_modules/@11ty/eleventy/src/Util/JavaScriptDependencies.js b/node_modules/@11ty/eleventy/src/Util/JavaScriptDependencies.js new file mode 100644 index 00000000..7f6e8093 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/JavaScriptDependencies.js @@ -0,0 +1,55 @@ +import dependencyTree from "@11ty/dependency-tree"; +import { find } from "@11ty/dependency-tree-esm"; +import { TemplatePath } from "@11ty/eleventy-utils"; + +import EleventyBaseError from "../Errors/EleventyBaseError.js"; + +class JavaScriptDependencies { + static getErrorMessage(file, type) { + return `A problem was encountered looking for JavaScript dependencies in ${type} file: ${file}. This only affects --watch and --serve behavior and does not affect your build.`; + } + + static async getDependencies(inputFiles, isProjectUsingEsm) { + let depSet = new Set(); + + // TODO does this need to work with aliasing? what other JS extensions will have deps? + let commonJsFiles = inputFiles.filter( + (file) => (!isProjectUsingEsm && file.endsWith(".js")) || file.endsWith(".cjs"), + ); + + for (let file of commonJsFiles) { + try { + let modules = dependencyTree(file, { + nodeModuleNames: "exclude", + allowNotFound: true, + }).map((dependency) => { + return TemplatePath.addLeadingDotSlash(TemplatePath.relativePath(dependency)); + }); + + for (let dep of modules) { + depSet.add(dep); + } + } catch (e) { + throw new EleventyBaseError(this.getErrorMessage(file, "CommonJS"), e); + } + } + + let esmFiles = inputFiles.filter( + (file) => (isProjectUsingEsm && file.endsWith(".js")) || file.endsWith(".mjs"), + ); + for (let file of esmFiles) { + try { + let modules = await find(file); + for (let dep of modules) { + depSet.add(dep); + } + } catch (e) { + throw new EleventyBaseError(this.getErrorMessage(file, "ESM"), e); + } + } + + return Array.from(depSet).sort(); + } +} + +export default JavaScriptDependencies; diff --git a/node_modules/@11ty/eleventy/src/Util/MemoizeFunction.js b/node_modules/@11ty/eleventy/src/Util/MemoizeFunction.js new file mode 100644 index 00000000..f66a155a --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/MemoizeFunction.js @@ -0,0 +1,26 @@ +export default function (callback, options = {}) { + let { bench, name } = options; + let cache = new Map(); + + return (...args) => { + // Only supports single-arg functions for now. + if (args.filter(Boolean).length > 1) { + bench?.get(`(count) ${name} Not valid for memoize`).incrementCount(); + return callback(...args); + } + + let [cacheKey] = args; + + if (!cache.has(cacheKey)) { + cache.set(cacheKey, callback(...args)); + + bench?.get(`(count) ${name} memoize miss`).incrementCount(); + + return cache.get(cacheKey); + } + + bench?.get(`(count) ${name} memoize hit`).incrementCount(); + + return cache.get(cacheKey); + }; +} diff --git a/node_modules/@11ty/eleventy/src/Util/Objects/DeepFreeze.js b/node_modules/@11ty/eleventy/src/Util/Objects/DeepFreeze.js new file mode 100644 index 00000000..88e2847a --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/Objects/DeepFreeze.js @@ -0,0 +1,20 @@ +import { isPlainObject } from "@11ty/eleventy-utils"; + +// via https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze + +function DeepFreeze(obj, topLevelExceptions) { + for (let name of Reflect.ownKeys(obj)) { + if ((topLevelExceptions || []).find((key) => key === name)) { + continue; + } + + const value = obj[name]; + if (isPlainObject(value)) { + DeepFreeze(value); + } + } + + return Object.freeze(obj); +} + +export { DeepFreeze }; diff --git a/node_modules/@11ty/eleventy/src/Util/Objects/ObjectFilter.js b/node_modules/@11ty/eleventy/src/Util/Objects/ObjectFilter.js new file mode 100644 index 00000000..9ce8737d --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/Objects/ObjectFilter.js @@ -0,0 +1,9 @@ +export default function objectFilter(obj, callback) { + let newObject = {}; + for (let [key, value] of Object.entries(obj || {})) { + if (callback(value, key)) { + newObject[key] = value; + } + } + return newObject; +} diff --git a/node_modules/@11ty/eleventy/src/Util/Objects/ProxyWrap.js b/node_modules/@11ty/eleventy/src/Util/Objects/ProxyWrap.js new file mode 100644 index 00000000..38730fd1 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/Objects/ProxyWrap.js @@ -0,0 +1,118 @@ +import types from "node:util/types"; +import debugUtil from "debug"; +import { isPlainObject } from "@11ty/eleventy-utils"; + +const debug = debugUtil("Dev:Eleventy:Proxy"); + +function wrapObject(target, fallback) { + if (Object.isFrozen(target)) { + return target; + } + + return new Proxy(target, { + getOwnPropertyDescriptor(target, prop) { + let ret; + + if (Reflect.has(target, prop)) { + ret = Reflect.getOwnPropertyDescriptor(target, prop); + } else if (Reflect.has(fallback, prop)) { + ret = Reflect.getOwnPropertyDescriptor(fallback, prop); + } + + return ret; + }, + has(target, prop) { + if (Reflect.has(target, prop)) { + return true; + } + + return Reflect.has(fallback, prop); + }, + ownKeys(target) { + let s = new Set(); + // The fallback keys need to come first to preserve proper key order + // https://github.com/11ty/eleventy/issues/3849 + if (isPlainObject(fallback)) { + for (let k of Reflect.ownKeys(fallback)) { + s.add(k); + } + } + for (let k of Reflect.ownKeys(target)) { + if (!s.has(k)) { + s.add(k); + } + } + return Array.from(s); + }, + get(target, prop) { + debug("handler:get", prop); + + let value = Reflect.get(target, prop); + + if (Reflect.has(target, prop)) { + // Already proxied + if (types.isProxy(value)) { + return value; + } + + if (isPlainObject(value) && Reflect.has(fallback, prop)) { + if (Object.isFrozen(value)) { + return value; + } + + let ret = wrapObject(value, Reflect.get(fallback, prop)); + debug("handler:get (primary, object)", prop); + return ret; + } + + debug("handler:get (primary)", prop); + return value; + } + + // Does not exist in primary + if ( + (typeof fallback === "object" || typeof fallback === "function") && + Reflect.has(fallback, prop) + ) { + // fallback has prop + let fallbackValue = Reflect.get(fallback, prop); + + if (isPlainObject(fallbackValue)) { + if (Object.isFrozen(fallbackValue)) { + return fallbackValue; + } + + debug("handler:get (fallback, object)", prop); + // set empty object on primary + let emptyObject = {}; + Reflect.set(target, prop, emptyObject); + + return wrapObject(emptyObject, fallbackValue); + } + + debug("handler:get (fallback)", prop); + return fallbackValue; + } + + // primary *and* fallback do _not_ have prop + debug("handler:get (not on primary or fallback)", prop); + + return value; + }, + set(target, prop, value) { + debug("handler:set", prop); + + return Reflect.set(target, prop, value); + }, + }); +} + +function ProxyWrap(target, fallback) { + if (!isPlainObject(target) || !isPlainObject(fallback)) { + throw new Error("ProxyWrap expects objects for both the target and fallback"); + } + + return wrapObject(target, fallback); +} + +export { ProxyWrap }; diff --git a/node_modules/@11ty/eleventy/src/Util/Objects/SampleModule.mjs b/node_modules/@11ty/eleventy/src/Util/Objects/SampleModule.mjs new file mode 100644 index 00000000..ff8b4c56 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/Objects/SampleModule.mjs @@ -0,0 +1 @@ +export default {}; diff --git a/node_modules/@11ty/eleventy/src/Util/Objects/Sortable.js b/node_modules/@11ty/eleventy/src/Util/Objects/Sortable.js new file mode 100644 index 00000000..a23d4c9a --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/Objects/Sortable.js @@ -0,0 +1,136 @@ +class Sortable { + constructor() { + this.isSortAscending = true; + this.isSortNumeric = false; + this.items = []; + this._dirty = true; + + this.sortFunctionStringMap = { + "A-Z": "sortFunctionAscending", + "Z-A": "sortFunctionDescending", + "0-9": "sortFunctionNumericAscending", + "9-0": "sortFunctionNumericDescending", + }; + } + + get length() { + return this.items.length; + } + + add(item) { + this._dirty = true; + this.items.push(item); + } + + sort(sortFunction) { + if (!sortFunction) { + sortFunction = this.getSortFunction(); + } else if (typeof sortFunction === "string") { + let key = sortFunction; + let name; + if (key in this.sortFunctionStringMap) { + name = this.sortFunctionStringMap[key]; + } + if (Sortable[name]) { + sortFunction = Sortable[name]; + } else { + throw new Error( + `Invalid String argument for sort(). Received \`${key}\`. Valid values: ${Object.keys( + this.sortFunctionStringMap, + )}`, + ); + } + } + + return this.items.slice().sort(sortFunction); + } + + sortAscending() { + return this.sort(this.getSortFunctionAscending()); + } + + sortDescending() { + return this.sort(this.getSortFunctionDescending()); + } + + setSortDescending(isDescending = true) { + this.isSortAscending = !isDescending; + } + + setSortAscending(isAscending = true) { + this.isSortAscending = isAscending; + } + + setSortNumeric(isNumeric) { + this.isSortNumeric = isNumeric; + } + + /* Sort functions */ + static sortFunctionNumericAscending(a, b) { + return a - b; + } + + static sortFunctionNumericDescending(a, b) { + return b - a; + } + + static sortFunctionAscending(a, b) { + if (a > b) { + return 1; + } else if (a < b) { + return -1; + } + return 0; + } + + static sortFunctionDescending(a, b) { + return Sortable.sortFunctionAscending(b, a); + } + + static sortFunctionAlphabeticAscending(a, b) { + return Sortable.sortFunctionAscending(a, b); + } + + static sortFunctionAlphabeticDescending(a, b) { + return Sortable.sortFunctionAscending(b, a); + } + + static sortFunctionDate(mapA, mapB) { + return Sortable.sortFunctionNumericAscending(mapA.date.getTime(), mapB.date.getTime()); + } + + static sortFunctionDateInputPath(mapA, mapB) { + let sortDate = Sortable.sortFunctionNumericAscending(mapA.date.getTime(), mapB.date.getTime()); + if (sortDate === 0) { + return Sortable.sortFunctionAlphabeticAscending(mapA.inputPath, mapB.inputPath); + } + return sortDate; + } + /* End sort functions */ + + getSortFunction() { + if (this.isSortAscending) { + return this.getSortFunctionAscending(); + } else { + return this.getSortFunctionDescending(); + } + } + + getSortFunctionAscending() { + if (this.isSortNumeric) { + return Sortable.sortFunctionNumericAscending; + } else { + return Sortable.sortFunctionAlphabeticAscending; + } + } + + getSortFunctionDescending() { + if (this.isSortNumeric) { + return Sortable.sortFunctionNumericDescending; + } else { + return Sortable.sortFunctionAlphabeticDescending; + } + } +} + +export default Sortable; diff --git a/node_modules/@11ty/eleventy/src/Util/Objects/Unique.js b/node_modules/@11ty/eleventy/src/Util/Objects/Unique.js new file mode 100644 index 00000000..8570c0c4 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/Objects/Unique.js @@ -0,0 +1,3 @@ +export default function Unique(arr) { + return Array.from(new Set(arr)); +} diff --git a/node_modules/@11ty/eleventy/src/Util/PassthroughCopyBehaviorCheck.js b/node_modules/@11ty/eleventy/src/Util/PassthroughCopyBehaviorCheck.js new file mode 100644 index 00000000..3dc1abb9 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/PassthroughCopyBehaviorCheck.js @@ -0,0 +1,16 @@ +function isUsingEleventyDevServer(config) { + return ( + !config.serverOptions.module || config.serverOptions.module === "@11ty/eleventy-dev-server" + ); +} + +// Config opt-out via serverPassthroughCopyBehavior +// False when other server is used +// False when runMode is "build" or "watch" +export default function (config, runMode) { + return ( + config.serverPassthroughCopyBehavior === "passthrough" && + isUsingEleventyDevServer(config) && + runMode === "serve" + ); +} diff --git a/node_modules/@11ty/eleventy/src/Util/PathNormalizer.js b/node_modules/@11ty/eleventy/src/Util/PathNormalizer.js new file mode 100644 index 00000000..cdc32532 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/PathNormalizer.js @@ -0,0 +1,58 @@ +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { TemplatePath } from "@11ty/eleventy-utils"; + +export default class PathNormalizer { + static getParts(inputPath) { + if (!inputPath) { + return []; + } + + let separator = "/"; + if (inputPath.includes(path.sep)) { + separator = path.sep; + } + + return inputPath.split(separator).filter((entry) => entry !== "."); + } + + // order is important here: the top-most directory returns first + // array of file and all parent directories + static getAllPaths(inputPath) { + let parts = this.getParts(inputPath); + let allPaths = []; + + let fullpath = ""; + for (let part of parts) { + fullpath += (fullpath.length > 0 ? "/" : "") + part; + allPaths.push(fullpath); + } + + return allPaths; + } + + static normalizeSeperator(inputPath) { + if (!inputPath) { + return inputPath; + } + return inputPath.split(path.sep).join("/"); + } + + static fullNormalization(inputPath) { + if (typeof inputPath !== "string") { + return inputPath; + } + + // Fix file:///Users/ or file:///C:/ paths passed in + if (inputPath.startsWith("file://")) { + inputPath = fileURLToPath(inputPath); + } + + // Paths should not be absolute (we convert absolute paths to relative) + // Paths should not have a leading dot slash + // Paths should always be `/` independent of OS path separator + return TemplatePath.stripLeadingDotSlash( + this.normalizeSeperator(TemplatePath.relativePath(inputPath)), + ); + } +} diff --git a/node_modules/@11ty/eleventy/src/Util/PathPrefixer.js b/node_modules/@11ty/eleventy/src/Util/PathPrefixer.js new file mode 100644 index 00000000..abd55825 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/PathPrefixer.js @@ -0,0 +1,21 @@ +import path from "node:path"; + +import PathNormalizer from "./PathNormalizer.js"; + +class PathPrefixer { + static normalizePathPrefix(pathPrefix) { + if (pathPrefix) { + // add leading / (for browsersync), see #1454 + // path.join uses \\ for Windows so we split and rejoin + return PathPrefixer.joinUrlParts("/", pathPrefix); + } + + return "/"; + } + + static joinUrlParts(...parts) { + return PathNormalizer.normalizeSeperator(path.join(...parts)); + } +} + +export default PathPrefixer; diff --git a/node_modules/@11ty/eleventy/src/Util/Pluralize.js b/node_modules/@11ty/eleventy/src/Util/Pluralize.js new file mode 100644 index 00000000..d35f1dd9 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/Pluralize.js @@ -0,0 +1,3 @@ +export default function (count, singleWord, pluralWord) { + return count === 1 ? singleWord : pluralWord; +} diff --git a/node_modules/@11ty/eleventy/src/Util/ProjectDirectories.js b/node_modules/@11ty/eleventy/src/Util/ProjectDirectories.js new file mode 100644 index 00000000..e15e985a --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/ProjectDirectories.js @@ -0,0 +1,369 @@ +import fs from "node:fs"; +import path from "node:path"; +import { TemplatePath } from "@11ty/eleventy-utils"; +import { isDynamicPattern } from "tinyglobby"; + +import DirContains from "./DirContains.js"; + +/* Directories internally should always use *nix forward slashes */ +class ProjectDirectories { + static defaults = { + input: "./", + data: "./_data/", // Relative to input directory + includes: "./_includes/", // Relative to input directory + layouts: "./_layouts/", // Relative to input directory + output: "./_site/", + }; + + // no updates allowed, input/output set via CLI + #frozen = false; + + #raw = {}; + + #dirs = {}; + + inputFile = undefined; + inputGlob = undefined; + + // Add leading dot slash + // Use forward slashes + static normalizePath(fileOrDir) { + return TemplatePath.standardizeFilePath(fileOrDir); + } + + // Must be a directory + // Always include a trailing slash + static normalizeDirectory(dir) { + return this.addTrailingSlash(this.normalizePath(dir)); + } + + normalizeDirectoryPathRelativeToInputDirectory(filePath) { + return ProjectDirectories.normalizeDirectory(path.join(this.input, filePath)); + } + + static addTrailingSlash(path) { + if (path.slice(-1) === "/") { + return path; + } + return path + "/"; + } + + // If input/output are set via CLI, they take precedence over all other configuration values. + freeze() { + this.#frozen = true; + } + + setViaConfigObject(configDirs = {}) { + // input must come last + let inputChanged = false; + if ( + configDirs.input && + ProjectDirectories.normalizeDirectory(configDirs.input) !== this.input + ) { + this.#setInputRaw(configDirs.input); + inputChanged = true; + } + + // If falsy or an empty string, the current directory is used. + if (configDirs.output !== undefined) { + if (ProjectDirectories.normalizeDirectory(configDirs.output) !== this.output) { + this.setOutput(configDirs.output); + } + } + + // Input relative directory, if falsy or an empty string, inputDir is used! + // Always set if input changed, e.g. input is `src` and data is `../_data` (resulting in `./_data`) we still want to set data to this new value + if (configDirs.data !== undefined) { + if ( + inputChanged || + this.normalizeDirectoryPathRelativeToInputDirectory(configDirs.data || "") !== this.data + ) { + this.setData(configDirs.data); + } + } + + // Input relative directory, if falsy or an empty string, inputDir is used! + if (configDirs.includes !== undefined) { + if ( + inputChanged || + this.normalizeDirectoryPathRelativeToInputDirectory(configDirs.includes || "") !== + this.includes + ) { + this.setIncludes(configDirs.includes); + } + } + + // Input relative directory, if falsy or an empty string, inputDir is used! + if (configDirs.layouts !== undefined) { + if ( + inputChanged || + this.normalizeDirectoryPathRelativeToInputDirectory(configDirs.layouts || "") !== + this.layouts + ) { + this.setLayouts(configDirs.layouts); + } + } + + if (inputChanged) { + this.updateInputDependencies(); + } + } + + updateInputDependencies() { + // raw first, fall back to Eleventy defaults if not yet set + this.setData(this.#raw.data ?? ProjectDirectories.defaults.data); + this.setIncludes(this.#raw.includes ?? ProjectDirectories.defaults.includes); + + // Should not include this if not explicitly opted-in + if (this.#raw.layouts !== undefined) { + this.setLayouts(this.#raw.layouts ?? ProjectDirectories.defaults.layouts); + } + } + + /* Relative to project root, must exist */ + #setInputRaw(dirOrFile, inputDir = undefined) { + // is frozen and was defined previously + if (this.#frozen && this.#raw.input !== undefined) { + return; + } + + this.#raw.input = dirOrFile; + + if (!dirOrFile) { + // input must exist if inputDir is not set. + return; + } + + // Normalize absolute paths to relative, #3805 + // if(path.isAbsolute(dirOrFile)) { + // dirOrFile = path.relative(".", dirOrFile); + // } + + // Input has to exist (assumed glob if it does not exist) + let inputExists = fs.existsSync(dirOrFile); + let inputExistsAndIsDirectory = inputExists && fs.statSync(dirOrFile).isDirectory(); + + if (inputExistsAndIsDirectory) { + // is not a file or glob + this.#dirs.input = ProjectDirectories.normalizeDirectory(dirOrFile); + } else { + if (inputExists) { + this.inputFile = ProjectDirectories.normalizePath(dirOrFile); + } else { + if (!isDynamicPattern(dirOrFile)) { + throw new Error( + `The "${dirOrFile}" \`input\` parameter (directory or file path) must exist on the file system (unless detected as a glob by the \`tinyglobby\` package)`, + ); + } + + this.inputGlob = dirOrFile; + } + + // Explicit Eleventy option for inputDir + if (inputDir) { + // Changed in 3.0: must exist + if (!fs.existsSync(inputDir)) { + throw new Error("Directory must exist (via inputDir option to Eleventy constructor)."); + } + + this.#dirs.input = ProjectDirectories.normalizeDirectory(inputDir); + } else { + // the input directory is implied to be the parent directory of the + // file, unless inputDir is explicitly specified (via Eleventy constructor `options`) + this.#dirs.input = ProjectDirectories.normalizeDirectory( + TemplatePath.getDirFromFilePath(dirOrFile), // works with globs + ); + } + } + } + + setInput(dirOrFile, inputDir = undefined) { + this.#setInputRaw(dirOrFile, inputDir); // does not update + this.updateInputDependencies(); + } + + /* Relative to input dir */ + setIncludes(dir) { + if (dir !== undefined) { + // falsy or an empty string is valid (falls back to input dir) + this.#raw.includes = dir; + this.#dirs.includes = ProjectDirectories.normalizeDirectory( + TemplatePath.join(this.input, dir || ""), + ); + } + } + + /* Relative to input dir */ + /* Optional */ + setLayouts(dir) { + if (dir !== undefined) { + // falsy or an empty string is valid (falls back to input dir) + this.#raw.layouts = dir; + this.#dirs.layouts = ProjectDirectories.normalizeDirectory( + TemplatePath.join(this.input, dir || ""), + ); + } + } + + /* Relative to input dir */ + setData(dir) { + if (dir !== undefined) { + // falsy or an empty string is valid (falls back to input dir) + // TODO must exist if specified + this.#raw.data = dir; + this.#dirs.data = ProjectDirectories.normalizeDirectory( + TemplatePath.join(this.input, dir || ""), + ); + } + } + + /* Relative to project root */ + setOutput(dir) { + // is frozen and was defined previously + if (this.#frozen && this.#raw.output !== undefined) { + return; + } + + if (dir !== undefined) { + this.#raw.output = dir; + this.#dirs.output = ProjectDirectories.normalizeDirectory(dir || ""); + } + } + + get input() { + return this.#dirs.input || ProjectDirectories.defaults.input; + } + + get data() { + return this.#dirs.data || ProjectDirectories.defaults.data; + } + + get includes() { + return this.#dirs.includes || ProjectDirectories.defaults.includes; + } + + get layouts() { + // explicit opt-in, no fallback. + return this.#dirs.layouts; + } + + get output() { + return this.#dirs.output || ProjectDirectories.defaults.output; + } + + isTemplateFile(filePath) { + let inputPath = this.getInputPath(filePath); + // TODO use DirContains + if (this.layouts && inputPath.startsWith(this.layouts)) { + return false; + } + + // if this.includes is "" (and thus is the same directory as this.input) + // we don’t actually know if this is a template file, so defer + if (this.includes && this.includes !== this.input) { + if (inputPath.startsWith(this.includes)) { + return false; + } + } + + // TODO use DirContains + return inputPath.startsWith(this.input); + } + + // for a hypothetical template file + getInputPath(filePathRelativeToInputDir) { + // TODO change ~/ to project root dir + return TemplatePath.addLeadingDotSlash( + TemplatePath.join(this.input, TemplatePath.standardizeFilePath(filePathRelativeToInputDir)), + ); + } + + // Inverse of getInputPath + // Removes input dir from path + getInputPathRelativeToInputDirectory(filePathRelativeToInputDir) { + let inputDir = TemplatePath.addLeadingDotSlash(TemplatePath.join(this.input)); + + // No leading dot slash + return TemplatePath.stripLeadingSubPath(filePathRelativeToInputDir, inputDir); + } + + // for a hypothetical Eleventy layout file + getLayoutPath(filePathRelativeToLayoutDir) { + return TemplatePath.addLeadingDotSlash( + TemplatePath.join( + this.layouts || this.includes, + TemplatePath.standardizeFilePath(filePathRelativeToLayoutDir), + ), + ); + } + + // Removes layout dir from path + getLayoutPathRelativeToInputDirectory(filePathRelativeToLayoutDir) { + let layoutPath = this.getLayoutPath(filePathRelativeToLayoutDir); + let inputDir = TemplatePath.addLeadingDotSlash(TemplatePath.join(this.input)); + + // No leading dot slash + return TemplatePath.stripLeadingSubPath(layoutPath, inputDir); + } + + getProjectPath(filePath) { + return TemplatePath.addLeadingDotSlash( + TemplatePath.join(".", TemplatePath.standardizeFilePath(filePath)), + ); + } + + isFileInProjectFolder(filePath) { + return DirContains(TemplatePath.getWorkingDir(), filePath); + } + + isFileInOutputFolder(filePath) { + return DirContains(this.output, filePath); + } + + static getRelativeTo(targetPath, cwd) { + return path.relative(cwd, path.join(path.resolve("."), targetPath)); + } + + // Access the data without being able to set the data. + getUserspaceInstance() { + let d = this; + + return { + get input() { + return d.input; + }, + get inputFile() { + return d.inputFile; + }, + get inputGlob() { + return d.inputGlob; + }, + get data() { + return d.data; + }, + get includes() { + return d.includes; + }, + get layouts() { + return d.layouts; + }, + get output() { + return d.output; + }, + }; + } + + toString() { + return { + input: this.input, + inputFile: this.inputFile, + inputGlob: this.inputGlob, + data: this.data, + includes: this.includes, + layouts: this.layouts, + output: this.output, + }; + } +} + +export default ProjectDirectories; diff --git a/node_modules/@11ty/eleventy/src/Util/ProjectTemplateFormats.js b/node_modules/@11ty/eleventy/src/Util/ProjectTemplateFormats.js new file mode 100644 index 00000000..f37040ef --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/ProjectTemplateFormats.js @@ -0,0 +1,134 @@ +import debugUtil from "debug"; +const debug = debugUtil("Eleventy:Util:ProjectTemplateFormats"); + +class ProjectTemplateFormats { + #useAll = {}; + #raw = {}; + + #values = {}; // Set objects + + static union(...sets) { + let s = new Set(); + + for (let set of sets) { + if (!set || typeof set[Symbol.iterator] !== "function") { + continue; + } + for (let v of set) { + s.add(v); + } + } + + return s; + } + + #normalize(formats) { + if (Array.isArray(formats)) { + formats = "" + formats.join(","); + } + + if (typeof formats !== "string") { + throw new Error( + `Invalid formats (expect String, Array) passed to ProjectTemplateFormats->normalize: ${formats}`, + ); + } + + let final = new Set(); + for (let format of formats.split(",")) { + format = format.trim(); + if (format && format !== "*") { + final.add(format); + } + } + + return final; + } + + isWildcard() { + return this.#useAll.cli || this.#useAll.config || false; + } + + /** @returns {boolean} */ + #isUseAll(rawFormats) { + if (rawFormats === "") { + return false; + } + + if (typeof rawFormats === "string") { + rawFormats = rawFormats.split(","); + } + + if (Array.isArray(rawFormats)) { + return rawFormats.find((entry) => entry === "*") !== undefined; + } + + return false; + } + + // 3.x Breaking: "" now means no formats. In 2.x and prior it meant "*" + setViaCommandLine(formats) { + if (formats === undefined) { + return; + } + + this.#useAll.cli = this.#isUseAll(formats); + this.#raw.cli = formats; + this.#values.cli = this.#normalize(formats); + } + + // 3.x Breaking: "" now means no formats—in 2.x and prior it meant "*" + // 3.x Adds support for comma separated string—in 2.x this required an Array + setViaConfig(formats) { + if (formats === undefined) { + return; + } + + // "*" is supported + this.#useAll.config = this.#isUseAll(formats); + this.#raw.config = formats; + this.#values.config = this.#normalize(formats); + } + + addViaConfig(formats) { + if (!formats) { + return; + } + + if (this.#isUseAll(formats)) { + throw new Error( + `\`addTemplateFormats("*")\` is not supported for project template syntaxes.`, + ); + } + + // "*" not supported here + this.#raw.configAdd = formats; + this.#values.configAdd = this.#normalize(formats); + } + + getAllTemplateFormats() { + return Array.from(ProjectTemplateFormats.union(this.#values.config, this.#values.configAdd)); + } + + getTemplateFormats() { + if (this.#useAll.cli) { + let v = this.getAllTemplateFormats(); + debug("Using CLI --formats='*': %o", v); + return v; + } + + if (this.#raw.cli !== undefined) { + let v = Array.from(this.#values.cli); + debug("Using CLI --formats: %o", v); + return v; + } + + let v = this.getAllTemplateFormats(); + debug( + "Using configuration `templateFormats`, `setTemplateFormats()`, `addTemplateFormats()`: %o", + v, + ); + return v; + } +} + +export default ProjectTemplateFormats; diff --git a/node_modules/@11ty/eleventy/src/Util/PromiseUtil.js b/node_modules/@11ty/eleventy/src/Util/PromiseUtil.js new file mode 100644 index 00000000..fa88da0f --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/PromiseUtil.js @@ -0,0 +1,15 @@ +function withResolvers() { + if ("withResolvers" in Promise) { + return Promise.withResolvers(); + } + + let resolve; + let reject; + let promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, resolve, reject }; +} + +export { withResolvers }; diff --git a/node_modules/@11ty/eleventy/src/Util/Require.js b/node_modules/@11ty/eleventy/src/Util/Require.js new file mode 100644 index 00000000..1cfff5ef --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/Require.js @@ -0,0 +1,239 @@ +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import module from "node:module"; + +import { addModifiedPath } from "./EsmResolverPortAdapter.js"; + +import { TemplatePath } from "@11ty/eleventy-utils"; + +import EleventyBaseError from "../Errors/EleventyBaseError.js"; +import eventBus from "../EventBus.js"; + +class EleventyImportError extends EleventyBaseError {} + +// important to clear the require.cache in CJS projects +const require = module.createRequire(import.meta.url); + +const requestPromiseCache = new Map(); + +function getImportErrorMessage(filePath, type) { + return `There was a problem importing '${path.relative(".", filePath)}' via ${type}`; +} + +// Used for JSON imports, suffering from Node warning that import assertions experimental but also +// throwing an error if you try to import() a JSON file without an import assertion. +/** + * + * @returns {string|undefined} + */ +function loadContents(path, options = {}) { + let rawInput; + /** @type {string} */ + let encoding = "utf8"; // JSON is utf8 + if (options?.encoding || options?.encoding === null) { + encoding = options.encoding; + } + + try { + // @ts-expect-error This is an error in the upstream types + rawInput = fs.readFileSync(path, encoding); + } catch (error) { + // @ts-expect-error Temporary + if (error?.code === "ENOENT") { + // if file does not exist, return nothing + return; + } + + throw error; + } + + // Can return a buffer, string, etc + if (typeof rawInput === "string") { + rawInput = rawInput.trim(); + } + + return rawInput; +} + +let lastModifiedPaths = new Map(); +eventBus.on("eleventy.importCacheReset", (fileQueue) => { + for (let filePath of fileQueue) { + let absolutePath = TemplatePath.absolutePath(filePath); + let newDate = Date.now(); + lastModifiedPaths.set(absolutePath, newDate); + addModifiedPath(absolutePath, newDate); + + // ESM Eleventy when using `import()` on a CJS project file still adds to require.cache + if (absolutePath in (require?.cache || {})) { + delete require.cache[absolutePath]; + } + } +}); + +// raw means we don’t normalize away the `default` export +async function dynamicImportAbsolutePath(absolutePath, options = {}) { + let { type, returnRaw, cacheBust } = Object.assign( + { + type: undefined, + returnRaw: false, + cacheBust: false, // force cache bust + }, + options, + ); + + // Short circuit for JSON files (that are optional and can be empty) + if (absolutePath.endsWith(".json") || type === "json") { + try { + // https://v8.dev/features/import-assertions#dynamic-import() is still experimental in Node 20 + let rawInput = loadContents(absolutePath); + if (!rawInput) { + // should not error when file exists but is _empty_ + return; + } + return JSON.parse(rawInput); + } catch (e) { + return Promise.reject( + new EleventyImportError(getImportErrorMessage(absolutePath, "fs.readFile(json)"), e), + ); + } + } + + // Removed a `require` short circuit from this piece originally added + // in https://github.com/11ty/eleventy/pull/3493 Was a bit faster but + // error messaging was worse for require(esm) + + let urlPath; + try { + let u = new URL(`file:${absolutePath}`); + + // Bust the import cache if this is the last modified file (or cache busting is forced) + if (cacheBust) { + lastModifiedPaths.set(absolutePath, Date.now()); + } + + if (cacheBust || lastModifiedPaths.has(absolutePath)) { + u.searchParams.set("_cache_bust", lastModifiedPaths.get(absolutePath)); + } + + urlPath = u.toString(); + } catch (e) { + urlPath = absolutePath; + } + + let promise; + if (requestPromiseCache.has(urlPath)) { + promise = requestPromiseCache.get(urlPath); + } else { + promise = import(urlPath); + requestPromiseCache.set(urlPath, promise); + } + + return promise.then( + (target) => { + if (returnRaw) { + return target; + } + + // If the only export is `default`, elevate to top (for ESM and CJS) + if (Object.keys(target).length === 1 && "default" in target) { + return target.default; + } + + // When using import() on a CommonJS file that exports an object sometimes it + // returns duplicated values in `default` key, e.g. `{ default: {key: value}, key: value }` + + // A few examples: + // module.exports = { key: false }; + // returns `{ default: {key: false}, key: false }` as not expected. + // module.exports = { key: true }; + // module.exports = { key: null }; + // module.exports = { key: undefined }; + // module.exports = { key: class {} }; + + // A few examples where it does not duplicate: + // module.exports = { key: 1 }; + // returns `{ default: {key: 1} }` as expected. + // module.exports = { key: "value" }; + // module.exports = { key: {} }; + // module.exports = { key: [] }; + + if (type === "cjs" && "default" in target) { + let match = true; + for (let key in target) { + if (key === "default") { + continue; + } + if (key === "module.exports") { + continue; + } + if (target[key] !== target.default[key]) { + match = false; + } + } + + if (match) { + return target.default; + } + } + + // Otherwise return { default: value, named: value } + // Object.assign here so we can add things to it in JavaScript.js + return Object.assign({}, target); + }, + (error) => { + return Promise.reject( + new EleventyImportError(getImportErrorMessage(absolutePath, `import(${type})`), error), + ); + }, + ); +} + +function normalizeFilePathInEleventyPackage(file) { + // Back up relative paths from ./src/Util/Require.js + return path.resolve(fileURLToPath(import.meta.url), "../../../", file); +} + +async function dynamicImportFromEleventyPackage(file) { + // points to files relative to the top level Eleventy directory + let filePath = normalizeFilePathInEleventyPackage(file); + + // Returns promise + return dynamicImportAbsolutePath(filePath, { type: "esm" }); +} + +async function dynamicImport(localPath, type, options = {}) { + let absolutePath = TemplatePath.absolutePath(localPath); + options.type = type; + + // Returns promise + return dynamicImportAbsolutePath(absolutePath, options); +} + +/* Used to import default Eleventy configuration file, raw means we don’t normalize away the `default` export */ +async function dynamicImportRawFromEleventyPackage(file) { + // points to files relative to the top level Eleventy directory + let filePath = normalizeFilePathInEleventyPackage(file); + + // Returns promise + return dynamicImportAbsolutePath(filePath, { type: "esm", returnRaw: true }); +} + +/* Used to import app configuration files, raw means we don’t normalize away the `default` export */ +async function dynamicImportRaw(localPath, type) { + let absolutePath = TemplatePath.absolutePath(localPath); + + // Returns promise + return dynamicImportAbsolutePath(absolutePath, { type, returnRaw: true }); +} + +export { + loadContents as EleventyLoadContent, + dynamicImport as EleventyImport, + dynamicImportRaw as EleventyImportRaw, + normalizeFilePathInEleventyPackage, + + // no longer used in core + dynamicImportFromEleventyPackage as EleventyImportFromEleventy, + dynamicImportRawFromEleventyPackage as EleventyImportRawFromEleventy, +}; diff --git a/node_modules/@11ty/eleventy/src/Util/ReservedData.js b/node_modules/@11ty/eleventy/src/Util/ReservedData.js new file mode 100644 index 00000000..d726c738 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/ReservedData.js @@ -0,0 +1,69 @@ +class EleventyReservedDataError extends TypeError {} + +class ReservedData { + static properties = [ + // "pkg", // Object.freeze’d upstream + // "eleventy", // Object.freeze’d upstream + // "page" is only frozen for specific subproperties below + "content", + "collections", + ]; + + static pageProperties = [ + "date", + "inputPath", + "fileSlug", + "filePathStem", + "outputFileExtension", + "templateSyntax", + "url", + "outputPath", + // not yet `excerpt` or `lang` set via front matter and computed data + ]; + + // Check in the data cascade for reserved data properties. + static getReservedKeys(data) { + if (!data) { + return []; + } + + let keys = this.properties.filter((key) => { + return key in data; + }); + + if ("page" in data) { + if (typeof data.page === "object") { + for (let key of this.pageProperties) { + if (key in data.page) { + keys.push(`page.${key}`); + } + } + } else { + // fail `page` when set to non-object values. + keys.push("page"); + } + } + return keys; + } + + static check(data) { + let reserved = ReservedData.getReservedKeys(data); + if (reserved.length === 0) { + return; + } + + let error = new EleventyReservedDataError( + `Cannot override reserved Eleventy properties: ${reserved.join(", ")}`, + ); + + error.reservedNames = reserved; + + throw error; + } + + static isReservedDataError(e) { + return e instanceof EleventyReservedDataError; + } +} + +export default ReservedData; diff --git a/node_modules/@11ty/eleventy/src/Util/SetUnion.js b/node_modules/@11ty/eleventy/src/Util/SetUnion.js new file mode 100644 index 00000000..50e6b9c6 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/SetUnion.js @@ -0,0 +1,11 @@ +function setUnion(...sets) { + let root = new Set(); + for (let set of sets) { + for (let entry of set) { + root.add(entry); + } + } + return root; +} + +export { setUnion }; diff --git a/node_modules/@11ty/eleventy/src/Util/SpawnAsync.js b/node_modules/@11ty/eleventy/src/Util/SpawnAsync.js new file mode 100644 index 00000000..5e6a20f9 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/SpawnAsync.js @@ -0,0 +1,29 @@ +import { spawn } from "node:child_process"; +import { withResolvers } from "./PromiseUtil.js"; + +export function spawnAsync(command, args, options) { + let { promise, resolve, reject } = withResolvers(); + + const cmd = spawn(command, args, options); + let res = []; + cmd.stdout.on("data", (data) => { + res.push(data.toString("utf8")); + }); + + let err = []; + cmd.stderr.on("data", (data) => { + err.push(data.toString("utf8")); + }); + + cmd.on("close", (code) => { + if (err.length > 0) { + reject(err.join("\n")); + } else if (code === 1) { + reject("Internal error: process closed with error exit code."); + } else { + resolve(res.join("\n")); + } + }); + + return promise; +} diff --git a/node_modules/@11ty/eleventy/src/Util/TemplateDepGraph.js b/node_modules/@11ty/eleventy/src/Util/TemplateDepGraph.js new file mode 100644 index 00000000..795453db --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/TemplateDepGraph.js @@ -0,0 +1,160 @@ +import { DepGraph as DependencyGraph } from "dependency-graph"; +import debugUtil from "debug"; + +const debug = debugUtil("Eleventy:TemplateDepGraph"); + +const COLLECTION_PREFIX = "__collection:"; + +export class TemplateDepGraph extends DependencyGraph { + static STAGES = ["[basic]", "[userconfig]", "[keys]", "all"]; + + #configCollectionNames = new Set(); + + constructor() { + // BREAKING TODO move this back to non-circular with errors + super({ circular: true }); + + let previous; + // establish stage relationships, all uses keys, keys uses userconfig, userconfig uses tags + for (let stageName of TemplateDepGraph.STAGES.filter(Boolean).reverse()) { + let stageKey = `${COLLECTION_PREFIX}${stageName}`; + if (previous) { + this.uses(previous, stageKey); + } + previous = stageKey; + } + } + + uses(from, to) { + this.addDependency(from, to); + } + + addTag(tagName, type) { + if ( + tagName === "all" || + (tagName.startsWith("[") && tagName.endsWith("]")) || + this.#configCollectionNames.has(tagName) + ) { + return; + } + if (!type) { + throw new Error( + `Missing tag type for addTag. Expecting one of ${TemplateDepGraph.STAGES.map((entry) => entry.slice(1, -1)).join(" or ")}. Received: ${type}`, + ); + } + + debug("collection type %o uses tag %o", tagName, type); + + this.uses(`${COLLECTION_PREFIX}[${type}]`, `${COLLECTION_PREFIX}${tagName}`); + } + + addConfigCollectionName(collectionName) { + if (collectionName === "all") { + return; + } + + this.#configCollectionNames.add(collectionName); + // Collection relationships to `[userconfig]` are added last, in unfilteredOrder() + } + + cleanupCollectionNames(collectionNames = []) { + let s = new Set(collectionNames); + if (s.has("[userconfig]")) { + return collectionNames; + } + + let hasAnyConfigCollections = collectionNames.find((name) => { + if (this.#configCollectionNames.has(name)) { + return true; + } + return false; + }); + + if (hasAnyConfigCollections) { + s.add("[userconfig]"); + } + + return Array.from(s); + } + + addTemplate(filePath, consumes = [], publishesTo = []) { + // Move to the beginning if it doesn’t consume anything + if (consumes.length === 0) { + this.uses(`${COLLECTION_PREFIX}[basic]`, filePath); + } + + consumes = this.cleanupCollectionNames(consumes); + publishesTo = this.cleanupCollectionNames(publishesTo); + // Can’t consume AND publish to `all` simultaneously + let consumesAll = consumes.includes("all"); + if (consumesAll) { + publishesTo = publishesTo.filter((entry) => entry !== "all"); + } + + debug("%o consumes %o and publishes to %o", filePath, consumes, publishesTo); + + for (let collectionName of publishesTo) { + if (!consumesAll) { + let tagType = "basic"; + + let consumesUserConfigCollection = consumes.includes("[userconfig]"); + if (consumesUserConfigCollection) { + // must finish before [keys] + tagType = "keys"; + } + + this.addTag(collectionName, tagType); + } + + this.uses(`${COLLECTION_PREFIX}${collectionName}`, filePath); + } + + for (let collectionName of consumes) { + this.uses(filePath, `${COLLECTION_PREFIX}${collectionName}`); + + let stageIndex = TemplateDepGraph.STAGES.indexOf(collectionName); + let nextStage = stageIndex > 0 ? TemplateDepGraph.STAGES[stageIndex + 1] : undefined; + if (nextStage) { + this.uses(`${COLLECTION_PREFIX}${nextStage}`, filePath); + } + } + } + + addDependency(from, to) { + if (!this.hasNode(from)) { + this.addNode(from); + } + if (!this.hasNode(to)) { + this.addNode(to); + } + super.addDependency(from, to); + } + + unfilteredOrder() { + // these need to be added last, after the template map has been added (see addConfigCollectionName) + for (let collectionName of this.#configCollectionNames) { + this.uses(`${COLLECTION_PREFIX}[keys]`, `${COLLECTION_PREFIX}${collectionName}`); + } + + return super.overallOrder(); + } + + overallOrder() { + let unfiltered = this.unfilteredOrder(); + + let filtered = unfiltered.filter((entry) => { + if (entry === `${COLLECTION_PREFIX}[keys]`) { + return true; + } + return !entry.startsWith(`${COLLECTION_PREFIX}[`) && !entry.endsWith("]"); + }); + + let allKey = `${COLLECTION_PREFIX}all`; + // Add another collections.all entry to the end (if not already the last one) + if (filtered[filtered.length - 1] !== allKey) { + filtered.push(allKey); + } + + return filtered; + } +} diff --git a/node_modules/@11ty/eleventy/src/Util/TransformsUtil.js b/node_modules/@11ty/eleventy/src/Util/TransformsUtil.js new file mode 100644 index 00000000..3ba8ab05 --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/TransformsUtil.js @@ -0,0 +1,70 @@ +import EleventyBaseError from "../Errors/EleventyBaseError.js"; +import { isPlainObject } from "@11ty/eleventy-utils"; +import debugUtil from "debug"; + +const debug = debugUtil("Eleventy:Transforms"); + +class EleventyTransformError extends EleventyBaseError {} + +class TransformsUtil { + static changeTransformsToArray(transformsObj) { + let transforms = []; + for (let name in transformsObj) { + transforms.push({ + name: name, + callback: transformsObj[name], + }); + } + return transforms; + } + + static async runAll(content, pageData, transforms = {}, options = {}) { + let { baseHrefOverride, logger } = options; + let { inputPath, outputPath, url } = pageData; + + if (!isPlainObject(transforms)) { + throw new Error("Object of transforms expected."); + } + + let transformsArray = this.changeTransformsToArray(transforms); + + for (let { callback, name } of transformsArray) { + debug("Running %o transform on %o: %o", name, inputPath, outputPath); + + try { + let hadContentBefore = !!content; + + content = await callback.call( + { + inputPath, + outputPath, + url, + page: pageData, + baseHref: baseHrefOverride, + }, + content, + outputPath, + ); + + if (hadContentBefore && !content) { + if (!logger || !logger.warn) { + throw new Error("Internal error: missing `logger` instance."); + } + + logger.warn( + `Warning: Transform \`${name}\` returned empty when writing ${outputPath} from ${inputPath}.`, + ); + } + } catch (e) { + throw new EleventyTransformError( + `Transform \`${name}\` encountered an error when transforming ${inputPath}.`, + e, + ); + } + } + + return content; + } +} + +export default TransformsUtil; diff --git a/node_modules/@11ty/eleventy/src/Util/ValidUrl.js b/node_modules/@11ty/eleventy/src/Util/ValidUrl.js new file mode 100644 index 00000000..9d0f59ba --- /dev/null +++ b/node_modules/@11ty/eleventy/src/Util/ValidUrl.js @@ -0,0 +1,9 @@ +export default function isValidUrl(url) { + try { + new URL(url); + return true; + } catch (e) { + // invalid url OR local path + return false; + } +} diff --git a/node_modules/@11ty/eleventy/src/defaultConfig.js b/node_modules/@11ty/eleventy/src/defaultConfig.js new file mode 100644 index 00000000..fb1ab5dd --- /dev/null +++ b/node_modules/@11ty/eleventy/src/defaultConfig.js @@ -0,0 +1,178 @@ +import bundlePlugin from "@11ty/eleventy-plugin-bundle"; + +import urlFilter from "./Filters/Url.js"; +import slugFilter from "./Filters/Slug.js"; +import slugifyFilter from "./Filters/Slugify.js"; +import getLocaleCollectionItem from "./Filters/GetLocaleCollectionItem.js"; +import getCollectionItemIndex from "./Filters/GetCollectionItemIndex.js"; +import { FilterPlugin as InputPathToUrlFilterPlugin } from "./Plugins/InputPathToUrl.js"; +import { HtmlTransformer } from "./Util/HtmlTransformer.js"; +import TransformsUtil from "./Util/TransformsUtil.js"; +import MemoizeUtil from "./Util/MemoizeFunction.js"; +import { HtmlRelativeCopyPlugin } from "./Plugins/HtmlRelativeCopyPlugin.js"; + +/** + * @module 11ty/eleventy/defaultConfig + */ + +/** + * @callback addFilter - Register a global filter. + * @param {string} name - Register a template filter by this name. + * @param {function} callback - The filter logic. + */ + +/** + * @typedef {object} config + * @property {addFilter} addFilter - Register a new global filter. + */ + +/** + * @typedef {object} defaultConfig + * @property {Array} templateFormats - An array of accepted template formats. + * @property {string} [pathPrefix='/'] - The directory under which all output files should be written to. + * @property {string} [markdownTemplateEngine='liquid'] - Template engine to process markdown files with. + * @property {string} [htmlTemplateEngine='liquid'] - Template engine to process html files with. + * @property {boolean} [dataTemplateEngine=false] - Changed in v1.0 + * @property {string} [jsDataFileSuffix='.11tydata'] - File suffix for jsData files. + * @property {object} keys + * @property {string} [keys.package='pkg'] - Global data property for package.json data + * @property {string} [keys.layout='layout'] + * @property {string} [keys.permalink='permalink'] + * @property {string} [keys.permalinkRoot='permalinkBypassOutputDir'] + * @property {string} [keys.engineOverride='templateEngineOverride'] + * @property {string} [keys.computed='eleventyComputed'] + * @property {object} dir + * @property {string} [dir.input='.'] + * @property {string} [dir.includes='_includes'] + * @property {string} [dir.data='_data'] + * @property {string} [dir.output='_site'] + * @deprecated handlebarsHelpers + * @deprecated nunjucksFilters + */ + +/** + * Default configuration object factory. + * + * @param {config} config - Eleventy configuration object. + * @returns {defaultConfig} + */ +export default function (config) { + let templateConfig = this; + + // Used for the HTML , InputPathToUrl, Image transform plugins + let ut = new HtmlTransformer(); + ut.setUserConfig(config); + + // This needs to be assigned before bundlePlugin is added below. + config.htmlTransformer = ut; + + config.exists = (filePath) => { + return this.existsCache.exists(filePath); + }; + + // Remember: the transform added here runs before the `htmlTransformer` transform + config.addPlugin(bundlePlugin, { + bundles: false, // no default bundles included—must be opt-in. + immediate: true, + }); + + // Filter: Maps an input path to output URL + config.addPlugin(InputPathToUrlFilterPlugin, { + immediate: true, + }); + + let memoizeBench = config.benchmarkManager.get("Configuration"); + config.addFilter("slug", MemoizeUtil(slugFilter, { name: "slug", bench: memoizeBench })); + config.addFilter("slugify", MemoizeUtil(slugifyFilter, { name: "slugify", bench: memoizeBench })); + + // Deprecated, use HtmlBasePlugin instead. + // Adds a pathPrefix manually to a URL string + config.addFilter("url", function addPathPrefixFilter(url, pathPrefixOverride) { + let pathPrefix; + if (pathPrefixOverride && typeof pathPrefixOverride === "string") { + pathPrefix = pathPrefixOverride; + } else { + pathPrefix = templateConfig.getPathPrefix(); + } + + return urlFilter.call(this, url, pathPrefix); + }); + + config.addFilter("log", (input, ...messages) => { + console.log(input, ...messages); + return input; + }); + + config.addFilter("getCollectionItemIndex", function (collection, pageOverride) { + return getCollectionItemIndex.call(this, collection, pageOverride); + }); + config.addFilter("getCollectionItem", function (collection, pageOverride, langCode) { + return getLocaleCollectionItem.call(this, config, collection, pageOverride, langCode, 0); + }); + config.addFilter("getPreviousCollectionItem", function (collection, pageOverride, langCode) { + return getLocaleCollectionItem.call(this, config, collection, pageOverride, langCode, -1); + }); + config.addFilter("getNextCollectionItem", function (collection, pageOverride, langCode) { + return getLocaleCollectionItem.call(this, config, collection, pageOverride, langCode, 1); + }); + + // Process arbitrary content with transforms + config.addFilter( + "renderTransforms", + async function transformsFilter(content, pageEntryOverride, baseHrefOverride) { + return TransformsUtil.runAll(content, pageEntryOverride || this.page, config.transforms, { + baseHrefOverride, + logger: config.logger, + }); + }, + ); + + // Run the `htmlTransformer` transform + config.addTransform("@11ty/eleventy/html-transformer", async function (content) { + // Runs **AFTER** the bundle plugin transform (except: delayed bundles) + return ut.transformContent(this.outputPath, content, this); + }); + + // Requires user configuration, so must run as second-stage + config.addPlugin(HtmlRelativeCopyPlugin); + + return { + templateFormats: ["liquid", "md", "njk", "html", "11ty.js"], + // if your site deploys to a subdirectory, change this + pathPrefix: "/", + markdownTemplateEngine: "liquid", + htmlTemplateEngine: "liquid", + + // Renamed from `jsDataFileSuffix` in 2.0 (and swapped to an Array) + // If you remove "" we won’t look for dir/dir.json or file.json + dataFileSuffixes: [".11tydata", ""], + + // "index" will look for `directory/index.*` directory data files instead of `directory/directory.*` + dataFileDirBaseNameOverride: false, + + keys: { + // TODO breaking: use `false` by default + package: "pkg", // supports `false` + layout: "layout", + permalink: "permalink", + permalinkRoot: "permalinkBypassOutputDir", + engineOverride: "templateEngineOverride", + computed: "eleventyComputed", + dataSchema: "eleventyDataSchema", + }, + + // Deprecated, define using `export const directories = {}` instead. + // Reference values using `eleventyConfig.directories` instead. + dir: { + // These values here aren’t used internally either (except by a few tests), instead we’re using `ProjectDirectories.defaults`. + // These are kept in place for backwards compat with `eleventyConfig.dir` references in project config code and plugins. + input: ".", + includes: "_includes", + data: "_data", + output: "_site", + }, + + // deprecated, use config.addNunjucksFilter + nunjucksFilters: {}, + }; +} diff --git a/node_modules/@11ty/eleventy/tsconfig.json b/node_modules/@11ty/eleventy/tsconfig.json new file mode 100644 index 00000000..a01ba080 --- /dev/null +++ b/node_modules/@11ty/eleventy/tsconfig.json @@ -0,0 +1,117 @@ +{ + "include": [ + // "src/Eleventy.js", + "src/UserConfig.js", + "src/Util/ConsoleLogger.js", + ], + "exclude": [], + + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "lib": ["ES2021"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "Node16", /* Specify what module code is generated. */ + // "rootDir": "./src/", /* Specify the root folder within your source files. */ + "moduleResolution": "Node16", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "types": ["node"], /* Specify type package names to be included without being referenced in a source file. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + // WARNING: this causes missing `node` types even with "types": ["node"] + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 0, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./types/", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./types/", /* Specify the output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + // "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/node_modules/@11ty/lodash-custom/README.md b/node_modules/@11ty/lodash-custom/README.md new file mode 100644 index 00000000..e45d1a9b --- /dev/null +++ b/node_modules/@11ty/lodash-custom/README.md @@ -0,0 +1,14 @@ +# @11ty/lodash-custom + +Eleventy uses 3 small `lodash` functions: + +* [`get`](https://lodash.com/docs/4#get) +* [`set`](https://lodash.com/docs/4#set) +* [`chunk`](https://lodash.com/docs/4#chunk) + +## Why? + +1. The top level `lodash` package includes all of `lodash` and is a hefty 5 MB. +1. Using the individual, modularized `lodash.get`, `lodash.set`, `lodash.chunk` packages are a much smaller 106 KB but do contain duplicated code. More problematically, these are not being maintained/updated with the newest versions of `lodash`. + +This package creates one focused custom dependency using the tools that `lodash` provides to do custom builds ([`lodash-cli`](https://lodash.com/custom-builds)) for these three `lodash` functions with updated versions of `lodash`. \ No newline at end of file diff --git a/node_modules/@11ty/lodash-custom/lodash.custom.js b/node_modules/@11ty/lodash-custom/lodash.custom.js new file mode 100644 index 00000000..037cfef9 --- /dev/null +++ b/node_modules/@11ty/lodash-custom/lodash.custom.js @@ -0,0 +1,1704 @@ +/** + * @license + * Lodash (Custom Build) + * Build: `lodash exports="node" include="get,set,chunk"` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ +;(function() { + + /** Used as a safe reference for `undefined` in pre-ES5 environments. */ + var undefined; + + /** Used as the semantic version number. */ + var VERSION = '4.17.21'; + + /** Error message constants. */ + var FUNC_ERROR_TEXT = 'Expected a function'; + + /** Used to stand-in for `undefined` hash values. */ + var HASH_UNDEFINED = '__lodash_hash_undefined__'; + + /** Used as the maximum memoize cache size. */ + var MAX_MEMOIZE_SIZE = 500; + + /** Used as references for various `Number` constants. */ + var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + + /** `Object#toString` result references. */ + var asyncTag = '[object AsyncFunction]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + nullTag = '[object Null]', + proxyTag = '[object Proxy]', + symbolTag = '[object Symbol]', + undefinedTag = '[object Undefined]'; + + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + + /** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ + var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + + /** Used to match leading whitespace. */ + var reTrimStart = /^\s+/; + + /** Used to match a single whitespace character. */ + var reWhitespace = /\s/; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** Used to detect bad signed hexadecimal string values. */ + var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + + /** Used to detect binary string values. */ + var reIsBinary = /^0b[01]+$/i; + + /** Used to detect host constructors (Safari). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used to detect octal string values. */ + var reIsOctal = /^0o[0-7]+$/i; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^(?:0|[1-9]\d*)$/; + + /** Built-in method references without a dependency on `root`. */ + var freeParseInt = parseInt; + + /** Detect free variable `global` from Node.js. */ + var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + + /** Detect free variable `self`. */ + var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || Function('return this')(); + + /** Detect free variable `exports`. */ + var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; + + /** Detect free variable `module`. */ + var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; + + /*--------------------------------------------------------------------------*/ + + /** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ + function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; + } + + /** + * The base implementation of `_.trim`. + * + * @private + * @param {string} string The string to trim. + * @returns {string} Returns the trimmed string. + */ + function baseTrim(string) { + return string + ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') + : string; + } + + /** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function getValue(object, key) { + return object == null ? undefined : object[key]; + } + + /** + * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace + * character of `string`. + * + * @private + * @param {string} string The string to inspect. + * @returns {number} Returns the index of the last non-whitespace character. + */ + function trimmedEndIndex(string) { + var index = string.length; + + while (index-- && reWhitespace.test(string.charAt(index))) {} + return index; + } + + /*--------------------------------------------------------------------------*/ + + /** Used for built-in method references. */ + var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + + /** Used to detect overreaching core-js shims. */ + var coreJsData = root['__core-js_shared__']; + + /** Used to resolve the decompiled source of functions. */ + var funcToString = funcProto.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to detect methods masquerading as native. */ + var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; + }()); + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto.toString; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** Built-in value references. */ + var Symbol = root.Symbol, + splice = arrayProto.splice, + symToStringTag = Symbol ? Symbol.toStringTag : undefined; + + var defineProperty = (function() { + try { + var func = getNative(Object, 'defineProperty'); + func({}, '', {}); + return func; + } catch (e) {} + }()); + + /* Built-in method references for those with the same name as other `lodash` methods. */ + var nativeCeil = Math.ceil, + nativeMax = Math.max; + + /* Built-in method references that are verified to be native. */ + var Map = getNative(root, 'Map'), + nativeCreate = getNative(Object, 'create'); + + /** Used to lookup unminified function names. */ + var realNames = {}; + + /** Used to convert symbols to primitives and strings. */ + var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` object which wraps `value` to enable implicit method + * chain sequences. Methods that operate on and return arrays, collections, + * and functions can be chained together. Methods that retrieve a single value + * or may return a primitive value will automatically end the chain sequence + * and return the unwrapped value. Otherwise, the value must be unwrapped + * with `_#value`. + * + * Explicit chain sequences, which must be unwrapped with `_#value`, may be + * enabled using `_.chain`. + * + * The execution of chained methods is lazy, that is, it's deferred until + * `_#value` is implicitly or explicitly called. + * + * Lazy evaluation allows several methods to support shortcut fusion. + * Shortcut fusion is an optimization to merge iteratee calls; this avoids + * the creation of intermediate arrays and can greatly reduce the number of + * iteratee executions. Sections of a chain sequence qualify for shortcut + * fusion if the section is applied to an array and iteratees accept only + * one argument. The heuristic for whether a section qualifies for shortcut + * fusion is subject to change. + * + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. + * + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, + * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, + * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, + * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, + * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, + * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, + * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, + * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, + * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, + * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, + * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, + * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, + * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, + * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, + * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, + * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, + * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, + * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, + * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, + * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, + * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, + * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, + * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, + * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, + * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, + * `zipObject`, `zipObjectDeep`, and `zipWith` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, + * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, + * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, + * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, + * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, + * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, + * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, + * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, + * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, + * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, + * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, + * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, + * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, + * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, + * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, + * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, + * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, + * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, + * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, + * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, + * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, + * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, + * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, + * `upperFirst`, `value`, and `words` + * + * @name _ + * @constructor + * @category Seq + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var wrapped = _([1, 2, 3]); + * + * // Returns an unwrapped value. + * wrapped.reduce(_.add); + * // => 6 + * + * // Returns a wrapped value. + * var squares = wrapped.map(square); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ + function lodash() { + // No operation performed. + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ + function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; + } + + /** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + + /** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; + } + + /** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function hashHas(key) { + var data = this.__data__; + return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); + } + + /** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ + function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; + } + + // Add methods to `Hash`. + Hash.prototype.clear = hashClear; + Hash.prototype['delete'] = hashDelete; + Hash.prototype.get = hashGet; + Hash.prototype.has = hashHas; + Hash.prototype.set = hashSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ + function listCacheClear() { + this.__data__ = []; + this.size = 0; + } + + /** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; + } + + /** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; + } + + /** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; + } + + /** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ + function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; + } + + // Add methods to `ListCache`. + ListCache.prototype.clear = listCacheClear; + ListCache.prototype['delete'] = listCacheDelete; + ListCache.prototype.get = listCacheGet; + ListCache.prototype.has = listCacheHas; + ListCache.prototype.set = listCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ + function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } + } + + /** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ + function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; + } + + /** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ + function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; + } + + /** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ + function mapCacheGet(key) { + return getMapData(this, key).get(key); + } + + /** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ + function mapCacheHas(key) { + return getMapData(this, key).has(key); + } + + /** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ + function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; + } + + // Add methods to `MapCache`. + MapCache.prototype.clear = mapCacheClear; + MapCache.prototype['delete'] = mapCacheDelete; + MapCache.prototype.get = mapCacheGet; + MapCache.prototype.has = mapCacheHas; + MapCache.prototype.set = mapCacheSet; + + /*------------------------------------------------------------------------*/ + + /** + * Assigns `value` to `key` of `object` if the existing value is not equivalent + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function assignValue(object, key, value) { + var objValue = object[key]; + if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || + (value === undefined && !(key in object))) { + baseAssignValue(object, key, value); + } + } + + /** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ + function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; + } + + /** + * The base implementation of `assignValue` and `assignMergeValue` without + * value checks. + * + * @private + * @param {Object} object The object to modify. + * @param {string} key The key of the property to assign. + * @param {*} value The value to assign. + */ + function baseAssignValue(object, key, value) { + if (key == '__proto__' && defineProperty) { + defineProperty(object, key, { + 'configurable': true, + 'enumerable': true, + 'value': value, + 'writable': true + }); + } else { + object[key] = value; + } + } + + /** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path) { + path = castPath(path, object); + + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[toKey(path[index++])]; + } + return (index && index == length) ? object : undefined; + } + + /** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ + function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); + } + + /** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ + function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); + } + + /** + * The base implementation of `_.set`. + * + * @private + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @param {Function} [customizer] The function to customize path creation. + * @returns {Object} Returns `object`. + */ + function baseSet(object, path, value, customizer) { + if (!isObject(object)) { + return object; + } + path = castPath(path, object); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = toKey(path[index]), + newValue = value; + + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return object; + } + + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined; + if (newValue === undefined) { + newValue = isObject(objValue) + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); + } + } + assignValue(nested, key, newValue); + nested = nested[key]; + } + return object; + } + + /** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ + function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; + } + + /** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @param {Object} [object] The object to query keys on. + * @returns {Array} Returns the cast property path array. + */ + function castPath(value, object) { + if (isArray(value)) { + return value; + } + return isKey(value, object) ? [value] : stringToPath(toString(value)); + } + + /** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ + function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; + } + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; + } + + /** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ + function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; + } + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); + } + + /** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; + } + + /** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); + } + + /** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ + function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); + } + + /** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ + function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); + } + + /** + * A specialized version of `_.memoize` which clears the memoized function's + * cache when it exceeds `MAX_MEMOIZE_SIZE`. + * + * @private + * @param {Function} func The function to have its output memoized. + * @returns {Function} Returns the new memoized function. + */ + function memoizeCapped(func) { + var result = memoize(func, function(key) { + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); + } + return key; + }); + + var cache = result.cache; + return result; + } + + /** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ + function objectToString(value) { + return nativeObjectToString.call(value); + } + + /** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ + var stringToPath = memoizeCapped(function(string) { + var result = []; + if (string.charCodeAt(0) === 46 /* . */) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; + }); + + /** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ + function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; + } + + /** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates an array of elements split into groups the length of `size`. + * If `array` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the new array of chunks. + * @example + * + * _.chunk(['a', 'b', 'c', 'd'], 2); + * // => [['a', 'b'], ['c', 'd']] + * + * _.chunk(['a', 'b', 'c', 'd'], 3); + * // => [['a', 'b', 'c'], ['d']] + */ + function chunk(array, size, guard) { + if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { + size = 1; + } else { + size = nativeMax(toInteger(size), 0); + } + var length = array == null ? 0 : array.length; + if (!length || size < 1) { + return []; + } + var index = 0, + resIndex = 0, + result = Array(nativeCeil(length / size)); + + while (index < length) { + result[resIndex++] = baseSlice(array, index, (index += size)); + } + return result; + } + + /*------------------------------------------------------------------------*/ + + /** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `clear`, `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ + function memoize(func, resolver) { + if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result) || cache; + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; + } + + // Expose `MapCache`. + memoize.Cache = MapCache; + + /*------------------------------------------------------------------------*/ + + /** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ + function eq(value, other) { + return value === other || (value !== value && other !== other); + } + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ + var isArray = Array.isArray; + + /** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ + function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); + } + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ + function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ + function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); + } + + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + function isObjectLike(value) { + return value != null && typeof value == 'object'; + } + + /** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ + function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); + } + + /** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ + function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; + } + + /** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ + function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; + } + + /** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ + function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = baseTrim(value); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); + } + + /** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ + function toString(value) { + return value == null ? '' : baseToString(value); + } + + /*------------------------------------------------------------------------*/ + + /** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; + } + + /** + * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, + * it's created. Arrays are created for missing index properties while objects + * are created for all other missing properties. Use `_.setWith` to customize + * `path` creation. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to modify. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.set(object, 'a[0].b.c', 4); + * console.log(object.a[0].b.c); + * // => 4 + * + * _.set(object, ['x', '0', 'y', 'z'], 5); + * console.log(object.x[0].y.z); + * // => 5 + */ + function set(object, path, value) { + return object == null ? object : baseSet(object, path, value); + } + + /*------------------------------------------------------------------------*/ + + // Add methods that return wrapped values in chain sequences. + lodash.chunk = chunk; + lodash.memoize = memoize; + lodash.set = set; + + /*------------------------------------------------------------------------*/ + + // Add methods that return unwrapped values in chain sequences. + lodash.eq = eq; + lodash.get = get; + lodash.isArray = isArray; + lodash.isArrayLike = isArrayLike; + lodash.isFunction = isFunction; + lodash.isLength = isLength; + lodash.isObject = isObject; + lodash.isObjectLike = isObjectLike; + lodash.isSymbol = isSymbol; + lodash.toFinite = toFinite; + lodash.toInteger = toInteger; + lodash.toNumber = toNumber; + lodash.toString = toString; + + /*------------------------------------------------------------------------*/ + + /** + * The semantic version number. + * + * @static + * @memberOf _ + * @type {string} + */ + lodash.VERSION = VERSION; + + /*--------------------------------------------------------------------------*/ + + if (freeModule) { + // Export for Node.js. + (freeModule.exports = lodash)._ = lodash; + // Export for CommonJS support. + freeExports._ = lodash; + } +}.call(this)); diff --git a/node_modules/@11ty/lodash-custom/package.json b/node_modules/@11ty/lodash-custom/package.json new file mode 100644 index 00000000..99d2eedc --- /dev/null +++ b/node_modules/@11ty/lodash-custom/package.json @@ -0,0 +1,38 @@ +{ + "name": "@11ty/lodash-custom", + "version": "4.17.21", + "description": "A custom, focused build of lodash exclusively for use internally in Eleventy.", + "main": "lodash.custom.js", + "scripts": { + "build": "npx lodash exports=node include=get,set,chunk && rm lodash.custom.min.js" + }, + "publishConfig": { + "access": "public" + }, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/11ty" + }, + "author": { + "name": "Zach Leatherman", + "email": "zachleatherman@gmail.com", + "url": "https://zachleat.com/" + }, + "repository": { + "type": "git", + "url": "git://github.com/11ty/lodash-custom.git" + }, + "bugs": "https://github.com/11ty/lodash-custom/issues", + "homepage": "https://github.com/11ty/lodash-custom/", + "devDependencies": { + "ava": "^5.2.0", + "lodash-cli": "^4.17.5" + }, + "overrides": { + "lodash": "4.17.21" + } +} diff --git a/node_modules/@11ty/posthtml-urls/LICENSE b/node_modules/@11ty/posthtml-urls/LICENSE new file mode 100644 index 00000000..16736bdf --- /dev/null +++ b/node_modules/@11ty/posthtml-urls/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Steven Vachon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@11ty/posthtml-urls/README.md b/node_modules/@11ty/posthtml-urls/README.md new file mode 100644 index 00000000..3b915fbb --- /dev/null +++ b/node_modules/@11ty/posthtml-urls/README.md @@ -0,0 +1,48 @@ +# `@11ty/posthtml-urls` + +PostHTML plugin for transforming URLs. This is a fork of [`posthtml/posthtml-urls`](https://github.com/posthtml/posthtml-urls). + + +## Installation + +[Node.js](http://nodejs.org) `>= 6` is required. To install, type this at the command line: + +```shell +npm install @11ty/posthtml-urls +``` + + +## Usage + +```js +const posthtml = require('posthtml'); +const urls = require('@11ty/posthtml-urls'); + +const options = { + eachURL: (url, attr, tagName, rawNode) => `http://domain.com/${url}` +}; + +posthtml() + .use( urls(options) ) + .process('link') + .then(result => console.log(result.html)); +//-> link +``` + + +## Options + +### `eachURL` +Type: `Function` +Default value: `undefined` +A callback function ran for each URL value found. You can return either a synchronous value or a `Promise`. The `rawNode` argument was added in `v1.0.3`. + +### `filter` +Type: `Object` +Default value: [`{…}`](https://github.com/posthtml/posthtml-urls/blob/master/lib/defaultOptions.js) +The elements and attributes for which to search. An attribute value can optionally be a function, for deeper filtering. + + +## FAQ +1. **How can I filter `"],["\x3c!--","--\x3e"],["<",">"]])),s="",o=0;ot?e.slice(0,t-3)+"...":e));var t},k.prototype.readWord=function(){return this.readIdentifier()},k.prototype.readIdentifier=function(){this.skipBlank();for(var e=this.p;!this.end()&&Ee(this.peek());)++this.p;return new Mt(this.input,e,this.p,this.file)},k.prototype.readNonEmptyIdentifier=function(){var e=this.readIdentifier();return e.size()?e:void 0},k.prototype.readTagName=function(){return this.skipBlank(),"#"===this.input[this.p]?this.input.slice(this.p,++this.p):this.readIdentifier().getText()},k.prototype.readHashes=function(e){for(var t=[];;){var r=this.readHash(e);if(!r)return t;t.push(r)}},k.prototype.readHash=function(e){this.skipBlank(),","===this.peek()&&++this.p;var t,r=this.p,n=this.readNonEmptyIdentifier();if(n)return this.skipBlank(),e=te(e)?e:e?"=":":",this.peek()===e&&(++this.p,t=this.readValue()),new Gt(this.input,r,this.p,n,t,this.file)},k.prototype.remaining=function(){return this.input.slice(this.p,this.N)},k.prototype.advance=function(e){this.p+=e=void 0===e?1:e},k.prototype.end=function(){return this.p>=this.N},k.prototype.read=function(){return this.input[this.p++]},k.prototype.readTo=function(e){for(;this.p=this.N?0:p[this.input.charCodeAt(this.p+e)]},k.prototype.peek=function(e){return this.p+(e=void 0===e?0:e)>=this.N?"":this.input[this.p+e]},k.prototype.skipBlank=function(){for(;this.peekType()&Ae;)++this.p};var w=k;function k(e,t,r,n){void 0===t&&(t=Pr.operators),this.input=e,this.file=r,this.rawBeginAt=-1,this.p=n?n[0]:0,this.N=n?n[1]:e.length,this.opTrie=et(t),this.literalTrie=et(Ge)}Ur.prototype.on=function(e,t){return this.handlers[e]=t,this},Ur.prototype.trigger=function(e,t){e=this.handlers[e];return!!e&&(e.call(this,t),!0)},Ur.prototype.start=function(){var e,t;for(this.trigger("start");!this.stopRequested&&(e=this.tokens.shift());)this.trigger("token",e)||_n(e)&&this.trigger("tag:".concat(e.name),e)||(t=this.parseToken(e,this.tokens),this.trigger("template",t));return this.stopRequested||this.trigger("end"),this},Ur.prototype.stop=function(){return this.stopRequested=!0,this};var Hr=Ur;function Ur(e,t){this.handlers={},this.stopRequested=!1,this.tokens=e,this.parseToken=t}function Kr(e){this.token=e}s(Yr,Wr=Kr);var Wr,L=Yr;function Yr(e,t,r){var n=Wr.call(this,e)||this;return n.name=e.name,n.liquid=r,n.tokenizer=e.tokenizer,n}Jr.prototype.render=function(t){var r,n,i,s,o,a,u,c,l;return G(this,function(e){switch(e.label){case 0:r={},e.label=1;case 1:e.trys.push([1,8,9,10]),n=X(Object.keys(this.hash)),i=n.next(),e.label=2;case 2:return i.done?[3,7]:(s=i.value,o=r,a=s,void 0!==this.hash[s]?[3,3]:(u=!0,[3,5]));case 3:return[4,S(this.hash[s],t)];case 4:u=e.sent(),e.label=5;case 5:o[a]=u,e.label=6;case 6:return i=n.next(),[3,2];case 7:return[3,10];case 8:return c=e.sent(),c={error:c},[3,10];case 9:try{i&&!i.done&&(l=n.return)&&l.call(n)}finally{if(c)throw c.error}return[7];case 10:return[2,r]}})};var Zr=Jr;function Jr(e,t){this.hash={};var r,n,e=e instanceof w?e:new w(e,{});try{for(var i=X(e.readHashes(t)),s=i.next();!s.done;s=i.next()){var o=s.value;this.hash[o.name.content]=o.value}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}function Qr(e){return c(e)}Gr.prototype.render=function(t,r){var n,i,s,o,a,u,c,l,h,p,f;return G(this,function(e){switch(e.label){case 0:n=[],e.label=1;case 1:e.trys.push([1,8,9,10]),i=X(this.args),s=i.next(),e.label=2;case 2:return s.done?[3,7]:Qr(o=s.value)?(u=(a=n).push,c=[o[0]],[4,S(o[1],r)]):[3,4];case 3:return u.apply(a,[c.concat([e.sent()])]),[3,6];case 4:return h=(l=n).push,[4,S(o,r)];case 5:h.apply(l,[e.sent()]),e.label=6;case 6:return s=i.next(),[3,2];case 7:return[3,10];case 8:return p=e.sent(),p={error:p},[3,10];case 9:try{s&&!s.done&&(f=i.return)&&f.call(i)}finally{if(p)throw p.error}return[7];case 10:return[4,this.handler.apply({context:r,token:this.token,liquid:this.liquid},d([t],ee(n),!1))];case 11:return[2,e.sent()]}})};var $r=Gr;function Gr(e,t,r){this.token=e,this.name=e.name,this.handler=u(t)?t:u(null==t?void 0:t.handler)?t.handler:Q,this.raw=!u(t)&&!(null==t||!t.raw),this.args=e.args,this.liquid=r}Xr.prototype.value=function(t,r){var n,i,s,o,a;return G(this,function(e){switch(e.label){case 0:return r=r||t.opts.lenientIf&&0=t&&(n+=r),n},normalize_whitespace:function(e){return e=y(e),this.context.memoryLimit.use(e.length),e.replace(/\s+/g," ")},number_of_words:function(e,t){var r=y(e);if(this.context.memoryLimit.use(r.length),!(e=r.trim()))return 0;switch(t){case"cjk":return(e.match(si)||[]).length+(e.match(oi)||[]).length;case"auto":return si.test(e)?e.match(si).length+(e.match(oi)||[]).length:e.split(/\s+/).length;default:return e.split(/\s+/).length}},array_to_sentence_string:function(e,t){for(var r=(t=y(t=void 0===t?"and":t)).length+2*e.length,n=0;n"),r.write(''))),r.write('')),[4,s.renderTemplates(this.templates,t,r)]):[3,6];case 4:e.sent(),r.write(""),e.label=5;case 5:return u++,o.next(),[3,3];case 6:return n.length&&r.write(""),t.pop(),[2]}})},Ji.prototype.children=function(){return G(this,function(e){return[2,this.templates]})},Ji.prototype.arguments=function(){var t,r,n,i,s;return G(this,function(e){switch(e.label){case 0:return[4,this.collection];case 1:e.sent(),e.label=2;case 2:e.trys.push([2,7,8,9]),t=X(Object.values(this.args.hash)),r=t.next(),e.label=3;case 3:return r.done?[3,6]:_(n=r.value)?[4,n]:[3,5];case 4:e.sent(),e.label=5;case 5:return r=t.next(),[3,3];case 6:return[3,9];case 7:return n=e.sent(),i={error:n},[3,9];case 8:try{r&&!r.done&&(s=t.return)&&s.call(t)}finally{if(i)throw i.error}return[7];case 9:return[2]}})},Ji.prototype.blockScope=function(){return[this.variable,"tablerowloop"]};var Yi,Zi=Ji;function Ji(e,t,r,n){var i,s=Yi.call(this,e,t,r)||this,o=s.tokenizer.readIdentifier(),a=(s.tokenizer.skipBlank(),s.tokenizer.readIdentifier()),u=s.tokenizer.readValue();if("in"!==a.content||!u)throw new Error("illegal tag: ".concat(e.getText()));s.variable=o.content,s.collection=u,s.args=new Zr(s.tokenizer,r.options.keyValueSeparator),s.templates=[];var c=n.parseStream(t).on("start",function(){return i=s.templates}).on("tag:endtablerow",function(){return c.stop()}).on("template",function(e){return i.push(e)}).on("end",function(){throw new Error("tag ".concat(e.getText()," not closed"))});return c.start(),s}s(Gi,Qi=L),Gi.prototype.render=function(t,r){var n,i,s,o,a,u,c,l;return G(this,function(e){switch(e.label){case 0:n=this.liquid.renderer,e.label=1;case 1:e.trys.push([1,7,8,9]),i=X(this.branches),s=i.next(),e.label=2;case 2:return s.done?[3,6]:(a=s.value,u=a.value,o=a.test,a=a.templates,[4,u.value(t,t.opts.lenientIf)]);case 3:return(u=e.sent(),o(u,t))?[4,n.renderTemplates(a,t,r)]:[3,5];case 4:return e.sent(),[2];case 5:return s=i.next(),[3,2];case 6:return[3,9];case 7:return c=e.sent(),c={error:c},[3,9];case 8:try{s&&!s.done&&(l=i.return)&&l.call(i)}finally{if(c)throw c.error}return[7];case 9:return[4,n.renderTemplates(this.elseTemplates,t,r)];case 10:return e.sent(),[2]}})},Gi.prototype.children=function(){var t;return G(this,function(e){return t=this.branches.flatMap(function(e){return e.templates}),this.elseTemplates&&t.push.apply(t,d([],ee(this.elseTemplates),!1)),[2,t]})},Gi.prototype.arguments=function(){return this.branches.map(function(e){return e.value})};var Qi,$i=Gi;function Gi(e,t,r,n){var i=Qi.call(this,e,t,r)||this,s=(i.branches=[],i.elseTemplates=[],[]),o=0;return n.parseStream(t).on("start",function(){return i.branches.push({value:new O(e.tokenizer.readFilteredValue(),i.liquid),test:Sr,templates:s=[]})}).on("tag:elsif",function(e){0 | any {\n return undefined\n }\n}\n","import { Drop } from '../drop/drop'\n\nexport const toString = Object.prototype.toString\nconst toLowerCase = String.prototype.toLowerCase\n\nexport const hasOwnProperty = Object.hasOwnProperty\n\nexport function isString (value: any): value is string {\n return typeof value === 'string'\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isFunction (value: any): value is Function {\n return typeof value === 'function'\n}\n\nexport function isPromise (val: any): val is Promise {\n return val && isFunction(val.then)\n}\n\nexport function isIterator (val: any): val is IterableIterator {\n return val && isFunction(val.next) && isFunction(val.throw) && isFunction(val.return)\n}\n\nexport function promisify (fn: (arg1: T1, cb: (err: Error | null, result: T2) => void) => void): (arg1: T1) => Promise;\nexport function promisify (fn: (arg1: T1, arg2: T2, cb: (err: Error | null, result: T3) => void) => void): (arg1: T1, arg2: T2) => Promise;\nexport function promisify (fn: any) {\n return function (...args: any[]) {\n return new Promise((resolve, reject) => {\n fn(...args, (err: Error, result: any) => {\n err ? reject(err) : resolve(result)\n })\n })\n }\n}\n\nexport function stringify (value: any): string {\n value = toValue(value)\n if (isString(value)) return value\n if (isNil(value)) return ''\n if (isArray(value)) return value.map(x => stringify(x)).join('')\n return String(value)\n}\n\nexport function readArrayElement (arr: any[], index: number, ownPropertyOnly: boolean) {\n if (index < 0) index = arr.length + index\n if (ownPropertyOnly && !hasOwnProperty.call(arr, index)) return undefined\n return arr[index]\n}\n\nexport function toEnumerable (val: any): T[] {\n val = toValue(val)\n if (isArray(val)) return val\n if (isString(val) && val.length > 0) return [val] as unknown as T[]\n if (isIterable(val)) return Array.from(val)\n if (isObject(val)) return Object.keys(val).map((key) => [key, val[key]]) as unknown as T[]\n return []\n}\n\nexport function toArray (val: any) {\n val = toValue(val)\n if (isNil(val)) return []\n if (isArray(val)) return val\n return [ val ]\n}\n\nexport function toValue (value: any): any {\n return (value instanceof Drop && isFunction(value.valueOf)) ? value.valueOf() : value\n}\n\nexport function toNumber (value: any): number {\n return +toValue(value) || 0\n}\n\nexport function isNumber (value: any): value is number {\n return typeof value === 'number'\n}\n\nexport function toLiquid (value: any): any {\n if (value && isFunction(value.toLiquid)) return toLiquid(value.toLiquid())\n return value\n}\n\nexport function isNil (value: any): boolean {\n return value == null\n}\n\nexport function isUndefined (value: any): boolean {\n return value === undefined\n}\n\nexport function isArray (value: any): value is any[] {\n // be compatible with IE 8\n return toString.call(value) === '[object Array]'\n}\n\nexport function isArrayLike (value: any): value is any[] {\n return value && isNumber(value.length)\n}\n\nexport function isIterable (value: any): value is Iterable {\n return isObject(value) && Symbol.iterator in value\n}\n\n/*\n * Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property.\n * The iteratee is invoked with three arguments: (value, key, object).\n * Iteratee functions may exit iteration early by explicitly returning false.\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @return {Object} Returns object.\n */\nexport function forOwn (\n obj: Record | undefined,\n iteratee: ((val: T, key: string, obj: {[key: string]: T}) => boolean | void)\n) {\n obj = obj || {}\n for (const k in obj) {\n if (hasOwnProperty.call(obj, k)) {\n if (iteratee(obj[k], k, obj) === false) break\n }\n }\n return obj\n}\n\nexport function last (arr: T[]): T;\nexport function last (arr: string): string;\nexport function last (arr: any[] | string): any | string {\n return arr[arr.length - 1]\n}\n\n/*\n * Checks if value is the language type of Object.\n * (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))\n * @param {any} value The value to check.\n * @return {Boolean} Returns true if value is an object, else false.\n */\nexport function isObject (value: any): value is object {\n const type = typeof value\n return value !== null && (type === 'object' || type === 'function')\n}\n\nexport function range (start: number, stop: number, step = 1) {\n const arr: number[] = []\n for (let i = start; i < stop; i += step) {\n arr.push(i)\n }\n return arr\n}\n\nexport function padStart (str: any, length: number, ch = ' ') {\n return pad(str, length, ch, (str, ch) => ch + str)\n}\n\nexport function padEnd (str: any, length: number, ch = ' ') {\n return pad(str, length, ch, (str, ch) => str + ch)\n}\n\nexport function pad (str: any, length: number, ch: string, add: (str: string, ch: string) => string) {\n str = String(str)\n const n = length - str.length\n if (n <= 0) return str\n return add(str, ch.repeat(n))\n}\n\nexport function identify (val: T): T {\n return val\n}\n\nexport function changeCase (str: string): string {\n const hasLowerCase = [...str].some(ch => ch >= 'a' && ch <= 'z')\n return hasLowerCase ? str.toUpperCase() : str.toLowerCase()\n}\n\nexport function ellipsis (str: string, N: number): string {\n return str.length > N ? str.slice(0, N - 3) + '...' : str\n}\n\nexport function orderedCompare (a: any, b: any) {\n if (isNil(a) && isNil(b)) return 0\n if (isNil(a)) return 1\n if (isNil(b)) return -1\n if (a < b) return -1\n if (a > b) return 1\n return 0\n}\n\n// compare string in case-insensitive way, undefined values to the tail\nexport function caseInsensitiveCompare (a: any, b: any) {\n if (isNil(a) && isNil(b)) return 0\n if (isNil(a)) return 1\n if (isNil(b)) return -1\n a = toLowerCase.call(a)\n b = toLowerCase.call(b)\n if (a < b) return -1\n if (a > b) return 1\n return 0\n}\n\nexport function argumentsToValue any, T> (fn: F) {\n return function (this: T, ...args: Parameters) { return fn.call(this, ...args.map(toValue)) }\n}\n\nexport function argumentsToNumber any, T> (fn: F) {\n return function (this: T, ...args: Parameters) { return fn.call(this, ...args.map(toNumber)) }\n}\n\nexport function escapeRegExp (text: string) {\n return text.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n}\n\n/** Return an array containing unique elements from _array_. Works with nested arrays and objects. */\nexport function * strictUniq (array: Array): Generator {\n const seen = new Set()\n\n for (const element of array) {\n const key = JSON.stringify(element)\n if (!seen.has(key)) {\n seen.add(key)\n yield element\n }\n }\n}\n","import * as _ from './underscore'\nimport { Token } from '../tokens/token'\nimport { Template } from '../template/template'\n\n/**\n * targeting ES5, extends Error won't create a proper prototype chain, need a trait to keep track of classes\n */\nconst TRAIT = '__liquidClass__'\n\nexport abstract class LiquidError extends Error {\n public token!: Token\n public context = ''\n public originalError?: Error\n public constructor (err: Error | string, token: Token) {\n /**\n * note: for ES5 targeting, `this` will be replaced by return value of Error(),\n * thus everything on `this` will be lost, avoid calling `LiquidError` methods here\n */\n super(typeof err === 'string' ? err : err.message)\n if (typeof err !== 'string') Object.defineProperty(this, 'originalError', { value: err, enumerable: false })\n Object.defineProperty(this, 'token', { value: token, enumerable: false })\n Object.defineProperty(this, TRAIT, { value: 'LiquidError', enumerable: false })\n }\n protected update () {\n Object.defineProperty(this, 'context', { value: mkContext(this.token), enumerable: false })\n this.message = mkMessage(this.message, this.token)\n this.stack = this.message + '\\n' + this.context +\n '\\n' + this.stack\n if (this.originalError) this.stack += '\\nFrom ' + this.originalError.stack\n }\n static is (obj: unknown): obj is LiquidError {\n return (obj as Record | null | undefined)?.[TRAIT] === 'LiquidError'\n }\n}\n\nexport class TokenizationError extends LiquidError {\n public constructor (message: string, token: Token) {\n super(message, token)\n this.name = 'TokenizationError'\n super.update()\n }\n}\n\nexport class ParseError extends LiquidError {\n public constructor (err: Error, token: Token) {\n super(err, token)\n this.name = 'ParseError'\n this.message = err.message\n super.update()\n }\n}\n\nexport class RenderError extends LiquidError {\n public constructor (err: Error, tpl: Template) {\n super(err, tpl.token)\n this.name = 'RenderError'\n this.message = err.message\n super.update()\n }\n public static is (obj: any): obj is RenderError {\n return obj.name === 'RenderError'\n }\n}\n\nexport class LiquidErrors extends LiquidError {\n public constructor (public errors: RenderError[]) {\n super(errors[0], errors[0].token)\n this.name = 'LiquidErrors'\n const s = errors.length > 1 ? 's' : ''\n this.message = `${errors.length} error${s} found`\n super.update()\n }\n public static is (obj: any): obj is LiquidErrors {\n return obj.name === 'LiquidErrors'\n }\n}\n\nexport class UndefinedVariableError extends LiquidError {\n public constructor (err: Error, token: Token) {\n super(err, token)\n this.name = 'UndefinedVariableError'\n this.message = err.message\n super.update()\n }\n}\n\n// only used internally; raised where we don't have token information,\n// so it can't be an UndefinedVariableError.\nexport class InternalUndefinedVariableError extends Error {\n variableName: string\n\n public constructor (variableName: string) {\n super(`undefined variable: ${variableName}`)\n this.name = 'InternalUndefinedVariableError'\n this.variableName = variableName\n }\n}\n\nexport class AssertionError extends Error {\n public constructor (message: string) {\n super(message)\n this.name = 'AssertionError'\n this.message = message + ''\n }\n}\n\nfunction mkContext (token: Token) {\n const [line, col] = token.getPosition()\n const lines = token.input.split('\\n')\n const begin = Math.max(line - 2, 1)\n const end = Math.min(line + 3, lines.length)\n\n const context = _\n .range(begin, end + 1)\n .map(lineNumber => {\n const rowIndicator = (lineNumber === line) ? '>> ' : ' '\n const num = _.padStart(String(lineNumber), String(end).length)\n let text = `${rowIndicator}${num}| `\n\n const colIndicator = lineNumber === line\n ? '\\n' + _.padStart('^', col + text.length)\n : ''\n\n text += lines[lineNumber - 1]\n text += colIndicator\n return text\n })\n .join('\\n')\n\n return context\n}\n\nfunction mkMessage (msg: string, token: Token) {\n if (token.file) msg += `, file:${token.file}`\n const [line, col] = token.getPosition()\n msg += `, line:${line}, col:${col}`\n return msg\n}\n","// **DO NOT CHANGE THIS FILE**\n//\n// This file is generated by bin/character-gen.js\n// bitmask character types to boost performance\nexport const TYPES = [0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 4, 4, 4, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 8, 0, 0, 0, 0, 8, 0, 0, 0, 64, 0, 65, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 0, 0, 2, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]\nexport const WORD = 1\nexport const OPERATOR = 2\nexport const BLANK = 4\nexport const QUOTE = 8\nexport const INLINE_BLANK = 16\nexport const NUMBER = 32\nexport const SIGN = 64\nexport const PUNCTUATION = 128\n\nexport function isWord (char: string): boolean {\n const code = char.charCodeAt(0)\n return code >= 128 ? !TYPES[code] : !!(TYPES[code] & WORD)\n}\nTYPES[160] = TYPES[5760] = TYPES[6158] = TYPES[8192] = TYPES[8193] = TYPES[8194] = TYPES[8195] = TYPES[8196] = TYPES[8197] = TYPES[8198] = TYPES[8199] = TYPES[8200] = TYPES[8201] = TYPES[8202] = TYPES[8232] = TYPES[8233] = TYPES[8239] = TYPES[8287] = TYPES[12288] = BLANK\nTYPES[8220] = TYPES[8221] = PUNCTUATION\n","import { AssertionError } from './error'\n\nexport function assert (predicate: T | null | undefined, message?: string | (() => string)) {\n if (!predicate) {\n const msg = typeof message === 'function'\n ? message()\n : (message || `expect ${predicate} to be true`)\n throw new AssertionError(msg)\n }\n}\n\nexport function assertEmpty (predicate: T | null | undefined, message = `unexpected ${JSON.stringify(predicate)}`) {\n assert(!predicate, message)\n}\n","import { Drop } from './drop'\nimport { Comparable } from './comparable'\nimport { isNil, toValue } from '../util'\n\nexport class NullDrop extends Drop implements Comparable {\n public equals (value: any) {\n return isNil(toValue(value))\n }\n public gt () {\n return false\n }\n public geq () {\n return false\n }\n public lt () {\n return false\n }\n public leq () {\n return false\n }\n public valueOf () {\n return null\n }\n}\n","import { Drop } from './drop'\nimport { Comparable } from './comparable'\nimport { isObject, isString, isArray, toValue } from '../util'\n\nexport class EmptyDrop extends Drop implements Comparable {\n public equals (value: any) {\n if (value instanceof EmptyDrop) return false\n value = toValue(value)\n if (isString(value) || isArray(value)) return value.length === 0\n if (isObject(value)) return Object.keys(value).length === 0\n return false\n }\n public gt () {\n return false\n }\n public geq () {\n return false\n }\n public lt () {\n return false\n }\n public leq () {\n return false\n }\n public valueOf () {\n return ''\n }\n static is (value: unknown) {\n return value instanceof EmptyDrop\n }\n}\n","import { isNil, isString, toValue } from '../util'\nimport { EmptyDrop } from '../drop'\n\nexport class BlankDrop extends EmptyDrop {\n public equals (value: any) {\n if (value === false) return true\n if (isNil(toValue(value))) return true\n if (isString(value)) return /^\\s*$/.test(value)\n return super.equals(value)\n }\n static is (value: unknown) {\n return value instanceof BlankDrop\n }\n}\n","import { Drop } from './drop'\n\nexport class ForloopDrop extends Drop {\n protected i = 0\n public name: string\n public length: number\n public constructor (length: number, collection: string, variable: string) {\n super()\n this.length = length\n this.name = `${variable}-${collection}`\n }\n public next () {\n this.i++\n }\n public index0 () {\n return this.i\n }\n public index () {\n return this.i + 1\n }\n public first () {\n return this.i === 0\n }\n public last () {\n return this.i === this.length - 1\n }\n public rindex () {\n return this.length - this.i\n }\n public rindex0 () {\n return this.length - this.i - 1\n }\n public valueOf () {\n return JSON.stringify(this)\n }\n}\n","import { stringify } from '../util'\nimport { Emitter } from './emitter'\n\nexport class SimpleEmitter implements Emitter {\n public buffer = '';\n\n public write (html: any) {\n this.buffer += stringify(html)\n }\n}\n","import { Emitter } from '../emitters'\n\nexport class StreamedEmitter implements Emitter {\n public buffer = '';\n public stream: NodeJS.ReadableStream = null as any\n constructor () {\n throw new Error('streaming not supported in browser')\n }\n public write: (html: any) => void\n public error: (err: Error) => void\n public end: () => void\n}\n","import { stringify, toValue } from '../util'\nimport { Emitter } from './emitter'\n\nexport class KeepingTypeEmitter implements Emitter {\n public buffer: any = '';\n\n public write (html: any) {\n html = toValue(html)\n // This will only preserve the type if the value is isolated.\n // I.E:\n // {{ my-port }} -> 42\n // {{ my-host }}:{{ my-port }} -> 'host:42'\n if (typeof html !== 'string' && this.buffer === '') {\n this.buffer = html\n } else {\n this.buffer = stringify(this.buffer) + stringify(html)\n }\n }\n}\n","import { Emitter, SimpleEmitter } from '../emitters'\nimport { Drop } from './drop'\n\nexport class BlockDrop extends Drop {\n constructor (\n // the block render from layout template\n private superBlockRender: (emitter: Emitter) => IterableIterator | string = () => ''\n ) {\n super()\n }\n /**\n * Provide parent access in child block by\n * {{ block.super }}\n */\n public * super (): IterableIterator {\n const emitter = new SimpleEmitter()\n yield this.superBlockRender(emitter)\n return emitter.buffer\n }\n}\n","import { isFunction } from '../util'\n\nexport interface Comparable {\n equals: (rhs: any) => boolean;\n gt: (rhs: any) => boolean;\n geq: (rhs: any) => boolean;\n lt: (rhs: any) => boolean;\n leq: (rhs: any) => boolean;\n}\n\nexport function isComparable (arg: any): arg is Comparable {\n return (\n arg &&\n isFunction(arg.equals) &&\n isFunction(arg.gt) &&\n isFunction(arg.geq) &&\n isFunction(arg.lt) &&\n isFunction(arg.leq)\n )\n}\n","import { BlankDrop, EmptyDrop, NullDrop } from '../drop'\n\nconst nil = new NullDrop()\nexport const literalValues = {\n 'true': true,\n 'false': false,\n 'nil': nil,\n 'null': nil,\n 'empty': new EmptyDrop(),\n 'blank': new BlankDrop()\n}\n\nexport type LiteralKey = keyof typeof literalValues\nexport type LiteralValue = typeof literalValues[LiteralKey]\n","import { isWord } from '../util/character'\n\ninterface TrieInput {\n [key: string]: T\n}\n\nexport type Trie = {\n data?: T\n end?: true\n needBoundary?: true\n} & Record\n\n// Tries are built once per input object and reused: the Tokenizer rebuilds them\n// on every instantiation, but `input` (operators/literalValues) is a stable\n// reference. WeakMap-keying by `input` lets short-lived operator objects (and\n// their tries) be garbage collected. The returned trie is treated as read-only\n// by callers (matchTrie only reads it); do not mutate it.\nconst trieCache = new WeakMap, Trie>()\n\nexport function createTrie (input: TrieInput): Trie {\n const cached = trieCache.get(input)\n if (cached) return cached\n const trie: Trie = {}\n for (const [name, data] of Object.entries(input)) {\n let node = trie\n\n for (let i = 0; i < name.length; i++) {\n const c = name[i]\n node[c] = node[c] || {}\n\n if (i === name.length - 1 && isWord(name[i])) {\n node[c].needBoundary = true\n }\n\n node = node[c]\n }\n\n node.data = data\n node.end = true\n }\n trieCache.set(input, trie)\n return trie\n}\n","import { isPromise, isIterator } from './underscore'\n\nexport type LiquidAsync any> =\n (sync: boolean, ...args: Parameters) => ReturnType | Promise>\n\nexport function toLiquidAsync any> (\n asyncFn: (...args: Parameters) => Promise>,\n syncFn?: F\n): LiquidAsync {\n const syncImpl = syncFn || asyncFn as any\n return (sync: boolean, ...args: any[]) => {\n return sync ? syncImpl(...args as Parameters) : asyncFn(...args as Parameters)\n }\n}\n\n// convert an async iterator to a Promise\nexport async function toPromise (val: Generator | Promise | T): Promise {\n if (!isIterator(val)) return val\n let value: unknown\n let done = false\n let next: 'next' | 'throw' = 'next'\n do {\n const state = val[next](value)\n done = !!state.done\n value = state.value\n next = 'next'\n try {\n if (isIterator(value)) value = toPromise(value)\n if (isPromise(value)) value = await value\n } catch (err) {\n next = 'throw'\n value = err\n }\n } while (!done)\n return value as T\n}\n\n// convert an async iterator to a value in a synchronous manner\nexport function toValueSync (val: Generator | T): T {\n if (!isIterator(val)) return val\n let value: any\n let done = false\n let next: 'next' | 'throw' = 'next'\n do {\n const state = val[next](value)\n done = !!state.done\n value = state.value\n next = 'next'\n if (isIterator(value)) {\n try {\n value = toValueSync(value)\n } catch (err) {\n next = 'throw'\n value = err\n }\n }\n } while (!done)\n return value\n}\n","import { changeCase, padStart, padEnd } from './underscore'\nimport { LiquidDate } from './liquid-date'\nimport type { Limiter } from './limiter'\n\nconst rFormat = /%([-_0^#:]+)?(\\d+)?([EO])?(.)/\ninterface FormatOptions {\n flags: Record;\n width?: string;\n modifier?: string;\n memoryLimit?: Pick;\n}\n\n// prototype extensions\nfunction daysInMonth (d: LiquidDate) {\n const feb = isLeapYear(d) ? 29 : 28\n return [31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n}\nfunction getDayOfYear (d: LiquidDate) {\n let num = 0\n for (let i = 0; i < d.getMonth(); ++i) {\n num += daysInMonth(d)[i]\n }\n return num + d.getDate()\n}\nfunction getWeekOfYear (d: LiquidDate, startDay: number) {\n // Skip to startDay of this week\n const now = getDayOfYear(d) + (startDay - d.getDay())\n // Find the first startDay of the year\n const jan1 = new Date(d.getFullYear(), 0, 1)\n const then = (7 - jan1.getDay() + startDay)\n return String(Math.floor((now - then) / 7) + 1)\n}\nfunction isLeapYear (d: LiquidDate) {\n const year = d.getFullYear()\n return !!((year & 3) === 0 && (year % 100 || (year % 400 === 0 && year)))\n}\nfunction ordinal (d: LiquidDate) {\n const date = d.getDate()\n if ([11, 12, 13].includes(date)) return 'th'\n\n switch (date % 10) {\n case 1: return 'st'\n case 2: return 'nd'\n case 3: return 'rd'\n default: return 'th'\n }\n}\nfunction century (d: LiquidDate) {\n return parseInt(d.getFullYear().toString().substring(0, 2), 10)\n}\n\n// default to 0\nconst padWidths: Record = {\n d: 2,\n e: 2,\n H: 2,\n I: 2,\n j: 3,\n k: 2,\n l: 2,\n L: 3,\n m: 2,\n M: 2,\n S: 2,\n U: 2,\n W: 2\n}\n\nconst padSpaceChars = new Set('aAbBceklpP')\n\nfunction getTimezoneOffset (d: LiquidDate, opts: FormatOptions) {\n const nOffset = Math.abs(d.getTimezoneOffset())\n const h = Math.floor(nOffset / 60)\n const m = nOffset % 60\n return (d.getTimezoneOffset() > 0 ? '-' : '+') +\n padStart(h, 2, '0') +\n (opts.flags[':'] ? ':' : '') +\n padStart(m, 2, '0')\n}\ntype FormatCodeHandler = (d: LiquidDate, opts: FormatOptions) => unknown\n\nconst formatCodes: Record = {\n a: (d: LiquidDate) => d.getShortWeekdayName(),\n A: (d: LiquidDate) => d.getLongWeekdayName(),\n b: (d: LiquidDate) => d.getShortMonthName(),\n B: (d: LiquidDate) => d.getLongMonthName(),\n c: (d: LiquidDate) => d.toLocaleString(),\n C: (d: LiquidDate) => century(d),\n d: (d: LiquidDate) => d.getDate(),\n e: (d: LiquidDate) => d.getDate(),\n H: (d: LiquidDate) => d.getHours(),\n I: (d: LiquidDate) => String(d.getHours() % 12 || 12),\n j: (d: LiquidDate) => getDayOfYear(d),\n k: (d: LiquidDate) => d.getHours(),\n l: (d: LiquidDate) => String(d.getHours() % 12 || 12),\n L: (d: LiquidDate) => d.getMilliseconds(),\n m: (d: LiquidDate) => d.getMonth() + 1,\n M: (d: LiquidDate) => d.getMinutes(),\n N: (d: LiquidDate, opts: FormatOptions) => {\n const width = Number(opts.width) || 9\n const str = padStart(String(d.getMilliseconds()), 3, '0').slice(0, width)\n opts.memoryLimit?.use(width - str.length)\n return padEnd(str, width, '0')\n },\n p: (d: LiquidDate) => (d.getHours() < 12 ? 'AM' : 'PM'),\n P: (d: LiquidDate) => (d.getHours() < 12 ? 'am' : 'pm'),\n q: (d: LiquidDate) => ordinal(d),\n s: (d: LiquidDate) => Math.round(d.getTime() / 1000),\n S: (d: LiquidDate) => d.getSeconds(),\n u: (d: LiquidDate) => d.getDay() || 7,\n U: (d: LiquidDate) => getWeekOfYear(d, 0),\n w: (d: LiquidDate) => d.getDay(),\n W: (d: LiquidDate) => getWeekOfYear(d, 1),\n x: (d: LiquidDate) => d.toLocaleDateString(),\n X: (d: LiquidDate) => d.toLocaleTimeString(),\n y: (d: LiquidDate) => d.getFullYear().toString().slice(2, 4),\n Y: (d: LiquidDate) => d.getFullYear(),\n z: getTimezoneOffset,\n Z: (d: LiquidDate, opts: FormatOptions) => d.getTimeZoneName() || getTimezoneOffset(d, opts),\n 't': () => '\\t',\n 'n': () => '\\n',\n '%': () => '%'\n}\nformatCodes.h = formatCodes.b\n\nexport function strftime (d: LiquidDate, formatStr: string, memoryLimit?: Pick) {\n let output = ''\n let remaining = formatStr\n let match\n while ((match = rFormat.exec(remaining))) {\n output += remaining.slice(0, match.index)\n remaining = remaining.slice(match.index + match[0].length)\n output += format(d, match, memoryLimit)\n }\n return output + remaining\n}\n\nfunction format (d: LiquidDate, match: RegExpExecArray, memoryLimit?: Pick) {\n const [input, flagStr = '', width, modifier, conversion] = match\n const convert = formatCodes[conversion]\n if (!convert) return input\n const flags: Record = {}\n for (const flag of flagStr) flags[flag] = true\n let ret = String(convert(d, { flags, width, modifier, memoryLimit }))\n let padChar = padSpaceChars.has(conversion) ? ' ' : '0'\n let padWidth = Number(width) || padWidths[conversion] || 0\n if (flags['^']) ret = ret.toUpperCase()\n else if (flags['#']) ret = changeCase(ret)\n if (flags['_']) padChar = ' '\n else if (flags['0']) padChar = '0'\n if (flags['-']) padWidth = 0\n memoryLimit?.use(Number(padWidth) - ret.length)\n return padStart(ret, padWidth, padChar)\n}\n","export function getDateTimeFormat () {\n return (typeof Intl !== 'undefined' ? Intl.DateTimeFormat : undefined)\n}\n","import { getDateTimeFormat } from './intl'\nimport { isString } from './underscore'\n\n// one minute in milliseconds\nconst OneMinute = 60000\n/**\n * Need support both ISO8601 and RFC2822 as in major browsers & NodeJS\n * RFC2822: https://datatracker.ietf.org/doc/html/rfc2822#section-3.3\n */\nconst TIMEZONE_PATTERN = /([zZ]|([+-])(\\d{2}):?(\\d{2}))$/\nconst monthNames = [\n 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',\n 'September', 'October', 'November', 'December'\n]\nconst monthNamesShort = monthNames.map(name => name.slice(0, 3))\nconst dayNames = [\n 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'\n]\nconst dayNamesShort = dayNames.map(name => name.slice(0, 3))\n\n/**\n * A date implementation with timezone info, just like Ruby date\n *\n * Implementation:\n * - create a Date offset by it's timezone difference, avoiding overriding a bunch of methods\n * - rewrite getTimezoneOffset() to trick strftime\n */\nexport class LiquidDate {\n private timezoneOffset: number\n private timezoneName: string\n private date: Date\n private displayDate: Date\n private DateTimeFormat = getDateTimeFormat()\n public timezoneFixed: boolean\n constructor (\n init: string | number | Date,\n private locale: string,\n timezone?: number | string\n ) {\n this.date = new Date(init)\n this.timezoneFixed = timezone !== undefined\n if (timezone === undefined) {\n timezone = this.date.getTimezoneOffset()\n }\n this.timezoneOffset = isString(timezone) ? LiquidDate.getTimezoneOffset(timezone, this.date) : timezone\n this.timezoneName = isString(timezone) ? timezone : ''\n\n const diff = (this.date.getTimezoneOffset() - this.timezoneOffset) * OneMinute\n const time = this.date.getTime() + diff\n this.displayDate = new Date(time)\n }\n\n getTime () {\n return this.displayDate.getTime()\n }\n getMilliseconds () {\n return this.displayDate.getMilliseconds()\n }\n getSeconds () {\n return this.displayDate.getSeconds()\n }\n getMinutes () {\n return this.displayDate.getMinutes()\n }\n getHours () {\n return this.displayDate.getHours()\n }\n getDay () {\n return this.displayDate.getDay()\n }\n getDate () {\n return this.displayDate.getDate()\n }\n getMonth () {\n return this.displayDate.getMonth()\n }\n getFullYear () {\n return this.displayDate.getFullYear()\n }\n toLocaleString (locale?: string, init?: any) {\n if (init?.timeZone) {\n return this.date.toLocaleString(locale, init)\n }\n return this.displayDate.toLocaleString(locale, init)\n }\n toLocaleTimeString (locale?: string) {\n return this.displayDate.toLocaleTimeString(locale)\n }\n toLocaleDateString (locale?: string) {\n return this.displayDate.toLocaleDateString(locale)\n }\n getTimezoneOffset () {\n return this.timezoneOffset!\n }\n getTimeZoneName () {\n if (this.timezoneFixed) return this.timezoneName\n if (!this.DateTimeFormat) return\n return this.DateTimeFormat().resolvedOptions().timeZone\n }\n getLongMonthName () {\n return this.format({ month: 'long' }) ?? monthNames[this.getMonth()]\n }\n getShortMonthName () {\n return this.format({ month: 'short' }) ?? monthNamesShort[this.getMonth()]\n }\n getLongWeekdayName () {\n return this.format({ weekday: 'long' }) ?? dayNames[this.displayDate.getDay()]\n }\n getShortWeekdayName () {\n return this.format({ weekday: 'short' }) ?? dayNamesShort[this.displayDate.getDay()]\n }\n valid () {\n return !isNaN(this.getTime())\n }\n private format (options: Intl.DateTimeFormatOptions) {\n return this.DateTimeFormat && this.DateTimeFormat(this.locale, options).format(this.displayDate)\n }\n\n /**\n * Create a Date object fixed to it's declared Timezone. Both\n * - 2021-08-06T02:29:00.000Z and\n * - 2021-08-06T02:29:00.000+08:00\n * will always be displayed as\n * - 2021-08-06 02:29:00\n * regardless timezoneOffset in JavaScript realm\n *\n * The implementation hack:\n * Instead of calling `.getMonth()`/`.getUTCMonth()` respect to `preserveTimezones`,\n * we create a different Date to trick strftime, it's both simpler and more performant.\n * Given that a template is expected to be parsed fewer times than rendered.\n */\n static createDateFixedToTimezone (dateString: string, locale: string): LiquidDate {\n const m = dateString.match(TIMEZONE_PATTERN)\n // representing a UTC timestamp\n if (m && m[1] === 'Z') {\n return new LiquidDate(+new Date(dateString), locale, 0)\n }\n // has a timezone specified\n if (m && m[2] && m[3] && m[4]) {\n const [, , sign, hours, minutes] = m\n const offset = (sign === '+' ? -1 : 1) * (parseInt(hours, 10) * 60 + parseInt(minutes, 10))\n return new LiquidDate(+new Date(dateString), locale, offset)\n }\n return new LiquidDate(dateString, locale)\n }\n private static getTimezoneOffset (timezoneName: string, date: Date) {\n const localDateString = date.toLocaleString('en-US', { timeZone: timezoneName })\n const utcDateString = date.toLocaleString('en-US', { timeZone: 'UTC' })\n\n const localDate = new Date(localDateString)\n const utcDate = new Date(utcDateString)\n return (+utcDate - +localDate) / (60 * 1000)\n }\n}\n","import { assert } from './assert'\n\nexport class Limiter {\n private message: string\n private base = 0\n private limit: number\n constructor (resource: string, limit: number) {\n this.message = `${resource} limit exceeded`\n this.limit = limit\n }\n use (count: number) {\n if (+count > 0) {\n assert(this.base + +count <= this.limit, this.message)\n this.base += +count\n }\n }\n check (count: number) {\n if (+count > 0) {\n assert(+count <= this.limit, this.message)\n }\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\nimport { TYPES, BLANK } from '../util'\n\nexport abstract class DelimitedToken extends Token {\n public trimLeft = false\n public trimRight = false\n public contentRange: [number, number]\n public constructor (\n kind: TokenKind,\n [contentBegin, contentEnd]: [number, number],\n input: string,\n begin: number,\n end: number,\n trimLeft: boolean,\n trimRight: boolean,\n file?: string\n ) {\n super(kind, input, begin, end, file)\n const tl = input[contentBegin] === '-'\n const tr = input[contentEnd - 1] === '-'\n\n let l = tl ? contentBegin + 1 : contentBegin\n let r = tr ? contentEnd - 1 : contentEnd\n while (l < r && (TYPES[input.charCodeAt(l)] & BLANK)) l++\n while (r > l && (TYPES[input.charCodeAt(r - 1)] & BLANK)) r--\n\n this.contentRange = [l, r]\n this.trimLeft = tl || trimLeft\n this.trimRight = tr || trimRight\n }\n get content () {\n return this.input.slice(this.contentRange[0], this.contentRange[1])\n }\n}\n","import { DelimitedToken } from './delimited-token'\nimport { Tokenizer, TokenKind } from '../parser'\nimport type { NormalizedFullOptions } from '../liquid-options'\n\nexport class TagToken extends DelimitedToken {\n public name: string\n public tokenizer: Tokenizer\n public readonly args: string;\n public constructor (\n input: string,\n begin: number,\n end: number,\n options: NormalizedFullOptions,\n file?: string\n ) {\n const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } = options\n const [valueBegin, valueEnd] = [begin + tagDelimiterLeft.length, end - tagDelimiterRight.length]\n super(TokenKind.Tag, [valueBegin, valueEnd], input, begin, end, trimTagLeft, trimTagRight, file)\n\n this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange)\n this.name = this.tokenizer.readTagName()\n this.tokenizer.assert(this.name, `illegal tag syntax, tag name expected`)\n this.tokenizer.skipBlank()\n this.args = this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1])\n }\n}\n","import { DelimitedToken } from './delimited-token'\nimport { NormalizedFullOptions } from '../liquid-options'\nimport { TokenKind } from '../parser'\n\nexport class OutputToken extends DelimitedToken {\n public constructor (\n input: string,\n begin: number,\n end: number,\n options: NormalizedFullOptions,\n file?: string\n ) {\n const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } = options\n const valueRange: [number, number] = [begin + outputDelimiterLeft.length, end - outputDelimiterRight.length]\n super(TokenKind.Output, valueRange, input, begin, end, trimOutputLeft, trimOutputRight, file)\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\n\nexport class HTMLToken extends Token {\n trimLeft = 0\n trimRight = 0\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.HTML, input, begin, end, file)\n }\n public getContent () {\n return this.input.slice(this.begin + this.trimLeft, this.end - this.trimRight)\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\n\nexport class NumberToken extends Token {\n public content: number\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.Number, input, begin, end, file)\n this.content = Number(this.getText())\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\n\nexport class IdentifierToken extends Token {\n public content: string\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.Word, input, begin, end, file)\n this.content = this.getText()\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\nimport { literalValues, LiteralValue, LiteralKey } from '../util'\n\nexport class LiteralToken extends Token {\n public content: LiteralValue\n public literal: LiteralKey\n public constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.Literal, input, begin, end, file)\n this.literal = this.getText() as LiteralKey\n this.content = literalValues[this.literal]\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\n\nexport const enum OperatorType {\n Binary,\n Unary\n}\n\nexport const operatorPrecedences = {\n '==': 2,\n '!=': 2,\n '>': 2,\n '<': 2,\n '>=': 2,\n '<=': 2,\n 'contains': 2,\n 'not': 1,\n 'and': 0,\n 'or': 0\n}\n\nexport const operatorTypes = {\n '==': OperatorType.Binary,\n '!=': OperatorType.Binary,\n '>': OperatorType.Binary,\n '<': OperatorType.Binary,\n '>=': OperatorType.Binary,\n '<=': OperatorType.Binary,\n 'contains': OperatorType.Binary,\n 'not': OperatorType.Unary,\n 'and': OperatorType.Binary,\n 'or': OperatorType.Binary\n}\n\nexport type OperatorKey = keyof typeof operatorPrecedences\n\nexport class OperatorToken extends Token {\n public operator: OperatorKey\n public constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.Operator, input, begin, end, file)\n this.operator = this.getText() as OperatorKey\n }\n getPrecedence () {\n return this.operator in operatorPrecedences ? operatorPrecedences[this.operator] : 1\n }\n}\n","import { Token } from './token'\nimport { LiteralToken } from './literal-token'\nimport { ValueToken } from './value-token'\nimport { IdentifierToken } from './identifier-token'\nimport { NumberToken } from './number-token'\nimport { RangeToken } from './range-token'\nimport { QuotedToken } from './quoted-token'\nimport { TokenKind } from '../parser'\n\nexport class PropertyAccessToken extends Token {\n constructor (\n public variable: QuotedToken | RangeToken | LiteralToken | NumberToken | undefined,\n public props: (ValueToken | IdentifierToken)[],\n input: string,\n begin: number,\n end: number,\n file?: string\n ) {\n super(TokenKind.PropertyAccess, input, begin, end, file)\n }\n}\n","import { Token } from './token'\nimport { FilterArg } from '../parser/filter-arg'\nimport { TokenKind } from '../parser'\n\nexport class FilterToken extends Token {\n public constructor (\n public name: string,\n public args: FilterArg[],\n input: string,\n begin: number,\n end: number,\n file?: string\n ) {\n super(TokenKind.Filter, input, begin, end, file)\n }\n}\n","import { Token } from './token'\nimport { ValueToken } from './value-token'\nimport { IdentifierToken } from './identifier-token'\nimport { TokenKind } from '../parser'\n\nexport class HashToken extends Token {\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public name: IdentifierToken,\n public value?: ValueToken,\n public file?: string\n ) {\n super(TokenKind.Hash, input, begin, end, file)\n }\n}\n","const rHex = /[\\da-fA-F]/\nconst rOct = /[0-7]/\nconst escapeChar: Record = {\n b: '\\b',\n f: '\\f',\n n: '\\n',\n r: '\\r',\n t: '\\t',\n v: '\\x0B'\n}\n\nfunction hexVal (c: string) {\n const code = c.charCodeAt(0)\n if (code >= 97) return code - 87\n if (code >= 65) return code - 55\n return code - 48\n}\n\nexport function parseStringLiteral (str: string): string {\n let ret = ''\n for (let i = 1; i < str.length - 1; i++) {\n if (str[i] !== '\\\\') {\n ret += str[i]\n continue\n }\n if (escapeChar[str[i + 1]] !== undefined) {\n ret += escapeChar[str[++i]]\n } else if (str[i + 1] === 'u') {\n let val = 0\n let j = i + 2\n while (j <= i + 5 && rHex.test(str[j])) {\n val = val * 16 + hexVal(str[j++])\n }\n i = j - 1\n ret += String.fromCharCode(val)\n } else if (!rOct.test(str[i + 1])) {\n ret += str[++i]\n } else {\n let j = i + 1\n let val = 0\n while (j <= i + 3 && rOct.test(str[j])) {\n val = val * 8 + hexVal(str[j++])\n }\n i = j - 1\n ret += String.fromCharCode(val)\n }\n }\n return ret\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\nimport { parseStringLiteral } from '../render/string'\n\nexport class QuotedToken extends Token {\n public readonly content: string\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.Quoted, input, begin, end, file)\n this.content = parseStringLiteral(this.getText())\n }\n}\n","import { Token } from './token'\nimport { ValueToken } from './value-token'\nimport { TokenKind } from '../parser'\n\nexport class RangeToken extends Token {\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public lhs: ValueToken,\n public rhs: ValueToken,\n public file?: string\n ) {\n super(TokenKind.Range, input, begin, end, file)\n }\n}\n","import { DelimitedToken } from './delimited-token'\nimport { NormalizedFullOptions } from '../liquid-options'\nimport { Tokenizer, TokenKind } from '../parser'\n\n/**\n * LiquidTagToken is different from TagToken by not having delimiters `{%` or `%}`\n */\nexport class LiquidTagToken extends DelimitedToken {\n public name: string\n public tokenizer: Tokenizer\n public constructor (\n input: string,\n begin: number,\n end: number,\n options: NormalizedFullOptions,\n file?: string\n ) {\n super(TokenKind.Tag, [begin, end], input, begin, end, false, false, file)\n this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange)\n this.name = this.tokenizer.readTagName()\n this.tokenizer.assert(this.name, 'illegal liquid tag syntax')\n this.tokenizer.skipBlank()\n }\n\n get args (): string {\n return this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1])\n }\n}\n","import { Token } from './token'\nimport { FilterToken } from './filter-token'\nimport { TokenKind } from '../parser'\nimport { Expression } from '../render'\n\n/**\n * value expression with optional filters\n * e.g.\n * {% assign foo=\"bar\" | append: \"coo\" %}\n */\nexport class FilteredValueToken extends Token {\n constructor (\n public initial: Expression,\n public filters: FilterToken[],\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.FilteredValue, input, begin, end, file)\n }\n}\n","interface LiquidPerformance {\n now: () => number\n}\n\nconst polyfill: LiquidPerformance = {\n now: () => Date.now()\n}\n\nexport function getPerformance (): LiquidPerformance {\n return (typeof global === 'object' && global.performance) ||\n (typeof window === 'object' && window.performance) ||\n polyfill\n}\n","import { getPerformance } from '../util/performance'\nimport { toPromise, RenderError, LiquidErrors, LiquidError } from '../util'\nimport { Context } from '../context'\nimport { Template } from '../template'\nimport { Emitter, KeepingTypeEmitter, StreamedEmitter, SimpleEmitter } from '../emitters'\n\nexport class Render {\n public renderTemplatesToNodeStream (templates: Template[], ctx: Context): NodeJS.ReadableStream {\n const emitter = new StreamedEmitter()\n Promise.resolve().then(() => toPromise(this.renderTemplates(templates, ctx, emitter)))\n .then(() => emitter.end(), err => emitter.error(err))\n return emitter.stream\n }\n public * renderTemplates (templates: Template[], ctx: Context, emitter?: Emitter): IterableIterator {\n if (!emitter) {\n emitter = ctx.opts.keepOutputType ? new KeepingTypeEmitter() : new SimpleEmitter()\n }\n ctx.renderLimit.check(getPerformance().now())\n const errors = []\n for (const tpl of templates) {\n ctx.renderLimit.check(getPerformance().now())\n try {\n // if tpl.render supports emitter, it'll return empty `html`\n const html = yield tpl.render(ctx, emitter)\n // if not, it'll return an `html`, write to the emitter for it\n html && emitter.write(html)\n if (ctx.breakCalled || ctx.continueCalled) break\n } catch (e) {\n const err = LiquidError.is(e) ? e : new RenderError(e as Error, tpl)\n if (ctx.opts.catchAllErrors) errors.push(err)\n else throw err\n }\n }\n if (errors.length) {\n throw new LiquidErrors(errors)\n }\n return emitter.buffer\n }\n}\n","import { QuotedToken, RangeToken, OperatorToken, Token, PropertyAccessToken, OperatorType, operatorTypes } from '../tokens'\nimport { isRangeToken, isPropertyAccessToken, UndefinedVariableError, range, isOperatorToken, assert } from '../util'\nimport type { Context } from '../context'\nimport type { UnaryOperatorHandler } from '../render'\nimport { Drop } from '../drop'\n\nexport class Expression {\n readonly postfix: Token[]\n\n public constructor (tokens: IterableIterator) {\n this.postfix = [...toPostfix(tokens)]\n }\n public * evaluate (ctx: Context, lenient?: boolean): Generator {\n assert(ctx, 'unable to evaluate: context not defined')\n const operands: any[] = []\n for (const token of this.postfix) {\n if (isOperatorToken(token)) {\n const r = operands.pop()\n let result\n if (operatorTypes[token.operator] === OperatorType.Unary) {\n result = yield (ctx.opts.operators[token.operator] as UnaryOperatorHandler)(r, ctx)\n } else {\n const l = operands.pop()\n result = yield ctx.opts.operators[token.operator](l, r, ctx)\n }\n operands.push(result)\n } else {\n operands.push(yield evalToken(token, ctx, lenient))\n }\n }\n return operands[0]\n }\n public valid () {\n return !!this.postfix.length\n }\n}\n\nexport function * evalToken (token: Token | undefined, ctx: Context, lenient = false): IterableIterator {\n if (!token) return\n if ('content' in token) return token.content\n if (isPropertyAccessToken(token)) return yield evalPropertyAccessToken(token, ctx, lenient)\n if (isRangeToken(token)) return yield evalRangeToken(token, ctx)\n}\n\nfunction * evalPropertyAccessToken (token: PropertyAccessToken, ctx: Context, lenient: boolean): IterableIterator {\n const props: (string | number | Drop)[] = []\n for (const prop of token.props) {\n props.push((yield evalToken(prop, ctx, false)) as unknown as string | number | Drop)\n }\n try {\n if (token.variable) {\n const variable = yield evalToken(token.variable, ctx, lenient)\n return yield ctx._getFromScope(variable, props)\n } else {\n return yield ctx._get(props)\n }\n } catch (e) {\n if (lenient && (e as Error).name === 'InternalUndefinedVariableError') return null\n throw (new UndefinedVariableError(e as Error, token))\n }\n}\n\nexport function evalQuotedToken (token: QuotedToken) {\n return token.content\n}\n\nfunction * evalRangeToken (token: RangeToken, ctx: Context) {\n const low: number = yield evalToken(token.lhs, ctx)\n const high: number = yield evalToken(token.rhs, ctx)\n ctx.memoryLimit.use(high - low + 1)\n return range(+low, +high + 1)\n}\n\nfunction * toPostfix (tokens: IterableIterator): IterableIterator {\n const ops: OperatorToken[] = []\n for (const token of tokens) {\n if (isOperatorToken(token)) {\n while (ops.length && ops[ops.length - 1].getPrecedence() > token.getPrecedence()) {\n yield ops.pop()!\n }\n ops.push(token)\n } else yield token\n }\n while (ops.length) {\n yield ops.pop()!\n }\n}\n","import { Context } from '../context/context'\nimport { toValue } from '../util'\n\nexport function isTruthy (val: any, ctx: Context): boolean {\n return !isFalsy(val, ctx)\n}\n\nexport function isFalsy (val: any, ctx: Context): boolean {\n val = toValue(val)\n\n if (ctx.opts.jsTruthy) {\n return !val\n } else {\n return val === false || undefined === val || val === null\n }\n}\n","import { isComparable } from '../drop/comparable'\nimport { Context } from '../context'\nimport { toValue } from '../util'\nimport { isFalsy, isTruthy } from '../render/boolean'\nimport { isArray, isFunction } from '../util/underscore'\n\nexport type UnaryOperatorHandler = (operand: any, ctx: Context) => boolean;\nexport type BinaryOperatorHandler = (lhs: any, rhs: any, ctx: Context) => boolean;\nexport type OperatorHandler = UnaryOperatorHandler | BinaryOperatorHandler;\nexport type Operators = Record\n\nexport const defaultOperators: Operators = {\n '==': equals,\n '!=': (l: any, r: any) => !equals(l, r),\n '>': (l: any, r: any) => {\n if (isComparable(l)) return l.gt(r)\n if (isComparable(r)) return r.lt(l)\n return toValue(l) > toValue(r)\n },\n '<': (l: any, r: any) => {\n if (isComparable(l)) return l.lt(r)\n if (isComparable(r)) return r.gt(l)\n return toValue(l) < toValue(r)\n },\n '>=': (l: any, r: any) => {\n if (isComparable(l)) return l.geq(r)\n if (isComparable(r)) return r.leq(l)\n return toValue(l) >= toValue(r)\n },\n '<=': (l: any, r: any) => {\n if (isComparable(l)) return l.leq(r)\n if (isComparable(r)) return r.geq(l)\n return toValue(l) <= toValue(r)\n },\n 'contains': (l: any, r: any) => {\n l = toValue(l)\n if (isArray(l)) return l.some((i) => equals(i, r))\n if (isFunction(l?.indexOf)) return l.indexOf(toValue(r)) > -1\n return false\n },\n 'not': (v: any, ctx: Context) => isFalsy(toValue(v), ctx),\n 'and': (l: any, r: any, ctx: Context) => isTruthy(toValue(l), ctx) && isTruthy(toValue(r), ctx),\n 'or': (l: any, r: any, ctx: Context) => isTruthy(toValue(l), ctx) || isTruthy(toValue(r), ctx)\n}\n\nexport function equals (lhs: any, rhs: any): boolean {\n if (isComparable(lhs)) return lhs.equals(rhs)\n if (isComparable(rhs)) return rhs.equals(lhs)\n lhs = toValue(lhs)\n rhs = toValue(rhs)\n if (isArray(lhs)) {\n return isArray(rhs) && arrayEquals(lhs, rhs)\n }\n return lhs === rhs\n}\n\nfunction arrayEquals (lhs: any[], rhs: any[]): boolean {\n if (lhs.length !== rhs.length) return false\n return !lhs.some((value, i) => !equals(value, rhs[i]))\n}\n\nexport function arrayIncludes (arr: any[], item: any): boolean {\n return arr.some(value => equals(value, item))\n}\n","import { Cache } from './cache'\n\nclass Node {\n constructor (\n public key: string,\n public value: T,\n public next: Node,\n public prev: Node\n ) {}\n}\n\nexport class LRU implements Cache {\n private cache: Record> = {}\n private head: Node\n private tail: Node\n\n constructor (\n public limit: number,\n public size = 0\n ) {\n this.head = new Node('HEAD', null as any, null as any, null as any)\n this.tail = new Node('TAIL', null as any, null as any, null as any)\n this.head.next = this.tail\n this.tail.prev = this.head\n }\n\n write (key: string, value: T) {\n if (this.cache[key]) {\n this.cache[key].value = value\n } else {\n const node = new Node(key, value, this.head.next, this.head)\n this.head.next.prev = node\n this.head.next = node\n\n this.cache[key] = node\n this.size++\n this.ensureLimit()\n }\n }\n\n read (key: string): T | undefined {\n if (!this.cache[key]) return\n const { value } = this.cache[key]\n this.remove(key)\n this.write(key, value)\n return value\n }\n\n remove (key: string) {\n const node = this.cache[key]\n node.prev.next = node.next\n node.next.prev = node.prev\n delete this.cache[key]\n this.size--\n }\n\n clear () {\n this.head.next = this.tail\n this.tail.prev = this.head\n this.size = 0\n this.cache = {}\n }\n\n private ensureLimit () {\n if (this.size > this.limit) this.remove(this.tail.prev.key)\n }\n}\n","import { last } from '../util'\n\nfunction domResolve (root: string, path: string) {\n const base = document.createElement('base')\n base.href = root\n\n const head = document.getElementsByTagName('head')[0]\n head.insertBefore(base, head.firstChild)\n\n const a = document.createElement('a')\n a.href = path\n const resolved = a.href\n head.removeChild(base)\n\n return resolved\n}\n\nexport function resolve (root: string, filepath: string, ext: string) {\n if (root.length && last(root) !== '/') root += '/'\n const url = domResolve(root, filepath)\n return url.replace(/^(\\w+:\\/\\/[^/]+)(\\/[^?]+)/, (str, origin, path) => {\n const last = path.split('/').pop()\n if (/\\.\\w+$/.test(last)) return str\n return origin + path + ext\n })\n}\n\nexport async function readFile (url: string): Promise {\n return new Promise((resolve, reject) => {\n const xhr = new XMLHttpRequest()\n xhr.onload = () => {\n if (xhr.status >= 200 && xhr.status < 300) {\n resolve(xhr.responseText as string)\n } else {\n reject(new Error(xhr.statusText))\n }\n }\n xhr.onerror = () => {\n reject(new Error('An error occurred whilst receiving the response.'))\n }\n xhr.open('GET', url)\n xhr.send()\n })\n}\n\nexport function readFileSync (url: string): string {\n const xhr = new XMLHttpRequest()\n xhr.open('GET', url, false)\n xhr.send()\n if (xhr.status < 200 || xhr.status >= 300) {\n throw new Error(xhr.statusText)\n }\n return xhr.responseText as string\n}\n\nexport async function exists (filepath: string) {\n return true\n}\n\nexport function existsSync (filepath: string) {\n return true\n}\n\nexport function dirname (filepath: string) {\n return domResolve(filepath, '.')\n}\n\nexport const sep = '/'\n","import { isFalsy } from '../render/boolean'\nimport { identify, isArray, isString, toValue } from '../util/underscore'\nimport { FilterImpl } from '../template'\n\nfunction chargeJsonReplacerValue (memoryLimit: { use(count: number): void }, val: unknown) {\n if (typeof val === 'string') {\n memoryLimit.use(val.length)\n } else if (val === null || typeof val === 'number' || typeof val === 'boolean') {\n memoryLimit.use(JSON.stringify(val).length)\n } else if (Array.isArray(val)) {\n memoryLimit.use(val.length + 1)\n } else if (typeof val === 'object') {\n memoryLimit.use(2)\n }\n}\n\nfunction defaultFilter (this: FilterImpl, value: T1, defaultValue: T2, ...args: Array<[string, any]>): T1 | T2 {\n value = toValue(value)\n if (isArray(value) || isString(value)) return value.length ? value : defaultValue\n if (value === false && (new Map(args)).get('allow_false')) return false as T1\n return isFalsy(value, this.context) ? defaultValue : value\n}\n\nfunction json (this: FilterImpl, value: any, space = 0) {\n const memoryLimit = this.context.memoryLimit\n return JSON.stringify(value, (_key, val) => {\n chargeJsonReplacerValue(memoryLimit, val)\n return val\n }, space)\n}\n\nfunction inspect (this: FilterImpl, value: any, space = 0) {\n const memoryLimit = this.context.memoryLimit\n const ancestors: object[] = []\n return JSON.stringify(value, function (this: unknown, _key: unknown, value: any) {\n if (typeof value !== 'object' || value === null) {\n chargeJsonReplacerValue(memoryLimit, value)\n return value\n }\n // `this` is the object that value is contained in, i.e., its direct parent.\n while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) ancestors.pop()\n if (ancestors.includes(value)) {\n memoryLimit.use('[Circular]'.length)\n return '[Circular]'\n }\n ancestors.push(value)\n chargeJsonReplacerValue(memoryLimit, value)\n return value\n }, space)\n}\n\nfunction to_integer (value: any) {\n return Number(value)\n}\n\nconst raw = {\n raw: true,\n handler: identify\n}\n\nexport default {\n default: defaultFilter,\n raw,\n jsonify: json,\n to_integer,\n json,\n inspect\n}\n","import { FilterImpl } from '../template'\nimport { stringify } from '../util/underscore'\n\nconst escapeMap: Record = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": '''\n}\nconst unescapeMap: Record = {\n '&': '&',\n '<': '<',\n '>': '>',\n '"': '\"',\n ''': \"'\"\n}\n\nexport function escape (this: FilterImpl, str: string) {\n str = stringify(str)\n this.context.memoryLimit.use(str.length)\n return str.replace(/&|<|>|\"|'/g, m => escapeMap[m])\n}\n\nexport function xml_escape (this: FilterImpl, str: string) {\n return escape.call(this, str)\n}\n\nfunction unescape (this: FilterImpl, str: string) {\n str = stringify(str)\n this.context.memoryLimit.use(str.length)\n return str.replace(/&(amp|lt|gt|#34|#39);/g, m => unescapeMap[m])\n}\n\nexport function escape_once (this: FilterImpl, str: string) {\n return escape.call(this, unescape.call(this, str))\n}\n\nexport function newline_to_br (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n return str.replace(/\\r?\\n/gm, '
\\n')\n}\n\n// Raw-text blocks (HTML5) plus '<...>' as the catch-all kind; a regex\n// equivalent is O(n^2) in V8 on unclosed openers.\nexport function strip_html (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n const blocks = new Map([[''], [''], [''], ['<', '>']])\n let out = ''\n let i = 0\n while (i < str.length) {\n const lt = str.indexOf('<', i)\n if (lt < 0) return out + str.slice(i)\n out += str.slice(i, lt)\n for (const [opener, closer] of blocks) {\n if (!str.startsWith(opener, lt)) continue\n const e = str.indexOf(closer, lt + opener.length)\n if (e >= 0) { i = e + closer.length; break }\n blocks.delete(opener)\n }\n if (i <= lt) return out + str.slice(lt)\n }\n return out\n}\n","import { isNil } from '../util'\n\nexport class MapFS {\n constructor (private mapping: {[key: string]: string}) {}\n\n public sep = '/'\n\n async exists (filepath: string) {\n return this.existsSync(filepath)\n }\n\n existsSync (filepath: string) {\n return !isNil(this.mapping[filepath])\n }\n\n async readFile (filepath: string) {\n return this.readFileSync(filepath)\n }\n\n readFileSync (filepath: string) {\n const content = this.mapping[filepath]\n if (isNil(content)) throw new Error(`ENOENT: ${filepath}`)\n return content\n }\n\n dirname (filepath: string) {\n const segments = filepath.split(this.sep)\n segments.pop()\n return segments.join(this.sep)\n }\n\n resolve (dir: string, file: string, ext: string) {\n file += ext\n if (dir === '.') return file\n const segments = dir.split(/\\/+/)\n for (const segment of file.split(this.sep)) {\n if (segment === '.' || segment === '') continue\n else if (segment === '..') {\n if (segments.length > 1 || segments[0] !== '') segments.pop()\n } else segments.push(segment)\n }\n return segments.join(this.sep)\n }\n}\n","import { assert, isArray, isString, isFunction } from './util'\nimport { getDateTimeFormat } from './util/intl'\nimport { LRU, LiquidCache } from './cache'\nimport { FS, LookupType } from './fs'\nimport * as fs from './fs/fs-impl'\nimport { defaultOperators, Operators } from './render'\nimport misc from './filters/misc'\nimport { escape } from './filters/html'\nimport { MapFS } from './fs/map-fs'\n\ntype OutputEscape = (value: any) => string\ntype OutputEscapeOption = 'escape' | 'json' | OutputEscape\n\nexport interface LiquidOptions {\n /** A directory or an array of directories from where to resolve layout and include templates, and the filename passed to `.renderFile()`. If it's an array, the files are looked up in the order they occur in the array. Defaults to `[\".\"]` */\n root?: string | string[];\n /** A directory or an array of directories from where to resolve included templates. If it's an array, the files are looked up in the order they occur in the array. Defaults to `root` */\n partials?: string | string[];\n /** A directory or an array of directories from where to resolve layout templates. If it's an array, the files are looked up in the order they occur in the array. Defaults to `root` */\n layouts?: string | string[];\n /** Allow refer to layouts/partials by relative pathname. To avoid arbitrary filesystem read, paths been referenced also need to be within corresponding root, partials, layouts. Defaults to `true`. */\n relativeReference?: boolean;\n /** Use jekyll style include, pass parameters to `include` variable of current scope. Defaults to `false`. */\n jekyllInclude?: boolean;\n /** Use jekyll style where filter, enables array item match. Defaults to `false`. */\n jekyllWhere?: boolean;\n /** Add a extname (if filepath doesn't include one) before template file lookup. Eg: setting to `\".html\"` will allow including file by basename. Defaults to `\"\"`. */\n extname?: string;\n /** Whether or not to cache resolved templates. Defaults to `false`. */\n cache?: boolean | number | LiquidCache;\n /** Use JavaScript Truthiness. Defaults to `false`. */\n jsTruthy?: boolean;\n /** If set, treat the `filepath` parameter in `{%include filepath %}` and `{%layout filepath%}` as a variable, otherwise as a literal value. Defaults to `true`. */\n dynamicPartials?: boolean;\n /** Whether or not to assert filter existence. If set to `false`, undefined filters will be skipped. Otherwise, undefined filters will cause an exception. Defaults to `false`. */\n strictFilters?: boolean;\n /** Whether or not to assert variable existence. If set to `false`, undefined variables will be rendered as empty string. Otherwise, undefined variables will cause an exception. Defaults to `false`. */\n strictVariables?: boolean;\n /** Catch all errors instead of exit upon one. Please note that render errors won't be reached when parse fails. */\n catchAllErrors?: boolean;\n /**\n * Hide scope variables from prototypes, useful when you're passing a not sanitized object into LiquidJS or need to hide prototypes from templates.\n * This only applies to property/index access on scope objects. Filter transforms and iteration operate on the resolved value with standard JavaScript semantics, so prototype-inherited array indices may still be surfaced by them.\n */\n ownPropertyOnly?: boolean;\n /** Modifies the behavior of `strictVariables`. If set, a single undefined variable will *not* cause an exception in the context of the `if`/`elsif`/`unless` tag and the `default` filter. Instead, it will evaluate to `false` and `null`, respectively. Irrelevant if `strictVariables` is not set. Defaults to `false`. **/\n lenientIf?: boolean;\n /** JavaScript timezone name or timezoneOffset for `date` filter, default to local time. That means if you're in Australia (UTC+10), it'll default to `-600` or `Australia/Lindeman` */\n timezoneOffset?: number | string;\n /** Default date format to use if the date filter doesn't include a format. Defaults to `%A, %B %-e, %Y at %-l:%M %P %z`. */\n dateFormat?: string;\n /** Default locale, will be used by date filter. Defaults to system locale. */\n locale?: string;\n /** Strip blank characters (including ` `, `\\t`, and `\\r`) from the right of tags (`{% %}`) until `\\n` (inclusive). Defaults to `false`. */\n trimTagRight?: boolean;\n /** Similar to `trimTagRight`, whereas the `\\n` is exclusive. Defaults to `false`. See Whitespace Control for details. */\n trimTagLeft?: boolean;\n /** Strip blank characters (including ` `, `\\t`, and `\\r`) from the right of values (`{{ }}`) until `\\n` (inclusive). Defaults to `false`. */\n trimOutputRight?: boolean;\n /** Similar to `trimOutputRight`, whereas the `\\n` is exclusive. Defaults to `false`. See Whitespace Control for details. */\n trimOutputLeft?: boolean;\n /** The left delimiter for liquid tags. **/\n tagDelimiterLeft?: string;\n /** The right delimiter for liquid tags. **/\n tagDelimiterRight?: string;\n /** The left delimiter for liquid outputs. **/\n outputDelimiterLeft?: string;\n /** The right delimiter for liquid outputs. **/\n outputDelimiterRight?: string;\n /** Whether input strings to date filter preserve the given timezone **/\n preserveTimezones?: boolean;\n /** Whether `trim*Left`/`trim*Right` is greedy. When set to `true`, all consecutive blank characters including `\\n` will be trimmed regardless of line breaks. Defaults to `true`. */\n greedy?: boolean;\n /** `fs` is used to override the default file-system module with a custom implementation. */\n fs?: FS;\n /** keyValue separator */\n keyValueSeparator?: string;\n /** Render from an in-memory `templates` mapping instead of the file system. When `templates` is set, Liquid uses the provided mapping for template lookup (including includes, layouts, and partials), and file-system options such as `fs`, `root`, `partials`, `layouts`, and `relativeReference` are effectively bypassed for those lookups. */\n templates?: {[key: string]: string};\n /** the global scope passed down to all partial and layout templates, i.e. templates included by `include`, `layout` and `render` tags. */\n globals?: object;\n /** Whether or not to keep value type when writing the Output, not working for streamed rendering. Defaults to `false`. */\n keepOutputType?: boolean;\n /** Default escape filter applied to output values, when set, you'll have to add `| raw` for values don't need to be escaped. Defaults to `undefined`. */\n outputEscape?: OutputEscapeOption;\n /** An object of operators for conditional statements. Defaults to the regular Liquid operators. */\n operators?: Operators;\n /** Respect parameter order when using filters like \"for ... reversed limit\", Defaults to `false`. */\n orderedFilterParameters?: boolean;\n /** For DoS handling, limit total length of templates parsed in one `parse()` call. A typical PC can handle 1e8 (100M) characters without issues. */\n parseLimit?: number;\n /** For DoS handling, limit total time (in ms) for each `render()` call. */\n renderLimit?: number;\n /** For DoS handling, limit new objects creation, including array concat/join/strftime, etc. A typical PC can handle 1e9 (1G) memory without issue. */\n memoryLimit?: number;\n}\n\nexport interface RenderOptions {\n /**\n * This call is sync or async? It's used by Liquid internal methods, you'll not need this.\n */\n sync?: boolean;\n /**\n * Same as `globals` on LiquidOptions, but only for current render() call\n */\n globals?: object;\n /**\n * Same as `strictVariables` on LiquidOptions, but only for current render() call\n */\n strictVariables?: boolean;\n /**\n * Same as `ownPropertyOnly` on LiquidOptions, but only for current render() call\n */\n ownPropertyOnly?: boolean;\n /** For DoS handling, limit total renders of tag/HTML/output in one `render()` call. A typical PC can handle 1e5 renders of typical templates per second. */\n templateLimit?: number;\n /** For DoS handling, limit total time (in ms) for each `render()` call. */\n renderLimit?: number;\n /** For DoS handling, limit new objects creation, including array concat/join/strftime, etc. A typical PC can handle 1e9 (1G) memory without issue.. */\n memoryLimit?: number;\n}\n\nexport interface RenderFileOptions extends RenderOptions {\n lookupType?: LookupType;\n}\n\ninterface NormalizedOptions extends LiquidOptions {\n root?: string[];\n partials?: string[];\n layouts?: string[];\n cache?: LiquidCache;\n outputEscape?: OutputEscape;\n}\n\nexport interface NormalizedFullOptions extends NormalizedOptions {\n root: string[];\n partials: string[];\n layouts: string[];\n relativeReference: boolean;\n jekyllInclude: boolean;\n extname: string;\n cache?: LiquidCache;\n jsTruthy: boolean;\n dynamicPartials: boolean;\n fs: FS;\n strictFilters: boolean;\n strictVariables: boolean;\n ownPropertyOnly: boolean;\n lenientIf: boolean;\n dateFormat: string;\n locale: string;\n trimTagRight: boolean;\n trimTagLeft: boolean;\n trimOutputRight: boolean;\n trimOutputLeft: boolean;\n tagDelimiterLeft: string;\n tagDelimiterRight: string;\n outputDelimiterLeft: string;\n outputDelimiterRight: string;\n preserveTimezones: boolean;\n greedy: boolean;\n globals: object;\n keepOutputType: boolean;\n operators: Operators;\n parseLimit: number;\n renderLimit: number;\n memoryLimit: number;\n}\n\nexport const defaultOptions: NormalizedFullOptions = {\n root: ['.'],\n layouts: ['.'],\n partials: ['.'],\n relativeReference: true,\n jekyllInclude: false,\n keyValueSeparator: ':',\n cache: undefined,\n extname: '',\n fs: fs,\n dynamicPartials: true,\n jsTruthy: false,\n dateFormat: '%A, %B %-e, %Y at %-l:%M %P %z',\n locale: '',\n trimTagRight: false,\n trimTagLeft: false,\n trimOutputRight: false,\n trimOutputLeft: false,\n greedy: true,\n tagDelimiterLeft: '{%',\n tagDelimiterRight: '%}',\n outputDelimiterLeft: '{{',\n outputDelimiterRight: '}}',\n preserveTimezones: false,\n strictFilters: false,\n strictVariables: false,\n ownPropertyOnly: true,\n lenientIf: false,\n globals: {},\n keepOutputType: false,\n operators: defaultOperators,\n memoryLimit: Infinity,\n parseLimit: Infinity,\n renderLimit: Infinity\n}\n\nexport function normalize (options: LiquidOptions): NormalizedFullOptions {\n if (options.hasOwnProperty('root')) {\n if (!options.hasOwnProperty('partials')) options.partials = options.root\n if (!options.hasOwnProperty('layouts')) options.layouts = options.root\n }\n if (options.hasOwnProperty('cache')) {\n let cache: LiquidCache | undefined\n if (typeof options.cache === 'number') cache = options.cache > 0 ? new LRU(options.cache) : undefined\n else if (typeof options.cache === 'object') cache = options.cache\n else cache = options.cache ? new LRU(1024) : undefined\n options.cache = cache\n }\n options = { ...defaultOptions, ...(options.jekyllInclude ? { dynamicPartials: false } : {}), ...options }\n if ((!options.fs!.dirname || !options.fs!.sep) && options.relativeReference) {\n console.warn('[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning')\n options.relativeReference = false\n }\n options.root = normalizeDirectoryList(options.root)\n options.partials = normalizeDirectoryList(options.partials)\n options.layouts = normalizeDirectoryList(options.layouts)\n options.outputEscape = options.outputEscape && getOutputEscapeFunction(options.outputEscape)\n if (!options.locale) {\n options.locale = getDateTimeFormat()?.().resolvedOptions().locale ?? 'en-US'\n }\n if (options.templates) {\n options.fs = new MapFS(options.templates)\n options.relativeReference = true\n options.root = options.partials = options.layouts = '.'\n }\n return options as NormalizedFullOptions\n}\n\nfunction getOutputEscapeFunction (nameOrFunction: OutputEscapeOption): OutputEscape {\n if (nameOrFunction === 'escape') return escape\n if (nameOrFunction === 'json') return misc.json\n assert(isFunction(nameOrFunction), '`outputEscape` need to be of type string or function')\n return nameOrFunction\n}\n\nexport function normalizeDirectoryList (value: any): string[] {\n let list: string[] = []\n if (isArray(value)) list = value\n if (isString(value)) list = [value]\n return list\n}\n","import { Token } from '../tokens'\nimport { NormalizedFullOptions } from '../liquid-options'\nimport { isTagToken, isHTMLToken, isDelimitedToken, TYPES, INLINE_BLANK, BLANK } from '../util'\n\nexport function whiteSpaceCtrl (tokens: Token[], options: NormalizedFullOptions) {\n let inRaw = false\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i]\n if (!isDelimitedToken(token)) continue\n if (!inRaw && token.trimLeft) {\n trimLeft(tokens[i - 1], options.greedy)\n }\n\n if (isTagToken(token)) {\n if (token.name === 'raw') inRaw = true\n else if (token.name === 'endraw') inRaw = false\n }\n\n if (!inRaw && token.trimRight) {\n trimRight(tokens[i + 1], options.greedy)\n }\n }\n}\n\nfunction trimLeft (token: Token, greedy: boolean) {\n if (!token || !isHTMLToken(token)) return\n\n const mask = greedy ? BLANK : INLINE_BLANK\n while (TYPES[token.input.charCodeAt(token.end - 1 - token.trimRight)] & mask) token.trimRight++\n}\n\nfunction trimRight (token: Token, greedy: boolean) {\n if (!token || !isHTMLToken(token)) return\n\n const mask = greedy ? BLANK : INLINE_BLANK\n while (TYPES[token.input.charCodeAt(token.begin + token.trimLeft)] & mask) token.trimLeft++\n if (token.input.charAt(token.begin + token.trimLeft) === '\\n') token.trimLeft++\n}\n","import { FilteredValueToken, TagToken, HTMLToken, HashToken, QuotedToken, LiquidTagToken, OutputToken, ValueToken, Token, RangeToken, FilterToken, TopLevelToken, PropertyAccessToken, OperatorToken, LiteralToken, IdentifierToken, NumberToken } from '../tokens'\nimport { OperatorHandler } from '../render/operator'\nimport { LiteralValue, Trie, createTrie, ellipsis, literalValues, TokenizationError, TYPES, QUOTE, BLANK, NUMBER, SIGN, isWord, isString } from '../util'\nimport { Operators, Expression } from '../render'\nimport { NormalizedFullOptions, defaultOptions } from '../liquid-options'\nimport { FilterArg } from './filter-arg'\nimport { whiteSpaceCtrl } from './whitespace-ctrl'\n\nexport class Tokenizer {\n p: number\n N: number\n private rawBeginAt = -1\n private opTrie: Trie\n private literalTrie: Trie\n\n constructor (\n public input: string,\n operators: Operators = defaultOptions.operators,\n public file?: string,\n range?: [number, number]\n ) {\n this.p = range ? range[0] : 0\n this.N = range ? range[1] : input.length\n this.opTrie = createTrie(operators)\n this.literalTrie = createTrie(literalValues)\n }\n\n readExpression () {\n return new Expression(this.readExpressionTokens())\n }\n\n * readExpressionTokens (): IterableIterator {\n while (this.p < this.N) {\n const operator = this.readOperator()\n if (operator) {\n yield operator\n continue\n }\n const operand = this.readValue()\n if (operand) {\n yield operand\n continue\n }\n return\n }\n }\n readOperator (): OperatorToken | undefined {\n this.skipBlank()\n const end = this.matchTrie(this.opTrie)\n if (end === -1) return\n return new OperatorToken(this.input, this.p, (this.p = end), this.file)\n }\n matchTrie (trie: Trie) {\n let node: Trie = trie\n let i = this.p\n let info: Trie | undefined\n while ((node as Trie)[this.input[i]] && i < this.N) {\n node = (node as Trie)[this.input[i++]] as Trie\n if (node['end']) info = node\n }\n if (!info) return -1\n if (info['needBoundary'] && isWord(this.peek(i - this.p))) return -1\n return i\n }\n readFilteredValue (): FilteredValueToken {\n const begin = this.p\n const initial = this.readExpression()\n this.assert(initial.valid(), `invalid value expression: ${this.snapshot()}`)\n const filters = this.readFilters()\n return new FilteredValueToken(initial, filters, this.input, begin, this.p, this.file)\n }\n readFilters (): FilterToken[] {\n const filters = []\n while (true) {\n const filter = this.readFilter()\n if (!filter) return filters\n filters.push(filter)\n }\n }\n readFilter (): FilterToken | null {\n this.skipBlank()\n if (this.end()) return null\n this.assert(this.read() === '|', `expected \"|\" before filter`)\n const name = this.readIdentifier()\n if (!name.size()) {\n this.assert(this.end(), `expected filter name`)\n return null\n }\n const args = []\n this.skipBlank()\n if (this.peek() === ':') {\n do {\n ++this.p\n const arg = this.readFilterArg()\n arg && args.push(arg)\n this.skipBlank()\n this.assert(this.end() || this.peek() === ',' || this.peek() === '|', () => `unexpected character ${this.snapshot()}`)\n } while (this.peek() === ',')\n } else if (this.peek() === '|' || this.end()) {\n // do nothing\n } else {\n throw this.error('expected \":\" after filter name')\n }\n return new FilterToken(name.getText(), args, this.input, name.begin, this.p, this.file)\n }\n\n readFilterArg (): FilterArg | undefined {\n const key = this.readValue()\n if (!key) return\n this.skipBlank()\n if (this.peek() !== ':') return key\n ++this.p\n const value = this.readValue()\n return [key.getText(), value]\n }\n\n readTopLevelTokens (options: NormalizedFullOptions = defaultOptions): TopLevelToken[] {\n const tokens: TopLevelToken[] = []\n while (this.p < this.N) {\n const token = this.readTopLevelToken(options)\n tokens.push(token)\n }\n whiteSpaceCtrl(tokens, options)\n return tokens\n }\n\n readTopLevelToken (options: NormalizedFullOptions): TopLevelToken {\n const { tagDelimiterLeft, outputDelimiterLeft } = options\n if (this.rawBeginAt > -1) return this.readEndrawOrRawContent(options)\n if (this.match(tagDelimiterLeft)) return this.readTagToken(options)\n if (this.match(outputDelimiterLeft)) return this.readOutputToken(options)\n return this.readHTMLToken([tagDelimiterLeft, outputDelimiterLeft])\n }\n\n readHTMLToken (stopStrings: string[]): HTMLToken {\n const begin = this.p\n while (this.p < this.N) {\n if (stopStrings.some(str => this.match(str))) break\n ++this.p\n }\n return new HTMLToken(this.input, begin, this.p, this.file)\n }\n\n readTagToken (options: NormalizedFullOptions): TagToken {\n const { file, input } = this\n const begin = this.p\n if (this.readToDelimiter(options.tagDelimiterRight) === -1) {\n throw this.error(`tag ${this.snapshot(begin)} not closed`, begin)\n }\n const token = new TagToken(input, begin, this.p, options, file)\n if (token.name === 'raw') this.rawBeginAt = begin\n return token\n }\n\n readToDelimiter (delimiter: string, respectQuoted = false) {\n this.skipBlank()\n while (this.p < this.N) {\n if (respectQuoted && (this.peekType() & QUOTE)) {\n this.readQuoted()\n continue\n }\n ++this.p\n if (this.rmatch(delimiter)) return this.p\n }\n return -1\n }\n\n readOutputToken (options: NormalizedFullOptions = defaultOptions): OutputToken {\n const { file, input } = this\n const { outputDelimiterRight } = options\n const begin = this.p\n if (this.readToDelimiter(outputDelimiterRight, true) === -1) {\n throw this.error(`output ${this.snapshot(begin)} not closed`, begin)\n }\n return new OutputToken(input, begin, this.p, options, file)\n }\n\n readEndrawOrRawContent (options: NormalizedFullOptions): HTMLToken | TagToken {\n const { tagDelimiterLeft, tagDelimiterRight } = options\n const begin = this.p\n let leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length\n while (this.p < this.N) {\n if (this.readIdentifier().getText() !== 'endraw') {\n leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length\n continue\n }\n while (this.p <= this.N) {\n if (this.rmatch(tagDelimiterRight)) {\n const end = this.p\n if (begin === leftPos) {\n this.rawBeginAt = -1\n return new TagToken(this.input, begin, end, options, this.file)\n } else {\n this.p = leftPos\n return new HTMLToken(this.input, begin, leftPos, this.file)\n }\n }\n if (this.rmatch(tagDelimiterLeft)) break\n this.p++\n }\n }\n throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, begin)\n }\n\n readLiquidTagTokens (options: NormalizedFullOptions = defaultOptions): LiquidTagToken[] {\n const tokens: LiquidTagToken[] = []\n while (this.p < this.N) {\n const token = this.readLiquidTagToken(options)\n token && tokens.push(token)\n }\n return tokens\n }\n\n readLiquidTagToken (options: NormalizedFullOptions): LiquidTagToken | undefined {\n this.skipBlank()\n if (this.end()) return\n\n const begin = this.p\n this.readToDelimiter('\\n')\n const end = this.p\n return new LiquidTagToken(this.input, begin, end, options, this.file)\n }\n\n error (msg: string, pos: number = this.p) {\n return new TokenizationError(msg, new IdentifierToken(this.input, pos, this.N, this.file))\n }\n\n assert (pred: unknown, msg: string | (() => string), pos?: number) {\n if (!pred) throw this.error(typeof msg === 'function' ? msg() : msg, pos)\n }\n\n snapshot (begin: number = this.p) {\n return JSON.stringify(ellipsis(this.input.slice(begin, this.N), 32))\n }\n\n /**\n * @deprecated use #readIdentifier instead\n */\n readWord () {\n return this.readIdentifier()\n }\n\n readIdentifier (): IdentifierToken {\n this.skipBlank()\n const begin = this.p\n while (!this.end() && isWord(this.peek())) ++this.p\n return new IdentifierToken(this.input, begin, this.p, this.file)\n }\n\n readNonEmptyIdentifier (): IdentifierToken | undefined {\n const id = this.readIdentifier()\n return id.size() ? id : undefined\n }\n\n readTagName (): string {\n this.skipBlank()\n // Handle inline comment tags\n if (this.input[this.p] === '#') return this.input.slice(this.p, ++this.p)\n return this.readIdentifier().getText()\n }\n\n readHashes (jekyllStyle?: boolean | string) {\n const hashes = []\n while (true) {\n const hash = this.readHash(jekyllStyle)\n if (!hash) return hashes\n hashes.push(hash)\n }\n }\n\n readHash (jekyllStyle?: boolean | string): HashToken | undefined {\n this.skipBlank()\n if (this.peek() === ',') ++this.p\n const begin = this.p\n const name = this.readNonEmptyIdentifier()\n if (!name) return\n let value\n\n this.skipBlank()\n const sep = isString(jekyllStyle) ? jekyllStyle : (jekyllStyle ? '=' : ':')\n if (this.peek() === sep) {\n ++this.p\n value = this.readValue()\n }\n return new HashToken(this.input, begin, this.p, name, value, this.file)\n }\n\n remaining () {\n return this.input.slice(this.p, this.N)\n }\n\n advance (step = 1) {\n this.p += step\n }\n\n end () {\n return this.p >= this.N\n }\n read () {\n return this.input[this.p++]\n }\n readTo (end: string): number {\n while (this.p < this.N) {\n ++this.p\n if (this.rmatch(end)) return this.p\n }\n return -1\n }\n\n readValue (): ValueToken | undefined {\n this.skipBlank()\n const begin = this.p\n const variable = this.readLiteral() || this.readQuoted() || this.readRange() || this.readNumber()\n const props = this.readProperties(!variable)\n if (!props.length) return variable\n return new PropertyAccessToken(variable, props, this.input, begin, this.p)\n }\n\n readScopeValue (): ValueToken | undefined {\n this.skipBlank()\n const begin = this.p\n const props = this.readProperties()\n if (!props.length) return undefined\n return new PropertyAccessToken(undefined, props, this.input, begin, this.p)\n }\n\n private readProperties (isBegin = true): (ValueToken | IdentifierToken)[] {\n const props: (ValueToken | IdentifierToken)[] = []\n while (true) {\n if (this.peek() === '[') {\n this.p++\n const prop = this.readValue() || new IdentifierToken(this.input, this.p, this.p, this.file)\n this.assert(this.readTo(']') !== -1, '[ not closed')\n props.push(prop)\n continue\n }\n if (isBegin && !props.length) {\n const prop = this.readNonEmptyIdentifier()\n if (prop) {\n props.push(prop)\n continue\n }\n }\n if (this.peek() === '.' && this.peek(1) !== '.') { // skip range syntax\n this.p++\n const prop = this.readNonEmptyIdentifier()\n if (!prop) break\n props.push(prop)\n continue\n }\n break\n }\n return props\n }\n\n readNumber (): NumberToken | undefined {\n this.skipBlank()\n let decimalFound = false\n let digitFound = false\n let n = 0\n if (this.peekType() & SIGN) n++\n while (this.p + n <= this.N) {\n if (this.peekType(n) & NUMBER) {\n digitFound = true\n n++\n } else if (this.peek(n) === '.' && this.peek(n + 1) !== '.') {\n if (decimalFound || !digitFound) return\n decimalFound = true\n n++\n } else break\n }\n if (digitFound && !isWord(this.peek(n))) {\n const num = new NumberToken(this.input, this.p, this.p + n, this.file)\n this.advance(n)\n return num\n }\n }\n\n readLiteral (): LiteralToken | undefined {\n this.skipBlank()\n const end = this.matchTrie(this.literalTrie)\n if (end === -1) return\n const literal = new LiteralToken(this.input, this.p, end, this.file)\n this.p = end\n return literal\n }\n\n readRange (): RangeToken | undefined {\n this.skipBlank()\n const begin = this.p\n if (this.peek() !== '(') return\n ++this.p\n const lhs = this.readValueOrThrow()\n this.skipBlank()\n this.assert(this.read() === '.' && this.read() === '.', 'invalid range syntax')\n const rhs = this.readValueOrThrow()\n this.skipBlank()\n this.assert(this.read() === ')', 'invalid range syntax')\n return new RangeToken(this.input, begin, this.p, lhs, rhs, this.file)\n }\n\n readValueOrThrow (): ValueToken {\n const value = this.readValue()\n this.assert(value, () => `unexpected token ${this.snapshot()}, value expected`)\n return value!\n }\n\n readQuoted (): QuotedToken | undefined {\n this.skipBlank()\n const begin = this.p\n if (!(this.peekType() & QUOTE)) return\n ++this.p\n let escaped = false\n while (this.p < this.N) {\n ++this.p\n if (this.input[this.p - 1] === this.input[begin] && !escaped) break\n if (escaped) escaped = false\n else if (this.input[this.p - 1] === '\\\\') escaped = true\n }\n return new QuotedToken(this.input, begin, this.p, this.file)\n }\n\n * readFileNameTemplate (options: NormalizedFullOptions): IterableIterator {\n const { outputDelimiterLeft } = options\n const htmlStopStrings = [',', ' ', '\\r', '\\n', '\\t', outputDelimiterLeft]\n const htmlStopStringSet = new Set(htmlStopStrings)\n // break on ',' and ' ', outputDelimiterLeft only stops HTML token\n while (this.p < this.N && !htmlStopStringSet.has(this.peek())) {\n yield this.match(outputDelimiterLeft)\n ? this.readOutputToken(options)\n : this.readHTMLToken(htmlStopStrings)\n }\n }\n\n match (word: string) {\n for (let i = 0; i < word.length; i++) {\n if (word[i] !== this.input[this.p + i]) return false\n }\n return true\n }\n\n rmatch (pattern: string) {\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[pattern.length - 1 - i] !== this.input[this.p - 1 - i]) return false\n }\n return true\n }\n\n peekType (n = 0) {\n return this.p + n >= this.N ? 0 : TYPES[this.input.charCodeAt(this.p + n)]\n }\n\n peek (n = 0): string {\n return this.p + n >= this.N ? '' : this.input[this.p + n]\n }\n\n skipBlank () {\n while (this.peekType() & BLANK) ++this.p\n }\n}\n","import { Token, TopLevelToken } from '../tokens'\nimport { Template } from '../template'\nimport { isTagToken } from '../util'\n\ntype ParseToken = ((token: T, remainTokens: T[]) => Template)\n\nexport class ParseStream {\n private tokens: T[]\n private handlers: Record void> = {}\n private stopRequested = false\n private parseToken: ParseToken\n\n public constructor (tokens: T[], parseToken: ParseToken) {\n this.tokens = tokens\n this.parseToken = parseToken\n }\n public on (name: string, cb: (this: ParseStream, arg: T2) => void): ParseStream {\n this.handlers[name] = cb\n return this\n }\n private trigger (event: string, arg?: T) {\n const h = this.handlers[event]\n return h ? (h.call(this, arg), true) : false\n }\n public start () {\n this.trigger('start')\n let token: T | undefined\n while (!this.stopRequested && (token = this.tokens.shift())) {\n if (this.trigger('token', token)) continue\n if (isTagToken(token) && this.trigger(`tag:${token.name}`, token)) {\n continue\n }\n const template = this.parseToken(token, this.tokens)\n this.trigger('template', template)\n }\n if (!this.stopRequested) this.trigger('end')\n return this\n }\n public stop () {\n this.stopRequested = true\n return this\n }\n}\n","export abstract class TemplateImpl {\n public token: T;\n public constructor (token: T) {\n this.token = token\n }\n}\n","import { TemplateImpl } from './template-impl'\nimport type { Emitter } from '../emitters/emitter'\nimport type { Parser, Tokenizer } from '../parser'\nimport type { Context } from '../context/context'\nimport type { TopLevelToken, TagToken } from '../tokens'\nimport type { Template } from './template'\nimport type { Liquid } from '../liquid'\n\nexport type TagRenderReturn = Generator | Promise | unknown\n\nexport abstract class Tag extends TemplateImpl implements Template {\n public name: string\n public liquid: Liquid\n protected tokenizer: Tokenizer\n\n public constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token)\n this.name = token.name\n this.liquid = liquid\n this.tokenizer = token.tokenizer\n }\n public abstract render (ctx: Context, emitter: Emitter): TagRenderReturn;\n}\n\nexport interface TagClass {\n new(token: TagToken, tokens: TopLevelToken[], liquid: Liquid, parser: Parser): Tag\n}\n","import { evalToken } from '../render/expression'\nimport { Context } from '../context/context'\nimport { Tokenizer } from '../parser/tokenizer'\nimport { Token } from '../tokens/token'\n\ntype HashValueTokens = Record\n\n/**\n * Key-Value Pairs Representing Tag Arguments\n * Example:\n * For the markup `, foo:'bar', coo:2 reversed %}`,\n * hash['foo'] === 'bar'\n * hash['coo'] === 2\n * hash['reversed'] === undefined\n */\nexport class Hash {\n hash: HashValueTokens = {}\n\n constructor (input: string | Tokenizer, jekyllStyle?: boolean | string) {\n const tokenizer = input instanceof Tokenizer ? input : new Tokenizer(input, {})\n for (const hash of tokenizer.readHashes(jekyllStyle)) {\n this.hash[hash.name.content] = hash.value\n }\n }\n\n * render (ctx: Context): Generator, unknown> {\n const hash: Record = {}\n for (const key of Object.keys(this.hash)) {\n hash[key] = this.hash[key] === undefined ? true : yield evalToken(this.hash[key], ctx)\n }\n return hash\n }\n}\n","import { isArray } from '../util/underscore'\nimport { ValueToken } from '../tokens/value-token'\n\ntype KeyValuePair = [string?, ValueToken?]\n\nexport type FilterArg = ValueToken | KeyValuePair\n\nexport function isKeyValuePair (arr: FilterArg): arr is KeyValuePair {\n return isArray(arr)\n}\n","import { evalToken } from '../render'\nimport { Context } from '../context'\nimport { identify, isFunction } from '../util/underscore'\nimport { FilterHandler, FilterImplOptions } from './filter-impl-options'\nimport { FilterArg, isKeyValuePair } from '../parser/filter-arg'\nimport { Liquid } from '../liquid'\nimport { FilterToken } from '../tokens'\n\nexport class Filter {\n public name: string\n public args: FilterArg[]\n public readonly raw: boolean\n private handler: FilterHandler\n private liquid: Liquid\n private token: FilterToken\n\n public constructor (token: FilterToken, options: FilterImplOptions | undefined, liquid: Liquid) {\n this.token = token\n this.name = token.name\n this.handler = isFunction(options)\n ? options\n : (isFunction(options?.handler) ? options!.handler : identify)\n this.raw = !isFunction(options) && !!options?.raw\n this.args = token.args\n this.liquid = liquid\n }\n public * render (value: any, context: Context): IterableIterator {\n const argv: any[] = []\n for (const arg of this.args as FilterArg[]) {\n if (isKeyValuePair(arg)) argv.push([arg[0], yield evalToken(arg[1], context)])\n else argv.push(yield evalToken(arg, context))\n }\n return yield this.handler.apply({ context, token: this.token, liquid: this.liquid }, [value, ...argv])\n }\n}\n","import { Filter } from './filter'\nimport { Expression } from '../render'\nimport { Tokenizer } from '../parser'\nimport { assert } from '../util'\nimport type { FilteredValueToken } from '../tokens'\nimport type { Liquid } from '../liquid'\nimport type { Context } from '../context'\n\nexport class Value {\n public readonly filters: Filter[] = []\n public readonly initial: Expression\n\n /**\n * @param str the value to be valuated, eg.: \"foobar\" | truncate: 3\n */\n public constructor (input: string | FilteredValueToken, liquid: Liquid) {\n const token: FilteredValueToken = typeof input === 'string'\n ? new Tokenizer(input, liquid.options.operators).readFilteredValue()\n : input\n this.initial = token.initial\n this.filters = token.filters.map(token => new Filter(token, this.getFilter(liquid, token.name), liquid))\n }\n\n public * value (ctx: Context, lenient?: boolean): Generator {\n lenient = lenient || (ctx.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === 'default')\n let val = yield this.initial.evaluate(ctx, lenient)\n\n for (const filter of this.filters) {\n val = yield filter.render(val, ctx)\n }\n return val\n }\n\n private getFilter (liquid: Liquid, name: string) {\n const impl = liquid.filters[name]\n assert(impl || !liquid.options.strictFilters, () => `undefined filter: ${name}`)\n return impl\n }\n}\n","import { Value } from './value'\nimport { Arguments, Template, TemplateImpl } from '../template'\nimport { Context } from '../context/context'\nimport { Emitter } from '../emitters/emitter'\nimport { OutputToken } from '../tokens/output-token'\nimport { Tokenizer } from '../parser'\nimport { Liquid } from '../liquid'\nimport { Filter } from './filter'\nimport { FilterToken } from '../tokens'\n\nexport class Output extends TemplateImpl implements Template {\n value: Value\n public constructor (token: OutputToken, liquid: Liquid) {\n super(token)\n const tokenizer = new Tokenizer(token.input, liquid.options.operators, token.file, token.contentRange)\n this.value = new Value(tokenizer.readFilteredValue(), liquid)\n const filters = this.value.filters\n const outputEscape = liquid.options.outputEscape\n if (!filters[filters.length - 1]?.raw && outputEscape) {\n const token = new FilterToken(toString.call(outputEscape), [], '', 0, 0)\n filters.push(new Filter(token, outputEscape, liquid))\n }\n }\n public * render (ctx: Context, emitter: Emitter): IterableIterator {\n const val = yield this.value.value(ctx, false)\n emitter.write(val)\n }\n\n public * arguments (): Arguments {\n yield this.value\n }\n}\n","import { TemplateImpl, Template } from '../template'\nimport { HTMLToken } from '../tokens'\nimport { Context } from '../context'\nimport { Emitter } from '../emitters'\n\nexport class HTML extends TemplateImpl implements Template {\n private str: string\n public constructor (token: HTMLToken) {\n super(token)\n this.str = token.getContent()\n }\n public * render (ctx: Context, emitter: Emitter): IterableIterator {\n emitter.write(this.str)\n }\n}\n","import { Argument, Template, Value } from '.'\nimport { isKeyValuePair } from '../parser/filter-arg'\nimport { PropertyAccessToken, ValueToken } from '../tokens'\nimport {\n isNumberToken,\n isPropertyAccessToken,\n isQuotedToken,\n isRangeToken,\n isString,\n isValueToken,\n isWordToken,\n toPromise,\n toValueSync\n} from '../util'\n\n/**\n * Row, column and file name where a variable was found.\n */\nexport interface VariableLocation {\n row: number;\n col: number;\n file?: string;\n}\n\n/**\n * A variable's segments as an array, possibly with nested arrays of segments.\n */\nexport type SegmentArray = Array\n\n/**\n * A variable's segments and location, which can be coerced to a string.\n */\nexport class Variable {\n constructor (\n readonly segments: Array,\n readonly location: VariableLocation\n ) {}\n\n public toString (): string {\n return segmentsString(this.segments, true)\n }\n\n /** Return this variable's segments as an array, possibly with nested arrays for nested paths. */\n public toArray (): SegmentArray {\n function * _visit (...segments: Array): Generator {\n for (const segment of segments) {\n if (segment instanceof Variable) {\n yield Array.from(_visit(...segment.segments))\n } else {\n yield segment\n }\n }\n }\n return Array.from(_visit(...this.segments))\n }\n}\n\n/**\n * Property names and array indexes that make up a path to a variable.\n */\nexport type VariableSegments = Array;\n\n/**\n * A mapping of variable names to an array of locations at which the variable was found.\n */\nexport type Variables = { [key: string]: Variable[] };\n\n/**\n * Group variables by the string representation of their root segment.\n */\nexport class VariableMap {\n private map: Map\n\n constructor () {\n this.map = new Map()\n }\n\n public get (key: Variable): Variable[] {\n const k = segmentsString([key.segments[0]])\n if (!this.map.has(k)) {\n this.map.set(k, [])\n }\n return this.map.get(k) as Variable[]\n }\n\n public has (key: Variable): boolean {\n return this.map.has(segmentsString([key.segments[0]]))\n }\n\n public push (variable: Variable): void {\n this.get(variable).push(variable)\n }\n\n public asObject (): Variables {\n return Object.fromEntries(this.map)\n }\n}\n\n/**\n * The result of calling `analyze()` or `analyzeSync()`.\n */\nexport interface StaticAnalysis {\n /**\n * All variables, whether they are in scope or not. Including references to names\n * such as `forloop` from the `for` tag.\n */\n variables: Variables;\n\n /**\n * Variables that are not in scope. These could be a \"global\" variables that are\n * expected to be provided by the application developer, or possible mistakes\n * from the template author.\n *\n * If a variable is referenced before and after assignment, you should expect\n * that variable to be included in `globals`, `variables` and `locals`, each with\n * a different location.\n */\n globals: Variables;\n\n /**\n * Template variables that are added to the template local scope using tags like\n * `assign`, `capture` or `increment`.\n */\n locals: Variables;\n}\n\nexport interface StaticAnalysisOptions {\n /**\n * When `true` (the default), try to load partial templates and analyze them too.\n */\n partials?: boolean;\n}\n\nexport const defaultStaticAnalysisOptions: StaticAnalysisOptions = {\n partials: true\n}\n\nfunction * _analyze (templates: Template[], partials: boolean, sync: boolean): Generator {\n const variables = new VariableMap()\n const globals = new VariableMap()\n const locals = new VariableMap()\n\n const rootScope = new DummyScope(new Set())\n\n // Names of partial templates that we've already analyzed.\n const seen: Set = new Set()\n\n function updateVariables (variable: Variable, scope: DummyScope) {\n variables.push(variable)\n const aliased = scope.alias(variable)\n\n if (aliased !== undefined) {\n const root = aliased.segments[0]\n // TODO: What if a a template renders a rendered template? Do we need scope.parent?\n if (isString(root) && !rootScope.has(root)) {\n globals.push(aliased)\n }\n } else {\n const root = variable.segments[0]\n if (isString(root) && !scope.has(root)) {\n globals.push(variable)\n }\n }\n\n // Recurse for nested Variables\n for (const segment of variable.segments) {\n if (segment instanceof Variable) {\n updateVariables(segment, scope)\n }\n }\n }\n\n function * visit (template: Template, scope: DummyScope): Generator {\n if (template.arguments) {\n for (const arg of template.arguments()) {\n for (const variable of extractVariables(arg)) {\n updateVariables(variable, scope)\n }\n }\n }\n\n if (template.localScope) {\n for (const ident of template.localScope()) {\n scope.add(ident.content)\n scope.deleteAlias(ident.content)\n const [row, col] = ident.getPosition()\n locals.push(new Variable([ident.content], { row, col, file: ident.file }))\n }\n }\n\n if (template.children) {\n if (template.partialScope) {\n const partial = template.partialScope()\n\n if (partial === undefined) {\n // Layouts, for example, can have children that are not partials.\n for (const child of (yield template.children(partials, sync)) as Template[]) {\n yield visit(child, scope)\n }\n return\n }\n\n if (seen.has(partial.name)) return\n\n const partialScopeNames: Set = new Set()\n const partialScope = partial.isolated\n ? new DummyScope(partialScopeNames)\n : scope.push(partialScopeNames)\n\n for (const name of partial.scope) {\n if (isString(name)) {\n partialScopeNames.add(name)\n } else {\n const [alias, argument] = name\n partialScopeNames.add(alias)\n const variables = Array.from(extractVariables(argument))\n if (variables.length) {\n partialScope.setAlias(alias, variables[0].segments)\n }\n }\n }\n\n for (const child of (yield template.children(partials, sync)) as Template[]) {\n yield visit(child, partialScope)\n seen.add(partial.name)\n }\n\n partialScope.pop()\n } else {\n if (template.blockScope) {\n scope.push(new Set(template.blockScope()))\n }\n\n for (const child of (yield template.children(partials, sync)) as Template[]) {\n yield visit(child, scope)\n }\n\n if (template.blockScope) {\n scope.pop()\n }\n }\n }\n }\n\n for (const template of templates) {\n yield visit(template, rootScope)\n }\n\n return {\n variables: variables.asObject(),\n globals: globals.asObject(),\n locals: locals.asObject()\n }\n}\n\n/**\n * Statically analyze a template and report variable usage.\n */\nexport function analyze (template: Template[], options: StaticAnalysisOptions = {}): Promise {\n const opts = { ...defaultStaticAnalysisOptions, ...options } as Required\n return toPromise(_analyze(template, opts.partials, false))\n}\n\n/**\n * Statically analyze a template and report variable usage.\n */\nexport function analyzeSync (template: Template[], options: StaticAnalysisOptions = {}): StaticAnalysis {\n const opts = { ...defaultStaticAnalysisOptions, ...options } as Required\n return toValueSync(_analyze(template, opts.partials, true))\n}\n\ninterface ScopeStackItem {\n names: Set;\n aliases: Map;\n}\n\n/**\n * A stack to manage scopes while traversing templates during static analysis.\n */\nclass DummyScope {\n private stack: Array\n\n constructor (globals: Set) {\n this.stack = [{ names: globals, aliases: new Map() }]\n }\n\n /** Return true if `name` is in scope. */\n public has (name: string): boolean {\n for (const scope of this.stack) {\n if (scope.names.has(name)) {\n return true\n }\n }\n return false\n }\n\n public push (scope: Set): DummyScope {\n this.stack.push({ names: scope, aliases: new Map() })\n return this\n }\n\n public pop (): Set | undefined {\n return this.stack.pop()?.names\n }\n\n // Add a name to the template scope.\n public add (name: string): void {\n this.stack[0].names.add(name)\n }\n\n /** Return the variable that `variable` aliases, or `variable` if it doesn't alias anything. */\n public alias (variable: Variable): Variable | undefined {\n const root = variable.segments[0]\n if (!isString(root)) return undefined\n const alias = this.getAlias(root)\n if (alias === undefined) return undefined\n return new Variable([...alias, ...variable.segments.slice(1)], variable.location)\n }\n\n // TODO: `from` could be a path with multiple segments, like `include.x`.\n public setAlias (from: string, to: VariableSegments): void {\n this.stack[this.stack.length - 1].aliases.set(from, to)\n }\n\n public deleteAlias (name: string): void {\n this.stack[this.stack.length - 1].aliases.delete(name)\n }\n\n private getAlias (name: string): VariableSegments | undefined {\n for (const scope of this.stack) {\n if (scope.aliases.has(name)) {\n return scope.aliases.get(name)\n }\n\n // If a scope has defined `name`, then it masks aliases in parent scopes.\n if (scope.names.has(name)) {\n return undefined\n }\n }\n return undefined\n }\n}\n\nfunction * extractVariables (value: Argument): Generator {\n if (isValueToken(value)) {\n yield * extractValueTokenVariables(value)\n } else if (value instanceof Value) {\n yield * extractFilteredValueVariables(value)\n }\n}\n\nfunction * extractFilteredValueVariables (value: Value): Generator {\n for (const token of value.initial.postfix) {\n if (isValueToken(token)) {\n yield * extractValueTokenVariables(token)\n }\n }\n\n for (const filter of value.filters) {\n for (const arg of filter.args) {\n if (isKeyValuePair(arg) && arg[1]) {\n yield * extractValueTokenVariables(arg[1])\n } else if (isValueToken(arg)) {\n yield * extractValueTokenVariables(arg)\n }\n }\n }\n}\n\nfunction * extractValueTokenVariables (token: ValueToken): Generator {\n if (isRangeToken(token)) {\n yield * extractValueTokenVariables(token.lhs)\n yield * extractValueTokenVariables(token.rhs)\n } else if (isPropertyAccessToken(token)) {\n yield extractPropertyAccessVariable(token)\n }\n}\n\nfunction extractPropertyAccessVariable (token: PropertyAccessToken): Variable {\n const segments: VariableSegments = []\n\n // token is not guaranteed to have `file` set. We'll try to get it from a prop if not.\n let file: string | undefined = token.file\n\n // Here we're flattening the first segment of a path if it is a nested path.\n const root = token.props[0]\n file = file || root.file\n if (isQuotedToken(root) || isNumberToken(root) || isWordToken(root)) {\n segments.push(root.content)\n } else if (isPropertyAccessToken(root)) {\n // Flatten paths that start with a nested path.\n segments.push(...extractPropertyAccessVariable(root).segments)\n }\n\n for (const prop of token.props.slice(1)) {\n file = file || prop.file\n if (isQuotedToken(prop) || isNumberToken(prop) || isWordToken(prop)) {\n segments.push(prop.content)\n } else if (isPropertyAccessToken(prop)) {\n segments.push(extractPropertyAccessVariable(prop))\n }\n }\n\n const [row, col] = token.getPosition()\n return new Variable(segments, {\n row,\n col,\n file\n })\n}\n\n// This is used to detect segments that can be represented with dot notation\n// when creating a string representation of VariableSegments.\nconst RE_PROPERTY = /^[\\u0080-\\uFFFFa-zA-Z_][\\u0080-\\uFFFFa-zA-Z0-9_-]*$/\n\n/**\n * Return a string representation of segments using dot notation where possible.\n * @param segments - The property names and array indices that make up a path to a variable.\n * @param bracketedRoot - If false (the default), don't surround the root segment with square brackets.\n */\nfunction segmentsString (segments: VariableSegments, bracketedRoot = false): string {\n const buf: string[] = []\n\n const root = segments[0]\n if (isString(root)) {\n if (!bracketedRoot || root.match(RE_PROPERTY)) {\n buf.push(`${root}`)\n } else {\n buf.push(`['${root}']`)\n }\n }\n\n for (const segment of segments.slice(1)) {\n if (segment instanceof Variable) {\n buf.push(`[${segmentsString(segment.segments)}]`)\n } else if (isString(segment)) {\n if (segment.match(RE_PROPERTY)) {\n buf.push(`.${segment}`)\n } else {\n buf.push(`['${segment}']`)\n }\n } else {\n buf.push(`[${segment}]`)\n }\n }\n\n return buf.join('')\n}\n","import { FS } from './fs'\nimport { assert, LiquidAsync, toLiquidAsync } from '../util'\n\nexport interface LoaderOptions {\n fs: FS;\n extname: string;\n root: string[];\n partials: string[];\n layouts: string[];\n relativeReference: boolean;\n}\nexport enum LookupType {\n Partials = 'partials',\n Layouts = 'layouts',\n Root = 'root'\n}\nexport class Loader {\n public shouldLoadRelative: (referencedFile: string) => boolean\n private options: LoaderOptions\n private contains: LiquidAsync>\n private exists: LiquidAsync\n\n constructor (options: LoaderOptions) {\n this.options = options\n if (options.relativeReference) {\n const sep = options.fs.sep\n assert(sep, '`fs.sep` is required for relative reference')\n const prefixes = ['.' + sep, '..' + sep, './', '../']\n this.shouldLoadRelative = (referencedFile: string) => prefixes.some(prefix => referencedFile.startsWith(prefix))\n } else {\n this.shouldLoadRelative = (_referencedFile: string) => false\n }\n const fs = options.fs\n this.contains = toLiquidAsync(\n fs.contains?.bind(fs) || (async () => true),\n fs.containsSync?.bind(fs) || (() => true)\n )\n this.exists = toLiquidAsync(\n fs.exists?.bind(fs) || (async () => false),\n fs.existsSync?.bind(fs)\n )\n }\n\n public * lookup (file: string, type: LookupType, sync?: boolean, currentFile?: string): Generator {\n const dirs = this.options[type]\n for (const filepath of this.candidates(file, dirs, currentFile)) {\n let allowed = false\n for (const dir of dirs) {\n if (yield this.contains(!!sync, dir, filepath)) { allowed = true; break }\n }\n if (!allowed) continue\n if (yield this.exists(!!sync, filepath)) return filepath\n }\n throw this.lookupError(file, dirs)\n }\n\n public * candidates (file: string, dirs: string[], currentFile?: string) {\n const { fs, extname } = this.options\n\n if (this.shouldLoadRelative(file) && currentFile) {\n const referenced = fs.resolve(this.dirname(currentFile), file, extname)\n yield referenced\n }\n for (const dir of dirs) {\n const referenced = fs.resolve(dir, file, extname)\n yield referenced\n }\n\n if (fs.fallback !== undefined) {\n const filepath = fs.fallback(file)\n if (filepath !== undefined) yield filepath\n }\n }\n\n private dirname (path: string) {\n const fs = this.options.fs\n assert(fs.dirname, '`fs.dirname` is required for relative reference')\n return fs.dirname!(path)\n }\n\n private lookupError (file: string, roots: string[]) {\n const err = new Error('ENOENT') as any\n err.message = `ENOENT: Failed to lookup \"${file}\" in \"${roots}\"`\n err.code = 'ENOENT'\n return err\n }\n}\n","import { Limiter, toPromise, assert, isTagToken, isOutputToken, ParseError, toLiquidAsync, LiquidAsync } from '../util'\nimport { Tokenizer } from './tokenizer'\nimport { ParseStream } from './parse-stream'\nimport { TopLevelToken, OutputToken } from '../tokens'\nimport { Template, Output, HTML } from '../template'\nimport { LiquidCache } from '../cache'\nimport { FS, Loader, LookupType } from '../fs'\nimport { LiquidError, LiquidErrors } from '../util/error'\nimport type { Liquid } from '../liquid'\n\nexport class Parser {\n public parseFile: (file: string, sync?: boolean, type?: LookupType, currentFile?: string) => Generator\n\n private liquid: Liquid\n private fs: FS\n private cache?: LiquidCache\n private loader: Loader\n private parseLimit: Limiter\n private readFile: LiquidAsync\n\n public constructor (liquid: Liquid) {\n this.liquid = liquid\n this.cache = this.liquid.options.cache\n this.fs = this.liquid.options.fs\n this.parseFile = this.cache ? this._parseFileCached : this._parseFile\n this.loader = new Loader(this.liquid.options)\n this.parseLimit = new Limiter('parse length', liquid.options.parseLimit)\n this.readFile = toLiquidAsync(\n this.fs.readFile?.bind(this.fs) || (async () => { throw new Error('readFile not implemented') }),\n this.fs.readFileSync?.bind(this.fs)\n )\n }\n public parse (html: string, filepath?: string): Template[] {\n html = String(html)\n this.parseLimit.use(html.length)\n const tokenizer = new Tokenizer(html, this.liquid.options.operators, filepath)\n const tokens = tokenizer.readTopLevelTokens(this.liquid.options)\n return this.parseTokens(tokens)\n }\n public parseTokens (tokens: TopLevelToken[]) {\n let token\n const templates: Template[] = []\n const errors: LiquidError[] = []\n while ((token = tokens.shift())) {\n try {\n templates.push(this.parseToken(token, tokens))\n } catch (err) {\n if (this.liquid.options.catchAllErrors) errors.push(err as LiquidError)\n else throw err\n }\n }\n if (errors.length) throw new LiquidErrors(errors)\n return templates\n }\n public parseToken (token: TopLevelToken, remainTokens: TopLevelToken[]) {\n try {\n if (isTagToken(token)) {\n const TagClass = this.liquid.tags[token.name]\n assert(TagClass, `tag \"${token.name}\" not found`)\n return new TagClass(token, remainTokens, this.liquid, this)\n }\n if (isOutputToken(token)) {\n return new Output(token as OutputToken, this.liquid)\n }\n return new HTML(token)\n } catch (e) {\n if (LiquidError.is(e)) throw e\n throw new ParseError(e as Error, token)\n }\n }\n public parseStream (tokens: TopLevelToken[]) {\n return new ParseStream(tokens, (token, tokens) => this.parseToken(token, tokens))\n }\n private * _parseFileCached (file: string, sync?: boolean, type: LookupType = LookupType.Root, currentFile?: string): Generator {\n const cache = this.cache!\n const key = this.loader.shouldLoadRelative(file) ? currentFile + ',' + file : type + ':' + file\n const tpls = yield cache.read(key)\n if (tpls) return tpls\n\n const task = this._parseFile(file, sync, type, currentFile)\n // sync mode: exec the task and cache the result\n // async mode: cache the task before exec\n const taskOrTpl = sync ? yield task : toPromise(task)\n cache.write(key, taskOrTpl as any)\n // note: concurrent tasks will be reused, cache for failed task is removed until its end\n try { return yield taskOrTpl } catch (err) { cache.remove(key); throw err }\n }\n private * _parseFile (file: string, sync?: boolean, type: LookupType = LookupType.Root, currentFile?: string): Generator {\n const filepath = yield this.loader.lookup(file, type, sync, currentFile)\n return this.parse(yield this.readFile(!!sync, filepath), filepath)\n }\n}\n","import { RangeToken, NumberToken, QuotedToken, LiteralToken, PropertyAccessToken, OutputToken, HTMLToken, TagToken, IdentifierToken, DelimitedToken, OperatorToken, ValueToken } from '../tokens'\nimport { TokenKind } from '../parser'\n\nexport function isDelimitedToken (val: any): val is DelimitedToken {\n return !!(getKind(val) & TokenKind.Delimited)\n}\n\nexport function isOperatorToken (val: any): val is OperatorToken {\n return getKind(val) === TokenKind.Operator\n}\n\nexport function isHTMLToken (val: any): val is HTMLToken {\n return getKind(val) === TokenKind.HTML\n}\n\nexport function isOutputToken (val: any): val is OutputToken {\n return getKind(val) === TokenKind.Output\n}\n\nexport function isTagToken (val: any): val is TagToken {\n return getKind(val) === TokenKind.Tag\n}\n\nexport function isQuotedToken (val: any): val is QuotedToken {\n return getKind(val) === TokenKind.Quoted\n}\n\nexport function isLiteralToken (val: any): val is LiteralToken {\n return getKind(val) === TokenKind.Literal\n}\n\nexport function isNumberToken (val: any): val is NumberToken {\n return getKind(val) === TokenKind.Number\n}\n\nexport function isPropertyAccessToken (val: any): val is PropertyAccessToken {\n return getKind(val) === TokenKind.PropertyAccess\n}\n\nexport function isWordToken (val: any): val is IdentifierToken {\n return getKind(val) === TokenKind.Word\n}\n\nexport function isRangeToken (val: any): val is RangeToken {\n return getKind(val) === TokenKind.Range\n}\n\nexport function isValueToken (val: any): val is ValueToken {\n // valueTokenBitMask = TokenKind.Number | TokenKind.Literal | TokenKind.Quoted | TokenKind.PropertyAccess | TokenKind.Range\n return (getKind(val) & 1667) > 0\n}\n\nfunction getKind (val: any) {\n return val ? val.kind : -1\n}\n","export enum TokenKind {\n Number = 1,\n Literal = 2,\n Tag = 4,\n Output = 8,\n HTML = 16,\n Filter = 32,\n Hash = 64,\n PropertyAccess = 128,\n Word = 256,\n Range = 512,\n Quoted = 1024,\n Operator = 2048,\n FilteredValue = 4096,\n Delimited = Tag | Output\n}\n","import { Drop } from '../drop/drop'\n\nexport interface ScopeObject extends Record {\n toLiquid?: () => any;\n}\n\nexport type Scope = ScopeObject | Drop\n\nexport function createScope (from?: ScopeObject): ScopeObject {\n const scope = Object.create(null)\n if (from) Object.assign(scope, from)\n return scope\n}\n","import { getPerformance } from '../util/performance'\nimport { Drop } from '../drop/drop'\nimport { __assign } from 'tslib'\nimport { NormalizedFullOptions, defaultOptions, RenderOptions } from '../liquid-options'\nimport { createScope, Scope } from './scope'\nimport { hasOwnProperty, isArray, isNil, isUndefined, isString, isFunction, isNumber, toLiquid, InternalUndefinedVariableError, toValueSync, isObject, Limiter, toValue, readArrayElement } from '../util'\n\ntype PropertyKey = string | number;\n\nexport class Context {\n /**\n * insert a Context-level empty scope,\n * for tags like `{% capture %}` `{% assign %}` to operate\n */\n private scopes: Scope[] = [createScope()]\n private registers: Record = {}\n /**\n * user passed in scope\n * `{% increment %}`, `{% decrement %}` changes this scope,\n * whereas `{% capture %}`, `{% assign %}` only hide this scope\n */\n public environments: Scope\n /**\n * global scope used as fallback for missing variables\n */\n public globals: Scope\n public sync: boolean\n public breakCalled = false\n public continueCalled = false\n /**\n * The normalized liquid options object\n */\n public opts: NormalizedFullOptions\n /**\n * Throw when accessing undefined variable?\n */\n public strictVariables: boolean;\n public ownPropertyOnly: boolean;\n public memoryLimit: Limiter;\n public renderLimit: Limiter;\n public constructor (env: object = {}, opts: NormalizedFullOptions = defaultOptions, renderOptions: RenderOptions = {}, { memoryLimit, renderLimit }: { [key: string]: Limiter } = {}) {\n this.sync = !!renderOptions.sync\n this.opts = opts\n this.globals = renderOptions.globals ?? opts.globals\n this.environments = isObject(env) ? env : Object(env)\n this.strictVariables = renderOptions.strictVariables ?? this.opts.strictVariables\n this.ownPropertyOnly = renderOptions.ownPropertyOnly ?? opts.ownPropertyOnly\n this.memoryLimit = memoryLimit ?? new Limiter('memory alloc', renderOptions.memoryLimit ?? opts.memoryLimit)\n this.renderLimit = renderLimit ?? new Limiter('template render', getPerformance().now() + (renderOptions.renderLimit ?? opts.renderLimit))\n }\n public getRegister (key: string, defaultValue: T = undefined as T): T {\n return (this.registers[key] = this.registers[key] || defaultValue)\n }\n public setRegister (key: string, value: any) {\n return (this.registers[key] = value)\n }\n public saveRegister (...keys: string[]): [string, any][] {\n return keys.map(key => [key, this.getRegister(key)])\n }\n public restoreRegister (keyValues: [string, any][]) {\n return keyValues.forEach(([key, value]) => this.setRegister(key, value))\n }\n public getAll () {\n return [this.globals, this.environments, ...this.scopes]\n .reduce((ctx, val) => __assign(ctx, val), {})\n }\n /**\n * @deprecated use `_get()` or `getSync()` instead\n */\n public get (paths: PropertyKey[]): unknown {\n return this.getSync(paths)\n }\n public getSync (paths: PropertyKey[]): unknown {\n return toValueSync(this._get(paths))\n }\n public * _get (paths: (PropertyKey | Drop)[]): IterableIterator {\n const scope = this.findScope(paths[0] as string) // first prop should always be a string\n return yield this._getFromScope(scope, paths)\n }\n /**\n * @deprecated use `_get()` instead\n */\n public getFromScope (scope: unknown, paths: PropertyKey[] | string): IterableIterator {\n return toValueSync(this._getFromScope(scope, paths))\n }\n public * _getFromScope (scope: unknown, paths: (PropertyKey | Drop)[] | string, strictVariables = this.strictVariables): IterableIterator {\n if (isString(paths)) paths = paths.split('.')\n for (let i = 0; i < paths.length; i++) {\n scope = yield this.readProperty(scope as object, paths[i])\n if (strictVariables && isUndefined(scope)) {\n throw new InternalUndefinedVariableError((paths as string[]).slice(0, i + 1).join!('.'))\n }\n }\n return scope\n }\n public push (ctx: object) {\n return this.scopes.push(ctx)\n }\n public pop () {\n return this.scopes.pop()\n }\n public bottom () {\n return this.scopes[0]\n }\n public spawn (scope = {}) {\n return new Context(scope, this.opts, {\n sync: this.sync,\n globals: this.globals,\n strictVariables: this.strictVariables,\n ownPropertyOnly: this.ownPropertyOnly\n }, {\n renderLimit: this.renderLimit,\n memoryLimit: this.memoryLimit\n })\n }\n private findScope (key: string | number) {\n for (let i = this.scopes.length - 1; i >= 0; i--) {\n const candidate = this.scopes[i]\n if (key in candidate) return candidate\n }\n if (key in this.environments) return this.environments\n return this.globals\n }\n readProperty (obj: Scope, key: (PropertyKey | Drop)) {\n obj = toLiquid(obj)\n key = toValue(key) as PropertyKey\n if (isNil(obj)) return obj\n if (isArray(obj) && isNumber(key)) return readArrayElement(obj, key, this.ownPropertyOnly)\n const value = readJSProperty(obj, key, this.ownPropertyOnly)\n if (value === undefined && obj instanceof Drop) return obj.liquidMethodMissing(key, this)\n if (isFunction(value)) return value.call(obj)\n if (key === 'size') return readSize(obj)\n else if (key === 'first') return readFirst(obj, this.ownPropertyOnly)\n else if (key === 'last') return readLast(obj, this.ownPropertyOnly)\n return value\n }\n}\n\nexport function readJSProperty (obj: Scope, key: PropertyKey, ownPropertyOnly: boolean) {\n if (ownPropertyOnly && !hasOwnProperty.call(obj, key) && !(obj instanceof Drop)) return undefined\n return obj[key]\n}\n\nfunction readFirst (obj: Scope, ownPropertyOnly: boolean) {\n if (isArray(obj)) return readArrayElement(obj, 0, ownPropertyOnly)\n return readJSProperty(obj, 'first', ownPropertyOnly)\n}\n\nfunction readLast (obj: Scope, ownPropertyOnly: boolean) {\n if (isArray(obj)) return readArrayElement(obj, -1, ownPropertyOnly)\n return readJSProperty(obj, 'last', ownPropertyOnly)\n}\n\nfunction readSize (obj: Scope) {\n if (hasOwnProperty.call(obj, 'size') || obj['size'] !== undefined) return obj['size']\n if (isArray(obj) || isString(obj)) return obj.length\n if (typeof obj === 'object') return Object.keys(obj).length\n}\n","export enum BlockMode {\n /* store rendered html into blocks */\n OUTPUT,\n /* output rendered html directly */\n STORE\n}\n","import { toNumber, argumentsToNumber } from '../util/underscore'\n\nexport const abs = argumentsToNumber(Math.abs)\nexport const at_least = argumentsToNumber(Math.max)\nexport const at_most = argumentsToNumber(Math.min)\nexport const ceil = argumentsToNumber(Math.ceil)\nexport const divided_by = argumentsToNumber((dividend: number, divisor: number, integerArithmetic = false) => integerArithmetic ? Math.floor(dividend / divisor) : dividend / divisor)\nexport const floor = argumentsToNumber(Math.floor)\nexport const minus = argumentsToNumber((v: number, arg: number) => v - arg)\nexport const plus = argumentsToNumber((lhs: number, rhs: number) => lhs + rhs)\nexport const modulo = argumentsToNumber((v: number, arg: number) => ((v % arg) + arg) % arg)\nexport const times = argumentsToNumber((v: number, arg: number) => v * arg)\n\nexport function round (v: number, arg = 0) {\n v = toNumber(v)\n arg = toNumber(arg)\n const amp = Math.pow(10, arg)\n const scaled = (v * amp) * (1 + Number.EPSILON)\n return Math.round(scaled) / amp\n}\n","import { stringify } from '../util/underscore'\n\nexport const url_decode = (x: string) => decodeURIComponent(stringify(x)).replace(/\\+/g, ' ')\nexport const url_encode = (x: string) => encodeURIComponent(stringify(x)).replace(/%20/g, '+')\nexport const cgi_escape = (x: string) => encodeURIComponent(stringify(x))\n .replace(/%20/g, '+')\n .replace(/[!'()*]/g, c => '%' + c.charCodeAt(0).toString(16).toUpperCase())\nexport const uri_escape = (x: string) => encodeURI(stringify(x))\n .replace(/%5B/g, '[')\n .replace(/%5D/g, ']')\n\nconst rSlugifyDefault = /[^\\p{M}\\p{L}\\p{Nd}]+/ug\nconst rSlugifyReplacers = {\n 'raw': /\\s+/g,\n 'default': rSlugifyDefault,\n 'pretty': /[^\\p{M}\\p{L}\\p{Nd}._~!$&'()+,;=@]+/ug,\n 'ascii': /[^A-Za-z0-9]+/g,\n 'latin': rSlugifyDefault,\n 'none': null\n}\n\nexport function slugify (str: string, mode: keyof typeof rSlugifyReplacers = 'default', cased = false): string {\n str = stringify(str)\n\n const replacer = rSlugifyReplacers[mode]\n if (replacer) {\n if (mode === 'latin') str = removeAccents(str)\n str = str.replace(replacer, '-').replace(/^-|-$/g, '')\n }\n\n return cased ? str : str.toLowerCase()\n}\n\nfunction removeAccents (str: string): string {\n return str.replace(/[àáâãäå]/g, 'a')\n .replace(/[æ]/g, 'ae')\n .replace(/[ç]/g, 'c')\n .replace(/[èéêë]/g, 'e')\n .replace(/[ìíîï]/g, 'i')\n .replace(/[ð]/g, 'd')\n .replace(/[ñ]/g, 'n')\n .replace(/[òóôõöø]/g, 'o')\n .replace(/[ùúûü]/g, 'u')\n .replace(/[ýÿ]/g, 'y')\n .replace(/[ß]/g, 'ss')\n .replace(/[œ]/g, 'oe')\n .replace(/[þ]/g, 'th')\n .replace(/[ẞ]/g, 'SS')\n .replace(/[Œ]/g, 'OE')\n .replace(/[Þ]/g, 'TH')\n}\n","import { toArray, argumentsToValue, toValue, stringify, caseInsensitiveCompare, orderedCompare, isArray, isNil, isArrayLike, readArrayElement, toEnumerable } from '../util'\nimport { arrayIncludes, equals, evalToken, isTruthy } from '../render'\nimport { Value, FilterImpl } from '../template'\nimport { Tokenizer } from '../parser'\nimport type { Scope } from '../context'\nimport { EmptyDrop } from '../drop'\n\nexport const join = argumentsToValue(function (this: FilterImpl, v: any[], arg: string) {\n const array = toArray(v)\n const sep = isNil(arg) ? ' ' : stringify(arg)\n let outputSize = sep.length * Math.max(array.length - 1, 0)\n for (let i = 0; i < array.length; i++) outputSize += String(array[i]).length\n this.context.memoryLimit.use(outputSize)\n return Array.prototype.join.call(array, sep)\n})\nexport const last = argumentsToValue(function (this: FilterImpl, v: any) {\n return isArrayLike(v) ? readArrayElement(v, -1, this.context.ownPropertyOnly) : ''\n})\nexport const first = argumentsToValue(function (this: FilterImpl, v: any) {\n return isArrayLike(v) ? readArrayElement(v, 0, this.context.ownPropertyOnly) : ''\n})\nexport const reverse = argumentsToValue(function (this: FilterImpl, v: any[]) {\n const array = toArray(v)\n this.context.memoryLimit.use(array.length)\n return [...array].reverse()\n})\n\nfunction * sortBy (this: FilterImpl, arr: T[], property: string | undefined, comparator: (a: unknown, b: unknown) => number): IterableIterator {\n const values: [T, unknown][] = []\n const array = toArray(arr)\n this.context.memoryLimit.use(array.length)\n for (const item of array) {\n values.push([\n item,\n property ? yield this.context._getFromScope(item, stringify(property).split('.'), false) : item\n ])\n }\n return values.sort((lhs, rhs) => comparator(lhs[1], rhs[1])).map(tuple => tuple[0])\n}\n\nexport function * sort (this: FilterImpl, arr: T[], property?: string): IterableIterator {\n return yield * sortBy.call(this, arr, property, orderedCompare)\n}\n\nexport function * sort_natural (this: FilterImpl, arr: T[], property?: string): IterableIterator {\n return yield * sortBy.call(this, arr, property, caseInsensitiveCompare)\n}\n\nexport const size = (v: string | any[]) => (v && v.length) || 0\n\nexport function * map (this: FilterImpl, arr: Scope[], property: string): IterableIterator {\n const results = []\n const array = toArray(arr)\n this.context.memoryLimit.use(array.length)\n for (const item of array) {\n results.push(yield this.context._getFromScope(item, stringify(property), false))\n }\n return results\n}\n\nexport function * sum (this: FilterImpl, arr: Scope[], property?: string): IterableIterator {\n let sum = 0\n const array = toArray(arr)\n for (const item of array) {\n const data = Number(property ? yield this.context._getFromScope(item, stringify(property), false) : item)\n sum += Number.isNaN(data) ? 0 : data\n }\n return sum\n}\n\nexport function compact (this: FilterImpl, arr: T[]) {\n const array = toArray(arr)\n this.context.memoryLimit.use(array.length)\n return Array.prototype.filter.call(array, x => !isNil(toValue(x)))\n}\n\nexport function concat (this: FilterImpl, v: T1[], arg: T2[] = []): (T1 | T2)[] {\n const lhs = toArray(v)\n const rhs = toArray(arg)\n this.context.memoryLimit.use(lhs.length + rhs.length)\n return Array.prototype.concat.call(lhs, rhs)\n}\n\nexport function push (this: FilterImpl, v: T[], arg: T): T[] {\n return concat.call(this, v, [arg]) as T[]\n}\n\nexport function unshift (this: FilterImpl, v: T[], arg: T): T[] {\n const array = toArray(v)\n this.context.memoryLimit.use(array.length)\n const clone = [...array]\n clone.unshift(arg)\n return clone\n}\n\nexport function pop (this: FilterImpl, v: T[]): T[] {\n const array = toArray(v)\n this.context.memoryLimit.use(array.length)\n const clone = [...array]\n clone.pop()\n return clone\n}\n\nexport function shift (this: FilterImpl, v: T[]): T[] {\n const array = toArray(v)\n this.context.memoryLimit.use(array.length)\n const clone = [...array]\n clone.shift()\n return clone\n}\n\nexport function slice (this: FilterImpl, v: T[] | string, begin: number, length = 1): T[] | string {\n v = toValue(v)\n if (isNil(v)) return []\n if (!isArray(v)) v = stringify(v)\n begin = begin < 0 ? v.length + begin : begin\n if (begin < 0 || length < 0) return isArray(v) ? [] : ''\n this.context.memoryLimit.use(length)\n return isArray(v)\n ? Array.prototype.slice.call(v, begin, begin + length)\n : String.prototype.slice.call(v, begin, begin + length)\n}\n\nfunction expectedMatcher (this: FilterImpl, expected: any): (v: any) => boolean {\n if (this.context.opts.jekyllWhere) {\n return (v: any) => EmptyDrop.is(expected) ? equals(v, expected) : (isArray(v) ? arrayIncludes(v, expected) : equals(v, expected))\n } else if (expected === undefined) {\n return (v: any) => isTruthy(v, this.context)\n } else {\n return (v: any) => equals(v, expected)\n }\n}\n\nfunction * filter (this: FilterImpl, include: boolean, arr: T[], property: string, expected: any): IterableIterator {\n const values: unknown[] = []\n arr = toArray(arr)\n this.context.memoryLimit.use(arr.length)\n const token = new Tokenizer(stringify(property)).readScopeValue()\n for (const item of arr) {\n values.push(yield evalToken(token, this.context.spawn(item)))\n }\n const matcher = expectedMatcher.call(this, expected)\n return Array.prototype.filter.call(arr, (_, i) => matcher(values[i]) === include)\n}\n\nfunction * filter_exp (this: FilterImpl, include: boolean, arr: T[], itemName: string, exp: string): IterableIterator {\n const filtered: unknown[] = []\n const keyTemplate = new Value(stringify(exp), this.liquid)\n const array = toArray(arr)\n this.context.memoryLimit.use(array.length)\n for (const item of array) {\n this.context.push({ [itemName]: item })\n const value = yield keyTemplate.value(this.context)\n this.context.pop()\n if (value === include) filtered.push(item)\n }\n return filtered\n}\n\nexport function * where (this: FilterImpl, arr: T[], property: string, expected?: any): IterableIterator {\n return yield * filter.call(this, true, arr, property, expected)\n}\n\nexport function * reject (this: FilterImpl, arr: T[], property: string, expected?: any): IterableIterator {\n return yield * filter.call(this, false, arr, property, expected)\n}\n\nexport function * where_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n return yield * filter_exp.call(this, true, arr, itemName, exp)\n}\n\nexport function * reject_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n return yield * filter_exp.call(this, false, arr, itemName, exp)\n}\n\nexport function * group_by (this: FilterImpl, arr: T[], property: string): IterableIterator {\n const map = new Map()\n arr = toEnumerable(arr)\n const token = new Tokenizer(stringify(property)).readScopeValue()\n this.context.memoryLimit.use(arr.length)\n for (const item of arr) {\n const key = yield evalToken(token, this.context.spawn(item))\n if (!map.has(key)) map.set(key, [])\n map.get(key).push(item)\n }\n return [...map.entries()].map(([name, items]) => ({ name, items }))\n}\n\nexport function * group_by_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n const map = new Map()\n const keyTemplate = new Value(stringify(exp), this.liquid)\n arr = toEnumerable(arr)\n this.context.memoryLimit.use(arr.length)\n for (const item of arr) {\n this.context.push({ [itemName]: item })\n const key = yield keyTemplate.value(this.context)\n this.context.pop()\n if (!map.has(key)) map.set(key, [])\n map.get(key).push(item)\n }\n return [...map.entries()].map(([name, items]) => ({ name, items }))\n}\n\nfunction * search (this: FilterImpl, arr: T[], property: string, expected: string): IterableIterator {\n const token = new Tokenizer(stringify(property)).readScopeValue()\n const array = toArray(arr)\n const matcher = expectedMatcher.call(this, expected)\n for (let index = 0; index < array.length; index++) {\n const value = yield evalToken(token, this.context.spawn(array[index]))\n if (matcher(value)) return [index, array[index]]\n }\n}\n\nfunction * search_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n const predicate = new Value(stringify(exp), this.liquid)\n const array = toArray(arr)\n for (let index = 0; index < array.length; index++) {\n this.context.push({ [itemName]: array[index] })\n const value = yield predicate.value(this.context)\n this.context.pop()\n if (value) return [index, array[index]]\n }\n}\n\nexport function * has (this: FilterImpl, arr: T[], property: string, expected?: any): IterableIterator {\n const result = yield * search.call(this, arr, property, expected)\n return !!result\n}\n\nexport function * has_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n const result = yield * search_exp.call(this, arr, itemName, exp)\n return !!result\n}\n\nexport function * find_index (this: FilterImpl, arr: T[], property: string, expected?: any): IterableIterator {\n const result = yield * search.call(this, arr, property, expected)\n return result ? result[0] : undefined\n}\n\nexport function * find_index_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n const result = yield * search_exp.call(this, arr, itemName, exp)\n return result ? result[0] : undefined\n}\n\nexport function * find (this: FilterImpl, arr: T[], property: string, expected?: any): IterableIterator {\n const result = yield * search.call(this, arr, property, expected)\n return result ? result[1] : undefined\n}\n\nexport function * find_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n const result = yield * search_exp.call(this, arr, itemName, exp)\n return result ? result[1] : undefined\n}\n\nexport function uniq (this: FilterImpl, arr: T[]): T[] {\n arr = toArray(arr)\n this.context.memoryLimit.use(arr.length)\n return [...new Set(arr)]\n}\n\nexport function sample (this: FilterImpl, v: T[] | string, count = 1): T | string | (T | string)[] {\n v = toValue(v)\n if (isNil(v)) return []\n if (!isArray(v)) v = stringify(v)\n this.context.memoryLimit.use(v.length)\n const shuffled = [...v].sort(() => Math.random() - 0.5)\n if (count === 1) return shuffled[0]\n return shuffled.slice(0, count)\n}\n","import { toValue, stringify, isString, isNumber, LiquidDate, strftime, isNil } from '../util'\nimport { FilterImpl } from '../template'\nimport { NormalizedFullOptions } from '../liquid-options'\n\nexport function date (this: FilterImpl, v: string | Date, format?: string, timezoneOffset?: number | string) {\n const size = ((v as string)?.length ?? 0) + ((timezoneOffset as string)?.length ?? 0)\n this.context.memoryLimit.use(size)\n const date = parseDate(v, this.context.opts, timezoneOffset)\n if (!date) return v\n format = toValue(format)\n format = isNil(format) ? this.context.opts.dateFormat : stringify(format)\n this.context.memoryLimit.use(format.length)\n return strftime(date, format, this.context.memoryLimit)\n}\n\nexport function date_to_xmlschema (this: FilterImpl, v: string | Date) {\n return date.call(this, v, '%Y-%m-%dT%H:%M:%S%:z')\n}\n\nexport function date_to_rfc822 (this: FilterImpl, v: string | Date) {\n return date.call(this, v, '%a, %d %b %Y %H:%M:%S %z')\n}\n\nexport function date_to_string (this: FilterImpl, v: string | Date, type?: string, style?: string) {\n return stringify_date.call(this, v, '%b', type, style)\n}\n\nexport function date_to_long_string (this: FilterImpl, v: string | Date, type?: string, style?: string) {\n return stringify_date.call(this, v, '%B', type, style)\n}\n\nfunction stringify_date (this: FilterImpl, v: string | Date, month_type: string, type?: string, style?: string) {\n const date = parseDate(v, this.context.opts)\n if (!date) return v\n const ml = this.context.memoryLimit\n if (type === 'ordinal') {\n const d = date.getDate()\n return style === 'US'\n ? strftime(date, `${month_type} ${d}%q, %Y`, ml)\n : strftime(date, `${d}%q ${month_type} %Y`, ml)\n }\n return strftime(date, `%d ${month_type} %Y`, ml)\n}\n\nfunction parseDate (v: string | Date, opts: NormalizedFullOptions, timezoneOffset?: number | string): LiquidDate | undefined {\n let date: LiquidDate | undefined\n const defaultTimezoneOffset = timezoneOffset ?? opts.timezoneOffset\n const locale = opts.locale\n v = toValue(v)\n if (isNil(v)) {\n return undefined\n } else if (v === 'now' || v === 'today') {\n date = new LiquidDate(Date.now(), locale, defaultTimezoneOffset)\n } else if (isNumber(v)) {\n date = new LiquidDate(v * 1000, locale, defaultTimezoneOffset)\n } else if (isString(v)) {\n if (/^\\d+$/.test(v)) {\n date = new LiquidDate(+v * 1000, locale, defaultTimezoneOffset)\n } else if (opts.preserveTimezones && timezoneOffset === undefined) {\n date = LiquidDate.createDateFixedToTimezone(v, locale)\n } else {\n date = new LiquidDate(v, locale, defaultTimezoneOffset)\n }\n } else {\n date = new LiquidDate(v, locale, defaultTimezoneOffset)\n }\n return date.valid() ? date : undefined\n}\n","/**\n * String related filters\n *\n * * prefer stringify() to String() since `undefined`, `null` should eval ''\n */\n\n// Han (Chinese) characters: \\u4E00-\\u9FFF\n// Additional Han characters: \\uF900-\\uFAFF (CJK Compatibility Ideographs)\n// Additional Han characters: \\u3400-\\u4DBF (CJK Unified Ideographs Extension A)\n// Katakana (Japanese): \\u30A0-\\u30FF\n// Hiragana (Japanese): \\u3040-\\u309F\n// Hangul (Korean): \\uAC00-\\uD7AF\nimport { FilterImpl } from '../template'\nimport { assert, stringify } from '../util'\n\nconst rCJKWord = /[\\u4E00-\\u9FFF\\uF900-\\uFAFF\\u3400-\\u4DBF\\u3040-\\u309F\\u30A0-\\u30FF\\uAC00-\\uD7AF]/gu\n\n// Word boundary followed by word characters (for detecting words)\nconst rNonCJKWord = /[^\\u4E00-\\u9FFF\\uF900-\\uFAFF\\u3400-\\u4DBF\\u3040-\\u309F\\u30A0-\\u30FF\\uAC00-\\uD7AF\\s]+/gu\n\nexport function append (this: FilterImpl, v: string, arg: string) {\n assert(arguments.length === 2, 'append expect 2 arguments')\n const lhs = stringify(v)\n const rhs = stringify(arg)\n this.context.memoryLimit.use(lhs.length + rhs.length)\n return lhs + rhs\n}\n\nexport function prepend (this: FilterImpl, v: string, arg: string) {\n assert(arguments.length === 2, 'prepend expect 2 arguments')\n const lhs = stringify(v)\n const rhs = stringify(arg)\n this.context.memoryLimit.use(lhs.length + rhs.length)\n return rhs + lhs\n}\n\nexport function lstrip (this: FilterImpl, v: string, chars?: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n if (chars) {\n chars = stringify(chars)\n this.context.memoryLimit.use(chars.length)\n for (let i = 0, set = new Set(chars); i < str.length; i++) {\n if (!set.has(str[i])) return str.slice(i)\n }\n return ''\n }\n return str.trimStart()\n}\n\nexport function downcase (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n return str.toLowerCase()\n}\n\nexport function upcase (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n return stringify(str).toUpperCase()\n}\n\nexport function remove (this: FilterImpl, v: string, arg: string) {\n const str = stringify(v)\n arg = stringify(arg)\n this.context.memoryLimit.use(str.length + arg.length)\n return str.split(arg).join('')\n}\n\nexport function remove_first (this: FilterImpl, v: string, l: string) {\n const str = stringify(v)\n l = stringify(l)\n this.context.memoryLimit.use(str.length + l.length)\n return str.replace(l, '')\n}\n\nexport function remove_last (this: FilterImpl, v: string, l: string) {\n const str = stringify(v)\n const pattern = stringify(l)\n this.context.memoryLimit.use(str.length + pattern.length)\n const index = str.lastIndexOf(pattern)\n if (index === -1) return str\n return str.substring(0, index) + str.substring(index + pattern.length)\n}\n\nexport function rstrip (this: FilterImpl, str: string, chars?: string) {\n str = stringify(str)\n this.context.memoryLimit.use(str.length)\n if (chars) {\n chars = stringify(chars)\n this.context.memoryLimit.use(chars.length)\n for (let i = str.length - 1, set = new Set(chars); i >= 0; i--) {\n if (!set.has(str[i])) return str.slice(0, i + 1)\n }\n return ''\n }\n return str.trimEnd()\n}\n\nexport function split (this: FilterImpl, v: string, arg: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n const arr = str.split(stringify(arg))\n // align to ruby split, which is the behavior of shopify/liquid\n // see: https://ruby-doc.org/core-2.4.0/String.html#method-i-split\n while (arr.length && arr[arr.length - 1] === '') arr.pop()\n return arr\n}\n\nexport function strip (this: FilterImpl, v: string, chars?: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n if (chars) {\n const set = new Set(stringify(chars))\n this.context.memoryLimit.use(set.size)\n let i = 0\n let j = str.length - 1\n while (set.has(str[i])) i++\n while (j >= i && set.has(str[j])) j--\n return str.slice(i, j + 1)\n }\n return str.trim()\n}\n\nexport function strip_newlines (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n return str.replace(/\\r?\\n/gm, '')\n}\n\nexport function capitalize (this: FilterImpl, str: string) {\n str = stringify(str)\n this.context.memoryLimit.use(str.length)\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()\n}\n\nexport function replace (this: FilterImpl, v: string, pattern: string, replacement: string) {\n const str = stringify(v)\n pattern = stringify(pattern)\n replacement = stringify(replacement)\n const parts = str.split(pattern)\n const outputSize = str.length + (parts.length - 1) * (replacement.length - pattern.length)\n this.context.memoryLimit.use(outputSize)\n return parts.join(replacement)\n}\n\nexport function replace_first (this: FilterImpl, v: string, arg1: string, arg2: string) {\n const str = stringify(v)\n arg1 = stringify(arg1)\n arg2 = stringify(arg2)\n this.context.memoryLimit.use(str.length + arg1.length + arg2.length)\n return str.replace(arg1, () => arg2)\n}\n\nexport function replace_last (this: FilterImpl, v: string, arg1: string, arg2: string) {\n const str = stringify(v)\n const pattern = stringify(arg1)\n const replacement = stringify(arg2)\n this.context.memoryLimit.use(str.length + pattern.length + replacement.length)\n const index = str.lastIndexOf(pattern)\n if (index === -1) return str\n return str.substring(0, index) + replacement + str.substring(index + pattern.length)\n}\n\nexport function truncate (this: FilterImpl, v: string, l = 50, o = '...') {\n const str = stringify(v)\n o = stringify(o)\n this.context.memoryLimit.use(str.length + o.length)\n if (str.length <= l) return v\n return str.substring(0, l - o.length) + o\n}\n\nexport function truncatewords (this: FilterImpl, v: string, words = 15, o = '...') {\n const str = stringify(v)\n o = stringify(o)\n this.context.memoryLimit.use(str.length + o.length)\n const arr = str.split(/\\s+/)\n if (words <= 0) words = 1\n let ret = arr.slice(0, words).join(' ')\n if (arr.length >= words) ret += o\n return ret\n}\n\nexport function normalize_whitespace (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n return str.replace(/\\s+/g, ' ')\n}\n\nexport function number_of_words (this: FilterImpl, input: string, mode?: 'cjk' | 'auto') {\n const str = stringify(input)\n this.context.memoryLimit.use(str.length)\n input = str.trim()\n if (!input) return 0\n switch (mode) {\n case 'cjk':\n // Count CJK characters and words\n return (input.match(rCJKWord) || []).length + (input.match(rNonCJKWord) || []).length\n case 'auto':\n // Count CJK characters, if none, count words\n return rCJKWord.test(input)\n ? input.match(rCJKWord)!.length + (input.match(rNonCJKWord) || []).length\n : input.split(/\\s+/).length\n default:\n // Count words only\n return input.split(/\\s+/).length\n }\n}\n\nexport function array_to_sentence_string (this: FilterImpl, array: unknown[], connector = 'and') {\n connector = stringify(connector)\n let outputSize = connector.length + array.length * 2\n for (let i = 0; i < array.length; i++) outputSize += stringify(array[i]).length\n this.context.memoryLimit.use(outputSize)\n switch (array.length) {\n case 0:\n return ''\n case 1:\n return array[0]\n case 2:\n return `${array[0]} ${connector} ${array[1]}`\n default:\n return `${array.slice(0, -1).join(', ')}, ${connector} ${array[array.length - 1]}`\n }\n}\n","/**\n * Base64 related filters\n *\n * Implements base64_encode and base64_decode filters for Shopify compatibility\n */\n\nimport { FilterImpl } from '../template'\nimport { stringify } from '../util'\nimport { base64Encode, base64Decode } from './base64-impl'\n\nexport function base64_encode (this: FilterImpl, value: string | Buffer): string {\n if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {\n this.context.memoryLimit.use(value.byteLength)\n return value.toString('base64')\n }\n const str = stringify(value)\n this.context.memoryLimit.use(str.length)\n return base64Encode(str)\n}\n\nexport function base64_decode (this: FilterImpl, value: string): string {\n const str = stringify(value)\n this.context.memoryLimit.use(str.length)\n return base64Decode(str)\n}\n","\nexport function base64Encode (str: string): string {\n return btoa(String.fromCharCode(...new TextEncoder().encode(str)))\n}\n\nexport function base64Decode (str: string): string {\n return new TextDecoder().decode(\n Uint8Array.from(atob(str), c => c.charCodeAt(0))\n )\n}\n","function bufferToHex (buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer)\n let hex = ''\n for (let i = 0; i < bytes.length; i++) {\n hex += bytes[i].toString(16).padStart(2, '0')\n }\n return hex\n}\n\nexport async function sha256 (str: string): Promise {\n const data = new TextEncoder().encode(str)\n const digest = await crypto.subtle.digest('SHA-256', data)\n return bufferToHex(digest)\n}\n\nexport async function hmacSha256 (str: string, key: string): Promise {\n const encoder = new TextEncoder()\n const cryptoKey = await crypto.subtle.importKey(\n 'raw',\n encoder.encode(key),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign']\n )\n const signature = await crypto.subtle.sign('HMAC', cryptoKey, encoder.encode(str))\n return bufferToHex(signature)\n}\n","/**\n * Crypto related filters\n *\n * Implements sha256 and hmac_sha256 filters for Shopify compatibility\n */\n\nimport { FilterImpl } from '../template'\nimport { stringify } from '../util'\nimport { sha256 as sha256Impl, hmacSha256 as hmacSha256Impl } from './crypto-impl'\n\nexport function sha256 (this: FilterImpl, value: unknown): string | Promise {\n const str = stringify(value)\n this.context.memoryLimit.use(str.length)\n return sha256Impl(str)\n}\n\nexport function hmac_sha256 (this: FilterImpl, value: unknown, key: unknown): string | Promise {\n const str = stringify(value)\n const keyStr = stringify(key)\n this.context.memoryLimit.use(str.length + keyStr.length)\n return hmacSha256Impl(str, keyStr)\n}\n","import * as htmlFilters from './html'\nimport * as mathFilters from './math'\nimport * as urlFilters from './url'\nimport * as arrayFilters from './array'\nimport * as dateFilters from './date'\nimport * as stringFilters from './string'\nimport * as base64Filters from './base64'\nimport * as cryptoFilters from './crypto'\nimport misc from './misc'\nimport { FilterImplOptions } from '../template'\n\nexport const filters: Record = {\n ...htmlFilters,\n ...mathFilters,\n ...urlFilters,\n ...arrayFilters,\n ...dateFilters,\n ...stringFilters,\n ...base64Filters,\n ...cryptoFilters,\n ...misc\n}\n","import { Value, Liquid, TopLevelToken, TagToken, Context, Tag } from '..'\nimport { Arguments } from '../template'\nimport { IdentifierToken } from '../tokens'\n\nexport default class extends Tag {\n private key: string\n private value: Value\n private identifier: IdentifierToken\n\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token, remainTokens, liquid)\n this.identifier = this.tokenizer.readIdentifier()\n this.key = this.identifier.content\n this.tokenizer.assert(this.key, 'expected variable name')\n\n this.tokenizer.skipBlank()\n this.tokenizer.assert(this.tokenizer.peek() === '=', 'expected \"=\"')\n\n this.tokenizer.advance()\n this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid)\n }\n * render (ctx: Context): Generator {\n ctx.bottom()[this.key] = yield this.value.value(ctx, this.liquid.options.lenientIf)\n }\n\n public * arguments (): Arguments {\n yield this.value\n }\n\n public * localScope (): Iterable {\n yield this.identifier\n }\n}\n","import { Hash, ValueToken, Liquid, Tag, evalToken, Emitter, TagToken, TopLevelToken, Context, Template, ParseStream } from '..'\nimport { assertEmpty, isValueToken, toEnumerable } from '../util'\nimport { createScope } from '../context/scope'\nimport { ForloopDrop } from '../drop/forloop-drop'\nimport { Parser } from '../parser'\nimport { Arguments } from '../template'\n\nconst MODIFIERS = ['offset', 'limit', 'reversed']\n\ntype valueOf = T[keyof T]\n\nexport default class extends Tag {\n variable: string\n collection: ValueToken\n hash: Hash\n templates: Template[]\n elseTemplates: Template[]\n\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n const variable = this.tokenizer.readIdentifier()\n const inStr = this.tokenizer.readIdentifier()\n const collection = this.tokenizer.readValue()\n if (!variable.size() || inStr.content !== 'in' || !collection) {\n throw new Error(`illegal tag: ${token.getText()}`)\n }\n\n this.variable = variable.content\n this.collection = collection\n this.hash = new Hash(this.tokenizer, liquid.options.keyValueSeparator)\n this.templates = []\n this.elseTemplates = []\n\n let p\n const stream: ParseStream = parser.parseStream(remainTokens)\n .on('start', () => (p = this.templates))\n .on('tag:else', tag => { assertEmpty(tag.args); p = this.elseTemplates })\n .on('tag:endfor', tag => { assertEmpty(tag.args); stream.stop() })\n .on('template', (tpl: Template) => p.push(tpl))\n .on('end', () => { throw new Error(`tag ${token.getText()} not closed`) })\n\n stream.start()\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n const r = this.liquid.renderer\n let collection = toEnumerable(yield evalToken(this.collection, ctx))\n\n if (!collection.length) {\n yield r.renderTemplates(this.elseTemplates, ctx, emitter)\n return\n }\n\n const continueKey = 'continue-' + this.variable + '-' + this.collection.getText()\n ctx.push(createScope({ continue: ctx.getRegister(continueKey, {}) }))\n const hash = (yield this.hash.render(ctx)) as Record\n ctx.pop()\n\n const modifiers = this.liquid.options.orderedFilterParameters\n ? Object.keys(hash).filter(x => MODIFIERS.includes(x))\n : MODIFIERS.filter(x => hash[x] !== undefined)\n\n collection = modifiers.reduce((collection, modifier: valueOf) => {\n if (modifier === 'offset') return offset(collection, hash['offset'])\n if (modifier === 'limit') return limit(collection, hash['limit'])\n return reversed(collection)\n }, collection)\n\n ctx.setRegister(continueKey, (hash['offset'] || 0) + collection.length)\n const scope = createScope({ forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) })\n ctx.push(scope)\n for (const item of collection) {\n scope[this.variable] = item\n ctx.continueCalled = ctx.breakCalled = false\n yield r.renderTemplates(this.templates, ctx, emitter)\n if (ctx.breakCalled) break\n scope.forloop.next()\n }\n ctx.continueCalled = ctx.breakCalled = false\n ctx.pop()\n }\n\n public * children (): Generator {\n const templates = this.templates.slice()\n if (this.elseTemplates) {\n templates.push(...this.elseTemplates)\n }\n return templates\n }\n\n public * arguments (): Arguments {\n yield this.collection\n\n for (const v of Object.values(this.hash.hash)) {\n if (isValueToken(v)) {\n yield v\n }\n }\n }\n\n public blockScope (): Iterable {\n return [this.variable, 'forloop']\n }\n}\n\nfunction reversed (arr: Array) {\n return [...arr].reverse()\n}\n\nfunction offset (arr: Array, count: number) {\n return arr.slice(count)\n}\n\nfunction limit (arr: Array, count: number) {\n return arr.slice(0, count)\n}\n","import { Liquid, Tag, Template, Context, TagToken, TopLevelToken } from '..'\nimport { Parser } from '../parser'\nimport { IdentifierToken, QuotedToken } from '../tokens'\nimport { isTagToken } from '../util'\n\nexport default class extends Tag {\n identifier: IdentifierToken | QuotedToken\n variable: string\n templates: Template[] = []\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(tagToken, remainTokens, liquid)\n this.identifier = this.readVariable()\n this.variable = this.identifier.content\n\n while (remainTokens.length) {\n const token = remainTokens.shift()!\n if (isTagToken(token) && token.name === 'endcapture') return\n this.templates.push(parser.parseToken(token, remainTokens))\n }\n throw new Error(`tag ${tagToken.getText()} not closed`)\n }\n\n private readVariable (): IdentifierToken | QuotedToken {\n let ident: IdentifierToken | QuotedToken | undefined = this.tokenizer.readIdentifier()\n if (ident.content) return ident\n ident = this.tokenizer.readQuoted()\n if (ident) return ident\n throw this.tokenizer.error('invalid capture name')\n }\n\n * render (ctx: Context): Generator {\n const r = this.liquid.renderer\n const html = yield r.renderTemplates(this.templates, ctx)\n ctx.bottom()[this.variable] = html\n }\n\n public * children (): Generator {\n return this.templates\n }\n\n public * localScope (): Iterable {\n yield this.identifier\n }\n}\n","import { ValueToken, Liquid, toValue, evalToken, Value, Emitter, TagToken, TopLevelToken, Context, Template, Tag, ParseStream } from '..'\nimport { Parser } from '../parser'\nimport { equals } from '../render'\nimport { Arguments } from '../template'\n\nexport default class extends Tag {\n value: Value\n branches: { values: ValueToken[], templates: Template[] }[] = []\n elseTemplates: Template[] = []\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(tagToken, remainTokens, liquid)\n this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid)\n this.elseTemplates = []\n\n let p: Template[] = []\n let elseCount = 0\n const stream: ParseStream = parser.parseStream(remainTokens)\n .on('tag:when', (token: TagToken) => {\n if (elseCount > 0) {\n return\n }\n\n p = []\n\n const values: ValueToken[] = []\n while (!token.tokenizer.end()) {\n values.push(token.tokenizer.readValueOrThrow())\n token.tokenizer.skipBlank()\n if (token.tokenizer.peek() === ',') {\n token.tokenizer.readTo(',')\n } else {\n token.tokenizer.readTo('or')\n }\n }\n this.branches.push({\n values,\n templates: p\n })\n })\n .on('tag:else', () => {\n elseCount++\n p = this.elseTemplates\n })\n .on('tag:endcase', () => stream.stop())\n .on('template', (tpl: Template) => {\n if (p !== this.elseTemplates || elseCount === 1) {\n p.push(tpl)\n }\n })\n .on('end', () => {\n throw new Error(`tag ${tagToken.getText()} not closed`)\n })\n\n stream.start()\n }\n\n * render (ctx: Context, emitter: Emitter): Generator {\n const r = this.liquid.renderer\n const target = toValue(yield this.value.value(ctx, ctx.opts.lenientIf))\n let branchHit = false\n for (const branch of this.branches) {\n for (const valueToken of branch.values) {\n const value = yield evalToken(valueToken, ctx, ctx.opts.lenientIf)\n if (equals(target, value)) {\n yield r.renderTemplates(branch.templates, ctx, emitter)\n branchHit = true\n break\n }\n }\n }\n if (!branchHit) {\n yield r.renderTemplates(this.elseTemplates, ctx, emitter)\n }\n }\n\n public * arguments (): Arguments {\n yield this.value\n yield * this.branches.flatMap(b => b.values)\n }\n\n public * children (): Generator {\n const templates = this.branches.flatMap(b => b.templates)\n if (this.elseTemplates) {\n templates.push(...this.elseTemplates)\n }\n return templates\n }\n}\n","import { Liquid, TopLevelToken, TagToken, Tag } from '..'\nimport { isTagToken } from '../util'\n\nexport default class extends Tag {\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(tagToken, remainTokens, liquid)\n while (remainTokens.length) {\n const token = remainTokens.shift()!\n if (isTagToken(token) && token.name === 'endcomment') return\n }\n throw new Error(`tag ${tagToken.getText()} not closed`)\n }\n render () {}\n}\n","import { __assign } from 'tslib'\nimport { ForloopDrop } from '../drop'\nimport { isString, isValueToken, toEnumerable } from '../util'\nimport { TopLevelToken, assert, Liquid, Token, ValueToken, Template, evalQuotedToken, TypeGuards, Tokenizer, evalToken, Hash, Emitter, TagToken, Context, Tag } from '..'\nimport { Parser } from '../parser'\nimport { Argument, Arguments, PartialScope } from '../template'\n\nexport type ParsedFileName = Template[] | Token | string | undefined\n\ntype RenderBinding = { value: ValueToken; alias?: string }\n\nexport default class extends Tag {\n private file: ParsedFileName\n private currentFile?: string\n private hash: Hash\n private with?: RenderBinding\n private forBinding?: RenderBinding\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n const tokenizer = this.tokenizer\n this.file = parseFilePath(tokenizer, this.liquid, parser)\n this.currentFile = token.file\n while (!tokenizer.end()) {\n tokenizer.skipBlank()\n const begin = tokenizer.p\n const keyword = tokenizer.readIdentifier()\n if (keyword.content === 'with' || keyword.content === 'for') {\n tokenizer.skipBlank()\n // can be normal key/value pair, like \"with: true\"\n if (tokenizer.peek() !== ':') {\n const value = tokenizer.readValue()\n // can be normal key, like \"with,\"\n if (value) {\n const beforeAs = tokenizer.p\n const asStr = tokenizer.readIdentifier()\n let alias\n if (asStr.content === 'as') alias = tokenizer.readIdentifier()\n else tokenizer.p = beforeAs\n\n const binding: RenderBinding = { value, alias: alias && alias.content }\n if (keyword.content === 'with') this.with = binding\n else this.forBinding = binding\n tokenizer.skipBlank()\n if (tokenizer.peek() === ',') tokenizer.advance()\n continue // matched!\n }\n }\n }\n /**\n * restore cursor if with/for not matched\n */\n tokenizer.p = begin\n break\n }\n this.hash = new Hash(tokenizer, liquid.options.keyValueSeparator)\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n const { liquid, hash } = this\n const filepath = (yield renderFilePath(this.file, ctx, liquid)) as string\n assert(filepath, () => `illegal file path \"${filepath}\"`)\n\n const childCtx = ctx.spawn()\n const scope = childCtx.bottom()\n __assign(scope, yield hash.render(ctx))\n if (this.with) {\n const { value, alias } = this.with\n scope[alias || filepath] = yield evalToken(value, ctx)\n }\n\n if (this.forBinding) {\n const { value, alias } = this.forBinding\n const collection = toEnumerable(yield evalToken(value, ctx))\n scope['forloop'] = new ForloopDrop(collection.length, value.getText(), alias as string)\n for (const item of collection) {\n scope[alias as string] = item\n const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)) as Template[]\n yield liquid.renderer.renderTemplates(templates, childCtx, emitter)\n scope['forloop'].next()\n }\n } else {\n const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)) as Template[]\n yield liquid.renderer.renderTemplates(templates, childCtx, emitter)\n }\n }\n\n public * children (partials: boolean, sync: boolean): Generator {\n if (partials && isString(this.file)) {\n return (yield this.liquid._parsePartialFile(this.file, sync, this.currentFile)) as Template[]\n }\n return []\n }\n\n public partialScope (): PartialScope | undefined {\n if (isString(this.file)) {\n const names: Array = Object.keys(this.hash.hash)\n\n if (this.with) {\n const { value, alias } = this.with\n if (isString(alias)) {\n names.push([alias, value])\n } else if (isString(this.file)) {\n names.push([this.file, value])\n }\n }\n\n if (this.forBinding) {\n const { value, alias } = this.forBinding\n if (isString(alias)) {\n names.push([alias, value])\n } else if (isString(this.file)) {\n names.push([this.file, value])\n }\n }\n\n return { name: this.file, isolated: true, scope: names }\n }\n }\n\n public * arguments (): Arguments {\n for (const v of Object.values(this.hash.hash)) {\n if (isValueToken(v)) {\n yield v\n }\n }\n\n if (this.with) {\n const { value } = this.with\n if (isValueToken(value)) {\n yield value\n }\n }\n\n if (this.forBinding) {\n const { value } = this.forBinding\n if (isValueToken(value)) {\n yield value\n }\n }\n }\n}\n\n/**\n * @return null for \"none\",\n * @return Template[] for quoted with tags and/or filters\n * @return Token for expression (not quoted)\n * @throws TypeError if cannot read next token\n */\nexport function parseFilePath (tokenizer: Tokenizer, liquid: Liquid, parser: Parser): ParsedFileName {\n if (liquid.options.dynamicPartials) {\n const file = tokenizer.readValue()\n tokenizer.assert(file, 'illegal file path')\n if (file!.getText() === 'none') return\n if (TypeGuards.isQuotedToken(file)) {\n // for filenames like \"files/{{file}}\", eval as liquid template\n const templates = parser.parse(evalQuotedToken(file))\n return optimize(templates)\n }\n return file\n }\n const tokens = [...tokenizer.readFileNameTemplate(liquid.options)]\n const templates = optimize(parser.parseTokens(tokens))\n return templates === 'none' ? undefined : templates\n}\n\nfunction optimize (templates: Template[]): string | Template[] {\n // for filenames like \"files/file.liquid\", extract the string directly\n if (templates.length === 1 && TypeGuards.isHTMLToken(templates[0].token)) return templates[0].token.getContent()\n return templates\n}\n\nexport function * renderFilePath (file: ParsedFileName, ctx: Context, liquid: Liquid): IterableIterator {\n if (typeof file === 'string') return file\n if (Array.isArray(file)) return liquid.renderer.renderTemplates(file, ctx)\n return yield evalToken(file, ctx)\n}\n","import { Template, ValueToken, TopLevelToken, Liquid, Tag, assert, evalToken, Hash, Emitter, TagToken, Context } from '..'\nimport { BlockMode, createScope, Scope } from '../context'\nimport { Parser } from '../parser'\nimport { Argument, Arguments, PartialScope } from '../template'\nimport { isString, isValueToken } from '../util'\nimport { parseFilePath, renderFilePath, ParsedFileName } from './render'\n\nexport default class extends Tag {\n private file: ParsedFileName\n private currentFile?: string\n private withVar?: ValueToken\n private hash: Hash\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n const { tokenizer } = token\n this.file = parseFilePath(tokenizer, this.liquid, parser)\n this.currentFile = token.file\n\n const begin = tokenizer.p\n const withStr = tokenizer.readIdentifier()\n if (withStr.content === 'with') {\n tokenizer.skipBlank()\n if (tokenizer.peek() !== ':') {\n this.withVar = tokenizer.readValue()\n } else tokenizer.p = begin\n } else tokenizer.p = begin\n\n this.hash = new Hash(tokenizer, liquid.options.jekyllInclude || liquid.options.keyValueSeparator)\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n const { liquid, hash, withVar } = this\n const { renderer } = liquid\n const filepath = (yield renderFilePath(this.file, ctx, liquid)) as string\n assert(filepath, () => `illegal file path \"${filepath}\"`)\n\n const saved = ctx.saveRegister('blocks', 'blockMode')\n ctx.setRegister('blocks', {})\n ctx.setRegister('blockMode', BlockMode.OUTPUT)\n const scope = createScope((yield hash.render(ctx)) as Scope)\n if (withVar) scope[filepath] = yield evalToken(withVar, ctx)\n const templates = (yield liquid._parsePartialFile(filepath, ctx.sync, this.currentFile)) as Template[]\n ctx.push(ctx.opts.jekyllInclude ? createScope({ include: scope }) : scope)\n yield renderer.renderTemplates(templates, ctx, emitter)\n ctx.pop()\n ctx.restoreRegister(saved)\n }\n\n public * children (partials: boolean, sync: boolean): Generator {\n if (partials && isString(this.file)) {\n return (yield this.liquid._parsePartialFile(this.file, sync, this.currentFile)) as Template[]\n }\n return []\n }\n\n public partialScope (): PartialScope | undefined {\n if (isString(this.file)) {\n let names: Array\n\n if (this.liquid.options.jekyllInclude) {\n names = ['include']\n } else {\n names = Object.keys(this.hash.hash)\n if (this.withVar) {\n names.push([this.file, this.withVar])\n }\n }\n\n return { name: this.file, isolated: false, scope: names }\n }\n }\n\n public * arguments (): Arguments {\n yield * Object.values(this.hash.hash).filter(isValueToken)\n\n if (isValueToken(this.file)) {\n yield this.file\n }\n\n if (isValueToken(this.withVar)) {\n yield this.withVar\n }\n }\n}\n","import { Tag, Liquid, TopLevelToken, Emitter, TagToken, Context } from '..'\nimport { IdentifierToken } from '../tokens'\nimport { isNumber, stringify } from '../util'\n\nexport default class extends Tag {\n private identifier: IdentifierToken\n private variable: string\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token, remainTokens, liquid)\n this.identifier = this.tokenizer.readIdentifier()\n this.variable = this.identifier.content\n }\n render (context: Context, emitter: Emitter) {\n const scope = context.environments\n if (!isNumber(scope[this.variable])) {\n scope[this.variable] = 0\n }\n emitter.write(stringify(--scope[this.variable]))\n }\n\n public * localScope (): Iterable {\n yield this.identifier\n }\n}\n","import { TopLevelToken, Liquid, ValueToken, evalToken, Emitter, TagToken, Context, Tag } from '..'\nimport { Arguments } from '../template'\n\nexport default class extends Tag {\n private candidates: ValueToken[] = []\n private group?: ValueToken\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token, remainTokens, liquid)\n const group = this.tokenizer.readValue()\n this.tokenizer.skipBlank()\n\n if (group) {\n if (this.tokenizer.peek() === ':') {\n this.group = group\n this.tokenizer.advance()\n } else this.candidates.push(group)\n }\n\n while (!this.tokenizer.end()) {\n const value = this.tokenizer.readValue()\n if (value) this.candidates.push(value)\n this.tokenizer.readTo(',')\n }\n this.tokenizer.assert(this.candidates.length, () => `empty candidates: \"${token.getText()}\"`)\n }\n\n * render (ctx: Context, emitter: Emitter): Generator {\n const group = (yield evalToken(this.group, ctx)) as ValueToken\n const fingerprint = `cycle:${group}:` + this.candidates.join(',')\n const groups = ctx.getRegister('cycle', {} as Record)\n let idx = groups[fingerprint]\n\n if (idx === undefined) {\n idx = groups[fingerprint] = 0\n }\n\n const candidate = this.candidates[idx]\n idx = (idx + 1) % this.candidates.length\n groups[fingerprint] = idx\n return yield evalToken(candidate, ctx)\n }\n\n public * arguments (): Arguments {\n yield * this.candidates\n\n if (this.group) {\n yield this.group\n }\n }\n}\n","import { Liquid, Tag, Value, Emitter, isTruthy, TagToken, TopLevelToken, Context, Template } from '..'\nimport { Parser } from '../parser'\nimport { Arguments } from '../template'\nimport { assert, assertEmpty } from '../util'\n\nexport default class extends Tag {\n branches: { value: Value, templates: Template[] }[] = []\n elseTemplates: Template[] | undefined\n\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(tagToken, remainTokens, liquid)\n let p: Template[] = []\n parser.parseStream(remainTokens)\n .on('start', () => this.branches.push({\n value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid),\n templates: (p = [])\n }))\n .on('tag:elsif', (token: TagToken) => {\n assert(!this.elseTemplates, 'unexpected elsif after else')\n this.branches.push({\n value: new Value(token.tokenizer.readFilteredValue(), this.liquid),\n templates: (p = [])\n })\n })\n .on('tag:else', tag => {\n assertEmpty(tag.args)\n assert(!this.elseTemplates, 'duplicated else')\n p = this.elseTemplates = []\n })\n .on('tag:endif', function (tag) { assertEmpty(tag.args); this.stop() })\n .on('template', (tpl: Template) => p.push(tpl))\n .on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`) })\n .start()\n }\n\n * render (ctx: Context, emitter: Emitter): Generator {\n const r = this.liquid.renderer\n\n for (const { value, templates } of this.branches) {\n const v = yield value.value(ctx, ctx.opts.lenientIf)\n if (isTruthy(v, ctx)) {\n yield r.renderTemplates(templates, ctx, emitter)\n return\n }\n }\n yield r.renderTemplates(this.elseTemplates || [], ctx, emitter)\n }\n\n public * children (): Generator {\n const templates = this.branches.flatMap(b => b.templates)\n if (this.elseTemplates) {\n templates.push(...this.elseTemplates)\n }\n return templates\n }\n\n public arguments (): Arguments {\n return this.branches.map(b => b.value)\n }\n}\n","import { isNumber, stringify } from '../util'\nimport { Tag, Liquid, TopLevelToken, Emitter, TagToken, Context } from '..'\nimport { IdentifierToken } from '../tokens'\n\nexport default class extends Tag {\n private identifier: IdentifierToken\n private variable: string\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token, remainTokens, liquid)\n this.identifier = this.tokenizer.readIdentifier()\n this.variable = this.identifier.content\n }\n render (context: Context, emitter: Emitter) {\n const scope = context.environments\n if (!isNumber(scope[this.variable])) {\n scope[this.variable] = 0\n }\n const val = scope[this.variable]\n scope[this.variable]++\n emitter.write(stringify(val))\n }\n\n public * localScope (): Iterable {\n yield this.identifier\n }\n}\n","import { Scope, Template, Liquid, Tag, assert, Emitter, Hash, TagToken, TopLevelToken, Context } from '..'\nimport { BlockMode, createScope } from '../context'\nimport { parseFilePath, renderFilePath, ParsedFileName } from './render'\nimport { BlankDrop } from '../drop'\nimport { Parser } from '../parser'\nimport { Arguments, PartialScope } from '../template'\nimport { isString, isValueToken } from '../util'\n\nexport default class extends Tag {\n args: Hash\n templates: Template[]\n file?: ParsedFileName\n private currentFile?: string\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n this.file = parseFilePath(this.tokenizer, this.liquid, parser)\n this.currentFile = token.file\n this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator)\n this.templates = parser.parseTokens(remainTokens)\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n const { liquid, args, file } = this\n const { renderer } = liquid\n if (file === undefined) {\n ctx.setRegister('blockMode', BlockMode.OUTPUT)\n yield renderer.renderTemplates(this.templates, ctx, emitter)\n return\n }\n const filepath = (yield renderFilePath(this.file, ctx, liquid)) as string\n assert(filepath, () => `illegal file path \"${filepath}\"`)\n const templates = (yield liquid._parseLayoutFile(filepath, ctx.sync, this.currentFile)) as Template[]\n\n // render remaining contents and store rendered results\n ctx.setRegister('blockMode', BlockMode.STORE)\n const html = yield renderer.renderTemplates(this.templates, ctx)\n const blocks = ctx.getRegister('blocks', {} as Record)\n\n // set whole content to anonymous block if anonymous doesn't specified\n if (blocks[''] === undefined) blocks[''] = (parent: BlankDrop, emitter: Emitter) => emitter.write(html)\n ctx.setRegister('blockMode', BlockMode.OUTPUT)\n\n // render the layout file use stored blocks\n ctx.push(createScope((yield args.render(ctx)) as Scope))\n yield renderer.renderTemplates(templates, ctx, emitter)\n ctx.pop()\n }\n\n public * children (partials: boolean): Generator {\n const templates = this.templates.slice()\n\n if (partials && isString(this.file)) {\n templates.push(...(yield this.liquid._parsePartialFile(this.file, true, this.currentFile)) as Template[])\n }\n\n return templates\n }\n\n public * arguments (): Arguments {\n for (const v of Object.values(this.args.hash)) {\n if (isValueToken(v)) {\n yield v\n }\n }\n\n if (isValueToken(this.file)) {\n yield this.file\n }\n }\n\n public partialScope (): PartialScope | undefined {\n if (isString(this.file)) {\n return { name: this.file, isolated: false, scope: Object.keys(this.args.hash) }\n }\n }\n}\n","import { BlockMode, createScope } from '../context'\nimport { isTagToken } from '../util'\nimport { BlockDrop } from '../drop'\nimport { Liquid, TagToken, TopLevelToken, Template, Context, Emitter, Tag } from '..'\nimport { Parser } from '../parser'\n\nexport default class extends Tag {\n block: string\n templates: Template[] = []\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n const match = /\\w+/.exec(token.args)\n this.block = match ? match[0] : ''\n while (remainTokens.length) {\n const token = remainTokens.shift()!\n if (isTagToken(token) && token.name === 'endblock') return\n const template = parser.parseToken(token, remainTokens)\n this.templates.push(template)\n }\n throw new Error(`tag ${token.getText()} not closed`)\n }\n\n * render (ctx: Context, emitter: Emitter) {\n const blockRender = this.getBlockRender(ctx)\n if (ctx.getRegister('blockMode') === BlockMode.STORE) {\n ctx.getRegister('blocks', {} as Record)[this.block] = blockRender\n } else {\n yield blockRender(new BlockDrop(), emitter)\n }\n }\n\n private getBlockRender (ctx: Context) {\n const self = this as Tag\n const { liquid, templates } = this\n const renderChild = ctx.getRegister('blocks', {} as Record)[this.block]\n const renderCurrent = function * (superBlock: BlockDrop, emitter: Emitter) {\n const stack: Tag[] = ctx.getRegister('blockStack', [])\n if (stack.includes(self)) throw new Error('block tag cannot be nested')\n\n stack.push(self)\n ctx.push(createScope({ block: superBlock }))\n yield liquid.renderer.renderTemplates(templates, ctx, emitter)\n ctx.pop()\n stack.pop()\n }\n return renderChild\n ? (superBlock: BlockDrop, emitter: Emitter) => renderChild(\n new BlockDrop(\n (emitter: Emitter) => renderCurrent(superBlock, emitter)\n ),\n emitter)\n : renderCurrent\n }\n\n public * children (): Generator {\n return this.templates\n }\n\n public blockScope (): Iterable {\n return ['block']\n }\n}\n","import { Liquid, TagToken, TopLevelToken, Tag } from '..'\nimport { isTagToken } from '../util'\n\nexport default class extends Tag {\n private tokens: TopLevelToken[] = []\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(tagToken, remainTokens, liquid)\n while (remainTokens.length) {\n const token = remainTokens.shift()!\n if (isTagToken(token) && token.name === 'endraw') return\n this.tokens.push(token)\n }\n throw new Error(`tag ${tagToken.getText()} not closed`)\n }\n render () {\n return this.tokens.map((token: TopLevelToken) => token.getText()).join('')\n }\n}\n","import { ForloopDrop } from './forloop-drop'\n\nexport class TablerowloopDrop extends ForloopDrop {\n private cols: number\n public constructor (length: number, cols: number, collection: string, variable: string) {\n super(length, collection, variable)\n this.length = length\n this.cols = cols\n }\n public row () {\n return Math.floor(this.i / this.cols) + 1\n }\n public col0 () {\n return (this.i % this.cols)\n }\n public col () {\n return this.col0() + 1\n }\n public col_first () { // eslint-disable-line\n return this.col0() === 0\n }\n public col_last () { // eslint-disable-line\n return this.col() === this.cols\n }\n}\n","import { isValueToken, toEnumerable } from '../util'\nimport { createScope } from '../context/scope'\nimport { ValueToken, Liquid, Tag, evalToken, Emitter, Hash, TagToken, TopLevelToken, Context, Template, ParseStream } from '..'\nimport { TablerowloopDrop } from '../drop/tablerowloop-drop'\nimport { Parser } from '../parser'\nimport { Arguments } from '../template'\n\nexport default class extends Tag {\n variable: string\n args: Hash\n templates: Template[]\n collection: ValueToken\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(tagToken, remainTokens, liquid)\n const variable = this.tokenizer.readIdentifier()\n this.tokenizer.skipBlank()\n\n const predicate = this.tokenizer.readIdentifier()\n const collectionToken = this.tokenizer.readValue()\n if (predicate.content !== 'in' || !collectionToken) {\n throw new Error(`illegal tag: ${tagToken.getText()}`)\n }\n\n this.variable = variable.content\n this.collection = collectionToken\n this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator)\n this.templates = []\n\n let p\n const stream: ParseStream = parser.parseStream(remainTokens)\n .on('start', () => (p = this.templates))\n .on('tag:endtablerow', () => stream.stop())\n .on('template', (tpl: Template) => p.push(tpl))\n .on('end', () => {\n throw new Error(`tag ${tagToken.getText()} not closed`)\n })\n\n stream.start()\n }\n\n * render (ctx: Context, emitter: Emitter): Generator {\n let collection = toEnumerable(yield evalToken(this.collection, ctx))\n const args = (yield this.args.render(ctx)) as Record\n const offset = args.offset || 0\n const limit = (args.limit === undefined) ? collection.length : args.limit\n\n collection = collection.slice(offset, offset + limit)\n const cols = args.cols || collection.length\n\n const r = this.liquid.renderer\n const tablerowloop = new TablerowloopDrop(collection.length, cols, this.collection.getText(), this.variable)\n const scope = createScope({ tablerowloop })\n ctx.push(scope)\n\n for (let idx = 0; idx < collection.length; idx++, tablerowloop.next()) {\n scope[this.variable] = collection[idx]\n if (tablerowloop.col0() === 0) {\n if (tablerowloop.row() !== 1) emitter.write('')\n emitter.write(``)\n }\n emitter.write(``)\n yield r.renderTemplates(this.templates, ctx, emitter)\n emitter.write('')\n }\n if (collection.length) emitter.write('')\n ctx.pop()\n }\n\n public * children (): Generator {\n return this.templates\n }\n\n public * arguments (): Arguments {\n yield this.collection\n\n for (const v of Object.values(this.args.hash)) {\n if (isValueToken(v)) {\n yield v\n }\n }\n }\n\n public blockScope (): string[] {\n return [this.variable, 'tablerowloop']\n }\n}\n","import { Liquid, Tag, Value, TopLevelToken, Template, Emitter, isTruthy, isFalsy, Context, TagToken } from '..'\nimport { Parser } from '../parser'\nimport { Arguments } from '../template'\n\nexport default class extends Tag {\n branches: { value: Value, test: (val: any, ctx: Context) => boolean, templates: Template[] }[] = []\n elseTemplates: Template[] = []\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(tagToken, remainTokens, liquid)\n let p: Template[] = []\n let elseCount = 0\n parser.parseStream(remainTokens)\n .on('start', () => this.branches.push({\n value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid),\n test: isFalsy,\n templates: (p = [])\n }))\n .on('tag:elsif', (token: TagToken) => {\n if (elseCount > 0) {\n p = []\n return\n }\n this.branches.push({\n value: new Value(token.tokenizer.readFilteredValue(), this.liquid),\n test: isTruthy,\n templates: (p = [])\n })\n })\n .on('tag:else', () => {\n elseCount++\n p = this.elseTemplates\n })\n .on('tag:endunless', function () { this.stop() })\n .on('template', (tpl: Template) => {\n if (p !== this.elseTemplates || elseCount === 1) {\n p.push(tpl)\n }\n })\n .on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`) })\n .start()\n }\n\n * render (ctx: Context, emitter: Emitter): Generator {\n const r = this.liquid.renderer\n\n for (const { value, test, templates } of this.branches) {\n const v = yield value.value(ctx, ctx.opts.lenientIf)\n if (test(v, ctx)) {\n yield r.renderTemplates(templates, ctx, emitter)\n return\n }\n }\n\n yield r.renderTemplates(this.elseTemplates, ctx, emitter)\n }\n\n public * children (): Generator {\n const children = this.branches.flatMap(b => b.templates)\n if (this.elseTemplates) {\n children.push(...this.elseTemplates)\n }\n return children\n }\n\n public arguments (): Arguments {\n return this.branches.map(b => b.value)\n }\n}\n","import { Context, Emitter, Tag } from '..'\n\nexport default class extends Tag {\n render (ctx: Context, _emitter: Emitter) {\n ctx.breakCalled = true\n }\n}\n","import { Tag, Emitter, Context } from '..'\n\nexport default class extends Tag {\n render (ctx: Context, _emitter: Emitter) {\n ctx.continueCalled = true\n }\n}\n","import { Liquid, TopLevelToken, Emitter, Value, TagToken, Context, Tag } from '..'\nimport { Arguments } from '../template'\n\nexport default class extends Tag {\n private value?: Value\n\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token, remainTokens, liquid)\n this.tokenizer.skipBlank()\n if (!this.tokenizer.end()) {\n this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid)\n }\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n if (!this.value) return\n const val = yield this.value.value(ctx, false)\n emitter.write(val)\n }\n\n public * arguments (): Arguments {\n if (this.value) {\n yield this.value\n }\n }\n}\n","import { Template, Emitter, Liquid, TopLevelToken, TagToken, Context, Tag } from '..'\nimport { Parser } from '../parser'\n\nexport default class extends Tag {\n templates: Template[]\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n const tokens = this.tokenizer.readLiquidTagTokens(this.liquid.options)\n this.templates = parser.parseTokens(tokens)\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n yield this.liquid.renderer.renderTemplates(this.templates, ctx, emitter)\n }\n\n public * children (): Generator {\n return this.templates\n }\n}\n","import { TagToken, Liquid, TopLevelToken, Tag } from '..'\n\nexport default class extends Tag {\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(tagToken, remainTokens, liquid)\n if (tagToken.args.search(/\\n\\s*[^#\\s]/g) !== -1) {\n throw new Error('every line of an inline comment must start with a \\'#\\' character')\n }\n }\n render () { }\n}\n","import AssignTag from './assign'\nimport ForTag from './for'\nimport CaptureTag from './capture'\nimport CaseTag from './case'\nimport CommentTag from './comment'\nimport IncludeTag from './include'\nimport RenderTag from './render'\nimport DecrementTag from './decrement'\nimport CycleTag from './cycle'\nimport IfTag from './if'\nimport IncrementTag from './increment'\nimport LayoutTag from './layout'\nimport BlockTag from './block'\nimport RawTag from './raw'\nimport TablerowTag from './tablerow'\nimport UnlessTag from './unless'\nimport BreakTag from './break'\nimport ContinueTag from './continue'\nimport EchoTag from './echo'\nimport LiquidTag from './liquid'\nimport InlineCommentTag from './inline-comment'\nimport type { TagClass } from '../template/tag'\n\nexport const tags: Record = {\n assign: AssignTag,\n 'for': ForTag,\n capture: CaptureTag,\n 'case': CaseTag,\n comment: CommentTag,\n include: IncludeTag,\n render: RenderTag,\n decrement: DecrementTag,\n increment: IncrementTag,\n cycle: CycleTag,\n 'if': IfTag,\n layout: LayoutTag,\n block: BlockTag,\n raw: RawTag,\n tablerow: TablerowTag,\n unless: UnlessTag,\n 'break': BreakTag,\n 'continue': ContinueTag,\n echo: EchoTag,\n liquid: LiquidTag,\n '#': InlineCommentTag\n}\n\nexport { AssignTag, ForTag, CaptureTag, CaseTag, CommentTag, IncludeTag, RenderTag, DecrementTag, IncrementTag, CycleTag, IfTag, LayoutTag, BlockTag, RawTag, TablerowTag, UnlessTag, BreakTag, ContinueTag, EchoTag, LiquidTag, InlineCommentTag }\n","import { Context } from './context'\nimport { toPromise, toValueSync, isFunction, forOwn, isString, strictUniq } from './util'\nimport { TagClass, createTagClass, TagImplOptions, FilterImplOptions, Template, Value, StaticAnalysisOptions, StaticAnalysis, analyze, analyzeSync, SegmentArray } from './template'\nimport { LookupType } from './fs/loader'\nimport { Render } from './render'\nimport { Parser } from './parser'\nimport { tags } from './tags'\nimport { filters } from './filters'\nimport { LiquidOptions, normalizeDirectoryList, NormalizedFullOptions, normalize, RenderOptions, RenderFileOptions } from './liquid-options'\n\nexport class Liquid {\n public readonly options: NormalizedFullOptions\n public readonly renderer = new Render()\n /**\n * @deprecated will be removed. In tags use `this.parser` instead\n */\n public readonly parser: Parser\n public readonly filters: Record = Object.create(null)\n public readonly tags: Record = Object.create(null)\n\n public constructor (opts: LiquidOptions = {}) {\n this.options = normalize(opts)\n // eslint-disable-next-line deprecation/deprecation\n this.parser = new Parser(this)\n forOwn(tags, (conf: TagClass, name: string) => this.registerTag(name, conf))\n forOwn(filters, (handler: FilterImplOptions, name: string) => this.registerFilter(name, handler))\n }\n public parse (html: string, filepath?: string): Template[] {\n const parser = new Parser(this)\n return parser.parse(html, filepath)\n }\n\n public _render (tpl: Template[], scope: Context | object | undefined, renderOptions: RenderOptions): IterableIterator {\n const ctx = scope instanceof Context ? scope : new Context(scope, this.options, renderOptions)\n return this.renderer.renderTemplates(tpl, ctx)\n }\n public async render (tpl: Template[], scope?: object, renderOptions?: RenderOptions): Promise {\n return toPromise(this._render(tpl, scope, { ...renderOptions, sync: false }))\n }\n public renderSync (tpl: Template[], scope?: object, renderOptions?: RenderOptions): any {\n return toValueSync(this._render(tpl, scope, { ...renderOptions, sync: true }))\n }\n public renderToNodeStream (tpl: Template[], scope?: object, renderOptions: RenderOptions = {}): NodeJS.ReadableStream {\n const ctx = new Context(scope, this.options, renderOptions)\n return this.renderer.renderTemplatesToNodeStream(tpl, ctx)\n }\n\n public _parseAndRender (html: string, scope: Context | object | undefined, renderOptions: RenderOptions): IterableIterator {\n const tpl = this.parse(html)\n return this._render(tpl, scope, renderOptions)\n }\n public async parseAndRender (html: string, scope?: Context | object, renderOptions?: RenderOptions): Promise {\n return toPromise(this._parseAndRender(html, scope, { ...renderOptions, sync: false }))\n }\n public parseAndRenderSync (html: string, scope?: Context | object, renderOptions?: RenderOptions): any {\n return toValueSync(this._parseAndRender(html, scope, { ...renderOptions, sync: true }))\n }\n\n public _parsePartialFile (file: string, sync?: boolean, currentFile?: string) {\n return new Parser(this).parseFile(file, sync, LookupType.Partials, currentFile)\n }\n public _parseLayoutFile (file: string, sync?: boolean, currentFile?: string) {\n return new Parser(this).parseFile(file, sync, LookupType.Layouts, currentFile)\n }\n public _parseFile (file: string, sync?: boolean, lookupType?: LookupType, currentFile?: string): Generator {\n return new Parser(this).parseFile(file, sync, lookupType, currentFile)\n }\n public async parseFile (file: string, lookupType?: LookupType): Promise {\n return toPromise(new Parser(this).parseFile(file, false, lookupType))\n }\n public parseFileSync (file: string, lookupType?: LookupType): Template[] {\n return toValueSync(new Parser(this).parseFile(file, true, lookupType))\n }\n public * _renderFile (file: string, ctx: Context | object | undefined, renderFileOptions: RenderFileOptions): Generator {\n const templates = (yield this._parseFile(file, renderFileOptions.sync, renderFileOptions.lookupType)) as Template[]\n return yield this._render(templates, ctx, renderFileOptions)\n }\n public async renderFile (file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions) {\n return toPromise(this._renderFile(file, ctx, { ...renderFileOptions, sync: false }))\n }\n public renderFileSync (file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions) {\n return toValueSync(this._renderFile(file, ctx, { ...renderFileOptions, sync: true }))\n }\n public async renderFileToNodeStream (file: string, scope?: object, renderOptions?: RenderOptions) {\n const templates = await this.parseFile(file)\n return this.renderToNodeStream(templates, scope, renderOptions)\n }\n\n public _evalValue (str: string, scope?: object | Context): IterableIterator {\n const value = new Value(str, this)\n const ctx = scope instanceof Context ? scope : new Context(scope, this.options)\n return value.value(ctx)\n }\n public async evalValue (str: string, scope?: object | Context): Promise {\n return toPromise(this._evalValue(str, scope))\n }\n public evalValueSync (str: string, scope?: object | Context): any {\n return toValueSync(this._evalValue(str, scope))\n }\n\n public registerFilter (name: string, filter: FilterImplOptions) {\n this.filters[name] = filter\n }\n public registerTag (name: string, tag: TagClass | TagImplOptions) {\n this.tags[name] = isFunction(tag) ? tag : createTagClass(tag)\n }\n public plugin (plugin: (this: Liquid, L: typeof Liquid) => void) {\n return plugin.call(this, Liquid)\n }\n public express () {\n const self = this // eslint-disable-line\n let firstCall = true\n\n return function (this: any, filePath: string, ctx: object, callback: (err: Error | null, rendered: string) => void) {\n if (firstCall) {\n firstCall = false\n const dirs = normalizeDirectoryList(this.root)\n self.options.root.unshift(...dirs)\n self.options.layouts.unshift(...dirs)\n self.options.partials.unshift(...dirs)\n }\n self.renderFile(filePath, ctx).then(html => callback(null, html) as any, callback as any)\n }\n }\n\n public async analyze (template: Template[], options: StaticAnalysisOptions = {}): Promise {\n return analyze(template, options)\n }\n\n public analyzeSync (template: Template[], options: StaticAnalysisOptions = {}): StaticAnalysis {\n return analyzeSync(template, options)\n }\n\n public async parseAndAnalyze (html: string, filename?: string, options: StaticAnalysisOptions = {}): Promise {\n return analyze(this.parse(html, filename), options)\n }\n\n public parseAndAnalyzeSync (html: string, filename?: string, options: StaticAnalysisOptions = {}): StaticAnalysis {\n return analyzeSync(this.parse(html, filename), options)\n }\n\n /** Return an array of all variables without their properties. */\n public async variables (template: string | Template[], options: StaticAnalysisOptions = {}): Promise {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Object.keys(analysis.variables)\n }\n\n /** Return an array of all variables without their properties. */\n public variablesSync (template: string | Template[], options: StaticAnalysisOptions = {}): string[] {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Object.keys(analysis.variables)\n }\n\n /** Return an array of all variables including their properties/paths. */\n public async fullVariables (template: string | Template[], options: StaticAnalysisOptions = {}): Promise {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))))\n }\n\n /** Return an array of all variables including their properties/paths. */\n public fullVariablesSync (template: string | Template[], options: StaticAnalysisOptions = {}): string[] {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))))\n }\n\n /** Return an array of all variables, each as an array of properties/segments. */\n public async variableSegments (template: string | Template[], options: StaticAnalysisOptions = {}): Promise> {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))))\n }\n\n /** Return an array of all variables, each as an array of properties/segments. */\n public variableSegmentsSync (template: string | Template[], options: StaticAnalysisOptions = {}): Array {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))))\n }\n\n /** Return an array of all expected context variables without their properties. */\n public async globalVariables (template: string | Template[], options: StaticAnalysisOptions = {}): Promise {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Object.keys(analysis.globals)\n }\n\n /** Return an array of all expected context variables without their properties. */\n public globalVariablesSync (template: string | Template[], options: StaticAnalysisOptions = {}): string[] {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Object.keys(analysis.globals)\n }\n\n /** Return an array of all expected context variables including their properties/paths. */\n public async globalFullVariables (template: string | Template[], options: StaticAnalysisOptions = {}): Promise {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))))\n }\n\n /** Return an array of all expected context variables including their properties/paths. */\n public globalFullVariablesSync (template: string | Template[], options: StaticAnalysisOptions = {}): string[] {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))))\n }\n\n /** Return an array of all expected context variables, each as an array of properties/segments. */\n public async globalVariableSegments (template: string | Template[], options: StaticAnalysisOptions = {}): Promise> {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))))\n }\n\n /** Return an array of all expected context variables, each as an array of properties/segments. */\n public globalVariableSegmentsSync (template: string | Template[], options: StaticAnalysisOptions = {}): Array {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))))\n }\n}\n","import { isFunction } from '../util'\nimport { Hash } from './hash'\nimport { Tag, TagClass, TagRenderReturn } from './tag'\nimport { TagToken, TopLevelToken } from '../tokens'\nimport { Emitter } from '../emitters'\nimport { Context } from '../context'\nimport type { Liquid } from '../liquid'\n\nexport interface TagImplOptions {\n [key: string]: any\n parse?: (this: Tag & TagImplOptions, token: TagToken, remainingTokens: TopLevelToken[]) => void;\n render: (this: Tag & TagImplOptions, ctx: Context, emitter: Emitter, hash: Record) => TagRenderReturn;\n}\n\nexport function createTagClass (options: TagImplOptions): TagClass {\n return class extends Tag {\n constructor (token: TagToken, tokens: TopLevelToken[], liquid: Liquid) {\n super(token, tokens, liquid)\n if (isFunction(options.parse)) {\n options.parse.call(this, token, tokens)\n }\n }\n * render (ctx: Context, emitter: Emitter): TagRenderReturn {\n const hash = (yield new Hash(this.token.args, ctx.opts.keyValueSeparator).render(ctx)) as Record\n return yield options.render.call(this, ctx, emitter, hash)\n }\n }\n}\n","/* istanbul ignore file */\nexport const version = '[VI]{version}[/VI]'\nexport * as TypeGuards from './util/type-guards'\nexport { toValue, createTrie, Trie, toPromise, toValueSync, assert, LiquidError, ParseError, RenderError, UndefinedVariableError, TokenizationError, AssertionError } from './util'\nexport type { LiquidErrors } from './util/error'\nexport { Drop } from './drop'\nexport type { Comparable } from './drop'\nexport { Emitter } from './emitters'\nexport { defaultOperators, Operators, evalToken, evalQuotedToken, Expression, isFalsy, isTruthy } from './render'\nexport { Context, Scope } from './context'\nexport { Value, Hash, Template, FilterImplOptions, Tag, Filter, Output, Variable, VariableLocation, VariableSegments, Variables, StaticAnalysis, StaticAnalysisOptions, analyze, analyzeSync, Arguments, PartialScope } from './template'\nexport type { TagRenderReturn } from './template'\nexport { Token, TopLevelToken, TagToken, ValueToken } from './tokens'\nexport type { RangeToken, LiteralToken, QuotedToken, PropertyAccessToken, NumberToken } from './tokens'\nexport { TokenKind, Tokenizer, ParseStream, Parser } from './parser'\nexport { filters } from './filters'\nexport * from './tags'\nexport { defaultOptions } from './liquid-options'\nexport type { LiquidOptions, RenderOptions, RenderFileOptions } from './liquid-options'\nexport { FS, LookupType } from './fs'\nexport { Liquid } from './liquid'\n"],"names":["Token","this","input","slice","begin","end","_a","__read","row","col","i","kind","file","Drop","key","context","toString","Object","prototype","toLowerCase","String","hasOwnProperty","isString","value","isFunction","isIterator","val","next","throw","return","stringify","toValue","isNil","isArray","map","join","readArrayElement","arr","index","ownPropertyOnly","length","call","toEnumerable","isObject","Symbol","iterator","Array","from","keys","toArray","valueOf","toNumber","isNumber","isArrayLike","forOwn","obj","iteratee","k","type","range","start","stop","step","push","padStart","str","ch","pad","add","n","repeat","identify","orderedCompare","a","b","caseInsensitiveCompare","argumentsToValue","fn","_i","args","argumentsToNumber","strictUniq","array","seen","Set","array_1","__values","element","JSON","has","_b","TRAIT","__extends","Error","LiquidError","line","lines","msg","token","defineProperty","getPosition","split","Math","max","min","_\r\n .range","lineNumber","rowIndicator","num","_.padStart","text","colIndicator","enumerable","message","stack","originalError","err","_super","_this","name","update","RenderError","tpl","LiquidErrors","errors","s","variableName","TYPES","WORD","BLANK","INLINE_BLANK","isWord","char","code","charCodeAt","assert","predicate","AssertionError","assertEmpty","NullDrop","EmptyDrop","BlankDrop","test","equals","ForloopDrop","collection","variable","SimpleEmitter","html","buffer","KeepingTypeEmitter","BlockDrop","emitter","superBlockRender","isComparable","arg","gt","geq","lt","leq","nil","literalValues","true","false","null","empty","blank","trieCache","WeakMap","createTrie","cached","get","trie","entries","_d","name_1","data","node","c","needBoundary","set","toLiquidAsync","asyncFn","syncFn","syncImpl","sync","toPromise","done","state","then","err_1","toValueSync","rFormat","daysInMonth","d","year","getFullYear","getDayOfYear","getMonth","getDate","getWeekOfYear","startDay","now","getDay","Date","floor","padWidths","e","H","I","j","l","L","m","M","S","U","W","padSpaceChars","getTimezoneOffset","opts","nOffset","abs","h","flags","formatCodes","getShortWeekdayName","A","getLongWeekdayName","getShortMonthName","B","getLongMonthName","toLocaleString","C","parseInt","substring","getHours","getMilliseconds","getMinutes","N","width","Number","memoryLimit","use","p","P","q","date","includes","round","getTime","getSeconds","u","w","x","toLocaleDateString","X","toLocaleTimeString","y","Y","z","Z","getTimeZoneName","t","%","strftime","formatStr","match","output","remaining","exec","_c","flagStr","modifier","conversion","convert","flagStr_1","flag","ret","padChar","padWidth","toUpperCase","__spreadArray","some","getDateTimeFormat","Intl","DateTimeFormat","undefined","TIMEZONE_PATTERN","monthNames","monthNamesShort","dayNames","dayNamesShort","LiquidDate","displayDate","locale","init","timeZone","timezoneOffset","timezoneFixed","timezoneName","resolvedOptions","format","month","weekday","isNaN","options","dateString","hours","offset","sign","minutes","localDateString","utcDateString","localDate","timezone","diff","time","Limiter","count","base","limit","resource","DelimitedToken","contentRange","trimLeft","trimRight","contentBegin","contentEnd","tl","tr","r","trimTagLeft","trimTagRight","tagDelimiterLeft","tagDelimiterRight","valueBegin","valueEnd","TokenKind","Tag","tokenizer","Tokenizer","operators","readTagName","skipBlank","trimOutputLeft","trimOutputRight","outputDelimiterLeft","outputDelimiterRight","valueRange","Output","HTMLToken","HTML","content","getText","Word","Literal","literal","operatorPrecedences","==","!=",">","<",">=","<=","contains","not","and","or","operatorTypes","OperatorToken","operator","Operator","props","PropertyAccess","Filter","Hash","rHex","rOct","escapeChar","f","v","hexVal","Quoted","fromCharCode","lhs","rhs","Range","LiquidTagToken","initial","filters","FilteredValue","polyfill","getPerformance","global","performance","window","Render","templates","ctx","StreamedEmitter","Promise","resolve","renderTemplates","error","stream","keepOutputType","renderLimit","check","templates_1","render","write","breakCalled","continueCalled","is","e_1","catchAllErrors","Expression","lenient","operands","postfix","isOperatorToken","pop","result","_f","evalToken","tokens","ops","tokens_1","getPrecedence","isPropertyAccessToken","prop","_getFromScope","_get","e_3","UndefinedVariableError","isRangeToken","low","high","evalQuotedToken","isTruthy","isFalsy","jsTruthy","defaultOperators","indexOf","prev","LRU","cache","Node","head","size","ensureLimit","remove","tail","domResolve","root","path","document","createElement","href","getElementsByTagName","insertBefore","firstChild","resolved","removeChild","filepath","ext","replace","origin","last","url","reject","xhr","XMLHttpRequest","onload","status","responseText","statusText","onerror","open","send","chargeJsonReplacerValue","json","space","_key","default","defaultValue","Map","raw","handler","jsonify","to_integer","inspect","ancestors","escapeMap","&","\"","'","unescapeMap","&","<",">",""","'","escape","blocks","out","blocks_1","opener_1","closer","startsWith","delete","MapFS","existsSync","mapping","readFileSync","segments","sep","dir","segment","defaultOptions","layouts","partials","relativeReference","jekyllInclude","keyValueSeparator","extname","fs","dynamicPartials","dateFormat","greedy","preserveTimezones","strictFilters","strictVariables","lenientIf","globals","Infinity","parseLimit","normalize","nameOrFunction","dirname","console","warn","normalizeDirectoryList","outputEscape","misc","list","whiteSpaceCtrl","inRaw","isDelimitedToken","mask","isHTMLToken","isTagToken","charAt","readExpressionTokens","readOperator","operand","readValue","matchTrie","opTrie","info","peek","readExpression","valid","snapshot","readFilters","FilteredValueToken","filter","readFilter","read","readIdentifier","readFilterArg","FilterToken","readTopLevelToken","rawBeginAt","readEndrawOrRawContent","readTagToken","readOutputToken","readHTMLToken","stopStrings","readToDelimiter","TagToken","delimiter","respectQuoted","peekType","readQuoted","rmatch","OutputToken","leftPos","readTo","readLiquidTagToken","pos","TokenizationError","IdentifierToken","pred","id","jekyllStyle","hashes","hash","readHash","readNonEmptyIdentifier","HashToken","readLiteral","readRange","readNumber","readProperties","PropertyAccessToken","isBegin","decimalFound","digitFound","NumberToken","advance","literalTrie","LiteralToken","readValueOrThrow","RangeToken","escaped","QuotedToken","htmlStopStrings","htmlStopStringSet","word","pattern","ParseStream","cb","handlers","event","template","trigger","stopRequested","shift","parseToken","TemplateImpl","remainTokens","liquid","_e","_g","readHashes","isKeyValuePair","argv","_j","apply","Value","evaluate","impl","readFilteredValue","getFilter","token_1","getContent","Variable","segmentsString","_visit","segments_1","location","VariableMap","fromEntries","defaultStaticAnalysisOptions","_analyze","visit","scope","arguments","extractVariables","updateVariables","variables","aliased","alias","rootScope","localScope","ident","deleteAlias","locals","children","partialScope","partial","_h","_z","partialScopeNames","isolated","DummyScope","_k","_m","argument","variables_1","setAlias","_o","blockScope","_q","asObject","analyze","__assign","analyzeSync","names","aliases","getAlias","to","isValueToken","extractValueTokenVariables","extractPropertyAccessVariable","isQuotedToken","isNumberToken","isWordToken","RE_PROPERTY","bracketedRoot","buf","LookupType","Loader","currentFile","dirs","candidates","allowed","dirs_1","exists","lookupError","shouldLoadRelative","dirs_2","fallback","roots","prefixes_1","referencedFile","prefix","_referencedFile","bind","containsSync","Parser","readTopLevelTokens","parseTokens","TagClass","tags","isOutputToken","ParseError","Root","loader","tpls","task","_parseFile","taskOrTpl","lookup","parse","readFile","parseFile","_parseFileCached","getKind","Delimited","createScope","create","assign","Context","registers","getRegister","keyValues","forEach","setRegister","environments","scopes","reduce","paths","getSync","findScope","readProperty","InternalUndefinedVariableError","candidate","toLiquid","readJSProperty","liquidMethodMissing","BlockMode","env","renderOptions","at_least","at_most","ceil","divided_by","dividend","divisor","integerArithmetic","minus","plus","modulo","times","amp","pow","scaled","EPSILON","rSlugifyDefault","rSlugifyReplacers","pretty","ascii","latin","none","decodeURIComponent","encodeURIComponent","encodeURI","mode","cased","replacer","outputSize","first","reverse","sortBy","property","comparator","values","item","sort","tuple","concat","expectedMatcher","expected","jekyllWhere","include","readScopeValue","arr_1","spawn","matcher","_","filter_exp","itemName","exp","filtered","keyTemplate","array_4","search","search_exp","results","array_2","sum","array_3","clone","unshift","arr_2","items","arr_3","shuffled","random","parseDate","stringify_date","month_type","style","ml","defaultTimezoneOffset","createDateFixedToTimezone","rCJKWord","rNonCJKWord","chars","trimStart","lastIndexOf","trimEnd","trim","replacement","parts","arg1","arg2","o","words","connector","Buffer","isBuffer","byteLength","btoa","TextEncoder","encode","TextDecoder","decode","Uint8Array","atob","bufferToHex","bytes","hex","crypto","subtle","digest","keyStr","encoder","importKey","cryptoKey","htmlFilters","mathFilters","urlFilters","arrayFilters","dateFilters","stringFilters","base64Filters","cryptoFilters","default_1","bottom","identifier","MODIFIERS","renderer","elseTemplates","continueKey","continue","modifiers","orderedFilterParameters","forloop","collection_1","parser","inStr","parseStream","on","tag","tagToken","readVariable","target","branchHit","branches","branch","flatMap","elseCount","renderFilePath","childCtx","with","forBinding","_parsePartialFile","parseFilePath","keyword","beforeAs","binding","TypeGuards.isQuotedToken","optimize","readFileNameTemplate","TypeGuards.isHTMLToken","withVar","saved","saveRegister","OUTPUT","restoreRegister","group","fingerprint","groups","idx","_parseLayoutFile","STORE","parent","blockRender","getBlockRender","block","renderCurrent","superBlock","self","renderChild","TablerowloopDrop","cols","col0","tablerowloop","collectionToken","test_1","_emitter","readLiquidTagTokens","AssignTag","for","ForTag","capture","CaptureTag","case","CaseTag","comment","CommentTag","IncludeTag","RenderTag","decrement","DecrementTag","increment","IncrementTag","cycle","CycleTag","if","IfTag","layout","LayoutTag","BlockTag","RawTag","tablerow","TablerowTag","unless","UnlessTag","break","BreakTag","ContinueTag","echo","EchoTag","LiquidTag","#","InlineCommentTag","Liquid","_render","renderTemplatesToNodeStream","_parseAndRender","Partials","Layouts","lookupType","renderFileOptions","_renderFile","renderToNodeStream","_evalValue","class_1","plugin","firstCall","filePath","callback","renderFile","filename","analysis","conf","registerTag","registerFilter"],"mappings":"q5FAUSA,oBAAP,WACE,OAAOC,KAAKC,MAAMC,MAAMF,KAAKG,MAAOH,KAAKI,GAAG,GAEvCL,wBAAP,WAEE,IADI,IAAAM,EAAAC,GAAa,CAAC,EAAG,MAAhBC,OAAKC,OACDC,EAAI,EAAGA,EAAIT,KAAKG,MAAOM,CAAC,GACT,OAAlBT,KAAKC,MAAMQ,IACbF,CAAG,GACHC,EAAM,GACDA,CAAG,GAEZ,MAAO,CAACD,EAAKC,IAERT,iBAAP,WACE,OAAOC,KAAKI,IAAMJ,KAAKG,eArBzB,WACSO,EACAT,EACAE,EACAC,EACAO,GAJAX,UAAAU,EACAV,WAAAC,EACAD,WAAAG,EACAH,SAAAI,EACAJ,UAAAW,ECJFC,gCAAP,SAA4BC,EAAsBC,aAFpD,cCAO,IAAMC,EAAWC,OAAOC,UAAUF,SACnCG,EAAcC,OAAOF,UAAUC,YAExBE,EAAiBJ,OAAOI,wBAErBC,GAAUC,GACxB,MAAwB,UAAjB,OAAOA,CAChB,UAGgBC,EAAYD,GAC1B,MAAwB,YAAjB,OAA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AC2V,GAAM,OAAAA,EAAE5U,UAAS,EAAC,CAAC,CAAC,SAIlGo6B,uCAAP,SAAmCnW,EAA+BhU,gBAAAA,MAC1DqrB,EAAWtT,GAAY3pB,GAAS4lB,CAAQ,EAAIjnB,KAAK+tB,MAAM9G,CAAQ,EAAIA,EAAUhU,CAAO,EAC1F,OAAOpQ,MAAMC,KAAKkC,GAAWhE,OAAO8wB,OAAOwM,EAAShd,OAAO,EAAEiX,QAAQ,SAAC/zB,GAAM,OAAAA,EAAEvC,IAAI,SAAC2V,GAAM,OAAAA,EAAE5U,UAAS,EAAC,CAAC,CAAC,MA9LzG,WAAoB2K,gBAAAA,MAApB,WARgB3N,cAAW,IAAI4Y,GAKf5Y,aAA6CgB,OAAOstB,OAAO,IAAI,EAC/DtuB,UAAiCgB,OAAOstB,OAAO,IAAI,EAGjEtuB,KAAKiT,QAAUwO,GAAU9T,CAAI,EAE7B3N,KAAK43B,OAAS,IAAI3K,GAAOjtB,IAAI,EAC7BqD,EAAOgqB,GAAM,SAACkR,EAAgBj3B,GAAiB,OAAAD,EAAKm3B,YAAYl3B,EAAMi3B,CAAI,EAAC,EAC3El7B,EAAOgV,GAAS,SAACmG,EAA4BlX,GAAiB,OAAAD,EAAKo3B,eAAen3B,EAAMkX,CAAO,EAAC,02BExB7E"} \ No newline at end of file diff --git a/node_modules/liquidjs/dist/liquid.browser.mjs b/node_modules/liquidjs/dist/liquid.browser.mjs new file mode 100644 index 00000000..5b5d2e57 --- /dev/null +++ b/node_modules/liquidjs/dist/liquid.browser.mjs @@ -0,0 +1,5161 @@ +/* + * liquidjs@10.27.2, https://github.com/harttle/liquidjs + * (c) 2016-2026 harttle + * Released under the MIT License. + */ +class Token { + constructor(kind, input, begin, end, file) { + this.kind = kind; + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + } + getText() { + return this.input.slice(this.begin, this.end); + } + getPosition() { + let [row, col] = [1, 1]; + for (let i = 0; i < this.begin; i++) { + if (this.input[i] === '\n') { + row++; + col = 1; + } + else + col++; + } + return [row, col]; + } + size() { + return this.end - this.begin; + } +} + +class Drop { + liquidMethodMissing(key, context) { + return undefined; + } +} + +const toString$1 = Object.prototype.toString; +const toLowerCase = String.prototype.toLowerCase; +const hasOwnProperty = Object.hasOwnProperty; +function isString(value) { + return typeof value === 'string'; +} +// eslint-disable-next-line @typescript-eslint/ban-types +function isFunction(value) { + return typeof value === 'function'; +} +function isPromise(val) { + return val && isFunction(val.then); +} +function isIterator(val) { + return val && isFunction(val.next) && isFunction(val.throw) && isFunction(val.return); +} +function stringify(value) { + value = toValue(value); + if (isString(value)) + return value; + if (isNil(value)) + return ''; + if (isArray(value)) + return value.map(x => stringify(x)).join(''); + return String(value); +} +function readArrayElement(arr, index, ownPropertyOnly) { + if (index < 0) + index = arr.length + index; + if (ownPropertyOnly && !hasOwnProperty.call(arr, index)) + return undefined; + return arr[index]; +} +function toEnumerable(val) { + val = toValue(val); + if (isArray(val)) + return val; + if (isString(val) && val.length > 0) + return [val]; + if (isIterable(val)) + return Array.from(val); + if (isObject(val)) + return Object.keys(val).map((key) => [key, val[key]]); + return []; +} +function toArray(val) { + val = toValue(val); + if (isNil(val)) + return []; + if (isArray(val)) + return val; + return [val]; +} +function toValue(value) { + return (value instanceof Drop && isFunction(value.valueOf)) ? value.valueOf() : value; +} +function toNumber(value) { + return +toValue(value) || 0; +} +function isNumber(value) { + return typeof value === 'number'; +} +function toLiquid(value) { + if (value && isFunction(value.toLiquid)) + return toLiquid(value.toLiquid()); + return value; +} +function isNil(value) { + return value == null; +} +function isUndefined(value) { + return value === undefined; +} +function isArray(value) { + // be compatible with IE 8 + return toString$1.call(value) === '[object Array]'; +} +function isArrayLike(value) { + return value && isNumber(value.length); +} +function isIterable(value) { + return isObject(value) && Symbol.iterator in value; +} +/* + * Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property. + * The iteratee is invoked with three arguments: (value, key, object). + * Iteratee functions may exit iteration early by explicitly returning false. + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @return {Object} Returns object. + */ +function forOwn(obj, iteratee) { + obj = obj || {}; + for (const k in obj) { + if (hasOwnProperty.call(obj, k)) { + if (iteratee(obj[k], k, obj) === false) + break; + } + } + return obj; +} +function last(arr) { + return arr[arr.length - 1]; +} +/* + * Checks if value is the language type of Object. + * (e.g. arrays, functions, objects, regexes, new Number(0), and new String('')) + * @param {any} value The value to check. + * @return {Boolean} Returns true if value is an object, else false. + */ +function isObject(value) { + const type = typeof value; + return value !== null && (type === 'object' || type === 'function'); +} +function range(start, stop, step = 1) { + const arr = []; + for (let i = start; i < stop; i += step) { + arr.push(i); + } + return arr; +} +function padStart(str, length, ch = ' ') { + return pad(str, length, ch, (str, ch) => ch + str); +} +function padEnd(str, length, ch = ' ') { + return pad(str, length, ch, (str, ch) => str + ch); +} +function pad(str, length, ch, add) { + str = String(str); + const n = length - str.length; + if (n <= 0) + return str; + return add(str, ch.repeat(n)); +} +function identify(val) { + return val; +} +function changeCase(str) { + const hasLowerCase = [...str].some(ch => ch >= 'a' && ch <= 'z'); + return hasLowerCase ? str.toUpperCase() : str.toLowerCase(); +} +function ellipsis(str, N) { + return str.length > N ? str.slice(0, N - 3) + '...' : str; +} +function orderedCompare(a, b) { + if (isNil(a) && isNil(b)) + return 0; + if (isNil(a)) + return 1; + if (isNil(b)) + return -1; + if (a < b) + return -1; + if (a > b) + return 1; + return 0; +} +// compare string in case-insensitive way, undefined values to the tail +function caseInsensitiveCompare(a, b) { + if (isNil(a) && isNil(b)) + return 0; + if (isNil(a)) + return 1; + if (isNil(b)) + return -1; + a = toLowerCase.call(a); + b = toLowerCase.call(b); + if (a < b) + return -1; + if (a > b) + return 1; + return 0; +} +function argumentsToValue(fn) { + return function (...args) { return fn.call(this, ...args.map(toValue)); }; +} +function argumentsToNumber(fn) { + return function (...args) { return fn.call(this, ...args.map(toNumber)); }; +} +/** Return an array containing unique elements from _array_. Works with nested arrays and objects. */ +function* strictUniq(array) { + const seen = new Set(); + for (const element of array) { + const key = JSON.stringify(element); + if (!seen.has(key)) { + seen.add(key); + yield element; + } + } +} + +/** + * targeting ES5, extends Error won't create a proper prototype chain, need a trait to keep track of classes + */ +const TRAIT = '__liquidClass__'; +class LiquidError extends Error { + constructor(err, token) { + /** + * note: for ES5 targeting, `this` will be replaced by return value of Error(), + * thus everything on `this` will be lost, avoid calling `LiquidError` methods here + */ + super(typeof err === 'string' ? err : err.message); + this.context = ''; + if (typeof err !== 'string') + Object.defineProperty(this, 'originalError', { value: err, enumerable: false }); + Object.defineProperty(this, 'token', { value: token, enumerable: false }); + Object.defineProperty(this, TRAIT, { value: 'LiquidError', enumerable: false }); + } + update() { + Object.defineProperty(this, 'context', { value: mkContext(this.token), enumerable: false }); + this.message = mkMessage(this.message, this.token); + this.stack = this.message + '\n' + this.context + + '\n' + this.stack; + if (this.originalError) + this.stack += '\nFrom ' + this.originalError.stack; + } + static is(obj) { + return (obj === null || obj === void 0 ? void 0 : obj[TRAIT]) === 'LiquidError'; + } +} +class TokenizationError extends LiquidError { + constructor(message, token) { + super(message, token); + this.name = 'TokenizationError'; + super.update(); + } +} +class ParseError extends LiquidError { + constructor(err, token) { + super(err, token); + this.name = 'ParseError'; + this.message = err.message; + super.update(); + } +} +class RenderError extends LiquidError { + constructor(err, tpl) { + super(err, tpl.token); + this.name = 'RenderError'; + this.message = err.message; + super.update(); + } + static is(obj) { + return obj.name === 'RenderError'; + } +} +class LiquidErrors extends LiquidError { + constructor(errors) { + super(errors[0], errors[0].token); + this.errors = errors; + this.name = 'LiquidErrors'; + const s = errors.length > 1 ? 's' : ''; + this.message = `${errors.length} error${s} found`; + super.update(); + } + static is(obj) { + return obj.name === 'LiquidErrors'; + } +} +class UndefinedVariableError extends LiquidError { + constructor(err, token) { + super(err, token); + this.name = 'UndefinedVariableError'; + this.message = err.message; + super.update(); + } +} +// only used internally; raised where we don't have token information, +// so it can't be an UndefinedVariableError. +class InternalUndefinedVariableError extends Error { + constructor(variableName) { + super(`undefined variable: ${variableName}`); + this.name = 'InternalUndefinedVariableError'; + this.variableName = variableName; + } +} +class AssertionError extends Error { + constructor(message) { + super(message); + this.name = 'AssertionError'; + this.message = message + ''; + } +} +function mkContext(token) { + const [line, col] = token.getPosition(); + const lines = token.input.split('\n'); + const begin = Math.max(line - 2, 1); + const end = Math.min(line + 3, lines.length); + const context = range(begin, end + 1) + .map(lineNumber => { + const rowIndicator = (lineNumber === line) ? '>> ' : ' '; + const num = padStart(String(lineNumber), String(end).length); + let text = `${rowIndicator}${num}| `; + const colIndicator = lineNumber === line + ? '\n' + padStart('^', col + text.length) + : ''; + text += lines[lineNumber - 1]; + text += colIndicator; + return text; + }) + .join('\n'); + return context; +} +function mkMessage(msg, token) { + if (token.file) + msg += `, file:${token.file}`; + const [line, col] = token.getPosition(); + msg += `, line:${line}, col:${col}`; + return msg; +} + +// **DO NOT CHANGE THIS FILE** +// +// This file is generated by bin/character-gen.js +// bitmask character types to boost performance +const TYPES = [0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 4, 4, 4, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 8, 0, 0, 0, 0, 8, 0, 0, 0, 64, 0, 65, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 0, 0, 2, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]; +const WORD = 1; +const BLANK = 4; +const QUOTE = 8; +const INLINE_BLANK = 16; +const NUMBER = 32; +const SIGN = 64; +const PUNCTUATION = 128; +function isWord(char) { + const code = char.charCodeAt(0); + return code >= 128 ? !TYPES[code] : !!(TYPES[code] & WORD); +} +TYPES[160] = TYPES[5760] = TYPES[6158] = TYPES[8192] = TYPES[8193] = TYPES[8194] = TYPES[8195] = TYPES[8196] = TYPES[8197] = TYPES[8198] = TYPES[8199] = TYPES[8200] = TYPES[8201] = TYPES[8202] = TYPES[8232] = TYPES[8233] = TYPES[8239] = TYPES[8287] = TYPES[12288] = BLANK; +TYPES[8220] = TYPES[8221] = PUNCTUATION; + +function assert(predicate, message) { + if (!predicate) { + const msg = typeof message === 'function' + ? message() + : (message || `expect ${predicate} to be true`); + throw new AssertionError(msg); + } +} +function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate)}`) { + assert(!predicate, message); +} + +class NullDrop extends Drop { + equals(value) { + return isNil(toValue(value)); + } + gt() { + return false; + } + geq() { + return false; + } + lt() { + return false; + } + leq() { + return false; + } + valueOf() { + return null; + } +} + +class EmptyDrop extends Drop { + equals(value) { + if (value instanceof EmptyDrop) + return false; + value = toValue(value); + if (isString(value) || isArray(value)) + return value.length === 0; + if (isObject(value)) + return Object.keys(value).length === 0; + return false; + } + gt() { + return false; + } + geq() { + return false; + } + lt() { + return false; + } + leq() { + return false; + } + valueOf() { + return ''; + } + static is(value) { + return value instanceof EmptyDrop; + } +} + +class BlankDrop extends EmptyDrop { + equals(value) { + if (value === false) + return true; + if (isNil(toValue(value))) + return true; + if (isString(value)) + return /^\s*$/.test(value); + return super.equals(value); + } + static is(value) { + return value instanceof BlankDrop; + } +} + +class ForloopDrop extends Drop { + constructor(length, collection, variable) { + super(); + this.i = 0; + this.length = length; + this.name = `${variable}-${collection}`; + } + next() { + this.i++; + } + index0() { + return this.i; + } + index() { + return this.i + 1; + } + first() { + return this.i === 0; + } + last() { + return this.i === this.length - 1; + } + rindex() { + return this.length - this.i; + } + rindex0() { + return this.length - this.i - 1; + } + valueOf() { + return JSON.stringify(this); + } +} + +class SimpleEmitter { + constructor() { + this.buffer = ''; + } + write(html) { + this.buffer += stringify(html); + } +} + +class StreamedEmitter { + constructor() { + this.buffer = ''; + this.stream = null; + throw new Error('streaming not supported in browser'); + } +} + +class KeepingTypeEmitter { + constructor() { + this.buffer = ''; + } + write(html) { + html = toValue(html); + // This will only preserve the type if the value is isolated. + // I.E: + // {{ my-port }} -> 42 + // {{ my-host }}:{{ my-port }} -> 'host:42' + if (typeof html !== 'string' && this.buffer === '') { + this.buffer = html; + } + else { + this.buffer = stringify(this.buffer) + stringify(html); + } + } +} + +class BlockDrop extends Drop { + constructor( + // the block render from layout template + superBlockRender = () => '') { + super(); + this.superBlockRender = superBlockRender; + } + /** + * Provide parent access in child block by + * {{ block.super }} + */ + *super() { + const emitter = new SimpleEmitter(); + yield this.superBlockRender(emitter); + return emitter.buffer; + } +} + +function isComparable(arg) { + return (arg && + isFunction(arg.equals) && + isFunction(arg.gt) && + isFunction(arg.geq) && + isFunction(arg.lt) && + isFunction(arg.leq)); +} + +const nil = new NullDrop(); +const literalValues = { + 'true': true, + 'false': false, + 'nil': nil, + 'null': nil, + 'empty': new EmptyDrop(), + 'blank': new BlankDrop() +}; + +// Tries are built once per input object and reused: the Tokenizer rebuilds them +// on every instantiation, but `input` (operators/literalValues) is a stable +// reference. WeakMap-keying by `input` lets short-lived operator objects (and +// their tries) be garbage collected. The returned trie is treated as read-only +// by callers (matchTrie only reads it); do not mutate it. +const trieCache = new WeakMap(); +function createTrie(input) { + const cached = trieCache.get(input); + if (cached) + return cached; + const trie = {}; + for (const [name, data] of Object.entries(input)) { + let node = trie; + for (let i = 0; i < name.length; i++) { + const c = name[i]; + node[c] = node[c] || {}; + if (i === name.length - 1 && isWord(name[i])) { + node[c].needBoundary = true; + } + node = node[c]; + } + node.data = data; + node.end = true; + } + trieCache.set(input, trie); + return trie; +} + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function toLiquidAsync(asyncFn, syncFn) { + const syncImpl = syncFn || asyncFn; + return (sync, ...args) => { + return sync ? syncImpl(...args) : asyncFn(...args); + }; +} +// convert an async iterator to a Promise +function toPromise(val) { + return __awaiter(this, void 0, void 0, function* () { + if (!isIterator(val)) + return val; + let value; + let done = false; + let next = 'next'; + do { + const state = val[next](value); + done = !!state.done; + value = state.value; + next = 'next'; + try { + if (isIterator(value)) + value = toPromise(value); + if (isPromise(value)) + value = yield value; + } + catch (err) { + next = 'throw'; + value = err; + } + } while (!done); + return value; + }); +} +// convert an async iterator to a value in a synchronous manner +function toValueSync(val) { + if (!isIterator(val)) + return val; + let value; + let done = false; + let next = 'next'; + do { + const state = val[next](value); + done = !!state.done; + value = state.value; + next = 'next'; + if (isIterator(value)) { + try { + value = toValueSync(value); + } + catch (err) { + next = 'throw'; + value = err; + } + } + } while (!done); + return value; +} + +const rFormat = /%([-_0^#:]+)?(\d+)?([EO])?(.)/; +// prototype extensions +function daysInMonth(d) { + const feb = isLeapYear(d) ? 29 : 28; + return [31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +} +function getDayOfYear(d) { + let num = 0; + for (let i = 0; i < d.getMonth(); ++i) { + num += daysInMonth(d)[i]; + } + return num + d.getDate(); +} +function getWeekOfYear(d, startDay) { + // Skip to startDay of this week + const now = getDayOfYear(d) + (startDay - d.getDay()); + // Find the first startDay of the year + const jan1 = new Date(d.getFullYear(), 0, 1); + const then = (7 - jan1.getDay() + startDay); + return String(Math.floor((now - then) / 7) + 1); +} +function isLeapYear(d) { + const year = d.getFullYear(); + return !!((year & 3) === 0 && (year % 100 || (year % 400 === 0 && year))); +} +function ordinal(d) { + const date = d.getDate(); + if ([11, 12, 13].includes(date)) + return 'th'; + switch (date % 10) { + case 1: return 'st'; + case 2: return 'nd'; + case 3: return 'rd'; + default: return 'th'; + } +} +function century(d) { + return parseInt(d.getFullYear().toString().substring(0, 2), 10); +} +// default to 0 +const padWidths = { + d: 2, + e: 2, + H: 2, + I: 2, + j: 3, + k: 2, + l: 2, + L: 3, + m: 2, + M: 2, + S: 2, + U: 2, + W: 2 +}; +const padSpaceChars = new Set('aAbBceklpP'); +function getTimezoneOffset(d, opts) { + const nOffset = Math.abs(d.getTimezoneOffset()); + const h = Math.floor(nOffset / 60); + const m = nOffset % 60; + return (d.getTimezoneOffset() > 0 ? '-' : '+') + + padStart(h, 2, '0') + + (opts.flags[':'] ? ':' : '') + + padStart(m, 2, '0'); +} +const formatCodes = { + a: (d) => d.getShortWeekdayName(), + A: (d) => d.getLongWeekdayName(), + b: (d) => d.getShortMonthName(), + B: (d) => d.getLongMonthName(), + c: (d) => d.toLocaleString(), + C: (d) => century(d), + d: (d) => d.getDate(), + e: (d) => d.getDate(), + H: (d) => d.getHours(), + I: (d) => String(d.getHours() % 12 || 12), + j: (d) => getDayOfYear(d), + k: (d) => d.getHours(), + l: (d) => String(d.getHours() % 12 || 12), + L: (d) => d.getMilliseconds(), + m: (d) => d.getMonth() + 1, + M: (d) => d.getMinutes(), + N: (d, opts) => { + var _a; + const width = Number(opts.width) || 9; + const str = padStart(String(d.getMilliseconds()), 3, '0').slice(0, width); + (_a = opts.memoryLimit) === null || _a === void 0 ? void 0 : _a.use(width - str.length); + return padEnd(str, width, '0'); + }, + p: (d) => (d.getHours() < 12 ? 'AM' : 'PM'), + P: (d) => (d.getHours() < 12 ? 'am' : 'pm'), + q: (d) => ordinal(d), + s: (d) => Math.round(d.getTime() / 1000), + S: (d) => d.getSeconds(), + u: (d) => d.getDay() || 7, + U: (d) => getWeekOfYear(d, 0), + w: (d) => d.getDay(), + W: (d) => getWeekOfYear(d, 1), + x: (d) => d.toLocaleDateString(), + X: (d) => d.toLocaleTimeString(), + y: (d) => d.getFullYear().toString().slice(2, 4), + Y: (d) => d.getFullYear(), + z: getTimezoneOffset, + Z: (d, opts) => d.getTimeZoneName() || getTimezoneOffset(d, opts), + 't': () => '\t', + 'n': () => '\n', + '%': () => '%' +}; +formatCodes.h = formatCodes.b; +function strftime(d, formatStr, memoryLimit) { + let output = ''; + let remaining = formatStr; + let match; + while ((match = rFormat.exec(remaining))) { + output += remaining.slice(0, match.index); + remaining = remaining.slice(match.index + match[0].length); + output += format(d, match, memoryLimit); + } + return output + remaining; +} +function format(d, match, memoryLimit) { + const [input, flagStr = '', width, modifier, conversion] = match; + const convert = formatCodes[conversion]; + if (!convert) + return input; + const flags = {}; + for (const flag of flagStr) + flags[flag] = true; + let ret = String(convert(d, { flags, width, modifier, memoryLimit })); + let padChar = padSpaceChars.has(conversion) ? ' ' : '0'; + let padWidth = Number(width) || padWidths[conversion] || 0; + if (flags['^']) + ret = ret.toUpperCase(); + else if (flags['#']) + ret = changeCase(ret); + if (flags['_']) + padChar = ' '; + else if (flags['0']) + padChar = '0'; + if (flags['-']) + padWidth = 0; + memoryLimit === null || memoryLimit === void 0 ? void 0 : memoryLimit.use(Number(padWidth) - ret.length); + return padStart(ret, padWidth, padChar); +} + +function getDateTimeFormat() { + return (typeof Intl !== 'undefined' ? Intl.DateTimeFormat : undefined); +} + +// one minute in milliseconds +const OneMinute = 60000; +/** + * Need support both ISO8601 and RFC2822 as in major browsers & NodeJS + * RFC2822: https://datatracker.ietf.org/doc/html/rfc2822#section-3.3 + */ +const TIMEZONE_PATTERN = /([zZ]|([+-])(\d{2}):?(\d{2}))$/; +const monthNames = [ + 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', + 'September', 'October', 'November', 'December' +]; +const monthNamesShort = monthNames.map(name => name.slice(0, 3)); +const dayNames = [ + 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' +]; +const dayNamesShort = dayNames.map(name => name.slice(0, 3)); +/** + * A date implementation with timezone info, just like Ruby date + * + * Implementation: + * - create a Date offset by it's timezone difference, avoiding overriding a bunch of methods + * - rewrite getTimezoneOffset() to trick strftime + */ +class LiquidDate { + constructor(init, locale, timezone) { + this.locale = locale; + this.DateTimeFormat = getDateTimeFormat(); + this.date = new Date(init); + this.timezoneFixed = timezone !== undefined; + if (timezone === undefined) { + timezone = this.date.getTimezoneOffset(); + } + this.timezoneOffset = isString(timezone) ? LiquidDate.getTimezoneOffset(timezone, this.date) : timezone; + this.timezoneName = isString(timezone) ? timezone : ''; + const diff = (this.date.getTimezoneOffset() - this.timezoneOffset) * OneMinute; + const time = this.date.getTime() + diff; + this.displayDate = new Date(time); + } + getTime() { + return this.displayDate.getTime(); + } + getMilliseconds() { + return this.displayDate.getMilliseconds(); + } + getSeconds() { + return this.displayDate.getSeconds(); + } + getMinutes() { + return this.displayDate.getMinutes(); + } + getHours() { + return this.displayDate.getHours(); + } + getDay() { + return this.displayDate.getDay(); + } + getDate() { + return this.displayDate.getDate(); + } + getMonth() { + return this.displayDate.getMonth(); + } + getFullYear() { + return this.displayDate.getFullYear(); + } + toLocaleString(locale, init) { + if (init === null || init === void 0 ? void 0 : init.timeZone) { + return this.date.toLocaleString(locale, init); + } + return this.displayDate.toLocaleString(locale, init); + } + toLocaleTimeString(locale) { + return this.displayDate.toLocaleTimeString(locale); + } + toLocaleDateString(locale) { + return this.displayDate.toLocaleDateString(locale); + } + getTimezoneOffset() { + return this.timezoneOffset; + } + getTimeZoneName() { + if (this.timezoneFixed) + return this.timezoneName; + if (!this.DateTimeFormat) + return; + return this.DateTimeFormat().resolvedOptions().timeZone; + } + getLongMonthName() { + var _a; + return (_a = this.format({ month: 'long' })) !== null && _a !== void 0 ? _a : monthNames[this.getMonth()]; + } + getShortMonthName() { + var _a; + return (_a = this.format({ month: 'short' })) !== null && _a !== void 0 ? _a : monthNamesShort[this.getMonth()]; + } + getLongWeekdayName() { + var _a; + return (_a = this.format({ weekday: 'long' })) !== null && _a !== void 0 ? _a : dayNames[this.displayDate.getDay()]; + } + getShortWeekdayName() { + var _a; + return (_a = this.format({ weekday: 'short' })) !== null && _a !== void 0 ? _a : dayNamesShort[this.displayDate.getDay()]; + } + valid() { + return !isNaN(this.getTime()); + } + format(options) { + return this.DateTimeFormat && this.DateTimeFormat(this.locale, options).format(this.displayDate); + } + /** + * Create a Date object fixed to it's declared Timezone. Both + * - 2021-08-06T02:29:00.000Z and + * - 2021-08-06T02:29:00.000+08:00 + * will always be displayed as + * - 2021-08-06 02:29:00 + * regardless timezoneOffset in JavaScript realm + * + * The implementation hack: + * Instead of calling `.getMonth()`/`.getUTCMonth()` respect to `preserveTimezones`, + * we create a different Date to trick strftime, it's both simpler and more performant. + * Given that a template is expected to be parsed fewer times than rendered. + */ + static createDateFixedToTimezone(dateString, locale) { + const m = dateString.match(TIMEZONE_PATTERN); + // representing a UTC timestamp + if (m && m[1] === 'Z') { + return new LiquidDate(+new Date(dateString), locale, 0); + } + // has a timezone specified + if (m && m[2] && m[3] && m[4]) { + const [, , sign, hours, minutes] = m; + const offset = (sign === '+' ? -1 : 1) * (parseInt(hours, 10) * 60 + parseInt(minutes, 10)); + return new LiquidDate(+new Date(dateString), locale, offset); + } + return new LiquidDate(dateString, locale); + } + static getTimezoneOffset(timezoneName, date) { + const localDateString = date.toLocaleString('en-US', { timeZone: timezoneName }); + const utcDateString = date.toLocaleString('en-US', { timeZone: 'UTC' }); + const localDate = new Date(localDateString); + const utcDate = new Date(utcDateString); + return (+utcDate - +localDate) / (60 * 1000); + } +} + +class Limiter { + constructor(resource, limit) { + this.base = 0; + this.message = `${resource} limit exceeded`; + this.limit = limit; + } + use(count) { + if (+count > 0) { + assert(this.base + +count <= this.limit, this.message); + this.base += +count; + } + } + check(count) { + if (+count > 0) { + assert(+count <= this.limit, this.message); + } + } +} + +class DelimitedToken extends Token { + constructor(kind, [contentBegin, contentEnd], input, begin, end, trimLeft, trimRight, file) { + super(kind, input, begin, end, file); + this.trimLeft = false; + this.trimRight = false; + const tl = input[contentBegin] === '-'; + const tr = input[contentEnd - 1] === '-'; + let l = tl ? contentBegin + 1 : contentBegin; + let r = tr ? contentEnd - 1 : contentEnd; + while (l < r && (TYPES[input.charCodeAt(l)] & BLANK)) + l++; + while (r > l && (TYPES[input.charCodeAt(r - 1)] & BLANK)) + r--; + this.contentRange = [l, r]; + this.trimLeft = tl || trimLeft; + this.trimRight = tr || trimRight; + } + get content() { + return this.input.slice(this.contentRange[0], this.contentRange[1]); + } +} + +class TagToken extends DelimitedToken { + constructor(input, begin, end, options, file) { + const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } = options; + const [valueBegin, valueEnd] = [begin + tagDelimiterLeft.length, end - tagDelimiterRight.length]; + super(TokenKind.Tag, [valueBegin, valueEnd], input, begin, end, trimTagLeft, trimTagRight, file); + this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange); + this.name = this.tokenizer.readTagName(); + this.tokenizer.assert(this.name, `illegal tag syntax, tag name expected`); + this.tokenizer.skipBlank(); + this.args = this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]); + } +} + +class OutputToken extends DelimitedToken { + constructor(input, begin, end, options, file) { + const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } = options; + const valueRange = [begin + outputDelimiterLeft.length, end - outputDelimiterRight.length]; + super(TokenKind.Output, valueRange, input, begin, end, trimOutputLeft, trimOutputRight, file); + } +} + +class HTMLToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.HTML, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.trimLeft = 0; + this.trimRight = 0; + } + getContent() { + return this.input.slice(this.begin + this.trimLeft, this.end - this.trimRight); + } +} + +class NumberToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.Number, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.content = Number(this.getText()); + } +} + +class IdentifierToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.Word, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.content = this.getText(); + } +} + +class LiteralToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.Literal, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.literal = this.getText(); + this.content = literalValues[this.literal]; + } +} + +const operatorPrecedences = { + '==': 2, + '!=': 2, + '>': 2, + '<': 2, + '>=': 2, + '<=': 2, + 'contains': 2, + 'not': 1, + 'and': 0, + 'or': 0 +}; +const operatorTypes = { + '==': 0 /* OperatorType.Binary */, + '!=': 0 /* OperatorType.Binary */, + '>': 0 /* OperatorType.Binary */, + '<': 0 /* OperatorType.Binary */, + '>=': 0 /* OperatorType.Binary */, + '<=': 0 /* OperatorType.Binary */, + 'contains': 0 /* OperatorType.Binary */, + 'not': 1 /* OperatorType.Unary */, + 'and': 0 /* OperatorType.Binary */, + 'or': 0 /* OperatorType.Binary */ +}; +class OperatorToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.Operator, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.operator = this.getText(); + } + getPrecedence() { + return this.operator in operatorPrecedences ? operatorPrecedences[this.operator] : 1; + } +} + +class PropertyAccessToken extends Token { + constructor(variable, props, input, begin, end, file) { + super(TokenKind.PropertyAccess, input, begin, end, file); + this.variable = variable; + this.props = props; + } +} + +class FilterToken extends Token { + constructor(name, args, input, begin, end, file) { + super(TokenKind.Filter, input, begin, end, file); + this.name = name; + this.args = args; + } +} + +class HashToken extends Token { + constructor(input, begin, end, name, value, file) { + super(TokenKind.Hash, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.name = name; + this.value = value; + this.file = file; + } +} + +const rHex = /[\da-fA-F]/; +const rOct = /[0-7]/; +const escapeChar = { + b: '\b', + f: '\f', + n: '\n', + r: '\r', + t: '\t', + v: '\x0B' +}; +function hexVal(c) { + const code = c.charCodeAt(0); + if (code >= 97) + return code - 87; + if (code >= 65) + return code - 55; + return code - 48; +} +function parseStringLiteral(str) { + let ret = ''; + for (let i = 1; i < str.length - 1; i++) { + if (str[i] !== '\\') { + ret += str[i]; + continue; + } + if (escapeChar[str[i + 1]] !== undefined) { + ret += escapeChar[str[++i]]; + } + else if (str[i + 1] === 'u') { + let val = 0; + let j = i + 2; + while (j <= i + 5 && rHex.test(str[j])) { + val = val * 16 + hexVal(str[j++]); + } + i = j - 1; + ret += String.fromCharCode(val); + } + else if (!rOct.test(str[i + 1])) { + ret += str[++i]; + } + else { + let j = i + 1; + let val = 0; + while (j <= i + 3 && rOct.test(str[j])) { + val = val * 8 + hexVal(str[j++]); + } + i = j - 1; + ret += String.fromCharCode(val); + } + } + return ret; +} + +class QuotedToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.Quoted, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.content = parseStringLiteral(this.getText()); + } +} + +class RangeToken extends Token { + constructor(input, begin, end, lhs, rhs, file) { + super(TokenKind.Range, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.lhs = lhs; + this.rhs = rhs; + this.file = file; + } +} + +/** + * LiquidTagToken is different from TagToken by not having delimiters `{%` or `%}` + */ +class LiquidTagToken extends DelimitedToken { + constructor(input, begin, end, options, file) { + super(TokenKind.Tag, [begin, end], input, begin, end, false, false, file); + this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange); + this.name = this.tokenizer.readTagName(); + this.tokenizer.assert(this.name, 'illegal liquid tag syntax'); + this.tokenizer.skipBlank(); + } + get args() { + return this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]); + } +} + +/** + * value expression with optional filters + * e.g. + * {% assign foo="bar" | append: "coo" %} + */ +class FilteredValueToken extends Token { + constructor(initial, filters, input, begin, end, file) { + super(TokenKind.FilteredValue, input, begin, end, file); + this.initial = initial; + this.filters = filters; + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + } +} + +const polyfill = { + now: () => Date.now() +}; +function getPerformance() { + return (typeof global === 'object' && global.performance) || + (typeof window === 'object' && window.performance) || + polyfill; +} + +class Render { + renderTemplatesToNodeStream(templates, ctx) { + const emitter = new StreamedEmitter(); + Promise.resolve().then(() => toPromise(this.renderTemplates(templates, ctx, emitter))) + .then(() => emitter.end(), err => emitter.error(err)); + return emitter.stream; + } + *renderTemplates(templates, ctx, emitter) { + if (!emitter) { + emitter = ctx.opts.keepOutputType ? new KeepingTypeEmitter() : new SimpleEmitter(); + } + ctx.renderLimit.check(getPerformance().now()); + const errors = []; + for (const tpl of templates) { + ctx.renderLimit.check(getPerformance().now()); + try { + // if tpl.render supports emitter, it'll return empty `html` + const html = yield tpl.render(ctx, emitter); + // if not, it'll return an `html`, write to the emitter for it + html && emitter.write(html); + if (ctx.breakCalled || ctx.continueCalled) + break; + } + catch (e) { + const err = LiquidError.is(e) ? e : new RenderError(e, tpl); + if (ctx.opts.catchAllErrors) + errors.push(err); + else + throw err; + } + } + if (errors.length) { + throw new LiquidErrors(errors); + } + return emitter.buffer; + } +} + +class Expression { + constructor(tokens) { + this.postfix = [...toPostfix(tokens)]; + } + *evaluate(ctx, lenient) { + assert(ctx, 'unable to evaluate: context not defined'); + const operands = []; + for (const token of this.postfix) { + if (isOperatorToken(token)) { + const r = operands.pop(); + let result; + if (operatorTypes[token.operator] === 1 /* OperatorType.Unary */) { + result = yield ctx.opts.operators[token.operator](r, ctx); + } + else { + const l = operands.pop(); + result = yield ctx.opts.operators[token.operator](l, r, ctx); + } + operands.push(result); + } + else { + operands.push(yield evalToken(token, ctx, lenient)); + } + } + return operands[0]; + } + valid() { + return !!this.postfix.length; + } +} +function* evalToken(token, ctx, lenient = false) { + if (!token) + return; + if ('content' in token) + return token.content; + if (isPropertyAccessToken(token)) + return yield evalPropertyAccessToken(token, ctx, lenient); + if (isRangeToken(token)) + return yield evalRangeToken(token, ctx); +} +function* evalPropertyAccessToken(token, ctx, lenient) { + const props = []; + for (const prop of token.props) { + props.push((yield evalToken(prop, ctx, false))); + } + try { + if (token.variable) { + const variable = yield evalToken(token.variable, ctx, lenient); + return yield ctx._getFromScope(variable, props); + } + else { + return yield ctx._get(props); + } + } + catch (e) { + if (lenient && e.name === 'InternalUndefinedVariableError') + return null; + throw (new UndefinedVariableError(e, token)); + } +} +function evalQuotedToken(token) { + return token.content; +} +function* evalRangeToken(token, ctx) { + const low = yield evalToken(token.lhs, ctx); + const high = yield evalToken(token.rhs, ctx); + ctx.memoryLimit.use(high - low + 1); + return range(+low, +high + 1); +} +function* toPostfix(tokens) { + const ops = []; + for (const token of tokens) { + if (isOperatorToken(token)) { + while (ops.length && ops[ops.length - 1].getPrecedence() > token.getPrecedence()) { + yield ops.pop(); + } + ops.push(token); + } + else + yield token; + } + while (ops.length) { + yield ops.pop(); + } +} + +function isTruthy(val, ctx) { + return !isFalsy(val, ctx); +} +function isFalsy(val, ctx) { + val = toValue(val); + if (ctx.opts.jsTruthy) { + return !val; + } + else { + return val === false || undefined === val || val === null; + } +} + +const defaultOperators = { + '==': equals, + '!=': (l, r) => !equals(l, r), + '>': (l, r) => { + if (isComparable(l)) + return l.gt(r); + if (isComparable(r)) + return r.lt(l); + return toValue(l) > toValue(r); + }, + '<': (l, r) => { + if (isComparable(l)) + return l.lt(r); + if (isComparable(r)) + return r.gt(l); + return toValue(l) < toValue(r); + }, + '>=': (l, r) => { + if (isComparable(l)) + return l.geq(r); + if (isComparable(r)) + return r.leq(l); + return toValue(l) >= toValue(r); + }, + '<=': (l, r) => { + if (isComparable(l)) + return l.leq(r); + if (isComparable(r)) + return r.geq(l); + return toValue(l) <= toValue(r); + }, + 'contains': (l, r) => { + l = toValue(l); + if (isArray(l)) + return l.some((i) => equals(i, r)); + if (isFunction(l === null || l === void 0 ? void 0 : l.indexOf)) + return l.indexOf(toValue(r)) > -1; + return false; + }, + 'not': (v, ctx) => isFalsy(toValue(v), ctx), + 'and': (l, r, ctx) => isTruthy(toValue(l), ctx) && isTruthy(toValue(r), ctx), + 'or': (l, r, ctx) => isTruthy(toValue(l), ctx) || isTruthy(toValue(r), ctx) +}; +function equals(lhs, rhs) { + if (isComparable(lhs)) + return lhs.equals(rhs); + if (isComparable(rhs)) + return rhs.equals(lhs); + lhs = toValue(lhs); + rhs = toValue(rhs); + if (isArray(lhs)) { + return isArray(rhs) && arrayEquals(lhs, rhs); + } + return lhs === rhs; +} +function arrayEquals(lhs, rhs) { + if (lhs.length !== rhs.length) + return false; + return !lhs.some((value, i) => !equals(value, rhs[i])); +} +function arrayIncludes(arr, item) { + return arr.some(value => equals(value, item)); +} + +class Node { + constructor(key, value, next, prev) { + this.key = key; + this.value = value; + this.next = next; + this.prev = prev; + } +} +class LRU { + constructor(limit, size = 0) { + this.limit = limit; + this.size = size; + this.cache = {}; + this.head = new Node('HEAD', null, null, null); + this.tail = new Node('TAIL', null, null, null); + this.head.next = this.tail; + this.tail.prev = this.head; + } + write(key, value) { + if (this.cache[key]) { + this.cache[key].value = value; + } + else { + const node = new Node(key, value, this.head.next, this.head); + this.head.next.prev = node; + this.head.next = node; + this.cache[key] = node; + this.size++; + this.ensureLimit(); + } + } + read(key) { + if (!this.cache[key]) + return; + const { value } = this.cache[key]; + this.remove(key); + this.write(key, value); + return value; + } + remove(key) { + const node = this.cache[key]; + node.prev.next = node.next; + node.next.prev = node.prev; + delete this.cache[key]; + this.size--; + } + clear() { + this.head.next = this.tail; + this.tail.prev = this.head; + this.size = 0; + this.cache = {}; + } + ensureLimit() { + if (this.size > this.limit) + this.remove(this.tail.prev.key); + } +} + +function domResolve(root, path) { + const base = document.createElement('base'); + base.href = root; + const head = document.getElementsByTagName('head')[0]; + head.insertBefore(base, head.firstChild); + const a = document.createElement('a'); + a.href = path; + const resolved = a.href; + head.removeChild(base); + return resolved; +} +function resolve(root, filepath, ext) { + if (root.length && last(root) !== '/') + root += '/'; + const url = domResolve(root, filepath); + return url.replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/, (str, origin, path) => { + const last = path.split('/').pop(); + if (/\.\w+$/.test(last)) + return str; + return origin + path + ext; + }); +} +function readFile(url) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => { + const xhr = new XMLHttpRequest(); + xhr.onload = () => { + if (xhr.status >= 200 && xhr.status < 300) { + resolve(xhr.responseText); + } + else { + reject(new Error(xhr.statusText)); + } + }; + xhr.onerror = () => { + reject(new Error('An error occurred whilst receiving the response.')); + }; + xhr.open('GET', url); + xhr.send(); + }); + }); +} +function readFileSync(url) { + const xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.send(); + if (xhr.status < 200 || xhr.status >= 300) { + throw new Error(xhr.statusText); + } + return xhr.responseText; +} +function exists(filepath) { + return __awaiter(this, void 0, void 0, function* () { + return true; + }); +} +function existsSync(filepath) { + return true; +} +function dirname(filepath) { + return domResolve(filepath, '.'); +} +const sep = '/'; + +var fs = /*#__PURE__*/Object.freeze({ + __proto__: null, + resolve: resolve, + readFile: readFile, + readFileSync: readFileSync, + exists: exists, + existsSync: existsSync, + dirname: dirname, + sep: sep +}); + +function chargeJsonReplacerValue(memoryLimit, val) { + if (typeof val === 'string') { + memoryLimit.use(val.length); + } + else if (val === null || typeof val === 'number' || typeof val === 'boolean') { + memoryLimit.use(JSON.stringify(val).length); + } + else if (Array.isArray(val)) { + memoryLimit.use(val.length + 1); + } + else if (typeof val === 'object') { + memoryLimit.use(2); + } +} +function defaultFilter(value, defaultValue, ...args) { + value = toValue(value); + if (isArray(value) || isString(value)) + return value.length ? value : defaultValue; + if (value === false && (new Map(args)).get('allow_false')) + return false; + return isFalsy(value, this.context) ? defaultValue : value; +} +function json(value, space = 0) { + const memoryLimit = this.context.memoryLimit; + return JSON.stringify(value, (_key, val) => { + chargeJsonReplacerValue(memoryLimit, val); + return val; + }, space); +} +function inspect(value, space = 0) { + const memoryLimit = this.context.memoryLimit; + const ancestors = []; + return JSON.stringify(value, function (_key, value) { + if (typeof value !== 'object' || value === null) { + chargeJsonReplacerValue(memoryLimit, value); + return value; + } + // `this` is the object that value is contained in, i.e., its direct parent. + while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) + ancestors.pop(); + if (ancestors.includes(value)) { + memoryLimit.use('[Circular]'.length); + return '[Circular]'; + } + ancestors.push(value); + chargeJsonReplacerValue(memoryLimit, value); + return value; + }, space); +} +function to_integer(value) { + return Number(value); +} +const raw = { + raw: true, + handler: identify +}; +var misc = { + default: defaultFilter, + raw, + jsonify: json, + to_integer, + json, + inspect +}; + +const escapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' +}; +const unescapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" +}; +function escape(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.replace(/&|<|>|"|'/g, m => escapeMap[m]); +} +function xml_escape(str) { + return escape.call(this, str); +} +function unescape(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.replace(/&(amp|lt|gt|#34|#39);/g, m => unescapeMap[m]); +} +function escape_once(str) { + return escape.call(this, unescape.call(this, str)); +} +function newline_to_br(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\r?\n/gm, '
\n'); +} +// Raw-text blocks (HTML5) plus '<...>' as the catch-all kind; a regex +// equivalent is O(n^2) in V8 on unclosed openers. +function strip_html(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + const blocks = new Map([[''], [''], [''], ['<', '>']]); + let out = ''; + let i = 0; + while (i < str.length) { + const lt = str.indexOf('<', i); + if (lt < 0) + return out + str.slice(i); + out += str.slice(i, lt); + for (const [opener, closer] of blocks) { + if (!str.startsWith(opener, lt)) + continue; + const e = str.indexOf(closer, lt + opener.length); + if (e >= 0) { + i = e + closer.length; + break; + } + blocks.delete(opener); + } + if (i <= lt) + return out + str.slice(lt); + } + return out; +} + +var htmlFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + escape: escape, + xml_escape: xml_escape, + escape_once: escape_once, + newline_to_br: newline_to_br, + strip_html: strip_html +}); + +class MapFS { + constructor(mapping) { + this.mapping = mapping; + this.sep = '/'; + } + exists(filepath) { + return __awaiter(this, void 0, void 0, function* () { + return this.existsSync(filepath); + }); + } + existsSync(filepath) { + return !isNil(this.mapping[filepath]); + } + readFile(filepath) { + return __awaiter(this, void 0, void 0, function* () { + return this.readFileSync(filepath); + }); + } + readFileSync(filepath) { + const content = this.mapping[filepath]; + if (isNil(content)) + throw new Error(`ENOENT: ${filepath}`); + return content; + } + dirname(filepath) { + const segments = filepath.split(this.sep); + segments.pop(); + return segments.join(this.sep); + } + resolve(dir, file, ext) { + file += ext; + if (dir === '.') + return file; + const segments = dir.split(/\/+/); + for (const segment of file.split(this.sep)) { + if (segment === '.' || segment === '') + continue; + else if (segment === '..') { + if (segments.length > 1 || segments[0] !== '') + segments.pop(); + } + else + segments.push(segment); + } + return segments.join(this.sep); + } +} + +const defaultOptions = { + root: ['.'], + layouts: ['.'], + partials: ['.'], + relativeReference: true, + jekyllInclude: false, + keyValueSeparator: ':', + cache: undefined, + extname: '', + fs: fs, + dynamicPartials: true, + jsTruthy: false, + dateFormat: '%A, %B %-e, %Y at %-l:%M %P %z', + locale: '', + trimTagRight: false, + trimTagLeft: false, + trimOutputRight: false, + trimOutputLeft: false, + greedy: true, + tagDelimiterLeft: '{%', + tagDelimiterRight: '%}', + outputDelimiterLeft: '{{', + outputDelimiterRight: '}}', + preserveTimezones: false, + strictFilters: false, + strictVariables: false, + ownPropertyOnly: true, + lenientIf: false, + globals: {}, + keepOutputType: false, + operators: defaultOperators, + memoryLimit: Infinity, + parseLimit: Infinity, + renderLimit: Infinity +}; +function normalize(options) { + var _a, _b; + if (options.hasOwnProperty('root')) { + if (!options.hasOwnProperty('partials')) + options.partials = options.root; + if (!options.hasOwnProperty('layouts')) + options.layouts = options.root; + } + if (options.hasOwnProperty('cache')) { + let cache; + if (typeof options.cache === 'number') + cache = options.cache > 0 ? new LRU(options.cache) : undefined; + else if (typeof options.cache === 'object') + cache = options.cache; + else + cache = options.cache ? new LRU(1024) : undefined; + options.cache = cache; + } + options = Object.assign(Object.assign(Object.assign({}, defaultOptions), (options.jekyllInclude ? { dynamicPartials: false } : {})), options); + if ((!options.fs.dirname || !options.fs.sep) && options.relativeReference) { + console.warn('[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning'); + options.relativeReference = false; + } + options.root = normalizeDirectoryList(options.root); + options.partials = normalizeDirectoryList(options.partials); + options.layouts = normalizeDirectoryList(options.layouts); + options.outputEscape = options.outputEscape && getOutputEscapeFunction(options.outputEscape); + if (!options.locale) { + options.locale = (_b = (_a = getDateTimeFormat()) === null || _a === void 0 ? void 0 : _a().resolvedOptions().locale) !== null && _b !== void 0 ? _b : 'en-US'; + } + if (options.templates) { + options.fs = new MapFS(options.templates); + options.relativeReference = true; + options.root = options.partials = options.layouts = '.'; + } + return options; +} +function getOutputEscapeFunction(nameOrFunction) { + if (nameOrFunction === 'escape') + return escape; + if (nameOrFunction === 'json') + return misc.json; + assert(isFunction(nameOrFunction), '`outputEscape` need to be of type string or function'); + return nameOrFunction; +} +function normalizeDirectoryList(value) { + let list = []; + if (isArray(value)) + list = value; + if (isString(value)) + list = [value]; + return list; +} + +function whiteSpaceCtrl(tokens, options) { + let inRaw = false; + for (let i = 0; i < tokens.length; i++) { + const token = tokens[i]; + if (!isDelimitedToken(token)) + continue; + if (!inRaw && token.trimLeft) { + trimLeft(tokens[i - 1], options.greedy); + } + if (isTagToken(token)) { + if (token.name === 'raw') + inRaw = true; + else if (token.name === 'endraw') + inRaw = false; + } + if (!inRaw && token.trimRight) { + trimRight(tokens[i + 1], options.greedy); + } + } +} +function trimLeft(token, greedy) { + if (!token || !isHTMLToken(token)) + return; + const mask = greedy ? BLANK : INLINE_BLANK; + while (TYPES[token.input.charCodeAt(token.end - 1 - token.trimRight)] & mask) + token.trimRight++; +} +function trimRight(token, greedy) { + if (!token || !isHTMLToken(token)) + return; + const mask = greedy ? BLANK : INLINE_BLANK; + while (TYPES[token.input.charCodeAt(token.begin + token.trimLeft)] & mask) + token.trimLeft++; + if (token.input.charAt(token.begin + token.trimLeft) === '\n') + token.trimLeft++; +} + +class Tokenizer { + constructor(input, operators = defaultOptions.operators, file, range) { + this.input = input; + this.file = file; + this.rawBeginAt = -1; + this.p = range ? range[0] : 0; + this.N = range ? range[1] : input.length; + this.opTrie = createTrie(operators); + this.literalTrie = createTrie(literalValues); + } + readExpression() { + return new Expression(this.readExpressionTokens()); + } + *readExpressionTokens() { + while (this.p < this.N) { + const operator = this.readOperator(); + if (operator) { + yield operator; + continue; + } + const operand = this.readValue(); + if (operand) { + yield operand; + continue; + } + return; + } + } + readOperator() { + this.skipBlank(); + const end = this.matchTrie(this.opTrie); + if (end === -1) + return; + return new OperatorToken(this.input, this.p, (this.p = end), this.file); + } + matchTrie(trie) { + let node = trie; + let i = this.p; + let info; + while (node[this.input[i]] && i < this.N) { + node = node[this.input[i++]]; + if (node['end']) + info = node; + } + if (!info) + return -1; + if (info['needBoundary'] && isWord(this.peek(i - this.p))) + return -1; + return i; + } + readFilteredValue() { + const begin = this.p; + const initial = this.readExpression(); + this.assert(initial.valid(), `invalid value expression: ${this.snapshot()}`); + const filters = this.readFilters(); + return new FilteredValueToken(initial, filters, this.input, begin, this.p, this.file); + } + readFilters() { + const filters = []; + while (true) { + const filter = this.readFilter(); + if (!filter) + return filters; + filters.push(filter); + } + } + readFilter() { + this.skipBlank(); + if (this.end()) + return null; + this.assert(this.read() === '|', `expected "|" before filter`); + const name = this.readIdentifier(); + if (!name.size()) { + this.assert(this.end(), `expected filter name`); + return null; + } + const args = []; + this.skipBlank(); + if (this.peek() === ':') { + do { + ++this.p; + const arg = this.readFilterArg(); + arg && args.push(arg); + this.skipBlank(); + this.assert(this.end() || this.peek() === ',' || this.peek() === '|', () => `unexpected character ${this.snapshot()}`); + } while (this.peek() === ','); + } + else if (this.peek() === '|' || this.end()) ; + else { + throw this.error('expected ":" after filter name'); + } + return new FilterToken(name.getText(), args, this.input, name.begin, this.p, this.file); + } + readFilterArg() { + const key = this.readValue(); + if (!key) + return; + this.skipBlank(); + if (this.peek() !== ':') + return key; + ++this.p; + const value = this.readValue(); + return [key.getText(), value]; + } + readTopLevelTokens(options = defaultOptions) { + const tokens = []; + while (this.p < this.N) { + const token = this.readTopLevelToken(options); + tokens.push(token); + } + whiteSpaceCtrl(tokens, options); + return tokens; + } + readTopLevelToken(options) { + const { tagDelimiterLeft, outputDelimiterLeft } = options; + if (this.rawBeginAt > -1) + return this.readEndrawOrRawContent(options); + if (this.match(tagDelimiterLeft)) + return this.readTagToken(options); + if (this.match(outputDelimiterLeft)) + return this.readOutputToken(options); + return this.readHTMLToken([tagDelimiterLeft, outputDelimiterLeft]); + } + readHTMLToken(stopStrings) { + const begin = this.p; + while (this.p < this.N) { + if (stopStrings.some(str => this.match(str))) + break; + ++this.p; + } + return new HTMLToken(this.input, begin, this.p, this.file); + } + readTagToken(options) { + const { file, input } = this; + const begin = this.p; + if (this.readToDelimiter(options.tagDelimiterRight) === -1) { + throw this.error(`tag ${this.snapshot(begin)} not closed`, begin); + } + const token = new TagToken(input, begin, this.p, options, file); + if (token.name === 'raw') + this.rawBeginAt = begin; + return token; + } + readToDelimiter(delimiter, respectQuoted = false) { + this.skipBlank(); + while (this.p < this.N) { + if (respectQuoted && (this.peekType() & QUOTE)) { + this.readQuoted(); + continue; + } + ++this.p; + if (this.rmatch(delimiter)) + return this.p; + } + return -1; + } + readOutputToken(options = defaultOptions) { + const { file, input } = this; + const { outputDelimiterRight } = options; + const begin = this.p; + if (this.readToDelimiter(outputDelimiterRight, true) === -1) { + throw this.error(`output ${this.snapshot(begin)} not closed`, begin); + } + return new OutputToken(input, begin, this.p, options, file); + } + readEndrawOrRawContent(options) { + const { tagDelimiterLeft, tagDelimiterRight } = options; + const begin = this.p; + let leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length; + while (this.p < this.N) { + if (this.readIdentifier().getText() !== 'endraw') { + leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length; + continue; + } + while (this.p <= this.N) { + if (this.rmatch(tagDelimiterRight)) { + const end = this.p; + if (begin === leftPos) { + this.rawBeginAt = -1; + return new TagToken(this.input, begin, end, options, this.file); + } + else { + this.p = leftPos; + return new HTMLToken(this.input, begin, leftPos, this.file); + } + } + if (this.rmatch(tagDelimiterLeft)) + break; + this.p++; + } + } + throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, begin); + } + readLiquidTagTokens(options = defaultOptions) { + const tokens = []; + while (this.p < this.N) { + const token = this.readLiquidTagToken(options); + token && tokens.push(token); + } + return tokens; + } + readLiquidTagToken(options) { + this.skipBlank(); + if (this.end()) + return; + const begin = this.p; + this.readToDelimiter('\n'); + const end = this.p; + return new LiquidTagToken(this.input, begin, end, options, this.file); + } + error(msg, pos = this.p) { + return new TokenizationError(msg, new IdentifierToken(this.input, pos, this.N, this.file)); + } + assert(pred, msg, pos) { + if (!pred) + throw this.error(typeof msg === 'function' ? msg() : msg, pos); + } + snapshot(begin = this.p) { + return JSON.stringify(ellipsis(this.input.slice(begin, this.N), 32)); + } + /** + * @deprecated use #readIdentifier instead + */ + readWord() { + return this.readIdentifier(); + } + readIdentifier() { + this.skipBlank(); + const begin = this.p; + while (!this.end() && isWord(this.peek())) + ++this.p; + return new IdentifierToken(this.input, begin, this.p, this.file); + } + readNonEmptyIdentifier() { + const id = this.readIdentifier(); + return id.size() ? id : undefined; + } + readTagName() { + this.skipBlank(); + // Handle inline comment tags + if (this.input[this.p] === '#') + return this.input.slice(this.p, ++this.p); + return this.readIdentifier().getText(); + } + readHashes(jekyllStyle) { + const hashes = []; + while (true) { + const hash = this.readHash(jekyllStyle); + if (!hash) + return hashes; + hashes.push(hash); + } + } + readHash(jekyllStyle) { + this.skipBlank(); + if (this.peek() === ',') + ++this.p; + const begin = this.p; + const name = this.readNonEmptyIdentifier(); + if (!name) + return; + let value; + this.skipBlank(); + const sep = isString(jekyllStyle) ? jekyllStyle : (jekyllStyle ? '=' : ':'); + if (this.peek() === sep) { + ++this.p; + value = this.readValue(); + } + return new HashToken(this.input, begin, this.p, name, value, this.file); + } + remaining() { + return this.input.slice(this.p, this.N); + } + advance(step = 1) { + this.p += step; + } + end() { + return this.p >= this.N; + } + read() { + return this.input[this.p++]; + } + readTo(end) { + while (this.p < this.N) { + ++this.p; + if (this.rmatch(end)) + return this.p; + } + return -1; + } + readValue() { + this.skipBlank(); + const begin = this.p; + const variable = this.readLiteral() || this.readQuoted() || this.readRange() || this.readNumber(); + const props = this.readProperties(!variable); + if (!props.length) + return variable; + return new PropertyAccessToken(variable, props, this.input, begin, this.p); + } + readScopeValue() { + this.skipBlank(); + const begin = this.p; + const props = this.readProperties(); + if (!props.length) + return undefined; + return new PropertyAccessToken(undefined, props, this.input, begin, this.p); + } + readProperties(isBegin = true) { + const props = []; + while (true) { + if (this.peek() === '[') { + this.p++; + const prop = this.readValue() || new IdentifierToken(this.input, this.p, this.p, this.file); + this.assert(this.readTo(']') !== -1, '[ not closed'); + props.push(prop); + continue; + } + if (isBegin && !props.length) { + const prop = this.readNonEmptyIdentifier(); + if (prop) { + props.push(prop); + continue; + } + } + if (this.peek() === '.' && this.peek(1) !== '.') { // skip range syntax + this.p++; + const prop = this.readNonEmptyIdentifier(); + if (!prop) + break; + props.push(prop); + continue; + } + break; + } + return props; + } + readNumber() { + this.skipBlank(); + let decimalFound = false; + let digitFound = false; + let n = 0; + if (this.peekType() & SIGN) + n++; + while (this.p + n <= this.N) { + if (this.peekType(n) & NUMBER) { + digitFound = true; + n++; + } + else if (this.peek(n) === '.' && this.peek(n + 1) !== '.') { + if (decimalFound || !digitFound) + return; + decimalFound = true; + n++; + } + else + break; + } + if (digitFound && !isWord(this.peek(n))) { + const num = new NumberToken(this.input, this.p, this.p + n, this.file); + this.advance(n); + return num; + } + } + readLiteral() { + this.skipBlank(); + const end = this.matchTrie(this.literalTrie); + if (end === -1) + return; + const literal = new LiteralToken(this.input, this.p, end, this.file); + this.p = end; + return literal; + } + readRange() { + this.skipBlank(); + const begin = this.p; + if (this.peek() !== '(') + return; + ++this.p; + const lhs = this.readValueOrThrow(); + this.skipBlank(); + this.assert(this.read() === '.' && this.read() === '.', 'invalid range syntax'); + const rhs = this.readValueOrThrow(); + this.skipBlank(); + this.assert(this.read() === ')', 'invalid range syntax'); + return new RangeToken(this.input, begin, this.p, lhs, rhs, this.file); + } + readValueOrThrow() { + const value = this.readValue(); + this.assert(value, () => `unexpected token ${this.snapshot()}, value expected`); + return value; + } + readQuoted() { + this.skipBlank(); + const begin = this.p; + if (!(this.peekType() & QUOTE)) + return; + ++this.p; + let escaped = false; + while (this.p < this.N) { + ++this.p; + if (this.input[this.p - 1] === this.input[begin] && !escaped) + break; + if (escaped) + escaped = false; + else if (this.input[this.p - 1] === '\\') + escaped = true; + } + return new QuotedToken(this.input, begin, this.p, this.file); + } + *readFileNameTemplate(options) { + const { outputDelimiterLeft } = options; + const htmlStopStrings = [',', ' ', '\r', '\n', '\t', outputDelimiterLeft]; + const htmlStopStringSet = new Set(htmlStopStrings); + // break on ',' and ' ', outputDelimiterLeft only stops HTML token + while (this.p < this.N && !htmlStopStringSet.has(this.peek())) { + yield this.match(outputDelimiterLeft) + ? this.readOutputToken(options) + : this.readHTMLToken(htmlStopStrings); + } + } + match(word) { + for (let i = 0; i < word.length; i++) { + if (word[i] !== this.input[this.p + i]) + return false; + } + return true; + } + rmatch(pattern) { + for (let i = 0; i < pattern.length; i++) { + if (pattern[pattern.length - 1 - i] !== this.input[this.p - 1 - i]) + return false; + } + return true; + } + peekType(n = 0) { + return this.p + n >= this.N ? 0 : TYPES[this.input.charCodeAt(this.p + n)]; + } + peek(n = 0) { + return this.p + n >= this.N ? '' : this.input[this.p + n]; + } + skipBlank() { + while (this.peekType() & BLANK) + ++this.p; + } +} + +class ParseStream { + constructor(tokens, parseToken) { + this.handlers = {}; + this.stopRequested = false; + this.tokens = tokens; + this.parseToken = parseToken; + } + on(name, cb) { + this.handlers[name] = cb; + return this; + } + trigger(event, arg) { + const h = this.handlers[event]; + return h ? (h.call(this, arg), true) : false; + } + start() { + this.trigger('start'); + let token; + while (!this.stopRequested && (token = this.tokens.shift())) { + if (this.trigger('token', token)) + continue; + if (isTagToken(token) && this.trigger(`tag:${token.name}`, token)) { + continue; + } + const template = this.parseToken(token, this.tokens); + this.trigger('template', template); + } + if (!this.stopRequested) + this.trigger('end'); + return this; + } + stop() { + this.stopRequested = true; + return this; + } +} + +class TemplateImpl { + constructor(token) { + this.token = token; + } +} + +class Tag extends TemplateImpl { + constructor(token, remainTokens, liquid) { + super(token); + this.name = token.name; + this.liquid = liquid; + this.tokenizer = token.tokenizer; + } +} + +/** + * Key-Value Pairs Representing Tag Arguments + * Example: + * For the markup `, foo:'bar', coo:2 reversed %}`, + * hash['foo'] === 'bar' + * hash['coo'] === 2 + * hash['reversed'] === undefined + */ +class Hash { + constructor(input, jekyllStyle) { + this.hash = {}; + const tokenizer = input instanceof Tokenizer ? input : new Tokenizer(input, {}); + for (const hash of tokenizer.readHashes(jekyllStyle)) { + this.hash[hash.name.content] = hash.value; + } + } + *render(ctx) { + const hash = {}; + for (const key of Object.keys(this.hash)) { + hash[key] = this.hash[key] === undefined ? true : yield evalToken(this.hash[key], ctx); + } + return hash; + } +} + +function createTagClass(options) { + return class extends Tag { + constructor(token, tokens, liquid) { + super(token, tokens, liquid); + if (isFunction(options.parse)) { + options.parse.call(this, token, tokens); + } + } + *render(ctx, emitter) { + const hash = (yield new Hash(this.token.args, ctx.opts.keyValueSeparator).render(ctx)); + return yield options.render.call(this, ctx, emitter, hash); + } + }; +} + +function isKeyValuePair(arr) { + return isArray(arr); +} + +class Filter { + constructor(token, options, liquid) { + this.token = token; + this.name = token.name; + this.handler = isFunction(options) + ? options + : (isFunction(options === null || options === void 0 ? void 0 : options.handler) ? options.handler : identify); + this.raw = !isFunction(options) && !!(options === null || options === void 0 ? void 0 : options.raw); + this.args = token.args; + this.liquid = liquid; + } + *render(value, context) { + const argv = []; + for (const arg of this.args) { + if (isKeyValuePair(arg)) + argv.push([arg[0], yield evalToken(arg[1], context)]); + else + argv.push(yield evalToken(arg, context)); + } + return yield this.handler.apply({ context, token: this.token, liquid: this.liquid }, [value, ...argv]); + } +} + +class Value { + /** + * @param str the value to be valuated, eg.: "foobar" | truncate: 3 + */ + constructor(input, liquid) { + this.filters = []; + const token = typeof input === 'string' + ? new Tokenizer(input, liquid.options.operators).readFilteredValue() + : input; + this.initial = token.initial; + this.filters = token.filters.map(token => new Filter(token, this.getFilter(liquid, token.name), liquid)); + } + *value(ctx, lenient) { + lenient = lenient || (ctx.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === 'default'); + let val = yield this.initial.evaluate(ctx, lenient); + for (const filter of this.filters) { + val = yield filter.render(val, ctx); + } + return val; + } + getFilter(liquid, name) { + const impl = liquid.filters[name]; + assert(impl || !liquid.options.strictFilters, () => `undefined filter: ${name}`); + return impl; + } +} + +class Output extends TemplateImpl { + constructor(token, liquid) { + var _a; + super(token); + const tokenizer = new Tokenizer(token.input, liquid.options.operators, token.file, token.contentRange); + this.value = new Value(tokenizer.readFilteredValue(), liquid); + const filters = this.value.filters; + const outputEscape = liquid.options.outputEscape; + if (!((_a = filters[filters.length - 1]) === null || _a === void 0 ? void 0 : _a.raw) && outputEscape) { + const token = new FilterToken(toString.call(outputEscape), [], '', 0, 0); + filters.push(new Filter(token, outputEscape, liquid)); + } + } + *render(ctx, emitter) { + const val = yield this.value.value(ctx, false); + emitter.write(val); + } + *arguments() { + yield this.value; + } +} + +class HTML extends TemplateImpl { + constructor(token) { + super(token); + this.str = token.getContent(); + } + *render(ctx, emitter) { + emitter.write(this.str); + } +} + +/** + * A variable's segments and location, which can be coerced to a string. + */ +class Variable { + constructor(segments, location) { + this.segments = segments; + this.location = location; + } + toString() { + return segmentsString(this.segments, true); + } + /** Return this variable's segments as an array, possibly with nested arrays for nested paths. */ + toArray() { + function* _visit(...segments) { + for (const segment of segments) { + if (segment instanceof Variable) { + yield Array.from(_visit(...segment.segments)); + } + else { + yield segment; + } + } + } + return Array.from(_visit(...this.segments)); + } +} +/** + * Group variables by the string representation of their root segment. + */ +class VariableMap { + constructor() { + this.map = new Map(); + } + get(key) { + const k = segmentsString([key.segments[0]]); + if (!this.map.has(k)) { + this.map.set(k, []); + } + return this.map.get(k); + } + has(key) { + return this.map.has(segmentsString([key.segments[0]])); + } + push(variable) { + this.get(variable).push(variable); + } + asObject() { + return Object.fromEntries(this.map); + } +} +const defaultStaticAnalysisOptions = { + partials: true +}; +function* _analyze(templates, partials, sync) { + const variables = new VariableMap(); + const globals = new VariableMap(); + const locals = new VariableMap(); + const rootScope = new DummyScope(new Set()); + // Names of partial templates that we've already analyzed. + const seen = new Set(); + function updateVariables(variable, scope) { + variables.push(variable); + const aliased = scope.alias(variable); + if (aliased !== undefined) { + const root = aliased.segments[0]; + // TODO: What if a a template renders a rendered template? Do we need scope.parent? + if (isString(root) && !rootScope.has(root)) { + globals.push(aliased); + } + } + else { + const root = variable.segments[0]; + if (isString(root) && !scope.has(root)) { + globals.push(variable); + } + } + // Recurse for nested Variables + for (const segment of variable.segments) { + if (segment instanceof Variable) { + updateVariables(segment, scope); + } + } + } + function* visit(template, scope) { + if (template.arguments) { + for (const arg of template.arguments()) { + for (const variable of extractVariables(arg)) { + updateVariables(variable, scope); + } + } + } + if (template.localScope) { + for (const ident of template.localScope()) { + scope.add(ident.content); + scope.deleteAlias(ident.content); + const [row, col] = ident.getPosition(); + locals.push(new Variable([ident.content], { row, col, file: ident.file })); + } + } + if (template.children) { + if (template.partialScope) { + const partial = template.partialScope(); + if (partial === undefined) { + // Layouts, for example, can have children that are not partials. + for (const child of (yield template.children(partials, sync))) { + yield visit(child, scope); + } + return; + } + if (seen.has(partial.name)) + return; + const partialScopeNames = new Set(); + const partialScope = partial.isolated + ? new DummyScope(partialScopeNames) + : scope.push(partialScopeNames); + for (const name of partial.scope) { + if (isString(name)) { + partialScopeNames.add(name); + } + else { + const [alias, argument] = name; + partialScopeNames.add(alias); + const variables = Array.from(extractVariables(argument)); + if (variables.length) { + partialScope.setAlias(alias, variables[0].segments); + } + } + } + for (const child of (yield template.children(partials, sync))) { + yield visit(child, partialScope); + seen.add(partial.name); + } + partialScope.pop(); + } + else { + if (template.blockScope) { + scope.push(new Set(template.blockScope())); + } + for (const child of (yield template.children(partials, sync))) { + yield visit(child, scope); + } + if (template.blockScope) { + scope.pop(); + } + } + } + } + for (const template of templates) { + yield visit(template, rootScope); + } + return { + variables: variables.asObject(), + globals: globals.asObject(), + locals: locals.asObject() + }; +} +/** + * Statically analyze a template and report variable usage. + */ +function analyze(template, options = {}) { + const opts = Object.assign(Object.assign({}, defaultStaticAnalysisOptions), options); + return toPromise(_analyze(template, opts.partials, false)); +} +/** + * Statically analyze a template and report variable usage. + */ +function analyzeSync(template, options = {}) { + const opts = Object.assign(Object.assign({}, defaultStaticAnalysisOptions), options); + return toValueSync(_analyze(template, opts.partials, true)); +} +/** + * A stack to manage scopes while traversing templates during static analysis. + */ +class DummyScope { + constructor(globals) { + this.stack = [{ names: globals, aliases: new Map() }]; + } + /** Return true if `name` is in scope. */ + has(name) { + for (const scope of this.stack) { + if (scope.names.has(name)) { + return true; + } + } + return false; + } + push(scope) { + this.stack.push({ names: scope, aliases: new Map() }); + return this; + } + pop() { + var _a; + return (_a = this.stack.pop()) === null || _a === void 0 ? void 0 : _a.names; + } + // Add a name to the template scope. + add(name) { + this.stack[0].names.add(name); + } + /** Return the variable that `variable` aliases, or `variable` if it doesn't alias anything. */ + alias(variable) { + const root = variable.segments[0]; + if (!isString(root)) + return undefined; + const alias = this.getAlias(root); + if (alias === undefined) + return undefined; + return new Variable([...alias, ...variable.segments.slice(1)], variable.location); + } + // TODO: `from` could be a path with multiple segments, like `include.x`. + setAlias(from, to) { + this.stack[this.stack.length - 1].aliases.set(from, to); + } + deleteAlias(name) { + this.stack[this.stack.length - 1].aliases.delete(name); + } + getAlias(name) { + for (const scope of this.stack) { + if (scope.aliases.has(name)) { + return scope.aliases.get(name); + } + // If a scope has defined `name`, then it masks aliases in parent scopes. + if (scope.names.has(name)) { + return undefined; + } + } + return undefined; + } +} +function* extractVariables(value) { + if (isValueToken(value)) { + yield* extractValueTokenVariables(value); + } + else if (value instanceof Value) { + yield* extractFilteredValueVariables(value); + } +} +function* extractFilteredValueVariables(value) { + for (const token of value.initial.postfix) { + if (isValueToken(token)) { + yield* extractValueTokenVariables(token); + } + } + for (const filter of value.filters) { + for (const arg of filter.args) { + if (isKeyValuePair(arg) && arg[1]) { + yield* extractValueTokenVariables(arg[1]); + } + else if (isValueToken(arg)) { + yield* extractValueTokenVariables(arg); + } + } + } +} +function* extractValueTokenVariables(token) { + if (isRangeToken(token)) { + yield* extractValueTokenVariables(token.lhs); + yield* extractValueTokenVariables(token.rhs); + } + else if (isPropertyAccessToken(token)) { + yield extractPropertyAccessVariable(token); + } +} +function extractPropertyAccessVariable(token) { + const segments = []; + // token is not guaranteed to have `file` set. We'll try to get it from a prop if not. + let file = token.file; + // Here we're flattening the first segment of a path if it is a nested path. + const root = token.props[0]; + file = file || root.file; + if (isQuotedToken(root) || isNumberToken(root) || isWordToken(root)) { + segments.push(root.content); + } + else if (isPropertyAccessToken(root)) { + // Flatten paths that start with a nested path. + segments.push(...extractPropertyAccessVariable(root).segments); + } + for (const prop of token.props.slice(1)) { + file = file || prop.file; + if (isQuotedToken(prop) || isNumberToken(prop) || isWordToken(prop)) { + segments.push(prop.content); + } + else if (isPropertyAccessToken(prop)) { + segments.push(extractPropertyAccessVariable(prop)); + } + } + const [row, col] = token.getPosition(); + return new Variable(segments, { + row, + col, + file + }); +} +// This is used to detect segments that can be represented with dot notation +// when creating a string representation of VariableSegments. +const RE_PROPERTY = /^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/; +/** + * Return a string representation of segments using dot notation where possible. + * @param segments - The property names and array indices that make up a path to a variable. + * @param bracketedRoot - If false (the default), don't surround the root segment with square brackets. + */ +function segmentsString(segments, bracketedRoot = false) { + const buf = []; + const root = segments[0]; + if (isString(root)) { + if (!bracketedRoot || root.match(RE_PROPERTY)) { + buf.push(`${root}`); + } + else { + buf.push(`['${root}']`); + } + } + for (const segment of segments.slice(1)) { + if (segment instanceof Variable) { + buf.push(`[${segmentsString(segment.segments)}]`); + } + else if (isString(segment)) { + if (segment.match(RE_PROPERTY)) { + buf.push(`.${segment}`); + } + else { + buf.push(`['${segment}']`); + } + } + else { + buf.push(`[${segment}]`); + } + } + return buf.join(''); +} + +var LookupType; +(function (LookupType) { + LookupType["Partials"] = "partials"; + LookupType["Layouts"] = "layouts"; + LookupType["Root"] = "root"; +})(LookupType || (LookupType = {})); +class Loader { + constructor(options) { + var _a, _b, _c, _d; + this.options = options; + if (options.relativeReference) { + const sep = options.fs.sep; + assert(sep, '`fs.sep` is required for relative reference'); + const prefixes = ['.' + sep, '..' + sep, './', '../']; + this.shouldLoadRelative = (referencedFile) => prefixes.some(prefix => referencedFile.startsWith(prefix)); + } + else { + this.shouldLoadRelative = (_referencedFile) => false; + } + const fs = options.fs; + this.contains = toLiquidAsync(((_a = fs.contains) === null || _a === void 0 ? void 0 : _a.bind(fs)) || (() => __awaiter(this, void 0, void 0, function* () { return true; })), ((_b = fs.containsSync) === null || _b === void 0 ? void 0 : _b.bind(fs)) || (() => true)); + this.exists = toLiquidAsync(((_c = fs.exists) === null || _c === void 0 ? void 0 : _c.bind(fs)) || (() => __awaiter(this, void 0, void 0, function* () { return false; })), (_d = fs.existsSync) === null || _d === void 0 ? void 0 : _d.bind(fs)); + } + *lookup(file, type, sync, currentFile) { + const dirs = this.options[type]; + for (const filepath of this.candidates(file, dirs, currentFile)) { + let allowed = false; + for (const dir of dirs) { + if (yield this.contains(!!sync, dir, filepath)) { + allowed = true; + break; + } + } + if (!allowed) + continue; + if (yield this.exists(!!sync, filepath)) + return filepath; + } + throw this.lookupError(file, dirs); + } + *candidates(file, dirs, currentFile) { + const { fs, extname } = this.options; + if (this.shouldLoadRelative(file) && currentFile) { + const referenced = fs.resolve(this.dirname(currentFile), file, extname); + yield referenced; + } + for (const dir of dirs) { + const referenced = fs.resolve(dir, file, extname); + yield referenced; + } + if (fs.fallback !== undefined) { + const filepath = fs.fallback(file); + if (filepath !== undefined) + yield filepath; + } + } + dirname(path) { + const fs = this.options.fs; + assert(fs.dirname, '`fs.dirname` is required for relative reference'); + return fs.dirname(path); + } + lookupError(file, roots) { + const err = new Error('ENOENT'); + err.message = `ENOENT: Failed to lookup "${file}" in "${roots}"`; + err.code = 'ENOENT'; + return err; + } +} + +class Parser { + constructor(liquid) { + var _a, _b; + this.liquid = liquid; + this.cache = this.liquid.options.cache; + this.fs = this.liquid.options.fs; + this.parseFile = this.cache ? this._parseFileCached : this._parseFile; + this.loader = new Loader(this.liquid.options); + this.parseLimit = new Limiter('parse length', liquid.options.parseLimit); + this.readFile = toLiquidAsync(((_a = this.fs.readFile) === null || _a === void 0 ? void 0 : _a.bind(this.fs)) || (() => __awaiter(this, void 0, void 0, function* () { throw new Error('readFile not implemented'); })), (_b = this.fs.readFileSync) === null || _b === void 0 ? void 0 : _b.bind(this.fs)); + } + parse(html, filepath) { + html = String(html); + this.parseLimit.use(html.length); + const tokenizer = new Tokenizer(html, this.liquid.options.operators, filepath); + const tokens = tokenizer.readTopLevelTokens(this.liquid.options); + return this.parseTokens(tokens); + } + parseTokens(tokens) { + let token; + const templates = []; + const errors = []; + while ((token = tokens.shift())) { + try { + templates.push(this.parseToken(token, tokens)); + } + catch (err) { + if (this.liquid.options.catchAllErrors) + errors.push(err); + else + throw err; + } + } + if (errors.length) + throw new LiquidErrors(errors); + return templates; + } + parseToken(token, remainTokens) { + try { + if (isTagToken(token)) { + const TagClass = this.liquid.tags[token.name]; + assert(TagClass, `tag "${token.name}" not found`); + return new TagClass(token, remainTokens, this.liquid, this); + } + if (isOutputToken(token)) { + return new Output(token, this.liquid); + } + return new HTML(token); + } + catch (e) { + if (LiquidError.is(e)) + throw e; + throw new ParseError(e, token); + } + } + parseStream(tokens) { + return new ParseStream(tokens, (token, tokens) => this.parseToken(token, tokens)); + } + *_parseFileCached(file, sync, type = LookupType.Root, currentFile) { + const cache = this.cache; + const key = this.loader.shouldLoadRelative(file) ? currentFile + ',' + file : type + ':' + file; + const tpls = yield cache.read(key); + if (tpls) + return tpls; + const task = this._parseFile(file, sync, type, currentFile); + // sync mode: exec the task and cache the result + // async mode: cache the task before exec + const taskOrTpl = sync ? yield task : toPromise(task); + cache.write(key, taskOrTpl); + // note: concurrent tasks will be reused, cache for failed task is removed until its end + try { + return yield taskOrTpl; + } + catch (err) { + cache.remove(key); + throw err; + } + } + *_parseFile(file, sync, type = LookupType.Root, currentFile) { + const filepath = yield this.loader.lookup(file, type, sync, currentFile); + return this.parse(yield this.readFile(!!sync, filepath), filepath); + } +} + +var TokenKind; +(function (TokenKind) { + TokenKind[TokenKind["Number"] = 1] = "Number"; + TokenKind[TokenKind["Literal"] = 2] = "Literal"; + TokenKind[TokenKind["Tag"] = 4] = "Tag"; + TokenKind[TokenKind["Output"] = 8] = "Output"; + TokenKind[TokenKind["HTML"] = 16] = "HTML"; + TokenKind[TokenKind["Filter"] = 32] = "Filter"; + TokenKind[TokenKind["Hash"] = 64] = "Hash"; + TokenKind[TokenKind["PropertyAccess"] = 128] = "PropertyAccess"; + TokenKind[TokenKind["Word"] = 256] = "Word"; + TokenKind[TokenKind["Range"] = 512] = "Range"; + TokenKind[TokenKind["Quoted"] = 1024] = "Quoted"; + TokenKind[TokenKind["Operator"] = 2048] = "Operator"; + TokenKind[TokenKind["FilteredValue"] = 4096] = "FilteredValue"; + TokenKind[TokenKind["Delimited"] = 12] = "Delimited"; +})(TokenKind || (TokenKind = {})); + +function isDelimitedToken(val) { + return !!(getKind(val) & TokenKind.Delimited); +} +function isOperatorToken(val) { + return getKind(val) === TokenKind.Operator; +} +function isHTMLToken(val) { + return getKind(val) === TokenKind.HTML; +} +function isOutputToken(val) { + return getKind(val) === TokenKind.Output; +} +function isTagToken(val) { + return getKind(val) === TokenKind.Tag; +} +function isQuotedToken(val) { + return getKind(val) === TokenKind.Quoted; +} +function isLiteralToken(val) { + return getKind(val) === TokenKind.Literal; +} +function isNumberToken(val) { + return getKind(val) === TokenKind.Number; +} +function isPropertyAccessToken(val) { + return getKind(val) === TokenKind.PropertyAccess; +} +function isWordToken(val) { + return getKind(val) === TokenKind.Word; +} +function isRangeToken(val) { + return getKind(val) === TokenKind.Range; +} +function isValueToken(val) { + // valueTokenBitMask = TokenKind.Number | TokenKind.Literal | TokenKind.Quoted | TokenKind.PropertyAccess | TokenKind.Range + return (getKind(val) & 1667) > 0; +} +function getKind(val) { + return val ? val.kind : -1; +} + +var typeGuards = /*#__PURE__*/Object.freeze({ + __proto__: null, + isDelimitedToken: isDelimitedToken, + isOperatorToken: isOperatorToken, + isHTMLToken: isHTMLToken, + isOutputToken: isOutputToken, + isTagToken: isTagToken, + isQuotedToken: isQuotedToken, + isLiteralToken: isLiteralToken, + isNumberToken: isNumberToken, + isPropertyAccessToken: isPropertyAccessToken, + isWordToken: isWordToken, + isRangeToken: isRangeToken, + isValueToken: isValueToken +}); + +function createScope(from) { + const scope = Object.create(null); + if (from) + Object.assign(scope, from); + return scope; +} + +class Context { + constructor(env = {}, opts = defaultOptions, renderOptions = {}, { memoryLimit, renderLimit } = {}) { + var _a, _b, _c, _d, _e; + /** + * insert a Context-level empty scope, + * for tags like `{% capture %}` `{% assign %}` to operate + */ + this.scopes = [createScope()]; + this.registers = {}; + this.breakCalled = false; + this.continueCalled = false; + this.sync = !!renderOptions.sync; + this.opts = opts; + this.globals = (_a = renderOptions.globals) !== null && _a !== void 0 ? _a : opts.globals; + this.environments = isObject(env) ? env : Object(env); + this.strictVariables = (_b = renderOptions.strictVariables) !== null && _b !== void 0 ? _b : this.opts.strictVariables; + this.ownPropertyOnly = (_c = renderOptions.ownPropertyOnly) !== null && _c !== void 0 ? _c : opts.ownPropertyOnly; + this.memoryLimit = memoryLimit !== null && memoryLimit !== void 0 ? memoryLimit : new Limiter('memory alloc', (_d = renderOptions.memoryLimit) !== null && _d !== void 0 ? _d : opts.memoryLimit); + this.renderLimit = renderLimit !== null && renderLimit !== void 0 ? renderLimit : new Limiter('template render', getPerformance().now() + ((_e = renderOptions.renderLimit) !== null && _e !== void 0 ? _e : opts.renderLimit)); + } + getRegister(key, defaultValue = undefined) { + return (this.registers[key] = this.registers[key] || defaultValue); + } + setRegister(key, value) { + return (this.registers[key] = value); + } + saveRegister(...keys) { + return keys.map(key => [key, this.getRegister(key)]); + } + restoreRegister(keyValues) { + return keyValues.forEach(([key, value]) => this.setRegister(key, value)); + } + getAll() { + return [this.globals, this.environments, ...this.scopes] + .reduce((ctx, val) => __assign(ctx, val), {}); + } + /** + * @deprecated use `_get()` or `getSync()` instead + */ + get(paths) { + return this.getSync(paths); + } + getSync(paths) { + return toValueSync(this._get(paths)); + } + *_get(paths) { + const scope = this.findScope(paths[0]); // first prop should always be a string + return yield this._getFromScope(scope, paths); + } + /** + * @deprecated use `_get()` instead + */ + getFromScope(scope, paths) { + return toValueSync(this._getFromScope(scope, paths)); + } + *_getFromScope(scope, paths, strictVariables = this.strictVariables) { + if (isString(paths)) + paths = paths.split('.'); + for (let i = 0; i < paths.length; i++) { + scope = yield this.readProperty(scope, paths[i]); + if (strictVariables && isUndefined(scope)) { + throw new InternalUndefinedVariableError(paths.slice(0, i + 1).join('.')); + } + } + return scope; + } + push(ctx) { + return this.scopes.push(ctx); + } + pop() { + return this.scopes.pop(); + } + bottom() { + return this.scopes[0]; + } + spawn(scope = {}) { + return new Context(scope, this.opts, { + sync: this.sync, + globals: this.globals, + strictVariables: this.strictVariables, + ownPropertyOnly: this.ownPropertyOnly + }, { + renderLimit: this.renderLimit, + memoryLimit: this.memoryLimit + }); + } + findScope(key) { + for (let i = this.scopes.length - 1; i >= 0; i--) { + const candidate = this.scopes[i]; + if (key in candidate) + return candidate; + } + if (key in this.environments) + return this.environments; + return this.globals; + } + readProperty(obj, key) { + obj = toLiquid(obj); + key = toValue(key); + if (isNil(obj)) + return obj; + if (isArray(obj) && isNumber(key)) + return readArrayElement(obj, key, this.ownPropertyOnly); + const value = readJSProperty(obj, key, this.ownPropertyOnly); + if (value === undefined && obj instanceof Drop) + return obj.liquidMethodMissing(key, this); + if (isFunction(value)) + return value.call(obj); + if (key === 'size') + return readSize(obj); + else if (key === 'first') + return readFirst(obj, this.ownPropertyOnly); + else if (key === 'last') + return readLast(obj, this.ownPropertyOnly); + return value; + } +} +function readJSProperty(obj, key, ownPropertyOnly) { + if (ownPropertyOnly && !hasOwnProperty.call(obj, key) && !(obj instanceof Drop)) + return undefined; + return obj[key]; +} +function readFirst(obj, ownPropertyOnly) { + if (isArray(obj)) + return readArrayElement(obj, 0, ownPropertyOnly); + return readJSProperty(obj, 'first', ownPropertyOnly); +} +function readLast(obj, ownPropertyOnly) { + if (isArray(obj)) + return readArrayElement(obj, -1, ownPropertyOnly); + return readJSProperty(obj, 'last', ownPropertyOnly); +} +function readSize(obj) { + if (hasOwnProperty.call(obj, 'size') || obj['size'] !== undefined) + return obj['size']; + if (isArray(obj) || isString(obj)) + return obj.length; + if (typeof obj === 'object') + return Object.keys(obj).length; +} + +var BlockMode; +(function (BlockMode) { + /* store rendered html into blocks */ + BlockMode[BlockMode["OUTPUT"] = 0] = "OUTPUT"; + /* output rendered html directly */ + BlockMode[BlockMode["STORE"] = 1] = "STORE"; +})(BlockMode || (BlockMode = {})); + +const abs = argumentsToNumber(Math.abs); +const at_least = argumentsToNumber(Math.max); +const at_most = argumentsToNumber(Math.min); +const ceil = argumentsToNumber(Math.ceil); +const divided_by = argumentsToNumber((dividend, divisor, integerArithmetic = false) => integerArithmetic ? Math.floor(dividend / divisor) : dividend / divisor); +const floor = argumentsToNumber(Math.floor); +const minus = argumentsToNumber((v, arg) => v - arg); +const plus = argumentsToNumber((lhs, rhs) => lhs + rhs); +const modulo = argumentsToNumber((v, arg) => ((v % arg) + arg) % arg); +const times = argumentsToNumber((v, arg) => v * arg); +function round(v, arg = 0) { + v = toNumber(v); + arg = toNumber(arg); + const amp = Math.pow(10, arg); + const scaled = (v * amp) * (1 + Number.EPSILON); + return Math.round(scaled) / amp; +} + +var mathFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + abs: abs, + at_least: at_least, + at_most: at_most, + ceil: ceil, + divided_by: divided_by, + floor: floor, + minus: minus, + plus: plus, + modulo: modulo, + times: times, + round: round +}); + +const url_decode = (x) => decodeURIComponent(stringify(x)).replace(/\+/g, ' '); +const url_encode = (x) => encodeURIComponent(stringify(x)).replace(/%20/g, '+'); +const cgi_escape = (x) => encodeURIComponent(stringify(x)) + .replace(/%20/g, '+') + .replace(/[!'()*]/g, c => '%' + c.charCodeAt(0).toString(16).toUpperCase()); +const uri_escape = (x) => encodeURI(stringify(x)) + .replace(/%5B/g, '[') + .replace(/%5D/g, ']'); +const rSlugifyDefault = /[^\p{M}\p{L}\p{Nd}]+/ug; +const rSlugifyReplacers = { + 'raw': /\s+/g, + 'default': rSlugifyDefault, + 'pretty': /[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/ug, + 'ascii': /[^A-Za-z0-9]+/g, + 'latin': rSlugifyDefault, + 'none': null +}; +function slugify(str, mode = 'default', cased = false) { + str = stringify(str); + const replacer = rSlugifyReplacers[mode]; + if (replacer) { + if (mode === 'latin') + str = removeAccents(str); + str = str.replace(replacer, '-').replace(/^-|-$/g, ''); + } + return cased ? str : str.toLowerCase(); +} +function removeAccents(str) { + return str.replace(/[àáâãäå]/g, 'a') + .replace(/[æ]/g, 'ae') + .replace(/[ç]/g, 'c') + .replace(/[èéêë]/g, 'e') + .replace(/[ìíîï]/g, 'i') + .replace(/[ð]/g, 'd') + .replace(/[ñ]/g, 'n') + .replace(/[òóôõöø]/g, 'o') + .replace(/[ùúûü]/g, 'u') + .replace(/[ýÿ]/g, 'y') + .replace(/[ß]/g, 'ss') + .replace(/[œ]/g, 'oe') + .replace(/[þ]/g, 'th') + .replace(/[ẞ]/g, 'SS') + .replace(/[Œ]/g, 'OE') + .replace(/[Þ]/g, 'TH'); +} + +var urlFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + url_decode: url_decode, + url_encode: url_encode, + cgi_escape: cgi_escape, + uri_escape: uri_escape, + slugify: slugify +}); + +const join = argumentsToValue(function (v, arg) { + const array = toArray(v); + const sep = isNil(arg) ? ' ' : stringify(arg); + let outputSize = sep.length * Math.max(array.length - 1, 0); + for (let i = 0; i < array.length; i++) + outputSize += String(array[i]).length; + this.context.memoryLimit.use(outputSize); + return Array.prototype.join.call(array, sep); +}); +const last$1 = argumentsToValue(function (v) { + return isArrayLike(v) ? readArrayElement(v, -1, this.context.ownPropertyOnly) : ''; +}); +const first = argumentsToValue(function (v) { + return isArrayLike(v) ? readArrayElement(v, 0, this.context.ownPropertyOnly) : ''; +}); +const reverse = argumentsToValue(function (v) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + return [...array].reverse(); +}); +function* sortBy(arr, property, comparator) { + const values = []; + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + for (const item of array) { + values.push([ + item, + property ? yield this.context._getFromScope(item, stringify(property).split('.'), false) : item + ]); + } + return values.sort((lhs, rhs) => comparator(lhs[1], rhs[1])).map(tuple => tuple[0]); +} +function* sort(arr, property) { + return yield* sortBy.call(this, arr, property, orderedCompare); +} +function* sort_natural(arr, property) { + return yield* sortBy.call(this, arr, property, caseInsensitiveCompare); +} +const size = (v) => (v && v.length) || 0; +function* map(arr, property) { + const results = []; + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + for (const item of array) { + results.push(yield this.context._getFromScope(item, stringify(property), false)); + } + return results; +} +function* sum(arr, property) { + let sum = 0; + const array = toArray(arr); + for (const item of array) { + const data = Number(property ? yield this.context._getFromScope(item, stringify(property), false) : item); + sum += Number.isNaN(data) ? 0 : data; + } + return sum; +} +function compact(arr) { + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + return Array.prototype.filter.call(array, x => !isNil(toValue(x))); +} +function concat(v, arg = []) { + const lhs = toArray(v); + const rhs = toArray(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return Array.prototype.concat.call(lhs, rhs); +} +function push(v, arg) { + return concat.call(this, v, [arg]); +} +function unshift(v, arg) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + const clone = [...array]; + clone.unshift(arg); + return clone; +} +function pop(v) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + const clone = [...array]; + clone.pop(); + return clone; +} +function shift(v) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + const clone = [...array]; + clone.shift(); + return clone; +} +function slice(v, begin, length = 1) { + v = toValue(v); + if (isNil(v)) + return []; + if (!isArray(v)) + v = stringify(v); + begin = begin < 0 ? v.length + begin : begin; + if (begin < 0 || length < 0) + return isArray(v) ? [] : ''; + this.context.memoryLimit.use(length); + return isArray(v) + ? Array.prototype.slice.call(v, begin, begin + length) + : String.prototype.slice.call(v, begin, begin + length); +} +function expectedMatcher(expected) { + if (this.context.opts.jekyllWhere) { + return (v) => EmptyDrop.is(expected) ? equals(v, expected) : (isArray(v) ? arrayIncludes(v, expected) : equals(v, expected)); + } + else if (expected === undefined) { + return (v) => isTruthy(v, this.context); + } + else { + return (v) => equals(v, expected); + } +} +function* filter(include, arr, property, expected) { + const values = []; + arr = toArray(arr); + this.context.memoryLimit.use(arr.length); + const token = new Tokenizer(stringify(property)).readScopeValue(); + for (const item of arr) { + values.push(yield evalToken(token, this.context.spawn(item))); + } + const matcher = expectedMatcher.call(this, expected); + return Array.prototype.filter.call(arr, (_, i) => matcher(values[i]) === include); +} +function* filter_exp(include, arr, itemName, exp) { + const filtered = []; + const keyTemplate = new Value(stringify(exp), this.liquid); + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + for (const item of array) { + this.context.push({ [itemName]: item }); + const value = yield keyTemplate.value(this.context); + this.context.pop(); + if (value === include) + filtered.push(item); + } + return filtered; +} +function* where(arr, property, expected) { + return yield* filter.call(this, true, arr, property, expected); +} +function* reject(arr, property, expected) { + return yield* filter.call(this, false, arr, property, expected); +} +function* where_exp(arr, itemName, exp) { + return yield* filter_exp.call(this, true, arr, itemName, exp); +} +function* reject_exp(arr, itemName, exp) { + return yield* filter_exp.call(this, false, arr, itemName, exp); +} +function* group_by(arr, property) { + const map = new Map(); + arr = toEnumerable(arr); + const token = new Tokenizer(stringify(property)).readScopeValue(); + this.context.memoryLimit.use(arr.length); + for (const item of arr) { + const key = yield evalToken(token, this.context.spawn(item)); + if (!map.has(key)) + map.set(key, []); + map.get(key).push(item); + } + return [...map.entries()].map(([name, items]) => ({ name, items })); +} +function* group_by_exp(arr, itemName, exp) { + const map = new Map(); + const keyTemplate = new Value(stringify(exp), this.liquid); + arr = toEnumerable(arr); + this.context.memoryLimit.use(arr.length); + for (const item of arr) { + this.context.push({ [itemName]: item }); + const key = yield keyTemplate.value(this.context); + this.context.pop(); + if (!map.has(key)) + map.set(key, []); + map.get(key).push(item); + } + return [...map.entries()].map(([name, items]) => ({ name, items })); +} +function* search(arr, property, expected) { + const token = new Tokenizer(stringify(property)).readScopeValue(); + const array = toArray(arr); + const matcher = expectedMatcher.call(this, expected); + for (let index = 0; index < array.length; index++) { + const value = yield evalToken(token, this.context.spawn(array[index])); + if (matcher(value)) + return [index, array[index]]; + } +} +function* search_exp(arr, itemName, exp) { + const predicate = new Value(stringify(exp), this.liquid); + const array = toArray(arr); + for (let index = 0; index < array.length; index++) { + this.context.push({ [itemName]: array[index] }); + const value = yield predicate.value(this.context); + this.context.pop(); + if (value) + return [index, array[index]]; + } +} +function* has(arr, property, expected) { + const result = yield* search.call(this, arr, property, expected); + return !!result; +} +function* has_exp(arr, itemName, exp) { + const result = yield* search_exp.call(this, arr, itemName, exp); + return !!result; +} +function* find_index(arr, property, expected) { + const result = yield* search.call(this, arr, property, expected); + return result ? result[0] : undefined; +} +function* find_index_exp(arr, itemName, exp) { + const result = yield* search_exp.call(this, arr, itemName, exp); + return result ? result[0] : undefined; +} +function* find(arr, property, expected) { + const result = yield* search.call(this, arr, property, expected); + return result ? result[1] : undefined; +} +function* find_exp(arr, itemName, exp) { + const result = yield* search_exp.call(this, arr, itemName, exp); + return result ? result[1] : undefined; +} +function uniq(arr) { + arr = toArray(arr); + this.context.memoryLimit.use(arr.length); + return [...new Set(arr)]; +} +function sample(v, count = 1) { + v = toValue(v); + if (isNil(v)) + return []; + if (!isArray(v)) + v = stringify(v); + this.context.memoryLimit.use(v.length); + const shuffled = [...v].sort(() => Math.random() - 0.5); + if (count === 1) + return shuffled[0]; + return shuffled.slice(0, count); +} + +var arrayFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + join: join, + last: last$1, + first: first, + reverse: reverse, + sort: sort, + sort_natural: sort_natural, + size: size, + map: map, + sum: sum, + compact: compact, + concat: concat, + push: push, + unshift: unshift, + pop: pop, + shift: shift, + slice: slice, + where: where, + reject: reject, + where_exp: where_exp, + reject_exp: reject_exp, + group_by: group_by, + group_by_exp: group_by_exp, + has: has, + has_exp: has_exp, + find_index: find_index, + find_index_exp: find_index_exp, + find: find, + find_exp: find_exp, + uniq: uniq, + sample: sample +}); + +function date(v, format, timezoneOffset) { + var _a, _b; + const size = ((_a = v === null || v === void 0 ? void 0 : v.length) !== null && _a !== void 0 ? _a : 0) + ((_b = timezoneOffset === null || timezoneOffset === void 0 ? void 0 : timezoneOffset.length) !== null && _b !== void 0 ? _b : 0); + this.context.memoryLimit.use(size); + const date = parseDate(v, this.context.opts, timezoneOffset); + if (!date) + return v; + format = toValue(format); + format = isNil(format) ? this.context.opts.dateFormat : stringify(format); + this.context.memoryLimit.use(format.length); + return strftime(date, format, this.context.memoryLimit); +} +function date_to_xmlschema(v) { + return date.call(this, v, '%Y-%m-%dT%H:%M:%S%:z'); +} +function date_to_rfc822(v) { + return date.call(this, v, '%a, %d %b %Y %H:%M:%S %z'); +} +function date_to_string(v, type, style) { + return stringify_date.call(this, v, '%b', type, style); +} +function date_to_long_string(v, type, style) { + return stringify_date.call(this, v, '%B', type, style); +} +function stringify_date(v, month_type, type, style) { + const date = parseDate(v, this.context.opts); + if (!date) + return v; + const ml = this.context.memoryLimit; + if (type === 'ordinal') { + const d = date.getDate(); + return style === 'US' + ? strftime(date, `${month_type} ${d}%q, %Y`, ml) + : strftime(date, `${d}%q ${month_type} %Y`, ml); + } + return strftime(date, `%d ${month_type} %Y`, ml); +} +function parseDate(v, opts, timezoneOffset) { + let date; + const defaultTimezoneOffset = timezoneOffset !== null && timezoneOffset !== void 0 ? timezoneOffset : opts.timezoneOffset; + const locale = opts.locale; + v = toValue(v); + if (isNil(v)) { + return undefined; + } + else if (v === 'now' || v === 'today') { + date = new LiquidDate(Date.now(), locale, defaultTimezoneOffset); + } + else if (isNumber(v)) { + date = new LiquidDate(v * 1000, locale, defaultTimezoneOffset); + } + else if (isString(v)) { + if (/^\d+$/.test(v)) { + date = new LiquidDate(+v * 1000, locale, defaultTimezoneOffset); + } + else if (opts.preserveTimezones && timezoneOffset === undefined) { + date = LiquidDate.createDateFixedToTimezone(v, locale); + } + else { + date = new LiquidDate(v, locale, defaultTimezoneOffset); + } + } + else { + date = new LiquidDate(v, locale, defaultTimezoneOffset); + } + return date.valid() ? date : undefined; +} + +var dateFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + date: date, + date_to_xmlschema: date_to_xmlschema, + date_to_rfc822: date_to_rfc822, + date_to_string: date_to_string, + date_to_long_string: date_to_long_string +}); + +/** + * String related filters + * + * * prefer stringify() to String() since `undefined`, `null` should eval '' + */ +const rCJKWord = /[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/gu; +// Word boundary followed by word characters (for detecting words) +const rNonCJKWord = /[^\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF\s]+/gu; +function append(v, arg) { + assert(arguments.length === 2, 'append expect 2 arguments'); + const lhs = stringify(v); + const rhs = stringify(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return lhs + rhs; +} +function prepend(v, arg) { + assert(arguments.length === 2, 'prepend expect 2 arguments'); + const lhs = stringify(v); + const rhs = stringify(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return rhs + lhs; +} +function lstrip(v, chars) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + if (chars) { + chars = stringify(chars); + this.context.memoryLimit.use(chars.length); + for (let i = 0, set = new Set(chars); i < str.length; i++) { + if (!set.has(str[i])) + return str.slice(i); + } + return ''; + } + return str.trimStart(); +} +function downcase(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.toLowerCase(); +} +function upcase(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return stringify(str).toUpperCase(); +} +function remove(v, arg) { + const str = stringify(v); + arg = stringify(arg); + this.context.memoryLimit.use(str.length + arg.length); + return str.split(arg).join(''); +} +function remove_first(v, l) { + const str = stringify(v); + l = stringify(l); + this.context.memoryLimit.use(str.length + l.length); + return str.replace(l, ''); +} +function remove_last(v, l) { + const str = stringify(v); + const pattern = stringify(l); + this.context.memoryLimit.use(str.length + pattern.length); + const index = str.lastIndexOf(pattern); + if (index === -1) + return str; + return str.substring(0, index) + str.substring(index + pattern.length); +} +function rstrip(str, chars) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + if (chars) { + chars = stringify(chars); + this.context.memoryLimit.use(chars.length); + for (let i = str.length - 1, set = new Set(chars); i >= 0; i--) { + if (!set.has(str[i])) + return str.slice(0, i + 1); + } + return ''; + } + return str.trimEnd(); +} +function split(v, arg) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + const arr = str.split(stringify(arg)); + // align to ruby split, which is the behavior of shopify/liquid + // see: https://ruby-doc.org/core-2.4.0/String.html#method-i-split + while (arr.length && arr[arr.length - 1] === '') + arr.pop(); + return arr; +} +function strip(v, chars) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + if (chars) { + const set = new Set(stringify(chars)); + this.context.memoryLimit.use(set.size); + let i = 0; + let j = str.length - 1; + while (set.has(str[i])) + i++; + while (j >= i && set.has(str[j])) + j--; + return str.slice(i, j + 1); + } + return str.trim(); +} +function strip_newlines(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\r?\n/gm, ''); +} +function capitalize(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); +} +function replace(v, pattern, replacement) { + const str = stringify(v); + pattern = stringify(pattern); + replacement = stringify(replacement); + const parts = str.split(pattern); + const outputSize = str.length + (parts.length - 1) * (replacement.length - pattern.length); + this.context.memoryLimit.use(outputSize); + return parts.join(replacement); +} +function replace_first(v, arg1, arg2) { + const str = stringify(v); + arg1 = stringify(arg1); + arg2 = stringify(arg2); + this.context.memoryLimit.use(str.length + arg1.length + arg2.length); + return str.replace(arg1, () => arg2); +} +function replace_last(v, arg1, arg2) { + const str = stringify(v); + const pattern = stringify(arg1); + const replacement = stringify(arg2); + this.context.memoryLimit.use(str.length + pattern.length + replacement.length); + const index = str.lastIndexOf(pattern); + if (index === -1) + return str; + return str.substring(0, index) + replacement + str.substring(index + pattern.length); +} +function truncate(v, l = 50, o = '...') { + const str = stringify(v); + o = stringify(o); + this.context.memoryLimit.use(str.length + o.length); + if (str.length <= l) + return v; + return str.substring(0, l - o.length) + o; +} +function truncatewords(v, words = 15, o = '...') { + const str = stringify(v); + o = stringify(o); + this.context.memoryLimit.use(str.length + o.length); + const arr = str.split(/\s+/); + if (words <= 0) + words = 1; + let ret = arr.slice(0, words).join(' '); + if (arr.length >= words) + ret += o; + return ret; +} +function normalize_whitespace(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\s+/g, ' '); +} +function number_of_words(input, mode) { + const str = stringify(input); + this.context.memoryLimit.use(str.length); + input = str.trim(); + if (!input) + return 0; + switch (mode) { + case 'cjk': + // Count CJK characters and words + return (input.match(rCJKWord) || []).length + (input.match(rNonCJKWord) || []).length; + case 'auto': + // Count CJK characters, if none, count words + return rCJKWord.test(input) + ? input.match(rCJKWord).length + (input.match(rNonCJKWord) || []).length + : input.split(/\s+/).length; + default: + // Count words only + return input.split(/\s+/).length; + } +} +function array_to_sentence_string(array, connector = 'and') { + connector = stringify(connector); + let outputSize = connector.length + array.length * 2; + for (let i = 0; i < array.length; i++) + outputSize += stringify(array[i]).length; + this.context.memoryLimit.use(outputSize); + switch (array.length) { + case 0: + return ''; + case 1: + return array[0]; + case 2: + return `${array[0]} ${connector} ${array[1]}`; + default: + return `${array.slice(0, -1).join(', ')}, ${connector} ${array[array.length - 1]}`; + } +} + +var stringFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + append: append, + prepend: prepend, + lstrip: lstrip, + downcase: downcase, + upcase: upcase, + remove: remove, + remove_first: remove_first, + remove_last: remove_last, + rstrip: rstrip, + split: split, + strip: strip, + strip_newlines: strip_newlines, + capitalize: capitalize, + replace: replace, + replace_first: replace_first, + replace_last: replace_last, + truncate: truncate, + truncatewords: truncatewords, + normalize_whitespace: normalize_whitespace, + number_of_words: number_of_words, + array_to_sentence_string: array_to_sentence_string +}); + +function base64Encode(str) { + return btoa(String.fromCharCode(...new TextEncoder().encode(str))); +} +function base64Decode(str) { + return new TextDecoder().decode(Uint8Array.from(atob(str), c => c.charCodeAt(0))); +} + +/** + * Base64 related filters + * + * Implements base64_encode and base64_decode filters for Shopify compatibility + */ +function base64_encode(value) { + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { + this.context.memoryLimit.use(value.byteLength); + return value.toString('base64'); + } + const str = stringify(value); + this.context.memoryLimit.use(str.length); + return base64Encode(str); +} +function base64_decode(value) { + const str = stringify(value); + this.context.memoryLimit.use(str.length); + return base64Decode(str); +} + +var base64Filters = /*#__PURE__*/Object.freeze({ + __proto__: null, + base64_encode: base64_encode, + base64_decode: base64_decode +}); + +function bufferToHex(buffer) { + const bytes = new Uint8Array(buffer); + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += bytes[i].toString(16).padStart(2, '0'); + } + return hex; +} +function sha256(str) { + return __awaiter(this, void 0, void 0, function* () { + const data = new TextEncoder().encode(str); + const digest = yield crypto.subtle.digest('SHA-256', data); + return bufferToHex(digest); + }); +} +function hmacSha256(str, key) { + return __awaiter(this, void 0, void 0, function* () { + const encoder = new TextEncoder(); + const cryptoKey = yield crypto.subtle.importKey('raw', encoder.encode(key), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']); + const signature = yield crypto.subtle.sign('HMAC', cryptoKey, encoder.encode(str)); + return bufferToHex(signature); + }); +} + +/** + * Crypto related filters + * + * Implements sha256 and hmac_sha256 filters for Shopify compatibility + */ +function sha256$1(value) { + const str = stringify(value); + this.context.memoryLimit.use(str.length); + return sha256(str); +} +function hmac_sha256(value, key) { + const str = stringify(value); + const keyStr = stringify(key); + this.context.memoryLimit.use(str.length + keyStr.length); + return hmacSha256(str, keyStr); +} + +var cryptoFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + sha256: sha256$1, + hmac_sha256: hmac_sha256 +}); + +const filters = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, htmlFilters), mathFilters), urlFilters), arrayFilters), dateFilters), stringFilters), base64Filters), cryptoFilters), misc); + +class AssignTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.identifier = this.tokenizer.readIdentifier(); + this.key = this.identifier.content; + this.tokenizer.assert(this.key, 'expected variable name'); + this.tokenizer.skipBlank(); + this.tokenizer.assert(this.tokenizer.peek() === '=', 'expected "="'); + this.tokenizer.advance(); + this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid); + } + *render(ctx) { + ctx.bottom()[this.key] = yield this.value.value(ctx, this.liquid.options.lenientIf); + } + *arguments() { + yield this.value; + } + *localScope() { + yield this.identifier; + } +} + +const MODIFIERS = ['offset', 'limit', 'reversed']; +class ForTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const variable = this.tokenizer.readIdentifier(); + const inStr = this.tokenizer.readIdentifier(); + const collection = this.tokenizer.readValue(); + if (!variable.size() || inStr.content !== 'in' || !collection) { + throw new Error(`illegal tag: ${token.getText()}`); + } + this.variable = variable.content; + this.collection = collection; + this.hash = new Hash(this.tokenizer, liquid.options.keyValueSeparator); + this.templates = []; + this.elseTemplates = []; + let p; + const stream = parser.parseStream(remainTokens) + .on('start', () => (p = this.templates)) + .on('tag:else', tag => { assertEmpty(tag.args); p = this.elseTemplates; }) + .on('tag:endfor', tag => { assertEmpty(tag.args); stream.stop(); }) + .on('template', (tpl) => p.push(tpl)) + .on('end', () => { throw new Error(`tag ${token.getText()} not closed`); }); + stream.start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + let collection = toEnumerable(yield evalToken(this.collection, ctx)); + if (!collection.length) { + yield r.renderTemplates(this.elseTemplates, ctx, emitter); + return; + } + const continueKey = 'continue-' + this.variable + '-' + this.collection.getText(); + ctx.push(createScope({ continue: ctx.getRegister(continueKey, {}) })); + const hash = (yield this.hash.render(ctx)); + ctx.pop(); + const modifiers = this.liquid.options.orderedFilterParameters + ? Object.keys(hash).filter(x => MODIFIERS.includes(x)) + : MODIFIERS.filter(x => hash[x] !== undefined); + collection = modifiers.reduce((collection, modifier) => { + if (modifier === 'offset') + return offset(collection, hash['offset']); + if (modifier === 'limit') + return limit(collection, hash['limit']); + return reversed(collection); + }, collection); + ctx.setRegister(continueKey, (hash['offset'] || 0) + collection.length); + const scope = createScope({ forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) }); + ctx.push(scope); + for (const item of collection) { + scope[this.variable] = item; + ctx.continueCalled = ctx.breakCalled = false; + yield r.renderTemplates(this.templates, ctx, emitter); + if (ctx.breakCalled) + break; + scope.forloop.next(); + } + ctx.continueCalled = ctx.breakCalled = false; + ctx.pop(); + } + *children() { + const templates = this.templates.slice(); + if (this.elseTemplates) { + templates.push(...this.elseTemplates); + } + return templates; + } + *arguments() { + yield this.collection; + for (const v of Object.values(this.hash.hash)) { + if (isValueToken(v)) { + yield v; + } + } + } + blockScope() { + return [this.variable, 'forloop']; + } +} +function reversed(arr) { + return [...arr].reverse(); +} +function offset(arr, count) { + return arr.slice(count); +} +function limit(arr, count) { + return arr.slice(0, count); +} + +class CaptureTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.templates = []; + this.identifier = this.readVariable(); + this.variable = this.identifier.content; + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endcapture') + return; + this.templates.push(parser.parseToken(token, remainTokens)); + } + throw new Error(`tag ${tagToken.getText()} not closed`); + } + readVariable() { + let ident = this.tokenizer.readIdentifier(); + if (ident.content) + return ident; + ident = this.tokenizer.readQuoted(); + if (ident) + return ident; + throw this.tokenizer.error('invalid capture name'); + } + *render(ctx) { + const r = this.liquid.renderer; + const html = yield r.renderTemplates(this.templates, ctx); + ctx.bottom()[this.variable] = html; + } + *children() { + return this.templates; + } + *localScope() { + yield this.identifier; + } +} + +class CaseTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.branches = []; + this.elseTemplates = []; + this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid); + this.elseTemplates = []; + let p = []; + let elseCount = 0; + const stream = parser.parseStream(remainTokens) + .on('tag:when', (token) => { + if (elseCount > 0) { + return; + } + p = []; + const values = []; + while (!token.tokenizer.end()) { + values.push(token.tokenizer.readValueOrThrow()); + token.tokenizer.skipBlank(); + if (token.tokenizer.peek() === ',') { + token.tokenizer.readTo(','); + } + else { + token.tokenizer.readTo('or'); + } + } + this.branches.push({ + values, + templates: p + }); + }) + .on('tag:else', () => { + elseCount++; + p = this.elseTemplates; + }) + .on('tag:endcase', () => stream.stop()) + .on('template', (tpl) => { + if (p !== this.elseTemplates || elseCount === 1) { + p.push(tpl); + } + }) + .on('end', () => { + throw new Error(`tag ${tagToken.getText()} not closed`); + }); + stream.start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + const target = toValue(yield this.value.value(ctx, ctx.opts.lenientIf)); + let branchHit = false; + for (const branch of this.branches) { + for (const valueToken of branch.values) { + const value = yield evalToken(valueToken, ctx, ctx.opts.lenientIf); + if (equals(target, value)) { + yield r.renderTemplates(branch.templates, ctx, emitter); + branchHit = true; + break; + } + } + } + if (!branchHit) { + yield r.renderTemplates(this.elseTemplates, ctx, emitter); + } + } + *arguments() { + yield this.value; + yield* this.branches.flatMap(b => b.values); + } + *children() { + const templates = this.branches.flatMap(b => b.templates); + if (this.elseTemplates) { + templates.push(...this.elseTemplates); + } + return templates; + } +} + +class CommentTag extends Tag { + constructor(tagToken, remainTokens, liquid) { + super(tagToken, remainTokens, liquid); + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endcomment') + return; + } + throw new Error(`tag ${tagToken.getText()} not closed`); + } + render() { } +} + +class RenderTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const tokenizer = this.tokenizer; + this.file = parseFilePath(tokenizer, this.liquid, parser); + this.currentFile = token.file; + while (!tokenizer.end()) { + tokenizer.skipBlank(); + const begin = tokenizer.p; + const keyword = tokenizer.readIdentifier(); + if (keyword.content === 'with' || keyword.content === 'for') { + tokenizer.skipBlank(); + // can be normal key/value pair, like "with: true" + if (tokenizer.peek() !== ':') { + const value = tokenizer.readValue(); + // can be normal key, like "with," + if (value) { + const beforeAs = tokenizer.p; + const asStr = tokenizer.readIdentifier(); + let alias; + if (asStr.content === 'as') + alias = tokenizer.readIdentifier(); + else + tokenizer.p = beforeAs; + const binding = { value, alias: alias && alias.content }; + if (keyword.content === 'with') + this.with = binding; + else + this.forBinding = binding; + tokenizer.skipBlank(); + if (tokenizer.peek() === ',') + tokenizer.advance(); + continue; // matched! + } + } + } + /** + * restore cursor if with/for not matched + */ + tokenizer.p = begin; + break; + } + this.hash = new Hash(tokenizer, liquid.options.keyValueSeparator); + } + *render(ctx, emitter) { + const { liquid, hash } = this; + const filepath = (yield renderFilePath(this.file, ctx, liquid)); + assert(filepath, () => `illegal file path "${filepath}"`); + const childCtx = ctx.spawn(); + const scope = childCtx.bottom(); + __assign(scope, yield hash.render(ctx)); + if (this.with) { + const { value, alias } = this.with; + scope[alias || filepath] = yield evalToken(value, ctx); + } + if (this.forBinding) { + const { value, alias } = this.forBinding; + const collection = toEnumerable(yield evalToken(value, ctx)); + scope['forloop'] = new ForloopDrop(collection.length, value.getText(), alias); + for (const item of collection) { + scope[alias] = item; + const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)); + yield liquid.renderer.renderTemplates(templates, childCtx, emitter); + scope['forloop'].next(); + } + } + else { + const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)); + yield liquid.renderer.renderTemplates(templates, childCtx, emitter); + } + } + *children(partials, sync) { + if (partials && isString(this.file)) { + return (yield this.liquid._parsePartialFile(this.file, sync, this.currentFile)); + } + return []; + } + partialScope() { + if (isString(this.file)) { + const names = Object.keys(this.hash.hash); + if (this.with) { + const { value, alias } = this.with; + if (isString(alias)) { + names.push([alias, value]); + } + else if (isString(this.file)) { + names.push([this.file, value]); + } + } + if (this.forBinding) { + const { value, alias } = this.forBinding; + if (isString(alias)) { + names.push([alias, value]); + } + else if (isString(this.file)) { + names.push([this.file, value]); + } + } + return { name: this.file, isolated: true, scope: names }; + } + } + *arguments() { + for (const v of Object.values(this.hash.hash)) { + if (isValueToken(v)) { + yield v; + } + } + if (this.with) { + const { value } = this.with; + if (isValueToken(value)) { + yield value; + } + } + if (this.forBinding) { + const { value } = this.forBinding; + if (isValueToken(value)) { + yield value; + } + } + } +} +/** + * @return null for "none", + * @return Template[] for quoted with tags and/or filters + * @return Token for expression (not quoted) + * @throws TypeError if cannot read next token + */ +function parseFilePath(tokenizer, liquid, parser) { + if (liquid.options.dynamicPartials) { + const file = tokenizer.readValue(); + tokenizer.assert(file, 'illegal file path'); + if (file.getText() === 'none') + return; + if (isQuotedToken(file)) { + // for filenames like "files/{{file}}", eval as liquid template + const templates = parser.parse(evalQuotedToken(file)); + return optimize(templates); + } + return file; + } + const tokens = [...tokenizer.readFileNameTemplate(liquid.options)]; + const templates = optimize(parser.parseTokens(tokens)); + return templates === 'none' ? undefined : templates; +} +function optimize(templates) { + // for filenames like "files/file.liquid", extract the string directly + if (templates.length === 1 && isHTMLToken(templates[0].token)) + return templates[0].token.getContent(); + return templates; +} +function* renderFilePath(file, ctx, liquid) { + if (typeof file === 'string') + return file; + if (Array.isArray(file)) + return liquid.renderer.renderTemplates(file, ctx); + return yield evalToken(file, ctx); +} + +class IncludeTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const { tokenizer } = token; + this.file = parseFilePath(tokenizer, this.liquid, parser); + this.currentFile = token.file; + const begin = tokenizer.p; + const withStr = tokenizer.readIdentifier(); + if (withStr.content === 'with') { + tokenizer.skipBlank(); + if (tokenizer.peek() !== ':') { + this.withVar = tokenizer.readValue(); + } + else + tokenizer.p = begin; + } + else + tokenizer.p = begin; + this.hash = new Hash(tokenizer, liquid.options.jekyllInclude || liquid.options.keyValueSeparator); + } + *render(ctx, emitter) { + const { liquid, hash, withVar } = this; + const { renderer } = liquid; + const filepath = (yield renderFilePath(this.file, ctx, liquid)); + assert(filepath, () => `illegal file path "${filepath}"`); + const saved = ctx.saveRegister('blocks', 'blockMode'); + ctx.setRegister('blocks', {}); + ctx.setRegister('blockMode', BlockMode.OUTPUT); + const scope = createScope((yield hash.render(ctx))); + if (withVar) + scope[filepath] = yield evalToken(withVar, ctx); + const templates = (yield liquid._parsePartialFile(filepath, ctx.sync, this.currentFile)); + ctx.push(ctx.opts.jekyllInclude ? createScope({ include: scope }) : scope); + yield renderer.renderTemplates(templates, ctx, emitter); + ctx.pop(); + ctx.restoreRegister(saved); + } + *children(partials, sync) { + if (partials && isString(this.file)) { + return (yield this.liquid._parsePartialFile(this.file, sync, this.currentFile)); + } + return []; + } + partialScope() { + if (isString(this.file)) { + let names; + if (this.liquid.options.jekyllInclude) { + names = ['include']; + } + else { + names = Object.keys(this.hash.hash); + if (this.withVar) { + names.push([this.file, this.withVar]); + } + } + return { name: this.file, isolated: false, scope: names }; + } + } + *arguments() { + yield* Object.values(this.hash.hash).filter(isValueToken); + if (isValueToken(this.file)) { + yield this.file; + } + if (isValueToken(this.withVar)) { + yield this.withVar; + } + } +} + +class DecrementTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.identifier = this.tokenizer.readIdentifier(); + this.variable = this.identifier.content; + } + render(context, emitter) { + const scope = context.environments; + if (!isNumber(scope[this.variable])) { + scope[this.variable] = 0; + } + emitter.write(stringify(--scope[this.variable])); + } + *localScope() { + yield this.identifier; + } +} + +class CycleTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.candidates = []; + const group = this.tokenizer.readValue(); + this.tokenizer.skipBlank(); + if (group) { + if (this.tokenizer.peek() === ':') { + this.group = group; + this.tokenizer.advance(); + } + else + this.candidates.push(group); + } + while (!this.tokenizer.end()) { + const value = this.tokenizer.readValue(); + if (value) + this.candidates.push(value); + this.tokenizer.readTo(','); + } + this.tokenizer.assert(this.candidates.length, () => `empty candidates: "${token.getText()}"`); + } + *render(ctx, emitter) { + const group = (yield evalToken(this.group, ctx)); + const fingerprint = `cycle:${group}:` + this.candidates.join(','); + const groups = ctx.getRegister('cycle', {}); + let idx = groups[fingerprint]; + if (idx === undefined) { + idx = groups[fingerprint] = 0; + } + const candidate = this.candidates[idx]; + idx = (idx + 1) % this.candidates.length; + groups[fingerprint] = idx; + return yield evalToken(candidate, ctx); + } + *arguments() { + yield* this.candidates; + if (this.group) { + yield this.group; + } + } +} + +class IfTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.branches = []; + let p = []; + parser.parseStream(remainTokens) + .on('start', () => this.branches.push({ + value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid), + templates: (p = []) + })) + .on('tag:elsif', (token) => { + assert(!this.elseTemplates, 'unexpected elsif after else'); + this.branches.push({ + value: new Value(token.tokenizer.readFilteredValue(), this.liquid), + templates: (p = []) + }); + }) + .on('tag:else', tag => { + assertEmpty(tag.args); + assert(!this.elseTemplates, 'duplicated else'); + p = this.elseTemplates = []; + }) + .on('tag:endif', function (tag) { assertEmpty(tag.args); this.stop(); }) + .on('template', (tpl) => p.push(tpl)) + .on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`); }) + .start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + for (const { value, templates } of this.branches) { + const v = yield value.value(ctx, ctx.opts.lenientIf); + if (isTruthy(v, ctx)) { + yield r.renderTemplates(templates, ctx, emitter); + return; + } + } + yield r.renderTemplates(this.elseTemplates || [], ctx, emitter); + } + *children() { + const templates = this.branches.flatMap(b => b.templates); + if (this.elseTemplates) { + templates.push(...this.elseTemplates); + } + return templates; + } + arguments() { + return this.branches.map(b => b.value); + } +} + +class IncrementTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.identifier = this.tokenizer.readIdentifier(); + this.variable = this.identifier.content; + } + render(context, emitter) { + const scope = context.environments; + if (!isNumber(scope[this.variable])) { + scope[this.variable] = 0; + } + const val = scope[this.variable]; + scope[this.variable]++; + emitter.write(stringify(val)); + } + *localScope() { + yield this.identifier; + } +} + +class LayoutTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + this.file = parseFilePath(this.tokenizer, this.liquid, parser); + this.currentFile = token.file; + this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator); + this.templates = parser.parseTokens(remainTokens); + } + *render(ctx, emitter) { + const { liquid, args, file } = this; + const { renderer } = liquid; + if (file === undefined) { + ctx.setRegister('blockMode', BlockMode.OUTPUT); + yield renderer.renderTemplates(this.templates, ctx, emitter); + return; + } + const filepath = (yield renderFilePath(this.file, ctx, liquid)); + assert(filepath, () => `illegal file path "${filepath}"`); + const templates = (yield liquid._parseLayoutFile(filepath, ctx.sync, this.currentFile)); + // render remaining contents and store rendered results + ctx.setRegister('blockMode', BlockMode.STORE); + const html = yield renderer.renderTemplates(this.templates, ctx); + const blocks = ctx.getRegister('blocks', {}); + // set whole content to anonymous block if anonymous doesn't specified + if (blocks[''] === undefined) + blocks[''] = (parent, emitter) => emitter.write(html); + ctx.setRegister('blockMode', BlockMode.OUTPUT); + // render the layout file use stored blocks + ctx.push(createScope((yield args.render(ctx)))); + yield renderer.renderTemplates(templates, ctx, emitter); + ctx.pop(); + } + *children(partials) { + const templates = this.templates.slice(); + if (partials && isString(this.file)) { + templates.push(...(yield this.liquid._parsePartialFile(this.file, true, this.currentFile))); + } + return templates; + } + *arguments() { + for (const v of Object.values(this.args.hash)) { + if (isValueToken(v)) { + yield v; + } + } + if (isValueToken(this.file)) { + yield this.file; + } + } + partialScope() { + if (isString(this.file)) { + return { name: this.file, isolated: false, scope: Object.keys(this.args.hash) }; + } + } +} + +class BlockTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + this.templates = []; + const match = /\w+/.exec(token.args); + this.block = match ? match[0] : ''; + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endblock') + return; + const template = parser.parseToken(token, remainTokens); + this.templates.push(template); + } + throw new Error(`tag ${token.getText()} not closed`); + } + *render(ctx, emitter) { + const blockRender = this.getBlockRender(ctx); + if (ctx.getRegister('blockMode') === BlockMode.STORE) { + ctx.getRegister('blocks', {})[this.block] = blockRender; + } + else { + yield blockRender(new BlockDrop(), emitter); + } + } + getBlockRender(ctx) { + const self = this; + const { liquid, templates } = this; + const renderChild = ctx.getRegister('blocks', {})[this.block]; + const renderCurrent = function* (superBlock, emitter) { + const stack = ctx.getRegister('blockStack', []); + if (stack.includes(self)) + throw new Error('block tag cannot be nested'); + stack.push(self); + ctx.push(createScope({ block: superBlock })); + yield liquid.renderer.renderTemplates(templates, ctx, emitter); + ctx.pop(); + stack.pop(); + }; + return renderChild + ? (superBlock, emitter) => renderChild(new BlockDrop((emitter) => renderCurrent(superBlock, emitter)), emitter) + : renderCurrent; + } + *children() { + return this.templates; + } + blockScope() { + return ['block']; + } +} + +class RawTag extends Tag { + constructor(tagToken, remainTokens, liquid) { + super(tagToken, remainTokens, liquid); + this.tokens = []; + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endraw') + return; + this.tokens.push(token); + } + throw new Error(`tag ${tagToken.getText()} not closed`); + } + render() { + return this.tokens.map((token) => token.getText()).join(''); + } +} + +class TablerowloopDrop extends ForloopDrop { + constructor(length, cols, collection, variable) { + super(length, collection, variable); + this.length = length; + this.cols = cols; + } + row() { + return Math.floor(this.i / this.cols) + 1; + } + col0() { + return (this.i % this.cols); + } + col() { + return this.col0() + 1; + } + col_first() { + return this.col0() === 0; + } + col_last() { + return this.col() === this.cols; + } +} + +class TablerowTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + const variable = this.tokenizer.readIdentifier(); + this.tokenizer.skipBlank(); + const predicate = this.tokenizer.readIdentifier(); + const collectionToken = this.tokenizer.readValue(); + if (predicate.content !== 'in' || !collectionToken) { + throw new Error(`illegal tag: ${tagToken.getText()}`); + } + this.variable = variable.content; + this.collection = collectionToken; + this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator); + this.templates = []; + let p; + const stream = parser.parseStream(remainTokens) + .on('start', () => (p = this.templates)) + .on('tag:endtablerow', () => stream.stop()) + .on('template', (tpl) => p.push(tpl)) + .on('end', () => { + throw new Error(`tag ${tagToken.getText()} not closed`); + }); + stream.start(); + } + *render(ctx, emitter) { + let collection = toEnumerable(yield evalToken(this.collection, ctx)); + const args = (yield this.args.render(ctx)); + const offset = args.offset || 0; + const limit = (args.limit === undefined) ? collection.length : args.limit; + collection = collection.slice(offset, offset + limit); + const cols = args.cols || collection.length; + const r = this.liquid.renderer; + const tablerowloop = new TablerowloopDrop(collection.length, cols, this.collection.getText(), this.variable); + const scope = createScope({ tablerowloop }); + ctx.push(scope); + for (let idx = 0; idx < collection.length; idx++, tablerowloop.next()) { + scope[this.variable] = collection[idx]; + if (tablerowloop.col0() === 0) { + if (tablerowloop.row() !== 1) + emitter.write(''); + emitter.write(``); + } + emitter.write(``); + yield r.renderTemplates(this.templates, ctx, emitter); + emitter.write(''); + } + if (collection.length) + emitter.write(''); + ctx.pop(); + } + *children() { + return this.templates; + } + *arguments() { + yield this.collection; + for (const v of Object.values(this.args.hash)) { + if (isValueToken(v)) { + yield v; + } + } + } + blockScope() { + return [this.variable, 'tablerowloop']; + } +} + +class UnlessTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.branches = []; + this.elseTemplates = []; + let p = []; + let elseCount = 0; + parser.parseStream(remainTokens) + .on('start', () => this.branches.push({ + value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid), + test: isFalsy, + templates: (p = []) + })) + .on('tag:elsif', (token) => { + if (elseCount > 0) { + p = []; + return; + } + this.branches.push({ + value: new Value(token.tokenizer.readFilteredValue(), this.liquid), + test: isTruthy, + templates: (p = []) + }); + }) + .on('tag:else', () => { + elseCount++; + p = this.elseTemplates; + }) + .on('tag:endunless', function () { this.stop(); }) + .on('template', (tpl) => { + if (p !== this.elseTemplates || elseCount === 1) { + p.push(tpl); + } + }) + .on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`); }) + .start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + for (const { value, test, templates } of this.branches) { + const v = yield value.value(ctx, ctx.opts.lenientIf); + if (test(v, ctx)) { + yield r.renderTemplates(templates, ctx, emitter); + return; + } + } + yield r.renderTemplates(this.elseTemplates, ctx, emitter); + } + *children() { + const children = this.branches.flatMap(b => b.templates); + if (this.elseTemplates) { + children.push(...this.elseTemplates); + } + return children; + } + arguments() { + return this.branches.map(b => b.value); + } +} + +class BreakTag extends Tag { + render(ctx, _emitter) { + ctx.breakCalled = true; + } +} + +class ContinueTag extends Tag { + render(ctx, _emitter) { + ctx.continueCalled = true; + } +} + +class EchoTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.tokenizer.skipBlank(); + if (!this.tokenizer.end()) { + this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid); + } + } + *render(ctx, emitter) { + if (!this.value) + return; + const val = yield this.value.value(ctx, false); + emitter.write(val); + } + *arguments() { + if (this.value) { + yield this.value; + } + } +} + +class LiquidTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const tokens = this.tokenizer.readLiquidTagTokens(this.liquid.options); + this.templates = parser.parseTokens(tokens); + } + *render(ctx, emitter) { + yield this.liquid.renderer.renderTemplates(this.templates, ctx, emitter); + } + *children() { + return this.templates; + } +} + +class InlineCommentTag extends Tag { + constructor(tagToken, remainTokens, liquid) { + super(tagToken, remainTokens, liquid); + if (tagToken.args.search(/\n\s*[^#\s]/g) !== -1) { + throw new Error('every line of an inline comment must start with a \'#\' character'); + } + } + render() { } +} + +const tags = { + assign: AssignTag, + 'for': ForTag, + capture: CaptureTag, + 'case': CaseTag, + comment: CommentTag, + include: IncludeTag, + render: RenderTag, + decrement: DecrementTag, + increment: IncrementTag, + cycle: CycleTag, + 'if': IfTag, + layout: LayoutTag, + block: BlockTag, + raw: RawTag, + tablerow: TablerowTag, + unless: UnlessTag, + 'break': BreakTag, + 'continue': ContinueTag, + echo: EchoTag, + liquid: LiquidTag, + '#': InlineCommentTag +}; + +class Liquid { + constructor(opts = {}) { + this.renderer = new Render(); + this.filters = Object.create(null); + this.tags = Object.create(null); + this.options = normalize(opts); + // eslint-disable-next-line deprecation/deprecation + this.parser = new Parser(this); + forOwn(tags, (conf, name) => this.registerTag(name, conf)); + forOwn(filters, (handler, name) => this.registerFilter(name, handler)); + } + parse(html, filepath) { + const parser = new Parser(this); + return parser.parse(html, filepath); + } + _render(tpl, scope, renderOptions) { + const ctx = scope instanceof Context ? scope : new Context(scope, this.options, renderOptions); + return this.renderer.renderTemplates(tpl, ctx); + } + render(tpl, scope, renderOptions) { + return __awaiter(this, void 0, void 0, function* () { + return toPromise(this._render(tpl, scope, Object.assign(Object.assign({}, renderOptions), { sync: false }))); + }); + } + renderSync(tpl, scope, renderOptions) { + return toValueSync(this._render(tpl, scope, Object.assign(Object.assign({}, renderOptions), { sync: true }))); + } + renderToNodeStream(tpl, scope, renderOptions = {}) { + const ctx = new Context(scope, this.options, renderOptions); + return this.renderer.renderTemplatesToNodeStream(tpl, ctx); + } + _parseAndRender(html, scope, renderOptions) { + const tpl = this.parse(html); + return this._render(tpl, scope, renderOptions); + } + parseAndRender(html, scope, renderOptions) { + return __awaiter(this, void 0, void 0, function* () { + return toPromise(this._parseAndRender(html, scope, Object.assign(Object.assign({}, renderOptions), { sync: false }))); + }); + } + parseAndRenderSync(html, scope, renderOptions) { + return toValueSync(this._parseAndRender(html, scope, Object.assign(Object.assign({}, renderOptions), { sync: true }))); + } + _parsePartialFile(file, sync, currentFile) { + return new Parser(this).parseFile(file, sync, LookupType.Partials, currentFile); + } + _parseLayoutFile(file, sync, currentFile) { + return new Parser(this).parseFile(file, sync, LookupType.Layouts, currentFile); + } + _parseFile(file, sync, lookupType, currentFile) { + return new Parser(this).parseFile(file, sync, lookupType, currentFile); + } + parseFile(file, lookupType) { + return __awaiter(this, void 0, void 0, function* () { + return toPromise(new Parser(this).parseFile(file, false, lookupType)); + }); + } + parseFileSync(file, lookupType) { + return toValueSync(new Parser(this).parseFile(file, true, lookupType)); + } + *_renderFile(file, ctx, renderFileOptions) { + const templates = (yield this._parseFile(file, renderFileOptions.sync, renderFileOptions.lookupType)); + return yield this._render(templates, ctx, renderFileOptions); + } + renderFile(file, ctx, renderFileOptions) { + return __awaiter(this, void 0, void 0, function* () { + return toPromise(this._renderFile(file, ctx, Object.assign(Object.assign({}, renderFileOptions), { sync: false }))); + }); + } + renderFileSync(file, ctx, renderFileOptions) { + return toValueSync(this._renderFile(file, ctx, Object.assign(Object.assign({}, renderFileOptions), { sync: true }))); + } + renderFileToNodeStream(file, scope, renderOptions) { + return __awaiter(this, void 0, void 0, function* () { + const templates = yield this.parseFile(file); + return this.renderToNodeStream(templates, scope, renderOptions); + }); + } + _evalValue(str, scope) { + const value = new Value(str, this); + const ctx = scope instanceof Context ? scope : new Context(scope, this.options); + return value.value(ctx); + } + evalValue(str, scope) { + return __awaiter(this, void 0, void 0, function* () { + return toPromise(this._evalValue(str, scope)); + }); + } + evalValueSync(str, scope) { + return toValueSync(this._evalValue(str, scope)); + } + registerFilter(name, filter) { + this.filters[name] = filter; + } + registerTag(name, tag) { + this.tags[name] = isFunction(tag) ? tag : createTagClass(tag); + } + plugin(plugin) { + return plugin.call(this, Liquid); + } + express() { + const self = this; // eslint-disable-line + let firstCall = true; + return function (filePath, ctx, callback) { + if (firstCall) { + firstCall = false; + const dirs = normalizeDirectoryList(this.root); + self.options.root.unshift(...dirs); + self.options.layouts.unshift(...dirs); + self.options.partials.unshift(...dirs); + } + self.renderFile(filePath, ctx).then(html => callback(null, html), callback); + }; + } + analyze(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + return analyze(template, options); + }); + } + analyzeSync(template, options = {}) { + return analyzeSync(template, options); + } + parseAndAnalyze(html, filename, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + return analyze(this.parse(html, filename), options); + }); + } + parseAndAnalyzeSync(html, filename, options = {}) { + return analyzeSync(this.parse(html, filename), options); + } + /** Return an array of all variables without their properties. */ + variables(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.variables); + }); + } + /** Return an array of all variables without their properties. */ + variablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.variables); + } + /** Return an array of all variables including their properties/paths. */ + fullVariables(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v))))); + }); + } + /** Return an array of all variables including their properties/paths. */ + fullVariablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v))))); + } + /** Return an array of all variables, each as an array of properties/segments. */ + variableSegments(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray())))); + }); + } + /** Return an array of all variables, each as an array of properties/segments. */ + variableSegmentsSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray())))); + } + /** Return an array of all expected context variables without their properties. */ + globalVariables(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.globals); + }); + } + /** Return an array of all expected context variables without their properties. */ + globalVariablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.globals); + } + /** Return an array of all expected context variables including their properties/paths. */ + globalFullVariables(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v))))); + }); + } + /** Return an array of all expected context variables including their properties/paths. */ + globalFullVariablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v))))); + } + /** Return an array of all expected context variables, each as an array of properties/segments. */ + globalVariableSegments(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray())))); + }); + } + /** Return an array of all expected context variables, each as an array of properties/segments. */ + globalVariableSegmentsSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray())))); + } +} + +/* istanbul ignore file */ +const version = '[VI]{version}[/VI]'; + +export { AssertionError, AssignTag, BlockTag, BreakTag, CaptureTag, CaseTag, CommentTag, Context, ContinueTag, CycleTag, DecrementTag, Drop, EchoTag, Expression, Filter, ForTag, Hash, IfTag, IncludeTag, IncrementTag, InlineCommentTag, LayoutTag, Liquid, LiquidError, LiquidTag, LookupType, Output, ParseError, ParseStream, Parser, RawTag, RenderError, RenderTag, TablerowTag, Tag, TagToken, Token, TokenKind, TokenizationError, Tokenizer, typeGuards as TypeGuards, UndefinedVariableError, UnlessTag, Value, Variable, analyze, analyzeSync, assert, createTrie, defaultOperators, defaultOptions, evalQuotedToken, evalToken, filters, isFalsy, isTruthy, tags, toPromise, toValue, toValueSync, version }; diff --git a/node_modules/liquidjs/dist/liquid.browser.umd.js b/node_modules/liquidjs/dist/liquid.browser.umd.js new file mode 100644 index 00000000..202bdc6d --- /dev/null +++ b/node_modules/liquidjs/dist/liquid.browser.umd.js @@ -0,0 +1,7537 @@ +/* + * liquidjs@10.27.2, https://github.com/harttle/liquidjs + * (c) 2016-2026 harttle + * Released under the MIT License. + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.liquidjs = {})); +}(this, (function (exports) { 'use strict'; + + /****************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + + function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + } + + function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + } + + function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + } + + function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + } + + function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + } + + var Token = /** @class */ (function () { + function Token(kind, input, begin, end, file) { + this.kind = kind; + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + } + Token.prototype.getText = function () { + return this.input.slice(this.begin, this.end); + }; + Token.prototype.getPosition = function () { + var _a = __read([1, 1], 2), row = _a[0], col = _a[1]; + for (var i = 0; i < this.begin; i++) { + if (this.input[i] === '\n') { + row++; + col = 1; + } + else + col++; + } + return [row, col]; + }; + Token.prototype.size = function () { + return this.end - this.begin; + }; + return Token; + }()); + + var Drop = /** @class */ (function () { + function Drop() { + } + Drop.prototype.liquidMethodMissing = function (key, context) { + return undefined; + }; + return Drop; + }()); + + var toString$1 = Object.prototype.toString; + var toLowerCase = String.prototype.toLowerCase; + var hasOwnProperty = Object.hasOwnProperty; + function isString(value) { + return typeof value === 'string'; + } + // eslint-disable-next-line @typescript-eslint/ban-types + function isFunction(value) { + return typeof value === 'function'; + } + function isPromise(val) { + return val && isFunction(val.then); + } + function isIterator(val) { + return val && isFunction(val.next) && isFunction(val.throw) && isFunction(val.return); + } + function stringify(value) { + value = toValue(value); + if (isString(value)) + return value; + if (isNil(value)) + return ''; + if (isArray(value)) + return value.map(function (x) { return stringify(x); }).join(''); + return String(value); + } + function readArrayElement(arr, index, ownPropertyOnly) { + if (index < 0) + index = arr.length + index; + if (ownPropertyOnly && !hasOwnProperty.call(arr, index)) + return undefined; + return arr[index]; + } + function toEnumerable(val) { + val = toValue(val); + if (isArray(val)) + return val; + if (isString(val) && val.length > 0) + return [val]; + if (isIterable(val)) + return Array.from(val); + if (isObject(val)) + return Object.keys(val).map(function (key) { return [key, val[key]]; }); + return []; + } + function toArray(val) { + val = toValue(val); + if (isNil(val)) + return []; + if (isArray(val)) + return val; + return [val]; + } + function toValue(value) { + return (value instanceof Drop && isFunction(value.valueOf)) ? value.valueOf() : value; + } + function toNumber(value) { + return +toValue(value) || 0; + } + function isNumber(value) { + return typeof value === 'number'; + } + function toLiquid(value) { + if (value && isFunction(value.toLiquid)) + return toLiquid(value.toLiquid()); + return value; + } + function isNil(value) { + return value == null; + } + function isUndefined(value) { + return value === undefined; + } + function isArray(value) { + // be compatible with IE 8 + return toString$1.call(value) === '[object Array]'; + } + function isArrayLike(value) { + return value && isNumber(value.length); + } + function isIterable(value) { + return isObject(value) && Symbol.iterator in value; + } + /* + * Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property. + * The iteratee is invoked with three arguments: (value, key, object). + * Iteratee functions may exit iteration early by explicitly returning false. + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @return {Object} Returns object. + */ + function forOwn(obj, iteratee) { + obj = obj || {}; + for (var k in obj) { + if (hasOwnProperty.call(obj, k)) { + if (iteratee(obj[k], k, obj) === false) + break; + } + } + return obj; + } + function last(arr) { + return arr[arr.length - 1]; + } + /* + * Checks if value is the language type of Object. + * (e.g. arrays, functions, objects, regexes, new Number(0), and new String('')) + * @param {any} value The value to check. + * @return {Boolean} Returns true if value is an object, else false. + */ + function isObject(value) { + var type = typeof value; + return value !== null && (type === 'object' || type === 'function'); + } + function range(start, stop, step) { + if (step === void 0) { step = 1; } + var arr = []; + for (var i = start; i < stop; i += step) { + arr.push(i); + } + return arr; + } + function padStart(str, length, ch) { + if (ch === void 0) { ch = ' '; } + return pad(str, length, ch, function (str, ch) { return ch + str; }); + } + function padEnd(str, length, ch) { + if (ch === void 0) { ch = ' '; } + return pad(str, length, ch, function (str, ch) { return str + ch; }); + } + function pad(str, length, ch, add) { + str = String(str); + var n = length - str.length; + if (n <= 0) + return str; + return add(str, ch.repeat(n)); + } + function identify(val) { + return val; + } + function changeCase(str) { + var hasLowerCase = __spreadArray([], __read(str), false).some(function (ch) { return ch >= 'a' && ch <= 'z'; }); + return hasLowerCase ? str.toUpperCase() : str.toLowerCase(); + } + function ellipsis(str, N) { + return str.length > N ? str.slice(0, N - 3) + '...' : str; + } + function orderedCompare(a, b) { + if (isNil(a) && isNil(b)) + return 0; + if (isNil(a)) + return 1; + if (isNil(b)) + return -1; + if (a < b) + return -1; + if (a > b) + return 1; + return 0; + } + // compare string in case-insensitive way, undefined values to the tail + function caseInsensitiveCompare(a, b) { + if (isNil(a) && isNil(b)) + return 0; + if (isNil(a)) + return 1; + if (isNil(b)) + return -1; + a = toLowerCase.call(a); + b = toLowerCase.call(b); + if (a < b) + return -1; + if (a > b) + return 1; + return 0; + } + function argumentsToValue(fn) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return fn.call.apply(fn, __spreadArray([this], __read(args.map(toValue)), false)); + }; + } + function argumentsToNumber(fn) { + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return fn.call.apply(fn, __spreadArray([this], __read(args.map(toNumber)), false)); + }; + } + /** Return an array containing unique elements from _array_. Works with nested arrays and objects. */ + function strictUniq(array) { + var seen, array_1, array_1_1, element, key, e_1_1; + var e_1, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + seen = new Set(); + _b.label = 1; + case 1: + _b.trys.push([1, 6, 7, 8]); + array_1 = __values(array), array_1_1 = array_1.next(); + _b.label = 2; + case 2: + if (!!array_1_1.done) return [3 /*break*/, 5]; + element = array_1_1.value; + key = JSON.stringify(element); + if (!!seen.has(key)) return [3 /*break*/, 4]; + seen.add(key); + return [4 /*yield*/, element]; + case 3: + _b.sent(); + _b.label = 4; + case 4: + array_1_1 = array_1.next(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 8]; + case 6: + e_1_1 = _b.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 8]; + case 7: + try { + if (array_1_1 && !array_1_1.done && (_a = array_1.return)) _a.call(array_1); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 8: return [2 /*return*/]; + } + }); + } + + /** + * targeting ES5, extends Error won't create a proper prototype chain, need a trait to keep track of classes + */ + var TRAIT = '__liquidClass__'; + var LiquidError = /** @class */ (function (_super) { + __extends(LiquidError, _super); + function LiquidError(err, token) { + var _this = + /** + * note: for ES5 targeting, `this` will be replaced by return value of Error(), + * thus everything on `this` will be lost, avoid calling `LiquidError` methods here + */ + _super.call(this, typeof err === 'string' ? err : err.message) || this; + _this.context = ''; + if (typeof err !== 'string') + Object.defineProperty(_this, 'originalError', { value: err, enumerable: false }); + Object.defineProperty(_this, 'token', { value: token, enumerable: false }); + Object.defineProperty(_this, TRAIT, { value: 'LiquidError', enumerable: false }); + return _this; + } + LiquidError.prototype.update = function () { + Object.defineProperty(this, 'context', { value: mkContext(this.token), enumerable: false }); + this.message = mkMessage(this.message, this.token); + this.stack = this.message + '\n' + this.context + + '\n' + this.stack; + if (this.originalError) + this.stack += '\nFrom ' + this.originalError.stack; + }; + LiquidError.is = function (obj) { + return (obj === null || obj === void 0 ? void 0 : obj[TRAIT]) === 'LiquidError'; + }; + return LiquidError; + }(Error)); + var TokenizationError = /** @class */ (function (_super) { + __extends(TokenizationError, _super); + function TokenizationError(message, token) { + var _this = _super.call(this, message, token) || this; + _this.name = 'TokenizationError'; + _super.prototype.update.call(_this); + return _this; + } + return TokenizationError; + }(LiquidError)); + var ParseError = /** @class */ (function (_super) { + __extends(ParseError, _super); + function ParseError(err, token) { + var _this = _super.call(this, err, token) || this; + _this.name = 'ParseError'; + _this.message = err.message; + _super.prototype.update.call(_this); + return _this; + } + return ParseError; + }(LiquidError)); + var RenderError = /** @class */ (function (_super) { + __extends(RenderError, _super); + function RenderError(err, tpl) { + var _this = _super.call(this, err, tpl.token) || this; + _this.name = 'RenderError'; + _this.message = err.message; + _super.prototype.update.call(_this); + return _this; + } + RenderError.is = function (obj) { + return obj.name === 'RenderError'; + }; + return RenderError; + }(LiquidError)); + var LiquidErrors = /** @class */ (function (_super) { + __extends(LiquidErrors, _super); + function LiquidErrors(errors) { + var _this = _super.call(this, errors[0], errors[0].token) || this; + _this.errors = errors; + _this.name = 'LiquidErrors'; + var s = errors.length > 1 ? 's' : ''; + _this.message = "".concat(errors.length, " error").concat(s, " found"); + _super.prototype.update.call(_this); + return _this; + } + LiquidErrors.is = function (obj) { + return obj.name === 'LiquidErrors'; + }; + return LiquidErrors; + }(LiquidError)); + var UndefinedVariableError = /** @class */ (function (_super) { + __extends(UndefinedVariableError, _super); + function UndefinedVariableError(err, token) { + var _this = _super.call(this, err, token) || this; + _this.name = 'UndefinedVariableError'; + _this.message = err.message; + _super.prototype.update.call(_this); + return _this; + } + return UndefinedVariableError; + }(LiquidError)); + // only used internally; raised where we don't have token information, + // so it can't be an UndefinedVariableError. + var InternalUndefinedVariableError = /** @class */ (function (_super) { + __extends(InternalUndefinedVariableError, _super); + function InternalUndefinedVariableError(variableName) { + var _this = _super.call(this, "undefined variable: ".concat(variableName)) || this; + _this.name = 'InternalUndefinedVariableError'; + _this.variableName = variableName; + return _this; + } + return InternalUndefinedVariableError; + }(Error)); + var AssertionError = /** @class */ (function (_super) { + __extends(AssertionError, _super); + function AssertionError(message) { + var _this = _super.call(this, message) || this; + _this.name = 'AssertionError'; + _this.message = message + ''; + return _this; + } + return AssertionError; + }(Error)); + function mkContext(token) { + var _a = __read(token.getPosition(), 2), line = _a[0], col = _a[1]; + var lines = token.input.split('\n'); + var begin = Math.max(line - 2, 1); + var end = Math.min(line + 3, lines.length); + var context = range(begin, end + 1) + .map(function (lineNumber) { + var rowIndicator = (lineNumber === line) ? '>> ' : ' '; + var num = padStart(String(lineNumber), String(end).length); + var text = "".concat(rowIndicator).concat(num, "| "); + var colIndicator = lineNumber === line + ? '\n' + padStart('^', col + text.length) + : ''; + text += lines[lineNumber - 1]; + text += colIndicator; + return text; + }) + .join('\n'); + return context; + } + function mkMessage(msg, token) { + if (token.file) + msg += ", file:".concat(token.file); + var _a = __read(token.getPosition(), 2), line = _a[0], col = _a[1]; + msg += ", line:".concat(line, ", col:").concat(col); + return msg; + } + + // **DO NOT CHANGE THIS FILE** + // + // This file is generated by bin/character-gen.js + // bitmask character types to boost performance + var TYPES = [0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 4, 4, 4, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 8, 0, 0, 0, 0, 8, 0, 0, 0, 64, 0, 65, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 0, 0, 2, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]; + var WORD = 1; + var BLANK = 4; + var QUOTE = 8; + var INLINE_BLANK = 16; + var NUMBER = 32; + var SIGN = 64; + var PUNCTUATION = 128; + function isWord(char) { + var code = char.charCodeAt(0); + return code >= 128 ? !TYPES[code] : !!(TYPES[code] & WORD); + } + TYPES[160] = TYPES[5760] = TYPES[6158] = TYPES[8192] = TYPES[8193] = TYPES[8194] = TYPES[8195] = TYPES[8196] = TYPES[8197] = TYPES[8198] = TYPES[8199] = TYPES[8200] = TYPES[8201] = TYPES[8202] = TYPES[8232] = TYPES[8233] = TYPES[8239] = TYPES[8287] = TYPES[12288] = BLANK; + TYPES[8220] = TYPES[8221] = PUNCTUATION; + + function assert(predicate, message) { + if (!predicate) { + var msg = typeof message === 'function' + ? message() + : (message || "expect ".concat(predicate, " to be true")); + throw new AssertionError(msg); + } + } + function assertEmpty(predicate, message) { + if (message === void 0) { message = "unexpected ".concat(JSON.stringify(predicate)); } + assert(!predicate, message); + } + + var NullDrop = /** @class */ (function (_super) { + __extends(NullDrop, _super); + function NullDrop() { + return _super !== null && _super.apply(this, arguments) || this; + } + NullDrop.prototype.equals = function (value) { + return isNil(toValue(value)); + }; + NullDrop.prototype.gt = function () { + return false; + }; + NullDrop.prototype.geq = function () { + return false; + }; + NullDrop.prototype.lt = function () { + return false; + }; + NullDrop.prototype.leq = function () { + return false; + }; + NullDrop.prototype.valueOf = function () { + return null; + }; + return NullDrop; + }(Drop)); + + var EmptyDrop = /** @class */ (function (_super) { + __extends(EmptyDrop, _super); + function EmptyDrop() { + return _super !== null && _super.apply(this, arguments) || this; + } + EmptyDrop.prototype.equals = function (value) { + if (value instanceof EmptyDrop) + return false; + value = toValue(value); + if (isString(value) || isArray(value)) + return value.length === 0; + if (isObject(value)) + return Object.keys(value).length === 0; + return false; + }; + EmptyDrop.prototype.gt = function () { + return false; + }; + EmptyDrop.prototype.geq = function () { + return false; + }; + EmptyDrop.prototype.lt = function () { + return false; + }; + EmptyDrop.prototype.leq = function () { + return false; + }; + EmptyDrop.prototype.valueOf = function () { + return ''; + }; + EmptyDrop.is = function (value) { + return value instanceof EmptyDrop; + }; + return EmptyDrop; + }(Drop)); + + var BlankDrop = /** @class */ (function (_super) { + __extends(BlankDrop, _super); + function BlankDrop() { + return _super !== null && _super.apply(this, arguments) || this; + } + BlankDrop.prototype.equals = function (value) { + if (value === false) + return true; + if (isNil(toValue(value))) + return true; + if (isString(value)) + return /^\s*$/.test(value); + return _super.prototype.equals.call(this, value); + }; + BlankDrop.is = function (value) { + return value instanceof BlankDrop; + }; + return BlankDrop; + }(EmptyDrop)); + + var ForloopDrop = /** @class */ (function (_super) { + __extends(ForloopDrop, _super); + function ForloopDrop(length, collection, variable) { + var _this = _super.call(this) || this; + _this.i = 0; + _this.length = length; + _this.name = "".concat(variable, "-").concat(collection); + return _this; + } + ForloopDrop.prototype.next = function () { + this.i++; + }; + ForloopDrop.prototype.index0 = function () { + return this.i; + }; + ForloopDrop.prototype.index = function () { + return this.i + 1; + }; + ForloopDrop.prototype.first = function () { + return this.i === 0; + }; + ForloopDrop.prototype.last = function () { + return this.i === this.length - 1; + }; + ForloopDrop.prototype.rindex = function () { + return this.length - this.i; + }; + ForloopDrop.prototype.rindex0 = function () { + return this.length - this.i - 1; + }; + ForloopDrop.prototype.valueOf = function () { + return JSON.stringify(this); + }; + return ForloopDrop; + }(Drop)); + + var SimpleEmitter = /** @class */ (function () { + function SimpleEmitter() { + this.buffer = ''; + } + SimpleEmitter.prototype.write = function (html) { + this.buffer += stringify(html); + }; + return SimpleEmitter; + }()); + + var StreamedEmitter = /** @class */ (function () { + function StreamedEmitter() { + this.buffer = ''; + this.stream = null; + throw new Error('streaming not supported in browser'); + } + return StreamedEmitter; + }()); + + var KeepingTypeEmitter = /** @class */ (function () { + function KeepingTypeEmitter() { + this.buffer = ''; + } + KeepingTypeEmitter.prototype.write = function (html) { + html = toValue(html); + // This will only preserve the type if the value is isolated. + // I.E: + // {{ my-port }} -> 42 + // {{ my-host }}:{{ my-port }} -> 'host:42' + if (typeof html !== 'string' && this.buffer === '') { + this.buffer = html; + } + else { + this.buffer = stringify(this.buffer) + stringify(html); + } + }; + return KeepingTypeEmitter; + }()); + + var BlockDrop = /** @class */ (function (_super) { + __extends(BlockDrop, _super); + function BlockDrop( + // the block render from layout template + superBlockRender) { + if (superBlockRender === void 0) { superBlockRender = function () { return ''; }; } + var _this = _super.call(this) || this; + _this.superBlockRender = superBlockRender; + return _this; + } + /** + * Provide parent access in child block by + * {{ block.super }} + */ + BlockDrop.prototype.super = function () { + var emitter; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + emitter = new SimpleEmitter(); + return [4 /*yield*/, this.superBlockRender(emitter)]; + case 1: + _a.sent(); + return [2 /*return*/, emitter.buffer]; + } + }); + }; + return BlockDrop; + }(Drop)); + + function isComparable(arg) { + return (arg && + isFunction(arg.equals) && + isFunction(arg.gt) && + isFunction(arg.geq) && + isFunction(arg.lt) && + isFunction(arg.leq)); + } + + var nil = new NullDrop(); + var literalValues = { + 'true': true, + 'false': false, + 'nil': nil, + 'null': nil, + 'empty': new EmptyDrop(), + 'blank': new BlankDrop() + }; + + // Tries are built once per input object and reused: the Tokenizer rebuilds them + // on every instantiation, but `input` (operators/literalValues) is a stable + // reference. WeakMap-keying by `input` lets short-lived operator objects (and + // their tries) be garbage collected. The returned trie is treated as read-only + // by callers (matchTrie only reads it); do not mutate it. + var trieCache = new WeakMap(); + function createTrie(input) { + var e_1, _a; + var cached = trieCache.get(input); + if (cached) + return cached; + var trie = {}; + try { + for (var _b = __values(Object.entries(input)), _c = _b.next(); !_c.done; _c = _b.next()) { + var _d = __read(_c.value, 2), name_1 = _d[0], data = _d[1]; + var node = trie; + for (var i = 0; i < name_1.length; i++) { + var c = name_1[i]; + node[c] = node[c] || {}; + if (i === name_1.length - 1 && isWord(name_1[i])) { + node[c].needBoundary = true; + } + node = node[c]; + } + node.data = data; + node.end = true; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + trieCache.set(input, trie); + return trie; + } + + function toLiquidAsync(asyncFn, syncFn) { + var syncImpl = syncFn || asyncFn; + return function (sync) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return sync ? syncImpl.apply(void 0, __spreadArray([], __read(args), false)) : asyncFn.apply(void 0, __spreadArray([], __read(args), false)); + }; + } + // convert an async iterator to a Promise + function toPromise(val) { + return __awaiter(this, void 0, void 0, function () { + var value, done, next, state, err_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!isIterator(val)) + return [2 /*return*/, val]; + done = false; + next = 'next'; + _a.label = 1; + case 1: + state = val[next](value); + done = !!state.done; + value = state.value; + next = 'next'; + _a.label = 2; + case 2: + _a.trys.push([2, 5, , 6]); + if (isIterator(value)) + value = toPromise(value); + if (!isPromise(value)) return [3 /*break*/, 4]; + return [4 /*yield*/, value]; + case 3: + value = _a.sent(); + _a.label = 4; + case 4: return [3 /*break*/, 6]; + case 5: + err_1 = _a.sent(); + next = 'throw'; + value = err_1; + return [3 /*break*/, 6]; + case 6: + if (!done) return [3 /*break*/, 1]; + _a.label = 7; + case 7: return [2 /*return*/, value]; + } + }); + }); + } + // convert an async iterator to a value in a synchronous manner + function toValueSync(val) { + if (!isIterator(val)) + return val; + var value; + var done = false; + var next = 'next'; + do { + var state = val[next](value); + done = !!state.done; + value = state.value; + next = 'next'; + if (isIterator(value)) { + try { + value = toValueSync(value); + } + catch (err) { + next = 'throw'; + value = err; + } + } + } while (!done); + return value; + } + + var rFormat = /%([-_0^#:]+)?(\d+)?([EO])?(.)/; + // prototype extensions + function daysInMonth(d) { + var feb = isLeapYear(d) ? 29 : 28; + return [31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + } + function getDayOfYear(d) { + var num = 0; + for (var i = 0; i < d.getMonth(); ++i) { + num += daysInMonth(d)[i]; + } + return num + d.getDate(); + } + function getWeekOfYear(d, startDay) { + // Skip to startDay of this week + var now = getDayOfYear(d) + (startDay - d.getDay()); + // Find the first startDay of the year + var jan1 = new Date(d.getFullYear(), 0, 1); + var then = (7 - jan1.getDay() + startDay); + return String(Math.floor((now - then) / 7) + 1); + } + function isLeapYear(d) { + var year = d.getFullYear(); + return !!((year & 3) === 0 && (year % 100 || (year % 400 === 0 && year))); + } + function ordinal(d) { + var date = d.getDate(); + if ([11, 12, 13].includes(date)) + return 'th'; + switch (date % 10) { + case 1: return 'st'; + case 2: return 'nd'; + case 3: return 'rd'; + default: return 'th'; + } + } + function century(d) { + return parseInt(d.getFullYear().toString().substring(0, 2), 10); + } + // default to 0 + var padWidths = { + d: 2, + e: 2, + H: 2, + I: 2, + j: 3, + k: 2, + l: 2, + L: 3, + m: 2, + M: 2, + S: 2, + U: 2, + W: 2 + }; + var padSpaceChars = new Set('aAbBceklpP'); + function getTimezoneOffset(d, opts) { + var nOffset = Math.abs(d.getTimezoneOffset()); + var h = Math.floor(nOffset / 60); + var m = nOffset % 60; + return (d.getTimezoneOffset() > 0 ? '-' : '+') + + padStart(h, 2, '0') + + (opts.flags[':'] ? ':' : '') + + padStart(m, 2, '0'); + } + var formatCodes = { + a: function (d) { return d.getShortWeekdayName(); }, + A: function (d) { return d.getLongWeekdayName(); }, + b: function (d) { return d.getShortMonthName(); }, + B: function (d) { return d.getLongMonthName(); }, + c: function (d) { return d.toLocaleString(); }, + C: function (d) { return century(d); }, + d: function (d) { return d.getDate(); }, + e: function (d) { return d.getDate(); }, + H: function (d) { return d.getHours(); }, + I: function (d) { return String(d.getHours() % 12 || 12); }, + j: function (d) { return getDayOfYear(d); }, + k: function (d) { return d.getHours(); }, + l: function (d) { return String(d.getHours() % 12 || 12); }, + L: function (d) { return d.getMilliseconds(); }, + m: function (d) { return d.getMonth() + 1; }, + M: function (d) { return d.getMinutes(); }, + N: function (d, opts) { + var _a; + var width = Number(opts.width) || 9; + var str = padStart(String(d.getMilliseconds()), 3, '0').slice(0, width); + (_a = opts.memoryLimit) === null || _a === void 0 ? void 0 : _a.use(width - str.length); + return padEnd(str, width, '0'); + }, + p: function (d) { return (d.getHours() < 12 ? 'AM' : 'PM'); }, + P: function (d) { return (d.getHours() < 12 ? 'am' : 'pm'); }, + q: function (d) { return ordinal(d); }, + s: function (d) { return Math.round(d.getTime() / 1000); }, + S: function (d) { return d.getSeconds(); }, + u: function (d) { return d.getDay() || 7; }, + U: function (d) { return getWeekOfYear(d, 0); }, + w: function (d) { return d.getDay(); }, + W: function (d) { return getWeekOfYear(d, 1); }, + x: function (d) { return d.toLocaleDateString(); }, + X: function (d) { return d.toLocaleTimeString(); }, + y: function (d) { return d.getFullYear().toString().slice(2, 4); }, + Y: function (d) { return d.getFullYear(); }, + z: getTimezoneOffset, + Z: function (d, opts) { return d.getTimeZoneName() || getTimezoneOffset(d, opts); }, + 't': function () { return '\t'; }, + 'n': function () { return '\n'; }, + '%': function () { return '%'; } + }; + formatCodes.h = formatCodes.b; + function strftime(d, formatStr, memoryLimit) { + var output = ''; + var remaining = formatStr; + var match; + while ((match = rFormat.exec(remaining))) { + output += remaining.slice(0, match.index); + remaining = remaining.slice(match.index + match[0].length); + output += format(d, match, memoryLimit); + } + return output + remaining; + } + function format(d, match, memoryLimit) { + var e_1, _a; + var _b = __read(match, 5), input = _b[0], _c = _b[1], flagStr = _c === void 0 ? '' : _c, width = _b[2], modifier = _b[3], conversion = _b[4]; + var convert = formatCodes[conversion]; + if (!convert) + return input; + var flags = {}; + try { + for (var flagStr_1 = __values(flagStr), flagStr_1_1 = flagStr_1.next(); !flagStr_1_1.done; flagStr_1_1 = flagStr_1.next()) { + var flag = flagStr_1_1.value; + flags[flag] = true; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (flagStr_1_1 && !flagStr_1_1.done && (_a = flagStr_1.return)) _a.call(flagStr_1); + } + finally { if (e_1) throw e_1.error; } + } + var ret = String(convert(d, { flags: flags, width: width, modifier: modifier, memoryLimit: memoryLimit })); + var padChar = padSpaceChars.has(conversion) ? ' ' : '0'; + var padWidth = Number(width) || padWidths[conversion] || 0; + if (flags['^']) + ret = ret.toUpperCase(); + else if (flags['#']) + ret = changeCase(ret); + if (flags['_']) + padChar = ' '; + else if (flags['0']) + padChar = '0'; + if (flags['-']) + padWidth = 0; + memoryLimit === null || memoryLimit === void 0 ? void 0 : memoryLimit.use(Number(padWidth) - ret.length); + return padStart(ret, padWidth, padChar); + } + + function getDateTimeFormat() { + return (typeof Intl !== 'undefined' ? Intl.DateTimeFormat : undefined); + } + + // one minute in milliseconds + var OneMinute = 60000; + /** + * Need support both ISO8601 and RFC2822 as in major browsers & NodeJS + * RFC2822: https://datatracker.ietf.org/doc/html/rfc2822#section-3.3 + */ + var TIMEZONE_PATTERN = /([zZ]|([+-])(\d{2}):?(\d{2}))$/; + var monthNames = [ + 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', + 'September', 'October', 'November', 'December' + ]; + var monthNamesShort = monthNames.map(function (name) { return name.slice(0, 3); }); + var dayNames = [ + 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' + ]; + var dayNamesShort = dayNames.map(function (name) { return name.slice(0, 3); }); + /** + * A date implementation with timezone info, just like Ruby date + * + * Implementation: + * - create a Date offset by it's timezone difference, avoiding overriding a bunch of methods + * - rewrite getTimezoneOffset() to trick strftime + */ + var LiquidDate = /** @class */ (function () { + function LiquidDate(init, locale, timezone) { + this.locale = locale; + this.DateTimeFormat = getDateTimeFormat(); + this.date = new Date(init); + this.timezoneFixed = timezone !== undefined; + if (timezone === undefined) { + timezone = this.date.getTimezoneOffset(); + } + this.timezoneOffset = isString(timezone) ? LiquidDate.getTimezoneOffset(timezone, this.date) : timezone; + this.timezoneName = isString(timezone) ? timezone : ''; + var diff = (this.date.getTimezoneOffset() - this.timezoneOffset) * OneMinute; + var time = this.date.getTime() + diff; + this.displayDate = new Date(time); + } + LiquidDate.prototype.getTime = function () { + return this.displayDate.getTime(); + }; + LiquidDate.prototype.getMilliseconds = function () { + return this.displayDate.getMilliseconds(); + }; + LiquidDate.prototype.getSeconds = function () { + return this.displayDate.getSeconds(); + }; + LiquidDate.prototype.getMinutes = function () { + return this.displayDate.getMinutes(); + }; + LiquidDate.prototype.getHours = function () { + return this.displayDate.getHours(); + }; + LiquidDate.prototype.getDay = function () { + return this.displayDate.getDay(); + }; + LiquidDate.prototype.getDate = function () { + return this.displayDate.getDate(); + }; + LiquidDate.prototype.getMonth = function () { + return this.displayDate.getMonth(); + }; + LiquidDate.prototype.getFullYear = function () { + return this.displayDate.getFullYear(); + }; + LiquidDate.prototype.toLocaleString = function (locale, init) { + if (init === null || init === void 0 ? void 0 : init.timeZone) { + return this.date.toLocaleString(locale, init); + } + return this.displayDate.toLocaleString(locale, init); + }; + LiquidDate.prototype.toLocaleTimeString = function (locale) { + return this.displayDate.toLocaleTimeString(locale); + }; + LiquidDate.prototype.toLocaleDateString = function (locale) { + return this.displayDate.toLocaleDateString(locale); + }; + LiquidDate.prototype.getTimezoneOffset = function () { + return this.timezoneOffset; + }; + LiquidDate.prototype.getTimeZoneName = function () { + if (this.timezoneFixed) + return this.timezoneName; + if (!this.DateTimeFormat) + return; + return this.DateTimeFormat().resolvedOptions().timeZone; + }; + LiquidDate.prototype.getLongMonthName = function () { + var _a; + return (_a = this.format({ month: 'long' })) !== null && _a !== void 0 ? _a : monthNames[this.getMonth()]; + }; + LiquidDate.prototype.getShortMonthName = function () { + var _a; + return (_a = this.format({ month: 'short' })) !== null && _a !== void 0 ? _a : monthNamesShort[this.getMonth()]; + }; + LiquidDate.prototype.getLongWeekdayName = function () { + var _a; + return (_a = this.format({ weekday: 'long' })) !== null && _a !== void 0 ? _a : dayNames[this.displayDate.getDay()]; + }; + LiquidDate.prototype.getShortWeekdayName = function () { + var _a; + return (_a = this.format({ weekday: 'short' })) !== null && _a !== void 0 ? _a : dayNamesShort[this.displayDate.getDay()]; + }; + LiquidDate.prototype.valid = function () { + return !isNaN(this.getTime()); + }; + LiquidDate.prototype.format = function (options) { + return this.DateTimeFormat && this.DateTimeFormat(this.locale, options).format(this.displayDate); + }; + /** + * Create a Date object fixed to it's declared Timezone. Both + * - 2021-08-06T02:29:00.000Z and + * - 2021-08-06T02:29:00.000+08:00 + * will always be displayed as + * - 2021-08-06 02:29:00 + * regardless timezoneOffset in JavaScript realm + * + * The implementation hack: + * Instead of calling `.getMonth()`/`.getUTCMonth()` respect to `preserveTimezones`, + * we create a different Date to trick strftime, it's both simpler and more performant. + * Given that a template is expected to be parsed fewer times than rendered. + */ + LiquidDate.createDateFixedToTimezone = function (dateString, locale) { + var m = dateString.match(TIMEZONE_PATTERN); + // representing a UTC timestamp + if (m && m[1] === 'Z') { + return new LiquidDate(+new Date(dateString), locale, 0); + } + // has a timezone specified + if (m && m[2] && m[3] && m[4]) { + var _a = __read(m, 5), sign = _a[2], hours = _a[3], minutes = _a[4]; + var offset = (sign === '+' ? -1 : 1) * (parseInt(hours, 10) * 60 + parseInt(minutes, 10)); + return new LiquidDate(+new Date(dateString), locale, offset); + } + return new LiquidDate(dateString, locale); + }; + LiquidDate.getTimezoneOffset = function (timezoneName, date) { + var localDateString = date.toLocaleString('en-US', { timeZone: timezoneName }); + var utcDateString = date.toLocaleString('en-US', { timeZone: 'UTC' }); + var localDate = new Date(localDateString); + var utcDate = new Date(utcDateString); + return (+utcDate - +localDate) / (60 * 1000); + }; + return LiquidDate; + }()); + + var Limiter = /** @class */ (function () { + function Limiter(resource, limit) { + this.base = 0; + this.message = "".concat(resource, " limit exceeded"); + this.limit = limit; + } + Limiter.prototype.use = function (count) { + if (+count > 0) { + assert(this.base + +count <= this.limit, this.message); + this.base += +count; + } + }; + Limiter.prototype.check = function (count) { + if (+count > 0) { + assert(+count <= this.limit, this.message); + } + }; + return Limiter; + }()); + + var DelimitedToken = /** @class */ (function (_super) { + __extends(DelimitedToken, _super); + function DelimitedToken(kind, _a, input, begin, end, trimLeft, trimRight, file) { + var _b = __read(_a, 2), contentBegin = _b[0], contentEnd = _b[1]; + var _this = _super.call(this, kind, input, begin, end, file) || this; + _this.trimLeft = false; + _this.trimRight = false; + var tl = input[contentBegin] === '-'; + var tr = input[contentEnd - 1] === '-'; + var l = tl ? contentBegin + 1 : contentBegin; + var r = tr ? contentEnd - 1 : contentEnd; + while (l < r && (TYPES[input.charCodeAt(l)] & BLANK)) + l++; + while (r > l && (TYPES[input.charCodeAt(r - 1)] & BLANK)) + r--; + _this.contentRange = [l, r]; + _this.trimLeft = tl || trimLeft; + _this.trimRight = tr || trimRight; + return _this; + } + Object.defineProperty(DelimitedToken.prototype, "content", { + get: function () { + return this.input.slice(this.contentRange[0], this.contentRange[1]); + }, + enumerable: false, + configurable: true + }); + return DelimitedToken; + }(Token)); + + var TagToken = /** @class */ (function (_super) { + __extends(TagToken, _super); + function TagToken(input, begin, end, options, file) { + var _this = this; + var trimTagLeft = options.trimTagLeft, trimTagRight = options.trimTagRight, tagDelimiterLeft = options.tagDelimiterLeft, tagDelimiterRight = options.tagDelimiterRight; + var _a = __read([begin + tagDelimiterLeft.length, end - tagDelimiterRight.length], 2), valueBegin = _a[0], valueEnd = _a[1]; + _this = _super.call(this, exports.TokenKind.Tag, [valueBegin, valueEnd], input, begin, end, trimTagLeft, trimTagRight, file) || this; + _this.tokenizer = new Tokenizer(input, options.operators, file, _this.contentRange); + _this.name = _this.tokenizer.readTagName(); + _this.tokenizer.assert(_this.name, "illegal tag syntax, tag name expected"); + _this.tokenizer.skipBlank(); + _this.args = _this.tokenizer.input.slice(_this.tokenizer.p, _this.contentRange[1]); + return _this; + } + return TagToken; + }(DelimitedToken)); + + var OutputToken = /** @class */ (function (_super) { + __extends(OutputToken, _super); + function OutputToken(input, begin, end, options, file) { + var trimOutputLeft = options.trimOutputLeft, trimOutputRight = options.trimOutputRight, outputDelimiterLeft = options.outputDelimiterLeft, outputDelimiterRight = options.outputDelimiterRight; + var valueRange = [begin + outputDelimiterLeft.length, end - outputDelimiterRight.length]; + return _super.call(this, exports.TokenKind.Output, valueRange, input, begin, end, trimOutputLeft, trimOutputRight, file) || this; + } + return OutputToken; + }(DelimitedToken)); + + var HTMLToken = /** @class */ (function (_super) { + __extends(HTMLToken, _super); + function HTMLToken(input, begin, end, file) { + var _this = _super.call(this, exports.TokenKind.HTML, input, begin, end, file) || this; + _this.input = input; + _this.begin = begin; + _this.end = end; + _this.file = file; + _this.trimLeft = 0; + _this.trimRight = 0; + return _this; + } + HTMLToken.prototype.getContent = function () { + return this.input.slice(this.begin + this.trimLeft, this.end - this.trimRight); + }; + return HTMLToken; + }(Token)); + + var NumberToken = /** @class */ (function (_super) { + __extends(NumberToken, _super); + function NumberToken(input, begin, end, file) { + var _this = _super.call(this, exports.TokenKind.Number, input, begin, end, file) || this; + _this.input = input; + _this.begin = begin; + _this.end = end; + _this.file = file; + _this.content = Number(_this.getText()); + return _this; + } + return NumberToken; + }(Token)); + + var IdentifierToken = /** @class */ (function (_super) { + __extends(IdentifierToken, _super); + function IdentifierToken(input, begin, end, file) { + var _this = _super.call(this, exports.TokenKind.Word, input, begin, end, file) || this; + _this.input = input; + _this.begin = begin; + _this.end = end; + _this.file = file; + _this.content = _this.getText(); + return _this; + } + return IdentifierToken; + }(Token)); + + var LiteralToken = /** @class */ (function (_super) { + __extends(LiteralToken, _super); + function LiteralToken(input, begin, end, file) { + var _this = _super.call(this, exports.TokenKind.Literal, input, begin, end, file) || this; + _this.input = input; + _this.begin = begin; + _this.end = end; + _this.file = file; + _this.literal = _this.getText(); + _this.content = literalValues[_this.literal]; + return _this; + } + return LiteralToken; + }(Token)); + + var operatorPrecedences = { + '==': 2, + '!=': 2, + '>': 2, + '<': 2, + '>=': 2, + '<=': 2, + 'contains': 2, + 'not': 1, + 'and': 0, + 'or': 0 + }; + var operatorTypes = { + '==': 0 /* OperatorType.Binary */, + '!=': 0 /* OperatorType.Binary */, + '>': 0 /* OperatorType.Binary */, + '<': 0 /* OperatorType.Binary */, + '>=': 0 /* OperatorType.Binary */, + '<=': 0 /* OperatorType.Binary */, + 'contains': 0 /* OperatorType.Binary */, + 'not': 1 /* OperatorType.Unary */, + 'and': 0 /* OperatorType.Binary */, + 'or': 0 /* OperatorType.Binary */ + }; + var OperatorToken = /** @class */ (function (_super) { + __extends(OperatorToken, _super); + function OperatorToken(input, begin, end, file) { + var _this = _super.call(this, exports.TokenKind.Operator, input, begin, end, file) || this; + _this.input = input; + _this.begin = begin; + _this.end = end; + _this.file = file; + _this.operator = _this.getText(); + return _this; + } + OperatorToken.prototype.getPrecedence = function () { + return this.operator in operatorPrecedences ? operatorPrecedences[this.operator] : 1; + }; + return OperatorToken; + }(Token)); + + var PropertyAccessToken = /** @class */ (function (_super) { + __extends(PropertyAccessToken, _super); + function PropertyAccessToken(variable, props, input, begin, end, file) { + var _this = _super.call(this, exports.TokenKind.PropertyAccess, input, begin, end, file) || this; + _this.variable = variable; + _this.props = props; + return _this; + } + return PropertyAccessToken; + }(Token)); + + var FilterToken = /** @class */ (function (_super) { + __extends(FilterToken, _super); + function FilterToken(name, args, input, begin, end, file) { + var _this = _super.call(this, exports.TokenKind.Filter, input, begin, end, file) || this; + _this.name = name; + _this.args = args; + return _this; + } + return FilterToken; + }(Token)); + + var HashToken = /** @class */ (function (_super) { + __extends(HashToken, _super); + function HashToken(input, begin, end, name, value, file) { + var _this = _super.call(this, exports.TokenKind.Hash, input, begin, end, file) || this; + _this.input = input; + _this.begin = begin; + _this.end = end; + _this.name = name; + _this.value = value; + _this.file = file; + return _this; + } + return HashToken; + }(Token)); + + var rHex = /[\da-fA-F]/; + var rOct = /[0-7]/; + var escapeChar = { + b: '\b', + f: '\f', + n: '\n', + r: '\r', + t: '\t', + v: '\x0B' + }; + function hexVal(c) { + var code = c.charCodeAt(0); + if (code >= 97) + return code - 87; + if (code >= 65) + return code - 55; + return code - 48; + } + function parseStringLiteral(str) { + var ret = ''; + for (var i = 1; i < str.length - 1; i++) { + if (str[i] !== '\\') { + ret += str[i]; + continue; + } + if (escapeChar[str[i + 1]] !== undefined) { + ret += escapeChar[str[++i]]; + } + else if (str[i + 1] === 'u') { + var val = 0; + var j = i + 2; + while (j <= i + 5 && rHex.test(str[j])) { + val = val * 16 + hexVal(str[j++]); + } + i = j - 1; + ret += String.fromCharCode(val); + } + else if (!rOct.test(str[i + 1])) { + ret += str[++i]; + } + else { + var j = i + 1; + var val = 0; + while (j <= i + 3 && rOct.test(str[j])) { + val = val * 8 + hexVal(str[j++]); + } + i = j - 1; + ret += String.fromCharCode(val); + } + } + return ret; + } + + var QuotedToken = /** @class */ (function (_super) { + __extends(QuotedToken, _super); + function QuotedToken(input, begin, end, file) { + var _this = _super.call(this, exports.TokenKind.Quoted, input, begin, end, file) || this; + _this.input = input; + _this.begin = begin; + _this.end = end; + _this.file = file; + _this.content = parseStringLiteral(_this.getText()); + return _this; + } + return QuotedToken; + }(Token)); + + var RangeToken = /** @class */ (function (_super) { + __extends(RangeToken, _super); + function RangeToken(input, begin, end, lhs, rhs, file) { + var _this = _super.call(this, exports.TokenKind.Range, input, begin, end, file) || this; + _this.input = input; + _this.begin = begin; + _this.end = end; + _this.lhs = lhs; + _this.rhs = rhs; + _this.file = file; + return _this; + } + return RangeToken; + }(Token)); + + /** + * LiquidTagToken is different from TagToken by not having delimiters `{%` or `%}` + */ + var LiquidTagToken = /** @class */ (function (_super) { + __extends(LiquidTagToken, _super); + function LiquidTagToken(input, begin, end, options, file) { + var _this = _super.call(this, exports.TokenKind.Tag, [begin, end], input, begin, end, false, false, file) || this; + _this.tokenizer = new Tokenizer(input, options.operators, file, _this.contentRange); + _this.name = _this.tokenizer.readTagName(); + _this.tokenizer.assert(_this.name, 'illegal liquid tag syntax'); + _this.tokenizer.skipBlank(); + return _this; + } + Object.defineProperty(LiquidTagToken.prototype, "args", { + get: function () { + return this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]); + }, + enumerable: false, + configurable: true + }); + return LiquidTagToken; + }(DelimitedToken)); + + /** + * value expression with optional filters + * e.g. + * {% assign foo="bar" | append: "coo" %} + */ + var FilteredValueToken = /** @class */ (function (_super) { + __extends(FilteredValueToken, _super); + function FilteredValueToken(initial, filters, input, begin, end, file) { + var _this = _super.call(this, exports.TokenKind.FilteredValue, input, begin, end, file) || this; + _this.initial = initial; + _this.filters = filters; + _this.input = input; + _this.begin = begin; + _this.end = end; + _this.file = file; + return _this; + } + return FilteredValueToken; + }(Token)); + + var polyfill = { + now: function () { return Date.now(); } + }; + function getPerformance() { + return (typeof global === 'object' && global.performance) || + (typeof window === 'object' && window.performance) || + polyfill; + } + + var Render = /** @class */ (function () { + function Render() { + } + Render.prototype.renderTemplatesToNodeStream = function (templates, ctx) { + var _this = this; + var emitter = new StreamedEmitter(); + Promise.resolve().then(function () { return toPromise(_this.renderTemplates(templates, ctx, emitter)); }) + .then(function () { return emitter.end(); }, function (err) { return emitter.error(err); }); + return emitter.stream; + }; + Render.prototype.renderTemplates = function (templates, ctx, emitter) { + var errors, templates_1, templates_1_1, tpl, html, e_1, err, e_2_1; + var e_2, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!emitter) { + emitter = ctx.opts.keepOutputType ? new KeepingTypeEmitter() : new SimpleEmitter(); + } + ctx.renderLimit.check(getPerformance().now()); + errors = []; + _b.label = 1; + case 1: + _b.trys.push([1, 8, 9, 10]); + templates_1 = __values(templates), templates_1_1 = templates_1.next(); + _b.label = 2; + case 2: + if (!!templates_1_1.done) return [3 /*break*/, 7]; + tpl = templates_1_1.value; + ctx.renderLimit.check(getPerformance().now()); + _b.label = 3; + case 3: + _b.trys.push([3, 5, , 6]); + return [4 /*yield*/, tpl.render(ctx, emitter) + // if not, it'll return an `html`, write to the emitter for it + ]; + case 4: + html = _b.sent(); + // if not, it'll return an `html`, write to the emitter for it + html && emitter.write(html); + if (ctx.breakCalled || ctx.continueCalled) + return [3 /*break*/, 7]; + return [3 /*break*/, 6]; + case 5: + e_1 = _b.sent(); + err = LiquidError.is(e_1) ? e_1 : new RenderError(e_1, tpl); + if (ctx.opts.catchAllErrors) + errors.push(err); + else + throw err; + return [3 /*break*/, 6]; + case 6: + templates_1_1 = templates_1.next(); + return [3 /*break*/, 2]; + case 7: return [3 /*break*/, 10]; + case 8: + e_2_1 = _b.sent(); + e_2 = { error: e_2_1 }; + return [3 /*break*/, 10]; + case 9: + try { + if (templates_1_1 && !templates_1_1.done && (_a = templates_1.return)) _a.call(templates_1); + } + finally { if (e_2) throw e_2.error; } + return [7 /*endfinally*/]; + case 10: + if (errors.length) { + throw new LiquidErrors(errors); + } + return [2 /*return*/, emitter.buffer]; + } + }); + }; + return Render; + }()); + + var Expression = /** @class */ (function () { + function Expression(tokens) { + this.postfix = __spreadArray([], __read(toPostfix(tokens)), false); + } + Expression.prototype.evaluate = function (ctx, lenient) { + var operands, _a, _b, token, r, result, l, _c, _d, e_1_1; + var e_1, _e; + return __generator(this, function (_f) { + switch (_f.label) { + case 0: + assert(ctx, 'unable to evaluate: context not defined'); + operands = []; + _f.label = 1; + case 1: + _f.trys.push([1, 11, 12, 13]); + _a = __values(this.postfix), _b = _a.next(); + _f.label = 2; + case 2: + if (!!_b.done) return [3 /*break*/, 10]; + token = _b.value; + if (!isOperatorToken(token)) return [3 /*break*/, 7]; + r = operands.pop(); + result = void 0; + if (!(operatorTypes[token.operator] === 1 /* OperatorType.Unary */)) return [3 /*break*/, 4]; + return [4 /*yield*/, ctx.opts.operators[token.operator](r, ctx)]; + case 3: + result = _f.sent(); + return [3 /*break*/, 6]; + case 4: + l = operands.pop(); + return [4 /*yield*/, ctx.opts.operators[token.operator](l, r, ctx)]; + case 5: + result = _f.sent(); + _f.label = 6; + case 6: + operands.push(result); + return [3 /*break*/, 9]; + case 7: + _d = (_c = operands).push; + return [4 /*yield*/, evalToken(token, ctx, lenient)]; + case 8: + _d.apply(_c, [_f.sent()]); + _f.label = 9; + case 9: + _b = _a.next(); + return [3 /*break*/, 2]; + case 10: return [3 /*break*/, 13]; + case 11: + e_1_1 = _f.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 13]; + case 12: + try { + if (_b && !_b.done && (_e = _a.return)) _e.call(_a); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 13: return [2 /*return*/, operands[0]]; + } + }); + }; + Expression.prototype.valid = function () { + return !!this.postfix.length; + }; + return Expression; + }()); + function evalToken(token, ctx, lenient) { + if (lenient === void 0) { lenient = false; } + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!token) + return [2 /*return*/]; + if ('content' in token) + return [2 /*return*/, token.content]; + if (!isPropertyAccessToken(token)) return [3 /*break*/, 2]; + return [4 /*yield*/, evalPropertyAccessToken(token, ctx, lenient)]; + case 1: return [2 /*return*/, _a.sent()]; + case 2: + if (!isRangeToken(token)) return [3 /*break*/, 4]; + return [4 /*yield*/, evalRangeToken(token, ctx)]; + case 3: return [2 /*return*/, _a.sent()]; + case 4: return [2 /*return*/]; + } + }); + } + function evalPropertyAccessToken(token, ctx, lenient) { + var props, _a, _b, prop, _c, _d, e_2_1, variable, e_3; + var e_2, _e; + return __generator(this, function (_f) { + switch (_f.label) { + case 0: + props = []; + _f.label = 1; + case 1: + _f.trys.push([1, 6, 7, 8]); + _a = __values(token.props), _b = _a.next(); + _f.label = 2; + case 2: + if (!!_b.done) return [3 /*break*/, 5]; + prop = _b.value; + _d = (_c = props).push; + return [4 /*yield*/, evalToken(prop, ctx, false)]; + case 3: + _d.apply(_c, [(_f.sent())]); + _f.label = 4; + case 4: + _b = _a.next(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 8]; + case 6: + e_2_1 = _f.sent(); + e_2 = { error: e_2_1 }; + return [3 /*break*/, 8]; + case 7: + try { + if (_b && !_b.done && (_e = _a.return)) _e.call(_a); + } + finally { if (e_2) throw e_2.error; } + return [7 /*endfinally*/]; + case 8: + _f.trys.push([8, 14, , 15]); + if (!token.variable) return [3 /*break*/, 11]; + return [4 /*yield*/, evalToken(token.variable, ctx, lenient)]; + case 9: + variable = _f.sent(); + return [4 /*yield*/, ctx._getFromScope(variable, props)]; + case 10: return [2 /*return*/, _f.sent()]; + case 11: return [4 /*yield*/, ctx._get(props)]; + case 12: return [2 /*return*/, _f.sent()]; + case 13: return [3 /*break*/, 15]; + case 14: + e_3 = _f.sent(); + if (lenient && e_3.name === 'InternalUndefinedVariableError') + return [2 /*return*/, null]; + throw (new UndefinedVariableError(e_3, token)); + case 15: return [2 /*return*/]; + } + }); + } + function evalQuotedToken(token) { + return token.content; + } + function evalRangeToken(token, ctx) { + var low, high; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, evalToken(token.lhs, ctx)]; + case 1: + low = _a.sent(); + return [4 /*yield*/, evalToken(token.rhs, ctx)]; + case 2: + high = _a.sent(); + ctx.memoryLimit.use(high - low + 1); + return [2 /*return*/, range(+low, +high + 1)]; + } + }); + } + function toPostfix(tokens) { + var ops, tokens_1, tokens_1_1, token, e_4_1; + var e_4, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + ops = []; + _b.label = 1; + case 1: + _b.trys.push([1, 10, 11, 12]); + tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); + _b.label = 2; + case 2: + if (!!tokens_1_1.done) return [3 /*break*/, 9]; + token = tokens_1_1.value; + if (!isOperatorToken(token)) return [3 /*break*/, 6]; + _b.label = 3; + case 3: + if (!(ops.length && ops[ops.length - 1].getPrecedence() > token.getPrecedence())) return [3 /*break*/, 5]; + return [4 /*yield*/, ops.pop()]; + case 4: + _b.sent(); + return [3 /*break*/, 3]; + case 5: + ops.push(token); + return [3 /*break*/, 8]; + case 6: return [4 /*yield*/, token]; + case 7: + _b.sent(); + _b.label = 8; + case 8: + tokens_1_1 = tokens_1.next(); + return [3 /*break*/, 2]; + case 9: return [3 /*break*/, 12]; + case 10: + e_4_1 = _b.sent(); + e_4 = { error: e_4_1 }; + return [3 /*break*/, 12]; + case 11: + try { + if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1); + } + finally { if (e_4) throw e_4.error; } + return [7 /*endfinally*/]; + case 12: + if (!ops.length) return [3 /*break*/, 14]; + return [4 /*yield*/, ops.pop()]; + case 13: + _b.sent(); + return [3 /*break*/, 12]; + case 14: return [2 /*return*/]; + } + }); + } + + function isTruthy(val, ctx) { + return !isFalsy(val, ctx); + } + function isFalsy(val, ctx) { + val = toValue(val); + if (ctx.opts.jsTruthy) { + return !val; + } + else { + return val === false || undefined === val || val === null; + } + } + + var defaultOperators = { + '==': equals, + '!=': function (l, r) { return !equals(l, r); }, + '>': function (l, r) { + if (isComparable(l)) + return l.gt(r); + if (isComparable(r)) + return r.lt(l); + return toValue(l) > toValue(r); + }, + '<': function (l, r) { + if (isComparable(l)) + return l.lt(r); + if (isComparable(r)) + return r.gt(l); + return toValue(l) < toValue(r); + }, + '>=': function (l, r) { + if (isComparable(l)) + return l.geq(r); + if (isComparable(r)) + return r.leq(l); + return toValue(l) >= toValue(r); + }, + '<=': function (l, r) { + if (isComparable(l)) + return l.leq(r); + if (isComparable(r)) + return r.geq(l); + return toValue(l) <= toValue(r); + }, + 'contains': function (l, r) { + l = toValue(l); + if (isArray(l)) + return l.some(function (i) { return equals(i, r); }); + if (isFunction(l === null || l === void 0 ? void 0 : l.indexOf)) + return l.indexOf(toValue(r)) > -1; + return false; + }, + 'not': function (v, ctx) { return isFalsy(toValue(v), ctx); }, + 'and': function (l, r, ctx) { return isTruthy(toValue(l), ctx) && isTruthy(toValue(r), ctx); }, + 'or': function (l, r, ctx) { return isTruthy(toValue(l), ctx) || isTruthy(toValue(r), ctx); } + }; + function equals(lhs, rhs) { + if (isComparable(lhs)) + return lhs.equals(rhs); + if (isComparable(rhs)) + return rhs.equals(lhs); + lhs = toValue(lhs); + rhs = toValue(rhs); + if (isArray(lhs)) { + return isArray(rhs) && arrayEquals(lhs, rhs); + } + return lhs === rhs; + } + function arrayEquals(lhs, rhs) { + if (lhs.length !== rhs.length) + return false; + return !lhs.some(function (value, i) { return !equals(value, rhs[i]); }); + } + function arrayIncludes(arr, item) { + return arr.some(function (value) { return equals(value, item); }); + } + + var Node = /** @class */ (function () { + function Node(key, value, next, prev) { + this.key = key; + this.value = value; + this.next = next; + this.prev = prev; + } + return Node; + }()); + var LRU = /** @class */ (function () { + function LRU(limit, size) { + if (size === void 0) { size = 0; } + this.limit = limit; + this.size = size; + this.cache = {}; + this.head = new Node('HEAD', null, null, null); + this.tail = new Node('TAIL', null, null, null); + this.head.next = this.tail; + this.tail.prev = this.head; + } + LRU.prototype.write = function (key, value) { + if (this.cache[key]) { + this.cache[key].value = value; + } + else { + var node = new Node(key, value, this.head.next, this.head); + this.head.next.prev = node; + this.head.next = node; + this.cache[key] = node; + this.size++; + this.ensureLimit(); + } + }; + LRU.prototype.read = function (key) { + if (!this.cache[key]) + return; + var value = this.cache[key].value; + this.remove(key); + this.write(key, value); + return value; + }; + LRU.prototype.remove = function (key) { + var node = this.cache[key]; + node.prev.next = node.next; + node.next.prev = node.prev; + delete this.cache[key]; + this.size--; + }; + LRU.prototype.clear = function () { + this.head.next = this.tail; + this.tail.prev = this.head; + this.size = 0; + this.cache = {}; + }; + LRU.prototype.ensureLimit = function () { + if (this.size > this.limit) + this.remove(this.tail.prev.key); + }; + return LRU; + }()); + + function domResolve(root, path) { + var base = document.createElement('base'); + base.href = root; + var head = document.getElementsByTagName('head')[0]; + head.insertBefore(base, head.firstChild); + var a = document.createElement('a'); + a.href = path; + var resolved = a.href; + head.removeChild(base); + return resolved; + } + function resolve(root, filepath, ext) { + if (root.length && last(root) !== '/') + root += '/'; + var url = domResolve(root, filepath); + return url.replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/, function (str, origin, path) { + var last = path.split('/').pop(); + if (/\.\w+$/.test(last)) + return str; + return origin + path + ext; + }); + } + function readFile(url) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, new Promise(function (resolve, reject) { + var xhr = new XMLHttpRequest(); + xhr.onload = function () { + if (xhr.status >= 200 && xhr.status < 300) { + resolve(xhr.responseText); + } + else { + reject(new Error(xhr.statusText)); + } + }; + xhr.onerror = function () { + reject(new Error('An error occurred whilst receiving the response.')); + }; + xhr.open('GET', url); + xhr.send(); + })]; + }); + }); + } + function readFileSync(url) { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.send(); + if (xhr.status < 200 || xhr.status >= 300) { + throw new Error(xhr.statusText); + } + return xhr.responseText; + } + function exists(filepath) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, true]; + }); + }); + } + function existsSync(filepath) { + return true; + } + function dirname(filepath) { + return domResolve(filepath, '.'); + } + var sep = '/'; + + var fs = /*#__PURE__*/Object.freeze({ + __proto__: null, + resolve: resolve, + readFile: readFile, + readFileSync: readFileSync, + exists: exists, + existsSync: existsSync, + dirname: dirname, + sep: sep + }); + + function chargeJsonReplacerValue(memoryLimit, val) { + if (typeof val === 'string') { + memoryLimit.use(val.length); + } + else if (val === null || typeof val === 'number' || typeof val === 'boolean') { + memoryLimit.use(JSON.stringify(val).length); + } + else if (Array.isArray(val)) { + memoryLimit.use(val.length + 1); + } + else if (typeof val === 'object') { + memoryLimit.use(2); + } + } + function defaultFilter(value, defaultValue) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + value = toValue(value); + if (isArray(value) || isString(value)) + return value.length ? value : defaultValue; + if (value === false && (new Map(args)).get('allow_false')) + return false; + return isFalsy(value, this.context) ? defaultValue : value; + } + function json(value, space) { + if (space === void 0) { space = 0; } + var memoryLimit = this.context.memoryLimit; + return JSON.stringify(value, function (_key, val) { + chargeJsonReplacerValue(memoryLimit, val); + return val; + }, space); + } + function inspect(value, space) { + if (space === void 0) { space = 0; } + var memoryLimit = this.context.memoryLimit; + var ancestors = []; + return JSON.stringify(value, function (_key, value) { + if (typeof value !== 'object' || value === null) { + chargeJsonReplacerValue(memoryLimit, value); + return value; + } + // `this` is the object that value is contained in, i.e., its direct parent. + while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) + ancestors.pop(); + if (ancestors.includes(value)) { + memoryLimit.use('[Circular]'.length); + return '[Circular]'; + } + ancestors.push(value); + chargeJsonReplacerValue(memoryLimit, value); + return value; + }, space); + } + function to_integer(value) { + return Number(value); + } + var raw = { + raw: true, + handler: identify + }; + var misc = { + default: defaultFilter, + raw: raw, + jsonify: json, + to_integer: to_integer, + json: json, + inspect: inspect + }; + + var escapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + var unescapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" + }; + function escape(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.replace(/&|<|>|"|'/g, function (m) { return escapeMap[m]; }); + } + function xml_escape(str) { + return escape.call(this, str); + } + function unescape(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.replace(/&(amp|lt|gt|#34|#39);/g, function (m) { return unescapeMap[m]; }); + } + function escape_once(str) { + return escape.call(this, unescape.call(this, str)); + } + function newline_to_br(v) { + var str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\r?\n/gm, '
\n'); + } + // Raw-text blocks (HTML5) plus '<...>' as the catch-all kind; a regex + // equivalent is O(n^2) in V8 on unclosed openers. + function strip_html(v) { + var e_1, _a; + var str = stringify(v); + this.context.memoryLimit.use(str.length); + var blocks = new Map([[''], [''], [''], ['<', '>']]); + var out = ''; + var i = 0; + while (i < str.length) { + var lt = str.indexOf('<', i); + if (lt < 0) + return out + str.slice(i); + out += str.slice(i, lt); + try { + for (var blocks_1 = (e_1 = void 0, __values(blocks)), blocks_1_1 = blocks_1.next(); !blocks_1_1.done; blocks_1_1 = blocks_1.next()) { + var _b = __read(blocks_1_1.value, 2), opener_1 = _b[0], closer = _b[1]; + if (!str.startsWith(opener_1, lt)) + continue; + var e = str.indexOf(closer, lt + opener_1.length); + if (e >= 0) { + i = e + closer.length; + break; + } + blocks.delete(opener_1); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (blocks_1_1 && !blocks_1_1.done && (_a = blocks_1.return)) _a.call(blocks_1); + } + finally { if (e_1) throw e_1.error; } + } + if (i <= lt) + return out + str.slice(lt); + } + return out; + } + + var htmlFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + escape: escape, + xml_escape: xml_escape, + escape_once: escape_once, + newline_to_br: newline_to_br, + strip_html: strip_html + }); + + var MapFS = /** @class */ (function () { + function MapFS(mapping) { + this.mapping = mapping; + this.sep = '/'; + } + MapFS.prototype.exists = function (filepath) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, this.existsSync(filepath)]; + }); + }); + }; + MapFS.prototype.existsSync = function (filepath) { + return !isNil(this.mapping[filepath]); + }; + MapFS.prototype.readFile = function (filepath) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, this.readFileSync(filepath)]; + }); + }); + }; + MapFS.prototype.readFileSync = function (filepath) { + var content = this.mapping[filepath]; + if (isNil(content)) + throw new Error("ENOENT: ".concat(filepath)); + return content; + }; + MapFS.prototype.dirname = function (filepath) { + var segments = filepath.split(this.sep); + segments.pop(); + return segments.join(this.sep); + }; + MapFS.prototype.resolve = function (dir, file, ext) { + var e_1, _a; + file += ext; + if (dir === '.') + return file; + var segments = dir.split(/\/+/); + try { + for (var _b = __values(file.split(this.sep)), _c = _b.next(); !_c.done; _c = _b.next()) { + var segment = _c.value; + if (segment === '.' || segment === '') + continue; + else if (segment === '..') { + if (segments.length > 1 || segments[0] !== '') + segments.pop(); + } + else + segments.push(segment); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + return segments.join(this.sep); + }; + return MapFS; + }()); + + var defaultOptions = { + root: ['.'], + layouts: ['.'], + partials: ['.'], + relativeReference: true, + jekyllInclude: false, + keyValueSeparator: ':', + cache: undefined, + extname: '', + fs: fs, + dynamicPartials: true, + jsTruthy: false, + dateFormat: '%A, %B %-e, %Y at %-l:%M %P %z', + locale: '', + trimTagRight: false, + trimTagLeft: false, + trimOutputRight: false, + trimOutputLeft: false, + greedy: true, + tagDelimiterLeft: '{%', + tagDelimiterRight: '%}', + outputDelimiterLeft: '{{', + outputDelimiterRight: '}}', + preserveTimezones: false, + strictFilters: false, + strictVariables: false, + ownPropertyOnly: true, + lenientIf: false, + globals: {}, + keepOutputType: false, + operators: defaultOperators, + memoryLimit: Infinity, + parseLimit: Infinity, + renderLimit: Infinity + }; + function normalize(options) { + var _a, _b; + if (options.hasOwnProperty('root')) { + if (!options.hasOwnProperty('partials')) + options.partials = options.root; + if (!options.hasOwnProperty('layouts')) + options.layouts = options.root; + } + if (options.hasOwnProperty('cache')) { + var cache = void 0; + if (typeof options.cache === 'number') + cache = options.cache > 0 ? new LRU(options.cache) : undefined; + else if (typeof options.cache === 'object') + cache = options.cache; + else + cache = options.cache ? new LRU(1024) : undefined; + options.cache = cache; + } + options = __assign(__assign(__assign({}, defaultOptions), (options.jekyllInclude ? { dynamicPartials: false } : {})), options); + if ((!options.fs.dirname || !options.fs.sep) && options.relativeReference) { + console.warn('[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning'); + options.relativeReference = false; + } + options.root = normalizeDirectoryList(options.root); + options.partials = normalizeDirectoryList(options.partials); + options.layouts = normalizeDirectoryList(options.layouts); + options.outputEscape = options.outputEscape && getOutputEscapeFunction(options.outputEscape); + if (!options.locale) { + options.locale = (_b = (_a = getDateTimeFormat()) === null || _a === void 0 ? void 0 : _a().resolvedOptions().locale) !== null && _b !== void 0 ? _b : 'en-US'; + } + if (options.templates) { + options.fs = new MapFS(options.templates); + options.relativeReference = true; + options.root = options.partials = options.layouts = '.'; + } + return options; + } + function getOutputEscapeFunction(nameOrFunction) { + if (nameOrFunction === 'escape') + return escape; + if (nameOrFunction === 'json') + return misc.json; + assert(isFunction(nameOrFunction), '`outputEscape` need to be of type string or function'); + return nameOrFunction; + } + function normalizeDirectoryList(value) { + var list = []; + if (isArray(value)) + list = value; + if (isString(value)) + list = [value]; + return list; + } + + function whiteSpaceCtrl(tokens, options) { + var inRaw = false; + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + if (!isDelimitedToken(token)) + continue; + if (!inRaw && token.trimLeft) { + trimLeft(tokens[i - 1], options.greedy); + } + if (isTagToken(token)) { + if (token.name === 'raw') + inRaw = true; + else if (token.name === 'endraw') + inRaw = false; + } + if (!inRaw && token.trimRight) { + trimRight(tokens[i + 1], options.greedy); + } + } + } + function trimLeft(token, greedy) { + if (!token || !isHTMLToken(token)) + return; + var mask = greedy ? BLANK : INLINE_BLANK; + while (TYPES[token.input.charCodeAt(token.end - 1 - token.trimRight)] & mask) + token.trimRight++; + } + function trimRight(token, greedy) { + if (!token || !isHTMLToken(token)) + return; + var mask = greedy ? BLANK : INLINE_BLANK; + while (TYPES[token.input.charCodeAt(token.begin + token.trimLeft)] & mask) + token.trimLeft++; + if (token.input.charAt(token.begin + token.trimLeft) === '\n') + token.trimLeft++; + } + + var Tokenizer = /** @class */ (function () { + function Tokenizer(input, operators, file, range) { + if (operators === void 0) { operators = defaultOptions.operators; } + this.input = input; + this.file = file; + this.rawBeginAt = -1; + this.p = range ? range[0] : 0; + this.N = range ? range[1] : input.length; + this.opTrie = createTrie(operators); + this.literalTrie = createTrie(literalValues); + } + Tokenizer.prototype.readExpression = function () { + return new Expression(this.readExpressionTokens()); + }; + Tokenizer.prototype.readExpressionTokens = function () { + var operator, operand; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(this.p < this.N)) return [3 /*break*/, 5]; + operator = this.readOperator(); + if (!operator) return [3 /*break*/, 2]; + return [4 /*yield*/, operator]; + case 1: + _a.sent(); + return [3 /*break*/, 0]; + case 2: + operand = this.readValue(); + if (!operand) return [3 /*break*/, 4]; + return [4 /*yield*/, operand]; + case 3: + _a.sent(); + return [3 /*break*/, 0]; + case 4: return [2 /*return*/]; + case 5: return [2 /*return*/]; + } + }); + }; + Tokenizer.prototype.readOperator = function () { + this.skipBlank(); + var end = this.matchTrie(this.opTrie); + if (end === -1) + return; + return new OperatorToken(this.input, this.p, (this.p = end), this.file); + }; + Tokenizer.prototype.matchTrie = function (trie) { + var node = trie; + var i = this.p; + var info; + while (node[this.input[i]] && i < this.N) { + node = node[this.input[i++]]; + if (node['end']) + info = node; + } + if (!info) + return -1; + if (info['needBoundary'] && isWord(this.peek(i - this.p))) + return -1; + return i; + }; + Tokenizer.prototype.readFilteredValue = function () { + var begin = this.p; + var initial = this.readExpression(); + this.assert(initial.valid(), "invalid value expression: ".concat(this.snapshot())); + var filters = this.readFilters(); + return new FilteredValueToken(initial, filters, this.input, begin, this.p, this.file); + }; + Tokenizer.prototype.readFilters = function () { + var filters = []; + while (true) { + var filter = this.readFilter(); + if (!filter) + return filters; + filters.push(filter); + } + }; + Tokenizer.prototype.readFilter = function () { + var _this = this; + this.skipBlank(); + if (this.end()) + return null; + this.assert(this.read() === '|', "expected \"|\" before filter"); + var name = this.readIdentifier(); + if (!name.size()) { + this.assert(this.end(), "expected filter name"); + return null; + } + var args = []; + this.skipBlank(); + if (this.peek() === ':') { + do { + ++this.p; + var arg = this.readFilterArg(); + arg && args.push(arg); + this.skipBlank(); + this.assert(this.end() || this.peek() === ',' || this.peek() === '|', function () { return "unexpected character ".concat(_this.snapshot()); }); + } while (this.peek() === ','); + } + else if (this.peek() === '|' || this.end()) ; + else { + throw this.error('expected ":" after filter name'); + } + return new FilterToken(name.getText(), args, this.input, name.begin, this.p, this.file); + }; + Tokenizer.prototype.readFilterArg = function () { + var key = this.readValue(); + if (!key) + return; + this.skipBlank(); + if (this.peek() !== ':') + return key; + ++this.p; + var value = this.readValue(); + return [key.getText(), value]; + }; + Tokenizer.prototype.readTopLevelTokens = function (options) { + if (options === void 0) { options = defaultOptions; } + var tokens = []; + while (this.p < this.N) { + var token = this.readTopLevelToken(options); + tokens.push(token); + } + whiteSpaceCtrl(tokens, options); + return tokens; + }; + Tokenizer.prototype.readTopLevelToken = function (options) { + var tagDelimiterLeft = options.tagDelimiterLeft, outputDelimiterLeft = options.outputDelimiterLeft; + if (this.rawBeginAt > -1) + return this.readEndrawOrRawContent(options); + if (this.match(tagDelimiterLeft)) + return this.readTagToken(options); + if (this.match(outputDelimiterLeft)) + return this.readOutputToken(options); + return this.readHTMLToken([tagDelimiterLeft, outputDelimiterLeft]); + }; + Tokenizer.prototype.readHTMLToken = function (stopStrings) { + var _this = this; + var begin = this.p; + while (this.p < this.N) { + if (stopStrings.some(function (str) { return _this.match(str); })) + break; + ++this.p; + } + return new HTMLToken(this.input, begin, this.p, this.file); + }; + Tokenizer.prototype.readTagToken = function (options) { + var _a = this, file = _a.file, input = _a.input; + var begin = this.p; + if (this.readToDelimiter(options.tagDelimiterRight) === -1) { + throw this.error("tag ".concat(this.snapshot(begin), " not closed"), begin); + } + var token = new TagToken(input, begin, this.p, options, file); + if (token.name === 'raw') + this.rawBeginAt = begin; + return token; + }; + Tokenizer.prototype.readToDelimiter = function (delimiter, respectQuoted) { + if (respectQuoted === void 0) { respectQuoted = false; } + this.skipBlank(); + while (this.p < this.N) { + if (respectQuoted && (this.peekType() & QUOTE)) { + this.readQuoted(); + continue; + } + ++this.p; + if (this.rmatch(delimiter)) + return this.p; + } + return -1; + }; + Tokenizer.prototype.readOutputToken = function (options) { + if (options === void 0) { options = defaultOptions; } + var _a = this, file = _a.file, input = _a.input; + var outputDelimiterRight = options.outputDelimiterRight; + var begin = this.p; + if (this.readToDelimiter(outputDelimiterRight, true) === -1) { + throw this.error("output ".concat(this.snapshot(begin), " not closed"), begin); + } + return new OutputToken(input, begin, this.p, options, file); + }; + Tokenizer.prototype.readEndrawOrRawContent = function (options) { + var tagDelimiterLeft = options.tagDelimiterLeft, tagDelimiterRight = options.tagDelimiterRight; + var begin = this.p; + var leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length; + while (this.p < this.N) { + if (this.readIdentifier().getText() !== 'endraw') { + leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length; + continue; + } + while (this.p <= this.N) { + if (this.rmatch(tagDelimiterRight)) { + var end = this.p; + if (begin === leftPos) { + this.rawBeginAt = -1; + return new TagToken(this.input, begin, end, options, this.file); + } + else { + this.p = leftPos; + return new HTMLToken(this.input, begin, leftPos, this.file); + } + } + if (this.rmatch(tagDelimiterLeft)) + break; + this.p++; + } + } + throw this.error("raw ".concat(this.snapshot(this.rawBeginAt), " not closed"), begin); + }; + Tokenizer.prototype.readLiquidTagTokens = function (options) { + if (options === void 0) { options = defaultOptions; } + var tokens = []; + while (this.p < this.N) { + var token = this.readLiquidTagToken(options); + token && tokens.push(token); + } + return tokens; + }; + Tokenizer.prototype.readLiquidTagToken = function (options) { + this.skipBlank(); + if (this.end()) + return; + var begin = this.p; + this.readToDelimiter('\n'); + var end = this.p; + return new LiquidTagToken(this.input, begin, end, options, this.file); + }; + Tokenizer.prototype.error = function (msg, pos) { + if (pos === void 0) { pos = this.p; } + return new TokenizationError(msg, new IdentifierToken(this.input, pos, this.N, this.file)); + }; + Tokenizer.prototype.assert = function (pred, msg, pos) { + if (!pred) + throw this.error(typeof msg === 'function' ? msg() : msg, pos); + }; + Tokenizer.prototype.snapshot = function (begin) { + if (begin === void 0) { begin = this.p; } + return JSON.stringify(ellipsis(this.input.slice(begin, this.N), 32)); + }; + /** + * @deprecated use #readIdentifier instead + */ + Tokenizer.prototype.readWord = function () { + return this.readIdentifier(); + }; + Tokenizer.prototype.readIdentifier = function () { + this.skipBlank(); + var begin = this.p; + while (!this.end() && isWord(this.peek())) + ++this.p; + return new IdentifierToken(this.input, begin, this.p, this.file); + }; + Tokenizer.prototype.readNonEmptyIdentifier = function () { + var id = this.readIdentifier(); + return id.size() ? id : undefined; + }; + Tokenizer.prototype.readTagName = function () { + this.skipBlank(); + // Handle inline comment tags + if (this.input[this.p] === '#') + return this.input.slice(this.p, ++this.p); + return this.readIdentifier().getText(); + }; + Tokenizer.prototype.readHashes = function (jekyllStyle) { + var hashes = []; + while (true) { + var hash = this.readHash(jekyllStyle); + if (!hash) + return hashes; + hashes.push(hash); + } + }; + Tokenizer.prototype.readHash = function (jekyllStyle) { + this.skipBlank(); + if (this.peek() === ',') + ++this.p; + var begin = this.p; + var name = this.readNonEmptyIdentifier(); + if (!name) + return; + var value; + this.skipBlank(); + var sep = isString(jekyllStyle) ? jekyllStyle : (jekyllStyle ? '=' : ':'); + if (this.peek() === sep) { + ++this.p; + value = this.readValue(); + } + return new HashToken(this.input, begin, this.p, name, value, this.file); + }; + Tokenizer.prototype.remaining = function () { + return this.input.slice(this.p, this.N); + }; + Tokenizer.prototype.advance = function (step) { + if (step === void 0) { step = 1; } + this.p += step; + }; + Tokenizer.prototype.end = function () { + return this.p >= this.N; + }; + Tokenizer.prototype.read = function () { + return this.input[this.p++]; + }; + Tokenizer.prototype.readTo = function (end) { + while (this.p < this.N) { + ++this.p; + if (this.rmatch(end)) + return this.p; + } + return -1; + }; + Tokenizer.prototype.readValue = function () { + this.skipBlank(); + var begin = this.p; + var variable = this.readLiteral() || this.readQuoted() || this.readRange() || this.readNumber(); + var props = this.readProperties(!variable); + if (!props.length) + return variable; + return new PropertyAccessToken(variable, props, this.input, begin, this.p); + }; + Tokenizer.prototype.readScopeValue = function () { + this.skipBlank(); + var begin = this.p; + var props = this.readProperties(); + if (!props.length) + return undefined; + return new PropertyAccessToken(undefined, props, this.input, begin, this.p); + }; + Tokenizer.prototype.readProperties = function (isBegin) { + if (isBegin === void 0) { isBegin = true; } + var props = []; + while (true) { + if (this.peek() === '[') { + this.p++; + var prop = this.readValue() || new IdentifierToken(this.input, this.p, this.p, this.file); + this.assert(this.readTo(']') !== -1, '[ not closed'); + props.push(prop); + continue; + } + if (isBegin && !props.length) { + var prop = this.readNonEmptyIdentifier(); + if (prop) { + props.push(prop); + continue; + } + } + if (this.peek() === '.' && this.peek(1) !== '.') { // skip range syntax + this.p++; + var prop = this.readNonEmptyIdentifier(); + if (!prop) + break; + props.push(prop); + continue; + } + break; + } + return props; + }; + Tokenizer.prototype.readNumber = function () { + this.skipBlank(); + var decimalFound = false; + var digitFound = false; + var n = 0; + if (this.peekType() & SIGN) + n++; + while (this.p + n <= this.N) { + if (this.peekType(n) & NUMBER) { + digitFound = true; + n++; + } + else if (this.peek(n) === '.' && this.peek(n + 1) !== '.') { + if (decimalFound || !digitFound) + return; + decimalFound = true; + n++; + } + else + break; + } + if (digitFound && !isWord(this.peek(n))) { + var num = new NumberToken(this.input, this.p, this.p + n, this.file); + this.advance(n); + return num; + } + }; + Tokenizer.prototype.readLiteral = function () { + this.skipBlank(); + var end = this.matchTrie(this.literalTrie); + if (end === -1) + return; + var literal = new LiteralToken(this.input, this.p, end, this.file); + this.p = end; + return literal; + }; + Tokenizer.prototype.readRange = function () { + this.skipBlank(); + var begin = this.p; + if (this.peek() !== '(') + return; + ++this.p; + var lhs = this.readValueOrThrow(); + this.skipBlank(); + this.assert(this.read() === '.' && this.read() === '.', 'invalid range syntax'); + var rhs = this.readValueOrThrow(); + this.skipBlank(); + this.assert(this.read() === ')', 'invalid range syntax'); + return new RangeToken(this.input, begin, this.p, lhs, rhs, this.file); + }; + Tokenizer.prototype.readValueOrThrow = function () { + var _this = this; + var value = this.readValue(); + this.assert(value, function () { return "unexpected token ".concat(_this.snapshot(), ", value expected"); }); + return value; + }; + Tokenizer.prototype.readQuoted = function () { + this.skipBlank(); + var begin = this.p; + if (!(this.peekType() & QUOTE)) + return; + ++this.p; + var escaped = false; + while (this.p < this.N) { + ++this.p; + if (this.input[this.p - 1] === this.input[begin] && !escaped) + break; + if (escaped) + escaped = false; + else if (this.input[this.p - 1] === '\\') + escaped = true; + } + return new QuotedToken(this.input, begin, this.p, this.file); + }; + Tokenizer.prototype.readFileNameTemplate = function (options) { + var outputDelimiterLeft, htmlStopStrings, htmlStopStringSet; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + outputDelimiterLeft = options.outputDelimiterLeft; + htmlStopStrings = [',', ' ', '\r', '\n', '\t', outputDelimiterLeft]; + htmlStopStringSet = new Set(htmlStopStrings); + _a.label = 1; + case 1: + if (!(this.p < this.N && !htmlStopStringSet.has(this.peek()))) return [3 /*break*/, 3]; + return [4 /*yield*/, this.match(outputDelimiterLeft) + ? this.readOutputToken(options) + : this.readHTMLToken(htmlStopStrings)]; + case 2: + _a.sent(); + return [3 /*break*/, 1]; + case 3: return [2 /*return*/]; + } + }); + }; + Tokenizer.prototype.match = function (word) { + for (var i = 0; i < word.length; i++) { + if (word[i] !== this.input[this.p + i]) + return false; + } + return true; + }; + Tokenizer.prototype.rmatch = function (pattern) { + for (var i = 0; i < pattern.length; i++) { + if (pattern[pattern.length - 1 - i] !== this.input[this.p - 1 - i]) + return false; + } + return true; + }; + Tokenizer.prototype.peekType = function (n) { + if (n === void 0) { n = 0; } + return this.p + n >= this.N ? 0 : TYPES[this.input.charCodeAt(this.p + n)]; + }; + Tokenizer.prototype.peek = function (n) { + if (n === void 0) { n = 0; } + return this.p + n >= this.N ? '' : this.input[this.p + n]; + }; + Tokenizer.prototype.skipBlank = function () { + while (this.peekType() & BLANK) + ++this.p; + }; + return Tokenizer; + }()); + + var ParseStream = /** @class */ (function () { + function ParseStream(tokens, parseToken) { + this.handlers = {}; + this.stopRequested = false; + this.tokens = tokens; + this.parseToken = parseToken; + } + ParseStream.prototype.on = function (name, cb) { + this.handlers[name] = cb; + return this; + }; + ParseStream.prototype.trigger = function (event, arg) { + var h = this.handlers[event]; + return h ? (h.call(this, arg), true) : false; + }; + ParseStream.prototype.start = function () { + this.trigger('start'); + var token; + while (!this.stopRequested && (token = this.tokens.shift())) { + if (this.trigger('token', token)) + continue; + if (isTagToken(token) && this.trigger("tag:".concat(token.name), token)) { + continue; + } + var template = this.parseToken(token, this.tokens); + this.trigger('template', template); + } + if (!this.stopRequested) + this.trigger('end'); + return this; + }; + ParseStream.prototype.stop = function () { + this.stopRequested = true; + return this; + }; + return ParseStream; + }()); + + var TemplateImpl = /** @class */ (function () { + function TemplateImpl(token) { + this.token = token; + } + return TemplateImpl; + }()); + + var Tag = /** @class */ (function (_super) { + __extends(Tag, _super); + function Tag(token, remainTokens, liquid) { + var _this = _super.call(this, token) || this; + _this.name = token.name; + _this.liquid = liquid; + _this.tokenizer = token.tokenizer; + return _this; + } + return Tag; + }(TemplateImpl)); + + /** + * Key-Value Pairs Representing Tag Arguments + * Example: + * For the markup `, foo:'bar', coo:2 reversed %}`, + * hash['foo'] === 'bar' + * hash['coo'] === 2 + * hash['reversed'] === undefined + */ + var Hash = /** @class */ (function () { + function Hash(input, jekyllStyle) { + var e_1, _a; + this.hash = {}; + var tokenizer = input instanceof Tokenizer ? input : new Tokenizer(input, {}); + try { + for (var _b = __values(tokenizer.readHashes(jekyllStyle)), _c = _b.next(); !_c.done; _c = _b.next()) { + var hash = _c.value; + this.hash[hash.name.content] = hash.value; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + } + Hash.prototype.render = function (ctx) { + var hash, _a, _b, key, _c, _d, _e, e_2_1; + var e_2, _f; + return __generator(this, function (_g) { + switch (_g.label) { + case 0: + hash = {}; + _g.label = 1; + case 1: + _g.trys.push([1, 8, 9, 10]); + _a = __values(Object.keys(this.hash)), _b = _a.next(); + _g.label = 2; + case 2: + if (!!_b.done) return [3 /*break*/, 7]; + key = _b.value; + _c = hash; + _d = key; + if (!(this.hash[key] === undefined)) return [3 /*break*/, 3]; + _e = true; + return [3 /*break*/, 5]; + case 3: return [4 /*yield*/, evalToken(this.hash[key], ctx)]; + case 4: + _e = _g.sent(); + _g.label = 5; + case 5: + _c[_d] = _e; + _g.label = 6; + case 6: + _b = _a.next(); + return [3 /*break*/, 2]; + case 7: return [3 /*break*/, 10]; + case 8: + e_2_1 = _g.sent(); + e_2 = { error: e_2_1 }; + return [3 /*break*/, 10]; + case 9: + try { + if (_b && !_b.done && (_f = _a.return)) _f.call(_a); + } + finally { if (e_2) throw e_2.error; } + return [7 /*endfinally*/]; + case 10: return [2 /*return*/, hash]; + } + }); + }; + return Hash; + }()); + + function createTagClass(options) { + return /** @class */ (function (_super) { + __extends(class_1, _super); + function class_1(token, tokens, liquid) { + var _this = _super.call(this, token, tokens, liquid) || this; + if (isFunction(options.parse)) { + options.parse.call(_this, token, tokens); + } + return _this; + } + class_1.prototype.render = function (ctx, emitter) { + var hash; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, new Hash(this.token.args, ctx.opts.keyValueSeparator).render(ctx)]; + case 1: + hash = (_a.sent()); + return [4 /*yield*/, options.render.call(this, ctx, emitter, hash)]; + case 2: return [2 /*return*/, _a.sent()]; + } + }); + }; + return class_1; + }(Tag)); + } + + function isKeyValuePair(arr) { + return isArray(arr); + } + + var Filter = /** @class */ (function () { + function Filter(token, options, liquid) { + this.token = token; + this.name = token.name; + this.handler = isFunction(options) + ? options + : (isFunction(options === null || options === void 0 ? void 0 : options.handler) ? options.handler : identify); + this.raw = !isFunction(options) && !!(options === null || options === void 0 ? void 0 : options.raw); + this.args = token.args; + this.liquid = liquid; + } + Filter.prototype.render = function (value, context) { + var argv, _a, _b, arg, _c, _d, _e, _f, _g, e_1_1; + var e_1, _h; + return __generator(this, function (_j) { + switch (_j.label) { + case 0: + argv = []; + _j.label = 1; + case 1: + _j.trys.push([1, 8, 9, 10]); + _a = __values(this.args), _b = _a.next(); + _j.label = 2; + case 2: + if (!!_b.done) return [3 /*break*/, 7]; + arg = _b.value; + if (!isKeyValuePair(arg)) return [3 /*break*/, 4]; + _d = (_c = argv).push; + _e = [arg[0]]; + return [4 /*yield*/, evalToken(arg[1], context)]; + case 3: + _d.apply(_c, [_e.concat([_j.sent()])]); + return [3 /*break*/, 6]; + case 4: + _g = (_f = argv).push; + return [4 /*yield*/, evalToken(arg, context)]; + case 5: + _g.apply(_f, [_j.sent()]); + _j.label = 6; + case 6: + _b = _a.next(); + return [3 /*break*/, 2]; + case 7: return [3 /*break*/, 10]; + case 8: + e_1_1 = _j.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 10]; + case 9: + try { + if (_b && !_b.done && (_h = _a.return)) _h.call(_a); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 10: return [4 /*yield*/, this.handler.apply({ context: context, token: this.token, liquid: this.liquid }, __spreadArray([value], __read(argv), false))]; + case 11: return [2 /*return*/, _j.sent()]; + } + }); + }; + return Filter; + }()); + + var Value = /** @class */ (function () { + /** + * @param str the value to be valuated, eg.: "foobar" | truncate: 3 + */ + function Value(input, liquid) { + var _this = this; + this.filters = []; + var token = typeof input === 'string' + ? new Tokenizer(input, liquid.options.operators).readFilteredValue() + : input; + this.initial = token.initial; + this.filters = token.filters.map(function (token) { return new Filter(token, _this.getFilter(liquid, token.name), liquid); }); + } + Value.prototype.value = function (ctx, lenient) { + var val, _a, _b, filter, e_1_1; + var e_1, _c; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + lenient = lenient || (ctx.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === 'default'); + return [4 /*yield*/, this.initial.evaluate(ctx, lenient)]; + case 1: + val = _d.sent(); + _d.label = 2; + case 2: + _d.trys.push([2, 7, 8, 9]); + _a = __values(this.filters), _b = _a.next(); + _d.label = 3; + case 3: + if (!!_b.done) return [3 /*break*/, 6]; + filter = _b.value; + return [4 /*yield*/, filter.render(val, ctx)]; + case 4: + val = _d.sent(); + _d.label = 5; + case 5: + _b = _a.next(); + return [3 /*break*/, 3]; + case 6: return [3 /*break*/, 9]; + case 7: + e_1_1 = _d.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 9]; + case 8: + try { + if (_b && !_b.done && (_c = _a.return)) _c.call(_a); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 9: return [2 /*return*/, val]; + } + }); + }; + Value.prototype.getFilter = function (liquid, name) { + var impl = liquid.filters[name]; + assert(impl || !liquid.options.strictFilters, function () { return "undefined filter: ".concat(name); }); + return impl; + }; + return Value; + }()); + + var Output = /** @class */ (function (_super) { + __extends(Output, _super); + function Output(token, liquid) { + var _this = this; + var _a; + _this = _super.call(this, token) || this; + var tokenizer = new Tokenizer(token.input, liquid.options.operators, token.file, token.contentRange); + _this.value = new Value(tokenizer.readFilteredValue(), liquid); + var filters = _this.value.filters; + var outputEscape = liquid.options.outputEscape; + if (!((_a = filters[filters.length - 1]) === null || _a === void 0 ? void 0 : _a.raw) && outputEscape) { + var token_1 = new FilterToken(toString.call(outputEscape), [], '', 0, 0); + filters.push(new Filter(token_1, outputEscape, liquid)); + } + return _this; + } + Output.prototype.render = function (ctx, emitter) { + var val; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.value.value(ctx, false)]; + case 1: + val = _a.sent(); + emitter.write(val); + return [2 /*return*/]; + } + }); + }; + Output.prototype.arguments = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.value]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + return Output; + }(TemplateImpl)); + + var HTML = /** @class */ (function (_super) { + __extends(HTML, _super); + function HTML(token) { + var _this = _super.call(this, token) || this; + _this.str = token.getContent(); + return _this; + } + HTML.prototype.render = function (ctx, emitter) { + return __generator(this, function (_a) { + emitter.write(this.str); + return [2 /*return*/]; + }); + }; + return HTML; + }(TemplateImpl)); + + /** + * A variable's segments and location, which can be coerced to a string. + */ + var Variable = /** @class */ (function () { + function Variable(segments, location) { + this.segments = segments; + this.location = location; + } + Variable.prototype.toString = function () { + return segmentsString(this.segments, true); + }; + /** Return this variable's segments as an array, possibly with nested arrays for nested paths. */ + Variable.prototype.toArray = function () { + function _visit() { + var _i, segments_1, segments_1_1, segment, e_1_1; + var e_1, _a; + var segments = []; + for (_i = 0; _i < arguments.length; _i++) { + segments[_i] = arguments[_i]; + } + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + _b.trys.push([0, 7, 8, 9]); + segments_1 = __values(segments), segments_1_1 = segments_1.next(); + _b.label = 1; + case 1: + if (!!segments_1_1.done) return [3 /*break*/, 6]; + segment = segments_1_1.value; + if (!(segment instanceof Variable)) return [3 /*break*/, 3]; + return [4 /*yield*/, Array.from(_visit.apply(void 0, __spreadArray([], __read(segment.segments), false)))]; + case 2: + _b.sent(); + return [3 /*break*/, 5]; + case 3: return [4 /*yield*/, segment]; + case 4: + _b.sent(); + _b.label = 5; + case 5: + segments_1_1 = segments_1.next(); + return [3 /*break*/, 1]; + case 6: return [3 /*break*/, 9]; + case 7: + e_1_1 = _b.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 9]; + case 8: + try { + if (segments_1_1 && !segments_1_1.done && (_a = segments_1.return)) _a.call(segments_1); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 9: return [2 /*return*/]; + } + }); + } + return Array.from(_visit.apply(void 0, __spreadArray([], __read(this.segments), false))); + }; + return Variable; + }()); + /** + * Group variables by the string representation of their root segment. + */ + var VariableMap = /** @class */ (function () { + function VariableMap() { + this.map = new Map(); + } + VariableMap.prototype.get = function (key) { + var k = segmentsString([key.segments[0]]); + if (!this.map.has(k)) { + this.map.set(k, []); + } + return this.map.get(k); + }; + VariableMap.prototype.has = function (key) { + return this.map.has(segmentsString([key.segments[0]])); + }; + VariableMap.prototype.push = function (variable) { + this.get(variable).push(variable); + }; + VariableMap.prototype.asObject = function () { + return Object.fromEntries(this.map); + }; + return VariableMap; + }()); + var defaultStaticAnalysisOptions = { + partials: true + }; + function _analyze(templates, partials, sync) { + function updateVariables(variable, scope) { + var e_3, _a; + variables.push(variable); + var aliased = scope.alias(variable); + if (aliased !== undefined) { + var root = aliased.segments[0]; + // TODO: What if a a template renders a rendered template? Do we need scope.parent? + if (isString(root) && !rootScope.has(root)) { + globals.push(aliased); + } + } + else { + var root = variable.segments[0]; + if (isString(root) && !scope.has(root)) { + globals.push(variable); + } + } + try { + // Recurse for nested Variables + for (var _b = __values(variable.segments), _c = _b.next(); !_c.done; _c = _b.next()) { + var segment = _c.value; + if (segment instanceof Variable) { + updateVariables(segment, scope); + } + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_3) throw e_3.error; } + } + } + function visit(template, scope) { + var _a, _b, arg, _c, _d, variable, _e, _f, ident, _g, row, col, partial, _h, _j, child, e_4_1, partialScopeNames, partialScope, _k, _l, name_1, _m, alias, argument, variables_1, _o, _p, child, e_5_1, _q, _r, child, e_6_1; + var e_7, _s, e_8, _t, e_9, _u, e_4, _v, e_10, _w, e_5, _x, e_6, _y; + return __generator(this, function (_z) { + switch (_z.label) { + case 0: + if (template.arguments) { + try { + for (_a = __values(template.arguments()), _b = _a.next(); !_b.done; _b = _a.next()) { + arg = _b.value; + try { + for (_c = (e_8 = void 0, __values(extractVariables(arg))), _d = _c.next(); !_d.done; _d = _c.next()) { + variable = _d.value; + updateVariables(variable, scope); + } + } + catch (e_8_1) { e_8 = { error: e_8_1 }; } + finally { + try { + if (_d && !_d.done && (_t = _c.return)) _t.call(_c); + } + finally { if (e_8) throw e_8.error; } + } + } + } + catch (e_7_1) { e_7 = { error: e_7_1 }; } + finally { + try { + if (_b && !_b.done && (_s = _a.return)) _s.call(_a); + } + finally { if (e_7) throw e_7.error; } + } + } + if (template.localScope) { + try { + for (_e = __values(template.localScope()), _f = _e.next(); !_f.done; _f = _e.next()) { + ident = _f.value; + scope.add(ident.content); + scope.deleteAlias(ident.content); + _g = __read(ident.getPosition(), 2), row = _g[0], col = _g[1]; + locals.push(new Variable([ident.content], { row: row, col: col, file: ident.file })); + } + } + catch (e_9_1) { e_9 = { error: e_9_1 }; } + finally { + try { + if (_f && !_f.done && (_u = _e.return)) _u.call(_e); + } + finally { if (e_9) throw e_9.error; } + } + } + if (!template.children) return [3 /*break*/, 30]; + if (!template.partialScope) return [3 /*break*/, 20]; + partial = template.partialScope(); + if (!(partial === undefined)) return [3 /*break*/, 10]; + _z.label = 1; + case 1: + _z.trys.push([1, 7, 8, 9]); + return [4 /*yield*/, template.children(partials, sync)]; + case 2: + _h = __values.apply(void 0, [(_z.sent())]), _j = _h.next(); + _z.label = 3; + case 3: + if (!!_j.done) return [3 /*break*/, 6]; + child = _j.value; + return [4 /*yield*/, visit(child, scope)]; + case 4: + _z.sent(); + _z.label = 5; + case 5: + _j = _h.next(); + return [3 /*break*/, 3]; + case 6: return [3 /*break*/, 9]; + case 7: + e_4_1 = _z.sent(); + e_4 = { error: e_4_1 }; + return [3 /*break*/, 9]; + case 8: + try { + if (_j && !_j.done && (_v = _h.return)) _v.call(_h); + } + finally { if (e_4) throw e_4.error; } + return [7 /*endfinally*/]; + case 9: return [2 /*return*/]; + case 10: + if (seen.has(partial.name)) + return [2 /*return*/]; + partialScopeNames = new Set(); + partialScope = partial.isolated + ? new DummyScope(partialScopeNames) + : scope.push(partialScopeNames); + try { + for (_k = __values(partial.scope), _l = _k.next(); !_l.done; _l = _k.next()) { + name_1 = _l.value; + if (isString(name_1)) { + partialScopeNames.add(name_1); + } + else { + _m = __read(name_1, 2), alias = _m[0], argument = _m[1]; + partialScopeNames.add(alias); + variables_1 = Array.from(extractVariables(argument)); + if (variables_1.length) { + partialScope.setAlias(alias, variables_1[0].segments); + } + } + } + } + catch (e_10_1) { e_10 = { error: e_10_1 }; } + finally { + try { + if (_l && !_l.done && (_w = _k.return)) _w.call(_k); + } + finally { if (e_10) throw e_10.error; } + } + _z.label = 11; + case 11: + _z.trys.push([11, 17, 18, 19]); + return [4 /*yield*/, template.children(partials, sync)]; + case 12: + _o = __values.apply(void 0, [(_z.sent())]), _p = _o.next(); + _z.label = 13; + case 13: + if (!!_p.done) return [3 /*break*/, 16]; + child = _p.value; + return [4 /*yield*/, visit(child, partialScope)]; + case 14: + _z.sent(); + seen.add(partial.name); + _z.label = 15; + case 15: + _p = _o.next(); + return [3 /*break*/, 13]; + case 16: return [3 /*break*/, 19]; + case 17: + e_5_1 = _z.sent(); + e_5 = { error: e_5_1 }; + return [3 /*break*/, 19]; + case 18: + try { + if (_p && !_p.done && (_x = _o.return)) _x.call(_o); + } + finally { if (e_5) throw e_5.error; } + return [7 /*endfinally*/]; + case 19: + partialScope.pop(); + return [3 /*break*/, 30]; + case 20: + if (template.blockScope) { + scope.push(new Set(template.blockScope())); + } + _z.label = 21; + case 21: + _z.trys.push([21, 27, 28, 29]); + return [4 /*yield*/, template.children(partials, sync)]; + case 22: + _q = __values.apply(void 0, [(_z.sent())]), _r = _q.next(); + _z.label = 23; + case 23: + if (!!_r.done) return [3 /*break*/, 26]; + child = _r.value; + return [4 /*yield*/, visit(child, scope)]; + case 24: + _z.sent(); + _z.label = 25; + case 25: + _r = _q.next(); + return [3 /*break*/, 23]; + case 26: return [3 /*break*/, 29]; + case 27: + e_6_1 = _z.sent(); + e_6 = { error: e_6_1 }; + return [3 /*break*/, 29]; + case 28: + try { + if (_r && !_r.done && (_y = _q.return)) _y.call(_q); + } + finally { if (e_6) throw e_6.error; } + return [7 /*endfinally*/]; + case 29: + if (template.blockScope) { + scope.pop(); + } + _z.label = 30; + case 30: return [2 /*return*/]; + } + }); + } + var variables, globals, locals, rootScope, seen, templates_1, templates_1_1, template, e_2_1; + var e_2, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + variables = new VariableMap(); + globals = new VariableMap(); + locals = new VariableMap(); + rootScope = new DummyScope(new Set()); + seen = new Set(); + _b.label = 1; + case 1: + _b.trys.push([1, 6, 7, 8]); + templates_1 = __values(templates), templates_1_1 = templates_1.next(); + _b.label = 2; + case 2: + if (!!templates_1_1.done) return [3 /*break*/, 5]; + template = templates_1_1.value; + return [4 /*yield*/, visit(template, rootScope)]; + case 3: + _b.sent(); + _b.label = 4; + case 4: + templates_1_1 = templates_1.next(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 8]; + case 6: + e_2_1 = _b.sent(); + e_2 = { error: e_2_1 }; + return [3 /*break*/, 8]; + case 7: + try { + if (templates_1_1 && !templates_1_1.done && (_a = templates_1.return)) _a.call(templates_1); + } + finally { if (e_2) throw e_2.error; } + return [7 /*endfinally*/]; + case 8: return [2 /*return*/, { + variables: variables.asObject(), + globals: globals.asObject(), + locals: locals.asObject() + }]; + } + }); + } + /** + * Statically analyze a template and report variable usage. + */ + function analyze(template, options) { + if (options === void 0) { options = {}; } + var opts = __assign(__assign({}, defaultStaticAnalysisOptions), options); + return toPromise(_analyze(template, opts.partials, false)); + } + /** + * Statically analyze a template and report variable usage. + */ + function analyzeSync(template, options) { + if (options === void 0) { options = {}; } + var opts = __assign(__assign({}, defaultStaticAnalysisOptions), options); + return toValueSync(_analyze(template, opts.partials, true)); + } + /** + * A stack to manage scopes while traversing templates during static analysis. + */ + var DummyScope = /** @class */ (function () { + function DummyScope(globals) { + this.stack = [{ names: globals, aliases: new Map() }]; + } + /** Return true if `name` is in scope. */ + DummyScope.prototype.has = function (name) { + var e_11, _a; + try { + for (var _b = __values(this.stack), _c = _b.next(); !_c.done; _c = _b.next()) { + var scope = _c.value; + if (scope.names.has(name)) { + return true; + } + } + } + catch (e_11_1) { e_11 = { error: e_11_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_11) throw e_11.error; } + } + return false; + }; + DummyScope.prototype.push = function (scope) { + this.stack.push({ names: scope, aliases: new Map() }); + return this; + }; + DummyScope.prototype.pop = function () { + var _a; + return (_a = this.stack.pop()) === null || _a === void 0 ? void 0 : _a.names; + }; + // Add a name to the template scope. + DummyScope.prototype.add = function (name) { + this.stack[0].names.add(name); + }; + /** Return the variable that `variable` aliases, or `variable` if it doesn't alias anything. */ + DummyScope.prototype.alias = function (variable) { + var root = variable.segments[0]; + if (!isString(root)) + return undefined; + var alias = this.getAlias(root); + if (alias === undefined) + return undefined; + return new Variable(__spreadArray(__spreadArray([], __read(alias), false), __read(variable.segments.slice(1)), false), variable.location); + }; + // TODO: `from` could be a path with multiple segments, like `include.x`. + DummyScope.prototype.setAlias = function (from, to) { + this.stack[this.stack.length - 1].aliases.set(from, to); + }; + DummyScope.prototype.deleteAlias = function (name) { + this.stack[this.stack.length - 1].aliases.delete(name); + }; + DummyScope.prototype.getAlias = function (name) { + var e_12, _a; + try { + for (var _b = __values(this.stack), _c = _b.next(); !_c.done; _c = _b.next()) { + var scope = _c.value; + if (scope.aliases.has(name)) { + return scope.aliases.get(name); + } + // If a scope has defined `name`, then it masks aliases in parent scopes. + if (scope.names.has(name)) { + return undefined; + } + } + } + catch (e_12_1) { e_12 = { error: e_12_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_12) throw e_12.error; } + } + return undefined; + }; + return DummyScope; + }()); + function extractVariables(value) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!isValueToken(value)) return [3 /*break*/, 2]; + return [5 /*yield**/, __values(extractValueTokenVariables(value))]; + case 1: + _a.sent(); + return [3 /*break*/, 4]; + case 2: + if (!(value instanceof Value)) return [3 /*break*/, 4]; + return [5 /*yield**/, __values(extractFilteredValueVariables(value))]; + case 3: + _a.sent(); + _a.label = 4; + case 4: return [2 /*return*/]; + } + }); + } + function extractFilteredValueVariables(value) { + var _a, _b, token, e_13_1, _c, _d, filter, _e, _f, arg, e_14_1, e_15_1; + var e_13, _g, e_15, _h, e_14, _j; + return __generator(this, function (_k) { + switch (_k.label) { + case 0: + _k.trys.push([0, 5, 6, 7]); + _a = __values(value.initial.postfix), _b = _a.next(); + _k.label = 1; + case 1: + if (!!_b.done) return [3 /*break*/, 4]; + token = _b.value; + if (!isValueToken(token)) return [3 /*break*/, 3]; + return [5 /*yield**/, __values(extractValueTokenVariables(token))]; + case 2: + _k.sent(); + _k.label = 3; + case 3: + _b = _a.next(); + return [3 /*break*/, 1]; + case 4: return [3 /*break*/, 7]; + case 5: + e_13_1 = _k.sent(); + e_13 = { error: e_13_1 }; + return [3 /*break*/, 7]; + case 6: + try { + if (_b && !_b.done && (_g = _a.return)) _g.call(_a); + } + finally { if (e_13) throw e_13.error; } + return [7 /*endfinally*/]; + case 7: + _k.trys.push([7, 20, 21, 22]); + _c = __values(value.filters), _d = _c.next(); + _k.label = 8; + case 8: + if (!!_d.done) return [3 /*break*/, 19]; + filter = _d.value; + _k.label = 9; + case 9: + _k.trys.push([9, 16, 17, 18]); + _e = (e_14 = void 0, __values(filter.args)), _f = _e.next(); + _k.label = 10; + case 10: + if (!!_f.done) return [3 /*break*/, 15]; + arg = _f.value; + if (!(isKeyValuePair(arg) && arg[1])) return [3 /*break*/, 12]; + return [5 /*yield**/, __values(extractValueTokenVariables(arg[1]))]; + case 11: + _k.sent(); + return [3 /*break*/, 14]; + case 12: + if (!isValueToken(arg)) return [3 /*break*/, 14]; + return [5 /*yield**/, __values(extractValueTokenVariables(arg))]; + case 13: + _k.sent(); + _k.label = 14; + case 14: + _f = _e.next(); + return [3 /*break*/, 10]; + case 15: return [3 /*break*/, 18]; + case 16: + e_14_1 = _k.sent(); + e_14 = { error: e_14_1 }; + return [3 /*break*/, 18]; + case 17: + try { + if (_f && !_f.done && (_j = _e.return)) _j.call(_e); + } + finally { if (e_14) throw e_14.error; } + return [7 /*endfinally*/]; + case 18: + _d = _c.next(); + return [3 /*break*/, 8]; + case 19: return [3 /*break*/, 22]; + case 20: + e_15_1 = _k.sent(); + e_15 = { error: e_15_1 }; + return [3 /*break*/, 22]; + case 21: + try { + if (_d && !_d.done && (_h = _c.return)) _h.call(_c); + } + finally { if (e_15) throw e_15.error; } + return [7 /*endfinally*/]; + case 22: return [2 /*return*/]; + } + }); + } + function extractValueTokenVariables(token) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!isRangeToken(token)) return [3 /*break*/, 3]; + return [5 /*yield**/, __values(extractValueTokenVariables(token.lhs))]; + case 1: + _a.sent(); + return [5 /*yield**/, __values(extractValueTokenVariables(token.rhs))]; + case 2: + _a.sent(); + return [3 /*break*/, 5]; + case 3: + if (!isPropertyAccessToken(token)) return [3 /*break*/, 5]; + return [4 /*yield*/, extractPropertyAccessVariable(token)]; + case 4: + _a.sent(); + _a.label = 5; + case 5: return [2 /*return*/]; + } + }); + } + function extractPropertyAccessVariable(token) { + var e_16, _a; + var segments = []; + // token is not guaranteed to have `file` set. We'll try to get it from a prop if not. + var file = token.file; + // Here we're flattening the first segment of a path if it is a nested path. + var root = token.props[0]; + file = file || root.file; + if (isQuotedToken(root) || isNumberToken(root) || isWordToken(root)) { + segments.push(root.content); + } + else if (isPropertyAccessToken(root)) { + // Flatten paths that start with a nested path. + segments.push.apply(segments, __spreadArray([], __read(extractPropertyAccessVariable(root).segments), false)); + } + try { + for (var _b = __values(token.props.slice(1)), _c = _b.next(); !_c.done; _c = _b.next()) { + var prop = _c.value; + file = file || prop.file; + if (isQuotedToken(prop) || isNumberToken(prop) || isWordToken(prop)) { + segments.push(prop.content); + } + else if (isPropertyAccessToken(prop)) { + segments.push(extractPropertyAccessVariable(prop)); + } + } + } + catch (e_16_1) { e_16 = { error: e_16_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_16) throw e_16.error; } + } + var _d = __read(token.getPosition(), 2), row = _d[0], col = _d[1]; + return new Variable(segments, { + row: row, + col: col, + file: file + }); + } + // This is used to detect segments that can be represented with dot notation + // when creating a string representation of VariableSegments. + var RE_PROPERTY = /^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/; + /** + * Return a string representation of segments using dot notation where possible. + * @param segments - The property names and array indices that make up a path to a variable. + * @param bracketedRoot - If false (the default), don't surround the root segment with square brackets. + */ + function segmentsString(segments, bracketedRoot) { + var e_17, _a; + if (bracketedRoot === void 0) { bracketedRoot = false; } + var buf = []; + var root = segments[0]; + if (isString(root)) { + if (!bracketedRoot || root.match(RE_PROPERTY)) { + buf.push("".concat(root)); + } + else { + buf.push("['".concat(root, "']")); + } + } + try { + for (var _b = __values(segments.slice(1)), _c = _b.next(); !_c.done; _c = _b.next()) { + var segment = _c.value; + if (segment instanceof Variable) { + buf.push("[".concat(segmentsString(segment.segments), "]")); + } + else if (isString(segment)) { + if (segment.match(RE_PROPERTY)) { + buf.push(".".concat(segment)); + } + else { + buf.push("['".concat(segment, "']")); + } + } + else { + buf.push("[".concat(segment, "]")); + } + } + } + catch (e_17_1) { e_17 = { error: e_17_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_17) throw e_17.error; } + } + return buf.join(''); + } + + (function (LookupType) { + LookupType["Partials"] = "partials"; + LookupType["Layouts"] = "layouts"; + LookupType["Root"] = "root"; + })(exports.LookupType || (exports.LookupType = {})); + var Loader = /** @class */ (function () { + function Loader(options) { + var _this = this; + var _a, _b, _c, _d; + this.options = options; + if (options.relativeReference) { + var sep = options.fs.sep; + assert(sep, '`fs.sep` is required for relative reference'); + var prefixes_1 = ['.' + sep, '..' + sep, './', '../']; + this.shouldLoadRelative = function (referencedFile) { return prefixes_1.some(function (prefix) { return referencedFile.startsWith(prefix); }); }; + } + else { + this.shouldLoadRelative = function (_referencedFile) { return false; }; + } + var fs = options.fs; + this.contains = toLiquidAsync(((_a = fs.contains) === null || _a === void 0 ? void 0 : _a.bind(fs)) || (function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/, true]; + }); }); }), ((_b = fs.containsSync) === null || _b === void 0 ? void 0 : _b.bind(fs)) || (function () { return true; })); + this.exists = toLiquidAsync(((_c = fs.exists) === null || _c === void 0 ? void 0 : _c.bind(fs)) || (function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/, false]; + }); }); }), (_d = fs.existsSync) === null || _d === void 0 ? void 0 : _d.bind(fs)); + } + Loader.prototype.lookup = function (file, type, sync, currentFile) { + var dirs, _a, _b, filepath, allowed, dirs_1, dirs_1_1, dir, e_1_1, e_2_1; + var e_2, _c, e_1, _d; + return __generator(this, function (_e) { + switch (_e.label) { + case 0: + dirs = this.options[type]; + _e.label = 1; + case 1: + _e.trys.push([1, 14, 15, 16]); + _a = __values(this.candidates(file, dirs, currentFile)), _b = _a.next(); + _e.label = 2; + case 2: + if (!!_b.done) return [3 /*break*/, 13]; + filepath = _b.value; + allowed = false; + _e.label = 3; + case 3: + _e.trys.push([3, 8, 9, 10]); + dirs_1 = (e_1 = void 0, __values(dirs)), dirs_1_1 = dirs_1.next(); + _e.label = 4; + case 4: + if (!!dirs_1_1.done) return [3 /*break*/, 7]; + dir = dirs_1_1.value; + return [4 /*yield*/, this.contains(!!sync, dir, filepath)]; + case 5: + if (_e.sent()) { + allowed = true; + return [3 /*break*/, 7]; + } + _e.label = 6; + case 6: + dirs_1_1 = dirs_1.next(); + return [3 /*break*/, 4]; + case 7: return [3 /*break*/, 10]; + case 8: + e_1_1 = _e.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 10]; + case 9: + try { + if (dirs_1_1 && !dirs_1_1.done && (_d = dirs_1.return)) _d.call(dirs_1); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 10: + if (!allowed) + return [3 /*break*/, 12]; + return [4 /*yield*/, this.exists(!!sync, filepath)]; + case 11: + if (_e.sent()) + return [2 /*return*/, filepath]; + _e.label = 12; + case 12: + _b = _a.next(); + return [3 /*break*/, 2]; + case 13: return [3 /*break*/, 16]; + case 14: + e_2_1 = _e.sent(); + e_2 = { error: e_2_1 }; + return [3 /*break*/, 16]; + case 15: + try { + if (_b && !_b.done && (_c = _a.return)) _c.call(_a); + } + finally { if (e_2) throw e_2.error; } + return [7 /*endfinally*/]; + case 16: throw this.lookupError(file, dirs); + } + }); + }; + Loader.prototype.candidates = function (file, dirs, currentFile) { + var _a, fs, extname, referenced, dirs_2, dirs_2_1, dir, referenced, e_3_1, filepath; + var e_3, _b; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + _a = this.options, fs = _a.fs, extname = _a.extname; + if (!(this.shouldLoadRelative(file) && currentFile)) return [3 /*break*/, 2]; + referenced = fs.resolve(this.dirname(currentFile), file, extname); + return [4 /*yield*/, referenced]; + case 1: + _c.sent(); + _c.label = 2; + case 2: + _c.trys.push([2, 7, 8, 9]); + dirs_2 = __values(dirs), dirs_2_1 = dirs_2.next(); + _c.label = 3; + case 3: + if (!!dirs_2_1.done) return [3 /*break*/, 6]; + dir = dirs_2_1.value; + referenced = fs.resolve(dir, file, extname); + return [4 /*yield*/, referenced]; + case 4: + _c.sent(); + _c.label = 5; + case 5: + dirs_2_1 = dirs_2.next(); + return [3 /*break*/, 3]; + case 6: return [3 /*break*/, 9]; + case 7: + e_3_1 = _c.sent(); + e_3 = { error: e_3_1 }; + return [3 /*break*/, 9]; + case 8: + try { + if (dirs_2_1 && !dirs_2_1.done && (_b = dirs_2.return)) _b.call(dirs_2); + } + finally { if (e_3) throw e_3.error; } + return [7 /*endfinally*/]; + case 9: + if (!(fs.fallback !== undefined)) return [3 /*break*/, 11]; + filepath = fs.fallback(file); + if (!(filepath !== undefined)) return [3 /*break*/, 11]; + return [4 /*yield*/, filepath]; + case 10: + _c.sent(); + _c.label = 11; + case 11: return [2 /*return*/]; + } + }); + }; + Loader.prototype.dirname = function (path) { + var fs = this.options.fs; + assert(fs.dirname, '`fs.dirname` is required for relative reference'); + return fs.dirname(path); + }; + Loader.prototype.lookupError = function (file, roots) { + var err = new Error('ENOENT'); + err.message = "ENOENT: Failed to lookup \"".concat(file, "\" in \"").concat(roots, "\""); + err.code = 'ENOENT'; + return err; + }; + return Loader; + }()); + + var Parser = /** @class */ (function () { + function Parser(liquid) { + var _this = this; + var _a, _b; + this.liquid = liquid; + this.cache = this.liquid.options.cache; + this.fs = this.liquid.options.fs; + this.parseFile = this.cache ? this._parseFileCached : this._parseFile; + this.loader = new Loader(this.liquid.options); + this.parseLimit = new Limiter('parse length', liquid.options.parseLimit); + this.readFile = toLiquidAsync(((_a = this.fs.readFile) === null || _a === void 0 ? void 0 : _a.bind(this.fs)) || (function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + throw new Error('readFile not implemented'); + }); }); }), (_b = this.fs.readFileSync) === null || _b === void 0 ? void 0 : _b.bind(this.fs)); + } + Parser.prototype.parse = function (html, filepath) { + html = String(html); + this.parseLimit.use(html.length); + var tokenizer = new Tokenizer(html, this.liquid.options.operators, filepath); + var tokens = tokenizer.readTopLevelTokens(this.liquid.options); + return this.parseTokens(tokens); + }; + Parser.prototype.parseTokens = function (tokens) { + var token; + var templates = []; + var errors = []; + while ((token = tokens.shift())) { + try { + templates.push(this.parseToken(token, tokens)); + } + catch (err) { + if (this.liquid.options.catchAllErrors) + errors.push(err); + else + throw err; + } + } + if (errors.length) + throw new LiquidErrors(errors); + return templates; + }; + Parser.prototype.parseToken = function (token, remainTokens) { + try { + if (isTagToken(token)) { + var TagClass = this.liquid.tags[token.name]; + assert(TagClass, "tag \"".concat(token.name, "\" not found")); + return new TagClass(token, remainTokens, this.liquid, this); + } + if (isOutputToken(token)) { + return new Output(token, this.liquid); + } + return new HTML(token); + } + catch (e) { + if (LiquidError.is(e)) + throw e; + throw new ParseError(e, token); + } + }; + Parser.prototype.parseStream = function (tokens) { + var _this = this; + return new ParseStream(tokens, function (token, tokens) { return _this.parseToken(token, tokens); }); + }; + Parser.prototype._parseFileCached = function (file, sync, type, currentFile) { + var cache, key, tpls, task, taskOrTpl, _a, err_1; + if (type === void 0) { type = exports.LookupType.Root; } + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + cache = this.cache; + key = this.loader.shouldLoadRelative(file) ? currentFile + ',' + file : type + ':' + file; + return [4 /*yield*/, cache.read(key)]; + case 1: + tpls = _b.sent(); + if (tpls) + return [2 /*return*/, tpls]; + task = this._parseFile(file, sync, type, currentFile); + if (!sync) return [3 /*break*/, 3]; + return [4 /*yield*/, task]; + case 2: + _a = _b.sent(); + return [3 /*break*/, 4]; + case 3: + _a = toPromise(task); + _b.label = 4; + case 4: + taskOrTpl = _a; + cache.write(key, taskOrTpl); + _b.label = 5; + case 5: + _b.trys.push([5, 7, , 8]); + return [4 /*yield*/, taskOrTpl]; + case 6: return [2 /*return*/, _b.sent()]; + case 7: + err_1 = _b.sent(); + cache.remove(key); + throw err_1; + case 8: return [2 /*return*/]; + } + }); + }; + Parser.prototype._parseFile = function (file, sync, type, currentFile) { + var filepath, _a; + if (type === void 0) { type = exports.LookupType.Root; } + return __generator(this, function (_b) { + switch (_b.label) { + case 0: return [4 /*yield*/, this.loader.lookup(file, type, sync, currentFile)]; + case 1: + filepath = _b.sent(); + _a = this.parse; + return [4 /*yield*/, this.readFile(!!sync, filepath)]; + case 2: return [2 /*return*/, _a.apply(this, [_b.sent(), filepath])]; + } + }); + }; + return Parser; + }()); + + (function (TokenKind) { + TokenKind[TokenKind["Number"] = 1] = "Number"; + TokenKind[TokenKind["Literal"] = 2] = "Literal"; + TokenKind[TokenKind["Tag"] = 4] = "Tag"; + TokenKind[TokenKind["Output"] = 8] = "Output"; + TokenKind[TokenKind["HTML"] = 16] = "HTML"; + TokenKind[TokenKind["Filter"] = 32] = "Filter"; + TokenKind[TokenKind["Hash"] = 64] = "Hash"; + TokenKind[TokenKind["PropertyAccess"] = 128] = "PropertyAccess"; + TokenKind[TokenKind["Word"] = 256] = "Word"; + TokenKind[TokenKind["Range"] = 512] = "Range"; + TokenKind[TokenKind["Quoted"] = 1024] = "Quoted"; + TokenKind[TokenKind["Operator"] = 2048] = "Operator"; + TokenKind[TokenKind["FilteredValue"] = 4096] = "FilteredValue"; + TokenKind[TokenKind["Delimited"] = 12] = "Delimited"; + })(exports.TokenKind || (exports.TokenKind = {})); + + function isDelimitedToken(val) { + return !!(getKind(val) & exports.TokenKind.Delimited); + } + function isOperatorToken(val) { + return getKind(val) === exports.TokenKind.Operator; + } + function isHTMLToken(val) { + return getKind(val) === exports.TokenKind.HTML; + } + function isOutputToken(val) { + return getKind(val) === exports.TokenKind.Output; + } + function isTagToken(val) { + return getKind(val) === exports.TokenKind.Tag; + } + function isQuotedToken(val) { + return getKind(val) === exports.TokenKind.Quoted; + } + function isLiteralToken(val) { + return getKind(val) === exports.TokenKind.Literal; + } + function isNumberToken(val) { + return getKind(val) === exports.TokenKind.Number; + } + function isPropertyAccessToken(val) { + return getKind(val) === exports.TokenKind.PropertyAccess; + } + function isWordToken(val) { + return getKind(val) === exports.TokenKind.Word; + } + function isRangeToken(val) { + return getKind(val) === exports.TokenKind.Range; + } + function isValueToken(val) { + // valueTokenBitMask = TokenKind.Number | TokenKind.Literal | TokenKind.Quoted | TokenKind.PropertyAccess | TokenKind.Range + return (getKind(val) & 1667) > 0; + } + function getKind(val) { + return val ? val.kind : -1; + } + + var typeGuards = /*#__PURE__*/Object.freeze({ + __proto__: null, + isDelimitedToken: isDelimitedToken, + isOperatorToken: isOperatorToken, + isHTMLToken: isHTMLToken, + isOutputToken: isOutputToken, + isTagToken: isTagToken, + isQuotedToken: isQuotedToken, + isLiteralToken: isLiteralToken, + isNumberToken: isNumberToken, + isPropertyAccessToken: isPropertyAccessToken, + isWordToken: isWordToken, + isRangeToken: isRangeToken, + isValueToken: isValueToken + }); + + function createScope(from) { + var scope = Object.create(null); + if (from) + Object.assign(scope, from); + return scope; + } + + var Context = /** @class */ (function () { + function Context(env, opts, renderOptions, _a) { + if (env === void 0) { env = {}; } + if (opts === void 0) { opts = defaultOptions; } + if (renderOptions === void 0) { renderOptions = {}; } + var _b = _a === void 0 ? {} : _a, memoryLimit = _b.memoryLimit, renderLimit = _b.renderLimit; + var _c, _d, _e, _f, _g; + /** + * insert a Context-level empty scope, + * for tags like `{% capture %}` `{% assign %}` to operate + */ + this.scopes = [createScope()]; + this.registers = {}; + this.breakCalled = false; + this.continueCalled = false; + this.sync = !!renderOptions.sync; + this.opts = opts; + this.globals = (_c = renderOptions.globals) !== null && _c !== void 0 ? _c : opts.globals; + this.environments = isObject(env) ? env : Object(env); + this.strictVariables = (_d = renderOptions.strictVariables) !== null && _d !== void 0 ? _d : this.opts.strictVariables; + this.ownPropertyOnly = (_e = renderOptions.ownPropertyOnly) !== null && _e !== void 0 ? _e : opts.ownPropertyOnly; + this.memoryLimit = memoryLimit !== null && memoryLimit !== void 0 ? memoryLimit : new Limiter('memory alloc', (_f = renderOptions.memoryLimit) !== null && _f !== void 0 ? _f : opts.memoryLimit); + this.renderLimit = renderLimit !== null && renderLimit !== void 0 ? renderLimit : new Limiter('template render', getPerformance().now() + ((_g = renderOptions.renderLimit) !== null && _g !== void 0 ? _g : opts.renderLimit)); + } + Context.prototype.getRegister = function (key, defaultValue) { + if (defaultValue === void 0) { defaultValue = undefined; } + return (this.registers[key] = this.registers[key] || defaultValue); + }; + Context.prototype.setRegister = function (key, value) { + return (this.registers[key] = value); + }; + Context.prototype.saveRegister = function () { + var _this = this; + var keys = []; + for (var _i = 0; _i < arguments.length; _i++) { + keys[_i] = arguments[_i]; + } + return keys.map(function (key) { return [key, _this.getRegister(key)]; }); + }; + Context.prototype.restoreRegister = function (keyValues) { + var _this = this; + return keyValues.forEach(function (_a) { + var _b = __read(_a, 2), key = _b[0], value = _b[1]; + return _this.setRegister(key, value); + }); + }; + Context.prototype.getAll = function () { + return __spreadArray([this.globals, this.environments], __read(this.scopes), false).reduce(function (ctx, val) { return __assign(ctx, val); }, {}); + }; + /** + * @deprecated use `_get()` or `getSync()` instead + */ + Context.prototype.get = function (paths) { + return this.getSync(paths); + }; + Context.prototype.getSync = function (paths) { + return toValueSync(this._get(paths)); + }; + Context.prototype._get = function (paths) { + var scope; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + scope = this.findScope(paths[0]) // first prop should always be a string + ; + return [4 /*yield*/, this._getFromScope(scope, paths)]; + case 1: // first prop should always be a string + return [2 /*return*/, _a.sent()]; + } + }); + }; + /** + * @deprecated use `_get()` instead + */ + Context.prototype.getFromScope = function (scope, paths) { + return toValueSync(this._getFromScope(scope, paths)); + }; + Context.prototype._getFromScope = function (scope, paths, strictVariables) { + var i; + if (strictVariables === void 0) { strictVariables = this.strictVariables; } + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (isString(paths)) + paths = paths.split('.'); + i = 0; + _a.label = 1; + case 1: + if (!(i < paths.length)) return [3 /*break*/, 4]; + return [4 /*yield*/, this.readProperty(scope, paths[i])]; + case 2: + scope = _a.sent(); + if (strictVariables && isUndefined(scope)) { + throw new InternalUndefinedVariableError(paths.slice(0, i + 1).join('.')); + } + _a.label = 3; + case 3: + i++; + return [3 /*break*/, 1]; + case 4: return [2 /*return*/, scope]; + } + }); + }; + Context.prototype.push = function (ctx) { + return this.scopes.push(ctx); + }; + Context.prototype.pop = function () { + return this.scopes.pop(); + }; + Context.prototype.bottom = function () { + return this.scopes[0]; + }; + Context.prototype.spawn = function (scope) { + if (scope === void 0) { scope = {}; } + return new Context(scope, this.opts, { + sync: this.sync, + globals: this.globals, + strictVariables: this.strictVariables, + ownPropertyOnly: this.ownPropertyOnly + }, { + renderLimit: this.renderLimit, + memoryLimit: this.memoryLimit + }); + }; + Context.prototype.findScope = function (key) { + for (var i = this.scopes.length - 1; i >= 0; i--) { + var candidate = this.scopes[i]; + if (key in candidate) + return candidate; + } + if (key in this.environments) + return this.environments; + return this.globals; + }; + Context.prototype.readProperty = function (obj, key) { + obj = toLiquid(obj); + key = toValue(key); + if (isNil(obj)) + return obj; + if (isArray(obj) && isNumber(key)) + return readArrayElement(obj, key, this.ownPropertyOnly); + var value = readJSProperty(obj, key, this.ownPropertyOnly); + if (value === undefined && obj instanceof Drop) + return obj.liquidMethodMissing(key, this); + if (isFunction(value)) + return value.call(obj); + if (key === 'size') + return readSize(obj); + else if (key === 'first') + return readFirst(obj, this.ownPropertyOnly); + else if (key === 'last') + return readLast(obj, this.ownPropertyOnly); + return value; + }; + return Context; + }()); + function readJSProperty(obj, key, ownPropertyOnly) { + if (ownPropertyOnly && !hasOwnProperty.call(obj, key) && !(obj instanceof Drop)) + return undefined; + return obj[key]; + } + function readFirst(obj, ownPropertyOnly) { + if (isArray(obj)) + return readArrayElement(obj, 0, ownPropertyOnly); + return readJSProperty(obj, 'first', ownPropertyOnly); + } + function readLast(obj, ownPropertyOnly) { + if (isArray(obj)) + return readArrayElement(obj, -1, ownPropertyOnly); + return readJSProperty(obj, 'last', ownPropertyOnly); + } + function readSize(obj) { + if (hasOwnProperty.call(obj, 'size') || obj['size'] !== undefined) + return obj['size']; + if (isArray(obj) || isString(obj)) + return obj.length; + if (typeof obj === 'object') + return Object.keys(obj).length; + } + + var BlockMode; + (function (BlockMode) { + /* store rendered html into blocks */ + BlockMode[BlockMode["OUTPUT"] = 0] = "OUTPUT"; + /* output rendered html directly */ + BlockMode[BlockMode["STORE"] = 1] = "STORE"; + })(BlockMode || (BlockMode = {})); + + var abs = argumentsToNumber(Math.abs); + var at_least = argumentsToNumber(Math.max); + var at_most = argumentsToNumber(Math.min); + var ceil = argumentsToNumber(Math.ceil); + var divided_by = argumentsToNumber(function (dividend, divisor, integerArithmetic) { + if (integerArithmetic === void 0) { integerArithmetic = false; } + return integerArithmetic ? Math.floor(dividend / divisor) : dividend / divisor; + }); + var floor = argumentsToNumber(Math.floor); + var minus = argumentsToNumber(function (v, arg) { return v - arg; }); + var plus = argumentsToNumber(function (lhs, rhs) { return lhs + rhs; }); + var modulo = argumentsToNumber(function (v, arg) { return ((v % arg) + arg) % arg; }); + var times = argumentsToNumber(function (v, arg) { return v * arg; }); + function round(v, arg) { + if (arg === void 0) { arg = 0; } + v = toNumber(v); + arg = toNumber(arg); + var amp = Math.pow(10, arg); + var scaled = (v * amp) * (1 + Number.EPSILON); + return Math.round(scaled) / amp; + } + + var mathFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + abs: abs, + at_least: at_least, + at_most: at_most, + ceil: ceil, + divided_by: divided_by, + floor: floor, + minus: minus, + plus: plus, + modulo: modulo, + times: times, + round: round + }); + + var url_decode = function (x) { return decodeURIComponent(stringify(x)).replace(/\+/g, ' '); }; + var url_encode = function (x) { return encodeURIComponent(stringify(x)).replace(/%20/g, '+'); }; + var cgi_escape = function (x) { return encodeURIComponent(stringify(x)) + .replace(/%20/g, '+') + .replace(/[!'()*]/g, function (c) { return '%' + c.charCodeAt(0).toString(16).toUpperCase(); }); }; + var uri_escape = function (x) { return encodeURI(stringify(x)) + .replace(/%5B/g, '[') + .replace(/%5D/g, ']'); }; + var rSlugifyDefault = /[^\p{M}\p{L}\p{Nd}]+/ug; + var rSlugifyReplacers = { + 'raw': /\s+/g, + 'default': rSlugifyDefault, + 'pretty': /[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/ug, + 'ascii': /[^A-Za-z0-9]+/g, + 'latin': rSlugifyDefault, + 'none': null + }; + function slugify(str, mode, cased) { + if (mode === void 0) { mode = 'default'; } + if (cased === void 0) { cased = false; } + str = stringify(str); + var replacer = rSlugifyReplacers[mode]; + if (replacer) { + if (mode === 'latin') + str = removeAccents(str); + str = str.replace(replacer, '-').replace(/^-|-$/g, ''); + } + return cased ? str : str.toLowerCase(); + } + function removeAccents(str) { + return str.replace(/[àáâãäå]/g, 'a') + .replace(/[æ]/g, 'ae') + .replace(/[ç]/g, 'c') + .replace(/[èéêë]/g, 'e') + .replace(/[ìíîï]/g, 'i') + .replace(/[ð]/g, 'd') + .replace(/[ñ]/g, 'n') + .replace(/[òóôõöø]/g, 'o') + .replace(/[ùúûü]/g, 'u') + .replace(/[ýÿ]/g, 'y') + .replace(/[ß]/g, 'ss') + .replace(/[œ]/g, 'oe') + .replace(/[þ]/g, 'th') + .replace(/[ẞ]/g, 'SS') + .replace(/[Œ]/g, 'OE') + .replace(/[Þ]/g, 'TH'); + } + + var urlFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + url_decode: url_decode, + url_encode: url_encode, + cgi_escape: cgi_escape, + uri_escape: uri_escape, + slugify: slugify + }); + + var join = argumentsToValue(function (v, arg) { + var array = toArray(v); + var sep = isNil(arg) ? ' ' : stringify(arg); + var outputSize = sep.length * Math.max(array.length - 1, 0); + for (var i = 0; i < array.length; i++) + outputSize += String(array[i]).length; + this.context.memoryLimit.use(outputSize); + return Array.prototype.join.call(array, sep); + }); + var last$1 = argumentsToValue(function (v) { + return isArrayLike(v) ? readArrayElement(v, -1, this.context.ownPropertyOnly) : ''; + }); + var first = argumentsToValue(function (v) { + return isArrayLike(v) ? readArrayElement(v, 0, this.context.ownPropertyOnly) : ''; + }); + var reverse = argumentsToValue(function (v) { + var array = toArray(v); + this.context.memoryLimit.use(array.length); + return __spreadArray([], __read(array), false).reverse(); + }); + function sortBy(arr, property, comparator) { + var values, array, array_1, array_1_1, item, _a, _b, _c, _d, e_1_1; + var e_1, _e; + return __generator(this, function (_f) { + switch (_f.label) { + case 0: + values = []; + array = toArray(arr); + this.context.memoryLimit.use(array.length); + _f.label = 1; + case 1: + _f.trys.push([1, 8, 9, 10]); + array_1 = __values(array), array_1_1 = array_1.next(); + _f.label = 2; + case 2: + if (!!array_1_1.done) return [3 /*break*/, 7]; + item = array_1_1.value; + _b = (_a = values).push; + _c = [item]; + if (!property) return [3 /*break*/, 4]; + return [4 /*yield*/, this.context._getFromScope(item, stringify(property).split('.'), false)]; + case 3: + _d = _f.sent(); + return [3 /*break*/, 5]; + case 4: + _d = item; + _f.label = 5; + case 5: + _b.apply(_a, [_c.concat([ + _d + ])]); + _f.label = 6; + case 6: + array_1_1 = array_1.next(); + return [3 /*break*/, 2]; + case 7: return [3 /*break*/, 10]; + case 8: + e_1_1 = _f.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 10]; + case 9: + try { + if (array_1_1 && !array_1_1.done && (_e = array_1.return)) _e.call(array_1); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 10: return [2 /*return*/, values.sort(function (lhs, rhs) { return comparator(lhs[1], rhs[1]); }).map(function (tuple) { return tuple[0]; })]; + } + }); + } + function sort(arr, property) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(sortBy.call(this, arr, property, orderedCompare))]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + } + function sort_natural(arr, property) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(sortBy.call(this, arr, property, caseInsensitiveCompare))]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + } + var size = function (v) { return (v && v.length) || 0; }; + function map(arr, property) { + var results, array, array_2, array_2_1, item, _a, _b, e_2_1; + var e_2, _c; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + results = []; + array = toArray(arr); + this.context.memoryLimit.use(array.length); + _d.label = 1; + case 1: + _d.trys.push([1, 6, 7, 8]); + array_2 = __values(array), array_2_1 = array_2.next(); + _d.label = 2; + case 2: + if (!!array_2_1.done) return [3 /*break*/, 5]; + item = array_2_1.value; + _b = (_a = results).push; + return [4 /*yield*/, this.context._getFromScope(item, stringify(property), false)]; + case 3: + _b.apply(_a, [_d.sent()]); + _d.label = 4; + case 4: + array_2_1 = array_2.next(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 8]; + case 6: + e_2_1 = _d.sent(); + e_2 = { error: e_2_1 }; + return [3 /*break*/, 8]; + case 7: + try { + if (array_2_1 && !array_2_1.done && (_c = array_2.return)) _c.call(array_2); + } + finally { if (e_2) throw e_2.error; } + return [7 /*endfinally*/]; + case 8: return [2 /*return*/, results]; + } + }); + } + function sum(arr, property) { + var sum, array, array_3, array_3_1, item, data, _a, _b, e_3_1; + var e_3, _c; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + sum = 0; + array = toArray(arr); + _d.label = 1; + case 1: + _d.trys.push([1, 8, 9, 10]); + array_3 = __values(array), array_3_1 = array_3.next(); + _d.label = 2; + case 2: + if (!!array_3_1.done) return [3 /*break*/, 7]; + item = array_3_1.value; + _a = Number; + if (!property) return [3 /*break*/, 4]; + return [4 /*yield*/, this.context._getFromScope(item, stringify(property), false)]; + case 3: + _b = _d.sent(); + return [3 /*break*/, 5]; + case 4: + _b = item; + _d.label = 5; + case 5: + data = _a.apply(void 0, [_b]); + sum += Number.isNaN(data) ? 0 : data; + _d.label = 6; + case 6: + array_3_1 = array_3.next(); + return [3 /*break*/, 2]; + case 7: return [3 /*break*/, 10]; + case 8: + e_3_1 = _d.sent(); + e_3 = { error: e_3_1 }; + return [3 /*break*/, 10]; + case 9: + try { + if (array_3_1 && !array_3_1.done && (_c = array_3.return)) _c.call(array_3); + } + finally { if (e_3) throw e_3.error; } + return [7 /*endfinally*/]; + case 10: return [2 /*return*/, sum]; + } + }); + } + function compact(arr) { + var array = toArray(arr); + this.context.memoryLimit.use(array.length); + return Array.prototype.filter.call(array, function (x) { return !isNil(toValue(x)); }); + } + function concat(v, arg) { + if (arg === void 0) { arg = []; } + var lhs = toArray(v); + var rhs = toArray(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return Array.prototype.concat.call(lhs, rhs); + } + function push(v, arg) { + return concat.call(this, v, [arg]); + } + function unshift(v, arg) { + var array = toArray(v); + this.context.memoryLimit.use(array.length); + var clone = __spreadArray([], __read(array), false); + clone.unshift(arg); + return clone; + } + function pop(v) { + var array = toArray(v); + this.context.memoryLimit.use(array.length); + var clone = __spreadArray([], __read(array), false); + clone.pop(); + return clone; + } + function shift(v) { + var array = toArray(v); + this.context.memoryLimit.use(array.length); + var clone = __spreadArray([], __read(array), false); + clone.shift(); + return clone; + } + function slice(v, begin, length) { + if (length === void 0) { length = 1; } + v = toValue(v); + if (isNil(v)) + return []; + if (!isArray(v)) + v = stringify(v); + begin = begin < 0 ? v.length + begin : begin; + if (begin < 0 || length < 0) + return isArray(v) ? [] : ''; + this.context.memoryLimit.use(length); + return isArray(v) + ? Array.prototype.slice.call(v, begin, begin + length) + : String.prototype.slice.call(v, begin, begin + length); + } + function expectedMatcher(expected) { + var _this = this; + if (this.context.opts.jekyllWhere) { + return function (v) { return EmptyDrop.is(expected) ? equals(v, expected) : (isArray(v) ? arrayIncludes(v, expected) : equals(v, expected)); }; + } + else if (expected === undefined) { + return function (v) { return isTruthy(v, _this.context); }; + } + else { + return function (v) { return equals(v, expected); }; + } + } + function filter(include, arr, property, expected) { + var values, token, arr_1, arr_1_1, item, _a, _b, e_4_1, matcher; + var e_4, _c; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + values = []; + arr = toArray(arr); + this.context.memoryLimit.use(arr.length); + token = new Tokenizer(stringify(property)).readScopeValue(); + _d.label = 1; + case 1: + _d.trys.push([1, 6, 7, 8]); + arr_1 = __values(arr), arr_1_1 = arr_1.next(); + _d.label = 2; + case 2: + if (!!arr_1_1.done) return [3 /*break*/, 5]; + item = arr_1_1.value; + _b = (_a = values).push; + return [4 /*yield*/, evalToken(token, this.context.spawn(item))]; + case 3: + _b.apply(_a, [_d.sent()]); + _d.label = 4; + case 4: + arr_1_1 = arr_1.next(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 8]; + case 6: + e_4_1 = _d.sent(); + e_4 = { error: e_4_1 }; + return [3 /*break*/, 8]; + case 7: + try { + if (arr_1_1 && !arr_1_1.done && (_c = arr_1.return)) _c.call(arr_1); + } + finally { if (e_4) throw e_4.error; } + return [7 /*endfinally*/]; + case 8: + matcher = expectedMatcher.call(this, expected); + return [2 /*return*/, Array.prototype.filter.call(arr, function (_, i) { return matcher(values[i]) === include; })]; + } + }); + } + function filter_exp(include, arr, itemName, exp) { + var filtered, keyTemplate, array, array_4, array_4_1, item, value, e_5_1; + var e_5, _a, _b; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + filtered = []; + keyTemplate = new Value(stringify(exp), this.liquid); + array = toArray(arr); + this.context.memoryLimit.use(array.length); + _c.label = 1; + case 1: + _c.trys.push([1, 6, 7, 8]); + array_4 = __values(array), array_4_1 = array_4.next(); + _c.label = 2; + case 2: + if (!!array_4_1.done) return [3 /*break*/, 5]; + item = array_4_1.value; + this.context.push((_b = {}, _b[itemName] = item, _b)); + return [4 /*yield*/, keyTemplate.value(this.context)]; + case 3: + value = _c.sent(); + this.context.pop(); + if (value === include) + filtered.push(item); + _c.label = 4; + case 4: + array_4_1 = array_4.next(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 8]; + case 6: + e_5_1 = _c.sent(); + e_5 = { error: e_5_1 }; + return [3 /*break*/, 8]; + case 7: + try { + if (array_4_1 && !array_4_1.done && (_a = array_4.return)) _a.call(array_4); + } + finally { if (e_5) throw e_5.error; } + return [7 /*endfinally*/]; + case 8: return [2 /*return*/, filtered]; + } + }); + } + function where(arr, property, expected) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(filter.call(this, true, arr, property, expected))]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + } + function reject(arr, property, expected) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(filter.call(this, false, arr, property, expected))]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + } + function where_exp(arr, itemName, exp) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(filter_exp.call(this, true, arr, itemName, exp))]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + } + function reject_exp(arr, itemName, exp) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(filter_exp.call(this, false, arr, itemName, exp))]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + } + function group_by(arr, property) { + var map, token, arr_2, arr_2_1, item, key, e_6_1; + var e_6, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + map = new Map(); + arr = toEnumerable(arr); + token = new Tokenizer(stringify(property)).readScopeValue(); + this.context.memoryLimit.use(arr.length); + _b.label = 1; + case 1: + _b.trys.push([1, 6, 7, 8]); + arr_2 = __values(arr), arr_2_1 = arr_2.next(); + _b.label = 2; + case 2: + if (!!arr_2_1.done) return [3 /*break*/, 5]; + item = arr_2_1.value; + return [4 /*yield*/, evalToken(token, this.context.spawn(item))]; + case 3: + key = _b.sent(); + if (!map.has(key)) + map.set(key, []); + map.get(key).push(item); + _b.label = 4; + case 4: + arr_2_1 = arr_2.next(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 8]; + case 6: + e_6_1 = _b.sent(); + e_6 = { error: e_6_1 }; + return [3 /*break*/, 8]; + case 7: + try { + if (arr_2_1 && !arr_2_1.done && (_a = arr_2.return)) _a.call(arr_2); + } + finally { if (e_6) throw e_6.error; } + return [7 /*endfinally*/]; + case 8: return [2 /*return*/, __spreadArray([], __read(map.entries()), false).map(function (_a) { + var _b = __read(_a, 2), name = _b[0], items = _b[1]; + return ({ name: name, items: items }); + })]; + } + }); + } + function group_by_exp(arr, itemName, exp) { + var map, keyTemplate, arr_3, arr_3_1, item, key, e_7_1; + var e_7, _a, _b; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + map = new Map(); + keyTemplate = new Value(stringify(exp), this.liquid); + arr = toEnumerable(arr); + this.context.memoryLimit.use(arr.length); + _c.label = 1; + case 1: + _c.trys.push([1, 6, 7, 8]); + arr_3 = __values(arr), arr_3_1 = arr_3.next(); + _c.label = 2; + case 2: + if (!!arr_3_1.done) return [3 /*break*/, 5]; + item = arr_3_1.value; + this.context.push((_b = {}, _b[itemName] = item, _b)); + return [4 /*yield*/, keyTemplate.value(this.context)]; + case 3: + key = _c.sent(); + this.context.pop(); + if (!map.has(key)) + map.set(key, []); + map.get(key).push(item); + _c.label = 4; + case 4: + arr_3_1 = arr_3.next(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 8]; + case 6: + e_7_1 = _c.sent(); + e_7 = { error: e_7_1 }; + return [3 /*break*/, 8]; + case 7: + try { + if (arr_3_1 && !arr_3_1.done && (_a = arr_3.return)) _a.call(arr_3); + } + finally { if (e_7) throw e_7.error; } + return [7 /*endfinally*/]; + case 8: return [2 /*return*/, __spreadArray([], __read(map.entries()), false).map(function (_a) { + var _b = __read(_a, 2), name = _b[0], items = _b[1]; + return ({ name: name, items: items }); + })]; + } + }); + } + function search(arr, property, expected) { + var token, array, matcher, index, value; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + token = new Tokenizer(stringify(property)).readScopeValue(); + array = toArray(arr); + matcher = expectedMatcher.call(this, expected); + index = 0; + _a.label = 1; + case 1: + if (!(index < array.length)) return [3 /*break*/, 4]; + return [4 /*yield*/, evalToken(token, this.context.spawn(array[index]))]; + case 2: + value = _a.sent(); + if (matcher(value)) + return [2 /*return*/, [index, array[index]]]; + _a.label = 3; + case 3: + index++; + return [3 /*break*/, 1]; + case 4: return [2 /*return*/]; + } + }); + } + function search_exp(arr, itemName, exp) { + var predicate, array, index, value; + var _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + predicate = new Value(stringify(exp), this.liquid); + array = toArray(arr); + index = 0; + _b.label = 1; + case 1: + if (!(index < array.length)) return [3 /*break*/, 4]; + this.context.push((_a = {}, _a[itemName] = array[index], _a)); + return [4 /*yield*/, predicate.value(this.context)]; + case 2: + value = _b.sent(); + this.context.pop(); + if (value) + return [2 /*return*/, [index, array[index]]]; + _b.label = 3; + case 3: + index++; + return [3 /*break*/, 1]; + case 4: return [2 /*return*/]; + } + }); + } + function has(arr, property, expected) { + var result; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(search.call(this, arr, property, expected))]; + case 1: + result = _a.sent(); + return [2 /*return*/, !!result]; + } + }); + } + function has_exp(arr, itemName, exp) { + var result; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(search_exp.call(this, arr, itemName, exp))]; + case 1: + result = _a.sent(); + return [2 /*return*/, !!result]; + } + }); + } + function find_index(arr, property, expected) { + var result; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(search.call(this, arr, property, expected))]; + case 1: + result = _a.sent(); + return [2 /*return*/, result ? result[0] : undefined]; + } + }); + } + function find_index_exp(arr, itemName, exp) { + var result; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(search_exp.call(this, arr, itemName, exp))]; + case 1: + result = _a.sent(); + return [2 /*return*/, result ? result[0] : undefined]; + } + }); + } + function find(arr, property, expected) { + var result; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(search.call(this, arr, property, expected))]; + case 1: + result = _a.sent(); + return [2 /*return*/, result ? result[1] : undefined]; + } + }); + } + function find_exp(arr, itemName, exp) { + var result; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(search_exp.call(this, arr, itemName, exp))]; + case 1: + result = _a.sent(); + return [2 /*return*/, result ? result[1] : undefined]; + } + }); + } + function uniq(arr) { + arr = toArray(arr); + this.context.memoryLimit.use(arr.length); + return __spreadArray([], __read(new Set(arr)), false); + } + function sample(v, count) { + if (count === void 0) { count = 1; } + v = toValue(v); + if (isNil(v)) + return []; + if (!isArray(v)) + v = stringify(v); + this.context.memoryLimit.use(v.length); + var shuffled = __spreadArray([], __read(v), false).sort(function () { return Math.random() - 0.5; }); + if (count === 1) + return shuffled[0]; + return shuffled.slice(0, count); + } + + var arrayFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + join: join, + last: last$1, + first: first, + reverse: reverse, + sort: sort, + sort_natural: sort_natural, + size: size, + map: map, + sum: sum, + compact: compact, + concat: concat, + push: push, + unshift: unshift, + pop: pop, + shift: shift, + slice: slice, + where: where, + reject: reject, + where_exp: where_exp, + reject_exp: reject_exp, + group_by: group_by, + group_by_exp: group_by_exp, + has: has, + has_exp: has_exp, + find_index: find_index, + find_index_exp: find_index_exp, + find: find, + find_exp: find_exp, + uniq: uniq, + sample: sample + }); + + function date(v, format, timezoneOffset) { + var _a, _b; + var size = ((_a = v === null || v === void 0 ? void 0 : v.length) !== null && _a !== void 0 ? _a : 0) + ((_b = timezoneOffset === null || timezoneOffset === void 0 ? void 0 : timezoneOffset.length) !== null && _b !== void 0 ? _b : 0); + this.context.memoryLimit.use(size); + var date = parseDate(v, this.context.opts, timezoneOffset); + if (!date) + return v; + format = toValue(format); + format = isNil(format) ? this.context.opts.dateFormat : stringify(format); + this.context.memoryLimit.use(format.length); + return strftime(date, format, this.context.memoryLimit); + } + function date_to_xmlschema(v) { + return date.call(this, v, '%Y-%m-%dT%H:%M:%S%:z'); + } + function date_to_rfc822(v) { + return date.call(this, v, '%a, %d %b %Y %H:%M:%S %z'); + } + function date_to_string(v, type, style) { + return stringify_date.call(this, v, '%b', type, style); + } + function date_to_long_string(v, type, style) { + return stringify_date.call(this, v, '%B', type, style); + } + function stringify_date(v, month_type, type, style) { + var date = parseDate(v, this.context.opts); + if (!date) + return v; + var ml = this.context.memoryLimit; + if (type === 'ordinal') { + var d = date.getDate(); + return style === 'US' + ? strftime(date, "".concat(month_type, " ").concat(d, "%q, %Y"), ml) + : strftime(date, "".concat(d, "%q ").concat(month_type, " %Y"), ml); + } + return strftime(date, "%d ".concat(month_type, " %Y"), ml); + } + function parseDate(v, opts, timezoneOffset) { + var date; + var defaultTimezoneOffset = timezoneOffset !== null && timezoneOffset !== void 0 ? timezoneOffset : opts.timezoneOffset; + var locale = opts.locale; + v = toValue(v); + if (isNil(v)) { + return undefined; + } + else if (v === 'now' || v === 'today') { + date = new LiquidDate(Date.now(), locale, defaultTimezoneOffset); + } + else if (isNumber(v)) { + date = new LiquidDate(v * 1000, locale, defaultTimezoneOffset); + } + else if (isString(v)) { + if (/^\d+$/.test(v)) { + date = new LiquidDate(+v * 1000, locale, defaultTimezoneOffset); + } + else if (opts.preserveTimezones && timezoneOffset === undefined) { + date = LiquidDate.createDateFixedToTimezone(v, locale); + } + else { + date = new LiquidDate(v, locale, defaultTimezoneOffset); + } + } + else { + date = new LiquidDate(v, locale, defaultTimezoneOffset); + } + return date.valid() ? date : undefined; + } + + var dateFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + date: date, + date_to_xmlschema: date_to_xmlschema, + date_to_rfc822: date_to_rfc822, + date_to_string: date_to_string, + date_to_long_string: date_to_long_string + }); + + /** + * String related filters + * + * * prefer stringify() to String() since `undefined`, `null` should eval '' + */ + var rCJKWord = /[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/gu; + // Word boundary followed by word characters (for detecting words) + var rNonCJKWord = /[^\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF\s]+/gu; + function append(v, arg) { + assert(arguments.length === 2, 'append expect 2 arguments'); + var lhs = stringify(v); + var rhs = stringify(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return lhs + rhs; + } + function prepend(v, arg) { + assert(arguments.length === 2, 'prepend expect 2 arguments'); + var lhs = stringify(v); + var rhs = stringify(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return rhs + lhs; + } + function lstrip(v, chars) { + var str = stringify(v); + this.context.memoryLimit.use(str.length); + if (chars) { + chars = stringify(chars); + this.context.memoryLimit.use(chars.length); + for (var i = 0, set = new Set(chars); i < str.length; i++) { + if (!set.has(str[i])) + return str.slice(i); + } + return ''; + } + return str.trimStart(); + } + function downcase(v) { + var str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.toLowerCase(); + } + function upcase(v) { + var str = stringify(v); + this.context.memoryLimit.use(str.length); + return stringify(str).toUpperCase(); + } + function remove(v, arg) { + var str = stringify(v); + arg = stringify(arg); + this.context.memoryLimit.use(str.length + arg.length); + return str.split(arg).join(''); + } + function remove_first(v, l) { + var str = stringify(v); + l = stringify(l); + this.context.memoryLimit.use(str.length + l.length); + return str.replace(l, ''); + } + function remove_last(v, l) { + var str = stringify(v); + var pattern = stringify(l); + this.context.memoryLimit.use(str.length + pattern.length); + var index = str.lastIndexOf(pattern); + if (index === -1) + return str; + return str.substring(0, index) + str.substring(index + pattern.length); + } + function rstrip(str, chars) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + if (chars) { + chars = stringify(chars); + this.context.memoryLimit.use(chars.length); + for (var i = str.length - 1, set = new Set(chars); i >= 0; i--) { + if (!set.has(str[i])) + return str.slice(0, i + 1); + } + return ''; + } + return str.trimEnd(); + } + function split(v, arg) { + var str = stringify(v); + this.context.memoryLimit.use(str.length); + var arr = str.split(stringify(arg)); + // align to ruby split, which is the behavior of shopify/liquid + // see: https://ruby-doc.org/core-2.4.0/String.html#method-i-split + while (arr.length && arr[arr.length - 1] === '') + arr.pop(); + return arr; + } + function strip(v, chars) { + var str = stringify(v); + this.context.memoryLimit.use(str.length); + if (chars) { + var set = new Set(stringify(chars)); + this.context.memoryLimit.use(set.size); + var i = 0; + var j = str.length - 1; + while (set.has(str[i])) + i++; + while (j >= i && set.has(str[j])) + j--; + return str.slice(i, j + 1); + } + return str.trim(); + } + function strip_newlines(v) { + var str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\r?\n/gm, ''); + } + function capitalize(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); + } + function replace(v, pattern, replacement) { + var str = stringify(v); + pattern = stringify(pattern); + replacement = stringify(replacement); + var parts = str.split(pattern); + var outputSize = str.length + (parts.length - 1) * (replacement.length - pattern.length); + this.context.memoryLimit.use(outputSize); + return parts.join(replacement); + } + function replace_first(v, arg1, arg2) { + var str = stringify(v); + arg1 = stringify(arg1); + arg2 = stringify(arg2); + this.context.memoryLimit.use(str.length + arg1.length + arg2.length); + return str.replace(arg1, function () { return arg2; }); + } + function replace_last(v, arg1, arg2) { + var str = stringify(v); + var pattern = stringify(arg1); + var replacement = stringify(arg2); + this.context.memoryLimit.use(str.length + pattern.length + replacement.length); + var index = str.lastIndexOf(pattern); + if (index === -1) + return str; + return str.substring(0, index) + replacement + str.substring(index + pattern.length); + } + function truncate(v, l, o) { + if (l === void 0) { l = 50; } + if (o === void 0) { o = '...'; } + var str = stringify(v); + o = stringify(o); + this.context.memoryLimit.use(str.length + o.length); + if (str.length <= l) + return v; + return str.substring(0, l - o.length) + o; + } + function truncatewords(v, words, o) { + if (words === void 0) { words = 15; } + if (o === void 0) { o = '...'; } + var str = stringify(v); + o = stringify(o); + this.context.memoryLimit.use(str.length + o.length); + var arr = str.split(/\s+/); + if (words <= 0) + words = 1; + var ret = arr.slice(0, words).join(' '); + if (arr.length >= words) + ret += o; + return ret; + } + function normalize_whitespace(v) { + var str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\s+/g, ' '); + } + function number_of_words(input, mode) { + var str = stringify(input); + this.context.memoryLimit.use(str.length); + input = str.trim(); + if (!input) + return 0; + switch (mode) { + case 'cjk': + // Count CJK characters and words + return (input.match(rCJKWord) || []).length + (input.match(rNonCJKWord) || []).length; + case 'auto': + // Count CJK characters, if none, count words + return rCJKWord.test(input) + ? input.match(rCJKWord).length + (input.match(rNonCJKWord) || []).length + : input.split(/\s+/).length; + default: + // Count words only + return input.split(/\s+/).length; + } + } + function array_to_sentence_string(array, connector) { + if (connector === void 0) { connector = 'and'; } + connector = stringify(connector); + var outputSize = connector.length + array.length * 2; + for (var i = 0; i < array.length; i++) + outputSize += stringify(array[i]).length; + this.context.memoryLimit.use(outputSize); + switch (array.length) { + case 0: + return ''; + case 1: + return array[0]; + case 2: + return "".concat(array[0], " ").concat(connector, " ").concat(array[1]); + default: + return "".concat(array.slice(0, -1).join(', '), ", ").concat(connector, " ").concat(array[array.length - 1]); + } + } + + var stringFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + append: append, + prepend: prepend, + lstrip: lstrip, + downcase: downcase, + upcase: upcase, + remove: remove, + remove_first: remove_first, + remove_last: remove_last, + rstrip: rstrip, + split: split, + strip: strip, + strip_newlines: strip_newlines, + capitalize: capitalize, + replace: replace, + replace_first: replace_first, + replace_last: replace_last, + truncate: truncate, + truncatewords: truncatewords, + normalize_whitespace: normalize_whitespace, + number_of_words: number_of_words, + array_to_sentence_string: array_to_sentence_string + }); + + function base64Encode(str) { + return btoa(String.fromCharCode.apply(String, __spreadArray([], __read(new TextEncoder().encode(str)), false))); + } + function base64Decode(str) { + return new TextDecoder().decode(Uint8Array.from(atob(str), function (c) { return c.charCodeAt(0); })); + } + + /** + * Base64 related filters + * + * Implements base64_encode and base64_decode filters for Shopify compatibility + */ + function base64_encode(value) { + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { + this.context.memoryLimit.use(value.byteLength); + return value.toString('base64'); + } + var str = stringify(value); + this.context.memoryLimit.use(str.length); + return base64Encode(str); + } + function base64_decode(value) { + var str = stringify(value); + this.context.memoryLimit.use(str.length); + return base64Decode(str); + } + + var base64Filters = /*#__PURE__*/Object.freeze({ + __proto__: null, + base64_encode: base64_encode, + base64_decode: base64_decode + }); + + function bufferToHex(buffer) { + var bytes = new Uint8Array(buffer); + var hex = ''; + for (var i = 0; i < bytes.length; i++) { + hex += bytes[i].toString(16).padStart(2, '0'); + } + return hex; + } + function sha256(str) { + return __awaiter(this, void 0, void 0, function () { + var data, digest; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + data = new TextEncoder().encode(str); + return [4 /*yield*/, crypto.subtle.digest('SHA-256', data)]; + case 1: + digest = _a.sent(); + return [2 /*return*/, bufferToHex(digest)]; + } + }); + }); + } + function hmacSha256(str, key) { + return __awaiter(this, void 0, void 0, function () { + var encoder, cryptoKey, signature; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + encoder = new TextEncoder(); + return [4 /*yield*/, crypto.subtle.importKey('raw', encoder.encode(key), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])]; + case 1: + cryptoKey = _a.sent(); + return [4 /*yield*/, crypto.subtle.sign('HMAC', cryptoKey, encoder.encode(str))]; + case 2: + signature = _a.sent(); + return [2 /*return*/, bufferToHex(signature)]; + } + }); + }); + } + + /** + * Crypto related filters + * + * Implements sha256 and hmac_sha256 filters for Shopify compatibility + */ + function sha256$1(value) { + var str = stringify(value); + this.context.memoryLimit.use(str.length); + return sha256(str); + } + function hmac_sha256(value, key) { + var str = stringify(value); + var keyStr = stringify(key); + this.context.memoryLimit.use(str.length + keyStr.length); + return hmacSha256(str, keyStr); + } + + var cryptoFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + sha256: sha256$1, + hmac_sha256: hmac_sha256 + }); + + var filters = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, htmlFilters), mathFilters), urlFilters), arrayFilters), dateFilters), stringFilters), base64Filters), cryptoFilters), misc); + + var default_1 = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(token, remainTokens, liquid) { + var _this = _super.call(this, token, remainTokens, liquid) || this; + _this.identifier = _this.tokenizer.readIdentifier(); + _this.key = _this.identifier.content; + _this.tokenizer.assert(_this.key, 'expected variable name'); + _this.tokenizer.skipBlank(); + _this.tokenizer.assert(_this.tokenizer.peek() === '=', 'expected "="'); + _this.tokenizer.advance(); + _this.value = new Value(_this.tokenizer.readFilteredValue(), _this.liquid); + return _this; + } + default_1.prototype.render = function (ctx) { + var _a, _b; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + _a = ctx.bottom(); + _b = this.key; + return [4 /*yield*/, this.value.value(ctx, this.liquid.options.lenientIf)]; + case 1: + _a[_b] = _c.sent(); + return [2 /*return*/]; + } + }); + }; + default_1.prototype.arguments = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.value]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + default_1.prototype.localScope = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.identifier]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + return default_1; + }(Tag)); + + var MODIFIERS = ['offset', 'limit', 'reversed']; + var default_1$1 = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(token, remainTokens, liquid, parser) { + var _this = _super.call(this, token, remainTokens, liquid) || this; + var variable = _this.tokenizer.readIdentifier(); + var inStr = _this.tokenizer.readIdentifier(); + var collection = _this.tokenizer.readValue(); + if (!variable.size() || inStr.content !== 'in' || !collection) { + throw new Error("illegal tag: ".concat(token.getText())); + } + _this.variable = variable.content; + _this.collection = collection; + _this.hash = new Hash(_this.tokenizer, liquid.options.keyValueSeparator); + _this.templates = []; + _this.elseTemplates = []; + var p; + var stream = parser.parseStream(remainTokens) + .on('start', function () { return (p = _this.templates); }) + .on('tag:else', function (tag) { assertEmpty(tag.args); p = _this.elseTemplates; }) + .on('tag:endfor', function (tag) { assertEmpty(tag.args); stream.stop(); }) + .on('template', function (tpl) { return p.push(tpl); }) + .on('end', function () { throw new Error("tag ".concat(token.getText(), " not closed")); }); + stream.start(); + return _this; + } + default_1.prototype.render = function (ctx, emitter) { + var r, collection, _a, continueKey, hash, modifiers, scope, collection_1, collection_1_1, item, e_1_1; + var e_1, _b; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + r = this.liquid.renderer; + _a = toEnumerable; + return [4 /*yield*/, evalToken(this.collection, ctx)]; + case 1: + collection = _a.apply(void 0, [_c.sent()]); + if (!!collection.length) return [3 /*break*/, 3]; + return [4 /*yield*/, r.renderTemplates(this.elseTemplates, ctx, emitter)]; + case 2: + _c.sent(); + return [2 /*return*/]; + case 3: + continueKey = 'continue-' + this.variable + '-' + this.collection.getText(); + ctx.push(createScope({ continue: ctx.getRegister(continueKey, {}) })); + return [4 /*yield*/, this.hash.render(ctx)]; + case 4: + hash = (_c.sent()); + ctx.pop(); + modifiers = this.liquid.options.orderedFilterParameters + ? Object.keys(hash).filter(function (x) { return MODIFIERS.includes(x); }) + : MODIFIERS.filter(function (x) { return hash[x] !== undefined; }); + collection = modifiers.reduce(function (collection, modifier) { + if (modifier === 'offset') + return offset(collection, hash['offset']); + if (modifier === 'limit') + return limit(collection, hash['limit']); + return reversed(collection); + }, collection); + ctx.setRegister(continueKey, (hash['offset'] || 0) + collection.length); + scope = createScope({ forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) }); + ctx.push(scope); + _c.label = 5; + case 5: + _c.trys.push([5, 10, 11, 12]); + collection_1 = __values(collection), collection_1_1 = collection_1.next(); + _c.label = 6; + case 6: + if (!!collection_1_1.done) return [3 /*break*/, 9]; + item = collection_1_1.value; + scope[this.variable] = item; + ctx.continueCalled = ctx.breakCalled = false; + return [4 /*yield*/, r.renderTemplates(this.templates, ctx, emitter)]; + case 7: + _c.sent(); + if (ctx.breakCalled) + return [3 /*break*/, 9]; + scope.forloop.next(); + _c.label = 8; + case 8: + collection_1_1 = collection_1.next(); + return [3 /*break*/, 6]; + case 9: return [3 /*break*/, 12]; + case 10: + e_1_1 = _c.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 12]; + case 11: + try { + if (collection_1_1 && !collection_1_1.done && (_b = collection_1.return)) _b.call(collection_1); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 12: + ctx.continueCalled = ctx.breakCalled = false; + ctx.pop(); + return [2 /*return*/]; + } + }); + }; + default_1.prototype.children = function () { + var templates; + return __generator(this, function (_a) { + templates = this.templates.slice(); + if (this.elseTemplates) { + templates.push.apply(templates, __spreadArray([], __read(this.elseTemplates), false)); + } + return [2 /*return*/, templates]; + }); + }; + default_1.prototype.arguments = function () { + var _a, _b, v, e_2_1; + var e_2, _c; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: return [4 /*yield*/, this.collection]; + case 1: + _d.sent(); + _d.label = 2; + case 2: + _d.trys.push([2, 7, 8, 9]); + _a = __values(Object.values(this.hash.hash)), _b = _a.next(); + _d.label = 3; + case 3: + if (!!_b.done) return [3 /*break*/, 6]; + v = _b.value; + if (!isValueToken(v)) return [3 /*break*/, 5]; + return [4 /*yield*/, v]; + case 4: + _d.sent(); + _d.label = 5; + case 5: + _b = _a.next(); + return [3 /*break*/, 3]; + case 6: return [3 /*break*/, 9]; + case 7: + e_2_1 = _d.sent(); + e_2 = { error: e_2_1 }; + return [3 /*break*/, 9]; + case 8: + try { + if (_b && !_b.done && (_c = _a.return)) _c.call(_a); + } + finally { if (e_2) throw e_2.error; } + return [7 /*endfinally*/]; + case 9: return [2 /*return*/]; + } + }); + }; + default_1.prototype.blockScope = function () { + return [this.variable, 'forloop']; + }; + return default_1; + }(Tag)); + function reversed(arr) { + return __spreadArray([], __read(arr), false).reverse(); + } + function offset(arr, count) { + return arr.slice(count); + } + function limit(arr, count) { + return arr.slice(0, count); + } + + var default_1$2 = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(tagToken, remainTokens, liquid, parser) { + var _this = _super.call(this, tagToken, remainTokens, liquid) || this; + _this.templates = []; + _this.identifier = _this.readVariable(); + _this.variable = _this.identifier.content; + while (remainTokens.length) { + var token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endcapture') + return _this; + _this.templates.push(parser.parseToken(token, remainTokens)); + } + throw new Error("tag ".concat(tagToken.getText(), " not closed")); + } + default_1.prototype.readVariable = function () { + var ident = this.tokenizer.readIdentifier(); + if (ident.content) + return ident; + ident = this.tokenizer.readQuoted(); + if (ident) + return ident; + throw this.tokenizer.error('invalid capture name'); + }; + default_1.prototype.render = function (ctx) { + var r, html; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + r = this.liquid.renderer; + return [4 /*yield*/, r.renderTemplates(this.templates, ctx)]; + case 1: + html = _a.sent(); + ctx.bottom()[this.variable] = html; + return [2 /*return*/]; + } + }); + }; + default_1.prototype.children = function () { + return __generator(this, function (_a) { + return [2 /*return*/, this.templates]; + }); + }; + default_1.prototype.localScope = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.identifier]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + return default_1; + }(Tag)); + + var default_1$3 = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(tagToken, remainTokens, liquid, parser) { + var _this = _super.call(this, tagToken, remainTokens, liquid) || this; + _this.branches = []; + _this.elseTemplates = []; + _this.value = new Value(_this.tokenizer.readFilteredValue(), _this.liquid); + _this.elseTemplates = []; + var p = []; + var elseCount = 0; + var stream = parser.parseStream(remainTokens) + .on('tag:when', function (token) { + if (elseCount > 0) { + return; + } + p = []; + var values = []; + while (!token.tokenizer.end()) { + values.push(token.tokenizer.readValueOrThrow()); + token.tokenizer.skipBlank(); + if (token.tokenizer.peek() === ',') { + token.tokenizer.readTo(','); + } + else { + token.tokenizer.readTo('or'); + } + } + _this.branches.push({ + values: values, + templates: p + }); + }) + .on('tag:else', function () { + elseCount++; + p = _this.elseTemplates; + }) + .on('tag:endcase', function () { return stream.stop(); }) + .on('template', function (tpl) { + if (p !== _this.elseTemplates || elseCount === 1) { + p.push(tpl); + } + }) + .on('end', function () { + throw new Error("tag ".concat(tagToken.getText(), " not closed")); + }); + stream.start(); + return _this; + } + default_1.prototype.render = function (ctx, emitter) { + var r, target, _a, branchHit, _b, _c, branch, _d, _e, valueToken, value, e_1_1, e_2_1; + var e_2, _f, e_1, _g; + return __generator(this, function (_h) { + switch (_h.label) { + case 0: + r = this.liquid.renderer; + _a = toValue; + return [4 /*yield*/, this.value.value(ctx, ctx.opts.lenientIf)]; + case 1: + target = _a.apply(void 0, [_h.sent()]); + branchHit = false; + _h.label = 2; + case 2: + _h.trys.push([2, 14, 15, 16]); + _b = __values(this.branches), _c = _b.next(); + _h.label = 3; + case 3: + if (!!_c.done) return [3 /*break*/, 13]; + branch = _c.value; + _h.label = 4; + case 4: + _h.trys.push([4, 10, 11, 12]); + _d = (e_1 = void 0, __values(branch.values)), _e = _d.next(); + _h.label = 5; + case 5: + if (!!_e.done) return [3 /*break*/, 9]; + valueToken = _e.value; + return [4 /*yield*/, evalToken(valueToken, ctx, ctx.opts.lenientIf)]; + case 6: + value = _h.sent(); + if (!equals(target, value)) return [3 /*break*/, 8]; + return [4 /*yield*/, r.renderTemplates(branch.templates, ctx, emitter)]; + case 7: + _h.sent(); + branchHit = true; + return [3 /*break*/, 9]; + case 8: + _e = _d.next(); + return [3 /*break*/, 5]; + case 9: return [3 /*break*/, 12]; + case 10: + e_1_1 = _h.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 12]; + case 11: + try { + if (_e && !_e.done && (_g = _d.return)) _g.call(_d); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 12: + _c = _b.next(); + return [3 /*break*/, 3]; + case 13: return [3 /*break*/, 16]; + case 14: + e_2_1 = _h.sent(); + e_2 = { error: e_2_1 }; + return [3 /*break*/, 16]; + case 15: + try { + if (_c && !_c.done && (_f = _b.return)) _f.call(_b); + } + finally { if (e_2) throw e_2.error; } + return [7 /*endfinally*/]; + case 16: + if (!!branchHit) return [3 /*break*/, 18]; + return [4 /*yield*/, r.renderTemplates(this.elseTemplates, ctx, emitter)]; + case 17: + _h.sent(); + _h.label = 18; + case 18: return [2 /*return*/]; + } + }); + }; + default_1.prototype.arguments = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.value]; + case 1: + _a.sent(); + return [5 /*yield**/, __values(this.branches.flatMap(function (b) { return b.values; }))]; + case 2: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + default_1.prototype.children = function () { + var templates; + return __generator(this, function (_a) { + templates = this.branches.flatMap(function (b) { return b.templates; }); + if (this.elseTemplates) { + templates.push.apply(templates, __spreadArray([], __read(this.elseTemplates), false)); + } + return [2 /*return*/, templates]; + }); + }; + return default_1; + }(Tag)); + + var default_1$4 = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(tagToken, remainTokens, liquid) { + var _this = _super.call(this, tagToken, remainTokens, liquid) || this; + while (remainTokens.length) { + var token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endcomment') + return _this; + } + throw new Error("tag ".concat(tagToken.getText(), " not closed")); + } + default_1.prototype.render = function () { }; + return default_1; + }(Tag)); + + var default_1$5 = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(token, remainTokens, liquid, parser) { + var _this = _super.call(this, token, remainTokens, liquid) || this; + var tokenizer = _this.tokenizer; + _this.file = parseFilePath(tokenizer, _this.liquid, parser); + _this.currentFile = token.file; + while (!tokenizer.end()) { + tokenizer.skipBlank(); + var begin = tokenizer.p; + var keyword = tokenizer.readIdentifier(); + if (keyword.content === 'with' || keyword.content === 'for') { + tokenizer.skipBlank(); + // can be normal key/value pair, like "with: true" + if (tokenizer.peek() !== ':') { + var value = tokenizer.readValue(); + // can be normal key, like "with," + if (value) { + var beforeAs = tokenizer.p; + var asStr = tokenizer.readIdentifier(); + var alias = void 0; + if (asStr.content === 'as') + alias = tokenizer.readIdentifier(); + else + tokenizer.p = beforeAs; + var binding = { value: value, alias: alias && alias.content }; + if (keyword.content === 'with') + _this.with = binding; + else + _this.forBinding = binding; + tokenizer.skipBlank(); + if (tokenizer.peek() === ',') + tokenizer.advance(); + continue; // matched! + } + } + } + /** + * restore cursor if with/for not matched + */ + tokenizer.p = begin; + break; + } + _this.hash = new Hash(tokenizer, liquid.options.keyValueSeparator); + return _this; + } + default_1.prototype.render = function (ctx, emitter) { + var _a, liquid, hash, filepath, childCtx, scope, _b, _c, _d, value, alias, _e, _f, _g, value, alias, collection, _h, collection_1, collection_1_1, item, templates, e_1_1, templates; + var e_1, _j; + return __generator(this, function (_k) { + switch (_k.label) { + case 0: + _a = this, liquid = _a.liquid, hash = _a.hash; + return [4 /*yield*/, renderFilePath(this.file, ctx, liquid)]; + case 1: + filepath = (_k.sent()); + assert(filepath, function () { return "illegal file path \"".concat(filepath, "\""); }); + childCtx = ctx.spawn(); + scope = childCtx.bottom(); + _b = __assign; + _c = [scope]; + return [4 /*yield*/, hash.render(ctx)]; + case 2: + _b.apply(void 0, _c.concat([_k.sent()])); + if (!this.with) return [3 /*break*/, 4]; + _d = this.with, value = _d.value, alias = _d.alias; + _e = scope; + _f = alias || filepath; + return [4 /*yield*/, evalToken(value, ctx)]; + case 3: + _e[_f] = _k.sent(); + _k.label = 4; + case 4: + if (!this.forBinding) return [3 /*break*/, 15]; + _g = this.forBinding, value = _g.value, alias = _g.alias; + _h = toEnumerable; + return [4 /*yield*/, evalToken(value, ctx)]; + case 5: + collection = _h.apply(void 0, [_k.sent()]); + scope['forloop'] = new ForloopDrop(collection.length, value.getText(), alias); + _k.label = 6; + case 6: + _k.trys.push([6, 12, 13, 14]); + collection_1 = __values(collection), collection_1_1 = collection_1.next(); + _k.label = 7; + case 7: + if (!!collection_1_1.done) return [3 /*break*/, 11]; + item = collection_1_1.value; + scope[alias] = item; + return [4 /*yield*/, liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)]; + case 8: + templates = (_k.sent()); + return [4 /*yield*/, liquid.renderer.renderTemplates(templates, childCtx, emitter)]; + case 9: + _k.sent(); + scope['forloop'].next(); + _k.label = 10; + case 10: + collection_1_1 = collection_1.next(); + return [3 /*break*/, 7]; + case 11: return [3 /*break*/, 14]; + case 12: + e_1_1 = _k.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 14]; + case 13: + try { + if (collection_1_1 && !collection_1_1.done && (_j = collection_1.return)) _j.call(collection_1); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 14: return [3 /*break*/, 18]; + case 15: return [4 /*yield*/, liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)]; + case 16: + templates = (_k.sent()); + return [4 /*yield*/, liquid.renderer.renderTemplates(templates, childCtx, emitter)]; + case 17: + _k.sent(); + _k.label = 18; + case 18: return [2 /*return*/]; + } + }); + }; + default_1.prototype.children = function (partials, sync) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(partials && isString(this.file))) return [3 /*break*/, 2]; + return [4 /*yield*/, this.liquid._parsePartialFile(this.file, sync, this.currentFile)]; + case 1: return [2 /*return*/, (_a.sent())]; + case 2: return [2 /*return*/, []]; + } + }); + }; + default_1.prototype.partialScope = function () { + if (isString(this.file)) { + var names = Object.keys(this.hash.hash); + if (this.with) { + var _a = this.with, value = _a.value, alias = _a.alias; + if (isString(alias)) { + names.push([alias, value]); + } + else if (isString(this.file)) { + names.push([this.file, value]); + } + } + if (this.forBinding) { + var _b = this.forBinding, value = _b.value, alias = _b.alias; + if (isString(alias)) { + names.push([alias, value]); + } + else if (isString(this.file)) { + names.push([this.file, value]); + } + } + return { name: this.file, isolated: true, scope: names }; + } + }; + default_1.prototype.arguments = function () { + var _a, _b, v, e_2_1, value, value; + var e_2, _c; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + _d.trys.push([0, 5, 6, 7]); + _a = __values(Object.values(this.hash.hash)), _b = _a.next(); + _d.label = 1; + case 1: + if (!!_b.done) return [3 /*break*/, 4]; + v = _b.value; + if (!isValueToken(v)) return [3 /*break*/, 3]; + return [4 /*yield*/, v]; + case 2: + _d.sent(); + _d.label = 3; + case 3: + _b = _a.next(); + return [3 /*break*/, 1]; + case 4: return [3 /*break*/, 7]; + case 5: + e_2_1 = _d.sent(); + e_2 = { error: e_2_1 }; + return [3 /*break*/, 7]; + case 6: + try { + if (_b && !_b.done && (_c = _a.return)) _c.call(_a); + } + finally { if (e_2) throw e_2.error; } + return [7 /*endfinally*/]; + case 7: + if (!this.with) return [3 /*break*/, 9]; + value = this.with.value; + if (!isValueToken(value)) return [3 /*break*/, 9]; + return [4 /*yield*/, value]; + case 8: + _d.sent(); + _d.label = 9; + case 9: + if (!this.forBinding) return [3 /*break*/, 11]; + value = this.forBinding.value; + if (!isValueToken(value)) return [3 /*break*/, 11]; + return [4 /*yield*/, value]; + case 10: + _d.sent(); + _d.label = 11; + case 11: return [2 /*return*/]; + } + }); + }; + return default_1; + }(Tag)); + /** + * @return null for "none", + * @return Template[] for quoted with tags and/or filters + * @return Token for expression (not quoted) + * @throws TypeError if cannot read next token + */ + function parseFilePath(tokenizer, liquid, parser) { + if (liquid.options.dynamicPartials) { + var file = tokenizer.readValue(); + tokenizer.assert(file, 'illegal file path'); + if (file.getText() === 'none') + return; + if (isQuotedToken(file)) { + // for filenames like "files/{{file}}", eval as liquid template + var templates_1 = parser.parse(evalQuotedToken(file)); + return optimize(templates_1); + } + return file; + } + var tokens = __spreadArray([], __read(tokenizer.readFileNameTemplate(liquid.options)), false); + var templates = optimize(parser.parseTokens(tokens)); + return templates === 'none' ? undefined : templates; + } + function optimize(templates) { + // for filenames like "files/file.liquid", extract the string directly + if (templates.length === 1 && isHTMLToken(templates[0].token)) + return templates[0].token.getContent(); + return templates; + } + function renderFilePath(file, ctx, liquid) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (typeof file === 'string') + return [2 /*return*/, file]; + if (Array.isArray(file)) + return [2 /*return*/, liquid.renderer.renderTemplates(file, ctx)]; + return [4 /*yield*/, evalToken(file, ctx)]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); + } + + var default_1$6 = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(token, remainTokens, liquid, parser) { + var _this = _super.call(this, token, remainTokens, liquid) || this; + var tokenizer = token.tokenizer; + _this.file = parseFilePath(tokenizer, _this.liquid, parser); + _this.currentFile = token.file; + var begin = tokenizer.p; + var withStr = tokenizer.readIdentifier(); + if (withStr.content === 'with') { + tokenizer.skipBlank(); + if (tokenizer.peek() !== ':') { + _this.withVar = tokenizer.readValue(); + } + else + tokenizer.p = begin; + } + else + tokenizer.p = begin; + _this.hash = new Hash(tokenizer, liquid.options.jekyllInclude || liquid.options.keyValueSeparator); + return _this; + } + default_1.prototype.render = function (ctx, emitter) { + var _a, liquid, hash, withVar, renderer, filepath, saved, scope, _b, _c, _d, templates; + return __generator(this, function (_e) { + switch (_e.label) { + case 0: + _a = this, liquid = _a.liquid, hash = _a.hash, withVar = _a.withVar; + renderer = liquid.renderer; + return [4 /*yield*/, renderFilePath(this.file, ctx, liquid)]; + case 1: + filepath = (_e.sent()); + assert(filepath, function () { return "illegal file path \"".concat(filepath, "\""); }); + saved = ctx.saveRegister('blocks', 'blockMode'); + ctx.setRegister('blocks', {}); + ctx.setRegister('blockMode', BlockMode.OUTPUT); + _b = createScope; + return [4 /*yield*/, hash.render(ctx)]; + case 2: + scope = _b.apply(void 0, [(_e.sent())]); + if (!withVar) return [3 /*break*/, 4]; + _c = scope; + _d = filepath; + return [4 /*yield*/, evalToken(withVar, ctx)]; + case 3: + _c[_d] = _e.sent(); + _e.label = 4; + case 4: return [4 /*yield*/, liquid._parsePartialFile(filepath, ctx.sync, this.currentFile)]; + case 5: + templates = (_e.sent()); + ctx.push(ctx.opts.jekyllInclude ? createScope({ include: scope }) : scope); + return [4 /*yield*/, renderer.renderTemplates(templates, ctx, emitter)]; + case 6: + _e.sent(); + ctx.pop(); + ctx.restoreRegister(saved); + return [2 /*return*/]; + } + }); + }; + default_1.prototype.children = function (partials, sync) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!(partials && isString(this.file))) return [3 /*break*/, 2]; + return [4 /*yield*/, this.liquid._parsePartialFile(this.file, sync, this.currentFile)]; + case 1: return [2 /*return*/, (_a.sent())]; + case 2: return [2 /*return*/, []]; + } + }); + }; + default_1.prototype.partialScope = function () { + if (isString(this.file)) { + var names = void 0; + if (this.liquid.options.jekyllInclude) { + names = ['include']; + } + else { + names = Object.keys(this.hash.hash); + if (this.withVar) { + names.push([this.file, this.withVar]); + } + } + return { name: this.file, isolated: false, scope: names }; + } + }; + default_1.prototype.arguments = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(Object.values(this.hash.hash).filter(isValueToken))]; + case 1: + _a.sent(); + if (!isValueToken(this.file)) return [3 /*break*/, 3]; + return [4 /*yield*/, this.file]; + case 2: + _a.sent(); + _a.label = 3; + case 3: + if (!isValueToken(this.withVar)) return [3 /*break*/, 5]; + return [4 /*yield*/, this.withVar]; + case 4: + _a.sent(); + _a.label = 5; + case 5: return [2 /*return*/]; + } + }); + }; + return default_1; + }(Tag)); + + var default_1$7 = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(token, remainTokens, liquid) { + var _this = _super.call(this, token, remainTokens, liquid) || this; + _this.identifier = _this.tokenizer.readIdentifier(); + _this.variable = _this.identifier.content; + return _this; + } + default_1.prototype.render = function (context, emitter) { + var scope = context.environments; + if (!isNumber(scope[this.variable])) { + scope[this.variable] = 0; + } + emitter.write(stringify(--scope[this.variable])); + }; + default_1.prototype.localScope = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.identifier]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + return default_1; + }(Tag)); + + var default_1$8 = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(token, remainTokens, liquid) { + var _this = _super.call(this, token, remainTokens, liquid) || this; + _this.candidates = []; + var group = _this.tokenizer.readValue(); + _this.tokenizer.skipBlank(); + if (group) { + if (_this.tokenizer.peek() === ':') { + _this.group = group; + _this.tokenizer.advance(); + } + else + _this.candidates.push(group); + } + while (!_this.tokenizer.end()) { + var value = _this.tokenizer.readValue(); + if (value) + _this.candidates.push(value); + _this.tokenizer.readTo(','); + } + _this.tokenizer.assert(_this.candidates.length, function () { return "empty candidates: \"".concat(token.getText(), "\""); }); + return _this; + } + default_1.prototype.render = function (ctx, emitter) { + var group, fingerprint, groups, idx, candidate; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, evalToken(this.group, ctx)]; + case 1: + group = (_a.sent()); + fingerprint = "cycle:".concat(group, ":") + this.candidates.join(','); + groups = ctx.getRegister('cycle', {}); + idx = groups[fingerprint]; + if (idx === undefined) { + idx = groups[fingerprint] = 0; + } + candidate = this.candidates[idx]; + idx = (idx + 1) % this.candidates.length; + groups[fingerprint] = idx; + return [4 /*yield*/, evalToken(candidate, ctx)]; + case 2: return [2 /*return*/, _a.sent()]; + } + }); + }; + default_1.prototype.arguments = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [5 /*yield**/, __values(this.candidates)]; + case 1: + _a.sent(); + if (!this.group) return [3 /*break*/, 3]; + return [4 /*yield*/, this.group]; + case 2: + _a.sent(); + _a.label = 3; + case 3: return [2 /*return*/]; + } + }); + }; + return default_1; + }(Tag)); + + var default_1$9 = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(tagToken, remainTokens, liquid, parser) { + var _this = _super.call(this, tagToken, remainTokens, liquid) || this; + _this.branches = []; + var p = []; + parser.parseStream(remainTokens) + .on('start', function () { return _this.branches.push({ + value: new Value(tagToken.tokenizer.readFilteredValue(), _this.liquid), + templates: (p = []) + }); }) + .on('tag:elsif', function (token) { + assert(!_this.elseTemplates, 'unexpected elsif after else'); + _this.branches.push({ + value: new Value(token.tokenizer.readFilteredValue(), _this.liquid), + templates: (p = []) + }); + }) + .on('tag:else', function (tag) { + assertEmpty(tag.args); + assert(!_this.elseTemplates, 'duplicated else'); + p = _this.elseTemplates = []; + }) + .on('tag:endif', function (tag) { assertEmpty(tag.args); this.stop(); }) + .on('template', function (tpl) { return p.push(tpl); }) + .on('end', function () { throw new Error("tag ".concat(tagToken.getText(), " not closed")); }) + .start(); + return _this; + } + default_1.prototype.render = function (ctx, emitter) { + var r, _a, _b, _c, value, templates, v, e_1_1; + var e_1, _d; + return __generator(this, function (_e) { + switch (_e.label) { + case 0: + r = this.liquid.renderer; + _e.label = 1; + case 1: + _e.trys.push([1, 7, 8, 9]); + _a = __values(this.branches), _b = _a.next(); + _e.label = 2; + case 2: + if (!!_b.done) return [3 /*break*/, 6]; + _c = _b.value, value = _c.value, templates = _c.templates; + return [4 /*yield*/, value.value(ctx, ctx.opts.lenientIf)]; + case 3: + v = _e.sent(); + if (!isTruthy(v, ctx)) return [3 /*break*/, 5]; + return [4 /*yield*/, r.renderTemplates(templates, ctx, emitter)]; + case 4: + _e.sent(); + return [2 /*return*/]; + case 5: + _b = _a.next(); + return [3 /*break*/, 2]; + case 6: return [3 /*break*/, 9]; + case 7: + e_1_1 = _e.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 9]; + case 8: + try { + if (_b && !_b.done && (_d = _a.return)) _d.call(_a); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 9: return [4 /*yield*/, r.renderTemplates(this.elseTemplates || [], ctx, emitter)]; + case 10: + _e.sent(); + return [2 /*return*/]; + } + }); + }; + default_1.prototype.children = function () { + var templates; + return __generator(this, function (_a) { + templates = this.branches.flatMap(function (b) { return b.templates; }); + if (this.elseTemplates) { + templates.push.apply(templates, __spreadArray([], __read(this.elseTemplates), false)); + } + return [2 /*return*/, templates]; + }); + }; + default_1.prototype.arguments = function () { + return this.branches.map(function (b) { return b.value; }); + }; + return default_1; + }(Tag)); + + var default_1$a = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(token, remainTokens, liquid) { + var _this = _super.call(this, token, remainTokens, liquid) || this; + _this.identifier = _this.tokenizer.readIdentifier(); + _this.variable = _this.identifier.content; + return _this; + } + default_1.prototype.render = function (context, emitter) { + var scope = context.environments; + if (!isNumber(scope[this.variable])) { + scope[this.variable] = 0; + } + var val = scope[this.variable]; + scope[this.variable]++; + emitter.write(stringify(val)); + }; + default_1.prototype.localScope = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.identifier]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + return default_1; + }(Tag)); + + var default_1$b = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(token, remainTokens, liquid, parser) { + var _this = _super.call(this, token, remainTokens, liquid) || this; + _this.file = parseFilePath(_this.tokenizer, _this.liquid, parser); + _this.currentFile = token.file; + _this.args = new Hash(_this.tokenizer, liquid.options.keyValueSeparator); + _this.templates = parser.parseTokens(remainTokens); + return _this; + } + default_1.prototype.render = function (ctx, emitter) { + var _a, liquid, args, file, renderer, filepath, templates, html, blocks, _b, _c, _d; + return __generator(this, function (_e) { + switch (_e.label) { + case 0: + _a = this, liquid = _a.liquid, args = _a.args, file = _a.file; + renderer = liquid.renderer; + if (!(file === undefined)) return [3 /*break*/, 2]; + ctx.setRegister('blockMode', BlockMode.OUTPUT); + return [4 /*yield*/, renderer.renderTemplates(this.templates, ctx, emitter)]; + case 1: + _e.sent(); + return [2 /*return*/]; + case 2: return [4 /*yield*/, renderFilePath(this.file, ctx, liquid)]; + case 3: + filepath = (_e.sent()); + assert(filepath, function () { return "illegal file path \"".concat(filepath, "\""); }); + return [4 /*yield*/, liquid._parseLayoutFile(filepath, ctx.sync, this.currentFile)]; + case 4: + templates = (_e.sent()); + // render remaining contents and store rendered results + ctx.setRegister('blockMode', BlockMode.STORE); + return [4 /*yield*/, renderer.renderTemplates(this.templates, ctx)]; + case 5: + html = _e.sent(); + blocks = ctx.getRegister('blocks', {}); + // set whole content to anonymous block if anonymous doesn't specified + if (blocks[''] === undefined) + blocks[''] = function (parent, emitter) { return emitter.write(html); }; + ctx.setRegister('blockMode', BlockMode.OUTPUT); + // render the layout file use stored blocks + _c = (_b = ctx).push; + _d = createScope; + return [4 /*yield*/, args.render(ctx)]; + case 6: + // render the layout file use stored blocks + _c.apply(_b, [_d.apply(void 0, [(_e.sent())])]); + return [4 /*yield*/, renderer.renderTemplates(templates, ctx, emitter)]; + case 7: + _e.sent(); + ctx.pop(); + return [2 /*return*/]; + } + }); + }; + default_1.prototype.children = function (partials) { + var templates, _a, _b, _c, _d; + return __generator(this, function (_e) { + switch (_e.label) { + case 0: + templates = this.templates.slice(); + if (!(partials && isString(this.file))) return [3 /*break*/, 2]; + _b = (_a = templates.push).apply; + _c = [templates]; + _d = [[]]; + return [4 /*yield*/, this.liquid._parsePartialFile(this.file, true, this.currentFile)]; + case 1: + _b.apply(_a, _c.concat([__spreadArray.apply(void 0, _d.concat([__read.apply(void 0, [(_e.sent())]), false]))])); + _e.label = 2; + case 2: return [2 /*return*/, templates]; + } + }); + }; + default_1.prototype.arguments = function () { + var _a, _b, v, e_1_1; + var e_1, _c; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + _d.trys.push([0, 5, 6, 7]); + _a = __values(Object.values(this.args.hash)), _b = _a.next(); + _d.label = 1; + case 1: + if (!!_b.done) return [3 /*break*/, 4]; + v = _b.value; + if (!isValueToken(v)) return [3 /*break*/, 3]; + return [4 /*yield*/, v]; + case 2: + _d.sent(); + _d.label = 3; + case 3: + _b = _a.next(); + return [3 /*break*/, 1]; + case 4: return [3 /*break*/, 7]; + case 5: + e_1_1 = _d.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 7]; + case 6: + try { + if (_b && !_b.done && (_c = _a.return)) _c.call(_a); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 7: + if (!isValueToken(this.file)) return [3 /*break*/, 9]; + return [4 /*yield*/, this.file]; + case 8: + _d.sent(); + _d.label = 9; + case 9: return [2 /*return*/]; + } + }); + }; + default_1.prototype.partialScope = function () { + if (isString(this.file)) { + return { name: this.file, isolated: false, scope: Object.keys(this.args.hash) }; + } + }; + return default_1; + }(Tag)); + + var default_1$c = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(token, remainTokens, liquid, parser) { + var _this = _super.call(this, token, remainTokens, liquid) || this; + _this.templates = []; + var match = /\w+/.exec(token.args); + _this.block = match ? match[0] : ''; + while (remainTokens.length) { + var token_1 = remainTokens.shift(); + if (isTagToken(token_1) && token_1.name === 'endblock') + return _this; + var template = parser.parseToken(token_1, remainTokens); + _this.templates.push(template); + } + throw new Error("tag ".concat(token.getText(), " not closed")); + } + default_1.prototype.render = function (ctx, emitter) { + var blockRender; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + blockRender = this.getBlockRender(ctx); + if (!(ctx.getRegister('blockMode') === BlockMode.STORE)) return [3 /*break*/, 1]; + ctx.getRegister('blocks', {})[this.block] = blockRender; + return [3 /*break*/, 3]; + case 1: return [4 /*yield*/, blockRender(new BlockDrop(), emitter)]; + case 2: + _a.sent(); + _a.label = 3; + case 3: return [2 /*return*/]; + } + }); + }; + default_1.prototype.getBlockRender = function (ctx) { + var self = this; + var _a = this, liquid = _a.liquid, templates = _a.templates; + var renderChild = ctx.getRegister('blocks', {})[this.block]; + var renderCurrent = function (superBlock, emitter) { + var stack; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + stack = ctx.getRegister('blockStack', []); + if (stack.includes(self)) + throw new Error('block tag cannot be nested'); + stack.push(self); + ctx.push(createScope({ block: superBlock })); + return [4 /*yield*/, liquid.renderer.renderTemplates(templates, ctx, emitter)]; + case 1: + _a.sent(); + ctx.pop(); + stack.pop(); + return [2 /*return*/]; + } + }); + }; + return renderChild + ? function (superBlock, emitter) { return renderChild(new BlockDrop(function (emitter) { return renderCurrent(superBlock, emitter); }), emitter); } + : renderCurrent; + }; + default_1.prototype.children = function () { + return __generator(this, function (_a) { + return [2 /*return*/, this.templates]; + }); + }; + default_1.prototype.blockScope = function () { + return ['block']; + }; + return default_1; + }(Tag)); + + var default_1$d = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(tagToken, remainTokens, liquid) { + var _this = _super.call(this, tagToken, remainTokens, liquid) || this; + _this.tokens = []; + while (remainTokens.length) { + var token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endraw') + return _this; + _this.tokens.push(token); + } + throw new Error("tag ".concat(tagToken.getText(), " not closed")); + } + default_1.prototype.render = function () { + return this.tokens.map(function (token) { return token.getText(); }).join(''); + }; + return default_1; + }(Tag)); + + var TablerowloopDrop = /** @class */ (function (_super) { + __extends(TablerowloopDrop, _super); + function TablerowloopDrop(length, cols, collection, variable) { + var _this = _super.call(this, length, collection, variable) || this; + _this.length = length; + _this.cols = cols; + return _this; + } + TablerowloopDrop.prototype.row = function () { + return Math.floor(this.i / this.cols) + 1; + }; + TablerowloopDrop.prototype.col0 = function () { + return (this.i % this.cols); + }; + TablerowloopDrop.prototype.col = function () { + return this.col0() + 1; + }; + TablerowloopDrop.prototype.col_first = function () { + return this.col0() === 0; + }; + TablerowloopDrop.prototype.col_last = function () { + return this.col() === this.cols; + }; + return TablerowloopDrop; + }(ForloopDrop)); + + var default_1$e = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(tagToken, remainTokens, liquid, parser) { + var _this = _super.call(this, tagToken, remainTokens, liquid) || this; + var variable = _this.tokenizer.readIdentifier(); + _this.tokenizer.skipBlank(); + var predicate = _this.tokenizer.readIdentifier(); + var collectionToken = _this.tokenizer.readValue(); + if (predicate.content !== 'in' || !collectionToken) { + throw new Error("illegal tag: ".concat(tagToken.getText())); + } + _this.variable = variable.content; + _this.collection = collectionToken; + _this.args = new Hash(_this.tokenizer, liquid.options.keyValueSeparator); + _this.templates = []; + var p; + var stream = parser.parseStream(remainTokens) + .on('start', function () { return (p = _this.templates); }) + .on('tag:endtablerow', function () { return stream.stop(); }) + .on('template', function (tpl) { return p.push(tpl); }) + .on('end', function () { + throw new Error("tag ".concat(tagToken.getText(), " not closed")); + }); + stream.start(); + return _this; + } + default_1.prototype.render = function (ctx, emitter) { + var collection, _a, args, offset, limit, cols, r, tablerowloop, scope, idx; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = toEnumerable; + return [4 /*yield*/, evalToken(this.collection, ctx)]; + case 1: + collection = _a.apply(void 0, [_b.sent()]); + return [4 /*yield*/, this.args.render(ctx)]; + case 2: + args = (_b.sent()); + offset = args.offset || 0; + limit = (args.limit === undefined) ? collection.length : args.limit; + collection = collection.slice(offset, offset + limit); + cols = args.cols || collection.length; + r = this.liquid.renderer; + tablerowloop = new TablerowloopDrop(collection.length, cols, this.collection.getText(), this.variable); + scope = createScope({ tablerowloop: tablerowloop }); + ctx.push(scope); + idx = 0; + _b.label = 3; + case 3: + if (!(idx < collection.length)) return [3 /*break*/, 6]; + scope[this.variable] = collection[idx]; + if (tablerowloop.col0() === 0) { + if (tablerowloop.row() !== 1) + emitter.write(''); + emitter.write("")); + } + emitter.write("")); + return [4 /*yield*/, r.renderTemplates(this.templates, ctx, emitter)]; + case 4: + _b.sent(); + emitter.write(''); + _b.label = 5; + case 5: + idx++, tablerowloop.next(); + return [3 /*break*/, 3]; + case 6: + if (collection.length) + emitter.write(''); + ctx.pop(); + return [2 /*return*/]; + } + }); + }; + default_1.prototype.children = function () { + return __generator(this, function (_a) { + return [2 /*return*/, this.templates]; + }); + }; + default_1.prototype.arguments = function () { + var _a, _b, v, e_1_1; + var e_1, _c; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: return [4 /*yield*/, this.collection]; + case 1: + _d.sent(); + _d.label = 2; + case 2: + _d.trys.push([2, 7, 8, 9]); + _a = __values(Object.values(this.args.hash)), _b = _a.next(); + _d.label = 3; + case 3: + if (!!_b.done) return [3 /*break*/, 6]; + v = _b.value; + if (!isValueToken(v)) return [3 /*break*/, 5]; + return [4 /*yield*/, v]; + case 4: + _d.sent(); + _d.label = 5; + case 5: + _b = _a.next(); + return [3 /*break*/, 3]; + case 6: return [3 /*break*/, 9]; + case 7: + e_1_1 = _d.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 9]; + case 8: + try { + if (_b && !_b.done && (_c = _a.return)) _c.call(_a); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 9: return [2 /*return*/]; + } + }); + }; + default_1.prototype.blockScope = function () { + return [this.variable, 'tablerowloop']; + }; + return default_1; + }(Tag)); + + var default_1$f = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(tagToken, remainTokens, liquid, parser) { + var _this = _super.call(this, tagToken, remainTokens, liquid) || this; + _this.branches = []; + _this.elseTemplates = []; + var p = []; + var elseCount = 0; + parser.parseStream(remainTokens) + .on('start', function () { return _this.branches.push({ + value: new Value(tagToken.tokenizer.readFilteredValue(), _this.liquid), + test: isFalsy, + templates: (p = []) + }); }) + .on('tag:elsif', function (token) { + if (elseCount > 0) { + p = []; + return; + } + _this.branches.push({ + value: new Value(token.tokenizer.readFilteredValue(), _this.liquid), + test: isTruthy, + templates: (p = []) + }); + }) + .on('tag:else', function () { + elseCount++; + p = _this.elseTemplates; + }) + .on('tag:endunless', function () { this.stop(); }) + .on('template', function (tpl) { + if (p !== _this.elseTemplates || elseCount === 1) { + p.push(tpl); + } + }) + .on('end', function () { throw new Error("tag ".concat(tagToken.getText(), " not closed")); }) + .start(); + return _this; + } + default_1.prototype.render = function (ctx, emitter) { + var r, _a, _b, _c, value, test_1, templates, v, e_1_1; + var e_1, _d; + return __generator(this, function (_e) { + switch (_e.label) { + case 0: + r = this.liquid.renderer; + _e.label = 1; + case 1: + _e.trys.push([1, 7, 8, 9]); + _a = __values(this.branches), _b = _a.next(); + _e.label = 2; + case 2: + if (!!_b.done) return [3 /*break*/, 6]; + _c = _b.value, value = _c.value, test_1 = _c.test, templates = _c.templates; + return [4 /*yield*/, value.value(ctx, ctx.opts.lenientIf)]; + case 3: + v = _e.sent(); + if (!test_1(v, ctx)) return [3 /*break*/, 5]; + return [4 /*yield*/, r.renderTemplates(templates, ctx, emitter)]; + case 4: + _e.sent(); + return [2 /*return*/]; + case 5: + _b = _a.next(); + return [3 /*break*/, 2]; + case 6: return [3 /*break*/, 9]; + case 7: + e_1_1 = _e.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 9]; + case 8: + try { + if (_b && !_b.done && (_d = _a.return)) _d.call(_a); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 9: return [4 /*yield*/, r.renderTemplates(this.elseTemplates, ctx, emitter)]; + case 10: + _e.sent(); + return [2 /*return*/]; + } + }); + }; + default_1.prototype.children = function () { + var children; + return __generator(this, function (_a) { + children = this.branches.flatMap(function (b) { return b.templates; }); + if (this.elseTemplates) { + children.push.apply(children, __spreadArray([], __read(this.elseTemplates), false)); + } + return [2 /*return*/, children]; + }); + }; + default_1.prototype.arguments = function () { + return this.branches.map(function (b) { return b.value; }); + }; + return default_1; + }(Tag)); + + var default_1$g = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1() { + return _super !== null && _super.apply(this, arguments) || this; + } + default_1.prototype.render = function (ctx, _emitter) { + ctx.breakCalled = true; + }; + return default_1; + }(Tag)); + + var default_1$h = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1() { + return _super !== null && _super.apply(this, arguments) || this; + } + default_1.prototype.render = function (ctx, _emitter) { + ctx.continueCalled = true; + }; + return default_1; + }(Tag)); + + var default_1$i = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(token, remainTokens, liquid) { + var _this = _super.call(this, token, remainTokens, liquid) || this; + _this.tokenizer.skipBlank(); + if (!_this.tokenizer.end()) { + _this.value = new Value(_this.tokenizer.readFilteredValue(), _this.liquid); + } + return _this; + } + default_1.prototype.render = function (ctx, emitter) { + var val; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!this.value) + return [2 /*return*/]; + return [4 /*yield*/, this.value.value(ctx, false)]; + case 1: + val = _a.sent(); + emitter.write(val); + return [2 /*return*/]; + } + }); + }; + default_1.prototype.arguments = function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!this.value) return [3 /*break*/, 2]; + return [4 /*yield*/, this.value]; + case 1: + _a.sent(); + _a.label = 2; + case 2: return [2 /*return*/]; + } + }); + }; + return default_1; + }(Tag)); + + var default_1$j = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(token, remainTokens, liquid, parser) { + var _this = _super.call(this, token, remainTokens, liquid) || this; + var tokens = _this.tokenizer.readLiquidTagTokens(_this.liquid.options); + _this.templates = parser.parseTokens(tokens); + return _this; + } + default_1.prototype.render = function (ctx, emitter) { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.liquid.renderer.renderTemplates(this.templates, ctx, emitter)]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }; + default_1.prototype.children = function () { + return __generator(this, function (_a) { + return [2 /*return*/, this.templates]; + }); + }; + return default_1; + }(Tag)); + + var default_1$k = /** @class */ (function (_super) { + __extends(default_1, _super); + function default_1(tagToken, remainTokens, liquid) { + var _this = _super.call(this, tagToken, remainTokens, liquid) || this; + if (tagToken.args.search(/\n\s*[^#\s]/g) !== -1) { + throw new Error('every line of an inline comment must start with a \'#\' character'); + } + return _this; + } + default_1.prototype.render = function () { }; + return default_1; + }(Tag)); + + var tags = { + assign: default_1, + 'for': default_1$1, + capture: default_1$2, + 'case': default_1$3, + comment: default_1$4, + include: default_1$6, + render: default_1$5, + decrement: default_1$7, + increment: default_1$a, + cycle: default_1$8, + 'if': default_1$9, + layout: default_1$b, + block: default_1$c, + raw: default_1$d, + tablerow: default_1$e, + unless: default_1$f, + 'break': default_1$g, + 'continue': default_1$h, + echo: default_1$i, + liquid: default_1$j, + '#': default_1$k + }; + + var Liquid = /** @class */ (function () { + function Liquid(opts) { + if (opts === void 0) { opts = {}; } + var _this = this; + this.renderer = new Render(); + this.filters = Object.create(null); + this.tags = Object.create(null); + this.options = normalize(opts); + // eslint-disable-next-line deprecation/deprecation + this.parser = new Parser(this); + forOwn(tags, function (conf, name) { return _this.registerTag(name, conf); }); + forOwn(filters, function (handler, name) { return _this.registerFilter(name, handler); }); + } + Liquid.prototype.parse = function (html, filepath) { + var parser = new Parser(this); + return parser.parse(html, filepath); + }; + Liquid.prototype._render = function (tpl, scope, renderOptions) { + var ctx = scope instanceof Context ? scope : new Context(scope, this.options, renderOptions); + return this.renderer.renderTemplates(tpl, ctx); + }; + Liquid.prototype.render = function (tpl, scope, renderOptions) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, toPromise(this._render(tpl, scope, __assign(__assign({}, renderOptions), { sync: false })))]; + }); + }); + }; + Liquid.prototype.renderSync = function (tpl, scope, renderOptions) { + return toValueSync(this._render(tpl, scope, __assign(__assign({}, renderOptions), { sync: true }))); + }; + Liquid.prototype.renderToNodeStream = function (tpl, scope, renderOptions) { + if (renderOptions === void 0) { renderOptions = {}; } + var ctx = new Context(scope, this.options, renderOptions); + return this.renderer.renderTemplatesToNodeStream(tpl, ctx); + }; + Liquid.prototype._parseAndRender = function (html, scope, renderOptions) { + var tpl = this.parse(html); + return this._render(tpl, scope, renderOptions); + }; + Liquid.prototype.parseAndRender = function (html, scope, renderOptions) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, toPromise(this._parseAndRender(html, scope, __assign(__assign({}, renderOptions), { sync: false })))]; + }); + }); + }; + Liquid.prototype.parseAndRenderSync = function (html, scope, renderOptions) { + return toValueSync(this._parseAndRender(html, scope, __assign(__assign({}, renderOptions), { sync: true }))); + }; + Liquid.prototype._parsePartialFile = function (file, sync, currentFile) { + return new Parser(this).parseFile(file, sync, exports.LookupType.Partials, currentFile); + }; + Liquid.prototype._parseLayoutFile = function (file, sync, currentFile) { + return new Parser(this).parseFile(file, sync, exports.LookupType.Layouts, currentFile); + }; + Liquid.prototype._parseFile = function (file, sync, lookupType, currentFile) { + return new Parser(this).parseFile(file, sync, lookupType, currentFile); + }; + Liquid.prototype.parseFile = function (file, lookupType) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, toPromise(new Parser(this).parseFile(file, false, lookupType))]; + }); + }); + }; + Liquid.prototype.parseFileSync = function (file, lookupType) { + return toValueSync(new Parser(this).parseFile(file, true, lookupType)); + }; + Liquid.prototype._renderFile = function (file, ctx, renderFileOptions) { + var templates; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this._parseFile(file, renderFileOptions.sync, renderFileOptions.lookupType)]; + case 1: + templates = (_a.sent()); + return [4 /*yield*/, this._render(templates, ctx, renderFileOptions)]; + case 2: return [2 /*return*/, _a.sent()]; + } + }); + }; + Liquid.prototype.renderFile = function (file, ctx, renderFileOptions) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, toPromise(this._renderFile(file, ctx, __assign(__assign({}, renderFileOptions), { sync: false })))]; + }); + }); + }; + Liquid.prototype.renderFileSync = function (file, ctx, renderFileOptions) { + return toValueSync(this._renderFile(file, ctx, __assign(__assign({}, renderFileOptions), { sync: true }))); + }; + Liquid.prototype.renderFileToNodeStream = function (file, scope, renderOptions) { + return __awaiter(this, void 0, void 0, function () { + var templates; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.parseFile(file)]; + case 1: + templates = _a.sent(); + return [2 /*return*/, this.renderToNodeStream(templates, scope, renderOptions)]; + } + }); + }); + }; + Liquid.prototype._evalValue = function (str, scope) { + var value = new Value(str, this); + var ctx = scope instanceof Context ? scope : new Context(scope, this.options); + return value.value(ctx); + }; + Liquid.prototype.evalValue = function (str, scope) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, toPromise(this._evalValue(str, scope))]; + }); + }); + }; + Liquid.prototype.evalValueSync = function (str, scope) { + return toValueSync(this._evalValue(str, scope)); + }; + Liquid.prototype.registerFilter = function (name, filter) { + this.filters[name] = filter; + }; + Liquid.prototype.registerTag = function (name, tag) { + this.tags[name] = isFunction(tag) ? tag : createTagClass(tag); + }; + Liquid.prototype.plugin = function (plugin) { + return plugin.call(this, Liquid); + }; + Liquid.prototype.express = function () { + var self = this; // eslint-disable-line + var firstCall = true; + return function (filePath, ctx, callback) { + var _a, _b, _c; + if (firstCall) { + firstCall = false; + var dirs = normalizeDirectoryList(this.root); + (_a = self.options.root).unshift.apply(_a, __spreadArray([], __read(dirs), false)); + (_b = self.options.layouts).unshift.apply(_b, __spreadArray([], __read(dirs), false)); + (_c = self.options.partials).unshift.apply(_c, __spreadArray([], __read(dirs), false)); + } + self.renderFile(filePath, ctx).then(function (html) { return callback(null, html); }, callback); + }; + }; + Liquid.prototype.analyze = function (template, options) { + if (options === void 0) { options = {}; } + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, analyze(template, options)]; + }); + }); + }; + Liquid.prototype.analyzeSync = function (template, options) { + if (options === void 0) { options = {}; } + return analyzeSync(template, options); + }; + Liquid.prototype.parseAndAnalyze = function (html, filename, options) { + if (options === void 0) { options = {}; } + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, analyze(this.parse(html, filename), options)]; + }); + }); + }; + Liquid.prototype.parseAndAnalyzeSync = function (html, filename, options) { + if (options === void 0) { options = {}; } + return analyzeSync(this.parse(html, filename), options); + }; + /** Return an array of all variables without their properties. */ + Liquid.prototype.variables = function (template, options) { + if (options === void 0) { options = {}; } + return __awaiter(this, void 0, void 0, function () { + var analysis; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)]; + case 1: + analysis = _a.sent(); + return [2 /*return*/, Object.keys(analysis.variables)]; + } + }); + }); + }; + /** Return an array of all variables without their properties. */ + Liquid.prototype.variablesSync = function (template, options) { + if (options === void 0) { options = {}; } + var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.variables); + }; + /** Return an array of all variables including their properties/paths. */ + Liquid.prototype.fullVariables = function (template, options) { + if (options === void 0) { options = {}; } + return __awaiter(this, void 0, void 0, function () { + var analysis; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)]; + case 1: + analysis = _a.sent(); + return [2 /*return*/, Array.from(new Set(Object.values(analysis.variables).flatMap(function (a) { return a.map(function (v) { return String(v); }); })))]; + } + }); + }); + }; + /** Return an array of all variables including their properties/paths. */ + Liquid.prototype.fullVariablesSync = function (template, options) { + if (options === void 0) { options = {}; } + var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.variables).flatMap(function (a) { return a.map(function (v) { return String(v); }); }))); + }; + /** Return an array of all variables, each as an array of properties/segments. */ + Liquid.prototype.variableSegments = function (template, options) { + if (options === void 0) { options = {}; } + return __awaiter(this, void 0, void 0, function () { + var analysis; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)]; + case 1: + analysis = _a.sent(); + return [2 /*return*/, Array.from(strictUniq(Object.values(analysis.variables).flatMap(function (a) { return a.map(function (v) { return v.toArray(); }); })))]; + } + }); + }); + }; + /** Return an array of all variables, each as an array of properties/segments. */ + Liquid.prototype.variableSegmentsSync = function (template, options) { + if (options === void 0) { options = {}; } + var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.variables).flatMap(function (a) { return a.map(function (v) { return v.toArray(); }); }))); + }; + /** Return an array of all expected context variables without their properties. */ + Liquid.prototype.globalVariables = function (template, options) { + if (options === void 0) { options = {}; } + return __awaiter(this, void 0, void 0, function () { + var analysis; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)]; + case 1: + analysis = _a.sent(); + return [2 /*return*/, Object.keys(analysis.globals)]; + } + }); + }); + }; + /** Return an array of all expected context variables without their properties. */ + Liquid.prototype.globalVariablesSync = function (template, options) { + if (options === void 0) { options = {}; } + var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.globals); + }; + /** Return an array of all expected context variables including their properties/paths. */ + Liquid.prototype.globalFullVariables = function (template, options) { + if (options === void 0) { options = {}; } + return __awaiter(this, void 0, void 0, function () { + var analysis; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)]; + case 1: + analysis = _a.sent(); + return [2 /*return*/, Array.from(new Set(Object.values(analysis.globals).flatMap(function (a) { return a.map(function (v) { return String(v); }); })))]; + } + }); + }); + }; + /** Return an array of all expected context variables including their properties/paths. */ + Liquid.prototype.globalFullVariablesSync = function (template, options) { + if (options === void 0) { options = {}; } + var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.globals).flatMap(function (a) { return a.map(function (v) { return String(v); }); }))); + }; + /** Return an array of all expected context variables, each as an array of properties/segments. */ + Liquid.prototype.globalVariableSegments = function (template, options) { + if (options === void 0) { options = {}; } + return __awaiter(this, void 0, void 0, function () { + var analysis; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)]; + case 1: + analysis = _a.sent(); + return [2 /*return*/, Array.from(strictUniq(Object.values(analysis.globals).flatMap(function (a) { return a.map(function (v) { return v.toArray(); }); })))]; + } + }); + }); + }; + /** Return an array of all expected context variables, each as an array of properties/segments. */ + Liquid.prototype.globalVariableSegmentsSync = function (template, options) { + if (options === void 0) { options = {}; } + var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.globals).flatMap(function (a) { return a.map(function (v) { return v.toArray(); }); }))); + }; + return Liquid; + }()); + + /* istanbul ignore file */ + var version = '10.27.2'; + + exports.AssertionError = AssertionError; + exports.AssignTag = default_1; + exports.BlockTag = default_1$c; + exports.BreakTag = default_1$g; + exports.CaptureTag = default_1$2; + exports.CaseTag = default_1$3; + exports.CommentTag = default_1$4; + exports.Context = Context; + exports.ContinueTag = default_1$h; + exports.CycleTag = default_1$8; + exports.DecrementTag = default_1$7; + exports.Drop = Drop; + exports.EchoTag = default_1$i; + exports.Expression = Expression; + exports.Filter = Filter; + exports.ForTag = default_1$1; + exports.Hash = Hash; + exports.IfTag = default_1$9; + exports.IncludeTag = default_1$6; + exports.IncrementTag = default_1$a; + exports.InlineCommentTag = default_1$k; + exports.LayoutTag = default_1$b; + exports.Liquid = Liquid; + exports.LiquidError = LiquidError; + exports.LiquidTag = default_1$j; + exports.Output = Output; + exports.ParseError = ParseError; + exports.ParseStream = ParseStream; + exports.Parser = Parser; + exports.RawTag = default_1$d; + exports.RenderError = RenderError; + exports.RenderTag = default_1$5; + exports.TablerowTag = default_1$e; + exports.Tag = Tag; + exports.TagToken = TagToken; + exports.Token = Token; + exports.TokenizationError = TokenizationError; + exports.Tokenizer = Tokenizer; + exports.TypeGuards = typeGuards; + exports.UndefinedVariableError = UndefinedVariableError; + exports.UnlessTag = default_1$f; + exports.Value = Value; + exports.Variable = Variable; + exports.analyze = analyze; + exports.analyzeSync = analyzeSync; + exports.assert = assert; + exports.createTrie = createTrie; + exports.defaultOperators = defaultOperators; + exports.defaultOptions = defaultOptions; + exports.evalQuotedToken = evalQuotedToken; + exports.evalToken = evalToken; + exports.filters = filters; + exports.isFalsy = isFalsy; + exports.isTruthy = isTruthy; + exports.tags = tags; + exports.toPromise = toPromise; + exports.toValue = toValue; + exports.toValueSync = toValueSync; + exports.version = version; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=liquid.browser.umd.js.map diff --git a/node_modules/liquidjs/dist/liquid.browser.umd.js.map b/node_modules/liquidjs/dist/liquid.browser.umd.js.map new file mode 100644 index 00000000..b7974d89 --- /dev/null +++ b/node_modules/liquidjs/dist/liquid.browser.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"liquid.browser.umd.js","sources":["../src/tokens/token.ts","../src/drop/drop.ts","../src/util/underscore.ts","../src/util/error.ts","../src/util/character.ts","../src/util/assert.ts","../src/drop/null-drop.ts","../src/drop/empty-drop.ts","../src/drop/blank-drop.ts","../src/drop/forloop-drop.ts","../src/emitters/simple-emitter.ts","../src/build/streamed-emitter-browser.ts","../src/emitters/keeping-type-emitter.ts","../src/drop/block-drop.ts","../src/drop/comparable.ts","../src/util/literal.ts","../src/util/operator-trie.ts","../src/util/async.ts","../src/util/strftime.ts","../src/util/intl.ts","../src/util/liquid-date.ts","../src/util/limiter.ts","../src/tokens/delimited-token.ts","../src/tokens/tag-token.ts","../src/tokens/output-token.ts","../src/tokens/html-token.ts","../src/tokens/number-token.ts","../src/tokens/identifier-token.ts","../src/tokens/literal-token.ts","../src/tokens/operator-token.ts","../src/tokens/property-access-token.ts","../src/tokens/filter-token.ts","../src/tokens/hash-token.ts","../src/render/string.ts","../src/tokens/quoted-token.ts","../src/tokens/range-token.ts","../src/tokens/liquid-tag-token.ts","../src/tokens/filtered-value-token.ts","../src/util/performance.ts","../src/render/render.ts","../src/render/expression.ts","../src/render/boolean.ts","../src/render/operator.ts","../src/cache/lru.ts","../src/build/fs-impl-browser.ts","../src/filters/misc.ts","../src/filters/html.ts","../src/fs/map-fs.ts","../src/liquid-options.ts","../src/parser/whitespace-ctrl.ts","../src/parser/tokenizer.ts","../src/parser/parse-stream.ts","../src/template/template-impl.ts","../src/template/tag.ts","../src/template/hash.ts","../src/template/tag-options-adapter.ts","../src/parser/filter-arg.ts","../src/template/filter.ts","../src/template/value.ts","../src/template/output.ts","../src/template/html.ts","../src/template/analysis.ts","../src/fs/loader.ts","../src/parser/parser.ts","../src/parser/token-kind.ts","../src/util/type-guards.ts","../src/context/scope.ts","../src/context/context.ts","../src/context/block-mode.ts","../src/filters/math.ts","../src/filters/url.ts","../src/filters/array.ts","../src/filters/date.ts","../src/filters/string.ts","../src/build/base64-impl-browser.ts","../src/filters/base64.ts","../src/build/crypto-impl-browser.ts","../src/filters/crypto.ts","../src/filters/index.ts","../src/tags/assign.ts","../src/tags/for.ts","../src/tags/capture.ts","../src/tags/case.ts","../src/tags/comment.ts","../src/tags/render.ts","../src/tags/include.ts","../src/tags/decrement.ts","../src/tags/cycle.ts","../src/tags/if.ts","../src/tags/increment.ts","../src/tags/layout.ts","../src/tags/block.ts","../src/tags/raw.ts","../src/drop/tablerowloop-drop.ts","../src/tags/tablerow.ts","../src/tags/unless.ts","../src/tags/break.ts","../src/tags/continue.ts","../src/tags/echo.ts","../src/tags/liquid.ts","../src/tags/inline-comment.ts","../src/tags/index.ts","../src/liquid.ts","../src/index.ts"],"sourcesContent":["import { TokenKind } from '../parser'\n\nexport abstract class Token {\n public constructor (\n public kind: TokenKind,\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {}\n public getText () {\n return this.input.slice(this.begin, this.end)\n }\n public getPosition () {\n let [row, col] = [1, 1]\n for (let i = 0; i < this.begin; i++) {\n if (this.input[i] === '\\n') {\n row++\n col = 1\n } else col++\n }\n return [row, col]\n }\n public size () {\n return this.end - this.begin\n }\n}\n","import { Context } from '../context'\n\nexport abstract class Drop {\n [key: string]: any\n public liquidMethodMissing (key: string | number, context: Context): Promise | any {\n return undefined\n }\n}\n","import { Drop } from '../drop/drop'\n\nexport const toString = Object.prototype.toString\nconst toLowerCase = String.prototype.toLowerCase\n\nexport const hasOwnProperty = Object.hasOwnProperty\n\nexport function isString (value: any): value is string {\n return typeof value === 'string'\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isFunction (value: any): value is Function {\n return typeof value === 'function'\n}\n\nexport function isPromise (val: any): val is Promise {\n return val && isFunction(val.then)\n}\n\nexport function isIterator (val: any): val is IterableIterator {\n return val && isFunction(val.next) && isFunction(val.throw) && isFunction(val.return)\n}\n\nexport function promisify (fn: (arg1: T1, cb: (err: Error | null, result: T2) => void) => void): (arg1: T1) => Promise;\nexport function promisify (fn: (arg1: T1, arg2: T2, cb: (err: Error | null, result: T3) => void) => void): (arg1: T1, arg2: T2) => Promise;\nexport function promisify (fn: any) {\n return function (...args: any[]) {\n return new Promise((resolve, reject) => {\n fn(...args, (err: Error, result: any) => {\n err ? reject(err) : resolve(result)\n })\n })\n }\n}\n\nexport function stringify (value: any): string {\n value = toValue(value)\n if (isString(value)) return value\n if (isNil(value)) return ''\n if (isArray(value)) return value.map(x => stringify(x)).join('')\n return String(value)\n}\n\nexport function readArrayElement (arr: any[], index: number, ownPropertyOnly: boolean) {\n if (index < 0) index = arr.length + index\n if (ownPropertyOnly && !hasOwnProperty.call(arr, index)) return undefined\n return arr[index]\n}\n\nexport function toEnumerable (val: any): T[] {\n val = toValue(val)\n if (isArray(val)) return val\n if (isString(val) && val.length > 0) return [val] as unknown as T[]\n if (isIterable(val)) return Array.from(val)\n if (isObject(val)) return Object.keys(val).map((key) => [key, val[key]]) as unknown as T[]\n return []\n}\n\nexport function toArray (val: any) {\n val = toValue(val)\n if (isNil(val)) return []\n if (isArray(val)) return val\n return [ val ]\n}\n\nexport function toValue (value: any): any {\n return (value instanceof Drop && isFunction(value.valueOf)) ? value.valueOf() : value\n}\n\nexport function toNumber (value: any): number {\n return +toValue(value) || 0\n}\n\nexport function isNumber (value: any): value is number {\n return typeof value === 'number'\n}\n\nexport function toLiquid (value: any): any {\n if (value && isFunction(value.toLiquid)) return toLiquid(value.toLiquid())\n return value\n}\n\nexport function isNil (value: any): boolean {\n return value == null\n}\n\nexport function isUndefined (value: any): boolean {\n return value === undefined\n}\n\nexport function isArray (value: any): value is any[] {\n // be compatible with IE 8\n return toString.call(value) === '[object Array]'\n}\n\nexport function isArrayLike (value: any): value is any[] {\n return value && isNumber(value.length)\n}\n\nexport function isIterable (value: any): value is Iterable {\n return isObject(value) && Symbol.iterator in value\n}\n\n/*\n * Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property.\n * The iteratee is invoked with three arguments: (value, key, object).\n * Iteratee functions may exit iteration early by explicitly returning false.\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @return {Object} Returns object.\n */\nexport function forOwn (\n obj: Record | undefined,\n iteratee: ((val: T, key: string, obj: {[key: string]: T}) => boolean | void)\n) {\n obj = obj || {}\n for (const k in obj) {\n if (hasOwnProperty.call(obj, k)) {\n if (iteratee(obj[k], k, obj) === false) break\n }\n }\n return obj\n}\n\nexport function last (arr: T[]): T;\nexport function last (arr: string): string;\nexport function last (arr: any[] | string): any | string {\n return arr[arr.length - 1]\n}\n\n/*\n * Checks if value is the language type of Object.\n * (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))\n * @param {any} value The value to check.\n * @return {Boolean} Returns true if value is an object, else false.\n */\nexport function isObject (value: any): value is object {\n const type = typeof value\n return value !== null && (type === 'object' || type === 'function')\n}\n\nexport function range (start: number, stop: number, step = 1) {\n const arr: number[] = []\n for (let i = start; i < stop; i += step) {\n arr.push(i)\n }\n return arr\n}\n\nexport function padStart (str: any, length: number, ch = ' ') {\n return pad(str, length, ch, (str, ch) => ch + str)\n}\n\nexport function padEnd (str: any, length: number, ch = ' ') {\n return pad(str, length, ch, (str, ch) => str + ch)\n}\n\nexport function pad (str: any, length: number, ch: string, add: (str: string, ch: string) => string) {\n str = String(str)\n const n = length - str.length\n if (n <= 0) return str\n return add(str, ch.repeat(n))\n}\n\nexport function identify (val: T): T {\n return val\n}\n\nexport function changeCase (str: string): string {\n const hasLowerCase = [...str].some(ch => ch >= 'a' && ch <= 'z')\n return hasLowerCase ? str.toUpperCase() : str.toLowerCase()\n}\n\nexport function ellipsis (str: string, N: number): string {\n return str.length > N ? str.slice(0, N - 3) + '...' : str\n}\n\nexport function orderedCompare (a: any, b: any) {\n if (isNil(a) && isNil(b)) return 0\n if (isNil(a)) return 1\n if (isNil(b)) return -1\n if (a < b) return -1\n if (a > b) return 1\n return 0\n}\n\n// compare string in case-insensitive way, undefined values to the tail\nexport function caseInsensitiveCompare (a: any, b: any) {\n if (isNil(a) && isNil(b)) return 0\n if (isNil(a)) return 1\n if (isNil(b)) return -1\n a = toLowerCase.call(a)\n b = toLowerCase.call(b)\n if (a < b) return -1\n if (a > b) return 1\n return 0\n}\n\nexport function argumentsToValue any, T> (fn: F) {\n return function (this: T, ...args: Parameters) { return fn.call(this, ...args.map(toValue)) }\n}\n\nexport function argumentsToNumber any, T> (fn: F) {\n return function (this: T, ...args: Parameters) { return fn.call(this, ...args.map(toNumber)) }\n}\n\nexport function escapeRegExp (text: string) {\n return text.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&')\n}\n\n/** Return an array containing unique elements from _array_. Works with nested arrays and objects. */\nexport function * strictUniq (array: Array): Generator {\n const seen = new Set()\n\n for (const element of array) {\n const key = JSON.stringify(element)\n if (!seen.has(key)) {\n seen.add(key)\n yield element\n }\n }\n}\n","import * as _ from './underscore'\nimport { Token } from '../tokens/token'\nimport { Template } from '../template/template'\n\n/**\n * targeting ES5, extends Error won't create a proper prototype chain, need a trait to keep track of classes\n */\nconst TRAIT = '__liquidClass__'\n\nexport abstract class LiquidError extends Error {\n public token!: Token\n public context = ''\n public originalError?: Error\n public constructor (err: Error | string, token: Token) {\n /**\n * note: for ES5 targeting, `this` will be replaced by return value of Error(),\n * thus everything on `this` will be lost, avoid calling `LiquidError` methods here\n */\n super(typeof err === 'string' ? err : err.message)\n if (typeof err !== 'string') Object.defineProperty(this, 'originalError', { value: err, enumerable: false })\n Object.defineProperty(this, 'token', { value: token, enumerable: false })\n Object.defineProperty(this, TRAIT, { value: 'LiquidError', enumerable: false })\n }\n protected update () {\n Object.defineProperty(this, 'context', { value: mkContext(this.token), enumerable: false })\n this.message = mkMessage(this.message, this.token)\n this.stack = this.message + '\\n' + this.context +\n '\\n' + this.stack\n if (this.originalError) this.stack += '\\nFrom ' + this.originalError.stack\n }\n static is (obj: unknown): obj is LiquidError {\n return (obj as Record | null | undefined)?.[TRAIT] === 'LiquidError'\n }\n}\n\nexport class TokenizationError extends LiquidError {\n public constructor (message: string, token: Token) {\n super(message, token)\n this.name = 'TokenizationError'\n super.update()\n }\n}\n\nexport class ParseError extends LiquidError {\n public constructor (err: Error, token: Token) {\n super(err, token)\n this.name = 'ParseError'\n this.message = err.message\n super.update()\n }\n}\n\nexport class RenderError extends LiquidError {\n public constructor (err: Error, tpl: Template) {\n super(err, tpl.token)\n this.name = 'RenderError'\n this.message = err.message\n super.update()\n }\n public static is (obj: any): obj is RenderError {\n return obj.name === 'RenderError'\n }\n}\n\nexport class LiquidErrors extends LiquidError {\n public constructor (public errors: RenderError[]) {\n super(errors[0], errors[0].token)\n this.name = 'LiquidErrors'\n const s = errors.length > 1 ? 's' : ''\n this.message = `${errors.length} error${s} found`\n super.update()\n }\n public static is (obj: any): obj is LiquidErrors {\n return obj.name === 'LiquidErrors'\n }\n}\n\nexport class UndefinedVariableError extends LiquidError {\n public constructor (err: Error, token: Token) {\n super(err, token)\n this.name = 'UndefinedVariableError'\n this.message = err.message\n super.update()\n }\n}\n\n// only used internally; raised where we don't have token information,\n// so it can't be an UndefinedVariableError.\nexport class InternalUndefinedVariableError extends Error {\n variableName: string\n\n public constructor (variableName: string) {\n super(`undefined variable: ${variableName}`)\n this.name = 'InternalUndefinedVariableError'\n this.variableName = variableName\n }\n}\n\nexport class AssertionError extends Error {\n public constructor (message: string) {\n super(message)\n this.name = 'AssertionError'\n this.message = message + ''\n }\n}\n\nfunction mkContext (token: Token) {\n const [line, col] = token.getPosition()\n const lines = token.input.split('\\n')\n const begin = Math.max(line - 2, 1)\n const end = Math.min(line + 3, lines.length)\n\n const context = _\n .range(begin, end + 1)\n .map(lineNumber => {\n const rowIndicator = (lineNumber === line) ? '>> ' : ' '\n const num = _.padStart(String(lineNumber), String(end).length)\n let text = `${rowIndicator}${num}| `\n\n const colIndicator = lineNumber === line\n ? '\\n' + _.padStart('^', col + text.length)\n : ''\n\n text += lines[lineNumber - 1]\n text += colIndicator\n return text\n })\n .join('\\n')\n\n return context\n}\n\nfunction mkMessage (msg: string, token: Token) {\n if (token.file) msg += `, file:${token.file}`\n const [line, col] = token.getPosition()\n msg += `, line:${line}, col:${col}`\n return msg\n}\n","// **DO NOT CHANGE THIS FILE**\n//\n// This file is generated by bin/character-gen.js\n// bitmask character types to boost performance\nexport const TYPES = [0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 4, 4, 4, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 8, 0, 0, 0, 0, 8, 0, 0, 0, 64, 0, 65, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 0, 0, 2, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]\nexport const WORD = 1\nexport const OPERATOR = 2\nexport const BLANK = 4\nexport const QUOTE = 8\nexport const INLINE_BLANK = 16\nexport const NUMBER = 32\nexport const SIGN = 64\nexport const PUNCTUATION = 128\n\nexport function isWord (char: string): boolean {\n const code = char.charCodeAt(0)\n return code >= 128 ? !TYPES[code] : !!(TYPES[code] & WORD)\n}\nTYPES[160] = TYPES[5760] = TYPES[6158] = TYPES[8192] = TYPES[8193] = TYPES[8194] = TYPES[8195] = TYPES[8196] = TYPES[8197] = TYPES[8198] = TYPES[8199] = TYPES[8200] = TYPES[8201] = TYPES[8202] = TYPES[8232] = TYPES[8233] = TYPES[8239] = TYPES[8287] = TYPES[12288] = BLANK\nTYPES[8220] = TYPES[8221] = PUNCTUATION\n","import { AssertionError } from './error'\n\nexport function assert (predicate: T | null | undefined, message?: string | (() => string)) {\n if (!predicate) {\n const msg = typeof message === 'function'\n ? message()\n : (message || `expect ${predicate} to be true`)\n throw new AssertionError(msg)\n }\n}\n\nexport function assertEmpty (predicate: T | null | undefined, message = `unexpected ${JSON.stringify(predicate)}`) {\n assert(!predicate, message)\n}\n","import { Drop } from './drop'\nimport { Comparable } from './comparable'\nimport { isNil, toValue } from '../util'\n\nexport class NullDrop extends Drop implements Comparable {\n public equals (value: any) {\n return isNil(toValue(value))\n }\n public gt () {\n return false\n }\n public geq () {\n return false\n }\n public lt () {\n return false\n }\n public leq () {\n return false\n }\n public valueOf () {\n return null\n }\n}\n","import { Drop } from './drop'\nimport { Comparable } from './comparable'\nimport { isObject, isString, isArray, toValue } from '../util'\n\nexport class EmptyDrop extends Drop implements Comparable {\n public equals (value: any) {\n if (value instanceof EmptyDrop) return false\n value = toValue(value)\n if (isString(value) || isArray(value)) return value.length === 0\n if (isObject(value)) return Object.keys(value).length === 0\n return false\n }\n public gt () {\n return false\n }\n public geq () {\n return false\n }\n public lt () {\n return false\n }\n public leq () {\n return false\n }\n public valueOf () {\n return ''\n }\n static is (value: unknown) {\n return value instanceof EmptyDrop\n }\n}\n","import { isNil, isString, toValue } from '../util'\nimport { EmptyDrop } from '../drop'\n\nexport class BlankDrop extends EmptyDrop {\n public equals (value: any) {\n if (value === false) return true\n if (isNil(toValue(value))) return true\n if (isString(value)) return /^\\s*$/.test(value)\n return super.equals(value)\n }\n static is (value: unknown) {\n return value instanceof BlankDrop\n }\n}\n","import { Drop } from './drop'\n\nexport class ForloopDrop extends Drop {\n protected i = 0\n public name: string\n public length: number\n public constructor (length: number, collection: string, variable: string) {\n super()\n this.length = length\n this.name = `${variable}-${collection}`\n }\n public next () {\n this.i++\n }\n public index0 () {\n return this.i\n }\n public index () {\n return this.i + 1\n }\n public first () {\n return this.i === 0\n }\n public last () {\n return this.i === this.length - 1\n }\n public rindex () {\n return this.length - this.i\n }\n public rindex0 () {\n return this.length - this.i - 1\n }\n public valueOf () {\n return JSON.stringify(this)\n }\n}\n","import { stringify } from '../util'\nimport { Emitter } from './emitter'\n\nexport class SimpleEmitter implements Emitter {\n public buffer = '';\n\n public write (html: any) {\n this.buffer += stringify(html)\n }\n}\n","import { Emitter } from '../emitters'\n\nexport class StreamedEmitter implements Emitter {\n public buffer = '';\n public stream: NodeJS.ReadableStream = null as any\n constructor () {\n throw new Error('streaming not supported in browser')\n }\n public write: (html: any) => void\n public error: (err: Error) => void\n public end: () => void\n}\n","import { stringify, toValue } from '../util'\nimport { Emitter } from './emitter'\n\nexport class KeepingTypeEmitter implements Emitter {\n public buffer: any = '';\n\n public write (html: any) {\n html = toValue(html)\n // This will only preserve the type if the value is isolated.\n // I.E:\n // {{ my-port }} -> 42\n // {{ my-host }}:{{ my-port }} -> 'host:42'\n if (typeof html !== 'string' && this.buffer === '') {\n this.buffer = html\n } else {\n this.buffer = stringify(this.buffer) + stringify(html)\n }\n }\n}\n","import { Emitter, SimpleEmitter } from '../emitters'\nimport { Drop } from './drop'\n\nexport class BlockDrop extends Drop {\n constructor (\n // the block render from layout template\n private superBlockRender: (emitter: Emitter) => IterableIterator | string = () => ''\n ) {\n super()\n }\n /**\n * Provide parent access in child block by\n * {{ block.super }}\n */\n public * super (): IterableIterator {\n const emitter = new SimpleEmitter()\n yield this.superBlockRender(emitter)\n return emitter.buffer\n }\n}\n","import { isFunction } from '../util'\n\nexport interface Comparable {\n equals: (rhs: any) => boolean;\n gt: (rhs: any) => boolean;\n geq: (rhs: any) => boolean;\n lt: (rhs: any) => boolean;\n leq: (rhs: any) => boolean;\n}\n\nexport function isComparable (arg: any): arg is Comparable {\n return (\n arg &&\n isFunction(arg.equals) &&\n isFunction(arg.gt) &&\n isFunction(arg.geq) &&\n isFunction(arg.lt) &&\n isFunction(arg.leq)\n )\n}\n","import { BlankDrop, EmptyDrop, NullDrop } from '../drop'\n\nconst nil = new NullDrop()\nexport const literalValues = {\n 'true': true,\n 'false': false,\n 'nil': nil,\n 'null': nil,\n 'empty': new EmptyDrop(),\n 'blank': new BlankDrop()\n}\n\nexport type LiteralKey = keyof typeof literalValues\nexport type LiteralValue = typeof literalValues[LiteralKey]\n","import { isWord } from '../util/character'\n\ninterface TrieInput {\n [key: string]: T\n}\n\nexport type Trie = {\n data?: T\n end?: true\n needBoundary?: true\n} & Record\n\n// Tries are built once per input object and reused: the Tokenizer rebuilds them\n// on every instantiation, but `input` (operators/literalValues) is a stable\n// reference. WeakMap-keying by `input` lets short-lived operator objects (and\n// their tries) be garbage collected. The returned trie is treated as read-only\n// by callers (matchTrie only reads it); do not mutate it.\nconst trieCache = new WeakMap, Trie>()\n\nexport function createTrie (input: TrieInput): Trie {\n const cached = trieCache.get(input)\n if (cached) return cached\n const trie: Trie = {}\n for (const [name, data] of Object.entries(input)) {\n let node = trie\n\n for (let i = 0; i < name.length; i++) {\n const c = name[i]\n node[c] = node[c] || {}\n\n if (i === name.length - 1 && isWord(name[i])) {\n node[c].needBoundary = true\n }\n\n node = node[c]\n }\n\n node.data = data\n node.end = true\n }\n trieCache.set(input, trie)\n return trie\n}\n","import { isPromise, isIterator } from './underscore'\n\nexport type LiquidAsync any> =\n (sync: boolean, ...args: Parameters) => ReturnType | Promise>\n\nexport function toLiquidAsync any> (\n asyncFn: (...args: Parameters) => Promise>,\n syncFn?: F\n): LiquidAsync {\n const syncImpl = syncFn || asyncFn as any\n return (sync: boolean, ...args: any[]) => {\n return sync ? syncImpl(...args as Parameters) : asyncFn(...args as Parameters)\n }\n}\n\n// convert an async iterator to a Promise\nexport async function toPromise (val: Generator | Promise | T): Promise {\n if (!isIterator(val)) return val\n let value: unknown\n let done = false\n let next: 'next' | 'throw' = 'next'\n do {\n const state = val[next](value)\n done = !!state.done\n value = state.value\n next = 'next'\n try {\n if (isIterator(value)) value = toPromise(value)\n if (isPromise(value)) value = await value\n } catch (err) {\n next = 'throw'\n value = err\n }\n } while (!done)\n return value as T\n}\n\n// convert an async iterator to a value in a synchronous manner\nexport function toValueSync (val: Generator | T): T {\n if (!isIterator(val)) return val\n let value: any\n let done = false\n let next: 'next' | 'throw' = 'next'\n do {\n const state = val[next](value)\n done = !!state.done\n value = state.value\n next = 'next'\n if (isIterator(value)) {\n try {\n value = toValueSync(value)\n } catch (err) {\n next = 'throw'\n value = err\n }\n }\n } while (!done)\n return value\n}\n","import { changeCase, padStart, padEnd } from './underscore'\nimport { LiquidDate } from './liquid-date'\nimport type { Limiter } from './limiter'\n\nconst rFormat = /%([-_0^#:]+)?(\\d+)?([EO])?(.)/\ninterface FormatOptions {\n flags: Record;\n width?: string;\n modifier?: string;\n memoryLimit?: Pick;\n}\n\n// prototype extensions\nfunction daysInMonth (d: LiquidDate) {\n const feb = isLeapYear(d) ? 29 : 28\n return [31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n}\nfunction getDayOfYear (d: LiquidDate) {\n let num = 0\n for (let i = 0; i < d.getMonth(); ++i) {\n num += daysInMonth(d)[i]\n }\n return num + d.getDate()\n}\nfunction getWeekOfYear (d: LiquidDate, startDay: number) {\n // Skip to startDay of this week\n const now = getDayOfYear(d) + (startDay - d.getDay())\n // Find the first startDay of the year\n const jan1 = new Date(d.getFullYear(), 0, 1)\n const then = (7 - jan1.getDay() + startDay)\n return String(Math.floor((now - then) / 7) + 1)\n}\nfunction isLeapYear (d: LiquidDate) {\n const year = d.getFullYear()\n return !!((year & 3) === 0 && (year % 100 || (year % 400 === 0 && year)))\n}\nfunction ordinal (d: LiquidDate) {\n const date = d.getDate()\n if ([11, 12, 13].includes(date)) return 'th'\n\n switch (date % 10) {\n case 1: return 'st'\n case 2: return 'nd'\n case 3: return 'rd'\n default: return 'th'\n }\n}\nfunction century (d: LiquidDate) {\n return parseInt(d.getFullYear().toString().substring(0, 2), 10)\n}\n\n// default to 0\nconst padWidths: Record = {\n d: 2,\n e: 2,\n H: 2,\n I: 2,\n j: 3,\n k: 2,\n l: 2,\n L: 3,\n m: 2,\n M: 2,\n S: 2,\n U: 2,\n W: 2\n}\n\nconst padSpaceChars = new Set('aAbBceklpP')\n\nfunction getTimezoneOffset (d: LiquidDate, opts: FormatOptions) {\n const nOffset = Math.abs(d.getTimezoneOffset())\n const h = Math.floor(nOffset / 60)\n const m = nOffset % 60\n return (d.getTimezoneOffset() > 0 ? '-' : '+') +\n padStart(h, 2, '0') +\n (opts.flags[':'] ? ':' : '') +\n padStart(m, 2, '0')\n}\ntype FormatCodeHandler = (d: LiquidDate, opts: FormatOptions) => unknown\n\nconst formatCodes: Record = {\n a: (d: LiquidDate) => d.getShortWeekdayName(),\n A: (d: LiquidDate) => d.getLongWeekdayName(),\n b: (d: LiquidDate) => d.getShortMonthName(),\n B: (d: LiquidDate) => d.getLongMonthName(),\n c: (d: LiquidDate) => d.toLocaleString(),\n C: (d: LiquidDate) => century(d),\n d: (d: LiquidDate) => d.getDate(),\n e: (d: LiquidDate) => d.getDate(),\n H: (d: LiquidDate) => d.getHours(),\n I: (d: LiquidDate) => String(d.getHours() % 12 || 12),\n j: (d: LiquidDate) => getDayOfYear(d),\n k: (d: LiquidDate) => d.getHours(),\n l: (d: LiquidDate) => String(d.getHours() % 12 || 12),\n L: (d: LiquidDate) => d.getMilliseconds(),\n m: (d: LiquidDate) => d.getMonth() + 1,\n M: (d: LiquidDate) => d.getMinutes(),\n N: (d: LiquidDate, opts: FormatOptions) => {\n const width = Number(opts.width) || 9\n const str = padStart(String(d.getMilliseconds()), 3, '0').slice(0, width)\n opts.memoryLimit?.use(width - str.length)\n return padEnd(str, width, '0')\n },\n p: (d: LiquidDate) => (d.getHours() < 12 ? 'AM' : 'PM'),\n P: (d: LiquidDate) => (d.getHours() < 12 ? 'am' : 'pm'),\n q: (d: LiquidDate) => ordinal(d),\n s: (d: LiquidDate) => Math.round(d.getTime() / 1000),\n S: (d: LiquidDate) => d.getSeconds(),\n u: (d: LiquidDate) => d.getDay() || 7,\n U: (d: LiquidDate) => getWeekOfYear(d, 0),\n w: (d: LiquidDate) => d.getDay(),\n W: (d: LiquidDate) => getWeekOfYear(d, 1),\n x: (d: LiquidDate) => d.toLocaleDateString(),\n X: (d: LiquidDate) => d.toLocaleTimeString(),\n y: (d: LiquidDate) => d.getFullYear().toString().slice(2, 4),\n Y: (d: LiquidDate) => d.getFullYear(),\n z: getTimezoneOffset,\n Z: (d: LiquidDate, opts: FormatOptions) => d.getTimeZoneName() || getTimezoneOffset(d, opts),\n 't': () => '\\t',\n 'n': () => '\\n',\n '%': () => '%'\n}\nformatCodes.h = formatCodes.b\n\nexport function strftime (d: LiquidDate, formatStr: string, memoryLimit?: Pick) {\n let output = ''\n let remaining = formatStr\n let match\n while ((match = rFormat.exec(remaining))) {\n output += remaining.slice(0, match.index)\n remaining = remaining.slice(match.index + match[0].length)\n output += format(d, match, memoryLimit)\n }\n return output + remaining\n}\n\nfunction format (d: LiquidDate, match: RegExpExecArray, memoryLimit?: Pick) {\n const [input, flagStr = '', width, modifier, conversion] = match\n const convert = formatCodes[conversion]\n if (!convert) return input\n const flags: Record = {}\n for (const flag of flagStr) flags[flag] = true\n let ret = String(convert(d, { flags, width, modifier, memoryLimit }))\n let padChar = padSpaceChars.has(conversion) ? ' ' : '0'\n let padWidth = Number(width) || padWidths[conversion] || 0\n if (flags['^']) ret = ret.toUpperCase()\n else if (flags['#']) ret = changeCase(ret)\n if (flags['_']) padChar = ' '\n else if (flags['0']) padChar = '0'\n if (flags['-']) padWidth = 0\n memoryLimit?.use(Number(padWidth) - ret.length)\n return padStart(ret, padWidth, padChar)\n}\n","export function getDateTimeFormat () {\n return (typeof Intl !== 'undefined' ? Intl.DateTimeFormat : undefined)\n}\n","import { getDateTimeFormat } from './intl'\nimport { isString } from './underscore'\n\n// one minute in milliseconds\nconst OneMinute = 60000\n/**\n * Need support both ISO8601 and RFC2822 as in major browsers & NodeJS\n * RFC2822: https://datatracker.ietf.org/doc/html/rfc2822#section-3.3\n */\nconst TIMEZONE_PATTERN = /([zZ]|([+-])(\\d{2}):?(\\d{2}))$/\nconst monthNames = [\n 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',\n 'September', 'October', 'November', 'December'\n]\nconst monthNamesShort = monthNames.map(name => name.slice(0, 3))\nconst dayNames = [\n 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'\n]\nconst dayNamesShort = dayNames.map(name => name.slice(0, 3))\n\n/**\n * A date implementation with timezone info, just like Ruby date\n *\n * Implementation:\n * - create a Date offset by it's timezone difference, avoiding overriding a bunch of methods\n * - rewrite getTimezoneOffset() to trick strftime\n */\nexport class LiquidDate {\n private timezoneOffset: number\n private timezoneName: string\n private date: Date\n private displayDate: Date\n private DateTimeFormat = getDateTimeFormat()\n public timezoneFixed: boolean\n constructor (\n init: string | number | Date,\n private locale: string,\n timezone?: number | string\n ) {\n this.date = new Date(init)\n this.timezoneFixed = timezone !== undefined\n if (timezone === undefined) {\n timezone = this.date.getTimezoneOffset()\n }\n this.timezoneOffset = isString(timezone) ? LiquidDate.getTimezoneOffset(timezone, this.date) : timezone\n this.timezoneName = isString(timezone) ? timezone : ''\n\n const diff = (this.date.getTimezoneOffset() - this.timezoneOffset) * OneMinute\n const time = this.date.getTime() + diff\n this.displayDate = new Date(time)\n }\n\n getTime () {\n return this.displayDate.getTime()\n }\n getMilliseconds () {\n return this.displayDate.getMilliseconds()\n }\n getSeconds () {\n return this.displayDate.getSeconds()\n }\n getMinutes () {\n return this.displayDate.getMinutes()\n }\n getHours () {\n return this.displayDate.getHours()\n }\n getDay () {\n return this.displayDate.getDay()\n }\n getDate () {\n return this.displayDate.getDate()\n }\n getMonth () {\n return this.displayDate.getMonth()\n }\n getFullYear () {\n return this.displayDate.getFullYear()\n }\n toLocaleString (locale?: string, init?: any) {\n if (init?.timeZone) {\n return this.date.toLocaleString(locale, init)\n }\n return this.displayDate.toLocaleString(locale, init)\n }\n toLocaleTimeString (locale?: string) {\n return this.displayDate.toLocaleTimeString(locale)\n }\n toLocaleDateString (locale?: string) {\n return this.displayDate.toLocaleDateString(locale)\n }\n getTimezoneOffset () {\n return this.timezoneOffset!\n }\n getTimeZoneName () {\n if (this.timezoneFixed) return this.timezoneName\n if (!this.DateTimeFormat) return\n return this.DateTimeFormat().resolvedOptions().timeZone\n }\n getLongMonthName () {\n return this.format({ month: 'long' }) ?? monthNames[this.getMonth()]\n }\n getShortMonthName () {\n return this.format({ month: 'short' }) ?? monthNamesShort[this.getMonth()]\n }\n getLongWeekdayName () {\n return this.format({ weekday: 'long' }) ?? dayNames[this.displayDate.getDay()]\n }\n getShortWeekdayName () {\n return this.format({ weekday: 'short' }) ?? dayNamesShort[this.displayDate.getDay()]\n }\n valid () {\n return !isNaN(this.getTime())\n }\n private format (options: Intl.DateTimeFormatOptions) {\n return this.DateTimeFormat && this.DateTimeFormat(this.locale, options).format(this.displayDate)\n }\n\n /**\n * Create a Date object fixed to it's declared Timezone. Both\n * - 2021-08-06T02:29:00.000Z and\n * - 2021-08-06T02:29:00.000+08:00\n * will always be displayed as\n * - 2021-08-06 02:29:00\n * regardless timezoneOffset in JavaScript realm\n *\n * The implementation hack:\n * Instead of calling `.getMonth()`/`.getUTCMonth()` respect to `preserveTimezones`,\n * we create a different Date to trick strftime, it's both simpler and more performant.\n * Given that a template is expected to be parsed fewer times than rendered.\n */\n static createDateFixedToTimezone (dateString: string, locale: string): LiquidDate {\n const m = dateString.match(TIMEZONE_PATTERN)\n // representing a UTC timestamp\n if (m && m[1] === 'Z') {\n return new LiquidDate(+new Date(dateString), locale, 0)\n }\n // has a timezone specified\n if (m && m[2] && m[3] && m[4]) {\n const [, , sign, hours, minutes] = m\n const offset = (sign === '+' ? -1 : 1) * (parseInt(hours, 10) * 60 + parseInt(minutes, 10))\n return new LiquidDate(+new Date(dateString), locale, offset)\n }\n return new LiquidDate(dateString, locale)\n }\n private static getTimezoneOffset (timezoneName: string, date: Date) {\n const localDateString = date.toLocaleString('en-US', { timeZone: timezoneName })\n const utcDateString = date.toLocaleString('en-US', { timeZone: 'UTC' })\n\n const localDate = new Date(localDateString)\n const utcDate = new Date(utcDateString)\n return (+utcDate - +localDate) / (60 * 1000)\n }\n}\n","import { assert } from './assert'\n\nexport class Limiter {\n private message: string\n private base = 0\n private limit: number\n constructor (resource: string, limit: number) {\n this.message = `${resource} limit exceeded`\n this.limit = limit\n }\n use (count: number) {\n if (+count > 0) {\n assert(this.base + +count <= this.limit, this.message)\n this.base += +count\n }\n }\n check (count: number) {\n if (+count > 0) {\n assert(+count <= this.limit, this.message)\n }\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\nimport { TYPES, BLANK } from '../util'\n\nexport abstract class DelimitedToken extends Token {\n public trimLeft = false\n public trimRight = false\n public contentRange: [number, number]\n public constructor (\n kind: TokenKind,\n [contentBegin, contentEnd]: [number, number],\n input: string,\n begin: number,\n end: number,\n trimLeft: boolean,\n trimRight: boolean,\n file?: string\n ) {\n super(kind, input, begin, end, file)\n const tl = input[contentBegin] === '-'\n const tr = input[contentEnd - 1] === '-'\n\n let l = tl ? contentBegin + 1 : contentBegin\n let r = tr ? contentEnd - 1 : contentEnd\n while (l < r && (TYPES[input.charCodeAt(l)] & BLANK)) l++\n while (r > l && (TYPES[input.charCodeAt(r - 1)] & BLANK)) r--\n\n this.contentRange = [l, r]\n this.trimLeft = tl || trimLeft\n this.trimRight = tr || trimRight\n }\n get content () {\n return this.input.slice(this.contentRange[0], this.contentRange[1])\n }\n}\n","import { DelimitedToken } from './delimited-token'\nimport { Tokenizer, TokenKind } from '../parser'\nimport type { NormalizedFullOptions } from '../liquid-options'\n\nexport class TagToken extends DelimitedToken {\n public name: string\n public tokenizer: Tokenizer\n public readonly args: string;\n public constructor (\n input: string,\n begin: number,\n end: number,\n options: NormalizedFullOptions,\n file?: string\n ) {\n const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } = options\n const [valueBegin, valueEnd] = [begin + tagDelimiterLeft.length, end - tagDelimiterRight.length]\n super(TokenKind.Tag, [valueBegin, valueEnd], input, begin, end, trimTagLeft, trimTagRight, file)\n\n this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange)\n this.name = this.tokenizer.readTagName()\n this.tokenizer.assert(this.name, `illegal tag syntax, tag name expected`)\n this.tokenizer.skipBlank()\n this.args = this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1])\n }\n}\n","import { DelimitedToken } from './delimited-token'\nimport { NormalizedFullOptions } from '../liquid-options'\nimport { TokenKind } from '../parser'\n\nexport class OutputToken extends DelimitedToken {\n public constructor (\n input: string,\n begin: number,\n end: number,\n options: NormalizedFullOptions,\n file?: string\n ) {\n const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } = options\n const valueRange: [number, number] = [begin + outputDelimiterLeft.length, end - outputDelimiterRight.length]\n super(TokenKind.Output, valueRange, input, begin, end, trimOutputLeft, trimOutputRight, file)\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\n\nexport class HTMLToken extends Token {\n trimLeft = 0\n trimRight = 0\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.HTML, input, begin, end, file)\n }\n public getContent () {\n return this.input.slice(this.begin + this.trimLeft, this.end - this.trimRight)\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\n\nexport class NumberToken extends Token {\n public content: number\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.Number, input, begin, end, file)\n this.content = Number(this.getText())\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\n\nexport class IdentifierToken extends Token {\n public content: string\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.Word, input, begin, end, file)\n this.content = this.getText()\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\nimport { literalValues, LiteralValue, LiteralKey } from '../util'\n\nexport class LiteralToken extends Token {\n public content: LiteralValue\n public literal: LiteralKey\n public constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.Literal, input, begin, end, file)\n this.literal = this.getText() as LiteralKey\n this.content = literalValues[this.literal]\n }\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\n\nexport const enum OperatorType {\n Binary,\n Unary\n}\n\nexport const operatorPrecedences = {\n '==': 2,\n '!=': 2,\n '>': 2,\n '<': 2,\n '>=': 2,\n '<=': 2,\n 'contains': 2,\n 'not': 1,\n 'and': 0,\n 'or': 0\n}\n\nexport const operatorTypes = {\n '==': OperatorType.Binary,\n '!=': OperatorType.Binary,\n '>': OperatorType.Binary,\n '<': OperatorType.Binary,\n '>=': OperatorType.Binary,\n '<=': OperatorType.Binary,\n 'contains': OperatorType.Binary,\n 'not': OperatorType.Unary,\n 'and': OperatorType.Binary,\n 'or': OperatorType.Binary\n}\n\nexport type OperatorKey = keyof typeof operatorPrecedences\n\nexport class OperatorToken extends Token {\n public operator: OperatorKey\n public constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.Operator, input, begin, end, file)\n this.operator = this.getText() as OperatorKey\n }\n getPrecedence () {\n return this.operator in operatorPrecedences ? operatorPrecedences[this.operator] : 1\n }\n}\n","import { Token } from './token'\nimport { LiteralToken } from './literal-token'\nimport { ValueToken } from './value-token'\nimport { IdentifierToken } from './identifier-token'\nimport { NumberToken } from './number-token'\nimport { RangeToken } from './range-token'\nimport { QuotedToken } from './quoted-token'\nimport { TokenKind } from '../parser'\n\nexport class PropertyAccessToken extends Token {\n constructor (\n public variable: QuotedToken | RangeToken | LiteralToken | NumberToken | undefined,\n public props: (ValueToken | IdentifierToken)[],\n input: string,\n begin: number,\n end: number,\n file?: string\n ) {\n super(TokenKind.PropertyAccess, input, begin, end, file)\n }\n}\n","import { Token } from './token'\nimport { FilterArg } from '../parser/filter-arg'\nimport { TokenKind } from '../parser'\n\nexport class FilterToken extends Token {\n public constructor (\n public name: string,\n public args: FilterArg[],\n input: string,\n begin: number,\n end: number,\n file?: string\n ) {\n super(TokenKind.Filter, input, begin, end, file)\n }\n}\n","import { Token } from './token'\nimport { ValueToken } from './value-token'\nimport { IdentifierToken } from './identifier-token'\nimport { TokenKind } from '../parser'\n\nexport class HashToken extends Token {\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public name: IdentifierToken,\n public value?: ValueToken,\n public file?: string\n ) {\n super(TokenKind.Hash, input, begin, end, file)\n }\n}\n","const rHex = /[\\da-fA-F]/\nconst rOct = /[0-7]/\nconst escapeChar: Record = {\n b: '\\b',\n f: '\\f',\n n: '\\n',\n r: '\\r',\n t: '\\t',\n v: '\\x0B'\n}\n\nfunction hexVal (c: string) {\n const code = c.charCodeAt(0)\n if (code >= 97) return code - 87\n if (code >= 65) return code - 55\n return code - 48\n}\n\nexport function parseStringLiteral (str: string): string {\n let ret = ''\n for (let i = 1; i < str.length - 1; i++) {\n if (str[i] !== '\\\\') {\n ret += str[i]\n continue\n }\n if (escapeChar[str[i + 1]] !== undefined) {\n ret += escapeChar[str[++i]]\n } else if (str[i + 1] === 'u') {\n let val = 0\n let j = i + 2\n while (j <= i + 5 && rHex.test(str[j])) {\n val = val * 16 + hexVal(str[j++])\n }\n i = j - 1\n ret += String.fromCharCode(val)\n } else if (!rOct.test(str[i + 1])) {\n ret += str[++i]\n } else {\n let j = i + 1\n let val = 0\n while (j <= i + 3 && rOct.test(str[j])) {\n val = val * 8 + hexVal(str[j++])\n }\n i = j - 1\n ret += String.fromCharCode(val)\n }\n }\n return ret\n}\n","import { Token } from './token'\nimport { TokenKind } from '../parser'\nimport { parseStringLiteral } from '../render/string'\n\nexport class QuotedToken extends Token {\n public readonly content: string\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.Quoted, input, begin, end, file)\n this.content = parseStringLiteral(this.getText())\n }\n}\n","import { Token } from './token'\nimport { ValueToken } from './value-token'\nimport { TokenKind } from '../parser'\n\nexport class RangeToken extends Token {\n constructor (\n public input: string,\n public begin: number,\n public end: number,\n public lhs: ValueToken,\n public rhs: ValueToken,\n public file?: string\n ) {\n super(TokenKind.Range, input, begin, end, file)\n }\n}\n","import { DelimitedToken } from './delimited-token'\nimport { NormalizedFullOptions } from '../liquid-options'\nimport { Tokenizer, TokenKind } from '../parser'\n\n/**\n * LiquidTagToken is different from TagToken by not having delimiters `{%` or `%}`\n */\nexport class LiquidTagToken extends DelimitedToken {\n public name: string\n public tokenizer: Tokenizer\n public constructor (\n input: string,\n begin: number,\n end: number,\n options: NormalizedFullOptions,\n file?: string\n ) {\n super(TokenKind.Tag, [begin, end], input, begin, end, false, false, file)\n this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange)\n this.name = this.tokenizer.readTagName()\n this.tokenizer.assert(this.name, 'illegal liquid tag syntax')\n this.tokenizer.skipBlank()\n }\n\n get args (): string {\n return this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1])\n }\n}\n","import { Token } from './token'\nimport { FilterToken } from './filter-token'\nimport { TokenKind } from '../parser'\nimport { Expression } from '../render'\n\n/**\n * value expression with optional filters\n * e.g.\n * {% assign foo=\"bar\" | append: \"coo\" %}\n */\nexport class FilteredValueToken extends Token {\n constructor (\n public initial: Expression,\n public filters: FilterToken[],\n public input: string,\n public begin: number,\n public end: number,\n public file?: string\n ) {\n super(TokenKind.FilteredValue, input, begin, end, file)\n }\n}\n","interface LiquidPerformance {\n now: () => number\n}\n\nconst polyfill: LiquidPerformance = {\n now: () => Date.now()\n}\n\nexport function getPerformance (): LiquidPerformance {\n return (typeof global === 'object' && global.performance) ||\n (typeof window === 'object' && window.performance) ||\n polyfill\n}\n","import { getPerformance } from '../util/performance'\nimport { toPromise, RenderError, LiquidErrors, LiquidError } from '../util'\nimport { Context } from '../context'\nimport { Template } from '../template'\nimport { Emitter, KeepingTypeEmitter, StreamedEmitter, SimpleEmitter } from '../emitters'\n\nexport class Render {\n public renderTemplatesToNodeStream (templates: Template[], ctx: Context): NodeJS.ReadableStream {\n const emitter = new StreamedEmitter()\n Promise.resolve().then(() => toPromise(this.renderTemplates(templates, ctx, emitter)))\n .then(() => emitter.end(), err => emitter.error(err))\n return emitter.stream\n }\n public * renderTemplates (templates: Template[], ctx: Context, emitter?: Emitter): IterableIterator {\n if (!emitter) {\n emitter = ctx.opts.keepOutputType ? new KeepingTypeEmitter() : new SimpleEmitter()\n }\n ctx.renderLimit.check(getPerformance().now())\n const errors = []\n for (const tpl of templates) {\n ctx.renderLimit.check(getPerformance().now())\n try {\n // if tpl.render supports emitter, it'll return empty `html`\n const html = yield tpl.render(ctx, emitter)\n // if not, it'll return an `html`, write to the emitter for it\n html && emitter.write(html)\n if (ctx.breakCalled || ctx.continueCalled) break\n } catch (e) {\n const err = LiquidError.is(e) ? e : new RenderError(e as Error, tpl)\n if (ctx.opts.catchAllErrors) errors.push(err)\n else throw err\n }\n }\n if (errors.length) {\n throw new LiquidErrors(errors)\n }\n return emitter.buffer\n }\n}\n","import { QuotedToken, RangeToken, OperatorToken, Token, PropertyAccessToken, OperatorType, operatorTypes } from '../tokens'\nimport { isRangeToken, isPropertyAccessToken, UndefinedVariableError, range, isOperatorToken, assert } from '../util'\nimport type { Context } from '../context'\nimport type { UnaryOperatorHandler } from '../render'\nimport { Drop } from '../drop'\n\nexport class Expression {\n readonly postfix: Token[]\n\n public constructor (tokens: IterableIterator) {\n this.postfix = [...toPostfix(tokens)]\n }\n public * evaluate (ctx: Context, lenient?: boolean): Generator {\n assert(ctx, 'unable to evaluate: context not defined')\n const operands: any[] = []\n for (const token of this.postfix) {\n if (isOperatorToken(token)) {\n const r = operands.pop()\n let result\n if (operatorTypes[token.operator] === OperatorType.Unary) {\n result = yield (ctx.opts.operators[token.operator] as UnaryOperatorHandler)(r, ctx)\n } else {\n const l = operands.pop()\n result = yield ctx.opts.operators[token.operator](l, r, ctx)\n }\n operands.push(result)\n } else {\n operands.push(yield evalToken(token, ctx, lenient))\n }\n }\n return operands[0]\n }\n public valid () {\n return !!this.postfix.length\n }\n}\n\nexport function * evalToken (token: Token | undefined, ctx: Context, lenient = false): IterableIterator {\n if (!token) return\n if ('content' in token) return token.content\n if (isPropertyAccessToken(token)) return yield evalPropertyAccessToken(token, ctx, lenient)\n if (isRangeToken(token)) return yield evalRangeToken(token, ctx)\n}\n\nfunction * evalPropertyAccessToken (token: PropertyAccessToken, ctx: Context, lenient: boolean): IterableIterator {\n const props: (string | number | Drop)[] = []\n for (const prop of token.props) {\n props.push((yield evalToken(prop, ctx, false)) as unknown as string | number | Drop)\n }\n try {\n if (token.variable) {\n const variable = yield evalToken(token.variable, ctx, lenient)\n return yield ctx._getFromScope(variable, props)\n } else {\n return yield ctx._get(props)\n }\n } catch (e) {\n if (lenient && (e as Error).name === 'InternalUndefinedVariableError') return null\n throw (new UndefinedVariableError(e as Error, token))\n }\n}\n\nexport function evalQuotedToken (token: QuotedToken) {\n return token.content\n}\n\nfunction * evalRangeToken (token: RangeToken, ctx: Context) {\n const low: number = yield evalToken(token.lhs, ctx)\n const high: number = yield evalToken(token.rhs, ctx)\n ctx.memoryLimit.use(high - low + 1)\n return range(+low, +high + 1)\n}\n\nfunction * toPostfix (tokens: IterableIterator): IterableIterator {\n const ops: OperatorToken[] = []\n for (const token of tokens) {\n if (isOperatorToken(token)) {\n while (ops.length && ops[ops.length - 1].getPrecedence() > token.getPrecedence()) {\n yield ops.pop()!\n }\n ops.push(token)\n } else yield token\n }\n while (ops.length) {\n yield ops.pop()!\n }\n}\n","import { Context } from '../context/context'\nimport { toValue } from '../util'\n\nexport function isTruthy (val: any, ctx: Context): boolean {\n return !isFalsy(val, ctx)\n}\n\nexport function isFalsy (val: any, ctx: Context): boolean {\n val = toValue(val)\n\n if (ctx.opts.jsTruthy) {\n return !val\n } else {\n return val === false || undefined === val || val === null\n }\n}\n","import { isComparable } from '../drop/comparable'\nimport { Context } from '../context'\nimport { toValue } from '../util'\nimport { isFalsy, isTruthy } from '../render/boolean'\nimport { isArray, isFunction } from '../util/underscore'\n\nexport type UnaryOperatorHandler = (operand: any, ctx: Context) => boolean;\nexport type BinaryOperatorHandler = (lhs: any, rhs: any, ctx: Context) => boolean;\nexport type OperatorHandler = UnaryOperatorHandler | BinaryOperatorHandler;\nexport type Operators = Record\n\nexport const defaultOperators: Operators = {\n '==': equals,\n '!=': (l: any, r: any) => !equals(l, r),\n '>': (l: any, r: any) => {\n if (isComparable(l)) return l.gt(r)\n if (isComparable(r)) return r.lt(l)\n return toValue(l) > toValue(r)\n },\n '<': (l: any, r: any) => {\n if (isComparable(l)) return l.lt(r)\n if (isComparable(r)) return r.gt(l)\n return toValue(l) < toValue(r)\n },\n '>=': (l: any, r: any) => {\n if (isComparable(l)) return l.geq(r)\n if (isComparable(r)) return r.leq(l)\n return toValue(l) >= toValue(r)\n },\n '<=': (l: any, r: any) => {\n if (isComparable(l)) return l.leq(r)\n if (isComparable(r)) return r.geq(l)\n return toValue(l) <= toValue(r)\n },\n 'contains': (l: any, r: any) => {\n l = toValue(l)\n if (isArray(l)) return l.some((i) => equals(i, r))\n if (isFunction(l?.indexOf)) return l.indexOf(toValue(r)) > -1\n return false\n },\n 'not': (v: any, ctx: Context) => isFalsy(toValue(v), ctx),\n 'and': (l: any, r: any, ctx: Context) => isTruthy(toValue(l), ctx) && isTruthy(toValue(r), ctx),\n 'or': (l: any, r: any, ctx: Context) => isTruthy(toValue(l), ctx) || isTruthy(toValue(r), ctx)\n}\n\nexport function equals (lhs: any, rhs: any): boolean {\n if (isComparable(lhs)) return lhs.equals(rhs)\n if (isComparable(rhs)) return rhs.equals(lhs)\n lhs = toValue(lhs)\n rhs = toValue(rhs)\n if (isArray(lhs)) {\n return isArray(rhs) && arrayEquals(lhs, rhs)\n }\n return lhs === rhs\n}\n\nfunction arrayEquals (lhs: any[], rhs: any[]): boolean {\n if (lhs.length !== rhs.length) return false\n return !lhs.some((value, i) => !equals(value, rhs[i]))\n}\n\nexport function arrayIncludes (arr: any[], item: any): boolean {\n return arr.some(value => equals(value, item))\n}\n","import { Cache } from './cache'\n\nclass Node {\n constructor (\n public key: string,\n public value: T,\n public next: Node,\n public prev: Node\n ) {}\n}\n\nexport class LRU implements Cache {\n private cache: Record> = {}\n private head: Node\n private tail: Node\n\n constructor (\n public limit: number,\n public size = 0\n ) {\n this.head = new Node('HEAD', null as any, null as any, null as any)\n this.tail = new Node('TAIL', null as any, null as any, null as any)\n this.head.next = this.tail\n this.tail.prev = this.head\n }\n\n write (key: string, value: T) {\n if (this.cache[key]) {\n this.cache[key].value = value\n } else {\n const node = new Node(key, value, this.head.next, this.head)\n this.head.next.prev = node\n this.head.next = node\n\n this.cache[key] = node\n this.size++\n this.ensureLimit()\n }\n }\n\n read (key: string): T | undefined {\n if (!this.cache[key]) return\n const { value } = this.cache[key]\n this.remove(key)\n this.write(key, value)\n return value\n }\n\n remove (key: string) {\n const node = this.cache[key]\n node.prev.next = node.next\n node.next.prev = node.prev\n delete this.cache[key]\n this.size--\n }\n\n clear () {\n this.head.next = this.tail\n this.tail.prev = this.head\n this.size = 0\n this.cache = {}\n }\n\n private ensureLimit () {\n if (this.size > this.limit) this.remove(this.tail.prev.key)\n }\n}\n","import { last } from '../util'\n\nfunction domResolve (root: string, path: string) {\n const base = document.createElement('base')\n base.href = root\n\n const head = document.getElementsByTagName('head')[0]\n head.insertBefore(base, head.firstChild)\n\n const a = document.createElement('a')\n a.href = path\n const resolved = a.href\n head.removeChild(base)\n\n return resolved\n}\n\nexport function resolve (root: string, filepath: string, ext: string) {\n if (root.length && last(root) !== '/') root += '/'\n const url = domResolve(root, filepath)\n return url.replace(/^(\\w+:\\/\\/[^/]+)(\\/[^?]+)/, (str, origin, path) => {\n const last = path.split('/').pop()\n if (/\\.\\w+$/.test(last)) return str\n return origin + path + ext\n })\n}\n\nexport async function readFile (url: string): Promise {\n return new Promise((resolve, reject) => {\n const xhr = new XMLHttpRequest()\n xhr.onload = () => {\n if (xhr.status >= 200 && xhr.status < 300) {\n resolve(xhr.responseText as string)\n } else {\n reject(new Error(xhr.statusText))\n }\n }\n xhr.onerror = () => {\n reject(new Error('An error occurred whilst receiving the response.'))\n }\n xhr.open('GET', url)\n xhr.send()\n })\n}\n\nexport function readFileSync (url: string): string {\n const xhr = new XMLHttpRequest()\n xhr.open('GET', url, false)\n xhr.send()\n if (xhr.status < 200 || xhr.status >= 300) {\n throw new Error(xhr.statusText)\n }\n return xhr.responseText as string\n}\n\nexport async function exists (filepath: string) {\n return true\n}\n\nexport function existsSync (filepath: string) {\n return true\n}\n\nexport function dirname (filepath: string) {\n return domResolve(filepath, '.')\n}\n\nexport const sep = '/'\n","import { isFalsy } from '../render/boolean'\nimport { identify, isArray, isString, toValue } from '../util/underscore'\nimport { FilterImpl } from '../template'\n\nfunction chargeJsonReplacerValue (memoryLimit: { use(count: number): void }, val: unknown) {\n if (typeof val === 'string') {\n memoryLimit.use(val.length)\n } else if (val === null || typeof val === 'number' || typeof val === 'boolean') {\n memoryLimit.use(JSON.stringify(val).length)\n } else if (Array.isArray(val)) {\n memoryLimit.use(val.length + 1)\n } else if (typeof val === 'object') {\n memoryLimit.use(2)\n }\n}\n\nfunction defaultFilter (this: FilterImpl, value: T1, defaultValue: T2, ...args: Array<[string, any]>): T1 | T2 {\n value = toValue(value)\n if (isArray(value) || isString(value)) return value.length ? value : defaultValue\n if (value === false && (new Map(args)).get('allow_false')) return false as T1\n return isFalsy(value, this.context) ? defaultValue : value\n}\n\nfunction json (this: FilterImpl, value: any, space = 0) {\n const memoryLimit = this.context.memoryLimit\n return JSON.stringify(value, (_key, val) => {\n chargeJsonReplacerValue(memoryLimit, val)\n return val\n }, space)\n}\n\nfunction inspect (this: FilterImpl, value: any, space = 0) {\n const memoryLimit = this.context.memoryLimit\n const ancestors: object[] = []\n return JSON.stringify(value, function (this: unknown, _key: unknown, value: any) {\n if (typeof value !== 'object' || value === null) {\n chargeJsonReplacerValue(memoryLimit, value)\n return value\n }\n // `this` is the object that value is contained in, i.e., its direct parent.\n while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) ancestors.pop()\n if (ancestors.includes(value)) {\n memoryLimit.use('[Circular]'.length)\n return '[Circular]'\n }\n ancestors.push(value)\n chargeJsonReplacerValue(memoryLimit, value)\n return value\n }, space)\n}\n\nfunction to_integer (value: any) {\n return Number(value)\n}\n\nconst raw = {\n raw: true,\n handler: identify\n}\n\nexport default {\n default: defaultFilter,\n raw,\n jsonify: json,\n to_integer,\n json,\n inspect\n}\n","import { FilterImpl } from '../template'\nimport { stringify } from '../util/underscore'\n\nconst escapeMap: Record = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": '''\n}\nconst unescapeMap: Record = {\n '&': '&',\n '<': '<',\n '>': '>',\n '"': '\"',\n ''': \"'\"\n}\n\nexport function escape (this: FilterImpl, str: string) {\n str = stringify(str)\n this.context.memoryLimit.use(str.length)\n return str.replace(/&|<|>|\"|'/g, m => escapeMap[m])\n}\n\nexport function xml_escape (this: FilterImpl, str: string) {\n return escape.call(this, str)\n}\n\nfunction unescape (this: FilterImpl, str: string) {\n str = stringify(str)\n this.context.memoryLimit.use(str.length)\n return str.replace(/&(amp|lt|gt|#34|#39);/g, m => unescapeMap[m])\n}\n\nexport function escape_once (this: FilterImpl, str: string) {\n return escape.call(this, unescape.call(this, str))\n}\n\nexport function newline_to_br (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n return str.replace(/\\r?\\n/gm, '
\\n')\n}\n\n// Raw-text blocks (HTML5) plus '<...>' as the catch-all kind; a regex\n// equivalent is O(n^2) in V8 on unclosed openers.\nexport function strip_html (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n const blocks = new Map([[''], [''], [''], ['<', '>']])\n let out = ''\n let i = 0\n while (i < str.length) {\n const lt = str.indexOf('<', i)\n if (lt < 0) return out + str.slice(i)\n out += str.slice(i, lt)\n for (const [opener, closer] of blocks) {\n if (!str.startsWith(opener, lt)) continue\n const e = str.indexOf(closer, lt + opener.length)\n if (e >= 0) { i = e + closer.length; break }\n blocks.delete(opener)\n }\n if (i <= lt) return out + str.slice(lt)\n }\n return out\n}\n","import { isNil } from '../util'\n\nexport class MapFS {\n constructor (private mapping: {[key: string]: string}) {}\n\n public sep = '/'\n\n async exists (filepath: string) {\n return this.existsSync(filepath)\n }\n\n existsSync (filepath: string) {\n return !isNil(this.mapping[filepath])\n }\n\n async readFile (filepath: string) {\n return this.readFileSync(filepath)\n }\n\n readFileSync (filepath: string) {\n const content = this.mapping[filepath]\n if (isNil(content)) throw new Error(`ENOENT: ${filepath}`)\n return content\n }\n\n dirname (filepath: string) {\n const segments = filepath.split(this.sep)\n segments.pop()\n return segments.join(this.sep)\n }\n\n resolve (dir: string, file: string, ext: string) {\n file += ext\n if (dir === '.') return file\n const segments = dir.split(/\\/+/)\n for (const segment of file.split(this.sep)) {\n if (segment === '.' || segment === '') continue\n else if (segment === '..') {\n if (segments.length > 1 || segments[0] !== '') segments.pop()\n } else segments.push(segment)\n }\n return segments.join(this.sep)\n }\n}\n","import { assert, isArray, isString, isFunction } from './util'\nimport { getDateTimeFormat } from './util/intl'\nimport { LRU, LiquidCache } from './cache'\nimport { FS, LookupType } from './fs'\nimport * as fs from './fs/fs-impl'\nimport { defaultOperators, Operators } from './render'\nimport misc from './filters/misc'\nimport { escape } from './filters/html'\nimport { MapFS } from './fs/map-fs'\n\ntype OutputEscape = (value: any) => string\ntype OutputEscapeOption = 'escape' | 'json' | OutputEscape\n\nexport interface LiquidOptions {\n /** A directory or an array of directories from where to resolve layout and include templates, and the filename passed to `.renderFile()`. If it's an array, the files are looked up in the order they occur in the array. Defaults to `[\".\"]` */\n root?: string | string[];\n /** A directory or an array of directories from where to resolve included templates. If it's an array, the files are looked up in the order they occur in the array. Defaults to `root` */\n partials?: string | string[];\n /** A directory or an array of directories from where to resolve layout templates. If it's an array, the files are looked up in the order they occur in the array. Defaults to `root` */\n layouts?: string | string[];\n /** Allow refer to layouts/partials by relative pathname. To avoid arbitrary filesystem read, paths been referenced also need to be within corresponding root, partials, layouts. Defaults to `true`. */\n relativeReference?: boolean;\n /** Use jekyll style include, pass parameters to `include` variable of current scope. Defaults to `false`. */\n jekyllInclude?: boolean;\n /** Use jekyll style where filter, enables array item match. Defaults to `false`. */\n jekyllWhere?: boolean;\n /** Add a extname (if filepath doesn't include one) before template file lookup. Eg: setting to `\".html\"` will allow including file by basename. Defaults to `\"\"`. */\n extname?: string;\n /** Whether or not to cache resolved templates. Defaults to `false`. */\n cache?: boolean | number | LiquidCache;\n /** Use JavaScript Truthiness. Defaults to `false`. */\n jsTruthy?: boolean;\n /** If set, treat the `filepath` parameter in `{%include filepath %}` and `{%layout filepath%}` as a variable, otherwise as a literal value. Defaults to `true`. */\n dynamicPartials?: boolean;\n /** Whether or not to assert filter existence. If set to `false`, undefined filters will be skipped. Otherwise, undefined filters will cause an exception. Defaults to `false`. */\n strictFilters?: boolean;\n /** Whether or not to assert variable existence. If set to `false`, undefined variables will be rendered as empty string. Otherwise, undefined variables will cause an exception. Defaults to `false`. */\n strictVariables?: boolean;\n /** Catch all errors instead of exit upon one. Please note that render errors won't be reached when parse fails. */\n catchAllErrors?: boolean;\n /**\n * Hide scope variables from prototypes, useful when you're passing a not sanitized object into LiquidJS or need to hide prototypes from templates.\n * This only applies to property/index access on scope objects. Filter transforms and iteration operate on the resolved value with standard JavaScript semantics, so prototype-inherited array indices may still be surfaced by them.\n */\n ownPropertyOnly?: boolean;\n /** Modifies the behavior of `strictVariables`. If set, a single undefined variable will *not* cause an exception in the context of the `if`/`elsif`/`unless` tag and the `default` filter. Instead, it will evaluate to `false` and `null`, respectively. Irrelevant if `strictVariables` is not set. Defaults to `false`. **/\n lenientIf?: boolean;\n /** JavaScript timezone name or timezoneOffset for `date` filter, default to local time. That means if you're in Australia (UTC+10), it'll default to `-600` or `Australia/Lindeman` */\n timezoneOffset?: number | string;\n /** Default date format to use if the date filter doesn't include a format. Defaults to `%A, %B %-e, %Y at %-l:%M %P %z`. */\n dateFormat?: string;\n /** Default locale, will be used by date filter. Defaults to system locale. */\n locale?: string;\n /** Strip blank characters (including ` `, `\\t`, and `\\r`) from the right of tags (`{% %}`) until `\\n` (inclusive). Defaults to `false`. */\n trimTagRight?: boolean;\n /** Similar to `trimTagRight`, whereas the `\\n` is exclusive. Defaults to `false`. See Whitespace Control for details. */\n trimTagLeft?: boolean;\n /** Strip blank characters (including ` `, `\\t`, and `\\r`) from the right of values (`{{ }}`) until `\\n` (inclusive). Defaults to `false`. */\n trimOutputRight?: boolean;\n /** Similar to `trimOutputRight`, whereas the `\\n` is exclusive. Defaults to `false`. See Whitespace Control for details. */\n trimOutputLeft?: boolean;\n /** The left delimiter for liquid tags. **/\n tagDelimiterLeft?: string;\n /** The right delimiter for liquid tags. **/\n tagDelimiterRight?: string;\n /** The left delimiter for liquid outputs. **/\n outputDelimiterLeft?: string;\n /** The right delimiter for liquid outputs. **/\n outputDelimiterRight?: string;\n /** Whether input strings to date filter preserve the given timezone **/\n preserveTimezones?: boolean;\n /** Whether `trim*Left`/`trim*Right` is greedy. When set to `true`, all consecutive blank characters including `\\n` will be trimmed regardless of line breaks. Defaults to `true`. */\n greedy?: boolean;\n /** `fs` is used to override the default file-system module with a custom implementation. */\n fs?: FS;\n /** keyValue separator */\n keyValueSeparator?: string;\n /** Render from an in-memory `templates` mapping instead of the file system. When `templates` is set, Liquid uses the provided mapping for template lookup (including includes, layouts, and partials), and file-system options such as `fs`, `root`, `partials`, `layouts`, and `relativeReference` are effectively bypassed for those lookups. */\n templates?: {[key: string]: string};\n /** the global scope passed down to all partial and layout templates, i.e. templates included by `include`, `layout` and `render` tags. */\n globals?: object;\n /** Whether or not to keep value type when writing the Output, not working for streamed rendering. Defaults to `false`. */\n keepOutputType?: boolean;\n /** Default escape filter applied to output values, when set, you'll have to add `| raw` for values don't need to be escaped. Defaults to `undefined`. */\n outputEscape?: OutputEscapeOption;\n /** An object of operators for conditional statements. Defaults to the regular Liquid operators. */\n operators?: Operators;\n /** Respect parameter order when using filters like \"for ... reversed limit\", Defaults to `false`. */\n orderedFilterParameters?: boolean;\n /** For DoS handling, limit total length of templates parsed in one `parse()` call. A typical PC can handle 1e8 (100M) characters without issues. */\n parseLimit?: number;\n /** For DoS handling, limit total time (in ms) for each `render()` call. */\n renderLimit?: number;\n /** For DoS handling, limit new objects creation, including array concat/join/strftime, etc. A typical PC can handle 1e9 (1G) memory without issue. */\n memoryLimit?: number;\n}\n\nexport interface RenderOptions {\n /**\n * This call is sync or async? It's used by Liquid internal methods, you'll not need this.\n */\n sync?: boolean;\n /**\n * Same as `globals` on LiquidOptions, but only for current render() call\n */\n globals?: object;\n /**\n * Same as `strictVariables` on LiquidOptions, but only for current render() call\n */\n strictVariables?: boolean;\n /**\n * Same as `ownPropertyOnly` on LiquidOptions, but only for current render() call\n */\n ownPropertyOnly?: boolean;\n /** For DoS handling, limit total renders of tag/HTML/output in one `render()` call. A typical PC can handle 1e5 renders of typical templates per second. */\n templateLimit?: number;\n /** For DoS handling, limit total time (in ms) for each `render()` call. */\n renderLimit?: number;\n /** For DoS handling, limit new objects creation, including array concat/join/strftime, etc. A typical PC can handle 1e9 (1G) memory without issue.. */\n memoryLimit?: number;\n}\n\nexport interface RenderFileOptions extends RenderOptions {\n lookupType?: LookupType;\n}\n\ninterface NormalizedOptions extends LiquidOptions {\n root?: string[];\n partials?: string[];\n layouts?: string[];\n cache?: LiquidCache;\n outputEscape?: OutputEscape;\n}\n\nexport interface NormalizedFullOptions extends NormalizedOptions {\n root: string[];\n partials: string[];\n layouts: string[];\n relativeReference: boolean;\n jekyllInclude: boolean;\n extname: string;\n cache?: LiquidCache;\n jsTruthy: boolean;\n dynamicPartials: boolean;\n fs: FS;\n strictFilters: boolean;\n strictVariables: boolean;\n ownPropertyOnly: boolean;\n lenientIf: boolean;\n dateFormat: string;\n locale: string;\n trimTagRight: boolean;\n trimTagLeft: boolean;\n trimOutputRight: boolean;\n trimOutputLeft: boolean;\n tagDelimiterLeft: string;\n tagDelimiterRight: string;\n outputDelimiterLeft: string;\n outputDelimiterRight: string;\n preserveTimezones: boolean;\n greedy: boolean;\n globals: object;\n keepOutputType: boolean;\n operators: Operators;\n parseLimit: number;\n renderLimit: number;\n memoryLimit: number;\n}\n\nexport const defaultOptions: NormalizedFullOptions = {\n root: ['.'],\n layouts: ['.'],\n partials: ['.'],\n relativeReference: true,\n jekyllInclude: false,\n keyValueSeparator: ':',\n cache: undefined,\n extname: '',\n fs: fs,\n dynamicPartials: true,\n jsTruthy: false,\n dateFormat: '%A, %B %-e, %Y at %-l:%M %P %z',\n locale: '',\n trimTagRight: false,\n trimTagLeft: false,\n trimOutputRight: false,\n trimOutputLeft: false,\n greedy: true,\n tagDelimiterLeft: '{%',\n tagDelimiterRight: '%}',\n outputDelimiterLeft: '{{',\n outputDelimiterRight: '}}',\n preserveTimezones: false,\n strictFilters: false,\n strictVariables: false,\n ownPropertyOnly: true,\n lenientIf: false,\n globals: {},\n keepOutputType: false,\n operators: defaultOperators,\n memoryLimit: Infinity,\n parseLimit: Infinity,\n renderLimit: Infinity\n}\n\nexport function normalize (options: LiquidOptions): NormalizedFullOptions {\n if (options.hasOwnProperty('root')) {\n if (!options.hasOwnProperty('partials')) options.partials = options.root\n if (!options.hasOwnProperty('layouts')) options.layouts = options.root\n }\n if (options.hasOwnProperty('cache')) {\n let cache: LiquidCache | undefined\n if (typeof options.cache === 'number') cache = options.cache > 0 ? new LRU(options.cache) : undefined\n else if (typeof options.cache === 'object') cache = options.cache\n else cache = options.cache ? new LRU(1024) : undefined\n options.cache = cache\n }\n options = { ...defaultOptions, ...(options.jekyllInclude ? { dynamicPartials: false } : {}), ...options }\n if ((!options.fs!.dirname || !options.fs!.sep) && options.relativeReference) {\n console.warn('[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning')\n options.relativeReference = false\n }\n options.root = normalizeDirectoryList(options.root)\n options.partials = normalizeDirectoryList(options.partials)\n options.layouts = normalizeDirectoryList(options.layouts)\n options.outputEscape = options.outputEscape && getOutputEscapeFunction(options.outputEscape)\n if (!options.locale) {\n options.locale = getDateTimeFormat()?.().resolvedOptions().locale ?? 'en-US'\n }\n if (options.templates) {\n options.fs = new MapFS(options.templates)\n options.relativeReference = true\n options.root = options.partials = options.layouts = '.'\n }\n return options as NormalizedFullOptions\n}\n\nfunction getOutputEscapeFunction (nameOrFunction: OutputEscapeOption): OutputEscape {\n if (nameOrFunction === 'escape') return escape\n if (nameOrFunction === 'json') return misc.json\n assert(isFunction(nameOrFunction), '`outputEscape` need to be of type string or function')\n return nameOrFunction\n}\n\nexport function normalizeDirectoryList (value: any): string[] {\n let list: string[] = []\n if (isArray(value)) list = value\n if (isString(value)) list = [value]\n return list\n}\n","import { Token } from '../tokens'\nimport { NormalizedFullOptions } from '../liquid-options'\nimport { isTagToken, isHTMLToken, isDelimitedToken, TYPES, INLINE_BLANK, BLANK } from '../util'\n\nexport function whiteSpaceCtrl (tokens: Token[], options: NormalizedFullOptions) {\n let inRaw = false\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i]\n if (!isDelimitedToken(token)) continue\n if (!inRaw && token.trimLeft) {\n trimLeft(tokens[i - 1], options.greedy)\n }\n\n if (isTagToken(token)) {\n if (token.name === 'raw') inRaw = true\n else if (token.name === 'endraw') inRaw = false\n }\n\n if (!inRaw && token.trimRight) {\n trimRight(tokens[i + 1], options.greedy)\n }\n }\n}\n\nfunction trimLeft (token: Token, greedy: boolean) {\n if (!token || !isHTMLToken(token)) return\n\n const mask = greedy ? BLANK : INLINE_BLANK\n while (TYPES[token.input.charCodeAt(token.end - 1 - token.trimRight)] & mask) token.trimRight++\n}\n\nfunction trimRight (token: Token, greedy: boolean) {\n if (!token || !isHTMLToken(token)) return\n\n const mask = greedy ? BLANK : INLINE_BLANK\n while (TYPES[token.input.charCodeAt(token.begin + token.trimLeft)] & mask) token.trimLeft++\n if (token.input.charAt(token.begin + token.trimLeft) === '\\n') token.trimLeft++\n}\n","import { FilteredValueToken, TagToken, HTMLToken, HashToken, QuotedToken, LiquidTagToken, OutputToken, ValueToken, Token, RangeToken, FilterToken, TopLevelToken, PropertyAccessToken, OperatorToken, LiteralToken, IdentifierToken, NumberToken } from '../tokens'\nimport { OperatorHandler } from '../render/operator'\nimport { LiteralValue, Trie, createTrie, ellipsis, literalValues, TokenizationError, TYPES, QUOTE, BLANK, NUMBER, SIGN, isWord, isString } from '../util'\nimport { Operators, Expression } from '../render'\nimport { NormalizedFullOptions, defaultOptions } from '../liquid-options'\nimport { FilterArg } from './filter-arg'\nimport { whiteSpaceCtrl } from './whitespace-ctrl'\n\nexport class Tokenizer {\n p: number\n N: number\n private rawBeginAt = -1\n private opTrie: Trie\n private literalTrie: Trie\n\n constructor (\n public input: string,\n operators: Operators = defaultOptions.operators,\n public file?: string,\n range?: [number, number]\n ) {\n this.p = range ? range[0] : 0\n this.N = range ? range[1] : input.length\n this.opTrie = createTrie(operators)\n this.literalTrie = createTrie(literalValues)\n }\n\n readExpression () {\n return new Expression(this.readExpressionTokens())\n }\n\n * readExpressionTokens (): IterableIterator {\n while (this.p < this.N) {\n const operator = this.readOperator()\n if (operator) {\n yield operator\n continue\n }\n const operand = this.readValue()\n if (operand) {\n yield operand\n continue\n }\n return\n }\n }\n readOperator (): OperatorToken | undefined {\n this.skipBlank()\n const end = this.matchTrie(this.opTrie)\n if (end === -1) return\n return new OperatorToken(this.input, this.p, (this.p = end), this.file)\n }\n matchTrie (trie: Trie) {\n let node: Trie = trie\n let i = this.p\n let info: Trie | undefined\n while ((node as Trie)[this.input[i]] && i < this.N) {\n node = (node as Trie)[this.input[i++]] as Trie\n if (node['end']) info = node\n }\n if (!info) return -1\n if (info['needBoundary'] && isWord(this.peek(i - this.p))) return -1\n return i\n }\n readFilteredValue (): FilteredValueToken {\n const begin = this.p\n const initial = this.readExpression()\n this.assert(initial.valid(), `invalid value expression: ${this.snapshot()}`)\n const filters = this.readFilters()\n return new FilteredValueToken(initial, filters, this.input, begin, this.p, this.file)\n }\n readFilters (): FilterToken[] {\n const filters = []\n while (true) {\n const filter = this.readFilter()\n if (!filter) return filters\n filters.push(filter)\n }\n }\n readFilter (): FilterToken | null {\n this.skipBlank()\n if (this.end()) return null\n this.assert(this.read() === '|', `expected \"|\" before filter`)\n const name = this.readIdentifier()\n if (!name.size()) {\n this.assert(this.end(), `expected filter name`)\n return null\n }\n const args = []\n this.skipBlank()\n if (this.peek() === ':') {\n do {\n ++this.p\n const arg = this.readFilterArg()\n arg && args.push(arg)\n this.skipBlank()\n this.assert(this.end() || this.peek() === ',' || this.peek() === '|', () => `unexpected character ${this.snapshot()}`)\n } while (this.peek() === ',')\n } else if (this.peek() === '|' || this.end()) {\n // do nothing\n } else {\n throw this.error('expected \":\" after filter name')\n }\n return new FilterToken(name.getText(), args, this.input, name.begin, this.p, this.file)\n }\n\n readFilterArg (): FilterArg | undefined {\n const key = this.readValue()\n if (!key) return\n this.skipBlank()\n if (this.peek() !== ':') return key\n ++this.p\n const value = this.readValue()\n return [key.getText(), value]\n }\n\n readTopLevelTokens (options: NormalizedFullOptions = defaultOptions): TopLevelToken[] {\n const tokens: TopLevelToken[] = []\n while (this.p < this.N) {\n const token = this.readTopLevelToken(options)\n tokens.push(token)\n }\n whiteSpaceCtrl(tokens, options)\n return tokens\n }\n\n readTopLevelToken (options: NormalizedFullOptions): TopLevelToken {\n const { tagDelimiterLeft, outputDelimiterLeft } = options\n if (this.rawBeginAt > -1) return this.readEndrawOrRawContent(options)\n if (this.match(tagDelimiterLeft)) return this.readTagToken(options)\n if (this.match(outputDelimiterLeft)) return this.readOutputToken(options)\n return this.readHTMLToken([tagDelimiterLeft, outputDelimiterLeft])\n }\n\n readHTMLToken (stopStrings: string[]): HTMLToken {\n const begin = this.p\n while (this.p < this.N) {\n if (stopStrings.some(str => this.match(str))) break\n ++this.p\n }\n return new HTMLToken(this.input, begin, this.p, this.file)\n }\n\n readTagToken (options: NormalizedFullOptions): TagToken {\n const { file, input } = this\n const begin = this.p\n if (this.readToDelimiter(options.tagDelimiterRight) === -1) {\n throw this.error(`tag ${this.snapshot(begin)} not closed`, begin)\n }\n const token = new TagToken(input, begin, this.p, options, file)\n if (token.name === 'raw') this.rawBeginAt = begin\n return token\n }\n\n readToDelimiter (delimiter: string, respectQuoted = false) {\n this.skipBlank()\n while (this.p < this.N) {\n if (respectQuoted && (this.peekType() & QUOTE)) {\n this.readQuoted()\n continue\n }\n ++this.p\n if (this.rmatch(delimiter)) return this.p\n }\n return -1\n }\n\n readOutputToken (options: NormalizedFullOptions = defaultOptions): OutputToken {\n const { file, input } = this\n const { outputDelimiterRight } = options\n const begin = this.p\n if (this.readToDelimiter(outputDelimiterRight, true) === -1) {\n throw this.error(`output ${this.snapshot(begin)} not closed`, begin)\n }\n return new OutputToken(input, begin, this.p, options, file)\n }\n\n readEndrawOrRawContent (options: NormalizedFullOptions): HTMLToken | TagToken {\n const { tagDelimiterLeft, tagDelimiterRight } = options\n const begin = this.p\n let leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length\n while (this.p < this.N) {\n if (this.readIdentifier().getText() !== 'endraw') {\n leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length\n continue\n }\n while (this.p <= this.N) {\n if (this.rmatch(tagDelimiterRight)) {\n const end = this.p\n if (begin === leftPos) {\n this.rawBeginAt = -1\n return new TagToken(this.input, begin, end, options, this.file)\n } else {\n this.p = leftPos\n return new HTMLToken(this.input, begin, leftPos, this.file)\n }\n }\n if (this.rmatch(tagDelimiterLeft)) break\n this.p++\n }\n }\n throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, begin)\n }\n\n readLiquidTagTokens (options: NormalizedFullOptions = defaultOptions): LiquidTagToken[] {\n const tokens: LiquidTagToken[] = []\n while (this.p < this.N) {\n const token = this.readLiquidTagToken(options)\n token && tokens.push(token)\n }\n return tokens\n }\n\n readLiquidTagToken (options: NormalizedFullOptions): LiquidTagToken | undefined {\n this.skipBlank()\n if (this.end()) return\n\n const begin = this.p\n this.readToDelimiter('\\n')\n const end = this.p\n return new LiquidTagToken(this.input, begin, end, options, this.file)\n }\n\n error (msg: string, pos: number = this.p) {\n return new TokenizationError(msg, new IdentifierToken(this.input, pos, this.N, this.file))\n }\n\n assert (pred: unknown, msg: string | (() => string), pos?: number) {\n if (!pred) throw this.error(typeof msg === 'function' ? msg() : msg, pos)\n }\n\n snapshot (begin: number = this.p) {\n return JSON.stringify(ellipsis(this.input.slice(begin, this.N), 32))\n }\n\n /**\n * @deprecated use #readIdentifier instead\n */\n readWord () {\n return this.readIdentifier()\n }\n\n readIdentifier (): IdentifierToken {\n this.skipBlank()\n const begin = this.p\n while (!this.end() && isWord(this.peek())) ++this.p\n return new IdentifierToken(this.input, begin, this.p, this.file)\n }\n\n readNonEmptyIdentifier (): IdentifierToken | undefined {\n const id = this.readIdentifier()\n return id.size() ? id : undefined\n }\n\n readTagName (): string {\n this.skipBlank()\n // Handle inline comment tags\n if (this.input[this.p] === '#') return this.input.slice(this.p, ++this.p)\n return this.readIdentifier().getText()\n }\n\n readHashes (jekyllStyle?: boolean | string) {\n const hashes = []\n while (true) {\n const hash = this.readHash(jekyllStyle)\n if (!hash) return hashes\n hashes.push(hash)\n }\n }\n\n readHash (jekyllStyle?: boolean | string): HashToken | undefined {\n this.skipBlank()\n if (this.peek() === ',') ++this.p\n const begin = this.p\n const name = this.readNonEmptyIdentifier()\n if (!name) return\n let value\n\n this.skipBlank()\n const sep = isString(jekyllStyle) ? jekyllStyle : (jekyllStyle ? '=' : ':')\n if (this.peek() === sep) {\n ++this.p\n value = this.readValue()\n }\n return new HashToken(this.input, begin, this.p, name, value, this.file)\n }\n\n remaining () {\n return this.input.slice(this.p, this.N)\n }\n\n advance (step = 1) {\n this.p += step\n }\n\n end () {\n return this.p >= this.N\n }\n read () {\n return this.input[this.p++]\n }\n readTo (end: string): number {\n while (this.p < this.N) {\n ++this.p\n if (this.rmatch(end)) return this.p\n }\n return -1\n }\n\n readValue (): ValueToken | undefined {\n this.skipBlank()\n const begin = this.p\n const variable = this.readLiteral() || this.readQuoted() || this.readRange() || this.readNumber()\n const props = this.readProperties(!variable)\n if (!props.length) return variable\n return new PropertyAccessToken(variable, props, this.input, begin, this.p)\n }\n\n readScopeValue (): ValueToken | undefined {\n this.skipBlank()\n const begin = this.p\n const props = this.readProperties()\n if (!props.length) return undefined\n return new PropertyAccessToken(undefined, props, this.input, begin, this.p)\n }\n\n private readProperties (isBegin = true): (ValueToken | IdentifierToken)[] {\n const props: (ValueToken | IdentifierToken)[] = []\n while (true) {\n if (this.peek() === '[') {\n this.p++\n const prop = this.readValue() || new IdentifierToken(this.input, this.p, this.p, this.file)\n this.assert(this.readTo(']') !== -1, '[ not closed')\n props.push(prop)\n continue\n }\n if (isBegin && !props.length) {\n const prop = this.readNonEmptyIdentifier()\n if (prop) {\n props.push(prop)\n continue\n }\n }\n if (this.peek() === '.' && this.peek(1) !== '.') { // skip range syntax\n this.p++\n const prop = this.readNonEmptyIdentifier()\n if (!prop) break\n props.push(prop)\n continue\n }\n break\n }\n return props\n }\n\n readNumber (): NumberToken | undefined {\n this.skipBlank()\n let decimalFound = false\n let digitFound = false\n let n = 0\n if (this.peekType() & SIGN) n++\n while (this.p + n <= this.N) {\n if (this.peekType(n) & NUMBER) {\n digitFound = true\n n++\n } else if (this.peek(n) === '.' && this.peek(n + 1) !== '.') {\n if (decimalFound || !digitFound) return\n decimalFound = true\n n++\n } else break\n }\n if (digitFound && !isWord(this.peek(n))) {\n const num = new NumberToken(this.input, this.p, this.p + n, this.file)\n this.advance(n)\n return num\n }\n }\n\n readLiteral (): LiteralToken | undefined {\n this.skipBlank()\n const end = this.matchTrie(this.literalTrie)\n if (end === -1) return\n const literal = new LiteralToken(this.input, this.p, end, this.file)\n this.p = end\n return literal\n }\n\n readRange (): RangeToken | undefined {\n this.skipBlank()\n const begin = this.p\n if (this.peek() !== '(') return\n ++this.p\n const lhs = this.readValueOrThrow()\n this.skipBlank()\n this.assert(this.read() === '.' && this.read() === '.', 'invalid range syntax')\n const rhs = this.readValueOrThrow()\n this.skipBlank()\n this.assert(this.read() === ')', 'invalid range syntax')\n return new RangeToken(this.input, begin, this.p, lhs, rhs, this.file)\n }\n\n readValueOrThrow (): ValueToken {\n const value = this.readValue()\n this.assert(value, () => `unexpected token ${this.snapshot()}, value expected`)\n return value!\n }\n\n readQuoted (): QuotedToken | undefined {\n this.skipBlank()\n const begin = this.p\n if (!(this.peekType() & QUOTE)) return\n ++this.p\n let escaped = false\n while (this.p < this.N) {\n ++this.p\n if (this.input[this.p - 1] === this.input[begin] && !escaped) break\n if (escaped) escaped = false\n else if (this.input[this.p - 1] === '\\\\') escaped = true\n }\n return new QuotedToken(this.input, begin, this.p, this.file)\n }\n\n * readFileNameTemplate (options: NormalizedFullOptions): IterableIterator {\n const { outputDelimiterLeft } = options\n const htmlStopStrings = [',', ' ', '\\r', '\\n', '\\t', outputDelimiterLeft]\n const htmlStopStringSet = new Set(htmlStopStrings)\n // break on ',' and ' ', outputDelimiterLeft only stops HTML token\n while (this.p < this.N && !htmlStopStringSet.has(this.peek())) {\n yield this.match(outputDelimiterLeft)\n ? this.readOutputToken(options)\n : this.readHTMLToken(htmlStopStrings)\n }\n }\n\n match (word: string) {\n for (let i = 0; i < word.length; i++) {\n if (word[i] !== this.input[this.p + i]) return false\n }\n return true\n }\n\n rmatch (pattern: string) {\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[pattern.length - 1 - i] !== this.input[this.p - 1 - i]) return false\n }\n return true\n }\n\n peekType (n = 0) {\n return this.p + n >= this.N ? 0 : TYPES[this.input.charCodeAt(this.p + n)]\n }\n\n peek (n = 0): string {\n return this.p + n >= this.N ? '' : this.input[this.p + n]\n }\n\n skipBlank () {\n while (this.peekType() & BLANK) ++this.p\n }\n}\n","import { Token, TopLevelToken } from '../tokens'\nimport { Template } from '../template'\nimport { isTagToken } from '../util'\n\ntype ParseToken = ((token: T, remainTokens: T[]) => Template)\n\nexport class ParseStream {\n private tokens: T[]\n private handlers: Record void> = {}\n private stopRequested = false\n private parseToken: ParseToken\n\n public constructor (tokens: T[], parseToken: ParseToken) {\n this.tokens = tokens\n this.parseToken = parseToken\n }\n public on (name: string, cb: (this: ParseStream, arg: T2) => void): ParseStream {\n this.handlers[name] = cb\n return this\n }\n private trigger (event: string, arg?: T) {\n const h = this.handlers[event]\n return h ? (h.call(this, arg), true) : false\n }\n public start () {\n this.trigger('start')\n let token: T | undefined\n while (!this.stopRequested && (token = this.tokens.shift())) {\n if (this.trigger('token', token)) continue\n if (isTagToken(token) && this.trigger(`tag:${token.name}`, token)) {\n continue\n }\n const template = this.parseToken(token, this.tokens)\n this.trigger('template', template)\n }\n if (!this.stopRequested) this.trigger('end')\n return this\n }\n public stop () {\n this.stopRequested = true\n return this\n }\n}\n","export abstract class TemplateImpl {\n public token: T;\n public constructor (token: T) {\n this.token = token\n }\n}\n","import { TemplateImpl } from './template-impl'\nimport type { Emitter } from '../emitters/emitter'\nimport type { Parser, Tokenizer } from '../parser'\nimport type { Context } from '../context/context'\nimport type { TopLevelToken, TagToken } from '../tokens'\nimport type { Template } from './template'\nimport type { Liquid } from '../liquid'\n\nexport type TagRenderReturn = Generator | Promise | unknown\n\nexport abstract class Tag extends TemplateImpl implements Template {\n public name: string\n public liquid: Liquid\n protected tokenizer: Tokenizer\n\n public constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token)\n this.name = token.name\n this.liquid = liquid\n this.tokenizer = token.tokenizer\n }\n public abstract render (ctx: Context, emitter: Emitter): TagRenderReturn;\n}\n\nexport interface TagClass {\n new(token: TagToken, tokens: TopLevelToken[], liquid: Liquid, parser: Parser): Tag\n}\n","import { evalToken } from '../render/expression'\nimport { Context } from '../context/context'\nimport { Tokenizer } from '../parser/tokenizer'\nimport { Token } from '../tokens/token'\n\ntype HashValueTokens = Record\n\n/**\n * Key-Value Pairs Representing Tag Arguments\n * Example:\n * For the markup `, foo:'bar', coo:2 reversed %}`,\n * hash['foo'] === 'bar'\n * hash['coo'] === 2\n * hash['reversed'] === undefined\n */\nexport class Hash {\n hash: HashValueTokens = {}\n\n constructor (input: string | Tokenizer, jekyllStyle?: boolean | string) {\n const tokenizer = input instanceof Tokenizer ? input : new Tokenizer(input, {})\n for (const hash of tokenizer.readHashes(jekyllStyle)) {\n this.hash[hash.name.content] = hash.value\n }\n }\n\n * render (ctx: Context): Generator, unknown> {\n const hash: Record = {}\n for (const key of Object.keys(this.hash)) {\n hash[key] = this.hash[key] === undefined ? true : yield evalToken(this.hash[key], ctx)\n }\n return hash\n }\n}\n","import { isFunction } from '../util'\nimport { Hash } from './hash'\nimport { Tag, TagClass, TagRenderReturn } from './tag'\nimport { TagToken, TopLevelToken } from '../tokens'\nimport { Emitter } from '../emitters'\nimport { Context } from '../context'\nimport type { Liquid } from '../liquid'\n\nexport interface TagImplOptions {\n [key: string]: any\n parse?: (this: Tag & TagImplOptions, token: TagToken, remainingTokens: TopLevelToken[]) => void;\n render: (this: Tag & TagImplOptions, ctx: Context, emitter: Emitter, hash: Record) => TagRenderReturn;\n}\n\nexport function createTagClass (options: TagImplOptions): TagClass {\n return class extends Tag {\n constructor (token: TagToken, tokens: TopLevelToken[], liquid: Liquid) {\n super(token, tokens, liquid)\n if (isFunction(options.parse)) {\n options.parse.call(this, token, tokens)\n }\n }\n * render (ctx: Context, emitter: Emitter): TagRenderReturn {\n const hash = (yield new Hash(this.token.args, ctx.opts.keyValueSeparator).render(ctx)) as Record\n return yield options.render.call(this, ctx, emitter, hash)\n }\n }\n}\n","import { isArray } from '../util/underscore'\nimport { ValueToken } from '../tokens/value-token'\n\ntype KeyValuePair = [string?, ValueToken?]\n\nexport type FilterArg = ValueToken | KeyValuePair\n\nexport function isKeyValuePair (arr: FilterArg): arr is KeyValuePair {\n return isArray(arr)\n}\n","import { evalToken } from '../render'\nimport { Context } from '../context'\nimport { identify, isFunction } from '../util/underscore'\nimport { FilterHandler, FilterImplOptions } from './filter-impl-options'\nimport { FilterArg, isKeyValuePair } from '../parser/filter-arg'\nimport { Liquid } from '../liquid'\nimport { FilterToken } from '../tokens'\n\nexport class Filter {\n public name: string\n public args: FilterArg[]\n public readonly raw: boolean\n private handler: FilterHandler\n private liquid: Liquid\n private token: FilterToken\n\n public constructor (token: FilterToken, options: FilterImplOptions | undefined, liquid: Liquid) {\n this.token = token\n this.name = token.name\n this.handler = isFunction(options)\n ? options\n : (isFunction(options?.handler) ? options!.handler : identify)\n this.raw = !isFunction(options) && !!options?.raw\n this.args = token.args\n this.liquid = liquid\n }\n public * render (value: any, context: Context): IterableIterator {\n const argv: any[] = []\n for (const arg of this.args as FilterArg[]) {\n if (isKeyValuePair(arg)) argv.push([arg[0], yield evalToken(arg[1], context)])\n else argv.push(yield evalToken(arg, context))\n }\n return yield this.handler.apply({ context, token: this.token, liquid: this.liquid }, [value, ...argv])\n }\n}\n","import { Filter } from './filter'\nimport { Expression } from '../render'\nimport { Tokenizer } from '../parser'\nimport { assert } from '../util'\nimport type { FilteredValueToken } from '../tokens'\nimport type { Liquid } from '../liquid'\nimport type { Context } from '../context'\n\nexport class Value {\n public readonly filters: Filter[] = []\n public readonly initial: Expression\n\n /**\n * @param str the value to be valuated, eg.: \"foobar\" | truncate: 3\n */\n public constructor (input: string | FilteredValueToken, liquid: Liquid) {\n const token: FilteredValueToken = typeof input === 'string'\n ? new Tokenizer(input, liquid.options.operators).readFilteredValue()\n : input\n this.initial = token.initial\n this.filters = token.filters.map(token => new Filter(token, this.getFilter(liquid, token.name), liquid))\n }\n\n public * value (ctx: Context, lenient?: boolean): Generator {\n lenient = lenient || (ctx.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === 'default')\n let val = yield this.initial.evaluate(ctx, lenient)\n\n for (const filter of this.filters) {\n val = yield filter.render(val, ctx)\n }\n return val\n }\n\n private getFilter (liquid: Liquid, name: string) {\n const impl = liquid.filters[name]\n assert(impl || !liquid.options.strictFilters, () => `undefined filter: ${name}`)\n return impl\n }\n}\n","import { Value } from './value'\nimport { Arguments, Template, TemplateImpl } from '../template'\nimport { Context } from '../context/context'\nimport { Emitter } from '../emitters/emitter'\nimport { OutputToken } from '../tokens/output-token'\nimport { Tokenizer } from '../parser'\nimport { Liquid } from '../liquid'\nimport { Filter } from './filter'\nimport { FilterToken } from '../tokens'\n\nexport class Output extends TemplateImpl implements Template {\n value: Value\n public constructor (token: OutputToken, liquid: Liquid) {\n super(token)\n const tokenizer = new Tokenizer(token.input, liquid.options.operators, token.file, token.contentRange)\n this.value = new Value(tokenizer.readFilteredValue(), liquid)\n const filters = this.value.filters\n const outputEscape = liquid.options.outputEscape\n if (!filters[filters.length - 1]?.raw && outputEscape) {\n const token = new FilterToken(toString.call(outputEscape), [], '', 0, 0)\n filters.push(new Filter(token, outputEscape, liquid))\n }\n }\n public * render (ctx: Context, emitter: Emitter): IterableIterator {\n const val = yield this.value.value(ctx, false)\n emitter.write(val)\n }\n\n public * arguments (): Arguments {\n yield this.value\n }\n}\n","import { TemplateImpl, Template } from '../template'\nimport { HTMLToken } from '../tokens'\nimport { Context } from '../context'\nimport { Emitter } from '../emitters'\n\nexport class HTML extends TemplateImpl implements Template {\n private str: string\n public constructor (token: HTMLToken) {\n super(token)\n this.str = token.getContent()\n }\n public * render (ctx: Context, emitter: Emitter): IterableIterator {\n emitter.write(this.str)\n }\n}\n","import { Argument, Template, Value } from '.'\nimport { isKeyValuePair } from '../parser/filter-arg'\nimport { PropertyAccessToken, ValueToken } from '../tokens'\nimport {\n isNumberToken,\n isPropertyAccessToken,\n isQuotedToken,\n isRangeToken,\n isString,\n isValueToken,\n isWordToken,\n toPromise,\n toValueSync\n} from '../util'\n\n/**\n * Row, column and file name where a variable was found.\n */\nexport interface VariableLocation {\n row: number;\n col: number;\n file?: string;\n}\n\n/**\n * A variable's segments as an array, possibly with nested arrays of segments.\n */\nexport type SegmentArray = Array\n\n/**\n * A variable's segments and location, which can be coerced to a string.\n */\nexport class Variable {\n constructor (\n readonly segments: Array,\n readonly location: VariableLocation\n ) {}\n\n public toString (): string {\n return segmentsString(this.segments, true)\n }\n\n /** Return this variable's segments as an array, possibly with nested arrays for nested paths. */\n public toArray (): SegmentArray {\n function * _visit (...segments: Array): Generator {\n for (const segment of segments) {\n if (segment instanceof Variable) {\n yield Array.from(_visit(...segment.segments))\n } else {\n yield segment\n }\n }\n }\n return Array.from(_visit(...this.segments))\n }\n}\n\n/**\n * Property names and array indexes that make up a path to a variable.\n */\nexport type VariableSegments = Array;\n\n/**\n * A mapping of variable names to an array of locations at which the variable was found.\n */\nexport type Variables = { [key: string]: Variable[] };\n\n/**\n * Group variables by the string representation of their root segment.\n */\nexport class VariableMap {\n private map: Map\n\n constructor () {\n this.map = new Map()\n }\n\n public get (key: Variable): Variable[] {\n const k = segmentsString([key.segments[0]])\n if (!this.map.has(k)) {\n this.map.set(k, [])\n }\n return this.map.get(k) as Variable[]\n }\n\n public has (key: Variable): boolean {\n return this.map.has(segmentsString([key.segments[0]]))\n }\n\n public push (variable: Variable): void {\n this.get(variable).push(variable)\n }\n\n public asObject (): Variables {\n return Object.fromEntries(this.map)\n }\n}\n\n/**\n * The result of calling `analyze()` or `analyzeSync()`.\n */\nexport interface StaticAnalysis {\n /**\n * All variables, whether they are in scope or not. Including references to names\n * such as `forloop` from the `for` tag.\n */\n variables: Variables;\n\n /**\n * Variables that are not in scope. These could be a \"global\" variables that are\n * expected to be provided by the application developer, or possible mistakes\n * from the template author.\n *\n * If a variable is referenced before and after assignment, you should expect\n * that variable to be included in `globals`, `variables` and `locals`, each with\n * a different location.\n */\n globals: Variables;\n\n /**\n * Template variables that are added to the template local scope using tags like\n * `assign`, `capture` or `increment`.\n */\n locals: Variables;\n}\n\nexport interface StaticAnalysisOptions {\n /**\n * When `true` (the default), try to load partial templates and analyze them too.\n */\n partials?: boolean;\n}\n\nexport const defaultStaticAnalysisOptions: StaticAnalysisOptions = {\n partials: true\n}\n\nfunction * _analyze (templates: Template[], partials: boolean, sync: boolean): Generator {\n const variables = new VariableMap()\n const globals = new VariableMap()\n const locals = new VariableMap()\n\n const rootScope = new DummyScope(new Set())\n\n // Names of partial templates that we've already analyzed.\n const seen: Set = new Set()\n\n function updateVariables (variable: Variable, scope: DummyScope) {\n variables.push(variable)\n const aliased = scope.alias(variable)\n\n if (aliased !== undefined) {\n const root = aliased.segments[0]\n // TODO: What if a a template renders a rendered template? Do we need scope.parent?\n if (isString(root) && !rootScope.has(root)) {\n globals.push(aliased)\n }\n } else {\n const root = variable.segments[0]\n if (isString(root) && !scope.has(root)) {\n globals.push(variable)\n }\n }\n\n // Recurse for nested Variables\n for (const segment of variable.segments) {\n if (segment instanceof Variable) {\n updateVariables(segment, scope)\n }\n }\n }\n\n function * visit (template: Template, scope: DummyScope): Generator {\n if (template.arguments) {\n for (const arg of template.arguments()) {\n for (const variable of extractVariables(arg)) {\n updateVariables(variable, scope)\n }\n }\n }\n\n if (template.localScope) {\n for (const ident of template.localScope()) {\n scope.add(ident.content)\n scope.deleteAlias(ident.content)\n const [row, col] = ident.getPosition()\n locals.push(new Variable([ident.content], { row, col, file: ident.file }))\n }\n }\n\n if (template.children) {\n if (template.partialScope) {\n const partial = template.partialScope()\n\n if (partial === undefined) {\n // Layouts, for example, can have children that are not partials.\n for (const child of (yield template.children(partials, sync)) as Template[]) {\n yield visit(child, scope)\n }\n return\n }\n\n if (seen.has(partial.name)) return\n\n const partialScopeNames: Set = new Set()\n const partialScope = partial.isolated\n ? new DummyScope(partialScopeNames)\n : scope.push(partialScopeNames)\n\n for (const name of partial.scope) {\n if (isString(name)) {\n partialScopeNames.add(name)\n } else {\n const [alias, argument] = name\n partialScopeNames.add(alias)\n const variables = Array.from(extractVariables(argument))\n if (variables.length) {\n partialScope.setAlias(alias, variables[0].segments)\n }\n }\n }\n\n for (const child of (yield template.children(partials, sync)) as Template[]) {\n yield visit(child, partialScope)\n seen.add(partial.name)\n }\n\n partialScope.pop()\n } else {\n if (template.blockScope) {\n scope.push(new Set(template.blockScope()))\n }\n\n for (const child of (yield template.children(partials, sync)) as Template[]) {\n yield visit(child, scope)\n }\n\n if (template.blockScope) {\n scope.pop()\n }\n }\n }\n }\n\n for (const template of templates) {\n yield visit(template, rootScope)\n }\n\n return {\n variables: variables.asObject(),\n globals: globals.asObject(),\n locals: locals.asObject()\n }\n}\n\n/**\n * Statically analyze a template and report variable usage.\n */\nexport function analyze (template: Template[], options: StaticAnalysisOptions = {}): Promise {\n const opts = { ...defaultStaticAnalysisOptions, ...options } as Required\n return toPromise(_analyze(template, opts.partials, false))\n}\n\n/**\n * Statically analyze a template and report variable usage.\n */\nexport function analyzeSync (template: Template[], options: StaticAnalysisOptions = {}): StaticAnalysis {\n const opts = { ...defaultStaticAnalysisOptions, ...options } as Required\n return toValueSync(_analyze(template, opts.partials, true))\n}\n\ninterface ScopeStackItem {\n names: Set;\n aliases: Map;\n}\n\n/**\n * A stack to manage scopes while traversing templates during static analysis.\n */\nclass DummyScope {\n private stack: Array\n\n constructor (globals: Set) {\n this.stack = [{ names: globals, aliases: new Map() }]\n }\n\n /** Return true if `name` is in scope. */\n public has (name: string): boolean {\n for (const scope of this.stack) {\n if (scope.names.has(name)) {\n return true\n }\n }\n return false\n }\n\n public push (scope: Set): DummyScope {\n this.stack.push({ names: scope, aliases: new Map() })\n return this\n }\n\n public pop (): Set | undefined {\n return this.stack.pop()?.names\n }\n\n // Add a name to the template scope.\n public add (name: string): void {\n this.stack[0].names.add(name)\n }\n\n /** Return the variable that `variable` aliases, or `variable` if it doesn't alias anything. */\n public alias (variable: Variable): Variable | undefined {\n const root = variable.segments[0]\n if (!isString(root)) return undefined\n const alias = this.getAlias(root)\n if (alias === undefined) return undefined\n return new Variable([...alias, ...variable.segments.slice(1)], variable.location)\n }\n\n // TODO: `from` could be a path with multiple segments, like `include.x`.\n public setAlias (from: string, to: VariableSegments): void {\n this.stack[this.stack.length - 1].aliases.set(from, to)\n }\n\n public deleteAlias (name: string): void {\n this.stack[this.stack.length - 1].aliases.delete(name)\n }\n\n private getAlias (name: string): VariableSegments | undefined {\n for (const scope of this.stack) {\n if (scope.aliases.has(name)) {\n return scope.aliases.get(name)\n }\n\n // If a scope has defined `name`, then it masks aliases in parent scopes.\n if (scope.names.has(name)) {\n return undefined\n }\n }\n return undefined\n }\n}\n\nfunction * extractVariables (value: Argument): Generator {\n if (isValueToken(value)) {\n yield * extractValueTokenVariables(value)\n } else if (value instanceof Value) {\n yield * extractFilteredValueVariables(value)\n }\n}\n\nfunction * extractFilteredValueVariables (value: Value): Generator {\n for (const token of value.initial.postfix) {\n if (isValueToken(token)) {\n yield * extractValueTokenVariables(token)\n }\n }\n\n for (const filter of value.filters) {\n for (const arg of filter.args) {\n if (isKeyValuePair(arg) && arg[1]) {\n yield * extractValueTokenVariables(arg[1])\n } else if (isValueToken(arg)) {\n yield * extractValueTokenVariables(arg)\n }\n }\n }\n}\n\nfunction * extractValueTokenVariables (token: ValueToken): Generator {\n if (isRangeToken(token)) {\n yield * extractValueTokenVariables(token.lhs)\n yield * extractValueTokenVariables(token.rhs)\n } else if (isPropertyAccessToken(token)) {\n yield extractPropertyAccessVariable(token)\n }\n}\n\nfunction extractPropertyAccessVariable (token: PropertyAccessToken): Variable {\n const segments: VariableSegments = []\n\n // token is not guaranteed to have `file` set. We'll try to get it from a prop if not.\n let file: string | undefined = token.file\n\n // Here we're flattening the first segment of a path if it is a nested path.\n const root = token.props[0]\n file = file || root.file\n if (isQuotedToken(root) || isNumberToken(root) || isWordToken(root)) {\n segments.push(root.content)\n } else if (isPropertyAccessToken(root)) {\n // Flatten paths that start with a nested path.\n segments.push(...extractPropertyAccessVariable(root).segments)\n }\n\n for (const prop of token.props.slice(1)) {\n file = file || prop.file\n if (isQuotedToken(prop) || isNumberToken(prop) || isWordToken(prop)) {\n segments.push(prop.content)\n } else if (isPropertyAccessToken(prop)) {\n segments.push(extractPropertyAccessVariable(prop))\n }\n }\n\n const [row, col] = token.getPosition()\n return new Variable(segments, {\n row,\n col,\n file\n })\n}\n\n// This is used to detect segments that can be represented with dot notation\n// when creating a string representation of VariableSegments.\nconst RE_PROPERTY = /^[\\u0080-\\uFFFFa-zA-Z_][\\u0080-\\uFFFFa-zA-Z0-9_-]*$/\n\n/**\n * Return a string representation of segments using dot notation where possible.\n * @param segments - The property names and array indices that make up a path to a variable.\n * @param bracketedRoot - If false (the default), don't surround the root segment with square brackets.\n */\nfunction segmentsString (segments: VariableSegments, bracketedRoot = false): string {\n const buf: string[] = []\n\n const root = segments[0]\n if (isString(root)) {\n if (!bracketedRoot || root.match(RE_PROPERTY)) {\n buf.push(`${root}`)\n } else {\n buf.push(`['${root}']`)\n }\n }\n\n for (const segment of segments.slice(1)) {\n if (segment instanceof Variable) {\n buf.push(`[${segmentsString(segment.segments)}]`)\n } else if (isString(segment)) {\n if (segment.match(RE_PROPERTY)) {\n buf.push(`.${segment}`)\n } else {\n buf.push(`['${segment}']`)\n }\n } else {\n buf.push(`[${segment}]`)\n }\n }\n\n return buf.join('')\n}\n","import { FS } from './fs'\nimport { assert, LiquidAsync, toLiquidAsync } from '../util'\n\nexport interface LoaderOptions {\n fs: FS;\n extname: string;\n root: string[];\n partials: string[];\n layouts: string[];\n relativeReference: boolean;\n}\nexport enum LookupType {\n Partials = 'partials',\n Layouts = 'layouts',\n Root = 'root'\n}\nexport class Loader {\n public shouldLoadRelative: (referencedFile: string) => boolean\n private options: LoaderOptions\n private contains: LiquidAsync>\n private exists: LiquidAsync\n\n constructor (options: LoaderOptions) {\n this.options = options\n if (options.relativeReference) {\n const sep = options.fs.sep\n assert(sep, '`fs.sep` is required for relative reference')\n const prefixes = ['.' + sep, '..' + sep, './', '../']\n this.shouldLoadRelative = (referencedFile: string) => prefixes.some(prefix => referencedFile.startsWith(prefix))\n } else {\n this.shouldLoadRelative = (_referencedFile: string) => false\n }\n const fs = options.fs\n this.contains = toLiquidAsync(\n fs.contains?.bind(fs) || (async () => true),\n fs.containsSync?.bind(fs) || (() => true)\n )\n this.exists = toLiquidAsync(\n fs.exists?.bind(fs) || (async () => false),\n fs.existsSync?.bind(fs)\n )\n }\n\n public * lookup (file: string, type: LookupType, sync?: boolean, currentFile?: string): Generator {\n const dirs = this.options[type]\n for (const filepath of this.candidates(file, dirs, currentFile)) {\n let allowed = false\n for (const dir of dirs) {\n if (yield this.contains(!!sync, dir, filepath)) { allowed = true; break }\n }\n if (!allowed) continue\n if (yield this.exists(!!sync, filepath)) return filepath\n }\n throw this.lookupError(file, dirs)\n }\n\n public * candidates (file: string, dirs: string[], currentFile?: string) {\n const { fs, extname } = this.options\n\n if (this.shouldLoadRelative(file) && currentFile) {\n const referenced = fs.resolve(this.dirname(currentFile), file, extname)\n yield referenced\n }\n for (const dir of dirs) {\n const referenced = fs.resolve(dir, file, extname)\n yield referenced\n }\n\n if (fs.fallback !== undefined) {\n const filepath = fs.fallback(file)\n if (filepath !== undefined) yield filepath\n }\n }\n\n private dirname (path: string) {\n const fs = this.options.fs\n assert(fs.dirname, '`fs.dirname` is required for relative reference')\n return fs.dirname!(path)\n }\n\n private lookupError (file: string, roots: string[]) {\n const err = new Error('ENOENT') as any\n err.message = `ENOENT: Failed to lookup \"${file}\" in \"${roots}\"`\n err.code = 'ENOENT'\n return err\n }\n}\n","import { Limiter, toPromise, assert, isTagToken, isOutputToken, ParseError, toLiquidAsync, LiquidAsync } from '../util'\nimport { Tokenizer } from './tokenizer'\nimport { ParseStream } from './parse-stream'\nimport { TopLevelToken, OutputToken } from '../tokens'\nimport { Template, Output, HTML } from '../template'\nimport { LiquidCache } from '../cache'\nimport { FS, Loader, LookupType } from '../fs'\nimport { LiquidError, LiquidErrors } from '../util/error'\nimport type { Liquid } from '../liquid'\n\nexport class Parser {\n public parseFile: (file: string, sync?: boolean, type?: LookupType, currentFile?: string) => Generator\n\n private liquid: Liquid\n private fs: FS\n private cache?: LiquidCache\n private loader: Loader\n private parseLimit: Limiter\n private readFile: LiquidAsync\n\n public constructor (liquid: Liquid) {\n this.liquid = liquid\n this.cache = this.liquid.options.cache\n this.fs = this.liquid.options.fs\n this.parseFile = this.cache ? this._parseFileCached : this._parseFile\n this.loader = new Loader(this.liquid.options)\n this.parseLimit = new Limiter('parse length', liquid.options.parseLimit)\n this.readFile = toLiquidAsync(\n this.fs.readFile?.bind(this.fs) || (async () => { throw new Error('readFile not implemented') }),\n this.fs.readFileSync?.bind(this.fs)\n )\n }\n public parse (html: string, filepath?: string): Template[] {\n html = String(html)\n this.parseLimit.use(html.length)\n const tokenizer = new Tokenizer(html, this.liquid.options.operators, filepath)\n const tokens = tokenizer.readTopLevelTokens(this.liquid.options)\n return this.parseTokens(tokens)\n }\n public parseTokens (tokens: TopLevelToken[]) {\n let token\n const templates: Template[] = []\n const errors: LiquidError[] = []\n while ((token = tokens.shift())) {\n try {\n templates.push(this.parseToken(token, tokens))\n } catch (err) {\n if (this.liquid.options.catchAllErrors) errors.push(err as LiquidError)\n else throw err\n }\n }\n if (errors.length) throw new LiquidErrors(errors)\n return templates\n }\n public parseToken (token: TopLevelToken, remainTokens: TopLevelToken[]) {\n try {\n if (isTagToken(token)) {\n const TagClass = this.liquid.tags[token.name]\n assert(TagClass, `tag \"${token.name}\" not found`)\n return new TagClass(token, remainTokens, this.liquid, this)\n }\n if (isOutputToken(token)) {\n return new Output(token as OutputToken, this.liquid)\n }\n return new HTML(token)\n } catch (e) {\n if (LiquidError.is(e)) throw e\n throw new ParseError(e as Error, token)\n }\n }\n public parseStream (tokens: TopLevelToken[]) {\n return new ParseStream(tokens, (token, tokens) => this.parseToken(token, tokens))\n }\n private * _parseFileCached (file: string, sync?: boolean, type: LookupType = LookupType.Root, currentFile?: string): Generator {\n const cache = this.cache!\n const key = this.loader.shouldLoadRelative(file) ? currentFile + ',' + file : type + ':' + file\n const tpls = yield cache.read(key)\n if (tpls) return tpls\n\n const task = this._parseFile(file, sync, type, currentFile)\n // sync mode: exec the task and cache the result\n // async mode: cache the task before exec\n const taskOrTpl = sync ? yield task : toPromise(task)\n cache.write(key, taskOrTpl as any)\n // note: concurrent tasks will be reused, cache for failed task is removed until its end\n try { return yield taskOrTpl } catch (err) { cache.remove(key); throw err }\n }\n private * _parseFile (file: string, sync?: boolean, type: LookupType = LookupType.Root, currentFile?: string): Generator {\n const filepath = yield this.loader.lookup(file, type, sync, currentFile)\n return this.parse(yield this.readFile(!!sync, filepath), filepath)\n }\n}\n","export enum TokenKind {\n Number = 1,\n Literal = 2,\n Tag = 4,\n Output = 8,\n HTML = 16,\n Filter = 32,\n Hash = 64,\n PropertyAccess = 128,\n Word = 256,\n Range = 512,\n Quoted = 1024,\n Operator = 2048,\n FilteredValue = 4096,\n Delimited = Tag | Output\n}\n","import { RangeToken, NumberToken, QuotedToken, LiteralToken, PropertyAccessToken, OutputToken, HTMLToken, TagToken, IdentifierToken, DelimitedToken, OperatorToken, ValueToken } from '../tokens'\nimport { TokenKind } from '../parser'\n\nexport function isDelimitedToken (val: any): val is DelimitedToken {\n return !!(getKind(val) & TokenKind.Delimited)\n}\n\nexport function isOperatorToken (val: any): val is OperatorToken {\n return getKind(val) === TokenKind.Operator\n}\n\nexport function isHTMLToken (val: any): val is HTMLToken {\n return getKind(val) === TokenKind.HTML\n}\n\nexport function isOutputToken (val: any): val is OutputToken {\n return getKind(val) === TokenKind.Output\n}\n\nexport function isTagToken (val: any): val is TagToken {\n return getKind(val) === TokenKind.Tag\n}\n\nexport function isQuotedToken (val: any): val is QuotedToken {\n return getKind(val) === TokenKind.Quoted\n}\n\nexport function isLiteralToken (val: any): val is LiteralToken {\n return getKind(val) === TokenKind.Literal\n}\n\nexport function isNumberToken (val: any): val is NumberToken {\n return getKind(val) === TokenKind.Number\n}\n\nexport function isPropertyAccessToken (val: any): val is PropertyAccessToken {\n return getKind(val) === TokenKind.PropertyAccess\n}\n\nexport function isWordToken (val: any): val is IdentifierToken {\n return getKind(val) === TokenKind.Word\n}\n\nexport function isRangeToken (val: any): val is RangeToken {\n return getKind(val) === TokenKind.Range\n}\n\nexport function isValueToken (val: any): val is ValueToken {\n // valueTokenBitMask = TokenKind.Number | TokenKind.Literal | TokenKind.Quoted | TokenKind.PropertyAccess | TokenKind.Range\n return (getKind(val) & 1667) > 0\n}\n\nfunction getKind (val: any) {\n return val ? val.kind : -1\n}\n","import { Drop } from '../drop/drop'\n\nexport interface ScopeObject extends Record {\n toLiquid?: () => any;\n}\n\nexport type Scope = ScopeObject | Drop\n\nexport function createScope (from?: ScopeObject): ScopeObject {\n const scope = Object.create(null)\n if (from) Object.assign(scope, from)\n return scope\n}\n","import { getPerformance } from '../util/performance'\nimport { Drop } from '../drop/drop'\nimport { __assign } from 'tslib'\nimport { NormalizedFullOptions, defaultOptions, RenderOptions } from '../liquid-options'\nimport { createScope, Scope } from './scope'\nimport { hasOwnProperty, isArray, isNil, isUndefined, isString, isFunction, isNumber, toLiquid, InternalUndefinedVariableError, toValueSync, isObject, Limiter, toValue, readArrayElement } from '../util'\n\ntype PropertyKey = string | number;\n\nexport class Context {\n /**\n * insert a Context-level empty scope,\n * for tags like `{% capture %}` `{% assign %}` to operate\n */\n private scopes: Scope[] = [createScope()]\n private registers: Record = {}\n /**\n * user passed in scope\n * `{% increment %}`, `{% decrement %}` changes this scope,\n * whereas `{% capture %}`, `{% assign %}` only hide this scope\n */\n public environments: Scope\n /**\n * global scope used as fallback for missing variables\n */\n public globals: Scope\n public sync: boolean\n public breakCalled = false\n public continueCalled = false\n /**\n * The normalized liquid options object\n */\n public opts: NormalizedFullOptions\n /**\n * Throw when accessing undefined variable?\n */\n public strictVariables: boolean;\n public ownPropertyOnly: boolean;\n public memoryLimit: Limiter;\n public renderLimit: Limiter;\n public constructor (env: object = {}, opts: NormalizedFullOptions = defaultOptions, renderOptions: RenderOptions = {}, { memoryLimit, renderLimit }: { [key: string]: Limiter } = {}) {\n this.sync = !!renderOptions.sync\n this.opts = opts\n this.globals = renderOptions.globals ?? opts.globals\n this.environments = isObject(env) ? env : Object(env)\n this.strictVariables = renderOptions.strictVariables ?? this.opts.strictVariables\n this.ownPropertyOnly = renderOptions.ownPropertyOnly ?? opts.ownPropertyOnly\n this.memoryLimit = memoryLimit ?? new Limiter('memory alloc', renderOptions.memoryLimit ?? opts.memoryLimit)\n this.renderLimit = renderLimit ?? new Limiter('template render', getPerformance().now() + (renderOptions.renderLimit ?? opts.renderLimit))\n }\n public getRegister (key: string, defaultValue: T = undefined as T): T {\n return (this.registers[key] = this.registers[key] || defaultValue)\n }\n public setRegister (key: string, value: any) {\n return (this.registers[key] = value)\n }\n public saveRegister (...keys: string[]): [string, any][] {\n return keys.map(key => [key, this.getRegister(key)])\n }\n public restoreRegister (keyValues: [string, any][]) {\n return keyValues.forEach(([key, value]) => this.setRegister(key, value))\n }\n public getAll () {\n return [this.globals, this.environments, ...this.scopes]\n .reduce((ctx, val) => __assign(ctx, val), {})\n }\n /**\n * @deprecated use `_get()` or `getSync()` instead\n */\n public get (paths: PropertyKey[]): unknown {\n return this.getSync(paths)\n }\n public getSync (paths: PropertyKey[]): unknown {\n return toValueSync(this._get(paths))\n }\n public * _get (paths: (PropertyKey | Drop)[]): IterableIterator {\n const scope = this.findScope(paths[0] as string) // first prop should always be a string\n return yield this._getFromScope(scope, paths)\n }\n /**\n * @deprecated use `_get()` instead\n */\n public getFromScope (scope: unknown, paths: PropertyKey[] | string): IterableIterator {\n return toValueSync(this._getFromScope(scope, paths))\n }\n public * _getFromScope (scope: unknown, paths: (PropertyKey | Drop)[] | string, strictVariables = this.strictVariables): IterableIterator {\n if (isString(paths)) paths = paths.split('.')\n for (let i = 0; i < paths.length; i++) {\n scope = yield this.readProperty(scope as object, paths[i])\n if (strictVariables && isUndefined(scope)) {\n throw new InternalUndefinedVariableError((paths as string[]).slice(0, i + 1).join!('.'))\n }\n }\n return scope\n }\n public push (ctx: object) {\n return this.scopes.push(ctx)\n }\n public pop () {\n return this.scopes.pop()\n }\n public bottom () {\n return this.scopes[0]\n }\n public spawn (scope = {}) {\n return new Context(scope, this.opts, {\n sync: this.sync,\n globals: this.globals,\n strictVariables: this.strictVariables,\n ownPropertyOnly: this.ownPropertyOnly\n }, {\n renderLimit: this.renderLimit,\n memoryLimit: this.memoryLimit\n })\n }\n private findScope (key: string | number) {\n for (let i = this.scopes.length - 1; i >= 0; i--) {\n const candidate = this.scopes[i]\n if (key in candidate) return candidate\n }\n if (key in this.environments) return this.environments\n return this.globals\n }\n readProperty (obj: Scope, key: (PropertyKey | Drop)) {\n obj = toLiquid(obj)\n key = toValue(key) as PropertyKey\n if (isNil(obj)) return obj\n if (isArray(obj) && isNumber(key)) return readArrayElement(obj, key, this.ownPropertyOnly)\n const value = readJSProperty(obj, key, this.ownPropertyOnly)\n if (value === undefined && obj instanceof Drop) return obj.liquidMethodMissing(key, this)\n if (isFunction(value)) return value.call(obj)\n if (key === 'size') return readSize(obj)\n else if (key === 'first') return readFirst(obj, this.ownPropertyOnly)\n else if (key === 'last') return readLast(obj, this.ownPropertyOnly)\n return value\n }\n}\n\nexport function readJSProperty (obj: Scope, key: PropertyKey, ownPropertyOnly: boolean) {\n if (ownPropertyOnly && !hasOwnProperty.call(obj, key) && !(obj instanceof Drop)) return undefined\n return obj[key]\n}\n\nfunction readFirst (obj: Scope, ownPropertyOnly: boolean) {\n if (isArray(obj)) return readArrayElement(obj, 0, ownPropertyOnly)\n return readJSProperty(obj, 'first', ownPropertyOnly)\n}\n\nfunction readLast (obj: Scope, ownPropertyOnly: boolean) {\n if (isArray(obj)) return readArrayElement(obj, -1, ownPropertyOnly)\n return readJSProperty(obj, 'last', ownPropertyOnly)\n}\n\nfunction readSize (obj: Scope) {\n if (hasOwnProperty.call(obj, 'size') || obj['size'] !== undefined) return obj['size']\n if (isArray(obj) || isString(obj)) return obj.length\n if (typeof obj === 'object') return Object.keys(obj).length\n}\n","export enum BlockMode {\n /* store rendered html into blocks */\n OUTPUT,\n /* output rendered html directly */\n STORE\n}\n","import { toNumber, argumentsToNumber } from '../util/underscore'\n\nexport const abs = argumentsToNumber(Math.abs)\nexport const at_least = argumentsToNumber(Math.max)\nexport const at_most = argumentsToNumber(Math.min)\nexport const ceil = argumentsToNumber(Math.ceil)\nexport const divided_by = argumentsToNumber((dividend: number, divisor: number, integerArithmetic = false) => integerArithmetic ? Math.floor(dividend / divisor) : dividend / divisor)\nexport const floor = argumentsToNumber(Math.floor)\nexport const minus = argumentsToNumber((v: number, arg: number) => v - arg)\nexport const plus = argumentsToNumber((lhs: number, rhs: number) => lhs + rhs)\nexport const modulo = argumentsToNumber((v: number, arg: number) => ((v % arg) + arg) % arg)\nexport const times = argumentsToNumber((v: number, arg: number) => v * arg)\n\nexport function round (v: number, arg = 0) {\n v = toNumber(v)\n arg = toNumber(arg)\n const amp = Math.pow(10, arg)\n const scaled = (v * amp) * (1 + Number.EPSILON)\n return Math.round(scaled) / amp\n}\n","import { stringify } from '../util/underscore'\n\nexport const url_decode = (x: string) => decodeURIComponent(stringify(x)).replace(/\\+/g, ' ')\nexport const url_encode = (x: string) => encodeURIComponent(stringify(x)).replace(/%20/g, '+')\nexport const cgi_escape = (x: string) => encodeURIComponent(stringify(x))\n .replace(/%20/g, '+')\n .replace(/[!'()*]/g, c => '%' + c.charCodeAt(0).toString(16).toUpperCase())\nexport const uri_escape = (x: string) => encodeURI(stringify(x))\n .replace(/%5B/g, '[')\n .replace(/%5D/g, ']')\n\nconst rSlugifyDefault = /[^\\p{M}\\p{L}\\p{Nd}]+/ug\nconst rSlugifyReplacers = {\n 'raw': /\\s+/g,\n 'default': rSlugifyDefault,\n 'pretty': /[^\\p{M}\\p{L}\\p{Nd}._~!$&'()+,;=@]+/ug,\n 'ascii': /[^A-Za-z0-9]+/g,\n 'latin': rSlugifyDefault,\n 'none': null\n}\n\nexport function slugify (str: string, mode: keyof typeof rSlugifyReplacers = 'default', cased = false): string {\n str = stringify(str)\n\n const replacer = rSlugifyReplacers[mode]\n if (replacer) {\n if (mode === 'latin') str = removeAccents(str)\n str = str.replace(replacer, '-').replace(/^-|-$/g, '')\n }\n\n return cased ? str : str.toLowerCase()\n}\n\nfunction removeAccents (str: string): string {\n return str.replace(/[àáâãäå]/g, 'a')\n .replace(/[æ]/g, 'ae')\n .replace(/[ç]/g, 'c')\n .replace(/[èéêë]/g, 'e')\n .replace(/[ìíîï]/g, 'i')\n .replace(/[ð]/g, 'd')\n .replace(/[ñ]/g, 'n')\n .replace(/[òóôõöø]/g, 'o')\n .replace(/[ùúûü]/g, 'u')\n .replace(/[ýÿ]/g, 'y')\n .replace(/[ß]/g, 'ss')\n .replace(/[œ]/g, 'oe')\n .replace(/[þ]/g, 'th')\n .replace(/[ẞ]/g, 'SS')\n .replace(/[Œ]/g, 'OE')\n .replace(/[Þ]/g, 'TH')\n}\n","import { toArray, argumentsToValue, toValue, stringify, caseInsensitiveCompare, orderedCompare, isArray, isNil, isArrayLike, readArrayElement, toEnumerable } from '../util'\nimport { arrayIncludes, equals, evalToken, isTruthy } from '../render'\nimport { Value, FilterImpl } from '../template'\nimport { Tokenizer } from '../parser'\nimport type { Scope } from '../context'\nimport { EmptyDrop } from '../drop'\n\nexport const join = argumentsToValue(function (this: FilterImpl, v: any[], arg: string) {\n const array = toArray(v)\n const sep = isNil(arg) ? ' ' : stringify(arg)\n let outputSize = sep.length * Math.max(array.length - 1, 0)\n for (let i = 0; i < array.length; i++) outputSize += String(array[i]).length\n this.context.memoryLimit.use(outputSize)\n return Array.prototype.join.call(array, sep)\n})\nexport const last = argumentsToValue(function (this: FilterImpl, v: any) {\n return isArrayLike(v) ? readArrayElement(v, -1, this.context.ownPropertyOnly) : ''\n})\nexport const first = argumentsToValue(function (this: FilterImpl, v: any) {\n return isArrayLike(v) ? readArrayElement(v, 0, this.context.ownPropertyOnly) : ''\n})\nexport const reverse = argumentsToValue(function (this: FilterImpl, v: any[]) {\n const array = toArray(v)\n this.context.memoryLimit.use(array.length)\n return [...array].reverse()\n})\n\nfunction * sortBy (this: FilterImpl, arr: T[], property: string | undefined, comparator: (a: unknown, b: unknown) => number): IterableIterator {\n const values: [T, unknown][] = []\n const array = toArray(arr)\n this.context.memoryLimit.use(array.length)\n for (const item of array) {\n values.push([\n item,\n property ? yield this.context._getFromScope(item, stringify(property).split('.'), false) : item\n ])\n }\n return values.sort((lhs, rhs) => comparator(lhs[1], rhs[1])).map(tuple => tuple[0])\n}\n\nexport function * sort (this: FilterImpl, arr: T[], property?: string): IterableIterator {\n return yield * sortBy.call(this, arr, property, orderedCompare)\n}\n\nexport function * sort_natural (this: FilterImpl, arr: T[], property?: string): IterableIterator {\n return yield * sortBy.call(this, arr, property, caseInsensitiveCompare)\n}\n\nexport const size = (v: string | any[]) => (v && v.length) || 0\n\nexport function * map (this: FilterImpl, arr: Scope[], property: string): IterableIterator {\n const results = []\n const array = toArray(arr)\n this.context.memoryLimit.use(array.length)\n for (const item of array) {\n results.push(yield this.context._getFromScope(item, stringify(property), false))\n }\n return results\n}\n\nexport function * sum (this: FilterImpl, arr: Scope[], property?: string): IterableIterator {\n let sum = 0\n const array = toArray(arr)\n for (const item of array) {\n const data = Number(property ? yield this.context._getFromScope(item, stringify(property), false) : item)\n sum += Number.isNaN(data) ? 0 : data\n }\n return sum\n}\n\nexport function compact (this: FilterImpl, arr: T[]) {\n const array = toArray(arr)\n this.context.memoryLimit.use(array.length)\n return Array.prototype.filter.call(array, x => !isNil(toValue(x)))\n}\n\nexport function concat (this: FilterImpl, v: T1[], arg: T2[] = []): (T1 | T2)[] {\n const lhs = toArray(v)\n const rhs = toArray(arg)\n this.context.memoryLimit.use(lhs.length + rhs.length)\n return Array.prototype.concat.call(lhs, rhs)\n}\n\nexport function push (this: FilterImpl, v: T[], arg: T): T[] {\n return concat.call(this, v, [arg]) as T[]\n}\n\nexport function unshift (this: FilterImpl, v: T[], arg: T): T[] {\n const array = toArray(v)\n this.context.memoryLimit.use(array.length)\n const clone = [...array]\n clone.unshift(arg)\n return clone\n}\n\nexport function pop (this: FilterImpl, v: T[]): T[] {\n const array = toArray(v)\n this.context.memoryLimit.use(array.length)\n const clone = [...array]\n clone.pop()\n return clone\n}\n\nexport function shift (this: FilterImpl, v: T[]): T[] {\n const array = toArray(v)\n this.context.memoryLimit.use(array.length)\n const clone = [...array]\n clone.shift()\n return clone\n}\n\nexport function slice (this: FilterImpl, v: T[] | string, begin: number, length = 1): T[] | string {\n v = toValue(v)\n if (isNil(v)) return []\n if (!isArray(v)) v = stringify(v)\n begin = begin < 0 ? v.length + begin : begin\n if (begin < 0 || length < 0) return isArray(v) ? [] : ''\n this.context.memoryLimit.use(length)\n return isArray(v)\n ? Array.prototype.slice.call(v, begin, begin + length)\n : String.prototype.slice.call(v, begin, begin + length)\n}\n\nfunction expectedMatcher (this: FilterImpl, expected: any): (v: any) => boolean {\n if (this.context.opts.jekyllWhere) {\n return (v: any) => EmptyDrop.is(expected) ? equals(v, expected) : (isArray(v) ? arrayIncludes(v, expected) : equals(v, expected))\n } else if (expected === undefined) {\n return (v: any) => isTruthy(v, this.context)\n } else {\n return (v: any) => equals(v, expected)\n }\n}\n\nfunction * filter (this: FilterImpl, include: boolean, arr: T[], property: string, expected: any): IterableIterator {\n const values: unknown[] = []\n arr = toArray(arr)\n this.context.memoryLimit.use(arr.length)\n const token = new Tokenizer(stringify(property)).readScopeValue()\n for (const item of arr) {\n values.push(yield evalToken(token, this.context.spawn(item)))\n }\n const matcher = expectedMatcher.call(this, expected)\n return Array.prototype.filter.call(arr, (_, i) => matcher(values[i]) === include)\n}\n\nfunction * filter_exp (this: FilterImpl, include: boolean, arr: T[], itemName: string, exp: string): IterableIterator {\n const filtered: unknown[] = []\n const keyTemplate = new Value(stringify(exp), this.liquid)\n const array = toArray(arr)\n this.context.memoryLimit.use(array.length)\n for (const item of array) {\n this.context.push({ [itemName]: item })\n const value = yield keyTemplate.value(this.context)\n this.context.pop()\n if (value === include) filtered.push(item)\n }\n return filtered\n}\n\nexport function * where (this: FilterImpl, arr: T[], property: string, expected?: any): IterableIterator {\n return yield * filter.call(this, true, arr, property, expected)\n}\n\nexport function * reject (this: FilterImpl, arr: T[], property: string, expected?: any): IterableIterator {\n return yield * filter.call(this, false, arr, property, expected)\n}\n\nexport function * where_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n return yield * filter_exp.call(this, true, arr, itemName, exp)\n}\n\nexport function * reject_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n return yield * filter_exp.call(this, false, arr, itemName, exp)\n}\n\nexport function * group_by (this: FilterImpl, arr: T[], property: string): IterableIterator {\n const map = new Map()\n arr = toEnumerable(arr)\n const token = new Tokenizer(stringify(property)).readScopeValue()\n this.context.memoryLimit.use(arr.length)\n for (const item of arr) {\n const key = yield evalToken(token, this.context.spawn(item))\n if (!map.has(key)) map.set(key, [])\n map.get(key).push(item)\n }\n return [...map.entries()].map(([name, items]) => ({ name, items }))\n}\n\nexport function * group_by_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n const map = new Map()\n const keyTemplate = new Value(stringify(exp), this.liquid)\n arr = toEnumerable(arr)\n this.context.memoryLimit.use(arr.length)\n for (const item of arr) {\n this.context.push({ [itemName]: item })\n const key = yield keyTemplate.value(this.context)\n this.context.pop()\n if (!map.has(key)) map.set(key, [])\n map.get(key).push(item)\n }\n return [...map.entries()].map(([name, items]) => ({ name, items }))\n}\n\nfunction * search (this: FilterImpl, arr: T[], property: string, expected: string): IterableIterator {\n const token = new Tokenizer(stringify(property)).readScopeValue()\n const array = toArray(arr)\n const matcher = expectedMatcher.call(this, expected)\n for (let index = 0; index < array.length; index++) {\n const value = yield evalToken(token, this.context.spawn(array[index]))\n if (matcher(value)) return [index, array[index]]\n }\n}\n\nfunction * search_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n const predicate = new Value(stringify(exp), this.liquid)\n const array = toArray(arr)\n for (let index = 0; index < array.length; index++) {\n this.context.push({ [itemName]: array[index] })\n const value = yield predicate.value(this.context)\n this.context.pop()\n if (value) return [index, array[index]]\n }\n}\n\nexport function * has (this: FilterImpl, arr: T[], property: string, expected?: any): IterableIterator {\n const result = yield * search.call(this, arr, property, expected)\n return !!result\n}\n\nexport function * has_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n const result = yield * search_exp.call(this, arr, itemName, exp)\n return !!result\n}\n\nexport function * find_index (this: FilterImpl, arr: T[], property: string, expected?: any): IterableIterator {\n const result = yield * search.call(this, arr, property, expected)\n return result ? result[0] : undefined\n}\n\nexport function * find_index_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n const result = yield * search_exp.call(this, arr, itemName, exp)\n return result ? result[0] : undefined\n}\n\nexport function * find (this: FilterImpl, arr: T[], property: string, expected?: any): IterableIterator {\n const result = yield * search.call(this, arr, property, expected)\n return result ? result[1] : undefined\n}\n\nexport function * find_exp (this: FilterImpl, arr: T[], itemName: string, exp: string): IterableIterator {\n const result = yield * search_exp.call(this, arr, itemName, exp)\n return result ? result[1] : undefined\n}\n\nexport function uniq (this: FilterImpl, arr: T[]): T[] {\n arr = toArray(arr)\n this.context.memoryLimit.use(arr.length)\n return [...new Set(arr)]\n}\n\nexport function sample (this: FilterImpl, v: T[] | string, count = 1): T | string | (T | string)[] {\n v = toValue(v)\n if (isNil(v)) return []\n if (!isArray(v)) v = stringify(v)\n this.context.memoryLimit.use(v.length)\n const shuffled = [...v].sort(() => Math.random() - 0.5)\n if (count === 1) return shuffled[0]\n return shuffled.slice(0, count)\n}\n","import { toValue, stringify, isString, isNumber, LiquidDate, strftime, isNil } from '../util'\nimport { FilterImpl } from '../template'\nimport { NormalizedFullOptions } from '../liquid-options'\n\nexport function date (this: FilterImpl, v: string | Date, format?: string, timezoneOffset?: number | string) {\n const size = ((v as string)?.length ?? 0) + ((timezoneOffset as string)?.length ?? 0)\n this.context.memoryLimit.use(size)\n const date = parseDate(v, this.context.opts, timezoneOffset)\n if (!date) return v\n format = toValue(format)\n format = isNil(format) ? this.context.opts.dateFormat : stringify(format)\n this.context.memoryLimit.use(format.length)\n return strftime(date, format, this.context.memoryLimit)\n}\n\nexport function date_to_xmlschema (this: FilterImpl, v: string | Date) {\n return date.call(this, v, '%Y-%m-%dT%H:%M:%S%:z')\n}\n\nexport function date_to_rfc822 (this: FilterImpl, v: string | Date) {\n return date.call(this, v, '%a, %d %b %Y %H:%M:%S %z')\n}\n\nexport function date_to_string (this: FilterImpl, v: string | Date, type?: string, style?: string) {\n return stringify_date.call(this, v, '%b', type, style)\n}\n\nexport function date_to_long_string (this: FilterImpl, v: string | Date, type?: string, style?: string) {\n return stringify_date.call(this, v, '%B', type, style)\n}\n\nfunction stringify_date (this: FilterImpl, v: string | Date, month_type: string, type?: string, style?: string) {\n const date = parseDate(v, this.context.opts)\n if (!date) return v\n const ml = this.context.memoryLimit\n if (type === 'ordinal') {\n const d = date.getDate()\n return style === 'US'\n ? strftime(date, `${month_type} ${d}%q, %Y`, ml)\n : strftime(date, `${d}%q ${month_type} %Y`, ml)\n }\n return strftime(date, `%d ${month_type} %Y`, ml)\n}\n\nfunction parseDate (v: string | Date, opts: NormalizedFullOptions, timezoneOffset?: number | string): LiquidDate | undefined {\n let date: LiquidDate | undefined\n const defaultTimezoneOffset = timezoneOffset ?? opts.timezoneOffset\n const locale = opts.locale\n v = toValue(v)\n if (isNil(v)) {\n return undefined\n } else if (v === 'now' || v === 'today') {\n date = new LiquidDate(Date.now(), locale, defaultTimezoneOffset)\n } else if (isNumber(v)) {\n date = new LiquidDate(v * 1000, locale, defaultTimezoneOffset)\n } else if (isString(v)) {\n if (/^\\d+$/.test(v)) {\n date = new LiquidDate(+v * 1000, locale, defaultTimezoneOffset)\n } else if (opts.preserveTimezones && timezoneOffset === undefined) {\n date = LiquidDate.createDateFixedToTimezone(v, locale)\n } else {\n date = new LiquidDate(v, locale, defaultTimezoneOffset)\n }\n } else {\n date = new LiquidDate(v, locale, defaultTimezoneOffset)\n }\n return date.valid() ? date : undefined\n}\n","/**\n * String related filters\n *\n * * prefer stringify() to String() since `undefined`, `null` should eval ''\n */\n\n// Han (Chinese) characters: \\u4E00-\\u9FFF\n// Additional Han characters: \\uF900-\\uFAFF (CJK Compatibility Ideographs)\n// Additional Han characters: \\u3400-\\u4DBF (CJK Unified Ideographs Extension A)\n// Katakana (Japanese): \\u30A0-\\u30FF\n// Hiragana (Japanese): \\u3040-\\u309F\n// Hangul (Korean): \\uAC00-\\uD7AF\nimport { FilterImpl } from '../template'\nimport { assert, stringify } from '../util'\n\nconst rCJKWord = /[\\u4E00-\\u9FFF\\uF900-\\uFAFF\\u3400-\\u4DBF\\u3040-\\u309F\\u30A0-\\u30FF\\uAC00-\\uD7AF]/gu\n\n// Word boundary followed by word characters (for detecting words)\nconst rNonCJKWord = /[^\\u4E00-\\u9FFF\\uF900-\\uFAFF\\u3400-\\u4DBF\\u3040-\\u309F\\u30A0-\\u30FF\\uAC00-\\uD7AF\\s]+/gu\n\nexport function append (this: FilterImpl, v: string, arg: string) {\n assert(arguments.length === 2, 'append expect 2 arguments')\n const lhs = stringify(v)\n const rhs = stringify(arg)\n this.context.memoryLimit.use(lhs.length + rhs.length)\n return lhs + rhs\n}\n\nexport function prepend (this: FilterImpl, v: string, arg: string) {\n assert(arguments.length === 2, 'prepend expect 2 arguments')\n const lhs = stringify(v)\n const rhs = stringify(arg)\n this.context.memoryLimit.use(lhs.length + rhs.length)\n return rhs + lhs\n}\n\nexport function lstrip (this: FilterImpl, v: string, chars?: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n if (chars) {\n chars = stringify(chars)\n this.context.memoryLimit.use(chars.length)\n for (let i = 0, set = new Set(chars); i < str.length; i++) {\n if (!set.has(str[i])) return str.slice(i)\n }\n return ''\n }\n return str.trimStart()\n}\n\nexport function downcase (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n return str.toLowerCase()\n}\n\nexport function upcase (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n return stringify(str).toUpperCase()\n}\n\nexport function remove (this: FilterImpl, v: string, arg: string) {\n const str = stringify(v)\n arg = stringify(arg)\n this.context.memoryLimit.use(str.length + arg.length)\n return str.split(arg).join('')\n}\n\nexport function remove_first (this: FilterImpl, v: string, l: string) {\n const str = stringify(v)\n l = stringify(l)\n this.context.memoryLimit.use(str.length + l.length)\n return str.replace(l, '')\n}\n\nexport function remove_last (this: FilterImpl, v: string, l: string) {\n const str = stringify(v)\n const pattern = stringify(l)\n this.context.memoryLimit.use(str.length + pattern.length)\n const index = str.lastIndexOf(pattern)\n if (index === -1) return str\n return str.substring(0, index) + str.substring(index + pattern.length)\n}\n\nexport function rstrip (this: FilterImpl, str: string, chars?: string) {\n str = stringify(str)\n this.context.memoryLimit.use(str.length)\n if (chars) {\n chars = stringify(chars)\n this.context.memoryLimit.use(chars.length)\n for (let i = str.length - 1, set = new Set(chars); i >= 0; i--) {\n if (!set.has(str[i])) return str.slice(0, i + 1)\n }\n return ''\n }\n return str.trimEnd()\n}\n\nexport function split (this: FilterImpl, v: string, arg: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n const arr = str.split(stringify(arg))\n // align to ruby split, which is the behavior of shopify/liquid\n // see: https://ruby-doc.org/core-2.4.0/String.html#method-i-split\n while (arr.length && arr[arr.length - 1] === '') arr.pop()\n return arr\n}\n\nexport function strip (this: FilterImpl, v: string, chars?: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n if (chars) {\n const set = new Set(stringify(chars))\n this.context.memoryLimit.use(set.size)\n let i = 0\n let j = str.length - 1\n while (set.has(str[i])) i++\n while (j >= i && set.has(str[j])) j--\n return str.slice(i, j + 1)\n }\n return str.trim()\n}\n\nexport function strip_newlines (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n return str.replace(/\\r?\\n/gm, '')\n}\n\nexport function capitalize (this: FilterImpl, str: string) {\n str = stringify(str)\n this.context.memoryLimit.use(str.length)\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()\n}\n\nexport function replace (this: FilterImpl, v: string, pattern: string, replacement: string) {\n const str = stringify(v)\n pattern = stringify(pattern)\n replacement = stringify(replacement)\n const parts = str.split(pattern)\n const outputSize = str.length + (parts.length - 1) * (replacement.length - pattern.length)\n this.context.memoryLimit.use(outputSize)\n return parts.join(replacement)\n}\n\nexport function replace_first (this: FilterImpl, v: string, arg1: string, arg2: string) {\n const str = stringify(v)\n arg1 = stringify(arg1)\n arg2 = stringify(arg2)\n this.context.memoryLimit.use(str.length + arg1.length + arg2.length)\n return str.replace(arg1, () => arg2)\n}\n\nexport function replace_last (this: FilterImpl, v: string, arg1: string, arg2: string) {\n const str = stringify(v)\n const pattern = stringify(arg1)\n const replacement = stringify(arg2)\n this.context.memoryLimit.use(str.length + pattern.length + replacement.length)\n const index = str.lastIndexOf(pattern)\n if (index === -1) return str\n return str.substring(0, index) + replacement + str.substring(index + pattern.length)\n}\n\nexport function truncate (this: FilterImpl, v: string, l = 50, o = '...') {\n const str = stringify(v)\n o = stringify(o)\n this.context.memoryLimit.use(str.length + o.length)\n if (str.length <= l) return v\n return str.substring(0, l - o.length) + o\n}\n\nexport function truncatewords (this: FilterImpl, v: string, words = 15, o = '...') {\n const str = stringify(v)\n o = stringify(o)\n this.context.memoryLimit.use(str.length + o.length)\n const arr = str.split(/\\s+/)\n if (words <= 0) words = 1\n let ret = arr.slice(0, words).join(' ')\n if (arr.length >= words) ret += o\n return ret\n}\n\nexport function normalize_whitespace (this: FilterImpl, v: string) {\n const str = stringify(v)\n this.context.memoryLimit.use(str.length)\n return str.replace(/\\s+/g, ' ')\n}\n\nexport function number_of_words (this: FilterImpl, input: string, mode?: 'cjk' | 'auto') {\n const str = stringify(input)\n this.context.memoryLimit.use(str.length)\n input = str.trim()\n if (!input) return 0\n switch (mode) {\n case 'cjk':\n // Count CJK characters and words\n return (input.match(rCJKWord) || []).length + (input.match(rNonCJKWord) || []).length\n case 'auto':\n // Count CJK characters, if none, count words\n return rCJKWord.test(input)\n ? input.match(rCJKWord)!.length + (input.match(rNonCJKWord) || []).length\n : input.split(/\\s+/).length\n default:\n // Count words only\n return input.split(/\\s+/).length\n }\n}\n\nexport function array_to_sentence_string (this: FilterImpl, array: unknown[], connector = 'and') {\n connector = stringify(connector)\n let outputSize = connector.length + array.length * 2\n for (let i = 0; i < array.length; i++) outputSize += stringify(array[i]).length\n this.context.memoryLimit.use(outputSize)\n switch (array.length) {\n case 0:\n return ''\n case 1:\n return array[0]\n case 2:\n return `${array[0]} ${connector} ${array[1]}`\n default:\n return `${array.slice(0, -1).join(', ')}, ${connector} ${array[array.length - 1]}`\n }\n}\n","\nexport function base64Encode (str: string): string {\n return btoa(String.fromCharCode(...new TextEncoder().encode(str)))\n}\n\nexport function base64Decode (str: string): string {\n return new TextDecoder().decode(\n Uint8Array.from(atob(str), c => c.charCodeAt(0))\n )\n}\n","/**\n * Base64 related filters\n *\n * Implements base64_encode and base64_decode filters for Shopify compatibility\n */\n\nimport { FilterImpl } from '../template'\nimport { stringify } from '../util'\nimport { base64Encode, base64Decode } from './base64-impl'\n\nexport function base64_encode (this: FilterImpl, value: string | Buffer): string {\n if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {\n this.context.memoryLimit.use(value.byteLength)\n return value.toString('base64')\n }\n const str = stringify(value)\n this.context.memoryLimit.use(str.length)\n return base64Encode(str)\n}\n\nexport function base64_decode (this: FilterImpl, value: string): string {\n const str = stringify(value)\n this.context.memoryLimit.use(str.length)\n return base64Decode(str)\n}\n","function bufferToHex (buffer: ArrayBuffer): string {\n const bytes = new Uint8Array(buffer)\n let hex = ''\n for (let i = 0; i < bytes.length; i++) {\n hex += bytes[i].toString(16).padStart(2, '0')\n }\n return hex\n}\n\nexport async function sha256 (str: string): Promise {\n const data = new TextEncoder().encode(str)\n const digest = await crypto.subtle.digest('SHA-256', data)\n return bufferToHex(digest)\n}\n\nexport async function hmacSha256 (str: string, key: string): Promise {\n const encoder = new TextEncoder()\n const cryptoKey = await crypto.subtle.importKey(\n 'raw',\n encoder.encode(key),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign']\n )\n const signature = await crypto.subtle.sign('HMAC', cryptoKey, encoder.encode(str))\n return bufferToHex(signature)\n}\n","/**\n * Crypto related filters\n *\n * Implements sha256 and hmac_sha256 filters for Shopify compatibility\n */\n\nimport { FilterImpl } from '../template'\nimport { stringify } from '../util'\nimport { sha256 as sha256Impl, hmacSha256 as hmacSha256Impl } from './crypto-impl'\n\nexport function sha256 (this: FilterImpl, value: unknown): string | Promise {\n const str = stringify(value)\n this.context.memoryLimit.use(str.length)\n return sha256Impl(str)\n}\n\nexport function hmac_sha256 (this: FilterImpl, value: unknown, key: unknown): string | Promise {\n const str = stringify(value)\n const keyStr = stringify(key)\n this.context.memoryLimit.use(str.length + keyStr.length)\n return hmacSha256Impl(str, keyStr)\n}\n","import * as htmlFilters from './html'\nimport * as mathFilters from './math'\nimport * as urlFilters from './url'\nimport * as arrayFilters from './array'\nimport * as dateFilters from './date'\nimport * as stringFilters from './string'\nimport * as base64Filters from './base64'\nimport * as cryptoFilters from './crypto'\nimport misc from './misc'\nimport { FilterImplOptions } from '../template'\n\nexport const filters: Record = {\n ...htmlFilters,\n ...mathFilters,\n ...urlFilters,\n ...arrayFilters,\n ...dateFilters,\n ...stringFilters,\n ...base64Filters,\n ...cryptoFilters,\n ...misc\n}\n","import { Value, Liquid, TopLevelToken, TagToken, Context, Tag } from '..'\nimport { Arguments } from '../template'\nimport { IdentifierToken } from '../tokens'\n\nexport default class extends Tag {\n private key: string\n private value: Value\n private identifier: IdentifierToken\n\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token, remainTokens, liquid)\n this.identifier = this.tokenizer.readIdentifier()\n this.key = this.identifier.content\n this.tokenizer.assert(this.key, 'expected variable name')\n\n this.tokenizer.skipBlank()\n this.tokenizer.assert(this.tokenizer.peek() === '=', 'expected \"=\"')\n\n this.tokenizer.advance()\n this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid)\n }\n * render (ctx: Context): Generator {\n ctx.bottom()[this.key] = yield this.value.value(ctx, this.liquid.options.lenientIf)\n }\n\n public * arguments (): Arguments {\n yield this.value\n }\n\n public * localScope (): Iterable {\n yield this.identifier\n }\n}\n","import { Hash, ValueToken, Liquid, Tag, evalToken, Emitter, TagToken, TopLevelToken, Context, Template, ParseStream } from '..'\nimport { assertEmpty, isValueToken, toEnumerable } from '../util'\nimport { createScope } from '../context/scope'\nimport { ForloopDrop } from '../drop/forloop-drop'\nimport { Parser } from '../parser'\nimport { Arguments } from '../template'\n\nconst MODIFIERS = ['offset', 'limit', 'reversed']\n\ntype valueOf = T[keyof T]\n\nexport default class extends Tag {\n variable: string\n collection: ValueToken\n hash: Hash\n templates: Template[]\n elseTemplates: Template[]\n\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n const variable = this.tokenizer.readIdentifier()\n const inStr = this.tokenizer.readIdentifier()\n const collection = this.tokenizer.readValue()\n if (!variable.size() || inStr.content !== 'in' || !collection) {\n throw new Error(`illegal tag: ${token.getText()}`)\n }\n\n this.variable = variable.content\n this.collection = collection\n this.hash = new Hash(this.tokenizer, liquid.options.keyValueSeparator)\n this.templates = []\n this.elseTemplates = []\n\n let p\n const stream: ParseStream = parser.parseStream(remainTokens)\n .on('start', () => (p = this.templates))\n .on('tag:else', tag => { assertEmpty(tag.args); p = this.elseTemplates })\n .on('tag:endfor', tag => { assertEmpty(tag.args); stream.stop() })\n .on('template', (tpl: Template) => p.push(tpl))\n .on('end', () => { throw new Error(`tag ${token.getText()} not closed`) })\n\n stream.start()\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n const r = this.liquid.renderer\n let collection = toEnumerable(yield evalToken(this.collection, ctx))\n\n if (!collection.length) {\n yield r.renderTemplates(this.elseTemplates, ctx, emitter)\n return\n }\n\n const continueKey = 'continue-' + this.variable + '-' + this.collection.getText()\n ctx.push(createScope({ continue: ctx.getRegister(continueKey, {}) }))\n const hash = (yield this.hash.render(ctx)) as Record\n ctx.pop()\n\n const modifiers = this.liquid.options.orderedFilterParameters\n ? Object.keys(hash).filter(x => MODIFIERS.includes(x))\n : MODIFIERS.filter(x => hash[x] !== undefined)\n\n collection = modifiers.reduce((collection, modifier: valueOf) => {\n if (modifier === 'offset') return offset(collection, hash['offset'])\n if (modifier === 'limit') return limit(collection, hash['limit'])\n return reversed(collection)\n }, collection)\n\n ctx.setRegister(continueKey, (hash['offset'] || 0) + collection.length)\n const scope = createScope({ forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) })\n ctx.push(scope)\n for (const item of collection) {\n scope[this.variable] = item\n ctx.continueCalled = ctx.breakCalled = false\n yield r.renderTemplates(this.templates, ctx, emitter)\n if (ctx.breakCalled) break\n scope.forloop.next()\n }\n ctx.continueCalled = ctx.breakCalled = false\n ctx.pop()\n }\n\n public * children (): Generator {\n const templates = this.templates.slice()\n if (this.elseTemplates) {\n templates.push(...this.elseTemplates)\n }\n return templates\n }\n\n public * arguments (): Arguments {\n yield this.collection\n\n for (const v of Object.values(this.hash.hash)) {\n if (isValueToken(v)) {\n yield v\n }\n }\n }\n\n public blockScope (): Iterable {\n return [this.variable, 'forloop']\n }\n}\n\nfunction reversed (arr: Array) {\n return [...arr].reverse()\n}\n\nfunction offset (arr: Array, count: number) {\n return arr.slice(count)\n}\n\nfunction limit (arr: Array, count: number) {\n return arr.slice(0, count)\n}\n","import { Liquid, Tag, Template, Context, TagToken, TopLevelToken } from '..'\nimport { Parser } from '../parser'\nimport { IdentifierToken, QuotedToken } from '../tokens'\nimport { isTagToken } from '../util'\n\nexport default class extends Tag {\n identifier: IdentifierToken | QuotedToken\n variable: string\n templates: Template[] = []\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(tagToken, remainTokens, liquid)\n this.identifier = this.readVariable()\n this.variable = this.identifier.content\n\n while (remainTokens.length) {\n const token = remainTokens.shift()!\n if (isTagToken(token) && token.name === 'endcapture') return\n this.templates.push(parser.parseToken(token, remainTokens))\n }\n throw new Error(`tag ${tagToken.getText()} not closed`)\n }\n\n private readVariable (): IdentifierToken | QuotedToken {\n let ident: IdentifierToken | QuotedToken | undefined = this.tokenizer.readIdentifier()\n if (ident.content) return ident\n ident = this.tokenizer.readQuoted()\n if (ident) return ident\n throw this.tokenizer.error('invalid capture name')\n }\n\n * render (ctx: Context): Generator {\n const r = this.liquid.renderer\n const html = yield r.renderTemplates(this.templates, ctx)\n ctx.bottom()[this.variable] = html\n }\n\n public * children (): Generator {\n return this.templates\n }\n\n public * localScope (): Iterable {\n yield this.identifier\n }\n}\n","import { ValueToken, Liquid, toValue, evalToken, Value, Emitter, TagToken, TopLevelToken, Context, Template, Tag, ParseStream } from '..'\nimport { Parser } from '../parser'\nimport { equals } from '../render'\nimport { Arguments } from '../template'\n\nexport default class extends Tag {\n value: Value\n branches: { values: ValueToken[], templates: Template[] }[] = []\n elseTemplates: Template[] = []\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(tagToken, remainTokens, liquid)\n this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid)\n this.elseTemplates = []\n\n let p: Template[] = []\n let elseCount = 0\n const stream: ParseStream = parser.parseStream(remainTokens)\n .on('tag:when', (token: TagToken) => {\n if (elseCount > 0) {\n return\n }\n\n p = []\n\n const values: ValueToken[] = []\n while (!token.tokenizer.end()) {\n values.push(token.tokenizer.readValueOrThrow())\n token.tokenizer.skipBlank()\n if (token.tokenizer.peek() === ',') {\n token.tokenizer.readTo(',')\n } else {\n token.tokenizer.readTo('or')\n }\n }\n this.branches.push({\n values,\n templates: p\n })\n })\n .on('tag:else', () => {\n elseCount++\n p = this.elseTemplates\n })\n .on('tag:endcase', () => stream.stop())\n .on('template', (tpl: Template) => {\n if (p !== this.elseTemplates || elseCount === 1) {\n p.push(tpl)\n }\n })\n .on('end', () => {\n throw new Error(`tag ${tagToken.getText()} not closed`)\n })\n\n stream.start()\n }\n\n * render (ctx: Context, emitter: Emitter): Generator {\n const r = this.liquid.renderer\n const target = toValue(yield this.value.value(ctx, ctx.opts.lenientIf))\n let branchHit = false\n for (const branch of this.branches) {\n for (const valueToken of branch.values) {\n const value = yield evalToken(valueToken, ctx, ctx.opts.lenientIf)\n if (equals(target, value)) {\n yield r.renderTemplates(branch.templates, ctx, emitter)\n branchHit = true\n break\n }\n }\n }\n if (!branchHit) {\n yield r.renderTemplates(this.elseTemplates, ctx, emitter)\n }\n }\n\n public * arguments (): Arguments {\n yield this.value\n yield * this.branches.flatMap(b => b.values)\n }\n\n public * children (): Generator {\n const templates = this.branches.flatMap(b => b.templates)\n if (this.elseTemplates) {\n templates.push(...this.elseTemplates)\n }\n return templates\n }\n}\n","import { Liquid, TopLevelToken, TagToken, Tag } from '..'\nimport { isTagToken } from '../util'\n\nexport default class extends Tag {\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(tagToken, remainTokens, liquid)\n while (remainTokens.length) {\n const token = remainTokens.shift()!\n if (isTagToken(token) && token.name === 'endcomment') return\n }\n throw new Error(`tag ${tagToken.getText()} not closed`)\n }\n render () {}\n}\n","import { __assign } from 'tslib'\nimport { ForloopDrop } from '../drop'\nimport { isString, isValueToken, toEnumerable } from '../util'\nimport { TopLevelToken, assert, Liquid, Token, ValueToken, Template, evalQuotedToken, TypeGuards, Tokenizer, evalToken, Hash, Emitter, TagToken, Context, Tag } from '..'\nimport { Parser } from '../parser'\nimport { Argument, Arguments, PartialScope } from '../template'\n\nexport type ParsedFileName = Template[] | Token | string | undefined\n\ntype RenderBinding = { value: ValueToken; alias?: string }\n\nexport default class extends Tag {\n private file: ParsedFileName\n private currentFile?: string\n private hash: Hash\n private with?: RenderBinding\n private forBinding?: RenderBinding\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n const tokenizer = this.tokenizer\n this.file = parseFilePath(tokenizer, this.liquid, parser)\n this.currentFile = token.file\n while (!tokenizer.end()) {\n tokenizer.skipBlank()\n const begin = tokenizer.p\n const keyword = tokenizer.readIdentifier()\n if (keyword.content === 'with' || keyword.content === 'for') {\n tokenizer.skipBlank()\n // can be normal key/value pair, like \"with: true\"\n if (tokenizer.peek() !== ':') {\n const value = tokenizer.readValue()\n // can be normal key, like \"with,\"\n if (value) {\n const beforeAs = tokenizer.p\n const asStr = tokenizer.readIdentifier()\n let alias\n if (asStr.content === 'as') alias = tokenizer.readIdentifier()\n else tokenizer.p = beforeAs\n\n const binding: RenderBinding = { value, alias: alias && alias.content }\n if (keyword.content === 'with') this.with = binding\n else this.forBinding = binding\n tokenizer.skipBlank()\n if (tokenizer.peek() === ',') tokenizer.advance()\n continue // matched!\n }\n }\n }\n /**\n * restore cursor if with/for not matched\n */\n tokenizer.p = begin\n break\n }\n this.hash = new Hash(tokenizer, liquid.options.keyValueSeparator)\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n const { liquid, hash } = this\n const filepath = (yield renderFilePath(this.file, ctx, liquid)) as string\n assert(filepath, () => `illegal file path \"${filepath}\"`)\n\n const childCtx = ctx.spawn()\n const scope = childCtx.bottom()\n __assign(scope, yield hash.render(ctx))\n if (this.with) {\n const { value, alias } = this.with\n scope[alias || filepath] = yield evalToken(value, ctx)\n }\n\n if (this.forBinding) {\n const { value, alias } = this.forBinding\n const collection = toEnumerable(yield evalToken(value, ctx))\n scope['forloop'] = new ForloopDrop(collection.length, value.getText(), alias as string)\n for (const item of collection) {\n scope[alias as string] = item\n const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)) as Template[]\n yield liquid.renderer.renderTemplates(templates, childCtx, emitter)\n scope['forloop'].next()\n }\n } else {\n const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)) as Template[]\n yield liquid.renderer.renderTemplates(templates, childCtx, emitter)\n }\n }\n\n public * children (partials: boolean, sync: boolean): Generator {\n if (partials && isString(this.file)) {\n return (yield this.liquid._parsePartialFile(this.file, sync, this.currentFile)) as Template[]\n }\n return []\n }\n\n public partialScope (): PartialScope | undefined {\n if (isString(this.file)) {\n const names: Array = Object.keys(this.hash.hash)\n\n if (this.with) {\n const { value, alias } = this.with\n if (isString(alias)) {\n names.push([alias, value])\n } else if (isString(this.file)) {\n names.push([this.file, value])\n }\n }\n\n if (this.forBinding) {\n const { value, alias } = this.forBinding\n if (isString(alias)) {\n names.push([alias, value])\n } else if (isString(this.file)) {\n names.push([this.file, value])\n }\n }\n\n return { name: this.file, isolated: true, scope: names }\n }\n }\n\n public * arguments (): Arguments {\n for (const v of Object.values(this.hash.hash)) {\n if (isValueToken(v)) {\n yield v\n }\n }\n\n if (this.with) {\n const { value } = this.with\n if (isValueToken(value)) {\n yield value\n }\n }\n\n if (this.forBinding) {\n const { value } = this.forBinding\n if (isValueToken(value)) {\n yield value\n }\n }\n }\n}\n\n/**\n * @return null for \"none\",\n * @return Template[] for quoted with tags and/or filters\n * @return Token for expression (not quoted)\n * @throws TypeError if cannot read next token\n */\nexport function parseFilePath (tokenizer: Tokenizer, liquid: Liquid, parser: Parser): ParsedFileName {\n if (liquid.options.dynamicPartials) {\n const file = tokenizer.readValue()\n tokenizer.assert(file, 'illegal file path')\n if (file!.getText() === 'none') return\n if (TypeGuards.isQuotedToken(file)) {\n // for filenames like \"files/{{file}}\", eval as liquid template\n const templates = parser.parse(evalQuotedToken(file))\n return optimize(templates)\n }\n return file\n }\n const tokens = [...tokenizer.readFileNameTemplate(liquid.options)]\n const templates = optimize(parser.parseTokens(tokens))\n return templates === 'none' ? undefined : templates\n}\n\nfunction optimize (templates: Template[]): string | Template[] {\n // for filenames like \"files/file.liquid\", extract the string directly\n if (templates.length === 1 && TypeGuards.isHTMLToken(templates[0].token)) return templates[0].token.getContent()\n return templates\n}\n\nexport function * renderFilePath (file: ParsedFileName, ctx: Context, liquid: Liquid): IterableIterator {\n if (typeof file === 'string') return file\n if (Array.isArray(file)) return liquid.renderer.renderTemplates(file, ctx)\n return yield evalToken(file, ctx)\n}\n","import { Template, ValueToken, TopLevelToken, Liquid, Tag, assert, evalToken, Hash, Emitter, TagToken, Context } from '..'\nimport { BlockMode, createScope, Scope } from '../context'\nimport { Parser } from '../parser'\nimport { Argument, Arguments, PartialScope } from '../template'\nimport { isString, isValueToken } from '../util'\nimport { parseFilePath, renderFilePath, ParsedFileName } from './render'\n\nexport default class extends Tag {\n private file: ParsedFileName\n private currentFile?: string\n private withVar?: ValueToken\n private hash: Hash\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n const { tokenizer } = token\n this.file = parseFilePath(tokenizer, this.liquid, parser)\n this.currentFile = token.file\n\n const begin = tokenizer.p\n const withStr = tokenizer.readIdentifier()\n if (withStr.content === 'with') {\n tokenizer.skipBlank()\n if (tokenizer.peek() !== ':') {\n this.withVar = tokenizer.readValue()\n } else tokenizer.p = begin\n } else tokenizer.p = begin\n\n this.hash = new Hash(tokenizer, liquid.options.jekyllInclude || liquid.options.keyValueSeparator)\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n const { liquid, hash, withVar } = this\n const { renderer } = liquid\n const filepath = (yield renderFilePath(this.file, ctx, liquid)) as string\n assert(filepath, () => `illegal file path \"${filepath}\"`)\n\n const saved = ctx.saveRegister('blocks', 'blockMode')\n ctx.setRegister('blocks', {})\n ctx.setRegister('blockMode', BlockMode.OUTPUT)\n const scope = createScope((yield hash.render(ctx)) as Scope)\n if (withVar) scope[filepath] = yield evalToken(withVar, ctx)\n const templates = (yield liquid._parsePartialFile(filepath, ctx.sync, this.currentFile)) as Template[]\n ctx.push(ctx.opts.jekyllInclude ? createScope({ include: scope }) : scope)\n yield renderer.renderTemplates(templates, ctx, emitter)\n ctx.pop()\n ctx.restoreRegister(saved)\n }\n\n public * children (partials: boolean, sync: boolean): Generator {\n if (partials && isString(this.file)) {\n return (yield this.liquid._parsePartialFile(this.file, sync, this.currentFile)) as Template[]\n }\n return []\n }\n\n public partialScope (): PartialScope | undefined {\n if (isString(this.file)) {\n let names: Array\n\n if (this.liquid.options.jekyllInclude) {\n names = ['include']\n } else {\n names = Object.keys(this.hash.hash)\n if (this.withVar) {\n names.push([this.file, this.withVar])\n }\n }\n\n return { name: this.file, isolated: false, scope: names }\n }\n }\n\n public * arguments (): Arguments {\n yield * Object.values(this.hash.hash).filter(isValueToken)\n\n if (isValueToken(this.file)) {\n yield this.file\n }\n\n if (isValueToken(this.withVar)) {\n yield this.withVar\n }\n }\n}\n","import { Tag, Liquid, TopLevelToken, Emitter, TagToken, Context } from '..'\nimport { IdentifierToken } from '../tokens'\nimport { isNumber, stringify } from '../util'\n\nexport default class extends Tag {\n private identifier: IdentifierToken\n private variable: string\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token, remainTokens, liquid)\n this.identifier = this.tokenizer.readIdentifier()\n this.variable = this.identifier.content\n }\n render (context: Context, emitter: Emitter) {\n const scope = context.environments\n if (!isNumber(scope[this.variable])) {\n scope[this.variable] = 0\n }\n emitter.write(stringify(--scope[this.variable]))\n }\n\n public * localScope (): Iterable {\n yield this.identifier\n }\n}\n","import { TopLevelToken, Liquid, ValueToken, evalToken, Emitter, TagToken, Context, Tag } from '..'\nimport { Arguments } from '../template'\n\nexport default class extends Tag {\n private candidates: ValueToken[] = []\n private group?: ValueToken\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token, remainTokens, liquid)\n const group = this.tokenizer.readValue()\n this.tokenizer.skipBlank()\n\n if (group) {\n if (this.tokenizer.peek() === ':') {\n this.group = group\n this.tokenizer.advance()\n } else this.candidates.push(group)\n }\n\n while (!this.tokenizer.end()) {\n const value = this.tokenizer.readValue()\n if (value) this.candidates.push(value)\n this.tokenizer.readTo(',')\n }\n this.tokenizer.assert(this.candidates.length, () => `empty candidates: \"${token.getText()}\"`)\n }\n\n * render (ctx: Context, emitter: Emitter): Generator {\n const group = (yield evalToken(this.group, ctx)) as ValueToken\n const fingerprint = `cycle:${group}:` + this.candidates.join(',')\n const groups = ctx.getRegister('cycle', {} as Record)\n let idx = groups[fingerprint]\n\n if (idx === undefined) {\n idx = groups[fingerprint] = 0\n }\n\n const candidate = this.candidates[idx]\n idx = (idx + 1) % this.candidates.length\n groups[fingerprint] = idx\n return yield evalToken(candidate, ctx)\n }\n\n public * arguments (): Arguments {\n yield * this.candidates\n\n if (this.group) {\n yield this.group\n }\n }\n}\n","import { Liquid, Tag, Value, Emitter, isTruthy, TagToken, TopLevelToken, Context, Template } from '..'\nimport { Parser } from '../parser'\nimport { Arguments } from '../template'\nimport { assert, assertEmpty } from '../util'\n\nexport default class extends Tag {\n branches: { value: Value, templates: Template[] }[] = []\n elseTemplates: Template[] | undefined\n\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(tagToken, remainTokens, liquid)\n let p: Template[] = []\n parser.parseStream(remainTokens)\n .on('start', () => this.branches.push({\n value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid),\n templates: (p = [])\n }))\n .on('tag:elsif', (token: TagToken) => {\n assert(!this.elseTemplates, 'unexpected elsif after else')\n this.branches.push({\n value: new Value(token.tokenizer.readFilteredValue(), this.liquid),\n templates: (p = [])\n })\n })\n .on('tag:else', tag => {\n assertEmpty(tag.args)\n assert(!this.elseTemplates, 'duplicated else')\n p = this.elseTemplates = []\n })\n .on('tag:endif', function (tag) { assertEmpty(tag.args); this.stop() })\n .on('template', (tpl: Template) => p.push(tpl))\n .on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`) })\n .start()\n }\n\n * render (ctx: Context, emitter: Emitter): Generator {\n const r = this.liquid.renderer\n\n for (const { value, templates } of this.branches) {\n const v = yield value.value(ctx, ctx.opts.lenientIf)\n if (isTruthy(v, ctx)) {\n yield r.renderTemplates(templates, ctx, emitter)\n return\n }\n }\n yield r.renderTemplates(this.elseTemplates || [], ctx, emitter)\n }\n\n public * children (): Generator {\n const templates = this.branches.flatMap(b => b.templates)\n if (this.elseTemplates) {\n templates.push(...this.elseTemplates)\n }\n return templates\n }\n\n public arguments (): Arguments {\n return this.branches.map(b => b.value)\n }\n}\n","import { isNumber, stringify } from '../util'\nimport { Tag, Liquid, TopLevelToken, Emitter, TagToken, Context } from '..'\nimport { IdentifierToken } from '../tokens'\n\nexport default class extends Tag {\n private identifier: IdentifierToken\n private variable: string\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token, remainTokens, liquid)\n this.identifier = this.tokenizer.readIdentifier()\n this.variable = this.identifier.content\n }\n render (context: Context, emitter: Emitter) {\n const scope = context.environments\n if (!isNumber(scope[this.variable])) {\n scope[this.variable] = 0\n }\n const val = scope[this.variable]\n scope[this.variable]++\n emitter.write(stringify(val))\n }\n\n public * localScope (): Iterable {\n yield this.identifier\n }\n}\n","import { Scope, Template, Liquid, Tag, assert, Emitter, Hash, TagToken, TopLevelToken, Context } from '..'\nimport { BlockMode, createScope } from '../context'\nimport { parseFilePath, renderFilePath, ParsedFileName } from './render'\nimport { BlankDrop } from '../drop'\nimport { Parser } from '../parser'\nimport { Arguments, PartialScope } from '../template'\nimport { isString, isValueToken } from '../util'\n\nexport default class extends Tag {\n args: Hash\n templates: Template[]\n file?: ParsedFileName\n private currentFile?: string\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n this.file = parseFilePath(this.tokenizer, this.liquid, parser)\n this.currentFile = token.file\n this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator)\n this.templates = parser.parseTokens(remainTokens)\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n const { liquid, args, file } = this\n const { renderer } = liquid\n if (file === undefined) {\n ctx.setRegister('blockMode', BlockMode.OUTPUT)\n yield renderer.renderTemplates(this.templates, ctx, emitter)\n return\n }\n const filepath = (yield renderFilePath(this.file, ctx, liquid)) as string\n assert(filepath, () => `illegal file path \"${filepath}\"`)\n const templates = (yield liquid._parseLayoutFile(filepath, ctx.sync, this.currentFile)) as Template[]\n\n // render remaining contents and store rendered results\n ctx.setRegister('blockMode', BlockMode.STORE)\n const html = yield renderer.renderTemplates(this.templates, ctx)\n const blocks = ctx.getRegister('blocks', {} as Record)\n\n // set whole content to anonymous block if anonymous doesn't specified\n if (blocks[''] === undefined) blocks[''] = (parent: BlankDrop, emitter: Emitter) => emitter.write(html)\n ctx.setRegister('blockMode', BlockMode.OUTPUT)\n\n // render the layout file use stored blocks\n ctx.push(createScope((yield args.render(ctx)) as Scope))\n yield renderer.renderTemplates(templates, ctx, emitter)\n ctx.pop()\n }\n\n public * children (partials: boolean): Generator {\n const templates = this.templates.slice()\n\n if (partials && isString(this.file)) {\n templates.push(...(yield this.liquid._parsePartialFile(this.file, true, this.currentFile)) as Template[])\n }\n\n return templates\n }\n\n public * arguments (): Arguments {\n for (const v of Object.values(this.args.hash)) {\n if (isValueToken(v)) {\n yield v\n }\n }\n\n if (isValueToken(this.file)) {\n yield this.file\n }\n }\n\n public partialScope (): PartialScope | undefined {\n if (isString(this.file)) {\n return { name: this.file, isolated: false, scope: Object.keys(this.args.hash) }\n }\n }\n}\n","import { BlockMode, createScope } from '../context'\nimport { isTagToken } from '../util'\nimport { BlockDrop } from '../drop'\nimport { Liquid, TagToken, TopLevelToken, Template, Context, Emitter, Tag } from '..'\nimport { Parser } from '../parser'\n\nexport default class extends Tag {\n block: string\n templates: Template[] = []\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n const match = /\\w+/.exec(token.args)\n this.block = match ? match[0] : ''\n while (remainTokens.length) {\n const token = remainTokens.shift()!\n if (isTagToken(token) && token.name === 'endblock') return\n const template = parser.parseToken(token, remainTokens)\n this.templates.push(template)\n }\n throw new Error(`tag ${token.getText()} not closed`)\n }\n\n * render (ctx: Context, emitter: Emitter) {\n const blockRender = this.getBlockRender(ctx)\n if (ctx.getRegister('blockMode') === BlockMode.STORE) {\n ctx.getRegister('blocks', {} as Record)[this.block] = blockRender\n } else {\n yield blockRender(new BlockDrop(), emitter)\n }\n }\n\n private getBlockRender (ctx: Context) {\n const self = this as Tag\n const { liquid, templates } = this\n const renderChild = ctx.getRegister('blocks', {} as Record)[this.block]\n const renderCurrent = function * (superBlock: BlockDrop, emitter: Emitter) {\n const stack: Tag[] = ctx.getRegister('blockStack', [])\n if (stack.includes(self)) throw new Error('block tag cannot be nested')\n\n stack.push(self)\n ctx.push(createScope({ block: superBlock }))\n yield liquid.renderer.renderTemplates(templates, ctx, emitter)\n ctx.pop()\n stack.pop()\n }\n return renderChild\n ? (superBlock: BlockDrop, emitter: Emitter) => renderChild(\n new BlockDrop(\n (emitter: Emitter) => renderCurrent(superBlock, emitter)\n ),\n emitter)\n : renderCurrent\n }\n\n public * children (): Generator {\n return this.templates\n }\n\n public blockScope (): Iterable {\n return ['block']\n }\n}\n","import { Liquid, TagToken, TopLevelToken, Tag } from '..'\nimport { isTagToken } from '../util'\n\nexport default class extends Tag {\n private tokens: TopLevelToken[] = []\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(tagToken, remainTokens, liquid)\n while (remainTokens.length) {\n const token = remainTokens.shift()!\n if (isTagToken(token) && token.name === 'endraw') return\n this.tokens.push(token)\n }\n throw new Error(`tag ${tagToken.getText()} not closed`)\n }\n render () {\n return this.tokens.map((token: TopLevelToken) => token.getText()).join('')\n }\n}\n","import { ForloopDrop } from './forloop-drop'\n\nexport class TablerowloopDrop extends ForloopDrop {\n private cols: number\n public constructor (length: number, cols: number, collection: string, variable: string) {\n super(length, collection, variable)\n this.length = length\n this.cols = cols\n }\n public row () {\n return Math.floor(this.i / this.cols) + 1\n }\n public col0 () {\n return (this.i % this.cols)\n }\n public col () {\n return this.col0() + 1\n }\n public col_first () { // eslint-disable-line\n return this.col0() === 0\n }\n public col_last () { // eslint-disable-line\n return this.col() === this.cols\n }\n}\n","import { isValueToken, toEnumerable } from '../util'\nimport { createScope } from '../context/scope'\nimport { ValueToken, Liquid, Tag, evalToken, Emitter, Hash, TagToken, TopLevelToken, Context, Template, ParseStream } from '..'\nimport { TablerowloopDrop } from '../drop/tablerowloop-drop'\nimport { Parser } from '../parser'\nimport { Arguments } from '../template'\n\nexport default class extends Tag {\n variable: string\n args: Hash\n templates: Template[]\n collection: ValueToken\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(tagToken, remainTokens, liquid)\n const variable = this.tokenizer.readIdentifier()\n this.tokenizer.skipBlank()\n\n const predicate = this.tokenizer.readIdentifier()\n const collectionToken = this.tokenizer.readValue()\n if (predicate.content !== 'in' || !collectionToken) {\n throw new Error(`illegal tag: ${tagToken.getText()}`)\n }\n\n this.variable = variable.content\n this.collection = collectionToken\n this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator)\n this.templates = []\n\n let p\n const stream: ParseStream = parser.parseStream(remainTokens)\n .on('start', () => (p = this.templates))\n .on('tag:endtablerow', () => stream.stop())\n .on('template', (tpl: Template) => p.push(tpl))\n .on('end', () => {\n throw new Error(`tag ${tagToken.getText()} not closed`)\n })\n\n stream.start()\n }\n\n * render (ctx: Context, emitter: Emitter): Generator {\n let collection = toEnumerable(yield evalToken(this.collection, ctx))\n const args = (yield this.args.render(ctx)) as Record\n const offset = args.offset || 0\n const limit = (args.limit === undefined) ? collection.length : args.limit\n\n collection = collection.slice(offset, offset + limit)\n const cols = args.cols || collection.length\n\n const r = this.liquid.renderer\n const tablerowloop = new TablerowloopDrop(collection.length, cols, this.collection.getText(), this.variable)\n const scope = createScope({ tablerowloop })\n ctx.push(scope)\n\n for (let idx = 0; idx < collection.length; idx++, tablerowloop.next()) {\n scope[this.variable] = collection[idx]\n if (tablerowloop.col0() === 0) {\n if (tablerowloop.row() !== 1) emitter.write('')\n emitter.write(``)\n }\n emitter.write(``)\n yield r.renderTemplates(this.templates, ctx, emitter)\n emitter.write('')\n }\n if (collection.length) emitter.write('')\n ctx.pop()\n }\n\n public * children (): Generator {\n return this.templates\n }\n\n public * arguments (): Arguments {\n yield this.collection\n\n for (const v of Object.values(this.args.hash)) {\n if (isValueToken(v)) {\n yield v\n }\n }\n }\n\n public blockScope (): string[] {\n return [this.variable, 'tablerowloop']\n }\n}\n","import { Liquid, Tag, Value, TopLevelToken, Template, Emitter, isTruthy, isFalsy, Context, TagToken } from '..'\nimport { Parser } from '../parser'\nimport { Arguments } from '../template'\n\nexport default class extends Tag {\n branches: { value: Value, test: (val: any, ctx: Context) => boolean, templates: Template[] }[] = []\n elseTemplates: Template[] = []\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(tagToken, remainTokens, liquid)\n let p: Template[] = []\n let elseCount = 0\n parser.parseStream(remainTokens)\n .on('start', () => this.branches.push({\n value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid),\n test: isFalsy,\n templates: (p = [])\n }))\n .on('tag:elsif', (token: TagToken) => {\n if (elseCount > 0) {\n p = []\n return\n }\n this.branches.push({\n value: new Value(token.tokenizer.readFilteredValue(), this.liquid),\n test: isTruthy,\n templates: (p = [])\n })\n })\n .on('tag:else', () => {\n elseCount++\n p = this.elseTemplates\n })\n .on('tag:endunless', function () { this.stop() })\n .on('template', (tpl: Template) => {\n if (p !== this.elseTemplates || elseCount === 1) {\n p.push(tpl)\n }\n })\n .on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`) })\n .start()\n }\n\n * render (ctx: Context, emitter: Emitter): Generator {\n const r = this.liquid.renderer\n\n for (const { value, test, templates } of this.branches) {\n const v = yield value.value(ctx, ctx.opts.lenientIf)\n if (test(v, ctx)) {\n yield r.renderTemplates(templates, ctx, emitter)\n return\n }\n }\n\n yield r.renderTemplates(this.elseTemplates, ctx, emitter)\n }\n\n public * children (): Generator {\n const children = this.branches.flatMap(b => b.templates)\n if (this.elseTemplates) {\n children.push(...this.elseTemplates)\n }\n return children\n }\n\n public arguments (): Arguments {\n return this.branches.map(b => b.value)\n }\n}\n","import { Context, Emitter, Tag } from '..'\n\nexport default class extends Tag {\n render (ctx: Context, _emitter: Emitter) {\n ctx.breakCalled = true\n }\n}\n","import { Tag, Emitter, Context } from '..'\n\nexport default class extends Tag {\n render (ctx: Context, _emitter: Emitter) {\n ctx.continueCalled = true\n }\n}\n","import { Liquid, TopLevelToken, Emitter, Value, TagToken, Context, Tag } from '..'\nimport { Arguments } from '../template'\n\nexport default class extends Tag {\n private value?: Value\n\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(token, remainTokens, liquid)\n this.tokenizer.skipBlank()\n if (!this.tokenizer.end()) {\n this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid)\n }\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n if (!this.value) return\n const val = yield this.value.value(ctx, false)\n emitter.write(val)\n }\n\n public * arguments (): Arguments {\n if (this.value) {\n yield this.value\n }\n }\n}\n","import { Template, Emitter, Liquid, TopLevelToken, TagToken, Context, Tag } from '..'\nimport { Parser } from '../parser'\n\nexport default class extends Tag {\n templates: Template[]\n constructor (token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser) {\n super(token, remainTokens, liquid)\n const tokens = this.tokenizer.readLiquidTagTokens(this.liquid.options)\n this.templates = parser.parseTokens(tokens)\n }\n * render (ctx: Context, emitter: Emitter): Generator {\n yield this.liquid.renderer.renderTemplates(this.templates, ctx, emitter)\n }\n\n public * children (): Generator {\n return this.templates\n }\n}\n","import { TagToken, Liquid, TopLevelToken, Tag } from '..'\n\nexport default class extends Tag {\n constructor (tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid) {\n super(tagToken, remainTokens, liquid)\n if (tagToken.args.search(/\\n\\s*[^#\\s]/g) !== -1) {\n throw new Error('every line of an inline comment must start with a \\'#\\' character')\n }\n }\n render () { }\n}\n","import AssignTag from './assign'\nimport ForTag from './for'\nimport CaptureTag from './capture'\nimport CaseTag from './case'\nimport CommentTag from './comment'\nimport IncludeTag from './include'\nimport RenderTag from './render'\nimport DecrementTag from './decrement'\nimport CycleTag from './cycle'\nimport IfTag from './if'\nimport IncrementTag from './increment'\nimport LayoutTag from './layout'\nimport BlockTag from './block'\nimport RawTag from './raw'\nimport TablerowTag from './tablerow'\nimport UnlessTag from './unless'\nimport BreakTag from './break'\nimport ContinueTag from './continue'\nimport EchoTag from './echo'\nimport LiquidTag from './liquid'\nimport InlineCommentTag from './inline-comment'\nimport type { TagClass } from '../template/tag'\n\nexport const tags: Record = {\n assign: AssignTag,\n 'for': ForTag,\n capture: CaptureTag,\n 'case': CaseTag,\n comment: CommentTag,\n include: IncludeTag,\n render: RenderTag,\n decrement: DecrementTag,\n increment: IncrementTag,\n cycle: CycleTag,\n 'if': IfTag,\n layout: LayoutTag,\n block: BlockTag,\n raw: RawTag,\n tablerow: TablerowTag,\n unless: UnlessTag,\n 'break': BreakTag,\n 'continue': ContinueTag,\n echo: EchoTag,\n liquid: LiquidTag,\n '#': InlineCommentTag\n}\n\nexport { AssignTag, ForTag, CaptureTag, CaseTag, CommentTag, IncludeTag, RenderTag, DecrementTag, IncrementTag, CycleTag, IfTag, LayoutTag, BlockTag, RawTag, TablerowTag, UnlessTag, BreakTag, ContinueTag, EchoTag, LiquidTag, InlineCommentTag }\n","import { Context } from './context'\nimport { toPromise, toValueSync, isFunction, forOwn, isString, strictUniq } from './util'\nimport { TagClass, createTagClass, TagImplOptions, FilterImplOptions, Template, Value, StaticAnalysisOptions, StaticAnalysis, analyze, analyzeSync, SegmentArray } from './template'\nimport { LookupType } from './fs/loader'\nimport { Render } from './render'\nimport { Parser } from './parser'\nimport { tags } from './tags'\nimport { filters } from './filters'\nimport { LiquidOptions, normalizeDirectoryList, NormalizedFullOptions, normalize, RenderOptions, RenderFileOptions } from './liquid-options'\n\nexport class Liquid {\n public readonly options: NormalizedFullOptions\n public readonly renderer = new Render()\n /**\n * @deprecated will be removed. In tags use `this.parser` instead\n */\n public readonly parser: Parser\n public readonly filters: Record = Object.create(null)\n public readonly tags: Record = Object.create(null)\n\n public constructor (opts: LiquidOptions = {}) {\n this.options = normalize(opts)\n // eslint-disable-next-line deprecation/deprecation\n this.parser = new Parser(this)\n forOwn(tags, (conf: TagClass, name: string) => this.registerTag(name, conf))\n forOwn(filters, (handler: FilterImplOptions, name: string) => this.registerFilter(name, handler))\n }\n public parse (html: string, filepath?: string): Template[] {\n const parser = new Parser(this)\n return parser.parse(html, filepath)\n }\n\n public _render (tpl: Template[], scope: Context | object | undefined, renderOptions: RenderOptions): IterableIterator {\n const ctx = scope instanceof Context ? scope : new Context(scope, this.options, renderOptions)\n return this.renderer.renderTemplates(tpl, ctx)\n }\n public async render (tpl: Template[], scope?: object, renderOptions?: RenderOptions): Promise {\n return toPromise(this._render(tpl, scope, { ...renderOptions, sync: false }))\n }\n public renderSync (tpl: Template[], scope?: object, renderOptions?: RenderOptions): any {\n return toValueSync(this._render(tpl, scope, { ...renderOptions, sync: true }))\n }\n public renderToNodeStream (tpl: Template[], scope?: object, renderOptions: RenderOptions = {}): NodeJS.ReadableStream {\n const ctx = new Context(scope, this.options, renderOptions)\n return this.renderer.renderTemplatesToNodeStream(tpl, ctx)\n }\n\n public _parseAndRender (html: string, scope: Context | object | undefined, renderOptions: RenderOptions): IterableIterator {\n const tpl = this.parse(html)\n return this._render(tpl, scope, renderOptions)\n }\n public async parseAndRender (html: string, scope?: Context | object, renderOptions?: RenderOptions): Promise {\n return toPromise(this._parseAndRender(html, scope, { ...renderOptions, sync: false }))\n }\n public parseAndRenderSync (html: string, scope?: Context | object, renderOptions?: RenderOptions): any {\n return toValueSync(this._parseAndRender(html, scope, { ...renderOptions, sync: true }))\n }\n\n public _parsePartialFile (file: string, sync?: boolean, currentFile?: string) {\n return new Parser(this).parseFile(file, sync, LookupType.Partials, currentFile)\n }\n public _parseLayoutFile (file: string, sync?: boolean, currentFile?: string) {\n return new Parser(this).parseFile(file, sync, LookupType.Layouts, currentFile)\n }\n public _parseFile (file: string, sync?: boolean, lookupType?: LookupType, currentFile?: string): Generator {\n return new Parser(this).parseFile(file, sync, lookupType, currentFile)\n }\n public async parseFile (file: string, lookupType?: LookupType): Promise {\n return toPromise(new Parser(this).parseFile(file, false, lookupType))\n }\n public parseFileSync (file: string, lookupType?: LookupType): Template[] {\n return toValueSync(new Parser(this).parseFile(file, true, lookupType))\n }\n public * _renderFile (file: string, ctx: Context | object | undefined, renderFileOptions: RenderFileOptions): Generator {\n const templates = (yield this._parseFile(file, renderFileOptions.sync, renderFileOptions.lookupType)) as Template[]\n return yield this._render(templates, ctx, renderFileOptions)\n }\n public async renderFile (file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions) {\n return toPromise(this._renderFile(file, ctx, { ...renderFileOptions, sync: false }))\n }\n public renderFileSync (file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions) {\n return toValueSync(this._renderFile(file, ctx, { ...renderFileOptions, sync: true }))\n }\n public async renderFileToNodeStream (file: string, scope?: object, renderOptions?: RenderOptions) {\n const templates = await this.parseFile(file)\n return this.renderToNodeStream(templates, scope, renderOptions)\n }\n\n public _evalValue (str: string, scope?: object | Context): IterableIterator {\n const value = new Value(str, this)\n const ctx = scope instanceof Context ? scope : new Context(scope, this.options)\n return value.value(ctx)\n }\n public async evalValue (str: string, scope?: object | Context): Promise {\n return toPromise(this._evalValue(str, scope))\n }\n public evalValueSync (str: string, scope?: object | Context): any {\n return toValueSync(this._evalValue(str, scope))\n }\n\n public registerFilter (name: string, filter: FilterImplOptions) {\n this.filters[name] = filter\n }\n public registerTag (name: string, tag: TagClass | TagImplOptions) {\n this.tags[name] = isFunction(tag) ? tag : createTagClass(tag)\n }\n public plugin (plugin: (this: Liquid, L: typeof Liquid) => void) {\n return plugin.call(this, Liquid)\n }\n public express () {\n const self = this // eslint-disable-line\n let firstCall = true\n\n return function (this: any, filePath: string, ctx: object, callback: (err: Error | null, rendered: string) => void) {\n if (firstCall) {\n firstCall = false\n const dirs = normalizeDirectoryList(this.root)\n self.options.root.unshift(...dirs)\n self.options.layouts.unshift(...dirs)\n self.options.partials.unshift(...dirs)\n }\n self.renderFile(filePath, ctx).then(html => callback(null, html) as any, callback as any)\n }\n }\n\n public async analyze (template: Template[], options: StaticAnalysisOptions = {}): Promise {\n return analyze(template, options)\n }\n\n public analyzeSync (template: Template[], options: StaticAnalysisOptions = {}): StaticAnalysis {\n return analyzeSync(template, options)\n }\n\n public async parseAndAnalyze (html: string, filename?: string, options: StaticAnalysisOptions = {}): Promise {\n return analyze(this.parse(html, filename), options)\n }\n\n public parseAndAnalyzeSync (html: string, filename?: string, options: StaticAnalysisOptions = {}): StaticAnalysis {\n return analyzeSync(this.parse(html, filename), options)\n }\n\n /** Return an array of all variables without their properties. */\n public async variables (template: string | Template[], options: StaticAnalysisOptions = {}): Promise {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Object.keys(analysis.variables)\n }\n\n /** Return an array of all variables without their properties. */\n public variablesSync (template: string | Template[], options: StaticAnalysisOptions = {}): string[] {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Object.keys(analysis.variables)\n }\n\n /** Return an array of all variables including their properties/paths. */\n public async fullVariables (template: string | Template[], options: StaticAnalysisOptions = {}): Promise {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))))\n }\n\n /** Return an array of all variables including their properties/paths. */\n public fullVariablesSync (template: string | Template[], options: StaticAnalysisOptions = {}): string[] {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v)))))\n }\n\n /** Return an array of all variables, each as an array of properties/segments. */\n public async variableSegments (template: string | Template[], options: StaticAnalysisOptions = {}): Promise> {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))))\n }\n\n /** Return an array of all variables, each as an array of properties/segments. */\n public variableSegmentsSync (template: string | Template[], options: StaticAnalysisOptions = {}): Array {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray()))))\n }\n\n /** Return an array of all expected context variables without their properties. */\n public async globalVariables (template: string | Template[], options: StaticAnalysisOptions = {}): Promise {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Object.keys(analysis.globals)\n }\n\n /** Return an array of all expected context variables without their properties. */\n public globalVariablesSync (template: string | Template[], options: StaticAnalysisOptions = {}): string[] {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Object.keys(analysis.globals)\n }\n\n /** Return an array of all expected context variables including their properties/paths. */\n public async globalFullVariables (template: string | Template[], options: StaticAnalysisOptions = {}): Promise {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))))\n }\n\n /** Return an array of all expected context variables including their properties/paths. */\n public globalFullVariablesSync (template: string | Template[], options: StaticAnalysisOptions = {}): string[] {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v)))))\n }\n\n /** Return an array of all expected context variables, each as an array of properties/segments. */\n public async globalVariableSegments (template: string | Template[], options: StaticAnalysisOptions = {}): Promise> {\n const analysis = await analyze(isString(template) ? this.parse(template) : template, options)\n return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))))\n }\n\n /** Return an array of all expected context variables, each as an array of properties/segments. */\n public globalVariableSegmentsSync (template: string | Template[], options: StaticAnalysisOptions = {}): Array {\n const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options)\n return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray()))))\n }\n}\n","/* istanbul ignore file */\nexport const version = '[VI]{version}[/VI]'\nexport * as TypeGuards from './util/type-guards'\nexport { toValue, createTrie, Trie, toPromise, toValueSync, assert, LiquidError, ParseError, RenderError, UndefinedVariableError, TokenizationError, AssertionError } from './util'\nexport type { LiquidErrors } from './util/error'\nexport { Drop } from './drop'\nexport type { Comparable } from './drop'\nexport { Emitter } from './emitters'\nexport { defaultOperators, Operators, evalToken, evalQuotedToken, Expression, isFalsy, isTruthy } from './render'\nexport { Context, Scope } from './context'\nexport { Value, Hash, Template, FilterImplOptions, Tag, Filter, Output, Variable, VariableLocation, VariableSegments, Variables, StaticAnalysis, StaticAnalysisOptions, analyze, analyzeSync, Arguments, PartialScope } from './template'\nexport type { TagRenderReturn } from './template'\nexport { Token, TopLevelToken, TagToken, ValueToken } from './tokens'\nexport type { RangeToken, LiteralToken, QuotedToken, PropertyAccessToken, NumberToken } from './tokens'\nexport { TokenKind, Tokenizer, ParseStream, Parser } from './parser'\nexport { filters } from './filters'\nexport * from './tags'\nexport { defaultOptions } from './liquid-options'\nexport type { LiquidOptions, RenderOptions, RenderFileOptions } from './liquid-options'\nexport { FS, LookupType } from './fs'\nexport { Liquid } from './liquid'\n"],"names":["toString","_\r\n .range","_.padStart","TokenKind","LookupType","last","sha256","sha256Impl","hmacSha256Impl","TypeGuards.isQuotedToken","TypeGuards.isHTMLToken","AssignTag","ForTag","CaptureTag","CaseTag","CommentTag","IncludeTag","RenderTag","DecrementTag","IncrementTag","CycleTag","IfTag","LayoutTag","BlockTag","RawTag","TablerowTag","UnlessTag","BreakTag","ContinueTag","EchoTag","LiquidTag","InlineCommentTag"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAGE,eACS,IAAe,EACf,KAAa,EACb,KAAa,EACb,GAAW,EACX,IAAa;YAJb,SAAI,GAAJ,IAAI,CAAW;YACf,UAAK,GAAL,KAAK,CAAQ;YACb,UAAK,GAAL,KAAK,CAAQ;YACb,QAAG,GAAH,GAAG,CAAQ;YACX,SAAI,GAAJ,IAAI,CAAS;SAClB;QACG,uBAAO,GAAd;YACE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;SAC9C;QACM,2BAAW,GAAlB;YACM,IAAA,KAAA,OAAa,CAAC,CAAC,EAAE,CAAC,CAAC,IAAA,EAAlB,GAAG,QAAA,EAAE,GAAG,QAAU,CAAA;YACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;gBACnC,IAAI,IAAI,CAAC,KAAK,CAAC,CA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AAO,EAAE,GAAA,CAAC,GAAA,CAAC,CAAC,CAAC,CAAA;SACzG;QACH,aAAC;IAAD,CAAC;;ICpND;AACA,QAAa,OAAO,GAAG,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/liquidjs/dist/liquid.d.ts b/node_modules/liquidjs/dist/liquid.d.ts new file mode 100644 index 00000000..4d387b39 --- /dev/null +++ b/node_modules/liquidjs/dist/liquid.d.ts @@ -0,0 +1,70 @@ +/// +import { Context } from './context'; +import { TagClass, TagImplOptions, FilterImplOptions, Template, StaticAnalysisOptions, StaticAnalysis, SegmentArray } from './template'; +import { LookupType } from './fs/loader'; +import { Render } from './render'; +import { Parser } from './parser'; +import { LiquidOptions, NormalizedFullOptions, RenderOptions, RenderFileOptions } from './liquid-options'; +export declare class Liquid { + readonly options: NormalizedFullOptions; + readonly renderer: Render; + /** + * @deprecated will be removed. In tags use `this.parser` instead + */ + readonly parser: Parser; + readonly filters: Record; + readonly tags: Record; + constructor(opts?: LiquidOptions); + parse(html: string, filepath?: string): Template[]; + _render(tpl: Template[], scope: Context | object | undefined, renderOptions: RenderOptions): IterableIterator; + render(tpl: Template[], scope?: object, renderOptions?: RenderOptions): Promise; + renderSync(tpl: Template[], scope?: object, renderOptions?: RenderOptions): any; + renderToNodeStream(tpl: Template[], scope?: object, renderOptions?: RenderOptions): NodeJS.ReadableStream; + _parseAndRender(html: string, scope: Context | object | undefined, renderOptions: RenderOptions): IterableIterator; + parseAndRender(html: string, scope?: Context | object, renderOptions?: RenderOptions): Promise; + parseAndRenderSync(html: string, scope?: Context | object, renderOptions?: RenderOptions): any; + _parsePartialFile(file: string, sync?: boolean, currentFile?: string): Generator; + _parseLayoutFile(file: string, sync?: boolean, currentFile?: string): Generator; + _parseFile(file: string, sync?: boolean, lookupType?: LookupType, currentFile?: string): Generator; + parseFile(file: string, lookupType?: LookupType): Promise; + parseFileSync(file: string, lookupType?: LookupType): Template[]; + _renderFile(file: string, ctx: Context | object | undefined, renderFileOptions: RenderFileOptions): Generator; + renderFile(file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions): Promise; + renderFileSync(file: string, ctx?: Context | object, renderFileOptions?: RenderFileOptions): any; + renderFileToNodeStream(file: string, scope?: object, renderOptions?: RenderOptions): Promise; + _evalValue(str: string, scope?: object | Context): IterableIterator; + evalValue(str: string, scope?: object | Context): Promise; + evalValueSync(str: string, scope?: object | Context): any; + registerFilter(name: string, filter: FilterImplOptions): void; + registerTag(name: string, tag: TagClass | TagImplOptions): void; + plugin(plugin: (this: Liquid, L: typeof Liquid) => void): void; + express(): (this: any, filePath: string, ctx: object, callback: (err: Error | null, rendered: string) => void) => void; + analyze(template: Template[], options?: StaticAnalysisOptions): Promise; + analyzeSync(template: Template[], options?: StaticAnalysisOptions): StaticAnalysis; + parseAndAnalyze(html: string, filename?: string, options?: StaticAnalysisOptions): Promise; + parseAndAnalyzeSync(html: string, filename?: string, options?: StaticAnalysisOptions): StaticAnalysis; + /** Return an array of all variables without their properties. */ + variables(template: string | Template[], options?: StaticAnalysisOptions): Promise; + /** Return an array of all variables without their properties. */ + variablesSync(template: string | Template[], options?: StaticAnalysisOptions): string[]; + /** Return an array of all variables including their properties/paths. */ + fullVariables(template: string | Template[], options?: StaticAnalysisOptions): Promise; + /** Return an array of all variables including their properties/paths. */ + fullVariablesSync(template: string | Template[], options?: StaticAnalysisOptions): string[]; + /** Return an array of all variables, each as an array of properties/segments. */ + variableSegments(template: string | Template[], options?: StaticAnalysisOptions): Promise>; + /** Return an array of all variables, each as an array of properties/segments. */ + variableSegmentsSync(template: string | Template[], options?: StaticAnalysisOptions): Array; + /** Return an array of all expected context variables without their properties. */ + globalVariables(template: string | Template[], options?: StaticAnalysisOptions): Promise; + /** Return an array of all expected context variables without their properties. */ + globalVariablesSync(template: string | Template[], options?: StaticAnalysisOptions): string[]; + /** Return an array of all expected context variables including their properties/paths. */ + globalFullVariables(template: string | Template[], options?: StaticAnalysisOptions): Promise; + /** Return an array of all expected context variables including their properties/paths. */ + globalFullVariablesSync(template: string | Template[], options?: StaticAnalysisOptions): string[]; + /** Return an array of all expected context variables, each as an array of properties/segments. */ + globalVariableSegments(template: string | Template[], options?: StaticAnalysisOptions): Promise>; + /** Return an array of all expected context variables, each as an array of properties/segments. */ + globalVariableSegmentsSync(template: string | Template[], options?: StaticAnalysisOptions): Array; +} diff --git a/node_modules/liquidjs/dist/liquid.node.js b/node_modules/liquidjs/dist/liquid.node.js new file mode 100644 index 00000000..885b5535 --- /dev/null +++ b/node_modules/liquidjs/dist/liquid.node.js @@ -0,0 +1,5182 @@ +/* + * liquidjs@10.27.2, https://github.com/harttle/liquidjs + * (c) 2016-2026 harttle + * Released under the MIT License. + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var stream = require('stream'); +var path = require('path'); +var fs$1 = require('fs'); +var crypto = require('crypto'); + +class Token { + constructor(kind, input, begin, end, file) { + this.kind = kind; + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + } + getText() { + return this.input.slice(this.begin, this.end); + } + getPosition() { + let [row, col] = [1, 1]; + for (let i = 0; i < this.begin; i++) { + if (this.input[i] === '\n') { + row++; + col = 1; + } + else + col++; + } + return [row, col]; + } + size() { + return this.end - this.begin; + } +} + +class Drop { + liquidMethodMissing(key, context) { + return undefined; + } +} + +const toString$1 = Object.prototype.toString; +const toLowerCase = String.prototype.toLowerCase; +const hasOwnProperty = Object.hasOwnProperty; +function isString(value) { + return typeof value === 'string'; +} +// eslint-disable-next-line @typescript-eslint/ban-types +function isFunction(value) { + return typeof value === 'function'; +} +function isPromise(val) { + return val && isFunction(val.then); +} +function isIterator(val) { + return val && isFunction(val.next) && isFunction(val.throw) && isFunction(val.return); +} +function promisify(fn) { + return function (...args) { + return new Promise((resolve, reject) => { + fn(...args, (err, result) => { + err ? reject(err) : resolve(result); + }); + }); + }; +} +function stringify(value) { + value = toValue(value); + if (isString(value)) + return value; + if (isNil(value)) + return ''; + if (isArray(value)) + return value.map(x => stringify(x)).join(''); + return String(value); +} +function readArrayElement(arr, index, ownPropertyOnly) { + if (index < 0) + index = arr.length + index; + if (ownPropertyOnly && !hasOwnProperty.call(arr, index)) + return undefined; + return arr[index]; +} +function toEnumerable(val) { + val = toValue(val); + if (isArray(val)) + return val; + if (isString(val) && val.length > 0) + return [val]; + if (isIterable(val)) + return Array.from(val); + if (isObject(val)) + return Object.keys(val).map((key) => [key, val[key]]); + return []; +} +function toArray(val) { + val = toValue(val); + if (isNil(val)) + return []; + if (isArray(val)) + return val; + return [val]; +} +function toValue(value) { + return (value instanceof Drop && isFunction(value.valueOf)) ? value.valueOf() : value; +} +function toNumber(value) { + return +toValue(value) || 0; +} +function isNumber(value) { + return typeof value === 'number'; +} +function toLiquid(value) { + if (value && isFunction(value.toLiquid)) + return toLiquid(value.toLiquid()); + return value; +} +function isNil(value) { + return value == null; +} +function isUndefined(value) { + return value === undefined; +} +function isArray(value) { + // be compatible with IE 8 + return toString$1.call(value) === '[object Array]'; +} +function isArrayLike(value) { + return value && isNumber(value.length); +} +function isIterable(value) { + return isObject(value) && Symbol.iterator in value; +} +/* + * Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property. + * The iteratee is invoked with three arguments: (value, key, object). + * Iteratee functions may exit iteration early by explicitly returning false. + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @return {Object} Returns object. + */ +function forOwn(obj, iteratee) { + obj = obj || {}; + for (const k in obj) { + if (hasOwnProperty.call(obj, k)) { + if (iteratee(obj[k], k, obj) === false) + break; + } + } + return obj; +} +/* + * Checks if value is the language type of Object. + * (e.g. arrays, functions, objects, regexes, new Number(0), and new String('')) + * @param {any} value The value to check. + * @return {Boolean} Returns true if value is an object, else false. + */ +function isObject(value) { + const type = typeof value; + return value !== null && (type === 'object' || type === 'function'); +} +function range(start, stop, step = 1) { + const arr = []; + for (let i = start; i < stop; i += step) { + arr.push(i); + } + return arr; +} +function padStart(str, length, ch = ' ') { + return pad(str, length, ch, (str, ch) => ch + str); +} +function padEnd(str, length, ch = ' ') { + return pad(str, length, ch, (str, ch) => str + ch); +} +function pad(str, length, ch, add) { + str = String(str); + const n = length - str.length; + if (n <= 0) + return str; + return add(str, ch.repeat(n)); +} +function identify(val) { + return val; +} +function changeCase(str) { + const hasLowerCase = [...str].some(ch => ch >= 'a' && ch <= 'z'); + return hasLowerCase ? str.toUpperCase() : str.toLowerCase(); +} +function ellipsis(str, N) { + return str.length > N ? str.slice(0, N - 3) + '...' : str; +} +function orderedCompare(a, b) { + if (isNil(a) && isNil(b)) + return 0; + if (isNil(a)) + return 1; + if (isNil(b)) + return -1; + if (a < b) + return -1; + if (a > b) + return 1; + return 0; +} +// compare string in case-insensitive way, undefined values to the tail +function caseInsensitiveCompare(a, b) { + if (isNil(a) && isNil(b)) + return 0; + if (isNil(a)) + return 1; + if (isNil(b)) + return -1; + a = toLowerCase.call(a); + b = toLowerCase.call(b); + if (a < b) + return -1; + if (a > b) + return 1; + return 0; +} +function argumentsToValue(fn) { + return function (...args) { return fn.call(this, ...args.map(toValue)); }; +} +function argumentsToNumber(fn) { + return function (...args) { return fn.call(this, ...args.map(toNumber)); }; +} +/** Return an array containing unique elements from _array_. Works with nested arrays and objects. */ +function* strictUniq(array) { + const seen = new Set(); + for (const element of array) { + const key = JSON.stringify(element); + if (!seen.has(key)) { + seen.add(key); + yield element; + } + } +} + +/** + * targeting ES5, extends Error won't create a proper prototype chain, need a trait to keep track of classes + */ +const TRAIT = '__liquidClass__'; +class LiquidError extends Error { + constructor(err, token) { + /** + * note: for ES5 targeting, `this` will be replaced by return value of Error(), + * thus everything on `this` will be lost, avoid calling `LiquidError` methods here + */ + super(typeof err === 'string' ? err : err.message); + this.context = ''; + if (typeof err !== 'string') + Object.defineProperty(this, 'originalError', { value: err, enumerable: false }); + Object.defineProperty(this, 'token', { value: token, enumerable: false }); + Object.defineProperty(this, TRAIT, { value: 'LiquidError', enumerable: false }); + } + update() { + Object.defineProperty(this, 'context', { value: mkContext(this.token), enumerable: false }); + this.message = mkMessage(this.message, this.token); + this.stack = this.message + '\n' + this.context + + '\n' + this.stack; + if (this.originalError) + this.stack += '\nFrom ' + this.originalError.stack; + } + static is(obj) { + return obj?.[TRAIT] === 'LiquidError'; + } +} +class TokenizationError extends LiquidError { + constructor(message, token) { + super(message, token); + this.name = 'TokenizationError'; + super.update(); + } +} +class ParseError extends LiquidError { + constructor(err, token) { + super(err, token); + this.name = 'ParseError'; + this.message = err.message; + super.update(); + } +} +class RenderError extends LiquidError { + constructor(err, tpl) { + super(err, tpl.token); + this.name = 'RenderError'; + this.message = err.message; + super.update(); + } + static is(obj) { + return obj.name === 'RenderError'; + } +} +class LiquidErrors extends LiquidError { + constructor(errors) { + super(errors[0], errors[0].token); + this.errors = errors; + this.name = 'LiquidErrors'; + const s = errors.length > 1 ? 's' : ''; + this.message = `${errors.length} error${s} found`; + super.update(); + } + static is(obj) { + return obj.name === 'LiquidErrors'; + } +} +class UndefinedVariableError extends LiquidError { + constructor(err, token) { + super(err, token); + this.name = 'UndefinedVariableError'; + this.message = err.message; + super.update(); + } +} +// only used internally; raised where we don't have token information, +// so it can't be an UndefinedVariableError. +class InternalUndefinedVariableError extends Error { + constructor(variableName) { + super(`undefined variable: ${variableName}`); + this.name = 'InternalUndefinedVariableError'; + this.variableName = variableName; + } +} +class AssertionError extends Error { + constructor(message) { + super(message); + this.name = 'AssertionError'; + this.message = message + ''; + } +} +function mkContext(token) { + const [line, col] = token.getPosition(); + const lines = token.input.split('\n'); + const begin = Math.max(line - 2, 1); + const end = Math.min(line + 3, lines.length); + const context = range(begin, end + 1) + .map(lineNumber => { + const rowIndicator = (lineNumber === line) ? '>> ' : ' '; + const num = padStart(String(lineNumber), String(end).length); + let text = `${rowIndicator}${num}| `; + const colIndicator = lineNumber === line + ? '\n' + padStart('^', col + text.length) + : ''; + text += lines[lineNumber - 1]; + text += colIndicator; + return text; + }) + .join('\n'); + return context; +} +function mkMessage(msg, token) { + if (token.file) + msg += `, file:${token.file}`; + const [line, col] = token.getPosition(); + msg += `, line:${line}, col:${col}`; + return msg; +} + +// **DO NOT CHANGE THIS FILE** +// +// This file is generated by bin/character-gen.js +// bitmask character types to boost performance +const TYPES = [0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 4, 4, 4, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 8, 0, 0, 0, 0, 8, 0, 0, 0, 64, 0, 65, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 0, 0, 2, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]; +const WORD = 1; +const BLANK = 4; +const QUOTE = 8; +const INLINE_BLANK = 16; +const NUMBER = 32; +const SIGN = 64; +const PUNCTUATION = 128; +function isWord(char) { + const code = char.charCodeAt(0); + return code >= 128 ? !TYPES[code] : !!(TYPES[code] & WORD); +} +TYPES[160] = TYPES[5760] = TYPES[6158] = TYPES[8192] = TYPES[8193] = TYPES[8194] = TYPES[8195] = TYPES[8196] = TYPES[8197] = TYPES[8198] = TYPES[8199] = TYPES[8200] = TYPES[8201] = TYPES[8202] = TYPES[8232] = TYPES[8233] = TYPES[8239] = TYPES[8287] = TYPES[12288] = BLANK; +TYPES[8220] = TYPES[8221] = PUNCTUATION; + +function assert(predicate, message) { + if (!predicate) { + const msg = typeof message === 'function' + ? message() + : (message || `expect ${predicate} to be true`); + throw new AssertionError(msg); + } +} +function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate)}`) { + assert(!predicate, message); +} + +class NullDrop extends Drop { + equals(value) { + return isNil(toValue(value)); + } + gt() { + return false; + } + geq() { + return false; + } + lt() { + return false; + } + leq() { + return false; + } + valueOf() { + return null; + } +} + +class EmptyDrop extends Drop { + equals(value) { + if (value instanceof EmptyDrop) + return false; + value = toValue(value); + if (isString(value) || isArray(value)) + return value.length === 0; + if (isObject(value)) + return Object.keys(value).length === 0; + return false; + } + gt() { + return false; + } + geq() { + return false; + } + lt() { + return false; + } + leq() { + return false; + } + valueOf() { + return ''; + } + static is(value) { + return value instanceof EmptyDrop; + } +} + +class BlankDrop extends EmptyDrop { + equals(value) { + if (value === false) + return true; + if (isNil(toValue(value))) + return true; + if (isString(value)) + return /^\s*$/.test(value); + return super.equals(value); + } + static is(value) { + return value instanceof BlankDrop; + } +} + +class ForloopDrop extends Drop { + constructor(length, collection, variable) { + super(); + this.i = 0; + this.length = length; + this.name = `${variable}-${collection}`; + } + next() { + this.i++; + } + index0() { + return this.i; + } + index() { + return this.i + 1; + } + first() { + return this.i === 0; + } + last() { + return this.i === this.length - 1; + } + rindex() { + return this.length - this.i; + } + rindex0() { + return this.length - this.i - 1; + } + valueOf() { + return JSON.stringify(this); + } +} + +class SimpleEmitter { + constructor() { + this.buffer = ''; + } + write(html) { + this.buffer += stringify(html); + } +} + +class StreamedEmitter { + constructor() { + this.buffer = ''; + this.stream = new stream.PassThrough(); + } + write(html) { + this.stream.write(stringify(html)); + } + error(err) { + this.stream.emit('error', err); + } + end() { + this.stream.end(); + } +} + +class KeepingTypeEmitter { + constructor() { + this.buffer = ''; + } + write(html) { + html = toValue(html); + // This will only preserve the type if the value is isolated. + // I.E: + // {{ my-port }} -> 42 + // {{ my-host }}:{{ my-port }} -> 'host:42' + if (typeof html !== 'string' && this.buffer === '') { + this.buffer = html; + } + else { + this.buffer = stringify(this.buffer) + stringify(html); + } + } +} + +class BlockDrop extends Drop { + constructor( + // the block render from layout template + superBlockRender = () => '') { + super(); + this.superBlockRender = superBlockRender; + } + /** + * Provide parent access in child block by + * {{ block.super }} + */ + *super() { + const emitter = new SimpleEmitter(); + yield this.superBlockRender(emitter); + return emitter.buffer; + } +} + +function isComparable(arg) { + return (arg && + isFunction(arg.equals) && + isFunction(arg.gt) && + isFunction(arg.geq) && + isFunction(arg.lt) && + isFunction(arg.leq)); +} + +const nil = new NullDrop(); +const literalValues = { + 'true': true, + 'false': false, + 'nil': nil, + 'null': nil, + 'empty': new EmptyDrop(), + 'blank': new BlankDrop() +}; + +// Tries are built once per input object and reused: the Tokenizer rebuilds them +// on every instantiation, but `input` (operators/literalValues) is a stable +// reference. WeakMap-keying by `input` lets short-lived operator objects (and +// their tries) be garbage collected. The returned trie is treated as read-only +// by callers (matchTrie only reads it); do not mutate it. +const trieCache = new WeakMap(); +function createTrie(input) { + const cached = trieCache.get(input); + if (cached) + return cached; + const trie = {}; + for (const [name, data] of Object.entries(input)) { + let node = trie; + for (let i = 0; i < name.length; i++) { + const c = name[i]; + node[c] = node[c] || {}; + if (i === name.length - 1 && isWord(name[i])) { + node[c].needBoundary = true; + } + node = node[c]; + } + node.data = data; + node.end = true; + } + trieCache.set(input, trie); + return trie; +} + +function toLiquidAsync(asyncFn, syncFn) { + const syncImpl = syncFn || asyncFn; + return (sync, ...args) => { + return sync ? syncImpl(...args) : asyncFn(...args); + }; +} +// convert an async iterator to a Promise +async function toPromise(val) { + if (!isIterator(val)) + return val; + let value; + let done = false; + let next = 'next'; + do { + const state = val[next](value); + done = !!state.done; + value = state.value; + next = 'next'; + try { + if (isIterator(value)) + value = toPromise(value); + if (isPromise(value)) + value = await value; + } + catch (err) { + next = 'throw'; + value = err; + } + } while (!done); + return value; +} +// convert an async iterator to a value in a synchronous manner +function toValueSync(val) { + if (!isIterator(val)) + return val; + let value; + let done = false; + let next = 'next'; + do { + const state = val[next](value); + done = !!state.done; + value = state.value; + next = 'next'; + if (isIterator(value)) { + try { + value = toValueSync(value); + } + catch (err) { + next = 'throw'; + value = err; + } + } + } while (!done); + return value; +} + +const rFormat = /%([-_0^#:]+)?(\d+)?([EO])?(.)/; +// prototype extensions +function daysInMonth(d) { + const feb = isLeapYear(d) ? 29 : 28; + return [31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +} +function getDayOfYear(d) { + let num = 0; + for (let i = 0; i < d.getMonth(); ++i) { + num += daysInMonth(d)[i]; + } + return num + d.getDate(); +} +function getWeekOfYear(d, startDay) { + // Skip to startDay of this week + const now = getDayOfYear(d) + (startDay - d.getDay()); + // Find the first startDay of the year + const jan1 = new Date(d.getFullYear(), 0, 1); + const then = (7 - jan1.getDay() + startDay); + return String(Math.floor((now - then) / 7) + 1); +} +function isLeapYear(d) { + const year = d.getFullYear(); + return !!((year & 3) === 0 && (year % 100 || (year % 400 === 0 && year))); +} +function ordinal(d) { + const date = d.getDate(); + if ([11, 12, 13].includes(date)) + return 'th'; + switch (date % 10) { + case 1: return 'st'; + case 2: return 'nd'; + case 3: return 'rd'; + default: return 'th'; + } +} +function century(d) { + return parseInt(d.getFullYear().toString().substring(0, 2), 10); +} +// default to 0 +const padWidths = { + d: 2, + e: 2, + H: 2, + I: 2, + j: 3, + k: 2, + l: 2, + L: 3, + m: 2, + M: 2, + S: 2, + U: 2, + W: 2 +}; +const padSpaceChars = new Set('aAbBceklpP'); +function getTimezoneOffset(d, opts) { + const nOffset = Math.abs(d.getTimezoneOffset()); + const h = Math.floor(nOffset / 60); + const m = nOffset % 60; + return (d.getTimezoneOffset() > 0 ? '-' : '+') + + padStart(h, 2, '0') + + (opts.flags[':'] ? ':' : '') + + padStart(m, 2, '0'); +} +const formatCodes = { + a: (d) => d.getShortWeekdayName(), + A: (d) => d.getLongWeekdayName(), + b: (d) => d.getShortMonthName(), + B: (d) => d.getLongMonthName(), + c: (d) => d.toLocaleString(), + C: (d) => century(d), + d: (d) => d.getDate(), + e: (d) => d.getDate(), + H: (d) => d.getHours(), + I: (d) => String(d.getHours() % 12 || 12), + j: (d) => getDayOfYear(d), + k: (d) => d.getHours(), + l: (d) => String(d.getHours() % 12 || 12), + L: (d) => d.getMilliseconds(), + m: (d) => d.getMonth() + 1, + M: (d) => d.getMinutes(), + N: (d, opts) => { + const width = Number(opts.width) || 9; + const str = padStart(String(d.getMilliseconds()), 3, '0').slice(0, width); + opts.memoryLimit?.use(width - str.length); + return padEnd(str, width, '0'); + }, + p: (d) => (d.getHours() < 12 ? 'AM' : 'PM'), + P: (d) => (d.getHours() < 12 ? 'am' : 'pm'), + q: (d) => ordinal(d), + s: (d) => Math.round(d.getTime() / 1000), + S: (d) => d.getSeconds(), + u: (d) => d.getDay() || 7, + U: (d) => getWeekOfYear(d, 0), + w: (d) => d.getDay(), + W: (d) => getWeekOfYear(d, 1), + x: (d) => d.toLocaleDateString(), + X: (d) => d.toLocaleTimeString(), + y: (d) => d.getFullYear().toString().slice(2, 4), + Y: (d) => d.getFullYear(), + z: getTimezoneOffset, + Z: (d, opts) => d.getTimeZoneName() || getTimezoneOffset(d, opts), + 't': () => '\t', + 'n': () => '\n', + '%': () => '%' +}; +formatCodes.h = formatCodes.b; +function strftime(d, formatStr, memoryLimit) { + let output = ''; + let remaining = formatStr; + let match; + while ((match = rFormat.exec(remaining))) { + output += remaining.slice(0, match.index); + remaining = remaining.slice(match.index + match[0].length); + output += format(d, match, memoryLimit); + } + return output + remaining; +} +function format(d, match, memoryLimit) { + const [input, flagStr = '', width, modifier, conversion] = match; + const convert = formatCodes[conversion]; + if (!convert) + return input; + const flags = {}; + for (const flag of flagStr) + flags[flag] = true; + let ret = String(convert(d, { flags, width, modifier, memoryLimit })); + let padChar = padSpaceChars.has(conversion) ? ' ' : '0'; + let padWidth = Number(width) || padWidths[conversion] || 0; + if (flags['^']) + ret = ret.toUpperCase(); + else if (flags['#']) + ret = changeCase(ret); + if (flags['_']) + padChar = ' '; + else if (flags['0']) + padChar = '0'; + if (flags['-']) + padWidth = 0; + memoryLimit?.use(Number(padWidth) - ret.length); + return padStart(ret, padWidth, padChar); +} + +function getDateTimeFormat() { + return (typeof Intl !== 'undefined' ? Intl.DateTimeFormat : undefined); +} + +// one minute in milliseconds +const OneMinute = 60000; +/** + * Need support both ISO8601 and RFC2822 as in major browsers & NodeJS + * RFC2822: https://datatracker.ietf.org/doc/html/rfc2822#section-3.3 + */ +const TIMEZONE_PATTERN = /([zZ]|([+-])(\d{2}):?(\d{2}))$/; +const monthNames = [ + 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', + 'September', 'October', 'November', 'December' +]; +const monthNamesShort = monthNames.map(name => name.slice(0, 3)); +const dayNames = [ + 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' +]; +const dayNamesShort = dayNames.map(name => name.slice(0, 3)); +/** + * A date implementation with timezone info, just like Ruby date + * + * Implementation: + * - create a Date offset by it's timezone difference, avoiding overriding a bunch of methods + * - rewrite getTimezoneOffset() to trick strftime + */ +class LiquidDate { + constructor(init, locale, timezone) { + this.locale = locale; + this.DateTimeFormat = getDateTimeFormat(); + this.date = new Date(init); + this.timezoneFixed = timezone !== undefined; + if (timezone === undefined) { + timezone = this.date.getTimezoneOffset(); + } + this.timezoneOffset = isString(timezone) ? LiquidDate.getTimezoneOffset(timezone, this.date) : timezone; + this.timezoneName = isString(timezone) ? timezone : ''; + const diff = (this.date.getTimezoneOffset() - this.timezoneOffset) * OneMinute; + const time = this.date.getTime() + diff; + this.displayDate = new Date(time); + } + getTime() { + return this.displayDate.getTime(); + } + getMilliseconds() { + return this.displayDate.getMilliseconds(); + } + getSeconds() { + return this.displayDate.getSeconds(); + } + getMinutes() { + return this.displayDate.getMinutes(); + } + getHours() { + return this.displayDate.getHours(); + } + getDay() { + return this.displayDate.getDay(); + } + getDate() { + return this.displayDate.getDate(); + } + getMonth() { + return this.displayDate.getMonth(); + } + getFullYear() { + return this.displayDate.getFullYear(); + } + toLocaleString(locale, init) { + if (init?.timeZone) { + return this.date.toLocaleString(locale, init); + } + return this.displayDate.toLocaleString(locale, init); + } + toLocaleTimeString(locale) { + return this.displayDate.toLocaleTimeString(locale); + } + toLocaleDateString(locale) { + return this.displayDate.toLocaleDateString(locale); + } + getTimezoneOffset() { + return this.timezoneOffset; + } + getTimeZoneName() { + if (this.timezoneFixed) + return this.timezoneName; + if (!this.DateTimeFormat) + return; + return this.DateTimeFormat().resolvedOptions().timeZone; + } + getLongMonthName() { + return this.format({ month: 'long' }) ?? monthNames[this.getMonth()]; + } + getShortMonthName() { + return this.format({ month: 'short' }) ?? monthNamesShort[this.getMonth()]; + } + getLongWeekdayName() { + return this.format({ weekday: 'long' }) ?? dayNames[this.displayDate.getDay()]; + } + getShortWeekdayName() { + return this.format({ weekday: 'short' }) ?? dayNamesShort[this.displayDate.getDay()]; + } + valid() { + return !isNaN(this.getTime()); + } + format(options) { + return this.DateTimeFormat && this.DateTimeFormat(this.locale, options).format(this.displayDate); + } + /** + * Create a Date object fixed to it's declared Timezone. Both + * - 2021-08-06T02:29:00.000Z and + * - 2021-08-06T02:29:00.000+08:00 + * will always be displayed as + * - 2021-08-06 02:29:00 + * regardless timezoneOffset in JavaScript realm + * + * The implementation hack: + * Instead of calling `.getMonth()`/`.getUTCMonth()` respect to `preserveTimezones`, + * we create a different Date to trick strftime, it's both simpler and more performant. + * Given that a template is expected to be parsed fewer times than rendered. + */ + static createDateFixedToTimezone(dateString, locale) { + const m = dateString.match(TIMEZONE_PATTERN); + // representing a UTC timestamp + if (m && m[1] === 'Z') { + return new LiquidDate(+new Date(dateString), locale, 0); + } + // has a timezone specified + if (m && m[2] && m[3] && m[4]) { + const [, , sign, hours, minutes] = m; + const offset = (sign === '+' ? -1 : 1) * (parseInt(hours, 10) * 60 + parseInt(minutes, 10)); + return new LiquidDate(+new Date(dateString), locale, offset); + } + return new LiquidDate(dateString, locale); + } + static getTimezoneOffset(timezoneName, date) { + const localDateString = date.toLocaleString('en-US', { timeZone: timezoneName }); + const utcDateString = date.toLocaleString('en-US', { timeZone: 'UTC' }); + const localDate = new Date(localDateString); + const utcDate = new Date(utcDateString); + return (+utcDate - +localDate) / (60 * 1000); + } +} + +class Limiter { + constructor(resource, limit) { + this.base = 0; + this.message = `${resource} limit exceeded`; + this.limit = limit; + } + use(count) { + if (+count > 0) { + assert(this.base + +count <= this.limit, this.message); + this.base += +count; + } + } + check(count) { + if (+count > 0) { + assert(+count <= this.limit, this.message); + } + } +} + +class DelimitedToken extends Token { + constructor(kind, [contentBegin, contentEnd], input, begin, end, trimLeft, trimRight, file) { + super(kind, input, begin, end, file); + this.trimLeft = false; + this.trimRight = false; + const tl = input[contentBegin] === '-'; + const tr = input[contentEnd - 1] === '-'; + let l = tl ? contentBegin + 1 : contentBegin; + let r = tr ? contentEnd - 1 : contentEnd; + while (l < r && (TYPES[input.charCodeAt(l)] & BLANK)) + l++; + while (r > l && (TYPES[input.charCodeAt(r - 1)] & BLANK)) + r--; + this.contentRange = [l, r]; + this.trimLeft = tl || trimLeft; + this.trimRight = tr || trimRight; + } + get content() { + return this.input.slice(this.contentRange[0], this.contentRange[1]); + } +} + +class TagToken extends DelimitedToken { + constructor(input, begin, end, options, file) { + const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } = options; + const [valueBegin, valueEnd] = [begin + tagDelimiterLeft.length, end - tagDelimiterRight.length]; + super(exports.TokenKind.Tag, [valueBegin, valueEnd], input, begin, end, trimTagLeft, trimTagRight, file); + this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange); + this.name = this.tokenizer.readTagName(); + this.tokenizer.assert(this.name, `illegal tag syntax, tag name expected`); + this.tokenizer.skipBlank(); + this.args = this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]); + } +} + +class OutputToken extends DelimitedToken { + constructor(input, begin, end, options, file) { + const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } = options; + const valueRange = [begin + outputDelimiterLeft.length, end - outputDelimiterRight.length]; + super(exports.TokenKind.Output, valueRange, input, begin, end, trimOutputLeft, trimOutputRight, file); + } +} + +class HTMLToken extends Token { + constructor(input, begin, end, file) { + super(exports.TokenKind.HTML, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.trimLeft = 0; + this.trimRight = 0; + } + getContent() { + return this.input.slice(this.begin + this.trimLeft, this.end - this.trimRight); + } +} + +class NumberToken extends Token { + constructor(input, begin, end, file) { + super(exports.TokenKind.Number, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.content = Number(this.getText()); + } +} + +class IdentifierToken extends Token { + constructor(input, begin, end, file) { + super(exports.TokenKind.Word, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.content = this.getText(); + } +} + +class LiteralToken extends Token { + constructor(input, begin, end, file) { + super(exports.TokenKind.Literal, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.literal = this.getText(); + this.content = literalValues[this.literal]; + } +} + +const operatorPrecedences = { + '==': 2, + '!=': 2, + '>': 2, + '<': 2, + '>=': 2, + '<=': 2, + 'contains': 2, + 'not': 1, + 'and': 0, + 'or': 0 +}; +const operatorTypes = { + '==': 0 /* OperatorType.Binary */, + '!=': 0 /* OperatorType.Binary */, + '>': 0 /* OperatorType.Binary */, + '<': 0 /* OperatorType.Binary */, + '>=': 0 /* OperatorType.Binary */, + '<=': 0 /* OperatorType.Binary */, + 'contains': 0 /* OperatorType.Binary */, + 'not': 1 /* OperatorType.Unary */, + 'and': 0 /* OperatorType.Binary */, + 'or': 0 /* OperatorType.Binary */ +}; +class OperatorToken extends Token { + constructor(input, begin, end, file) { + super(exports.TokenKind.Operator, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.operator = this.getText(); + } + getPrecedence() { + return this.operator in operatorPrecedences ? operatorPrecedences[this.operator] : 1; + } +} + +class PropertyAccessToken extends Token { + constructor(variable, props, input, begin, end, file) { + super(exports.TokenKind.PropertyAccess, input, begin, end, file); + this.variable = variable; + this.props = props; + } +} + +class FilterToken extends Token { + constructor(name, args, input, begin, end, file) { + super(exports.TokenKind.Filter, input, begin, end, file); + this.name = name; + this.args = args; + } +} + +class HashToken extends Token { + constructor(input, begin, end, name, value, file) { + super(exports.TokenKind.Hash, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.name = name; + this.value = value; + this.file = file; + } +} + +const rHex = /[\da-fA-F]/; +const rOct = /[0-7]/; +const escapeChar = { + b: '\b', + f: '\f', + n: '\n', + r: '\r', + t: '\t', + v: '\x0B' +}; +function hexVal(c) { + const code = c.charCodeAt(0); + if (code >= 97) + return code - 87; + if (code >= 65) + return code - 55; + return code - 48; +} +function parseStringLiteral(str) { + let ret = ''; + for (let i = 1; i < str.length - 1; i++) { + if (str[i] !== '\\') { + ret += str[i]; + continue; + } + if (escapeChar[str[i + 1]] !== undefined) { + ret += escapeChar[str[++i]]; + } + else if (str[i + 1] === 'u') { + let val = 0; + let j = i + 2; + while (j <= i + 5 && rHex.test(str[j])) { + val = val * 16 + hexVal(str[j++]); + } + i = j - 1; + ret += String.fromCharCode(val); + } + else if (!rOct.test(str[i + 1])) { + ret += str[++i]; + } + else { + let j = i + 1; + let val = 0; + while (j <= i + 3 && rOct.test(str[j])) { + val = val * 8 + hexVal(str[j++]); + } + i = j - 1; + ret += String.fromCharCode(val); + } + } + return ret; +} + +class QuotedToken extends Token { + constructor(input, begin, end, file) { + super(exports.TokenKind.Quoted, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.content = parseStringLiteral(this.getText()); + } +} + +class RangeToken extends Token { + constructor(input, begin, end, lhs, rhs, file) { + super(exports.TokenKind.Range, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.lhs = lhs; + this.rhs = rhs; + this.file = file; + } +} + +/** + * LiquidTagToken is different from TagToken by not having delimiters `{%` or `%}` + */ +class LiquidTagToken extends DelimitedToken { + constructor(input, begin, end, options, file) { + super(exports.TokenKind.Tag, [begin, end], input, begin, end, false, false, file); + this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange); + this.name = this.tokenizer.readTagName(); + this.tokenizer.assert(this.name, 'illegal liquid tag syntax'); + this.tokenizer.skipBlank(); + } + get args() { + return this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]); + } +} + +/** + * value expression with optional filters + * e.g. + * {% assign foo="bar" | append: "coo" %} + */ +class FilteredValueToken extends Token { + constructor(initial, filters, input, begin, end, file) { + super(exports.TokenKind.FilteredValue, input, begin, end, file); + this.initial = initial; + this.filters = filters; + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + } +} + +const polyfill = { + now: () => Date.now() +}; +function getPerformance() { + return (typeof global === 'object' && global.performance) || + (typeof window === 'object' && window.performance) || + polyfill; +} + +class Render { + renderTemplatesToNodeStream(templates, ctx) { + const emitter = new StreamedEmitter(); + Promise.resolve().then(() => toPromise(this.renderTemplates(templates, ctx, emitter))) + .then(() => emitter.end(), err => emitter.error(err)); + return emitter.stream; + } + *renderTemplates(templates, ctx, emitter) { + if (!emitter) { + emitter = ctx.opts.keepOutputType ? new KeepingTypeEmitter() : new SimpleEmitter(); + } + ctx.renderLimit.check(getPerformance().now()); + const errors = []; + for (const tpl of templates) { + ctx.renderLimit.check(getPerformance().now()); + try { + // if tpl.render supports emitter, it'll return empty `html` + const html = yield tpl.render(ctx, emitter); + // if not, it'll return an `html`, write to the emitter for it + html && emitter.write(html); + if (ctx.breakCalled || ctx.continueCalled) + break; + } + catch (e) { + const err = LiquidError.is(e) ? e : new RenderError(e, tpl); + if (ctx.opts.catchAllErrors) + errors.push(err); + else + throw err; + } + } + if (errors.length) { + throw new LiquidErrors(errors); + } + return emitter.buffer; + } +} + +class Expression { + constructor(tokens) { + this.postfix = [...toPostfix(tokens)]; + } + *evaluate(ctx, lenient) { + assert(ctx, 'unable to evaluate: context not defined'); + const operands = []; + for (const token of this.postfix) { + if (isOperatorToken(token)) { + const r = operands.pop(); + let result; + if (operatorTypes[token.operator] === 1 /* OperatorType.Unary */) { + result = yield ctx.opts.operators[token.operator](r, ctx); + } + else { + const l = operands.pop(); + result = yield ctx.opts.operators[token.operator](l, r, ctx); + } + operands.push(result); + } + else { + operands.push(yield evalToken(token, ctx, lenient)); + } + } + return operands[0]; + } + valid() { + return !!this.postfix.length; + } +} +function* evalToken(token, ctx, lenient = false) { + if (!token) + return; + if ('content' in token) + return token.content; + if (isPropertyAccessToken(token)) + return yield evalPropertyAccessToken(token, ctx, lenient); + if (isRangeToken(token)) + return yield evalRangeToken(token, ctx); +} +function* evalPropertyAccessToken(token, ctx, lenient) { + const props = []; + for (const prop of token.props) { + props.push((yield evalToken(prop, ctx, false))); + } + try { + if (token.variable) { + const variable = yield evalToken(token.variable, ctx, lenient); + return yield ctx._getFromScope(variable, props); + } + else { + return yield ctx._get(props); + } + } + catch (e) { + if (lenient && e.name === 'InternalUndefinedVariableError') + return null; + throw (new UndefinedVariableError(e, token)); + } +} +function evalQuotedToken(token) { + return token.content; +} +function* evalRangeToken(token, ctx) { + const low = yield evalToken(token.lhs, ctx); + const high = yield evalToken(token.rhs, ctx); + ctx.memoryLimit.use(high - low + 1); + return range(+low, +high + 1); +} +function* toPostfix(tokens) { + const ops = []; + for (const token of tokens) { + if (isOperatorToken(token)) { + while (ops.length && ops[ops.length - 1].getPrecedence() > token.getPrecedence()) { + yield ops.pop(); + } + ops.push(token); + } + else + yield token; + } + while (ops.length) { + yield ops.pop(); + } +} + +function isTruthy(val, ctx) { + return !isFalsy(val, ctx); +} +function isFalsy(val, ctx) { + val = toValue(val); + if (ctx.opts.jsTruthy) { + return !val; + } + else { + return val === false || undefined === val || val === null; + } +} + +const defaultOperators = { + '==': equals, + '!=': (l, r) => !equals(l, r), + '>': (l, r) => { + if (isComparable(l)) + return l.gt(r); + if (isComparable(r)) + return r.lt(l); + return toValue(l) > toValue(r); + }, + '<': (l, r) => { + if (isComparable(l)) + return l.lt(r); + if (isComparable(r)) + return r.gt(l); + return toValue(l) < toValue(r); + }, + '>=': (l, r) => { + if (isComparable(l)) + return l.geq(r); + if (isComparable(r)) + return r.leq(l); + return toValue(l) >= toValue(r); + }, + '<=': (l, r) => { + if (isComparable(l)) + return l.leq(r); + if (isComparable(r)) + return r.geq(l); + return toValue(l) <= toValue(r); + }, + 'contains': (l, r) => { + l = toValue(l); + if (isArray(l)) + return l.some((i) => equals(i, r)); + if (isFunction(l?.indexOf)) + return l.indexOf(toValue(r)) > -1; + return false; + }, + 'not': (v, ctx) => isFalsy(toValue(v), ctx), + 'and': (l, r, ctx) => isTruthy(toValue(l), ctx) && isTruthy(toValue(r), ctx), + 'or': (l, r, ctx) => isTruthy(toValue(l), ctx) || isTruthy(toValue(r), ctx) +}; +function equals(lhs, rhs) { + if (isComparable(lhs)) + return lhs.equals(rhs); + if (isComparable(rhs)) + return rhs.equals(lhs); + lhs = toValue(lhs); + rhs = toValue(rhs); + if (isArray(lhs)) { + return isArray(rhs) && arrayEquals(lhs, rhs); + } + return lhs === rhs; +} +function arrayEquals(lhs, rhs) { + if (lhs.length !== rhs.length) + return false; + return !lhs.some((value, i) => !equals(value, rhs[i])); +} +function arrayIncludes(arr, item) { + return arr.some(value => equals(value, item)); +} + +class Node { + constructor(key, value, next, prev) { + this.key = key; + this.value = value; + this.next = next; + this.prev = prev; + } +} +class LRU { + constructor(limit, size = 0) { + this.limit = limit; + this.size = size; + this.cache = {}; + this.head = new Node('HEAD', null, null, null); + this.tail = new Node('TAIL', null, null, null); + this.head.next = this.tail; + this.tail.prev = this.head; + } + write(key, value) { + if (this.cache[key]) { + this.cache[key].value = value; + } + else { + const node = new Node(key, value, this.head.next, this.head); + this.head.next.prev = node; + this.head.next = node; + this.cache[key] = node; + this.size++; + this.ensureLimit(); + } + } + read(key) { + if (!this.cache[key]) + return; + const { value } = this.cache[key]; + this.remove(key); + this.write(key, value); + return value; + } + remove(key) { + const node = this.cache[key]; + node.prev.next = node.next; + node.next.prev = node.prev; + delete this.cache[key]; + this.size--; + } + clear() { + this.head.next = this.tail; + this.tail.prev = this.head; + this.size = 0; + this.cache = {}; + } + ensureLimit() { + if (this.size > this.limit) + this.remove(this.tail.prev.key); + } +} + +const requireResolve = (partial) => require.resolve(partial, { paths: ['.'] }); + +const statAsync = promisify(fs$1.stat); +const readFileAsync = promisify(fs$1.readFile); +async function exists(filepath) { + try { + await statAsync(filepath); + return true; + } + catch (err) { + return false; + } +} +function readFile(filepath) { + return readFileAsync(filepath, 'utf8'); +} +function existsSync(filepath) { + try { + fs$1.statSync(filepath); + return true; + } + catch (err) { + return false; + } +} +function readFileSync(filepath) { + return fs$1.readFileSync(filepath, 'utf8'); +} +function resolve(root, file, ext) { + if (!path.extname(file)) + file += ext; + return path.resolve(root, file); +} +function fallback(file) { + try { + return requireResolve(file); + } + catch (e) { } +} +function dirname(filepath) { + return path.dirname(filepath); +} +const realpathAsync = promisify(fs$1.realpath); +async function contains(root, file) { + try { + const realRoot = await realpathAsync(root); + const realFile = await realpathAsync(file); + const prefix = realRoot.endsWith(path.sep) ? realRoot : realRoot + path.sep; + return realFile.startsWith(prefix); + } + catch { + return false; + } +} +function containsSync(root, file) { + try { + const realRoot = fs$1.realpathSync(root); + const realFile = fs$1.realpathSync(file); + const prefix = realRoot.endsWith(path.sep) ? realRoot : realRoot + path.sep; + return realFile.startsWith(prefix); + } + catch { + return false; + } +} + +var fs = /*#__PURE__*/Object.freeze({ + __proto__: null, + exists: exists, + readFile: readFile, + existsSync: existsSync, + readFileSync: readFileSync, + resolve: resolve, + fallback: fallback, + dirname: dirname, + contains: contains, + containsSync: containsSync, + sep: path.sep +}); + +function chargeJsonReplacerValue(memoryLimit, val) { + if (typeof val === 'string') { + memoryLimit.use(val.length); + } + else if (val === null || typeof val === 'number' || typeof val === 'boolean') { + memoryLimit.use(JSON.stringify(val).length); + } + else if (Array.isArray(val)) { + memoryLimit.use(val.length + 1); + } + else if (typeof val === 'object') { + memoryLimit.use(2); + } +} +function defaultFilter(value, defaultValue, ...args) { + value = toValue(value); + if (isArray(value) || isString(value)) + return value.length ? value : defaultValue; + if (value === false && (new Map(args)).get('allow_false')) + return false; + return isFalsy(value, this.context) ? defaultValue : value; +} +function json(value, space = 0) { + const memoryLimit = this.context.memoryLimit; + return JSON.stringify(value, (_key, val) => { + chargeJsonReplacerValue(memoryLimit, val); + return val; + }, space); +} +function inspect(value, space = 0) { + const memoryLimit = this.context.memoryLimit; + const ancestors = []; + return JSON.stringify(value, function (_key, value) { + if (typeof value !== 'object' || value === null) { + chargeJsonReplacerValue(memoryLimit, value); + return value; + } + // `this` is the object that value is contained in, i.e., its direct parent. + while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) + ancestors.pop(); + if (ancestors.includes(value)) { + memoryLimit.use('[Circular]'.length); + return '[Circular]'; + } + ancestors.push(value); + chargeJsonReplacerValue(memoryLimit, value); + return value; + }, space); +} +function to_integer(value) { + return Number(value); +} +const raw = { + raw: true, + handler: identify +}; +var misc = { + default: defaultFilter, + raw, + jsonify: json, + to_integer, + json, + inspect +}; + +const escapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' +}; +const unescapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" +}; +function escape(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.replace(/&|<|>|"|'/g, m => escapeMap[m]); +} +function xml_escape(str) { + return escape.call(this, str); +} +function unescape(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.replace(/&(amp|lt|gt|#34|#39);/g, m => unescapeMap[m]); +} +function escape_once(str) { + return escape.call(this, unescape.call(this, str)); +} +function newline_to_br(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\r?\n/gm, '
\n'); +} +// Raw-text blocks (HTML5) plus '<...>' as the catch-all kind; a regex +// equivalent is O(n^2) in V8 on unclosed openers. +function strip_html(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + const blocks = new Map([[''], [''], [''], ['<', '>']]); + let out = ''; + let i = 0; + while (i < str.length) { + const lt = str.indexOf('<', i); + if (lt < 0) + return out + str.slice(i); + out += str.slice(i, lt); + for (const [opener, closer] of blocks) { + if (!str.startsWith(opener, lt)) + continue; + const e = str.indexOf(closer, lt + opener.length); + if (e >= 0) { + i = e + closer.length; + break; + } + blocks.delete(opener); + } + if (i <= lt) + return out + str.slice(lt); + } + return out; +} + +var htmlFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + escape: escape, + xml_escape: xml_escape, + escape_once: escape_once, + newline_to_br: newline_to_br, + strip_html: strip_html +}); + +class MapFS { + constructor(mapping) { + this.mapping = mapping; + this.sep = '/'; + } + async exists(filepath) { + return this.existsSync(filepath); + } + existsSync(filepath) { + return !isNil(this.mapping[filepath]); + } + async readFile(filepath) { + return this.readFileSync(filepath); + } + readFileSync(filepath) { + const content = this.mapping[filepath]; + if (isNil(content)) + throw new Error(`ENOENT: ${filepath}`); + return content; + } + dirname(filepath) { + const segments = filepath.split(this.sep); + segments.pop(); + return segments.join(this.sep); + } + resolve(dir, file, ext) { + file += ext; + if (dir === '.') + return file; + const segments = dir.split(/\/+/); + for (const segment of file.split(this.sep)) { + if (segment === '.' || segment === '') + continue; + else if (segment === '..') { + if (segments.length > 1 || segments[0] !== '') + segments.pop(); + } + else + segments.push(segment); + } + return segments.join(this.sep); + } +} + +const defaultOptions = { + root: ['.'], + layouts: ['.'], + partials: ['.'], + relativeReference: true, + jekyllInclude: false, + keyValueSeparator: ':', + cache: undefined, + extname: '', + fs: fs, + dynamicPartials: true, + jsTruthy: false, + dateFormat: '%A, %B %-e, %Y at %-l:%M %P %z', + locale: '', + trimTagRight: false, + trimTagLeft: false, + trimOutputRight: false, + trimOutputLeft: false, + greedy: true, + tagDelimiterLeft: '{%', + tagDelimiterRight: '%}', + outputDelimiterLeft: '{{', + outputDelimiterRight: '}}', + preserveTimezones: false, + strictFilters: false, + strictVariables: false, + ownPropertyOnly: true, + lenientIf: false, + globals: {}, + keepOutputType: false, + operators: defaultOperators, + memoryLimit: Infinity, + parseLimit: Infinity, + renderLimit: Infinity +}; +function normalize(options) { + if (options.hasOwnProperty('root')) { + if (!options.hasOwnProperty('partials')) + options.partials = options.root; + if (!options.hasOwnProperty('layouts')) + options.layouts = options.root; + } + if (options.hasOwnProperty('cache')) { + let cache; + if (typeof options.cache === 'number') + cache = options.cache > 0 ? new LRU(options.cache) : undefined; + else if (typeof options.cache === 'object') + cache = options.cache; + else + cache = options.cache ? new LRU(1024) : undefined; + options.cache = cache; + } + options = { ...defaultOptions, ...(options.jekyllInclude ? { dynamicPartials: false } : {}), ...options }; + if ((!options.fs.dirname || !options.fs.sep) && options.relativeReference) { + console.warn('[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning'); + options.relativeReference = false; + } + options.root = normalizeDirectoryList(options.root); + options.partials = normalizeDirectoryList(options.partials); + options.layouts = normalizeDirectoryList(options.layouts); + options.outputEscape = options.outputEscape && getOutputEscapeFunction(options.outputEscape); + if (!options.locale) { + options.locale = getDateTimeFormat()?.().resolvedOptions().locale ?? 'en-US'; + } + if (options.templates) { + options.fs = new MapFS(options.templates); + options.relativeReference = true; + options.root = options.partials = options.layouts = '.'; + } + return options; +} +function getOutputEscapeFunction(nameOrFunction) { + if (nameOrFunction === 'escape') + return escape; + if (nameOrFunction === 'json') + return misc.json; + assert(isFunction(nameOrFunction), '`outputEscape` need to be of type string or function'); + return nameOrFunction; +} +function normalizeDirectoryList(value) { + let list = []; + if (isArray(value)) + list = value; + if (isString(value)) + list = [value]; + return list; +} + +function whiteSpaceCtrl(tokens, options) { + let inRaw = false; + for (let i = 0; i < tokens.length; i++) { + const token = tokens[i]; + if (!isDelimitedToken(token)) + continue; + if (!inRaw && token.trimLeft) { + trimLeft(tokens[i - 1], options.greedy); + } + if (isTagToken(token)) { + if (token.name === 'raw') + inRaw = true; + else if (token.name === 'endraw') + inRaw = false; + } + if (!inRaw && token.trimRight) { + trimRight(tokens[i + 1], options.greedy); + } + } +} +function trimLeft(token, greedy) { + if (!token || !isHTMLToken(token)) + return; + const mask = greedy ? BLANK : INLINE_BLANK; + while (TYPES[token.input.charCodeAt(token.end - 1 - token.trimRight)] & mask) + token.trimRight++; +} +function trimRight(token, greedy) { + if (!token || !isHTMLToken(token)) + return; + const mask = greedy ? BLANK : INLINE_BLANK; + while (TYPES[token.input.charCodeAt(token.begin + token.trimLeft)] & mask) + token.trimLeft++; + if (token.input.charAt(token.begin + token.trimLeft) === '\n') + token.trimLeft++; +} + +class Tokenizer { + constructor(input, operators = defaultOptions.operators, file, range) { + this.input = input; + this.file = file; + this.rawBeginAt = -1; + this.p = range ? range[0] : 0; + this.N = range ? range[1] : input.length; + this.opTrie = createTrie(operators); + this.literalTrie = createTrie(literalValues); + } + readExpression() { + return new Expression(this.readExpressionTokens()); + } + *readExpressionTokens() { + while (this.p < this.N) { + const operator = this.readOperator(); + if (operator) { + yield operator; + continue; + } + const operand = this.readValue(); + if (operand) { + yield operand; + continue; + } + return; + } + } + readOperator() { + this.skipBlank(); + const end = this.matchTrie(this.opTrie); + if (end === -1) + return; + return new OperatorToken(this.input, this.p, (this.p = end), this.file); + } + matchTrie(trie) { + let node = trie; + let i = this.p; + let info; + while (node[this.input[i]] && i < this.N) { + node = node[this.input[i++]]; + if (node['end']) + info = node; + } + if (!info) + return -1; + if (info['needBoundary'] && isWord(this.peek(i - this.p))) + return -1; + return i; + } + readFilteredValue() { + const begin = this.p; + const initial = this.readExpression(); + this.assert(initial.valid(), `invalid value expression: ${this.snapshot()}`); + const filters = this.readFilters(); + return new FilteredValueToken(initial, filters, this.input, begin, this.p, this.file); + } + readFilters() { + const filters = []; + while (true) { + const filter = this.readFilter(); + if (!filter) + return filters; + filters.push(filter); + } + } + readFilter() { + this.skipBlank(); + if (this.end()) + return null; + this.assert(this.read() === '|', `expected "|" before filter`); + const name = this.readIdentifier(); + if (!name.size()) { + this.assert(this.end(), `expected filter name`); + return null; + } + const args = []; + this.skipBlank(); + if (this.peek() === ':') { + do { + ++this.p; + const arg = this.readFilterArg(); + arg && args.push(arg); + this.skipBlank(); + this.assert(this.end() || this.peek() === ',' || this.peek() === '|', () => `unexpected character ${this.snapshot()}`); + } while (this.peek() === ','); + } + else if (this.peek() === '|' || this.end()) ; + else { + throw this.error('expected ":" after filter name'); + } + return new FilterToken(name.getText(), args, this.input, name.begin, this.p, this.file); + } + readFilterArg() { + const key = this.readValue(); + if (!key) + return; + this.skipBlank(); + if (this.peek() !== ':') + return key; + ++this.p; + const value = this.readValue(); + return [key.getText(), value]; + } + readTopLevelTokens(options = defaultOptions) { + const tokens = []; + while (this.p < this.N) { + const token = this.readTopLevelToken(options); + tokens.push(token); + } + whiteSpaceCtrl(tokens, options); + return tokens; + } + readTopLevelToken(options) { + const { tagDelimiterLeft, outputDelimiterLeft } = options; + if (this.rawBeginAt > -1) + return this.readEndrawOrRawContent(options); + if (this.match(tagDelimiterLeft)) + return this.readTagToken(options); + if (this.match(outputDelimiterLeft)) + return this.readOutputToken(options); + return this.readHTMLToken([tagDelimiterLeft, outputDelimiterLeft]); + } + readHTMLToken(stopStrings) { + const begin = this.p; + while (this.p < this.N) { + if (stopStrings.some(str => this.match(str))) + break; + ++this.p; + } + return new HTMLToken(this.input, begin, this.p, this.file); + } + readTagToken(options) { + const { file, input } = this; + const begin = this.p; + if (this.readToDelimiter(options.tagDelimiterRight) === -1) { + throw this.error(`tag ${this.snapshot(begin)} not closed`, begin); + } + const token = new TagToken(input, begin, this.p, options, file); + if (token.name === 'raw') + this.rawBeginAt = begin; + return token; + } + readToDelimiter(delimiter, respectQuoted = false) { + this.skipBlank(); + while (this.p < this.N) { + if (respectQuoted && (this.peekType() & QUOTE)) { + this.readQuoted(); + continue; + } + ++this.p; + if (this.rmatch(delimiter)) + return this.p; + } + return -1; + } + readOutputToken(options = defaultOptions) { + const { file, input } = this; + const { outputDelimiterRight } = options; + const begin = this.p; + if (this.readToDelimiter(outputDelimiterRight, true) === -1) { + throw this.error(`output ${this.snapshot(begin)} not closed`, begin); + } + return new OutputToken(input, begin, this.p, options, file); + } + readEndrawOrRawContent(options) { + const { tagDelimiterLeft, tagDelimiterRight } = options; + const begin = this.p; + let leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length; + while (this.p < this.N) { + if (this.readIdentifier().getText() !== 'endraw') { + leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length; + continue; + } + while (this.p <= this.N) { + if (this.rmatch(tagDelimiterRight)) { + const end = this.p; + if (begin === leftPos) { + this.rawBeginAt = -1; + return new TagToken(this.input, begin, end, options, this.file); + } + else { + this.p = leftPos; + return new HTMLToken(this.input, begin, leftPos, this.file); + } + } + if (this.rmatch(tagDelimiterLeft)) + break; + this.p++; + } + } + throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, begin); + } + readLiquidTagTokens(options = defaultOptions) { + const tokens = []; + while (this.p < this.N) { + const token = this.readLiquidTagToken(options); + token && tokens.push(token); + } + return tokens; + } + readLiquidTagToken(options) { + this.skipBlank(); + if (this.end()) + return; + const begin = this.p; + this.readToDelimiter('\n'); + const end = this.p; + return new LiquidTagToken(this.input, begin, end, options, this.file); + } + error(msg, pos = this.p) { + return new TokenizationError(msg, new IdentifierToken(this.input, pos, this.N, this.file)); + } + assert(pred, msg, pos) { + if (!pred) + throw this.error(typeof msg === 'function' ? msg() : msg, pos); + } + snapshot(begin = this.p) { + return JSON.stringify(ellipsis(this.input.slice(begin, this.N), 32)); + } + /** + * @deprecated use #readIdentifier instead + */ + readWord() { + return this.readIdentifier(); + } + readIdentifier() { + this.skipBlank(); + const begin = this.p; + while (!this.end() && isWord(this.peek())) + ++this.p; + return new IdentifierToken(this.input, begin, this.p, this.file); + } + readNonEmptyIdentifier() { + const id = this.readIdentifier(); + return id.size() ? id : undefined; + } + readTagName() { + this.skipBlank(); + // Handle inline comment tags + if (this.input[this.p] === '#') + return this.input.slice(this.p, ++this.p); + return this.readIdentifier().getText(); + } + readHashes(jekyllStyle) { + const hashes = []; + while (true) { + const hash = this.readHash(jekyllStyle); + if (!hash) + return hashes; + hashes.push(hash); + } + } + readHash(jekyllStyle) { + this.skipBlank(); + if (this.peek() === ',') + ++this.p; + const begin = this.p; + const name = this.readNonEmptyIdentifier(); + if (!name) + return; + let value; + this.skipBlank(); + const sep = isString(jekyllStyle) ? jekyllStyle : (jekyllStyle ? '=' : ':'); + if (this.peek() === sep) { + ++this.p; + value = this.readValue(); + } + return new HashToken(this.input, begin, this.p, name, value, this.file); + } + remaining() { + return this.input.slice(this.p, this.N); + } + advance(step = 1) { + this.p += step; + } + end() { + return this.p >= this.N; + } + read() { + return this.input[this.p++]; + } + readTo(end) { + while (this.p < this.N) { + ++this.p; + if (this.rmatch(end)) + return this.p; + } + return -1; + } + readValue() { + this.skipBlank(); + const begin = this.p; + const variable = this.readLiteral() || this.readQuoted() || this.readRange() || this.readNumber(); + const props = this.readProperties(!variable); + if (!props.length) + return variable; + return new PropertyAccessToken(variable, props, this.input, begin, this.p); + } + readScopeValue() { + this.skipBlank(); + const begin = this.p; + const props = this.readProperties(); + if (!props.length) + return undefined; + return new PropertyAccessToken(undefined, props, this.input, begin, this.p); + } + readProperties(isBegin = true) { + const props = []; + while (true) { + if (this.peek() === '[') { + this.p++; + const prop = this.readValue() || new IdentifierToken(this.input, this.p, this.p, this.file); + this.assert(this.readTo(']') !== -1, '[ not closed'); + props.push(prop); + continue; + } + if (isBegin && !props.length) { + const prop = this.readNonEmptyIdentifier(); + if (prop) { + props.push(prop); + continue; + } + } + if (this.peek() === '.' && this.peek(1) !== '.') { // skip range syntax + this.p++; + const prop = this.readNonEmptyIdentifier(); + if (!prop) + break; + props.push(prop); + continue; + } + break; + } + return props; + } + readNumber() { + this.skipBlank(); + let decimalFound = false; + let digitFound = false; + let n = 0; + if (this.peekType() & SIGN) + n++; + while (this.p + n <= this.N) { + if (this.peekType(n) & NUMBER) { + digitFound = true; + n++; + } + else if (this.peek(n) === '.' && this.peek(n + 1) !== '.') { + if (decimalFound || !digitFound) + return; + decimalFound = true; + n++; + } + else + break; + } + if (digitFound && !isWord(this.peek(n))) { + const num = new NumberToken(this.input, this.p, this.p + n, this.file); + this.advance(n); + return num; + } + } + readLiteral() { + this.skipBlank(); + const end = this.matchTrie(this.literalTrie); + if (end === -1) + return; + const literal = new LiteralToken(this.input, this.p, end, this.file); + this.p = end; + return literal; + } + readRange() { + this.skipBlank(); + const begin = this.p; + if (this.peek() !== '(') + return; + ++this.p; + const lhs = this.readValueOrThrow(); + this.skipBlank(); + this.assert(this.read() === '.' && this.read() === '.', 'invalid range syntax'); + const rhs = this.readValueOrThrow(); + this.skipBlank(); + this.assert(this.read() === ')', 'invalid range syntax'); + return new RangeToken(this.input, begin, this.p, lhs, rhs, this.file); + } + readValueOrThrow() { + const value = this.readValue(); + this.assert(value, () => `unexpected token ${this.snapshot()}, value expected`); + return value; + } + readQuoted() { + this.skipBlank(); + const begin = this.p; + if (!(this.peekType() & QUOTE)) + return; + ++this.p; + let escaped = false; + while (this.p < this.N) { + ++this.p; + if (this.input[this.p - 1] === this.input[begin] && !escaped) + break; + if (escaped) + escaped = false; + else if (this.input[this.p - 1] === '\\') + escaped = true; + } + return new QuotedToken(this.input, begin, this.p, this.file); + } + *readFileNameTemplate(options) { + const { outputDelimiterLeft } = options; + const htmlStopStrings = [',', ' ', '\r', '\n', '\t', outputDelimiterLeft]; + const htmlStopStringSet = new Set(htmlStopStrings); + // break on ',' and ' ', outputDelimiterLeft only stops HTML token + while (this.p < this.N && !htmlStopStringSet.has(this.peek())) { + yield this.match(outputDelimiterLeft) + ? this.readOutputToken(options) + : this.readHTMLToken(htmlStopStrings); + } + } + match(word) { + for (let i = 0; i < word.length; i++) { + if (word[i] !== this.input[this.p + i]) + return false; + } + return true; + } + rmatch(pattern) { + for (let i = 0; i < pattern.length; i++) { + if (pattern[pattern.length - 1 - i] !== this.input[this.p - 1 - i]) + return false; + } + return true; + } + peekType(n = 0) { + return this.p + n >= this.N ? 0 : TYPES[this.input.charCodeAt(this.p + n)]; + } + peek(n = 0) { + return this.p + n >= this.N ? '' : this.input[this.p + n]; + } + skipBlank() { + while (this.peekType() & BLANK) + ++this.p; + } +} + +class ParseStream { + constructor(tokens, parseToken) { + this.handlers = {}; + this.stopRequested = false; + this.tokens = tokens; + this.parseToken = parseToken; + } + on(name, cb) { + this.handlers[name] = cb; + return this; + } + trigger(event, arg) { + const h = this.handlers[event]; + return h ? (h.call(this, arg), true) : false; + } + start() { + this.trigger('start'); + let token; + while (!this.stopRequested && (token = this.tokens.shift())) { + if (this.trigger('token', token)) + continue; + if (isTagToken(token) && this.trigger(`tag:${token.name}`, token)) { + continue; + } + const template = this.parseToken(token, this.tokens); + this.trigger('template', template); + } + if (!this.stopRequested) + this.trigger('end'); + return this; + } + stop() { + this.stopRequested = true; + return this; + } +} + +class TemplateImpl { + constructor(token) { + this.token = token; + } +} + +class Tag extends TemplateImpl { + constructor(token, remainTokens, liquid) { + super(token); + this.name = token.name; + this.liquid = liquid; + this.tokenizer = token.tokenizer; + } +} + +/** + * Key-Value Pairs Representing Tag Arguments + * Example: + * For the markup `, foo:'bar', coo:2 reversed %}`, + * hash['foo'] === 'bar' + * hash['coo'] === 2 + * hash['reversed'] === undefined + */ +class Hash { + constructor(input, jekyllStyle) { + this.hash = {}; + const tokenizer = input instanceof Tokenizer ? input : new Tokenizer(input, {}); + for (const hash of tokenizer.readHashes(jekyllStyle)) { + this.hash[hash.name.content] = hash.value; + } + } + *render(ctx) { + const hash = {}; + for (const key of Object.keys(this.hash)) { + hash[key] = this.hash[key] === undefined ? true : yield evalToken(this.hash[key], ctx); + } + return hash; + } +} + +function createTagClass(options) { + return class extends Tag { + constructor(token, tokens, liquid) { + super(token, tokens, liquid); + if (isFunction(options.parse)) { + options.parse.call(this, token, tokens); + } + } + *render(ctx, emitter) { + const hash = (yield new Hash(this.token.args, ctx.opts.keyValueSeparator).render(ctx)); + return yield options.render.call(this, ctx, emitter, hash); + } + }; +} + +function isKeyValuePair(arr) { + return isArray(arr); +} + +class Filter { + constructor(token, options, liquid) { + this.token = token; + this.name = token.name; + this.handler = isFunction(options) + ? options + : (isFunction(options?.handler) ? options.handler : identify); + this.raw = !isFunction(options) && !!options?.raw; + this.args = token.args; + this.liquid = liquid; + } + *render(value, context) { + const argv = []; + for (const arg of this.args) { + if (isKeyValuePair(arg)) + argv.push([arg[0], yield evalToken(arg[1], context)]); + else + argv.push(yield evalToken(arg, context)); + } + return yield this.handler.apply({ context, token: this.token, liquid: this.liquid }, [value, ...argv]); + } +} + +class Value { + /** + * @param str the value to be valuated, eg.: "foobar" | truncate: 3 + */ + constructor(input, liquid) { + this.filters = []; + const token = typeof input === 'string' + ? new Tokenizer(input, liquid.options.operators).readFilteredValue() + : input; + this.initial = token.initial; + this.filters = token.filters.map(token => new Filter(token, this.getFilter(liquid, token.name), liquid)); + } + *value(ctx, lenient) { + lenient = lenient || (ctx.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === 'default'); + let val = yield this.initial.evaluate(ctx, lenient); + for (const filter of this.filters) { + val = yield filter.render(val, ctx); + } + return val; + } + getFilter(liquid, name) { + const impl = liquid.filters[name]; + assert(impl || !liquid.options.strictFilters, () => `undefined filter: ${name}`); + return impl; + } +} + +class Output extends TemplateImpl { + constructor(token, liquid) { + super(token); + const tokenizer = new Tokenizer(token.input, liquid.options.operators, token.file, token.contentRange); + this.value = new Value(tokenizer.readFilteredValue(), liquid); + const filters = this.value.filters; + const outputEscape = liquid.options.outputEscape; + if (!filters[filters.length - 1]?.raw && outputEscape) { + const token = new FilterToken(toString.call(outputEscape), [], '', 0, 0); + filters.push(new Filter(token, outputEscape, liquid)); + } + } + *render(ctx, emitter) { + const val = yield this.value.value(ctx, false); + emitter.write(val); + } + *arguments() { + yield this.value; + } +} + +class HTML extends TemplateImpl { + constructor(token) { + super(token); + this.str = token.getContent(); + } + *render(ctx, emitter) { + emitter.write(this.str); + } +} + +/** + * A variable's segments and location, which can be coerced to a string. + */ +class Variable { + constructor(segments, location) { + this.segments = segments; + this.location = location; + } + toString() { + return segmentsString(this.segments, true); + } + /** Return this variable's segments as an array, possibly with nested arrays for nested paths. */ + toArray() { + function* _visit(...segments) { + for (const segment of segments) { + if (segment instanceof Variable) { + yield Array.from(_visit(...segment.segments)); + } + else { + yield segment; + } + } + } + return Array.from(_visit(...this.segments)); + } +} +/** + * Group variables by the string representation of their root segment. + */ +class VariableMap { + constructor() { + this.map = new Map(); + } + get(key) { + const k = segmentsString([key.segments[0]]); + if (!this.map.has(k)) { + this.map.set(k, []); + } + return this.map.get(k); + } + has(key) { + return this.map.has(segmentsString([key.segments[0]])); + } + push(variable) { + this.get(variable).push(variable); + } + asObject() { + return Object.fromEntries(this.map); + } +} +const defaultStaticAnalysisOptions = { + partials: true +}; +function* _analyze(templates, partials, sync) { + const variables = new VariableMap(); + const globals = new VariableMap(); + const locals = new VariableMap(); + const rootScope = new DummyScope(new Set()); + // Names of partial templates that we've already analyzed. + const seen = new Set(); + function updateVariables(variable, scope) { + variables.push(variable); + const aliased = scope.alias(variable); + if (aliased !== undefined) { + const root = aliased.segments[0]; + // TODO: What if a a template renders a rendered template? Do we need scope.parent? + if (isString(root) && !rootScope.has(root)) { + globals.push(aliased); + } + } + else { + const root = variable.segments[0]; + if (isString(root) && !scope.has(root)) { + globals.push(variable); + } + } + // Recurse for nested Variables + for (const segment of variable.segments) { + if (segment instanceof Variable) { + updateVariables(segment, scope); + } + } + } + function* visit(template, scope) { + if (template.arguments) { + for (const arg of template.arguments()) { + for (const variable of extractVariables(arg)) { + updateVariables(variable, scope); + } + } + } + if (template.localScope) { + for (const ident of template.localScope()) { + scope.add(ident.content); + scope.deleteAlias(ident.content); + const [row, col] = ident.getPosition(); + locals.push(new Variable([ident.content], { row, col, file: ident.file })); + } + } + if (template.children) { + if (template.partialScope) { + const partial = template.partialScope(); + if (partial === undefined) { + // Layouts, for example, can have children that are not partials. + for (const child of (yield template.children(partials, sync))) { + yield visit(child, scope); + } + return; + } + if (seen.has(partial.name)) + return; + const partialScopeNames = new Set(); + const partialScope = partial.isolated + ? new DummyScope(partialScopeNames) + : scope.push(partialScopeNames); + for (const name of partial.scope) { + if (isString(name)) { + partialScopeNames.add(name); + } + else { + const [alias, argument] = name; + partialScopeNames.add(alias); + const variables = Array.from(extractVariables(argument)); + if (variables.length) { + partialScope.setAlias(alias, variables[0].segments); + } + } + } + for (const child of (yield template.children(partials, sync))) { + yield visit(child, partialScope); + seen.add(partial.name); + } + partialScope.pop(); + } + else { + if (template.blockScope) { + scope.push(new Set(template.blockScope())); + } + for (const child of (yield template.children(partials, sync))) { + yield visit(child, scope); + } + if (template.blockScope) { + scope.pop(); + } + } + } + } + for (const template of templates) { + yield visit(template, rootScope); + } + return { + variables: variables.asObject(), + globals: globals.asObject(), + locals: locals.asObject() + }; +} +/** + * Statically analyze a template and report variable usage. + */ +function analyze(template, options = {}) { + const opts = { ...defaultStaticAnalysisOptions, ...options }; + return toPromise(_analyze(template, opts.partials, false)); +} +/** + * Statically analyze a template and report variable usage. + */ +function analyzeSync(template, options = {}) { + const opts = { ...defaultStaticAnalysisOptions, ...options }; + return toValueSync(_analyze(template, opts.partials, true)); +} +/** + * A stack to manage scopes while traversing templates during static analysis. + */ +class DummyScope { + constructor(globals) { + this.stack = [{ names: globals, aliases: new Map() }]; + } + /** Return true if `name` is in scope. */ + has(name) { + for (const scope of this.stack) { + if (scope.names.has(name)) { + return true; + } + } + return false; + } + push(scope) { + this.stack.push({ names: scope, aliases: new Map() }); + return this; + } + pop() { + return this.stack.pop()?.names; + } + // Add a name to the template scope. + add(name) { + this.stack[0].names.add(name); + } + /** Return the variable that `variable` aliases, or `variable` if it doesn't alias anything. */ + alias(variable) { + const root = variable.segments[0]; + if (!isString(root)) + return undefined; + const alias = this.getAlias(root); + if (alias === undefined) + return undefined; + return new Variable([...alias, ...variable.segments.slice(1)], variable.location); + } + // TODO: `from` could be a path with multiple segments, like `include.x`. + setAlias(from, to) { + this.stack[this.stack.length - 1].aliases.set(from, to); + } + deleteAlias(name) { + this.stack[this.stack.length - 1].aliases.delete(name); + } + getAlias(name) { + for (const scope of this.stack) { + if (scope.aliases.has(name)) { + return scope.aliases.get(name); + } + // If a scope has defined `name`, then it masks aliases in parent scopes. + if (scope.names.has(name)) { + return undefined; + } + } + return undefined; + } +} +function* extractVariables(value) { + if (isValueToken(value)) { + yield* extractValueTokenVariables(value); + } + else if (value instanceof Value) { + yield* extractFilteredValueVariables(value); + } +} +function* extractFilteredValueVariables(value) { + for (const token of value.initial.postfix) { + if (isValueToken(token)) { + yield* extractValueTokenVariables(token); + } + } + for (const filter of value.filters) { + for (const arg of filter.args) { + if (isKeyValuePair(arg) && arg[1]) { + yield* extractValueTokenVariables(arg[1]); + } + else if (isValueToken(arg)) { + yield* extractValueTokenVariables(arg); + } + } + } +} +function* extractValueTokenVariables(token) { + if (isRangeToken(token)) { + yield* extractValueTokenVariables(token.lhs); + yield* extractValueTokenVariables(token.rhs); + } + else if (isPropertyAccessToken(token)) { + yield extractPropertyAccessVariable(token); + } +} +function extractPropertyAccessVariable(token) { + const segments = []; + // token is not guaranteed to have `file` set. We'll try to get it from a prop if not. + let file = token.file; + // Here we're flattening the first segment of a path if it is a nested path. + const root = token.props[0]; + file = file || root.file; + if (isQuotedToken(root) || isNumberToken(root) || isWordToken(root)) { + segments.push(root.content); + } + else if (isPropertyAccessToken(root)) { + // Flatten paths that start with a nested path. + segments.push(...extractPropertyAccessVariable(root).segments); + } + for (const prop of token.props.slice(1)) { + file = file || prop.file; + if (isQuotedToken(prop) || isNumberToken(prop) || isWordToken(prop)) { + segments.push(prop.content); + } + else if (isPropertyAccessToken(prop)) { + segments.push(extractPropertyAccessVariable(prop)); + } + } + const [row, col] = token.getPosition(); + return new Variable(segments, { + row, + col, + file + }); +} +// This is used to detect segments that can be represented with dot notation +// when creating a string representation of VariableSegments. +const RE_PROPERTY = /^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/; +/** + * Return a string representation of segments using dot notation where possible. + * @param segments - The property names and array indices that make up a path to a variable. + * @param bracketedRoot - If false (the default), don't surround the root segment with square brackets. + */ +function segmentsString(segments, bracketedRoot = false) { + const buf = []; + const root = segments[0]; + if (isString(root)) { + if (!bracketedRoot || root.match(RE_PROPERTY)) { + buf.push(`${root}`); + } + else { + buf.push(`['${root}']`); + } + } + for (const segment of segments.slice(1)) { + if (segment instanceof Variable) { + buf.push(`[${segmentsString(segment.segments)}]`); + } + else if (isString(segment)) { + if (segment.match(RE_PROPERTY)) { + buf.push(`.${segment}`); + } + else { + buf.push(`['${segment}']`); + } + } + else { + buf.push(`[${segment}]`); + } + } + return buf.join(''); +} + +(function (LookupType) { + LookupType["Partials"] = "partials"; + LookupType["Layouts"] = "layouts"; + LookupType["Root"] = "root"; +})(exports.LookupType || (exports.LookupType = {})); +class Loader { + constructor(options) { + this.options = options; + if (options.relativeReference) { + const sep = options.fs.sep; + assert(sep, '`fs.sep` is required for relative reference'); + const prefixes = ['.' + sep, '..' + sep, './', '../']; + this.shouldLoadRelative = (referencedFile) => prefixes.some(prefix => referencedFile.startsWith(prefix)); + } + else { + this.shouldLoadRelative = (_referencedFile) => false; + } + const fs = options.fs; + this.contains = toLiquidAsync(fs.contains?.bind(fs) || (async () => true), fs.containsSync?.bind(fs) || (() => true)); + this.exists = toLiquidAsync(fs.exists?.bind(fs) || (async () => false), fs.existsSync?.bind(fs)); + } + *lookup(file, type, sync, currentFile) { + const dirs = this.options[type]; + for (const filepath of this.candidates(file, dirs, currentFile)) { + let allowed = false; + for (const dir of dirs) { + if (yield this.contains(!!sync, dir, filepath)) { + allowed = true; + break; + } + } + if (!allowed) + continue; + if (yield this.exists(!!sync, filepath)) + return filepath; + } + throw this.lookupError(file, dirs); + } + *candidates(file, dirs, currentFile) { + const { fs, extname } = this.options; + if (this.shouldLoadRelative(file) && currentFile) { + const referenced = fs.resolve(this.dirname(currentFile), file, extname); + yield referenced; + } + for (const dir of dirs) { + const referenced = fs.resolve(dir, file, extname); + yield referenced; + } + if (fs.fallback !== undefined) { + const filepath = fs.fallback(file); + if (filepath !== undefined) + yield filepath; + } + } + dirname(path) { + const fs = this.options.fs; + assert(fs.dirname, '`fs.dirname` is required for relative reference'); + return fs.dirname(path); + } + lookupError(file, roots) { + const err = new Error('ENOENT'); + err.message = `ENOENT: Failed to lookup "${file}" in "${roots}"`; + err.code = 'ENOENT'; + return err; + } +} + +class Parser { + constructor(liquid) { + this.liquid = liquid; + this.cache = this.liquid.options.cache; + this.fs = this.liquid.options.fs; + this.parseFile = this.cache ? this._parseFileCached : this._parseFile; + this.loader = new Loader(this.liquid.options); + this.parseLimit = new Limiter('parse length', liquid.options.parseLimit); + this.readFile = toLiquidAsync(this.fs.readFile?.bind(this.fs) || (async () => { throw new Error('readFile not implemented'); }), this.fs.readFileSync?.bind(this.fs)); + } + parse(html, filepath) { + html = String(html); + this.parseLimit.use(html.length); + const tokenizer = new Tokenizer(html, this.liquid.options.operators, filepath); + const tokens = tokenizer.readTopLevelTokens(this.liquid.options); + return this.parseTokens(tokens); + } + parseTokens(tokens) { + let token; + const templates = []; + const errors = []; + while ((token = tokens.shift())) { + try { + templates.push(this.parseToken(token, tokens)); + } + catch (err) { + if (this.liquid.options.catchAllErrors) + errors.push(err); + else + throw err; + } + } + if (errors.length) + throw new LiquidErrors(errors); + return templates; + } + parseToken(token, remainTokens) { + try { + if (isTagToken(token)) { + const TagClass = this.liquid.tags[token.name]; + assert(TagClass, `tag "${token.name}" not found`); + return new TagClass(token, remainTokens, this.liquid, this); + } + if (isOutputToken(token)) { + return new Output(token, this.liquid); + } + return new HTML(token); + } + catch (e) { + if (LiquidError.is(e)) + throw e; + throw new ParseError(e, token); + } + } + parseStream(tokens) { + return new ParseStream(tokens, (token, tokens) => this.parseToken(token, tokens)); + } + *_parseFileCached(file, sync, type = exports.LookupType.Root, currentFile) { + const cache = this.cache; + const key = this.loader.shouldLoadRelative(file) ? currentFile + ',' + file : type + ':' + file; + const tpls = yield cache.read(key); + if (tpls) + return tpls; + const task = this._parseFile(file, sync, type, currentFile); + // sync mode: exec the task and cache the result + // async mode: cache the task before exec + const taskOrTpl = sync ? yield task : toPromise(task); + cache.write(key, taskOrTpl); + // note: concurrent tasks will be reused, cache for failed task is removed until its end + try { + return yield taskOrTpl; + } + catch (err) { + cache.remove(key); + throw err; + } + } + *_parseFile(file, sync, type = exports.LookupType.Root, currentFile) { + const filepath = yield this.loader.lookup(file, type, sync, currentFile); + return this.parse(yield this.readFile(!!sync, filepath), filepath); + } +} + +(function (TokenKind) { + TokenKind[TokenKind["Number"] = 1] = "Number"; + TokenKind[TokenKind["Literal"] = 2] = "Literal"; + TokenKind[TokenKind["Tag"] = 4] = "Tag"; + TokenKind[TokenKind["Output"] = 8] = "Output"; + TokenKind[TokenKind["HTML"] = 16] = "HTML"; + TokenKind[TokenKind["Filter"] = 32] = "Filter"; + TokenKind[TokenKind["Hash"] = 64] = "Hash"; + TokenKind[TokenKind["PropertyAccess"] = 128] = "PropertyAccess"; + TokenKind[TokenKind["Word"] = 256] = "Word"; + TokenKind[TokenKind["Range"] = 512] = "Range"; + TokenKind[TokenKind["Quoted"] = 1024] = "Quoted"; + TokenKind[TokenKind["Operator"] = 2048] = "Operator"; + TokenKind[TokenKind["FilteredValue"] = 4096] = "FilteredValue"; + TokenKind[TokenKind["Delimited"] = 12] = "Delimited"; +})(exports.TokenKind || (exports.TokenKind = {})); + +function isDelimitedToken(val) { + return !!(getKind(val) & exports.TokenKind.Delimited); +} +function isOperatorToken(val) { + return getKind(val) === exports.TokenKind.Operator; +} +function isHTMLToken(val) { + return getKind(val) === exports.TokenKind.HTML; +} +function isOutputToken(val) { + return getKind(val) === exports.TokenKind.Output; +} +function isTagToken(val) { + return getKind(val) === exports.TokenKind.Tag; +} +function isQuotedToken(val) { + return getKind(val) === exports.TokenKind.Quoted; +} +function isLiteralToken(val) { + return getKind(val) === exports.TokenKind.Literal; +} +function isNumberToken(val) { + return getKind(val) === exports.TokenKind.Number; +} +function isPropertyAccessToken(val) { + return getKind(val) === exports.TokenKind.PropertyAccess; +} +function isWordToken(val) { + return getKind(val) === exports.TokenKind.Word; +} +function isRangeToken(val) { + return getKind(val) === exports.TokenKind.Range; +} +function isValueToken(val) { + // valueTokenBitMask = TokenKind.Number | TokenKind.Literal | TokenKind.Quoted | TokenKind.PropertyAccess | TokenKind.Range + return (getKind(val) & 1667) > 0; +} +function getKind(val) { + return val ? val.kind : -1; +} + +var typeGuards = /*#__PURE__*/Object.freeze({ + __proto__: null, + isDelimitedToken: isDelimitedToken, + isOperatorToken: isOperatorToken, + isHTMLToken: isHTMLToken, + isOutputToken: isOutputToken, + isTagToken: isTagToken, + isQuotedToken: isQuotedToken, + isLiteralToken: isLiteralToken, + isNumberToken: isNumberToken, + isPropertyAccessToken: isPropertyAccessToken, + isWordToken: isWordToken, + isRangeToken: isRangeToken, + isValueToken: isValueToken +}); + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; + +function createScope(from) { + const scope = Object.create(null); + if (from) + Object.assign(scope, from); + return scope; +} + +class Context { + constructor(env = {}, opts = defaultOptions, renderOptions = {}, { memoryLimit, renderLimit } = {}) { + /** + * insert a Context-level empty scope, + * for tags like `{% capture %}` `{% assign %}` to operate + */ + this.scopes = [createScope()]; + this.registers = {}; + this.breakCalled = false; + this.continueCalled = false; + this.sync = !!renderOptions.sync; + this.opts = opts; + this.globals = renderOptions.globals ?? opts.globals; + this.environments = isObject(env) ? env : Object(env); + this.strictVariables = renderOptions.strictVariables ?? this.opts.strictVariables; + this.ownPropertyOnly = renderOptions.ownPropertyOnly ?? opts.ownPropertyOnly; + this.memoryLimit = memoryLimit ?? new Limiter('memory alloc', renderOptions.memoryLimit ?? opts.memoryLimit); + this.renderLimit = renderLimit ?? new Limiter('template render', getPerformance().now() + (renderOptions.renderLimit ?? opts.renderLimit)); + } + getRegister(key, defaultValue = undefined) { + return (this.registers[key] = this.registers[key] || defaultValue); + } + setRegister(key, value) { + return (this.registers[key] = value); + } + saveRegister(...keys) { + return keys.map(key => [key, this.getRegister(key)]); + } + restoreRegister(keyValues) { + return keyValues.forEach(([key, value]) => this.setRegister(key, value)); + } + getAll() { + return [this.globals, this.environments, ...this.scopes] + .reduce((ctx, val) => __assign(ctx, val), {}); + } + /** + * @deprecated use `_get()` or `getSync()` instead + */ + get(paths) { + return this.getSync(paths); + } + getSync(paths) { + return toValueSync(this._get(paths)); + } + *_get(paths) { + const scope = this.findScope(paths[0]); // first prop should always be a string + return yield this._getFromScope(scope, paths); + } + /** + * @deprecated use `_get()` instead + */ + getFromScope(scope, paths) { + return toValueSync(this._getFromScope(scope, paths)); + } + *_getFromScope(scope, paths, strictVariables = this.strictVariables) { + if (isString(paths)) + paths = paths.split('.'); + for (let i = 0; i < paths.length; i++) { + scope = yield this.readProperty(scope, paths[i]); + if (strictVariables && isUndefined(scope)) { + throw new InternalUndefinedVariableError(paths.slice(0, i + 1).join('.')); + } + } + return scope; + } + push(ctx) { + return this.scopes.push(ctx); + } + pop() { + return this.scopes.pop(); + } + bottom() { + return this.scopes[0]; + } + spawn(scope = {}) { + return new Context(scope, this.opts, { + sync: this.sync, + globals: this.globals, + strictVariables: this.strictVariables, + ownPropertyOnly: this.ownPropertyOnly + }, { + renderLimit: this.renderLimit, + memoryLimit: this.memoryLimit + }); + } + findScope(key) { + for (let i = this.scopes.length - 1; i >= 0; i--) { + const candidate = this.scopes[i]; + if (key in candidate) + return candidate; + } + if (key in this.environments) + return this.environments; + return this.globals; + } + readProperty(obj, key) { + obj = toLiquid(obj); + key = toValue(key); + if (isNil(obj)) + return obj; + if (isArray(obj) && isNumber(key)) + return readArrayElement(obj, key, this.ownPropertyOnly); + const value = readJSProperty(obj, key, this.ownPropertyOnly); + if (value === undefined && obj instanceof Drop) + return obj.liquidMethodMissing(key, this); + if (isFunction(value)) + return value.call(obj); + if (key === 'size') + return readSize(obj); + else if (key === 'first') + return readFirst(obj, this.ownPropertyOnly); + else if (key === 'last') + return readLast(obj, this.ownPropertyOnly); + return value; + } +} +function readJSProperty(obj, key, ownPropertyOnly) { + if (ownPropertyOnly && !hasOwnProperty.call(obj, key) && !(obj instanceof Drop)) + return undefined; + return obj[key]; +} +function readFirst(obj, ownPropertyOnly) { + if (isArray(obj)) + return readArrayElement(obj, 0, ownPropertyOnly); + return readJSProperty(obj, 'first', ownPropertyOnly); +} +function readLast(obj, ownPropertyOnly) { + if (isArray(obj)) + return readArrayElement(obj, -1, ownPropertyOnly); + return readJSProperty(obj, 'last', ownPropertyOnly); +} +function readSize(obj) { + if (hasOwnProperty.call(obj, 'size') || obj['size'] !== undefined) + return obj['size']; + if (isArray(obj) || isString(obj)) + return obj.length; + if (typeof obj === 'object') + return Object.keys(obj).length; +} + +var BlockMode; +(function (BlockMode) { + /* store rendered html into blocks */ + BlockMode[BlockMode["OUTPUT"] = 0] = "OUTPUT"; + /* output rendered html directly */ + BlockMode[BlockMode["STORE"] = 1] = "STORE"; +})(BlockMode || (BlockMode = {})); + +const abs = argumentsToNumber(Math.abs); +const at_least = argumentsToNumber(Math.max); +const at_most = argumentsToNumber(Math.min); +const ceil = argumentsToNumber(Math.ceil); +const divided_by = argumentsToNumber((dividend, divisor, integerArithmetic = false) => integerArithmetic ? Math.floor(dividend / divisor) : dividend / divisor); +const floor = argumentsToNumber(Math.floor); +const minus = argumentsToNumber((v, arg) => v - arg); +const plus = argumentsToNumber((lhs, rhs) => lhs + rhs); +const modulo = argumentsToNumber((v, arg) => ((v % arg) + arg) % arg); +const times = argumentsToNumber((v, arg) => v * arg); +function round(v, arg = 0) { + v = toNumber(v); + arg = toNumber(arg); + const amp = Math.pow(10, arg); + const scaled = (v * amp) * (1 + Number.EPSILON); + return Math.round(scaled) / amp; +} + +var mathFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + abs: abs, + at_least: at_least, + at_most: at_most, + ceil: ceil, + divided_by: divided_by, + floor: floor, + minus: minus, + plus: plus, + modulo: modulo, + times: times, + round: round +}); + +const url_decode = (x) => decodeURIComponent(stringify(x)).replace(/\+/g, ' '); +const url_encode = (x) => encodeURIComponent(stringify(x)).replace(/%20/g, '+'); +const cgi_escape = (x) => encodeURIComponent(stringify(x)) + .replace(/%20/g, '+') + .replace(/[!'()*]/g, c => '%' + c.charCodeAt(0).toString(16).toUpperCase()); +const uri_escape = (x) => encodeURI(stringify(x)) + .replace(/%5B/g, '[') + .replace(/%5D/g, ']'); +const rSlugifyDefault = /[^\p{M}\p{L}\p{Nd}]+/ug; +const rSlugifyReplacers = { + 'raw': /\s+/g, + 'default': rSlugifyDefault, + 'pretty': /[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/ug, + 'ascii': /[^A-Za-z0-9]+/g, + 'latin': rSlugifyDefault, + 'none': null +}; +function slugify(str, mode = 'default', cased = false) { + str = stringify(str); + const replacer = rSlugifyReplacers[mode]; + if (replacer) { + if (mode === 'latin') + str = removeAccents(str); + str = str.replace(replacer, '-').replace(/^-|-$/g, ''); + } + return cased ? str : str.toLowerCase(); +} +function removeAccents(str) { + return str.replace(/[àáâãäå]/g, 'a') + .replace(/[æ]/g, 'ae') + .replace(/[ç]/g, 'c') + .replace(/[èéêë]/g, 'e') + .replace(/[ìíîï]/g, 'i') + .replace(/[ð]/g, 'd') + .replace(/[ñ]/g, 'n') + .replace(/[òóôõöø]/g, 'o') + .replace(/[ùúûü]/g, 'u') + .replace(/[ýÿ]/g, 'y') + .replace(/[ß]/g, 'ss') + .replace(/[œ]/g, 'oe') + .replace(/[þ]/g, 'th') + .replace(/[ẞ]/g, 'SS') + .replace(/[Œ]/g, 'OE') + .replace(/[Þ]/g, 'TH'); +} + +var urlFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + url_decode: url_decode, + url_encode: url_encode, + cgi_escape: cgi_escape, + uri_escape: uri_escape, + slugify: slugify +}); + +const join = argumentsToValue(function (v, arg) { + const array = toArray(v); + const sep = isNil(arg) ? ' ' : stringify(arg); + let outputSize = sep.length * Math.max(array.length - 1, 0); + for (let i = 0; i < array.length; i++) + outputSize += String(array[i]).length; + this.context.memoryLimit.use(outputSize); + return Array.prototype.join.call(array, sep); +}); +const last = argumentsToValue(function (v) { + return isArrayLike(v) ? readArrayElement(v, -1, this.context.ownPropertyOnly) : ''; +}); +const first = argumentsToValue(function (v) { + return isArrayLike(v) ? readArrayElement(v, 0, this.context.ownPropertyOnly) : ''; +}); +const reverse = argumentsToValue(function (v) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + return [...array].reverse(); +}); +function* sortBy(arr, property, comparator) { + const values = []; + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + for (const item of array) { + values.push([ + item, + property ? yield this.context._getFromScope(item, stringify(property).split('.'), false) : item + ]); + } + return values.sort((lhs, rhs) => comparator(lhs[1], rhs[1])).map(tuple => tuple[0]); +} +function* sort(arr, property) { + return yield* sortBy.call(this, arr, property, orderedCompare); +} +function* sort_natural(arr, property) { + return yield* sortBy.call(this, arr, property, caseInsensitiveCompare); +} +const size = (v) => (v && v.length) || 0; +function* map(arr, property) { + const results = []; + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + for (const item of array) { + results.push(yield this.context._getFromScope(item, stringify(property), false)); + } + return results; +} +function* sum(arr, property) { + let sum = 0; + const array = toArray(arr); + for (const item of array) { + const data = Number(property ? yield this.context._getFromScope(item, stringify(property), false) : item); + sum += Number.isNaN(data) ? 0 : data; + } + return sum; +} +function compact(arr) { + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + return Array.prototype.filter.call(array, x => !isNil(toValue(x))); +} +function concat(v, arg = []) { + const lhs = toArray(v); + const rhs = toArray(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return Array.prototype.concat.call(lhs, rhs); +} +function push(v, arg) { + return concat.call(this, v, [arg]); +} +function unshift(v, arg) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + const clone = [...array]; + clone.unshift(arg); + return clone; +} +function pop(v) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + const clone = [...array]; + clone.pop(); + return clone; +} +function shift(v) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + const clone = [...array]; + clone.shift(); + return clone; +} +function slice(v, begin, length = 1) { + v = toValue(v); + if (isNil(v)) + return []; + if (!isArray(v)) + v = stringify(v); + begin = begin < 0 ? v.length + begin : begin; + if (begin < 0 || length < 0) + return isArray(v) ? [] : ''; + this.context.memoryLimit.use(length); + return isArray(v) + ? Array.prototype.slice.call(v, begin, begin + length) + : String.prototype.slice.call(v, begin, begin + length); +} +function expectedMatcher(expected) { + if (this.context.opts.jekyllWhere) { + return (v) => EmptyDrop.is(expected) ? equals(v, expected) : (isArray(v) ? arrayIncludes(v, expected) : equals(v, expected)); + } + else if (expected === undefined) { + return (v) => isTruthy(v, this.context); + } + else { + return (v) => equals(v, expected); + } +} +function* filter(include, arr, property, expected) { + const values = []; + arr = toArray(arr); + this.context.memoryLimit.use(arr.length); + const token = new Tokenizer(stringify(property)).readScopeValue(); + for (const item of arr) { + values.push(yield evalToken(token, this.context.spawn(item))); + } + const matcher = expectedMatcher.call(this, expected); + return Array.prototype.filter.call(arr, (_, i) => matcher(values[i]) === include); +} +function* filter_exp(include, arr, itemName, exp) { + const filtered = []; + const keyTemplate = new Value(stringify(exp), this.liquid); + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + for (const item of array) { + this.context.push({ [itemName]: item }); + const value = yield keyTemplate.value(this.context); + this.context.pop(); + if (value === include) + filtered.push(item); + } + return filtered; +} +function* where(arr, property, expected) { + return yield* filter.call(this, true, arr, property, expected); +} +function* reject(arr, property, expected) { + return yield* filter.call(this, false, arr, property, expected); +} +function* where_exp(arr, itemName, exp) { + return yield* filter_exp.call(this, true, arr, itemName, exp); +} +function* reject_exp(arr, itemName, exp) { + return yield* filter_exp.call(this, false, arr, itemName, exp); +} +function* group_by(arr, property) { + const map = new Map(); + arr = toEnumerable(arr); + const token = new Tokenizer(stringify(property)).readScopeValue(); + this.context.memoryLimit.use(arr.length); + for (const item of arr) { + const key = yield evalToken(token, this.context.spawn(item)); + if (!map.has(key)) + map.set(key, []); + map.get(key).push(item); + } + return [...map.entries()].map(([name, items]) => ({ name, items })); +} +function* group_by_exp(arr, itemName, exp) { + const map = new Map(); + const keyTemplate = new Value(stringify(exp), this.liquid); + arr = toEnumerable(arr); + this.context.memoryLimit.use(arr.length); + for (const item of arr) { + this.context.push({ [itemName]: item }); + const key = yield keyTemplate.value(this.context); + this.context.pop(); + if (!map.has(key)) + map.set(key, []); + map.get(key).push(item); + } + return [...map.entries()].map(([name, items]) => ({ name, items })); +} +function* search(arr, property, expected) { + const token = new Tokenizer(stringify(property)).readScopeValue(); + const array = toArray(arr); + const matcher = expectedMatcher.call(this, expected); + for (let index = 0; index < array.length; index++) { + const value = yield evalToken(token, this.context.spawn(array[index])); + if (matcher(value)) + return [index, array[index]]; + } +} +function* search_exp(arr, itemName, exp) { + const predicate = new Value(stringify(exp), this.liquid); + const array = toArray(arr); + for (let index = 0; index < array.length; index++) { + this.context.push({ [itemName]: array[index] }); + const value = yield predicate.value(this.context); + this.context.pop(); + if (value) + return [index, array[index]]; + } +} +function* has(arr, property, expected) { + const result = yield* search.call(this, arr, property, expected); + return !!result; +} +function* has_exp(arr, itemName, exp) { + const result = yield* search_exp.call(this, arr, itemName, exp); + return !!result; +} +function* find_index(arr, property, expected) { + const result = yield* search.call(this, arr, property, expected); + return result ? result[0] : undefined; +} +function* find_index_exp(arr, itemName, exp) { + const result = yield* search_exp.call(this, arr, itemName, exp); + return result ? result[0] : undefined; +} +function* find(arr, property, expected) { + const result = yield* search.call(this, arr, property, expected); + return result ? result[1] : undefined; +} +function* find_exp(arr, itemName, exp) { + const result = yield* search_exp.call(this, arr, itemName, exp); + return result ? result[1] : undefined; +} +function uniq(arr) { + arr = toArray(arr); + this.context.memoryLimit.use(arr.length); + return [...new Set(arr)]; +} +function sample(v, count = 1) { + v = toValue(v); + if (isNil(v)) + return []; + if (!isArray(v)) + v = stringify(v); + this.context.memoryLimit.use(v.length); + const shuffled = [...v].sort(() => Math.random() - 0.5); + if (count === 1) + return shuffled[0]; + return shuffled.slice(0, count); +} + +var arrayFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + join: join, + last: last, + first: first, + reverse: reverse, + sort: sort, + sort_natural: sort_natural, + size: size, + map: map, + sum: sum, + compact: compact, + concat: concat, + push: push, + unshift: unshift, + pop: pop, + shift: shift, + slice: slice, + where: where, + reject: reject, + where_exp: where_exp, + reject_exp: reject_exp, + group_by: group_by, + group_by_exp: group_by_exp, + has: has, + has_exp: has_exp, + find_index: find_index, + find_index_exp: find_index_exp, + find: find, + find_exp: find_exp, + uniq: uniq, + sample: sample +}); + +function date(v, format, timezoneOffset) { + const size = (v?.length ?? 0) + (timezoneOffset?.length ?? 0); + this.context.memoryLimit.use(size); + const date = parseDate(v, this.context.opts, timezoneOffset); + if (!date) + return v; + format = toValue(format); + format = isNil(format) ? this.context.opts.dateFormat : stringify(format); + this.context.memoryLimit.use(format.length); + return strftime(date, format, this.context.memoryLimit); +} +function date_to_xmlschema(v) { + return date.call(this, v, '%Y-%m-%dT%H:%M:%S%:z'); +} +function date_to_rfc822(v) { + return date.call(this, v, '%a, %d %b %Y %H:%M:%S %z'); +} +function date_to_string(v, type, style) { + return stringify_date.call(this, v, '%b', type, style); +} +function date_to_long_string(v, type, style) { + return stringify_date.call(this, v, '%B', type, style); +} +function stringify_date(v, month_type, type, style) { + const date = parseDate(v, this.context.opts); + if (!date) + return v; + const ml = this.context.memoryLimit; + if (type === 'ordinal') { + const d = date.getDate(); + return style === 'US' + ? strftime(date, `${month_type} ${d}%q, %Y`, ml) + : strftime(date, `${d}%q ${month_type} %Y`, ml); + } + return strftime(date, `%d ${month_type} %Y`, ml); +} +function parseDate(v, opts, timezoneOffset) { + let date; + const defaultTimezoneOffset = timezoneOffset ?? opts.timezoneOffset; + const locale = opts.locale; + v = toValue(v); + if (isNil(v)) { + return undefined; + } + else if (v === 'now' || v === 'today') { + date = new LiquidDate(Date.now(), locale, defaultTimezoneOffset); + } + else if (isNumber(v)) { + date = new LiquidDate(v * 1000, locale, defaultTimezoneOffset); + } + else if (isString(v)) { + if (/^\d+$/.test(v)) { + date = new LiquidDate(+v * 1000, locale, defaultTimezoneOffset); + } + else if (opts.preserveTimezones && timezoneOffset === undefined) { + date = LiquidDate.createDateFixedToTimezone(v, locale); + } + else { + date = new LiquidDate(v, locale, defaultTimezoneOffset); + } + } + else { + date = new LiquidDate(v, locale, defaultTimezoneOffset); + } + return date.valid() ? date : undefined; +} + +var dateFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + date: date, + date_to_xmlschema: date_to_xmlschema, + date_to_rfc822: date_to_rfc822, + date_to_string: date_to_string, + date_to_long_string: date_to_long_string +}); + +/** + * String related filters + * + * * prefer stringify() to String() since `undefined`, `null` should eval '' + */ +const rCJKWord = /[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/gu; +// Word boundary followed by word characters (for detecting words) +const rNonCJKWord = /[^\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF\s]+/gu; +function append(v, arg) { + assert(arguments.length === 2, 'append expect 2 arguments'); + const lhs = stringify(v); + const rhs = stringify(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return lhs + rhs; +} +function prepend(v, arg) { + assert(arguments.length === 2, 'prepend expect 2 arguments'); + const lhs = stringify(v); + const rhs = stringify(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return rhs + lhs; +} +function lstrip(v, chars) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + if (chars) { + chars = stringify(chars); + this.context.memoryLimit.use(chars.length); + for (let i = 0, set = new Set(chars); i < str.length; i++) { + if (!set.has(str[i])) + return str.slice(i); + } + return ''; + } + return str.trimStart(); +} +function downcase(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.toLowerCase(); +} +function upcase(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return stringify(str).toUpperCase(); +} +function remove(v, arg) { + const str = stringify(v); + arg = stringify(arg); + this.context.memoryLimit.use(str.length + arg.length); + return str.split(arg).join(''); +} +function remove_first(v, l) { + const str = stringify(v); + l = stringify(l); + this.context.memoryLimit.use(str.length + l.length); + return str.replace(l, ''); +} +function remove_last(v, l) { + const str = stringify(v); + const pattern = stringify(l); + this.context.memoryLimit.use(str.length + pattern.length); + const index = str.lastIndexOf(pattern); + if (index === -1) + return str; + return str.substring(0, index) + str.substring(index + pattern.length); +} +function rstrip(str, chars) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + if (chars) { + chars = stringify(chars); + this.context.memoryLimit.use(chars.length); + for (let i = str.length - 1, set = new Set(chars); i >= 0; i--) { + if (!set.has(str[i])) + return str.slice(0, i + 1); + } + return ''; + } + return str.trimEnd(); +} +function split(v, arg) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + const arr = str.split(stringify(arg)); + // align to ruby split, which is the behavior of shopify/liquid + // see: https://ruby-doc.org/core-2.4.0/String.html#method-i-split + while (arr.length && arr[arr.length - 1] === '') + arr.pop(); + return arr; +} +function strip(v, chars) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + if (chars) { + const set = new Set(stringify(chars)); + this.context.memoryLimit.use(set.size); + let i = 0; + let j = str.length - 1; + while (set.has(str[i])) + i++; + while (j >= i && set.has(str[j])) + j--; + return str.slice(i, j + 1); + } + return str.trim(); +} +function strip_newlines(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\r?\n/gm, ''); +} +function capitalize(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); +} +function replace(v, pattern, replacement) { + const str = stringify(v); + pattern = stringify(pattern); + replacement = stringify(replacement); + const parts = str.split(pattern); + const outputSize = str.length + (parts.length - 1) * (replacement.length - pattern.length); + this.context.memoryLimit.use(outputSize); + return parts.join(replacement); +} +function replace_first(v, arg1, arg2) { + const str = stringify(v); + arg1 = stringify(arg1); + arg2 = stringify(arg2); + this.context.memoryLimit.use(str.length + arg1.length + arg2.length); + return str.replace(arg1, () => arg2); +} +function replace_last(v, arg1, arg2) { + const str = stringify(v); + const pattern = stringify(arg1); + const replacement = stringify(arg2); + this.context.memoryLimit.use(str.length + pattern.length + replacement.length); + const index = str.lastIndexOf(pattern); + if (index === -1) + return str; + return str.substring(0, index) + replacement + str.substring(index + pattern.length); +} +function truncate(v, l = 50, o = '...') { + const str = stringify(v); + o = stringify(o); + this.context.memoryLimit.use(str.length + o.length); + if (str.length <= l) + return v; + return str.substring(0, l - o.length) + o; +} +function truncatewords(v, words = 15, o = '...') { + const str = stringify(v); + o = stringify(o); + this.context.memoryLimit.use(str.length + o.length); + const arr = str.split(/\s+/); + if (words <= 0) + words = 1; + let ret = arr.slice(0, words).join(' '); + if (arr.length >= words) + ret += o; + return ret; +} +function normalize_whitespace(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\s+/g, ' '); +} +function number_of_words(input, mode) { + const str = stringify(input); + this.context.memoryLimit.use(str.length); + input = str.trim(); + if (!input) + return 0; + switch (mode) { + case 'cjk': + // Count CJK characters and words + return (input.match(rCJKWord) || []).length + (input.match(rNonCJKWord) || []).length; + case 'auto': + // Count CJK characters, if none, count words + return rCJKWord.test(input) + ? input.match(rCJKWord).length + (input.match(rNonCJKWord) || []).length + : input.split(/\s+/).length; + default: + // Count words only + return input.split(/\s+/).length; + } +} +function array_to_sentence_string(array, connector = 'and') { + connector = stringify(connector); + let outputSize = connector.length + array.length * 2; + for (let i = 0; i < array.length; i++) + outputSize += stringify(array[i]).length; + this.context.memoryLimit.use(outputSize); + switch (array.length) { + case 0: + return ''; + case 1: + return array[0]; + case 2: + return `${array[0]} ${connector} ${array[1]}`; + default: + return `${array.slice(0, -1).join(', ')}, ${connector} ${array[array.length - 1]}`; + } +} + +var stringFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + append: append, + prepend: prepend, + lstrip: lstrip, + downcase: downcase, + upcase: upcase, + remove: remove, + remove_first: remove_first, + remove_last: remove_last, + rstrip: rstrip, + split: split, + strip: strip, + strip_newlines: strip_newlines, + capitalize: capitalize, + replace: replace, + replace_first: replace_first, + replace_last: replace_last, + truncate: truncate, + truncatewords: truncatewords, + normalize_whitespace: normalize_whitespace, + number_of_words: number_of_words, + array_to_sentence_string: array_to_sentence_string +}); + +function base64Encode(str) { + return Buffer.from(str, 'utf8').toString('base64'); +} +function base64Decode(str) { + return Buffer.from(str, 'base64').toString('utf8'); +} + +/** + * Base64 related filters + * + * Implements base64_encode and base64_decode filters for Shopify compatibility + */ +function base64_encode(value) { + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { + this.context.memoryLimit.use(value.byteLength); + return value.toString('base64'); + } + const str = stringify(value); + this.context.memoryLimit.use(str.length); + return base64Encode(str); +} +function base64_decode(value) { + const str = stringify(value); + this.context.memoryLimit.use(str.length); + return base64Decode(str); +} + +var base64Filters = /*#__PURE__*/Object.freeze({ + __proto__: null, + base64_encode: base64_encode, + base64_decode: base64_decode +}); + +function sha256(str) { + return crypto.createHash('sha256').update(str, 'utf8').digest('hex'); +} +function hmacSha256(str, key) { + return crypto.createHmac('sha256', key).update(str, 'utf8').digest('hex'); +} + +/** + * Crypto related filters + * + * Implements sha256 and hmac_sha256 filters for Shopify compatibility + */ +function sha256$1(value) { + const str = stringify(value); + this.context.memoryLimit.use(str.length); + return sha256(str); +} +function hmac_sha256(value, key) { + const str = stringify(value); + const keyStr = stringify(key); + this.context.memoryLimit.use(str.length + keyStr.length); + return hmacSha256(str, keyStr); +} + +var cryptoFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + sha256: sha256$1, + hmac_sha256: hmac_sha256 +}); + +const filters = { + ...htmlFilters, + ...mathFilters, + ...urlFilters, + ...arrayFilters, + ...dateFilters, + ...stringFilters, + ...base64Filters, + ...cryptoFilters, + ...misc +}; + +class AssignTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.identifier = this.tokenizer.readIdentifier(); + this.key = this.identifier.content; + this.tokenizer.assert(this.key, 'expected variable name'); + this.tokenizer.skipBlank(); + this.tokenizer.assert(this.tokenizer.peek() === '=', 'expected "="'); + this.tokenizer.advance(); + this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid); + } + *render(ctx) { + ctx.bottom()[this.key] = yield this.value.value(ctx, this.liquid.options.lenientIf); + } + *arguments() { + yield this.value; + } + *localScope() { + yield this.identifier; + } +} + +const MODIFIERS = ['offset', 'limit', 'reversed']; +class ForTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const variable = this.tokenizer.readIdentifier(); + const inStr = this.tokenizer.readIdentifier(); + const collection = this.tokenizer.readValue(); + if (!variable.size() || inStr.content !== 'in' || !collection) { + throw new Error(`illegal tag: ${token.getText()}`); + } + this.variable = variable.content; + this.collection = collection; + this.hash = new Hash(this.tokenizer, liquid.options.keyValueSeparator); + this.templates = []; + this.elseTemplates = []; + let p; + const stream = parser.parseStream(remainTokens) + .on('start', () => (p = this.templates)) + .on('tag:else', tag => { assertEmpty(tag.args); p = this.elseTemplates; }) + .on('tag:endfor', tag => { assertEmpty(tag.args); stream.stop(); }) + .on('template', (tpl) => p.push(tpl)) + .on('end', () => { throw new Error(`tag ${token.getText()} not closed`); }); + stream.start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + let collection = toEnumerable(yield evalToken(this.collection, ctx)); + if (!collection.length) { + yield r.renderTemplates(this.elseTemplates, ctx, emitter); + return; + } + const continueKey = 'continue-' + this.variable + '-' + this.collection.getText(); + ctx.push(createScope({ continue: ctx.getRegister(continueKey, {}) })); + const hash = (yield this.hash.render(ctx)); + ctx.pop(); + const modifiers = this.liquid.options.orderedFilterParameters + ? Object.keys(hash).filter(x => MODIFIERS.includes(x)) + : MODIFIERS.filter(x => hash[x] !== undefined); + collection = modifiers.reduce((collection, modifier) => { + if (modifier === 'offset') + return offset(collection, hash['offset']); + if (modifier === 'limit') + return limit(collection, hash['limit']); + return reversed(collection); + }, collection); + ctx.setRegister(continueKey, (hash['offset'] || 0) + collection.length); + const scope = createScope({ forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) }); + ctx.push(scope); + for (const item of collection) { + scope[this.variable] = item; + ctx.continueCalled = ctx.breakCalled = false; + yield r.renderTemplates(this.templates, ctx, emitter); + if (ctx.breakCalled) + break; + scope.forloop.next(); + } + ctx.continueCalled = ctx.breakCalled = false; + ctx.pop(); + } + *children() { + const templates = this.templates.slice(); + if (this.elseTemplates) { + templates.push(...this.elseTemplates); + } + return templates; + } + *arguments() { + yield this.collection; + for (const v of Object.values(this.hash.hash)) { + if (isValueToken(v)) { + yield v; + } + } + } + blockScope() { + return [this.variable, 'forloop']; + } +} +function reversed(arr) { + return [...arr].reverse(); +} +function offset(arr, count) { + return arr.slice(count); +} +function limit(arr, count) { + return arr.slice(0, count); +} + +class CaptureTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.templates = []; + this.identifier = this.readVariable(); + this.variable = this.identifier.content; + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endcapture') + return; + this.templates.push(parser.parseToken(token, remainTokens)); + } + throw new Error(`tag ${tagToken.getText()} not closed`); + } + readVariable() { + let ident = this.tokenizer.readIdentifier(); + if (ident.content) + return ident; + ident = this.tokenizer.readQuoted(); + if (ident) + return ident; + throw this.tokenizer.error('invalid capture name'); + } + *render(ctx) { + const r = this.liquid.renderer; + const html = yield r.renderTemplates(this.templates, ctx); + ctx.bottom()[this.variable] = html; + } + *children() { + return this.templates; + } + *localScope() { + yield this.identifier; + } +} + +class CaseTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.branches = []; + this.elseTemplates = []; + this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid); + this.elseTemplates = []; + let p = []; + let elseCount = 0; + const stream = parser.parseStream(remainTokens) + .on('tag:when', (token) => { + if (elseCount > 0) { + return; + } + p = []; + const values = []; + while (!token.tokenizer.end()) { + values.push(token.tokenizer.readValueOrThrow()); + token.tokenizer.skipBlank(); + if (token.tokenizer.peek() === ',') { + token.tokenizer.readTo(','); + } + else { + token.tokenizer.readTo('or'); + } + } + this.branches.push({ + values, + templates: p + }); + }) + .on('tag:else', () => { + elseCount++; + p = this.elseTemplates; + }) + .on('tag:endcase', () => stream.stop()) + .on('template', (tpl) => { + if (p !== this.elseTemplates || elseCount === 1) { + p.push(tpl); + } + }) + .on('end', () => { + throw new Error(`tag ${tagToken.getText()} not closed`); + }); + stream.start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + const target = toValue(yield this.value.value(ctx, ctx.opts.lenientIf)); + let branchHit = false; + for (const branch of this.branches) { + for (const valueToken of branch.values) { + const value = yield evalToken(valueToken, ctx, ctx.opts.lenientIf); + if (equals(target, value)) { + yield r.renderTemplates(branch.templates, ctx, emitter); + branchHit = true; + break; + } + } + } + if (!branchHit) { + yield r.renderTemplates(this.elseTemplates, ctx, emitter); + } + } + *arguments() { + yield this.value; + yield* this.branches.flatMap(b => b.values); + } + *children() { + const templates = this.branches.flatMap(b => b.templates); + if (this.elseTemplates) { + templates.push(...this.elseTemplates); + } + return templates; + } +} + +class CommentTag extends Tag { + constructor(tagToken, remainTokens, liquid) { + super(tagToken, remainTokens, liquid); + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endcomment') + return; + } + throw new Error(`tag ${tagToken.getText()} not closed`); + } + render() { } +} + +class RenderTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const tokenizer = this.tokenizer; + this.file = parseFilePath(tokenizer, this.liquid, parser); + this.currentFile = token.file; + while (!tokenizer.end()) { + tokenizer.skipBlank(); + const begin = tokenizer.p; + const keyword = tokenizer.readIdentifier(); + if (keyword.content === 'with' || keyword.content === 'for') { + tokenizer.skipBlank(); + // can be normal key/value pair, like "with: true" + if (tokenizer.peek() !== ':') { + const value = tokenizer.readValue(); + // can be normal key, like "with," + if (value) { + const beforeAs = tokenizer.p; + const asStr = tokenizer.readIdentifier(); + let alias; + if (asStr.content === 'as') + alias = tokenizer.readIdentifier(); + else + tokenizer.p = beforeAs; + const binding = { value, alias: alias && alias.content }; + if (keyword.content === 'with') + this.with = binding; + else + this.forBinding = binding; + tokenizer.skipBlank(); + if (tokenizer.peek() === ',') + tokenizer.advance(); + continue; // matched! + } + } + } + /** + * restore cursor if with/for not matched + */ + tokenizer.p = begin; + break; + } + this.hash = new Hash(tokenizer, liquid.options.keyValueSeparator); + } + *render(ctx, emitter) { + const { liquid, hash } = this; + const filepath = (yield renderFilePath(this.file, ctx, liquid)); + assert(filepath, () => `illegal file path "${filepath}"`); + const childCtx = ctx.spawn(); + const scope = childCtx.bottom(); + __assign(scope, yield hash.render(ctx)); + if (this.with) { + const { value, alias } = this.with; + scope[alias || filepath] = yield evalToken(value, ctx); + } + if (this.forBinding) { + const { value, alias } = this.forBinding; + const collection = toEnumerable(yield evalToken(value, ctx)); + scope['forloop'] = new ForloopDrop(collection.length, value.getText(), alias); + for (const item of collection) { + scope[alias] = item; + const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)); + yield liquid.renderer.renderTemplates(templates, childCtx, emitter); + scope['forloop'].next(); + } + } + else { + const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)); + yield liquid.renderer.renderTemplates(templates, childCtx, emitter); + } + } + *children(partials, sync) { + if (partials && isString(this.file)) { + return (yield this.liquid._parsePartialFile(this.file, sync, this.currentFile)); + } + return []; + } + partialScope() { + if (isString(this.file)) { + const names = Object.keys(this.hash.hash); + if (this.with) { + const { value, alias } = this.with; + if (isString(alias)) { + names.push([alias, value]); + } + else if (isString(this.file)) { + names.push([this.file, value]); + } + } + if (this.forBinding) { + const { value, alias } = this.forBinding; + if (isString(alias)) { + names.push([alias, value]); + } + else if (isString(this.file)) { + names.push([this.file, value]); + } + } + return { name: this.file, isolated: true, scope: names }; + } + } + *arguments() { + for (const v of Object.values(this.hash.hash)) { + if (isValueToken(v)) { + yield v; + } + } + if (this.with) { + const { value } = this.with; + if (isValueToken(value)) { + yield value; + } + } + if (this.forBinding) { + const { value } = this.forBinding; + if (isValueToken(value)) { + yield value; + } + } + } +} +/** + * @return null for "none", + * @return Template[] for quoted with tags and/or filters + * @return Token for expression (not quoted) + * @throws TypeError if cannot read next token + */ +function parseFilePath(tokenizer, liquid, parser) { + if (liquid.options.dynamicPartials) { + const file = tokenizer.readValue(); + tokenizer.assert(file, 'illegal file path'); + if (file.getText() === 'none') + return; + if (isQuotedToken(file)) { + // for filenames like "files/{{file}}", eval as liquid template + const templates = parser.parse(evalQuotedToken(file)); + return optimize(templates); + } + return file; + } + const tokens = [...tokenizer.readFileNameTemplate(liquid.options)]; + const templates = optimize(parser.parseTokens(tokens)); + return templates === 'none' ? undefined : templates; +} +function optimize(templates) { + // for filenames like "files/file.liquid", extract the string directly + if (templates.length === 1 && isHTMLToken(templates[0].token)) + return templates[0].token.getContent(); + return templates; +} +function* renderFilePath(file, ctx, liquid) { + if (typeof file === 'string') + return file; + if (Array.isArray(file)) + return liquid.renderer.renderTemplates(file, ctx); + return yield evalToken(file, ctx); +} + +class IncludeTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const { tokenizer } = token; + this.file = parseFilePath(tokenizer, this.liquid, parser); + this.currentFile = token.file; + const begin = tokenizer.p; + const withStr = tokenizer.readIdentifier(); + if (withStr.content === 'with') { + tokenizer.skipBlank(); + if (tokenizer.peek() !== ':') { + this.withVar = tokenizer.readValue(); + } + else + tokenizer.p = begin; + } + else + tokenizer.p = begin; + this.hash = new Hash(tokenizer, liquid.options.jekyllInclude || liquid.options.keyValueSeparator); + } + *render(ctx, emitter) { + const { liquid, hash, withVar } = this; + const { renderer } = liquid; + const filepath = (yield renderFilePath(this.file, ctx, liquid)); + assert(filepath, () => `illegal file path "${filepath}"`); + const saved = ctx.saveRegister('blocks', 'blockMode'); + ctx.setRegister('blocks', {}); + ctx.setRegister('blockMode', BlockMode.OUTPUT); + const scope = createScope((yield hash.render(ctx))); + if (withVar) + scope[filepath] = yield evalToken(withVar, ctx); + const templates = (yield liquid._parsePartialFile(filepath, ctx.sync, this.currentFile)); + ctx.push(ctx.opts.jekyllInclude ? createScope({ include: scope }) : scope); + yield renderer.renderTemplates(templates, ctx, emitter); + ctx.pop(); + ctx.restoreRegister(saved); + } + *children(partials, sync) { + if (partials && isString(this.file)) { + return (yield this.liquid._parsePartialFile(this.file, sync, this.currentFile)); + } + return []; + } + partialScope() { + if (isString(this.file)) { + let names; + if (this.liquid.options.jekyllInclude) { + names = ['include']; + } + else { + names = Object.keys(this.hash.hash); + if (this.withVar) { + names.push([this.file, this.withVar]); + } + } + return { name: this.file, isolated: false, scope: names }; + } + } + *arguments() { + yield* Object.values(this.hash.hash).filter(isValueToken); + if (isValueToken(this.file)) { + yield this.file; + } + if (isValueToken(this.withVar)) { + yield this.withVar; + } + } +} + +class DecrementTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.identifier = this.tokenizer.readIdentifier(); + this.variable = this.identifier.content; + } + render(context, emitter) { + const scope = context.environments; + if (!isNumber(scope[this.variable])) { + scope[this.variable] = 0; + } + emitter.write(stringify(--scope[this.variable])); + } + *localScope() { + yield this.identifier; + } +} + +class CycleTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.candidates = []; + const group = this.tokenizer.readValue(); + this.tokenizer.skipBlank(); + if (group) { + if (this.tokenizer.peek() === ':') { + this.group = group; + this.tokenizer.advance(); + } + else + this.candidates.push(group); + } + while (!this.tokenizer.end()) { + const value = this.tokenizer.readValue(); + if (value) + this.candidates.push(value); + this.tokenizer.readTo(','); + } + this.tokenizer.assert(this.candidates.length, () => `empty candidates: "${token.getText()}"`); + } + *render(ctx, emitter) { + const group = (yield evalToken(this.group, ctx)); + const fingerprint = `cycle:${group}:` + this.candidates.join(','); + const groups = ctx.getRegister('cycle', {}); + let idx = groups[fingerprint]; + if (idx === undefined) { + idx = groups[fingerprint] = 0; + } + const candidate = this.candidates[idx]; + idx = (idx + 1) % this.candidates.length; + groups[fingerprint] = idx; + return yield evalToken(candidate, ctx); + } + *arguments() { + yield* this.candidates; + if (this.group) { + yield this.group; + } + } +} + +class IfTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.branches = []; + let p = []; + parser.parseStream(remainTokens) + .on('start', () => this.branches.push({ + value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid), + templates: (p = []) + })) + .on('tag:elsif', (token) => { + assert(!this.elseTemplates, 'unexpected elsif after else'); + this.branches.push({ + value: new Value(token.tokenizer.readFilteredValue(), this.liquid), + templates: (p = []) + }); + }) + .on('tag:else', tag => { + assertEmpty(tag.args); + assert(!this.elseTemplates, 'duplicated else'); + p = this.elseTemplates = []; + }) + .on('tag:endif', function (tag) { assertEmpty(tag.args); this.stop(); }) + .on('template', (tpl) => p.push(tpl)) + .on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`); }) + .start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + for (const { value, templates } of this.branches) { + const v = yield value.value(ctx, ctx.opts.lenientIf); + if (isTruthy(v, ctx)) { + yield r.renderTemplates(templates, ctx, emitter); + return; + } + } + yield r.renderTemplates(this.elseTemplates || [], ctx, emitter); + } + *children() { + const templates = this.branches.flatMap(b => b.templates); + if (this.elseTemplates) { + templates.push(...this.elseTemplates); + } + return templates; + } + arguments() { + return this.branches.map(b => b.value); + } +} + +class IncrementTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.identifier = this.tokenizer.readIdentifier(); + this.variable = this.identifier.content; + } + render(context, emitter) { + const scope = context.environments; + if (!isNumber(scope[this.variable])) { + scope[this.variable] = 0; + } + const val = scope[this.variable]; + scope[this.variable]++; + emitter.write(stringify(val)); + } + *localScope() { + yield this.identifier; + } +} + +class LayoutTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + this.file = parseFilePath(this.tokenizer, this.liquid, parser); + this.currentFile = token.file; + this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator); + this.templates = parser.parseTokens(remainTokens); + } + *render(ctx, emitter) { + const { liquid, args, file } = this; + const { renderer } = liquid; + if (file === undefined) { + ctx.setRegister('blockMode', BlockMode.OUTPUT); + yield renderer.renderTemplates(this.templates, ctx, emitter); + return; + } + const filepath = (yield renderFilePath(this.file, ctx, liquid)); + assert(filepath, () => `illegal file path "${filepath}"`); + const templates = (yield liquid._parseLayoutFile(filepath, ctx.sync, this.currentFile)); + // render remaining contents and store rendered results + ctx.setRegister('blockMode', BlockMode.STORE); + const html = yield renderer.renderTemplates(this.templates, ctx); + const blocks = ctx.getRegister('blocks', {}); + // set whole content to anonymous block if anonymous doesn't specified + if (blocks[''] === undefined) + blocks[''] = (parent, emitter) => emitter.write(html); + ctx.setRegister('blockMode', BlockMode.OUTPUT); + // render the layout file use stored blocks + ctx.push(createScope((yield args.render(ctx)))); + yield renderer.renderTemplates(templates, ctx, emitter); + ctx.pop(); + } + *children(partials) { + const templates = this.templates.slice(); + if (partials && isString(this.file)) { + templates.push(...(yield this.liquid._parsePartialFile(this.file, true, this.currentFile))); + } + return templates; + } + *arguments() { + for (const v of Object.values(this.args.hash)) { + if (isValueToken(v)) { + yield v; + } + } + if (isValueToken(this.file)) { + yield this.file; + } + } + partialScope() { + if (isString(this.file)) { + return { name: this.file, isolated: false, scope: Object.keys(this.args.hash) }; + } + } +} + +class BlockTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + this.templates = []; + const match = /\w+/.exec(token.args); + this.block = match ? match[0] : ''; + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endblock') + return; + const template = parser.parseToken(token, remainTokens); + this.templates.push(template); + } + throw new Error(`tag ${token.getText()} not closed`); + } + *render(ctx, emitter) { + const blockRender = this.getBlockRender(ctx); + if (ctx.getRegister('blockMode') === BlockMode.STORE) { + ctx.getRegister('blocks', {})[this.block] = blockRender; + } + else { + yield blockRender(new BlockDrop(), emitter); + } + } + getBlockRender(ctx) { + const self = this; + const { liquid, templates } = this; + const renderChild = ctx.getRegister('blocks', {})[this.block]; + const renderCurrent = function* (superBlock, emitter) { + const stack = ctx.getRegister('blockStack', []); + if (stack.includes(self)) + throw new Error('block tag cannot be nested'); + stack.push(self); + ctx.push(createScope({ block: superBlock })); + yield liquid.renderer.renderTemplates(templates, ctx, emitter); + ctx.pop(); + stack.pop(); + }; + return renderChild + ? (superBlock, emitter) => renderChild(new BlockDrop((emitter) => renderCurrent(superBlock, emitter)), emitter) + : renderCurrent; + } + *children() { + return this.templates; + } + blockScope() { + return ['block']; + } +} + +class RawTag extends Tag { + constructor(tagToken, remainTokens, liquid) { + super(tagToken, remainTokens, liquid); + this.tokens = []; + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endraw') + return; + this.tokens.push(token); + } + throw new Error(`tag ${tagToken.getText()} not closed`); + } + render() { + return this.tokens.map((token) => token.getText()).join(''); + } +} + +class TablerowloopDrop extends ForloopDrop { + constructor(length, cols, collection, variable) { + super(length, collection, variable); + this.length = length; + this.cols = cols; + } + row() { + return Math.floor(this.i / this.cols) + 1; + } + col0() { + return (this.i % this.cols); + } + col() { + return this.col0() + 1; + } + col_first() { + return this.col0() === 0; + } + col_last() { + return this.col() === this.cols; + } +} + +class TablerowTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + const variable = this.tokenizer.readIdentifier(); + this.tokenizer.skipBlank(); + const predicate = this.tokenizer.readIdentifier(); + const collectionToken = this.tokenizer.readValue(); + if (predicate.content !== 'in' || !collectionToken) { + throw new Error(`illegal tag: ${tagToken.getText()}`); + } + this.variable = variable.content; + this.collection = collectionToken; + this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator); + this.templates = []; + let p; + const stream = parser.parseStream(remainTokens) + .on('start', () => (p = this.templates)) + .on('tag:endtablerow', () => stream.stop()) + .on('template', (tpl) => p.push(tpl)) + .on('end', () => { + throw new Error(`tag ${tagToken.getText()} not closed`); + }); + stream.start(); + } + *render(ctx, emitter) { + let collection = toEnumerable(yield evalToken(this.collection, ctx)); + const args = (yield this.args.render(ctx)); + const offset = args.offset || 0; + const limit = (args.limit === undefined) ? collection.length : args.limit; + collection = collection.slice(offset, offset + limit); + const cols = args.cols || collection.length; + const r = this.liquid.renderer; + const tablerowloop = new TablerowloopDrop(collection.length, cols, this.collection.getText(), this.variable); + const scope = createScope({ tablerowloop }); + ctx.push(scope); + for (let idx = 0; idx < collection.length; idx++, tablerowloop.next()) { + scope[this.variable] = collection[idx]; + if (tablerowloop.col0() === 0) { + if (tablerowloop.row() !== 1) + emitter.write(''); + emitter.write(``); + } + emitter.write(``); + yield r.renderTemplates(this.templates, ctx, emitter); + emitter.write(''); + } + if (collection.length) + emitter.write(''); + ctx.pop(); + } + *children() { + return this.templates; + } + *arguments() { + yield this.collection; + for (const v of Object.values(this.args.hash)) { + if (isValueToken(v)) { + yield v; + } + } + } + blockScope() { + return [this.variable, 'tablerowloop']; + } +} + +class UnlessTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.branches = []; + this.elseTemplates = []; + let p = []; + let elseCount = 0; + parser.parseStream(remainTokens) + .on('start', () => this.branches.push({ + value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid), + test: isFalsy, + templates: (p = []) + })) + .on('tag:elsif', (token) => { + if (elseCount > 0) { + p = []; + return; + } + this.branches.push({ + value: new Value(token.tokenizer.readFilteredValue(), this.liquid), + test: isTruthy, + templates: (p = []) + }); + }) + .on('tag:else', () => { + elseCount++; + p = this.elseTemplates; + }) + .on('tag:endunless', function () { this.stop(); }) + .on('template', (tpl) => { + if (p !== this.elseTemplates || elseCount === 1) { + p.push(tpl); + } + }) + .on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`); }) + .start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + for (const { value, test, templates } of this.branches) { + const v = yield value.value(ctx, ctx.opts.lenientIf); + if (test(v, ctx)) { + yield r.renderTemplates(templates, ctx, emitter); + return; + } + } + yield r.renderTemplates(this.elseTemplates, ctx, emitter); + } + *children() { + const children = this.branches.flatMap(b => b.templates); + if (this.elseTemplates) { + children.push(...this.elseTemplates); + } + return children; + } + arguments() { + return this.branches.map(b => b.value); + } +} + +class BreakTag extends Tag { + render(ctx, _emitter) { + ctx.breakCalled = true; + } +} + +class ContinueTag extends Tag { + render(ctx, _emitter) { + ctx.continueCalled = true; + } +} + +class EchoTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.tokenizer.skipBlank(); + if (!this.tokenizer.end()) { + this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid); + } + } + *render(ctx, emitter) { + if (!this.value) + return; + const val = yield this.value.value(ctx, false); + emitter.write(val); + } + *arguments() { + if (this.value) { + yield this.value; + } + } +} + +class LiquidTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const tokens = this.tokenizer.readLiquidTagTokens(this.liquid.options); + this.templates = parser.parseTokens(tokens); + } + *render(ctx, emitter) { + yield this.liquid.renderer.renderTemplates(this.templates, ctx, emitter); + } + *children() { + return this.templates; + } +} + +class InlineCommentTag extends Tag { + constructor(tagToken, remainTokens, liquid) { + super(tagToken, remainTokens, liquid); + if (tagToken.args.search(/\n\s*[^#\s]/g) !== -1) { + throw new Error('every line of an inline comment must start with a \'#\' character'); + } + } + render() { } +} + +const tags = { + assign: AssignTag, + 'for': ForTag, + capture: CaptureTag, + 'case': CaseTag, + comment: CommentTag, + include: IncludeTag, + render: RenderTag, + decrement: DecrementTag, + increment: IncrementTag, + cycle: CycleTag, + 'if': IfTag, + layout: LayoutTag, + block: BlockTag, + raw: RawTag, + tablerow: TablerowTag, + unless: UnlessTag, + 'break': BreakTag, + 'continue': ContinueTag, + echo: EchoTag, + liquid: LiquidTag, + '#': InlineCommentTag +}; + +class Liquid { + constructor(opts = {}) { + this.renderer = new Render(); + this.filters = Object.create(null); + this.tags = Object.create(null); + this.options = normalize(opts); + // eslint-disable-next-line deprecation/deprecation + this.parser = new Parser(this); + forOwn(tags, (conf, name) => this.registerTag(name, conf)); + forOwn(filters, (handler, name) => this.registerFilter(name, handler)); + } + parse(html, filepath) { + const parser = new Parser(this); + return parser.parse(html, filepath); + } + _render(tpl, scope, renderOptions) { + const ctx = scope instanceof Context ? scope : new Context(scope, this.options, renderOptions); + return this.renderer.renderTemplates(tpl, ctx); + } + async render(tpl, scope, renderOptions) { + return toPromise(this._render(tpl, scope, { ...renderOptions, sync: false })); + } + renderSync(tpl, scope, renderOptions) { + return toValueSync(this._render(tpl, scope, { ...renderOptions, sync: true })); + } + renderToNodeStream(tpl, scope, renderOptions = {}) { + const ctx = new Context(scope, this.options, renderOptions); + return this.renderer.renderTemplatesToNodeStream(tpl, ctx); + } + _parseAndRender(html, scope, renderOptions) { + const tpl = this.parse(html); + return this._render(tpl, scope, renderOptions); + } + async parseAndRender(html, scope, renderOptions) { + return toPromise(this._parseAndRender(html, scope, { ...renderOptions, sync: false })); + } + parseAndRenderSync(html, scope, renderOptions) { + return toValueSync(this._parseAndRender(html, scope, { ...renderOptions, sync: true })); + } + _parsePartialFile(file, sync, currentFile) { + return new Parser(this).parseFile(file, sync, exports.LookupType.Partials, currentFile); + } + _parseLayoutFile(file, sync, currentFile) { + return new Parser(this).parseFile(file, sync, exports.LookupType.Layouts, currentFile); + } + _parseFile(file, sync, lookupType, currentFile) { + return new Parser(this).parseFile(file, sync, lookupType, currentFile); + } + async parseFile(file, lookupType) { + return toPromise(new Parser(this).parseFile(file, false, lookupType)); + } + parseFileSync(file, lookupType) { + return toValueSync(new Parser(this).parseFile(file, true, lookupType)); + } + *_renderFile(file, ctx, renderFileOptions) { + const templates = (yield this._parseFile(file, renderFileOptions.sync, renderFileOptions.lookupType)); + return yield this._render(templates, ctx, renderFileOptions); + } + async renderFile(file, ctx, renderFileOptions) { + return toPromise(this._renderFile(file, ctx, { ...renderFileOptions, sync: false })); + } + renderFileSync(file, ctx, renderFileOptions) { + return toValueSync(this._renderFile(file, ctx, { ...renderFileOptions, sync: true })); + } + async renderFileToNodeStream(file, scope, renderOptions) { + const templates = await this.parseFile(file); + return this.renderToNodeStream(templates, scope, renderOptions); + } + _evalValue(str, scope) { + const value = new Value(str, this); + const ctx = scope instanceof Context ? scope : new Context(scope, this.options); + return value.value(ctx); + } + async evalValue(str, scope) { + return toPromise(this._evalValue(str, scope)); + } + evalValueSync(str, scope) { + return toValueSync(this._evalValue(str, scope)); + } + registerFilter(name, filter) { + this.filters[name] = filter; + } + registerTag(name, tag) { + this.tags[name] = isFunction(tag) ? tag : createTagClass(tag); + } + plugin(plugin) { + return plugin.call(this, Liquid); + } + express() { + const self = this; // eslint-disable-line + let firstCall = true; + return function (filePath, ctx, callback) { + if (firstCall) { + firstCall = false; + const dirs = normalizeDirectoryList(this.root); + self.options.root.unshift(...dirs); + self.options.layouts.unshift(...dirs); + self.options.partials.unshift(...dirs); + } + self.renderFile(filePath, ctx).then(html => callback(null, html), callback); + }; + } + async analyze(template, options = {}) { + return analyze(template, options); + } + analyzeSync(template, options = {}) { + return analyzeSync(template, options); + } + async parseAndAnalyze(html, filename, options = {}) { + return analyze(this.parse(html, filename), options); + } + parseAndAnalyzeSync(html, filename, options = {}) { + return analyzeSync(this.parse(html, filename), options); + } + /** Return an array of all variables without their properties. */ + async variables(template, options = {}) { + const analysis = await analyze(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.variables); + } + /** Return an array of all variables without their properties. */ + variablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.variables); + } + /** Return an array of all variables including their properties/paths. */ + async fullVariables(template, options = {}) { + const analysis = await analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v))))); + } + /** Return an array of all variables including their properties/paths. */ + fullVariablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v))))); + } + /** Return an array of all variables, each as an array of properties/segments. */ + async variableSegments(template, options = {}) { + const analysis = await analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray())))); + } + /** Return an array of all variables, each as an array of properties/segments. */ + variableSegmentsSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray())))); + } + /** Return an array of all expected context variables without their properties. */ + async globalVariables(template, options = {}) { + const analysis = await analyze(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.globals); + } + /** Return an array of all expected context variables without their properties. */ + globalVariablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.globals); + } + /** Return an array of all expected context variables including their properties/paths. */ + async globalFullVariables(template, options = {}) { + const analysis = await analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v))))); + } + /** Return an array of all expected context variables including their properties/paths. */ + globalFullVariablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v))))); + } + /** Return an array of all expected context variables, each as an array of properties/segments. */ + async globalVariableSegments(template, options = {}) { + const analysis = await analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray())))); + } + /** Return an array of all expected context variables, each as an array of properties/segments. */ + globalVariableSegmentsSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray())))); + } +} + +/* istanbul ignore file */ +const version = '10.27.2'; + +exports.AssertionError = AssertionError; +exports.AssignTag = AssignTag; +exports.BlockTag = BlockTag; +exports.BreakTag = BreakTag; +exports.CaptureTag = CaptureTag; +exports.CaseTag = CaseTag; +exports.CommentTag = CommentTag; +exports.Context = Context; +exports.ContinueTag = ContinueTag; +exports.CycleTag = CycleTag; +exports.DecrementTag = DecrementTag; +exports.Drop = Drop; +exports.EchoTag = EchoTag; +exports.Expression = Expression; +exports.Filter = Filter; +exports.ForTag = ForTag; +exports.Hash = Hash; +exports.IfTag = IfTag; +exports.IncludeTag = IncludeTag; +exports.IncrementTag = IncrementTag; +exports.InlineCommentTag = InlineCommentTag; +exports.LayoutTag = LayoutTag; +exports.Liquid = Liquid; +exports.LiquidError = LiquidError; +exports.LiquidTag = LiquidTag; +exports.Output = Output; +exports.ParseError = ParseError; +exports.ParseStream = ParseStream; +exports.Parser = Parser; +exports.RawTag = RawTag; +exports.RenderError = RenderError; +exports.RenderTag = RenderTag; +exports.TablerowTag = TablerowTag; +exports.Tag = Tag; +exports.TagToken = TagToken; +exports.Token = Token; +exports.TokenizationError = TokenizationError; +exports.Tokenizer = Tokenizer; +exports.TypeGuards = typeGuards; +exports.UndefinedVariableError = UndefinedVariableError; +exports.UnlessTag = UnlessTag; +exports.Value = Value; +exports.Variable = Variable; +exports.analyze = analyze; +exports.analyzeSync = analyzeSync; +exports.assert = assert; +exports.createTrie = createTrie; +exports.defaultOperators = defaultOperators; +exports.defaultOptions = defaultOptions; +exports.evalQuotedToken = evalQuotedToken; +exports.evalToken = evalToken; +exports.filters = filters; +exports.isFalsy = isFalsy; +exports.isTruthy = isTruthy; +exports.tags = tags; +exports.toPromise = toPromise; +exports.toValue = toValue; +exports.toValueSync = toValueSync; +exports.version = version; diff --git a/node_modules/liquidjs/dist/liquid.node.mjs b/node_modules/liquidjs/dist/liquid.node.mjs new file mode 100644 index 00000000..cc6180bd --- /dev/null +++ b/node_modules/liquidjs/dist/liquid.node.mjs @@ -0,0 +1,5176 @@ +/* + * liquidjs@10.27.2, https://github.com/harttle/liquidjs + * (c) 2016-2026 harttle + * Released under the MIT License. + */ +import { PassThrough } from 'stream'; +import { sep, extname, resolve as resolve$1, dirname as dirname$1 } from 'path'; +import { statSync, readFileSync as readFileSync$1, realpathSync, stat, readFile as readFile$1, realpath } from 'fs'; +import { createRequire } from 'module'; +import { createHash, createHmac } from 'crypto'; + +class Token { + constructor(kind, input, begin, end, file) { + this.kind = kind; + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + } + getText() { + return this.input.slice(this.begin, this.end); + } + getPosition() { + let [row, col] = [1, 1]; + for (let i = 0; i < this.begin; i++) { + if (this.input[i] === '\n') { + row++; + col = 1; + } + else + col++; + } + return [row, col]; + } + size() { + return this.end - this.begin; + } +} + +class Drop { + liquidMethodMissing(key, context) { + return undefined; + } +} + +const toString$1 = Object.prototype.toString; +const toLowerCase = String.prototype.toLowerCase; +const hasOwnProperty = Object.hasOwnProperty; +function isString(value) { + return typeof value === 'string'; +} +// eslint-disable-next-line @typescript-eslint/ban-types +function isFunction(value) { + return typeof value === 'function'; +} +function isPromise(val) { + return val && isFunction(val.then); +} +function isIterator(val) { + return val && isFunction(val.next) && isFunction(val.throw) && isFunction(val.return); +} +function promisify(fn) { + return function (...args) { + return new Promise((resolve, reject) => { + fn(...args, (err, result) => { + err ? reject(err) : resolve(result); + }); + }); + }; +} +function stringify(value) { + value = toValue(value); + if (isString(value)) + return value; + if (isNil(value)) + return ''; + if (isArray(value)) + return value.map(x => stringify(x)).join(''); + return String(value); +} +function readArrayElement(arr, index, ownPropertyOnly) { + if (index < 0) + index = arr.length + index; + if (ownPropertyOnly && !hasOwnProperty.call(arr, index)) + return undefined; + return arr[index]; +} +function toEnumerable(val) { + val = toValue(val); + if (isArray(val)) + return val; + if (isString(val) && val.length > 0) + return [val]; + if (isIterable(val)) + return Array.from(val); + if (isObject(val)) + return Object.keys(val).map((key) => [key, val[key]]); + return []; +} +function toArray(val) { + val = toValue(val); + if (isNil(val)) + return []; + if (isArray(val)) + return val; + return [val]; +} +function toValue(value) { + return (value instanceof Drop && isFunction(value.valueOf)) ? value.valueOf() : value; +} +function toNumber(value) { + return +toValue(value) || 0; +} +function isNumber(value) { + return typeof value === 'number'; +} +function toLiquid(value) { + if (value && isFunction(value.toLiquid)) + return toLiquid(value.toLiquid()); + return value; +} +function isNil(value) { + return value == null; +} +function isUndefined(value) { + return value === undefined; +} +function isArray(value) { + // be compatible with IE 8 + return toString$1.call(value) === '[object Array]'; +} +function isArrayLike(value) { + return value && isNumber(value.length); +} +function isIterable(value) { + return isObject(value) && Symbol.iterator in value; +} +/* + * Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property. + * The iteratee is invoked with three arguments: (value, key, object). + * Iteratee functions may exit iteration early by explicitly returning false. + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @return {Object} Returns object. + */ +function forOwn(obj, iteratee) { + obj = obj || {}; + for (const k in obj) { + if (hasOwnProperty.call(obj, k)) { + if (iteratee(obj[k], k, obj) === false) + break; + } + } + return obj; +} +/* + * Checks if value is the language type of Object. + * (e.g. arrays, functions, objects, regexes, new Number(0), and new String('')) + * @param {any} value The value to check. + * @return {Boolean} Returns true if value is an object, else false. + */ +function isObject(value) { + const type = typeof value; + return value !== null && (type === 'object' || type === 'function'); +} +function range(start, stop, step = 1) { + const arr = []; + for (let i = start; i < stop; i += step) { + arr.push(i); + } + return arr; +} +function padStart(str, length, ch = ' ') { + return pad(str, length, ch, (str, ch) => ch + str); +} +function padEnd(str, length, ch = ' ') { + return pad(str, length, ch, (str, ch) => str + ch); +} +function pad(str, length, ch, add) { + str = String(str); + const n = length - str.length; + if (n <= 0) + return str; + return add(str, ch.repeat(n)); +} +function identify(val) { + return val; +} +function changeCase(str) { + const hasLowerCase = [...str].some(ch => ch >= 'a' && ch <= 'z'); + return hasLowerCase ? str.toUpperCase() : str.toLowerCase(); +} +function ellipsis(str, N) { + return str.length > N ? str.slice(0, N - 3) + '...' : str; +} +function orderedCompare(a, b) { + if (isNil(a) && isNil(b)) + return 0; + if (isNil(a)) + return 1; + if (isNil(b)) + return -1; + if (a < b) + return -1; + if (a > b) + return 1; + return 0; +} +// compare string in case-insensitive way, undefined values to the tail +function caseInsensitiveCompare(a, b) { + if (isNil(a) && isNil(b)) + return 0; + if (isNil(a)) + return 1; + if (isNil(b)) + return -1; + a = toLowerCase.call(a); + b = toLowerCase.call(b); + if (a < b) + return -1; + if (a > b) + return 1; + return 0; +} +function argumentsToValue(fn) { + return function (...args) { return fn.call(this, ...args.map(toValue)); }; +} +function argumentsToNumber(fn) { + return function (...args) { return fn.call(this, ...args.map(toNumber)); }; +} +/** Return an array containing unique elements from _array_. Works with nested arrays and objects. */ +function* strictUniq(array) { + const seen = new Set(); + for (const element of array) { + const key = JSON.stringify(element); + if (!seen.has(key)) { + seen.add(key); + yield element; + } + } +} + +/** + * targeting ES5, extends Error won't create a proper prototype chain, need a trait to keep track of classes + */ +const TRAIT = '__liquidClass__'; +class LiquidError extends Error { + constructor(err, token) { + /** + * note: for ES5 targeting, `this` will be replaced by return value of Error(), + * thus everything on `this` will be lost, avoid calling `LiquidError` methods here + */ + super(typeof err === 'string' ? err : err.message); + this.context = ''; + if (typeof err !== 'string') + Object.defineProperty(this, 'originalError', { value: err, enumerable: false }); + Object.defineProperty(this, 'token', { value: token, enumerable: false }); + Object.defineProperty(this, TRAIT, { value: 'LiquidError', enumerable: false }); + } + update() { + Object.defineProperty(this, 'context', { value: mkContext(this.token), enumerable: false }); + this.message = mkMessage(this.message, this.token); + this.stack = this.message + '\n' + this.context + + '\n' + this.stack; + if (this.originalError) + this.stack += '\nFrom ' + this.originalError.stack; + } + static is(obj) { + return (obj === null || obj === void 0 ? void 0 : obj[TRAIT]) === 'LiquidError'; + } +} +class TokenizationError extends LiquidError { + constructor(message, token) { + super(message, token); + this.name = 'TokenizationError'; + super.update(); + } +} +class ParseError extends LiquidError { + constructor(err, token) { + super(err, token); + this.name = 'ParseError'; + this.message = err.message; + super.update(); + } +} +class RenderError extends LiquidError { + constructor(err, tpl) { + super(err, tpl.token); + this.name = 'RenderError'; + this.message = err.message; + super.update(); + } + static is(obj) { + return obj.name === 'RenderError'; + } +} +class LiquidErrors extends LiquidError { + constructor(errors) { + super(errors[0], errors[0].token); + this.errors = errors; + this.name = 'LiquidErrors'; + const s = errors.length > 1 ? 's' : ''; + this.message = `${errors.length} error${s} found`; + super.update(); + } + static is(obj) { + return obj.name === 'LiquidErrors'; + } +} +class UndefinedVariableError extends LiquidError { + constructor(err, token) { + super(err, token); + this.name = 'UndefinedVariableError'; + this.message = err.message; + super.update(); + } +} +// only used internally; raised where we don't have token information, +// so it can't be an UndefinedVariableError. +class InternalUndefinedVariableError extends Error { + constructor(variableName) { + super(`undefined variable: ${variableName}`); + this.name = 'InternalUndefinedVariableError'; + this.variableName = variableName; + } +} +class AssertionError extends Error { + constructor(message) { + super(message); + this.name = 'AssertionError'; + this.message = message + ''; + } +} +function mkContext(token) { + const [line, col] = token.getPosition(); + const lines = token.input.split('\n'); + const begin = Math.max(line - 2, 1); + const end = Math.min(line + 3, lines.length); + const context = range(begin, end + 1) + .map(lineNumber => { + const rowIndicator = (lineNumber === line) ? '>> ' : ' '; + const num = padStart(String(lineNumber), String(end).length); + let text = `${rowIndicator}${num}| `; + const colIndicator = lineNumber === line + ? '\n' + padStart('^', col + text.length) + : ''; + text += lines[lineNumber - 1]; + text += colIndicator; + return text; + }) + .join('\n'); + return context; +} +function mkMessage(msg, token) { + if (token.file) + msg += `, file:${token.file}`; + const [line, col] = token.getPosition(); + msg += `, line:${line}, col:${col}`; + return msg; +} + +// **DO NOT CHANGE THIS FILE** +// +// This file is generated by bin/character-gen.js +// bitmask character types to boost performance +const TYPES = [0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 4, 4, 4, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 8, 0, 0, 0, 0, 8, 0, 0, 0, 64, 0, 65, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 0, 0, 2, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]; +const WORD = 1; +const BLANK = 4; +const QUOTE = 8; +const INLINE_BLANK = 16; +const NUMBER = 32; +const SIGN = 64; +const PUNCTUATION = 128; +function isWord(char) { + const code = char.charCodeAt(0); + return code >= 128 ? !TYPES[code] : !!(TYPES[code] & WORD); +} +TYPES[160] = TYPES[5760] = TYPES[6158] = TYPES[8192] = TYPES[8193] = TYPES[8194] = TYPES[8195] = TYPES[8196] = TYPES[8197] = TYPES[8198] = TYPES[8199] = TYPES[8200] = TYPES[8201] = TYPES[8202] = TYPES[8232] = TYPES[8233] = TYPES[8239] = TYPES[8287] = TYPES[12288] = BLANK; +TYPES[8220] = TYPES[8221] = PUNCTUATION; + +function assert(predicate, message) { + if (!predicate) { + const msg = typeof message === 'function' + ? message() + : (message || `expect ${predicate} to be true`); + throw new AssertionError(msg); + } +} +function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate)}`) { + assert(!predicate, message); +} + +class NullDrop extends Drop { + equals(value) { + return isNil(toValue(value)); + } + gt() { + return false; + } + geq() { + return false; + } + lt() { + return false; + } + leq() { + return false; + } + valueOf() { + return null; + } +} + +class EmptyDrop extends Drop { + equals(value) { + if (value instanceof EmptyDrop) + return false; + value = toValue(value); + if (isString(value) || isArray(value)) + return value.length === 0; + if (isObject(value)) + return Object.keys(value).length === 0; + return false; + } + gt() { + return false; + } + geq() { + return false; + } + lt() { + return false; + } + leq() { + return false; + } + valueOf() { + return ''; + } + static is(value) { + return value instanceof EmptyDrop; + } +} + +class BlankDrop extends EmptyDrop { + equals(value) { + if (value === false) + return true; + if (isNil(toValue(value))) + return true; + if (isString(value)) + return /^\s*$/.test(value); + return super.equals(value); + } + static is(value) { + return value instanceof BlankDrop; + } +} + +class ForloopDrop extends Drop { + constructor(length, collection, variable) { + super(); + this.i = 0; + this.length = length; + this.name = `${variable}-${collection}`; + } + next() { + this.i++; + } + index0() { + return this.i; + } + index() { + return this.i + 1; + } + first() { + return this.i === 0; + } + last() { + return this.i === this.length - 1; + } + rindex() { + return this.length - this.i; + } + rindex0() { + return this.length - this.i - 1; + } + valueOf() { + return JSON.stringify(this); + } +} + +class SimpleEmitter { + constructor() { + this.buffer = ''; + } + write(html) { + this.buffer += stringify(html); + } +} + +class StreamedEmitter { + constructor() { + this.buffer = ''; + this.stream = new PassThrough(); + } + write(html) { + this.stream.write(stringify(html)); + } + error(err) { + this.stream.emit('error', err); + } + end() { + this.stream.end(); + } +} + +class KeepingTypeEmitter { + constructor() { + this.buffer = ''; + } + write(html) { + html = toValue(html); + // This will only preserve the type if the value is isolated. + // I.E: + // {{ my-port }} -> 42 + // {{ my-host }}:{{ my-port }} -> 'host:42' + if (typeof html !== 'string' && this.buffer === '') { + this.buffer = html; + } + else { + this.buffer = stringify(this.buffer) + stringify(html); + } + } +} + +class BlockDrop extends Drop { + constructor( + // the block render from layout template + superBlockRender = () => '') { + super(); + this.superBlockRender = superBlockRender; + } + /** + * Provide parent access in child block by + * {{ block.super }} + */ + *super() { + const emitter = new SimpleEmitter(); + yield this.superBlockRender(emitter); + return emitter.buffer; + } +} + +function isComparable(arg) { + return (arg && + isFunction(arg.equals) && + isFunction(arg.gt) && + isFunction(arg.geq) && + isFunction(arg.lt) && + isFunction(arg.leq)); +} + +const nil = new NullDrop(); +const literalValues = { + 'true': true, + 'false': false, + 'nil': nil, + 'null': nil, + 'empty': new EmptyDrop(), + 'blank': new BlankDrop() +}; + +// Tries are built once per input object and reused: the Tokenizer rebuilds them +// on every instantiation, but `input` (operators/literalValues) is a stable +// reference. WeakMap-keying by `input` lets short-lived operator objects (and +// their tries) be garbage collected. The returned trie is treated as read-only +// by callers (matchTrie only reads it); do not mutate it. +const trieCache = new WeakMap(); +function createTrie(input) { + const cached = trieCache.get(input); + if (cached) + return cached; + const trie = {}; + for (const [name, data] of Object.entries(input)) { + let node = trie; + for (let i = 0; i < name.length; i++) { + const c = name[i]; + node[c] = node[c] || {}; + if (i === name.length - 1 && isWord(name[i])) { + node[c].needBoundary = true; + } + node = node[c]; + } + node.data = data; + node.end = true; + } + trieCache.set(input, trie); + return trie; +} + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function toLiquidAsync(asyncFn, syncFn) { + const syncImpl = syncFn || asyncFn; + return (sync, ...args) => { + return sync ? syncImpl(...args) : asyncFn(...args); + }; +} +// convert an async iterator to a Promise +function toPromise(val) { + return __awaiter(this, void 0, void 0, function* () { + if (!isIterator(val)) + return val; + let value; + let done = false; + let next = 'next'; + do { + const state = val[next](value); + done = !!state.done; + value = state.value; + next = 'next'; + try { + if (isIterator(value)) + value = toPromise(value); + if (isPromise(value)) + value = yield value; + } + catch (err) { + next = 'throw'; + value = err; + } + } while (!done); + return value; + }); +} +// convert an async iterator to a value in a synchronous manner +function toValueSync(val) { + if (!isIterator(val)) + return val; + let value; + let done = false; + let next = 'next'; + do { + const state = val[next](value); + done = !!state.done; + value = state.value; + next = 'next'; + if (isIterator(value)) { + try { + value = toValueSync(value); + } + catch (err) { + next = 'throw'; + value = err; + } + } + } while (!done); + return value; +} + +const rFormat = /%([-_0^#:]+)?(\d+)?([EO])?(.)/; +// prototype extensions +function daysInMonth(d) { + const feb = isLeapYear(d) ? 29 : 28; + return [31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +} +function getDayOfYear(d) { + let num = 0; + for (let i = 0; i < d.getMonth(); ++i) { + num += daysInMonth(d)[i]; + } + return num + d.getDate(); +} +function getWeekOfYear(d, startDay) { + // Skip to startDay of this week + const now = getDayOfYear(d) + (startDay - d.getDay()); + // Find the first startDay of the year + const jan1 = new Date(d.getFullYear(), 0, 1); + const then = (7 - jan1.getDay() + startDay); + return String(Math.floor((now - then) / 7) + 1); +} +function isLeapYear(d) { + const year = d.getFullYear(); + return !!((year & 3) === 0 && (year % 100 || (year % 400 === 0 && year))); +} +function ordinal(d) { + const date = d.getDate(); + if ([11, 12, 13].includes(date)) + return 'th'; + switch (date % 10) { + case 1: return 'st'; + case 2: return 'nd'; + case 3: return 'rd'; + default: return 'th'; + } +} +function century(d) { + return parseInt(d.getFullYear().toString().substring(0, 2), 10); +} +// default to 0 +const padWidths = { + d: 2, + e: 2, + H: 2, + I: 2, + j: 3, + k: 2, + l: 2, + L: 3, + m: 2, + M: 2, + S: 2, + U: 2, + W: 2 +}; +const padSpaceChars = new Set('aAbBceklpP'); +function getTimezoneOffset(d, opts) { + const nOffset = Math.abs(d.getTimezoneOffset()); + const h = Math.floor(nOffset / 60); + const m = nOffset % 60; + return (d.getTimezoneOffset() > 0 ? '-' : '+') + + padStart(h, 2, '0') + + (opts.flags[':'] ? ':' : '') + + padStart(m, 2, '0'); +} +const formatCodes = { + a: (d) => d.getShortWeekdayName(), + A: (d) => d.getLongWeekdayName(), + b: (d) => d.getShortMonthName(), + B: (d) => d.getLongMonthName(), + c: (d) => d.toLocaleString(), + C: (d) => century(d), + d: (d) => d.getDate(), + e: (d) => d.getDate(), + H: (d) => d.getHours(), + I: (d) => String(d.getHours() % 12 || 12), + j: (d) => getDayOfYear(d), + k: (d) => d.getHours(), + l: (d) => String(d.getHours() % 12 || 12), + L: (d) => d.getMilliseconds(), + m: (d) => d.getMonth() + 1, + M: (d) => d.getMinutes(), + N: (d, opts) => { + var _a; + const width = Number(opts.width) || 9; + const str = padStart(String(d.getMilliseconds()), 3, '0').slice(0, width); + (_a = opts.memoryLimit) === null || _a === void 0 ? void 0 : _a.use(width - str.length); + return padEnd(str, width, '0'); + }, + p: (d) => (d.getHours() < 12 ? 'AM' : 'PM'), + P: (d) => (d.getHours() < 12 ? 'am' : 'pm'), + q: (d) => ordinal(d), + s: (d) => Math.round(d.getTime() / 1000), + S: (d) => d.getSeconds(), + u: (d) => d.getDay() || 7, + U: (d) => getWeekOfYear(d, 0), + w: (d) => d.getDay(), + W: (d) => getWeekOfYear(d, 1), + x: (d) => d.toLocaleDateString(), + X: (d) => d.toLocaleTimeString(), + y: (d) => d.getFullYear().toString().slice(2, 4), + Y: (d) => d.getFullYear(), + z: getTimezoneOffset, + Z: (d, opts) => d.getTimeZoneName() || getTimezoneOffset(d, opts), + 't': () => '\t', + 'n': () => '\n', + '%': () => '%' +}; +formatCodes.h = formatCodes.b; +function strftime(d, formatStr, memoryLimit) { + let output = ''; + let remaining = formatStr; + let match; + while ((match = rFormat.exec(remaining))) { + output += remaining.slice(0, match.index); + remaining = remaining.slice(match.index + match[0].length); + output += format(d, match, memoryLimit); + } + return output + remaining; +} +function format(d, match, memoryLimit) { + const [input, flagStr = '', width, modifier, conversion] = match; + const convert = formatCodes[conversion]; + if (!convert) + return input; + const flags = {}; + for (const flag of flagStr) + flags[flag] = true; + let ret = String(convert(d, { flags, width, modifier, memoryLimit })); + let padChar = padSpaceChars.has(conversion) ? ' ' : '0'; + let padWidth = Number(width) || padWidths[conversion] || 0; + if (flags['^']) + ret = ret.toUpperCase(); + else if (flags['#']) + ret = changeCase(ret); + if (flags['_']) + padChar = ' '; + else if (flags['0']) + padChar = '0'; + if (flags['-']) + padWidth = 0; + memoryLimit === null || memoryLimit === void 0 ? void 0 : memoryLimit.use(Number(padWidth) - ret.length); + return padStart(ret, padWidth, padChar); +} + +function getDateTimeFormat() { + return (typeof Intl !== 'undefined' ? Intl.DateTimeFormat : undefined); +} + +// one minute in milliseconds +const OneMinute = 60000; +/** + * Need support both ISO8601 and RFC2822 as in major browsers & NodeJS + * RFC2822: https://datatracker.ietf.org/doc/html/rfc2822#section-3.3 + */ +const TIMEZONE_PATTERN = /([zZ]|([+-])(\d{2}):?(\d{2}))$/; +const monthNames = [ + 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', + 'September', 'October', 'November', 'December' +]; +const monthNamesShort = monthNames.map(name => name.slice(0, 3)); +const dayNames = [ + 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' +]; +const dayNamesShort = dayNames.map(name => name.slice(0, 3)); +/** + * A date implementation with timezone info, just like Ruby date + * + * Implementation: + * - create a Date offset by it's timezone difference, avoiding overriding a bunch of methods + * - rewrite getTimezoneOffset() to trick strftime + */ +class LiquidDate { + constructor(init, locale, timezone) { + this.locale = locale; + this.DateTimeFormat = getDateTimeFormat(); + this.date = new Date(init); + this.timezoneFixed = timezone !== undefined; + if (timezone === undefined) { + timezone = this.date.getTimezoneOffset(); + } + this.timezoneOffset = isString(timezone) ? LiquidDate.getTimezoneOffset(timezone, this.date) : timezone; + this.timezoneName = isString(timezone) ? timezone : ''; + const diff = (this.date.getTimezoneOffset() - this.timezoneOffset) * OneMinute; + const time = this.date.getTime() + diff; + this.displayDate = new Date(time); + } + getTime() { + return this.displayDate.getTime(); + } + getMilliseconds() { + return this.displayDate.getMilliseconds(); + } + getSeconds() { + return this.displayDate.getSeconds(); + } + getMinutes() { + return this.displayDate.getMinutes(); + } + getHours() { + return this.displayDate.getHours(); + } + getDay() { + return this.displayDate.getDay(); + } + getDate() { + return this.displayDate.getDate(); + } + getMonth() { + return this.displayDate.getMonth(); + } + getFullYear() { + return this.displayDate.getFullYear(); + } + toLocaleString(locale, init) { + if (init === null || init === void 0 ? void 0 : init.timeZone) { + return this.date.toLocaleString(locale, init); + } + return this.displayDate.toLocaleString(locale, init); + } + toLocaleTimeString(locale) { + return this.displayDate.toLocaleTimeString(locale); + } + toLocaleDateString(locale) { + return this.displayDate.toLocaleDateString(locale); + } + getTimezoneOffset() { + return this.timezoneOffset; + } + getTimeZoneName() { + if (this.timezoneFixed) + return this.timezoneName; + if (!this.DateTimeFormat) + return; + return this.DateTimeFormat().resolvedOptions().timeZone; + } + getLongMonthName() { + var _a; + return (_a = this.format({ month: 'long' })) !== null && _a !== void 0 ? _a : monthNames[this.getMonth()]; + } + getShortMonthName() { + var _a; + return (_a = this.format({ month: 'short' })) !== null && _a !== void 0 ? _a : monthNamesShort[this.getMonth()]; + } + getLongWeekdayName() { + var _a; + return (_a = this.format({ weekday: 'long' })) !== null && _a !== void 0 ? _a : dayNames[this.displayDate.getDay()]; + } + getShortWeekdayName() { + var _a; + return (_a = this.format({ weekday: 'short' })) !== null && _a !== void 0 ? _a : dayNamesShort[this.displayDate.getDay()]; + } + valid() { + return !isNaN(this.getTime()); + } + format(options) { + return this.DateTimeFormat && this.DateTimeFormat(this.locale, options).format(this.displayDate); + } + /** + * Create a Date object fixed to it's declared Timezone. Both + * - 2021-08-06T02:29:00.000Z and + * - 2021-08-06T02:29:00.000+08:00 + * will always be displayed as + * - 2021-08-06 02:29:00 + * regardless timezoneOffset in JavaScript realm + * + * The implementation hack: + * Instead of calling `.getMonth()`/`.getUTCMonth()` respect to `preserveTimezones`, + * we create a different Date to trick strftime, it's both simpler and more performant. + * Given that a template is expected to be parsed fewer times than rendered. + */ + static createDateFixedToTimezone(dateString, locale) { + const m = dateString.match(TIMEZONE_PATTERN); + // representing a UTC timestamp + if (m && m[1] === 'Z') { + return new LiquidDate(+new Date(dateString), locale, 0); + } + // has a timezone specified + if (m && m[2] && m[3] && m[4]) { + const [, , sign, hours, minutes] = m; + const offset = (sign === '+' ? -1 : 1) * (parseInt(hours, 10) * 60 + parseInt(minutes, 10)); + return new LiquidDate(+new Date(dateString), locale, offset); + } + return new LiquidDate(dateString, locale); + } + static getTimezoneOffset(timezoneName, date) { + const localDateString = date.toLocaleString('en-US', { timeZone: timezoneName }); + const utcDateString = date.toLocaleString('en-US', { timeZone: 'UTC' }); + const localDate = new Date(localDateString); + const utcDate = new Date(utcDateString); + return (+utcDate - +localDate) / (60 * 1000); + } +} + +class Limiter { + constructor(resource, limit) { + this.base = 0; + this.message = `${resource} limit exceeded`; + this.limit = limit; + } + use(count) { + if (+count > 0) { + assert(this.base + +count <= this.limit, this.message); + this.base += +count; + } + } + check(count) { + if (+count > 0) { + assert(+count <= this.limit, this.message); + } + } +} + +class DelimitedToken extends Token { + constructor(kind, [contentBegin, contentEnd], input, begin, end, trimLeft, trimRight, file) { + super(kind, input, begin, end, file); + this.trimLeft = false; + this.trimRight = false; + const tl = input[contentBegin] === '-'; + const tr = input[contentEnd - 1] === '-'; + let l = tl ? contentBegin + 1 : contentBegin; + let r = tr ? contentEnd - 1 : contentEnd; + while (l < r && (TYPES[input.charCodeAt(l)] & BLANK)) + l++; + while (r > l && (TYPES[input.charCodeAt(r - 1)] & BLANK)) + r--; + this.contentRange = [l, r]; + this.trimLeft = tl || trimLeft; + this.trimRight = tr || trimRight; + } + get content() { + return this.input.slice(this.contentRange[0], this.contentRange[1]); + } +} + +class TagToken extends DelimitedToken { + constructor(input, begin, end, options, file) { + const { trimTagLeft, trimTagRight, tagDelimiterLeft, tagDelimiterRight } = options; + const [valueBegin, valueEnd] = [begin + tagDelimiterLeft.length, end - tagDelimiterRight.length]; + super(TokenKind.Tag, [valueBegin, valueEnd], input, begin, end, trimTagLeft, trimTagRight, file); + this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange); + this.name = this.tokenizer.readTagName(); + this.tokenizer.assert(this.name, `illegal tag syntax, tag name expected`); + this.tokenizer.skipBlank(); + this.args = this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]); + } +} + +class OutputToken extends DelimitedToken { + constructor(input, begin, end, options, file) { + const { trimOutputLeft, trimOutputRight, outputDelimiterLeft, outputDelimiterRight } = options; + const valueRange = [begin + outputDelimiterLeft.length, end - outputDelimiterRight.length]; + super(TokenKind.Output, valueRange, input, begin, end, trimOutputLeft, trimOutputRight, file); + } +} + +class HTMLToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.HTML, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.trimLeft = 0; + this.trimRight = 0; + } + getContent() { + return this.input.slice(this.begin + this.trimLeft, this.end - this.trimRight); + } +} + +class NumberToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.Number, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.content = Number(this.getText()); + } +} + +class IdentifierToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.Word, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.content = this.getText(); + } +} + +class LiteralToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.Literal, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.literal = this.getText(); + this.content = literalValues[this.literal]; + } +} + +const operatorPrecedences = { + '==': 2, + '!=': 2, + '>': 2, + '<': 2, + '>=': 2, + '<=': 2, + 'contains': 2, + 'not': 1, + 'and': 0, + 'or': 0 +}; +const operatorTypes = { + '==': 0 /* OperatorType.Binary */, + '!=': 0 /* OperatorType.Binary */, + '>': 0 /* OperatorType.Binary */, + '<': 0 /* OperatorType.Binary */, + '>=': 0 /* OperatorType.Binary */, + '<=': 0 /* OperatorType.Binary */, + 'contains': 0 /* OperatorType.Binary */, + 'not': 1 /* OperatorType.Unary */, + 'and': 0 /* OperatorType.Binary */, + 'or': 0 /* OperatorType.Binary */ +}; +class OperatorToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.Operator, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.operator = this.getText(); + } + getPrecedence() { + return this.operator in operatorPrecedences ? operatorPrecedences[this.operator] : 1; + } +} + +class PropertyAccessToken extends Token { + constructor(variable, props, input, begin, end, file) { + super(TokenKind.PropertyAccess, input, begin, end, file); + this.variable = variable; + this.props = props; + } +} + +class FilterToken extends Token { + constructor(name, args, input, begin, end, file) { + super(TokenKind.Filter, input, begin, end, file); + this.name = name; + this.args = args; + } +} + +class HashToken extends Token { + constructor(input, begin, end, name, value, file) { + super(TokenKind.Hash, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.name = name; + this.value = value; + this.file = file; + } +} + +const rHex = /[\da-fA-F]/; +const rOct = /[0-7]/; +const escapeChar = { + b: '\b', + f: '\f', + n: '\n', + r: '\r', + t: '\t', + v: '\x0B' +}; +function hexVal(c) { + const code = c.charCodeAt(0); + if (code >= 97) + return code - 87; + if (code >= 65) + return code - 55; + return code - 48; +} +function parseStringLiteral(str) { + let ret = ''; + for (let i = 1; i < str.length - 1; i++) { + if (str[i] !== '\\') { + ret += str[i]; + continue; + } + if (escapeChar[str[i + 1]] !== undefined) { + ret += escapeChar[str[++i]]; + } + else if (str[i + 1] === 'u') { + let val = 0; + let j = i + 2; + while (j <= i + 5 && rHex.test(str[j])) { + val = val * 16 + hexVal(str[j++]); + } + i = j - 1; + ret += String.fromCharCode(val); + } + else if (!rOct.test(str[i + 1])) { + ret += str[++i]; + } + else { + let j = i + 1; + let val = 0; + while (j <= i + 3 && rOct.test(str[j])) { + val = val * 8 + hexVal(str[j++]); + } + i = j - 1; + ret += String.fromCharCode(val); + } + } + return ret; +} + +class QuotedToken extends Token { + constructor(input, begin, end, file) { + super(TokenKind.Quoted, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + this.content = parseStringLiteral(this.getText()); + } +} + +class RangeToken extends Token { + constructor(input, begin, end, lhs, rhs, file) { + super(TokenKind.Range, input, begin, end, file); + this.input = input; + this.begin = begin; + this.end = end; + this.lhs = lhs; + this.rhs = rhs; + this.file = file; + } +} + +/** + * LiquidTagToken is different from TagToken by not having delimiters `{%` or `%}` + */ +class LiquidTagToken extends DelimitedToken { + constructor(input, begin, end, options, file) { + super(TokenKind.Tag, [begin, end], input, begin, end, false, false, file); + this.tokenizer = new Tokenizer(input, options.operators, file, this.contentRange); + this.name = this.tokenizer.readTagName(); + this.tokenizer.assert(this.name, 'illegal liquid tag syntax'); + this.tokenizer.skipBlank(); + } + get args() { + return this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]); + } +} + +/** + * value expression with optional filters + * e.g. + * {% assign foo="bar" | append: "coo" %} + */ +class FilteredValueToken extends Token { + constructor(initial, filters, input, begin, end, file) { + super(TokenKind.FilteredValue, input, begin, end, file); + this.initial = initial; + this.filters = filters; + this.input = input; + this.begin = begin; + this.end = end; + this.file = file; + } +} + +const polyfill = { + now: () => Date.now() +}; +function getPerformance() { + return (typeof global === 'object' && global.performance) || + (typeof window === 'object' && window.performance) || + polyfill; +} + +class Render { + renderTemplatesToNodeStream(templates, ctx) { + const emitter = new StreamedEmitter(); + Promise.resolve().then(() => toPromise(this.renderTemplates(templates, ctx, emitter))) + .then(() => emitter.end(), err => emitter.error(err)); + return emitter.stream; + } + *renderTemplates(templates, ctx, emitter) { + if (!emitter) { + emitter = ctx.opts.keepOutputType ? new KeepingTypeEmitter() : new SimpleEmitter(); + } + ctx.renderLimit.check(getPerformance().now()); + const errors = []; + for (const tpl of templates) { + ctx.renderLimit.check(getPerformance().now()); + try { + // if tpl.render supports emitter, it'll return empty `html` + const html = yield tpl.render(ctx, emitter); + // if not, it'll return an `html`, write to the emitter for it + html && emitter.write(html); + if (ctx.breakCalled || ctx.continueCalled) + break; + } + catch (e) { + const err = LiquidError.is(e) ? e : new RenderError(e, tpl); + if (ctx.opts.catchAllErrors) + errors.push(err); + else + throw err; + } + } + if (errors.length) { + throw new LiquidErrors(errors); + } + return emitter.buffer; + } +} + +class Expression { + constructor(tokens) { + this.postfix = [...toPostfix(tokens)]; + } + *evaluate(ctx, lenient) { + assert(ctx, 'unable to evaluate: context not defined'); + const operands = []; + for (const token of this.postfix) { + if (isOperatorToken(token)) { + const r = operands.pop(); + let result; + if (operatorTypes[token.operator] === 1 /* OperatorType.Unary */) { + result = yield ctx.opts.operators[token.operator](r, ctx); + } + else { + const l = operands.pop(); + result = yield ctx.opts.operators[token.operator](l, r, ctx); + } + operands.push(result); + } + else { + operands.push(yield evalToken(token, ctx, lenient)); + } + } + return operands[0]; + } + valid() { + return !!this.postfix.length; + } +} +function* evalToken(token, ctx, lenient = false) { + if (!token) + return; + if ('content' in token) + return token.content; + if (isPropertyAccessToken(token)) + return yield evalPropertyAccessToken(token, ctx, lenient); + if (isRangeToken(token)) + return yield evalRangeToken(token, ctx); +} +function* evalPropertyAccessToken(token, ctx, lenient) { + const props = []; + for (const prop of token.props) { + props.push((yield evalToken(prop, ctx, false))); + } + try { + if (token.variable) { + const variable = yield evalToken(token.variable, ctx, lenient); + return yield ctx._getFromScope(variable, props); + } + else { + return yield ctx._get(props); + } + } + catch (e) { + if (lenient && e.name === 'InternalUndefinedVariableError') + return null; + throw (new UndefinedVariableError(e, token)); + } +} +function evalQuotedToken(token) { + return token.content; +} +function* evalRangeToken(token, ctx) { + const low = yield evalToken(token.lhs, ctx); + const high = yield evalToken(token.rhs, ctx); + ctx.memoryLimit.use(high - low + 1); + return range(+low, +high + 1); +} +function* toPostfix(tokens) { + const ops = []; + for (const token of tokens) { + if (isOperatorToken(token)) { + while (ops.length && ops[ops.length - 1].getPrecedence() > token.getPrecedence()) { + yield ops.pop(); + } + ops.push(token); + } + else + yield token; + } + while (ops.length) { + yield ops.pop(); + } +} + +function isTruthy(val, ctx) { + return !isFalsy(val, ctx); +} +function isFalsy(val, ctx) { + val = toValue(val); + if (ctx.opts.jsTruthy) { + return !val; + } + else { + return val === false || undefined === val || val === null; + } +} + +const defaultOperators = { + '==': equals, + '!=': (l, r) => !equals(l, r), + '>': (l, r) => { + if (isComparable(l)) + return l.gt(r); + if (isComparable(r)) + return r.lt(l); + return toValue(l) > toValue(r); + }, + '<': (l, r) => { + if (isComparable(l)) + return l.lt(r); + if (isComparable(r)) + return r.gt(l); + return toValue(l) < toValue(r); + }, + '>=': (l, r) => { + if (isComparable(l)) + return l.geq(r); + if (isComparable(r)) + return r.leq(l); + return toValue(l) >= toValue(r); + }, + '<=': (l, r) => { + if (isComparable(l)) + return l.leq(r); + if (isComparable(r)) + return r.geq(l); + return toValue(l) <= toValue(r); + }, + 'contains': (l, r) => { + l = toValue(l); + if (isArray(l)) + return l.some((i) => equals(i, r)); + if (isFunction(l === null || l === void 0 ? void 0 : l.indexOf)) + return l.indexOf(toValue(r)) > -1; + return false; + }, + 'not': (v, ctx) => isFalsy(toValue(v), ctx), + 'and': (l, r, ctx) => isTruthy(toValue(l), ctx) && isTruthy(toValue(r), ctx), + 'or': (l, r, ctx) => isTruthy(toValue(l), ctx) || isTruthy(toValue(r), ctx) +}; +function equals(lhs, rhs) { + if (isComparable(lhs)) + return lhs.equals(rhs); + if (isComparable(rhs)) + return rhs.equals(lhs); + lhs = toValue(lhs); + rhs = toValue(rhs); + if (isArray(lhs)) { + return isArray(rhs) && arrayEquals(lhs, rhs); + } + return lhs === rhs; +} +function arrayEquals(lhs, rhs) { + if (lhs.length !== rhs.length) + return false; + return !lhs.some((value, i) => !equals(value, rhs[i])); +} +function arrayIncludes(arr, item) { + return arr.some(value => equals(value, item)); +} + +class Node { + constructor(key, value, next, prev) { + this.key = key; + this.value = value; + this.next = next; + this.prev = prev; + } +} +class LRU { + constructor(limit, size = 0) { + this.limit = limit; + this.size = size; + this.cache = {}; + this.head = new Node('HEAD', null, null, null); + this.tail = new Node('TAIL', null, null, null); + this.head.next = this.tail; + this.tail.prev = this.head; + } + write(key, value) { + if (this.cache[key]) { + this.cache[key].value = value; + } + else { + const node = new Node(key, value, this.head.next, this.head); + this.head.next.prev = node; + this.head.next = node; + this.cache[key] = node; + this.size++; + this.ensureLimit(); + } + } + read(key) { + if (!this.cache[key]) + return; + const { value } = this.cache[key]; + this.remove(key); + this.write(key, value); + return value; + } + remove(key) { + const node = this.cache[key]; + node.prev.next = node.next; + node.next.prev = node.prev; + delete this.cache[key]; + this.size--; + } + clear() { + this.head.next = this.tail; + this.tail.prev = this.head; + this.size = 0; + this.cache = {}; + } + ensureLimit() { + if (this.size > this.limit) + this.remove(this.tail.prev.key); + } +} + +function requireResolve (file) { + const require = createRequire(process.cwd() + '/'); + return require.resolve(file) +} + +const statAsync = promisify(stat); +const readFileAsync = promisify(readFile$1); +function exists(filepath) { + return __awaiter(this, void 0, void 0, function* () { + try { + yield statAsync(filepath); + return true; + } + catch (err) { + return false; + } + }); +} +function readFile(filepath) { + return readFileAsync(filepath, 'utf8'); +} +function existsSync(filepath) { + try { + statSync(filepath); + return true; + } + catch (err) { + return false; + } +} +function readFileSync(filepath) { + return readFileSync$1(filepath, 'utf8'); +} +function resolve(root, file, ext) { + if (!extname(file)) + file += ext; + return resolve$1(root, file); +} +function fallback(file) { + try { + return requireResolve(file); + } + catch (e) { } +} +function dirname(filepath) { + return dirname$1(filepath); +} +const realpathAsync = promisify(realpath); +function contains(root, file) { + return __awaiter(this, void 0, void 0, function* () { + try { + const realRoot = yield realpathAsync(root); + const realFile = yield realpathAsync(file); + const prefix = realRoot.endsWith(sep) ? realRoot : realRoot + sep; + return realFile.startsWith(prefix); + } + catch (_a) { + return false; + } + }); +} +function containsSync(root, file) { + try { + const realRoot = realpathSync(root); + const realFile = realpathSync(file); + const prefix = realRoot.endsWith(sep) ? realRoot : realRoot + sep; + return realFile.startsWith(prefix); + } + catch (_a) { + return false; + } +} + +var fs = /*#__PURE__*/Object.freeze({ + __proto__: null, + exists: exists, + readFile: readFile, + existsSync: existsSync, + readFileSync: readFileSync, + resolve: resolve, + fallback: fallback, + dirname: dirname, + contains: contains, + containsSync: containsSync, + sep: sep +}); + +function chargeJsonReplacerValue(memoryLimit, val) { + if (typeof val === 'string') { + memoryLimit.use(val.length); + } + else if (val === null || typeof val === 'number' || typeof val === 'boolean') { + memoryLimit.use(JSON.stringify(val).length); + } + else if (Array.isArray(val)) { + memoryLimit.use(val.length + 1); + } + else if (typeof val === 'object') { + memoryLimit.use(2); + } +} +function defaultFilter(value, defaultValue, ...args) { + value = toValue(value); + if (isArray(value) || isString(value)) + return value.length ? value : defaultValue; + if (value === false && (new Map(args)).get('allow_false')) + return false; + return isFalsy(value, this.context) ? defaultValue : value; +} +function json(value, space = 0) { + const memoryLimit = this.context.memoryLimit; + return JSON.stringify(value, (_key, val) => { + chargeJsonReplacerValue(memoryLimit, val); + return val; + }, space); +} +function inspect(value, space = 0) { + const memoryLimit = this.context.memoryLimit; + const ancestors = []; + return JSON.stringify(value, function (_key, value) { + if (typeof value !== 'object' || value === null) { + chargeJsonReplacerValue(memoryLimit, value); + return value; + } + // `this` is the object that value is contained in, i.e., its direct parent. + while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) + ancestors.pop(); + if (ancestors.includes(value)) { + memoryLimit.use('[Circular]'.length); + return '[Circular]'; + } + ancestors.push(value); + chargeJsonReplacerValue(memoryLimit, value); + return value; + }, space); +} +function to_integer(value) { + return Number(value); +} +const raw = { + raw: true, + handler: identify +}; +var misc = { + default: defaultFilter, + raw, + jsonify: json, + to_integer, + json, + inspect +}; + +const escapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' +}; +const unescapeMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': "'" +}; +function escape(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.replace(/&|<|>|"|'/g, m => escapeMap[m]); +} +function xml_escape(str) { + return escape.call(this, str); +} +function unescape(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.replace(/&(amp|lt|gt|#34|#39);/g, m => unescapeMap[m]); +} +function escape_once(str) { + return escape.call(this, unescape.call(this, str)); +} +function newline_to_br(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\r?\n/gm, '
\n'); +} +// Raw-text blocks (HTML5) plus '<...>' as the catch-all kind; a regex +// equivalent is O(n^2) in V8 on unclosed openers. +function strip_html(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + const blocks = new Map([[''], [''], [''], ['<', '>']]); + let out = ''; + let i = 0; + while (i < str.length) { + const lt = str.indexOf('<', i); + if (lt < 0) + return out + str.slice(i); + out += str.slice(i, lt); + for (const [opener, closer] of blocks) { + if (!str.startsWith(opener, lt)) + continue; + const e = str.indexOf(closer, lt + opener.length); + if (e >= 0) { + i = e + closer.length; + break; + } + blocks.delete(opener); + } + if (i <= lt) + return out + str.slice(lt); + } + return out; +} + +var htmlFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + escape: escape, + xml_escape: xml_escape, + escape_once: escape_once, + newline_to_br: newline_to_br, + strip_html: strip_html +}); + +class MapFS { + constructor(mapping) { + this.mapping = mapping; + this.sep = '/'; + } + exists(filepath) { + return __awaiter(this, void 0, void 0, function* () { + return this.existsSync(filepath); + }); + } + existsSync(filepath) { + return !isNil(this.mapping[filepath]); + } + readFile(filepath) { + return __awaiter(this, void 0, void 0, function* () { + return this.readFileSync(filepath); + }); + } + readFileSync(filepath) { + const content = this.mapping[filepath]; + if (isNil(content)) + throw new Error(`ENOENT: ${filepath}`); + return content; + } + dirname(filepath) { + const segments = filepath.split(this.sep); + segments.pop(); + return segments.join(this.sep); + } + resolve(dir, file, ext) { + file += ext; + if (dir === '.') + return file; + const segments = dir.split(/\/+/); + for (const segment of file.split(this.sep)) { + if (segment === '.' || segment === '') + continue; + else if (segment === '..') { + if (segments.length > 1 || segments[0] !== '') + segments.pop(); + } + else + segments.push(segment); + } + return segments.join(this.sep); + } +} + +const defaultOptions = { + root: ['.'], + layouts: ['.'], + partials: ['.'], + relativeReference: true, + jekyllInclude: false, + keyValueSeparator: ':', + cache: undefined, + extname: '', + fs: fs, + dynamicPartials: true, + jsTruthy: false, + dateFormat: '%A, %B %-e, %Y at %-l:%M %P %z', + locale: '', + trimTagRight: false, + trimTagLeft: false, + trimOutputRight: false, + trimOutputLeft: false, + greedy: true, + tagDelimiterLeft: '{%', + tagDelimiterRight: '%}', + outputDelimiterLeft: '{{', + outputDelimiterRight: '}}', + preserveTimezones: false, + strictFilters: false, + strictVariables: false, + ownPropertyOnly: true, + lenientIf: false, + globals: {}, + keepOutputType: false, + operators: defaultOperators, + memoryLimit: Infinity, + parseLimit: Infinity, + renderLimit: Infinity +}; +function normalize(options) { + var _a, _b; + if (options.hasOwnProperty('root')) { + if (!options.hasOwnProperty('partials')) + options.partials = options.root; + if (!options.hasOwnProperty('layouts')) + options.layouts = options.root; + } + if (options.hasOwnProperty('cache')) { + let cache; + if (typeof options.cache === 'number') + cache = options.cache > 0 ? new LRU(options.cache) : undefined; + else if (typeof options.cache === 'object') + cache = options.cache; + else + cache = options.cache ? new LRU(1024) : undefined; + options.cache = cache; + } + options = Object.assign(Object.assign(Object.assign({}, defaultOptions), (options.jekyllInclude ? { dynamicPartials: false } : {})), options); + if ((!options.fs.dirname || !options.fs.sep) && options.relativeReference) { + console.warn('[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning'); + options.relativeReference = false; + } + options.root = normalizeDirectoryList(options.root); + options.partials = normalizeDirectoryList(options.partials); + options.layouts = normalizeDirectoryList(options.layouts); + options.outputEscape = options.outputEscape && getOutputEscapeFunction(options.outputEscape); + if (!options.locale) { + options.locale = (_b = (_a = getDateTimeFormat()) === null || _a === void 0 ? void 0 : _a().resolvedOptions().locale) !== null && _b !== void 0 ? _b : 'en-US'; + } + if (options.templates) { + options.fs = new MapFS(options.templates); + options.relativeReference = true; + options.root = options.partials = options.layouts = '.'; + } + return options; +} +function getOutputEscapeFunction(nameOrFunction) { + if (nameOrFunction === 'escape') + return escape; + if (nameOrFunction === 'json') + return misc.json; + assert(isFunction(nameOrFunction), '`outputEscape` need to be of type string or function'); + return nameOrFunction; +} +function normalizeDirectoryList(value) { + let list = []; + if (isArray(value)) + list = value; + if (isString(value)) + list = [value]; + return list; +} + +function whiteSpaceCtrl(tokens, options) { + let inRaw = false; + for (let i = 0; i < tokens.length; i++) { + const token = tokens[i]; + if (!isDelimitedToken(token)) + continue; + if (!inRaw && token.trimLeft) { + trimLeft(tokens[i - 1], options.greedy); + } + if (isTagToken(token)) { + if (token.name === 'raw') + inRaw = true; + else if (token.name === 'endraw') + inRaw = false; + } + if (!inRaw && token.trimRight) { + trimRight(tokens[i + 1], options.greedy); + } + } +} +function trimLeft(token, greedy) { + if (!token || !isHTMLToken(token)) + return; + const mask = greedy ? BLANK : INLINE_BLANK; + while (TYPES[token.input.charCodeAt(token.end - 1 - token.trimRight)] & mask) + token.trimRight++; +} +function trimRight(token, greedy) { + if (!token || !isHTMLToken(token)) + return; + const mask = greedy ? BLANK : INLINE_BLANK; + while (TYPES[token.input.charCodeAt(token.begin + token.trimLeft)] & mask) + token.trimLeft++; + if (token.input.charAt(token.begin + token.trimLeft) === '\n') + token.trimLeft++; +} + +class Tokenizer { + constructor(input, operators = defaultOptions.operators, file, range) { + this.input = input; + this.file = file; + this.rawBeginAt = -1; + this.p = range ? range[0] : 0; + this.N = range ? range[1] : input.length; + this.opTrie = createTrie(operators); + this.literalTrie = createTrie(literalValues); + } + readExpression() { + return new Expression(this.readExpressionTokens()); + } + *readExpressionTokens() { + while (this.p < this.N) { + const operator = this.readOperator(); + if (operator) { + yield operator; + continue; + } + const operand = this.readValue(); + if (operand) { + yield operand; + continue; + } + return; + } + } + readOperator() { + this.skipBlank(); + const end = this.matchTrie(this.opTrie); + if (end === -1) + return; + return new OperatorToken(this.input, this.p, (this.p = end), this.file); + } + matchTrie(trie) { + let node = trie; + let i = this.p; + let info; + while (node[this.input[i]] && i < this.N) { + node = node[this.input[i++]]; + if (node['end']) + info = node; + } + if (!info) + return -1; + if (info['needBoundary'] && isWord(this.peek(i - this.p))) + return -1; + return i; + } + readFilteredValue() { + const begin = this.p; + const initial = this.readExpression(); + this.assert(initial.valid(), `invalid value expression: ${this.snapshot()}`); + const filters = this.readFilters(); + return new FilteredValueToken(initial, filters, this.input, begin, this.p, this.file); + } + readFilters() { + const filters = []; + while (true) { + const filter = this.readFilter(); + if (!filter) + return filters; + filters.push(filter); + } + } + readFilter() { + this.skipBlank(); + if (this.end()) + return null; + this.assert(this.read() === '|', `expected "|" before filter`); + const name = this.readIdentifier(); + if (!name.size()) { + this.assert(this.end(), `expected filter name`); + return null; + } + const args = []; + this.skipBlank(); + if (this.peek() === ':') { + do { + ++this.p; + const arg = this.readFilterArg(); + arg && args.push(arg); + this.skipBlank(); + this.assert(this.end() || this.peek() === ',' || this.peek() === '|', () => `unexpected character ${this.snapshot()}`); + } while (this.peek() === ','); + } + else if (this.peek() === '|' || this.end()) ; + else { + throw this.error('expected ":" after filter name'); + } + return new FilterToken(name.getText(), args, this.input, name.begin, this.p, this.file); + } + readFilterArg() { + const key = this.readValue(); + if (!key) + return; + this.skipBlank(); + if (this.peek() !== ':') + return key; + ++this.p; + const value = this.readValue(); + return [key.getText(), value]; + } + readTopLevelTokens(options = defaultOptions) { + const tokens = []; + while (this.p < this.N) { + const token = this.readTopLevelToken(options); + tokens.push(token); + } + whiteSpaceCtrl(tokens, options); + return tokens; + } + readTopLevelToken(options) { + const { tagDelimiterLeft, outputDelimiterLeft } = options; + if (this.rawBeginAt > -1) + return this.readEndrawOrRawContent(options); + if (this.match(tagDelimiterLeft)) + return this.readTagToken(options); + if (this.match(outputDelimiterLeft)) + return this.readOutputToken(options); + return this.readHTMLToken([tagDelimiterLeft, outputDelimiterLeft]); + } + readHTMLToken(stopStrings) { + const begin = this.p; + while (this.p < this.N) { + if (stopStrings.some(str => this.match(str))) + break; + ++this.p; + } + return new HTMLToken(this.input, begin, this.p, this.file); + } + readTagToken(options) { + const { file, input } = this; + const begin = this.p; + if (this.readToDelimiter(options.tagDelimiterRight) === -1) { + throw this.error(`tag ${this.snapshot(begin)} not closed`, begin); + } + const token = new TagToken(input, begin, this.p, options, file); + if (token.name === 'raw') + this.rawBeginAt = begin; + return token; + } + readToDelimiter(delimiter, respectQuoted = false) { + this.skipBlank(); + while (this.p < this.N) { + if (respectQuoted && (this.peekType() & QUOTE)) { + this.readQuoted(); + continue; + } + ++this.p; + if (this.rmatch(delimiter)) + return this.p; + } + return -1; + } + readOutputToken(options = defaultOptions) { + const { file, input } = this; + const { outputDelimiterRight } = options; + const begin = this.p; + if (this.readToDelimiter(outputDelimiterRight, true) === -1) { + throw this.error(`output ${this.snapshot(begin)} not closed`, begin); + } + return new OutputToken(input, begin, this.p, options, file); + } + readEndrawOrRawContent(options) { + const { tagDelimiterLeft, tagDelimiterRight } = options; + const begin = this.p; + let leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length; + while (this.p < this.N) { + if (this.readIdentifier().getText() !== 'endraw') { + leftPos = this.readTo(tagDelimiterLeft) - tagDelimiterLeft.length; + continue; + } + while (this.p <= this.N) { + if (this.rmatch(tagDelimiterRight)) { + const end = this.p; + if (begin === leftPos) { + this.rawBeginAt = -1; + return new TagToken(this.input, begin, end, options, this.file); + } + else { + this.p = leftPos; + return new HTMLToken(this.input, begin, leftPos, this.file); + } + } + if (this.rmatch(tagDelimiterLeft)) + break; + this.p++; + } + } + throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, begin); + } + readLiquidTagTokens(options = defaultOptions) { + const tokens = []; + while (this.p < this.N) { + const token = this.readLiquidTagToken(options); + token && tokens.push(token); + } + return tokens; + } + readLiquidTagToken(options) { + this.skipBlank(); + if (this.end()) + return; + const begin = this.p; + this.readToDelimiter('\n'); + const end = this.p; + return new LiquidTagToken(this.input, begin, end, options, this.file); + } + error(msg, pos = this.p) { + return new TokenizationError(msg, new IdentifierToken(this.input, pos, this.N, this.file)); + } + assert(pred, msg, pos) { + if (!pred) + throw this.error(typeof msg === 'function' ? msg() : msg, pos); + } + snapshot(begin = this.p) { + return JSON.stringify(ellipsis(this.input.slice(begin, this.N), 32)); + } + /** + * @deprecated use #readIdentifier instead + */ + readWord() { + return this.readIdentifier(); + } + readIdentifier() { + this.skipBlank(); + const begin = this.p; + while (!this.end() && isWord(this.peek())) + ++this.p; + return new IdentifierToken(this.input, begin, this.p, this.file); + } + readNonEmptyIdentifier() { + const id = this.readIdentifier(); + return id.size() ? id : undefined; + } + readTagName() { + this.skipBlank(); + // Handle inline comment tags + if (this.input[this.p] === '#') + return this.input.slice(this.p, ++this.p); + return this.readIdentifier().getText(); + } + readHashes(jekyllStyle) { + const hashes = []; + while (true) { + const hash = this.readHash(jekyllStyle); + if (!hash) + return hashes; + hashes.push(hash); + } + } + readHash(jekyllStyle) { + this.skipBlank(); + if (this.peek() === ',') + ++this.p; + const begin = this.p; + const name = this.readNonEmptyIdentifier(); + if (!name) + return; + let value; + this.skipBlank(); + const sep = isString(jekyllStyle) ? jekyllStyle : (jekyllStyle ? '=' : ':'); + if (this.peek() === sep) { + ++this.p; + value = this.readValue(); + } + return new HashToken(this.input, begin, this.p, name, value, this.file); + } + remaining() { + return this.input.slice(this.p, this.N); + } + advance(step = 1) { + this.p += step; + } + end() { + return this.p >= this.N; + } + read() { + return this.input[this.p++]; + } + readTo(end) { + while (this.p < this.N) { + ++this.p; + if (this.rmatch(end)) + return this.p; + } + return -1; + } + readValue() { + this.skipBlank(); + const begin = this.p; + const variable = this.readLiteral() || this.readQuoted() || this.readRange() || this.readNumber(); + const props = this.readProperties(!variable); + if (!props.length) + return variable; + return new PropertyAccessToken(variable, props, this.input, begin, this.p); + } + readScopeValue() { + this.skipBlank(); + const begin = this.p; + const props = this.readProperties(); + if (!props.length) + return undefined; + return new PropertyAccessToken(undefined, props, this.input, begin, this.p); + } + readProperties(isBegin = true) { + const props = []; + while (true) { + if (this.peek() === '[') { + this.p++; + const prop = this.readValue() || new IdentifierToken(this.input, this.p, this.p, this.file); + this.assert(this.readTo(']') !== -1, '[ not closed'); + props.push(prop); + continue; + } + if (isBegin && !props.length) { + const prop = this.readNonEmptyIdentifier(); + if (prop) { + props.push(prop); + continue; + } + } + if (this.peek() === '.' && this.peek(1) !== '.') { // skip range syntax + this.p++; + const prop = this.readNonEmptyIdentifier(); + if (!prop) + break; + props.push(prop); + continue; + } + break; + } + return props; + } + readNumber() { + this.skipBlank(); + let decimalFound = false; + let digitFound = false; + let n = 0; + if (this.peekType() & SIGN) + n++; + while (this.p + n <= this.N) { + if (this.peekType(n) & NUMBER) { + digitFound = true; + n++; + } + else if (this.peek(n) === '.' && this.peek(n + 1) !== '.') { + if (decimalFound || !digitFound) + return; + decimalFound = true; + n++; + } + else + break; + } + if (digitFound && !isWord(this.peek(n))) { + const num = new NumberToken(this.input, this.p, this.p + n, this.file); + this.advance(n); + return num; + } + } + readLiteral() { + this.skipBlank(); + const end = this.matchTrie(this.literalTrie); + if (end === -1) + return; + const literal = new LiteralToken(this.input, this.p, end, this.file); + this.p = end; + return literal; + } + readRange() { + this.skipBlank(); + const begin = this.p; + if (this.peek() !== '(') + return; + ++this.p; + const lhs = this.readValueOrThrow(); + this.skipBlank(); + this.assert(this.read() === '.' && this.read() === '.', 'invalid range syntax'); + const rhs = this.readValueOrThrow(); + this.skipBlank(); + this.assert(this.read() === ')', 'invalid range syntax'); + return new RangeToken(this.input, begin, this.p, lhs, rhs, this.file); + } + readValueOrThrow() { + const value = this.readValue(); + this.assert(value, () => `unexpected token ${this.snapshot()}, value expected`); + return value; + } + readQuoted() { + this.skipBlank(); + const begin = this.p; + if (!(this.peekType() & QUOTE)) + return; + ++this.p; + let escaped = false; + while (this.p < this.N) { + ++this.p; + if (this.input[this.p - 1] === this.input[begin] && !escaped) + break; + if (escaped) + escaped = false; + else if (this.input[this.p - 1] === '\\') + escaped = true; + } + return new QuotedToken(this.input, begin, this.p, this.file); + } + *readFileNameTemplate(options) { + const { outputDelimiterLeft } = options; + const htmlStopStrings = [',', ' ', '\r', '\n', '\t', outputDelimiterLeft]; + const htmlStopStringSet = new Set(htmlStopStrings); + // break on ',' and ' ', outputDelimiterLeft only stops HTML token + while (this.p < this.N && !htmlStopStringSet.has(this.peek())) { + yield this.match(outputDelimiterLeft) + ? this.readOutputToken(options) + : this.readHTMLToken(htmlStopStrings); + } + } + match(word) { + for (let i = 0; i < word.length; i++) { + if (word[i] !== this.input[this.p + i]) + return false; + } + return true; + } + rmatch(pattern) { + for (let i = 0; i < pattern.length; i++) { + if (pattern[pattern.length - 1 - i] !== this.input[this.p - 1 - i]) + return false; + } + return true; + } + peekType(n = 0) { + return this.p + n >= this.N ? 0 : TYPES[this.input.charCodeAt(this.p + n)]; + } + peek(n = 0) { + return this.p + n >= this.N ? '' : this.input[this.p + n]; + } + skipBlank() { + while (this.peekType() & BLANK) + ++this.p; + } +} + +class ParseStream { + constructor(tokens, parseToken) { + this.handlers = {}; + this.stopRequested = false; + this.tokens = tokens; + this.parseToken = parseToken; + } + on(name, cb) { + this.handlers[name] = cb; + return this; + } + trigger(event, arg) { + const h = this.handlers[event]; + return h ? (h.call(this, arg), true) : false; + } + start() { + this.trigger('start'); + let token; + while (!this.stopRequested && (token = this.tokens.shift())) { + if (this.trigger('token', token)) + continue; + if (isTagToken(token) && this.trigger(`tag:${token.name}`, token)) { + continue; + } + const template = this.parseToken(token, this.tokens); + this.trigger('template', template); + } + if (!this.stopRequested) + this.trigger('end'); + return this; + } + stop() { + this.stopRequested = true; + return this; + } +} + +class TemplateImpl { + constructor(token) { + this.token = token; + } +} + +class Tag extends TemplateImpl { + constructor(token, remainTokens, liquid) { + super(token); + this.name = token.name; + this.liquid = liquid; + this.tokenizer = token.tokenizer; + } +} + +/** + * Key-Value Pairs Representing Tag Arguments + * Example: + * For the markup `, foo:'bar', coo:2 reversed %}`, + * hash['foo'] === 'bar' + * hash['coo'] === 2 + * hash['reversed'] === undefined + */ +class Hash { + constructor(input, jekyllStyle) { + this.hash = {}; + const tokenizer = input instanceof Tokenizer ? input : new Tokenizer(input, {}); + for (const hash of tokenizer.readHashes(jekyllStyle)) { + this.hash[hash.name.content] = hash.value; + } + } + *render(ctx) { + const hash = {}; + for (const key of Object.keys(this.hash)) { + hash[key] = this.hash[key] === undefined ? true : yield evalToken(this.hash[key], ctx); + } + return hash; + } +} + +function createTagClass(options) { + return class extends Tag { + constructor(token, tokens, liquid) { + super(token, tokens, liquid); + if (isFunction(options.parse)) { + options.parse.call(this, token, tokens); + } + } + *render(ctx, emitter) { + const hash = (yield new Hash(this.token.args, ctx.opts.keyValueSeparator).render(ctx)); + return yield options.render.call(this, ctx, emitter, hash); + } + }; +} + +function isKeyValuePair(arr) { + return isArray(arr); +} + +class Filter { + constructor(token, options, liquid) { + this.token = token; + this.name = token.name; + this.handler = isFunction(options) + ? options + : (isFunction(options === null || options === void 0 ? void 0 : options.handler) ? options.handler : identify); + this.raw = !isFunction(options) && !!(options === null || options === void 0 ? void 0 : options.raw); + this.args = token.args; + this.liquid = liquid; + } + *render(value, context) { + const argv = []; + for (const arg of this.args) { + if (isKeyValuePair(arg)) + argv.push([arg[0], yield evalToken(arg[1], context)]); + else + argv.push(yield evalToken(arg, context)); + } + return yield this.handler.apply({ context, token: this.token, liquid: this.liquid }, [value, ...argv]); + } +} + +class Value { + /** + * @param str the value to be valuated, eg.: "foobar" | truncate: 3 + */ + constructor(input, liquid) { + this.filters = []; + const token = typeof input === 'string' + ? new Tokenizer(input, liquid.options.operators).readFilteredValue() + : input; + this.initial = token.initial; + this.filters = token.filters.map(token => new Filter(token, this.getFilter(liquid, token.name), liquid)); + } + *value(ctx, lenient) { + lenient = lenient || (ctx.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === 'default'); + let val = yield this.initial.evaluate(ctx, lenient); + for (const filter of this.filters) { + val = yield filter.render(val, ctx); + } + return val; + } + getFilter(liquid, name) { + const impl = liquid.filters[name]; + assert(impl || !liquid.options.strictFilters, () => `undefined filter: ${name}`); + return impl; + } +} + +class Output extends TemplateImpl { + constructor(token, liquid) { + var _a; + super(token); + const tokenizer = new Tokenizer(token.input, liquid.options.operators, token.file, token.contentRange); + this.value = new Value(tokenizer.readFilteredValue(), liquid); + const filters = this.value.filters; + const outputEscape = liquid.options.outputEscape; + if (!((_a = filters[filters.length - 1]) === null || _a === void 0 ? void 0 : _a.raw) && outputEscape) { + const token = new FilterToken(toString.call(outputEscape), [], '', 0, 0); + filters.push(new Filter(token, outputEscape, liquid)); + } + } + *render(ctx, emitter) { + const val = yield this.value.value(ctx, false); + emitter.write(val); + } + *arguments() { + yield this.value; + } +} + +class HTML extends TemplateImpl { + constructor(token) { + super(token); + this.str = token.getContent(); + } + *render(ctx, emitter) { + emitter.write(this.str); + } +} + +/** + * A variable's segments and location, which can be coerced to a string. + */ +class Variable { + constructor(segments, location) { + this.segments = segments; + this.location = location; + } + toString() { + return segmentsString(this.segments, true); + } + /** Return this variable's segments as an array, possibly with nested arrays for nested paths. */ + toArray() { + function* _visit(...segments) { + for (const segment of segments) { + if (segment instanceof Variable) { + yield Array.from(_visit(...segment.segments)); + } + else { + yield segment; + } + } + } + return Array.from(_visit(...this.segments)); + } +} +/** + * Group variables by the string representation of their root segment. + */ +class VariableMap { + constructor() { + this.map = new Map(); + } + get(key) { + const k = segmentsString([key.segments[0]]); + if (!this.map.has(k)) { + this.map.set(k, []); + } + return this.map.get(k); + } + has(key) { + return this.map.has(segmentsString([key.segments[0]])); + } + push(variable) { + this.get(variable).push(variable); + } + asObject() { + return Object.fromEntries(this.map); + } +} +const defaultStaticAnalysisOptions = { + partials: true +}; +function* _analyze(templates, partials, sync) { + const variables = new VariableMap(); + const globals = new VariableMap(); + const locals = new VariableMap(); + const rootScope = new DummyScope(new Set()); + // Names of partial templates that we've already analyzed. + const seen = new Set(); + function updateVariables(variable, scope) { + variables.push(variable); + const aliased = scope.alias(variable); + if (aliased !== undefined) { + const root = aliased.segments[0]; + // TODO: What if a a template renders a rendered template? Do we need scope.parent? + if (isString(root) && !rootScope.has(root)) { + globals.push(aliased); + } + } + else { + const root = variable.segments[0]; + if (isString(root) && !scope.has(root)) { + globals.push(variable); + } + } + // Recurse for nested Variables + for (const segment of variable.segments) { + if (segment instanceof Variable) { + updateVariables(segment, scope); + } + } + } + function* visit(template, scope) { + if (template.arguments) { + for (const arg of template.arguments()) { + for (const variable of extractVariables(arg)) { + updateVariables(variable, scope); + } + } + } + if (template.localScope) { + for (const ident of template.localScope()) { + scope.add(ident.content); + scope.deleteAlias(ident.content); + const [row, col] = ident.getPosition(); + locals.push(new Variable([ident.content], { row, col, file: ident.file })); + } + } + if (template.children) { + if (template.partialScope) { + const partial = template.partialScope(); + if (partial === undefined) { + // Layouts, for example, can have children that are not partials. + for (const child of (yield template.children(partials, sync))) { + yield visit(child, scope); + } + return; + } + if (seen.has(partial.name)) + return; + const partialScopeNames = new Set(); + const partialScope = partial.isolated + ? new DummyScope(partialScopeNames) + : scope.push(partialScopeNames); + for (const name of partial.scope) { + if (isString(name)) { + partialScopeNames.add(name); + } + else { + const [alias, argument] = name; + partialScopeNames.add(alias); + const variables = Array.from(extractVariables(argument)); + if (variables.length) { + partialScope.setAlias(alias, variables[0].segments); + } + } + } + for (const child of (yield template.children(partials, sync))) { + yield visit(child, partialScope); + seen.add(partial.name); + } + partialScope.pop(); + } + else { + if (template.blockScope) { + scope.push(new Set(template.blockScope())); + } + for (const child of (yield template.children(partials, sync))) { + yield visit(child, scope); + } + if (template.blockScope) { + scope.pop(); + } + } + } + } + for (const template of templates) { + yield visit(template, rootScope); + } + return { + variables: variables.asObject(), + globals: globals.asObject(), + locals: locals.asObject() + }; +} +/** + * Statically analyze a template and report variable usage. + */ +function analyze(template, options = {}) { + const opts = Object.assign(Object.assign({}, defaultStaticAnalysisOptions), options); + return toPromise(_analyze(template, opts.partials, false)); +} +/** + * Statically analyze a template and report variable usage. + */ +function analyzeSync(template, options = {}) { + const opts = Object.assign(Object.assign({}, defaultStaticAnalysisOptions), options); + return toValueSync(_analyze(template, opts.partials, true)); +} +/** + * A stack to manage scopes while traversing templates during static analysis. + */ +class DummyScope { + constructor(globals) { + this.stack = [{ names: globals, aliases: new Map() }]; + } + /** Return true if `name` is in scope. */ + has(name) { + for (const scope of this.stack) { + if (scope.names.has(name)) { + return true; + } + } + return false; + } + push(scope) { + this.stack.push({ names: scope, aliases: new Map() }); + return this; + } + pop() { + var _a; + return (_a = this.stack.pop()) === null || _a === void 0 ? void 0 : _a.names; + } + // Add a name to the template scope. + add(name) { + this.stack[0].names.add(name); + } + /** Return the variable that `variable` aliases, or `variable` if it doesn't alias anything. */ + alias(variable) { + const root = variable.segments[0]; + if (!isString(root)) + return undefined; + const alias = this.getAlias(root); + if (alias === undefined) + return undefined; + return new Variable([...alias, ...variable.segments.slice(1)], variable.location); + } + // TODO: `from` could be a path with multiple segments, like `include.x`. + setAlias(from, to) { + this.stack[this.stack.length - 1].aliases.set(from, to); + } + deleteAlias(name) { + this.stack[this.stack.length - 1].aliases.delete(name); + } + getAlias(name) { + for (const scope of this.stack) { + if (scope.aliases.has(name)) { + return scope.aliases.get(name); + } + // If a scope has defined `name`, then it masks aliases in parent scopes. + if (scope.names.has(name)) { + return undefined; + } + } + return undefined; + } +} +function* extractVariables(value) { + if (isValueToken(value)) { + yield* extractValueTokenVariables(value); + } + else if (value instanceof Value) { + yield* extractFilteredValueVariables(value); + } +} +function* extractFilteredValueVariables(value) { + for (const token of value.initial.postfix) { + if (isValueToken(token)) { + yield* extractValueTokenVariables(token); + } + } + for (const filter of value.filters) { + for (const arg of filter.args) { + if (isKeyValuePair(arg) && arg[1]) { + yield* extractValueTokenVariables(arg[1]); + } + else if (isValueToken(arg)) { + yield* extractValueTokenVariables(arg); + } + } + } +} +function* extractValueTokenVariables(token) { + if (isRangeToken(token)) { + yield* extractValueTokenVariables(token.lhs); + yield* extractValueTokenVariables(token.rhs); + } + else if (isPropertyAccessToken(token)) { + yield extractPropertyAccessVariable(token); + } +} +function extractPropertyAccessVariable(token) { + const segments = []; + // token is not guaranteed to have `file` set. We'll try to get it from a prop if not. + let file = token.file; + // Here we're flattening the first segment of a path if it is a nested path. + const root = token.props[0]; + file = file || root.file; + if (isQuotedToken(root) || isNumberToken(root) || isWordToken(root)) { + segments.push(root.content); + } + else if (isPropertyAccessToken(root)) { + // Flatten paths that start with a nested path. + segments.push(...extractPropertyAccessVariable(root).segments); + } + for (const prop of token.props.slice(1)) { + file = file || prop.file; + if (isQuotedToken(prop) || isNumberToken(prop) || isWordToken(prop)) { + segments.push(prop.content); + } + else if (isPropertyAccessToken(prop)) { + segments.push(extractPropertyAccessVariable(prop)); + } + } + const [row, col] = token.getPosition(); + return new Variable(segments, { + row, + col, + file + }); +} +// This is used to detect segments that can be represented with dot notation +// when creating a string representation of VariableSegments. +const RE_PROPERTY = /^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/; +/** + * Return a string representation of segments using dot notation where possible. + * @param segments - The property names and array indices that make up a path to a variable. + * @param bracketedRoot - If false (the default), don't surround the root segment with square brackets. + */ +function segmentsString(segments, bracketedRoot = false) { + const buf = []; + const root = segments[0]; + if (isString(root)) { + if (!bracketedRoot || root.match(RE_PROPERTY)) { + buf.push(`${root}`); + } + else { + buf.push(`['${root}']`); + } + } + for (const segment of segments.slice(1)) { + if (segment instanceof Variable) { + buf.push(`[${segmentsString(segment.segments)}]`); + } + else if (isString(segment)) { + if (segment.match(RE_PROPERTY)) { + buf.push(`.${segment}`); + } + else { + buf.push(`['${segment}']`); + } + } + else { + buf.push(`[${segment}]`); + } + } + return buf.join(''); +} + +var LookupType; +(function (LookupType) { + LookupType["Partials"] = "partials"; + LookupType["Layouts"] = "layouts"; + LookupType["Root"] = "root"; +})(LookupType || (LookupType = {})); +class Loader { + constructor(options) { + var _a, _b, _c, _d; + this.options = options; + if (options.relativeReference) { + const sep = options.fs.sep; + assert(sep, '`fs.sep` is required for relative reference'); + const prefixes = ['.' + sep, '..' + sep, './', '../']; + this.shouldLoadRelative = (referencedFile) => prefixes.some(prefix => referencedFile.startsWith(prefix)); + } + else { + this.shouldLoadRelative = (_referencedFile) => false; + } + const fs = options.fs; + this.contains = toLiquidAsync(((_a = fs.contains) === null || _a === void 0 ? void 0 : _a.bind(fs)) || (() => __awaiter(this, void 0, void 0, function* () { return true; })), ((_b = fs.containsSync) === null || _b === void 0 ? void 0 : _b.bind(fs)) || (() => true)); + this.exists = toLiquidAsync(((_c = fs.exists) === null || _c === void 0 ? void 0 : _c.bind(fs)) || (() => __awaiter(this, void 0, void 0, function* () { return false; })), (_d = fs.existsSync) === null || _d === void 0 ? void 0 : _d.bind(fs)); + } + *lookup(file, type, sync, currentFile) { + const dirs = this.options[type]; + for (const filepath of this.candidates(file, dirs, currentFile)) { + let allowed = false; + for (const dir of dirs) { + if (yield this.contains(!!sync, dir, filepath)) { + allowed = true; + break; + } + } + if (!allowed) + continue; + if (yield this.exists(!!sync, filepath)) + return filepath; + } + throw this.lookupError(file, dirs); + } + *candidates(file, dirs, currentFile) { + const { fs, extname } = this.options; + if (this.shouldLoadRelative(file) && currentFile) { + const referenced = fs.resolve(this.dirname(currentFile), file, extname); + yield referenced; + } + for (const dir of dirs) { + const referenced = fs.resolve(dir, file, extname); + yield referenced; + } + if (fs.fallback !== undefined) { + const filepath = fs.fallback(file); + if (filepath !== undefined) + yield filepath; + } + } + dirname(path) { + const fs = this.options.fs; + assert(fs.dirname, '`fs.dirname` is required for relative reference'); + return fs.dirname(path); + } + lookupError(file, roots) { + const err = new Error('ENOENT'); + err.message = `ENOENT: Failed to lookup "${file}" in "${roots}"`; + err.code = 'ENOENT'; + return err; + } +} + +class Parser { + constructor(liquid) { + var _a, _b; + this.liquid = liquid; + this.cache = this.liquid.options.cache; + this.fs = this.liquid.options.fs; + this.parseFile = this.cache ? this._parseFileCached : this._parseFile; + this.loader = new Loader(this.liquid.options); + this.parseLimit = new Limiter('parse length', liquid.options.parseLimit); + this.readFile = toLiquidAsync(((_a = this.fs.readFile) === null || _a === void 0 ? void 0 : _a.bind(this.fs)) || (() => __awaiter(this, void 0, void 0, function* () { throw new Error('readFile not implemented'); })), (_b = this.fs.readFileSync) === null || _b === void 0 ? void 0 : _b.bind(this.fs)); + } + parse(html, filepath) { + html = String(html); + this.parseLimit.use(html.length); + const tokenizer = new Tokenizer(html, this.liquid.options.operators, filepath); + const tokens = tokenizer.readTopLevelTokens(this.liquid.options); + return this.parseTokens(tokens); + } + parseTokens(tokens) { + let token; + const templates = []; + const errors = []; + while ((token = tokens.shift())) { + try { + templates.push(this.parseToken(token, tokens)); + } + catch (err) { + if (this.liquid.options.catchAllErrors) + errors.push(err); + else + throw err; + } + } + if (errors.length) + throw new LiquidErrors(errors); + return templates; + } + parseToken(token, remainTokens) { + try { + if (isTagToken(token)) { + const TagClass = this.liquid.tags[token.name]; + assert(TagClass, `tag "${token.name}" not found`); + return new TagClass(token, remainTokens, this.liquid, this); + } + if (isOutputToken(token)) { + return new Output(token, this.liquid); + } + return new HTML(token); + } + catch (e) { + if (LiquidError.is(e)) + throw e; + throw new ParseError(e, token); + } + } + parseStream(tokens) { + return new ParseStream(tokens, (token, tokens) => this.parseToken(token, tokens)); + } + *_parseFileCached(file, sync, type = LookupType.Root, currentFile) { + const cache = this.cache; + const key = this.loader.shouldLoadRelative(file) ? currentFile + ',' + file : type + ':' + file; + const tpls = yield cache.read(key); + if (tpls) + return tpls; + const task = this._parseFile(file, sync, type, currentFile); + // sync mode: exec the task and cache the result + // async mode: cache the task before exec + const taskOrTpl = sync ? yield task : toPromise(task); + cache.write(key, taskOrTpl); + // note: concurrent tasks will be reused, cache for failed task is removed until its end + try { + return yield taskOrTpl; + } + catch (err) { + cache.remove(key); + throw err; + } + } + *_parseFile(file, sync, type = LookupType.Root, currentFile) { + const filepath = yield this.loader.lookup(file, type, sync, currentFile); + return this.parse(yield this.readFile(!!sync, filepath), filepath); + } +} + +var TokenKind; +(function (TokenKind) { + TokenKind[TokenKind["Number"] = 1] = "Number"; + TokenKind[TokenKind["Literal"] = 2] = "Literal"; + TokenKind[TokenKind["Tag"] = 4] = "Tag"; + TokenKind[TokenKind["Output"] = 8] = "Output"; + TokenKind[TokenKind["HTML"] = 16] = "HTML"; + TokenKind[TokenKind["Filter"] = 32] = "Filter"; + TokenKind[TokenKind["Hash"] = 64] = "Hash"; + TokenKind[TokenKind["PropertyAccess"] = 128] = "PropertyAccess"; + TokenKind[TokenKind["Word"] = 256] = "Word"; + TokenKind[TokenKind["Range"] = 512] = "Range"; + TokenKind[TokenKind["Quoted"] = 1024] = "Quoted"; + TokenKind[TokenKind["Operator"] = 2048] = "Operator"; + TokenKind[TokenKind["FilteredValue"] = 4096] = "FilteredValue"; + TokenKind[TokenKind["Delimited"] = 12] = "Delimited"; +})(TokenKind || (TokenKind = {})); + +function isDelimitedToken(val) { + return !!(getKind(val) & TokenKind.Delimited); +} +function isOperatorToken(val) { + return getKind(val) === TokenKind.Operator; +} +function isHTMLToken(val) { + return getKind(val) === TokenKind.HTML; +} +function isOutputToken(val) { + return getKind(val) === TokenKind.Output; +} +function isTagToken(val) { + return getKind(val) === TokenKind.Tag; +} +function isQuotedToken(val) { + return getKind(val) === TokenKind.Quoted; +} +function isLiteralToken(val) { + return getKind(val) === TokenKind.Literal; +} +function isNumberToken(val) { + return getKind(val) === TokenKind.Number; +} +function isPropertyAccessToken(val) { + return getKind(val) === TokenKind.PropertyAccess; +} +function isWordToken(val) { + return getKind(val) === TokenKind.Word; +} +function isRangeToken(val) { + return getKind(val) === TokenKind.Range; +} +function isValueToken(val) { + // valueTokenBitMask = TokenKind.Number | TokenKind.Literal | TokenKind.Quoted | TokenKind.PropertyAccess | TokenKind.Range + return (getKind(val) & 1667) > 0; +} +function getKind(val) { + return val ? val.kind : -1; +} + +var typeGuards = /*#__PURE__*/Object.freeze({ + __proto__: null, + isDelimitedToken: isDelimitedToken, + isOperatorToken: isOperatorToken, + isHTMLToken: isHTMLToken, + isOutputToken: isOutputToken, + isTagToken: isTagToken, + isQuotedToken: isQuotedToken, + isLiteralToken: isLiteralToken, + isNumberToken: isNumberToken, + isPropertyAccessToken: isPropertyAccessToken, + isWordToken: isWordToken, + isRangeToken: isRangeToken, + isValueToken: isValueToken +}); + +function createScope(from) { + const scope = Object.create(null); + if (from) + Object.assign(scope, from); + return scope; +} + +class Context { + constructor(env = {}, opts = defaultOptions, renderOptions = {}, { memoryLimit, renderLimit } = {}) { + var _a, _b, _c, _d, _e; + /** + * insert a Context-level empty scope, + * for tags like `{% capture %}` `{% assign %}` to operate + */ + this.scopes = [createScope()]; + this.registers = {}; + this.breakCalled = false; + this.continueCalled = false; + this.sync = !!renderOptions.sync; + this.opts = opts; + this.globals = (_a = renderOptions.globals) !== null && _a !== void 0 ? _a : opts.globals; + this.environments = isObject(env) ? env : Object(env); + this.strictVariables = (_b = renderOptions.strictVariables) !== null && _b !== void 0 ? _b : this.opts.strictVariables; + this.ownPropertyOnly = (_c = renderOptions.ownPropertyOnly) !== null && _c !== void 0 ? _c : opts.ownPropertyOnly; + this.memoryLimit = memoryLimit !== null && memoryLimit !== void 0 ? memoryLimit : new Limiter('memory alloc', (_d = renderOptions.memoryLimit) !== null && _d !== void 0 ? _d : opts.memoryLimit); + this.renderLimit = renderLimit !== null && renderLimit !== void 0 ? renderLimit : new Limiter('template render', getPerformance().now() + ((_e = renderOptions.renderLimit) !== null && _e !== void 0 ? _e : opts.renderLimit)); + } + getRegister(key, defaultValue = undefined) { + return (this.registers[key] = this.registers[key] || defaultValue); + } + setRegister(key, value) { + return (this.registers[key] = value); + } + saveRegister(...keys) { + return keys.map(key => [key, this.getRegister(key)]); + } + restoreRegister(keyValues) { + return keyValues.forEach(([key, value]) => this.setRegister(key, value)); + } + getAll() { + return [this.globals, this.environments, ...this.scopes] + .reduce((ctx, val) => __assign(ctx, val), {}); + } + /** + * @deprecated use `_get()` or `getSync()` instead + */ + get(paths) { + return this.getSync(paths); + } + getSync(paths) { + return toValueSync(this._get(paths)); + } + *_get(paths) { + const scope = this.findScope(paths[0]); // first prop should always be a string + return yield this._getFromScope(scope, paths); + } + /** + * @deprecated use `_get()` instead + */ + getFromScope(scope, paths) { + return toValueSync(this._getFromScope(scope, paths)); + } + *_getFromScope(scope, paths, strictVariables = this.strictVariables) { + if (isString(paths)) + paths = paths.split('.'); + for (let i = 0; i < paths.length; i++) { + scope = yield this.readProperty(scope, paths[i]); + if (strictVariables && isUndefined(scope)) { + throw new InternalUndefinedVariableError(paths.slice(0, i + 1).join('.')); + } + } + return scope; + } + push(ctx) { + return this.scopes.push(ctx); + } + pop() { + return this.scopes.pop(); + } + bottom() { + return this.scopes[0]; + } + spawn(scope = {}) { + return new Context(scope, this.opts, { + sync: this.sync, + globals: this.globals, + strictVariables: this.strictVariables, + ownPropertyOnly: this.ownPropertyOnly + }, { + renderLimit: this.renderLimit, + memoryLimit: this.memoryLimit + }); + } + findScope(key) { + for (let i = this.scopes.length - 1; i >= 0; i--) { + const candidate = this.scopes[i]; + if (key in candidate) + return candidate; + } + if (key in this.environments) + return this.environments; + return this.globals; + } + readProperty(obj, key) { + obj = toLiquid(obj); + key = toValue(key); + if (isNil(obj)) + return obj; + if (isArray(obj) && isNumber(key)) + return readArrayElement(obj, key, this.ownPropertyOnly); + const value = readJSProperty(obj, key, this.ownPropertyOnly); + if (value === undefined && obj instanceof Drop) + return obj.liquidMethodMissing(key, this); + if (isFunction(value)) + return value.call(obj); + if (key === 'size') + return readSize(obj); + else if (key === 'first') + return readFirst(obj, this.ownPropertyOnly); + else if (key === 'last') + return readLast(obj, this.ownPropertyOnly); + return value; + } +} +function readJSProperty(obj, key, ownPropertyOnly) { + if (ownPropertyOnly && !hasOwnProperty.call(obj, key) && !(obj instanceof Drop)) + return undefined; + return obj[key]; +} +function readFirst(obj, ownPropertyOnly) { + if (isArray(obj)) + return readArrayElement(obj, 0, ownPropertyOnly); + return readJSProperty(obj, 'first', ownPropertyOnly); +} +function readLast(obj, ownPropertyOnly) { + if (isArray(obj)) + return readArrayElement(obj, -1, ownPropertyOnly); + return readJSProperty(obj, 'last', ownPropertyOnly); +} +function readSize(obj) { + if (hasOwnProperty.call(obj, 'size') || obj['size'] !== undefined) + return obj['size']; + if (isArray(obj) || isString(obj)) + return obj.length; + if (typeof obj === 'object') + return Object.keys(obj).length; +} + +var BlockMode; +(function (BlockMode) { + /* store rendered html into blocks */ + BlockMode[BlockMode["OUTPUT"] = 0] = "OUTPUT"; + /* output rendered html directly */ + BlockMode[BlockMode["STORE"] = 1] = "STORE"; +})(BlockMode || (BlockMode = {})); + +const abs = argumentsToNumber(Math.abs); +const at_least = argumentsToNumber(Math.max); +const at_most = argumentsToNumber(Math.min); +const ceil = argumentsToNumber(Math.ceil); +const divided_by = argumentsToNumber((dividend, divisor, integerArithmetic = false) => integerArithmetic ? Math.floor(dividend / divisor) : dividend / divisor); +const floor = argumentsToNumber(Math.floor); +const minus = argumentsToNumber((v, arg) => v - arg); +const plus = argumentsToNumber((lhs, rhs) => lhs + rhs); +const modulo = argumentsToNumber((v, arg) => ((v % arg) + arg) % arg); +const times = argumentsToNumber((v, arg) => v * arg); +function round(v, arg = 0) { + v = toNumber(v); + arg = toNumber(arg); + const amp = Math.pow(10, arg); + const scaled = (v * amp) * (1 + Number.EPSILON); + return Math.round(scaled) / amp; +} + +var mathFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + abs: abs, + at_least: at_least, + at_most: at_most, + ceil: ceil, + divided_by: divided_by, + floor: floor, + minus: minus, + plus: plus, + modulo: modulo, + times: times, + round: round +}); + +const url_decode = (x) => decodeURIComponent(stringify(x)).replace(/\+/g, ' '); +const url_encode = (x) => encodeURIComponent(stringify(x)).replace(/%20/g, '+'); +const cgi_escape = (x) => encodeURIComponent(stringify(x)) + .replace(/%20/g, '+') + .replace(/[!'()*]/g, c => '%' + c.charCodeAt(0).toString(16).toUpperCase()); +const uri_escape = (x) => encodeURI(stringify(x)) + .replace(/%5B/g, '[') + .replace(/%5D/g, ']'); +const rSlugifyDefault = /[^\p{M}\p{L}\p{Nd}]+/ug; +const rSlugifyReplacers = { + 'raw': /\s+/g, + 'default': rSlugifyDefault, + 'pretty': /[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/ug, + 'ascii': /[^A-Za-z0-9]+/g, + 'latin': rSlugifyDefault, + 'none': null +}; +function slugify(str, mode = 'default', cased = false) { + str = stringify(str); + const replacer = rSlugifyReplacers[mode]; + if (replacer) { + if (mode === 'latin') + str = removeAccents(str); + str = str.replace(replacer, '-').replace(/^-|-$/g, ''); + } + return cased ? str : str.toLowerCase(); +} +function removeAccents(str) { + return str.replace(/[àáâãäå]/g, 'a') + .replace(/[æ]/g, 'ae') + .replace(/[ç]/g, 'c') + .replace(/[èéêë]/g, 'e') + .replace(/[ìíîï]/g, 'i') + .replace(/[ð]/g, 'd') + .replace(/[ñ]/g, 'n') + .replace(/[òóôõöø]/g, 'o') + .replace(/[ùúûü]/g, 'u') + .replace(/[ýÿ]/g, 'y') + .replace(/[ß]/g, 'ss') + .replace(/[œ]/g, 'oe') + .replace(/[þ]/g, 'th') + .replace(/[ẞ]/g, 'SS') + .replace(/[Œ]/g, 'OE') + .replace(/[Þ]/g, 'TH'); +} + +var urlFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + url_decode: url_decode, + url_encode: url_encode, + cgi_escape: cgi_escape, + uri_escape: uri_escape, + slugify: slugify +}); + +const join = argumentsToValue(function (v, arg) { + const array = toArray(v); + const sep = isNil(arg) ? ' ' : stringify(arg); + let outputSize = sep.length * Math.max(array.length - 1, 0); + for (let i = 0; i < array.length; i++) + outputSize += String(array[i]).length; + this.context.memoryLimit.use(outputSize); + return Array.prototype.join.call(array, sep); +}); +const last = argumentsToValue(function (v) { + return isArrayLike(v) ? readArrayElement(v, -1, this.context.ownPropertyOnly) : ''; +}); +const first = argumentsToValue(function (v) { + return isArrayLike(v) ? readArrayElement(v, 0, this.context.ownPropertyOnly) : ''; +}); +const reverse = argumentsToValue(function (v) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + return [...array].reverse(); +}); +function* sortBy(arr, property, comparator) { + const values = []; + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + for (const item of array) { + values.push([ + item, + property ? yield this.context._getFromScope(item, stringify(property).split('.'), false) : item + ]); + } + return values.sort((lhs, rhs) => comparator(lhs[1], rhs[1])).map(tuple => tuple[0]); +} +function* sort(arr, property) { + return yield* sortBy.call(this, arr, property, orderedCompare); +} +function* sort_natural(arr, property) { + return yield* sortBy.call(this, arr, property, caseInsensitiveCompare); +} +const size = (v) => (v && v.length) || 0; +function* map(arr, property) { + const results = []; + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + for (const item of array) { + results.push(yield this.context._getFromScope(item, stringify(property), false)); + } + return results; +} +function* sum(arr, property) { + let sum = 0; + const array = toArray(arr); + for (const item of array) { + const data = Number(property ? yield this.context._getFromScope(item, stringify(property), false) : item); + sum += Number.isNaN(data) ? 0 : data; + } + return sum; +} +function compact(arr) { + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + return Array.prototype.filter.call(array, x => !isNil(toValue(x))); +} +function concat(v, arg = []) { + const lhs = toArray(v); + const rhs = toArray(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return Array.prototype.concat.call(lhs, rhs); +} +function push(v, arg) { + return concat.call(this, v, [arg]); +} +function unshift(v, arg) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + const clone = [...array]; + clone.unshift(arg); + return clone; +} +function pop(v) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + const clone = [...array]; + clone.pop(); + return clone; +} +function shift(v) { + const array = toArray(v); + this.context.memoryLimit.use(array.length); + const clone = [...array]; + clone.shift(); + return clone; +} +function slice(v, begin, length = 1) { + v = toValue(v); + if (isNil(v)) + return []; + if (!isArray(v)) + v = stringify(v); + begin = begin < 0 ? v.length + begin : begin; + if (begin < 0 || length < 0) + return isArray(v) ? [] : ''; + this.context.memoryLimit.use(length); + return isArray(v) + ? Array.prototype.slice.call(v, begin, begin + length) + : String.prototype.slice.call(v, begin, begin + length); +} +function expectedMatcher(expected) { + if (this.context.opts.jekyllWhere) { + return (v) => EmptyDrop.is(expected) ? equals(v, expected) : (isArray(v) ? arrayIncludes(v, expected) : equals(v, expected)); + } + else if (expected === undefined) { + return (v) => isTruthy(v, this.context); + } + else { + return (v) => equals(v, expected); + } +} +function* filter(include, arr, property, expected) { + const values = []; + arr = toArray(arr); + this.context.memoryLimit.use(arr.length); + const token = new Tokenizer(stringify(property)).readScopeValue(); + for (const item of arr) { + values.push(yield evalToken(token, this.context.spawn(item))); + } + const matcher = expectedMatcher.call(this, expected); + return Array.prototype.filter.call(arr, (_, i) => matcher(values[i]) === include); +} +function* filter_exp(include, arr, itemName, exp) { + const filtered = []; + const keyTemplate = new Value(stringify(exp), this.liquid); + const array = toArray(arr); + this.context.memoryLimit.use(array.length); + for (const item of array) { + this.context.push({ [itemName]: item }); + const value = yield keyTemplate.value(this.context); + this.context.pop(); + if (value === include) + filtered.push(item); + } + return filtered; +} +function* where(arr, property, expected) { + return yield* filter.call(this, true, arr, property, expected); +} +function* reject(arr, property, expected) { + return yield* filter.call(this, false, arr, property, expected); +} +function* where_exp(arr, itemName, exp) { + return yield* filter_exp.call(this, true, arr, itemName, exp); +} +function* reject_exp(arr, itemName, exp) { + return yield* filter_exp.call(this, false, arr, itemName, exp); +} +function* group_by(arr, property) { + const map = new Map(); + arr = toEnumerable(arr); + const token = new Tokenizer(stringify(property)).readScopeValue(); + this.context.memoryLimit.use(arr.length); + for (const item of arr) { + const key = yield evalToken(token, this.context.spawn(item)); + if (!map.has(key)) + map.set(key, []); + map.get(key).push(item); + } + return [...map.entries()].map(([name, items]) => ({ name, items })); +} +function* group_by_exp(arr, itemName, exp) { + const map = new Map(); + const keyTemplate = new Value(stringify(exp), this.liquid); + arr = toEnumerable(arr); + this.context.memoryLimit.use(arr.length); + for (const item of arr) { + this.context.push({ [itemName]: item }); + const key = yield keyTemplate.value(this.context); + this.context.pop(); + if (!map.has(key)) + map.set(key, []); + map.get(key).push(item); + } + return [...map.entries()].map(([name, items]) => ({ name, items })); +} +function* search(arr, property, expected) { + const token = new Tokenizer(stringify(property)).readScopeValue(); + const array = toArray(arr); + const matcher = expectedMatcher.call(this, expected); + for (let index = 0; index < array.length; index++) { + const value = yield evalToken(token, this.context.spawn(array[index])); + if (matcher(value)) + return [index, array[index]]; + } +} +function* search_exp(arr, itemName, exp) { + const predicate = new Value(stringify(exp), this.liquid); + const array = toArray(arr); + for (let index = 0; index < array.length; index++) { + this.context.push({ [itemName]: array[index] }); + const value = yield predicate.value(this.context); + this.context.pop(); + if (value) + return [index, array[index]]; + } +} +function* has(arr, property, expected) { + const result = yield* search.call(this, arr, property, expected); + return !!result; +} +function* has_exp(arr, itemName, exp) { + const result = yield* search_exp.call(this, arr, itemName, exp); + return !!result; +} +function* find_index(arr, property, expected) { + const result = yield* search.call(this, arr, property, expected); + return result ? result[0] : undefined; +} +function* find_index_exp(arr, itemName, exp) { + const result = yield* search_exp.call(this, arr, itemName, exp); + return result ? result[0] : undefined; +} +function* find(arr, property, expected) { + const result = yield* search.call(this, arr, property, expected); + return result ? result[1] : undefined; +} +function* find_exp(arr, itemName, exp) { + const result = yield* search_exp.call(this, arr, itemName, exp); + return result ? result[1] : undefined; +} +function uniq(arr) { + arr = toArray(arr); + this.context.memoryLimit.use(arr.length); + return [...new Set(arr)]; +} +function sample(v, count = 1) { + v = toValue(v); + if (isNil(v)) + return []; + if (!isArray(v)) + v = stringify(v); + this.context.memoryLimit.use(v.length); + const shuffled = [...v].sort(() => Math.random() - 0.5); + if (count === 1) + return shuffled[0]; + return shuffled.slice(0, count); +} + +var arrayFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + join: join, + last: last, + first: first, + reverse: reverse, + sort: sort, + sort_natural: sort_natural, + size: size, + map: map, + sum: sum, + compact: compact, + concat: concat, + push: push, + unshift: unshift, + pop: pop, + shift: shift, + slice: slice, + where: where, + reject: reject, + where_exp: where_exp, + reject_exp: reject_exp, + group_by: group_by, + group_by_exp: group_by_exp, + has: has, + has_exp: has_exp, + find_index: find_index, + find_index_exp: find_index_exp, + find: find, + find_exp: find_exp, + uniq: uniq, + sample: sample +}); + +function date(v, format, timezoneOffset) { + var _a, _b; + const size = ((_a = v === null || v === void 0 ? void 0 : v.length) !== null && _a !== void 0 ? _a : 0) + ((_b = timezoneOffset === null || timezoneOffset === void 0 ? void 0 : timezoneOffset.length) !== null && _b !== void 0 ? _b : 0); + this.context.memoryLimit.use(size); + const date = parseDate(v, this.context.opts, timezoneOffset); + if (!date) + return v; + format = toValue(format); + format = isNil(format) ? this.context.opts.dateFormat : stringify(format); + this.context.memoryLimit.use(format.length); + return strftime(date, format, this.context.memoryLimit); +} +function date_to_xmlschema(v) { + return date.call(this, v, '%Y-%m-%dT%H:%M:%S%:z'); +} +function date_to_rfc822(v) { + return date.call(this, v, '%a, %d %b %Y %H:%M:%S %z'); +} +function date_to_string(v, type, style) { + return stringify_date.call(this, v, '%b', type, style); +} +function date_to_long_string(v, type, style) { + return stringify_date.call(this, v, '%B', type, style); +} +function stringify_date(v, month_type, type, style) { + const date = parseDate(v, this.context.opts); + if (!date) + return v; + const ml = this.context.memoryLimit; + if (type === 'ordinal') { + const d = date.getDate(); + return style === 'US' + ? strftime(date, `${month_type} ${d}%q, %Y`, ml) + : strftime(date, `${d}%q ${month_type} %Y`, ml); + } + return strftime(date, `%d ${month_type} %Y`, ml); +} +function parseDate(v, opts, timezoneOffset) { + let date; + const defaultTimezoneOffset = timezoneOffset !== null && timezoneOffset !== void 0 ? timezoneOffset : opts.timezoneOffset; + const locale = opts.locale; + v = toValue(v); + if (isNil(v)) { + return undefined; + } + else if (v === 'now' || v === 'today') { + date = new LiquidDate(Date.now(), locale, defaultTimezoneOffset); + } + else if (isNumber(v)) { + date = new LiquidDate(v * 1000, locale, defaultTimezoneOffset); + } + else if (isString(v)) { + if (/^\d+$/.test(v)) { + date = new LiquidDate(+v * 1000, locale, defaultTimezoneOffset); + } + else if (opts.preserveTimezones && timezoneOffset === undefined) { + date = LiquidDate.createDateFixedToTimezone(v, locale); + } + else { + date = new LiquidDate(v, locale, defaultTimezoneOffset); + } + } + else { + date = new LiquidDate(v, locale, defaultTimezoneOffset); + } + return date.valid() ? date : undefined; +} + +var dateFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + date: date, + date_to_xmlschema: date_to_xmlschema, + date_to_rfc822: date_to_rfc822, + date_to_string: date_to_string, + date_to_long_string: date_to_long_string +}); + +/** + * String related filters + * + * * prefer stringify() to String() since `undefined`, `null` should eval '' + */ +const rCJKWord = /[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/gu; +// Word boundary followed by word characters (for detecting words) +const rNonCJKWord = /[^\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF\s]+/gu; +function append(v, arg) { + assert(arguments.length === 2, 'append expect 2 arguments'); + const lhs = stringify(v); + const rhs = stringify(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return lhs + rhs; +} +function prepend(v, arg) { + assert(arguments.length === 2, 'prepend expect 2 arguments'); + const lhs = stringify(v); + const rhs = stringify(arg); + this.context.memoryLimit.use(lhs.length + rhs.length); + return rhs + lhs; +} +function lstrip(v, chars) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + if (chars) { + chars = stringify(chars); + this.context.memoryLimit.use(chars.length); + for (let i = 0, set = new Set(chars); i < str.length; i++) { + if (!set.has(str[i])) + return str.slice(i); + } + return ''; + } + return str.trimStart(); +} +function downcase(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.toLowerCase(); +} +function upcase(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return stringify(str).toUpperCase(); +} +function remove(v, arg) { + const str = stringify(v); + arg = stringify(arg); + this.context.memoryLimit.use(str.length + arg.length); + return str.split(arg).join(''); +} +function remove_first(v, l) { + const str = stringify(v); + l = stringify(l); + this.context.memoryLimit.use(str.length + l.length); + return str.replace(l, ''); +} +function remove_last(v, l) { + const str = stringify(v); + const pattern = stringify(l); + this.context.memoryLimit.use(str.length + pattern.length); + const index = str.lastIndexOf(pattern); + if (index === -1) + return str; + return str.substring(0, index) + str.substring(index + pattern.length); +} +function rstrip(str, chars) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + if (chars) { + chars = stringify(chars); + this.context.memoryLimit.use(chars.length); + for (let i = str.length - 1, set = new Set(chars); i >= 0; i--) { + if (!set.has(str[i])) + return str.slice(0, i + 1); + } + return ''; + } + return str.trimEnd(); +} +function split(v, arg) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + const arr = str.split(stringify(arg)); + // align to ruby split, which is the behavior of shopify/liquid + // see: https://ruby-doc.org/core-2.4.0/String.html#method-i-split + while (arr.length && arr[arr.length - 1] === '') + arr.pop(); + return arr; +} +function strip(v, chars) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + if (chars) { + const set = new Set(stringify(chars)); + this.context.memoryLimit.use(set.size); + let i = 0; + let j = str.length - 1; + while (set.has(str[i])) + i++; + while (j >= i && set.has(str[j])) + j--; + return str.slice(i, j + 1); + } + return str.trim(); +} +function strip_newlines(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\r?\n/gm, ''); +} +function capitalize(str) { + str = stringify(str); + this.context.memoryLimit.use(str.length); + return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); +} +function replace(v, pattern, replacement) { + const str = stringify(v); + pattern = stringify(pattern); + replacement = stringify(replacement); + const parts = str.split(pattern); + const outputSize = str.length + (parts.length - 1) * (replacement.length - pattern.length); + this.context.memoryLimit.use(outputSize); + return parts.join(replacement); +} +function replace_first(v, arg1, arg2) { + const str = stringify(v); + arg1 = stringify(arg1); + arg2 = stringify(arg2); + this.context.memoryLimit.use(str.length + arg1.length + arg2.length); + return str.replace(arg1, () => arg2); +} +function replace_last(v, arg1, arg2) { + const str = stringify(v); + const pattern = stringify(arg1); + const replacement = stringify(arg2); + this.context.memoryLimit.use(str.length + pattern.length + replacement.length); + const index = str.lastIndexOf(pattern); + if (index === -1) + return str; + return str.substring(0, index) + replacement + str.substring(index + pattern.length); +} +function truncate(v, l = 50, o = '...') { + const str = stringify(v); + o = stringify(o); + this.context.memoryLimit.use(str.length + o.length); + if (str.length <= l) + return v; + return str.substring(0, l - o.length) + o; +} +function truncatewords(v, words = 15, o = '...') { + const str = stringify(v); + o = stringify(o); + this.context.memoryLimit.use(str.length + o.length); + const arr = str.split(/\s+/); + if (words <= 0) + words = 1; + let ret = arr.slice(0, words).join(' '); + if (arr.length >= words) + ret += o; + return ret; +} +function normalize_whitespace(v) { + const str = stringify(v); + this.context.memoryLimit.use(str.length); + return str.replace(/\s+/g, ' '); +} +function number_of_words(input, mode) { + const str = stringify(input); + this.context.memoryLimit.use(str.length); + input = str.trim(); + if (!input) + return 0; + switch (mode) { + case 'cjk': + // Count CJK characters and words + return (input.match(rCJKWord) || []).length + (input.match(rNonCJKWord) || []).length; + case 'auto': + // Count CJK characters, if none, count words + return rCJKWord.test(input) + ? input.match(rCJKWord).length + (input.match(rNonCJKWord) || []).length + : input.split(/\s+/).length; + default: + // Count words only + return input.split(/\s+/).length; + } +} +function array_to_sentence_string(array, connector = 'and') { + connector = stringify(connector); + let outputSize = connector.length + array.length * 2; + for (let i = 0; i < array.length; i++) + outputSize += stringify(array[i]).length; + this.context.memoryLimit.use(outputSize); + switch (array.length) { + case 0: + return ''; + case 1: + return array[0]; + case 2: + return `${array[0]} ${connector} ${array[1]}`; + default: + return `${array.slice(0, -1).join(', ')}, ${connector} ${array[array.length - 1]}`; + } +} + +var stringFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + append: append, + prepend: prepend, + lstrip: lstrip, + downcase: downcase, + upcase: upcase, + remove: remove, + remove_first: remove_first, + remove_last: remove_last, + rstrip: rstrip, + split: split, + strip: strip, + strip_newlines: strip_newlines, + capitalize: capitalize, + replace: replace, + replace_first: replace_first, + replace_last: replace_last, + truncate: truncate, + truncatewords: truncatewords, + normalize_whitespace: normalize_whitespace, + number_of_words: number_of_words, + array_to_sentence_string: array_to_sentence_string +}); + +function base64Encode(str) { + return Buffer.from(str, 'utf8').toString('base64'); +} +function base64Decode(str) { + return Buffer.from(str, 'base64').toString('utf8'); +} + +/** + * Base64 related filters + * + * Implements base64_encode and base64_decode filters for Shopify compatibility + */ +function base64_encode(value) { + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { + this.context.memoryLimit.use(value.byteLength); + return value.toString('base64'); + } + const str = stringify(value); + this.context.memoryLimit.use(str.length); + return base64Encode(str); +} +function base64_decode(value) { + const str = stringify(value); + this.context.memoryLimit.use(str.length); + return base64Decode(str); +} + +var base64Filters = /*#__PURE__*/Object.freeze({ + __proto__: null, + base64_encode: base64_encode, + base64_decode: base64_decode +}); + +function sha256(str) { + return createHash('sha256').update(str, 'utf8').digest('hex'); +} +function hmacSha256(str, key) { + return createHmac('sha256', key).update(str, 'utf8').digest('hex'); +} + +/** + * Crypto related filters + * + * Implements sha256 and hmac_sha256 filters for Shopify compatibility + */ +function sha256$1(value) { + const str = stringify(value); + this.context.memoryLimit.use(str.length); + return sha256(str); +} +function hmac_sha256(value, key) { + const str = stringify(value); + const keyStr = stringify(key); + this.context.memoryLimit.use(str.length + keyStr.length); + return hmacSha256(str, keyStr); +} + +var cryptoFilters = /*#__PURE__*/Object.freeze({ + __proto__: null, + sha256: sha256$1, + hmac_sha256: hmac_sha256 +}); + +const filters = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, htmlFilters), mathFilters), urlFilters), arrayFilters), dateFilters), stringFilters), base64Filters), cryptoFilters), misc); + +class AssignTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.identifier = this.tokenizer.readIdentifier(); + this.key = this.identifier.content; + this.tokenizer.assert(this.key, 'expected variable name'); + this.tokenizer.skipBlank(); + this.tokenizer.assert(this.tokenizer.peek() === '=', 'expected "="'); + this.tokenizer.advance(); + this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid); + } + *render(ctx) { + ctx.bottom()[this.key] = yield this.value.value(ctx, this.liquid.options.lenientIf); + } + *arguments() { + yield this.value; + } + *localScope() { + yield this.identifier; + } +} + +const MODIFIERS = ['offset', 'limit', 'reversed']; +class ForTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const variable = this.tokenizer.readIdentifier(); + const inStr = this.tokenizer.readIdentifier(); + const collection = this.tokenizer.readValue(); + if (!variable.size() || inStr.content !== 'in' || !collection) { + throw new Error(`illegal tag: ${token.getText()}`); + } + this.variable = variable.content; + this.collection = collection; + this.hash = new Hash(this.tokenizer, liquid.options.keyValueSeparator); + this.templates = []; + this.elseTemplates = []; + let p; + const stream = parser.parseStream(remainTokens) + .on('start', () => (p = this.templates)) + .on('tag:else', tag => { assertEmpty(tag.args); p = this.elseTemplates; }) + .on('tag:endfor', tag => { assertEmpty(tag.args); stream.stop(); }) + .on('template', (tpl) => p.push(tpl)) + .on('end', () => { throw new Error(`tag ${token.getText()} not closed`); }); + stream.start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + let collection = toEnumerable(yield evalToken(this.collection, ctx)); + if (!collection.length) { + yield r.renderTemplates(this.elseTemplates, ctx, emitter); + return; + } + const continueKey = 'continue-' + this.variable + '-' + this.collection.getText(); + ctx.push(createScope({ continue: ctx.getRegister(continueKey, {}) })); + const hash = (yield this.hash.render(ctx)); + ctx.pop(); + const modifiers = this.liquid.options.orderedFilterParameters + ? Object.keys(hash).filter(x => MODIFIERS.includes(x)) + : MODIFIERS.filter(x => hash[x] !== undefined); + collection = modifiers.reduce((collection, modifier) => { + if (modifier === 'offset') + return offset(collection, hash['offset']); + if (modifier === 'limit') + return limit(collection, hash['limit']); + return reversed(collection); + }, collection); + ctx.setRegister(continueKey, (hash['offset'] || 0) + collection.length); + const scope = createScope({ forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) }); + ctx.push(scope); + for (const item of collection) { + scope[this.variable] = item; + ctx.continueCalled = ctx.breakCalled = false; + yield r.renderTemplates(this.templates, ctx, emitter); + if (ctx.breakCalled) + break; + scope.forloop.next(); + } + ctx.continueCalled = ctx.breakCalled = false; + ctx.pop(); + } + *children() { + const templates = this.templates.slice(); + if (this.elseTemplates) { + templates.push(...this.elseTemplates); + } + return templates; + } + *arguments() { + yield this.collection; + for (const v of Object.values(this.hash.hash)) { + if (isValueToken(v)) { + yield v; + } + } + } + blockScope() { + return [this.variable, 'forloop']; + } +} +function reversed(arr) { + return [...arr].reverse(); +} +function offset(arr, count) { + return arr.slice(count); +} +function limit(arr, count) { + return arr.slice(0, count); +} + +class CaptureTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.templates = []; + this.identifier = this.readVariable(); + this.variable = this.identifier.content; + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endcapture') + return; + this.templates.push(parser.parseToken(token, remainTokens)); + } + throw new Error(`tag ${tagToken.getText()} not closed`); + } + readVariable() { + let ident = this.tokenizer.readIdentifier(); + if (ident.content) + return ident; + ident = this.tokenizer.readQuoted(); + if (ident) + return ident; + throw this.tokenizer.error('invalid capture name'); + } + *render(ctx) { + const r = this.liquid.renderer; + const html = yield r.renderTemplates(this.templates, ctx); + ctx.bottom()[this.variable] = html; + } + *children() { + return this.templates; + } + *localScope() { + yield this.identifier; + } +} + +class CaseTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.branches = []; + this.elseTemplates = []; + this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid); + this.elseTemplates = []; + let p = []; + let elseCount = 0; + const stream = parser.parseStream(remainTokens) + .on('tag:when', (token) => { + if (elseCount > 0) { + return; + } + p = []; + const values = []; + while (!token.tokenizer.end()) { + values.push(token.tokenizer.readValueOrThrow()); + token.tokenizer.skipBlank(); + if (token.tokenizer.peek() === ',') { + token.tokenizer.readTo(','); + } + else { + token.tokenizer.readTo('or'); + } + } + this.branches.push({ + values, + templates: p + }); + }) + .on('tag:else', () => { + elseCount++; + p = this.elseTemplates; + }) + .on('tag:endcase', () => stream.stop()) + .on('template', (tpl) => { + if (p !== this.elseTemplates || elseCount === 1) { + p.push(tpl); + } + }) + .on('end', () => { + throw new Error(`tag ${tagToken.getText()} not closed`); + }); + stream.start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + const target = toValue(yield this.value.value(ctx, ctx.opts.lenientIf)); + let branchHit = false; + for (const branch of this.branches) { + for (const valueToken of branch.values) { + const value = yield evalToken(valueToken, ctx, ctx.opts.lenientIf); + if (equals(target, value)) { + yield r.renderTemplates(branch.templates, ctx, emitter); + branchHit = true; + break; + } + } + } + if (!branchHit) { + yield r.renderTemplates(this.elseTemplates, ctx, emitter); + } + } + *arguments() { + yield this.value; + yield* this.branches.flatMap(b => b.values); + } + *children() { + const templates = this.branches.flatMap(b => b.templates); + if (this.elseTemplates) { + templates.push(...this.elseTemplates); + } + return templates; + } +} + +class CommentTag extends Tag { + constructor(tagToken, remainTokens, liquid) { + super(tagToken, remainTokens, liquid); + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endcomment') + return; + } + throw new Error(`tag ${tagToken.getText()} not closed`); + } + render() { } +} + +class RenderTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const tokenizer = this.tokenizer; + this.file = parseFilePath(tokenizer, this.liquid, parser); + this.currentFile = token.file; + while (!tokenizer.end()) { + tokenizer.skipBlank(); + const begin = tokenizer.p; + const keyword = tokenizer.readIdentifier(); + if (keyword.content === 'with' || keyword.content === 'for') { + tokenizer.skipBlank(); + // can be normal key/value pair, like "with: true" + if (tokenizer.peek() !== ':') { + const value = tokenizer.readValue(); + // can be normal key, like "with," + if (value) { + const beforeAs = tokenizer.p; + const asStr = tokenizer.readIdentifier(); + let alias; + if (asStr.content === 'as') + alias = tokenizer.readIdentifier(); + else + tokenizer.p = beforeAs; + const binding = { value, alias: alias && alias.content }; + if (keyword.content === 'with') + this.with = binding; + else + this.forBinding = binding; + tokenizer.skipBlank(); + if (tokenizer.peek() === ',') + tokenizer.advance(); + continue; // matched! + } + } + } + /** + * restore cursor if with/for not matched + */ + tokenizer.p = begin; + break; + } + this.hash = new Hash(tokenizer, liquid.options.keyValueSeparator); + } + *render(ctx, emitter) { + const { liquid, hash } = this; + const filepath = (yield renderFilePath(this.file, ctx, liquid)); + assert(filepath, () => `illegal file path "${filepath}"`); + const childCtx = ctx.spawn(); + const scope = childCtx.bottom(); + __assign(scope, yield hash.render(ctx)); + if (this.with) { + const { value, alias } = this.with; + scope[alias || filepath] = yield evalToken(value, ctx); + } + if (this.forBinding) { + const { value, alias } = this.forBinding; + const collection = toEnumerable(yield evalToken(value, ctx)); + scope['forloop'] = new ForloopDrop(collection.length, value.getText(), alias); + for (const item of collection) { + scope[alias] = item; + const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)); + yield liquid.renderer.renderTemplates(templates, childCtx, emitter); + scope['forloop'].next(); + } + } + else { + const templates = (yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile)); + yield liquid.renderer.renderTemplates(templates, childCtx, emitter); + } + } + *children(partials, sync) { + if (partials && isString(this.file)) { + return (yield this.liquid._parsePartialFile(this.file, sync, this.currentFile)); + } + return []; + } + partialScope() { + if (isString(this.file)) { + const names = Object.keys(this.hash.hash); + if (this.with) { + const { value, alias } = this.with; + if (isString(alias)) { + names.push([alias, value]); + } + else if (isString(this.file)) { + names.push([this.file, value]); + } + } + if (this.forBinding) { + const { value, alias } = this.forBinding; + if (isString(alias)) { + names.push([alias, value]); + } + else if (isString(this.file)) { + names.push([this.file, value]); + } + } + return { name: this.file, isolated: true, scope: names }; + } + } + *arguments() { + for (const v of Object.values(this.hash.hash)) { + if (isValueToken(v)) { + yield v; + } + } + if (this.with) { + const { value } = this.with; + if (isValueToken(value)) { + yield value; + } + } + if (this.forBinding) { + const { value } = this.forBinding; + if (isValueToken(value)) { + yield value; + } + } + } +} +/** + * @return null for "none", + * @return Template[] for quoted with tags and/or filters + * @return Token for expression (not quoted) + * @throws TypeError if cannot read next token + */ +function parseFilePath(tokenizer, liquid, parser) { + if (liquid.options.dynamicPartials) { + const file = tokenizer.readValue(); + tokenizer.assert(file, 'illegal file path'); + if (file.getText() === 'none') + return; + if (isQuotedToken(file)) { + // for filenames like "files/{{file}}", eval as liquid template + const templates = parser.parse(evalQuotedToken(file)); + return optimize(templates); + } + return file; + } + const tokens = [...tokenizer.readFileNameTemplate(liquid.options)]; + const templates = optimize(parser.parseTokens(tokens)); + return templates === 'none' ? undefined : templates; +} +function optimize(templates) { + // for filenames like "files/file.liquid", extract the string directly + if (templates.length === 1 && isHTMLToken(templates[0].token)) + return templates[0].token.getContent(); + return templates; +} +function* renderFilePath(file, ctx, liquid) { + if (typeof file === 'string') + return file; + if (Array.isArray(file)) + return liquid.renderer.renderTemplates(file, ctx); + return yield evalToken(file, ctx); +} + +class IncludeTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const { tokenizer } = token; + this.file = parseFilePath(tokenizer, this.liquid, parser); + this.currentFile = token.file; + const begin = tokenizer.p; + const withStr = tokenizer.readIdentifier(); + if (withStr.content === 'with') { + tokenizer.skipBlank(); + if (tokenizer.peek() !== ':') { + this.withVar = tokenizer.readValue(); + } + else + tokenizer.p = begin; + } + else + tokenizer.p = begin; + this.hash = new Hash(tokenizer, liquid.options.jekyllInclude || liquid.options.keyValueSeparator); + } + *render(ctx, emitter) { + const { liquid, hash, withVar } = this; + const { renderer } = liquid; + const filepath = (yield renderFilePath(this.file, ctx, liquid)); + assert(filepath, () => `illegal file path "${filepath}"`); + const saved = ctx.saveRegister('blocks', 'blockMode'); + ctx.setRegister('blocks', {}); + ctx.setRegister('blockMode', BlockMode.OUTPUT); + const scope = createScope((yield hash.render(ctx))); + if (withVar) + scope[filepath] = yield evalToken(withVar, ctx); + const templates = (yield liquid._parsePartialFile(filepath, ctx.sync, this.currentFile)); + ctx.push(ctx.opts.jekyllInclude ? createScope({ include: scope }) : scope); + yield renderer.renderTemplates(templates, ctx, emitter); + ctx.pop(); + ctx.restoreRegister(saved); + } + *children(partials, sync) { + if (partials && isString(this.file)) { + return (yield this.liquid._parsePartialFile(this.file, sync, this.currentFile)); + } + return []; + } + partialScope() { + if (isString(this.file)) { + let names; + if (this.liquid.options.jekyllInclude) { + names = ['include']; + } + else { + names = Object.keys(this.hash.hash); + if (this.withVar) { + names.push([this.file, this.withVar]); + } + } + return { name: this.file, isolated: false, scope: names }; + } + } + *arguments() { + yield* Object.values(this.hash.hash).filter(isValueToken); + if (isValueToken(this.file)) { + yield this.file; + } + if (isValueToken(this.withVar)) { + yield this.withVar; + } + } +} + +class DecrementTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.identifier = this.tokenizer.readIdentifier(); + this.variable = this.identifier.content; + } + render(context, emitter) { + const scope = context.environments; + if (!isNumber(scope[this.variable])) { + scope[this.variable] = 0; + } + emitter.write(stringify(--scope[this.variable])); + } + *localScope() { + yield this.identifier; + } +} + +class CycleTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.candidates = []; + const group = this.tokenizer.readValue(); + this.tokenizer.skipBlank(); + if (group) { + if (this.tokenizer.peek() === ':') { + this.group = group; + this.tokenizer.advance(); + } + else + this.candidates.push(group); + } + while (!this.tokenizer.end()) { + const value = this.tokenizer.readValue(); + if (value) + this.candidates.push(value); + this.tokenizer.readTo(','); + } + this.tokenizer.assert(this.candidates.length, () => `empty candidates: "${token.getText()}"`); + } + *render(ctx, emitter) { + const group = (yield evalToken(this.group, ctx)); + const fingerprint = `cycle:${group}:` + this.candidates.join(','); + const groups = ctx.getRegister('cycle', {}); + let idx = groups[fingerprint]; + if (idx === undefined) { + idx = groups[fingerprint] = 0; + } + const candidate = this.candidates[idx]; + idx = (idx + 1) % this.candidates.length; + groups[fingerprint] = idx; + return yield evalToken(candidate, ctx); + } + *arguments() { + yield* this.candidates; + if (this.group) { + yield this.group; + } + } +} + +class IfTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.branches = []; + let p = []; + parser.parseStream(remainTokens) + .on('start', () => this.branches.push({ + value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid), + templates: (p = []) + })) + .on('tag:elsif', (token) => { + assert(!this.elseTemplates, 'unexpected elsif after else'); + this.branches.push({ + value: new Value(token.tokenizer.readFilteredValue(), this.liquid), + templates: (p = []) + }); + }) + .on('tag:else', tag => { + assertEmpty(tag.args); + assert(!this.elseTemplates, 'duplicated else'); + p = this.elseTemplates = []; + }) + .on('tag:endif', function (tag) { assertEmpty(tag.args); this.stop(); }) + .on('template', (tpl) => p.push(tpl)) + .on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`); }) + .start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + for (const { value, templates } of this.branches) { + const v = yield value.value(ctx, ctx.opts.lenientIf); + if (isTruthy(v, ctx)) { + yield r.renderTemplates(templates, ctx, emitter); + return; + } + } + yield r.renderTemplates(this.elseTemplates || [], ctx, emitter); + } + *children() { + const templates = this.branches.flatMap(b => b.templates); + if (this.elseTemplates) { + templates.push(...this.elseTemplates); + } + return templates; + } + arguments() { + return this.branches.map(b => b.value); + } +} + +class IncrementTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.identifier = this.tokenizer.readIdentifier(); + this.variable = this.identifier.content; + } + render(context, emitter) { + const scope = context.environments; + if (!isNumber(scope[this.variable])) { + scope[this.variable] = 0; + } + const val = scope[this.variable]; + scope[this.variable]++; + emitter.write(stringify(val)); + } + *localScope() { + yield this.identifier; + } +} + +class LayoutTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + this.file = parseFilePath(this.tokenizer, this.liquid, parser); + this.currentFile = token.file; + this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator); + this.templates = parser.parseTokens(remainTokens); + } + *render(ctx, emitter) { + const { liquid, args, file } = this; + const { renderer } = liquid; + if (file === undefined) { + ctx.setRegister('blockMode', BlockMode.OUTPUT); + yield renderer.renderTemplates(this.templates, ctx, emitter); + return; + } + const filepath = (yield renderFilePath(this.file, ctx, liquid)); + assert(filepath, () => `illegal file path "${filepath}"`); + const templates = (yield liquid._parseLayoutFile(filepath, ctx.sync, this.currentFile)); + // render remaining contents and store rendered results + ctx.setRegister('blockMode', BlockMode.STORE); + const html = yield renderer.renderTemplates(this.templates, ctx); + const blocks = ctx.getRegister('blocks', {}); + // set whole content to anonymous block if anonymous doesn't specified + if (blocks[''] === undefined) + blocks[''] = (parent, emitter) => emitter.write(html); + ctx.setRegister('blockMode', BlockMode.OUTPUT); + // render the layout file use stored blocks + ctx.push(createScope((yield args.render(ctx)))); + yield renderer.renderTemplates(templates, ctx, emitter); + ctx.pop(); + } + *children(partials) { + const templates = this.templates.slice(); + if (partials && isString(this.file)) { + templates.push(...(yield this.liquid._parsePartialFile(this.file, true, this.currentFile))); + } + return templates; + } + *arguments() { + for (const v of Object.values(this.args.hash)) { + if (isValueToken(v)) { + yield v; + } + } + if (isValueToken(this.file)) { + yield this.file; + } + } + partialScope() { + if (isString(this.file)) { + return { name: this.file, isolated: false, scope: Object.keys(this.args.hash) }; + } + } +} + +class BlockTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + this.templates = []; + const match = /\w+/.exec(token.args); + this.block = match ? match[0] : ''; + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endblock') + return; + const template = parser.parseToken(token, remainTokens); + this.templates.push(template); + } + throw new Error(`tag ${token.getText()} not closed`); + } + *render(ctx, emitter) { + const blockRender = this.getBlockRender(ctx); + if (ctx.getRegister('blockMode') === BlockMode.STORE) { + ctx.getRegister('blocks', {})[this.block] = blockRender; + } + else { + yield blockRender(new BlockDrop(), emitter); + } + } + getBlockRender(ctx) { + const self = this; + const { liquid, templates } = this; + const renderChild = ctx.getRegister('blocks', {})[this.block]; + const renderCurrent = function* (superBlock, emitter) { + const stack = ctx.getRegister('blockStack', []); + if (stack.includes(self)) + throw new Error('block tag cannot be nested'); + stack.push(self); + ctx.push(createScope({ block: superBlock })); + yield liquid.renderer.renderTemplates(templates, ctx, emitter); + ctx.pop(); + stack.pop(); + }; + return renderChild + ? (superBlock, emitter) => renderChild(new BlockDrop((emitter) => renderCurrent(superBlock, emitter)), emitter) + : renderCurrent; + } + *children() { + return this.templates; + } + blockScope() { + return ['block']; + } +} + +class RawTag extends Tag { + constructor(tagToken, remainTokens, liquid) { + super(tagToken, remainTokens, liquid); + this.tokens = []; + while (remainTokens.length) { + const token = remainTokens.shift(); + if (isTagToken(token) && token.name === 'endraw') + return; + this.tokens.push(token); + } + throw new Error(`tag ${tagToken.getText()} not closed`); + } + render() { + return this.tokens.map((token) => token.getText()).join(''); + } +} + +class TablerowloopDrop extends ForloopDrop { + constructor(length, cols, collection, variable) { + super(length, collection, variable); + this.length = length; + this.cols = cols; + } + row() { + return Math.floor(this.i / this.cols) + 1; + } + col0() { + return (this.i % this.cols); + } + col() { + return this.col0() + 1; + } + col_first() { + return this.col0() === 0; + } + col_last() { + return this.col() === this.cols; + } +} + +class TablerowTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + const variable = this.tokenizer.readIdentifier(); + this.tokenizer.skipBlank(); + const predicate = this.tokenizer.readIdentifier(); + const collectionToken = this.tokenizer.readValue(); + if (predicate.content !== 'in' || !collectionToken) { + throw new Error(`illegal tag: ${tagToken.getText()}`); + } + this.variable = variable.content; + this.collection = collectionToken; + this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator); + this.templates = []; + let p; + const stream = parser.parseStream(remainTokens) + .on('start', () => (p = this.templates)) + .on('tag:endtablerow', () => stream.stop()) + .on('template', (tpl) => p.push(tpl)) + .on('end', () => { + throw new Error(`tag ${tagToken.getText()} not closed`); + }); + stream.start(); + } + *render(ctx, emitter) { + let collection = toEnumerable(yield evalToken(this.collection, ctx)); + const args = (yield this.args.render(ctx)); + const offset = args.offset || 0; + const limit = (args.limit === undefined) ? collection.length : args.limit; + collection = collection.slice(offset, offset + limit); + const cols = args.cols || collection.length; + const r = this.liquid.renderer; + const tablerowloop = new TablerowloopDrop(collection.length, cols, this.collection.getText(), this.variable); + const scope = createScope({ tablerowloop }); + ctx.push(scope); + for (let idx = 0; idx < collection.length; idx++, tablerowloop.next()) { + scope[this.variable] = collection[idx]; + if (tablerowloop.col0() === 0) { + if (tablerowloop.row() !== 1) + emitter.write(''); + emitter.write(``); + } + emitter.write(``); + yield r.renderTemplates(this.templates, ctx, emitter); + emitter.write(''); + } + if (collection.length) + emitter.write(''); + ctx.pop(); + } + *children() { + return this.templates; + } + *arguments() { + yield this.collection; + for (const v of Object.values(this.args.hash)) { + if (isValueToken(v)) { + yield v; + } + } + } + blockScope() { + return [this.variable, 'tablerowloop']; + } +} + +class UnlessTag extends Tag { + constructor(tagToken, remainTokens, liquid, parser) { + super(tagToken, remainTokens, liquid); + this.branches = []; + this.elseTemplates = []; + let p = []; + let elseCount = 0; + parser.parseStream(remainTokens) + .on('start', () => this.branches.push({ + value: new Value(tagToken.tokenizer.readFilteredValue(), this.liquid), + test: isFalsy, + templates: (p = []) + })) + .on('tag:elsif', (token) => { + if (elseCount > 0) { + p = []; + return; + } + this.branches.push({ + value: new Value(token.tokenizer.readFilteredValue(), this.liquid), + test: isTruthy, + templates: (p = []) + }); + }) + .on('tag:else', () => { + elseCount++; + p = this.elseTemplates; + }) + .on('tag:endunless', function () { this.stop(); }) + .on('template', (tpl) => { + if (p !== this.elseTemplates || elseCount === 1) { + p.push(tpl); + } + }) + .on('end', () => { throw new Error(`tag ${tagToken.getText()} not closed`); }) + .start(); + } + *render(ctx, emitter) { + const r = this.liquid.renderer; + for (const { value, test, templates } of this.branches) { + const v = yield value.value(ctx, ctx.opts.lenientIf); + if (test(v, ctx)) { + yield r.renderTemplates(templates, ctx, emitter); + return; + } + } + yield r.renderTemplates(this.elseTemplates, ctx, emitter); + } + *children() { + const children = this.branches.flatMap(b => b.templates); + if (this.elseTemplates) { + children.push(...this.elseTemplates); + } + return children; + } + arguments() { + return this.branches.map(b => b.value); + } +} + +class BreakTag extends Tag { + render(ctx, _emitter) { + ctx.breakCalled = true; + } +} + +class ContinueTag extends Tag { + render(ctx, _emitter) { + ctx.continueCalled = true; + } +} + +class EchoTag extends Tag { + constructor(token, remainTokens, liquid) { + super(token, remainTokens, liquid); + this.tokenizer.skipBlank(); + if (!this.tokenizer.end()) { + this.value = new Value(this.tokenizer.readFilteredValue(), this.liquid); + } + } + *render(ctx, emitter) { + if (!this.value) + return; + const val = yield this.value.value(ctx, false); + emitter.write(val); + } + *arguments() { + if (this.value) { + yield this.value; + } + } +} + +class LiquidTag extends Tag { + constructor(token, remainTokens, liquid, parser) { + super(token, remainTokens, liquid); + const tokens = this.tokenizer.readLiquidTagTokens(this.liquid.options); + this.templates = parser.parseTokens(tokens); + } + *render(ctx, emitter) { + yield this.liquid.renderer.renderTemplates(this.templates, ctx, emitter); + } + *children() { + return this.templates; + } +} + +class InlineCommentTag extends Tag { + constructor(tagToken, remainTokens, liquid) { + super(tagToken, remainTokens, liquid); + if (tagToken.args.search(/\n\s*[^#\s]/g) !== -1) { + throw new Error('every line of an inline comment must start with a \'#\' character'); + } + } + render() { } +} + +const tags = { + assign: AssignTag, + 'for': ForTag, + capture: CaptureTag, + 'case': CaseTag, + comment: CommentTag, + include: IncludeTag, + render: RenderTag, + decrement: DecrementTag, + increment: IncrementTag, + cycle: CycleTag, + 'if': IfTag, + layout: LayoutTag, + block: BlockTag, + raw: RawTag, + tablerow: TablerowTag, + unless: UnlessTag, + 'break': BreakTag, + 'continue': ContinueTag, + echo: EchoTag, + liquid: LiquidTag, + '#': InlineCommentTag +}; + +class Liquid { + constructor(opts = {}) { + this.renderer = new Render(); + this.filters = Object.create(null); + this.tags = Object.create(null); + this.options = normalize(opts); + // eslint-disable-next-line deprecation/deprecation + this.parser = new Parser(this); + forOwn(tags, (conf, name) => this.registerTag(name, conf)); + forOwn(filters, (handler, name) => this.registerFilter(name, handler)); + } + parse(html, filepath) { + const parser = new Parser(this); + return parser.parse(html, filepath); + } + _render(tpl, scope, renderOptions) { + const ctx = scope instanceof Context ? scope : new Context(scope, this.options, renderOptions); + return this.renderer.renderTemplates(tpl, ctx); + } + render(tpl, scope, renderOptions) { + return __awaiter(this, void 0, void 0, function* () { + return toPromise(this._render(tpl, scope, Object.assign(Object.assign({}, renderOptions), { sync: false }))); + }); + } + renderSync(tpl, scope, renderOptions) { + return toValueSync(this._render(tpl, scope, Object.assign(Object.assign({}, renderOptions), { sync: true }))); + } + renderToNodeStream(tpl, scope, renderOptions = {}) { + const ctx = new Context(scope, this.options, renderOptions); + return this.renderer.renderTemplatesToNodeStream(tpl, ctx); + } + _parseAndRender(html, scope, renderOptions) { + const tpl = this.parse(html); + return this._render(tpl, scope, renderOptions); + } + parseAndRender(html, scope, renderOptions) { + return __awaiter(this, void 0, void 0, function* () { + return toPromise(this._parseAndRender(html, scope, Object.assign(Object.assign({}, renderOptions), { sync: false }))); + }); + } + parseAndRenderSync(html, scope, renderOptions) { + return toValueSync(this._parseAndRender(html, scope, Object.assign(Object.assign({}, renderOptions), { sync: true }))); + } + _parsePartialFile(file, sync, currentFile) { + return new Parser(this).parseFile(file, sync, LookupType.Partials, currentFile); + } + _parseLayoutFile(file, sync, currentFile) { + return new Parser(this).parseFile(file, sync, LookupType.Layouts, currentFile); + } + _parseFile(file, sync, lookupType, currentFile) { + return new Parser(this).parseFile(file, sync, lookupType, currentFile); + } + parseFile(file, lookupType) { + return __awaiter(this, void 0, void 0, function* () { + return toPromise(new Parser(this).parseFile(file, false, lookupType)); + }); + } + parseFileSync(file, lookupType) { + return toValueSync(new Parser(this).parseFile(file, true, lookupType)); + } + *_renderFile(file, ctx, renderFileOptions) { + const templates = (yield this._parseFile(file, renderFileOptions.sync, renderFileOptions.lookupType)); + return yield this._render(templates, ctx, renderFileOptions); + } + renderFile(file, ctx, renderFileOptions) { + return __awaiter(this, void 0, void 0, function* () { + return toPromise(this._renderFile(file, ctx, Object.assign(Object.assign({}, renderFileOptions), { sync: false }))); + }); + } + renderFileSync(file, ctx, renderFileOptions) { + return toValueSync(this._renderFile(file, ctx, Object.assign(Object.assign({}, renderFileOptions), { sync: true }))); + } + renderFileToNodeStream(file, scope, renderOptions) { + return __awaiter(this, void 0, void 0, function* () { + const templates = yield this.parseFile(file); + return this.renderToNodeStream(templates, scope, renderOptions); + }); + } + _evalValue(str, scope) { + const value = new Value(str, this); + const ctx = scope instanceof Context ? scope : new Context(scope, this.options); + return value.value(ctx); + } + evalValue(str, scope) { + return __awaiter(this, void 0, void 0, function* () { + return toPromise(this._evalValue(str, scope)); + }); + } + evalValueSync(str, scope) { + return toValueSync(this._evalValue(str, scope)); + } + registerFilter(name, filter) { + this.filters[name] = filter; + } + registerTag(name, tag) { + this.tags[name] = isFunction(tag) ? tag : createTagClass(tag); + } + plugin(plugin) { + return plugin.call(this, Liquid); + } + express() { + const self = this; // eslint-disable-line + let firstCall = true; + return function (filePath, ctx, callback) { + if (firstCall) { + firstCall = false; + const dirs = normalizeDirectoryList(this.root); + self.options.root.unshift(...dirs); + self.options.layouts.unshift(...dirs); + self.options.partials.unshift(...dirs); + } + self.renderFile(filePath, ctx).then(html => callback(null, html), callback); + }; + } + analyze(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + return analyze(template, options); + }); + } + analyzeSync(template, options = {}) { + return analyzeSync(template, options); + } + parseAndAnalyze(html, filename, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + return analyze(this.parse(html, filename), options); + }); + } + parseAndAnalyzeSync(html, filename, options = {}) { + return analyzeSync(this.parse(html, filename), options); + } + /** Return an array of all variables without their properties. */ + variables(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.variables); + }); + } + /** Return an array of all variables without their properties. */ + variablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.variables); + } + /** Return an array of all variables including their properties/paths. */ + fullVariables(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v))))); + }); + } + /** Return an array of all variables including their properties/paths. */ + fullVariablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.variables).flatMap((a) => a.map((v) => String(v))))); + } + /** Return an array of all variables, each as an array of properties/segments. */ + variableSegments(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray())))); + }); + } + /** Return an array of all variables, each as an array of properties/segments. */ + variableSegmentsSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.variables).flatMap((a) => a.map((v) => v.toArray())))); + } + /** Return an array of all expected context variables without their properties. */ + globalVariables(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.globals); + }); + } + /** Return an array of all expected context variables without their properties. */ + globalVariablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Object.keys(analysis.globals); + } + /** Return an array of all expected context variables including their properties/paths. */ + globalFullVariables(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v))))); + }); + } + /** Return an array of all expected context variables including their properties/paths. */ + globalFullVariablesSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(new Set(Object.values(analysis.globals).flatMap((a) => a.map((v) => String(v))))); + } + /** Return an array of all expected context variables, each as an array of properties/segments. */ + globalVariableSegments(template, options = {}) { + return __awaiter(this, void 0, void 0, function* () { + const analysis = yield analyze(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray())))); + }); + } + /** Return an array of all expected context variables, each as an array of properties/segments. */ + globalVariableSegmentsSync(template, options = {}) { + const analysis = analyzeSync(isString(template) ? this.parse(template) : template, options); + return Array.from(strictUniq(Object.values(analysis.globals).flatMap((a) => a.map((v) => v.toArray())))); + } +} + +/* istanbul ignore file */ +const version = '[VI]{version}[/VI]'; + +export { AssertionError, AssignTag, BlockTag, BreakTag, CaptureTag, CaseTag, CommentTag, Context, ContinueTag, CycleTag, DecrementTag, Drop, EchoTag, Expression, Filter, ForTag, Hash, IfTag, IncludeTag, IncrementTag, InlineCommentTag, LayoutTag, Liquid, LiquidError, LiquidTag, LookupType, Output, ParseError, ParseStream, Parser, RawTag, RenderError, RenderTag, TablerowTag, Tag, TagToken, Token, TokenKind, TokenizationError, Tokenizer, typeGuards as TypeGuards, UndefinedVariableError, UnlessTag, Value, Variable, analyze, analyzeSync, assert, createTrie, defaultOperators, defaultOptions, evalQuotedToken, evalToken, filters, isFalsy, isTruthy, tags, toPromise, toValue, toValueSync, version }; diff --git a/node_modules/liquidjs/dist/parser/filter-arg.d.ts b/node_modules/liquidjs/dist/parser/filter-arg.d.ts new file mode 100644 index 00000000..e552e595 --- /dev/null +++ b/node_modules/liquidjs/dist/parser/filter-arg.d.ts @@ -0,0 +1,5 @@ +import { ValueToken } from '../tokens/value-token'; +type KeyValuePair = [string?, ValueToken?]; +export type FilterArg = ValueToken | KeyValuePair; +export declare function isKeyValuePair(arr: FilterArg): arr is KeyValuePair; +export {}; diff --git a/node_modules/liquidjs/dist/parser/index.d.ts b/node_modules/liquidjs/dist/parser/index.d.ts new file mode 100644 index 00000000..275faea7 --- /dev/null +++ b/node_modules/liquidjs/dist/parser/index.d.ts @@ -0,0 +1,4 @@ +export * from './tokenizer'; +export * from './parser'; +export * from './parse-stream'; +export * from './token-kind'; diff --git a/node_modules/liquidjs/dist/parser/parse-stream.d.ts b/node_modules/liquidjs/dist/parser/parse-stream.d.ts new file mode 100644 index 00000000..7ac8223f --- /dev/null +++ b/node_modules/liquidjs/dist/parser/parse-stream.d.ts @@ -0,0 +1,15 @@ +import { Token, TopLevelToken } from '../tokens'; +import { Template } from '../template'; +type ParseToken = ((token: T, remainTokens: T[]) => Template); +export declare class ParseStream { + private tokens; + private handlers; + private stopRequested; + private parseToken; + constructor(tokens: T[], parseToken: ParseToken); + on(name: string, cb: (this: ParseStream, arg: T2) => void): ParseStream; + private trigger; + start(): this; + stop(): this; +} +export {}; diff --git a/node_modules/liquidjs/dist/parser/parse-stream.spec.d.ts b/node_modules/liquidjs/dist/parser/parse-stream.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/parser/parse-stream.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/parser/parser.d.ts b/node_modules/liquidjs/dist/parser/parser.d.ts new file mode 100644 index 00000000..5a9d834e --- /dev/null +++ b/node_modules/liquidjs/dist/parser/parser.d.ts @@ -0,0 +1,21 @@ +import { ParseStream } from './parse-stream'; +import { TopLevelToken } from '../tokens'; +import { Template, Output, HTML } from '../template'; +import { LookupType } from '../fs'; +import type { Liquid } from '../liquid'; +export declare class Parser { + parseFile: (file: string, sync?: boolean, type?: LookupType, currentFile?: string) => Generator; + private liquid; + private fs; + private cache?; + private loader; + private parseLimit; + private readFile; + constructor(liquid: Liquid); + parse(html: string, filepath?: string): Template[]; + parseTokens(tokens: TopLevelToken[]): Template[]; + parseToken(token: TopLevelToken, remainTokens: TopLevelToken[]): import("../template").Tag | Output | HTML; + parseStream(tokens: TopLevelToken[]): ParseStream; + private _parseFileCached; + private _parseFile; +} diff --git a/node_modules/liquidjs/dist/parser/parser.spec.d.ts b/node_modules/liquidjs/dist/parser/parser.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/parser/parser.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/parser/token-kind.d.ts b/node_modules/liquidjs/dist/parser/token-kind.d.ts new file mode 100644 index 00000000..6f15bf0f --- /dev/null +++ b/node_modules/liquidjs/dist/parser/token-kind.d.ts @@ -0,0 +1,16 @@ +export declare enum TokenKind { + Number = 1, + Literal = 2, + Tag = 4, + Output = 8, + HTML = 16, + Filter = 32, + Hash = 64, + PropertyAccess = 128, + Word = 256, + Range = 512, + Quoted = 1024, + Operator = 2048, + FilteredValue = 4096, + Delimited = 12 +} diff --git a/node_modules/liquidjs/dist/parser/tokenizer.d.ts b/node_modules/liquidjs/dist/parser/tokenizer.d.ts new file mode 100644 index 00000000..94bc09ff --- /dev/null +++ b/node_modules/liquidjs/dist/parser/tokenizer.d.ts @@ -0,0 +1,63 @@ +import { FilteredValueToken, TagToken, HTMLToken, HashToken, QuotedToken, LiquidTagToken, OutputToken, ValueToken, Token, RangeToken, FilterToken, TopLevelToken, OperatorToken, LiteralToken, IdentifierToken, NumberToken } from '../tokens'; +import { Trie, TokenizationError } from '../util'; +import { Operators, Expression } from '../render'; +import { NormalizedFullOptions } from '../liquid-options'; +import { FilterArg } from './filter-arg'; +export declare class Tokenizer { + input: string; + file?: string | undefined; + p: number; + N: number; + private rawBeginAt; + private opTrie; + private literalTrie; + constructor(input: string, operators?: Operators, file?: string | undefined, range?: [number, number]); + readExpression(): Expression; + readExpressionTokens(): IterableIterator; + readOperator(): OperatorToken | undefined; + matchTrie(trie: Trie): number; + readFilteredValue(): FilteredValueToken; + readFilters(): FilterToken[]; + readFilter(): FilterToken | null; + readFilterArg(): FilterArg | undefined; + readTopLevelTokens(options?: NormalizedFullOptions): TopLevelToken[]; + readTopLevelToken(options: NormalizedFullOptions): TopLevelToken; + readHTMLToken(stopStrings: string[]): HTMLToken; + readTagToken(options: NormalizedFullOptions): TagToken; + readToDelimiter(delimiter: string, respectQuoted?: boolean): number; + readOutputToken(options?: NormalizedFullOptions): OutputToken; + readEndrawOrRawContent(options: NormalizedFullOptions): HTMLToken | TagToken; + readLiquidTagTokens(options?: NormalizedFullOptions): LiquidTagToken[]; + readLiquidTagToken(options: NormalizedFullOptions): LiquidTagToken | undefined; + error(msg: string, pos?: number): TokenizationError; + assert(pred: unknown, msg: string | (() => string), pos?: number): void; + snapshot(begin?: number): string; + /** + * @deprecated use #readIdentifier instead + */ + readWord(): IdentifierToken; + readIdentifier(): IdentifierToken; + readNonEmptyIdentifier(): IdentifierToken | undefined; + readTagName(): string; + readHashes(jekyllStyle?: boolean | string): HashToken[]; + readHash(jekyllStyle?: boolean | string): HashToken | undefined; + remaining(): string; + advance(step?: number): void; + end(): boolean; + read(): string; + readTo(end: string): number; + readValue(): ValueToken | undefined; + readScopeValue(): ValueToken | undefined; + private readProperties; + readNumber(): NumberToken | undefined; + readLiteral(): LiteralToken | undefined; + readRange(): RangeToken | undefined; + readValueOrThrow(): ValueToken; + readQuoted(): QuotedToken | undefined; + readFileNameTemplate(options: NormalizedFullOptions): IterableIterator; + match(word: string): boolean; + rmatch(pattern: string): boolean; + peekType(n?: number): number; + peek(n?: number): string; + skipBlank(): void; +} diff --git a/node_modules/liquidjs/dist/parser/tokenizer.spec.d.ts b/node_modules/liquidjs/dist/parser/tokenizer.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/parser/tokenizer.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/parser/whitespace-ctrl.d.ts b/node_modules/liquidjs/dist/parser/whitespace-ctrl.d.ts new file mode 100644 index 00000000..baf8be7e --- /dev/null +++ b/node_modules/liquidjs/dist/parser/whitespace-ctrl.d.ts @@ -0,0 +1,3 @@ +import { Token } from '../tokens'; +import { NormalizedFullOptions } from '../liquid-options'; +export declare function whiteSpaceCtrl(tokens: Token[], options: NormalizedFullOptions): void; diff --git a/node_modules/liquidjs/dist/render/boolean.d.ts b/node_modules/liquidjs/dist/render/boolean.d.ts new file mode 100644 index 00000000..aba44c69 --- /dev/null +++ b/node_modules/liquidjs/dist/render/boolean.d.ts @@ -0,0 +1,3 @@ +import { Context } from '../context/context'; +export declare function isTruthy(val: any, ctx: Context): boolean; +export declare function isFalsy(val: any, ctx: Context): boolean; diff --git a/node_modules/liquidjs/dist/render/boolean.spec.d.ts b/node_modules/liquidjs/dist/render/boolean.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/render/boolean.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/render/expression.d.ts b/node_modules/liquidjs/dist/render/expression.d.ts new file mode 100644 index 00000000..1afc2a8f --- /dev/null +++ b/node_modules/liquidjs/dist/render/expression.d.ts @@ -0,0 +1,10 @@ +import { QuotedToken, Token } from '../tokens'; +import type { Context } from '../context'; +export declare class Expression { + readonly postfix: Token[]; + constructor(tokens: IterableIterator); + evaluate(ctx: Context, lenient?: boolean): Generator; + valid(): boolean; +} +export declare function evalToken(token: Token | undefined, ctx: Context, lenient?: boolean): IterableIterator; +export declare function evalQuotedToken(token: QuotedToken): string; diff --git a/node_modules/liquidjs/dist/render/expression.spec.d.ts b/node_modules/liquidjs/dist/render/expression.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/render/expression.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/render/index.d.ts b/node_modules/liquidjs/dist/render/index.d.ts new file mode 100644 index 00000000..80c98505 --- /dev/null +++ b/node_modules/liquidjs/dist/render/index.d.ts @@ -0,0 +1,4 @@ +export * from './render'; +export * from './expression'; +export * from './operator'; +export * from './boolean'; diff --git a/node_modules/liquidjs/dist/render/operator.d.ts b/node_modules/liquidjs/dist/render/operator.d.ts new file mode 100644 index 00000000..3d301d51 --- /dev/null +++ b/node_modules/liquidjs/dist/render/operator.d.ts @@ -0,0 +1,8 @@ +import { Context } from '../context'; +export type UnaryOperatorHandler = (operand: any, ctx: Context) => boolean; +export type BinaryOperatorHandler = (lhs: any, rhs: any, ctx: Context) => boolean; +export type OperatorHandler = UnaryOperatorHandler | BinaryOperatorHandler; +export type Operators = Record; +export declare const defaultOperators: Operators; +export declare function equals(lhs: any, rhs: any): boolean; +export declare function arrayIncludes(arr: any[], item: any): boolean; diff --git a/node_modules/liquidjs/dist/render/render.d.ts b/node_modules/liquidjs/dist/render/render.d.ts new file mode 100644 index 00000000..c642d8a3 --- /dev/null +++ b/node_modules/liquidjs/dist/render/render.d.ts @@ -0,0 +1,8 @@ +/// +import { Context } from '../context'; +import { Template } from '../template'; +import { Emitter } from '../emitters'; +export declare class Render { + renderTemplatesToNodeStream(templates: Template[], ctx: Context): NodeJS.ReadableStream; + renderTemplates(templates: Template[], ctx: Context, emitter?: Emitter): IterableIterator; +} diff --git a/node_modules/liquidjs/dist/render/render.spec.d.ts b/node_modules/liquidjs/dist/render/render.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/render/render.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/render/string.d.ts b/node_modules/liquidjs/dist/render/string.d.ts new file mode 100644 index 00000000..18066154 --- /dev/null +++ b/node_modules/liquidjs/dist/render/string.d.ts @@ -0,0 +1 @@ +export declare function parseStringLiteral(str: string): string; diff --git a/node_modules/liquidjs/dist/render/string.spec.d.ts b/node_modules/liquidjs/dist/render/string.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/render/string.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/tags/assign.d.ts b/node_modules/liquidjs/dist/tags/assign.d.ts new file mode 100644 index 00000000..32589d3d --- /dev/null +++ b/node_modules/liquidjs/dist/tags/assign.d.ts @@ -0,0 +1,12 @@ +import { Liquid, TopLevelToken, TagToken, Context, Tag } from '..'; +import { Arguments } from '../template'; +import { IdentifierToken } from '../tokens'; +export default class extends Tag { + private key; + private value; + private identifier; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid); + render(ctx: Context): Generator; + arguments(): Arguments; + localScope(): Iterable; +} diff --git a/node_modules/liquidjs/dist/tags/block.d.ts b/node_modules/liquidjs/dist/tags/block.d.ts new file mode 100644 index 00000000..c1c6a36e --- /dev/null +++ b/node_modules/liquidjs/dist/tags/block.d.ts @@ -0,0 +1,11 @@ +import { Liquid, TagToken, TopLevelToken, Template, Context, Emitter, Tag } from '..'; +import { Parser } from '../parser'; +export default class extends Tag { + block: string; + templates: Template[]; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser); + render(ctx: Context, emitter: Emitter): Generator; + private getBlockRender; + children(): Generator; + blockScope(): Iterable; +} diff --git a/node_modules/liquidjs/dist/tags/break.d.ts b/node_modules/liquidjs/dist/tags/break.d.ts new file mode 100644 index 00000000..8b21aeac --- /dev/null +++ b/node_modules/liquidjs/dist/tags/break.d.ts @@ -0,0 +1,4 @@ +import { Context, Emitter, Tag } from '..'; +export default class extends Tag { + render(ctx: Context, _emitter: Emitter): void; +} diff --git a/node_modules/liquidjs/dist/tags/capture.d.ts b/node_modules/liquidjs/dist/tags/capture.d.ts new file mode 100644 index 00000000..351b8b1e --- /dev/null +++ b/node_modules/liquidjs/dist/tags/capture.d.ts @@ -0,0 +1,13 @@ +import { Liquid, Tag, Template, Context, TagToken, TopLevelToken } from '..'; +import { Parser } from '../parser'; +import { IdentifierToken, QuotedToken } from '../tokens'; +export default class extends Tag { + identifier: IdentifierToken | QuotedToken; + variable: string; + templates: Template[]; + constructor(tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser); + private readVariable; + render(ctx: Context): Generator; + children(): Generator; + localScope(): Iterable; +} diff --git a/node_modules/liquidjs/dist/tags/case.d.ts b/node_modules/liquidjs/dist/tags/case.d.ts new file mode 100644 index 00000000..b475171f --- /dev/null +++ b/node_modules/liquidjs/dist/tags/case.d.ts @@ -0,0 +1,15 @@ +import { ValueToken, Liquid, Value, Emitter, TagToken, TopLevelToken, Context, Template, Tag } from '..'; +import { Parser } from '../parser'; +import { Arguments } from '../template'; +export default class extends Tag { + value: Value; + branches: { + values: ValueToken[]; + templates: Template[]; + }[]; + elseTemplates: Template[]; + constructor(tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser); + render(ctx: Context, emitter: Emitter): Generator; + arguments(): Arguments; + children(): Generator; +} diff --git a/node_modules/liquidjs/dist/tags/comment.d.ts b/node_modules/liquidjs/dist/tags/comment.d.ts new file mode 100644 index 00000000..2487a655 --- /dev/null +++ b/node_modules/liquidjs/dist/tags/comment.d.ts @@ -0,0 +1,5 @@ +import { Liquid, TopLevelToken, TagToken, Tag } from '..'; +export default class extends Tag { + constructor(tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid); + render(): void; +} diff --git a/node_modules/liquidjs/dist/tags/continue.d.ts b/node_modules/liquidjs/dist/tags/continue.d.ts new file mode 100644 index 00000000..009876e6 --- /dev/null +++ b/node_modules/liquidjs/dist/tags/continue.d.ts @@ -0,0 +1,4 @@ +import { Tag, Emitter, Context } from '..'; +export default class extends Tag { + render(ctx: Context, _emitter: Emitter): void; +} diff --git a/node_modules/liquidjs/dist/tags/cycle.d.ts b/node_modules/liquidjs/dist/tags/cycle.d.ts new file mode 100644 index 00000000..0937521d --- /dev/null +++ b/node_modules/liquidjs/dist/tags/cycle.d.ts @@ -0,0 +1,9 @@ +import { TopLevelToken, Liquid, Emitter, TagToken, Context, Tag } from '..'; +import { Arguments } from '../template'; +export default class extends Tag { + private candidates; + private group?; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid); + render(ctx: Context, emitter: Emitter): Generator; + arguments(): Arguments; +} diff --git a/node_modules/liquidjs/dist/tags/decrement.d.ts b/node_modules/liquidjs/dist/tags/decrement.d.ts new file mode 100644 index 00000000..bc013e5d --- /dev/null +++ b/node_modules/liquidjs/dist/tags/decrement.d.ts @@ -0,0 +1,9 @@ +import { Tag, Liquid, TopLevelToken, Emitter, TagToken, Context } from '..'; +import { IdentifierToken } from '../tokens'; +export default class extends Tag { + private identifier; + private variable; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid); + render(context: Context, emitter: Emitter): void; + localScope(): Iterable; +} diff --git a/node_modules/liquidjs/dist/tags/echo.d.ts b/node_modules/liquidjs/dist/tags/echo.d.ts new file mode 100644 index 00000000..77392207 --- /dev/null +++ b/node_modules/liquidjs/dist/tags/echo.d.ts @@ -0,0 +1,8 @@ +import { Liquid, TopLevelToken, Emitter, TagToken, Context, Tag } from '..'; +import { Arguments } from '../template'; +export default class extends Tag { + private value?; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid); + render(ctx: Context, emitter: Emitter): Generator; + arguments(): Arguments; +} diff --git a/node_modules/liquidjs/dist/tags/for.d.ts b/node_modules/liquidjs/dist/tags/for.d.ts new file mode 100644 index 00000000..543b0f0e --- /dev/null +++ b/node_modules/liquidjs/dist/tags/for.d.ts @@ -0,0 +1,15 @@ +import { Hash, ValueToken, Liquid, Tag, Emitter, TagToken, TopLevelToken, Context, Template } from '..'; +import { Parser } from '../parser'; +import { Arguments } from '../template'; +export default class extends Tag { + variable: string; + collection: ValueToken; + hash: Hash; + templates: Template[]; + elseTemplates: Template[]; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser); + render(ctx: Context, emitter: Emitter): Generator; + children(): Generator; + arguments(): Arguments; + blockScope(): Iterable; +} diff --git a/node_modules/liquidjs/dist/tags/if.d.ts b/node_modules/liquidjs/dist/tags/if.d.ts new file mode 100644 index 00000000..2a8a6f69 --- /dev/null +++ b/node_modules/liquidjs/dist/tags/if.d.ts @@ -0,0 +1,14 @@ +import { Liquid, Tag, Value, Emitter, TagToken, TopLevelToken, Context, Template } from '..'; +import { Parser } from '../parser'; +import { Arguments } from '../template'; +export default class extends Tag { + branches: { + value: Value; + templates: Template[]; + }[]; + elseTemplates: Template[] | undefined; + constructor(tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser); + render(ctx: Context, emitter: Emitter): Generator; + children(): Generator; + arguments(): Arguments; +} diff --git a/node_modules/liquidjs/dist/tags/include.d.ts b/node_modules/liquidjs/dist/tags/include.d.ts new file mode 100644 index 00000000..3e60b78f --- /dev/null +++ b/node_modules/liquidjs/dist/tags/include.d.ts @@ -0,0 +1,14 @@ +import { Template, TopLevelToken, Liquid, Tag, Emitter, TagToken, Context } from '..'; +import { Parser } from '../parser'; +import { Arguments, PartialScope } from '../template'; +export default class extends Tag { + private file; + private currentFile?; + private withVar?; + private hash; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser); + render(ctx: Context, emitter: Emitter): Generator; + children(partials: boolean, sync: boolean): Generator; + partialScope(): PartialScope | undefined; + arguments(): Arguments; +} diff --git a/node_modules/liquidjs/dist/tags/increment.d.ts b/node_modules/liquidjs/dist/tags/increment.d.ts new file mode 100644 index 00000000..bc013e5d --- /dev/null +++ b/node_modules/liquidjs/dist/tags/increment.d.ts @@ -0,0 +1,9 @@ +import { Tag, Liquid, TopLevelToken, Emitter, TagToken, Context } from '..'; +import { IdentifierToken } from '../tokens'; +export default class extends Tag { + private identifier; + private variable; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid); + render(context: Context, emitter: Emitter): void; + localScope(): Iterable; +} diff --git a/node_modules/liquidjs/dist/tags/index.d.ts b/node_modules/liquidjs/dist/tags/index.d.ts new file mode 100644 index 00000000..89ea4498 --- /dev/null +++ b/node_modules/liquidjs/dist/tags/index.d.ts @@ -0,0 +1,24 @@ +import AssignTag from './assign'; +import ForTag from './for'; +import CaptureTag from './capture'; +import CaseTag from './case'; +import CommentTag from './comment'; +import IncludeTag from './include'; +import RenderTag from './render'; +import DecrementTag from './decrement'; +import CycleTag from './cycle'; +import IfTag from './if'; +import IncrementTag from './increment'; +import LayoutTag from './layout'; +import BlockTag from './block'; +import RawTag from './raw'; +import TablerowTag from './tablerow'; +import UnlessTag from './unless'; +import BreakTag from './break'; +import ContinueTag from './continue'; +import EchoTag from './echo'; +import LiquidTag from './liquid'; +import InlineCommentTag from './inline-comment'; +import type { TagClass } from '../template/tag'; +export declare const tags: Record; +export { AssignTag, ForTag, CaptureTag, CaseTag, CommentTag, IncludeTag, RenderTag, DecrementTag, IncrementTag, CycleTag, IfTag, LayoutTag, BlockTag, RawTag, TablerowTag, UnlessTag, BreakTag, ContinueTag, EchoTag, LiquidTag, InlineCommentTag }; diff --git a/node_modules/liquidjs/dist/tags/inline-comment.d.ts b/node_modules/liquidjs/dist/tags/inline-comment.d.ts new file mode 100644 index 00000000..12d0d02d --- /dev/null +++ b/node_modules/liquidjs/dist/tags/inline-comment.d.ts @@ -0,0 +1,5 @@ +import { TagToken, Liquid, TopLevelToken, Tag } from '..'; +export default class extends Tag { + constructor(tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid); + render(): void; +} diff --git a/node_modules/liquidjs/dist/tags/layout.d.ts b/node_modules/liquidjs/dist/tags/layout.d.ts new file mode 100644 index 00000000..0d2076e0 --- /dev/null +++ b/node_modules/liquidjs/dist/tags/layout.d.ts @@ -0,0 +1,15 @@ +import { Template, Liquid, Tag, Emitter, Hash, TagToken, TopLevelToken, Context } from '..'; +import { ParsedFileName } from './render'; +import { Parser } from '../parser'; +import { Arguments, PartialScope } from '../template'; +export default class extends Tag { + args: Hash; + templates: Template[]; + file?: ParsedFileName; + private currentFile?; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser); + render(ctx: Context, emitter: Emitter): Generator; + children(partials: boolean): Generator; + arguments(): Arguments; + partialScope(): PartialScope | undefined; +} diff --git a/node_modules/liquidjs/dist/tags/liquid.d.ts b/node_modules/liquidjs/dist/tags/liquid.d.ts new file mode 100644 index 00000000..583fe710 --- /dev/null +++ b/node_modules/liquidjs/dist/tags/liquid.d.ts @@ -0,0 +1,8 @@ +import { Template, Emitter, Liquid, TopLevelToken, TagToken, Context, Tag } from '..'; +import { Parser } from '../parser'; +export default class extends Tag { + templates: Template[]; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser); + render(ctx: Context, emitter: Emitter): Generator; + children(): Generator; +} diff --git a/node_modules/liquidjs/dist/tags/raw.d.ts b/node_modules/liquidjs/dist/tags/raw.d.ts new file mode 100644 index 00000000..c8c6f5dd --- /dev/null +++ b/node_modules/liquidjs/dist/tags/raw.d.ts @@ -0,0 +1,6 @@ +import { Liquid, TagToken, TopLevelToken, Tag } from '..'; +export default class extends Tag { + private tokens; + constructor(tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid); + render(): string; +} diff --git a/node_modules/liquidjs/dist/tags/render.d.ts b/node_modules/liquidjs/dist/tags/render.d.ts new file mode 100644 index 00000000..09fe7cf8 --- /dev/null +++ b/node_modules/liquidjs/dist/tags/render.d.ts @@ -0,0 +1,24 @@ +import { TopLevelToken, Liquid, Token, Template, Tokenizer, Emitter, TagToken, Context, Tag } from '..'; +import { Parser } from '../parser'; +import { Arguments, PartialScope } from '../template'; +export type ParsedFileName = Template[] | Token | string | undefined; +export default class extends Tag { + private file; + private currentFile?; + private hash; + private with?; + private forBinding?; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser); + render(ctx: Context, emitter: Emitter): Generator; + children(partials: boolean, sync: boolean): Generator; + partialScope(): PartialScope | undefined; + arguments(): Arguments; +} +/** + * @return null for "none", + * @return Template[] for quoted with tags and/or filters + * @return Token for expression (not quoted) + * @throws TypeError if cannot read next token + */ +export declare function parseFilePath(tokenizer: Tokenizer, liquid: Liquid, parser: Parser): ParsedFileName; +export declare function renderFilePath(file: ParsedFileName, ctx: Context, liquid: Liquid): IterableIterator; diff --git a/node_modules/liquidjs/dist/tags/tablerow.d.ts b/node_modules/liquidjs/dist/tags/tablerow.d.ts new file mode 100644 index 00000000..7169f935 --- /dev/null +++ b/node_modules/liquidjs/dist/tags/tablerow.d.ts @@ -0,0 +1,14 @@ +import { ValueToken, Liquid, Tag, Emitter, Hash, TagToken, TopLevelToken, Context, Template } from '..'; +import { Parser } from '../parser'; +import { Arguments } from '../template'; +export default class extends Tag { + variable: string; + args: Hash; + templates: Template[]; + collection: ValueToken; + constructor(tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser); + render(ctx: Context, emitter: Emitter): Generator; + children(): Generator; + arguments(): Arguments; + blockScope(): string[]; +} diff --git a/node_modules/liquidjs/dist/tags/unless.d.ts b/node_modules/liquidjs/dist/tags/unless.d.ts new file mode 100644 index 00000000..15a54d4f --- /dev/null +++ b/node_modules/liquidjs/dist/tags/unless.d.ts @@ -0,0 +1,15 @@ +import { Liquid, Tag, Value, TopLevelToken, Template, Emitter, Context, TagToken } from '..'; +import { Parser } from '../parser'; +import { Arguments } from '../template'; +export default class extends Tag { + branches: { + value: Value; + test: (val: any, ctx: Context) => boolean; + templates: Template[]; + }[]; + elseTemplates: Template[]; + constructor(tagToken: TagToken, remainTokens: TopLevelToken[], liquid: Liquid, parser: Parser); + render(ctx: Context, emitter: Emitter): Generator; + children(): Generator; + arguments(): Arguments; +} diff --git a/node_modules/liquidjs/dist/template/analysis.d.ts b/node_modules/liquidjs/dist/template/analysis.d.ts new file mode 100644 index 00000000..cae2618d --- /dev/null +++ b/node_modules/liquidjs/dist/template/analysis.d.ts @@ -0,0 +1,85 @@ +import { Template } from '.'; +/** + * Row, column and file name where a variable was found. + */ +export interface VariableLocation { + row: number; + col: number; + file?: string; +} +/** + * A variable's segments as an array, possibly with nested arrays of segments. + */ +export type SegmentArray = Array; +/** + * A variable's segments and location, which can be coerced to a string. + */ +export declare class Variable { + readonly segments: Array; + readonly location: VariableLocation; + constructor(segments: Array, location: VariableLocation); + toString(): string; + /** Return this variable's segments as an array, possibly with nested arrays for nested paths. */ + toArray(): SegmentArray; +} +/** + * Property names and array indexes that make up a path to a variable. + */ +export type VariableSegments = Array; +/** + * A mapping of variable names to an array of locations at which the variable was found. + */ +export type Variables = { + [key: string]: Variable[]; +}; +/** + * Group variables by the string representation of their root segment. + */ +export declare class VariableMap { + private map; + constructor(); + get(key: Variable): Variable[]; + has(key: Variable): boolean; + push(variable: Variable): void; + asObject(): Variables; +} +/** + * The result of calling `analyze()` or `analyzeSync()`. + */ +export interface StaticAnalysis { + /** + * All variables, whether they are in scope or not. Including references to names + * such as `forloop` from the `for` tag. + */ + variables: Variables; + /** + * Variables that are not in scope. These could be a "global" variables that are + * expected to be provided by the application developer, or possible mistakes + * from the template author. + * + * If a variable is referenced before and after assignment, you should expect + * that variable to be included in `globals`, `variables` and `locals`, each with + * a different location. + */ + globals: Variables; + /** + * Template variables that are added to the template local scope using tags like + * `assign`, `capture` or `increment`. + */ + locals: Variables; +} +export interface StaticAnalysisOptions { + /** + * When `true` (the default), try to load partial templates and analyze them too. + */ + partials?: boolean; +} +export declare const defaultStaticAnalysisOptions: StaticAnalysisOptions; +/** + * Statically analyze a template and report variable usage. + */ +export declare function analyze(template: Template[], options?: StaticAnalysisOptions): Promise; +/** + * Statically analyze a template and report variable usage. + */ +export declare function analyzeSync(template: Template[], options?: StaticAnalysisOptions): StaticAnalysis; diff --git a/node_modules/liquidjs/dist/template/analysis.spec.d.ts b/node_modules/liquidjs/dist/template/analysis.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/template/analysis.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/template/filter-impl-options.d.ts b/node_modules/liquidjs/dist/template/filter-impl-options.d.ts new file mode 100644 index 00000000..b7105977 --- /dev/null +++ b/node_modules/liquidjs/dist/template/filter-impl-options.d.ts @@ -0,0 +1,14 @@ +import type { Context } from '../context'; +import type { Liquid } from '../liquid'; +import type { FilterToken } from '../tokens'; +export interface FilterImpl { + context: Context; + token: FilterToken; + liquid: Liquid; +} +export type FilterHandler = (this: FilterImpl, value: any, ...args: any[]) => any; +export interface FilterOptions { + handler: FilterHandler; + raw: boolean; +} +export type FilterImplOptions = FilterHandler | FilterOptions; diff --git a/node_modules/liquidjs/dist/template/filter.d.ts b/node_modules/liquidjs/dist/template/filter.d.ts new file mode 100644 index 00000000..d3bab6ed --- /dev/null +++ b/node_modules/liquidjs/dist/template/filter.d.ts @@ -0,0 +1,15 @@ +import { Context } from '../context'; +import { FilterImplOptions } from './filter-impl-options'; +import { FilterArg } from '../parser/filter-arg'; +import { Liquid } from '../liquid'; +import { FilterToken } from '../tokens'; +export declare class Filter { + name: string; + args: FilterArg[]; + readonly raw: boolean; + private handler; + private liquid; + private token; + constructor(token: FilterToken, options: FilterImplOptions | undefined, liquid: Liquid); + render(value: any, context: Context): IterableIterator; +} diff --git a/node_modules/liquidjs/dist/template/filter.spec.d.ts b/node_modules/liquidjs/dist/template/filter.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/template/filter.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/template/hash.d.ts b/node_modules/liquidjs/dist/template/hash.d.ts new file mode 100644 index 00000000..21dd7e1f --- /dev/null +++ b/node_modules/liquidjs/dist/template/hash.d.ts @@ -0,0 +1,18 @@ +import { Context } from '../context/context'; +import { Tokenizer } from '../parser/tokenizer'; +import { Token } from '../tokens/token'; +type HashValueTokens = Record; +/** + * Key-Value Pairs Representing Tag Arguments + * Example: + * For the markup `, foo:'bar', coo:2 reversed %}`, + * hash['foo'] === 'bar' + * hash['coo'] === 2 + * hash['reversed'] === undefined + */ +export declare class Hash { + hash: HashValueTokens; + constructor(input: string | Tokenizer, jekyllStyle?: boolean | string); + render(ctx: Context): Generator, unknown>; +} +export {}; diff --git a/node_modules/liquidjs/dist/template/hash.spec.d.ts b/node_modules/liquidjs/dist/template/hash.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/template/hash.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/template/html.d.ts b/node_modules/liquidjs/dist/template/html.d.ts new file mode 100644 index 00000000..32b89d02 --- /dev/null +++ b/node_modules/liquidjs/dist/template/html.d.ts @@ -0,0 +1,9 @@ +import { TemplateImpl, Template } from '../template'; +import { HTMLToken } from '../tokens'; +import { Context } from '../context'; +import { Emitter } from '../emitters'; +export declare class HTML extends TemplateImpl implements Template { + private str; + constructor(token: HTMLToken); + render(ctx: Context, emitter: Emitter): IterableIterator; +} diff --git a/node_modules/liquidjs/dist/template/index.d.ts b/node_modules/liquidjs/dist/template/index.d.ts new file mode 100644 index 00000000..675e2179 --- /dev/null +++ b/node_modules/liquidjs/dist/template/index.d.ts @@ -0,0 +1,11 @@ +export * from './template'; +export * from './template-impl'; +export * from './tag'; +export * from './tag-options-adapter'; +export * from './filter'; +export * from './filter-impl-options'; +export * from './hash'; +export * from './value'; +export * from './output'; +export * from './html'; +export * from './analysis'; diff --git a/node_modules/liquidjs/dist/template/output.d.ts b/node_modules/liquidjs/dist/template/output.d.ts new file mode 100644 index 00000000..44edb032 --- /dev/null +++ b/node_modules/liquidjs/dist/template/output.d.ts @@ -0,0 +1,12 @@ +import { Value } from './value'; +import { Arguments, Template, TemplateImpl } from '../template'; +import { Context } from '../context/context'; +import { Emitter } from '../emitters/emitter'; +import { OutputToken } from '../tokens/output-token'; +import { Liquid } from '../liquid'; +export declare class Output extends TemplateImpl implements Template { + value: Value; + constructor(token: OutputToken, liquid: Liquid); + render(ctx: Context, emitter: Emitter): IterableIterator; + arguments(): Arguments; +} diff --git a/node_modules/liquidjs/dist/template/output.spec.d.ts b/node_modules/liquidjs/dist/template/output.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/template/output.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/template/tag-options-adapter.d.ts b/node_modules/liquidjs/dist/template/tag-options-adapter.d.ts new file mode 100644 index 00000000..cd9b82a9 --- /dev/null +++ b/node_modules/liquidjs/dist/template/tag-options-adapter.d.ts @@ -0,0 +1,10 @@ +import { Tag, TagClass, TagRenderReturn } from './tag'; +import { TagToken, TopLevelToken } from '../tokens'; +import { Emitter } from '../emitters'; +import { Context } from '../context'; +export interface TagImplOptions { + [key: string]: any; + parse?: (this: Tag & TagImplOptions, token: TagToken, remainingTokens: TopLevelToken[]) => void; + render: (this: Tag & TagImplOptions, ctx: Context, emitter: Emitter, hash: Record) => TagRenderReturn; +} +export declare function createTagClass(options: TagImplOptions): TagClass; diff --git a/node_modules/liquidjs/dist/template/tag.d.ts b/node_modules/liquidjs/dist/template/tag.d.ts new file mode 100644 index 00000000..fb6e1271 --- /dev/null +++ b/node_modules/liquidjs/dist/template/tag.d.ts @@ -0,0 +1,18 @@ +import { TemplateImpl } from './template-impl'; +import type { Emitter } from '../emitters/emitter'; +import type { Parser, Tokenizer } from '../parser'; +import type { Context } from '../context/context'; +import type { TopLevelToken, TagToken } from '../tokens'; +import type { Template } from './template'; +import type { Liquid } from '../liquid'; +export type TagRenderReturn = Generator | Promise | unknown; +export declare abstract class Tag extends TemplateImpl implements Template { + name: string; + liquid: Liquid; + protected tokenizer: Tokenizer; + constructor(token: TagToken, remainTokens: TopLevelToken[], liquid: Liquid); + abstract render(ctx: Context, emitter: Emitter): TagRenderReturn; +} +export interface TagClass { + new (token: TagToken, tokens: TopLevelToken[], liquid: Liquid, parser: Parser): Tag; +} diff --git a/node_modules/liquidjs/dist/template/template-impl.d.ts b/node_modules/liquidjs/dist/template/template-impl.d.ts new file mode 100644 index 00000000..14da50bc --- /dev/null +++ b/node_modules/liquidjs/dist/template/template-impl.d.ts @@ -0,0 +1,4 @@ +export declare abstract class TemplateImpl { + token: T; + constructor(token: T); +} diff --git a/node_modules/liquidjs/dist/template/template.d.ts b/node_modules/liquidjs/dist/template/template.d.ts new file mode 100644 index 00000000..f5e9f82f --- /dev/null +++ b/node_modules/liquidjs/dist/template/template.d.ts @@ -0,0 +1,36 @@ +import { Context } from '../context/context'; +import { Token } from '../tokens/token'; +import { Emitter } from '../emitters/emitter'; +import { IdentifierToken, QuotedToken, ValueToken } from '../tokens'; +import { Value } from './value'; +export type Argument = Value | ValueToken; +export type Arguments = Iterable; +/** Scope information used when analyzing partial templates. */ +export interface PartialScope { + /** + * The name of the partial template. We need this to make sure we only analyze + * each template once. + * */ + name: string; + /** + * If `true`, names in `scope` will be added to a new, isolated scope before + * analyzing any child templates, without access to the parent template's scope. + */ + isolated: boolean; + /** + * A list of names that will be in scope for the child template. + * + * If an item is a [string, Argument] tuple, the string is considered an alias + * for the argument. + */ + scope: Iterable; +} +export interface Template { + token: Token; + render(ctx: Context, emitter: Emitter): any; + children?(partials: boolean, sync: boolean): Generator; + arguments?(): Arguments; + blockScope?(): Iterable; + localScope?(): Iterable; + partialScope?(): PartialScope | undefined; +} diff --git a/node_modules/liquidjs/dist/template/value.d.ts b/node_modules/liquidjs/dist/template/value.d.ts new file mode 100644 index 00000000..37cb2ab5 --- /dev/null +++ b/node_modules/liquidjs/dist/template/value.d.ts @@ -0,0 +1,15 @@ +import { Filter } from './filter'; +import { Expression } from '../render'; +import type { FilteredValueToken } from '../tokens'; +import type { Liquid } from '../liquid'; +import type { Context } from '../context'; +export declare class Value { + readonly filters: Filter[]; + readonly initial: Expression; + /** + * @param str the value to be valuated, eg.: "foobar" | truncate: 3 + */ + constructor(input: string | FilteredValueToken, liquid: Liquid); + value(ctx: Context, lenient?: boolean): Generator; + private getFilter; +} diff --git a/node_modules/liquidjs/dist/template/value.spec.d.ts b/node_modules/liquidjs/dist/template/value.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/template/value.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/tokens/delimited-token.d.ts b/node_modules/liquidjs/dist/tokens/delimited-token.d.ts new file mode 100644 index 00000000..8ccb1894 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/delimited-token.d.ts @@ -0,0 +1,9 @@ +import { Token } from './token'; +import { TokenKind } from '../parser'; +export declare abstract class DelimitedToken extends Token { + trimLeft: boolean; + trimRight: boolean; + contentRange: [number, number]; + constructor(kind: TokenKind, [contentBegin, contentEnd]: [number, number], input: string, begin: number, end: number, trimLeft: boolean, trimRight: boolean, file?: string); + get content(): string; +} diff --git a/node_modules/liquidjs/dist/tokens/filter-token.d.ts b/node_modules/liquidjs/dist/tokens/filter-token.d.ts new file mode 100644 index 00000000..682335e5 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/filter-token.d.ts @@ -0,0 +1,7 @@ +import { Token } from './token'; +import { FilterArg } from '../parser/filter-arg'; +export declare class FilterToken extends Token { + name: string; + args: FilterArg[]; + constructor(name: string, args: FilterArg[], input: string, begin: number, end: number, file?: string); +} diff --git a/node_modules/liquidjs/dist/tokens/filtered-value-token.d.ts b/node_modules/liquidjs/dist/tokens/filtered-value-token.d.ts new file mode 100644 index 00000000..2c8d581d --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/filtered-value-token.d.ts @@ -0,0 +1,17 @@ +import { Token } from './token'; +import { FilterToken } from './filter-token'; +import { Expression } from '../render'; +/** + * value expression with optional filters + * e.g. + * {% assign foo="bar" | append: "coo" %} + */ +export declare class FilteredValueToken extends Token { + initial: Expression; + filters: FilterToken[]; + input: string; + begin: number; + end: number; + file?: string | undefined; + constructor(initial: Expression, filters: FilterToken[], input: string, begin: number, end: number, file?: string | undefined); +} diff --git a/node_modules/liquidjs/dist/tokens/hash-token.d.ts b/node_modules/liquidjs/dist/tokens/hash-token.d.ts new file mode 100644 index 00000000..564e22e6 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/hash-token.d.ts @@ -0,0 +1,12 @@ +import { Token } from './token'; +import { ValueToken } from './value-token'; +import { IdentifierToken } from './identifier-token'; +export declare class HashToken extends Token { + input: string; + begin: number; + end: number; + name: IdentifierToken; + value?: ValueToken | undefined; + file?: string | undefined; + constructor(input: string, begin: number, end: number, name: IdentifierToken, value?: ValueToken | undefined, file?: string | undefined); +} diff --git a/node_modules/liquidjs/dist/tokens/html-token.d.ts b/node_modules/liquidjs/dist/tokens/html-token.d.ts new file mode 100644 index 00000000..40ba217e --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/html-token.d.ts @@ -0,0 +1,11 @@ +import { Token } from './token'; +export declare class HTMLToken extends Token { + input: string; + begin: number; + end: number; + file?: string | undefined; + trimLeft: number; + trimRight: number; + constructor(input: string, begin: number, end: number, file?: string | undefined); + getContent(): string; +} diff --git a/node_modules/liquidjs/dist/tokens/identifier-token.d.ts b/node_modules/liquidjs/dist/tokens/identifier-token.d.ts new file mode 100644 index 00000000..2af10fa0 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/identifier-token.d.ts @@ -0,0 +1,9 @@ +import { Token } from './token'; +export declare class IdentifierToken extends Token { + input: string; + begin: number; + end: number; + file?: string | undefined; + content: string; + constructor(input: string, begin: number, end: number, file?: string | undefined); +} diff --git a/node_modules/liquidjs/dist/tokens/index.d.ts b/node_modules/liquidjs/dist/tokens/index.d.ts new file mode 100644 index 00000000..6f338126 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/index.d.ts @@ -0,0 +1,18 @@ +export * from './top-level-token'; +export * from './tag-token'; +export * from './output-token'; +export * from './html-token'; +export * from './number-token'; +export * from './identifier-token'; +export * from './literal-token'; +export * from './operator-token'; +export * from './property-access-token'; +export * from './filter-token'; +export * from './hash-token'; +export * from './quoted-token'; +export * from './token'; +export * from './range-token'; +export * from './value-token'; +export * from './liquid-tag-token'; +export * from './delimited-token'; +export * from './filtered-value-token'; diff --git a/node_modules/liquidjs/dist/tokens/liquid-tag-token.d.ts b/node_modules/liquidjs/dist/tokens/liquid-tag-token.d.ts new file mode 100644 index 00000000..a82f2a6c --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/liquid-tag-token.d.ts @@ -0,0 +1,12 @@ +import { DelimitedToken } from './delimited-token'; +import { NormalizedFullOptions } from '../liquid-options'; +import { Tokenizer } from '../parser'; +/** + * LiquidTagToken is different from TagToken by not having delimiters `{%` or `%}` + */ +export declare class LiquidTagToken extends DelimitedToken { + name: string; + tokenizer: Tokenizer; + constructor(input: string, begin: number, end: number, options: NormalizedFullOptions, file?: string); + get args(): string; +} diff --git a/node_modules/liquidjs/dist/tokens/literal-token.d.ts b/node_modules/liquidjs/dist/tokens/literal-token.d.ts new file mode 100644 index 00000000..7367e06e --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/literal-token.d.ts @@ -0,0 +1,11 @@ +import { Token } from './token'; +import { LiteralValue, LiteralKey } from '../util'; +export declare class LiteralToken extends Token { + input: string; + begin: number; + end: number; + file?: string | undefined; + content: LiteralValue; + literal: LiteralKey; + constructor(input: string, begin: number, end: number, file?: string | undefined); +} diff --git a/node_modules/liquidjs/dist/tokens/number-token.d.ts b/node_modules/liquidjs/dist/tokens/number-token.d.ts new file mode 100644 index 00000000..75b5d047 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/number-token.d.ts @@ -0,0 +1,9 @@ +import { Token } from './token'; +export declare class NumberToken extends Token { + input: string; + begin: number; + end: number; + file?: string | undefined; + content: number; + constructor(input: string, begin: number, end: number, file?: string | undefined); +} diff --git a/node_modules/liquidjs/dist/tokens/operator-token.d.ts b/node_modules/liquidjs/dist/tokens/operator-token.d.ts new file mode 100644 index 00000000..cde8435f --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/operator-token.d.ts @@ -0,0 +1,39 @@ +import { Token } from './token'; +export declare const enum OperatorType { + Binary = 0, + Unary = 1 +} +export declare const operatorPrecedences: { + '==': number; + '!=': number; + '>': number; + '<': number; + '>=': number; + '<=': number; + contains: number; + not: number; + and: number; + or: number; +}; +export declare const operatorTypes: { + '==': OperatorType; + '!=': OperatorType; + '>': OperatorType; + '<': OperatorType; + '>=': OperatorType; + '<=': OperatorType; + contains: OperatorType; + not: OperatorType; + and: OperatorType; + or: OperatorType; +}; +export type OperatorKey = keyof typeof operatorPrecedences; +export declare class OperatorToken extends Token { + input: string; + begin: number; + end: number; + file?: string | undefined; + operator: OperatorKey; + constructor(input: string, begin: number, end: number, file?: string | undefined); + getPrecedence(): number; +} diff --git a/node_modules/liquidjs/dist/tokens/output-token.d.ts b/node_modules/liquidjs/dist/tokens/output-token.d.ts new file mode 100644 index 00000000..51e78650 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/output-token.d.ts @@ -0,0 +1,5 @@ +import { DelimitedToken } from './delimited-token'; +import { NormalizedFullOptions } from '../liquid-options'; +export declare class OutputToken extends DelimitedToken { + constructor(input: string, begin: number, end: number, options: NormalizedFullOptions, file?: string); +} diff --git a/node_modules/liquidjs/dist/tokens/property-access-token.d.ts b/node_modules/liquidjs/dist/tokens/property-access-token.d.ts new file mode 100644 index 00000000..a7f6508a --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/property-access-token.d.ts @@ -0,0 +1,12 @@ +import { Token } from './token'; +import { LiteralToken } from './literal-token'; +import { ValueToken } from './value-token'; +import { IdentifierToken } from './identifier-token'; +import { NumberToken } from './number-token'; +import { RangeToken } from './range-token'; +import { QuotedToken } from './quoted-token'; +export declare class PropertyAccessToken extends Token { + variable: QuotedToken | RangeToken | LiteralToken | NumberToken | undefined; + props: (ValueToken | IdentifierToken)[]; + constructor(variable: QuotedToken | RangeToken | LiteralToken | NumberToken | undefined, props: (ValueToken | IdentifierToken)[], input: string, begin: number, end: number, file?: string); +} diff --git a/node_modules/liquidjs/dist/tokens/quoted-token.d.ts b/node_modules/liquidjs/dist/tokens/quoted-token.d.ts new file mode 100644 index 00000000..96cb4e92 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/quoted-token.d.ts @@ -0,0 +1,9 @@ +import { Token } from './token'; +export declare class QuotedToken extends Token { + input: string; + begin: number; + end: number; + file?: string | undefined; + readonly content: string; + constructor(input: string, begin: number, end: number, file?: string | undefined); +} diff --git a/node_modules/liquidjs/dist/tokens/range-token.d.ts b/node_modules/liquidjs/dist/tokens/range-token.d.ts new file mode 100644 index 00000000..22c98961 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/range-token.d.ts @@ -0,0 +1,11 @@ +import { Token } from './token'; +import { ValueToken } from './value-token'; +export declare class RangeToken extends Token { + input: string; + begin: number; + end: number; + lhs: ValueToken; + rhs: ValueToken; + file?: string | undefined; + constructor(input: string, begin: number, end: number, lhs: ValueToken, rhs: ValueToken, file?: string | undefined); +} diff --git a/node_modules/liquidjs/dist/tokens/tag-token.d.ts b/node_modules/liquidjs/dist/tokens/tag-token.d.ts new file mode 100644 index 00000000..216c33e9 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/tag-token.d.ts @@ -0,0 +1,9 @@ +import { DelimitedToken } from './delimited-token'; +import { Tokenizer } from '../parser'; +import type { NormalizedFullOptions } from '../liquid-options'; +export declare class TagToken extends DelimitedToken { + name: string; + tokenizer: Tokenizer; + readonly args: string; + constructor(input: string, begin: number, end: number, options: NormalizedFullOptions, file?: string); +} diff --git a/node_modules/liquidjs/dist/tokens/token.d.ts b/node_modules/liquidjs/dist/tokens/token.d.ts new file mode 100644 index 00000000..4ad08437 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/token.d.ts @@ -0,0 +1,12 @@ +import { TokenKind } from '../parser'; +export declare abstract class Token { + kind: TokenKind; + input: string; + begin: number; + end: number; + file?: string | undefined; + constructor(kind: TokenKind, input: string, begin: number, end: number, file?: string | undefined); + getText(): string; + getPosition(): number[]; + size(): number; +} diff --git a/node_modules/liquidjs/dist/tokens/top-level-token.d.ts b/node_modules/liquidjs/dist/tokens/top-level-token.d.ts new file mode 100644 index 00000000..4cb6f45b --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/top-level-token.d.ts @@ -0,0 +1,4 @@ +import type { TagToken } from './tag-token'; +import type { HTMLToken } from './html-token'; +import type { OutputToken } from './output-token'; +export type TopLevelToken = TagToken | OutputToken | HTMLToken; diff --git a/node_modules/liquidjs/dist/tokens/value-token.d.ts b/node_modules/liquidjs/dist/tokens/value-token.d.ts new file mode 100644 index 00000000..06ca8a21 --- /dev/null +++ b/node_modules/liquidjs/dist/tokens/value-token.d.ts @@ -0,0 +1,6 @@ +import { RangeToken } from './range-token'; +import { LiteralToken } from './literal-token'; +import { NumberToken } from './number-token'; +import { QuotedToken } from './quoted-token'; +import { PropertyAccessToken } from './property-access-token'; +export type ValueToken = RangeToken | LiteralToken | QuotedToken | PropertyAccessToken | NumberToken; diff --git a/node_modules/liquidjs/dist/util/assert.d.ts b/node_modules/liquidjs/dist/util/assert.d.ts new file mode 100644 index 00000000..070ed1a2 --- /dev/null +++ b/node_modules/liquidjs/dist/util/assert.d.ts @@ -0,0 +1,2 @@ +export declare function assert(predicate: T | null | undefined, message?: string | (() => string)): void; +export declare function assertEmpty(predicate: T | null | undefined, message?: string): void; diff --git a/node_modules/liquidjs/dist/util/assert.spec.d.ts b/node_modules/liquidjs/dist/util/assert.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/util/assert.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/util/async.d.ts b/node_modules/liquidjs/dist/util/async.d.ts new file mode 100644 index 00000000..6e02850d --- /dev/null +++ b/node_modules/liquidjs/dist/util/async.d.ts @@ -0,0 +1,4 @@ +export type LiquidAsync any> = (sync: boolean, ...args: Parameters) => ReturnType | Promise>; +export declare function toLiquidAsync any>(asyncFn: (...args: Parameters) => Promise>, syncFn?: F): LiquidAsync; +export declare function toPromise(val: Generator | Promise | T): Promise; +export declare function toValueSync(val: Generator | T): T; diff --git a/node_modules/liquidjs/dist/util/async.spec.d.ts b/node_modules/liquidjs/dist/util/async.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/util/async.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/util/character.d.ts b/node_modules/liquidjs/dist/util/character.d.ts new file mode 100644 index 00000000..830a8588 --- /dev/null +++ b/node_modules/liquidjs/dist/util/character.d.ts @@ -0,0 +1,10 @@ +export declare const TYPES: number[]; +export declare const WORD = 1; +export declare const OPERATOR = 2; +export declare const BLANK = 4; +export declare const QUOTE = 8; +export declare const INLINE_BLANK = 16; +export declare const NUMBER = 32; +export declare const SIGN = 64; +export declare const PUNCTUATION = 128; +export declare function isWord(char: string): boolean; diff --git a/node_modules/liquidjs/dist/util/error.d.ts b/node_modules/liquidjs/dist/util/error.d.ts new file mode 100644 index 00000000..be7d25a7 --- /dev/null +++ b/node_modules/liquidjs/dist/util/error.d.ts @@ -0,0 +1,35 @@ +import { Token } from '../tokens/token'; +import { Template } from '../template/template'; +export declare abstract class LiquidError extends Error { + token: Token; + context: string; + originalError?: Error; + constructor(err: Error | string, token: Token); + protected update(): void; + static is(obj: unknown): obj is LiquidError; +} +export declare class TokenizationError extends LiquidError { + constructor(message: string, token: Token); +} +export declare class ParseError extends LiquidError { + constructor(err: Error, token: Token); +} +export declare class RenderError extends LiquidError { + constructor(err: Error, tpl: Template); + static is(obj: any): obj is RenderError; +} +export declare class LiquidErrors extends LiquidError { + errors: RenderError[]; + constructor(errors: RenderError[]); + static is(obj: any): obj is LiquidErrors; +} +export declare class UndefinedVariableError extends LiquidError { + constructor(err: Error, token: Token); +} +export declare class InternalUndefinedVariableError extends Error { + variableName: string; + constructor(variableName: string); +} +export declare class AssertionError extends Error { + constructor(message: string); +} diff --git a/node_modules/liquidjs/dist/util/error.spec.d.ts b/node_modules/liquidjs/dist/util/error.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/util/error.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/util/index.d.ts b/node_modules/liquidjs/dist/util/index.d.ts new file mode 100644 index 00000000..4da01dc3 --- /dev/null +++ b/node_modules/liquidjs/dist/util/index.d.ts @@ -0,0 +1,12 @@ +export * from './error'; +export * from './character'; +export * from './assert'; +export * from './literal'; +export * from './underscore'; +export * from './operator-trie'; +export * from './type-guards'; +export * from './async'; +export * from './strftime'; +export * from './liquid-date'; +export * from './limiter'; +export * from './intl'; diff --git a/node_modules/liquidjs/dist/util/intl.d.ts b/node_modules/liquidjs/dist/util/intl.d.ts new file mode 100644 index 00000000..82cd8982 --- /dev/null +++ b/node_modules/liquidjs/dist/util/intl.d.ts @@ -0,0 +1,6 @@ +export declare function getDateTimeFormat(): { + (locales?: string | string[] | undefined, options?: Intl.DateTimeFormatOptions | undefined): Intl.DateTimeFormat; + new (locales?: string | string[] | undefined, options?: Intl.DateTimeFormatOptions | undefined): Intl.DateTimeFormat; + supportedLocalesOf(locales: string | string[], options?: Intl.DateTimeFormatOptions | undefined): string[]; + readonly prototype: Intl.DateTimeFormat; +} | undefined; diff --git a/node_modules/liquidjs/dist/util/limiter.d.ts b/node_modules/liquidjs/dist/util/limiter.d.ts new file mode 100644 index 00000000..ccd1a5b6 --- /dev/null +++ b/node_modules/liquidjs/dist/util/limiter.d.ts @@ -0,0 +1,8 @@ +export declare class Limiter { + private message; + private base; + private limit; + constructor(resource: string, limit: number); + use(count: number): void; + check(count: number): void; +} diff --git a/node_modules/liquidjs/dist/util/liquid-date.d.ts b/node_modules/liquidjs/dist/util/liquid-date.d.ts new file mode 100644 index 00000000..276ca827 --- /dev/null +++ b/node_modules/liquidjs/dist/util/liquid-date.d.ts @@ -0,0 +1,52 @@ +/** + * A date implementation with timezone info, just like Ruby date + * + * Implementation: + * - create a Date offset by it's timezone difference, avoiding overriding a bunch of methods + * - rewrite getTimezoneOffset() to trick strftime + */ +export declare class LiquidDate { + private locale; + private timezoneOffset; + private timezoneName; + private date; + private displayDate; + private DateTimeFormat; + timezoneFixed: boolean; + constructor(init: string | number | Date, locale: string, timezone?: number | string); + getTime(): number; + getMilliseconds(): number; + getSeconds(): number; + getMinutes(): number; + getHours(): number; + getDay(): number; + getDate(): number; + getMonth(): number; + getFullYear(): number; + toLocaleString(locale?: string, init?: any): string; + toLocaleTimeString(locale?: string): string; + toLocaleDateString(locale?: string): string; + getTimezoneOffset(): number; + getTimeZoneName(): string | undefined; + getLongMonthName(): string; + getShortMonthName(): string; + getLongWeekdayName(): string; + getShortWeekdayName(): string; + valid(): boolean; + private format; + /** + * Create a Date object fixed to it's declared Timezone. Both + * - 2021-08-06T02:29:00.000Z and + * - 2021-08-06T02:29:00.000+08:00 + * will always be displayed as + * - 2021-08-06 02:29:00 + * regardless timezoneOffset in JavaScript realm + * + * The implementation hack: + * Instead of calling `.getMonth()`/`.getUTCMonth()` respect to `preserveTimezones`, + * we create a different Date to trick strftime, it's both simpler and more performant. + * Given that a template is expected to be parsed fewer times than rendered. + */ + static createDateFixedToTimezone(dateString: string, locale: string): LiquidDate; + private static getTimezoneOffset; +} diff --git a/node_modules/liquidjs/dist/util/liquid-date.spec.d.ts b/node_modules/liquidjs/dist/util/liquid-date.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/util/liquid-date.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/util/literal.d.ts b/node_modules/liquidjs/dist/util/literal.d.ts new file mode 100644 index 00000000..067c1afd --- /dev/null +++ b/node_modules/liquidjs/dist/util/literal.d.ts @@ -0,0 +1,11 @@ +import { BlankDrop, EmptyDrop, NullDrop } from '../drop'; +export declare const literalValues: { + true: boolean; + false: boolean; + nil: NullDrop; + null: NullDrop; + empty: EmptyDrop; + blank: BlankDrop; +}; +export type LiteralKey = keyof typeof literalValues; +export type LiteralValue = typeof literalValues[LiteralKey]; diff --git a/node_modules/liquidjs/dist/util/operator-trie.d.ts b/node_modules/liquidjs/dist/util/operator-trie.d.ts new file mode 100644 index 00000000..68e74b79 --- /dev/null +++ b/node_modules/liquidjs/dist/util/operator-trie.d.ts @@ -0,0 +1,10 @@ +interface TrieInput { + [key: string]: T; +} +export type Trie = { + data?: T; + end?: true; + needBoundary?: true; +} & Record; +export declare function createTrie(input: TrieInput): Trie; +export {}; diff --git a/node_modules/liquidjs/dist/util/performance.d.ts b/node_modules/liquidjs/dist/util/performance.d.ts new file mode 100644 index 00000000..291e2a1a --- /dev/null +++ b/node_modules/liquidjs/dist/util/performance.d.ts @@ -0,0 +1,5 @@ +interface LiquidPerformance { + now: () => number; +} +export declare function getPerformance(): LiquidPerformance; +export {}; diff --git a/node_modules/liquidjs/dist/util/performance.spec.d.ts b/node_modules/liquidjs/dist/util/performance.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/util/performance.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/util/strftime.d.ts b/node_modules/liquidjs/dist/util/strftime.d.ts new file mode 100644 index 00000000..ece39b05 --- /dev/null +++ b/node_modules/liquidjs/dist/util/strftime.d.ts @@ -0,0 +1,3 @@ +import { LiquidDate } from './liquid-date'; +import type { Limiter } from './limiter'; +export declare function strftime(d: LiquidDate, formatStr: string, memoryLimit?: Pick): string; diff --git a/node_modules/liquidjs/dist/util/strftime.spec.d.ts b/node_modules/liquidjs/dist/util/strftime.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/util/strftime.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/util/type-guards.d.ts b/node_modules/liquidjs/dist/util/type-guards.d.ts new file mode 100644 index 00000000..809b5404 --- /dev/null +++ b/node_modules/liquidjs/dist/util/type-guards.d.ts @@ -0,0 +1,13 @@ +import { RangeToken, NumberToken, QuotedToken, LiteralToken, PropertyAccessToken, OutputToken, HTMLToken, TagToken, IdentifierToken, DelimitedToken, OperatorToken, ValueToken } from '../tokens'; +export declare function isDelimitedToken(val: any): val is DelimitedToken; +export declare function isOperatorToken(val: any): val is OperatorToken; +export declare function isHTMLToken(val: any): val is HTMLToken; +export declare function isOutputToken(val: any): val is OutputToken; +export declare function isTagToken(val: any): val is TagToken; +export declare function isQuotedToken(val: any): val is QuotedToken; +export declare function isLiteralToken(val: any): val is LiteralToken; +export declare function isNumberToken(val: any): val is NumberToken; +export declare function isPropertyAccessToken(val: any): val is PropertyAccessToken; +export declare function isWordToken(val: any): val is IdentifierToken; +export declare function isRangeToken(val: any): val is RangeToken; +export declare function isValueToken(val: any): val is ValueToken; diff --git a/node_modules/liquidjs/dist/util/type-guards.spec.d.ts b/node_modules/liquidjs/dist/util/type-guards.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/util/type-guards.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/dist/util/underscore.d.ts b/node_modules/liquidjs/dist/util/underscore.d.ts new file mode 100644 index 00000000..703facf1 --- /dev/null +++ b/node_modules/liquidjs/dist/util/underscore.d.ts @@ -0,0 +1,41 @@ +export declare const toString: () => string; +export declare const hasOwnProperty: (v: PropertyKey) => boolean; +export declare function isString(value: any): value is string; +export declare function isFunction(value: any): value is Function; +export declare function isPromise(val: any): val is Promise; +export declare function isIterator(val: any): val is IterableIterator; +export declare function promisify(fn: (arg1: T1, cb: (err: Error | null, result: T2) => void) => void): (arg1: T1) => Promise; +export declare function promisify(fn: (arg1: T1, arg2: T2, cb: (err: Error | null, result: T3) => void) => void): (arg1: T1, arg2: T2) => Promise; +export declare function stringify(value: any): string; +export declare function readArrayElement(arr: any[], index: number, ownPropertyOnly: boolean): any; +export declare function toEnumerable(val: any): T[]; +export declare function toArray(val: any): any[]; +export declare function toValue(value: any): any; +export declare function toNumber(value: any): number; +export declare function isNumber(value: any): value is number; +export declare function toLiquid(value: any): any; +export declare function isNil(value: any): boolean; +export declare function isUndefined(value: any): boolean; +export declare function isArray(value: any): value is any[]; +export declare function isArrayLike(value: any): value is any[]; +export declare function isIterable(value: any): value is Iterable; +export declare function forOwn(obj: Record | undefined, iteratee: ((val: T, key: string, obj: { + [key: string]: T; +}) => boolean | void)): Record; +export declare function last(arr: T[]): T; +export declare function last(arr: string): string; +export declare function isObject(value: any): value is object; +export declare function range(start: number, stop: number, step?: number): number[]; +export declare function padStart(str: any, length: number, ch?: string): any; +export declare function padEnd(str: any, length: number, ch?: string): any; +export declare function pad(str: any, length: number, ch: string, add: (str: string, ch: string) => string): any; +export declare function identify(val: T): T; +export declare function changeCase(str: string): string; +export declare function ellipsis(str: string, N: number): string; +export declare function orderedCompare(a: any, b: any): 0 | 1 | -1; +export declare function caseInsensitiveCompare(a: any, b: any): 0 | 1 | -1; +export declare function argumentsToValue any, T>(fn: F): (this: T, ...args: Parameters) => any; +export declare function argumentsToNumber any, T>(fn: F): (this: T, ...args: Parameters) => any; +export declare function escapeRegExp(text: string): string; +/** Return an array containing unique elements from _array_. Works with nested arrays and objects. */ +export declare function strictUniq(array: Array): Generator; diff --git a/node_modules/liquidjs/dist/util/underscore.spec.d.ts b/node_modules/liquidjs/dist/util/underscore.spec.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/liquidjs/dist/util/underscore.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/liquidjs/package.json b/node_modules/liquidjs/package.json new file mode 100644 index 00000000..2be3d9f0 --- /dev/null +++ b/node_modules/liquidjs/package.json @@ -0,0 +1,171 @@ +{ + "name": "liquidjs", + "version": "10.27.2", + "sideEffects": false, + "description": "A simple, expressive, extensible Liquid template engine for JavaScript — Shopify, Jekyll and GitHub Pages compatible, for Node.js, browsers, and the CLI, with TypeScript support.", + "main": "dist/liquid.node.js", + "module": "dist/liquid.node.mjs", + "es2015": "dist/liquid.browser.mjs", + "browser": { + "./dist/liquid.node.js": "./dist/liquid.browser.umd.js", + "./dist/liquid.node.mjs": "./dist/liquid.browser.mjs" + }, + "types": "dist/index.d.ts", + "engines": { + "node": ">=16" + }, + "scripts": { + "lint": "eslint \"**/*.mjs\" \"**/*.ts\" .", + "check": "npm run build && npm run build:docs && npm test && npm run lint && npm run perf:diff", + "test": "jest", + "test:coverage": "jest --coverage src test/integration", + "test:e2e": "jest test/e2e", + "test:demo": "./test/demo/test.sh", + "perf:diff": "node bin/perf-diff.js", + "perf:engines": "cd benchmark && npm run engines", + "version": "npm run build && npm test", + "build": "rollup -c rollup.config.mjs", + "build:cjs": "BUNDLES=cjs rollup -c rollup.config.mjs", + "build:min": "BUNDLES=min rollup -c rollup.config.mjs", + "build:umd": "BUNDLES=umd rollup -c rollup.config.mjs", + "build:charmap": "./bin/character-gen.js > src/util/character.ts", + "prepare:docs": "run-s build:docs-liquid build:contributors build:apidoc build:changelog", + "build:docs": "run-s prepare:docs build:docs-hexo", + "build:docs-liquid": "cross-env BUNDLES=min rollup -c rollup.config.mjs && shx cp dist/liquid.browser.min.js docs/themes/navy/source/js/", + "build:contributors": "node bin/build-contributors.js", + "build:apidoc": "shx rm -rf docs/source/api && typedoc --plugin typedoc-plugin-missing-exports ./src --gitRevision master --out docs/source/api", + "build:changelog": "node bin/build-changelog.js", + "build:docs-hexo": "cd docs && npm ci && npm run build && shx cp CNAME public/", + "serve:docs": "cd docs && npm run start", + "dev:docs": "run-s prepare:docs serve:docs" + }, + "bin": { + "liquidjs": "./bin/liquid.js", + "liquid": "./bin/liquid.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/harttle/liquidjs.git" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/liquidjs" + }, + "files": [ + "bin/liquid.js", + "dist", + "LICENSE", + "README.md" + ], + "keywords": [ + "liquid", + "template engine", + "express", + "jinja", + "shopify" + ], + "author": "Harttle", + "license": "MIT", + "bugs": { + "url": "https://github.com/harttle/liquidjs/issues" + }, + "homepage": "https://github.com/harttle/liquidjs#readme", + "devDependencies": { + "@commitlint/cli": "^12.1.4", + "@commitlint/config-conventional": "^8.2.0", + "@semantic-release/changelog": "^6.0.2", + "@semantic-release/commit-analyzer": "^9.0.2", + "@semantic-release/git": "^10.0.1", + "@semantic-release/npm": "^13.1.5", + "@semantic-release/release-notes-generator": "^10.0.3", + "@types/benchmark": "^1.0.31", + "@types/express": "^4.17.2", + "@types/jest": "^29.4.0", + "@types/jsdom": "^12.2.2", + "@types/node": "^22.3.0", + "@types/sinon": "^10.0.13", + "@types/supertest": "^2.0.7", + "@typescript-eslint/eslint-plugin": "^5.6.0", + "@typescript-eslint/parser": "^5.6.0", + "all-contributors-cli": "^6.24.0", + "benchmark": "^2.1.4", + "coveralls": "^3.0.2", + "cross-env": "^5.2.0", + "eslint": "^7.32.0", + "eslint-config-standard": "^12.0.0", + "eslint-plugin-deprecation": "^1.3.2", + "eslint-plugin-import": "^2.27.5", + "eslint-plugin-mocha": "^5.3.0", + "eslint-plugin-node": "^8.0.1", + "eslint-plugin-promise": "^4.0.1", + "eslint-plugin-standard": "^4.0.0", + "express": "^4.16.4", + "jest": "^29.5.0", + "jsdom": "^16.5.0", + "npm-run-all2": "^8.0.4", + "rollup": "^1.26.3", + "rollup-plugin-replace": "^2.1.0", + "rollup-plugin-typescript2": "^0.31.1", + "rollup-plugin-uglify": "^6.0.4", + "rollup-plugin-version-injector": "^1.3.3", + "semantic-release": "^25.0.3", + "shx": "^0.4.0", + "sinon": "^15.0.2", + "supertest": "^3.4.2", + "ts-jest": "^29.0.5", + "tslib": "^2.3.1", + "typedoc": "^0.26.5", + "typedoc-plugin-missing-exports": "^3.0.0", + "typescript": "^4.5.3" + }, + "dependencies": { + "commander": "^10.0.0" + }, + "release": { + "branch": "master", + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + "@semantic-release/npm", + [ + "@semantic-release/git", + { + "assets": [ + "package.json", + "package-lock.json", + "CHANGELOG.md" + ], + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + } + ], + [ + "@semantic-release/github", + { + "assets": [ + { + "path": "dist/*.umd.js", + "label": "liquid.js" + }, + { + "path": "dist/*.min.js", + "label": "liquid.min.js" + }, + { + "path": "dist/*.min.js.map", + "label": "liquid.min.js.map" + } + ] + } + ] + ] + }, + "publishConfig": { + "provenance": true + }, + "nyc": { + "extension": [ + ".ts" + ] + } +} diff --git a/node_modules/list-to-array/.npmignore b/node_modules/list-to-array/.npmignore new file mode 100644 index 00000000..123ae94d --- /dev/null +++ b/node_modules/list-to-array/.npmignore @@ -0,0 +1,27 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git +node_modules diff --git a/node_modules/list-to-array/LICENSE b/node_modules/list-to-array/LICENSE new file mode 100644 index 00000000..b9d84981 --- /dev/null +++ b/node_modules/list-to-array/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Jed Watson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/list-to-array/README.md b/node_modules/list-to-array/README.md new file mode 100644 index 00000000..2fec249e --- /dev/null +++ b/node_modules/list-to-array/README.md @@ -0,0 +1,52 @@ +# list-to-array + +Simple javascript lib for converting a [comma || space] delimited string to an array. + +Trims values so you can use human-friendly lists like `'one, two, three' => ['one','two','three']` + +If in array is provided, it is simply returned. If a falsy or non-string value is provided, an empty array is returned. + +Won't work with values that contain spaces. + +## Installation + +``` +npm install list-to-array +``` + +Works in node.js, iojs or bundle for the browser with browserify or webpack. + +## Usage + +``` +var listToArray = require('list-to-array'); + +console.log(listToArray('one, two, three')); + +// logs ['one','two','three'] +``` + +## License + +(The MIT License) + +Copyright (c) 2015 Jed Watson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/list-to-array/index.js b/node_modules/list-to-array/index.js new file mode 100644 index 00000000..78efcf96 --- /dev/null +++ b/node_modules/list-to-array/index.js @@ -0,0 +1,18 @@ +function truthy(val) { return val; } +function trim(str) { return str.trim(); } + +function listToArray (str, delimiter) { + if (Array.isArray(str)) { + return str; + } + if (!str || typeof str !== 'string') { + return []; + } + if (!delimiter) { + delimiter = ' '; + str = str.replace(/\,/g, ' '); + } + return str.split(delimiter).map(trim).filter(truthy); +} + +module.exports = listToArray; diff --git a/node_modules/list-to-array/package.json b/node_modules/list-to-array/package.json new file mode 100644 index 00000000..a6b8ed0c --- /dev/null +++ b/node_modules/list-to-array/package.json @@ -0,0 +1,32 @@ +{ + "name": "list-to-array", + "version": "1.1.0", + "description": "Simple javascript lib for converting a [comma || space] delimited string to an array", + "main": "index.js", + "author": "Jed Watson", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/JedWatson/list-to-array.git" + }, + "bugs": { + "url": "https://github.com/JedWatson/list-to-array/issues" + }, + "homepage": "https://github.com/JedWatson/list-to-array", + "scripts": { + "test": "mocha tests.js" + }, + "keywords": [ + "array", + "list", + "string", + "manipulation", + "conversion", + "function", + "library" + ], + "devDependencies": { + "mocha": "^2.2.5", + "must": "^0.12.0" + } +} diff --git a/node_modules/list-to-array/tests.js b/node_modules/list-to-array/tests.js new file mode 100644 index 00000000..456d2753 --- /dev/null +++ b/node_modules/list-to-array/tests.js @@ -0,0 +1,29 @@ +var demand = require('must'); +var listToArray = require('./index'); + +describe('listToArray', function() { + it('splits a comma-delimited list into an array', function() { + listToArray('one,two,three').must.eql(['one', 'two', 'three']); + }); + it('splits a space-delimited list into an array', function() { + listToArray('one two three').must.eql(['one', 'two', 'three']); + }); + it('trims whitespace from values', function() { + listToArray('one, two, three').must.eql(['one', 'two', 'three']); + }); + it('splits a list into an array', function() { + listToArray('one,two,three').must.eql(['one', 'two', 'three']); + }); + it('returns a empty array w/ no arguments', function() { + listToArray().must.eql([]); + }); + it('returns a empty array for a blank string', function() { + listToArray('').must.eql([]); + }); + it('returns a empty array when only given whitespace', function() { + listToArray(' ').must.eql([]); + }); + it('returns a empty array when only given whitespace and commas', function() { + listToArray(' , ').must.eql([]); + }); +}); diff --git a/node_modules/luxon/LICENSE.md b/node_modules/luxon/LICENSE.md new file mode 100644 index 00000000..2d560a64 --- /dev/null +++ b/node_modules/luxon/LICENSE.md @@ -0,0 +1,7 @@ +Copyright 2019 JS Foundation and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/luxon/README.md b/node_modules/luxon/README.md new file mode 100644 index 00000000..3fcacd7d --- /dev/null +++ b/node_modules/luxon/README.md @@ -0,0 +1,55 @@ +# Luxon + +[![MIT License][license-image]][license] [![Build Status][github-action-image]][github-action-url] [![NPM version][npm-version-image]][npm-url] [![Coverage Status][test-coverage-image]][test-coverage-url] [![PRs welcome][contributing-image]][contributing-url] + +Luxon is a library for working with dates and times in JavaScript. + +```js +DateTime.now().setZone("America/New_York").minus({ weeks: 1 }).endOf("day").toISO(); +``` + +## Upgrading to 3.0 + +[Guide](https://moment.github.io/luxon/#upgrading) + +## Features + * DateTime, Duration, and Interval types. + * Immutable, chainable, unambiguous API. + * Parsing and formatting for common and custom formats. + * Native time zone and Intl support (no locale or tz files). + +## Download/install + +[Download/install instructions](https://moment.github.io/luxon/#/install) + +## Documentation + +* [General documentation](https://moment.github.io/luxon/#/?id=luxon) +* [API docs](https://moment.github.io/luxon/api-docs/index.html) +* [Quick tour](https://moment.github.io/luxon/#/tour) +* [For Moment users](https://moment.github.io/luxon/#/moment) +* [Why does Luxon exist?](https://moment.github.io/luxon/#/why) +* [A quick demo](https://moment.github.io/luxon/demo/global.html) + +## Development + +See [contributing](CONTRIBUTING.md). + +![Phasers to stun][phasers-image] + +[license-image]: https://img.shields.io/badge/license-MIT-blue.svg +[license]: LICENSE.md + +[github-action-image]: https://github.com/moment/luxon/actions/workflows/test.yml/badge.svg +[github-action-url]: https://github.com/moment/luxon/actions/workflows/test.yml + +[npm-url]: https://npmjs.org/package/luxon +[npm-version-image]: https://badge.fury.io/js/luxon.svg + +[test-coverage-url]: https://codecov.io/gh/moment/luxon +[test-coverage-image]: https://codecov.io/gh/moment/luxon/branch/master/graph/badge.svg + +[contributing-url]: https://github.com/moment/luxon/blob/master/CONTRIBUTING.md +[contributing-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg + +[phasers-image]: https://img.shields.io/badge/phasers-stun-brightgreen.svg diff --git a/node_modules/luxon/build/amd/luxon.js b/node_modules/luxon/build/amd/luxon.js new file mode 100644 index 00000000..dcdb4f91 --- /dev/null +++ b/node_modules/luxon/build/amd/luxon.js @@ -0,0 +1,8741 @@ +define(['exports'], (function (exports) { 'use strict'; + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _extends() { + _extends = Object.assign ? Object.assign.bind() : function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + return target; + }; + return _extends.apply(this, arguments); + } + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + _setPrototypeOf(subClass, superClass); + } + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return _setPrototypeOf(o, p); + } + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct.bind(); + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + return _construct.apply(null, arguments); + } + function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; + } + function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + _cache.set(Class, Wrapper); + } + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; + return _wrapNativeSuper(Class); + } + function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function _createForOfIteratorHelperLoose(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (it) return (it = it.call(o)).next.bind(it); + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _toPrimitive(input, hint) { + if (typeof input !== "object" || input === null) return input; + var prim = input[Symbol.toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (typeof res !== "object") return res; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (hint === "string" ? String : Number)(input); + } + function _toPropertyKey(arg) { + var key = _toPrimitive(arg, "string"); + return typeof key === "symbol" ? key : String(key); + } + + // these aren't really private, but nor are they really useful to document + /** + * @private + */ + var LuxonError = /*#__PURE__*/function (_Error) { + _inheritsLoose(LuxonError, _Error); + function LuxonError() { + return _Error.apply(this, arguments) || this; + } + return LuxonError; + }( /*#__PURE__*/_wrapNativeSuper(Error)); + /** + * @private + */ + var InvalidDateTimeError = /*#__PURE__*/function (_LuxonError) { + _inheritsLoose(InvalidDateTimeError, _LuxonError); + function InvalidDateTimeError(reason) { + return _LuxonError.call(this, "Invalid DateTime: " + reason.toMessage()) || this; + } + return InvalidDateTimeError; + }(LuxonError); + + /** + * @private + */ + var InvalidIntervalError = /*#__PURE__*/function (_LuxonError2) { + _inheritsLoose(InvalidIntervalError, _LuxonError2); + function InvalidIntervalError(reason) { + return _LuxonError2.call(this, "Invalid Interval: " + reason.toMessage()) || this; + } + return InvalidIntervalError; + }(LuxonError); + + /** + * @private + */ + var InvalidDurationError = /*#__PURE__*/function (_LuxonError3) { + _inheritsLoose(InvalidDurationError, _LuxonError3); + function InvalidDurationError(reason) { + return _LuxonError3.call(this, "Invalid Duration: " + reason.toMessage()) || this; + } + return InvalidDurationError; + }(LuxonError); + + /** + * @private + */ + var ConflictingSpecificationError = /*#__PURE__*/function (_LuxonError4) { + _inheritsLoose(ConflictingSpecificationError, _LuxonError4); + function ConflictingSpecificationError() { + return _LuxonError4.apply(this, arguments) || this; + } + return ConflictingSpecificationError; + }(LuxonError); + + /** + * @private + */ + var InvalidUnitError = /*#__PURE__*/function (_LuxonError5) { + _inheritsLoose(InvalidUnitError, _LuxonError5); + function InvalidUnitError(unit) { + return _LuxonError5.call(this, "Invalid unit " + unit) || this; + } + return InvalidUnitError; + }(LuxonError); + + /** + * @private + */ + var InvalidArgumentError = /*#__PURE__*/function (_LuxonError6) { + _inheritsLoose(InvalidArgumentError, _LuxonError6); + function InvalidArgumentError() { + return _LuxonError6.apply(this, arguments) || this; + } + return InvalidArgumentError; + }(LuxonError); + + /** + * @private + */ + var ZoneIsAbstractError = /*#__PURE__*/function (_LuxonError7) { + _inheritsLoose(ZoneIsAbstractError, _LuxonError7); + function ZoneIsAbstractError() { + return _LuxonError7.call(this, "Zone is an abstract class") || this; + } + return ZoneIsAbstractError; + }(LuxonError); + + /** + * @private + */ + + var n = "numeric", + s = "short", + l = "long"; + var DATE_SHORT = { + year: n, + month: n, + day: n + }; + var DATE_MED = { + year: n, + month: s, + day: n + }; + var DATE_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s + }; + var DATE_FULL = { + year: n, + month: l, + day: n + }; + var DATE_HUGE = { + year: n, + month: l, + day: n, + weekday: l + }; + var TIME_SIMPLE = { + hour: n, + minute: n + }; + var TIME_WITH_SECONDS = { + hour: n, + minute: n, + second: n + }; + var TIME_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: s + }; + var TIME_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: l + }; + var TIME_24_SIMPLE = { + hour: n, + minute: n, + hourCycle: "h23" + }; + var TIME_24_WITH_SECONDS = { + hour: n, + minute: n, + second: n, + hourCycle: "h23" + }; + var TIME_24_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + hourCycle: "h23", + timeZoneName: s + }; + var TIME_24_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + hourCycle: "h23", + timeZoneName: l + }; + var DATETIME_SHORT = { + year: n, + month: n, + day: n, + hour: n, + minute: n + }; + var DATETIME_SHORT_WITH_SECONDS = { + year: n, + month: n, + day: n, + hour: n, + minute: n, + second: n + }; + var DATETIME_MED = { + year: n, + month: s, + day: n, + hour: n, + minute: n + }; + var DATETIME_MED_WITH_SECONDS = { + year: n, + month: s, + day: n, + hour: n, + minute: n, + second: n + }; + var DATETIME_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, + hour: n, + minute: n + }; + var DATETIME_FULL = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + timeZoneName: s + }; + var DATETIME_FULL_WITH_SECONDS = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + second: n, + timeZoneName: s + }; + var DATETIME_HUGE = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + timeZoneName: l + }; + var DATETIME_HUGE_WITH_SECONDS = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + second: n, + timeZoneName: l + }; + + /** + * @interface + */ + var Zone = /*#__PURE__*/function () { + function Zone() {} + var _proto = Zone.prototype; + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + _proto.offsetName = function offsetName(ts, opts) { + throw new ZoneIsAbstractError(); + } + + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */; + _proto.formatOffset = function formatOffset(ts, format) { + throw new ZoneIsAbstractError(); + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */; + _proto.offset = function offset(ts) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */; + _proto.equals = function equals(otherZone) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */; + _createClass(Zone, [{ + key: "type", + get: + /** + * The type of zone + * @abstract + * @type {string} + */ + function get() { + throw new ZoneIsAbstractError(); + } + + /** + * The name of this zone. + * @abstract + * @type {string} + */ + }, { + key: "name", + get: function get() { + throw new ZoneIsAbstractError(); + } + + /** + * The IANA name of this zone. + * Defaults to `name` if not overwritten by a subclass. + * @abstract + * @type {string} + */ + }, { + key: "ianaName", + get: function get() { + return this.name; + } + + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + }, { + key: "isUniversal", + get: function get() { + throw new ZoneIsAbstractError(); + } + }, { + key: "isValid", + get: function get() { + throw new ZoneIsAbstractError(); + } + }]); + return Zone; + }(); + + var singleton$1 = null; + + /** + * Represents the local zone for this JavaScript environment. + * @implements {Zone} + */ + var SystemZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(SystemZone, _Zone); + function SystemZone() { + return _Zone.apply(this, arguments) || this; + } + var _proto = SystemZone.prototype; + /** @override **/ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale); + } + + /** @override **/; + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** @override **/; + _proto.offset = function offset(ts) { + return -new Date(ts).getTimezoneOffset(); + } + + /** @override **/; + _proto.equals = function equals(otherZone) { + return otherZone.type === "system"; + } + + /** @override **/; + _createClass(SystemZone, [{ + key: "type", + get: /** @override **/ + function get() { + return "system"; + } + + /** @override **/ + }, { + key: "name", + get: function get() { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } + + /** @override **/ + }, { + key: "isUniversal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }], [{ + key: "instance", + get: + /** + * Get a singleton instance of the local zone + * @return {SystemZone} + */ + function get() { + if (singleton$1 === null) { + singleton$1 = new SystemZone(); + } + return singleton$1; + } + }]); + return SystemZone; + }(Zone); + + var dtfCache = new Map(); + function makeDTF(zoneName) { + var dtf = dtfCache.get(zoneName); + if (dtf === undefined) { + dtf = new Intl.DateTimeFormat("en-US", { + hour12: false, + timeZone: zoneName, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + era: "short" + }); + dtfCache.set(zoneName, dtf); + } + return dtf; + } + var typeToPos = { + year: 0, + month: 1, + day: 2, + era: 3, + hour: 4, + minute: 5, + second: 6 + }; + function hackyOffset(dtf, date) { + var formatted = dtf.format(date).replace(/\u200E/g, ""), + parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted), + fMonth = parsed[1], + fDay = parsed[2], + fYear = parsed[3], + fadOrBc = parsed[4], + fHour = parsed[5], + fMinute = parsed[6], + fSecond = parsed[7]; + return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond]; + } + function partsOffset(dtf, date) { + var formatted = dtf.formatToParts(date); + var filled = []; + for (var i = 0; i < formatted.length; i++) { + var _formatted$i = formatted[i], + type = _formatted$i.type, + value = _formatted$i.value; + var pos = typeToPos[type]; + if (type === "era") { + filled[pos] = value; + } else if (!isUndefined(pos)) { + filled[pos] = parseInt(value, 10); + } + } + return filled; + } + var ianaZoneCache = new Map(); + /** + * A zone identified by an IANA identifier, like America/New_York + * @implements {Zone} + */ + var IANAZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(IANAZone, _Zone); + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + IANAZone.create = function create(name) { + var zone = ianaZoneCache.get(name); + if (zone === undefined) { + ianaZoneCache.set(name, zone = new IANAZone(name)); + } + return zone; + } + + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */; + IANAZone.resetCache = function resetCache() { + ianaZoneCache.clear(); + dtfCache.clear(); + } + + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead. + * @return {boolean} + */; + IANAZone.isValidSpecifier = function isValidSpecifier(s) { + return this.isValidZone(s); + } + + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */; + IANAZone.isValidZone = function isValidZone(zone) { + if (!zone) { + return false; + } + try { + new Intl.DateTimeFormat("en-US", { + timeZone: zone + }).format(); + return true; + } catch (e) { + return false; + } + }; + function IANAZone(name) { + var _this; + _this = _Zone.call(this) || this; + /** @private **/ + _this.zoneName = name; + /** @private **/ + _this.valid = IANAZone.isValidZone(name); + return _this; + } + + /** + * The type of zone. `iana` for all instances of `IANAZone`. + * @override + * @type {string} + */ + var _proto = IANAZone.prototype; + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @override + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale, this.name); + } + + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */; + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @override + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */; + _proto.offset = function offset(ts) { + if (!this.valid) return NaN; + var date = new Date(ts); + if (isNaN(date)) return NaN; + var dtf = makeDTF(this.name); + var _ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date), + year = _ref2[0], + month = _ref2[1], + day = _ref2[2], + adOrBc = _ref2[3], + hour = _ref2[4], + minute = _ref2[5], + second = _ref2[6]; + if (adOrBc === "BC") { + year = -Math.abs(year) + 1; + } + + // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat + var adjustedHour = hour === 24 ? 0 : hour; + var asUTC = objToLocalTS({ + year: year, + month: month, + day: day, + hour: adjustedHour, + minute: minute, + second: second, + millisecond: 0 + }); + var asTS = +date; + var over = asTS % 1000; + asTS -= over >= 0 ? over : 1000 + over; + return (asUTC - asTS) / (60 * 1000); + } + + /** + * Return whether this Zone is equal to another zone + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */; + _proto.equals = function equals(otherZone) { + return otherZone.type === "iana" && otherZone.name === this.name; + } + + /** + * Return whether this Zone is valid. + * @override + * @type {boolean} + */; + _createClass(IANAZone, [{ + key: "type", + get: function get() { + return "iana"; + } + + /** + * The name of this zone (i.e. the IANA zone name). + * @override + * @type {string} + */ + }, { + key: "name", + get: function get() { + return this.zoneName; + } + + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns false for all IANA zones. + * @override + * @type {boolean} + */ + }, { + key: "isUniversal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return this.valid; + } + }]); + return IANAZone; + }(Zone); + + var _excluded = ["base"], + _excluded2 = ["padTo", "floor"]; + + // todo - remap caching + + var intlLFCache = {}; + function getCachedLF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var key = JSON.stringify([locString, opts]); + var dtf = intlLFCache[key]; + if (!dtf) { + dtf = new Intl.ListFormat(locString, opts); + intlLFCache[key] = dtf; + } + return dtf; + } + var intlDTCache = new Map(); + function getCachedDTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var key = JSON.stringify([locString, opts]); + var dtf = intlDTCache.get(key); + if (dtf === undefined) { + dtf = new Intl.DateTimeFormat(locString, opts); + intlDTCache.set(key, dtf); + } + return dtf; + } + var intlNumCache = new Map(); + function getCachedINF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var key = JSON.stringify([locString, opts]); + var inf = intlNumCache.get(key); + if (inf === undefined) { + inf = new Intl.NumberFormat(locString, opts); + intlNumCache.set(key, inf); + } + return inf; + } + var intlRelCache = new Map(); + function getCachedRTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var _opts = opts; + _opts.base; + var cacheKeyOpts = _objectWithoutPropertiesLoose(_opts, _excluded); // exclude `base` from the options + var key = JSON.stringify([locString, cacheKeyOpts]); + var inf = intlRelCache.get(key); + if (inf === undefined) { + inf = new Intl.RelativeTimeFormat(locString, opts); + intlRelCache.set(key, inf); + } + return inf; + } + var sysLocaleCache = null; + function systemLocale() { + if (sysLocaleCache) { + return sysLocaleCache; + } else { + sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale; + return sysLocaleCache; + } + } + var intlResolvedOptionsCache = new Map(); + function getCachedIntResolvedOptions(locString) { + var opts = intlResolvedOptionsCache.get(locString); + if (opts === undefined) { + opts = new Intl.DateTimeFormat(locString).resolvedOptions(); + intlResolvedOptionsCache.set(locString, opts); + } + return opts; + } + var weekInfoCache = new Map(); + function getCachedWeekInfo(locString) { + var data = weekInfoCache.get(locString); + if (!data) { + var locale = new Intl.Locale(locString); + // browsers currently implement this as a property, but spec says it should be a getter function + data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo; + // minimalDays was removed from WeekInfo: https://github.com/tc39/proposal-intl-locale-info/issues/86 + if (!("minimalDays" in data)) { + data = _extends({}, fallbackWeekSettings, data); + } + weekInfoCache.set(locString, data); + } + return data; + } + function parseLocaleString(localeStr) { + // I really want to avoid writing a BCP 47 parser + // see, e.g. https://github.com/wooorm/bcp-47 + // Instead, we'll do this: + + // a) if the string has no -u extensions, just leave it alone + // b) if it does, use Intl to resolve everything + // c) if Intl fails, try again without the -u + + // private subtags and unicode subtags have ordering requirements, + // and we're not properly parsing this, so just strip out the + // private ones if they exist. + var xIndex = localeStr.indexOf("-x-"); + if (xIndex !== -1) { + localeStr = localeStr.substring(0, xIndex); + } + var uIndex = localeStr.indexOf("-u-"); + if (uIndex === -1) { + return [localeStr]; + } else { + var options; + var selectedStr; + try { + options = getCachedDTF(localeStr).resolvedOptions(); + selectedStr = localeStr; + } catch (e) { + var smaller = localeStr.substring(0, uIndex); + options = getCachedDTF(smaller).resolvedOptions(); + selectedStr = smaller; + } + var _options = options, + numberingSystem = _options.numberingSystem, + calendar = _options.calendar; + return [selectedStr, numberingSystem, calendar]; + } + } + function intlConfigString(localeStr, numberingSystem, outputCalendar) { + if (outputCalendar || numberingSystem) { + if (!localeStr.includes("-u-")) { + localeStr += "-u"; + } + if (outputCalendar) { + localeStr += "-ca-" + outputCalendar; + } + if (numberingSystem) { + localeStr += "-nu-" + numberingSystem; + } + return localeStr; + } else { + return localeStr; + } + } + function mapMonths(f) { + var ms = []; + for (var i = 1; i <= 12; i++) { + var dt = DateTime.utc(2009, i, 1); + ms.push(f(dt)); + } + return ms; + } + function mapWeekdays(f) { + var ms = []; + for (var i = 1; i <= 7; i++) { + var dt = DateTime.utc(2016, 11, 13 + i); + ms.push(f(dt)); + } + return ms; + } + function listStuff(loc, length, englishFn, intlFn) { + var mode = loc.listingMode(); + if (mode === "error") { + return null; + } else if (mode === "en") { + return englishFn(length); + } else { + return intlFn(length); + } + } + function supportsFastNumbers(loc) { + if (loc.numberingSystem && loc.numberingSystem !== "latn") { + return false; + } else { + return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || getCachedIntResolvedOptions(loc.locale).numberingSystem === "latn"; + } + } + + /** + * @private + */ + var PolyNumberFormatter = /*#__PURE__*/function () { + function PolyNumberFormatter(intl, forceSimple, opts) { + this.padTo = opts.padTo || 0; + this.floor = opts.floor || false; + opts.padTo; + opts.floor; + var otherOpts = _objectWithoutPropertiesLoose(opts, _excluded2); + if (!forceSimple || Object.keys(otherOpts).length > 0) { + var intlOpts = _extends({ + useGrouping: false + }, opts); + if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; + this.inf = getCachedINF(intl, intlOpts); + } + } + var _proto = PolyNumberFormatter.prototype; + _proto.format = function format(i) { + if (this.inf) { + var fixed = this.floor ? Math.floor(i) : i; + return this.inf.format(fixed); + } else { + // to match the browser's numberformatter defaults + var _fixed = this.floor ? Math.floor(i) : roundTo(i, 3); + return padStart(_fixed, this.padTo); + } + }; + return PolyNumberFormatter; + }(); + /** + * @private + */ + var PolyDateFormatter = /*#__PURE__*/function () { + function PolyDateFormatter(dt, intl, opts) { + this.opts = opts; + this.originalZone = undefined; + var z = undefined; + if (this.opts.timeZone) { + // Don't apply any workarounds if a timeZone is explicitly provided in opts + this.dt = dt; + } else if (dt.zone.type === "fixed") { + // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like. + // That is why fixed-offset TZ is set to that unless it is: + // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT. + // 2. Unsupported by the browser: + // - some do not support Etc/ + // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata + var gmtOffset = -1 * (dt.offset / 60); + var offsetZ = gmtOffset >= 0 ? "Etc/GMT+" + gmtOffset : "Etc/GMT" + gmtOffset; + if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) { + z = offsetZ; + this.dt = dt; + } else { + // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so + // we manually apply the offset and substitute the zone as needed. + z = "UTC"; + this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({ + minutes: dt.offset + }); + this.originalZone = dt.zone; + } + } else if (dt.zone.type === "system") { + this.dt = dt; + } else if (dt.zone.type === "iana") { + this.dt = dt; + z = dt.zone.name; + } else { + // Custom zones can have any offset / offsetName so we just manually + // apply the offset and substitute the zone as needed. + z = "UTC"; + this.dt = dt.setZone("UTC").plus({ + minutes: dt.offset + }); + this.originalZone = dt.zone; + } + var intlOpts = _extends({}, this.opts); + intlOpts.timeZone = intlOpts.timeZone || z; + this.dtf = getCachedDTF(intl, intlOpts); + } + var _proto2 = PolyDateFormatter.prototype; + _proto2.format = function format() { + if (this.originalZone) { + // If we have to substitute in the actual zone name, we have to use + // formatToParts so that the timezone can be replaced. + return this.formatToParts().map(function (_ref) { + var value = _ref.value; + return value; + }).join(""); + } + return this.dtf.format(this.dt.toJSDate()); + }; + _proto2.formatToParts = function formatToParts() { + var _this = this; + var parts = this.dtf.formatToParts(this.dt.toJSDate()); + if (this.originalZone) { + return parts.map(function (part) { + if (part.type === "timeZoneName") { + var offsetName = _this.originalZone.offsetName(_this.dt.ts, { + locale: _this.dt.locale, + format: _this.opts.timeZoneName + }); + return _extends({}, part, { + value: offsetName + }); + } else { + return part; + } + }); + } + return parts; + }; + _proto2.resolvedOptions = function resolvedOptions() { + return this.dtf.resolvedOptions(); + }; + return PolyDateFormatter; + }(); + /** + * @private + */ + var PolyRelFormatter = /*#__PURE__*/function () { + function PolyRelFormatter(intl, isEnglish, opts) { + this.opts = _extends({ + style: "long" + }, opts); + if (!isEnglish && hasRelative()) { + this.rtf = getCachedRTF(intl, opts); + } + } + var _proto3 = PolyRelFormatter.prototype; + _proto3.format = function format(count, unit) { + if (this.rtf) { + return this.rtf.format(count, unit); + } else { + return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); + } + }; + _proto3.formatToParts = function formatToParts(count, unit) { + if (this.rtf) { + return this.rtf.formatToParts(count, unit); + } else { + return []; + } + }; + return PolyRelFormatter; + }(); + var fallbackWeekSettings = { + firstDay: 1, + minimalDays: 4, + weekend: [6, 7] + }; + + /** + * @private + */ + var Locale = /*#__PURE__*/function () { + Locale.fromOpts = function fromOpts(opts) { + return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN); + }; + Locale.create = function create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN) { + if (defaultToEN === void 0) { + defaultToEN = false; + } + var specifiedLocale = locale || Settings.defaultLocale; + // the system locale is useful for human-readable strings but annoying for parsing/formatting known formats + var localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()); + var numberingSystemR = numberingSystem || Settings.defaultNumberingSystem; + var outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; + var weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings; + return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale); + }; + Locale.resetCache = function resetCache() { + sysLocaleCache = null; + intlDTCache.clear(); + intlNumCache.clear(); + intlRelCache.clear(); + intlResolvedOptionsCache.clear(); + weekInfoCache.clear(); + }; + Locale.fromObject = function fromObject(_temp) { + var _ref2 = _temp === void 0 ? {} : _temp, + locale = _ref2.locale, + numberingSystem = _ref2.numberingSystem, + outputCalendar = _ref2.outputCalendar, + weekSettings = _ref2.weekSettings; + return Locale.create(locale, numberingSystem, outputCalendar, weekSettings); + }; + function Locale(locale, numbering, outputCalendar, weekSettings, specifiedLocale) { + var _parseLocaleString = parseLocaleString(locale), + parsedLocale = _parseLocaleString[0], + parsedNumberingSystem = _parseLocaleString[1], + parsedOutputCalendar = _parseLocaleString[2]; + this.locale = parsedLocale; + this.numberingSystem = numbering || parsedNumberingSystem || null; + this.outputCalendar = outputCalendar || parsedOutputCalendar || null; + this.weekSettings = weekSettings; + this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); + this.weekdaysCache = { + format: {}, + standalone: {} + }; + this.monthsCache = { + format: {}, + standalone: {} + }; + this.meridiemCache = null; + this.eraCache = {}; + this.specifiedLocale = specifiedLocale; + this.fastNumbersCached = null; + } + var _proto4 = Locale.prototype; + _proto4.listingMode = function listingMode() { + var isActuallyEn = this.isEnglish(); + var hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); + return isActuallyEn && hasNoWeirdness ? "en" : "intl"; + }; + _proto4.clone = function clone(alts) { + if (!alts || Object.getOwnPropertyNames(alts).length === 0) { + return this; + } else { + return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false); + } + }; + _proto4.redefaultToEN = function redefaultToEN(alts) { + if (alts === void 0) { + alts = {}; + } + return this.clone(_extends({}, alts, { + defaultToEN: true + })); + }; + _proto4.redefaultToSystem = function redefaultToSystem(alts) { + if (alts === void 0) { + alts = {}; + } + return this.clone(_extends({}, alts, { + defaultToEN: false + })); + }; + _proto4.months = function months$1(length, format) { + var _this2 = this; + if (format === void 0) { + format = false; + } + return listStuff(this, length, months, function () { + // Workaround for "ja" locale: formatToParts does not label all parts of the month + // as "month" and for this locale there is no difference between "format" and "non-format". + // As such, just use format() instead of formatToParts() and take the whole string + var monthSpecialCase = _this2.intl === "ja" || _this2.intl.startsWith("ja-"); + format &= !monthSpecialCase; + var intl = format ? { + month: length, + day: "numeric" + } : { + month: length + }, + formatStr = format ? "format" : "standalone"; + if (!_this2.monthsCache[formatStr][length]) { + var mapper = !monthSpecialCase ? function (dt) { + return _this2.extract(dt, intl, "month"); + } : function (dt) { + return _this2.dtFormatter(dt, intl).format(); + }; + _this2.monthsCache[formatStr][length] = mapMonths(mapper); + } + return _this2.monthsCache[formatStr][length]; + }); + }; + _proto4.weekdays = function weekdays$1(length, format) { + var _this3 = this; + if (format === void 0) { + format = false; + } + return listStuff(this, length, weekdays, function () { + var intl = format ? { + weekday: length, + year: "numeric", + month: "long", + day: "numeric" + } : { + weekday: length + }, + formatStr = format ? "format" : "standalone"; + if (!_this3.weekdaysCache[formatStr][length]) { + _this3.weekdaysCache[formatStr][length] = mapWeekdays(function (dt) { + return _this3.extract(dt, intl, "weekday"); + }); + } + return _this3.weekdaysCache[formatStr][length]; + }); + }; + _proto4.meridiems = function meridiems$1() { + var _this4 = this; + return listStuff(this, undefined, function () { + return meridiems; + }, function () { + // In theory there could be aribitrary day periods. We're gonna assume there are exactly two + // for AM and PM. This is probably wrong, but it's makes parsing way easier. + if (!_this4.meridiemCache) { + var intl = { + hour: "numeric", + hourCycle: "h12" + }; + _this4.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(function (dt) { + return _this4.extract(dt, intl, "dayperiod"); + }); + } + return _this4.meridiemCache; + }); + }; + _proto4.eras = function eras$1(length) { + var _this5 = this; + return listStuff(this, length, eras, function () { + var intl = { + era: length + }; + + // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates + // to definitely enumerate them. + if (!_this5.eraCache[length]) { + _this5.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(function (dt) { + return _this5.extract(dt, intl, "era"); + }); + } + return _this5.eraCache[length]; + }); + }; + _proto4.extract = function extract(dt, intlOpts, field) { + var df = this.dtFormatter(dt, intlOpts), + results = df.formatToParts(), + matching = results.find(function (m) { + return m.type.toLowerCase() === field; + }); + return matching ? matching.value : null; + }; + _proto4.numberFormatter = function numberFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave) + // (in contrast, the rest of the condition is used heavily) + return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); + }; + _proto4.dtFormatter = function dtFormatter(dt, intlOpts) { + if (intlOpts === void 0) { + intlOpts = {}; + } + return new PolyDateFormatter(dt, this.intl, intlOpts); + }; + _proto4.relFormatter = function relFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + return new PolyRelFormatter(this.intl, this.isEnglish(), opts); + }; + _proto4.listFormatter = function listFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + return getCachedLF(this.intl, opts); + }; + _proto4.isEnglish = function isEnglish() { + return this.locale === "en" || this.locale.toLowerCase() === "en-us" || getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us"); + }; + _proto4.getWeekSettings = function getWeekSettings() { + if (this.weekSettings) { + return this.weekSettings; + } else if (!hasLocaleWeekInfo()) { + return fallbackWeekSettings; + } else { + return getCachedWeekInfo(this.locale); + } + }; + _proto4.getStartOfWeek = function getStartOfWeek() { + return this.getWeekSettings().firstDay; + }; + _proto4.getMinDaysInFirstWeek = function getMinDaysInFirstWeek() { + return this.getWeekSettings().minimalDays; + }; + _proto4.getWeekendDays = function getWeekendDays() { + return this.getWeekSettings().weekend; + }; + _proto4.equals = function equals(other) { + return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar; + }; + _proto4.toString = function toString() { + return "Locale(" + this.locale + ", " + this.numberingSystem + ", " + this.outputCalendar + ")"; + }; + _createClass(Locale, [{ + key: "fastNumbers", + get: function get() { + if (this.fastNumbersCached == null) { + this.fastNumbersCached = supportsFastNumbers(this); + } + return this.fastNumbersCached; + } + }]); + return Locale; + }(); + + var singleton = null; + + /** + * A zone with a fixed offset (meaning no DST) + * @implements {Zone} + */ + var FixedOffsetZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(FixedOffsetZone, _Zone); + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + FixedOffsetZone.instance = function instance(offset) { + return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset); + } + + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */; + FixedOffsetZone.parseSpecifier = function parseSpecifier(s) { + if (s) { + var r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + if (r) { + return new FixedOffsetZone(signedOffset(r[1], r[2])); + } + } + return null; + }; + function FixedOffsetZone(offset) { + var _this; + _this = _Zone.call(this) || this; + /** @private **/ + _this.fixed = offset; + return _this; + } + + /** + * The type of zone. `fixed` for all instances of `FixedOffsetZone`. + * @override + * @type {string} + */ + var _proto = FixedOffsetZone.prototype; + /** + * Returns the offset's common name at the specified timestamp. + * + * For fixed offset zones this equals to the zone name. + * @override + */ + _proto.offsetName = function offsetName() { + return this.name; + } + + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */; + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.fixed, format); + } + + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns true for all fixed offset zones. + * @override + * @type {boolean} + */; + /** + * Return the offset in minutes for this zone at the specified timestamp. + * + * For fixed offset zones, this is constant and does not depend on a timestamp. + * @override + * @return {number} + */ + _proto.offset = function offset() { + return this.fixed; + } + + /** + * Return whether this Zone is equal to another zone (i.e. also fixed and same offset) + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */; + _proto.equals = function equals(otherZone) { + return otherZone.type === "fixed" && otherZone.fixed === this.fixed; + } + + /** + * Return whether this Zone is valid: + * All fixed offset zones are valid. + * @override + * @type {boolean} + */; + _createClass(FixedOffsetZone, [{ + key: "type", + get: function get() { + return "fixed"; + } + + /** + * The name of this zone. + * All fixed zones' names always start with "UTC" (plus optional offset) + * @override + * @type {string} + */ + }, { + key: "name", + get: function get() { + return this.fixed === 0 ? "UTC" : "UTC" + formatOffset(this.fixed, "narrow"); + } + + /** + * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn` + * + * @override + * @type {string} + */ + }, { + key: "ianaName", + get: function get() { + if (this.fixed === 0) { + return "Etc/UTC"; + } else { + return "Etc/GMT" + formatOffset(-this.fixed, "narrow"); + } + } + }, { + key: "isUniversal", + get: function get() { + return true; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }], [{ + key: "utcInstance", + get: + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + function get() { + if (singleton === null) { + singleton = new FixedOffsetZone(0); + } + return singleton; + } + }]); + return FixedOffsetZone; + }(Zone); + + /** + * A zone that failed to parse. You should never need to instantiate this. + * @implements {Zone} + */ + var InvalidZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(InvalidZone, _Zone); + function InvalidZone(zoneName) { + var _this; + _this = _Zone.call(this) || this; + /** @private */ + _this.zoneName = zoneName; + return _this; + } + + /** @override **/ + var _proto = InvalidZone.prototype; + /** @override **/ + _proto.offsetName = function offsetName() { + return null; + } + + /** @override **/; + _proto.formatOffset = function formatOffset() { + return ""; + } + + /** @override **/; + _proto.offset = function offset() { + return NaN; + } + + /** @override **/; + _proto.equals = function equals() { + return false; + } + + /** @override **/; + _createClass(InvalidZone, [{ + key: "type", + get: function get() { + return "invalid"; + } + + /** @override **/ + }, { + key: "name", + get: function get() { + return this.zoneName; + } + + /** @override **/ + }, { + key: "isUniversal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return false; + } + }]); + return InvalidZone; + }(Zone); + + /** + * @private + */ + function normalizeZone(input, defaultZone) { + if (isUndefined(input) || input === null) { + return defaultZone; + } else if (input instanceof Zone) { + return input; + } else if (isString(input)) { + var lowered = input.toLowerCase(); + if (lowered === "default") return defaultZone;else if (lowered === "local" || lowered === "system") return SystemZone.instance;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input); + } else if (isNumber(input)) { + return FixedOffsetZone.instance(input); + } else if (typeof input === "object" && "offset" in input && typeof input.offset === "function") { + // This is dumb, but the instanceof check above doesn't seem to really work + // so we're duck checking it + return input; + } else { + return new InvalidZone(input); + } + } + + var numberingSystems = { + arab: "[\u0660-\u0669]", + arabext: "[\u06F0-\u06F9]", + bali: "[\u1B50-\u1B59]", + beng: "[\u09E6-\u09EF]", + deva: "[\u0966-\u096F]", + fullwide: "[\uFF10-\uFF19]", + gujr: "[\u0AE6-\u0AEF]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[\u17E0-\u17E9]", + knda: "[\u0CE6-\u0CEF]", + laoo: "[\u0ED0-\u0ED9]", + limb: "[\u1946-\u194F]", + mlym: "[\u0D66-\u0D6F]", + mong: "[\u1810-\u1819]", + mymr: "[\u1040-\u1049]", + orya: "[\u0B66-\u0B6F]", + tamldec: "[\u0BE6-\u0BEF]", + telu: "[\u0C66-\u0C6F]", + thai: "[\u0E50-\u0E59]", + tibt: "[\u0F20-\u0F29]", + latn: "\\d" + }; + var numberingSystemsUTF16 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881] + }; + var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); + function parseDigits(str) { + var value = parseInt(str, 10); + if (isNaN(value)) { + value = ""; + for (var i = 0; i < str.length; i++) { + var code = str.charCodeAt(i); + if (str[i].search(numberingSystems.hanidec) !== -1) { + value += hanidecChars.indexOf(str[i]); + } else { + for (var key in numberingSystemsUTF16) { + var _numberingSystemsUTF = numberingSystemsUTF16[key], + min = _numberingSystemsUTF[0], + max = _numberingSystemsUTF[1]; + if (code >= min && code <= max) { + value += code - min; + } + } + } + } + return parseInt(value, 10); + } else { + return value; + } + } + + // cache of {numberingSystem: {append: regex}} + var digitRegexCache = new Map(); + function resetDigitRegexCache() { + digitRegexCache.clear(); + } + function digitRegex(_ref, append) { + var numberingSystem = _ref.numberingSystem; + if (append === void 0) { + append = ""; + } + var ns = numberingSystem || "latn"; + var appendCache = digitRegexCache.get(ns); + if (appendCache === undefined) { + appendCache = new Map(); + digitRegexCache.set(ns, appendCache); + } + var regex = appendCache.get(append); + if (regex === undefined) { + regex = new RegExp("" + numberingSystems[ns] + append); + appendCache.set(append, regex); + } + return regex; + } + + var now = function now() { + return Date.now(); + }, + defaultZone = "system", + defaultLocale = null, + defaultNumberingSystem = null, + defaultOutputCalendar = null, + twoDigitCutoffYear = 60, + throwOnInvalid, + defaultWeekSettings = null; + + /** + * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here. + */ + var Settings = /*#__PURE__*/function () { + function Settings() {} + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + Settings.resetCaches = function resetCaches() { + Locale.resetCache(); + IANAZone.resetCache(); + DateTime.resetCache(); + resetDigitRegexCache(); + }; + _createClass(Settings, null, [{ + key: "now", + get: + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + function get() { + return now; + } + + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */, + set: function set(n) { + now = n; + } + + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * Use the value "system" to reset this value to the system's time zone. + * @type {string} + */ + }, { + key: "defaultZone", + get: + /** + * Get the default time zone object currently used to create DateTimes. Does not affect existing instances. + * The default value is the system's time zone (the one set on the machine that runs this code). + * @type {Zone} + */ + function get() { + return normalizeZone(defaultZone, SystemZone.instance); + } + + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(zone) { + defaultZone = zone; + } + }, { + key: "defaultLocale", + get: function get() { + return defaultLocale; + } + + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(locale) { + defaultLocale = locale; + } + + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + }, { + key: "defaultNumberingSystem", + get: function get() { + return defaultNumberingSystem; + } + + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(numberingSystem) { + defaultNumberingSystem = numberingSystem; + } + + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + }, { + key: "defaultOutputCalendar", + get: function get() { + return defaultOutputCalendar; + } + + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(outputCalendar) { + defaultOutputCalendar = outputCalendar; + } + + /** + * @typedef {Object} WeekSettings + * @property {number} firstDay + * @property {number} minimalDays + * @property {number[]} weekend + */ + + /** + * @return {WeekSettings|null} + */ + }, { + key: "defaultWeekSettings", + get: function get() { + return defaultWeekSettings; + } + + /** + * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and + * how many days are required in the first week of a year. + * Does not affect existing instances. + * + * @param {WeekSettings|null} weekSettings + */, + set: function set(weekSettings) { + defaultWeekSettings = validateWeekSettings(weekSettings); + } + + /** + * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + */ + }, { + key: "twoDigitCutoffYear", + get: function get() { + return twoDigitCutoffYear; + } + + /** + * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century + * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century + * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950 + * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50 + * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50 + */, + set: function set(cutoffYear) { + twoDigitCutoffYear = cutoffYear % 100; + } + + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + }, { + key: "throwOnInvalid", + get: function get() { + return throwOnInvalid; + } + + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */, + set: function set(t) { + throwOnInvalid = t; + } + }]); + return Settings; + }(); + + var Invalid = /*#__PURE__*/function () { + function Invalid(reason, explanation) { + this.reason = reason; + this.explanation = explanation; + } + var _proto = Invalid.prototype; + _proto.toMessage = function toMessage() { + if (this.explanation) { + return this.reason + ": " + this.explanation; + } else { + return this.reason; + } + }; + return Invalid; + }(); + + var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], + leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; + function unitOutOfRange(unit, value) { + return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid"); + } + function dayOfWeek(year, month, day) { + var d = new Date(Date.UTC(year, month - 1, day)); + if (year < 100 && year >= 0) { + d.setUTCFullYear(d.getUTCFullYear() - 1900); + } + var js = d.getUTCDay(); + return js === 0 ? 7 : js; + } + function computeOrdinal(year, month, day) { + return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; + } + function uncomputeOrdinal(year, ordinal) { + var table = isLeapYear(year) ? leapLadder : nonLeapLadder, + month0 = table.findIndex(function (i) { + return i < ordinal; + }), + day = ordinal - table[month0]; + return { + month: month0 + 1, + day: day + }; + } + function isoWeekdayToLocal(isoWeekday, startOfWeek) { + return (isoWeekday - startOfWeek + 7) % 7 + 1; + } + + /** + * @private + */ + + function gregorianToWeek(gregObj, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var year = gregObj.year, + month = gregObj.month, + day = gregObj.day, + ordinal = computeOrdinal(year, month, day), + weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek); + var weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7), + weekYear; + if (weekNumber < 1) { + weekYear = year - 1; + weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek); + } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) { + weekYear = year + 1; + weekNumber = 1; + } else { + weekYear = year; + } + return _extends({ + weekYear: weekYear, + weekNumber: weekNumber, + weekday: weekday + }, timeObject(gregObj)); + } + function weekToGregorian(weekData, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var weekYear = weekData.weekYear, + weekNumber = weekData.weekNumber, + weekday = weekData.weekday, + weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek), + yearInDays = daysInYear(weekYear); + var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek, + year; + if (ordinal < 1) { + year = weekYear - 1; + ordinal += daysInYear(year); + } else if (ordinal > yearInDays) { + year = weekYear + 1; + ordinal -= daysInYear(weekYear); + } else { + year = weekYear; + } + var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal.month, + day = _uncomputeOrdinal.day; + return _extends({ + year: year, + month: month, + day: day + }, timeObject(weekData)); + } + function gregorianToOrdinal(gregData) { + var year = gregData.year, + month = gregData.month, + day = gregData.day; + var ordinal = computeOrdinal(year, month, day); + return _extends({ + year: year, + ordinal: ordinal + }, timeObject(gregData)); + } + function ordinalToGregorian(ordinalData) { + var year = ordinalData.year, + ordinal = ordinalData.ordinal; + var _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal2.month, + day = _uncomputeOrdinal2.day; + return _extends({ + year: year, + month: month, + day: day + }, timeObject(ordinalData)); + } + + /** + * Check if local week units like localWeekday are used in obj. + * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties. + * Modifies obj in-place! + * @param obj the object values + */ + function usesLocalWeekValues(obj, loc) { + var hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear); + if (hasLocaleWeekData) { + var hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear); + if (hasIsoWeekData) { + throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields"); + } + if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday; + if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber; + if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear; + delete obj.localWeekday; + delete obj.localWeekNumber; + delete obj.localWeekYear; + return { + minDaysInFirstWeek: loc.getMinDaysInFirstWeek(), + startOfWeek: loc.getStartOfWeek() + }; + } else { + return { + minDaysInFirstWeek: 4, + startOfWeek: 1 + }; + } + } + function hasInvalidWeekData(obj, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var validYear = isInteger(obj.weekYear), + validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)), + validWeekday = integerBetween(obj.weekday, 1, 7); + if (!validYear) { + return unitOutOfRange("weekYear", obj.weekYear); + } else if (!validWeek) { + return unitOutOfRange("week", obj.weekNumber); + } else if (!validWeekday) { + return unitOutOfRange("weekday", obj.weekday); + } else return false; + } + function hasInvalidOrdinalData(obj) { + var validYear = isInteger(obj.year), + validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validOrdinal) { + return unitOutOfRange("ordinal", obj.ordinal); + } else return false; + } + function hasInvalidGregorianData(obj) { + var validYear = isInteger(obj.year), + validMonth = integerBetween(obj.month, 1, 12), + validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validMonth) { + return unitOutOfRange("month", obj.month); + } else if (!validDay) { + return unitOutOfRange("day", obj.day); + } else return false; + } + function hasInvalidTimeData(obj) { + var hour = obj.hour, + minute = obj.minute, + second = obj.second, + millisecond = obj.millisecond; + var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, + validMinute = integerBetween(minute, 0, 59), + validSecond = integerBetween(second, 0, 59), + validMillisecond = integerBetween(millisecond, 0, 999); + if (!validHour) { + return unitOutOfRange("hour", hour); + } else if (!validMinute) { + return unitOutOfRange("minute", minute); + } else if (!validSecond) { + return unitOutOfRange("second", second); + } else if (!validMillisecond) { + return unitOutOfRange("millisecond", millisecond); + } else return false; + } + + /** + * @private + */ + + // TYPES + + function isUndefined(o) { + return typeof o === "undefined"; + } + function isNumber(o) { + return typeof o === "number"; + } + function isInteger(o) { + return typeof o === "number" && o % 1 === 0; + } + function isString(o) { + return typeof o === "string"; + } + function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; + } + + // CAPABILITIES + + function hasRelative() { + try { + return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; + } catch (e) { + return false; + } + } + function hasLocaleWeekInfo() { + try { + return typeof Intl !== "undefined" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype); + } catch (e) { + return false; + } + } + + // OBJECTS AND ARRAYS + + function maybeArray(thing) { + return Array.isArray(thing) ? thing : [thing]; + } + function bestBy(arr, by, compare) { + if (arr.length === 0) { + return undefined; + } + return arr.reduce(function (best, next) { + var pair = [by(next), next]; + if (!best) { + return pair; + } else if (compare(best[0], pair[0]) === best[0]) { + return best; + } else { + return pair; + } + }, null)[1]; + } + function pick(obj, keys) { + return keys.reduce(function (a, k) { + a[k] = obj[k]; + return a; + }, {}); + } + function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } + function validateWeekSettings(settings) { + if (settings == null) { + return null; + } else if (typeof settings !== "object") { + throw new InvalidArgumentError("Week settings must be an object"); + } else { + if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some(function (v) { + return !integerBetween(v, 1, 7); + })) { + throw new InvalidArgumentError("Invalid week settings"); + } + return { + firstDay: settings.firstDay, + minimalDays: settings.minimalDays, + weekend: Array.from(settings.weekend) + }; + } + } + + // NUMBERS AND STRINGS + + function integerBetween(thing, bottom, top) { + return isInteger(thing) && thing >= bottom && thing <= top; + } + + // x % n but takes the sign of n instead of x + function floorMod(x, n) { + return x - n * Math.floor(x / n); + } + function padStart(input, n) { + if (n === void 0) { + n = 2; + } + var isNeg = input < 0; + var padded; + if (isNeg) { + padded = "-" + ("" + -input).padStart(n, "0"); + } else { + padded = ("" + input).padStart(n, "0"); + } + return padded; + } + function parseInteger(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseInt(string, 10); + } + } + function parseFloating(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseFloat(string); + } + } + function parseMillis(fraction) { + // Return undefined (instead of 0) in these cases, where fraction is not set + if (isUndefined(fraction) || fraction === null || fraction === "") { + return undefined; + } else { + var f = parseFloat("0." + fraction) * 1000; + return Math.floor(f); + } + } + function roundTo(number, digits, rounding) { + if (rounding === void 0) { + rounding = "round"; + } + var factor = Math.pow(10, digits); + switch (rounding) { + case "expand": + return number > 0 ? Math.ceil(number * factor) / factor : Math.floor(number * factor) / factor; + case "trunc": + return Math.trunc(number * factor) / factor; + case "round": + return Math.round(number * factor) / factor; + case "floor": + return Math.floor(number * factor) / factor; + case "ceil": + return Math.ceil(number * factor) / factor; + default: + throw new RangeError("Value rounding " + rounding + " is out of range"); + } + } + + // DATE BASICS + + function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + } + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } + function daysInMonth(year, month) { + var modMonth = floorMod(month - 1, 12) + 1, + modYear = year + (month - modMonth) / 12; + if (modMonth === 2) { + return isLeapYear(modYear) ? 29 : 28; + } else { + return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; + } + } + + // convert a calendar object to a local timestamp (epoch, but with the offset baked in) + function objToLocalTS(obj) { + var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond); + + // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that + if (obj.year < 100 && obj.year >= 0) { + d = new Date(d); + // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not + // so if obj.year is in 99, but obj.day makes it roll over into year 100, + // the calculations done by Date.UTC are using year 2000 - which is incorrect + d.setUTCFullYear(obj.year, obj.month - 1, obj.day); + } + return +d; + } + + // adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js + function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) { + var fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek); + return -fwdlw + minDaysInFirstWeek - 1; + } + function weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek); + var weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek); + return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7; + } + function untruncateYear(year) { + if (year > 99) { + return year; + } else return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year; + } + + // PARSING + + function parseZoneInfo(ts, offsetFormat, locale, timeZone) { + if (timeZone === void 0) { + timeZone = null; + } + var date = new Date(ts), + intlOpts = { + hourCycle: "h23", + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit" + }; + if (timeZone) { + intlOpts.timeZone = timeZone; + } + var modified = _extends({ + timeZoneName: offsetFormat + }, intlOpts); + var parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(function (m) { + return m.type.toLowerCase() === "timezonename"; + }); + return parsed ? parsed.value : null; + } + + // signedOffset('-5', '30') -> -330 + function signedOffset(offHourStr, offMinuteStr) { + var offHour = parseInt(offHourStr, 10); + + // don't || this because we want to preserve -0 + if (Number.isNaN(offHour)) { + offHour = 0; + } + var offMin = parseInt(offMinuteStr, 10) || 0, + offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; + return offHour * 60 + offMinSigned; + } + + // COERCION + + function asNumber(value) { + var numericValue = Number(value); + if (typeof value === "boolean" || value === "" || !Number.isFinite(numericValue)) throw new InvalidArgumentError("Invalid unit value " + value); + return numericValue; + } + function normalizeObject(obj, normalizer) { + var normalized = {}; + for (var u in obj) { + if (hasOwnProperty(obj, u)) { + var v = obj[u]; + if (v === undefined || v === null) continue; + normalized[normalizer(u)] = asNumber(v); + } + } + return normalized; + } + + /** + * Returns the offset's value as a string + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + function formatOffset(offset, format) { + var hours = Math.trunc(Math.abs(offset / 60)), + minutes = Math.trunc(Math.abs(offset % 60)), + sign = offset >= 0 ? "+" : "-"; + switch (format) { + case "short": + return "" + sign + padStart(hours, 2) + ":" + padStart(minutes, 2); + case "narrow": + return "" + sign + hours + (minutes > 0 ? ":" + minutes : ""); + case "techie": + return "" + sign + padStart(hours, 2) + padStart(minutes, 2); + default: + throw new RangeError("Value format " + format + " is out of range for property format"); + } + } + function timeObject(obj) { + return pick(obj, ["hour", "minute", "second", "millisecond"]); + } + + /** + * @private + */ + + var monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + var monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; + function months(length) { + switch (length) { + case "narrow": + return [].concat(monthsNarrow); + case "short": + return [].concat(monthsShort); + case "long": + return [].concat(monthsLong); + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + default: + return null; + } + } + var weekdaysLong = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; + var weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; + var weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; + function weekdays(length) { + switch (length) { + case "narrow": + return [].concat(weekdaysNarrow); + case "short": + return [].concat(weekdaysShort); + case "long": + return [].concat(weekdaysLong); + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + default: + return null; + } + } + var meridiems = ["AM", "PM"]; + var erasLong = ["Before Christ", "Anno Domini"]; + var erasShort = ["BC", "AD"]; + var erasNarrow = ["B", "A"]; + function eras(length) { + switch (length) { + case "narrow": + return [].concat(erasNarrow); + case "short": + return [].concat(erasShort); + case "long": + return [].concat(erasLong); + default: + return null; + } + } + function meridiemForDateTime(dt) { + return meridiems[dt.hour < 12 ? 0 : 1]; + } + function weekdayForDateTime(dt, length) { + return weekdays(length)[dt.weekday - 1]; + } + function monthForDateTime(dt, length) { + return months(length)[dt.month - 1]; + } + function eraForDateTime(dt, length) { + return eras(length)[dt.year < 0 ? 0 : 1]; + } + function formatRelativeTime(unit, count, numeric, narrow) { + if (numeric === void 0) { + numeric = "always"; + } + if (narrow === void 0) { + narrow = false; + } + var units = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."] + }; + var lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; + if (numeric === "auto" && lastable) { + var isDay = unit === "days"; + switch (count) { + case 1: + return isDay ? "tomorrow" : "next " + units[unit][0]; + case -1: + return isDay ? "yesterday" : "last " + units[unit][0]; + case 0: + return isDay ? "today" : "this " + units[unit][0]; + } + } + + var isInPast = Object.is(count, -0) || count < 0, + fmtValue = Math.abs(count), + singular = fmtValue === 1, + lilUnits = units[unit], + fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit; + return isInPast ? fmtValue + " " + fmtUnit + " ago" : "in " + fmtValue + " " + fmtUnit; + } + + function stringifyTokens(splits, tokenToString) { + var s = ""; + for (var _iterator = _createForOfIteratorHelperLoose(splits), _step; !(_step = _iterator()).done;) { + var token = _step.value; + if (token.literal) { + s += token.val; + } else { + s += tokenToString(token.val); + } + } + return s; + } + var _macroTokenToFormatOpts = { + D: DATE_SHORT, + DD: DATE_MED, + DDD: DATE_FULL, + DDDD: DATE_HUGE, + t: TIME_SIMPLE, + tt: TIME_WITH_SECONDS, + ttt: TIME_WITH_SHORT_OFFSET, + tttt: TIME_WITH_LONG_OFFSET, + T: TIME_24_SIMPLE, + TT: TIME_24_WITH_SECONDS, + TTT: TIME_24_WITH_SHORT_OFFSET, + TTTT: TIME_24_WITH_LONG_OFFSET, + f: DATETIME_SHORT, + ff: DATETIME_MED, + fff: DATETIME_FULL, + ffff: DATETIME_HUGE, + F: DATETIME_SHORT_WITH_SECONDS, + FF: DATETIME_MED_WITH_SECONDS, + FFF: DATETIME_FULL_WITH_SECONDS, + FFFF: DATETIME_HUGE_WITH_SECONDS + }; + + /** + * @private + */ + var Formatter = /*#__PURE__*/function () { + Formatter.create = function create(locale, opts) { + if (opts === void 0) { + opts = {}; + } + return new Formatter(locale, opts); + }; + Formatter.parseFormat = function parseFormat(fmt) { + // white-space is always considered a literal in user-provided formats + // the " " token has a special meaning (see unitForToken) + + var current = null, + currentFull = "", + bracketed = false; + var splits = []; + for (var i = 0; i < fmt.length; i++) { + var c = fmt.charAt(i); + if (c === "'") { + // turn '' into a literal signal quote instead of just skipping the empty literal + if (currentFull.length > 0 || bracketed) { + splits.push({ + literal: bracketed || /^\s+$/.test(currentFull), + val: currentFull === "" ? "'" : currentFull + }); + } + current = null; + currentFull = ""; + bracketed = !bracketed; + } else if (bracketed) { + currentFull += c; + } else if (c === current) { + currentFull += c; + } else { + if (currentFull.length > 0) { + splits.push({ + literal: /^\s+$/.test(currentFull), + val: currentFull + }); + } + currentFull = c; + current = c; + } + } + if (currentFull.length > 0) { + splits.push({ + literal: bracketed || /^\s+$/.test(currentFull), + val: currentFull + }); + } + return splits; + }; + Formatter.macroTokenToFormatOpts = function macroTokenToFormatOpts(token) { + return _macroTokenToFormatOpts[token]; + }; + function Formatter(locale, formatOpts) { + this.opts = formatOpts; + this.loc = locale; + this.systemLoc = null; + } + var _proto = Formatter.prototype; + _proto.formatWithSystemDefault = function formatWithSystemDefault(dt, opts) { + if (this.systemLoc === null) { + this.systemLoc = this.loc.redefaultToSystem(); + } + var df = this.systemLoc.dtFormatter(dt, _extends({}, this.opts, opts)); + return df.format(); + }; + _proto.dtFormatter = function dtFormatter(dt, opts) { + if (opts === void 0) { + opts = {}; + } + return this.loc.dtFormatter(dt, _extends({}, this.opts, opts)); + }; + _proto.formatDateTime = function formatDateTime(dt, opts) { + return this.dtFormatter(dt, opts).format(); + }; + _proto.formatDateTimeParts = function formatDateTimeParts(dt, opts) { + return this.dtFormatter(dt, opts).formatToParts(); + }; + _proto.formatInterval = function formatInterval(interval, opts) { + var df = this.dtFormatter(interval.start, opts); + return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate()); + }; + _proto.resolvedOptions = function resolvedOptions(dt, opts) { + return this.dtFormatter(dt, opts).resolvedOptions(); + }; + _proto.num = function num(n, p, signDisplay) { + if (p === void 0) { + p = 0; + } + if (signDisplay === void 0) { + signDisplay = undefined; + } + // we get some perf out of doing this here, annoyingly + if (this.opts.forceSimple) { + return padStart(n, p); + } + var opts = _extends({}, this.opts); + if (p > 0) { + opts.padTo = p; + } + if (signDisplay) { + opts.signDisplay = signDisplay; + } + return this.loc.numberFormatter(opts).format(n); + }; + _proto.formatDateTimeFromString = function formatDateTimeFromString(dt, fmt) { + var _this = this; + var knownEnglish = this.loc.listingMode() === "en", + useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", + string = function string(opts, extract) { + return _this.loc.extract(dt, opts, extract); + }, + formatOffset = function formatOffset(opts) { + if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { + return "Z"; + } + return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; + }, + meridiem = function meridiem() { + return knownEnglish ? meridiemForDateTime(dt) : string({ + hour: "numeric", + hourCycle: "h12" + }, "dayperiod"); + }, + month = function month(length, standalone) { + return knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { + month: length + } : { + month: length, + day: "numeric" + }, "month"); + }, + weekday = function weekday(length, standalone) { + return knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { + weekday: length + } : { + weekday: length, + month: "long", + day: "numeric" + }, "weekday"); + }, + maybeMacro = function maybeMacro(token) { + var formatOpts = Formatter.macroTokenToFormatOpts(token); + if (formatOpts) { + return _this.formatWithSystemDefault(dt, formatOpts); + } else { + return token; + } + }, + era = function era(length) { + return knownEnglish ? eraForDateTime(dt, length) : string({ + era: length + }, "era"); + }, + tokenToString = function tokenToString(token) { + // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols + switch (token) { + // ms + case "S": + return _this.num(dt.millisecond); + case "u": + // falls through + case "SSS": + return _this.num(dt.millisecond, 3); + // seconds + case "s": + return _this.num(dt.second); + case "ss": + return _this.num(dt.second, 2); + // fractional seconds + case "uu": + return _this.num(Math.floor(dt.millisecond / 10), 2); + case "uuu": + return _this.num(Math.floor(dt.millisecond / 100)); + // minutes + case "m": + return _this.num(dt.minute); + case "mm": + return _this.num(dt.minute, 2); + // hours + case "h": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); + case "hh": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); + case "H": + return _this.num(dt.hour); + case "HH": + return _this.num(dt.hour, 2); + // offset + case "Z": + // like +6 + return formatOffset({ + format: "narrow", + allowZ: _this.opts.allowZ + }); + case "ZZ": + // like +06:00 + return formatOffset({ + format: "short", + allowZ: _this.opts.allowZ + }); + case "ZZZ": + // like +0600 + return formatOffset({ + format: "techie", + allowZ: _this.opts.allowZ + }); + case "ZZZZ": + // like EST + return dt.zone.offsetName(dt.ts, { + format: "short", + locale: _this.loc.locale + }); + case "ZZZZZ": + // like Eastern Standard Time + return dt.zone.offsetName(dt.ts, { + format: "long", + locale: _this.loc.locale + }); + // zone + case "z": + // like America/New_York + return dt.zoneName; + // meridiems + case "a": + return meridiem(); + // dates + case "d": + return useDateTimeFormatter ? string({ + day: "numeric" + }, "day") : _this.num(dt.day); + case "dd": + return useDateTimeFormatter ? string({ + day: "2-digit" + }, "day") : _this.num(dt.day, 2); + // weekdays - standalone + case "c": + // like 1 + return _this.num(dt.weekday); + case "ccc": + // like 'Tues' + return weekday("short", true); + case "cccc": + // like 'Tuesday' + return weekday("long", true); + case "ccccc": + // like 'T' + return weekday("narrow", true); + // weekdays - format + case "E": + // like 1 + return _this.num(dt.weekday); + case "EEE": + // like 'Tues' + return weekday("short", false); + case "EEEE": + // like 'Tuesday' + return weekday("long", false); + case "EEEEE": + // like 'T' + return weekday("narrow", false); + // months - standalone + case "L": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric", + day: "numeric" + }, "month") : _this.num(dt.month); + case "LL": + // like 01, doesn't seem to work + return useDateTimeFormatter ? string({ + month: "2-digit", + day: "numeric" + }, "month") : _this.num(dt.month, 2); + case "LLL": + // like Jan + return month("short", true); + case "LLLL": + // like January + return month("long", true); + case "LLLLL": + // like J + return month("narrow", true); + // months - format + case "M": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric" + }, "month") : _this.num(dt.month); + case "MM": + // like 01 + return useDateTimeFormatter ? string({ + month: "2-digit" + }, "month") : _this.num(dt.month, 2); + case "MMM": + // like Jan + return month("short", false); + case "MMMM": + // like January + return month("long", false); + case "MMMMM": + // like J + return month("narrow", false); + // years + case "y": + // like 2014 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year); + case "yy": + // like 14 + return useDateTimeFormatter ? string({ + year: "2-digit" + }, "year") : _this.num(dt.year.toString().slice(-2), 2); + case "yyyy": + // like 0012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 4); + case "yyyyyy": + // like 000012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 6); + // eras + case "G": + // like AD + return era("short"); + case "GG": + // like Anno Domini + return era("long"); + case "GGGGG": + return era("narrow"); + case "kk": + return _this.num(dt.weekYear.toString().slice(-2), 2); + case "kkkk": + return _this.num(dt.weekYear, 4); + case "W": + return _this.num(dt.weekNumber); + case "WW": + return _this.num(dt.weekNumber, 2); + case "n": + return _this.num(dt.localWeekNumber); + case "nn": + return _this.num(dt.localWeekNumber, 2); + case "ii": + return _this.num(dt.localWeekYear.toString().slice(-2), 2); + case "iiii": + return _this.num(dt.localWeekYear, 4); + case "o": + return _this.num(dt.ordinal); + case "ooo": + return _this.num(dt.ordinal, 3); + case "q": + // like 1 + return _this.num(dt.quarter); + case "qq": + // like 01 + return _this.num(dt.quarter, 2); + case "X": + return _this.num(Math.floor(dt.ts / 1000)); + case "x": + return _this.num(dt.ts); + default: + return maybeMacro(token); + } + }; + return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); + }; + _proto.formatDurationFromString = function formatDurationFromString(dur, fmt) { + var _this2 = this; + var invertLargest = this.opts.signMode === "negativeLargestOnly" ? -1 : 1; + var tokenToField = function tokenToField(token) { + switch (token[0]) { + case "S": + return "milliseconds"; + case "s": + return "seconds"; + case "m": + return "minutes"; + case "h": + return "hours"; + case "d": + return "days"; + case "w": + return "weeks"; + case "M": + return "months"; + case "y": + return "years"; + default: + return null; + } + }, + tokenToString = function tokenToString(lildur, info) { + return function (token) { + var mapped = tokenToField(token); + if (mapped) { + var inversionFactor = info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1; + var signDisplay; + if (_this2.opts.signMode === "negativeLargestOnly" && mapped !== info.largestUnit) { + signDisplay = "never"; + } else if (_this2.opts.signMode === "all") { + signDisplay = "always"; + } else { + // "auto" and "negative" are the same, but "auto" has better support + signDisplay = "auto"; + } + return _this2.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay); + } else { + return token; + } + }; + }, + tokens = Formatter.parseFormat(fmt), + realTokens = tokens.reduce(function (found, _ref) { + var literal = _ref.literal, + val = _ref.val; + return literal ? found : found.concat(val); + }, []), + collapsed = dur.shiftTo.apply(dur, realTokens.map(tokenToField).filter(function (t) { + return t; + })), + durationInfo = { + isNegativeDuration: collapsed < 0, + // this relies on "collapsed" being based on "shiftTo", which builds up the object + // in order + largestUnit: Object.keys(collapsed.values)[0] + }; + return stringifyTokens(tokens, tokenToString(collapsed, durationInfo)); + }; + return Formatter; + }(); + + /* + * This file handles parsing for well-specified formats. Here's how it works: + * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. + * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object + * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. + * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. + * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. + * Some extractions are super dumb and simpleParse and fromStrings help DRY them. + */ + + var ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/; + function combineRegexes() { + for (var _len = arguments.length, regexes = new Array(_len), _key = 0; _key < _len; _key++) { + regexes[_key] = arguments[_key]; + } + var full = regexes.reduce(function (f, r) { + return f + r.source; + }, ""); + return RegExp("^" + full + "$"); + } + function combineExtractors() { + for (var _len2 = arguments.length, extractors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + extractors[_key2] = arguments[_key2]; + } + return function (m) { + return extractors.reduce(function (_ref, ex) { + var mergedVals = _ref[0], + mergedZone = _ref[1], + cursor = _ref[2]; + var _ex = ex(m, cursor), + val = _ex[0], + zone = _ex[1], + next = _ex[2]; + return [_extends({}, mergedVals, val), zone || mergedZone, next]; + }, [{}, null, 1]).slice(0, 2); + }; + } + function parse(s) { + if (s == null) { + return [null, null]; + } + for (var _len3 = arguments.length, patterns = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + patterns[_key3 - 1] = arguments[_key3]; + } + for (var _i = 0, _patterns = patterns; _i < _patterns.length; _i++) { + var _patterns$_i = _patterns[_i], + regex = _patterns$_i[0], + extractor = _patterns$_i[1]; + var m = regex.exec(s); + if (m) { + return extractor(m); + } + } + return [null, null]; + } + function simpleParse() { + for (var _len4 = arguments.length, keys = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + keys[_key4] = arguments[_key4]; + } + return function (match, cursor) { + var ret = {}; + var i; + for (i = 0; i < keys.length; i++) { + ret[keys[i]] = parseInteger(match[cursor + i]); + } + return [ret, null, cursor + i]; + }; + } + + // ISO and SQL parsing + var offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/; + var isoExtendedZone = "(?:" + offsetRegex.source + "?(?:\\[(" + ianaRegex.source + ")\\])?)?"; + var isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/; + var isoTimeRegex = RegExp("" + isoTimeBaseRegex.source + isoExtendedZone); + var isoTimeExtensionRegex = RegExp("(?:[Tt]" + isoTimeRegex.source + ")?"); + var isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/; + var isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/; + var isoOrdinalRegex = /(\d{4})-?(\d{3})/; + var extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"); + var extractISOOrdinalData = simpleParse("year", "ordinal"); + var sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/; // dumbed-down version of the ISO one + var sqlTimeRegex = RegExp(isoTimeBaseRegex.source + " ?(?:" + offsetRegex.source + "|(" + ianaRegex.source + "))?"); + var sqlTimeExtensionRegex = RegExp("(?: " + sqlTimeRegex.source + ")?"); + function int(match, pos, fallback) { + var m = match[pos]; + return isUndefined(m) ? fallback : parseInteger(m); + } + function extractISOYmd(match, cursor) { + var item = { + year: int(match, cursor), + month: int(match, cursor + 1, 1), + day: int(match, cursor + 2, 1) + }; + return [item, null, cursor + 3]; + } + function extractISOTime(match, cursor) { + var item = { + hours: int(match, cursor, 0), + minutes: int(match, cursor + 1, 0), + seconds: int(match, cursor + 2, 0), + milliseconds: parseMillis(match[cursor + 3]) + }; + return [item, null, cursor + 4]; + } + function extractISOOffset(match, cursor) { + var local = !match[cursor] && !match[cursor + 1], + fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), + zone = local ? null : FixedOffsetZone.instance(fullOffset); + return [{}, zone, cursor + 3]; + } + function extractIANAZone(match, cursor) { + var zone = match[cursor] ? IANAZone.create(match[cursor]) : null; + return [{}, zone, cursor + 1]; + } + + // ISO time parsing + + var isoTimeOnly = RegExp("^T?" + isoTimeBaseRegex.source + "$"); + + // ISO duration parsing + + var isoDuration = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/; + function extractISODuration(match) { + var s = match[0], + yearStr = match[1], + monthStr = match[2], + weekStr = match[3], + dayStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + millisecondsStr = match[8]; + var hasNegativePrefix = s[0] === "-"; + var negativeSeconds = secondStr && secondStr[0] === "-"; + var maybeNegate = function maybeNegate(num, force) { + if (force === void 0) { + force = false; + } + return num !== undefined && (force || num && hasNegativePrefix) ? -num : num; + }; + return [{ + years: maybeNegate(parseFloating(yearStr)), + months: maybeNegate(parseFloating(monthStr)), + weeks: maybeNegate(parseFloating(weekStr)), + days: maybeNegate(parseFloating(dayStr)), + hours: maybeNegate(parseFloating(hourStr)), + minutes: maybeNegate(parseFloating(minuteStr)), + seconds: maybeNegate(parseFloating(secondStr), secondStr === "-0"), + milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds) + }]; + } + + // These are a little braindead. EDT *should* tell us that we're in, say, America/New_York + // and not just that we're in -240 *right now*. But since I don't think these are used that often + // I'm just going to ignore that + var obsOffsets = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 + }; + function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + var result = { + year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), + month: monthsShort.indexOf(monthStr) + 1, + day: parseInteger(dayStr), + hour: parseInteger(hourStr), + minute: parseInteger(minuteStr) + }; + if (secondStr) result.second = parseInteger(secondStr); + if (weekdayStr) { + result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1; + } + return result; + } + + // RFC 2822/5322 + var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; + function extractRFC2822(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + obsOffset = match[8], + milOffset = match[9], + offHourStr = match[10], + offMinuteStr = match[11], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + var offset; + if (obsOffset) { + offset = obsOffsets[obsOffset]; + } else if (milOffset) { + offset = 0; + } else { + offset = signedOffset(offHourStr, offMinuteStr); + } + return [result, new FixedOffsetZone(offset)]; + } + function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); + } + + // http date + + var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, + rfc850 = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, + ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; + function extractRFC1123Or850(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; + } + function extractASCII(match) { + var weekdayStr = match[1], + monthStr = match[2], + dayStr = match[3], + hourStr = match[4], + minuteStr = match[5], + secondStr = match[6], + yearStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; + } + var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); + var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); + var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); + var isoTimeCombinedRegex = combineRegexes(isoTimeRegex); + var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone); + var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset, extractIANAZone); + var extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset, extractIANAZone); + var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); + + /* + * @private + */ + + function parseISODate(s) { + return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]); + } + function parseRFC2822Date(s) { + return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]); + } + function parseHTTPDate(s) { + return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]); + } + function parseISODuration(s) { + return parse(s, [isoDuration, extractISODuration]); + } + var extractISOTimeOnly = combineExtractors(extractISOTime); + function parseISOTimeOnly(s) { + return parse(s, [isoTimeOnly, extractISOTimeOnly]); + } + var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); + var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); + var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); + function parseSQL(s) { + return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]); + } + + var INVALID$2 = "Invalid Duration"; + + // unit conversion constants + var lowOrderMatrix = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1000 + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1000 + }, + hours: { + minutes: 60, + seconds: 60 * 60, + milliseconds: 60 * 60 * 1000 + }, + minutes: { + seconds: 60, + milliseconds: 60 * 1000 + }, + seconds: { + milliseconds: 1000 + } + }, + casualMatrix = _extends({ + years: { + quarters: 4, + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + seconds: 91 * 24 * 60 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1000 + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix), + daysInYearAccurate = 146097.0 / 400, + daysInMonthAccurate = 146097.0 / 4800, + accurateMatrix = _extends({ + years: { + quarters: 4, + months: 12, + weeks: daysInYearAccurate / 7, + days: daysInYearAccurate, + hours: daysInYearAccurate * 24, + minutes: daysInYearAccurate * 24 * 60, + seconds: daysInYearAccurate * 24 * 60 * 60, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: daysInYearAccurate / 28, + days: daysInYearAccurate / 4, + hours: daysInYearAccurate * 24 / 4, + minutes: daysInYearAccurate * 24 * 60 / 4, + seconds: daysInYearAccurate * 24 * 60 * 60 / 4, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 / 4 + }, + months: { + weeks: daysInMonthAccurate / 7, + days: daysInMonthAccurate, + hours: daysInMonthAccurate * 24, + minutes: daysInMonthAccurate * 24 * 60, + seconds: daysInMonthAccurate * 24 * 60 * 60, + milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix); + + // units ordered by size + var orderedUnits$1 = ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"]; + var reverseUnits = orderedUnits$1.slice(0).reverse(); + + // clone really means "create another instance just like this one, but with these changes" + function clone$1(dur, alts, clear) { + if (clear === void 0) { + clear = false; + } + // deep merge for vals + var conf = { + values: clear ? alts.values : _extends({}, dur.values, alts.values || {}), + loc: dur.loc.clone(alts.loc), + conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy, + matrix: alts.matrix || dur.matrix + }; + return new Duration(conf); + } + function durationToMillis(matrix, vals) { + var _vals$milliseconds; + var sum = (_vals$milliseconds = vals.milliseconds) != null ? _vals$milliseconds : 0; + for (var _iterator = _createForOfIteratorHelperLoose(reverseUnits.slice(1)), _step; !(_step = _iterator()).done;) { + var unit = _step.value; + if (vals[unit]) { + sum += vals[unit] * matrix[unit]["milliseconds"]; + } + } + return sum; + } + + // NB: mutates parameters + function normalizeValues(matrix, vals) { + // the logic below assumes the overall value of the duration is positive + // if this is not the case, factor is used to make it so + var factor = durationToMillis(matrix, vals) < 0 ? -1 : 1; + orderedUnits$1.reduceRight(function (previous, current) { + if (!isUndefined(vals[current])) { + if (previous) { + var previousVal = vals[previous] * factor; + var conv = matrix[current][previous]; + + // if (previousVal < 0): + // lower order unit is negative (e.g. { years: 2, days: -2 }) + // normalize this by reducing the higher order unit by the appropriate amount + // and increasing the lower order unit + // this can never make the higher order unit negative, because this function only operates + // on positive durations, so the amount of time represented by the lower order unit cannot + // be larger than the higher order unit + // else: + // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 }) + // in this case we attempt to convert as much as possible from the lower order unit into + // the higher order one + // + // Math.floor takes care of both of these cases, rounding away from 0 + // if previousVal < 0 it makes the absolute value larger + // if previousVal >= it makes the absolute value smaller + var rollUp = Math.floor(previousVal / conv); + vals[current] += rollUp * factor; + vals[previous] -= rollUp * conv * factor; + } + return current; + } else { + return previous; + } + }, null); + + // try to convert any decimals into smaller units if possible + // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 } + orderedUnits$1.reduce(function (previous, current) { + if (!isUndefined(vals[current])) { + if (previous) { + var fraction = vals[previous] % 1; + vals[previous] -= fraction; + vals[current] += fraction * matrix[previous][current]; + } + return current; + } else { + return previous; + } + }, null); + } + + // Remove all properties with a value of 0 from an object + function removeZeroes(vals) { + var newVals = {}; + for (var _i = 0, _Object$entries = Object.entries(vals); _i < _Object$entries.length; _i++) { + var _Object$entries$_i = _Object$entries[_i], + key = _Object$entries$_i[0], + value = _Object$entries$_i[1]; + if (value !== 0) { + newVals[key] = value; + } + } + return newVals; + } + + /** + * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime#plus} to add a Duration object to a DateTime, producing another DateTime. + * + * Here is a brief overview of commonly used methods and getters in Duration: + * + * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. + * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors. + * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors. + * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}. + * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON} + * + * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. + */ + var Duration = /*#__PURE__*/function (_Symbol$for) { + /** + * @private + */ + function Duration(config) { + var accurate = config.conversionAccuracy === "longterm" || false; + var matrix = accurate ? accurateMatrix : casualMatrix; + if (config.matrix) { + matrix = config.matrix; + } + + /** + * @access private + */ + this.values = config.values; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.conversionAccuracy = accurate ? "longterm" : "casual"; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.matrix = matrix; + /** + * @access private + */ + this.isLuxonDuration = true; + } + + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + Duration.fromMillis = function fromMillis(count, opts) { + return Duration.fromObject({ + milliseconds: count + }, opts); + } + + /** + * Create a Duration from a JavaScript object with keys like 'years' and 'hours'. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {Object} [opts=[]] - options for creating this Duration + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the custom conversion system to use + * @return {Duration} + */; + Duration.fromObject = function fromObject(obj, opts) { + if (opts === void 0) { + opts = {}; + } + if (obj == null || typeof obj !== "object") { + throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got " + (obj === null ? "null" : typeof obj)); + } + return new Duration({ + values: normalizeObject(obj, Duration.normalizeUnit), + loc: Locale.fromObject(opts), + conversionAccuracy: opts.conversionAccuracy, + matrix: opts.matrix + }); + } + + /** + * Create a Duration from DurationLike. + * + * @param {Object | number | Duration} durationLike + * One of: + * - object with keys like 'years' and 'hours'. + * - number representing milliseconds + * - Duration instance + * @return {Duration} + */; + Duration.fromDurationLike = function fromDurationLike(durationLike) { + if (isNumber(durationLike)) { + return Duration.fromMillis(durationLike); + } else if (Duration.isDuration(durationLike)) { + return durationLike; + } else if (typeof durationLike === "object") { + return Duration.fromObject(durationLike); + } else { + throw new InvalidArgumentError("Unknown duration argument " + durationLike + " of type " + typeof durationLike); + } + } + + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the preset conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */; + Duration.fromISO = function fromISO(text, opts) { + var _parseISODuration = parseISODuration(text), + parsed = _parseISODuration[0]; + if (parsed) { + return Duration.fromObject(parsed, opts); + } else { + return Duration.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + } + + /** + * Create a Duration from an ISO 8601 time string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 } + * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @return {Duration} + */; + Duration.fromISOTime = function fromISOTime(text, opts) { + var _parseISOTimeOnly = parseISOTimeOnly(text), + parsed = _parseISOTimeOnly[0]; + if (parsed) { + return Duration.fromObject(parsed, opts); + } else { + return Duration.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + } + + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */; + Duration.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); + } + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidDurationError(invalid); + } else { + return new Duration({ + invalid: invalid + }); + } + } + + /** + * @private + */; + Duration.normalizeUnit = function normalizeUnit(unit) { + var normalized = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds" + }[unit ? unit.toLowerCase() : unit]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } + + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */; + Duration.isDuration = function isDuration(o) { + return o && o.isLuxonDuration || false; + } + + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */; + var _proto = Duration.prototype; + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `w` for weeks + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * Tokens can be escaped by wrapping with single quotes. + * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat("d s", { signMode: "all" }) //=> "+6 +2" + * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "all" }) //=> "-6 -2" + * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "negativeLargestOnly" }) //=> "-6 2" + * @return {string} + */ + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + // reverse-compat since 1.2; we always round down now, never up, and we do it by default + var fmtOpts = _extends({}, opts, { + floor: opts.round !== false && opts.floor !== false + }); + return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2; + } + + /** + * Returns a string representation of a Duration with all units included. + * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options + * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`. + * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor. + * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero + * @example + * ```js + * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 }) + * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes' + * dur.toHuman({ listStyle: "long" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes' + * dur.toHuman({ unitDisplay: "short" }) //=> '1 mth, 0 wks, 5 hr, 6 min' + * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes' + * ``` + */; + _proto.toHuman = function toHuman(opts) { + var _this = this; + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) return INVALID$2; + var showZeros = opts.showZeros !== false; + var l = orderedUnits$1.map(function (unit) { + var val = _this.values[unit]; + if (isUndefined(val) || val === 0 && !showZeros) { + return null; + } + return _this.loc.numberFormatter(_extends({ + style: "unit", + unitDisplay: "long" + }, opts, { + unit: unit.slice(0, -1) + })).format(val); + }).filter(function (n) { + return n; + }); + return this.loc.listFormatter(_extends({ + type: "conjunction", + style: opts.listStyle || "narrow" + }, opts)).format(l); + } + + /** + * Returns a JavaScript object with this Duration's values. + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */; + _proto.toObject = function toObject() { + if (!this.isValid) return {}; + return _extends({}, this.values); + } + + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */; + _proto.toISO = function toISO() { + // we could use the formatter, but this is an easier way to get the minimum string + if (!this.isValid) return null; + var s = "P"; + if (this.years !== 0) s += this.years + "Y"; + if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + "M"; + if (this.weeks !== 0) s += this.weeks + "W"; + if (this.days !== 0) s += this.days + "D"; + if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) s += "T"; + if (this.hours !== 0) s += this.hours + "H"; + if (this.minutes !== 0) s += this.minutes + "M"; + if (this.seconds !== 0 || this.milliseconds !== 0) + // this will handle "floating point madness" by removing extra decimal places + // https://stackoverflow.com/questions/588004/is-floating-point-math-broken + s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S"; + if (s === "P") s += "T0S"; + return s; + } + + /** + * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day. + * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours. + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000' + * @return {string} + */; + _proto.toISOTime = function toISOTime(opts) { + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) return null; + var millis = this.toMillis(); + if (millis < 0 || millis >= 86400000) return null; + opts = _extends({ + suppressMilliseconds: false, + suppressSeconds: false, + includePrefix: false, + format: "extended" + }, opts, { + includeOffset: false + }); + var dateTime = DateTime.fromMillis(millis, { + zone: "UTC" + }); + return dateTime.toISOTime(opts); + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */; + _proto.toJSON = function toJSON() { + return this.toISO(); + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */; + _proto.toString = function toString() { + return this.toISO(); + } + + /** + * Returns a string representation of this Duration appropriate for the REPL. + * @return {string} + */; + _proto[_Symbol$for] = function () { + if (this.isValid) { + return "Duration { values: " + JSON.stringify(this.values) + " }"; + } else { + return "Duration { Invalid, reason: " + this.invalidReason + " }"; + } + } + + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */; + _proto.toMillis = function toMillis() { + if (!this.isValid) return NaN; + return durationToMillis(this.matrix, this.values); + } + + /** + * Returns an milliseconds value of this Duration. Alias of {@link toMillis} + * @return {number} + */; + _proto.valueOf = function valueOf() { + return this.toMillis(); + } + + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */; + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration), + result = {}; + for (var _i2 = 0, _orderedUnits = orderedUnits$1; _i2 < _orderedUnits.length; _i2++) { + var k = _orderedUnits[_i2]; + if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { + result[k] = dur.get(k) + this.get(k); + } + } + return clone$1(this, { + values: result + }, true); + } + + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */; + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration); + return this.plus(dur.negate()); + } + + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */; + _proto.mapUnits = function mapUnits(fn) { + if (!this.isValid) return this; + var result = {}; + for (var _i3 = 0, _Object$keys = Object.keys(this.values); _i3 < _Object$keys.length; _i3++) { + var k = _Object$keys[_i3]; + result[k] = asNumber(fn(this.values[k], k)); + } + return clone$1(this, { + values: result + }, true); + } + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3 + * @return {number} + */; + _proto.get = function get(unit) { + return this[Duration.normalizeUnit(unit)]; + } + + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */; + _proto.set = function set(values) { + if (!this.isValid) return this; + var mixed = _extends({}, this.values, normalizeObject(values, Duration.normalizeUnit)); + return clone$1(this, { + values: mixed + }); + } + + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */; + _proto.reconfigure = function reconfigure(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + locale = _ref.locale, + numberingSystem = _ref.numberingSystem, + conversionAccuracy = _ref.conversionAccuracy, + matrix = _ref.matrix; + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem + }); + var opts = { + loc: loc, + matrix: matrix, + conversionAccuracy: conversionAccuracy + }; + return clone$1(this, opts); + } + + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */; + _proto.as = function as(unit) { + return this.isValid ? this.shiftTo(unit).get(unit) : NaN; + } + + /** + * Reduce this Duration to its canonical representation in its current units. + * Assuming the overall value of the Duration is positive, this means: + * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example) + * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise + * the overall value would be negative, see third example) + * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example) + * + * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 } + * @return {Duration} + */; + _proto.normalize = function normalize() { + if (!this.isValid) return this; + var vals = this.toObject(); + normalizeValues(this.matrix, vals); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Rescale units to its largest representation + * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 } + * @return {Duration} + */; + _proto.rescale = function rescale() { + if (!this.isValid) return this; + var vals = removeZeroes(this.normalize().shiftToAll().toObject()); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */; + _proto.shiftTo = function shiftTo() { + for (var _len = arguments.length, units = new Array(_len), _key = 0; _key < _len; _key++) { + units[_key] = arguments[_key]; + } + if (!this.isValid) return this; + if (units.length === 0) { + return this; + } + units = units.map(function (u) { + return Duration.normalizeUnit(u); + }); + var built = {}, + accumulated = {}, + vals = this.toObject(); + var lastUnit; + for (var _i4 = 0, _orderedUnits2 = orderedUnits$1; _i4 < _orderedUnits2.length; _i4++) { + var k = _orderedUnits2[_i4]; + if (units.indexOf(k) >= 0) { + lastUnit = k; + var own = 0; + + // anything we haven't boiled down yet should get boiled to this unit + for (var ak in accumulated) { + own += this.matrix[ak][k] * accumulated[ak]; + accumulated[ak] = 0; + } + + // plus anything that's already in this unit + if (isNumber(vals[k])) { + own += vals[k]; + } + + // only keep the integer part for now in the hopes of putting any decimal part + // into a smaller unit later + var i = Math.trunc(own); + built[k] = i; + accumulated[k] = (own * 1000 - i * 1000) / 1000; + + // otherwise, keep it in the wings to boil it later + } else if (isNumber(vals[k])) { + accumulated[k] = vals[k]; + } + } + + // anything leftover becomes the decimal for the last unit + // lastUnit must be defined since units is not empty + for (var key in accumulated) { + if (accumulated[key] !== 0) { + built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; + } + } + normalizeValues(this.matrix, built); + return clone$1(this, { + values: built + }, true); + } + + /** + * Shift this Duration to all available units. + * Same as shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds") + * @return {Duration} + */; + _proto.shiftToAll = function shiftToAll() { + if (!this.isValid) return this; + return this.shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"); + } + + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */; + _proto.negate = function negate() { + if (!this.isValid) return this; + var negated = {}; + for (var _i5 = 0, _Object$keys2 = Object.keys(this.values); _i5 < _Object$keys2.length; _i5++) { + var k = _Object$keys2[_i5]; + negated[k] = this.values[k] === 0 ? 0 : -this.values[k]; + } + return clone$1(this, { + values: negated + }, true); + } + + /** + * Removes all units with values equal to 0 from this Duration. + * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 } + * @return {Duration} + */; + _proto.removeZeros = function removeZeros() { + if (!this.isValid) return this; + var vals = removeZeroes(this.values); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Get the years. + * @type {number} + */; + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + if (!this.loc.equals(other.loc)) { + return false; + } + function eq(v1, v2) { + // Consider 0 and undefined as equal + if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0; + return v1 === v2; + } + for (var _i6 = 0, _orderedUnits3 = orderedUnits$1; _i6 < _orderedUnits3.length; _i6++) { + var u = _orderedUnits3[_i6]; + if (!eq(this.values[u], other.values[u])) { + return false; + } + } + return true; + }; + _createClass(Duration, [{ + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + }, { + key: "years", + get: function get() { + return this.isValid ? this.values.years || 0 : NaN; + } + + /** + * Get the quarters. + * @type {number} + */ + }, { + key: "quarters", + get: function get() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + + /** + * Get the months. + * @type {number} + */ + }, { + key: "months", + get: function get() { + return this.isValid ? this.values.months || 0 : NaN; + } + + /** + * Get the weeks + * @type {number} + */ + }, { + key: "weeks", + get: function get() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + + /** + * Get the days. + * @type {number} + */ + }, { + key: "days", + get: function get() { + return this.isValid ? this.values.days || 0 : NaN; + } + + /** + * Get the hours. + * @type {number} + */ + }, { + key: "hours", + get: function get() { + return this.isValid ? this.values.hours || 0 : NaN; + } + + /** + * Get the minutes. + * @type {number} + */ + }, { + key: "minutes", + get: function get() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + + /** + * Get the seconds. + * @return {number} + */ + }, { + key: "seconds", + get: function get() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + + /** + * Get the milliseconds. + * @return {number} + */ + }, { + key: "milliseconds", + get: function get() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + }, { + key: "isValid", + get: function get() { + return this.invalid === null; + } + + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + return Duration; + }(Symbol.for("nodejs.util.inspect.custom")); + + var INVALID$1 = "Invalid Interval"; + + // checks if the start is equal to or before the end + function validateStartEnd(start, end) { + if (!start || !start.isValid) { + return Interval.invalid("missing or invalid start"); + } else if (!end || !end.isValid) { + return Interval.invalid("missing or invalid end"); + } else if (end < start) { + return Interval.invalid("end before start", "The end of an interval must be after its start, but you had start=" + start.toISO() + " and end=" + end.toISO()); + } else { + return null; + } + } + + /** + * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them. + * + * Here is a brief overview of the most commonly used methods and getters in Interval: + * + * * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}. + * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end. + * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}. + * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}. + * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs} + * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}. + */ + var Interval = /*#__PURE__*/function (_Symbol$for) { + /** + * @private + */ + function Interval(config) { + /** + * @access private + */ + this.s = config.start; + /** + * @access private + */ + this.e = config.end; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.isLuxonInterval = true; + } + + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + Interval.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); + } + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidIntervalError(invalid); + } else { + return new Interval({ + invalid: invalid + }); + } + } + + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */; + Interval.fromDateTimes = function fromDateTimes(start, end) { + var builtStart = friendlyDateTime(start), + builtEnd = friendlyDateTime(end); + var validateError = validateStartEnd(builtStart, builtEnd); + if (validateError == null) { + return new Interval({ + start: builtStart, + end: builtEnd + }); + } else { + return validateError; + } + } + + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */; + Interval.after = function after(start, duration) { + var dur = Duration.fromDurationLike(duration), + dt = friendlyDateTime(start); + return Interval.fromDateTimes(dt, dt.plus(dur)); + } + + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */; + Interval.before = function before(end, duration) { + var dur = Duration.fromDurationLike(duration), + dt = friendlyDateTime(end); + return Interval.fromDateTimes(dt.minus(dur), dt); + } + + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */; + Interval.fromISO = function fromISO(text, opts) { + var _split = (text || "").split("/", 2), + s = _split[0], + e = _split[1]; + if (s && e) { + var start, startIsValid; + try { + start = DateTime.fromISO(s, opts); + startIsValid = start.isValid; + } catch (e) { + startIsValid = false; + } + var end, endIsValid; + try { + end = DateTime.fromISO(e, opts); + endIsValid = end.isValid; + } catch (e) { + endIsValid = false; + } + if (startIsValid && endIsValid) { + return Interval.fromDateTimes(start, end); + } + if (startIsValid) { + var dur = Duration.fromISO(e, opts); + if (dur.isValid) { + return Interval.after(start, dur); + } + } else if (endIsValid) { + var _dur = Duration.fromISO(s, opts); + if (_dur.isValid) { + return Interval.before(end, _dur); + } + } + } + return Interval.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */; + Interval.isInterval = function isInterval(o) { + return o && o.isLuxonInterval || false; + } + + /** + * Returns the start of the Interval + * @type {DateTime} + */; + var _proto = Interval.prototype; + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + _proto.length = function length(unit) { + if (unit === void 0) { + unit = "milliseconds"; + } + return this.isValid ? this.toDuration.apply(this, [unit]).get(unit) : NaN; + } + + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime + * @return {number} + */; + _proto.count = function count(unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + if (!this.isValid) return NaN; + var start = this.start.startOf(unit, opts); + var end; + if (opts != null && opts.useLocaleWeeks) { + end = this.end.reconfigure({ + locale: start.locale + }); + } else { + end = this.end; + } + end = end.startOf(unit, opts); + return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf()); + } + + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */; + _proto.hasSame = function hasSame(unit) { + return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false; + } + + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */; + _proto.isEmpty = function isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */; + _proto.isAfter = function isAfter(dateTime) { + if (!this.isValid) return false; + return this.s > dateTime; + } + + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */; + _proto.isBefore = function isBefore(dateTime) { + if (!this.isValid) return false; + return this.e <= dateTime; + } + + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */; + _proto.contains = function contains(dateTime) { + if (!this.isValid) return false; + return this.s <= dateTime && this.e > dateTime; + } + + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */; + _proto.set = function set(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + start = _ref.start, + end = _ref.end; + if (!this.isValid) return this; + return Interval.fromDateTimes(start || this.s, end || this.e); + } + + /** + * Split this Interval at each of the specified DateTimes + * @param {...DateTime} dateTimes - the unit of time to count. + * @return {Array} + */; + _proto.splitAt = function splitAt() { + var _this = this; + if (!this.isValid) return []; + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + var sorted = dateTimes.map(friendlyDateTime).filter(function (d) { + return _this.contains(d); + }).sort(function (a, b) { + return a.toMillis() - b.toMillis(); + }), + results = []; + var s = this.s, + i = 0; + while (s < this.e) { + var added = sorted[i] || this.e, + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + i += 1; + } + return results; + } + + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {Array} + */; + _proto.splitBy = function splitBy(duration) { + var dur = Duration.fromDurationLike(duration); + if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { + return []; + } + var s = this.s, + idx = 1, + next; + var results = []; + while (s < this.e) { + var added = this.start.plus(dur.mapUnits(function (x) { + return x * idx; + })); + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + idx += 1; + } + return results; + } + + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {Array} + */; + _proto.divideEqually = function divideEqually(numberOfParts) { + if (!this.isValid) return []; + return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); + } + + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */; + _proto.overlaps = function overlaps(other) { + return this.e > other.s && this.s < other.e; + } + + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */; + _proto.abutsStart = function abutsStart(other) { + if (!this.isValid) return false; + return +this.e === +other.s; + } + + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */; + _proto.abutsEnd = function abutsEnd(other) { + if (!this.isValid) return false; + return +other.e === +this.s; + } + + /** + * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise. + * @param {Interval} other + * @return {boolean} + */; + _proto.engulfs = function engulfs(other) { + if (!this.isValid) return false; + return this.s <= other.s && this.e >= other.e; + } + + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */; + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + return this.s.equals(other.s) && this.e.equals(other.e); + } + + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */; + _proto.intersection = function intersection(other) { + if (!this.isValid) return this; + var s = this.s > other.s ? this.s : other.s, + e = this.e < other.e ? this.e : other.e; + if (s >= e) { + return null; + } else { + return Interval.fromDateTimes(s, e); + } + } + + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */; + _proto.union = function union(other) { + if (!this.isValid) return this; + var s = this.s < other.s ? this.s : other.s, + e = this.e > other.e ? this.e : other.e; + return Interval.fromDateTimes(s, e); + } + + /** + * Merge an array of Intervals into an equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * The resulting array will contain the Intervals in ascending order, that is, starting with the earliest Interval + * and ending with the latest. + * + * @param {Array} intervals + * @return {Array} + */; + Interval.merge = function merge(intervals) { + var _intervals$sort$reduc = intervals.sort(function (a, b) { + return a.s - b.s; + }).reduce(function (_ref2, item) { + var sofar = _ref2[0], + current = _ref2[1]; + if (!current) { + return [sofar, item]; + } else if (current.overlaps(item) || current.abutsStart(item)) { + return [sofar, current.union(item)]; + } else { + return [sofar.concat([current]), item]; + } + }, [[], null]), + found = _intervals$sort$reduc[0], + final = _intervals$sort$reduc[1]; + if (final) { + found.push(final); + } + return found; + } + + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {Array} intervals + * @return {Array} + */; + Interval.xor = function xor(intervals) { + var _Array$prototype; + var start = null, + currentCount = 0; + var results = [], + ends = intervals.map(function (i) { + return [{ + time: i.s, + type: "s" + }, { + time: i.e, + type: "e" + }]; + }), + flattened = (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, ends), + arr = flattened.sort(function (a, b) { + return a.time - b.time; + }); + for (var _iterator = _createForOfIteratorHelperLoose(arr), _step; !(_step = _iterator()).done;) { + var i = _step.value; + currentCount += i.type === "s" ? 1 : -1; + if (currentCount === 1) { + start = i.time; + } else { + if (start && +start !== +i.time) { + results.push(Interval.fromDateTimes(start, i.time)); + } + start = null; + } + } + return Interval.merge(results); + } + + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {Array} + */; + _proto.difference = function difference() { + var _this2 = this; + for (var _len2 = arguments.length, intervals = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + intervals[_key2] = arguments[_key2]; + } + return Interval.xor([this].concat(intervals)).map(function (i) { + return _this2.intersection(i); + }).filter(function (i) { + return i && !i.isEmpty(); + }); + } + + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */; + _proto.toString = function toString() { + if (!this.isValid) return INVALID$1; + return "[" + this.s.toISO() + " \u2013 " + this.e.toISO() + ")"; + } + + /** + * Returns a string representation of this Interval appropriate for the REPL. + * @return {string} + */; + _proto[_Symbol$for] = function () { + if (this.isValid) { + return "Interval { start: " + this.s.toISO() + ", end: " + this.e.toISO() + " }"; + } else { + return "Interval { Invalid, reason: " + this.invalidReason + " }"; + } + } + + /** + * Returns a localized string representing this Interval. Accepts the same options as the + * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as + * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method + * is browser-specific, but in general it will return an appropriate representation of the + * Interval in the assigned locale. Defaults to the system's locale if no locale has been + * specified. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or + * Intl.DateTimeFormat constructor options. + * @param {Object} opts - Options to override the configuration of the start DateTime. + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022 + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p + * @return {string} + */; + _proto.toLocaleString = function toLocaleString(formatOpts, opts) { + if (formatOpts === void 0) { + formatOpts = DATE_SHORT; + } + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) : INVALID$1; + } + + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */; + _proto.toISO = function toISO(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISO(opts) + "/" + this.e.toISO(opts); + } + + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */; + _proto.toISODate = function toISODate() { + if (!this.isValid) return INVALID$1; + return this.s.toISODate() + "/" + this.e.toISODate(); + } + + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */; + _proto.toISOTime = function toISOTime(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISOTime(opts) + "/" + this.e.toISOTime(opts); + } + + /** + * Returns a string representation of this Interval formatted according to the specified format + * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible + * formatting tool. + * @param {string} dateFormat - The format string. This string formats the start and end time. + * See {@link DateTime#toFormat} for details. + * @param {Object} opts - Options. + * @param {string} [opts.separator = ' – '] - A separator to place between the start and end + * representations. + * @return {string} + */; + _proto.toFormat = function toFormat(dateFormat, _temp2) { + var _ref3 = _temp2 === void 0 ? {} : _temp2, + _ref3$separator = _ref3.separator, + separator = _ref3$separator === void 0 ? " – " : _ref3$separator; + if (!this.isValid) return INVALID$1; + return "" + this.s.toFormat(dateFormat) + separator + this.e.toFormat(dateFormat); + } + + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */; + _proto.toDuration = function toDuration(unit, opts) { + if (!this.isValid) { + return Duration.invalid(this.invalidReason); + } + return this.e.diff(this.s, unit, opts); + } + + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */; + _proto.mapEndpoints = function mapEndpoints(mapFn) { + return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); + }; + _createClass(Interval, [{ + key: "start", + get: function get() { + return this.isValid ? this.s : null; + } + + /** + * Returns the end of the Interval. This is the first instant which is not part of the interval + * (Interval is half-open). + * @type {DateTime} + */ + }, { + key: "end", + get: function get() { + return this.isValid ? this.e : null; + } + + /** + * Returns the last DateTime included in the interval (since end is not part of the interval) + * @type {DateTime} + */ + }, { + key: "lastDateTime", + get: function get() { + return this.isValid ? this.e ? this.e.minus(1) : null : null; + } + + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + }, { + key: "isValid", + get: function get() { + return this.invalidReason === null; + } + + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + return Interval; + }(Symbol.for("nodejs.util.inspect.custom")); + + /** + * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment. + */ + var Info = /*#__PURE__*/function () { + function Info() {} + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + Info.hasDST = function hasDST(zone) { + if (zone === void 0) { + zone = Settings.defaultZone; + } + var proto = DateTime.now().setZone(zone).set({ + month: 12 + }); + return !zone.isUniversal && proto.offset !== proto.set({ + month: 6 + }).offset; + } + + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */; + Info.isValidIANAZone = function isValidIANAZone(zone) { + return IANAZone.isValidZone(zone); + } + + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone#isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */; + Info.normalizeZone = function normalizeZone$1(input) { + return normalizeZone(input, Settings.defaultZone); + } + + /** + * Get the weekday on which the week starts according to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} the start of the week, 1 for Monday through 7 for Sunday + */; + Info.getStartOfWeek = function getStartOfWeek(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + _ref$locale = _ref.locale, + locale = _ref$locale === void 0 ? null : _ref$locale, + _ref$locObj = _ref.locObj, + locObj = _ref$locObj === void 0 ? null : _ref$locObj; + return (locObj || Locale.create(locale)).getStartOfWeek(); + } + + /** + * Get the minimum number of days necessary in a week before it is considered part of the next year according + * to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} + */; + Info.getMinimumDaysInFirstWeek = function getMinimumDaysInFirstWeek(_temp2) { + var _ref2 = _temp2 === void 0 ? {} : _temp2, + _ref2$locale = _ref2.locale, + locale = _ref2$locale === void 0 ? null : _ref2$locale, + _ref2$locObj = _ref2.locObj, + locObj = _ref2$locObj === void 0 ? null : _ref2$locObj; + return (locObj || Locale.create(locale)).getMinDaysInFirstWeek(); + } + + /** + * Get the weekdays, which are considered the weekend according to the given locale + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday + */; + Info.getWeekendWeekdays = function getWeekendWeekdays(_temp3) { + var _ref3 = _temp3 === void 0 ? {} : _temp3, + _ref3$locale = _ref3.locale, + locale = _ref3$locale === void 0 ? null : _ref3$locale, + _ref3$locObj = _ref3.locObj, + locObj = _ref3$locObj === void 0 ? null : _ref3$locObj; + // copy the array, because we cache it internally + return (locObj || Locale.create(locale)).getWeekendDays().slice(); + } + + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {Array} + */; + Info.months = function months(length, _temp4) { + if (length === void 0) { + length = "long"; + } + var _ref4 = _temp4 === void 0 ? {} : _temp4, + _ref4$locale = _ref4.locale, + locale = _ref4$locale === void 0 ? null : _ref4$locale, + _ref4$numberingSystem = _ref4.numberingSystem, + numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem, + _ref4$locObj = _ref4.locObj, + locObj = _ref4$locObj === void 0 ? null : _ref4$locObj, + _ref4$outputCalendar = _ref4.outputCalendar, + outputCalendar = _ref4$outputCalendar === void 0 ? "gregory" : _ref4$outputCalendar; + return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length); + } + + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link Info#months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {Array} + */; + Info.monthsFormat = function monthsFormat(length, _temp5) { + if (length === void 0) { + length = "long"; + } + var _ref5 = _temp5 === void 0 ? {} : _temp5, + _ref5$locale = _ref5.locale, + locale = _ref5$locale === void 0 ? null : _ref5$locale, + _ref5$numberingSystem = _ref5.numberingSystem, + numberingSystem = _ref5$numberingSystem === void 0 ? null : _ref5$numberingSystem, + _ref5$locObj = _ref5.locObj, + locObj = _ref5$locObj === void 0 ? null : _ref5$locObj, + _ref5$outputCalendar = _ref5.outputCalendar, + outputCalendar = _ref5$outputCalendar === void 0 ? "gregory" : _ref5$outputCalendar; + return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true); + } + + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {Array} + */; + Info.weekdays = function weekdays(length, _temp6) { + if (length === void 0) { + length = "long"; + } + var _ref6 = _temp6 === void 0 ? {} : _temp6, + _ref6$locale = _ref6.locale, + locale = _ref6$locale === void 0 ? null : _ref6$locale, + _ref6$numberingSystem = _ref6.numberingSystem, + numberingSystem = _ref6$numberingSystem === void 0 ? null : _ref6$numberingSystem, + _ref6$locObj = _ref6.locObj, + locObj = _ref6$locObj === void 0 ? null : _ref6$locObj; + return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length); + } + + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link Info#weekdays} + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @return {Array} + */; + Info.weekdaysFormat = function weekdaysFormat(length, _temp7) { + if (length === void 0) { + length = "long"; + } + var _ref7 = _temp7 === void 0 ? {} : _temp7, + _ref7$locale = _ref7.locale, + locale = _ref7$locale === void 0 ? null : _ref7$locale, + _ref7$numberingSystem = _ref7.numberingSystem, + numberingSystem = _ref7$numberingSystem === void 0 ? null : _ref7$numberingSystem, + _ref7$locObj = _ref7.locObj, + locObj = _ref7$locObj === void 0 ? null : _ref7$locObj; + return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true); + } + + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {Array} + */; + Info.meridiems = function meridiems(_temp8) { + var _ref8 = _temp8 === void 0 ? {} : _temp8, + _ref8$locale = _ref8.locale, + locale = _ref8$locale === void 0 ? null : _ref8$locale; + return Locale.create(locale).meridiems(); + } + + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {Array} + */; + Info.eras = function eras(length, _temp9) { + if (length === void 0) { + length = "short"; + } + var _ref9 = _temp9 === void 0 ? {} : _temp9, + _ref9$locale = _ref9.locale, + locale = _ref9$locale === void 0 ? null : _ref9$locale; + return Locale.create(locale, null, "gregory").eras(length); + } + + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case. + * Keys: + * * `relative`: whether this environment supports relative time formatting + * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale + * @example Info.features() //=> { relative: false, localeWeek: true } + * @return {Object} + */; + Info.features = function features() { + return { + relative: hasRelative(), + localeWeek: hasLocaleWeekInfo() + }; + }; + return Info; + }(); + + function dayDiff(earlier, later) { + var utcDayStart = function utcDayStart(dt) { + return dt.toUTC(0, { + keepLocalTime: true + }).startOf("day").valueOf(); + }, + ms = utcDayStart(later) - utcDayStart(earlier); + return Math.floor(Duration.fromMillis(ms).as("days")); + } + function highOrderDiffs(cursor, later, units) { + var differs = [["years", function (a, b) { + return b.year - a.year; + }], ["quarters", function (a, b) { + return b.quarter - a.quarter + (b.year - a.year) * 4; + }], ["months", function (a, b) { + return b.month - a.month + (b.year - a.year) * 12; + }], ["weeks", function (a, b) { + var days = dayDiff(a, b); + return (days - days % 7) / 7; + }], ["days", dayDiff]]; + var results = {}; + var earlier = cursor; + var lowestOrder, highWater; + + /* This loop tries to diff using larger units first. + If we overshoot, we backtrack and try the next smaller unit. + "cursor" starts out at the earlier timestamp and moves closer and closer to "later" + as we use smaller and smaller units. + highWater keeps track of where we would be if we added one more of the smallest unit, + this is used later to potentially convert any difference smaller than the smallest higher order unit + into a fraction of that smallest higher order unit + */ + for (var _i = 0, _differs = differs; _i < _differs.length; _i++) { + var _differs$_i = _differs[_i], + unit = _differs$_i[0], + differ = _differs$_i[1]; + if (units.indexOf(unit) >= 0) { + lowestOrder = unit; + results[unit] = differ(cursor, later); + highWater = earlier.plus(results); + if (highWater > later) { + // we overshot the end point, backtrack cursor by 1 + results[unit]--; + cursor = earlier.plus(results); + + // if we are still overshooting now, we need to backtrack again + // this happens in certain situations when diffing times in different zones, + // because this calculation ignores time zones + if (cursor > later) { + // keep the "overshot by 1" around as highWater + highWater = cursor; + // backtrack cursor by 1 + results[unit]--; + cursor = earlier.plus(results); + } + } else { + cursor = highWater; + } + } + } + return [cursor, results, highWater, lowestOrder]; + } + function _diff (earlier, later, units, opts) { + var _highOrderDiffs = highOrderDiffs(earlier, later, units), + cursor = _highOrderDiffs[0], + results = _highOrderDiffs[1], + highWater = _highOrderDiffs[2], + lowestOrder = _highOrderDiffs[3]; + var remainingMillis = later - cursor; + var lowerOrderUnits = units.filter(function (u) { + return ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0; + }); + if (lowerOrderUnits.length === 0) { + if (highWater < later) { + var _cursor$plus; + highWater = cursor.plus((_cursor$plus = {}, _cursor$plus[lowestOrder] = 1, _cursor$plus)); + } + if (highWater !== cursor) { + results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); + } + } + var duration = Duration.fromObject(results, opts); + if (lowerOrderUnits.length > 0) { + var _Duration$fromMillis; + return (_Duration$fromMillis = Duration.fromMillis(remainingMillis, opts)).shiftTo.apply(_Duration$fromMillis, lowerOrderUnits).plus(duration); + } else { + return duration; + } + } + + var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; + function intUnit(regex, post) { + if (post === void 0) { + post = function post(i) { + return i; + }; + } + return { + regex: regex, + deser: function deser(_ref) { + var s = _ref[0]; + return post(parseDigits(s)); + } + }; + } + var NBSP = String.fromCharCode(160); + var spaceOrNBSP = "[ " + NBSP + "]"; + var spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g"); + function fixListRegex(s) { + // make dots optional and also make them literal + // make space and non breakable space characters interchangeable + return s.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP); + } + function stripInsensitivities(s) { + return s.replace(/\./g, "") // ignore dots that were made optional + .replace(spaceOrNBSPRegExp, " ") // interchange space and nbsp + .toLowerCase(); + } + function oneOf(strings, startIndex) { + if (strings === null) { + return null; + } else { + return { + regex: RegExp(strings.map(fixListRegex).join("|")), + deser: function deser(_ref2) { + var s = _ref2[0]; + return strings.findIndex(function (i) { + return stripInsensitivities(s) === stripInsensitivities(i); + }) + startIndex; + } + }; + } + } + function offset(regex, groups) { + return { + regex: regex, + deser: function deser(_ref3) { + var h = _ref3[1], + m = _ref3[2]; + return signedOffset(h, m); + }, + groups: groups + }; + } + function simple(regex) { + return { + regex: regex, + deser: function deser(_ref4) { + var s = _ref4[0]; + return s; + } + }; + } + function escapeToken(value) { + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); + } + + /** + * @param token + * @param {Locale} loc + */ + function unitForToken(token, loc) { + var one = digitRegex(loc), + two = digitRegex(loc, "{2}"), + three = digitRegex(loc, "{3}"), + four = digitRegex(loc, "{4}"), + six = digitRegex(loc, "{6}"), + oneOrTwo = digitRegex(loc, "{1,2}"), + oneToThree = digitRegex(loc, "{1,3}"), + oneToSix = digitRegex(loc, "{1,6}"), + oneToNine = digitRegex(loc, "{1,9}"), + twoToFour = digitRegex(loc, "{2,4}"), + fourToSix = digitRegex(loc, "{4,6}"), + literal = function literal(t) { + return { + regex: RegExp(escapeToken(t.val)), + deser: function deser(_ref5) { + var s = _ref5[0]; + return s; + }, + literal: true + }; + }, + unitate = function unitate(t) { + if (token.literal) { + return literal(t); + } + switch (t.val) { + // era + case "G": + return oneOf(loc.eras("short"), 0); + case "GG": + return oneOf(loc.eras("long"), 0); + // years + case "y": + return intUnit(oneToSix); + case "yy": + return intUnit(twoToFour, untruncateYear); + case "yyyy": + return intUnit(four); + case "yyyyy": + return intUnit(fourToSix); + case "yyyyyy": + return intUnit(six); + // months + case "M": + return intUnit(oneOrTwo); + case "MM": + return intUnit(two); + case "MMM": + return oneOf(loc.months("short", true), 1); + case "MMMM": + return oneOf(loc.months("long", true), 1); + case "L": + return intUnit(oneOrTwo); + case "LL": + return intUnit(two); + case "LLL": + return oneOf(loc.months("short", false), 1); + case "LLLL": + return oneOf(loc.months("long", false), 1); + // dates + case "d": + return intUnit(oneOrTwo); + case "dd": + return intUnit(two); + // ordinals + case "o": + return intUnit(oneToThree); + case "ooo": + return intUnit(three); + // time + case "HH": + return intUnit(two); + case "H": + return intUnit(oneOrTwo); + case "hh": + return intUnit(two); + case "h": + return intUnit(oneOrTwo); + case "mm": + return intUnit(two); + case "m": + return intUnit(oneOrTwo); + case "q": + return intUnit(oneOrTwo); + case "qq": + return intUnit(two); + case "s": + return intUnit(oneOrTwo); + case "ss": + return intUnit(two); + case "S": + return intUnit(oneToThree); + case "SSS": + return intUnit(three); + case "u": + return simple(oneToNine); + case "uu": + return simple(oneOrTwo); + case "uuu": + return intUnit(one); + // meridiem + case "a": + return oneOf(loc.meridiems(), 0); + // weekYear (k) + case "kkkk": + return intUnit(four); + case "kk": + return intUnit(twoToFour, untruncateYear); + // weekNumber (W) + case "W": + return intUnit(oneOrTwo); + case "WW": + return intUnit(two); + // weekdays + case "E": + case "c": + return intUnit(one); + case "EEE": + return oneOf(loc.weekdays("short", false), 1); + case "EEEE": + return oneOf(loc.weekdays("long", false), 1); + case "ccc": + return oneOf(loc.weekdays("short", true), 1); + case "cccc": + return oneOf(loc.weekdays("long", true), 1); + // offset/zone + case "Z": + case "ZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(?::(" + two.source + "))?"), 2); + case "ZZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(" + two.source + ")?"), 2); + // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing + // because we don't have any way to figure out what they are + case "z": + return simple(/[a-z_+-/]{1,256}?/i); + // this special-case "token" represents a place where a macro-token expanded into a white-space literal + // in this case we accept any non-newline white-space + case " ": + return simple(/[^\S\n\r]/); + default: + return literal(t); + } + }; + var unit = unitate(token) || { + invalidReason: MISSING_FTP + }; + unit.token = token; + return unit; + } + var partTypeStyleToTokenVal = { + year: { + "2-digit": "yy", + numeric: "yyyyy" + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM" + }, + day: { + numeric: "d", + "2-digit": "dd" + }, + weekday: { + short: "EEE", + long: "EEEE" + }, + dayperiod: "a", + dayPeriod: "a", + hour12: { + numeric: "h", + "2-digit": "hh" + }, + hour24: { + numeric: "H", + "2-digit": "HH" + }, + minute: { + numeric: "m", + "2-digit": "mm" + }, + second: { + numeric: "s", + "2-digit": "ss" + }, + timeZoneName: { + long: "ZZZZZ", + short: "ZZZ" + } + }; + function tokenForPart(part, formatOpts, resolvedOpts) { + var type = part.type, + value = part.value; + if (type === "literal") { + var isSpace = /^\s+$/.test(value); + return { + literal: !isSpace, + val: isSpace ? " " : value + }; + } + var style = formatOpts[type]; + + // The user might have explicitly specified hour12 or hourCycle + // if so, respect their decision + // if not, refer back to the resolvedOpts, which are based on the locale + var actualType = type; + if (type === "hour") { + if (formatOpts.hour12 != null) { + actualType = formatOpts.hour12 ? "hour12" : "hour24"; + } else if (formatOpts.hourCycle != null) { + if (formatOpts.hourCycle === "h11" || formatOpts.hourCycle === "h12") { + actualType = "hour12"; + } else { + actualType = "hour24"; + } + } else { + // tokens only differentiate between 24 hours or not, + // so we do not need to check hourCycle here, which is less supported anyways + actualType = resolvedOpts.hour12 ? "hour12" : "hour24"; + } + } + var val = partTypeStyleToTokenVal[actualType]; + if (typeof val === "object") { + val = val[style]; + } + if (val) { + return { + literal: false, + val: val + }; + } + return undefined; + } + function buildRegex(units) { + var re = units.map(function (u) { + return u.regex; + }).reduce(function (f, r) { + return f + "(" + r.source + ")"; + }, ""); + return ["^" + re + "$", units]; + } + function match(input, regex, handlers) { + var matches = input.match(regex); + if (matches) { + var all = {}; + var matchIndex = 1; + for (var i in handlers) { + if (hasOwnProperty(handlers, i)) { + var h = handlers[i], + groups = h.groups ? h.groups + 1 : 1; + if (!h.literal && h.token) { + all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); + } + matchIndex += groups; + } + } + return [matches, all]; + } else { + return [matches, {}]; + } + } + function dateTimeFromMatches(matches) { + var toField = function toField(token) { + switch (token) { + case "S": + return "millisecond"; + case "s": + return "second"; + case "m": + return "minute"; + case "h": + case "H": + return "hour"; + case "d": + return "day"; + case "o": + return "ordinal"; + case "L": + case "M": + return "month"; + case "y": + return "year"; + case "E": + case "c": + return "weekday"; + case "W": + return "weekNumber"; + case "k": + return "weekYear"; + case "q": + return "quarter"; + default: + return null; + } + }; + var zone = null; + var specificOffset; + if (!isUndefined(matches.z)) { + zone = IANAZone.create(matches.z); + } + if (!isUndefined(matches.Z)) { + if (!zone) { + zone = new FixedOffsetZone(matches.Z); + } + specificOffset = matches.Z; + } + if (!isUndefined(matches.q)) { + matches.M = (matches.q - 1) * 3 + 1; + } + if (!isUndefined(matches.h)) { + if (matches.h < 12 && matches.a === 1) { + matches.h += 12; + } else if (matches.h === 12 && matches.a === 0) { + matches.h = 0; + } + } + if (matches.G === 0 && matches.y) { + matches.y = -matches.y; + } + if (!isUndefined(matches.u)) { + matches.S = parseMillis(matches.u); + } + var vals = Object.keys(matches).reduce(function (r, k) { + var f = toField(k); + if (f) { + r[f] = matches[k]; + } + return r; + }, {}); + return [vals, zone, specificOffset]; + } + var dummyDateTimeCache = null; + function getDummyDateTime() { + if (!dummyDateTimeCache) { + dummyDateTimeCache = DateTime.fromMillis(1555555555555); + } + return dummyDateTimeCache; + } + function maybeExpandMacroToken(token, locale) { + if (token.literal) { + return token; + } + var formatOpts = Formatter.macroTokenToFormatOpts(token.val); + var tokens = formatOptsToTokens(formatOpts, locale); + if (tokens == null || tokens.includes(undefined)) { + return token; + } + return tokens; + } + function expandMacroTokens(tokens, locale) { + var _Array$prototype; + return (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, tokens.map(function (t) { + return maybeExpandMacroToken(t, locale); + })); + } + + /** + * @private + */ + + var TokenParser = /*#__PURE__*/function () { + function TokenParser(locale, format) { + this.locale = locale; + this.format = format; + this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale); + this.units = this.tokens.map(function (t) { + return unitForToken(t, locale); + }); + this.disqualifyingUnit = this.units.find(function (t) { + return t.invalidReason; + }); + if (!this.disqualifyingUnit) { + var _buildRegex = buildRegex(this.units), + regexString = _buildRegex[0], + handlers = _buildRegex[1]; + this.regex = RegExp(regexString, "i"); + this.handlers = handlers; + } + } + var _proto = TokenParser.prototype; + _proto.explainFromTokens = function explainFromTokens(input) { + if (!this.isValid) { + return { + input: input, + tokens: this.tokens, + invalidReason: this.invalidReason + }; + } else { + var _match = match(input, this.regex, this.handlers), + rawMatches = _match[0], + matches = _match[1], + _ref6 = matches ? dateTimeFromMatches(matches) : [null, null, undefined], + result = _ref6[0], + zone = _ref6[1], + specificOffset = _ref6[2]; + if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { + throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format"); + } + return { + input: input, + tokens: this.tokens, + regex: this.regex, + rawMatches: rawMatches, + matches: matches, + result: result, + zone: zone, + specificOffset: specificOffset + }; + } + }; + _createClass(TokenParser, [{ + key: "isValid", + get: function get() { + return !this.disqualifyingUnit; + } + }, { + key: "invalidReason", + get: function get() { + return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null; + } + }]); + return TokenParser; + }(); + function explainFromTokens(locale, input, format) { + var parser = new TokenParser(locale, format); + return parser.explainFromTokens(input); + } + function parseFromTokens(locale, input, format) { + var _explainFromTokens = explainFromTokens(locale, input, format), + result = _explainFromTokens.result, + zone = _explainFromTokens.zone, + specificOffset = _explainFromTokens.specificOffset, + invalidReason = _explainFromTokens.invalidReason; + return [result, zone, specificOffset, invalidReason]; + } + function formatOptsToTokens(formatOpts, locale) { + if (!formatOpts) { + return null; + } + var formatter = Formatter.create(locale, formatOpts); + var df = formatter.dtFormatter(getDummyDateTime()); + var parts = df.formatToParts(); + var resolvedOpts = df.resolvedOptions(); + return parts.map(function (p) { + return tokenForPart(p, formatOpts, resolvedOpts); + }); + } + + var INVALID = "Invalid DateTime"; + var MAX_DATE = 8.64e15; + function unsupportedZone(zone) { + return new Invalid("unsupported zone", "the zone \"" + zone.name + "\" is not supported"); + } + + // we cache week data on the DT object and this intermediates the cache + /** + * @param {DateTime} dt + */ + function possiblyCachedWeekData(dt) { + if (dt.weekData === null) { + dt.weekData = gregorianToWeek(dt.c); + } + return dt.weekData; + } + + /** + * @param {DateTime} dt + */ + function possiblyCachedLocalWeekData(dt) { + if (dt.localWeekData === null) { + dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek()); + } + return dt.localWeekData; + } + + // clone really means, "make a new object with these modifications". all "setters" really use this + // to create a new object while only changing some of the properties + function clone(inst, alts) { + var current = { + ts: inst.ts, + zone: inst.zone, + c: inst.c, + o: inst.o, + loc: inst.loc, + invalid: inst.invalid + }; + return new DateTime(_extends({}, current, alts, { + old: current + })); + } + + // find the right offset a given local time. The o input is our guess, which determines which + // offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST) + function fixOffset(localTS, o, tz) { + // Our UTC time is just a guess because our offset is just a guess + var utcGuess = localTS - o * 60 * 1000; + + // Test whether the zone matches the offset for this ts + var o2 = tz.offset(utcGuess); + + // If so, offset didn't change and we're done + if (o === o2) { + return [utcGuess, o]; + } + + // If not, change the ts by the difference in the offset + utcGuess -= (o2 - o) * 60 * 1000; + + // If that gives us the local time we want, we're done + var o3 = tz.offset(utcGuess); + if (o2 === o3) { + return [utcGuess, o2]; + } + + // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time + return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; + } + + // convert an epoch timestamp into a calendar object with the given offset + function tsToObj(ts, offset) { + ts += offset * 60 * 1000; + var d = new Date(ts); + return { + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate(), + hour: d.getUTCHours(), + minute: d.getUTCMinutes(), + second: d.getUTCSeconds(), + millisecond: d.getUTCMilliseconds() + }; + } + + // convert a calendar object to a epoch timestamp + function objToTS(obj, offset, zone) { + return fixOffset(objToLocalTS(obj), offset, zone); + } + + // create a new DT instance by adding a duration, adjusting for DSTs + function adjustTime(inst, dur) { + var oPre = inst.o, + year = inst.c.year + Math.trunc(dur.years), + month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, + c = _extends({}, inst.c, { + year: year, + month: month, + day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + Math.trunc(dur.weeks) * 7 + }), + millisToAdd = Duration.fromObject({ + years: dur.years - Math.trunc(dur.years), + quarters: dur.quarters - Math.trunc(dur.quarters), + months: dur.months - Math.trunc(dur.months), + weeks: dur.weeks - Math.trunc(dur.weeks), + days: dur.days - Math.trunc(dur.days), + hours: dur.hours, + minutes: dur.minutes, + seconds: dur.seconds, + milliseconds: dur.milliseconds + }).as("milliseconds"), + localTS = objToLocalTS(c); + var _fixOffset = fixOffset(localTS, oPre, inst.zone), + ts = _fixOffset[0], + o = _fixOffset[1]; + if (millisToAdd !== 0) { + ts += millisToAdd; + // that could have changed the offset by going over a DST, but we want to keep the ts the same + o = inst.zone.offset(ts); + } + return { + ts: ts, + o: o + }; + } + + // helper useful in turning the results of parsing into real dates + // by handling the zone options + function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) { + var setZone = opts.setZone, + zone = opts.zone; + if (parsed && Object.keys(parsed).length !== 0 || parsedZone) { + var interpretationZone = parsedZone || zone, + inst = DateTime.fromObject(parsed, _extends({}, opts, { + zone: interpretationZone, + specificOffset: specificOffset + })); + return setZone ? inst : inst.setZone(zone); + } else { + return DateTime.invalid(new Invalid("unparsable", "the input \"" + text + "\" can't be parsed as " + format)); + } + } + + // if you want to output a technical format (e.g. RFC 2822), this helper + // helps handle the details + function toTechFormat(dt, format, allowZ) { + if (allowZ === void 0) { + allowZ = true; + } + return dt.isValid ? Formatter.create(Locale.create("en-US"), { + allowZ: allowZ, + forceSimple: true + }).formatDateTimeFromString(dt, format) : null; + } + function _toISODate(o, extended, precision) { + var longFormat = o.c.year > 9999 || o.c.year < 0; + var c = ""; + if (longFormat && o.c.year >= 0) c += "+"; + c += padStart(o.c.year, longFormat ? 6 : 4); + if (precision === "year") return c; + if (extended) { + c += "-"; + c += padStart(o.c.month); + if (precision === "month") return c; + c += "-"; + } else { + c += padStart(o.c.month); + if (precision === "month") return c; + } + c += padStart(o.c.day); + return c; + } + function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision) { + var showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0, + c = ""; + switch (precision) { + case "day": + case "month": + case "year": + break; + default: + c += padStart(o.c.hour); + if (precision === "hour") break; + if (extended) { + c += ":"; + c += padStart(o.c.minute); + if (precision === "minute") break; + if (showSeconds) { + c += ":"; + c += padStart(o.c.second); + } + } else { + c += padStart(o.c.minute); + if (precision === "minute") break; + if (showSeconds) { + c += padStart(o.c.second); + } + } + if (precision === "second") break; + if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) { + c += "."; + c += padStart(o.c.millisecond, 3); + } + } + if (includeOffset) { + if (o.isOffsetFixed && o.offset === 0 && !extendedZone) { + c += "Z"; + } else if (o.o < 0) { + c += "-"; + c += padStart(Math.trunc(-o.o / 60)); + c += ":"; + c += padStart(Math.trunc(-o.o % 60)); + } else { + c += "+"; + c += padStart(Math.trunc(o.o / 60)); + c += ":"; + c += padStart(Math.trunc(o.o % 60)); + } + } + if (extendedZone) { + c += "[" + o.zone.ianaName + "]"; + } + return c; + } + + // defaults for unspecified units in the supported calendars + var defaultUnitValues = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultWeekUnitValues = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultOrdinalUnitValues = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }; + + // Units in the supported calendars, sorted by bigness + var orderedUnits = ["year", "month", "day", "hour", "minute", "second", "millisecond"], + orderedWeekUnits = ["weekYear", "weekNumber", "weekday", "hour", "minute", "second", "millisecond"], + orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; + + // standardize case and plurality in units + function normalizeUnit(unit) { + var normalized = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal" + }[unit.toLowerCase()]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } + function normalizeUnitWithLocalWeeks(unit) { + switch (unit.toLowerCase()) { + case "localweekday": + case "localweekdays": + return "localWeekday"; + case "localweeknumber": + case "localweeknumbers": + return "localWeekNumber"; + case "localweekyear": + case "localweekyears": + return "localWeekYear"; + default: + return normalizeUnit(unit); + } + } + + // cache offsets for zones based on the current timestamp when this function is + // first called. When we are handling a datetime from components like (year, + // month, day, hour) in a time zone, we need a guess about what the timezone + // offset is so that we can convert into a UTC timestamp. One way is to find the + // offset of now in the zone. The actual date may have a different offset (for + // example, if we handle a date in June while we're in December in a zone that + // observes DST), but we can check and adjust that. + // + // When handling many dates, calculating the offset for now every time is + // expensive. It's just a guess, so we can cache the offset to use even if we + // are right on a time change boundary (we'll just correct in the other + // direction). Using a timestamp from first read is a slight optimization for + // handling dates close to the current date, since those dates will usually be + // in the same offset (we could set the timestamp statically, instead). We use a + // single timestamp for all zones to make things a bit more predictable. + // + // This is safe for quickDT (used by local() and utc()) because we don't fill in + // higher-order units from tsNow (as we do in fromObject, this requires that + // offset is calculated from tsNow). + /** + * @param {Zone} zone + * @return {number} + */ + function guessOffsetForZone(zone) { + if (zoneOffsetTs === undefined) { + zoneOffsetTs = Settings.now(); + } + + // Do not cache anything but IANA zones, because it is not safe to do so. + // Guessing an offset which is not present in the zone can cause wrong results from fixOffset + if (zone.type !== "iana") { + return zone.offset(zoneOffsetTs); + } + var zoneName = zone.name; + var offsetGuess = zoneOffsetGuessCache.get(zoneName); + if (offsetGuess === undefined) { + offsetGuess = zone.offset(zoneOffsetTs); + zoneOffsetGuessCache.set(zoneName, offsetGuess); + } + return offsetGuess; + } + + // this is a dumbed down version of fromObject() that runs about 60% faster + // but doesn't do any validation, makes a bunch of assumptions about what units + // are present, and so on. + function quickDT(obj, opts) { + var zone = normalizeZone(opts.zone, Settings.defaultZone); + if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } + var loc = Locale.fromObject(opts); + var ts, o; + + // assume we have the higher-order units + if (!isUndefined(obj.year)) { + for (var _i = 0, _orderedUnits = orderedUnits; _i < _orderedUnits.length; _i++) { + var u = _orderedUnits[_i]; + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } + } + var invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + if (invalid) { + return DateTime.invalid(invalid); + } + var offsetProvis = guessOffsetForZone(zone); + var _objToTS = objToTS(obj, offsetProvis, zone); + ts = _objToTS[0]; + o = _objToTS[1]; + } else { + ts = Settings.now(); + } + return new DateTime({ + ts: ts, + zone: zone, + loc: loc, + o: o + }); + } + function diffRelative(start, end, opts) { + var round = isUndefined(opts.round) ? true : opts.round, + rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding, + format = function format(c, unit) { + c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding); + var formatter = end.loc.clone(opts).relFormatter(opts); + return formatter.format(c, unit); + }, + differ = function differ(unit) { + if (opts.calendary) { + if (!end.hasSame(start, unit)) { + return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); + } else return 0; + } else { + return end.diff(start, unit).get(unit); + } + }; + if (opts.unit) { + return format(differ(opts.unit), opts.unit); + } + for (var _iterator = _createForOfIteratorHelperLoose(opts.units), _step; !(_step = _iterator()).done;) { + var unit = _step.value; + var count = differ(unit); + if (Math.abs(count) >= 1) { + return format(count, unit); + } + } + return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]); + } + function lastOpts(argList) { + var opts = {}, + args; + if (argList.length > 0 && typeof argList[argList.length - 1] === "object") { + opts = argList[argList.length - 1]; + args = Array.from(argList).slice(0, argList.length - 1); + } else { + args = Array.from(argList); + } + return [opts, args]; + } + + /** + * Timestamp to use for cached zone offset guesses (exposed for test) + */ + var zoneOffsetTs; + /** + * Cache for zone offset guesses (exposed for test). + * + * This optimizes quickDT via guessOffsetForZone to avoid repeated calls of + * zone.offset(). + */ + var zoneOffsetGuessCache = new Map(); + + /** + * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. + * + * A DateTime comprises of: + * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. + * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). + * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. + * + * Here is a brief overview of the most commonly used functionality it provides: + * + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month}, + * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors. + * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}. + * + * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. + */ + var DateTime = /*#__PURE__*/function (_Symbol$for) { + /** + * @access private + */ + function DateTime(config) { + var zone = config.zone || Settings.defaultZone; + var invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null); + /** + * @access private + */ + this.ts = isUndefined(config.ts) ? Settings.now() : config.ts; + var c = null, + o = null; + if (!invalid) { + var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); + if (unchanged) { + var _ref = [config.old.c, config.old.o]; + c = _ref[0]; + o = _ref[1]; + } else { + // If an offset has been passed and we have not been called from + // clone(), we can trust it and avoid the offset calculation. + var ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts); + c = tsToObj(this.ts, ot); + invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; + c = invalid ? null : c; + o = invalid ? null : ot; + } + } + + /** + * @access private + */ + this._zone = zone; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.invalid = invalid; + /** + * @access private + */ + this.weekData = null; + /** + * @access private + */ + this.localWeekData = null; + /** + * @access private + */ + this.c = c; + /** + * @access private + */ + this.o = o; + /** + * @access private + */ + this.isLuxonDateTime = true; + } + + // CONSTRUCT + + /** + * Create a DateTime for the current instant, in the system's time zone. + * + * Use Settings to override these default values if needed. + * @example DateTime.now().toISO() //~> now in the ISO format + * @return {DateTime} + */ + DateTime.now = function now() { + return new DateTime({}); + } + + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month, 1-indexed + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local({ zone: "America/New_York" }) //~> now, in US east coast time + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12, { locale: "fr" }) //~> 2017-03-12T00:00:00, with a French locale + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, { zone: "utc" }) //~> 2017-03-12T05:00:00, in UTC + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */; + DateTime.local = function local() { + var _lastOpts = lastOpts(arguments), + opts = _lastOpts[0], + args = _lastOpts[1], + year = args[0], + month = args[1], + day = args[2], + hour = args[3], + minute = args[4], + second = args[5], + millisecond = args[6]; + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, opts); + } + + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @param {Object} options - configuration options for the DateTime + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: "fr" }) //~> 2017-03-12T05:45:00Z with a French locale + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: "fr" }) //~> 2017-03-12T05:45:10.765Z with a French locale + * @return {DateTime} + */; + DateTime.utc = function utc() { + var _lastOpts2 = lastOpts(arguments), + opts = _lastOpts2[0], + args = _lastOpts2[1], + year = args[0], + month = args[1], + day = args[2], + hour = args[3], + minute = args[4], + second = args[5], + millisecond = args[6]; + opts.zone = FixedOffsetZone.utcInstance; + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, opts); + } + + /** + * Create a DateTime from a JavaScript Date object. Uses the default zone. + * @param {Date} date - a JavaScript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */; + DateTime.fromJSDate = function fromJSDate(date, options) { + if (options === void 0) { + options = {}; + } + var ts = isDate(date) ? date.valueOf() : NaN; + if (Number.isNaN(ts)) { + return DateTime.invalid("invalid input"); + } + var zoneToUse = normalizeZone(options.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + return new DateTime({ + ts: ts, + zone: zoneToUse, + loc: Locale.fromObject(options) + }); + } + + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */; + DateTime.fromMillis = function fromMillis(milliseconds, options) { + if (options === void 0) { + options = {}; + } + if (!isNumber(milliseconds)) { + throw new InvalidArgumentError("fromMillis requires a numerical input, but received a " + typeof milliseconds + " with value " + milliseconds); + } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { + // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start + return DateTime.invalid("Timestamp out of range"); + } else { + return new DateTime({ + ts: milliseconds, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */; + DateTime.fromSeconds = function fromSeconds(seconds, options) { + if (options === void 0) { + options = {}; + } + if (!isNumber(seconds)) { + throw new InvalidArgumentError("fromSeconds requires a numerical input"); + } else { + return new DateTime({ + ts: seconds * 1000, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + + /** + * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.localWeekYear - a week year, according to the locale + * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale + * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {Object} opts - options for creating this DateTime + * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26' + * @return {DateTime} + */; + DateTime.fromObject = function fromObject(obj, opts) { + if (opts === void 0) { + opts = {}; + } + obj = obj || {}; + var zoneToUse = normalizeZone(opts.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + var loc = Locale.fromObject(opts); + var normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks); + var _usesLocalWeekValues = usesLocalWeekValues(normalized, loc), + minDaysInFirstWeek = _usesLocalWeekValues.minDaysInFirstWeek, + startOfWeek = _usesLocalWeekValues.startOfWeek; + var tsNow = Settings.now(), + offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber; + + // cases: + // just a weekday -> this week's instance of that weekday, no worries + // (gregorian data or ordinal) + (weekYear or weekNumber) -> error + // (gregorian month or day) + ordinal -> error + // otherwise just use weeks or ordinals or gregorian, depending on what's specified + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + var useWeekData = definiteWeekDef || normalized.weekday && !containsGregor; + + // configure ourselves to deal with gregorian dates or week stuff + var units, + defaultValues, + objNow = tsToObj(tsNow, offsetProvis); + if (useWeekData) { + units = orderedWeekUnits; + defaultValues = defaultWeekUnitValues; + objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek); + } else if (containsOrdinal) { + units = orderedOrdinalUnits; + defaultValues = defaultOrdinalUnitValues; + objNow = gregorianToOrdinal(objNow); + } else { + units = orderedUnits; + defaultValues = defaultUnitValues; + } + + // set default values for missing stuff + var foundFirst = false; + for (var _iterator2 = _createForOfIteratorHelperLoose(units), _step2; !(_step2 = _iterator2()).done;) { + var u = _step2.value; + var v = normalized[u]; + if (!isUndefined(v)) { + foundFirst = true; + } else if (foundFirst) { + normalized[u] = defaultValues[u]; + } else { + normalized[u] = objNow[u]; + } + } + + // make sure the values we have are in range + var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), + invalid = higherOrderInvalid || hasInvalidTimeData(normalized); + if (invalid) { + return DateTime.invalid(invalid); + } + + // compute the actual time + var gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, + _objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse), + tsFinal = _objToTS2[0], + offsetFinal = _objToTS2[1], + inst = new DateTime({ + ts: tsFinal, + zone: zoneToUse, + o: offsetFinal, + loc: loc + }); + + // gregorian data + weekday serves only to validate + if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { + return DateTime.invalid("mismatched weekday", "you can't specify both a weekday of " + normalized.weekday + " and a date of " + inst.toISO()); + } + if (!inst.isValid) { + return DateTime.invalid(inst.invalid); + } + return inst; + } + + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */; + DateTime.fromISO = function fromISO(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseISODate = parseISODate(text), + vals = _parseISODate[0], + parsedZone = _parseISODate[1]; + return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); + } + + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */; + DateTime.fromRFC2822 = function fromRFC2822(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseRFC2822Date = parseRFC2822Date(text), + vals = _parseRFC2822Date[0], + parsedZone = _parseRFC2822Date[1]; + return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); + } + + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */; + DateTime.fromHTTP = function fromHTTP(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseHTTPDate = parseHTTPDate(text), + vals = _parseHTTPDate[0], + parsedZone = _parseHTTPDate[1]; + return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); + } + + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens). + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */; + DateTime.fromFormat = function fromFormat(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + if (isUndefined(text) || isUndefined(fmt)) { + throw new InvalidArgumentError("fromFormat requires an input string and a format"); + } + var _opts = opts, + _opts$locale = _opts.locale, + locale = _opts$locale === void 0 ? null : _opts$locale, + _opts$numberingSystem = _opts.numberingSystem, + numberingSystem = _opts$numberingSystem === void 0 ? null : _opts$numberingSystem, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }), + _parseFromTokens = parseFromTokens(localeToUse, text, fmt), + vals = _parseFromTokens[0], + parsedZone = _parseFromTokens[1], + specificOffset = _parseFromTokens[2], + invalid = _parseFromTokens[3]; + if (invalid) { + return DateTime.invalid(invalid); + } else { + return parseDataToDateTime(vals, parsedZone, opts, "format " + fmt, text, specificOffset); + } + } + + /** + * @deprecated use fromFormat instead + */; + DateTime.fromString = function fromString(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + return DateTime.fromFormat(text, fmt, opts); + } + + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */; + DateTime.fromSQL = function fromSQL(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseSQL = parseSQL(text), + vals = _parseSQL[0], + parsedZone = _parseSQL[1]; + return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); + } + + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent. + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */; + DateTime.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); + } + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidDateTimeError(invalid); + } else { + return new DateTime({ + invalid: invalid + }); + } + } + + /** + * Check if an object is an instance of DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */; + DateTime.isDateTime = function isDateTime(o) { + return o && o.isLuxonDateTime || false; + } + + /** + * Produce the format string for a set of options + * @param formatOpts + * @param localeOpts + * @returns {string} + */; + DateTime.parseFormatForOpts = function parseFormatForOpts(formatOpts, localeOpts) { + if (localeOpts === void 0) { + localeOpts = {}; + } + var tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts)); + return !tokenList ? null : tokenList.map(function (t) { + return t ? t.val : null; + }).join(""); + } + + /** + * Produce the the fully expanded format token for the locale + * Does NOT quote characters, so quoted tokens will not round trip correctly + * @param fmt + * @param localeOpts + * @returns {string} + */; + DateTime.expandFormat = function expandFormat(fmt, localeOpts) { + if (localeOpts === void 0) { + localeOpts = {}; + } + var expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts)); + return expanded.map(function (t) { + return t.val; + }).join(""); + }; + DateTime.resetCache = function resetCache() { + zoneOffsetTs = undefined; + zoneOffsetGuessCache.clear(); + } + + // INFO + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */; + var _proto = DateTime.prototype; + _proto.get = function get(unit) { + return this[unit]; + } + + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */; + /** + * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC + * in this DateTime's zone. During DST changes local time can be ambiguous, for example + * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`. + * This method will return both possible DateTimes if this DateTime's local time is ambiguous. + * @returns {DateTime[]} + */ + _proto.getPossibleOffsets = function getPossibleOffsets() { + if (!this.isValid || this.isOffsetFixed) { + return [this]; + } + var dayMs = 86400000; + var minuteMs = 60000; + var localTS = objToLocalTS(this.c); + var oEarlier = this.zone.offset(localTS - dayMs); + var oLater = this.zone.offset(localTS + dayMs); + var o1 = this.zone.offset(localTS - oEarlier * minuteMs); + var o2 = this.zone.offset(localTS - oLater * minuteMs); + if (o1 === o2) { + return [this]; + } + var ts1 = localTS - o1 * minuteMs; + var ts2 = localTS - o2 * minuteMs; + var c1 = tsToObj(ts1, o1); + var c2 = tsToObj(ts2, o2); + if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) { + return [clone(this, { + ts: ts1 + }), clone(this, { + ts: ts2 + })]; + } + return [this]; + } + + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */; + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + _proto.resolvedLocaleOptions = function resolvedLocaleOptions(opts) { + if (opts === void 0) { + opts = {}; + } + var _Formatter$create$res = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this), + locale = _Formatter$create$res.locale, + numberingSystem = _Formatter$create$res.numberingSystem, + calendar = _Formatter$create$res.calendar; + return { + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: calendar + }; + } + + // TRANSFORM + + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link DateTime#setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */; + _proto.toUTC = function toUTC(offset, opts) { + if (offset === void 0) { + offset = 0; + } + if (opts === void 0) { + opts = {}; + } + return this.setZone(FixedOffsetZone.instance(offset), opts); + } + + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */; + _proto.toLocal = function toLocal() { + return this.setZone(Settings.defaultZone); + } + + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */; + _proto.setZone = function setZone(zone, _temp) { + var _ref2 = _temp === void 0 ? {} : _temp, + _ref2$keepLocalTime = _ref2.keepLocalTime, + keepLocalTime = _ref2$keepLocalTime === void 0 ? false : _ref2$keepLocalTime, + _ref2$keepCalendarTim = _ref2.keepCalendarTime, + keepCalendarTime = _ref2$keepCalendarTim === void 0 ? false : _ref2$keepCalendarTim; + zone = normalizeZone(zone, Settings.defaultZone); + if (zone.equals(this.zone)) { + return this; + } else if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } else { + var newTS = this.ts; + if (keepLocalTime || keepCalendarTime) { + var offsetGuess = zone.offset(this.ts); + var asObj = this.toObject(); + var _objToTS3 = objToTS(asObj, offsetGuess, zone); + newTS = _objToTS3[0]; + } + return clone(this, { + ts: newTS, + zone: zone + }); + } + } + + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */; + _proto.reconfigure = function reconfigure(_temp2) { + var _ref3 = _temp2 === void 0 ? {} : _temp2, + locale = _ref3.locale, + numberingSystem = _ref3.numberingSystem, + outputCalendar = _ref3.outputCalendar; + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: outputCalendar + }); + return clone(this, { + loc: loc + }); + } + + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */; + _proto.setLocale = function setLocale(locale) { + return this.reconfigure({ + locale: locale + }); + } + + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}. + * + * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`. + * They cannot be mixed with ISO-week units like `weekday`. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */; + _proto.set = function set(values) { + if (!this.isValid) return this; + var normalized = normalizeObject(values, normalizeUnitWithLocalWeeks); + var _usesLocalWeekValues2 = usesLocalWeekValues(normalized, this.loc), + minDaysInFirstWeek = _usesLocalWeekValues2.minDaysInFirstWeek, + startOfWeek = _usesLocalWeekValues2.startOfWeek; + var settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber; + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + var mixed; + if (settingWeekStuff) { + mixed = weekToGregorian(_extends({}, gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), normalized), minDaysInFirstWeek, startOfWeek); + } else if (!isUndefined(normalized.ordinal)) { + mixed = ordinalToGregorian(_extends({}, gregorianToOrdinal(this.c), normalized)); + } else { + mixed = _extends({}, this.toObject(), normalized); + + // if we didn't set the day but we ended up on an overflow date, + // use the last day of the right month + if (isUndefined(normalized.day)) { + mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); + } + } + var _objToTS4 = objToTS(mixed, this.o, this.zone), + ts = _objToTS4[0], + o = _objToTS4[1]; + return clone(this, { + ts: ts, + o: o + }); + } + + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.now().plus(123) //~> in 123 milliseconds + * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */; + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration); + return clone(this, adjustTime(this, dur)); + } + + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link DateTime#plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */; + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration).negate(); + return clone(this, adjustTime(this, dur)); + } + + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */; + _proto.startOf = function startOf(unit, _temp3) { + var _ref4 = _temp3 === void 0 ? {} : _temp3, + _ref4$useLocaleWeeks = _ref4.useLocaleWeeks, + useLocaleWeeks = _ref4$useLocaleWeeks === void 0 ? false : _ref4$useLocaleWeeks; + if (!this.isValid) return this; + var o = {}, + normalizedUnit = Duration.normalizeUnit(unit); + switch (normalizedUnit) { + case "years": + o.month = 1; + // falls through + case "quarters": + case "months": + o.day = 1; + // falls through + case "weeks": + case "days": + o.hour = 0; + // falls through + case "hours": + o.minute = 0; + // falls through + case "minutes": + o.second = 0; + // falls through + case "seconds": + o.millisecond = 0; + break; + // no default, invalid units throw in normalizeUnit() + } + + if (normalizedUnit === "weeks") { + if (useLocaleWeeks) { + var startOfWeek = this.loc.getStartOfWeek(); + var weekday = this.weekday; + if (weekday < startOfWeek) { + o.weekNumber = this.weekNumber - 1; + } + o.weekday = startOfWeek; + } else { + o.weekday = 1; + } + } + if (normalizedUnit === "quarters") { + var q = Math.ceil(this.month / 3); + o.month = (q - 1) * 3 + 1; + } + return this.set(o); + } + + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */; + _proto.endOf = function endOf(unit, opts) { + var _this$plus; + return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit, opts).minus(1) : this; + } + + // OUTPUT + + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.now().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.now().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */; + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID; + } + + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toLocaleString(); //=> 4/20/2017 + * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022' + * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32' + * @return {string} + */; + _proto.toLocaleString = function toLocaleString(formatOpts, opts) { + if (formatOpts === void 0) { + formatOpts = DATE_SHORT; + } + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID; + } + + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.now().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */; + _proto.toLocaleParts = function toLocaleParts(opts) { + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : []; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=false] - add the time zone format extension + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0. + * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z' + * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z' + * @return {string|null} + */; + _proto.toISO = function toISO(_temp4) { + var _ref5 = _temp4 === void 0 ? {} : _temp4, + _ref5$format = _ref5.format, + format = _ref5$format === void 0 ? "extended" : _ref5$format, + _ref5$suppressSeconds = _ref5.suppressSeconds, + suppressSeconds = _ref5$suppressSeconds === void 0 ? false : _ref5$suppressSeconds, + _ref5$suppressMillise = _ref5.suppressMilliseconds, + suppressMilliseconds = _ref5$suppressMillise === void 0 ? false : _ref5$suppressMillise, + _ref5$includeOffset = _ref5.includeOffset, + includeOffset = _ref5$includeOffset === void 0 ? true : _ref5$includeOffset, + _ref5$extendedZone = _ref5.extendedZone, + extendedZone = _ref5$extendedZone === void 0 ? false : _ref5$extendedZone, + _ref5$precision = _ref5.precision, + precision = _ref5$precision === void 0 ? "milliseconds" : _ref5$precision; + if (!this.isValid) { + return null; + } + precision = normalizeUnit(precision); + var ext = format === "extended"; + var c = _toISODate(this, ext, precision); + if (orderedUnits.indexOf(precision) >= 3) c += "T"; + c += _toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision); + return c; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'. + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05' + * @return {string|null} + */; + _proto.toISODate = function toISODate(_temp5) { + var _ref6 = _temp5 === void 0 ? {} : _temp5, + _ref6$format = _ref6.format, + format = _ref6$format === void 0 ? "extended" : _ref6$format, + _ref6$precision = _ref6.precision, + precision = _ref6$precision === void 0 ? "day" : _ref6$precision; + if (!this.isValid) { + return null; + } + return _toISODate(this, format === "extended", normalizeUnit(precision)); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */; + _proto.toISOWeekDate = function toISOWeekDate() { + return toTechFormat(this, "kkkk-'W'WW-c"); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=true] - add the time zone format extension + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0. + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z' + * @return {string} + */; + _proto.toISOTime = function toISOTime(_temp6) { + var _ref7 = _temp6 === void 0 ? {} : _temp6, + _ref7$suppressMillise = _ref7.suppressMilliseconds, + suppressMilliseconds = _ref7$suppressMillise === void 0 ? false : _ref7$suppressMillise, + _ref7$suppressSeconds = _ref7.suppressSeconds, + suppressSeconds = _ref7$suppressSeconds === void 0 ? false : _ref7$suppressSeconds, + _ref7$includeOffset = _ref7.includeOffset, + includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset, + _ref7$includePrefix = _ref7.includePrefix, + includePrefix = _ref7$includePrefix === void 0 ? false : _ref7$includePrefix, + _ref7$extendedZone = _ref7.extendedZone, + extendedZone = _ref7$extendedZone === void 0 ? false : _ref7$extendedZone, + _ref7$format = _ref7.format, + format = _ref7$format === void 0 ? "extended" : _ref7$format, + _ref7$precision = _ref7.precision, + precision = _ref7$precision === void 0 ? "milliseconds" : _ref7$precision; + if (!this.isValid) { + return null; + } + precision = normalizeUnit(precision); + var c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : ""; + return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision); + } + + /** + * Returns an RFC 2822-compatible string representation of this DateTime + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */; + _proto.toRFC2822 = function toRFC2822() { + return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); + } + + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */; + _proto.toHTTP = function toHTTP() { + return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string|null} + */; + _proto.toSQLDate = function toSQLDate() { + if (!this.isValid) { + return null; + } + return _toISODate(this, true); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */; + _proto.toSQLTime = function toSQLTime(_temp7) { + var _ref8 = _temp7 === void 0 ? {} : _temp7, + _ref8$includeOffset = _ref8.includeOffset, + includeOffset = _ref8$includeOffset === void 0 ? true : _ref8$includeOffset, + _ref8$includeZone = _ref8.includeZone, + includeZone = _ref8$includeZone === void 0 ? false : _ref8$includeZone, + _ref8$includeOffsetSp = _ref8.includeOffsetSpace, + includeOffsetSpace = _ref8$includeOffsetSp === void 0 ? true : _ref8$includeOffsetSp; + var fmt = "HH:mm:ss.SSS"; + if (includeZone || includeOffset) { + if (includeOffsetSpace) { + fmt += " "; + } + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += "ZZ"; + } + } + return toTechFormat(this, fmt, true); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */; + _proto.toSQL = function toSQL(opts) { + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) { + return null; + } + return this.toSQLDate() + " " + this.toSQLTime(opts); + } + + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */; + _proto.toString = function toString() { + return this.isValid ? this.toISO() : INVALID; + } + + /** + * Returns a string representation of this DateTime appropriate for the REPL. + * @return {string} + */; + _proto[_Symbol$for] = function () { + if (this.isValid) { + return "DateTime { ts: " + this.toISO() + ", zone: " + this.zone.name + ", locale: " + this.locale + " }"; + } else { + return "DateTime { Invalid, reason: " + this.invalidReason + " }"; + } + } + + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis} + * @return {number} + */; + _proto.valueOf = function valueOf() { + return this.toMillis(); + } + + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */; + _proto.toMillis = function toMillis() { + return this.isValid ? this.ts : NaN; + } + + /** + * Returns the epoch seconds (including milliseconds in the fractional part) of this DateTime. + * @return {number} + */; + _proto.toSeconds = function toSeconds() { + return this.isValid ? this.ts / 1000 : NaN; + } + + /** + * Returns the epoch seconds (as a whole number) of this DateTime. + * @return {number} + */; + _proto.toUnixInteger = function toUnixInteger() { + return this.isValid ? Math.floor(this.ts / 1000) : NaN; + } + + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */; + _proto.toJSON = function toJSON() { + return this.toISO(); + } + + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */; + _proto.toBSON = function toBSON() { + return this.toJSDate(); + } + + /** + * Returns a JavaScript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */; + _proto.toObject = function toObject(opts) { + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) return {}; + var base = _extends({}, this.c); + if (opts.includeConfig) { + base.outputCalendar = this.outputCalendar; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + return base; + } + + /** + * Returns a JavaScript Date equivalent to this DateTime. + * @return {Date} + */; + _proto.toJSDate = function toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } + + // COMPARE + + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */; + _proto.diff = function diff(otherDateTime, unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + if (opts === void 0) { + opts = {}; + } + if (!this.isValid || !otherDateTime.isValid) { + return Duration.invalid("created by diffing an invalid DateTime"); + } + var durOpts = _extends({ + locale: this.locale, + numberingSystem: this.numberingSystem + }, opts); + var units = maybeArray(unit).map(Duration.normalizeUnit), + otherIsLater = otherDateTime.valueOf() > this.valueOf(), + earlier = otherIsLater ? this : otherDateTime, + later = otherIsLater ? otherDateTime : this, + diffed = _diff(earlier, later, units, durOpts); + return otherIsLater ? diffed.negate() : diffed; + } + + /** + * Return the difference between this DateTime and right now. + * See {@link DateTime#diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */; + _proto.diffNow = function diffNow(unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + if (opts === void 0) { + opts = {}; + } + return this.diff(DateTime.now(), unit, opts); + } + + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval|DateTime} + */; + _proto.until = function until(otherDateTime) { + return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; + } + + /** + * Return whether this DateTime is in the same unit of time as another DateTime. + * Higher-order units must also be identical for this function to return `true`. + * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed. + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used + * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day + * @return {boolean} + */; + _proto.hasSame = function hasSame(otherDateTime, unit, opts) { + if (!this.isValid) return false; + var inputMs = otherDateTime.valueOf(); + var adjustedToZone = this.setZone(otherDateTime.zone, { + keepLocalTime: true + }); + return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts); + } + + /** + * Equality check + * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */; + _proto.equals = function equals(other) { + return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc); + } + + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {string} [options.rounding="trunc"] - rounding method to use when rounding the numbers in the output. Can be "trunc" (toward zero), "expand" (away from zero), "round", "floor", or "ceil". + * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.now().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.now().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */; + _proto.toRelative = function toRelative(options) { + if (options === void 0) { + options = {}; + } + if (!this.isValid) return null; + var base = options.base || DateTime.fromObject({}, { + zone: this.zone + }), + padding = options.padding ? this < base ? -options.padding : options.padding : 0; + var units = ["years", "months", "days", "hours", "minutes", "seconds"]; + var unit = options.unit; + if (Array.isArray(options.unit)) { + units = options.unit; + unit = undefined; + } + return diffRelative(base, this.plus(padding), _extends({}, options, { + numeric: "always", + units: units, + unit: unit + })); + } + + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.now().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */; + _proto.toRelativeCalendar = function toRelativeCalendar(options) { + if (options === void 0) { + options = {}; + } + if (!this.isValid) return null; + return diffRelative(options.base || DateTime.fromObject({}, { + zone: this.zone + }), this, _extends({}, options, { + numeric: "auto", + units: ["years", "months", "days"], + calendary: true + })); + } + + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */; + DateTime.min = function min() { + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("min requires all arguments be DateTimes"); + } + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.min); + } + + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */; + DateTime.max = function max() { + for (var _len2 = arguments.length, dateTimes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + dateTimes[_key2] = arguments[_key2]; + } + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("max requires all arguments be DateTimes"); + } + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.max); + } + + // MISC + + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */; + DateTime.fromFormatExplain = function fromFormatExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + var _options = options, + _options$locale = _options.locale, + locale = _options$locale === void 0 ? null : _options$locale, + _options$numberingSys = _options.numberingSystem, + numberingSystem = _options$numberingSys === void 0 ? null : _options$numberingSys, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + return explainFromTokens(localeToUse, text, fmt); + } + + /** + * @deprecated use fromFormatExplain instead + */; + DateTime.fromStringExplain = function fromStringExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + return DateTime.fromFormatExplain(text, fmt, options); + } + + /** + * Build a parser for `fmt` using the given locale. This parser can be passed + * to {@link DateTime.fromFormatParser} to a parse a date in this format. This + * can be used to optimize cases where many dates need to be parsed in a + * specific format. + * + * @param {String} fmt - the format the string is expected to be in (see + * description) + * @param {Object} options - options used to set locale and numberingSystem + * for parser + * @returns {TokenParser} - opaque object to be used + */; + DateTime.buildFormatParser = function buildFormatParser(fmt, options) { + if (options === void 0) { + options = {}; + } + var _options2 = options, + _options2$locale = _options2.locale, + locale = _options2$locale === void 0 ? null : _options2$locale, + _options2$numberingSy = _options2.numberingSystem, + numberingSystem = _options2$numberingSy === void 0 ? null : _options2$numberingSy, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + return new TokenParser(localeToUse, fmt); + } + + /** + * Create a DateTime from an input string and format parser. + * + * The format parser must have been created with the same locale as this call. + * + * @param {String} text - the string to parse + * @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser} + * @param {Object} opts - options taken by fromFormat() + * @returns {DateTime} + */; + DateTime.fromFormatParser = function fromFormatParser(text, formatParser, opts) { + if (opts === void 0) { + opts = {}; + } + if (isUndefined(text) || isUndefined(formatParser)) { + throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser"); + } + var _opts2 = opts, + _opts2$locale = _opts2.locale, + locale = _opts2$locale === void 0 ? null : _opts2$locale, + _opts2$numberingSyste = _opts2.numberingSystem, + numberingSystem = _opts2$numberingSyste === void 0 ? null : _opts2$numberingSyste, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + if (!localeToUse.equals(formatParser.locale)) { + throw new InvalidArgumentError("fromFormatParser called with a locale of " + localeToUse + ", " + ("but the format parser was created for " + formatParser.locale)); + } + var _formatParser$explain = formatParser.explainFromTokens(text), + result = _formatParser$explain.result, + zone = _formatParser$explain.zone, + specificOffset = _formatParser$explain.specificOffset, + invalidReason = _formatParser$explain.invalidReason; + if (invalidReason) { + return DateTime.invalid(invalidReason); + } else { + return parseDataToDateTime(result, zone, opts, "format " + formatParser.format, text, specificOffset); + } + } + + // FORMAT PRESETS + + /** + * {@link DateTime#toLocaleString} format like 10/14/1983 + * @type {Object} + */; + _createClass(DateTime, [{ + key: "isValid", + get: function get() { + return this.invalid === null; + } + + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + }, { + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + }, { + key: "outputCalendar", + get: function get() { + return this.isValid ? this.loc.outputCalendar : null; + } + + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + }, { + key: "zone", + get: function get() { + return this._zone; + } + + /** + * Get the name of the time zone. + * @type {string} + */ + }, { + key: "zoneName", + get: function get() { + return this.isValid ? this.zone.name : null; + } + + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + }, { + key: "year", + get: function get() { + return this.isValid ? this.c.year : NaN; + } + + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + }, { + key: "quarter", + get: function get() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + }, { + key: "month", + get: function get() { + return this.isValid ? this.c.month : NaN; + } + + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + }, { + key: "day", + get: function get() { + return this.isValid ? this.c.day : NaN; + } + + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + }, { + key: "hour", + get: function get() { + return this.isValid ? this.c.hour : NaN; + } + + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + }, { + key: "minute", + get: function get() { + return this.isValid ? this.c.minute : NaN; + } + + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + }, { + key: "second", + get: function get() { + return this.isValid ? this.c.second : NaN; + } + + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + }, { + key: "millisecond", + get: function get() { + return this.isValid ? this.c.millisecond : NaN; + } + + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 12, 31).weekYear //=> 2015 + * @type {number} + */ + }, { + key: "weekYear", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; + } + + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + }, { + key: "weekNumber", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; + } + + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + }, { + key: "weekday", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; + } + + /** + * Returns true if this date is on a weekend according to the locale, false otherwise + * @returns {boolean} + */ + }, { + key: "isWeekend", + get: function get() { + return this.isValid && this.loc.getWeekendDays().includes(this.weekday); + } + + /** + * Get the day of the week according to the locale. + * 1 is the first day of the week and 7 is the last day of the week. + * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1, + * @returns {number} + */ + }, { + key: "localWeekday", + get: function get() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN; + } + + /** + * Get the week number of the week year according to the locale. Different locales assign week numbers differently, + * because the week can start on different days of the week (see localWeekday) and because a different number of days + * is required for a week to count as the first week of a year. + * @returns {number} + */ + }, { + key: "localWeekNumber", + get: function get() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN; + } + + /** + * Get the week year according to the locale. Different locales assign week numbers (and therefor week years) + * differently, see localWeekNumber. + * @returns {number} + */ + }, { + key: "localWeekYear", + get: function get() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN; + } + + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + }, { + key: "ordinal", + get: function get() { + return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; + } + + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + }, { + key: "monthShort", + get: function get() { + return this.isValid ? Info.months("short", { + locObj: this.loc + })[this.month - 1] : null; + } + + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + }, { + key: "monthLong", + get: function get() { + return this.isValid ? Info.months("long", { + locObj: this.loc + })[this.month - 1] : null; + } + + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + }, { + key: "weekdayShort", + get: function get() { + return this.isValid ? Info.weekdays("short", { + locObj: this.loc + })[this.weekday - 1] : null; + } + + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + }, { + key: "weekdayLong", + get: function get() { + return this.isValid ? Info.weekdays("long", { + locObj: this.loc + })[this.weekday - 1] : null; + } + + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.now().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + }, { + key: "offset", + get: function get() { + return this.isValid ? +this.o : NaN; + } + + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + }, { + key: "offsetNameShort", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale + }); + } else { + return null; + } + } + + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + }, { + key: "offsetNameLong", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale + }); + } else { + return null; + } + } + + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + }, { + key: "isOffsetFixed", + get: function get() { + return this.isValid ? this.zone.isUniversal : null; + } + + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + }, { + key: "isInDST", + get: function get() { + if (this.isOffsetFixed) { + return false; + } else { + return this.offset > this.set({ + month: 1, + day: 1 + }).offset || this.offset > this.set({ + month: 5 + }).offset; + } + } + }, { + key: "isInLeapYear", + get: function get() { + return isLeapYear(this.year); + } + + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + }, { + key: "daysInMonth", + get: function get() { + return daysInMonth(this.year, this.month); + } + + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + }, { + key: "daysInYear", + get: function get() { + return this.isValid ? daysInYear(this.year) : NaN; + } + + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + }, { + key: "weeksInWeekYear", + get: function get() { + return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; + } + + /** + * Returns the number of weeks in this DateTime's local week year + * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52 + * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53 + * @type {number} + */ + }, { + key: "weeksInLocalWeekYear", + get: function get() { + return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN; + } + }], [{ + key: "DATE_SHORT", + get: function get() { + return DATE_SHORT; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_MED", + get: function get() { + return DATE_MED; + } + + /** + * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_MED_WITH_WEEKDAY", + get: function get() { + return DATE_MED_WITH_WEEKDAY; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_FULL", + get: function get() { + return DATE_FULL; + } + + /** + * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_HUGE", + get: function get() { + return DATE_HUGE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_SIMPLE", + get: function get() { + return TIME_SIMPLE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_WITH_SECONDS", + get: function get() { + return TIME_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_WITH_SHORT_OFFSET", + get: function get() { + return TIME_WITH_SHORT_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_WITH_LONG_OFFSET", + get: function get() { + return TIME_WITH_LONG_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_SIMPLE", + get: function get() { + return TIME_24_SIMPLE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_WITH_SECONDS", + get: function get() { + return TIME_24_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_WITH_SHORT_OFFSET", + get: function get() { + return TIME_24_WITH_SHORT_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_WITH_LONG_OFFSET", + get: function get() { + return TIME_24_WITH_LONG_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_SHORT", + get: function get() { + return DATETIME_SHORT; + } + + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_SHORT_WITH_SECONDS", + get: function get() { + return DATETIME_SHORT_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_MED", + get: function get() { + return DATETIME_MED; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_MED_WITH_SECONDS", + get: function get() { + return DATETIME_MED_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_MED_WITH_WEEKDAY", + get: function get() { + return DATETIME_MED_WITH_WEEKDAY; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_FULL", + get: function get() { + return DATETIME_FULL; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_FULL_WITH_SECONDS", + get: function get() { + return DATETIME_FULL_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_HUGE", + get: function get() { + return DATETIME_HUGE; + } + + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_HUGE_WITH_SECONDS", + get: function get() { + return DATETIME_HUGE_WITH_SECONDS; + } + }]); + return DateTime; + }(Symbol.for("nodejs.util.inspect.custom")); + function friendlyDateTime(dateTimeish) { + if (DateTime.isDateTime(dateTimeish)) { + return dateTimeish; + } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) { + return DateTime.fromJSDate(dateTimeish); + } else if (dateTimeish && typeof dateTimeish === "object") { + return DateTime.fromObject(dateTimeish); + } else { + throw new InvalidArgumentError("Unknown datetime argument: " + dateTimeish + ", of type " + typeof dateTimeish); + } + } + + var VERSION = "3.7.2"; + + exports.DateTime = DateTime; + exports.Duration = Duration; + exports.FixedOffsetZone = FixedOffsetZone; + exports.IANAZone = IANAZone; + exports.Info = Info; + exports.Interval = Interval; + exports.InvalidZone = InvalidZone; + exports.Settings = Settings; + exports.SystemZone = SystemZone; + exports.VERSION = VERSION; + exports.Zone = Zone; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=luxon.js.map diff --git a/node_modules/luxon/build/amd/luxon.js.map b/node_modules/luxon/build/amd/luxon.js.map new file mode 100644 index 00000000..30cf2260 --- /dev/null +++ b/node_modules/luxon/build/amd/luxon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"luxon.js","sources":["../../src/errors.js","../../src/impl/formats.js","../../src/zone.js","../../src/zones/systemZone.js","../../src/zones/IANAZone.js","../../src/impl/locale.js","../../src/zones/fixedOffsetZone.js","../../src/zones/invalidZone.js","../../src/impl/zoneUtil.js","../../src/impl/digits.js","../../src/settings.js","../../src/impl/invalid.js","../../src/impl/conversions.js","../../src/impl/util.js","../../src/impl/english.js","../../src/impl/formatter.js","../../src/impl/regexParser.js","../../src/duration.js","../../src/interval.js","../../src/info.js","../../src/impl/diff.js","../../src/impl/tokenParser.js","../../src/datetime.js","../../src/luxon.js"],"sourcesContent":["// these aren't really private, but nor are they really useful to document\n\n/**\n * @private\n */\nclass LuxonError extends Error {}\n\n/**\n * @private\n */\nexport class InvalidDateTimeError extends LuxonError {\n constructor(reason) {\n super(`Invalid DateTime: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidIntervalError extends LuxonError {\n constructor(reason) {\n super(`Invalid Interval: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidDurationError extends LuxonError {\n constructor(reason) {\n super(`Invalid Duration: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class ConflictingSpecificationError extends LuxonError {}\n\n/**\n * @private\n */\nexport class InvalidUnitError extends LuxonError {\n constructor(unit) {\n super(`Invalid unit ${unit}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidArgumentError extends LuxonError {}\n\n/**\n * @private\n */\nexport class ZoneIsAbstractError extends LuxonError {\n constructor() {\n super(\"Zone is an abstract class\");\n }\n}\n","/**\n * @private\n */\n\nconst n = \"numeric\",\n s = \"short\",\n l = \"long\";\n\nexport const DATE_SHORT = {\n year: n,\n month: n,\n day: n,\n};\n\nexport const DATE_MED = {\n year: n,\n month: s,\n day: n,\n};\n\nexport const DATE_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n};\n\nexport const DATE_FULL = {\n year: n,\n month: l,\n day: n,\n};\n\nexport const DATE_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n};\n\nexport const TIME_SIMPLE = {\n hour: n,\n minute: n,\n};\n\nexport const TIME_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const TIME_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const TIME_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n\nexport const TIME_24_SIMPLE = {\n hour: n,\n minute: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: s,\n};\n\nexport const TIME_24_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: l,\n};\n\nexport const DATETIME_SHORT = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_SHORT_WITH_SECONDS = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_MED_WITH_SECONDS = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_FULL = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_FULL_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n timeZoneName: l,\n};\n\nexport const DATETIME_HUGE_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n","import { ZoneIsAbstractError } from \"./errors.js\";\n\n/**\n * @interface\n */\nexport default class Zone {\n /**\n * The type of zone\n * @abstract\n * @type {string}\n */\n get type() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The name of this zone.\n * @abstract\n * @type {string}\n */\n get name() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The IANA name of this zone.\n * Defaults to `name` if not overwritten by a subclass.\n * @abstract\n * @type {string}\n */\n get ianaName() {\n return this.name;\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @type {boolean}\n */\n get isUniversal() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, opts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's value as a string\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is valid.\n * @abstract\n * @type {boolean}\n */\n get isValid() {\n throw new ZoneIsAbstractError();\n }\n}\n","import { formatOffset, parseZoneInfo } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * Represents the local zone for this JavaScript environment.\n * @implements {Zone}\n */\nexport default class SystemZone extends Zone {\n /**\n * Get a singleton instance of the local zone\n * @return {SystemZone}\n */\n static get instance() {\n if (singleton === null) {\n singleton = new SystemZone();\n }\n return singleton;\n }\n\n /** @override **/\n get type() {\n return \"system\";\n }\n\n /** @override **/\n get name() {\n return new Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n return -new Date(ts).getTimezoneOffset();\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"system\";\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import { formatOffset, parseZoneInfo, isUndefined, objToLocalTS } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nconst dtfCache = new Map();\nfunction makeDTF(zoneName) {\n let dtf = dtfCache.get(zoneName);\n if (dtf === undefined) {\n dtf = new Intl.DateTimeFormat(\"en-US\", {\n hour12: false,\n timeZone: zoneName,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n era: \"short\",\n });\n dtfCache.set(zoneName, dtf);\n }\n return dtf;\n}\n\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n era: 3,\n hour: 4,\n minute: 5,\n second: 6,\n};\n\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, \"\"),\n parsed = /(\\d+)\\/(\\d+)\\/(\\d+) (AD|BC),? (\\d+):(\\d+):(\\d+)/.exec(formatted),\n [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;\n return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];\n}\n\nfunction partsOffset(dtf, date) {\n const formatted = dtf.formatToParts(date);\n const filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const { type, value } = formatted[i];\n const pos = typeToPos[type];\n\n if (type === \"era\") {\n filled[pos] = value;\n } else if (!isUndefined(pos)) {\n filled[pos] = parseInt(value, 10);\n }\n }\n return filled;\n}\n\nconst ianaZoneCache = new Map();\n/**\n * A zone identified by an IANA identifier, like America/New_York\n * @implements {Zone}\n */\nexport default class IANAZone extends Zone {\n /**\n * @param {string} name - Zone name\n * @return {IANAZone}\n */\n static create(name) {\n let zone = ianaZoneCache.get(name);\n if (zone === undefined) {\n ianaZoneCache.set(name, (zone = new IANAZone(name)));\n }\n return zone;\n }\n\n /**\n * Reset local caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCache() {\n ianaZoneCache.clear();\n dtfCache.clear();\n }\n\n /**\n * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.\n * @param {string} s - The string to check validity on\n * @example IANAZone.isValidSpecifier(\"America/New_York\") //=> true\n * @example IANAZone.isValidSpecifier(\"Sport~~blorp\") //=> false\n * @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead.\n * @return {boolean}\n */\n static isValidSpecifier(s) {\n return this.isValidZone(s);\n }\n\n /**\n * Returns whether the provided string identifies a real zone\n * @param {string} zone - The string to check\n * @example IANAZone.isValidZone(\"America/New_York\") //=> true\n * @example IANAZone.isValidZone(\"Fantasia/Castle\") //=> false\n * @example IANAZone.isValidZone(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidZone(zone) {\n if (!zone) {\n return false;\n }\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: zone }).format();\n return true;\n } catch (e) {\n return false;\n }\n }\n\n constructor(name) {\n super();\n /** @private **/\n this.zoneName = name;\n /** @private **/\n this.valid = IANAZone.isValidZone(name);\n }\n\n /**\n * The type of zone. `iana` for all instances of `IANAZone`.\n * @override\n * @type {string}\n */\n get type() {\n return \"iana\";\n }\n\n /**\n * The name of this zone (i.e. the IANA zone name).\n * @override\n * @type {string}\n */\n get name() {\n return this.zoneName;\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year:\n * Always returns false for all IANA zones.\n * @override\n * @type {boolean}\n */\n get isUniversal() {\n return false;\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale, this.name);\n }\n\n /**\n * Returns the offset's value as a string\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @override\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n if (!this.valid) return NaN;\n const date = new Date(ts);\n\n if (isNaN(date)) return NaN;\n\n const dtf = makeDTF(this.name);\n let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts\n ? partsOffset(dtf, date)\n : hackyOffset(dtf, date);\n\n if (adOrBc === \"BC\") {\n year = -Math.abs(year) + 1;\n }\n\n // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat\n const adjustedHour = hour === 24 ? 0 : hour;\n\n const asUTC = objToLocalTS({\n year,\n month,\n day,\n hour: adjustedHour,\n minute,\n second,\n millisecond: 0,\n });\n\n let asTS = +date;\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return (asUTC - asTS) / (60 * 1000);\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @override\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n return otherZone.type === \"iana\" && otherZone.name === this.name;\n }\n\n /**\n * Return whether this Zone is valid.\n * @override\n * @type {boolean}\n */\n get isValid() {\n return this.valid;\n }\n}\n","import { hasLocaleWeekInfo, hasRelative, padStart, roundTo, validateWeekSettings } from \"./util.js\";\nimport * as English from \"./english.js\";\nimport Settings from \"../settings.js\";\nimport DateTime from \"../datetime.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n// todo - remap caching\n\nlet intlLFCache = {};\nfunction getCachedLF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlLFCache[key];\n if (!dtf) {\n dtf = new Intl.ListFormat(locString, opts);\n intlLFCache[key] = dtf;\n }\n return dtf;\n}\n\nconst intlDTCache = new Map();\nfunction getCachedDTF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlDTCache.get(key);\n if (dtf === undefined) {\n dtf = new Intl.DateTimeFormat(locString, opts);\n intlDTCache.set(key, dtf);\n }\n return dtf;\n}\n\nconst intlNumCache = new Map();\nfunction getCachedINF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let inf = intlNumCache.get(key);\n if (inf === undefined) {\n inf = new Intl.NumberFormat(locString, opts);\n intlNumCache.set(key, inf);\n }\n return inf;\n}\n\nconst intlRelCache = new Map();\nfunction getCachedRTF(locString, opts = {}) {\n const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options\n const key = JSON.stringify([locString, cacheKeyOpts]);\n let inf = intlRelCache.get(key);\n if (inf === undefined) {\n inf = new Intl.RelativeTimeFormat(locString, opts);\n intlRelCache.set(key, inf);\n }\n return inf;\n}\n\nlet sysLocaleCache = null;\nfunction systemLocale() {\n if (sysLocaleCache) {\n return sysLocaleCache;\n } else {\n sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;\n return sysLocaleCache;\n }\n}\n\nconst intlResolvedOptionsCache = new Map();\nfunction getCachedIntResolvedOptions(locString) {\n let opts = intlResolvedOptionsCache.get(locString);\n if (opts === undefined) {\n opts = new Intl.DateTimeFormat(locString).resolvedOptions();\n intlResolvedOptionsCache.set(locString, opts);\n }\n return opts;\n}\n\nconst weekInfoCache = new Map();\nfunction getCachedWeekInfo(locString) {\n let data = weekInfoCache.get(locString);\n if (!data) {\n const locale = new Intl.Locale(locString);\n // browsers currently implement this as a property, but spec says it should be a getter function\n data = \"getWeekInfo\" in locale ? locale.getWeekInfo() : locale.weekInfo;\n // minimalDays was removed from WeekInfo: https://github.com/tc39/proposal-intl-locale-info/issues/86\n if (!(\"minimalDays\" in data)) {\n data = { ...fallbackWeekSettings, ...data };\n }\n weekInfoCache.set(locString, data);\n }\n return data;\n}\n\nfunction parseLocaleString(localeStr) {\n // I really want to avoid writing a BCP 47 parser\n // see, e.g. https://github.com/wooorm/bcp-47\n // Instead, we'll do this:\n\n // a) if the string has no -u extensions, just leave it alone\n // b) if it does, use Intl to resolve everything\n // c) if Intl fails, try again without the -u\n\n // private subtags and unicode subtags have ordering requirements,\n // and we're not properly parsing this, so just strip out the\n // private ones if they exist.\n const xIndex = localeStr.indexOf(\"-x-\");\n if (xIndex !== -1) {\n localeStr = localeStr.substring(0, xIndex);\n }\n\n const uIndex = localeStr.indexOf(\"-u-\");\n if (uIndex === -1) {\n return [localeStr];\n } else {\n let options;\n let selectedStr;\n try {\n options = getCachedDTF(localeStr).resolvedOptions();\n selectedStr = localeStr;\n } catch (e) {\n const smaller = localeStr.substring(0, uIndex);\n options = getCachedDTF(smaller).resolvedOptions();\n selectedStr = smaller;\n }\n\n const { numberingSystem, calendar } = options;\n return [selectedStr, numberingSystem, calendar];\n }\n}\n\nfunction intlConfigString(localeStr, numberingSystem, outputCalendar) {\n if (outputCalendar || numberingSystem) {\n if (!localeStr.includes(\"-u-\")) {\n localeStr += \"-u\";\n }\n\n if (outputCalendar) {\n localeStr += `-ca-${outputCalendar}`;\n }\n\n if (numberingSystem) {\n localeStr += `-nu-${numberingSystem}`;\n }\n return localeStr;\n } else {\n return localeStr;\n }\n}\n\nfunction mapMonths(f) {\n const ms = [];\n for (let i = 1; i <= 12; i++) {\n const dt = DateTime.utc(2009, i, 1);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction mapWeekdays(f) {\n const ms = [];\n for (let i = 1; i <= 7; i++) {\n const dt = DateTime.utc(2016, 11, 13 + i);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction listStuff(loc, length, englishFn, intlFn) {\n const mode = loc.listingMode();\n\n if (mode === \"error\") {\n return null;\n } else if (mode === \"en\") {\n return englishFn(length);\n } else {\n return intlFn(length);\n }\n}\n\nfunction supportsFastNumbers(loc) {\n if (loc.numberingSystem && loc.numberingSystem !== \"latn\") {\n return false;\n } else {\n return (\n loc.numberingSystem === \"latn\" ||\n !loc.locale ||\n loc.locale.startsWith(\"en\") ||\n getCachedIntResolvedOptions(loc.locale).numberingSystem === \"latn\"\n );\n }\n}\n\n/**\n * @private\n */\n\nclass PolyNumberFormatter {\n constructor(intl, forceSimple, opts) {\n this.padTo = opts.padTo || 0;\n this.floor = opts.floor || false;\n\n const { padTo, floor, ...otherOpts } = opts;\n\n if (!forceSimple || Object.keys(otherOpts).length > 0) {\n const intlOpts = { useGrouping: false, ...opts };\n if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;\n this.inf = getCachedINF(intl, intlOpts);\n }\n }\n\n format(i) {\n if (this.inf) {\n const fixed = this.floor ? Math.floor(i) : i;\n return this.inf.format(fixed);\n } else {\n // to match the browser's numberformatter defaults\n const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);\n return padStart(fixed, this.padTo);\n }\n }\n}\n\n/**\n * @private\n */\n\nclass PolyDateFormatter {\n constructor(dt, intl, opts) {\n this.opts = opts;\n this.originalZone = undefined;\n\n let z = undefined;\n if (this.opts.timeZone) {\n // Don't apply any workarounds if a timeZone is explicitly provided in opts\n this.dt = dt;\n } else if (dt.zone.type === \"fixed\") {\n // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like.\n // That is why fixed-offset TZ is set to that unless it is:\n // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT.\n // 2. Unsupported by the browser:\n // - some do not support Etc/\n // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata\n const gmtOffset = -1 * (dt.offset / 60);\n const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;\n if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {\n z = offsetZ;\n this.dt = dt;\n } else {\n // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so\n // we manually apply the offset and substitute the zone as needed.\n z = \"UTC\";\n this.dt = dt.offset === 0 ? dt : dt.setZone(\"UTC\").plus({ minutes: dt.offset });\n this.originalZone = dt.zone;\n }\n } else if (dt.zone.type === \"system\") {\n this.dt = dt;\n } else if (dt.zone.type === \"iana\") {\n this.dt = dt;\n z = dt.zone.name;\n } else {\n // Custom zones can have any offset / offsetName so we just manually\n // apply the offset and substitute the zone as needed.\n z = \"UTC\";\n this.dt = dt.setZone(\"UTC\").plus({ minutes: dt.offset });\n this.originalZone = dt.zone;\n }\n\n const intlOpts = { ...this.opts };\n intlOpts.timeZone = intlOpts.timeZone || z;\n this.dtf = getCachedDTF(intl, intlOpts);\n }\n\n format() {\n if (this.originalZone) {\n // If we have to substitute in the actual zone name, we have to use\n // formatToParts so that the timezone can be replaced.\n return this.formatToParts()\n .map(({ value }) => value)\n .join(\"\");\n }\n return this.dtf.format(this.dt.toJSDate());\n }\n\n formatToParts() {\n const parts = this.dtf.formatToParts(this.dt.toJSDate());\n if (this.originalZone) {\n return parts.map((part) => {\n if (part.type === \"timeZoneName\") {\n const offsetName = this.originalZone.offsetName(this.dt.ts, {\n locale: this.dt.locale,\n format: this.opts.timeZoneName,\n });\n return {\n ...part,\n value: offsetName,\n };\n } else {\n return part;\n }\n });\n }\n return parts;\n }\n\n resolvedOptions() {\n return this.dtf.resolvedOptions();\n }\n}\n\n/**\n * @private\n */\nclass PolyRelFormatter {\n constructor(intl, isEnglish, opts) {\n this.opts = { style: \"long\", ...opts };\n if (!isEnglish && hasRelative()) {\n this.rtf = getCachedRTF(intl, opts);\n }\n }\n\n format(count, unit) {\n if (this.rtf) {\n return this.rtf.format(count, unit);\n } else {\n return English.formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== \"long\");\n }\n }\n\n formatToParts(count, unit) {\n if (this.rtf) {\n return this.rtf.formatToParts(count, unit);\n } else {\n return [];\n }\n }\n}\n\nconst fallbackWeekSettings = {\n firstDay: 1,\n minimalDays: 4,\n weekend: [6, 7],\n};\n\n/**\n * @private\n */\nexport default class Locale {\n static fromOpts(opts) {\n return Locale.create(\n opts.locale,\n opts.numberingSystem,\n opts.outputCalendar,\n opts.weekSettings,\n opts.defaultToEN\n );\n }\n\n static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {\n const specifiedLocale = locale || Settings.defaultLocale;\n // the system locale is useful for human-readable strings but annoying for parsing/formatting known formats\n const localeR = specifiedLocale || (defaultToEN ? \"en-US\" : systemLocale());\n const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;\n const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;\n const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;\n return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);\n }\n\n static resetCache() {\n sysLocaleCache = null;\n intlDTCache.clear();\n intlNumCache.clear();\n intlRelCache.clear();\n intlResolvedOptionsCache.clear();\n weekInfoCache.clear();\n }\n\n static fromObject({ locale, numberingSystem, outputCalendar, weekSettings } = {}) {\n return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);\n }\n\n constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {\n const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);\n\n this.locale = parsedLocale;\n this.numberingSystem = numbering || parsedNumberingSystem || null;\n this.outputCalendar = outputCalendar || parsedOutputCalendar || null;\n this.weekSettings = weekSettings;\n this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);\n\n this.weekdaysCache = { format: {}, standalone: {} };\n this.monthsCache = { format: {}, standalone: {} };\n this.meridiemCache = null;\n this.eraCache = {};\n\n this.specifiedLocale = specifiedLocale;\n this.fastNumbersCached = null;\n }\n\n get fastNumbers() {\n if (this.fastNumbersCached == null) {\n this.fastNumbersCached = supportsFastNumbers(this);\n }\n\n return this.fastNumbersCached;\n }\n\n listingMode() {\n const isActuallyEn = this.isEnglish();\n const hasNoWeirdness =\n (this.numberingSystem === null || this.numberingSystem === \"latn\") &&\n (this.outputCalendar === null || this.outputCalendar === \"gregory\");\n return isActuallyEn && hasNoWeirdness ? \"en\" : \"intl\";\n }\n\n clone(alts) {\n if (!alts || Object.getOwnPropertyNames(alts).length === 0) {\n return this;\n } else {\n return Locale.create(\n alts.locale || this.specifiedLocale,\n alts.numberingSystem || this.numberingSystem,\n alts.outputCalendar || this.outputCalendar,\n validateWeekSettings(alts.weekSettings) || this.weekSettings,\n alts.defaultToEN || false\n );\n }\n }\n\n redefaultToEN(alts = {}) {\n return this.clone({ ...alts, defaultToEN: true });\n }\n\n redefaultToSystem(alts = {}) {\n return this.clone({ ...alts, defaultToEN: false });\n }\n\n months(length, format = false) {\n return listStuff(this, length, English.months, () => {\n // Workaround for \"ja\" locale: formatToParts does not label all parts of the month\n // as \"month\" and for this locale there is no difference between \"format\" and \"non-format\".\n // As such, just use format() instead of formatToParts() and take the whole string\n const monthSpecialCase = this.intl === \"ja\" || this.intl.startsWith(\"ja-\");\n format &= !monthSpecialCase;\n const intl = format ? { month: length, day: \"numeric\" } : { month: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.monthsCache[formatStr][length]) {\n const mapper = !monthSpecialCase\n ? (dt) => this.extract(dt, intl, \"month\")\n : (dt) => this.dtFormatter(dt, intl).format();\n this.monthsCache[formatStr][length] = mapMonths(mapper);\n }\n return this.monthsCache[formatStr][length];\n });\n }\n\n weekdays(length, format = false) {\n return listStuff(this, length, English.weekdays, () => {\n const intl = format\n ? { weekday: length, year: \"numeric\", month: \"long\", day: \"numeric\" }\n : { weekday: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.weekdaysCache[formatStr][length]) {\n this.weekdaysCache[formatStr][length] = mapWeekdays((dt) =>\n this.extract(dt, intl, \"weekday\")\n );\n }\n return this.weekdaysCache[formatStr][length];\n });\n }\n\n meridiems() {\n return listStuff(\n this,\n undefined,\n () => English.meridiems,\n () => {\n // In theory there could be aribitrary day periods. We're gonna assume there are exactly two\n // for AM and PM. This is probably wrong, but it's makes parsing way easier.\n if (!this.meridiemCache) {\n const intl = { hour: \"numeric\", hourCycle: \"h12\" };\n this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(\n (dt) => this.extract(dt, intl, \"dayperiod\")\n );\n }\n\n return this.meridiemCache;\n }\n );\n }\n\n eras(length) {\n return listStuff(this, length, English.eras, () => {\n const intl = { era: length };\n\n // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates\n // to definitely enumerate them.\n if (!this.eraCache[length]) {\n this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map((dt) =>\n this.extract(dt, intl, \"era\")\n );\n }\n\n return this.eraCache[length];\n });\n }\n\n extract(dt, intlOpts, field) {\n const df = this.dtFormatter(dt, intlOpts),\n results = df.formatToParts(),\n matching = results.find((m) => m.type.toLowerCase() === field);\n return matching ? matching.value : null;\n }\n\n numberFormatter(opts = {}) {\n // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave)\n // (in contrast, the rest of the condition is used heavily)\n return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);\n }\n\n dtFormatter(dt, intlOpts = {}) {\n return new PolyDateFormatter(dt, this.intl, intlOpts);\n }\n\n relFormatter(opts = {}) {\n return new PolyRelFormatter(this.intl, this.isEnglish(), opts);\n }\n\n listFormatter(opts = {}) {\n return getCachedLF(this.intl, opts);\n }\n\n isEnglish() {\n return (\n this.locale === \"en\" ||\n this.locale.toLowerCase() === \"en-us\" ||\n getCachedIntResolvedOptions(this.intl).locale.startsWith(\"en-us\")\n );\n }\n\n getWeekSettings() {\n if (this.weekSettings) {\n return this.weekSettings;\n } else if (!hasLocaleWeekInfo()) {\n return fallbackWeekSettings;\n } else {\n return getCachedWeekInfo(this.locale);\n }\n }\n\n getStartOfWeek() {\n return this.getWeekSettings().firstDay;\n }\n\n getMinDaysInFirstWeek() {\n return this.getWeekSettings().minimalDays;\n }\n\n getWeekendDays() {\n return this.getWeekSettings().weekend;\n }\n\n equals(other) {\n return (\n this.locale === other.locale &&\n this.numberingSystem === other.numberingSystem &&\n this.outputCalendar === other.outputCalendar\n );\n }\n\n toString() {\n return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;\n }\n}\n","import { formatOffset, signedOffset } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * A zone with a fixed offset (meaning no DST)\n * @implements {Zone}\n */\nexport default class FixedOffsetZone extends Zone {\n /**\n * Get a singleton instance of UTC\n * @return {FixedOffsetZone}\n */\n static get utcInstance() {\n if (singleton === null) {\n singleton = new FixedOffsetZone(0);\n }\n return singleton;\n }\n\n /**\n * Get an instance with a specified offset\n * @param {number} offset - The offset in minutes\n * @return {FixedOffsetZone}\n */\n static instance(offset) {\n return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);\n }\n\n /**\n * Get an instance of FixedOffsetZone from a UTC offset string, like \"UTC+6\"\n * @param {string} s - The offset string to parse\n * @example FixedOffsetZone.parseSpecifier(\"UTC+6\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC+06\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC-6:00\")\n * @return {FixedOffsetZone}\n */\n static parseSpecifier(s) {\n if (s) {\n const r = s.match(/^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$/i);\n if (r) {\n return new FixedOffsetZone(signedOffset(r[1], r[2]));\n }\n }\n return null;\n }\n\n constructor(offset) {\n super();\n /** @private **/\n this.fixed = offset;\n }\n\n /**\n * The type of zone. `fixed` for all instances of `FixedOffsetZone`.\n * @override\n * @type {string}\n */\n get type() {\n return \"fixed\";\n }\n\n /**\n * The name of this zone.\n * All fixed zones' names always start with \"UTC\" (plus optional offset)\n * @override\n * @type {string}\n */\n get name() {\n return this.fixed === 0 ? \"UTC\" : `UTC${formatOffset(this.fixed, \"narrow\")}`;\n }\n\n /**\n * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`\n *\n * @override\n * @type {string}\n */\n get ianaName() {\n if (this.fixed === 0) {\n return \"Etc/UTC\";\n } else {\n return `Etc/GMT${formatOffset(-this.fixed, \"narrow\")}`;\n }\n }\n\n /**\n * Returns the offset's common name at the specified timestamp.\n *\n * For fixed offset zones this equals to the zone name.\n * @override\n */\n offsetName() {\n return this.name;\n }\n\n /**\n * Returns the offset's value as a string\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n return formatOffset(this.fixed, format);\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year:\n * Always returns true for all fixed offset zones.\n * @override\n * @type {boolean}\n */\n get isUniversal() {\n return true;\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n *\n * For fixed offset zones, this is constant and does not depend on a timestamp.\n * @override\n * @return {number}\n */\n offset() {\n return this.fixed;\n }\n\n /**\n * Return whether this Zone is equal to another zone (i.e. also fixed and same offset)\n * @override\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n return otherZone.type === \"fixed\" && otherZone.fixed === this.fixed;\n }\n\n /**\n * Return whether this Zone is valid:\n * All fixed offset zones are valid.\n * @override\n * @type {boolean}\n */\n get isValid() {\n return true;\n }\n}\n","import Zone from \"../zone.js\";\n\n/**\n * A zone that failed to parse. You should never need to instantiate this.\n * @implements {Zone}\n */\nexport default class InvalidZone extends Zone {\n constructor(zoneName) {\n super();\n /** @private */\n this.zoneName = zoneName;\n }\n\n /** @override **/\n get type() {\n return \"invalid\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName() {\n return null;\n }\n\n /** @override **/\n formatOffset() {\n return \"\";\n }\n\n /** @override **/\n offset() {\n return NaN;\n }\n\n /** @override **/\n equals() {\n return false;\n }\n\n /** @override **/\n get isValid() {\n return false;\n }\n}\n","/**\n * @private\n */\n\nimport Zone from \"../zone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport InvalidZone from \"../zones/invalidZone.js\";\n\nimport { isUndefined, isString, isNumber } from \"./util.js\";\nimport SystemZone from \"../zones/systemZone.js\";\n\nexport function normalizeZone(input, defaultZone) {\n let offset;\n if (isUndefined(input) || input === null) {\n return defaultZone;\n } else if (input instanceof Zone) {\n return input;\n } else if (isString(input)) {\n const lowered = input.toLowerCase();\n if (lowered === \"default\") return defaultZone;\n else if (lowered === \"local\" || lowered === \"system\") return SystemZone.instance;\n else if (lowered === \"utc\" || lowered === \"gmt\") return FixedOffsetZone.utcInstance;\n else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);\n } else if (isNumber(input)) {\n return FixedOffsetZone.instance(input);\n } else if (typeof input === \"object\" && \"offset\" in input && typeof input.offset === \"function\") {\n // This is dumb, but the instanceof check above doesn't seem to really work\n // so we're duck checking it\n return input;\n } else {\n return new InvalidZone(input);\n }\n}\n","const numberingSystems = {\n arab: \"[\\u0660-\\u0669]\",\n arabext: \"[\\u06F0-\\u06F9]\",\n bali: \"[\\u1B50-\\u1B59]\",\n beng: \"[\\u09E6-\\u09EF]\",\n deva: \"[\\u0966-\\u096F]\",\n fullwide: \"[\\uFF10-\\uFF19]\",\n gujr: \"[\\u0AE6-\\u0AEF]\",\n hanidec: \"[〇|一|二|三|四|五|六|七|八|九]\",\n khmr: \"[\\u17E0-\\u17E9]\",\n knda: \"[\\u0CE6-\\u0CEF]\",\n laoo: \"[\\u0ED0-\\u0ED9]\",\n limb: \"[\\u1946-\\u194F]\",\n mlym: \"[\\u0D66-\\u0D6F]\",\n mong: \"[\\u1810-\\u1819]\",\n mymr: \"[\\u1040-\\u1049]\",\n orya: \"[\\u0B66-\\u0B6F]\",\n tamldec: \"[\\u0BE6-\\u0BEF]\",\n telu: \"[\\u0C66-\\u0C6F]\",\n thai: \"[\\u0E50-\\u0E59]\",\n tibt: \"[\\u0F20-\\u0F29]\",\n latn: \"\\\\d\",\n};\n\nconst numberingSystemsUTF16 = {\n arab: [1632, 1641],\n arabext: [1776, 1785],\n bali: [6992, 7001],\n beng: [2534, 2543],\n deva: [2406, 2415],\n fullwide: [65296, 65303],\n gujr: [2790, 2799],\n khmr: [6112, 6121],\n knda: [3302, 3311],\n laoo: [3792, 3801],\n limb: [6470, 6479],\n mlym: [3430, 3439],\n mong: [6160, 6169],\n mymr: [4160, 4169],\n orya: [2918, 2927],\n tamldec: [3046, 3055],\n telu: [3174, 3183],\n thai: [3664, 3673],\n tibt: [3872, 3881],\n};\n\nconst hanidecChars = numberingSystems.hanidec.replace(/[\\[|\\]]/g, \"\").split(\"\");\n\nexport function parseDigits(str) {\n let value = parseInt(str, 10);\n if (isNaN(value)) {\n value = \"\";\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (str[i].search(numberingSystems.hanidec) !== -1) {\n value += hanidecChars.indexOf(str[i]);\n } else {\n for (const key in numberingSystemsUTF16) {\n const [min, max] = numberingSystemsUTF16[key];\n if (code >= min && code <= max) {\n value += code - min;\n }\n }\n }\n }\n return parseInt(value, 10);\n } else {\n return value;\n }\n}\n\n// cache of {numberingSystem: {append: regex}}\nconst digitRegexCache = new Map();\nexport function resetDigitRegexCache() {\n digitRegexCache.clear();\n}\n\nexport function digitRegex({ numberingSystem }, append = \"\") {\n const ns = numberingSystem || \"latn\";\n\n let appendCache = digitRegexCache.get(ns);\n if (appendCache === undefined) {\n appendCache = new Map();\n digitRegexCache.set(ns, appendCache);\n }\n let regex = appendCache.get(append);\n if (regex === undefined) {\n regex = new RegExp(`${numberingSystems[ns]}${append}`);\n appendCache.set(append, regex);\n }\n\n return regex;\n}\n","import SystemZone from \"./zones/systemZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport DateTime from \"./datetime.js\";\n\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport { validateWeekSettings } from \"./impl/util.js\";\nimport { resetDigitRegexCache } from \"./impl/digits.js\";\n\nlet now = () => Date.now(),\n defaultZone = \"system\",\n defaultLocale = null,\n defaultNumberingSystem = null,\n defaultOutputCalendar = null,\n twoDigitCutoffYear = 60,\n throwOnInvalid,\n defaultWeekSettings = null;\n\n/**\n * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.\n */\nexport default class Settings {\n /**\n * Get the callback for returning the current timestamp.\n * @type {function}\n */\n static get now() {\n return now;\n }\n\n /**\n * Set the callback for returning the current timestamp.\n * The function should return a number, which will be interpreted as an Epoch millisecond count\n * @type {function}\n * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future\n * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time\n */\n static set now(n) {\n now = n;\n }\n\n /**\n * Set the default time zone to create DateTimes in. Does not affect existing instances.\n * Use the value \"system\" to reset this value to the system's time zone.\n * @type {string}\n */\n static set defaultZone(zone) {\n defaultZone = zone;\n }\n\n /**\n * Get the default time zone object currently used to create DateTimes. Does not affect existing instances.\n * The default value is the system's time zone (the one set on the machine that runs this code).\n * @type {Zone}\n */\n static get defaultZone() {\n return normalizeZone(defaultZone, SystemZone.instance);\n }\n\n /**\n * Get the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultLocale() {\n return defaultLocale;\n }\n\n /**\n * Set the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultLocale(locale) {\n defaultLocale = locale;\n }\n\n /**\n * Get the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultNumberingSystem() {\n return defaultNumberingSystem;\n }\n\n /**\n * Set the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultNumberingSystem(numberingSystem) {\n defaultNumberingSystem = numberingSystem;\n }\n\n /**\n * Get the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultOutputCalendar() {\n return defaultOutputCalendar;\n }\n\n /**\n * Set the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultOutputCalendar(outputCalendar) {\n defaultOutputCalendar = outputCalendar;\n }\n\n /**\n * @typedef {Object} WeekSettings\n * @property {number} firstDay\n * @property {number} minimalDays\n * @property {number[]} weekend\n */\n\n /**\n * @return {WeekSettings|null}\n */\n static get defaultWeekSettings() {\n return defaultWeekSettings;\n }\n\n /**\n * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and\n * how many days are required in the first week of a year.\n * Does not affect existing instances.\n *\n * @param {WeekSettings|null} weekSettings\n */\n static set defaultWeekSettings(weekSettings) {\n defaultWeekSettings = validateWeekSettings(weekSettings);\n }\n\n /**\n * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.\n * @type {number}\n */\n static get twoDigitCutoffYear() {\n return twoDigitCutoffYear;\n }\n\n /**\n * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.\n * @type {number}\n * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century\n * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century\n * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950\n * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50\n * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50\n */\n static set twoDigitCutoffYear(cutoffYear) {\n twoDigitCutoffYear = cutoffYear % 100;\n }\n\n /**\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static get throwOnInvalid() {\n return throwOnInvalid;\n }\n\n /**\n * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static set throwOnInvalid(t) {\n throwOnInvalid = t;\n }\n\n /**\n * Reset Luxon's global caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCaches() {\n Locale.resetCache();\n IANAZone.resetCache();\n DateTime.resetCache();\n resetDigitRegexCache();\n }\n}\n","export default class Invalid {\n constructor(reason, explanation) {\n this.reason = reason;\n this.explanation = explanation;\n }\n\n toMessage() {\n if (this.explanation) {\n return `${this.reason}: ${this.explanation}`;\n } else {\n return this.reason;\n }\n }\n}\n","import {\n integerBetween,\n isLeapYear,\n timeObject,\n daysInYear,\n daysInMonth,\n weeksInWeekYear,\n isInteger,\n isUndefined,\n} from \"./util.js\";\nimport Invalid from \"./invalid.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],\n leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];\n\nfunction unitOutOfRange(unit, value) {\n return new Invalid(\n \"unit out of range\",\n `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`\n );\n}\n\nexport function dayOfWeek(year, month, day) {\n const d = new Date(Date.UTC(year, month - 1, day));\n\n if (year < 100 && year >= 0) {\n d.setUTCFullYear(d.getUTCFullYear() - 1900);\n }\n\n const js = d.getUTCDay();\n\n return js === 0 ? 7 : js;\n}\n\nfunction computeOrdinal(year, month, day) {\n return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];\n}\n\nfunction uncomputeOrdinal(year, ordinal) {\n const table = isLeapYear(year) ? leapLadder : nonLeapLadder,\n month0 = table.findIndex((i) => i < ordinal),\n day = ordinal - table[month0];\n return { month: month0 + 1, day };\n}\n\nexport function isoWeekdayToLocal(isoWeekday, startOfWeek) {\n return ((isoWeekday - startOfWeek + 7) % 7) + 1;\n}\n\n/**\n * @private\n */\n\nexport function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const { year, month, day } = gregObj,\n ordinal = computeOrdinal(year, month, day),\n weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);\n\n let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7),\n weekYear;\n\n if (weekNumber < 1) {\n weekYear = year - 1;\n weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);\n } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {\n weekYear = year + 1;\n weekNumber = 1;\n } else {\n weekYear = year;\n }\n\n return { weekYear, weekNumber, weekday, ...timeObject(gregObj) };\n}\n\nexport function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const { weekYear, weekNumber, weekday } = weekData,\n weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek),\n yearInDays = daysInYear(weekYear);\n\n let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek,\n year;\n\n if (ordinal < 1) {\n year = weekYear - 1;\n ordinal += daysInYear(year);\n } else if (ordinal > yearInDays) {\n year = weekYear + 1;\n ordinal -= daysInYear(weekYear);\n } else {\n year = weekYear;\n }\n\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(weekData) };\n}\n\nexport function gregorianToOrdinal(gregData) {\n const { year, month, day } = gregData;\n const ordinal = computeOrdinal(year, month, day);\n return { year, ordinal, ...timeObject(gregData) };\n}\n\nexport function ordinalToGregorian(ordinalData) {\n const { year, ordinal } = ordinalData;\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(ordinalData) };\n}\n\n/**\n * Check if local week units like localWeekday are used in obj.\n * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties.\n * Modifies obj in-place!\n * @param obj the object values\n */\nexport function usesLocalWeekValues(obj, loc) {\n const hasLocaleWeekData =\n !isUndefined(obj.localWeekday) ||\n !isUndefined(obj.localWeekNumber) ||\n !isUndefined(obj.localWeekYear);\n if (hasLocaleWeekData) {\n const hasIsoWeekData =\n !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);\n\n if (hasIsoWeekData) {\n throw new ConflictingSpecificationError(\n \"Cannot mix locale-based week fields with ISO-based week fields\"\n );\n }\n if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;\n if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;\n if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;\n delete obj.localWeekday;\n delete obj.localWeekNumber;\n delete obj.localWeekYear;\n return {\n minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),\n startOfWeek: loc.getStartOfWeek(),\n };\n } else {\n return { minDaysInFirstWeek: 4, startOfWeek: 1 };\n }\n}\n\nexport function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const validYear = isInteger(obj.weekYear),\n validWeek = integerBetween(\n obj.weekNumber,\n 1,\n weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)\n ),\n validWeekday = integerBetween(obj.weekday, 1, 7);\n\n if (!validYear) {\n return unitOutOfRange(\"weekYear\", obj.weekYear);\n } else if (!validWeek) {\n return unitOutOfRange(\"week\", obj.weekNumber);\n } else if (!validWeekday) {\n return unitOutOfRange(\"weekday\", obj.weekday);\n } else return false;\n}\n\nexport function hasInvalidOrdinalData(obj) {\n const validYear = isInteger(obj.year),\n validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validOrdinal) {\n return unitOutOfRange(\"ordinal\", obj.ordinal);\n } else return false;\n}\n\nexport function hasInvalidGregorianData(obj) {\n const validYear = isInteger(obj.year),\n validMonth = integerBetween(obj.month, 1, 12),\n validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validMonth) {\n return unitOutOfRange(\"month\", obj.month);\n } else if (!validDay) {\n return unitOutOfRange(\"day\", obj.day);\n } else return false;\n}\n\nexport function hasInvalidTimeData(obj) {\n const { hour, minute, second, millisecond } = obj;\n const validHour =\n integerBetween(hour, 0, 23) ||\n (hour === 24 && minute === 0 && second === 0 && millisecond === 0),\n validMinute = integerBetween(minute, 0, 59),\n validSecond = integerBetween(second, 0, 59),\n validMillisecond = integerBetween(millisecond, 0, 999);\n\n if (!validHour) {\n return unitOutOfRange(\"hour\", hour);\n } else if (!validMinute) {\n return unitOutOfRange(\"minute\", minute);\n } else if (!validSecond) {\n return unitOutOfRange(\"second\", second);\n } else if (!validMillisecond) {\n return unitOutOfRange(\"millisecond\", millisecond);\n } else return false;\n}\n","/*\n This is just a junk drawer, containing anything used across multiple classes.\n Because Luxon is small(ish), this should stay small and we won't worry about splitting\n it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.\n*/\n\nimport { InvalidArgumentError } from \"../errors.js\";\nimport Settings from \"../settings.js\";\nimport { dayOfWeek, isoWeekdayToLocal } from \"./conversions.js\";\n\n/**\n * @private\n */\n\n// TYPES\n\nexport function isUndefined(o) {\n return typeof o === \"undefined\";\n}\n\nexport function isNumber(o) {\n return typeof o === \"number\";\n}\n\nexport function isInteger(o) {\n return typeof o === \"number\" && o % 1 === 0;\n}\n\nexport function isString(o) {\n return typeof o === \"string\";\n}\n\nexport function isDate(o) {\n return Object.prototype.toString.call(o) === \"[object Date]\";\n}\n\n// CAPABILITIES\n\nexport function hasRelative() {\n try {\n return typeof Intl !== \"undefined\" && !!Intl.RelativeTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\nexport function hasLocaleWeekInfo() {\n try {\n return (\n typeof Intl !== \"undefined\" &&\n !!Intl.Locale &&\n (\"weekInfo\" in Intl.Locale.prototype || \"getWeekInfo\" in Intl.Locale.prototype)\n );\n } catch (e) {\n return false;\n }\n}\n\n// OBJECTS AND ARRAYS\n\nexport function maybeArray(thing) {\n return Array.isArray(thing) ? thing : [thing];\n}\n\nexport function bestBy(arr, by, compare) {\n if (arr.length === 0) {\n return undefined;\n }\n return arr.reduce((best, next) => {\n const pair = [by(next), next];\n if (!best) {\n return pair;\n } else if (compare(best[0], pair[0]) === best[0]) {\n return best;\n } else {\n return pair;\n }\n }, null)[1];\n}\n\nexport function pick(obj, keys) {\n return keys.reduce((a, k) => {\n a[k] = obj[k];\n return a;\n }, {});\n}\n\nexport function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport function validateWeekSettings(settings) {\n if (settings == null) {\n return null;\n } else if (typeof settings !== \"object\") {\n throw new InvalidArgumentError(\"Week settings must be an object\");\n } else {\n if (\n !integerBetween(settings.firstDay, 1, 7) ||\n !integerBetween(settings.minimalDays, 1, 7) ||\n !Array.isArray(settings.weekend) ||\n settings.weekend.some((v) => !integerBetween(v, 1, 7))\n ) {\n throw new InvalidArgumentError(\"Invalid week settings\");\n }\n return {\n firstDay: settings.firstDay,\n minimalDays: settings.minimalDays,\n weekend: Array.from(settings.weekend),\n };\n }\n}\n\n// NUMBERS AND STRINGS\n\nexport function integerBetween(thing, bottom, top) {\n return isInteger(thing) && thing >= bottom && thing <= top;\n}\n\n// x % n but takes the sign of n instead of x\nexport function floorMod(x, n) {\n return x - n * Math.floor(x / n);\n}\n\nexport function padStart(input, n = 2) {\n const isNeg = input < 0;\n let padded;\n if (isNeg) {\n padded = \"-\" + (\"\" + -input).padStart(n, \"0\");\n } else {\n padded = (\"\" + input).padStart(n, \"0\");\n }\n return padded;\n}\n\nexport function parseInteger(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseInt(string, 10);\n }\n}\n\nexport function parseFloating(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseFloat(string);\n }\n}\n\nexport function parseMillis(fraction) {\n // Return undefined (instead of 0) in these cases, where fraction is not set\n if (isUndefined(fraction) || fraction === null || fraction === \"\") {\n return undefined;\n } else {\n const f = parseFloat(\"0.\" + fraction) * 1000;\n return Math.floor(f);\n }\n}\n\nexport function roundTo(number, digits, rounding = \"round\") {\n const factor = 10 ** digits;\n switch (rounding) {\n case \"expand\":\n return number > 0\n ? Math.ceil(number * factor) / factor\n : Math.floor(number * factor) / factor;\n case \"trunc\":\n return Math.trunc(number * factor) / factor;\n case \"round\":\n return Math.round(number * factor) / factor;\n case \"floor\":\n return Math.floor(number * factor) / factor;\n case \"ceil\":\n return Math.ceil(number * factor) / factor;\n default:\n throw new RangeError(`Value rounding ${rounding} is out of range`);\n }\n}\n\n// DATE BASICS\n\nexport function isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\nexport function daysInMonth(year, month) {\n const modMonth = floorMod(month - 1, 12) + 1,\n modYear = year + (month - modMonth) / 12;\n\n if (modMonth === 2) {\n return isLeapYear(modYear) ? 29 : 28;\n } else {\n return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];\n }\n}\n\n// convert a calendar object to a local timestamp (epoch, but with the offset baked in)\nexport function objToLocalTS(obj) {\n let d = Date.UTC(\n obj.year,\n obj.month - 1,\n obj.day,\n obj.hour,\n obj.minute,\n obj.second,\n obj.millisecond\n );\n\n // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that\n if (obj.year < 100 && obj.year >= 0) {\n d = new Date(d);\n // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not\n // so if obj.year is in 99, but obj.day makes it roll over into year 100,\n // the calculations done by Date.UTC are using year 2000 - which is incorrect\n d.setUTCFullYear(obj.year, obj.month - 1, obj.day);\n }\n return +d;\n}\n\n// adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js\nfunction firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {\n const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);\n return -fwdlw + minDaysInFirstWeek - 1;\n}\n\nexport function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);\n const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);\n return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;\n}\n\nexport function untruncateYear(year) {\n if (year > 99) {\n return year;\n } else return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year;\n}\n\n// PARSING\n\nexport function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {\n const date = new Date(ts),\n intlOpts = {\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n };\n\n if (timeZone) {\n intlOpts.timeZone = timeZone;\n }\n\n const modified = { timeZoneName: offsetFormat, ...intlOpts };\n\n const parsed = new Intl.DateTimeFormat(locale, modified)\n .formatToParts(date)\n .find((m) => m.type.toLowerCase() === \"timezonename\");\n return parsed ? parsed.value : null;\n}\n\n// signedOffset('-5', '30') -> -330\nexport function signedOffset(offHourStr, offMinuteStr) {\n let offHour = parseInt(offHourStr, 10);\n\n // don't || this because we want to preserve -0\n if (Number.isNaN(offHour)) {\n offHour = 0;\n }\n\n const offMin = parseInt(offMinuteStr, 10) || 0,\n offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;\n return offHour * 60 + offMinSigned;\n}\n\n// COERCION\n\nexport function asNumber(value) {\n const numericValue = Number(value);\n if (typeof value === \"boolean\" || value === \"\" || !Number.isFinite(numericValue))\n throw new InvalidArgumentError(`Invalid unit value ${value}`);\n return numericValue;\n}\n\nexport function normalizeObject(obj, normalizer) {\n const normalized = {};\n for (const u in obj) {\n if (hasOwnProperty(obj, u)) {\n const v = obj[u];\n if (v === undefined || v === null) continue;\n normalized[normalizer(u)] = asNumber(v);\n }\n }\n return normalized;\n}\n\n/**\n * Returns the offset's value as a string\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\nexport function formatOffset(offset, format) {\n const hours = Math.trunc(Math.abs(offset / 60)),\n minutes = Math.trunc(Math.abs(offset % 60)),\n sign = offset >= 0 ? \"+\" : \"-\";\n\n switch (format) {\n case \"short\":\n return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;\n case \"narrow\":\n return `${sign}${hours}${minutes > 0 ? `:${minutes}` : \"\"}`;\n case \"techie\":\n return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;\n default:\n throw new RangeError(`Value format ${format} is out of range for property format`);\n }\n}\n\nexport function timeObject(obj) {\n return pick(obj, [\"hour\", \"minute\", \"second\", \"millisecond\"]);\n}\n","import * as Formats from \"./formats.js\";\nimport { pick } from \"./util.js\";\n\nfunction stringify(obj) {\n return JSON.stringify(obj, Object.keys(obj).sort());\n}\n\n/**\n * @private\n */\n\nexport const monthsLong = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n];\n\nexport const monthsShort = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n];\n\nexport const monthsNarrow = [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"];\n\nexport function months(length) {\n switch (length) {\n case \"narrow\":\n return [...monthsNarrow];\n case \"short\":\n return [...monthsShort];\n case \"long\":\n return [...monthsLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"];\n case \"2-digit\":\n return [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\"];\n default:\n return null;\n }\n}\n\nexport const weekdaysLong = [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\",\n];\n\nexport const weekdaysShort = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nexport const weekdaysNarrow = [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"];\n\nexport function weekdays(length) {\n switch (length) {\n case \"narrow\":\n return [...weekdaysNarrow];\n case \"short\":\n return [...weekdaysShort];\n case \"long\":\n return [...weekdaysLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"];\n default:\n return null;\n }\n}\n\nexport const meridiems = [\"AM\", \"PM\"];\n\nexport const erasLong = [\"Before Christ\", \"Anno Domini\"];\n\nexport const erasShort = [\"BC\", \"AD\"];\n\nexport const erasNarrow = [\"B\", \"A\"];\n\nexport function eras(length) {\n switch (length) {\n case \"narrow\":\n return [...erasNarrow];\n case \"short\":\n return [...erasShort];\n case \"long\":\n return [...erasLong];\n default:\n return null;\n }\n}\n\nexport function meridiemForDateTime(dt) {\n return meridiems[dt.hour < 12 ? 0 : 1];\n}\n\nexport function weekdayForDateTime(dt, length) {\n return weekdays(length)[dt.weekday - 1];\n}\n\nexport function monthForDateTime(dt, length) {\n return months(length)[dt.month - 1];\n}\n\nexport function eraForDateTime(dt, length) {\n return eras(length)[dt.year < 0 ? 0 : 1];\n}\n\nexport function formatRelativeTime(unit, count, numeric = \"always\", narrow = false) {\n const units = {\n years: [\"year\", \"yr.\"],\n quarters: [\"quarter\", \"qtr.\"],\n months: [\"month\", \"mo.\"],\n weeks: [\"week\", \"wk.\"],\n days: [\"day\", \"day\", \"days\"],\n hours: [\"hour\", \"hr.\"],\n minutes: [\"minute\", \"min.\"],\n seconds: [\"second\", \"sec.\"],\n };\n\n const lastable = [\"hours\", \"minutes\", \"seconds\"].indexOf(unit) === -1;\n\n if (numeric === \"auto\" && lastable) {\n const isDay = unit === \"days\";\n switch (count) {\n case 1:\n return isDay ? \"tomorrow\" : `next ${units[unit][0]}`;\n case -1:\n return isDay ? \"yesterday\" : `last ${units[unit][0]}`;\n case 0:\n return isDay ? \"today\" : `this ${units[unit][0]}`;\n default: // fall through\n }\n }\n\n const isInPast = Object.is(count, -0) || count < 0,\n fmtValue = Math.abs(count),\n singular = fmtValue === 1,\n lilUnits = units[unit],\n fmtUnit = narrow\n ? singular\n ? lilUnits[1]\n : lilUnits[2] || lilUnits[1]\n : singular\n ? units[unit][0]\n : unit;\n return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;\n}\n\nexport function formatString(knownFormat) {\n // these all have the offsets removed because we don't have access to them\n // without all the intl stuff this is backfilling\n const filtered = pick(knownFormat, [\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n \"hourCycle\",\n ]),\n key = stringify(filtered),\n dateTimeHuge = \"EEEE, LLLL d, yyyy, h:mm a\";\n switch (key) {\n case stringify(Formats.DATE_SHORT):\n return \"M/d/yyyy\";\n case stringify(Formats.DATE_MED):\n return \"LLL d, yyyy\";\n case stringify(Formats.DATE_MED_WITH_WEEKDAY):\n return \"EEE, LLL d, yyyy\";\n case stringify(Formats.DATE_FULL):\n return \"LLLL d, yyyy\";\n case stringify(Formats.DATE_HUGE):\n return \"EEEE, LLLL d, yyyy\";\n case stringify(Formats.TIME_SIMPLE):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_SECONDS):\n return \"h:mm:ss a\";\n case stringify(Formats.TIME_WITH_SHORT_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_LONG_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_24_SIMPLE):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_SECONDS):\n return \"HH:mm:ss\";\n case stringify(Formats.TIME_24_WITH_SHORT_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_LONG_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.DATETIME_SHORT):\n return \"M/d/yyyy, h:mm a\";\n case stringify(Formats.DATETIME_MED):\n return \"LLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL):\n return \"LLLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_HUGE):\n return dateTimeHuge;\n case stringify(Formats.DATETIME_SHORT_WITH_SECONDS):\n return \"M/d/yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_SECONDS):\n return \"LLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_WEEKDAY):\n return \"EEE, d LLL yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL_WITH_SECONDS):\n return \"LLLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_HUGE_WITH_SECONDS):\n return \"EEEE, LLLL d, yyyy, h:mm:ss a\";\n default:\n return dateTimeHuge;\n }\n}\n","import * as English from \"./english.js\";\nimport * as Formats from \"./formats.js\";\nimport { padStart } from \"./util.js\";\n\nfunction stringifyTokens(splits, tokenToString) {\n let s = \"\";\n for (const token of splits) {\n if (token.literal) {\n s += token.val;\n } else {\n s += tokenToString(token.val);\n }\n }\n return s;\n}\n\nconst macroTokenToFormatOpts = {\n D: Formats.DATE_SHORT,\n DD: Formats.DATE_MED,\n DDD: Formats.DATE_FULL,\n DDDD: Formats.DATE_HUGE,\n t: Formats.TIME_SIMPLE,\n tt: Formats.TIME_WITH_SECONDS,\n ttt: Formats.TIME_WITH_SHORT_OFFSET,\n tttt: Formats.TIME_WITH_LONG_OFFSET,\n T: Formats.TIME_24_SIMPLE,\n TT: Formats.TIME_24_WITH_SECONDS,\n TTT: Formats.TIME_24_WITH_SHORT_OFFSET,\n TTTT: Formats.TIME_24_WITH_LONG_OFFSET,\n f: Formats.DATETIME_SHORT,\n ff: Formats.DATETIME_MED,\n fff: Formats.DATETIME_FULL,\n ffff: Formats.DATETIME_HUGE,\n F: Formats.DATETIME_SHORT_WITH_SECONDS,\n FF: Formats.DATETIME_MED_WITH_SECONDS,\n FFF: Formats.DATETIME_FULL_WITH_SECONDS,\n FFFF: Formats.DATETIME_HUGE_WITH_SECONDS,\n};\n\n/**\n * @private\n */\n\nexport default class Formatter {\n static create(locale, opts = {}) {\n return new Formatter(locale, opts);\n }\n\n static parseFormat(fmt) {\n // white-space is always considered a literal in user-provided formats\n // the \" \" token has a special meaning (see unitForToken)\n\n let current = null,\n currentFull = \"\",\n bracketed = false;\n const splits = [];\n for (let i = 0; i < fmt.length; i++) {\n const c = fmt.charAt(i);\n if (c === \"'\") {\n // turn '' into a literal signal quote instead of just skipping the empty literal\n if (currentFull.length > 0 || bracketed) {\n splits.push({\n literal: bracketed || /^\\s+$/.test(currentFull),\n val: currentFull === \"\" ? \"'\" : currentFull,\n });\n }\n current = null;\n currentFull = \"\";\n bracketed = !bracketed;\n } else if (bracketed) {\n currentFull += c;\n } else if (c === current) {\n currentFull += c;\n } else {\n if (currentFull.length > 0) {\n splits.push({ literal: /^\\s+$/.test(currentFull), val: currentFull });\n }\n currentFull = c;\n current = c;\n }\n }\n\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed || /^\\s+$/.test(currentFull), val: currentFull });\n }\n\n return splits;\n }\n\n static macroTokenToFormatOpts(token) {\n return macroTokenToFormatOpts[token];\n }\n\n constructor(locale, formatOpts) {\n this.opts = formatOpts;\n this.loc = locale;\n this.systemLoc = null;\n }\n\n formatWithSystemDefault(dt, opts) {\n if (this.systemLoc === null) {\n this.systemLoc = this.loc.redefaultToSystem();\n }\n const df = this.systemLoc.dtFormatter(dt, { ...this.opts, ...opts });\n return df.format();\n }\n\n dtFormatter(dt, opts = {}) {\n return this.loc.dtFormatter(dt, { ...this.opts, ...opts });\n }\n\n formatDateTime(dt, opts) {\n return this.dtFormatter(dt, opts).format();\n }\n\n formatDateTimeParts(dt, opts) {\n return this.dtFormatter(dt, opts).formatToParts();\n }\n\n formatInterval(interval, opts) {\n const df = this.dtFormatter(interval.start, opts);\n return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());\n }\n\n resolvedOptions(dt, opts) {\n return this.dtFormatter(dt, opts).resolvedOptions();\n }\n\n num(n, p = 0, signDisplay = undefined) {\n // we get some perf out of doing this here, annoyingly\n if (this.opts.forceSimple) {\n return padStart(n, p);\n }\n\n const opts = { ...this.opts };\n\n if (p > 0) {\n opts.padTo = p;\n }\n if (signDisplay) {\n opts.signDisplay = signDisplay;\n }\n\n return this.loc.numberFormatter(opts).format(n);\n }\n\n formatDateTimeFromString(dt, fmt) {\n const knownEnglish = this.loc.listingMode() === \"en\",\n useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== \"gregory\",\n string = (opts, extract) => this.loc.extract(dt, opts, extract),\n formatOffset = (opts) => {\n if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {\n return \"Z\";\n }\n\n return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : \"\";\n },\n meridiem = () =>\n knownEnglish\n ? English.meridiemForDateTime(dt)\n : string({ hour: \"numeric\", hourCycle: \"h12\" }, \"dayperiod\"),\n month = (length, standalone) =>\n knownEnglish\n ? English.monthForDateTime(dt, length)\n : string(standalone ? { month: length } : { month: length, day: \"numeric\" }, \"month\"),\n weekday = (length, standalone) =>\n knownEnglish\n ? English.weekdayForDateTime(dt, length)\n : string(\n standalone ? { weekday: length } : { weekday: length, month: \"long\", day: \"numeric\" },\n \"weekday\"\n ),\n maybeMacro = (token) => {\n const formatOpts = Formatter.macroTokenToFormatOpts(token);\n if (formatOpts) {\n return this.formatWithSystemDefault(dt, formatOpts);\n } else {\n return token;\n }\n },\n era = (length) =>\n knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, \"era\"),\n tokenToString = (token) => {\n // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols\n switch (token) {\n // ms\n case \"S\":\n return this.num(dt.millisecond);\n case \"u\":\n // falls through\n case \"SSS\":\n return this.num(dt.millisecond, 3);\n // seconds\n case \"s\":\n return this.num(dt.second);\n case \"ss\":\n return this.num(dt.second, 2);\n // fractional seconds\n case \"uu\":\n return this.num(Math.floor(dt.millisecond / 10), 2);\n case \"uuu\":\n return this.num(Math.floor(dt.millisecond / 100));\n // minutes\n case \"m\":\n return this.num(dt.minute);\n case \"mm\":\n return this.num(dt.minute, 2);\n // hours\n case \"h\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);\n case \"hh\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);\n case \"H\":\n return this.num(dt.hour);\n case \"HH\":\n return this.num(dt.hour, 2);\n // offset\n case \"Z\":\n // like +6\n return formatOffset({ format: \"narrow\", allowZ: this.opts.allowZ });\n case \"ZZ\":\n // like +06:00\n return formatOffset({ format: \"short\", allowZ: this.opts.allowZ });\n case \"ZZZ\":\n // like +0600\n return formatOffset({ format: \"techie\", allowZ: this.opts.allowZ });\n case \"ZZZZ\":\n // like EST\n return dt.zone.offsetName(dt.ts, { format: \"short\", locale: this.loc.locale });\n case \"ZZZZZ\":\n // like Eastern Standard Time\n return dt.zone.offsetName(dt.ts, { format: \"long\", locale: this.loc.locale });\n // zone\n case \"z\":\n // like America/New_York\n return dt.zoneName;\n // meridiems\n case \"a\":\n return meridiem();\n // dates\n case \"d\":\n return useDateTimeFormatter ? string({ day: \"numeric\" }, \"day\") : this.num(dt.day);\n case \"dd\":\n return useDateTimeFormatter ? string({ day: \"2-digit\" }, \"day\") : this.num(dt.day, 2);\n // weekdays - standalone\n case \"c\":\n // like 1\n return this.num(dt.weekday);\n case \"ccc\":\n // like 'Tues'\n return weekday(\"short\", true);\n case \"cccc\":\n // like 'Tuesday'\n return weekday(\"long\", true);\n case \"ccccc\":\n // like 'T'\n return weekday(\"narrow\", true);\n // weekdays - format\n case \"E\":\n // like 1\n return this.num(dt.weekday);\n case \"EEE\":\n // like 'Tues'\n return weekday(\"short\", false);\n case \"EEEE\":\n // like 'Tuesday'\n return weekday(\"long\", false);\n case \"EEEEE\":\n // like 'T'\n return weekday(\"narrow\", false);\n // months - standalone\n case \"L\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\", day: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"LL\":\n // like 01, doesn't seem to work\n return useDateTimeFormatter\n ? string({ month: \"2-digit\", day: \"numeric\" }, \"month\")\n : this.num(dt.month, 2);\n case \"LLL\":\n // like Jan\n return month(\"short\", true);\n case \"LLLL\":\n // like January\n return month(\"long\", true);\n case \"LLLLL\":\n // like J\n return month(\"narrow\", true);\n // months - format\n case \"M\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"MM\":\n // like 01\n return useDateTimeFormatter\n ? string({ month: \"2-digit\" }, \"month\")\n : this.num(dt.month, 2);\n case \"MMM\":\n // like Jan\n return month(\"short\", false);\n case \"MMMM\":\n // like January\n return month(\"long\", false);\n case \"MMMMM\":\n // like J\n return month(\"narrow\", false);\n // years\n case \"y\":\n // like 2014\n return useDateTimeFormatter ? string({ year: \"numeric\" }, \"year\") : this.num(dt.year);\n case \"yy\":\n // like 14\n return useDateTimeFormatter\n ? string({ year: \"2-digit\" }, \"year\")\n : this.num(dt.year.toString().slice(-2), 2);\n case \"yyyy\":\n // like 0012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 4);\n case \"yyyyyy\":\n // like 000012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 6);\n // eras\n case \"G\":\n // like AD\n return era(\"short\");\n case \"GG\":\n // like Anno Domini\n return era(\"long\");\n case \"GGGGG\":\n return era(\"narrow\");\n case \"kk\":\n return this.num(dt.weekYear.toString().slice(-2), 2);\n case \"kkkk\":\n return this.num(dt.weekYear, 4);\n case \"W\":\n return this.num(dt.weekNumber);\n case \"WW\":\n return this.num(dt.weekNumber, 2);\n case \"n\":\n return this.num(dt.localWeekNumber);\n case \"nn\":\n return this.num(dt.localWeekNumber, 2);\n case \"ii\":\n return this.num(dt.localWeekYear.toString().slice(-2), 2);\n case \"iiii\":\n return this.num(dt.localWeekYear, 4);\n case \"o\":\n return this.num(dt.ordinal);\n case \"ooo\":\n return this.num(dt.ordinal, 3);\n case \"q\":\n // like 1\n return this.num(dt.quarter);\n case \"qq\":\n // like 01\n return this.num(dt.quarter, 2);\n case \"X\":\n return this.num(Math.floor(dt.ts / 1000));\n case \"x\":\n return this.num(dt.ts);\n default:\n return maybeMacro(token);\n }\n };\n\n return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);\n }\n\n formatDurationFromString(dur, fmt) {\n const invertLargest = this.opts.signMode === \"negativeLargestOnly\" ? -1 : 1;\n const tokenToField = (token) => {\n switch (token[0]) {\n case \"S\":\n return \"milliseconds\";\n case \"s\":\n return \"seconds\";\n case \"m\":\n return \"minutes\";\n case \"h\":\n return \"hours\";\n case \"d\":\n return \"days\";\n case \"w\":\n return \"weeks\";\n case \"M\":\n return \"months\";\n case \"y\":\n return \"years\";\n default:\n return null;\n }\n },\n tokenToString = (lildur, info) => (token) => {\n const mapped = tokenToField(token);\n if (mapped) {\n const inversionFactor =\n info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;\n let signDisplay;\n if (this.opts.signMode === \"negativeLargestOnly\" && mapped !== info.largestUnit) {\n signDisplay = \"never\";\n } else if (this.opts.signMode === \"all\") {\n signDisplay = \"always\";\n } else {\n // \"auto\" and \"negative\" are the same, but \"auto\" has better support\n signDisplay = \"auto\";\n }\n return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);\n } else {\n return token;\n }\n },\n tokens = Formatter.parseFormat(fmt),\n realTokens = tokens.reduce(\n (found, { literal, val }) => (literal ? found : found.concat(val)),\n []\n ),\n collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t)),\n durationInfo = {\n isNegativeDuration: collapsed < 0,\n // this relies on \"collapsed\" being based on \"shiftTo\", which builds up the object\n // in order\n largestUnit: Object.keys(collapsed.values)[0],\n };\n return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));\n }\n}\n","import {\n untruncateYear,\n signedOffset,\n parseInteger,\n parseMillis,\n isUndefined,\n parseFloating,\n} from \"./util.js\";\nimport * as English from \"./english.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n/*\n * This file handles parsing for well-specified formats. Here's how it works:\n * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.\n * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object\n * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.\n * Extractors can take a \"cursor\" representing the offset in the match to look at. This makes it easy to combine extractors.\n * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.\n * Some extractions are super dumb and simpleParse and fromStrings help DRY them.\n */\n\nconst ianaRegex = /[A-Za-z_+-]{1,256}(?::?\\/[A-Za-z0-9_+-]{1,256}(?:\\/[A-Za-z0-9_+-]{1,256})?)?/;\n\nfunction combineRegexes(...regexes) {\n const full = regexes.reduce((f, r) => f + r.source, \"\");\n return RegExp(`^${full}$`);\n}\n\nfunction combineExtractors(...extractors) {\n return (m) =>\n extractors\n .reduce(\n ([mergedVals, mergedZone, cursor], ex) => {\n const [val, zone, next] = ex(m, cursor);\n return [{ ...mergedVals, ...val }, zone || mergedZone, next];\n },\n [{}, null, 1]\n )\n .slice(0, 2);\n}\n\nfunction parse(s, ...patterns) {\n if (s == null) {\n return [null, null];\n }\n\n for (const [regex, extractor] of patterns) {\n const m = regex.exec(s);\n if (m) {\n return extractor(m);\n }\n }\n return [null, null];\n}\n\nfunction simpleParse(...keys) {\n return (match, cursor) => {\n const ret = {};\n let i;\n\n for (i = 0; i < keys.length; i++) {\n ret[keys[i]] = parseInteger(match[cursor + i]);\n }\n return [ret, null, cursor + i];\n };\n}\n\n// ISO and SQL parsing\nconst offsetRegex = /(?:([Zz])|([+-]\\d\\d)(?::?(\\d\\d))?)/;\nconst isoExtendedZone = `(?:${offsetRegex.source}?(?:\\\\[(${ianaRegex.source})\\\\])?)?`;\nconst isoTimeBaseRegex = /(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:[.,](\\d{1,30}))?)?)?/;\nconst isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);\nconst isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);\nconst isoYmdRegex = /([+-]\\d{6}|\\d{4})(?:-?(\\d\\d)(?:-?(\\d\\d))?)?/;\nconst isoWeekRegex = /(\\d{4})-?W(\\d\\d)(?:-?(\\d))?/;\nconst isoOrdinalRegex = /(\\d{4})-?(\\d{3})/;\nconst extractISOWeekData = simpleParse(\"weekYear\", \"weekNumber\", \"weekDay\");\nconst extractISOOrdinalData = simpleParse(\"year\", \"ordinal\");\nconst sqlYmdRegex = /(\\d{4})-(\\d\\d)-(\\d\\d)/; // dumbed-down version of the ISO one\nconst sqlTimeRegex = RegExp(\n `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`\n);\nconst sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);\n\nfunction int(match, pos, fallback) {\n const m = match[pos];\n return isUndefined(m) ? fallback : parseInteger(m);\n}\n\nfunction extractISOYmd(match, cursor) {\n const item = {\n year: int(match, cursor),\n month: int(match, cursor + 1, 1),\n day: int(match, cursor + 2, 1),\n };\n\n return [item, null, cursor + 3];\n}\n\nfunction extractISOTime(match, cursor) {\n const item = {\n hours: int(match, cursor, 0),\n minutes: int(match, cursor + 1, 0),\n seconds: int(match, cursor + 2, 0),\n milliseconds: parseMillis(match[cursor + 3]),\n };\n\n return [item, null, cursor + 4];\n}\n\nfunction extractISOOffset(match, cursor) {\n const local = !match[cursor] && !match[cursor + 1],\n fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),\n zone = local ? null : FixedOffsetZone.instance(fullOffset);\n return [{}, zone, cursor + 3];\n}\n\nfunction extractIANAZone(match, cursor) {\n const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;\n return [{}, zone, cursor + 1];\n}\n\n// ISO time parsing\n\nconst isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);\n\n// ISO duration parsing\n\nconst isoDuration =\n /^-?P(?:(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)Y)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)M)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)W)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)D)?(?:T(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)H)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)M)?(?:(-?\\d{1,20})(?:[.,](-?\\d{1,20}))?S)?)?)$/;\n\nfunction extractISODuration(match) {\n const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] =\n match;\n\n const hasNegativePrefix = s[0] === \"-\";\n const negativeSeconds = secondStr && secondStr[0] === \"-\";\n\n const maybeNegate = (num, force = false) =>\n num !== undefined && (force || (num && hasNegativePrefix)) ? -num : num;\n\n return [\n {\n years: maybeNegate(parseFloating(yearStr)),\n months: maybeNegate(parseFloating(monthStr)),\n weeks: maybeNegate(parseFloating(weekStr)),\n days: maybeNegate(parseFloating(dayStr)),\n hours: maybeNegate(parseFloating(hourStr)),\n minutes: maybeNegate(parseFloating(minuteStr)),\n seconds: maybeNegate(parseFloating(secondStr), secondStr === \"-0\"),\n milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds),\n },\n ];\n}\n\n// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York\n// and not just that we're in -240 *right now*. But since I don't think these are used that often\n// I'm just going to ignore that\nconst obsOffsets = {\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n};\n\nfunction fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {\n const result = {\n year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),\n month: English.monthsShort.indexOf(monthStr) + 1,\n day: parseInteger(dayStr),\n hour: parseInteger(hourStr),\n minute: parseInteger(minuteStr),\n };\n\n if (secondStr) result.second = parseInteger(secondStr);\n if (weekdayStr) {\n result.weekday =\n weekdayStr.length > 3\n ? English.weekdaysLong.indexOf(weekdayStr) + 1\n : English.weekdaysShort.indexOf(weekdayStr) + 1;\n }\n\n return result;\n}\n\n// RFC 2822/5322\nconst rfc2822 =\n /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\\d\\d)(\\d\\d)))$/;\n\nfunction extractRFC2822(match) {\n const [\n ,\n weekdayStr,\n dayStr,\n monthStr,\n yearStr,\n hourStr,\n minuteStr,\n secondStr,\n obsOffset,\n milOffset,\n offHourStr,\n offMinuteStr,\n ] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n\n let offset;\n if (obsOffset) {\n offset = obsOffsets[obsOffset];\n } else if (milOffset) {\n offset = 0;\n } else {\n offset = signedOffset(offHourStr, offMinuteStr);\n }\n\n return [result, new FixedOffsetZone(offset)];\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^()]*\\)|[\\n\\t]/g, \" \")\n .replace(/(\\s\\s+)/g, \" \")\n .trim();\n}\n\n// http date\n\nconst rfc1123 =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d\\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\\d{4}) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n rfc850 =\n /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\\d\\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n ascii =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \\d|\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) (\\d{4})$/;\n\nfunction extractRFC1123Or850(match) {\n const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nfunction extractASCII(match) {\n const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nconst isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);\nconst isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);\nconst isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);\nconst isoTimeCombinedRegex = combineRegexes(isoTimeRegex);\n\nconst extractISOYmdTimeAndOffset = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOWeekTimeAndOffset = combineExtractors(\n extractISOWeekData,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOOrdinalDateAndTime = combineExtractors(\n extractISOOrdinalData,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOTimeAndOffset = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\n/*\n * @private\n */\n\nexport function parseISODate(s) {\n return parse(\n s,\n [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],\n [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime],\n [isoTimeCombinedRegex, extractISOTimeAndOffset]\n );\n}\n\nexport function parseRFC2822Date(s) {\n return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);\n}\n\nexport function parseHTTPDate(s) {\n return parse(\n s,\n [rfc1123, extractRFC1123Or850],\n [rfc850, extractRFC1123Or850],\n [ascii, extractASCII]\n );\n}\n\nexport function parseISODuration(s) {\n return parse(s, [isoDuration, extractISODuration]);\n}\n\nconst extractISOTimeOnly = combineExtractors(extractISOTime);\n\nexport function parseISOTimeOnly(s) {\n return parse(s, [isoTimeOnly, extractISOTimeOnly]);\n}\n\nconst sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);\nconst sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);\n\nconst extractISOTimeOffsetAndIANAZone = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\nexport function parseSQL(s) {\n return parse(\n s,\n [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]\n );\n}\n","import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from \"./errors.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Locale from \"./impl/locale.js\";\nimport { parseISODuration, parseISOTimeOnly } from \"./impl/regexParser.js\";\nimport {\n asNumber,\n hasOwnProperty,\n isNumber,\n isUndefined,\n normalizeObject,\n roundTo,\n} from \"./impl/util.js\";\nimport Settings from \"./settings.js\";\nimport DateTime from \"./datetime.js\";\n\nconst INVALID = \"Invalid Duration\";\n\n// unit conversion constants\nexport const lowOrderMatrix = {\n weeks: {\n days: 7,\n hours: 7 * 24,\n minutes: 7 * 24 * 60,\n seconds: 7 * 24 * 60 * 60,\n milliseconds: 7 * 24 * 60 * 60 * 1000,\n },\n days: {\n hours: 24,\n minutes: 24 * 60,\n seconds: 24 * 60 * 60,\n milliseconds: 24 * 60 * 60 * 1000,\n },\n hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },\n minutes: { seconds: 60, milliseconds: 60 * 1000 },\n seconds: { milliseconds: 1000 },\n },\n casualMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: 52,\n days: 365,\n hours: 365 * 24,\n minutes: 365 * 24 * 60,\n seconds: 365 * 24 * 60 * 60,\n milliseconds: 365 * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: 13,\n days: 91,\n hours: 91 * 24,\n minutes: 91 * 24 * 60,\n seconds: 91 * 24 * 60 * 60,\n milliseconds: 91 * 24 * 60 * 60 * 1000,\n },\n months: {\n weeks: 4,\n days: 30,\n hours: 30 * 24,\n minutes: 30 * 24 * 60,\n seconds: 30 * 24 * 60 * 60,\n milliseconds: 30 * 24 * 60 * 60 * 1000,\n },\n\n ...lowOrderMatrix,\n },\n daysInYearAccurate = 146097.0 / 400,\n daysInMonthAccurate = 146097.0 / 4800,\n accurateMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: daysInYearAccurate / 7,\n days: daysInYearAccurate,\n hours: daysInYearAccurate * 24,\n minutes: daysInYearAccurate * 24 * 60,\n seconds: daysInYearAccurate * 24 * 60 * 60,\n milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: daysInYearAccurate / 28,\n days: daysInYearAccurate / 4,\n hours: (daysInYearAccurate * 24) / 4,\n minutes: (daysInYearAccurate * 24 * 60) / 4,\n seconds: (daysInYearAccurate * 24 * 60 * 60) / 4,\n milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4,\n },\n months: {\n weeks: daysInMonthAccurate / 7,\n days: daysInMonthAccurate,\n hours: daysInMonthAccurate * 24,\n minutes: daysInMonthAccurate * 24 * 60,\n seconds: daysInMonthAccurate * 24 * 60 * 60,\n milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000,\n },\n ...lowOrderMatrix,\n };\n\n// units ordered by size\nconst orderedUnits = [\n \"years\",\n \"quarters\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\",\n];\n\nconst reverseUnits = orderedUnits.slice(0).reverse();\n\n// clone really means \"create another instance just like this one, but with these changes\"\nfunction clone(dur, alts, clear = false) {\n // deep merge for vals\n const conf = {\n values: clear ? alts.values : { ...dur.values, ...(alts.values || {}) },\n loc: dur.loc.clone(alts.loc),\n conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,\n matrix: alts.matrix || dur.matrix,\n };\n return new Duration(conf);\n}\n\nfunction durationToMillis(matrix, vals) {\n let sum = vals.milliseconds ?? 0;\n for (const unit of reverseUnits.slice(1)) {\n if (vals[unit]) {\n sum += vals[unit] * matrix[unit][\"milliseconds\"];\n }\n }\n return sum;\n}\n\n// NB: mutates parameters\nfunction normalizeValues(matrix, vals) {\n // the logic below assumes the overall value of the duration is positive\n // if this is not the case, factor is used to make it so\n const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;\n\n orderedUnits.reduceRight((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n const previousVal = vals[previous] * factor;\n const conv = matrix[current][previous];\n\n // if (previousVal < 0):\n // lower order unit is negative (e.g. { years: 2, days: -2 })\n // normalize this by reducing the higher order unit by the appropriate amount\n // and increasing the lower order unit\n // this can never make the higher order unit negative, because this function only operates\n // on positive durations, so the amount of time represented by the lower order unit cannot\n // be larger than the higher order unit\n // else:\n // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 })\n // in this case we attempt to convert as much as possible from the lower order unit into\n // the higher order one\n //\n // Math.floor takes care of both of these cases, rounding away from 0\n // if previousVal < 0 it makes the absolute value larger\n // if previousVal >= it makes the absolute value smaller\n const rollUp = Math.floor(previousVal / conv);\n vals[current] += rollUp * factor;\n vals[previous] -= rollUp * conv * factor;\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n\n // try to convert any decimals into smaller units if possible\n // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 }\n orderedUnits.reduce((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n const fraction = vals[previous] % 1;\n vals[previous] -= fraction;\n vals[current] += fraction * matrix[previous][current];\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n}\n\n// Remove all properties with a value of 0 from an object\nfunction removeZeroes(vals) {\n const newVals = {};\n for (const [key, value] of Object.entries(vals)) {\n if (value !== 0) {\n newVals[key] = value;\n }\n }\n return newVals;\n}\n\n/**\n * A Duration object represents a period of time, like \"2 months\" or \"1 day, 1 hour\". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime#plus} to add a Duration object to a DateTime, producing another DateTime.\n *\n * Here is a brief overview of commonly used methods and getters in Duration:\n *\n * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.\n * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors.\n * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors.\n * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}.\n * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON}\n *\n * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.\n */\nexport default class Duration {\n /**\n * @private\n */\n constructor(config) {\n const accurate = config.conversionAccuracy === \"longterm\" || false;\n let matrix = accurate ? accurateMatrix : casualMatrix;\n\n if (config.matrix) {\n matrix = config.matrix;\n }\n\n /**\n * @access private\n */\n this.values = config.values;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.conversionAccuracy = accurate ? \"longterm\" : \"casual\";\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.matrix = matrix;\n /**\n * @access private\n */\n this.isLuxonDuration = true;\n }\n\n /**\n * Create Duration from a number of milliseconds.\n * @param {number} count of milliseconds\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromMillis(count, opts) {\n return Duration.fromObject({ milliseconds: count }, opts);\n }\n\n /**\n * Create a Duration from a JavaScript object with keys like 'years' and 'hours'.\n * If this object is empty then a zero milliseconds duration is returned.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.years\n * @param {number} obj.quarters\n * @param {number} obj.months\n * @param {number} obj.weeks\n * @param {number} obj.days\n * @param {number} obj.hours\n * @param {number} obj.minutes\n * @param {number} obj.seconds\n * @param {number} obj.milliseconds\n * @param {Object} [opts=[]] - options for creating this Duration\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the custom conversion system to use\n * @return {Duration}\n */\n static fromObject(obj, opts = {}) {\n if (obj == null || typeof obj !== \"object\") {\n throw new InvalidArgumentError(\n `Duration.fromObject: argument expected to be an object, got ${\n obj === null ? \"null\" : typeof obj\n }`\n );\n }\n\n return new Duration({\n values: normalizeObject(obj, Duration.normalizeUnit),\n loc: Locale.fromObject(opts),\n conversionAccuracy: opts.conversionAccuracy,\n matrix: opts.matrix,\n });\n }\n\n /**\n * Create a Duration from DurationLike.\n *\n * @param {Object | number | Duration} durationLike\n * One of:\n * - object with keys like 'years' and 'hours'.\n * - number representing milliseconds\n * - Duration instance\n * @return {Duration}\n */\n static fromDurationLike(durationLike) {\n if (isNumber(durationLike)) {\n return Duration.fromMillis(durationLike);\n } else if (Duration.isDuration(durationLike)) {\n return durationLike;\n } else if (typeof durationLike === \"object\") {\n return Duration.fromObject(durationLike);\n } else {\n throw new InvalidArgumentError(\n `Unknown duration argument ${durationLike} of type ${typeof durationLike}`\n );\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 duration string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the preset conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }\n * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }\n * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }\n * @return {Duration}\n */\n static fromISO(text, opts) {\n const [parsed] = parseISODuration(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 time string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 }\n * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @return {Duration}\n */\n static fromISOTime(text, opts) {\n const [parsed] = parseISOTimeOnly(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create an invalid Duration.\n * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Duration}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Duration is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDurationError(invalid);\n } else {\n return new Duration({ invalid });\n }\n }\n\n /**\n * @private\n */\n static normalizeUnit(unit) {\n const normalized = {\n year: \"years\",\n years: \"years\",\n quarter: \"quarters\",\n quarters: \"quarters\",\n month: \"months\",\n months: \"months\",\n week: \"weeks\",\n weeks: \"weeks\",\n day: \"days\",\n days: \"days\",\n hour: \"hours\",\n hours: \"hours\",\n minute: \"minutes\",\n minutes: \"minutes\",\n second: \"seconds\",\n seconds: \"seconds\",\n millisecond: \"milliseconds\",\n milliseconds: \"milliseconds\",\n }[unit ? unit.toLowerCase() : unit];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n }\n\n /**\n * Check if an object is a Duration. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDuration(o) {\n return (o && o.isLuxonDuration) || false;\n }\n\n /**\n * Get the locale of a Duration, such 'en-GB'\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:\n * * `S` for milliseconds\n * * `s` for seconds\n * * `m` for minutes\n * * `h` for hours\n * * `d` for days\n * * `w` for weeks\n * * `M` for months\n * * `y` for years\n * Notes:\n * * Add padding by repeating the token, e.g. \"yy\" pads the years to two digits, \"hhhh\" pads the hours out to four digits\n * * Tokens can be escaped by wrapping with single quotes.\n * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting.\n * @param {string} fmt - the format string\n * @param {Object} opts - options\n * @param {boolean} [opts.floor=true] - floor numerical values\n * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"y d s\") //=> \"1 6 2\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"yy dd sss\") //=> \"01 06 002\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"M S\") //=> \"12 518402000\"\n * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat(\"d s\", { signMode: \"all\" }) //=> \"+6 +2\"\n * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat(\"d s\", { signMode: \"all\" }) //=> \"-6 -2\"\n * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat(\"d s\", { signMode: \"negativeLargestOnly\" }) //=> \"-6 2\"\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n // reverse-compat since 1.2; we always round down now, never up, and we do it by default\n const fmtOpts = {\n ...opts,\n floor: opts.round !== false && opts.floor !== false,\n };\n return this.isValid\n ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a string representation of a Duration with all units included.\n * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options\n * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.\n * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.\n * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero\n * @example\n * ```js\n * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 })\n * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes'\n * dur.toHuman({ listStyle: \"long\" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes'\n * dur.toHuman({ unitDisplay: \"short\" }) //=> '1 mth, 0 wks, 5 hr, 6 min'\n * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes'\n * ```\n */\n toHuman(opts = {}) {\n if (!this.isValid) return INVALID;\n\n const showZeros = opts.showZeros !== false;\n\n const l = orderedUnits\n .map((unit) => {\n const val = this.values[unit];\n if (isUndefined(val) || (val === 0 && !showZeros)) {\n return null;\n }\n return this.loc\n .numberFormatter({ style: \"unit\", unitDisplay: \"long\", ...opts, unit: unit.slice(0, -1) })\n .format(val);\n })\n .filter((n) => n);\n\n return this.loc\n .listFormatter({ type: \"conjunction\", style: opts.listStyle || \"narrow\", ...opts })\n .format(l);\n }\n\n /**\n * Returns a JavaScript object with this Duration's values.\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }\n * @return {Object}\n */\n toObject() {\n if (!this.isValid) return {};\n return { ...this.values };\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'\n * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'\n * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'\n * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'\n * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'\n * @return {string}\n */\n toISO() {\n // we could use the formatter, but this is an easier way to get the minimum string\n if (!this.isValid) return null;\n\n let s = \"P\";\n if (this.years !== 0) s += this.years + \"Y\";\n if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + \"M\";\n if (this.weeks !== 0) s += this.weeks + \"W\";\n if (this.days !== 0) s += this.days + \"D\";\n if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)\n s += \"T\";\n if (this.hours !== 0) s += this.hours + \"H\";\n if (this.minutes !== 0) s += this.minutes + \"M\";\n if (this.seconds !== 0 || this.milliseconds !== 0)\n // this will handle \"floating point madness\" by removing extra decimal places\n // https://stackoverflow.com/questions/588004/is-floating-point-math-broken\n s += roundTo(this.seconds + this.milliseconds / 1000, 3) + \"S\";\n if (s === \"P\") s += \"T0S\";\n return s;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day.\n * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000'\n * @return {string}\n */\n toISOTime(opts = {}) {\n if (!this.isValid) return null;\n\n const millis = this.toMillis();\n if (millis < 0 || millis >= 86400000) return null;\n\n opts = {\n suppressMilliseconds: false,\n suppressSeconds: false,\n includePrefix: false,\n format: \"extended\",\n ...opts,\n includeOffset: false,\n };\n\n const dateTime = DateTime.fromMillis(millis, { zone: \"UTC\" });\n return dateTime.toISOTime(opts);\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in debugging.\n * @return {string}\n */\n toString() {\n return this.toISO();\n }\n\n /**\n * Returns a string representation of this Duration appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `Duration { values: ${JSON.stringify(this.values)} }`;\n } else {\n return `Duration { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns an milliseconds value of this Duration.\n * @return {number}\n */\n toMillis() {\n if (!this.isValid) return NaN;\n\n return durationToMillis(this.matrix, this.values);\n }\n\n /**\n * Returns an milliseconds value of this Duration. Alias of {@link toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Make this Duration longer by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n plus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration),\n result = {};\n\n for (const k of orderedUnits) {\n if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {\n result[k] = dur.get(k) + this.get(k);\n }\n }\n\n return clone(this, { values: result }, true);\n }\n\n /**\n * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n minus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration);\n return this.plus(dur.negate());\n }\n\n /**\n * Scale this Duration by the specified amount. Return a newly-constructed Duration.\n * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 }\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === \"hours\" ? x * 2 : x) //=> { hours: 2, minutes: 30 }\n * @return {Duration}\n */\n mapUnits(fn) {\n if (!this.isValid) return this;\n const result = {};\n for (const k of Object.keys(this.values)) {\n result[k] = asNumber(fn(this.values[k], k));\n }\n return clone(this, { values: result }, true);\n }\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2\n * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0\n * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3\n * @return {number}\n */\n get(unit) {\n return this[Duration.normalizeUnit(unit)];\n }\n\n /**\n * \"Set\" the values of specified units. Return a newly-constructed Duration.\n * @param {Object} values - a mapping of units to numbers\n * @example dur.set({ years: 2017 })\n * @example dur.set({ hours: 8, minutes: 30 })\n * @return {Duration}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const mixed = { ...this.values, ...normalizeObject(values, Duration.normalizeUnit) };\n return clone(this, { values: mixed });\n }\n\n /**\n * \"Set\" the locale and/or numberingSystem. Returns a newly-constructed Duration.\n * @example dur.reconfigure({ locale: 'en-GB' })\n * @return {Duration}\n */\n reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem });\n const opts = { loc, matrix, conversionAccuracy };\n return clone(this, opts);\n }\n\n /**\n * Return the length of the duration in the specified unit.\n * @param {string} unit - a unit such as 'minutes' or 'days'\n * @example Duration.fromObject({years: 1}).as('days') //=> 365\n * @example Duration.fromObject({years: 1}).as('months') //=> 12\n * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5\n * @return {number}\n */\n as(unit) {\n return this.isValid ? this.shiftTo(unit).get(unit) : NaN;\n }\n\n /**\n * Reduce this Duration to its canonical representation in its current units.\n * Assuming the overall value of the Duration is positive, this means:\n * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)\n * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise\n * the overall value would be negative, see third example)\n * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)\n *\n * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.\n * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }\n * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 }\n * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }\n * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 }\n * @return {Duration}\n */\n normalize() {\n if (!this.isValid) return this;\n const vals = this.toObject();\n normalizeValues(this.matrix, vals);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Rescale units to its largest representation\n * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 }\n * @return {Duration}\n */\n rescale() {\n if (!this.isValid) return this;\n const vals = removeZeroes(this.normalize().shiftToAll().toObject());\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Convert this Duration into its representation in a different set of units.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }\n * @return {Duration}\n */\n shiftTo(...units) {\n if (!this.isValid) return this;\n\n if (units.length === 0) {\n return this;\n }\n\n units = units.map((u) => Duration.normalizeUnit(u));\n\n const built = {},\n accumulated = {},\n vals = this.toObject();\n let lastUnit;\n\n for (const k of orderedUnits) {\n if (units.indexOf(k) >= 0) {\n lastUnit = k;\n\n let own = 0;\n\n // anything we haven't boiled down yet should get boiled to this unit\n for (const ak in accumulated) {\n own += this.matrix[ak][k] * accumulated[ak];\n accumulated[ak] = 0;\n }\n\n // plus anything that's already in this unit\n if (isNumber(vals[k])) {\n own += vals[k];\n }\n\n // only keep the integer part for now in the hopes of putting any decimal part\n // into a smaller unit later\n const i = Math.trunc(own);\n built[k] = i;\n accumulated[k] = (own * 1000 - i * 1000) / 1000;\n\n // otherwise, keep it in the wings to boil it later\n } else if (isNumber(vals[k])) {\n accumulated[k] = vals[k];\n }\n }\n\n // anything leftover becomes the decimal for the last unit\n // lastUnit must be defined since units is not empty\n for (const key in accumulated) {\n if (accumulated[key] !== 0) {\n built[lastUnit] +=\n key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];\n }\n }\n\n normalizeValues(this.matrix, built);\n return clone(this, { values: built }, true);\n }\n\n /**\n * Shift this Duration to all available units.\n * Same as shiftTo(\"years\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", \"seconds\", \"milliseconds\")\n * @return {Duration}\n */\n shiftToAll() {\n if (!this.isValid) return this;\n return this.shiftTo(\n \"years\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\"\n );\n }\n\n /**\n * Return the negative of this Duration.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }\n * @return {Duration}\n */\n negate() {\n if (!this.isValid) return this;\n const negated = {};\n for (const k of Object.keys(this.values)) {\n negated[k] = this.values[k] === 0 ? 0 : -this.values[k];\n }\n return clone(this, { values: negated }, true);\n }\n\n /**\n * Removes all units with values equal to 0 from this Duration.\n * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 }\n * @return {Duration}\n */\n removeZeros() {\n if (!this.isValid) return this;\n const vals = removeZeroes(this.values);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Get the years.\n * @type {number}\n */\n get years() {\n return this.isValid ? this.values.years || 0 : NaN;\n }\n\n /**\n * Get the quarters.\n * @type {number}\n */\n get quarters() {\n return this.isValid ? this.values.quarters || 0 : NaN;\n }\n\n /**\n * Get the months.\n * @type {number}\n */\n get months() {\n return this.isValid ? this.values.months || 0 : NaN;\n }\n\n /**\n * Get the weeks\n * @type {number}\n */\n get weeks() {\n return this.isValid ? this.values.weeks || 0 : NaN;\n }\n\n /**\n * Get the days.\n * @type {number}\n */\n get days() {\n return this.isValid ? this.values.days || 0 : NaN;\n }\n\n /**\n * Get the hours.\n * @type {number}\n */\n get hours() {\n return this.isValid ? this.values.hours || 0 : NaN;\n }\n\n /**\n * Get the minutes.\n * @type {number}\n */\n get minutes() {\n return this.isValid ? this.values.minutes || 0 : NaN;\n }\n\n /**\n * Get the seconds.\n * @return {number}\n */\n get seconds() {\n return this.isValid ? this.values.seconds || 0 : NaN;\n }\n\n /**\n * Get the milliseconds.\n * @return {number}\n */\n get milliseconds() {\n return this.isValid ? this.values.milliseconds || 0 : NaN;\n }\n\n /**\n * Returns whether the Duration is invalid. Invalid durations are returned by diff operations\n * on invalid DateTimes or Intervals.\n * @return {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this Duration became invalid, or null if the Duration is valid\n * @return {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Duration became invalid, or null if the Duration is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Equality check\n * Two Durations are equal iff they have the same units and the same values for each unit.\n * @param {Duration} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n if (!this.loc.equals(other.loc)) {\n return false;\n }\n\n function eq(v1, v2) {\n // Consider 0 and undefined as equal\n if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0;\n return v1 === v2;\n }\n\n for (const u of orderedUnits) {\n if (!eq(this.values[u], other.values[u])) {\n return false;\n }\n }\n return true;\n }\n}\n","import DateTime, { friendlyDateTime } from \"./datetime.js\";\nimport Duration from \"./duration.js\";\nimport Settings from \"./settings.js\";\nimport { InvalidArgumentError, InvalidIntervalError } from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport * as Formats from \"./impl/formats.js\";\n\nconst INVALID = \"Invalid Interval\";\n\n// checks if the start is equal to or before the end\nfunction validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\n \"end before start\",\n `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`\n );\n } else {\n return null;\n }\n}\n\n/**\n * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.\n *\n * Here is a brief overview of the most commonly used methods and getters in Interval:\n *\n * * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}.\n * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end.\n * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}.\n * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}.\n * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}\n * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}.\n */\nexport default class Interval {\n /**\n * @private\n */\n constructor(config) {\n /**\n * @access private\n */\n this.s = config.start;\n /**\n * @access private\n */\n this.e = config.end;\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.isLuxonInterval = true;\n }\n\n /**\n * Create an invalid Interval.\n * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Interval}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Interval is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidIntervalError(invalid);\n } else {\n return new Interval({ invalid });\n }\n }\n\n /**\n * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.\n * @param {DateTime|Date|Object} start\n * @param {DateTime|Date|Object} end\n * @return {Interval}\n */\n static fromDateTimes(start, end) {\n const builtStart = friendlyDateTime(start),\n builtEnd = friendlyDateTime(end);\n\n const validateError = validateStartEnd(builtStart, builtEnd);\n\n if (validateError == null) {\n return new Interval({\n start: builtStart,\n end: builtEnd,\n });\n } else {\n return validateError;\n }\n }\n\n /**\n * Create an Interval from a start DateTime and a Duration to extend to.\n * @param {DateTime|Date|Object} start\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static after(start, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(start);\n return Interval.fromDateTimes(dt, dt.plus(dur));\n }\n\n /**\n * Create an Interval from an end DateTime and a Duration to extend backwards to.\n * @param {DateTime|Date|Object} end\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static before(end, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(end);\n return Interval.fromDateTimes(dt.minus(dur), dt);\n }\n\n /**\n * Create an Interval from an ISO 8601 string.\n * Accepts `/`, `/`, and `/` formats.\n * @param {string} text - the ISO string to parse\n * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO}\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {Interval}\n */\n static fromISO(text, opts) {\n const [s, e] = (text || \"\").split(\"/\", 2);\n if (s && e) {\n let start, startIsValid;\n try {\n start = DateTime.fromISO(s, opts);\n startIsValid = start.isValid;\n } catch (e) {\n startIsValid = false;\n }\n\n let end, endIsValid;\n try {\n end = DateTime.fromISO(e, opts);\n endIsValid = end.isValid;\n } catch (e) {\n endIsValid = false;\n }\n\n if (startIsValid && endIsValid) {\n return Interval.fromDateTimes(start, end);\n }\n\n if (startIsValid) {\n const dur = Duration.fromISO(e, opts);\n if (dur.isValid) {\n return Interval.after(start, dur);\n }\n } else if (endIsValid) {\n const dur = Duration.fromISO(s, opts);\n if (dur.isValid) {\n return Interval.before(end, dur);\n }\n }\n }\n return Interval.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n\n /**\n * Check if an object is an Interval. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isInterval(o) {\n return (o && o.isLuxonInterval) || false;\n }\n\n /**\n * Returns the start of the Interval\n * @type {DateTime}\n */\n get start() {\n return this.isValid ? this.s : null;\n }\n\n /**\n * Returns the end of the Interval. This is the first instant which is not part of the interval\n * (Interval is half-open).\n * @type {DateTime}\n */\n get end() {\n return this.isValid ? this.e : null;\n }\n\n /**\n * Returns the last DateTime included in the interval (since end is not part of the interval)\n * @type {DateTime}\n */\n get lastDateTime() {\n return this.isValid ? (this.e ? this.e.minus(1) : null) : null;\n }\n\n /**\n * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.\n * @type {boolean}\n */\n get isValid() {\n return this.invalidReason === null;\n }\n\n /**\n * Returns an error code if this Interval is invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Interval became invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Returns the length of the Interval in the specified unit.\n * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.\n * @return {number}\n */\n length(unit = \"milliseconds\") {\n return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;\n }\n\n /**\n * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.\n * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'\n * asks 'what dates are included in this interval?', not 'how many days long is this interval?'\n * @param {string} [unit='milliseconds'] - the unit of time to count.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime\n * @return {number}\n */\n count(unit = \"milliseconds\", opts) {\n if (!this.isValid) return NaN;\n const start = this.start.startOf(unit, opts);\n let end;\n if (opts?.useLocaleWeeks) {\n end = this.end.reconfigure({ locale: start.locale });\n } else {\n end = this.end;\n }\n end = end.startOf(unit, opts);\n return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());\n }\n\n /**\n * Returns whether this Interval's start and end are both in the same unit of time\n * @param {string} unit - the unit of time to check sameness on\n * @return {boolean}\n */\n hasSame(unit) {\n return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;\n }\n\n /**\n * Return whether this Interval has the same start and end DateTimes.\n * @return {boolean}\n */\n isEmpty() {\n return this.s.valueOf() === this.e.valueOf();\n }\n\n /**\n * Return whether this Interval's start is after the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isAfter(dateTime) {\n if (!this.isValid) return false;\n return this.s > dateTime;\n }\n\n /**\n * Return whether this Interval's end is before the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isBefore(dateTime) {\n if (!this.isValid) return false;\n return this.e <= dateTime;\n }\n\n /**\n * Return whether this Interval contains the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n contains(dateTime) {\n if (!this.isValid) return false;\n return this.s <= dateTime && this.e > dateTime;\n }\n\n /**\n * \"Sets\" the start and/or end dates. Returns a newly-constructed Interval.\n * @param {Object} values - the values to set\n * @param {DateTime} values.start - the starting DateTime\n * @param {DateTime} values.end - the ending DateTime\n * @return {Interval}\n */\n set({ start, end } = {}) {\n if (!this.isValid) return this;\n return Interval.fromDateTimes(start || this.s, end || this.e);\n }\n\n /**\n * Split this Interval at each of the specified DateTimes\n * @param {...DateTime} dateTimes - the unit of time to count.\n * @return {Array}\n */\n splitAt(...dateTimes) {\n if (!this.isValid) return [];\n const sorted = dateTimes\n .map(friendlyDateTime)\n .filter((d) => this.contains(d))\n .sort((a, b) => a.toMillis() - b.toMillis()),\n results = [];\n let { s } = this,\n i = 0;\n\n while (s < this.e) {\n const added = sorted[i] || this.e,\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n i += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into smaller Intervals, each of the specified length.\n * Left over time is grouped into a smaller interval\n * @param {Duration|Object|number} duration - The length of each resulting interval.\n * @return {Array}\n */\n splitBy(duration) {\n const dur = Duration.fromDurationLike(duration);\n\n if (!this.isValid || !dur.isValid || dur.as(\"milliseconds\") === 0) {\n return [];\n }\n\n let { s } = this,\n idx = 1,\n next;\n\n const results = [];\n while (s < this.e) {\n const added = this.start.plus(dur.mapUnits((x) => x * idx));\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n idx += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into the specified number of smaller intervals.\n * @param {number} numberOfParts - The number of Intervals to divide the Interval into.\n * @return {Array}\n */\n divideEqually(numberOfParts) {\n if (!this.isValid) return [];\n return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);\n }\n\n /**\n * Return whether this Interval overlaps with the specified Interval\n * @param {Interval} other\n * @return {boolean}\n */\n overlaps(other) {\n return this.e > other.s && this.s < other.e;\n }\n\n /**\n * Return whether this Interval's end is adjacent to the specified Interval's start.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsStart(other) {\n if (!this.isValid) return false;\n return +this.e === +other.s;\n }\n\n /**\n * Return whether this Interval's start is adjacent to the specified Interval's end.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsEnd(other) {\n if (!this.isValid) return false;\n return +other.e === +this.s;\n }\n\n /**\n * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise.\n * @param {Interval} other\n * @return {boolean}\n */\n engulfs(other) {\n if (!this.isValid) return false;\n return this.s <= other.s && this.e >= other.e;\n }\n\n /**\n * Return whether this Interval has the same start and end as the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n return this.s.equals(other.s) && this.e.equals(other.e);\n }\n\n /**\n * Return an Interval representing the intersection of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.\n * Returns null if the intersection is empty, meaning, the intervals don't intersect.\n * @param {Interval} other\n * @return {Interval}\n */\n intersection(other) {\n if (!this.isValid) return this;\n const s = this.s > other.s ? this.s : other.s,\n e = this.e < other.e ? this.e : other.e;\n\n if (s >= e) {\n return null;\n } else {\n return Interval.fromDateTimes(s, e);\n }\n }\n\n /**\n * Return an Interval representing the union of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.\n * @param {Interval} other\n * @return {Interval}\n */\n union(other) {\n if (!this.isValid) return this;\n const s = this.s < other.s ? this.s : other.s,\n e = this.e > other.e ? this.e : other.e;\n return Interval.fromDateTimes(s, e);\n }\n\n /**\n * Merge an array of Intervals into an equivalent minimal set of Intervals.\n * Combines overlapping and adjacent Intervals.\n * The resulting array will contain the Intervals in ascending order, that is, starting with the earliest Interval\n * and ending with the latest.\n *\n * @param {Array} intervals\n * @return {Array}\n */\n static merge(intervals) {\n const [found, final] = intervals\n .sort((a, b) => a.s - b.s)\n .reduce(\n ([sofar, current], item) => {\n if (!current) {\n return [sofar, item];\n } else if (current.overlaps(item) || current.abutsStart(item)) {\n return [sofar, current.union(item)];\n } else {\n return [sofar.concat([current]), item];\n }\n },\n [[], null]\n );\n if (final) {\n found.push(final);\n }\n return found;\n }\n\n /**\n * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.\n * @param {Array} intervals\n * @return {Array}\n */\n static xor(intervals) {\n let start = null,\n currentCount = 0;\n const results = [],\n ends = intervals.map((i) => [\n { time: i.s, type: \"s\" },\n { time: i.e, type: \"e\" },\n ]),\n flattened = Array.prototype.concat(...ends),\n arr = flattened.sort((a, b) => a.time - b.time);\n\n for (const i of arr) {\n currentCount += i.type === \"s\" ? 1 : -1;\n\n if (currentCount === 1) {\n start = i.time;\n } else {\n if (start && +start !== +i.time) {\n results.push(Interval.fromDateTimes(start, i.time));\n }\n\n start = null;\n }\n }\n\n return Interval.merge(results);\n }\n\n /**\n * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.\n * @param {...Interval} intervals\n * @return {Array}\n */\n difference(...intervals) {\n return Interval.xor([this].concat(intervals))\n .map((i) => this.intersection(i))\n .filter((i) => i && !i.isEmpty());\n }\n\n /**\n * Returns a string representation of this Interval appropriate for debugging.\n * @return {string}\n */\n toString() {\n if (!this.isValid) return INVALID;\n return `[${this.s.toISO()} – ${this.e.toISO()})`;\n }\n\n /**\n * Returns a string representation of this Interval appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;\n } else {\n return `Interval { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns a localized string representing this Interval. Accepts the same options as the\n * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as\n * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method\n * is browser-specific, but in general it will return an appropriate representation of the\n * Interval in the assigned locale. Defaults to the system's locale if no locale has been\n * specified.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or\n * Intl.DateTimeFormat constructor options.\n * @param {Object} opts - Options to override the configuration of the start DateTime.\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022\n * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM\n * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p\n * @return {string}\n */\n toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) {\n return this.isValid\n ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this)\n : INVALID;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Interval.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISO(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of date of this Interval.\n * The time components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {string}\n */\n toISODate() {\n if (!this.isValid) return INVALID;\n return `${this.s.toISODate()}/${this.e.toISODate()}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of time of this Interval.\n * The date components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISOTime(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this Interval formatted according to the specified format\n * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible\n * formatting tool.\n * @param {string} dateFormat - The format string. This string formats the start and end time.\n * See {@link DateTime#toFormat} for details.\n * @param {Object} opts - Options.\n * @param {string} [opts.separator = ' – '] - A separator to place between the start and end\n * representations.\n * @return {string}\n */\n toFormat(dateFormat, { separator = \" – \" } = {}) {\n if (!this.isValid) return INVALID;\n return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;\n }\n\n /**\n * Return a Duration representing the time spanned by this interval.\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }\n * @return {Duration}\n */\n toDuration(unit, opts) {\n if (!this.isValid) {\n return Duration.invalid(this.invalidReason);\n }\n return this.e.diff(this.s, unit, opts);\n }\n\n /**\n * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes\n * @param {function} mapFn\n * @return {Interval}\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))\n */\n mapEndpoints(mapFn) {\n return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Settings from \"./settings.js\";\nimport Locale from \"./impl/locale.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nimport { hasLocaleWeekInfo, hasRelative } from \"./impl/util.js\";\n\n/**\n * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.\n */\nexport default class Info {\n /**\n * Return whether the specified zone contains a DST.\n * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.\n * @return {boolean}\n */\n static hasDST(zone = Settings.defaultZone) {\n const proto = DateTime.now().setZone(zone).set({ month: 12 });\n\n return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset;\n }\n\n /**\n * Return whether the specified zone is a valid IANA specifier.\n * @param {string} zone - Zone to check\n * @return {boolean}\n */\n static isValidIANAZone(zone) {\n return IANAZone.isValidZone(zone);\n }\n\n /**\n * Converts the input into a {@link Zone} instance.\n *\n * * If `input` is already a Zone instance, it is returned unchanged.\n * * If `input` is a string containing a valid time zone name, a Zone instance\n * with that name is returned.\n * * If `input` is a string that doesn't refer to a known time zone, a Zone\n * instance with {@link Zone#isValid} == false is returned.\n * * If `input is a number, a Zone instance with the specified fixed offset\n * in minutes is returned.\n * * If `input` is `null` or `undefined`, the default zone is returned.\n * @param {string|Zone|number} [input] - the value to be converted\n * @return {Zone}\n */\n static normalizeZone(input) {\n return normalizeZone(input, Settings.defaultZone);\n }\n\n /**\n * Get the weekday on which the week starts according to the given locale.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number} the start of the week, 1 for Monday through 7 for Sunday\n */\n static getStartOfWeek({ locale = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale)).getStartOfWeek();\n }\n\n /**\n * Get the minimum number of days necessary in a week before it is considered part of the next year according\n * to the given locale.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number}\n */\n static getMinimumDaysInFirstWeek({ locale = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();\n }\n\n /**\n * Get the weekdays, which are considered the weekend according to the given locale\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday\n */\n static getWeekendWeekdays({ locale = null, locObj = null } = {}) {\n // copy the array, because we cache it internally\n return (locObj || Locale.create(locale)).getWeekendDays().slice();\n }\n\n /**\n * Return an array of standalone month names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @example Info.months()[0] //=> 'January'\n * @example Info.months('short')[0] //=> 'Jan'\n * @example Info.months('numeric')[0] //=> '1'\n * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'\n * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'\n * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'\n * @return {Array}\n */\n static months(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);\n }\n\n /**\n * Return an array of format month names.\n * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that\n * changes the string.\n * See {@link Info#months}\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @return {Array}\n */\n static monthsFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);\n }\n\n /**\n * Return an array of standalone week names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the weekday representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @example Info.weekdays()[0] //=> 'Monday'\n * @example Info.weekdays('short')[0] //=> 'Mon'\n * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'\n * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'\n * @return {Array}\n */\n static weekdays(length = \"long\", { locale = null, numberingSystem = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);\n }\n\n /**\n * Return an array of format week names.\n * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that\n * changes the string.\n * See {@link Info#weekdays}\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale=null] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @return {Array}\n */\n static weekdaysFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);\n }\n\n /**\n * Return an array of meridiems.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.meridiems() //=> [ 'AM', 'PM' ]\n * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]\n * @return {Array}\n */\n static meridiems({ locale = null } = {}) {\n return Locale.create(locale).meridiems();\n }\n\n /**\n * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.\n * @param {string} [length='short'] - the length of the era representation, such as \"short\" or \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.eras() //=> [ 'BC', 'AD' ]\n * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]\n * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]\n * @return {Array}\n */\n static eras(length = \"short\", { locale = null } = {}) {\n return Locale.create(locale, null, \"gregory\").eras(length);\n }\n\n /**\n * Return the set of available features in this environment.\n * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.\n * Keys:\n * * `relative`: whether this environment supports relative time formatting\n * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale\n * @example Info.features() //=> { relative: false, localeWeek: true }\n * @return {Object}\n */\n static features() {\n return { relative: hasRelative(), localeWeek: hasLocaleWeekInfo() };\n }\n}\n","import Duration from \"../duration.js\";\n\nfunction dayDiff(earlier, later) {\n const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf(\"day\").valueOf(),\n ms = utcDayStart(later) - utcDayStart(earlier);\n return Math.floor(Duration.fromMillis(ms).as(\"days\"));\n}\n\nfunction highOrderDiffs(cursor, later, units) {\n const differs = [\n [\"years\", (a, b) => b.year - a.year],\n [\"quarters\", (a, b) => b.quarter - a.quarter + (b.year - a.year) * 4],\n [\"months\", (a, b) => b.month - a.month + (b.year - a.year) * 12],\n [\n \"weeks\",\n (a, b) => {\n const days = dayDiff(a, b);\n return (days - (days % 7)) / 7;\n },\n ],\n [\"days\", dayDiff],\n ];\n\n const results = {};\n const earlier = cursor;\n let lowestOrder, highWater;\n\n /* This loop tries to diff using larger units first.\n If we overshoot, we backtrack and try the next smaller unit.\n \"cursor\" starts out at the earlier timestamp and moves closer and closer to \"later\"\n as we use smaller and smaller units.\n highWater keeps track of where we would be if we added one more of the smallest unit,\n this is used later to potentially convert any difference smaller than the smallest higher order unit\n into a fraction of that smallest higher order unit\n */\n for (const [unit, differ] of differs) {\n if (units.indexOf(unit) >= 0) {\n lowestOrder = unit;\n\n results[unit] = differ(cursor, later);\n highWater = earlier.plus(results);\n\n if (highWater > later) {\n // we overshot the end point, backtrack cursor by 1\n results[unit]--;\n cursor = earlier.plus(results);\n\n // if we are still overshooting now, we need to backtrack again\n // this happens in certain situations when diffing times in different zones,\n // because this calculation ignores time zones\n if (cursor > later) {\n // keep the \"overshot by 1\" around as highWater\n highWater = cursor;\n // backtrack cursor by 1\n results[unit]--;\n cursor = earlier.plus(results);\n }\n } else {\n cursor = highWater;\n }\n }\n }\n\n return [cursor, results, highWater, lowestOrder];\n}\n\nexport default function (earlier, later, units, opts) {\n let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);\n\n const remainingMillis = later - cursor;\n\n const lowerOrderUnits = units.filter(\n (u) => [\"hours\", \"minutes\", \"seconds\", \"milliseconds\"].indexOf(u) >= 0\n );\n\n if (lowerOrderUnits.length === 0) {\n if (highWater < later) {\n highWater = cursor.plus({ [lowestOrder]: 1 });\n }\n\n if (highWater !== cursor) {\n results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);\n }\n }\n\n const duration = Duration.fromObject(results, opts);\n\n if (lowerOrderUnits.length > 0) {\n return Duration.fromMillis(remainingMillis, opts)\n .shiftTo(...lowerOrderUnits)\n .plus(duration);\n } else {\n return duration;\n }\n}\n","import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from \"./util.js\";\nimport Formatter from \"./formatter.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport DateTime from \"../datetime.js\";\nimport { digitRegex, parseDigits } from \"./digits.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst MISSING_FTP = \"missing Intl.DateTimeFormat.formatToParts support\";\n\nfunction intUnit(regex, post = (i) => i) {\n return { regex, deser: ([s]) => post(parseDigits(s)) };\n}\n\nconst NBSP = String.fromCharCode(160);\nconst spaceOrNBSP = `[ ${NBSP}]`;\nconst spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, \"g\");\n\nfunction fixListRegex(s) {\n // make dots optional and also make them literal\n // make space and non breakable space characters interchangeable\n return s.replace(/\\./g, \"\\\\.?\").replace(spaceOrNBSPRegExp, spaceOrNBSP);\n}\n\nfunction stripInsensitivities(s) {\n return s\n .replace(/\\./g, \"\") // ignore dots that were made optional\n .replace(spaceOrNBSPRegExp, \" \") // interchange space and nbsp\n .toLowerCase();\n}\n\nfunction oneOf(strings, startIndex) {\n if (strings === null) {\n return null;\n } else {\n return {\n regex: RegExp(strings.map(fixListRegex).join(\"|\")),\n deser: ([s]) =>\n strings.findIndex((i) => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex,\n };\n }\n}\n\nfunction offset(regex, groups) {\n return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };\n}\n\nfunction simple(regex) {\n return { regex, deser: ([s]) => s };\n}\n\nfunction escapeToken(value) {\n return value.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n}\n\n/**\n * @param token\n * @param {Locale} loc\n */\nfunction unitForToken(token, loc) {\n const one = digitRegex(loc),\n two = digitRegex(loc, \"{2}\"),\n three = digitRegex(loc, \"{3}\"),\n four = digitRegex(loc, \"{4}\"),\n six = digitRegex(loc, \"{6}\"),\n oneOrTwo = digitRegex(loc, \"{1,2}\"),\n oneToThree = digitRegex(loc, \"{1,3}\"),\n oneToSix = digitRegex(loc, \"{1,6}\"),\n oneToNine = digitRegex(loc, \"{1,9}\"),\n twoToFour = digitRegex(loc, \"{2,4}\"),\n fourToSix = digitRegex(loc, \"{4,6}\"),\n literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }),\n unitate = (t) => {\n if (token.literal) {\n return literal(t);\n }\n switch (t.val) {\n // era\n case \"G\":\n return oneOf(loc.eras(\"short\"), 0);\n case \"GG\":\n return oneOf(loc.eras(\"long\"), 0);\n // years\n case \"y\":\n return intUnit(oneToSix);\n case \"yy\":\n return intUnit(twoToFour, untruncateYear);\n case \"yyyy\":\n return intUnit(four);\n case \"yyyyy\":\n return intUnit(fourToSix);\n case \"yyyyyy\":\n return intUnit(six);\n // months\n case \"M\":\n return intUnit(oneOrTwo);\n case \"MM\":\n return intUnit(two);\n case \"MMM\":\n return oneOf(loc.months(\"short\", true), 1);\n case \"MMMM\":\n return oneOf(loc.months(\"long\", true), 1);\n case \"L\":\n return intUnit(oneOrTwo);\n case \"LL\":\n return intUnit(two);\n case \"LLL\":\n return oneOf(loc.months(\"short\", false), 1);\n case \"LLLL\":\n return oneOf(loc.months(\"long\", false), 1);\n // dates\n case \"d\":\n return intUnit(oneOrTwo);\n case \"dd\":\n return intUnit(two);\n // ordinals\n case \"o\":\n return intUnit(oneToThree);\n case \"ooo\":\n return intUnit(three);\n // time\n case \"HH\":\n return intUnit(two);\n case \"H\":\n return intUnit(oneOrTwo);\n case \"hh\":\n return intUnit(two);\n case \"h\":\n return intUnit(oneOrTwo);\n case \"mm\":\n return intUnit(two);\n case \"m\":\n return intUnit(oneOrTwo);\n case \"q\":\n return intUnit(oneOrTwo);\n case \"qq\":\n return intUnit(two);\n case \"s\":\n return intUnit(oneOrTwo);\n case \"ss\":\n return intUnit(two);\n case \"S\":\n return intUnit(oneToThree);\n case \"SSS\":\n return intUnit(three);\n case \"u\":\n return simple(oneToNine);\n case \"uu\":\n return simple(oneOrTwo);\n case \"uuu\":\n return intUnit(one);\n // meridiem\n case \"a\":\n return oneOf(loc.meridiems(), 0);\n // weekYear (k)\n case \"kkkk\":\n return intUnit(four);\n case \"kk\":\n return intUnit(twoToFour, untruncateYear);\n // weekNumber (W)\n case \"W\":\n return intUnit(oneOrTwo);\n case \"WW\":\n return intUnit(two);\n // weekdays\n case \"E\":\n case \"c\":\n return intUnit(one);\n case \"EEE\":\n return oneOf(loc.weekdays(\"short\", false), 1);\n case \"EEEE\":\n return oneOf(loc.weekdays(\"long\", false), 1);\n case \"ccc\":\n return oneOf(loc.weekdays(\"short\", true), 1);\n case \"cccc\":\n return oneOf(loc.weekdays(\"long\", true), 1);\n // offset/zone\n case \"Z\":\n case \"ZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);\n case \"ZZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);\n // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing\n // because we don't have any way to figure out what they are\n case \"z\":\n return simple(/[a-z_+-/]{1,256}?/i);\n // this special-case \"token\" represents a place where a macro-token expanded into a white-space literal\n // in this case we accept any non-newline white-space\n case \" \":\n return simple(/[^\\S\\n\\r]/);\n default:\n return literal(t);\n }\n };\n\n const unit = unitate(token) || {\n invalidReason: MISSING_FTP,\n };\n\n unit.token = token;\n\n return unit;\n}\n\nconst partTypeStyleToTokenVal = {\n year: {\n \"2-digit\": \"yy\",\n numeric: \"yyyyy\",\n },\n month: {\n numeric: \"M\",\n \"2-digit\": \"MM\",\n short: \"MMM\",\n long: \"MMMM\",\n },\n day: {\n numeric: \"d\",\n \"2-digit\": \"dd\",\n },\n weekday: {\n short: \"EEE\",\n long: \"EEEE\",\n },\n dayperiod: \"a\",\n dayPeriod: \"a\",\n hour12: {\n numeric: \"h\",\n \"2-digit\": \"hh\",\n },\n hour24: {\n numeric: \"H\",\n \"2-digit\": \"HH\",\n },\n minute: {\n numeric: \"m\",\n \"2-digit\": \"mm\",\n },\n second: {\n numeric: \"s\",\n \"2-digit\": \"ss\",\n },\n timeZoneName: {\n long: \"ZZZZZ\",\n short: \"ZZZ\",\n },\n};\n\nfunction tokenForPart(part, formatOpts, resolvedOpts) {\n const { type, value } = part;\n\n if (type === \"literal\") {\n const isSpace = /^\\s+$/.test(value);\n return {\n literal: !isSpace,\n val: isSpace ? \" \" : value,\n };\n }\n\n const style = formatOpts[type];\n\n // The user might have explicitly specified hour12 or hourCycle\n // if so, respect their decision\n // if not, refer back to the resolvedOpts, which are based on the locale\n let actualType = type;\n if (type === \"hour\") {\n if (formatOpts.hour12 != null) {\n actualType = formatOpts.hour12 ? \"hour12\" : \"hour24\";\n } else if (formatOpts.hourCycle != null) {\n if (formatOpts.hourCycle === \"h11\" || formatOpts.hourCycle === \"h12\") {\n actualType = \"hour12\";\n } else {\n actualType = \"hour24\";\n }\n } else {\n // tokens only differentiate between 24 hours or not,\n // so we do not need to check hourCycle here, which is less supported anyways\n actualType = resolvedOpts.hour12 ? \"hour12\" : \"hour24\";\n }\n }\n let val = partTypeStyleToTokenVal[actualType];\n if (typeof val === \"object\") {\n val = val[style];\n }\n\n if (val) {\n return {\n literal: false,\n val,\n };\n }\n\n return undefined;\n}\n\nfunction buildRegex(units) {\n const re = units.map((u) => u.regex).reduce((f, r) => `${f}(${r.source})`, \"\");\n return [`^${re}$`, units];\n}\n\nfunction match(input, regex, handlers) {\n const matches = input.match(regex);\n\n if (matches) {\n const all = {};\n let matchIndex = 1;\n for (const i in handlers) {\n if (hasOwnProperty(handlers, i)) {\n const h = handlers[i],\n groups = h.groups ? h.groups + 1 : 1;\n if (!h.literal && h.token) {\n all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));\n }\n matchIndex += groups;\n }\n }\n return [matches, all];\n } else {\n return [matches, {}];\n }\n}\n\nfunction dateTimeFromMatches(matches) {\n const toField = (token) => {\n switch (token) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n case \"H\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"o\":\n return \"ordinal\";\n case \"L\":\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n case \"E\":\n case \"c\":\n return \"weekday\";\n case \"W\":\n return \"weekNumber\";\n case \"k\":\n return \"weekYear\";\n case \"q\":\n return \"quarter\";\n default:\n return null;\n }\n };\n\n let zone = null;\n let specificOffset;\n if (!isUndefined(matches.z)) {\n zone = IANAZone.create(matches.z);\n }\n\n if (!isUndefined(matches.Z)) {\n if (!zone) {\n zone = new FixedOffsetZone(matches.Z);\n }\n specificOffset = matches.Z;\n }\n\n if (!isUndefined(matches.q)) {\n matches.M = (matches.q - 1) * 3 + 1;\n }\n\n if (!isUndefined(matches.h)) {\n if (matches.h < 12 && matches.a === 1) {\n matches.h += 12;\n } else if (matches.h === 12 && matches.a === 0) {\n matches.h = 0;\n }\n }\n\n if (matches.G === 0 && matches.y) {\n matches.y = -matches.y;\n }\n\n if (!isUndefined(matches.u)) {\n matches.S = parseMillis(matches.u);\n }\n\n const vals = Object.keys(matches).reduce((r, k) => {\n const f = toField(k);\n if (f) {\n r[f] = matches[k];\n }\n\n return r;\n }, {});\n\n return [vals, zone, specificOffset];\n}\n\nlet dummyDateTimeCache = null;\n\nfunction getDummyDateTime() {\n if (!dummyDateTimeCache) {\n dummyDateTimeCache = DateTime.fromMillis(1555555555555);\n }\n\n return dummyDateTimeCache;\n}\n\nfunction maybeExpandMacroToken(token, locale) {\n if (token.literal) {\n return token;\n }\n\n const formatOpts = Formatter.macroTokenToFormatOpts(token.val);\n const tokens = formatOptsToTokens(formatOpts, locale);\n\n if (tokens == null || tokens.includes(undefined)) {\n return token;\n }\n\n return tokens;\n}\n\nexport function expandMacroTokens(tokens, locale) {\n return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale)));\n}\n\n/**\n * @private\n */\n\nexport class TokenParser {\n constructor(locale, format) {\n this.locale = locale;\n this.format = format;\n this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale);\n this.units = this.tokens.map((t) => unitForToken(t, locale));\n this.disqualifyingUnit = this.units.find((t) => t.invalidReason);\n\n if (!this.disqualifyingUnit) {\n const [regexString, handlers] = buildRegex(this.units);\n this.regex = RegExp(regexString, \"i\");\n this.handlers = handlers;\n }\n }\n\n explainFromTokens(input) {\n if (!this.isValid) {\n return { input, tokens: this.tokens, invalidReason: this.invalidReason };\n } else {\n const [rawMatches, matches] = match(input, this.regex, this.handlers),\n [result, zone, specificOffset] = matches\n ? dateTimeFromMatches(matches)\n : [null, null, undefined];\n if (hasOwnProperty(matches, \"a\") && hasOwnProperty(matches, \"H\")) {\n throw new ConflictingSpecificationError(\n \"Can't include meridiem when specifying 24-hour format\"\n );\n }\n return {\n input,\n tokens: this.tokens,\n regex: this.regex,\n rawMatches,\n matches,\n result,\n zone,\n specificOffset,\n };\n }\n }\n\n get isValid() {\n return !this.disqualifyingUnit;\n }\n\n get invalidReason() {\n return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null;\n }\n}\n\nexport function explainFromTokens(locale, input, format) {\n const parser = new TokenParser(locale, format);\n return parser.explainFromTokens(input);\n}\n\nexport function parseFromTokens(locale, input, format) {\n const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format);\n return [result, zone, specificOffset, invalidReason];\n}\n\nexport function formatOptsToTokens(formatOpts, locale) {\n if (!formatOpts) {\n return null;\n }\n\n const formatter = Formatter.create(locale, formatOpts);\n const df = formatter.dtFormatter(getDummyDateTime());\n const parts = df.formatToParts();\n const resolvedOpts = df.resolvedOptions();\n return parts.map((p) => tokenForPart(p, formatOpts, resolvedOpts));\n}\n","import Duration from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Settings from \"./settings.js\";\nimport Info from \"./info.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport {\n isUndefined,\n maybeArray,\n isDate,\n isNumber,\n bestBy,\n daysInMonth,\n daysInYear,\n isLeapYear,\n weeksInWeekYear,\n normalizeObject,\n roundTo,\n objToLocalTS,\n padStart,\n} from \"./impl/util.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport diff from \"./impl/diff.js\";\nimport { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from \"./impl/regexParser.js\";\nimport {\n parseFromTokens,\n explainFromTokens,\n formatOptsToTokens,\n expandMacroTokens,\n TokenParser,\n} from \"./impl/tokenParser.js\";\nimport {\n gregorianToWeek,\n weekToGregorian,\n gregorianToOrdinal,\n ordinalToGregorian,\n hasInvalidGregorianData,\n hasInvalidWeekData,\n hasInvalidOrdinalData,\n hasInvalidTimeData,\n usesLocalWeekValues,\n isoWeekdayToLocal,\n} from \"./impl/conversions.js\";\nimport * as Formats from \"./impl/formats.js\";\nimport {\n InvalidArgumentError,\n ConflictingSpecificationError,\n InvalidUnitError,\n InvalidDateTimeError,\n} from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid DateTime\";\nconst MAX_DATE = 8.64e15;\n\nfunction unsupportedZone(zone) {\n return new Invalid(\"unsupported zone\", `the zone \"${zone.name}\" is not supported`);\n}\n\n// we cache week data on the DT object and this intermediates the cache\n/**\n * @param {DateTime} dt\n */\nfunction possiblyCachedWeekData(dt) {\n if (dt.weekData === null) {\n dt.weekData = gregorianToWeek(dt.c);\n }\n return dt.weekData;\n}\n\n/**\n * @param {DateTime} dt\n */\nfunction possiblyCachedLocalWeekData(dt) {\n if (dt.localWeekData === null) {\n dt.localWeekData = gregorianToWeek(\n dt.c,\n dt.loc.getMinDaysInFirstWeek(),\n dt.loc.getStartOfWeek()\n );\n }\n return dt.localWeekData;\n}\n\n// clone really means, \"make a new object with these modifications\". all \"setters\" really use this\n// to create a new object while only changing some of the properties\nfunction clone(inst, alts) {\n const current = {\n ts: inst.ts,\n zone: inst.zone,\n c: inst.c,\n o: inst.o,\n loc: inst.loc,\n invalid: inst.invalid,\n };\n return new DateTime({ ...current, ...alts, old: current });\n}\n\n// find the right offset a given local time. The o input is our guess, which determines which\n// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)\nfunction fixOffset(localTS, o, tz) {\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - o * 60 * 1000;\n\n // Test whether the zone matches the offset for this ts\n const o2 = tz.offset(utcGuess);\n\n // If so, offset didn't change and we're done\n if (o === o2) {\n return [utcGuess, o];\n }\n\n // If not, change the ts by the difference in the offset\n utcGuess -= (o2 - o) * 60 * 1000;\n\n // If that gives us the local time we want, we're done\n const o3 = tz.offset(utcGuess);\n if (o2 === o3) {\n return [utcGuess, o2];\n }\n\n // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time\n return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];\n}\n\n// convert an epoch timestamp into a calendar object with the given offset\nfunction tsToObj(ts, offset) {\n ts += offset * 60 * 1000;\n\n const d = new Date(ts);\n\n return {\n year: d.getUTCFullYear(),\n month: d.getUTCMonth() + 1,\n day: d.getUTCDate(),\n hour: d.getUTCHours(),\n minute: d.getUTCMinutes(),\n second: d.getUTCSeconds(),\n millisecond: d.getUTCMilliseconds(),\n };\n}\n\n// convert a calendar object to a epoch timestamp\nfunction objToTS(obj, offset, zone) {\n return fixOffset(objToLocalTS(obj), offset, zone);\n}\n\n// create a new DT instance by adding a duration, adjusting for DSTs\nfunction adjustTime(inst, dur) {\n const oPre = inst.o,\n year = inst.c.year + Math.trunc(dur.years),\n month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3,\n c = {\n ...inst.c,\n year,\n month,\n day:\n Math.min(inst.c.day, daysInMonth(year, month)) +\n Math.trunc(dur.days) +\n Math.trunc(dur.weeks) * 7,\n },\n millisToAdd = Duration.fromObject({\n years: dur.years - Math.trunc(dur.years),\n quarters: dur.quarters - Math.trunc(dur.quarters),\n months: dur.months - Math.trunc(dur.months),\n weeks: dur.weeks - Math.trunc(dur.weeks),\n days: dur.days - Math.trunc(dur.days),\n hours: dur.hours,\n minutes: dur.minutes,\n seconds: dur.seconds,\n milliseconds: dur.milliseconds,\n }).as(\"milliseconds\"),\n localTS = objToLocalTS(c);\n\n let [ts, o] = fixOffset(localTS, oPre, inst.zone);\n\n if (millisToAdd !== 0) {\n ts += millisToAdd;\n // that could have changed the offset by going over a DST, but we want to keep the ts the same\n o = inst.zone.offset(ts);\n }\n\n return { ts, o };\n}\n\n// helper useful in turning the results of parsing into real dates\n// by handling the zone options\nfunction parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {\n const { setZone, zone } = opts;\n if ((parsed && Object.keys(parsed).length !== 0) || parsedZone) {\n const interpretationZone = parsedZone || zone,\n inst = DateTime.fromObject(parsed, {\n ...opts,\n zone: interpretationZone,\n specificOffset,\n });\n return setZone ? inst : inst.setZone(zone);\n } else {\n return DateTime.invalid(\n new Invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ${format}`)\n );\n }\n}\n\n// if you want to output a technical format (e.g. RFC 2822), this helper\n// helps handle the details\nfunction toTechFormat(dt, format, allowZ = true) {\n return dt.isValid\n ? Formatter.create(Locale.create(\"en-US\"), {\n allowZ,\n forceSimple: true,\n }).formatDateTimeFromString(dt, format)\n : null;\n}\n\nfunction toISODate(o, extended, precision) {\n const longFormat = o.c.year > 9999 || o.c.year < 0;\n let c = \"\";\n if (longFormat && o.c.year >= 0) c += \"+\";\n c += padStart(o.c.year, longFormat ? 6 : 4);\n if (precision === \"year\") return c;\n if (extended) {\n c += \"-\";\n c += padStart(o.c.month);\n if (precision === \"month\") return c;\n c += \"-\";\n } else {\n c += padStart(o.c.month);\n if (precision === \"month\") return c;\n }\n c += padStart(o.c.day);\n return c;\n}\n\nfunction toISOTime(\n o,\n extended,\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n) {\n let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0,\n c = \"\";\n switch (precision) {\n case \"day\":\n case \"month\":\n case \"year\":\n break;\n default:\n c += padStart(o.c.hour);\n if (precision === \"hour\") break;\n if (extended) {\n c += \":\";\n c += padStart(o.c.minute);\n if (precision === \"minute\") break;\n if (showSeconds) {\n c += \":\";\n c += padStart(o.c.second);\n }\n } else {\n c += padStart(o.c.minute);\n if (precision === \"minute\") break;\n if (showSeconds) {\n c += padStart(o.c.second);\n }\n }\n if (precision === \"second\") break;\n if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) {\n c += \".\";\n c += padStart(o.c.millisecond, 3);\n }\n }\n\n if (includeOffset) {\n if (o.isOffsetFixed && o.offset === 0 && !extendedZone) {\n c += \"Z\";\n } else if (o.o < 0) {\n c += \"-\";\n c += padStart(Math.trunc(-o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(-o.o % 60));\n } else {\n c += \"+\";\n c += padStart(Math.trunc(o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(o.o % 60));\n }\n }\n\n if (extendedZone) {\n c += \"[\" + o.zone.ianaName + \"]\";\n }\n return c;\n}\n\n// defaults for unspecified units in the supported calendars\nconst defaultUnitValues = {\n month: 1,\n day: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultWeekUnitValues = {\n weekNumber: 1,\n weekday: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultOrdinalUnitValues = {\n ordinal: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n };\n\n// Units in the supported calendars, sorted by bigness\nconst orderedUnits = [\"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"millisecond\"],\n orderedWeekUnits = [\n \"weekYear\",\n \"weekNumber\",\n \"weekday\",\n \"hour\",\n \"minute\",\n \"second\",\n \"millisecond\",\n ],\n orderedOrdinalUnits = [\"year\", \"ordinal\", \"hour\", \"minute\", \"second\", \"millisecond\"];\n\n// standardize case and plurality in units\nfunction normalizeUnit(unit) {\n const normalized = {\n year: \"year\",\n years: \"year\",\n month: \"month\",\n months: \"month\",\n day: \"day\",\n days: \"day\",\n hour: \"hour\",\n hours: \"hour\",\n minute: \"minute\",\n minutes: \"minute\",\n quarter: \"quarter\",\n quarters: \"quarter\",\n second: \"second\",\n seconds: \"second\",\n millisecond: \"millisecond\",\n milliseconds: \"millisecond\",\n weekday: \"weekday\",\n weekdays: \"weekday\",\n weeknumber: \"weekNumber\",\n weeksnumber: \"weekNumber\",\n weeknumbers: \"weekNumber\",\n weekyear: \"weekYear\",\n weekyears: \"weekYear\",\n ordinal: \"ordinal\",\n }[unit.toLowerCase()];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n}\n\nfunction normalizeUnitWithLocalWeeks(unit) {\n switch (unit.toLowerCase()) {\n case \"localweekday\":\n case \"localweekdays\":\n return \"localWeekday\";\n case \"localweeknumber\":\n case \"localweeknumbers\":\n return \"localWeekNumber\";\n case \"localweekyear\":\n case \"localweekyears\":\n return \"localWeekYear\";\n default:\n return normalizeUnit(unit);\n }\n}\n\n// cache offsets for zones based on the current timestamp when this function is\n// first called. When we are handling a datetime from components like (year,\n// month, day, hour) in a time zone, we need a guess about what the timezone\n// offset is so that we can convert into a UTC timestamp. One way is to find the\n// offset of now in the zone. The actual date may have a different offset (for\n// example, if we handle a date in June while we're in December in a zone that\n// observes DST), but we can check and adjust that.\n//\n// When handling many dates, calculating the offset for now every time is\n// expensive. It's just a guess, so we can cache the offset to use even if we\n// are right on a time change boundary (we'll just correct in the other\n// direction). Using a timestamp from first read is a slight optimization for\n// handling dates close to the current date, since those dates will usually be\n// in the same offset (we could set the timestamp statically, instead). We use a\n// single timestamp for all zones to make things a bit more predictable.\n//\n// This is safe for quickDT (used by local() and utc()) because we don't fill in\n// higher-order units from tsNow (as we do in fromObject, this requires that\n// offset is calculated from tsNow).\n/**\n * @param {Zone} zone\n * @return {number}\n */\nfunction guessOffsetForZone(zone) {\n if (zoneOffsetTs === undefined) {\n zoneOffsetTs = Settings.now();\n }\n\n // Do not cache anything but IANA zones, because it is not safe to do so.\n // Guessing an offset which is not present in the zone can cause wrong results from fixOffset\n if (zone.type !== \"iana\") {\n return zone.offset(zoneOffsetTs);\n }\n const zoneName = zone.name;\n let offsetGuess = zoneOffsetGuessCache.get(zoneName);\n if (offsetGuess === undefined) {\n offsetGuess = zone.offset(zoneOffsetTs);\n zoneOffsetGuessCache.set(zoneName, offsetGuess);\n }\n return offsetGuess;\n}\n\n// this is a dumbed down version of fromObject() that runs about 60% faster\n// but doesn't do any validation, makes a bunch of assumptions about what units\n// are present, and so on.\nfunction quickDT(obj, opts) {\n const zone = normalizeZone(opts.zone, Settings.defaultZone);\n if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n }\n\n const loc = Locale.fromObject(opts);\n\n let ts, o;\n\n // assume we have the higher-order units\n if (!isUndefined(obj.year)) {\n for (const u of orderedUnits) {\n if (isUndefined(obj[u])) {\n obj[u] = defaultUnitValues[u];\n }\n }\n\n const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n const offsetProvis = guessOffsetForZone(zone);\n [ts, o] = objToTS(obj, offsetProvis, zone);\n } else {\n ts = Settings.now();\n }\n\n return new DateTime({ ts, zone, loc, o });\n}\n\nfunction diffRelative(start, end, opts) {\n const round = isUndefined(opts.round) ? true : opts.round,\n rounding = isUndefined(opts.rounding) ? \"trunc\" : opts.rounding,\n format = (c, unit) => {\n c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? \"round\" : rounding);\n const formatter = end.loc.clone(opts).relFormatter(opts);\n return formatter.format(c, unit);\n },\n differ = (unit) => {\n if (opts.calendary) {\n if (!end.hasSame(start, unit)) {\n return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);\n } else return 0;\n } else {\n return end.diff(start, unit).get(unit);\n }\n };\n\n if (opts.unit) {\n return format(differ(opts.unit), opts.unit);\n }\n\n for (const unit of opts.units) {\n const count = differ(unit);\n if (Math.abs(count) >= 1) {\n return format(count, unit);\n }\n }\n return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);\n}\n\nfunction lastOpts(argList) {\n let opts = {},\n args;\n if (argList.length > 0 && typeof argList[argList.length - 1] === \"object\") {\n opts = argList[argList.length - 1];\n args = Array.from(argList).slice(0, argList.length - 1);\n } else {\n args = Array.from(argList);\n }\n return [opts, args];\n}\n\n/**\n * Timestamp to use for cached zone offset guesses (exposed for test)\n */\nlet zoneOffsetTs;\n/**\n * Cache for zone offset guesses (exposed for test).\n *\n * This optimizes quickDT via guessOffsetForZone to avoid repeated calls of\n * zone.offset().\n */\nconst zoneOffsetGuessCache = new Map();\n\n/**\n * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them.\n *\n * A DateTime comprises of:\n * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch.\n * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone).\n * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`.\n *\n * Here is a brief overview of the most commonly used functionality it provides:\n *\n * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}.\n * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month},\n * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors.\n * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors.\n * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors.\n * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}.\n * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}.\n *\n * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.\n */\nexport default class DateTime {\n /**\n * @access private\n */\n constructor(config) {\n const zone = config.zone || Settings.defaultZone;\n\n let invalid =\n config.invalid ||\n (Number.isNaN(config.ts) ? new Invalid(\"invalid input\") : null) ||\n (!zone.isValid ? unsupportedZone(zone) : null);\n /**\n * @access private\n */\n this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;\n\n let c = null,\n o = null;\n if (!invalid) {\n const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);\n\n if (unchanged) {\n [c, o] = [config.old.c, config.old.o];\n } else {\n // If an offset has been passed and we have not been called from\n // clone(), we can trust it and avoid the offset calculation.\n const ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts);\n c = tsToObj(this.ts, ot);\n invalid = Number.isNaN(c.year) ? new Invalid(\"invalid input\") : null;\n c = invalid ? null : c;\n o = invalid ? null : ot;\n }\n }\n\n /**\n * @access private\n */\n this._zone = zone;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.invalid = invalid;\n /**\n * @access private\n */\n this.weekData = null;\n /**\n * @access private\n */\n this.localWeekData = null;\n /**\n * @access private\n */\n this.c = c;\n /**\n * @access private\n */\n this.o = o;\n /**\n * @access private\n */\n this.isLuxonDateTime = true;\n }\n\n // CONSTRUCT\n\n /**\n * Create a DateTime for the current instant, in the system's time zone.\n *\n * Use Settings to override these default values if needed.\n * @example DateTime.now().toISO() //~> now in the ISO format\n * @return {DateTime}\n */\n static now() {\n return new DateTime({});\n }\n\n /**\n * Create a local DateTime\n * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month, 1-indexed\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.local() //~> now\n * @example DateTime.local({ zone: \"America/New_York\" }) //~> now, in US east coast time\n * @example DateTime.local(2017) //~> 2017-01-01T00:00:00\n * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00\n * @example DateTime.local(2017, 3, 12, { locale: \"fr\" }) //~> 2017-03-12T00:00:00, with a French locale\n * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00\n * @example DateTime.local(2017, 3, 12, 5, { zone: \"utc\" }) //~> 2017-03-12T05:00:00, in UTC\n * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00\n * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10\n * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765\n * @return {DateTime}\n */\n static local() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime in UTC\n * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @param {Object} options - configuration options for the DateTime\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance\n * @example DateTime.utc() //~> now\n * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z\n * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z\n * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: \"fr\" }) //~> 2017-03-12T05:45:00Z with a French locale\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: \"fr\" }) //~> 2017-03-12T05:45:10.765Z with a French locale\n * @return {DateTime}\n */\n static utc() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n\n opts.zone = FixedOffsetZone.utcInstance;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime from a JavaScript Date object. Uses the default zone.\n * @param {Date} date - a JavaScript Date object\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @return {DateTime}\n */\n static fromJSDate(date, options = {}) {\n const ts = isDate(date) ? date.valueOf() : NaN;\n if (Number.isNaN(ts)) {\n return DateTime.invalid(\"invalid input\");\n }\n\n const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n return new DateTime({\n ts: ts,\n zone: zoneToUse,\n loc: Locale.fromObject(options),\n });\n }\n\n /**\n * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} milliseconds - a number of milliseconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromMillis(milliseconds, options = {}) {\n if (!isNumber(milliseconds)) {\n throw new InvalidArgumentError(\n `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`\n );\n } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {\n // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start\n return DateTime.invalid(\"Timestamp out of range\");\n } else {\n return new DateTime({\n ts: milliseconds,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} seconds - a number of seconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromSeconds(seconds, options = {}) {\n if (!isNumber(seconds)) {\n throw new InvalidArgumentError(\"fromSeconds requires a numerical input\");\n } else {\n return new DateTime({\n ts: seconds * 1000,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.year - a year, such as 1987\n * @param {number} obj.month - a month, 1-12\n * @param {number} obj.day - a day of the month, 1-31, depending on the month\n * @param {number} obj.ordinal - day of the year, 1-365 or 366\n * @param {number} obj.weekYear - an ISO week year\n * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year\n * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday\n * @param {number} obj.localWeekYear - a week year, according to the locale\n * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale\n * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale\n * @param {number} obj.hour - hour of the day, 0-23\n * @param {number} obj.minute - minute of the hour, 0-59\n * @param {number} obj.second - second of the minute, 0-59\n * @param {number} obj.millisecond - millisecond of the second, 0-999\n * @param {Object} opts - options for creating this DateTime\n * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()\n * @param {string} [opts.locale='system\\'s locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'\n * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }),\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })\n * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'\n * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: \"en-US\" }).toISODate() //=> '2021-12-26'\n * @return {DateTime}\n */\n static fromObject(obj, opts = {}) {\n obj = obj || {};\n const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n const loc = Locale.fromObject(opts);\n const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);\n const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, loc);\n\n const tsNow = Settings.now(),\n offsetProvis = !isUndefined(opts.specificOffset)\n ? opts.specificOffset\n : zoneToUse.offset(tsNow),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber;\n\n // cases:\n // just a weekday -> this week's instance of that weekday, no worries\n // (gregorian data or ordinal) + (weekYear or weekNumber) -> error\n // (gregorian month or day) + ordinal -> error\n // otherwise just use weeks or ordinals or gregorian, depending on what's specified\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor);\n\n // configure ourselves to deal with gregorian dates or week stuff\n let units,\n defaultValues,\n objNow = tsToObj(tsNow, offsetProvis);\n if (useWeekData) {\n units = orderedWeekUnits;\n defaultValues = defaultWeekUnitValues;\n objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);\n } else if (containsOrdinal) {\n units = orderedOrdinalUnits;\n defaultValues = defaultOrdinalUnitValues;\n objNow = gregorianToOrdinal(objNow);\n } else {\n units = orderedUnits;\n defaultValues = defaultUnitValues;\n }\n\n // set default values for missing stuff\n let foundFirst = false;\n for (const u of units) {\n const v = normalized[u];\n if (!isUndefined(v)) {\n foundFirst = true;\n } else if (foundFirst) {\n normalized[u] = defaultValues[u];\n } else {\n normalized[u] = objNow[u];\n }\n }\n\n // make sure the values we have are in range\n const higherOrderInvalid = useWeekData\n ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek)\n : containsOrdinal\n ? hasInvalidOrdinalData(normalized)\n : hasInvalidGregorianData(normalized),\n invalid = higherOrderInvalid || hasInvalidTimeData(normalized);\n\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n // compute the actual time\n const gregorian = useWeekData\n ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek)\n : containsOrdinal\n ? ordinalToGregorian(normalized)\n : normalized,\n [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),\n inst = new DateTime({\n ts: tsFinal,\n zone: zoneToUse,\n o: offsetFinal,\n loc,\n });\n\n // gregorian data + weekday serves only to validate\n if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {\n return DateTime.invalid(\n \"mismatched weekday\",\n `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`\n );\n }\n\n if (!inst.isValid) {\n return DateTime.invalid(inst.invalid);\n }\n\n return inst;\n }\n\n /**\n * Create a DateTime from an ISO 8601 string\n * @param {string} text - the ISO string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromISO('2016-05-25T09:08:34.123')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})\n * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})\n * @example DateTime.fromISO('2016-W05-4')\n * @return {DateTime}\n */\n static fromISO(text, opts = {}) {\n const [vals, parsedZone] = parseISODate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"ISO 8601\", text);\n }\n\n /**\n * Create a DateTime from an RFC 2822 string\n * @param {string} text - the RFC 2822 string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')\n * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')\n * @return {DateTime}\n */\n static fromRFC2822(text, opts = {}) {\n const [vals, parsedZone] = parseRFC2822Date(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"RFC 2822\", text);\n }\n\n /**\n * Create a DateTime from an HTTP header date\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @param {string} text - the HTTP header date\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')\n * @return {DateTime}\n */\n static fromHTTP(text, opts = {}) {\n const [vals, parsedZone] = parseHTTPDate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"HTTP\", opts);\n }\n\n /**\n * Create a DateTime from an input string and format string.\n * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens).\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see the link below for the formats)\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromFormat(text, fmt, opts = {}) {\n if (isUndefined(text) || isUndefined(fmt)) {\n throw new InvalidArgumentError(\"fromFormat requires an input string and a format\");\n }\n\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n }),\n [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);\n if (invalid) {\n return DateTime.invalid(invalid);\n } else {\n return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);\n }\n }\n\n /**\n * @deprecated use fromFormat instead\n */\n static fromString(text, fmt, opts = {}) {\n return DateTime.fromFormat(text, fmt, opts);\n }\n\n /**\n * Create a DateTime from a SQL date, time, or datetime\n * Defaults to en-US if no locale has been specified, regardless of the system's locale\n * @param {string} text - the string to parse\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @example DateTime.fromSQL('2017-05-15')\n * @example DateTime.fromSQL('2017-05-15 09:12:34')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })\n * @example DateTime.fromSQL('09:12:34.342')\n * @return {DateTime}\n */\n static fromSQL(text, opts = {}) {\n const [vals, parsedZone] = parseSQL(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"SQL\", text);\n }\n\n /**\n * Create an invalid DateTime.\n * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent.\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {DateTime}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the DateTime is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDateTimeError(invalid);\n } else {\n return new DateTime({ invalid });\n }\n }\n\n /**\n * Check if an object is an instance of DateTime. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDateTime(o) {\n return (o && o.isLuxonDateTime) || false;\n }\n\n /**\n * Produce the format string for a set of options\n * @param formatOpts\n * @param localeOpts\n * @returns {string}\n */\n static parseFormatForOpts(formatOpts, localeOpts = {}) {\n const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));\n return !tokenList ? null : tokenList.map((t) => (t ? t.val : null)).join(\"\");\n }\n\n /**\n * Produce the the fully expanded format token for the locale\n * Does NOT quote characters, so quoted tokens will not round trip correctly\n * @param fmt\n * @param localeOpts\n * @returns {string}\n */\n static expandFormat(fmt, localeOpts = {}) {\n const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));\n return expanded.map((t) => t.val).join(\"\");\n }\n\n static resetCache() {\n zoneOffsetTs = undefined;\n zoneOffsetGuessCache.clear();\n }\n\n // INFO\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example DateTime.local(2017, 7, 4).get('month'); //=> 7\n * @example DateTime.local(2017, 7, 4).get('day'); //=> 4\n * @return {number}\n */\n get(unit) {\n return this[unit];\n }\n\n /**\n * Returns whether the DateTime is valid. Invalid DateTimes occur when:\n * * The DateTime was created from invalid calendar information, such as the 13th month or February 30\n * * The DateTime was created by an operation on another invalid date\n * @type {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this DateTime is invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime\n *\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime\n *\n * @type {string}\n */\n get outputCalendar() {\n return this.isValid ? this.loc.outputCalendar : null;\n }\n\n /**\n * Get the time zone associated with this DateTime.\n * @type {Zone}\n */\n get zone() {\n return this._zone;\n }\n\n /**\n * Get the name of the time zone.\n * @type {string}\n */\n get zoneName() {\n return this.isValid ? this.zone.name : null;\n }\n\n /**\n * Get the year\n * @example DateTime.local(2017, 5, 25).year //=> 2017\n * @type {number}\n */\n get year() {\n return this.isValid ? this.c.year : NaN;\n }\n\n /**\n * Get the quarter\n * @example DateTime.local(2017, 5, 25).quarter //=> 2\n * @type {number}\n */\n get quarter() {\n return this.isValid ? Math.ceil(this.c.month / 3) : NaN;\n }\n\n /**\n * Get the month (1-12).\n * @example DateTime.local(2017, 5, 25).month //=> 5\n * @type {number}\n */\n get month() {\n return this.isValid ? this.c.month : NaN;\n }\n\n /**\n * Get the day of the month (1-30ish).\n * @example DateTime.local(2017, 5, 25).day //=> 25\n * @type {number}\n */\n get day() {\n return this.isValid ? this.c.day : NaN;\n }\n\n /**\n * Get the hour of the day (0-23).\n * @example DateTime.local(2017, 5, 25, 9).hour //=> 9\n * @type {number}\n */\n get hour() {\n return this.isValid ? this.c.hour : NaN;\n }\n\n /**\n * Get the minute of the hour (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30\n * @type {number}\n */\n get minute() {\n return this.isValid ? this.c.minute : NaN;\n }\n\n /**\n * Get the second of the minute (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52\n * @type {number}\n */\n get second() {\n return this.isValid ? this.c.second : NaN;\n }\n\n /**\n * Get the millisecond of the second (0-999).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654\n * @type {number}\n */\n get millisecond() {\n return this.isValid ? this.c.millisecond : NaN;\n }\n\n /**\n * Get the week year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 12, 31).weekYear //=> 2015\n * @type {number}\n */\n get weekYear() {\n return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the week number of the week year (1-52ish).\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2017, 5, 25).weekNumber //=> 21\n * @type {number}\n */\n get weekNumber() {\n return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the day of the week.\n * 1 is Monday and 7 is Sunday\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekday //=> 4\n * @type {number}\n */\n get weekday() {\n return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;\n }\n\n /**\n * Returns true if this date is on a weekend according to the locale, false otherwise\n * @returns {boolean}\n */\n get isWeekend() {\n return this.isValid && this.loc.getWeekendDays().includes(this.weekday);\n }\n\n /**\n * Get the day of the week according to the locale.\n * 1 is the first day of the week and 7 is the last day of the week.\n * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,\n * @returns {number}\n */\n get localWeekday() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;\n }\n\n /**\n * Get the week number of the week year according to the locale. Different locales assign week numbers differently,\n * because the week can start on different days of the week (see localWeekday) and because a different number of days\n * is required for a week to count as the first week of a year.\n * @returns {number}\n */\n get localWeekNumber() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the week year according to the locale. Different locales assign week numbers (and therefor week years)\n * differently, see localWeekNumber.\n * @returns {number}\n */\n get localWeekYear() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the ordinal (meaning the day of the year)\n * @example DateTime.local(2017, 5, 25).ordinal //=> 145\n * @type {number|DateTime}\n */\n get ordinal() {\n return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;\n }\n\n /**\n * Get the human readable short month name, such as 'Oct'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthShort //=> Oct\n * @type {string}\n */\n get monthShort() {\n return this.isValid ? Info.months(\"short\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable long month name, such as 'October'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthLong //=> October\n * @type {string}\n */\n get monthLong() {\n return this.isValid ? Info.months(\"long\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable short weekday, such as 'Mon'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon\n * @type {string}\n */\n get weekdayShort() {\n return this.isValid ? Info.weekdays(\"short\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the human readable long weekday, such as 'Monday'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday\n * @type {string}\n */\n get weekdayLong() {\n return this.isValid ? Info.weekdays(\"long\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the UTC offset of this DateTime in minutes\n * @example DateTime.now().offset //=> -240\n * @example DateTime.utc().offset //=> 0\n * @type {number}\n */\n get offset() {\n return this.isValid ? +this.o : NaN;\n }\n\n /**\n * Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameShort() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"short\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get the long human name for the zone's current offset, for example \"Eastern Standard Time\" or \"Eastern Daylight Time\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameLong() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"long\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get whether this zone's offset ever changes, as in a DST.\n * @type {boolean}\n */\n get isOffsetFixed() {\n return this.isValid ? this.zone.isUniversal : null;\n }\n\n /**\n * Get whether the DateTime is in a DST.\n * @type {boolean}\n */\n get isInDST() {\n if (this.isOffsetFixed) {\n return false;\n } else {\n return (\n this.offset > this.set({ month: 1, day: 1 }).offset ||\n this.offset > this.set({ month: 5 }).offset\n );\n }\n }\n\n /**\n * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC\n * in this DateTime's zone. During DST changes local time can be ambiguous, for example\n * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`.\n * This method will return both possible DateTimes if this DateTime's local time is ambiguous.\n * @returns {DateTime[]}\n */\n getPossibleOffsets() {\n if (!this.isValid || this.isOffsetFixed) {\n return [this];\n }\n const dayMs = 86400000;\n const minuteMs = 60000;\n const localTS = objToLocalTS(this.c);\n const oEarlier = this.zone.offset(localTS - dayMs);\n const oLater = this.zone.offset(localTS + dayMs);\n\n const o1 = this.zone.offset(localTS - oEarlier * minuteMs);\n const o2 = this.zone.offset(localTS - oLater * minuteMs);\n if (o1 === o2) {\n return [this];\n }\n const ts1 = localTS - o1 * minuteMs;\n const ts2 = localTS - o2 * minuteMs;\n const c1 = tsToObj(ts1, o1);\n const c2 = tsToObj(ts2, o2);\n if (\n c1.hour === c2.hour &&\n c1.minute === c2.minute &&\n c1.second === c2.second &&\n c1.millisecond === c2.millisecond\n ) {\n return [clone(this, { ts: ts1 }), clone(this, { ts: ts2 })];\n }\n return [this];\n }\n\n /**\n * Returns true if this DateTime is in a leap year, false otherwise\n * @example DateTime.local(2016).isInLeapYear //=> true\n * @example DateTime.local(2013).isInLeapYear //=> false\n * @type {boolean}\n */\n get isInLeapYear() {\n return isLeapYear(this.year);\n }\n\n /**\n * Returns the number of days in this DateTime's month\n * @example DateTime.local(2016, 2).daysInMonth //=> 29\n * @example DateTime.local(2016, 3).daysInMonth //=> 31\n * @type {number}\n */\n get daysInMonth() {\n return daysInMonth(this.year, this.month);\n }\n\n /**\n * Returns the number of days in this DateTime's year\n * @example DateTime.local(2016).daysInYear //=> 366\n * @example DateTime.local(2013).daysInYear //=> 365\n * @type {number}\n */\n get daysInYear() {\n return this.isValid ? daysInYear(this.year) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2004).weeksInWeekYear //=> 53\n * @example DateTime.local(2013).weeksInWeekYear //=> 52\n * @type {number}\n */\n get weeksInWeekYear() {\n return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's local week year\n * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52\n * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53\n * @type {number}\n */\n get weeksInLocalWeekYear() {\n return this.isValid\n ? weeksInWeekYear(\n this.localWeekYear,\n this.loc.getMinDaysInFirstWeek(),\n this.loc.getStartOfWeek()\n )\n : NaN;\n }\n\n /**\n * Returns the resolved Intl options for this DateTime.\n * This is useful in understanding the behavior of formatting methods\n * @param {Object} opts - the same options as toLocaleString\n * @return {Object}\n */\n resolvedLocaleOptions(opts = {}) {\n const { locale, numberingSystem, calendar } = Formatter.create(\n this.loc.clone(opts),\n opts\n ).resolvedOptions(this);\n return { locale, numberingSystem, outputCalendar: calendar };\n }\n\n // TRANSFORM\n\n /**\n * \"Set\" the DateTime's zone to UTC. Returns a newly-constructed DateTime.\n *\n * Equivalent to {@link DateTime#setZone}('utc')\n * @param {number} [offset=0] - optionally, an offset from UTC in minutes\n * @param {Object} [opts={}] - options to pass to `setZone()`\n * @return {DateTime}\n */\n toUTC(offset = 0, opts = {}) {\n return this.setZone(FixedOffsetZone.instance(offset), opts);\n }\n\n /**\n * \"Set\" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.\n *\n * Equivalent to `setZone('local')`\n * @return {DateTime}\n */\n toLocal() {\n return this.setZone(Settings.defaultZone);\n }\n\n /**\n * \"Set\" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.\n *\n * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones.\n * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class.\n * @param {Object} opts - options\n * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.\n * @return {DateTime}\n */\n setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {\n zone = normalizeZone(zone, Settings.defaultZone);\n if (zone.equals(this.zone)) {\n return this;\n } else if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n } else {\n let newTS = this.ts;\n if (keepLocalTime || keepCalendarTime) {\n const offsetGuess = zone.offset(this.ts);\n const asObj = this.toObject();\n [newTS] = objToTS(asObj, offsetGuess, zone);\n }\n return clone(this, { ts: newTS, zone });\n }\n }\n\n /**\n * \"Set\" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.\n * @param {Object} properties - the properties to set\n * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })\n * @return {DateTime}\n */\n reconfigure({ locale, numberingSystem, outputCalendar } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });\n return clone(this, { loc });\n }\n\n /**\n * \"Set\" the locale. Returns a newly-constructed DateTime.\n * Just a convenient alias for reconfigure({ locale })\n * @example DateTime.local(2017, 5, 25).setLocale('en-GB')\n * @return {DateTime}\n */\n setLocale(locale) {\n return this.reconfigure({ locale });\n }\n\n /**\n * \"Set\" the values of specified units. Returns a newly-constructed DateTime.\n * You can only set units with this method; for \"setting\" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.\n *\n * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.\n * They cannot be mixed with ISO-week units like `weekday`.\n * @param {Object} values - a mapping of units to numbers\n * @example dt.set({ year: 2017 })\n * @example dt.set({ hour: 8, minute: 30 })\n * @example dt.set({ weekday: 5 })\n * @example dt.set({ year: 2005, ordinal: 234 })\n * @return {DateTime}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);\n const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, this.loc);\n\n const settingWeekStuff =\n !isUndefined(normalized.weekYear) ||\n !isUndefined(normalized.weekNumber) ||\n !isUndefined(normalized.weekday),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber;\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n let mixed;\n if (settingWeekStuff) {\n mixed = weekToGregorian(\n { ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), ...normalized },\n minDaysInFirstWeek,\n startOfWeek\n );\n } else if (!isUndefined(normalized.ordinal)) {\n mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized });\n } else {\n mixed = { ...this.toObject(), ...normalized };\n\n // if we didn't set the day but we ended up on an overflow date,\n // use the last day of the right month\n if (isUndefined(normalized.day)) {\n mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);\n }\n }\n\n const [ts, o] = objToTS(mixed, this.o, this.zone);\n return clone(this, { ts, o });\n }\n\n /**\n * Add a period of time to this DateTime and return the resulting DateTime\n *\n * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @example DateTime.now().plus(123) //~> in 123 milliseconds\n * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes\n * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow\n * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday\n * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min\n * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min\n * @return {DateTime}\n */\n plus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration);\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * Subtract a period of time to this DateTime and return the resulting DateTime\n * See {@link DateTime#plus}\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n @return {DateTime}\n */\n minus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration).negate();\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * \"Set\" this DateTime to the beginning of a unit of time.\n * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week\n * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'\n * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'\n * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'\n * @return {DateTime}\n */\n startOf(unit, { useLocaleWeeks = false } = {}) {\n if (!this.isValid) return this;\n\n const o = {},\n normalizedUnit = Duration.normalizeUnit(unit);\n switch (normalizedUnit) {\n case \"years\":\n o.month = 1;\n // falls through\n case \"quarters\":\n case \"months\":\n o.day = 1;\n // falls through\n case \"weeks\":\n case \"days\":\n o.hour = 0;\n // falls through\n case \"hours\":\n o.minute = 0;\n // falls through\n case \"minutes\":\n o.second = 0;\n // falls through\n case \"seconds\":\n o.millisecond = 0;\n break;\n case \"milliseconds\":\n break;\n // no default, invalid units throw in normalizeUnit()\n }\n\n if (normalizedUnit === \"weeks\") {\n if (useLocaleWeeks) {\n const startOfWeek = this.loc.getStartOfWeek();\n const { weekday } = this;\n if (weekday < startOfWeek) {\n o.weekNumber = this.weekNumber - 1;\n }\n o.weekday = startOfWeek;\n } else {\n o.weekday = 1;\n }\n }\n\n if (normalizedUnit === \"quarters\") {\n const q = Math.ceil(this.month / 3);\n o.month = (q - 1) * 3 + 1;\n }\n\n return this.set(o);\n }\n\n /**\n * \"Set\" this DateTime to the end (meaning the last millisecond) of a unit of time\n * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week\n * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'\n * @return {DateTime}\n */\n endOf(unit, opts) {\n return this.isValid\n ? this.plus({ [unit]: 1 })\n .startOf(unit, opts)\n .minus(1)\n : this;\n }\n\n // OUTPUT\n\n /**\n * Returns a string representation of this DateTime formatted according to the specified format string.\n * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens).\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @param {string} fmt - the format string\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22'\n * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'\n * @example DateTime.now().toFormat('yyyy LLL dd', { locale: \"fr\" }) //=> '2017 avr. 22'\n * @example DateTime.now().toFormat(\"HH 'hours and' mm 'minutes'\") //=> '20 hours and 55 minutes'\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.\n * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation\n * of the DateTime in the assigned locale.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toLocaleString(); //=> 4/20/2017\n * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'\n * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'\n * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022'\n * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'\n * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'\n * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'\n * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'\n * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32'\n * @return {string}\n */\n toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this)\n : INVALID;\n }\n\n /**\n * Returns an array of format \"parts\", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts\n * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.\n * @example DateTime.now().toLocaleParts(); //=> [\n * //=> { type: 'day', value: '25' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'month', value: '05' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'year', value: '1982' }\n * //=> ]\n */\n toLocaleParts(opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this)\n : [];\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.extendedZone=false] - add the time zone format extension\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.\n * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'\n * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'\n * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'\n * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'\n * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z'\n * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z'\n * @return {string|null}\n */\n toISO({\n format = \"extended\",\n suppressSeconds = false,\n suppressMilliseconds = false,\n includeOffset = true,\n extendedZone = false,\n precision = \"milliseconds\",\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n precision = normalizeUnit(precision);\n const ext = format === \"extended\";\n\n let c = toISODate(this, ext, precision);\n if (orderedUnits.indexOf(precision) >= 3) c += \"T\";\n c += toISOTime(\n this,\n ext,\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n );\n return c;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's date component\n * @param {Object} opts - options\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'.\n * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'\n * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'\n * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05'\n * @return {string|null}\n */\n toISODate({ format = \"extended\", precision = \"day\" } = {}) {\n if (!this.isValid) {\n return null;\n }\n return toISODate(this, format === \"extended\", normalizeUnit(precision));\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's week date\n * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'\n * @return {string}\n */\n toISOWeekDate() {\n return toTechFormat(this, \"kkkk-'W'WW-c\");\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's time component\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.extendedZone=true] - add the time zone format extension\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z'\n * @return {string}\n */\n toISOTime({\n suppressMilliseconds = false,\n suppressSeconds = false,\n includeOffset = true,\n includePrefix = false,\n extendedZone = false,\n format = \"extended\",\n precision = \"milliseconds\",\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n precision = normalizeUnit(precision);\n let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? \"T\" : \"\";\n return (\n c +\n toISOTime(\n this,\n format === \"extended\",\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n )\n );\n }\n\n /**\n * Returns an RFC 2822-compatible string representation of this DateTime\n * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'\n * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'\n * @return {string}\n */\n toRFC2822() {\n return toTechFormat(this, \"EEE, dd LLL yyyy HH:mm:ss ZZZ\", false);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.\n * Specifically, the string conforms to RFC 1123.\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'\n * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'\n * @return {string}\n */\n toHTTP() {\n return toTechFormat(this.toUTC(), \"EEE, dd LLL yyyy HH:mm:ss 'GMT'\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Date\n * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'\n * @return {string|null}\n */\n toSQLDate() {\n if (!this.isValid) {\n return null;\n }\n return toISODate(this, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Time\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'\n * @example DateTime.utc().toSQL() //=> '05:15:16.345'\n * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00'\n * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345'\n * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'\n * @return {string}\n */\n toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) {\n let fmt = \"HH:mm:ss.SSS\";\n\n if (includeZone || includeOffset) {\n if (includeOffsetSpace) {\n fmt += \" \";\n }\n if (includeZone) {\n fmt += \"z\";\n } else if (includeOffset) {\n fmt += \"ZZ\";\n }\n }\n\n return toTechFormat(this, fmt, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'\n * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'\n * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'\n * @return {string}\n */\n toSQL(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for debugging\n * @return {string}\n */\n toString() {\n return this.isValid ? this.toISO() : INVALID;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;\n } else {\n return `DateTime { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime.\n * @return {number}\n */\n toMillis() {\n return this.isValid ? this.ts : NaN;\n }\n\n /**\n * Returns the epoch seconds (including milliseconds in the fractional part) of this DateTime.\n * @return {number}\n */\n toSeconds() {\n return this.isValid ? this.ts / 1000 : NaN;\n }\n\n /**\n * Returns the epoch seconds (as a whole number) of this DateTime.\n * @return {number}\n */\n toUnixInteger() {\n return this.isValid ? Math.floor(this.ts / 1000) : NaN;\n }\n\n /**\n * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns a BSON serializable equivalent to this DateTime.\n * @return {Date}\n */\n toBSON() {\n return this.toJSDate();\n }\n\n /**\n * Returns a JavaScript object with this DateTime's year, month, day, and so on.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = { ...this.c };\n\n if (opts.includeConfig) {\n base.outputCalendar = this.outputCalendar;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns a JavaScript Date equivalent to this DateTime.\n * @return {Date}\n */\n toJSDate() {\n return new Date(this.isValid ? this.ts : NaN);\n }\n\n // COMPARE\n\n /**\n * Return the difference between two DateTimes as a Duration.\n * @param {DateTime} otherDateTime - the DateTime to compare this one to\n * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example\n * var i1 = DateTime.fromISO('1982-05-25T09:45'),\n * i2 = DateTime.fromISO('1983-10-14T10:30');\n * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\n * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\n * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\n * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n * @return {Duration}\n */\n diff(otherDateTime, unit = \"milliseconds\", opts = {}) {\n if (!this.isValid || !otherDateTime.isValid) {\n return Duration.invalid(\"created by diffing an invalid DateTime\");\n }\n\n const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts };\n\n const units = maybeArray(unit).map(Duration.normalizeUnit),\n otherIsLater = otherDateTime.valueOf() > this.valueOf(),\n earlier = otherIsLater ? this : otherDateTime,\n later = otherIsLater ? otherDateTime : this,\n diffed = diff(earlier, later, units, durOpts);\n\n return otherIsLater ? diffed.negate() : diffed;\n }\n\n /**\n * Return the difference between this DateTime and right now.\n * See {@link DateTime#diff}\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n diffNow(unit = \"milliseconds\", opts = {}) {\n return this.diff(DateTime.now(), unit, opts);\n }\n\n /**\n * Return an Interval spanning between this DateTime and another DateTime\n * @param {DateTime} otherDateTime - the other end point of the Interval\n * @return {Interval|DateTime}\n */\n until(otherDateTime) {\n return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;\n }\n\n /**\n * Return whether this DateTime is in the same unit of time as another DateTime.\n * Higher-order units must also be identical for this function to return `true`.\n * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.\n * @param {DateTime} otherDateTime - the other DateTime\n * @param {string} unit - the unit of time to check sameness on\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used\n * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day\n * @return {boolean}\n */\n hasSame(otherDateTime, unit, opts) {\n if (!this.isValid) return false;\n\n const inputMs = otherDateTime.valueOf();\n const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true });\n return (\n adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts)\n );\n }\n\n /**\n * Equality check\n * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid.\n * To compare just the millisecond values, use `+dt1 === +dt2`.\n * @param {DateTime} other - the other DateTime\n * @return {boolean}\n */\n equals(other) {\n return (\n this.isValid &&\n other.isValid &&\n this.valueOf() === other.valueOf() &&\n this.zone.equals(other.zone) &&\n this.loc.equals(other.loc)\n );\n }\n\n /**\n * Returns a string representation of a this time relative to now, such as \"in two days\". Can only internationalize if your\n * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} [options.style=\"long\"] - the style of units, must be \"long\", \"short\", or \"narrow\"\n * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of \"years\", \"quarters\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", or \"seconds\"\n * @param {boolean} [options.round=true] - whether to round the numbers in the output.\n * @param {string} [options.rounding=\"trunc\"] - rounding method to use when rounding the numbers in the output. Can be \"trunc\" (toward zero), \"expand\" (away from zero), \"round\", \"floor\", or \"ceil\".\n * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelative() //=> \"in 1 day\"\n * @example DateTime.now().setLocale(\"es\").toRelative({ days: 1 }) //=> \"dentro de 1 día\"\n * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: \"fr\" }) //=> \"dans 23 heures\"\n * @example DateTime.now().minus({ days: 2 }).toRelative() //=> \"2 days ago\"\n * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: \"hours\" }) //=> \"48 hours ago\"\n * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> \"1.5 days ago\"\n */\n toRelative(options = {}) {\n if (!this.isValid) return null;\n const base = options.base || DateTime.fromObject({}, { zone: this.zone }),\n padding = options.padding ? (this < base ? -options.padding : options.padding) : 0;\n let units = [\"years\", \"months\", \"days\", \"hours\", \"minutes\", \"seconds\"];\n let unit = options.unit;\n if (Array.isArray(options.unit)) {\n units = options.unit;\n unit = undefined;\n }\n return diffRelative(base, this.plus(padding), {\n ...options,\n numeric: \"always\",\n units,\n unit,\n });\n }\n\n /**\n * Returns a string representation of this date relative to today, such as \"yesterday\" or \"next month\".\n * Only internationalizes on platforms that supports Intl.RelativeTimeFormat.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", or \"days\"\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> \"tomorrow\"\n * @example DateTime.now().setLocale(\"es\").plus({ days: 1 }).toRelative() //=> \"\"mañana\"\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: \"fr\" }) //=> \"demain\"\n * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> \"2 days ago\"\n */\n toRelativeCalendar(options = {}) {\n if (!this.isValid) return null;\n\n return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, {\n ...options,\n numeric: \"auto\",\n units: [\"years\", \"months\", \"days\"],\n calendary: true,\n });\n }\n\n /**\n * Return the min of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum\n * @return {DateTime} the min DateTime, or undefined if called with no argument\n */\n static min(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"min requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.min);\n }\n\n /**\n * Return the max of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum\n * @return {DateTime} the max DateTime, or undefined if called with no argument\n */\n static max(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"max requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.max);\n }\n\n // MISC\n\n /**\n * Explain how a string would be parsed by fromFormat()\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see description)\n * @param {Object} options - options taken by fromFormat()\n * @return {Object}\n */\n static fromFormatExplain(text, fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n return explainFromTokens(localeToUse, text, fmt);\n }\n\n /**\n * @deprecated use fromFormatExplain instead\n */\n static fromStringExplain(text, fmt, options = {}) {\n return DateTime.fromFormatExplain(text, fmt, options);\n }\n\n /**\n * Build a parser for `fmt` using the given locale. This parser can be passed\n * to {@link DateTime.fromFormatParser} to a parse a date in this format. This\n * can be used to optimize cases where many dates need to be parsed in a\n * specific format.\n *\n * @param {String} fmt - the format the string is expected to be in (see\n * description)\n * @param {Object} options - options used to set locale and numberingSystem\n * for parser\n * @returns {TokenParser} - opaque object to be used\n */\n static buildFormatParser(fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n return new TokenParser(localeToUse, fmt);\n }\n\n /**\n * Create a DateTime from an input string and format parser.\n *\n * The format parser must have been created with the same locale as this call.\n *\n * @param {String} text - the string to parse\n * @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser}\n * @param {Object} opts - options taken by fromFormat()\n * @returns {DateTime}\n */\n static fromFormatParser(text, formatParser, opts = {}) {\n if (isUndefined(text) || isUndefined(formatParser)) {\n throw new InvalidArgumentError(\n \"fromFormatParser requires an input string and a format parser\"\n );\n }\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n\n if (!localeToUse.equals(formatParser.locale)) {\n throw new InvalidArgumentError(\n `fromFormatParser called with a locale of ${localeToUse}, ` +\n `but the format parser was created for ${formatParser.locale}`\n );\n }\n\n const { result, zone, specificOffset, invalidReason } = formatParser.explainFromTokens(text);\n\n if (invalidReason) {\n return DateTime.invalid(invalidReason);\n } else {\n return parseDataToDateTime(\n result,\n zone,\n opts,\n `format ${formatParser.format}`,\n text,\n specificOffset\n );\n }\n }\n\n // FORMAT PRESETS\n\n /**\n * {@link DateTime#toLocaleString} format like 10/14/1983\n * @type {Object}\n */\n static get DATE_SHORT() {\n return Formats.DATE_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED() {\n return Formats.DATE_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED_WITH_WEEKDAY() {\n return Formats.DATE_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983'\n * @type {Object}\n */\n static get DATE_FULL() {\n return Formats.DATE_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983'\n * @type {Object}\n */\n static get DATE_HUGE() {\n return Formats.DATE_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_SIMPLE() {\n return Formats.TIME_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SECONDS() {\n return Formats.TIME_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SHORT_OFFSET() {\n return Formats.TIME_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_LONG_OFFSET() {\n return Formats.TIME_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_SIMPLE() {\n return Formats.TIME_24_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SECONDS() {\n return Formats.TIME_24_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SHORT_OFFSET() {\n return Formats.TIME_24_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_LONG_OFFSET() {\n return Formats.TIME_24_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT() {\n return Formats.DATETIME_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT_WITH_SECONDS() {\n return Formats.DATETIME_SHORT_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED() {\n return Formats.DATETIME_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_SECONDS() {\n return Formats.DATETIME_MED_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_WEEKDAY() {\n return Formats.DATETIME_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL() {\n return Formats.DATETIME_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL_WITH_SECONDS() {\n return Formats.DATETIME_FULL_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE() {\n return Formats.DATETIME_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE_WITH_SECONDS() {\n return Formats.DATETIME_HUGE_WITH_SECONDS;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDateTime(dateTimeish) {\n if (DateTime.isDateTime(dateTimeish)) {\n return dateTimeish;\n } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {\n return DateTime.fromJSDate(dateTimeish);\n } else if (dateTimeish && typeof dateTimeish === \"object\") {\n return DateTime.fromObject(dateTimeish);\n } else {\n throw new InvalidArgumentError(\n `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`\n );\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Duration from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Info from \"./info.js\";\nimport Zone from \"./zone.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport InvalidZone from \"./zones/invalidZone.js\";\nimport SystemZone from \"./zones/systemZone.js\";\nimport Settings from \"./settings.js\";\n\nconst VERSION = \"3.7.2\";\n\nexport {\n VERSION,\n DateTime,\n Duration,\n Interval,\n Info,\n Zone,\n FixedOffsetZone,\n IANAZone,\n InvalidZone,\n SystemZone,\n Settings,\n};\n"],"names":["LuxonError","_Error","_inheritsLoose","apply","arguments","_wrapNativeSuper","Error","InvalidDateTimeError","_LuxonError","reason","call","toMessage","InvalidIntervalError","_LuxonError2","InvalidDurationError","_LuxonError3","ConflictingSpecificationError","_LuxonError4","InvalidUnitError","_LuxonError5","unit","InvalidArgumentError","_LuxonError6","ZoneIsAbstractError","_LuxonError7","n","s","l","DATE_SHORT","year","month","day","DATE_MED","DATE_MED_WITH_WEEKDAY","weekday","DATE_FULL","DATE_HUGE","TIME_SIMPLE","hour","minute","TIME_WITH_SECONDS","second","TIME_WITH_SHORT_OFFSET","timeZoneName","TIME_WITH_LONG_OFFSET","TIME_24_SIMPLE","hourCycle","TIME_24_WITH_SECONDS","TIME_24_WITH_SHORT_OFFSET","TIME_24_WITH_LONG_OFFSET","DATETIME_SHORT","DATETIME_SHORT_WITH_SECONDS","DATETIME_MED","DATETIME_MED_WITH_SECONDS","DATETIME_MED_WITH_WEEKDAY","DATETIME_FULL","DATETIME_FULL_WITH_SECONDS","DATETIME_HUGE","DATETIME_HUGE_WITH_SECONDS","Zone","_proto","prototype","offsetName","ts","opts","formatOffset","format","offset","equals","otherZone","_createClass","key","get","name","singleton","SystemZone","_Zone","_ref","locale","parseZoneInfo","Date","getTimezoneOffset","type","Intl","DateTimeFormat","resolvedOptions","timeZone","dtfCache","Map","makeDTF","zoneName","dtf","undefined","hour12","era","set","typeToPos","hackyOffset","date","formatted","replace","parsed","exec","fMonth","fDay","fYear","fadOrBc","fHour","fMinute","fSecond","partsOffset","formatToParts","filled","i","length","_formatted$i","value","pos","isUndefined","parseInt","ianaZoneCache","IANAZone","create","zone","resetCache","clear","isValidSpecifier","isValidZone","e","_this","valid","NaN","isNaN","_ref2","adOrBc","Math","abs","adjustedHour","asUTC","objToLocalTS","millisecond","asTS","over","intlLFCache","getCachedLF","locString","JSON","stringify","ListFormat","intlDTCache","getCachedDTF","intlNumCache","getCachedINF","inf","NumberFormat","intlRelCache","getCachedRTF","_opts","base","cacheKeyOpts","_objectWithoutPropertiesLoose","_excluded","RelativeTimeFormat","sysLocaleCache","systemLocale","intlResolvedOptionsCache","getCachedIntResolvedOptions","weekInfoCache","getCachedWeekInfo","data","Locale","getWeekInfo","weekInfo","_extends","fallbackWeekSettings","parseLocaleString","localeStr","xIndex","indexOf","substring","uIndex","options","selectedStr","smaller","_options","numberingSystem","calendar","intlConfigString","outputCalendar","includes","mapMonths","f","ms","dt","DateTime","utc","push","mapWeekdays","listStuff","loc","englishFn","intlFn","mode","listingMode","supportsFastNumbers","startsWith","PolyNumberFormatter","intl","forceSimple","padTo","floor","otherOpts","_excluded2","Object","keys","intlOpts","useGrouping","minimumIntegerDigits","fixed","roundTo","padStart","PolyDateFormatter","originalZone","z","gmtOffset","offsetZ","setZone","plus","minutes","_proto2","map","join","toJSDate","parts","part","PolyRelFormatter","isEnglish","style","hasRelative","rtf","_proto3","count","English","numeric","firstDay","minimalDays","weekend","fromOpts","weekSettings","defaultToEN","specifiedLocale","Settings","defaultLocale","localeR","numberingSystemR","defaultNumberingSystem","outputCalendarR","defaultOutputCalendar","weekSettingsR","validateWeekSettings","defaultWeekSettings","fromObject","_temp","numbering","_parseLocaleString","parsedLocale","parsedNumberingSystem","parsedOutputCalendar","weekdaysCache","standalone","monthsCache","meridiemCache","eraCache","fastNumbersCached","_proto4","isActuallyEn","hasNoWeirdness","clone","alts","getOwnPropertyNames","redefaultToEN","redefaultToSystem","months","_this2","monthSpecialCase","formatStr","mapper","extract","dtFormatter","weekdays","_this3","meridiems","_this4","eras","_this5","field","df","results","matching","find","m","toLowerCase","numberFormatter","fastNumbers","relFormatter","listFormatter","getWeekSettings","hasLocaleWeekInfo","getStartOfWeek","getMinDaysInFirstWeek","getWeekendDays","other","toString","FixedOffsetZone","instance","utcInstance","parseSpecifier","r","match","signedOffset","InvalidZone","normalizeZone","input","defaultZone","isString","lowered","isNumber","numberingSystems","arab","arabext","bali","beng","deva","fullwide","gujr","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","latn","numberingSystemsUTF16","hanidecChars","split","parseDigits","str","code","charCodeAt","search","_numberingSystemsUTF","min","max","digitRegexCache","resetDigitRegexCache","digitRegex","append","ns","appendCache","regex","RegExp","now","twoDigitCutoffYear","throwOnInvalid","resetCaches","cutoffYear","t","Invalid","explanation","nonLeapLadder","leapLadder","unitOutOfRange","dayOfWeek","d","UTC","setUTCFullYear","getUTCFullYear","js","getUTCDay","computeOrdinal","isLeapYear","uncomputeOrdinal","ordinal","table","month0","findIndex","isoWeekdayToLocal","isoWeekday","startOfWeek","gregorianToWeek","gregObj","minDaysInFirstWeek","weekNumber","weekYear","weeksInWeekYear","timeObject","weekToGregorian","weekData","weekdayOfJan4","yearInDays","daysInYear","_uncomputeOrdinal","gregorianToOrdinal","gregData","ordinalToGregorian","ordinalData","_uncomputeOrdinal2","usesLocalWeekValues","obj","hasLocaleWeekData","localWeekday","localWeekNumber","localWeekYear","hasIsoWeekData","hasInvalidWeekData","validYear","isInteger","validWeek","integerBetween","validWeekday","hasInvalidOrdinalData","validOrdinal","hasInvalidGregorianData","validMonth","validDay","daysInMonth","hasInvalidTimeData","validHour","validMinute","validSecond","validMillisecond","o","isDate","maybeArray","thing","Array","isArray","bestBy","arr","by","compare","reduce","best","next","pair","pick","a","k","hasOwnProperty","prop","settings","some","v","from","bottom","top","floorMod","x","isNeg","padded","parseInteger","string","parseFloating","parseFloat","parseMillis","fraction","number","digits","rounding","factor","pow","ceil","trunc","round","RangeError","modMonth","modYear","firstWeekOffset","fwdlw","weekOffset","weekOffsetNext","untruncateYear","offsetFormat","modified","offHourStr","offMinuteStr","offHour","Number","offMin","offMinSigned","is","asNumber","numericValue","isFinite","normalizeObject","normalizer","normalized","u","hours","sign","monthsLong","monthsShort","monthsNarrow","concat","weekdaysLong","weekdaysShort","weekdaysNarrow","erasLong","erasShort","erasNarrow","meridiemForDateTime","weekdayForDateTime","monthForDateTime","eraForDateTime","formatRelativeTime","narrow","units","years","quarters","weeks","days","seconds","lastable","isDay","isInPast","fmtValue","singular","lilUnits","fmtUnit","stringifyTokens","splits","tokenToString","_iterator","_createForOfIteratorHelperLoose","_step","done","token","literal","val","macroTokenToFormatOpts","D","Formats","DD","DDD","DDDD","tt","ttt","tttt","T","TT","TTT","TTTT","ff","fff","ffff","F","FF","FFF","FFFF","Formatter","parseFormat","fmt","current","currentFull","bracketed","c","charAt","test","formatOpts","systemLoc","formatWithSystemDefault","formatDateTime","formatDateTimeParts","formatInterval","interval","start","formatRange","end","num","p","signDisplay","formatDateTimeFromString","knownEnglish","useDateTimeFormatter","isOffsetFixed","allowZ","isValid","meridiem","maybeMacro","slice","quarter","formatDurationFromString","dur","invertLargest","signMode","tokenToField","lildur","info","mapped","inversionFactor","isNegativeDuration","largestUnit","tokens","realTokens","found","collapsed","shiftTo","filter","durationInfo","values","ianaRegex","combineRegexes","_len","regexes","_key","full","source","combineExtractors","_len2","extractors","_key2","ex","mergedVals","mergedZone","cursor","_ex","parse","_len3","patterns","_key3","_i","_patterns","_patterns$_i","extractor","simpleParse","_len4","_key4","ret","offsetRegex","isoExtendedZone","isoTimeBaseRegex","isoTimeRegex","isoTimeExtensionRegex","isoYmdRegex","isoWeekRegex","isoOrdinalRegex","extractISOWeekData","extractISOOrdinalData","sqlYmdRegex","sqlTimeRegex","sqlTimeExtensionRegex","int","fallback","extractISOYmd","item","extractISOTime","milliseconds","extractISOOffset","local","fullOffset","extractIANAZone","isoTimeOnly","isoDuration","extractISODuration","yearStr","monthStr","weekStr","dayStr","hourStr","minuteStr","secondStr","millisecondsStr","hasNegativePrefix","negativeSeconds","maybeNegate","force","obsOffsets","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","fromStrings","weekdayStr","result","rfc2822","extractRFC2822","obsOffset","milOffset","preprocessRFC2822","trim","rfc1123","rfc850","ascii","extractRFC1123Or850","extractASCII","isoYmdWithTimeExtensionRegex","isoWeekWithTimeExtensionRegex","isoOrdinalWithTimeExtensionRegex","isoTimeCombinedRegex","extractISOYmdTimeAndOffset","extractISOWeekTimeAndOffset","extractISOOrdinalDateAndTime","extractISOTimeAndOffset","parseISODate","parseRFC2822Date","parseHTTPDate","parseISODuration","extractISOTimeOnly","parseISOTimeOnly","sqlYmdWithTimeExtensionRegex","sqlTimeCombinedRegex","extractISOTimeOffsetAndIANAZone","parseSQL","INVALID","lowOrderMatrix","casualMatrix","daysInYearAccurate","daysInMonthAccurate","accurateMatrix","orderedUnits","reverseUnits","reverse","conf","conversionAccuracy","matrix","Duration","durationToMillis","vals","_vals$milliseconds","sum","normalizeValues","reduceRight","previous","previousVal","conv","rollUp","removeZeroes","newVals","_Object$entries","entries","_Object$entries$_i","_Symbol$for","config","accurate","invalid","isLuxonDuration","fromMillis","normalizeUnit","fromDurationLike","durationLike","isDuration","fromISO","text","_parseISODuration","fromISOTime","_parseISOTimeOnly","week","toFormat","fmtOpts","toHuman","showZeros","unitDisplay","listStyle","toObject","toISO","toISOTime","millis","toMillis","suppressMilliseconds","suppressSeconds","includePrefix","includeOffset","dateTime","toJSON","invalidReason","valueOf","duration","_i2","_orderedUnits","minus","negate","mapUnits","fn","_i3","_Object$keys","mixed","reconfigure","as","normalize","rescale","shiftToAll","built","accumulated","lastUnit","_i4","_orderedUnits2","own","ak","negated","_i5","_Object$keys2","removeZeros","eq","v1","v2","_i6","_orderedUnits3","Symbol","for","validateStartEnd","Interval","isLuxonInterval","fromDateTimes","builtStart","friendlyDateTime","builtEnd","validateError","after","before","_split","startIsValid","endIsValid","isInterval","toDuration","startOf","useLocaleWeeks","diff","hasSame","isEmpty","isAfter","isBefore","contains","splitAt","dateTimes","sorted","sort","b","added","splitBy","idx","divideEqually","numberOfParts","overlaps","abutsStart","abutsEnd","engulfs","intersection","union","merge","intervals","_intervals$sort$reduc","sofar","final","xor","_Array$prototype","currentCount","ends","time","flattened","difference","toLocaleString","toISODate","dateFormat","_temp2","_ref3","_ref3$separator","separator","mapEndpoints","mapFn","Info","hasDST","proto","isUniversal","isValidIANAZone","_ref$locale","_ref$locObj","locObj","getMinimumDaysInFirstWeek","_ref2$locale","_ref2$locObj","getWeekendWeekdays","_temp3","_ref3$locale","_ref3$locObj","_temp4","_ref4","_ref4$locale","_ref4$numberingSystem","_ref4$locObj","_ref4$outputCalendar","monthsFormat","_temp5","_ref5","_ref5$locale","_ref5$numberingSystem","_ref5$locObj","_ref5$outputCalendar","_temp6","_ref6","_ref6$locale","_ref6$numberingSystem","_ref6$locObj","weekdaysFormat","_temp7","_ref7","_ref7$locale","_ref7$numberingSystem","_ref7$locObj","_temp8","_ref8","_ref8$locale","_temp9","_ref9","_ref9$locale","features","relative","localeWeek","dayDiff","earlier","later","utcDayStart","toUTC","keepLocalTime","highOrderDiffs","differs","lowestOrder","highWater","_differs","_differs$_i","differ","_highOrderDiffs","remainingMillis","lowerOrderUnits","_cursor$plus","_Duration$fromMillis","MISSING_FTP","intUnit","post","deser","NBSP","String","fromCharCode","spaceOrNBSP","spaceOrNBSPRegExp","fixListRegex","stripInsensitivities","oneOf","strings","startIndex","groups","h","simple","escapeToken","unitForToken","one","two","three","four","six","oneOrTwo","oneToThree","oneToSix","oneToNine","twoToFour","fourToSix","unitate","partTypeStyleToTokenVal","short","long","dayperiod","dayPeriod","hour24","tokenForPart","resolvedOpts","isSpace","actualType","buildRegex","re","handlers","matches","all","matchIndex","dateTimeFromMatches","toField","specificOffset","Z","q","M","G","y","S","dummyDateTimeCache","getDummyDateTime","maybeExpandMacroToken","formatOptsToTokens","expandMacroTokens","TokenParser","disqualifyingUnit","_buildRegex","regexString","explainFromTokens","_match","rawMatches","parser","parseFromTokens","_explainFromTokens","formatter","MAX_DATE","unsupportedZone","possiblyCachedWeekData","possiblyCachedLocalWeekData","localWeekData","inst","old","fixOffset","localTS","tz","utcGuess","o2","o3","tsToObj","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","objToTS","adjustTime","oPre","millisToAdd","_fixOffset","parseDataToDateTime","parsedZone","interpretationZone","toTechFormat","extended","precision","longFormat","extendedZone","showSeconds","ianaName","defaultUnitValues","defaultWeekUnitValues","defaultOrdinalUnitValues","orderedWeekUnits","orderedOrdinalUnits","weeknumber","weeksnumber","weeknumbers","weekyear","weekyears","normalizeUnitWithLocalWeeks","guessOffsetForZone","zoneOffsetTs","offsetGuess","zoneOffsetGuessCache","quickDT","offsetProvis","_objToTS","diffRelative","calendary","lastOpts","argList","args","unchanged","ot","_zone","isLuxonDateTime","_lastOpts","_lastOpts2","fromJSDate","zoneToUse","fromSeconds","_usesLocalWeekValues","tsNow","containsOrdinal","containsGregorYear","containsGregorMD","containsGregor","definiteWeekDef","useWeekData","defaultValues","objNow","foundFirst","_iterator2","_step2","higherOrderInvalid","gregorian","_objToTS2","tsFinal","offsetFinal","_parseISODate","fromRFC2822","_parseRFC2822Date","fromHTTP","_parseHTTPDate","fromFormat","_opts$locale","_opts$numberingSystem","localeToUse","_parseFromTokens","fromString","fromSQL","_parseSQL","isDateTime","parseFormatForOpts","localeOpts","tokenList","expandFormat","expanded","getPossibleOffsets","dayMs","minuteMs","oEarlier","oLater","o1","ts1","ts2","c1","c2","resolvedLocaleOptions","_Formatter$create$res","toLocal","_ref2$keepLocalTime","_ref2$keepCalendarTim","keepCalendarTime","newTS","asObj","_objToTS3","setLocale","_usesLocalWeekValues2","settingWeekStuff","_objToTS4","_ref4$useLocaleWeeks","normalizedUnit","endOf","_this$plus","toLocaleParts","_ref5$format","_ref5$suppressSeconds","_ref5$suppressMillise","_ref5$includeOffset","_ref5$extendedZone","_ref5$precision","ext","_ref6$format","_ref6$precision","toISOWeekDate","_ref7$suppressMillise","_ref7$suppressSeconds","_ref7$includeOffset","_ref7$includePrefix","_ref7$extendedZone","_ref7$format","_ref7$precision","toRFC2822","toHTTP","toSQLDate","toSQLTime","_ref8$includeOffset","_ref8$includeZone","includeZone","_ref8$includeOffsetSp","includeOffsetSpace","toSQL","toSeconds","toUnixInteger","toBSON","includeConfig","otherDateTime","durOpts","otherIsLater","diffed","diffNow","until","inputMs","adjustedToZone","toRelative","padding","toRelativeCalendar","every","fromFormatExplain","_options$locale","_options$numberingSys","fromStringExplain","buildFormatParser","_options2","_options2$locale","_options2$numberingSy","fromFormatParser","formatParser","_opts2","_opts2$locale","_opts2$numberingSyste","_formatParser$explain","dateTimeish","VERSION"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EAEA;EACA;EACA;EAFA,IAGMA,UAAU,0BAAAC,MAAA,EAAA;IAAAC,cAAA,CAAAF,UAAA,EAAAC,MAAA,CAAA,CAAA;EAAA,EAAA,SAAAD,UAAA,GAAA;EAAA,IAAA,OAAAC,MAAA,CAAAE,KAAA,CAAA,IAAA,EAAAC,SAA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GAAA,EAAA,eAAA;MAAAC,GAAA,EAIA,SAAAA,GAAAA,GAA2B;QACzB,OAAO4d,aAAqB,CAAA;EAC9B,KAAA;;EAEA;EACF;EACA;EACA;EAHE,GAAA,EAAA;MAAA7d,GAAA,EAAA,4BAAA;MAAAC,GAAA,EAIA,SAAAA,GAAAA,GAAwC;QACtC,OAAO4d,0BAAkC,CAAA;EAC3C,KAAA;EAAC,GAAA,CAAA,CAAA,CAAA;EAAA,EAAA,OAAAlW,QAAA,CAAA;EAAA,CAAA,CAnhBAinB,MAAM,CAACC,GAAG,CAAC,4BAA4B,CAAC,EAAA;EAyhBpC,SAASM,gBAAgBA,CAAC8X,WAAW,EAAE;EAC5C,EAAA,IAAIt/B,QAAQ,CAAC25B,UAAU,CAAC2F,WAAW,CAAC,EAAE;EACpC,IAAA,OAAOA,WAAW,CAAA;EACpB,GAAC,MAAM,IAAIA,WAAW,IAAIA,WAAW,CAACra,OAAO,IAAI7c,QAAQ,CAACk3B,WAAW,CAACra,OAAO,EAAE,CAAC,EAAE;EAChF,IAAA,OAAOjlB,QAAQ,CAACy3B,UAAU,CAAC6H,WAAW,CAAC,CAAA;KACxC,MAAM,IAAIA,WAAW,IAAI,OAAOA,WAAW,KAAK,QAAQ,EAAE;EACzD,IAAA,OAAOt/B,QAAQ,CAACmE,UAAU,CAACm7B,WAAW,CAAC,CAAA;EACzC,GAAC,MAAM;EACL,IAAA,MAAM,IAAInqC,oBAAoB,CAAA,6BAAA,GACEmqC,WAAW,GAAa,YAAA,GAAA,OAAOA,WAC/D,CAAC,CAAA;EACH,GAAA;EACF;;AC/hFMC,MAAAA,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/luxon/build/cjs-browser/luxon.js b/node_modules/luxon/build/cjs-browser/luxon.js new file mode 100644 index 00000000..679b0ee4 --- /dev/null +++ b/node_modules/luxon/build/cjs-browser/luxon.js @@ -0,0 +1,8739 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } +} +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; +} +function _extends() { + _extends = Object.assign ? Object.assign.bind() : function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + return target; + }; + return _extends.apply(this, arguments); +} +function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + _setPrototypeOf(subClass, superClass); +} +function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); +} +function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return _setPrototypeOf(o, p); +} +function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } +} +function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct.bind(); + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + return _construct.apply(null, arguments); +} +function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; +} +function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + _cache.set(Class, Wrapper); + } + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; + return _wrapNativeSuper(Class); +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; +} +function _createForOfIteratorHelperLoose(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (it) return (it = it.call(o)).next.bind(it); + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _toPrimitive(input, hint) { + if (typeof input !== "object" || input === null) return input; + var prim = input[Symbol.toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (typeof res !== "object") return res; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (hint === "string" ? String : Number)(input); +} +function _toPropertyKey(arg) { + var key = _toPrimitive(arg, "string"); + return typeof key === "symbol" ? key : String(key); +} + +// these aren't really private, but nor are they really useful to document +/** + * @private + */ +var LuxonError = /*#__PURE__*/function (_Error) { + _inheritsLoose(LuxonError, _Error); + function LuxonError() { + return _Error.apply(this, arguments) || this; + } + return LuxonError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); +/** + * @private + */ +var InvalidDateTimeError = /*#__PURE__*/function (_LuxonError) { + _inheritsLoose(InvalidDateTimeError, _LuxonError); + function InvalidDateTimeError(reason) { + return _LuxonError.call(this, "Invalid DateTime: " + reason.toMessage()) || this; + } + return InvalidDateTimeError; +}(LuxonError); + +/** + * @private + */ +var InvalidIntervalError = /*#__PURE__*/function (_LuxonError2) { + _inheritsLoose(InvalidIntervalError, _LuxonError2); + function InvalidIntervalError(reason) { + return _LuxonError2.call(this, "Invalid Interval: " + reason.toMessage()) || this; + } + return InvalidIntervalError; +}(LuxonError); + +/** + * @private + */ +var InvalidDurationError = /*#__PURE__*/function (_LuxonError3) { + _inheritsLoose(InvalidDurationError, _LuxonError3); + function InvalidDurationError(reason) { + return _LuxonError3.call(this, "Invalid Duration: " + reason.toMessage()) || this; + } + return InvalidDurationError; +}(LuxonError); + +/** + * @private + */ +var ConflictingSpecificationError = /*#__PURE__*/function (_LuxonError4) { + _inheritsLoose(ConflictingSpecificationError, _LuxonError4); + function ConflictingSpecificationError() { + return _LuxonError4.apply(this, arguments) || this; + } + return ConflictingSpecificationError; +}(LuxonError); + +/** + * @private + */ +var InvalidUnitError = /*#__PURE__*/function (_LuxonError5) { + _inheritsLoose(InvalidUnitError, _LuxonError5); + function InvalidUnitError(unit) { + return _LuxonError5.call(this, "Invalid unit " + unit) || this; + } + return InvalidUnitError; +}(LuxonError); + +/** + * @private + */ +var InvalidArgumentError = /*#__PURE__*/function (_LuxonError6) { + _inheritsLoose(InvalidArgumentError, _LuxonError6); + function InvalidArgumentError() { + return _LuxonError6.apply(this, arguments) || this; + } + return InvalidArgumentError; +}(LuxonError); + +/** + * @private + */ +var ZoneIsAbstractError = /*#__PURE__*/function (_LuxonError7) { + _inheritsLoose(ZoneIsAbstractError, _LuxonError7); + function ZoneIsAbstractError() { + return _LuxonError7.call(this, "Zone is an abstract class") || this; + } + return ZoneIsAbstractError; +}(LuxonError); + +/** + * @private + */ + +var n = "numeric", + s = "short", + l = "long"; +var DATE_SHORT = { + year: n, + month: n, + day: n +}; +var DATE_MED = { + year: n, + month: s, + day: n +}; +var DATE_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s +}; +var DATE_FULL = { + year: n, + month: l, + day: n +}; +var DATE_HUGE = { + year: n, + month: l, + day: n, + weekday: l +}; +var TIME_SIMPLE = { + hour: n, + minute: n +}; +var TIME_WITH_SECONDS = { + hour: n, + minute: n, + second: n +}; +var TIME_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: s +}; +var TIME_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: l +}; +var TIME_24_SIMPLE = { + hour: n, + minute: n, + hourCycle: "h23" +}; +var TIME_24_WITH_SECONDS = { + hour: n, + minute: n, + second: n, + hourCycle: "h23" +}; +var TIME_24_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + hourCycle: "h23", + timeZoneName: s +}; +var TIME_24_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + hourCycle: "h23", + timeZoneName: l +}; +var DATETIME_SHORT = { + year: n, + month: n, + day: n, + hour: n, + minute: n +}; +var DATETIME_SHORT_WITH_SECONDS = { + year: n, + month: n, + day: n, + hour: n, + minute: n, + second: n +}; +var DATETIME_MED = { + year: n, + month: s, + day: n, + hour: n, + minute: n +}; +var DATETIME_MED_WITH_SECONDS = { + year: n, + month: s, + day: n, + hour: n, + minute: n, + second: n +}; +var DATETIME_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, + hour: n, + minute: n +}; +var DATETIME_FULL = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + timeZoneName: s +}; +var DATETIME_FULL_WITH_SECONDS = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + second: n, + timeZoneName: s +}; +var DATETIME_HUGE = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + timeZoneName: l +}; +var DATETIME_HUGE_WITH_SECONDS = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + second: n, + timeZoneName: l +}; + +/** + * @interface + */ +var Zone = /*#__PURE__*/function () { + function Zone() {} + var _proto = Zone.prototype; + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + _proto.offsetName = function offsetName(ts, opts) { + throw new ZoneIsAbstractError(); + } + + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */; + _proto.formatOffset = function formatOffset(ts, format) { + throw new ZoneIsAbstractError(); + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */; + _proto.offset = function offset(ts) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */; + _proto.equals = function equals(otherZone) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */; + _createClass(Zone, [{ + key: "type", + get: + /** + * The type of zone + * @abstract + * @type {string} + */ + function get() { + throw new ZoneIsAbstractError(); + } + + /** + * The name of this zone. + * @abstract + * @type {string} + */ + }, { + key: "name", + get: function get() { + throw new ZoneIsAbstractError(); + } + + /** + * The IANA name of this zone. + * Defaults to `name` if not overwritten by a subclass. + * @abstract + * @type {string} + */ + }, { + key: "ianaName", + get: function get() { + return this.name; + } + + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + }, { + key: "isUniversal", + get: function get() { + throw new ZoneIsAbstractError(); + } + }, { + key: "isValid", + get: function get() { + throw new ZoneIsAbstractError(); + } + }]); + return Zone; +}(); + +var singleton$1 = null; + +/** + * Represents the local zone for this JavaScript environment. + * @implements {Zone} + */ +var SystemZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(SystemZone, _Zone); + function SystemZone() { + return _Zone.apply(this, arguments) || this; + } + var _proto = SystemZone.prototype; + /** @override **/ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale); + } + + /** @override **/; + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** @override **/; + _proto.offset = function offset(ts) { + return -new Date(ts).getTimezoneOffset(); + } + + /** @override **/; + _proto.equals = function equals(otherZone) { + return otherZone.type === "system"; + } + + /** @override **/; + _createClass(SystemZone, [{ + key: "type", + get: /** @override **/ + function get() { + return "system"; + } + + /** @override **/ + }, { + key: "name", + get: function get() { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } + + /** @override **/ + }, { + key: "isUniversal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }], [{ + key: "instance", + get: + /** + * Get a singleton instance of the local zone + * @return {SystemZone} + */ + function get() { + if (singleton$1 === null) { + singleton$1 = new SystemZone(); + } + return singleton$1; + } + }]); + return SystemZone; +}(Zone); + +var dtfCache = new Map(); +function makeDTF(zoneName) { + var dtf = dtfCache.get(zoneName); + if (dtf === undefined) { + dtf = new Intl.DateTimeFormat("en-US", { + hour12: false, + timeZone: zoneName, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + era: "short" + }); + dtfCache.set(zoneName, dtf); + } + return dtf; +} +var typeToPos = { + year: 0, + month: 1, + day: 2, + era: 3, + hour: 4, + minute: 5, + second: 6 +}; +function hackyOffset(dtf, date) { + var formatted = dtf.format(date).replace(/\u200E/g, ""), + parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted), + fMonth = parsed[1], + fDay = parsed[2], + fYear = parsed[3], + fadOrBc = parsed[4], + fHour = parsed[5], + fMinute = parsed[6], + fSecond = parsed[7]; + return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond]; +} +function partsOffset(dtf, date) { + var formatted = dtf.formatToParts(date); + var filled = []; + for (var i = 0; i < formatted.length; i++) { + var _formatted$i = formatted[i], + type = _formatted$i.type, + value = _formatted$i.value; + var pos = typeToPos[type]; + if (type === "era") { + filled[pos] = value; + } else if (!isUndefined(pos)) { + filled[pos] = parseInt(value, 10); + } + } + return filled; +} +var ianaZoneCache = new Map(); +/** + * A zone identified by an IANA identifier, like America/New_York + * @implements {Zone} + */ +var IANAZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(IANAZone, _Zone); + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + IANAZone.create = function create(name) { + var zone = ianaZoneCache.get(name); + if (zone === undefined) { + ianaZoneCache.set(name, zone = new IANAZone(name)); + } + return zone; + } + + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */; + IANAZone.resetCache = function resetCache() { + ianaZoneCache.clear(); + dtfCache.clear(); + } + + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead. + * @return {boolean} + */; + IANAZone.isValidSpecifier = function isValidSpecifier(s) { + return this.isValidZone(s); + } + + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */; + IANAZone.isValidZone = function isValidZone(zone) { + if (!zone) { + return false; + } + try { + new Intl.DateTimeFormat("en-US", { + timeZone: zone + }).format(); + return true; + } catch (e) { + return false; + } + }; + function IANAZone(name) { + var _this; + _this = _Zone.call(this) || this; + /** @private **/ + _this.zoneName = name; + /** @private **/ + _this.valid = IANAZone.isValidZone(name); + return _this; + } + + /** + * The type of zone. `iana` for all instances of `IANAZone`. + * @override + * @type {string} + */ + var _proto = IANAZone.prototype; + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @override + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale, this.name); + } + + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */; + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @override + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */; + _proto.offset = function offset(ts) { + if (!this.valid) return NaN; + var date = new Date(ts); + if (isNaN(date)) return NaN; + var dtf = makeDTF(this.name); + var _ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date), + year = _ref2[0], + month = _ref2[1], + day = _ref2[2], + adOrBc = _ref2[3], + hour = _ref2[4], + minute = _ref2[5], + second = _ref2[6]; + if (adOrBc === "BC") { + year = -Math.abs(year) + 1; + } + + // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat + var adjustedHour = hour === 24 ? 0 : hour; + var asUTC = objToLocalTS({ + year: year, + month: month, + day: day, + hour: adjustedHour, + minute: minute, + second: second, + millisecond: 0 + }); + var asTS = +date; + var over = asTS % 1000; + asTS -= over >= 0 ? over : 1000 + over; + return (asUTC - asTS) / (60 * 1000); + } + + /** + * Return whether this Zone is equal to another zone + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */; + _proto.equals = function equals(otherZone) { + return otherZone.type === "iana" && otherZone.name === this.name; + } + + /** + * Return whether this Zone is valid. + * @override + * @type {boolean} + */; + _createClass(IANAZone, [{ + key: "type", + get: function get() { + return "iana"; + } + + /** + * The name of this zone (i.e. the IANA zone name). + * @override + * @type {string} + */ + }, { + key: "name", + get: function get() { + return this.zoneName; + } + + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns false for all IANA zones. + * @override + * @type {boolean} + */ + }, { + key: "isUniversal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return this.valid; + } + }]); + return IANAZone; +}(Zone); + +var _excluded = ["base"], + _excluded2 = ["padTo", "floor"]; + +// todo - remap caching + +var intlLFCache = {}; +function getCachedLF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var key = JSON.stringify([locString, opts]); + var dtf = intlLFCache[key]; + if (!dtf) { + dtf = new Intl.ListFormat(locString, opts); + intlLFCache[key] = dtf; + } + return dtf; +} +var intlDTCache = new Map(); +function getCachedDTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var key = JSON.stringify([locString, opts]); + var dtf = intlDTCache.get(key); + if (dtf === undefined) { + dtf = new Intl.DateTimeFormat(locString, opts); + intlDTCache.set(key, dtf); + } + return dtf; +} +var intlNumCache = new Map(); +function getCachedINF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var key = JSON.stringify([locString, opts]); + var inf = intlNumCache.get(key); + if (inf === undefined) { + inf = new Intl.NumberFormat(locString, opts); + intlNumCache.set(key, inf); + } + return inf; +} +var intlRelCache = new Map(); +function getCachedRTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var _opts = opts; + _opts.base; + var cacheKeyOpts = _objectWithoutPropertiesLoose(_opts, _excluded); // exclude `base` from the options + var key = JSON.stringify([locString, cacheKeyOpts]); + var inf = intlRelCache.get(key); + if (inf === undefined) { + inf = new Intl.RelativeTimeFormat(locString, opts); + intlRelCache.set(key, inf); + } + return inf; +} +var sysLocaleCache = null; +function systemLocale() { + if (sysLocaleCache) { + return sysLocaleCache; + } else { + sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale; + return sysLocaleCache; + } +} +var intlResolvedOptionsCache = new Map(); +function getCachedIntResolvedOptions(locString) { + var opts = intlResolvedOptionsCache.get(locString); + if (opts === undefined) { + opts = new Intl.DateTimeFormat(locString).resolvedOptions(); + intlResolvedOptionsCache.set(locString, opts); + } + return opts; +} +var weekInfoCache = new Map(); +function getCachedWeekInfo(locString) { + var data = weekInfoCache.get(locString); + if (!data) { + var locale = new Intl.Locale(locString); + // browsers currently implement this as a property, but spec says it should be a getter function + data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo; + // minimalDays was removed from WeekInfo: https://github.com/tc39/proposal-intl-locale-info/issues/86 + if (!("minimalDays" in data)) { + data = _extends({}, fallbackWeekSettings, data); + } + weekInfoCache.set(locString, data); + } + return data; +} +function parseLocaleString(localeStr) { + // I really want to avoid writing a BCP 47 parser + // see, e.g. https://github.com/wooorm/bcp-47 + // Instead, we'll do this: + + // a) if the string has no -u extensions, just leave it alone + // b) if it does, use Intl to resolve everything + // c) if Intl fails, try again without the -u + + // private subtags and unicode subtags have ordering requirements, + // and we're not properly parsing this, so just strip out the + // private ones if they exist. + var xIndex = localeStr.indexOf("-x-"); + if (xIndex !== -1) { + localeStr = localeStr.substring(0, xIndex); + } + var uIndex = localeStr.indexOf("-u-"); + if (uIndex === -1) { + return [localeStr]; + } else { + var options; + var selectedStr; + try { + options = getCachedDTF(localeStr).resolvedOptions(); + selectedStr = localeStr; + } catch (e) { + var smaller = localeStr.substring(0, uIndex); + options = getCachedDTF(smaller).resolvedOptions(); + selectedStr = smaller; + } + var _options = options, + numberingSystem = _options.numberingSystem, + calendar = _options.calendar; + return [selectedStr, numberingSystem, calendar]; + } +} +function intlConfigString(localeStr, numberingSystem, outputCalendar) { + if (outputCalendar || numberingSystem) { + if (!localeStr.includes("-u-")) { + localeStr += "-u"; + } + if (outputCalendar) { + localeStr += "-ca-" + outputCalendar; + } + if (numberingSystem) { + localeStr += "-nu-" + numberingSystem; + } + return localeStr; + } else { + return localeStr; + } +} +function mapMonths(f) { + var ms = []; + for (var i = 1; i <= 12; i++) { + var dt = DateTime.utc(2009, i, 1); + ms.push(f(dt)); + } + return ms; +} +function mapWeekdays(f) { + var ms = []; + for (var i = 1; i <= 7; i++) { + var dt = DateTime.utc(2016, 11, 13 + i); + ms.push(f(dt)); + } + return ms; +} +function listStuff(loc, length, englishFn, intlFn) { + var mode = loc.listingMode(); + if (mode === "error") { + return null; + } else if (mode === "en") { + return englishFn(length); + } else { + return intlFn(length); + } +} +function supportsFastNumbers(loc) { + if (loc.numberingSystem && loc.numberingSystem !== "latn") { + return false; + } else { + return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || getCachedIntResolvedOptions(loc.locale).numberingSystem === "latn"; + } +} + +/** + * @private + */ +var PolyNumberFormatter = /*#__PURE__*/function () { + function PolyNumberFormatter(intl, forceSimple, opts) { + this.padTo = opts.padTo || 0; + this.floor = opts.floor || false; + opts.padTo; + opts.floor; + var otherOpts = _objectWithoutPropertiesLoose(opts, _excluded2); + if (!forceSimple || Object.keys(otherOpts).length > 0) { + var intlOpts = _extends({ + useGrouping: false + }, opts); + if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; + this.inf = getCachedINF(intl, intlOpts); + } + } + var _proto = PolyNumberFormatter.prototype; + _proto.format = function format(i) { + if (this.inf) { + var fixed = this.floor ? Math.floor(i) : i; + return this.inf.format(fixed); + } else { + // to match the browser's numberformatter defaults + var _fixed = this.floor ? Math.floor(i) : roundTo(i, 3); + return padStart(_fixed, this.padTo); + } + }; + return PolyNumberFormatter; +}(); +/** + * @private + */ +var PolyDateFormatter = /*#__PURE__*/function () { + function PolyDateFormatter(dt, intl, opts) { + this.opts = opts; + this.originalZone = undefined; + var z = undefined; + if (this.opts.timeZone) { + // Don't apply any workarounds if a timeZone is explicitly provided in opts + this.dt = dt; + } else if (dt.zone.type === "fixed") { + // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like. + // That is why fixed-offset TZ is set to that unless it is: + // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT. + // 2. Unsupported by the browser: + // - some do not support Etc/ + // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata + var gmtOffset = -1 * (dt.offset / 60); + var offsetZ = gmtOffset >= 0 ? "Etc/GMT+" + gmtOffset : "Etc/GMT" + gmtOffset; + if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) { + z = offsetZ; + this.dt = dt; + } else { + // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so + // we manually apply the offset and substitute the zone as needed. + z = "UTC"; + this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({ + minutes: dt.offset + }); + this.originalZone = dt.zone; + } + } else if (dt.zone.type === "system") { + this.dt = dt; + } else if (dt.zone.type === "iana") { + this.dt = dt; + z = dt.zone.name; + } else { + // Custom zones can have any offset / offsetName so we just manually + // apply the offset and substitute the zone as needed. + z = "UTC"; + this.dt = dt.setZone("UTC").plus({ + minutes: dt.offset + }); + this.originalZone = dt.zone; + } + var intlOpts = _extends({}, this.opts); + intlOpts.timeZone = intlOpts.timeZone || z; + this.dtf = getCachedDTF(intl, intlOpts); + } + var _proto2 = PolyDateFormatter.prototype; + _proto2.format = function format() { + if (this.originalZone) { + // If we have to substitute in the actual zone name, we have to use + // formatToParts so that the timezone can be replaced. + return this.formatToParts().map(function (_ref) { + var value = _ref.value; + return value; + }).join(""); + } + return this.dtf.format(this.dt.toJSDate()); + }; + _proto2.formatToParts = function formatToParts() { + var _this = this; + var parts = this.dtf.formatToParts(this.dt.toJSDate()); + if (this.originalZone) { + return parts.map(function (part) { + if (part.type === "timeZoneName") { + var offsetName = _this.originalZone.offsetName(_this.dt.ts, { + locale: _this.dt.locale, + format: _this.opts.timeZoneName + }); + return _extends({}, part, { + value: offsetName + }); + } else { + return part; + } + }); + } + return parts; + }; + _proto2.resolvedOptions = function resolvedOptions() { + return this.dtf.resolvedOptions(); + }; + return PolyDateFormatter; +}(); +/** + * @private + */ +var PolyRelFormatter = /*#__PURE__*/function () { + function PolyRelFormatter(intl, isEnglish, opts) { + this.opts = _extends({ + style: "long" + }, opts); + if (!isEnglish && hasRelative()) { + this.rtf = getCachedRTF(intl, opts); + } + } + var _proto3 = PolyRelFormatter.prototype; + _proto3.format = function format(count, unit) { + if (this.rtf) { + return this.rtf.format(count, unit); + } else { + return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); + } + }; + _proto3.formatToParts = function formatToParts(count, unit) { + if (this.rtf) { + return this.rtf.formatToParts(count, unit); + } else { + return []; + } + }; + return PolyRelFormatter; +}(); +var fallbackWeekSettings = { + firstDay: 1, + minimalDays: 4, + weekend: [6, 7] +}; + +/** + * @private + */ +var Locale = /*#__PURE__*/function () { + Locale.fromOpts = function fromOpts(opts) { + return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN); + }; + Locale.create = function create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN) { + if (defaultToEN === void 0) { + defaultToEN = false; + } + var specifiedLocale = locale || Settings.defaultLocale; + // the system locale is useful for human-readable strings but annoying for parsing/formatting known formats + var localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()); + var numberingSystemR = numberingSystem || Settings.defaultNumberingSystem; + var outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; + var weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings; + return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale); + }; + Locale.resetCache = function resetCache() { + sysLocaleCache = null; + intlDTCache.clear(); + intlNumCache.clear(); + intlRelCache.clear(); + intlResolvedOptionsCache.clear(); + weekInfoCache.clear(); + }; + Locale.fromObject = function fromObject(_temp) { + var _ref2 = _temp === void 0 ? {} : _temp, + locale = _ref2.locale, + numberingSystem = _ref2.numberingSystem, + outputCalendar = _ref2.outputCalendar, + weekSettings = _ref2.weekSettings; + return Locale.create(locale, numberingSystem, outputCalendar, weekSettings); + }; + function Locale(locale, numbering, outputCalendar, weekSettings, specifiedLocale) { + var _parseLocaleString = parseLocaleString(locale), + parsedLocale = _parseLocaleString[0], + parsedNumberingSystem = _parseLocaleString[1], + parsedOutputCalendar = _parseLocaleString[2]; + this.locale = parsedLocale; + this.numberingSystem = numbering || parsedNumberingSystem || null; + this.outputCalendar = outputCalendar || parsedOutputCalendar || null; + this.weekSettings = weekSettings; + this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); + this.weekdaysCache = { + format: {}, + standalone: {} + }; + this.monthsCache = { + format: {}, + standalone: {} + }; + this.meridiemCache = null; + this.eraCache = {}; + this.specifiedLocale = specifiedLocale; + this.fastNumbersCached = null; + } + var _proto4 = Locale.prototype; + _proto4.listingMode = function listingMode() { + var isActuallyEn = this.isEnglish(); + var hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); + return isActuallyEn && hasNoWeirdness ? "en" : "intl"; + }; + _proto4.clone = function clone(alts) { + if (!alts || Object.getOwnPropertyNames(alts).length === 0) { + return this; + } else { + return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false); + } + }; + _proto4.redefaultToEN = function redefaultToEN(alts) { + if (alts === void 0) { + alts = {}; + } + return this.clone(_extends({}, alts, { + defaultToEN: true + })); + }; + _proto4.redefaultToSystem = function redefaultToSystem(alts) { + if (alts === void 0) { + alts = {}; + } + return this.clone(_extends({}, alts, { + defaultToEN: false + })); + }; + _proto4.months = function months$1(length, format) { + var _this2 = this; + if (format === void 0) { + format = false; + } + return listStuff(this, length, months, function () { + // Workaround for "ja" locale: formatToParts does not label all parts of the month + // as "month" and for this locale there is no difference between "format" and "non-format". + // As such, just use format() instead of formatToParts() and take the whole string + var monthSpecialCase = _this2.intl === "ja" || _this2.intl.startsWith("ja-"); + format &= !monthSpecialCase; + var intl = format ? { + month: length, + day: "numeric" + } : { + month: length + }, + formatStr = format ? "format" : "standalone"; + if (!_this2.monthsCache[formatStr][length]) { + var mapper = !monthSpecialCase ? function (dt) { + return _this2.extract(dt, intl, "month"); + } : function (dt) { + return _this2.dtFormatter(dt, intl).format(); + }; + _this2.monthsCache[formatStr][length] = mapMonths(mapper); + } + return _this2.monthsCache[formatStr][length]; + }); + }; + _proto4.weekdays = function weekdays$1(length, format) { + var _this3 = this; + if (format === void 0) { + format = false; + } + return listStuff(this, length, weekdays, function () { + var intl = format ? { + weekday: length, + year: "numeric", + month: "long", + day: "numeric" + } : { + weekday: length + }, + formatStr = format ? "format" : "standalone"; + if (!_this3.weekdaysCache[formatStr][length]) { + _this3.weekdaysCache[formatStr][length] = mapWeekdays(function (dt) { + return _this3.extract(dt, intl, "weekday"); + }); + } + return _this3.weekdaysCache[formatStr][length]; + }); + }; + _proto4.meridiems = function meridiems$1() { + var _this4 = this; + return listStuff(this, undefined, function () { + return meridiems; + }, function () { + // In theory there could be aribitrary day periods. We're gonna assume there are exactly two + // for AM and PM. This is probably wrong, but it's makes parsing way easier. + if (!_this4.meridiemCache) { + var intl = { + hour: "numeric", + hourCycle: "h12" + }; + _this4.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(function (dt) { + return _this4.extract(dt, intl, "dayperiod"); + }); + } + return _this4.meridiemCache; + }); + }; + _proto4.eras = function eras$1(length) { + var _this5 = this; + return listStuff(this, length, eras, function () { + var intl = { + era: length + }; + + // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates + // to definitely enumerate them. + if (!_this5.eraCache[length]) { + _this5.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(function (dt) { + return _this5.extract(dt, intl, "era"); + }); + } + return _this5.eraCache[length]; + }); + }; + _proto4.extract = function extract(dt, intlOpts, field) { + var df = this.dtFormatter(dt, intlOpts), + results = df.formatToParts(), + matching = results.find(function (m) { + return m.type.toLowerCase() === field; + }); + return matching ? matching.value : null; + }; + _proto4.numberFormatter = function numberFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave) + // (in contrast, the rest of the condition is used heavily) + return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); + }; + _proto4.dtFormatter = function dtFormatter(dt, intlOpts) { + if (intlOpts === void 0) { + intlOpts = {}; + } + return new PolyDateFormatter(dt, this.intl, intlOpts); + }; + _proto4.relFormatter = function relFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + return new PolyRelFormatter(this.intl, this.isEnglish(), opts); + }; + _proto4.listFormatter = function listFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + return getCachedLF(this.intl, opts); + }; + _proto4.isEnglish = function isEnglish() { + return this.locale === "en" || this.locale.toLowerCase() === "en-us" || getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us"); + }; + _proto4.getWeekSettings = function getWeekSettings() { + if (this.weekSettings) { + return this.weekSettings; + } else if (!hasLocaleWeekInfo()) { + return fallbackWeekSettings; + } else { + return getCachedWeekInfo(this.locale); + } + }; + _proto4.getStartOfWeek = function getStartOfWeek() { + return this.getWeekSettings().firstDay; + }; + _proto4.getMinDaysInFirstWeek = function getMinDaysInFirstWeek() { + return this.getWeekSettings().minimalDays; + }; + _proto4.getWeekendDays = function getWeekendDays() { + return this.getWeekSettings().weekend; + }; + _proto4.equals = function equals(other) { + return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar; + }; + _proto4.toString = function toString() { + return "Locale(" + this.locale + ", " + this.numberingSystem + ", " + this.outputCalendar + ")"; + }; + _createClass(Locale, [{ + key: "fastNumbers", + get: function get() { + if (this.fastNumbersCached == null) { + this.fastNumbersCached = supportsFastNumbers(this); + } + return this.fastNumbersCached; + } + }]); + return Locale; +}(); + +var singleton = null; + +/** + * A zone with a fixed offset (meaning no DST) + * @implements {Zone} + */ +var FixedOffsetZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(FixedOffsetZone, _Zone); + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + FixedOffsetZone.instance = function instance(offset) { + return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset); + } + + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */; + FixedOffsetZone.parseSpecifier = function parseSpecifier(s) { + if (s) { + var r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + if (r) { + return new FixedOffsetZone(signedOffset(r[1], r[2])); + } + } + return null; + }; + function FixedOffsetZone(offset) { + var _this; + _this = _Zone.call(this) || this; + /** @private **/ + _this.fixed = offset; + return _this; + } + + /** + * The type of zone. `fixed` for all instances of `FixedOffsetZone`. + * @override + * @type {string} + */ + var _proto = FixedOffsetZone.prototype; + /** + * Returns the offset's common name at the specified timestamp. + * + * For fixed offset zones this equals to the zone name. + * @override + */ + _proto.offsetName = function offsetName() { + return this.name; + } + + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */; + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.fixed, format); + } + + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns true for all fixed offset zones. + * @override + * @type {boolean} + */; + /** + * Return the offset in minutes for this zone at the specified timestamp. + * + * For fixed offset zones, this is constant and does not depend on a timestamp. + * @override + * @return {number} + */ + _proto.offset = function offset() { + return this.fixed; + } + + /** + * Return whether this Zone is equal to another zone (i.e. also fixed and same offset) + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */; + _proto.equals = function equals(otherZone) { + return otherZone.type === "fixed" && otherZone.fixed === this.fixed; + } + + /** + * Return whether this Zone is valid: + * All fixed offset zones are valid. + * @override + * @type {boolean} + */; + _createClass(FixedOffsetZone, [{ + key: "type", + get: function get() { + return "fixed"; + } + + /** + * The name of this zone. + * All fixed zones' names always start with "UTC" (plus optional offset) + * @override + * @type {string} + */ + }, { + key: "name", + get: function get() { + return this.fixed === 0 ? "UTC" : "UTC" + formatOffset(this.fixed, "narrow"); + } + + /** + * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn` + * + * @override + * @type {string} + */ + }, { + key: "ianaName", + get: function get() { + if (this.fixed === 0) { + return "Etc/UTC"; + } else { + return "Etc/GMT" + formatOffset(-this.fixed, "narrow"); + } + } + }, { + key: "isUniversal", + get: function get() { + return true; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }], [{ + key: "utcInstance", + get: + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + function get() { + if (singleton === null) { + singleton = new FixedOffsetZone(0); + } + return singleton; + } + }]); + return FixedOffsetZone; +}(Zone); + +/** + * A zone that failed to parse. You should never need to instantiate this. + * @implements {Zone} + */ +var InvalidZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(InvalidZone, _Zone); + function InvalidZone(zoneName) { + var _this; + _this = _Zone.call(this) || this; + /** @private */ + _this.zoneName = zoneName; + return _this; + } + + /** @override **/ + var _proto = InvalidZone.prototype; + /** @override **/ + _proto.offsetName = function offsetName() { + return null; + } + + /** @override **/; + _proto.formatOffset = function formatOffset() { + return ""; + } + + /** @override **/; + _proto.offset = function offset() { + return NaN; + } + + /** @override **/; + _proto.equals = function equals() { + return false; + } + + /** @override **/; + _createClass(InvalidZone, [{ + key: "type", + get: function get() { + return "invalid"; + } + + /** @override **/ + }, { + key: "name", + get: function get() { + return this.zoneName; + } + + /** @override **/ + }, { + key: "isUniversal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return false; + } + }]); + return InvalidZone; +}(Zone); + +/** + * @private + */ +function normalizeZone(input, defaultZone) { + if (isUndefined(input) || input === null) { + return defaultZone; + } else if (input instanceof Zone) { + return input; + } else if (isString(input)) { + var lowered = input.toLowerCase(); + if (lowered === "default") return defaultZone;else if (lowered === "local" || lowered === "system") return SystemZone.instance;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input); + } else if (isNumber(input)) { + return FixedOffsetZone.instance(input); + } else if (typeof input === "object" && "offset" in input && typeof input.offset === "function") { + // This is dumb, but the instanceof check above doesn't seem to really work + // so we're duck checking it + return input; + } else { + return new InvalidZone(input); + } +} + +var numberingSystems = { + arab: "[\u0660-\u0669]", + arabext: "[\u06F0-\u06F9]", + bali: "[\u1B50-\u1B59]", + beng: "[\u09E6-\u09EF]", + deva: "[\u0966-\u096F]", + fullwide: "[\uFF10-\uFF19]", + gujr: "[\u0AE6-\u0AEF]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[\u17E0-\u17E9]", + knda: "[\u0CE6-\u0CEF]", + laoo: "[\u0ED0-\u0ED9]", + limb: "[\u1946-\u194F]", + mlym: "[\u0D66-\u0D6F]", + mong: "[\u1810-\u1819]", + mymr: "[\u1040-\u1049]", + orya: "[\u0B66-\u0B6F]", + tamldec: "[\u0BE6-\u0BEF]", + telu: "[\u0C66-\u0C6F]", + thai: "[\u0E50-\u0E59]", + tibt: "[\u0F20-\u0F29]", + latn: "\\d" +}; +var numberingSystemsUTF16 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881] +}; +var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); +function parseDigits(str) { + var value = parseInt(str, 10); + if (isNaN(value)) { + value = ""; + for (var i = 0; i < str.length; i++) { + var code = str.charCodeAt(i); + if (str[i].search(numberingSystems.hanidec) !== -1) { + value += hanidecChars.indexOf(str[i]); + } else { + for (var key in numberingSystemsUTF16) { + var _numberingSystemsUTF = numberingSystemsUTF16[key], + min = _numberingSystemsUTF[0], + max = _numberingSystemsUTF[1]; + if (code >= min && code <= max) { + value += code - min; + } + } + } + } + return parseInt(value, 10); + } else { + return value; + } +} + +// cache of {numberingSystem: {append: regex}} +var digitRegexCache = new Map(); +function resetDigitRegexCache() { + digitRegexCache.clear(); +} +function digitRegex(_ref, append) { + var numberingSystem = _ref.numberingSystem; + if (append === void 0) { + append = ""; + } + var ns = numberingSystem || "latn"; + var appendCache = digitRegexCache.get(ns); + if (appendCache === undefined) { + appendCache = new Map(); + digitRegexCache.set(ns, appendCache); + } + var regex = appendCache.get(append); + if (regex === undefined) { + regex = new RegExp("" + numberingSystems[ns] + append); + appendCache.set(append, regex); + } + return regex; +} + +var now = function now() { + return Date.now(); + }, + defaultZone = "system", + defaultLocale = null, + defaultNumberingSystem = null, + defaultOutputCalendar = null, + twoDigitCutoffYear = 60, + throwOnInvalid, + defaultWeekSettings = null; + +/** + * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here. + */ +var Settings = /*#__PURE__*/function () { + function Settings() {} + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + Settings.resetCaches = function resetCaches() { + Locale.resetCache(); + IANAZone.resetCache(); + DateTime.resetCache(); + resetDigitRegexCache(); + }; + _createClass(Settings, null, [{ + key: "now", + get: + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + function get() { + return now; + } + + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */, + set: function set(n) { + now = n; + } + + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * Use the value "system" to reset this value to the system's time zone. + * @type {string} + */ + }, { + key: "defaultZone", + get: + /** + * Get the default time zone object currently used to create DateTimes. Does not affect existing instances. + * The default value is the system's time zone (the one set on the machine that runs this code). + * @type {Zone} + */ + function get() { + return normalizeZone(defaultZone, SystemZone.instance); + } + + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(zone) { + defaultZone = zone; + } + }, { + key: "defaultLocale", + get: function get() { + return defaultLocale; + } + + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(locale) { + defaultLocale = locale; + } + + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + }, { + key: "defaultNumberingSystem", + get: function get() { + return defaultNumberingSystem; + } + + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(numberingSystem) { + defaultNumberingSystem = numberingSystem; + } + + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + }, { + key: "defaultOutputCalendar", + get: function get() { + return defaultOutputCalendar; + } + + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(outputCalendar) { + defaultOutputCalendar = outputCalendar; + } + + /** + * @typedef {Object} WeekSettings + * @property {number} firstDay + * @property {number} minimalDays + * @property {number[]} weekend + */ + + /** + * @return {WeekSettings|null} + */ + }, { + key: "defaultWeekSettings", + get: function get() { + return defaultWeekSettings; + } + + /** + * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and + * how many days are required in the first week of a year. + * Does not affect existing instances. + * + * @param {WeekSettings|null} weekSettings + */, + set: function set(weekSettings) { + defaultWeekSettings = validateWeekSettings(weekSettings); + } + + /** + * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + */ + }, { + key: "twoDigitCutoffYear", + get: function get() { + return twoDigitCutoffYear; + } + + /** + * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century + * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century + * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950 + * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50 + * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50 + */, + set: function set(cutoffYear) { + twoDigitCutoffYear = cutoffYear % 100; + } + + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + }, { + key: "throwOnInvalid", + get: function get() { + return throwOnInvalid; + } + + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */, + set: function set(t) { + throwOnInvalid = t; + } + }]); + return Settings; +}(); + +var Invalid = /*#__PURE__*/function () { + function Invalid(reason, explanation) { + this.reason = reason; + this.explanation = explanation; + } + var _proto = Invalid.prototype; + _proto.toMessage = function toMessage() { + if (this.explanation) { + return this.reason + ": " + this.explanation; + } else { + return this.reason; + } + }; + return Invalid; +}(); + +var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], + leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; +function unitOutOfRange(unit, value) { + return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid"); +} +function dayOfWeek(year, month, day) { + var d = new Date(Date.UTC(year, month - 1, day)); + if (year < 100 && year >= 0) { + d.setUTCFullYear(d.getUTCFullYear() - 1900); + } + var js = d.getUTCDay(); + return js === 0 ? 7 : js; +} +function computeOrdinal(year, month, day) { + return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; +} +function uncomputeOrdinal(year, ordinal) { + var table = isLeapYear(year) ? leapLadder : nonLeapLadder, + month0 = table.findIndex(function (i) { + return i < ordinal; + }), + day = ordinal - table[month0]; + return { + month: month0 + 1, + day: day + }; +} +function isoWeekdayToLocal(isoWeekday, startOfWeek) { + return (isoWeekday - startOfWeek + 7) % 7 + 1; +} + +/** + * @private + */ + +function gregorianToWeek(gregObj, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var year = gregObj.year, + month = gregObj.month, + day = gregObj.day, + ordinal = computeOrdinal(year, month, day), + weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek); + var weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7), + weekYear; + if (weekNumber < 1) { + weekYear = year - 1; + weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek); + } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) { + weekYear = year + 1; + weekNumber = 1; + } else { + weekYear = year; + } + return _extends({ + weekYear: weekYear, + weekNumber: weekNumber, + weekday: weekday + }, timeObject(gregObj)); +} +function weekToGregorian(weekData, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var weekYear = weekData.weekYear, + weekNumber = weekData.weekNumber, + weekday = weekData.weekday, + weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek), + yearInDays = daysInYear(weekYear); + var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek, + year; + if (ordinal < 1) { + year = weekYear - 1; + ordinal += daysInYear(year); + } else if (ordinal > yearInDays) { + year = weekYear + 1; + ordinal -= daysInYear(weekYear); + } else { + year = weekYear; + } + var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal.month, + day = _uncomputeOrdinal.day; + return _extends({ + year: year, + month: month, + day: day + }, timeObject(weekData)); +} +function gregorianToOrdinal(gregData) { + var year = gregData.year, + month = gregData.month, + day = gregData.day; + var ordinal = computeOrdinal(year, month, day); + return _extends({ + year: year, + ordinal: ordinal + }, timeObject(gregData)); +} +function ordinalToGregorian(ordinalData) { + var year = ordinalData.year, + ordinal = ordinalData.ordinal; + var _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal2.month, + day = _uncomputeOrdinal2.day; + return _extends({ + year: year, + month: month, + day: day + }, timeObject(ordinalData)); +} + +/** + * Check if local week units like localWeekday are used in obj. + * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties. + * Modifies obj in-place! + * @param obj the object values + */ +function usesLocalWeekValues(obj, loc) { + var hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear); + if (hasLocaleWeekData) { + var hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear); + if (hasIsoWeekData) { + throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields"); + } + if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday; + if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber; + if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear; + delete obj.localWeekday; + delete obj.localWeekNumber; + delete obj.localWeekYear; + return { + minDaysInFirstWeek: loc.getMinDaysInFirstWeek(), + startOfWeek: loc.getStartOfWeek() + }; + } else { + return { + minDaysInFirstWeek: 4, + startOfWeek: 1 + }; + } +} +function hasInvalidWeekData(obj, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var validYear = isInteger(obj.weekYear), + validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)), + validWeekday = integerBetween(obj.weekday, 1, 7); + if (!validYear) { + return unitOutOfRange("weekYear", obj.weekYear); + } else if (!validWeek) { + return unitOutOfRange("week", obj.weekNumber); + } else if (!validWeekday) { + return unitOutOfRange("weekday", obj.weekday); + } else return false; +} +function hasInvalidOrdinalData(obj) { + var validYear = isInteger(obj.year), + validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validOrdinal) { + return unitOutOfRange("ordinal", obj.ordinal); + } else return false; +} +function hasInvalidGregorianData(obj) { + var validYear = isInteger(obj.year), + validMonth = integerBetween(obj.month, 1, 12), + validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validMonth) { + return unitOutOfRange("month", obj.month); + } else if (!validDay) { + return unitOutOfRange("day", obj.day); + } else return false; +} +function hasInvalidTimeData(obj) { + var hour = obj.hour, + minute = obj.minute, + second = obj.second, + millisecond = obj.millisecond; + var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, + validMinute = integerBetween(minute, 0, 59), + validSecond = integerBetween(second, 0, 59), + validMillisecond = integerBetween(millisecond, 0, 999); + if (!validHour) { + return unitOutOfRange("hour", hour); + } else if (!validMinute) { + return unitOutOfRange("minute", minute); + } else if (!validSecond) { + return unitOutOfRange("second", second); + } else if (!validMillisecond) { + return unitOutOfRange("millisecond", millisecond); + } else return false; +} + +/** + * @private + */ + +// TYPES + +function isUndefined(o) { + return typeof o === "undefined"; +} +function isNumber(o) { + return typeof o === "number"; +} +function isInteger(o) { + return typeof o === "number" && o % 1 === 0; +} +function isString(o) { + return typeof o === "string"; +} +function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; +} + +// CAPABILITIES + +function hasRelative() { + try { + return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; + } catch (e) { + return false; + } +} +function hasLocaleWeekInfo() { + try { + return typeof Intl !== "undefined" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype); + } catch (e) { + return false; + } +} + +// OBJECTS AND ARRAYS + +function maybeArray(thing) { + return Array.isArray(thing) ? thing : [thing]; +} +function bestBy(arr, by, compare) { + if (arr.length === 0) { + return undefined; + } + return arr.reduce(function (best, next) { + var pair = [by(next), next]; + if (!best) { + return pair; + } else if (compare(best[0], pair[0]) === best[0]) { + return best; + } else { + return pair; + } + }, null)[1]; +} +function pick(obj, keys) { + return keys.reduce(function (a, k) { + a[k] = obj[k]; + return a; + }, {}); +} +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} +function validateWeekSettings(settings) { + if (settings == null) { + return null; + } else if (typeof settings !== "object") { + throw new InvalidArgumentError("Week settings must be an object"); + } else { + if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some(function (v) { + return !integerBetween(v, 1, 7); + })) { + throw new InvalidArgumentError("Invalid week settings"); + } + return { + firstDay: settings.firstDay, + minimalDays: settings.minimalDays, + weekend: Array.from(settings.weekend) + }; + } +} + +// NUMBERS AND STRINGS + +function integerBetween(thing, bottom, top) { + return isInteger(thing) && thing >= bottom && thing <= top; +} + +// x % n but takes the sign of n instead of x +function floorMod(x, n) { + return x - n * Math.floor(x / n); +} +function padStart(input, n) { + if (n === void 0) { + n = 2; + } + var isNeg = input < 0; + var padded; + if (isNeg) { + padded = "-" + ("" + -input).padStart(n, "0"); + } else { + padded = ("" + input).padStart(n, "0"); + } + return padded; +} +function parseInteger(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseInt(string, 10); + } +} +function parseFloating(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseFloat(string); + } +} +function parseMillis(fraction) { + // Return undefined (instead of 0) in these cases, where fraction is not set + if (isUndefined(fraction) || fraction === null || fraction === "") { + return undefined; + } else { + var f = parseFloat("0." + fraction) * 1000; + return Math.floor(f); + } +} +function roundTo(number, digits, rounding) { + if (rounding === void 0) { + rounding = "round"; + } + var factor = Math.pow(10, digits); + switch (rounding) { + case "expand": + return number > 0 ? Math.ceil(number * factor) / factor : Math.floor(number * factor) / factor; + case "trunc": + return Math.trunc(number * factor) / factor; + case "round": + return Math.round(number * factor) / factor; + case "floor": + return Math.floor(number * factor) / factor; + case "ceil": + return Math.ceil(number * factor) / factor; + default: + throw new RangeError("Value rounding " + rounding + " is out of range"); + } +} + +// DATE BASICS + +function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} +function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; +} +function daysInMonth(year, month) { + var modMonth = floorMod(month - 1, 12) + 1, + modYear = year + (month - modMonth) / 12; + if (modMonth === 2) { + return isLeapYear(modYear) ? 29 : 28; + } else { + return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; + } +} + +// convert a calendar object to a local timestamp (epoch, but with the offset baked in) +function objToLocalTS(obj) { + var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond); + + // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that + if (obj.year < 100 && obj.year >= 0) { + d = new Date(d); + // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not + // so if obj.year is in 99, but obj.day makes it roll over into year 100, + // the calculations done by Date.UTC are using year 2000 - which is incorrect + d.setUTCFullYear(obj.year, obj.month - 1, obj.day); + } + return +d; +} + +// adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js +function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) { + var fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek); + return -fwdlw + minDaysInFirstWeek - 1; +} +function weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek); + var weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek); + return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7; +} +function untruncateYear(year) { + if (year > 99) { + return year; + } else return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year; +} + +// PARSING + +function parseZoneInfo(ts, offsetFormat, locale, timeZone) { + if (timeZone === void 0) { + timeZone = null; + } + var date = new Date(ts), + intlOpts = { + hourCycle: "h23", + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit" + }; + if (timeZone) { + intlOpts.timeZone = timeZone; + } + var modified = _extends({ + timeZoneName: offsetFormat + }, intlOpts); + var parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(function (m) { + return m.type.toLowerCase() === "timezonename"; + }); + return parsed ? parsed.value : null; +} + +// signedOffset('-5', '30') -> -330 +function signedOffset(offHourStr, offMinuteStr) { + var offHour = parseInt(offHourStr, 10); + + // don't || this because we want to preserve -0 + if (Number.isNaN(offHour)) { + offHour = 0; + } + var offMin = parseInt(offMinuteStr, 10) || 0, + offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; + return offHour * 60 + offMinSigned; +} + +// COERCION + +function asNumber(value) { + var numericValue = Number(value); + if (typeof value === "boolean" || value === "" || !Number.isFinite(numericValue)) throw new InvalidArgumentError("Invalid unit value " + value); + return numericValue; +} +function normalizeObject(obj, normalizer) { + var normalized = {}; + for (var u in obj) { + if (hasOwnProperty(obj, u)) { + var v = obj[u]; + if (v === undefined || v === null) continue; + normalized[normalizer(u)] = asNumber(v); + } + } + return normalized; +} + +/** + * Returns the offset's value as a string + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ +function formatOffset(offset, format) { + var hours = Math.trunc(Math.abs(offset / 60)), + minutes = Math.trunc(Math.abs(offset % 60)), + sign = offset >= 0 ? "+" : "-"; + switch (format) { + case "short": + return "" + sign + padStart(hours, 2) + ":" + padStart(minutes, 2); + case "narrow": + return "" + sign + hours + (minutes > 0 ? ":" + minutes : ""); + case "techie": + return "" + sign + padStart(hours, 2) + padStart(minutes, 2); + default: + throw new RangeError("Value format " + format + " is out of range for property format"); + } +} +function timeObject(obj) { + return pick(obj, ["hour", "minute", "second", "millisecond"]); +} + +/** + * @private + */ + +var monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; +var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; +var monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; +function months(length) { + switch (length) { + case "narrow": + return [].concat(monthsNarrow); + case "short": + return [].concat(monthsShort); + case "long": + return [].concat(monthsLong); + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + default: + return null; + } +} +var weekdaysLong = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; +var weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; +var weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; +function weekdays(length) { + switch (length) { + case "narrow": + return [].concat(weekdaysNarrow); + case "short": + return [].concat(weekdaysShort); + case "long": + return [].concat(weekdaysLong); + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + default: + return null; + } +} +var meridiems = ["AM", "PM"]; +var erasLong = ["Before Christ", "Anno Domini"]; +var erasShort = ["BC", "AD"]; +var erasNarrow = ["B", "A"]; +function eras(length) { + switch (length) { + case "narrow": + return [].concat(erasNarrow); + case "short": + return [].concat(erasShort); + case "long": + return [].concat(erasLong); + default: + return null; + } +} +function meridiemForDateTime(dt) { + return meridiems[dt.hour < 12 ? 0 : 1]; +} +function weekdayForDateTime(dt, length) { + return weekdays(length)[dt.weekday - 1]; +} +function monthForDateTime(dt, length) { + return months(length)[dt.month - 1]; +} +function eraForDateTime(dt, length) { + return eras(length)[dt.year < 0 ? 0 : 1]; +} +function formatRelativeTime(unit, count, numeric, narrow) { + if (numeric === void 0) { + numeric = "always"; + } + if (narrow === void 0) { + narrow = false; + } + var units = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."] + }; + var lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; + if (numeric === "auto" && lastable) { + var isDay = unit === "days"; + switch (count) { + case 1: + return isDay ? "tomorrow" : "next " + units[unit][0]; + case -1: + return isDay ? "yesterday" : "last " + units[unit][0]; + case 0: + return isDay ? "today" : "this " + units[unit][0]; + } + } + + var isInPast = Object.is(count, -0) || count < 0, + fmtValue = Math.abs(count), + singular = fmtValue === 1, + lilUnits = units[unit], + fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit; + return isInPast ? fmtValue + " " + fmtUnit + " ago" : "in " + fmtValue + " " + fmtUnit; +} + +function stringifyTokens(splits, tokenToString) { + var s = ""; + for (var _iterator = _createForOfIteratorHelperLoose(splits), _step; !(_step = _iterator()).done;) { + var token = _step.value; + if (token.literal) { + s += token.val; + } else { + s += tokenToString(token.val); + } + } + return s; +} +var _macroTokenToFormatOpts = { + D: DATE_SHORT, + DD: DATE_MED, + DDD: DATE_FULL, + DDDD: DATE_HUGE, + t: TIME_SIMPLE, + tt: TIME_WITH_SECONDS, + ttt: TIME_WITH_SHORT_OFFSET, + tttt: TIME_WITH_LONG_OFFSET, + T: TIME_24_SIMPLE, + TT: TIME_24_WITH_SECONDS, + TTT: TIME_24_WITH_SHORT_OFFSET, + TTTT: TIME_24_WITH_LONG_OFFSET, + f: DATETIME_SHORT, + ff: DATETIME_MED, + fff: DATETIME_FULL, + ffff: DATETIME_HUGE, + F: DATETIME_SHORT_WITH_SECONDS, + FF: DATETIME_MED_WITH_SECONDS, + FFF: DATETIME_FULL_WITH_SECONDS, + FFFF: DATETIME_HUGE_WITH_SECONDS +}; + +/** + * @private + */ +var Formatter = /*#__PURE__*/function () { + Formatter.create = function create(locale, opts) { + if (opts === void 0) { + opts = {}; + } + return new Formatter(locale, opts); + }; + Formatter.parseFormat = function parseFormat(fmt) { + // white-space is always considered a literal in user-provided formats + // the " " token has a special meaning (see unitForToken) + + var current = null, + currentFull = "", + bracketed = false; + var splits = []; + for (var i = 0; i < fmt.length; i++) { + var c = fmt.charAt(i); + if (c === "'") { + // turn '' into a literal signal quote instead of just skipping the empty literal + if (currentFull.length > 0 || bracketed) { + splits.push({ + literal: bracketed || /^\s+$/.test(currentFull), + val: currentFull === "" ? "'" : currentFull + }); + } + current = null; + currentFull = ""; + bracketed = !bracketed; + } else if (bracketed) { + currentFull += c; + } else if (c === current) { + currentFull += c; + } else { + if (currentFull.length > 0) { + splits.push({ + literal: /^\s+$/.test(currentFull), + val: currentFull + }); + } + currentFull = c; + current = c; + } + } + if (currentFull.length > 0) { + splits.push({ + literal: bracketed || /^\s+$/.test(currentFull), + val: currentFull + }); + } + return splits; + }; + Formatter.macroTokenToFormatOpts = function macroTokenToFormatOpts(token) { + return _macroTokenToFormatOpts[token]; + }; + function Formatter(locale, formatOpts) { + this.opts = formatOpts; + this.loc = locale; + this.systemLoc = null; + } + var _proto = Formatter.prototype; + _proto.formatWithSystemDefault = function formatWithSystemDefault(dt, opts) { + if (this.systemLoc === null) { + this.systemLoc = this.loc.redefaultToSystem(); + } + var df = this.systemLoc.dtFormatter(dt, _extends({}, this.opts, opts)); + return df.format(); + }; + _proto.dtFormatter = function dtFormatter(dt, opts) { + if (opts === void 0) { + opts = {}; + } + return this.loc.dtFormatter(dt, _extends({}, this.opts, opts)); + }; + _proto.formatDateTime = function formatDateTime(dt, opts) { + return this.dtFormatter(dt, opts).format(); + }; + _proto.formatDateTimeParts = function formatDateTimeParts(dt, opts) { + return this.dtFormatter(dt, opts).formatToParts(); + }; + _proto.formatInterval = function formatInterval(interval, opts) { + var df = this.dtFormatter(interval.start, opts); + return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate()); + }; + _proto.resolvedOptions = function resolvedOptions(dt, opts) { + return this.dtFormatter(dt, opts).resolvedOptions(); + }; + _proto.num = function num(n, p, signDisplay) { + if (p === void 0) { + p = 0; + } + if (signDisplay === void 0) { + signDisplay = undefined; + } + // we get some perf out of doing this here, annoyingly + if (this.opts.forceSimple) { + return padStart(n, p); + } + var opts = _extends({}, this.opts); + if (p > 0) { + opts.padTo = p; + } + if (signDisplay) { + opts.signDisplay = signDisplay; + } + return this.loc.numberFormatter(opts).format(n); + }; + _proto.formatDateTimeFromString = function formatDateTimeFromString(dt, fmt) { + var _this = this; + var knownEnglish = this.loc.listingMode() === "en", + useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", + string = function string(opts, extract) { + return _this.loc.extract(dt, opts, extract); + }, + formatOffset = function formatOffset(opts) { + if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { + return "Z"; + } + return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; + }, + meridiem = function meridiem() { + return knownEnglish ? meridiemForDateTime(dt) : string({ + hour: "numeric", + hourCycle: "h12" + }, "dayperiod"); + }, + month = function month(length, standalone) { + return knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { + month: length + } : { + month: length, + day: "numeric" + }, "month"); + }, + weekday = function weekday(length, standalone) { + return knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { + weekday: length + } : { + weekday: length, + month: "long", + day: "numeric" + }, "weekday"); + }, + maybeMacro = function maybeMacro(token) { + var formatOpts = Formatter.macroTokenToFormatOpts(token); + if (formatOpts) { + return _this.formatWithSystemDefault(dt, formatOpts); + } else { + return token; + } + }, + era = function era(length) { + return knownEnglish ? eraForDateTime(dt, length) : string({ + era: length + }, "era"); + }, + tokenToString = function tokenToString(token) { + // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols + switch (token) { + // ms + case "S": + return _this.num(dt.millisecond); + case "u": + // falls through + case "SSS": + return _this.num(dt.millisecond, 3); + // seconds + case "s": + return _this.num(dt.second); + case "ss": + return _this.num(dt.second, 2); + // fractional seconds + case "uu": + return _this.num(Math.floor(dt.millisecond / 10), 2); + case "uuu": + return _this.num(Math.floor(dt.millisecond / 100)); + // minutes + case "m": + return _this.num(dt.minute); + case "mm": + return _this.num(dt.minute, 2); + // hours + case "h": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); + case "hh": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); + case "H": + return _this.num(dt.hour); + case "HH": + return _this.num(dt.hour, 2); + // offset + case "Z": + // like +6 + return formatOffset({ + format: "narrow", + allowZ: _this.opts.allowZ + }); + case "ZZ": + // like +06:00 + return formatOffset({ + format: "short", + allowZ: _this.opts.allowZ + }); + case "ZZZ": + // like +0600 + return formatOffset({ + format: "techie", + allowZ: _this.opts.allowZ + }); + case "ZZZZ": + // like EST + return dt.zone.offsetName(dt.ts, { + format: "short", + locale: _this.loc.locale + }); + case "ZZZZZ": + // like Eastern Standard Time + return dt.zone.offsetName(dt.ts, { + format: "long", + locale: _this.loc.locale + }); + // zone + case "z": + // like America/New_York + return dt.zoneName; + // meridiems + case "a": + return meridiem(); + // dates + case "d": + return useDateTimeFormatter ? string({ + day: "numeric" + }, "day") : _this.num(dt.day); + case "dd": + return useDateTimeFormatter ? string({ + day: "2-digit" + }, "day") : _this.num(dt.day, 2); + // weekdays - standalone + case "c": + // like 1 + return _this.num(dt.weekday); + case "ccc": + // like 'Tues' + return weekday("short", true); + case "cccc": + // like 'Tuesday' + return weekday("long", true); + case "ccccc": + // like 'T' + return weekday("narrow", true); + // weekdays - format + case "E": + // like 1 + return _this.num(dt.weekday); + case "EEE": + // like 'Tues' + return weekday("short", false); + case "EEEE": + // like 'Tuesday' + return weekday("long", false); + case "EEEEE": + // like 'T' + return weekday("narrow", false); + // months - standalone + case "L": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric", + day: "numeric" + }, "month") : _this.num(dt.month); + case "LL": + // like 01, doesn't seem to work + return useDateTimeFormatter ? string({ + month: "2-digit", + day: "numeric" + }, "month") : _this.num(dt.month, 2); + case "LLL": + // like Jan + return month("short", true); + case "LLLL": + // like January + return month("long", true); + case "LLLLL": + // like J + return month("narrow", true); + // months - format + case "M": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric" + }, "month") : _this.num(dt.month); + case "MM": + // like 01 + return useDateTimeFormatter ? string({ + month: "2-digit" + }, "month") : _this.num(dt.month, 2); + case "MMM": + // like Jan + return month("short", false); + case "MMMM": + // like January + return month("long", false); + case "MMMMM": + // like J + return month("narrow", false); + // years + case "y": + // like 2014 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year); + case "yy": + // like 14 + return useDateTimeFormatter ? string({ + year: "2-digit" + }, "year") : _this.num(dt.year.toString().slice(-2), 2); + case "yyyy": + // like 0012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 4); + case "yyyyyy": + // like 000012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 6); + // eras + case "G": + // like AD + return era("short"); + case "GG": + // like Anno Domini + return era("long"); + case "GGGGG": + return era("narrow"); + case "kk": + return _this.num(dt.weekYear.toString().slice(-2), 2); + case "kkkk": + return _this.num(dt.weekYear, 4); + case "W": + return _this.num(dt.weekNumber); + case "WW": + return _this.num(dt.weekNumber, 2); + case "n": + return _this.num(dt.localWeekNumber); + case "nn": + return _this.num(dt.localWeekNumber, 2); + case "ii": + return _this.num(dt.localWeekYear.toString().slice(-2), 2); + case "iiii": + return _this.num(dt.localWeekYear, 4); + case "o": + return _this.num(dt.ordinal); + case "ooo": + return _this.num(dt.ordinal, 3); + case "q": + // like 1 + return _this.num(dt.quarter); + case "qq": + // like 01 + return _this.num(dt.quarter, 2); + case "X": + return _this.num(Math.floor(dt.ts / 1000)); + case "x": + return _this.num(dt.ts); + default: + return maybeMacro(token); + } + }; + return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); + }; + _proto.formatDurationFromString = function formatDurationFromString(dur, fmt) { + var _this2 = this; + var invertLargest = this.opts.signMode === "negativeLargestOnly" ? -1 : 1; + var tokenToField = function tokenToField(token) { + switch (token[0]) { + case "S": + return "milliseconds"; + case "s": + return "seconds"; + case "m": + return "minutes"; + case "h": + return "hours"; + case "d": + return "days"; + case "w": + return "weeks"; + case "M": + return "months"; + case "y": + return "years"; + default: + return null; + } + }, + tokenToString = function tokenToString(lildur, info) { + return function (token) { + var mapped = tokenToField(token); + if (mapped) { + var inversionFactor = info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1; + var signDisplay; + if (_this2.opts.signMode === "negativeLargestOnly" && mapped !== info.largestUnit) { + signDisplay = "never"; + } else if (_this2.opts.signMode === "all") { + signDisplay = "always"; + } else { + // "auto" and "negative" are the same, but "auto" has better support + signDisplay = "auto"; + } + return _this2.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay); + } else { + return token; + } + }; + }, + tokens = Formatter.parseFormat(fmt), + realTokens = tokens.reduce(function (found, _ref) { + var literal = _ref.literal, + val = _ref.val; + return literal ? found : found.concat(val); + }, []), + collapsed = dur.shiftTo.apply(dur, realTokens.map(tokenToField).filter(function (t) { + return t; + })), + durationInfo = { + isNegativeDuration: collapsed < 0, + // this relies on "collapsed" being based on "shiftTo", which builds up the object + // in order + largestUnit: Object.keys(collapsed.values)[0] + }; + return stringifyTokens(tokens, tokenToString(collapsed, durationInfo)); + }; + return Formatter; +}(); + +/* + * This file handles parsing for well-specified formats. Here's how it works: + * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. + * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object + * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. + * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. + * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. + * Some extractions are super dumb and simpleParse and fromStrings help DRY them. + */ + +var ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/; +function combineRegexes() { + for (var _len = arguments.length, regexes = new Array(_len), _key = 0; _key < _len; _key++) { + regexes[_key] = arguments[_key]; + } + var full = regexes.reduce(function (f, r) { + return f + r.source; + }, ""); + return RegExp("^" + full + "$"); +} +function combineExtractors() { + for (var _len2 = arguments.length, extractors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + extractors[_key2] = arguments[_key2]; + } + return function (m) { + return extractors.reduce(function (_ref, ex) { + var mergedVals = _ref[0], + mergedZone = _ref[1], + cursor = _ref[2]; + var _ex = ex(m, cursor), + val = _ex[0], + zone = _ex[1], + next = _ex[2]; + return [_extends({}, mergedVals, val), zone || mergedZone, next]; + }, [{}, null, 1]).slice(0, 2); + }; +} +function parse(s) { + if (s == null) { + return [null, null]; + } + for (var _len3 = arguments.length, patterns = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + patterns[_key3 - 1] = arguments[_key3]; + } + for (var _i = 0, _patterns = patterns; _i < _patterns.length; _i++) { + var _patterns$_i = _patterns[_i], + regex = _patterns$_i[0], + extractor = _patterns$_i[1]; + var m = regex.exec(s); + if (m) { + return extractor(m); + } + } + return [null, null]; +} +function simpleParse() { + for (var _len4 = arguments.length, keys = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + keys[_key4] = arguments[_key4]; + } + return function (match, cursor) { + var ret = {}; + var i; + for (i = 0; i < keys.length; i++) { + ret[keys[i]] = parseInteger(match[cursor + i]); + } + return [ret, null, cursor + i]; + }; +} + +// ISO and SQL parsing +var offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/; +var isoExtendedZone = "(?:" + offsetRegex.source + "?(?:\\[(" + ianaRegex.source + ")\\])?)?"; +var isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/; +var isoTimeRegex = RegExp("" + isoTimeBaseRegex.source + isoExtendedZone); +var isoTimeExtensionRegex = RegExp("(?:[Tt]" + isoTimeRegex.source + ")?"); +var isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/; +var isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/; +var isoOrdinalRegex = /(\d{4})-?(\d{3})/; +var extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"); +var extractISOOrdinalData = simpleParse("year", "ordinal"); +var sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/; // dumbed-down version of the ISO one +var sqlTimeRegex = RegExp(isoTimeBaseRegex.source + " ?(?:" + offsetRegex.source + "|(" + ianaRegex.source + "))?"); +var sqlTimeExtensionRegex = RegExp("(?: " + sqlTimeRegex.source + ")?"); +function int(match, pos, fallback) { + var m = match[pos]; + return isUndefined(m) ? fallback : parseInteger(m); +} +function extractISOYmd(match, cursor) { + var item = { + year: int(match, cursor), + month: int(match, cursor + 1, 1), + day: int(match, cursor + 2, 1) + }; + return [item, null, cursor + 3]; +} +function extractISOTime(match, cursor) { + var item = { + hours: int(match, cursor, 0), + minutes: int(match, cursor + 1, 0), + seconds: int(match, cursor + 2, 0), + milliseconds: parseMillis(match[cursor + 3]) + }; + return [item, null, cursor + 4]; +} +function extractISOOffset(match, cursor) { + var local = !match[cursor] && !match[cursor + 1], + fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), + zone = local ? null : FixedOffsetZone.instance(fullOffset); + return [{}, zone, cursor + 3]; +} +function extractIANAZone(match, cursor) { + var zone = match[cursor] ? IANAZone.create(match[cursor]) : null; + return [{}, zone, cursor + 1]; +} + +// ISO time parsing + +var isoTimeOnly = RegExp("^T?" + isoTimeBaseRegex.source + "$"); + +// ISO duration parsing + +var isoDuration = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/; +function extractISODuration(match) { + var s = match[0], + yearStr = match[1], + monthStr = match[2], + weekStr = match[3], + dayStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + millisecondsStr = match[8]; + var hasNegativePrefix = s[0] === "-"; + var negativeSeconds = secondStr && secondStr[0] === "-"; + var maybeNegate = function maybeNegate(num, force) { + if (force === void 0) { + force = false; + } + return num !== undefined && (force || num && hasNegativePrefix) ? -num : num; + }; + return [{ + years: maybeNegate(parseFloating(yearStr)), + months: maybeNegate(parseFloating(monthStr)), + weeks: maybeNegate(parseFloating(weekStr)), + days: maybeNegate(parseFloating(dayStr)), + hours: maybeNegate(parseFloating(hourStr)), + minutes: maybeNegate(parseFloating(minuteStr)), + seconds: maybeNegate(parseFloating(secondStr), secondStr === "-0"), + milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds) + }]; +} + +// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York +// and not just that we're in -240 *right now*. But since I don't think these are used that often +// I'm just going to ignore that +var obsOffsets = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 +}; +function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + var result = { + year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), + month: monthsShort.indexOf(monthStr) + 1, + day: parseInteger(dayStr), + hour: parseInteger(hourStr), + minute: parseInteger(minuteStr) + }; + if (secondStr) result.second = parseInteger(secondStr); + if (weekdayStr) { + result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1; + } + return result; +} + +// RFC 2822/5322 +var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; +function extractRFC2822(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + obsOffset = match[8], + milOffset = match[9], + offHourStr = match[10], + offMinuteStr = match[11], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + var offset; + if (obsOffset) { + offset = obsOffsets[obsOffset]; + } else if (milOffset) { + offset = 0; + } else { + offset = signedOffset(offHourStr, offMinuteStr); + } + return [result, new FixedOffsetZone(offset)]; +} +function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); +} + +// http date + +var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, + rfc850 = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, + ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; +function extractRFC1123Or850(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} +function extractASCII(match) { + var weekdayStr = match[1], + monthStr = match[2], + dayStr = match[3], + hourStr = match[4], + minuteStr = match[5], + secondStr = match[6], + yearStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} +var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); +var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); +var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); +var isoTimeCombinedRegex = combineRegexes(isoTimeRegex); +var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone); +var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset, extractIANAZone); +var extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset, extractIANAZone); +var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); + +/* + * @private + */ + +function parseISODate(s) { + return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]); +} +function parseRFC2822Date(s) { + return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]); +} +function parseHTTPDate(s) { + return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]); +} +function parseISODuration(s) { + return parse(s, [isoDuration, extractISODuration]); +} +var extractISOTimeOnly = combineExtractors(extractISOTime); +function parseISOTimeOnly(s) { + return parse(s, [isoTimeOnly, extractISOTimeOnly]); +} +var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); +var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); +var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); +function parseSQL(s) { + return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]); +} + +var INVALID$2 = "Invalid Duration"; + +// unit conversion constants +var lowOrderMatrix = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1000 + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1000 + }, + hours: { + minutes: 60, + seconds: 60 * 60, + milliseconds: 60 * 60 * 1000 + }, + minutes: { + seconds: 60, + milliseconds: 60 * 1000 + }, + seconds: { + milliseconds: 1000 + } + }, + casualMatrix = _extends({ + years: { + quarters: 4, + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + seconds: 91 * 24 * 60 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1000 + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix), + daysInYearAccurate = 146097.0 / 400, + daysInMonthAccurate = 146097.0 / 4800, + accurateMatrix = _extends({ + years: { + quarters: 4, + months: 12, + weeks: daysInYearAccurate / 7, + days: daysInYearAccurate, + hours: daysInYearAccurate * 24, + minutes: daysInYearAccurate * 24 * 60, + seconds: daysInYearAccurate * 24 * 60 * 60, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: daysInYearAccurate / 28, + days: daysInYearAccurate / 4, + hours: daysInYearAccurate * 24 / 4, + minutes: daysInYearAccurate * 24 * 60 / 4, + seconds: daysInYearAccurate * 24 * 60 * 60 / 4, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 / 4 + }, + months: { + weeks: daysInMonthAccurate / 7, + days: daysInMonthAccurate, + hours: daysInMonthAccurate * 24, + minutes: daysInMonthAccurate * 24 * 60, + seconds: daysInMonthAccurate * 24 * 60 * 60, + milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix); + +// units ordered by size +var orderedUnits$1 = ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"]; +var reverseUnits = orderedUnits$1.slice(0).reverse(); + +// clone really means "create another instance just like this one, but with these changes" +function clone$1(dur, alts, clear) { + if (clear === void 0) { + clear = false; + } + // deep merge for vals + var conf = { + values: clear ? alts.values : _extends({}, dur.values, alts.values || {}), + loc: dur.loc.clone(alts.loc), + conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy, + matrix: alts.matrix || dur.matrix + }; + return new Duration(conf); +} +function durationToMillis(matrix, vals) { + var _vals$milliseconds; + var sum = (_vals$milliseconds = vals.milliseconds) != null ? _vals$milliseconds : 0; + for (var _iterator = _createForOfIteratorHelperLoose(reverseUnits.slice(1)), _step; !(_step = _iterator()).done;) { + var unit = _step.value; + if (vals[unit]) { + sum += vals[unit] * matrix[unit]["milliseconds"]; + } + } + return sum; +} + +// NB: mutates parameters +function normalizeValues(matrix, vals) { + // the logic below assumes the overall value of the duration is positive + // if this is not the case, factor is used to make it so + var factor = durationToMillis(matrix, vals) < 0 ? -1 : 1; + orderedUnits$1.reduceRight(function (previous, current) { + if (!isUndefined(vals[current])) { + if (previous) { + var previousVal = vals[previous] * factor; + var conv = matrix[current][previous]; + + // if (previousVal < 0): + // lower order unit is negative (e.g. { years: 2, days: -2 }) + // normalize this by reducing the higher order unit by the appropriate amount + // and increasing the lower order unit + // this can never make the higher order unit negative, because this function only operates + // on positive durations, so the amount of time represented by the lower order unit cannot + // be larger than the higher order unit + // else: + // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 }) + // in this case we attempt to convert as much as possible from the lower order unit into + // the higher order one + // + // Math.floor takes care of both of these cases, rounding away from 0 + // if previousVal < 0 it makes the absolute value larger + // if previousVal >= it makes the absolute value smaller + var rollUp = Math.floor(previousVal / conv); + vals[current] += rollUp * factor; + vals[previous] -= rollUp * conv * factor; + } + return current; + } else { + return previous; + } + }, null); + + // try to convert any decimals into smaller units if possible + // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 } + orderedUnits$1.reduce(function (previous, current) { + if (!isUndefined(vals[current])) { + if (previous) { + var fraction = vals[previous] % 1; + vals[previous] -= fraction; + vals[current] += fraction * matrix[previous][current]; + } + return current; + } else { + return previous; + } + }, null); +} + +// Remove all properties with a value of 0 from an object +function removeZeroes(vals) { + var newVals = {}; + for (var _i = 0, _Object$entries = Object.entries(vals); _i < _Object$entries.length; _i++) { + var _Object$entries$_i = _Object$entries[_i], + key = _Object$entries$_i[0], + value = _Object$entries$_i[1]; + if (value !== 0) { + newVals[key] = value; + } + } + return newVals; +} + +/** + * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime#plus} to add a Duration object to a DateTime, producing another DateTime. + * + * Here is a brief overview of commonly used methods and getters in Duration: + * + * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. + * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors. + * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors. + * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}. + * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON} + * + * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. + */ +var Duration = /*#__PURE__*/function (_Symbol$for) { + /** + * @private + */ + function Duration(config) { + var accurate = config.conversionAccuracy === "longterm" || false; + var matrix = accurate ? accurateMatrix : casualMatrix; + if (config.matrix) { + matrix = config.matrix; + } + + /** + * @access private + */ + this.values = config.values; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.conversionAccuracy = accurate ? "longterm" : "casual"; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.matrix = matrix; + /** + * @access private + */ + this.isLuxonDuration = true; + } + + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + Duration.fromMillis = function fromMillis(count, opts) { + return Duration.fromObject({ + milliseconds: count + }, opts); + } + + /** + * Create a Duration from a JavaScript object with keys like 'years' and 'hours'. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {Object} [opts=[]] - options for creating this Duration + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the custom conversion system to use + * @return {Duration} + */; + Duration.fromObject = function fromObject(obj, opts) { + if (opts === void 0) { + opts = {}; + } + if (obj == null || typeof obj !== "object") { + throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got " + (obj === null ? "null" : typeof obj)); + } + return new Duration({ + values: normalizeObject(obj, Duration.normalizeUnit), + loc: Locale.fromObject(opts), + conversionAccuracy: opts.conversionAccuracy, + matrix: opts.matrix + }); + } + + /** + * Create a Duration from DurationLike. + * + * @param {Object | number | Duration} durationLike + * One of: + * - object with keys like 'years' and 'hours'. + * - number representing milliseconds + * - Duration instance + * @return {Duration} + */; + Duration.fromDurationLike = function fromDurationLike(durationLike) { + if (isNumber(durationLike)) { + return Duration.fromMillis(durationLike); + } else if (Duration.isDuration(durationLike)) { + return durationLike; + } else if (typeof durationLike === "object") { + return Duration.fromObject(durationLike); + } else { + throw new InvalidArgumentError("Unknown duration argument " + durationLike + " of type " + typeof durationLike); + } + } + + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the preset conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */; + Duration.fromISO = function fromISO(text, opts) { + var _parseISODuration = parseISODuration(text), + parsed = _parseISODuration[0]; + if (parsed) { + return Duration.fromObject(parsed, opts); + } else { + return Duration.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + } + + /** + * Create a Duration from an ISO 8601 time string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 } + * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @return {Duration} + */; + Duration.fromISOTime = function fromISOTime(text, opts) { + var _parseISOTimeOnly = parseISOTimeOnly(text), + parsed = _parseISOTimeOnly[0]; + if (parsed) { + return Duration.fromObject(parsed, opts); + } else { + return Duration.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + } + + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */; + Duration.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); + } + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidDurationError(invalid); + } else { + return new Duration({ + invalid: invalid + }); + } + } + + /** + * @private + */; + Duration.normalizeUnit = function normalizeUnit(unit) { + var normalized = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds" + }[unit ? unit.toLowerCase() : unit]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } + + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */; + Duration.isDuration = function isDuration(o) { + return o && o.isLuxonDuration || false; + } + + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */; + var _proto = Duration.prototype; + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `w` for weeks + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * Tokens can be escaped by wrapping with single quotes. + * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat("d s", { signMode: "all" }) //=> "+6 +2" + * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "all" }) //=> "-6 -2" + * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "negativeLargestOnly" }) //=> "-6 2" + * @return {string} + */ + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + // reverse-compat since 1.2; we always round down now, never up, and we do it by default + var fmtOpts = _extends({}, opts, { + floor: opts.round !== false && opts.floor !== false + }); + return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2; + } + + /** + * Returns a string representation of a Duration with all units included. + * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options + * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`. + * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor. + * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero + * @example + * ```js + * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 }) + * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes' + * dur.toHuman({ listStyle: "long" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes' + * dur.toHuman({ unitDisplay: "short" }) //=> '1 mth, 0 wks, 5 hr, 6 min' + * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes' + * ``` + */; + _proto.toHuman = function toHuman(opts) { + var _this = this; + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) return INVALID$2; + var showZeros = opts.showZeros !== false; + var l = orderedUnits$1.map(function (unit) { + var val = _this.values[unit]; + if (isUndefined(val) || val === 0 && !showZeros) { + return null; + } + return _this.loc.numberFormatter(_extends({ + style: "unit", + unitDisplay: "long" + }, opts, { + unit: unit.slice(0, -1) + })).format(val); + }).filter(function (n) { + return n; + }); + return this.loc.listFormatter(_extends({ + type: "conjunction", + style: opts.listStyle || "narrow" + }, opts)).format(l); + } + + /** + * Returns a JavaScript object with this Duration's values. + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */; + _proto.toObject = function toObject() { + if (!this.isValid) return {}; + return _extends({}, this.values); + } + + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */; + _proto.toISO = function toISO() { + // we could use the formatter, but this is an easier way to get the minimum string + if (!this.isValid) return null; + var s = "P"; + if (this.years !== 0) s += this.years + "Y"; + if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + "M"; + if (this.weeks !== 0) s += this.weeks + "W"; + if (this.days !== 0) s += this.days + "D"; + if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) s += "T"; + if (this.hours !== 0) s += this.hours + "H"; + if (this.minutes !== 0) s += this.minutes + "M"; + if (this.seconds !== 0 || this.milliseconds !== 0) + // this will handle "floating point madness" by removing extra decimal places + // https://stackoverflow.com/questions/588004/is-floating-point-math-broken + s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S"; + if (s === "P") s += "T0S"; + return s; + } + + /** + * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day. + * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours. + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000' + * @return {string} + */; + _proto.toISOTime = function toISOTime(opts) { + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) return null; + var millis = this.toMillis(); + if (millis < 0 || millis >= 86400000) return null; + opts = _extends({ + suppressMilliseconds: false, + suppressSeconds: false, + includePrefix: false, + format: "extended" + }, opts, { + includeOffset: false + }); + var dateTime = DateTime.fromMillis(millis, { + zone: "UTC" + }); + return dateTime.toISOTime(opts); + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */; + _proto.toJSON = function toJSON() { + return this.toISO(); + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */; + _proto.toString = function toString() { + return this.toISO(); + } + + /** + * Returns a string representation of this Duration appropriate for the REPL. + * @return {string} + */; + _proto[_Symbol$for] = function () { + if (this.isValid) { + return "Duration { values: " + JSON.stringify(this.values) + " }"; + } else { + return "Duration { Invalid, reason: " + this.invalidReason + " }"; + } + } + + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */; + _proto.toMillis = function toMillis() { + if (!this.isValid) return NaN; + return durationToMillis(this.matrix, this.values); + } + + /** + * Returns an milliseconds value of this Duration. Alias of {@link toMillis} + * @return {number} + */; + _proto.valueOf = function valueOf() { + return this.toMillis(); + } + + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */; + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration), + result = {}; + for (var _i2 = 0, _orderedUnits = orderedUnits$1; _i2 < _orderedUnits.length; _i2++) { + var k = _orderedUnits[_i2]; + if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { + result[k] = dur.get(k) + this.get(k); + } + } + return clone$1(this, { + values: result + }, true); + } + + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */; + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration); + return this.plus(dur.negate()); + } + + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */; + _proto.mapUnits = function mapUnits(fn) { + if (!this.isValid) return this; + var result = {}; + for (var _i3 = 0, _Object$keys = Object.keys(this.values); _i3 < _Object$keys.length; _i3++) { + var k = _Object$keys[_i3]; + result[k] = asNumber(fn(this.values[k], k)); + } + return clone$1(this, { + values: result + }, true); + } + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3 + * @return {number} + */; + _proto.get = function get(unit) { + return this[Duration.normalizeUnit(unit)]; + } + + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */; + _proto.set = function set(values) { + if (!this.isValid) return this; + var mixed = _extends({}, this.values, normalizeObject(values, Duration.normalizeUnit)); + return clone$1(this, { + values: mixed + }); + } + + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */; + _proto.reconfigure = function reconfigure(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + locale = _ref.locale, + numberingSystem = _ref.numberingSystem, + conversionAccuracy = _ref.conversionAccuracy, + matrix = _ref.matrix; + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem + }); + var opts = { + loc: loc, + matrix: matrix, + conversionAccuracy: conversionAccuracy + }; + return clone$1(this, opts); + } + + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */; + _proto.as = function as(unit) { + return this.isValid ? this.shiftTo(unit).get(unit) : NaN; + } + + /** + * Reduce this Duration to its canonical representation in its current units. + * Assuming the overall value of the Duration is positive, this means: + * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example) + * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise + * the overall value would be negative, see third example) + * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example) + * + * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 } + * @return {Duration} + */; + _proto.normalize = function normalize() { + if (!this.isValid) return this; + var vals = this.toObject(); + normalizeValues(this.matrix, vals); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Rescale units to its largest representation + * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 } + * @return {Duration} + */; + _proto.rescale = function rescale() { + if (!this.isValid) return this; + var vals = removeZeroes(this.normalize().shiftToAll().toObject()); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */; + _proto.shiftTo = function shiftTo() { + for (var _len = arguments.length, units = new Array(_len), _key = 0; _key < _len; _key++) { + units[_key] = arguments[_key]; + } + if (!this.isValid) return this; + if (units.length === 0) { + return this; + } + units = units.map(function (u) { + return Duration.normalizeUnit(u); + }); + var built = {}, + accumulated = {}, + vals = this.toObject(); + var lastUnit; + for (var _i4 = 0, _orderedUnits2 = orderedUnits$1; _i4 < _orderedUnits2.length; _i4++) { + var k = _orderedUnits2[_i4]; + if (units.indexOf(k) >= 0) { + lastUnit = k; + var own = 0; + + // anything we haven't boiled down yet should get boiled to this unit + for (var ak in accumulated) { + own += this.matrix[ak][k] * accumulated[ak]; + accumulated[ak] = 0; + } + + // plus anything that's already in this unit + if (isNumber(vals[k])) { + own += vals[k]; + } + + // only keep the integer part for now in the hopes of putting any decimal part + // into a smaller unit later + var i = Math.trunc(own); + built[k] = i; + accumulated[k] = (own * 1000 - i * 1000) / 1000; + + // otherwise, keep it in the wings to boil it later + } else if (isNumber(vals[k])) { + accumulated[k] = vals[k]; + } + } + + // anything leftover becomes the decimal for the last unit + // lastUnit must be defined since units is not empty + for (var key in accumulated) { + if (accumulated[key] !== 0) { + built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; + } + } + normalizeValues(this.matrix, built); + return clone$1(this, { + values: built + }, true); + } + + /** + * Shift this Duration to all available units. + * Same as shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds") + * @return {Duration} + */; + _proto.shiftToAll = function shiftToAll() { + if (!this.isValid) return this; + return this.shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"); + } + + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */; + _proto.negate = function negate() { + if (!this.isValid) return this; + var negated = {}; + for (var _i5 = 0, _Object$keys2 = Object.keys(this.values); _i5 < _Object$keys2.length; _i5++) { + var k = _Object$keys2[_i5]; + negated[k] = this.values[k] === 0 ? 0 : -this.values[k]; + } + return clone$1(this, { + values: negated + }, true); + } + + /** + * Removes all units with values equal to 0 from this Duration. + * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 } + * @return {Duration} + */; + _proto.removeZeros = function removeZeros() { + if (!this.isValid) return this; + var vals = removeZeroes(this.values); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Get the years. + * @type {number} + */; + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + if (!this.loc.equals(other.loc)) { + return false; + } + function eq(v1, v2) { + // Consider 0 and undefined as equal + if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0; + return v1 === v2; + } + for (var _i6 = 0, _orderedUnits3 = orderedUnits$1; _i6 < _orderedUnits3.length; _i6++) { + var u = _orderedUnits3[_i6]; + if (!eq(this.values[u], other.values[u])) { + return false; + } + } + return true; + }; + _createClass(Duration, [{ + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + }, { + key: "years", + get: function get() { + return this.isValid ? this.values.years || 0 : NaN; + } + + /** + * Get the quarters. + * @type {number} + */ + }, { + key: "quarters", + get: function get() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + + /** + * Get the months. + * @type {number} + */ + }, { + key: "months", + get: function get() { + return this.isValid ? this.values.months || 0 : NaN; + } + + /** + * Get the weeks + * @type {number} + */ + }, { + key: "weeks", + get: function get() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + + /** + * Get the days. + * @type {number} + */ + }, { + key: "days", + get: function get() { + return this.isValid ? this.values.days || 0 : NaN; + } + + /** + * Get the hours. + * @type {number} + */ + }, { + key: "hours", + get: function get() { + return this.isValid ? this.values.hours || 0 : NaN; + } + + /** + * Get the minutes. + * @type {number} + */ + }, { + key: "minutes", + get: function get() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + + /** + * Get the seconds. + * @return {number} + */ + }, { + key: "seconds", + get: function get() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + + /** + * Get the milliseconds. + * @return {number} + */ + }, { + key: "milliseconds", + get: function get() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + }, { + key: "isValid", + get: function get() { + return this.invalid === null; + } + + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + return Duration; +}(Symbol.for("nodejs.util.inspect.custom")); + +var INVALID$1 = "Invalid Interval"; + +// checks if the start is equal to or before the end +function validateStartEnd(start, end) { + if (!start || !start.isValid) { + return Interval.invalid("missing or invalid start"); + } else if (!end || !end.isValid) { + return Interval.invalid("missing or invalid end"); + } else if (end < start) { + return Interval.invalid("end before start", "The end of an interval must be after its start, but you had start=" + start.toISO() + " and end=" + end.toISO()); + } else { + return null; + } +} + +/** + * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them. + * + * Here is a brief overview of the most commonly used methods and getters in Interval: + * + * * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}. + * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end. + * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}. + * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}. + * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs} + * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}. + */ +var Interval = /*#__PURE__*/function (_Symbol$for) { + /** + * @private + */ + function Interval(config) { + /** + * @access private + */ + this.s = config.start; + /** + * @access private + */ + this.e = config.end; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.isLuxonInterval = true; + } + + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + Interval.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); + } + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidIntervalError(invalid); + } else { + return new Interval({ + invalid: invalid + }); + } + } + + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */; + Interval.fromDateTimes = function fromDateTimes(start, end) { + var builtStart = friendlyDateTime(start), + builtEnd = friendlyDateTime(end); + var validateError = validateStartEnd(builtStart, builtEnd); + if (validateError == null) { + return new Interval({ + start: builtStart, + end: builtEnd + }); + } else { + return validateError; + } + } + + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */; + Interval.after = function after(start, duration) { + var dur = Duration.fromDurationLike(duration), + dt = friendlyDateTime(start); + return Interval.fromDateTimes(dt, dt.plus(dur)); + } + + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */; + Interval.before = function before(end, duration) { + var dur = Duration.fromDurationLike(duration), + dt = friendlyDateTime(end); + return Interval.fromDateTimes(dt.minus(dur), dt); + } + + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */; + Interval.fromISO = function fromISO(text, opts) { + var _split = (text || "").split("/", 2), + s = _split[0], + e = _split[1]; + if (s && e) { + var start, startIsValid; + try { + start = DateTime.fromISO(s, opts); + startIsValid = start.isValid; + } catch (e) { + startIsValid = false; + } + var end, endIsValid; + try { + end = DateTime.fromISO(e, opts); + endIsValid = end.isValid; + } catch (e) { + endIsValid = false; + } + if (startIsValid && endIsValid) { + return Interval.fromDateTimes(start, end); + } + if (startIsValid) { + var dur = Duration.fromISO(e, opts); + if (dur.isValid) { + return Interval.after(start, dur); + } + } else if (endIsValid) { + var _dur = Duration.fromISO(s, opts); + if (_dur.isValid) { + return Interval.before(end, _dur); + } + } + } + return Interval.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */; + Interval.isInterval = function isInterval(o) { + return o && o.isLuxonInterval || false; + } + + /** + * Returns the start of the Interval + * @type {DateTime} + */; + var _proto = Interval.prototype; + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + _proto.length = function length(unit) { + if (unit === void 0) { + unit = "milliseconds"; + } + return this.isValid ? this.toDuration.apply(this, [unit]).get(unit) : NaN; + } + + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime + * @return {number} + */; + _proto.count = function count(unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + if (!this.isValid) return NaN; + var start = this.start.startOf(unit, opts); + var end; + if (opts != null && opts.useLocaleWeeks) { + end = this.end.reconfigure({ + locale: start.locale + }); + } else { + end = this.end; + } + end = end.startOf(unit, opts); + return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf()); + } + + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */; + _proto.hasSame = function hasSame(unit) { + return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false; + } + + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */; + _proto.isEmpty = function isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */; + _proto.isAfter = function isAfter(dateTime) { + if (!this.isValid) return false; + return this.s > dateTime; + } + + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */; + _proto.isBefore = function isBefore(dateTime) { + if (!this.isValid) return false; + return this.e <= dateTime; + } + + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */; + _proto.contains = function contains(dateTime) { + if (!this.isValid) return false; + return this.s <= dateTime && this.e > dateTime; + } + + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */; + _proto.set = function set(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + start = _ref.start, + end = _ref.end; + if (!this.isValid) return this; + return Interval.fromDateTimes(start || this.s, end || this.e); + } + + /** + * Split this Interval at each of the specified DateTimes + * @param {...DateTime} dateTimes - the unit of time to count. + * @return {Array} + */; + _proto.splitAt = function splitAt() { + var _this = this; + if (!this.isValid) return []; + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + var sorted = dateTimes.map(friendlyDateTime).filter(function (d) { + return _this.contains(d); + }).sort(function (a, b) { + return a.toMillis() - b.toMillis(); + }), + results = []; + var s = this.s, + i = 0; + while (s < this.e) { + var added = sorted[i] || this.e, + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + i += 1; + } + return results; + } + + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {Array} + */; + _proto.splitBy = function splitBy(duration) { + var dur = Duration.fromDurationLike(duration); + if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { + return []; + } + var s = this.s, + idx = 1, + next; + var results = []; + while (s < this.e) { + var added = this.start.plus(dur.mapUnits(function (x) { + return x * idx; + })); + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + idx += 1; + } + return results; + } + + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {Array} + */; + _proto.divideEqually = function divideEqually(numberOfParts) { + if (!this.isValid) return []; + return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); + } + + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */; + _proto.overlaps = function overlaps(other) { + return this.e > other.s && this.s < other.e; + } + + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */; + _proto.abutsStart = function abutsStart(other) { + if (!this.isValid) return false; + return +this.e === +other.s; + } + + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */; + _proto.abutsEnd = function abutsEnd(other) { + if (!this.isValid) return false; + return +other.e === +this.s; + } + + /** + * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise. + * @param {Interval} other + * @return {boolean} + */; + _proto.engulfs = function engulfs(other) { + if (!this.isValid) return false; + return this.s <= other.s && this.e >= other.e; + } + + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */; + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + return this.s.equals(other.s) && this.e.equals(other.e); + } + + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */; + _proto.intersection = function intersection(other) { + if (!this.isValid) return this; + var s = this.s > other.s ? this.s : other.s, + e = this.e < other.e ? this.e : other.e; + if (s >= e) { + return null; + } else { + return Interval.fromDateTimes(s, e); + } + } + + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */; + _proto.union = function union(other) { + if (!this.isValid) return this; + var s = this.s < other.s ? this.s : other.s, + e = this.e > other.e ? this.e : other.e; + return Interval.fromDateTimes(s, e); + } + + /** + * Merge an array of Intervals into an equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * The resulting array will contain the Intervals in ascending order, that is, starting with the earliest Interval + * and ending with the latest. + * + * @param {Array} intervals + * @return {Array} + */; + Interval.merge = function merge(intervals) { + var _intervals$sort$reduc = intervals.sort(function (a, b) { + return a.s - b.s; + }).reduce(function (_ref2, item) { + var sofar = _ref2[0], + current = _ref2[1]; + if (!current) { + return [sofar, item]; + } else if (current.overlaps(item) || current.abutsStart(item)) { + return [sofar, current.union(item)]; + } else { + return [sofar.concat([current]), item]; + } + }, [[], null]), + found = _intervals$sort$reduc[0], + final = _intervals$sort$reduc[1]; + if (final) { + found.push(final); + } + return found; + } + + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {Array} intervals + * @return {Array} + */; + Interval.xor = function xor(intervals) { + var _Array$prototype; + var start = null, + currentCount = 0; + var results = [], + ends = intervals.map(function (i) { + return [{ + time: i.s, + type: "s" + }, { + time: i.e, + type: "e" + }]; + }), + flattened = (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, ends), + arr = flattened.sort(function (a, b) { + return a.time - b.time; + }); + for (var _iterator = _createForOfIteratorHelperLoose(arr), _step; !(_step = _iterator()).done;) { + var i = _step.value; + currentCount += i.type === "s" ? 1 : -1; + if (currentCount === 1) { + start = i.time; + } else { + if (start && +start !== +i.time) { + results.push(Interval.fromDateTimes(start, i.time)); + } + start = null; + } + } + return Interval.merge(results); + } + + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {Array} + */; + _proto.difference = function difference() { + var _this2 = this; + for (var _len2 = arguments.length, intervals = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + intervals[_key2] = arguments[_key2]; + } + return Interval.xor([this].concat(intervals)).map(function (i) { + return _this2.intersection(i); + }).filter(function (i) { + return i && !i.isEmpty(); + }); + } + + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */; + _proto.toString = function toString() { + if (!this.isValid) return INVALID$1; + return "[" + this.s.toISO() + " \u2013 " + this.e.toISO() + ")"; + } + + /** + * Returns a string representation of this Interval appropriate for the REPL. + * @return {string} + */; + _proto[_Symbol$for] = function () { + if (this.isValid) { + return "Interval { start: " + this.s.toISO() + ", end: " + this.e.toISO() + " }"; + } else { + return "Interval { Invalid, reason: " + this.invalidReason + " }"; + } + } + + /** + * Returns a localized string representing this Interval. Accepts the same options as the + * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as + * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method + * is browser-specific, but in general it will return an appropriate representation of the + * Interval in the assigned locale. Defaults to the system's locale if no locale has been + * specified. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or + * Intl.DateTimeFormat constructor options. + * @param {Object} opts - Options to override the configuration of the start DateTime. + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022 + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p + * @return {string} + */; + _proto.toLocaleString = function toLocaleString(formatOpts, opts) { + if (formatOpts === void 0) { + formatOpts = DATE_SHORT; + } + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) : INVALID$1; + } + + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */; + _proto.toISO = function toISO(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISO(opts) + "/" + this.e.toISO(opts); + } + + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */; + _proto.toISODate = function toISODate() { + if (!this.isValid) return INVALID$1; + return this.s.toISODate() + "/" + this.e.toISODate(); + } + + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */; + _proto.toISOTime = function toISOTime(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISOTime(opts) + "/" + this.e.toISOTime(opts); + } + + /** + * Returns a string representation of this Interval formatted according to the specified format + * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible + * formatting tool. + * @param {string} dateFormat - The format string. This string formats the start and end time. + * See {@link DateTime#toFormat} for details. + * @param {Object} opts - Options. + * @param {string} [opts.separator = ' – '] - A separator to place between the start and end + * representations. + * @return {string} + */; + _proto.toFormat = function toFormat(dateFormat, _temp2) { + var _ref3 = _temp2 === void 0 ? {} : _temp2, + _ref3$separator = _ref3.separator, + separator = _ref3$separator === void 0 ? " – " : _ref3$separator; + if (!this.isValid) return INVALID$1; + return "" + this.s.toFormat(dateFormat) + separator + this.e.toFormat(dateFormat); + } + + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */; + _proto.toDuration = function toDuration(unit, opts) { + if (!this.isValid) { + return Duration.invalid(this.invalidReason); + } + return this.e.diff(this.s, unit, opts); + } + + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */; + _proto.mapEndpoints = function mapEndpoints(mapFn) { + return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); + }; + _createClass(Interval, [{ + key: "start", + get: function get() { + return this.isValid ? this.s : null; + } + + /** + * Returns the end of the Interval. This is the first instant which is not part of the interval + * (Interval is half-open). + * @type {DateTime} + */ + }, { + key: "end", + get: function get() { + return this.isValid ? this.e : null; + } + + /** + * Returns the last DateTime included in the interval (since end is not part of the interval) + * @type {DateTime} + */ + }, { + key: "lastDateTime", + get: function get() { + return this.isValid ? this.e ? this.e.minus(1) : null : null; + } + + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + }, { + key: "isValid", + get: function get() { + return this.invalidReason === null; + } + + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + return Interval; +}(Symbol.for("nodejs.util.inspect.custom")); + +/** + * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment. + */ +var Info = /*#__PURE__*/function () { + function Info() {} + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + Info.hasDST = function hasDST(zone) { + if (zone === void 0) { + zone = Settings.defaultZone; + } + var proto = DateTime.now().setZone(zone).set({ + month: 12 + }); + return !zone.isUniversal && proto.offset !== proto.set({ + month: 6 + }).offset; + } + + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */; + Info.isValidIANAZone = function isValidIANAZone(zone) { + return IANAZone.isValidZone(zone); + } + + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone#isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */; + Info.normalizeZone = function normalizeZone$1(input) { + return normalizeZone(input, Settings.defaultZone); + } + + /** + * Get the weekday on which the week starts according to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} the start of the week, 1 for Monday through 7 for Sunday + */; + Info.getStartOfWeek = function getStartOfWeek(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + _ref$locale = _ref.locale, + locale = _ref$locale === void 0 ? null : _ref$locale, + _ref$locObj = _ref.locObj, + locObj = _ref$locObj === void 0 ? null : _ref$locObj; + return (locObj || Locale.create(locale)).getStartOfWeek(); + } + + /** + * Get the minimum number of days necessary in a week before it is considered part of the next year according + * to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} + */; + Info.getMinimumDaysInFirstWeek = function getMinimumDaysInFirstWeek(_temp2) { + var _ref2 = _temp2 === void 0 ? {} : _temp2, + _ref2$locale = _ref2.locale, + locale = _ref2$locale === void 0 ? null : _ref2$locale, + _ref2$locObj = _ref2.locObj, + locObj = _ref2$locObj === void 0 ? null : _ref2$locObj; + return (locObj || Locale.create(locale)).getMinDaysInFirstWeek(); + } + + /** + * Get the weekdays, which are considered the weekend according to the given locale + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday + */; + Info.getWeekendWeekdays = function getWeekendWeekdays(_temp3) { + var _ref3 = _temp3 === void 0 ? {} : _temp3, + _ref3$locale = _ref3.locale, + locale = _ref3$locale === void 0 ? null : _ref3$locale, + _ref3$locObj = _ref3.locObj, + locObj = _ref3$locObj === void 0 ? null : _ref3$locObj; + // copy the array, because we cache it internally + return (locObj || Locale.create(locale)).getWeekendDays().slice(); + } + + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {Array} + */; + Info.months = function months(length, _temp4) { + if (length === void 0) { + length = "long"; + } + var _ref4 = _temp4 === void 0 ? {} : _temp4, + _ref4$locale = _ref4.locale, + locale = _ref4$locale === void 0 ? null : _ref4$locale, + _ref4$numberingSystem = _ref4.numberingSystem, + numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem, + _ref4$locObj = _ref4.locObj, + locObj = _ref4$locObj === void 0 ? null : _ref4$locObj, + _ref4$outputCalendar = _ref4.outputCalendar, + outputCalendar = _ref4$outputCalendar === void 0 ? "gregory" : _ref4$outputCalendar; + return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length); + } + + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link Info#months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {Array} + */; + Info.monthsFormat = function monthsFormat(length, _temp5) { + if (length === void 0) { + length = "long"; + } + var _ref5 = _temp5 === void 0 ? {} : _temp5, + _ref5$locale = _ref5.locale, + locale = _ref5$locale === void 0 ? null : _ref5$locale, + _ref5$numberingSystem = _ref5.numberingSystem, + numberingSystem = _ref5$numberingSystem === void 0 ? null : _ref5$numberingSystem, + _ref5$locObj = _ref5.locObj, + locObj = _ref5$locObj === void 0 ? null : _ref5$locObj, + _ref5$outputCalendar = _ref5.outputCalendar, + outputCalendar = _ref5$outputCalendar === void 0 ? "gregory" : _ref5$outputCalendar; + return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true); + } + + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {Array} + */; + Info.weekdays = function weekdays(length, _temp6) { + if (length === void 0) { + length = "long"; + } + var _ref6 = _temp6 === void 0 ? {} : _temp6, + _ref6$locale = _ref6.locale, + locale = _ref6$locale === void 0 ? null : _ref6$locale, + _ref6$numberingSystem = _ref6.numberingSystem, + numberingSystem = _ref6$numberingSystem === void 0 ? null : _ref6$numberingSystem, + _ref6$locObj = _ref6.locObj, + locObj = _ref6$locObj === void 0 ? null : _ref6$locObj; + return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length); + } + + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link Info#weekdays} + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @return {Array} + */; + Info.weekdaysFormat = function weekdaysFormat(length, _temp7) { + if (length === void 0) { + length = "long"; + } + var _ref7 = _temp7 === void 0 ? {} : _temp7, + _ref7$locale = _ref7.locale, + locale = _ref7$locale === void 0 ? null : _ref7$locale, + _ref7$numberingSystem = _ref7.numberingSystem, + numberingSystem = _ref7$numberingSystem === void 0 ? null : _ref7$numberingSystem, + _ref7$locObj = _ref7.locObj, + locObj = _ref7$locObj === void 0 ? null : _ref7$locObj; + return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true); + } + + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {Array} + */; + Info.meridiems = function meridiems(_temp8) { + var _ref8 = _temp8 === void 0 ? {} : _temp8, + _ref8$locale = _ref8.locale, + locale = _ref8$locale === void 0 ? null : _ref8$locale; + return Locale.create(locale).meridiems(); + } + + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {Array} + */; + Info.eras = function eras(length, _temp9) { + if (length === void 0) { + length = "short"; + } + var _ref9 = _temp9 === void 0 ? {} : _temp9, + _ref9$locale = _ref9.locale, + locale = _ref9$locale === void 0 ? null : _ref9$locale; + return Locale.create(locale, null, "gregory").eras(length); + } + + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case. + * Keys: + * * `relative`: whether this environment supports relative time formatting + * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale + * @example Info.features() //=> { relative: false, localeWeek: true } + * @return {Object} + */; + Info.features = function features() { + return { + relative: hasRelative(), + localeWeek: hasLocaleWeekInfo() + }; + }; + return Info; +}(); + +function dayDiff(earlier, later) { + var utcDayStart = function utcDayStart(dt) { + return dt.toUTC(0, { + keepLocalTime: true + }).startOf("day").valueOf(); + }, + ms = utcDayStart(later) - utcDayStart(earlier); + return Math.floor(Duration.fromMillis(ms).as("days")); +} +function highOrderDiffs(cursor, later, units) { + var differs = [["years", function (a, b) { + return b.year - a.year; + }], ["quarters", function (a, b) { + return b.quarter - a.quarter + (b.year - a.year) * 4; + }], ["months", function (a, b) { + return b.month - a.month + (b.year - a.year) * 12; + }], ["weeks", function (a, b) { + var days = dayDiff(a, b); + return (days - days % 7) / 7; + }], ["days", dayDiff]]; + var results = {}; + var earlier = cursor; + var lowestOrder, highWater; + + /* This loop tries to diff using larger units first. + If we overshoot, we backtrack and try the next smaller unit. + "cursor" starts out at the earlier timestamp and moves closer and closer to "later" + as we use smaller and smaller units. + highWater keeps track of where we would be if we added one more of the smallest unit, + this is used later to potentially convert any difference smaller than the smallest higher order unit + into a fraction of that smallest higher order unit + */ + for (var _i = 0, _differs = differs; _i < _differs.length; _i++) { + var _differs$_i = _differs[_i], + unit = _differs$_i[0], + differ = _differs$_i[1]; + if (units.indexOf(unit) >= 0) { + lowestOrder = unit; + results[unit] = differ(cursor, later); + highWater = earlier.plus(results); + if (highWater > later) { + // we overshot the end point, backtrack cursor by 1 + results[unit]--; + cursor = earlier.plus(results); + + // if we are still overshooting now, we need to backtrack again + // this happens in certain situations when diffing times in different zones, + // because this calculation ignores time zones + if (cursor > later) { + // keep the "overshot by 1" around as highWater + highWater = cursor; + // backtrack cursor by 1 + results[unit]--; + cursor = earlier.plus(results); + } + } else { + cursor = highWater; + } + } + } + return [cursor, results, highWater, lowestOrder]; +} +function _diff (earlier, later, units, opts) { + var _highOrderDiffs = highOrderDiffs(earlier, later, units), + cursor = _highOrderDiffs[0], + results = _highOrderDiffs[1], + highWater = _highOrderDiffs[2], + lowestOrder = _highOrderDiffs[3]; + var remainingMillis = later - cursor; + var lowerOrderUnits = units.filter(function (u) { + return ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0; + }); + if (lowerOrderUnits.length === 0) { + if (highWater < later) { + var _cursor$plus; + highWater = cursor.plus((_cursor$plus = {}, _cursor$plus[lowestOrder] = 1, _cursor$plus)); + } + if (highWater !== cursor) { + results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); + } + } + var duration = Duration.fromObject(results, opts); + if (lowerOrderUnits.length > 0) { + var _Duration$fromMillis; + return (_Duration$fromMillis = Duration.fromMillis(remainingMillis, opts)).shiftTo.apply(_Duration$fromMillis, lowerOrderUnits).plus(duration); + } else { + return duration; + } +} + +var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; +function intUnit(regex, post) { + if (post === void 0) { + post = function post(i) { + return i; + }; + } + return { + regex: regex, + deser: function deser(_ref) { + var s = _ref[0]; + return post(parseDigits(s)); + } + }; +} +var NBSP = String.fromCharCode(160); +var spaceOrNBSP = "[ " + NBSP + "]"; +var spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g"); +function fixListRegex(s) { + // make dots optional and also make them literal + // make space and non breakable space characters interchangeable + return s.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP); +} +function stripInsensitivities(s) { + return s.replace(/\./g, "") // ignore dots that were made optional + .replace(spaceOrNBSPRegExp, " ") // interchange space and nbsp + .toLowerCase(); +} +function oneOf(strings, startIndex) { + if (strings === null) { + return null; + } else { + return { + regex: RegExp(strings.map(fixListRegex).join("|")), + deser: function deser(_ref2) { + var s = _ref2[0]; + return strings.findIndex(function (i) { + return stripInsensitivities(s) === stripInsensitivities(i); + }) + startIndex; + } + }; + } +} +function offset(regex, groups) { + return { + regex: regex, + deser: function deser(_ref3) { + var h = _ref3[1], + m = _ref3[2]; + return signedOffset(h, m); + }, + groups: groups + }; +} +function simple(regex) { + return { + regex: regex, + deser: function deser(_ref4) { + var s = _ref4[0]; + return s; + } + }; +} +function escapeToken(value) { + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); +} + +/** + * @param token + * @param {Locale} loc + */ +function unitForToken(token, loc) { + var one = digitRegex(loc), + two = digitRegex(loc, "{2}"), + three = digitRegex(loc, "{3}"), + four = digitRegex(loc, "{4}"), + six = digitRegex(loc, "{6}"), + oneOrTwo = digitRegex(loc, "{1,2}"), + oneToThree = digitRegex(loc, "{1,3}"), + oneToSix = digitRegex(loc, "{1,6}"), + oneToNine = digitRegex(loc, "{1,9}"), + twoToFour = digitRegex(loc, "{2,4}"), + fourToSix = digitRegex(loc, "{4,6}"), + literal = function literal(t) { + return { + regex: RegExp(escapeToken(t.val)), + deser: function deser(_ref5) { + var s = _ref5[0]; + return s; + }, + literal: true + }; + }, + unitate = function unitate(t) { + if (token.literal) { + return literal(t); + } + switch (t.val) { + // era + case "G": + return oneOf(loc.eras("short"), 0); + case "GG": + return oneOf(loc.eras("long"), 0); + // years + case "y": + return intUnit(oneToSix); + case "yy": + return intUnit(twoToFour, untruncateYear); + case "yyyy": + return intUnit(four); + case "yyyyy": + return intUnit(fourToSix); + case "yyyyyy": + return intUnit(six); + // months + case "M": + return intUnit(oneOrTwo); + case "MM": + return intUnit(two); + case "MMM": + return oneOf(loc.months("short", true), 1); + case "MMMM": + return oneOf(loc.months("long", true), 1); + case "L": + return intUnit(oneOrTwo); + case "LL": + return intUnit(two); + case "LLL": + return oneOf(loc.months("short", false), 1); + case "LLLL": + return oneOf(loc.months("long", false), 1); + // dates + case "d": + return intUnit(oneOrTwo); + case "dd": + return intUnit(two); + // ordinals + case "o": + return intUnit(oneToThree); + case "ooo": + return intUnit(three); + // time + case "HH": + return intUnit(two); + case "H": + return intUnit(oneOrTwo); + case "hh": + return intUnit(two); + case "h": + return intUnit(oneOrTwo); + case "mm": + return intUnit(two); + case "m": + return intUnit(oneOrTwo); + case "q": + return intUnit(oneOrTwo); + case "qq": + return intUnit(two); + case "s": + return intUnit(oneOrTwo); + case "ss": + return intUnit(two); + case "S": + return intUnit(oneToThree); + case "SSS": + return intUnit(three); + case "u": + return simple(oneToNine); + case "uu": + return simple(oneOrTwo); + case "uuu": + return intUnit(one); + // meridiem + case "a": + return oneOf(loc.meridiems(), 0); + // weekYear (k) + case "kkkk": + return intUnit(four); + case "kk": + return intUnit(twoToFour, untruncateYear); + // weekNumber (W) + case "W": + return intUnit(oneOrTwo); + case "WW": + return intUnit(two); + // weekdays + case "E": + case "c": + return intUnit(one); + case "EEE": + return oneOf(loc.weekdays("short", false), 1); + case "EEEE": + return oneOf(loc.weekdays("long", false), 1); + case "ccc": + return oneOf(loc.weekdays("short", true), 1); + case "cccc": + return oneOf(loc.weekdays("long", true), 1); + // offset/zone + case "Z": + case "ZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(?::(" + two.source + "))?"), 2); + case "ZZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(" + two.source + ")?"), 2); + // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing + // because we don't have any way to figure out what they are + case "z": + return simple(/[a-z_+-/]{1,256}?/i); + // this special-case "token" represents a place where a macro-token expanded into a white-space literal + // in this case we accept any non-newline white-space + case " ": + return simple(/[^\S\n\r]/); + default: + return literal(t); + } + }; + var unit = unitate(token) || { + invalidReason: MISSING_FTP + }; + unit.token = token; + return unit; +} +var partTypeStyleToTokenVal = { + year: { + "2-digit": "yy", + numeric: "yyyyy" + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM" + }, + day: { + numeric: "d", + "2-digit": "dd" + }, + weekday: { + short: "EEE", + long: "EEEE" + }, + dayperiod: "a", + dayPeriod: "a", + hour12: { + numeric: "h", + "2-digit": "hh" + }, + hour24: { + numeric: "H", + "2-digit": "HH" + }, + minute: { + numeric: "m", + "2-digit": "mm" + }, + second: { + numeric: "s", + "2-digit": "ss" + }, + timeZoneName: { + long: "ZZZZZ", + short: "ZZZ" + } +}; +function tokenForPart(part, formatOpts, resolvedOpts) { + var type = part.type, + value = part.value; + if (type === "literal") { + var isSpace = /^\s+$/.test(value); + return { + literal: !isSpace, + val: isSpace ? " " : value + }; + } + var style = formatOpts[type]; + + // The user might have explicitly specified hour12 or hourCycle + // if so, respect their decision + // if not, refer back to the resolvedOpts, which are based on the locale + var actualType = type; + if (type === "hour") { + if (formatOpts.hour12 != null) { + actualType = formatOpts.hour12 ? "hour12" : "hour24"; + } else if (formatOpts.hourCycle != null) { + if (formatOpts.hourCycle === "h11" || formatOpts.hourCycle === "h12") { + actualType = "hour12"; + } else { + actualType = "hour24"; + } + } else { + // tokens only differentiate between 24 hours or not, + // so we do not need to check hourCycle here, which is less supported anyways + actualType = resolvedOpts.hour12 ? "hour12" : "hour24"; + } + } + var val = partTypeStyleToTokenVal[actualType]; + if (typeof val === "object") { + val = val[style]; + } + if (val) { + return { + literal: false, + val: val + }; + } + return undefined; +} +function buildRegex(units) { + var re = units.map(function (u) { + return u.regex; + }).reduce(function (f, r) { + return f + "(" + r.source + ")"; + }, ""); + return ["^" + re + "$", units]; +} +function match(input, regex, handlers) { + var matches = input.match(regex); + if (matches) { + var all = {}; + var matchIndex = 1; + for (var i in handlers) { + if (hasOwnProperty(handlers, i)) { + var h = handlers[i], + groups = h.groups ? h.groups + 1 : 1; + if (!h.literal && h.token) { + all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); + } + matchIndex += groups; + } + } + return [matches, all]; + } else { + return [matches, {}]; + } +} +function dateTimeFromMatches(matches) { + var toField = function toField(token) { + switch (token) { + case "S": + return "millisecond"; + case "s": + return "second"; + case "m": + return "minute"; + case "h": + case "H": + return "hour"; + case "d": + return "day"; + case "o": + return "ordinal"; + case "L": + case "M": + return "month"; + case "y": + return "year"; + case "E": + case "c": + return "weekday"; + case "W": + return "weekNumber"; + case "k": + return "weekYear"; + case "q": + return "quarter"; + default: + return null; + } + }; + var zone = null; + var specificOffset; + if (!isUndefined(matches.z)) { + zone = IANAZone.create(matches.z); + } + if (!isUndefined(matches.Z)) { + if (!zone) { + zone = new FixedOffsetZone(matches.Z); + } + specificOffset = matches.Z; + } + if (!isUndefined(matches.q)) { + matches.M = (matches.q - 1) * 3 + 1; + } + if (!isUndefined(matches.h)) { + if (matches.h < 12 && matches.a === 1) { + matches.h += 12; + } else if (matches.h === 12 && matches.a === 0) { + matches.h = 0; + } + } + if (matches.G === 0 && matches.y) { + matches.y = -matches.y; + } + if (!isUndefined(matches.u)) { + matches.S = parseMillis(matches.u); + } + var vals = Object.keys(matches).reduce(function (r, k) { + var f = toField(k); + if (f) { + r[f] = matches[k]; + } + return r; + }, {}); + return [vals, zone, specificOffset]; +} +var dummyDateTimeCache = null; +function getDummyDateTime() { + if (!dummyDateTimeCache) { + dummyDateTimeCache = DateTime.fromMillis(1555555555555); + } + return dummyDateTimeCache; +} +function maybeExpandMacroToken(token, locale) { + if (token.literal) { + return token; + } + var formatOpts = Formatter.macroTokenToFormatOpts(token.val); + var tokens = formatOptsToTokens(formatOpts, locale); + if (tokens == null || tokens.includes(undefined)) { + return token; + } + return tokens; +} +function expandMacroTokens(tokens, locale) { + var _Array$prototype; + return (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, tokens.map(function (t) { + return maybeExpandMacroToken(t, locale); + })); +} + +/** + * @private + */ + +var TokenParser = /*#__PURE__*/function () { + function TokenParser(locale, format) { + this.locale = locale; + this.format = format; + this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale); + this.units = this.tokens.map(function (t) { + return unitForToken(t, locale); + }); + this.disqualifyingUnit = this.units.find(function (t) { + return t.invalidReason; + }); + if (!this.disqualifyingUnit) { + var _buildRegex = buildRegex(this.units), + regexString = _buildRegex[0], + handlers = _buildRegex[1]; + this.regex = RegExp(regexString, "i"); + this.handlers = handlers; + } + } + var _proto = TokenParser.prototype; + _proto.explainFromTokens = function explainFromTokens(input) { + if (!this.isValid) { + return { + input: input, + tokens: this.tokens, + invalidReason: this.invalidReason + }; + } else { + var _match = match(input, this.regex, this.handlers), + rawMatches = _match[0], + matches = _match[1], + _ref6 = matches ? dateTimeFromMatches(matches) : [null, null, undefined], + result = _ref6[0], + zone = _ref6[1], + specificOffset = _ref6[2]; + if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { + throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format"); + } + return { + input: input, + tokens: this.tokens, + regex: this.regex, + rawMatches: rawMatches, + matches: matches, + result: result, + zone: zone, + specificOffset: specificOffset + }; + } + }; + _createClass(TokenParser, [{ + key: "isValid", + get: function get() { + return !this.disqualifyingUnit; + } + }, { + key: "invalidReason", + get: function get() { + return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null; + } + }]); + return TokenParser; +}(); +function explainFromTokens(locale, input, format) { + var parser = new TokenParser(locale, format); + return parser.explainFromTokens(input); +} +function parseFromTokens(locale, input, format) { + var _explainFromTokens = explainFromTokens(locale, input, format), + result = _explainFromTokens.result, + zone = _explainFromTokens.zone, + specificOffset = _explainFromTokens.specificOffset, + invalidReason = _explainFromTokens.invalidReason; + return [result, zone, specificOffset, invalidReason]; +} +function formatOptsToTokens(formatOpts, locale) { + if (!formatOpts) { + return null; + } + var formatter = Formatter.create(locale, formatOpts); + var df = formatter.dtFormatter(getDummyDateTime()); + var parts = df.formatToParts(); + var resolvedOpts = df.resolvedOptions(); + return parts.map(function (p) { + return tokenForPart(p, formatOpts, resolvedOpts); + }); +} + +var INVALID = "Invalid DateTime"; +var MAX_DATE = 8.64e15; +function unsupportedZone(zone) { + return new Invalid("unsupported zone", "the zone \"" + zone.name + "\" is not supported"); +} + +// we cache week data on the DT object and this intermediates the cache +/** + * @param {DateTime} dt + */ +function possiblyCachedWeekData(dt) { + if (dt.weekData === null) { + dt.weekData = gregorianToWeek(dt.c); + } + return dt.weekData; +} + +/** + * @param {DateTime} dt + */ +function possiblyCachedLocalWeekData(dt) { + if (dt.localWeekData === null) { + dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek()); + } + return dt.localWeekData; +} + +// clone really means, "make a new object with these modifications". all "setters" really use this +// to create a new object while only changing some of the properties +function clone(inst, alts) { + var current = { + ts: inst.ts, + zone: inst.zone, + c: inst.c, + o: inst.o, + loc: inst.loc, + invalid: inst.invalid + }; + return new DateTime(_extends({}, current, alts, { + old: current + })); +} + +// find the right offset a given local time. The o input is our guess, which determines which +// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST) +function fixOffset(localTS, o, tz) { + // Our UTC time is just a guess because our offset is just a guess + var utcGuess = localTS - o * 60 * 1000; + + // Test whether the zone matches the offset for this ts + var o2 = tz.offset(utcGuess); + + // If so, offset didn't change and we're done + if (o === o2) { + return [utcGuess, o]; + } + + // If not, change the ts by the difference in the offset + utcGuess -= (o2 - o) * 60 * 1000; + + // If that gives us the local time we want, we're done + var o3 = tz.offset(utcGuess); + if (o2 === o3) { + return [utcGuess, o2]; + } + + // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time + return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; +} + +// convert an epoch timestamp into a calendar object with the given offset +function tsToObj(ts, offset) { + ts += offset * 60 * 1000; + var d = new Date(ts); + return { + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate(), + hour: d.getUTCHours(), + minute: d.getUTCMinutes(), + second: d.getUTCSeconds(), + millisecond: d.getUTCMilliseconds() + }; +} + +// convert a calendar object to a epoch timestamp +function objToTS(obj, offset, zone) { + return fixOffset(objToLocalTS(obj), offset, zone); +} + +// create a new DT instance by adding a duration, adjusting for DSTs +function adjustTime(inst, dur) { + var oPre = inst.o, + year = inst.c.year + Math.trunc(dur.years), + month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, + c = _extends({}, inst.c, { + year: year, + month: month, + day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + Math.trunc(dur.weeks) * 7 + }), + millisToAdd = Duration.fromObject({ + years: dur.years - Math.trunc(dur.years), + quarters: dur.quarters - Math.trunc(dur.quarters), + months: dur.months - Math.trunc(dur.months), + weeks: dur.weeks - Math.trunc(dur.weeks), + days: dur.days - Math.trunc(dur.days), + hours: dur.hours, + minutes: dur.minutes, + seconds: dur.seconds, + milliseconds: dur.milliseconds + }).as("milliseconds"), + localTS = objToLocalTS(c); + var _fixOffset = fixOffset(localTS, oPre, inst.zone), + ts = _fixOffset[0], + o = _fixOffset[1]; + if (millisToAdd !== 0) { + ts += millisToAdd; + // that could have changed the offset by going over a DST, but we want to keep the ts the same + o = inst.zone.offset(ts); + } + return { + ts: ts, + o: o + }; +} + +// helper useful in turning the results of parsing into real dates +// by handling the zone options +function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) { + var setZone = opts.setZone, + zone = opts.zone; + if (parsed && Object.keys(parsed).length !== 0 || parsedZone) { + var interpretationZone = parsedZone || zone, + inst = DateTime.fromObject(parsed, _extends({}, opts, { + zone: interpretationZone, + specificOffset: specificOffset + })); + return setZone ? inst : inst.setZone(zone); + } else { + return DateTime.invalid(new Invalid("unparsable", "the input \"" + text + "\" can't be parsed as " + format)); + } +} + +// if you want to output a technical format (e.g. RFC 2822), this helper +// helps handle the details +function toTechFormat(dt, format, allowZ) { + if (allowZ === void 0) { + allowZ = true; + } + return dt.isValid ? Formatter.create(Locale.create("en-US"), { + allowZ: allowZ, + forceSimple: true + }).formatDateTimeFromString(dt, format) : null; +} +function _toISODate(o, extended, precision) { + var longFormat = o.c.year > 9999 || o.c.year < 0; + var c = ""; + if (longFormat && o.c.year >= 0) c += "+"; + c += padStart(o.c.year, longFormat ? 6 : 4); + if (precision === "year") return c; + if (extended) { + c += "-"; + c += padStart(o.c.month); + if (precision === "month") return c; + c += "-"; + } else { + c += padStart(o.c.month); + if (precision === "month") return c; + } + c += padStart(o.c.day); + return c; +} +function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision) { + var showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0, + c = ""; + switch (precision) { + case "day": + case "month": + case "year": + break; + default: + c += padStart(o.c.hour); + if (precision === "hour") break; + if (extended) { + c += ":"; + c += padStart(o.c.minute); + if (precision === "minute") break; + if (showSeconds) { + c += ":"; + c += padStart(o.c.second); + } + } else { + c += padStart(o.c.minute); + if (precision === "minute") break; + if (showSeconds) { + c += padStart(o.c.second); + } + } + if (precision === "second") break; + if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) { + c += "."; + c += padStart(o.c.millisecond, 3); + } + } + if (includeOffset) { + if (o.isOffsetFixed && o.offset === 0 && !extendedZone) { + c += "Z"; + } else if (o.o < 0) { + c += "-"; + c += padStart(Math.trunc(-o.o / 60)); + c += ":"; + c += padStart(Math.trunc(-o.o % 60)); + } else { + c += "+"; + c += padStart(Math.trunc(o.o / 60)); + c += ":"; + c += padStart(Math.trunc(o.o % 60)); + } + } + if (extendedZone) { + c += "[" + o.zone.ianaName + "]"; + } + return c; +} + +// defaults for unspecified units in the supported calendars +var defaultUnitValues = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultWeekUnitValues = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultOrdinalUnitValues = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }; + +// Units in the supported calendars, sorted by bigness +var orderedUnits = ["year", "month", "day", "hour", "minute", "second", "millisecond"], + orderedWeekUnits = ["weekYear", "weekNumber", "weekday", "hour", "minute", "second", "millisecond"], + orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; + +// standardize case and plurality in units +function normalizeUnit(unit) { + var normalized = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal" + }[unit.toLowerCase()]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; +} +function normalizeUnitWithLocalWeeks(unit) { + switch (unit.toLowerCase()) { + case "localweekday": + case "localweekdays": + return "localWeekday"; + case "localweeknumber": + case "localweeknumbers": + return "localWeekNumber"; + case "localweekyear": + case "localweekyears": + return "localWeekYear"; + default: + return normalizeUnit(unit); + } +} + +// cache offsets for zones based on the current timestamp when this function is +// first called. When we are handling a datetime from components like (year, +// month, day, hour) in a time zone, we need a guess about what the timezone +// offset is so that we can convert into a UTC timestamp. One way is to find the +// offset of now in the zone. The actual date may have a different offset (for +// example, if we handle a date in June while we're in December in a zone that +// observes DST), but we can check and adjust that. +// +// When handling many dates, calculating the offset for now every time is +// expensive. It's just a guess, so we can cache the offset to use even if we +// are right on a time change boundary (we'll just correct in the other +// direction). Using a timestamp from first read is a slight optimization for +// handling dates close to the current date, since those dates will usually be +// in the same offset (we could set the timestamp statically, instead). We use a +// single timestamp for all zones to make things a bit more predictable. +// +// This is safe for quickDT (used by local() and utc()) because we don't fill in +// higher-order units from tsNow (as we do in fromObject, this requires that +// offset is calculated from tsNow). +/** + * @param {Zone} zone + * @return {number} + */ +function guessOffsetForZone(zone) { + if (zoneOffsetTs === undefined) { + zoneOffsetTs = Settings.now(); + } + + // Do not cache anything but IANA zones, because it is not safe to do so. + // Guessing an offset which is not present in the zone can cause wrong results from fixOffset + if (zone.type !== "iana") { + return zone.offset(zoneOffsetTs); + } + var zoneName = zone.name; + var offsetGuess = zoneOffsetGuessCache.get(zoneName); + if (offsetGuess === undefined) { + offsetGuess = zone.offset(zoneOffsetTs); + zoneOffsetGuessCache.set(zoneName, offsetGuess); + } + return offsetGuess; +} + +// this is a dumbed down version of fromObject() that runs about 60% faster +// but doesn't do any validation, makes a bunch of assumptions about what units +// are present, and so on. +function quickDT(obj, opts) { + var zone = normalizeZone(opts.zone, Settings.defaultZone); + if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } + var loc = Locale.fromObject(opts); + var ts, o; + + // assume we have the higher-order units + if (!isUndefined(obj.year)) { + for (var _i = 0, _orderedUnits = orderedUnits; _i < _orderedUnits.length; _i++) { + var u = _orderedUnits[_i]; + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } + } + var invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + if (invalid) { + return DateTime.invalid(invalid); + } + var offsetProvis = guessOffsetForZone(zone); + var _objToTS = objToTS(obj, offsetProvis, zone); + ts = _objToTS[0]; + o = _objToTS[1]; + } else { + ts = Settings.now(); + } + return new DateTime({ + ts: ts, + zone: zone, + loc: loc, + o: o + }); +} +function diffRelative(start, end, opts) { + var round = isUndefined(opts.round) ? true : opts.round, + rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding, + format = function format(c, unit) { + c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding); + var formatter = end.loc.clone(opts).relFormatter(opts); + return formatter.format(c, unit); + }, + differ = function differ(unit) { + if (opts.calendary) { + if (!end.hasSame(start, unit)) { + return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); + } else return 0; + } else { + return end.diff(start, unit).get(unit); + } + }; + if (opts.unit) { + return format(differ(opts.unit), opts.unit); + } + for (var _iterator = _createForOfIteratorHelperLoose(opts.units), _step; !(_step = _iterator()).done;) { + var unit = _step.value; + var count = differ(unit); + if (Math.abs(count) >= 1) { + return format(count, unit); + } + } + return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]); +} +function lastOpts(argList) { + var opts = {}, + args; + if (argList.length > 0 && typeof argList[argList.length - 1] === "object") { + opts = argList[argList.length - 1]; + args = Array.from(argList).slice(0, argList.length - 1); + } else { + args = Array.from(argList); + } + return [opts, args]; +} + +/** + * Timestamp to use for cached zone offset guesses (exposed for test) + */ +var zoneOffsetTs; +/** + * Cache for zone offset guesses (exposed for test). + * + * This optimizes quickDT via guessOffsetForZone to avoid repeated calls of + * zone.offset(). + */ +var zoneOffsetGuessCache = new Map(); + +/** + * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. + * + * A DateTime comprises of: + * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. + * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). + * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. + * + * Here is a brief overview of the most commonly used functionality it provides: + * + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month}, + * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors. + * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}. + * + * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. + */ +var DateTime = /*#__PURE__*/function (_Symbol$for) { + /** + * @access private + */ + function DateTime(config) { + var zone = config.zone || Settings.defaultZone; + var invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null); + /** + * @access private + */ + this.ts = isUndefined(config.ts) ? Settings.now() : config.ts; + var c = null, + o = null; + if (!invalid) { + var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); + if (unchanged) { + var _ref = [config.old.c, config.old.o]; + c = _ref[0]; + o = _ref[1]; + } else { + // If an offset has been passed and we have not been called from + // clone(), we can trust it and avoid the offset calculation. + var ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts); + c = tsToObj(this.ts, ot); + invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; + c = invalid ? null : c; + o = invalid ? null : ot; + } + } + + /** + * @access private + */ + this._zone = zone; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.invalid = invalid; + /** + * @access private + */ + this.weekData = null; + /** + * @access private + */ + this.localWeekData = null; + /** + * @access private + */ + this.c = c; + /** + * @access private + */ + this.o = o; + /** + * @access private + */ + this.isLuxonDateTime = true; + } + + // CONSTRUCT + + /** + * Create a DateTime for the current instant, in the system's time zone. + * + * Use Settings to override these default values if needed. + * @example DateTime.now().toISO() //~> now in the ISO format + * @return {DateTime} + */ + DateTime.now = function now() { + return new DateTime({}); + } + + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month, 1-indexed + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local({ zone: "America/New_York" }) //~> now, in US east coast time + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12, { locale: "fr" }) //~> 2017-03-12T00:00:00, with a French locale + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, { zone: "utc" }) //~> 2017-03-12T05:00:00, in UTC + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */; + DateTime.local = function local() { + var _lastOpts = lastOpts(arguments), + opts = _lastOpts[0], + args = _lastOpts[1], + year = args[0], + month = args[1], + day = args[2], + hour = args[3], + minute = args[4], + second = args[5], + millisecond = args[6]; + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, opts); + } + + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @param {Object} options - configuration options for the DateTime + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: "fr" }) //~> 2017-03-12T05:45:00Z with a French locale + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: "fr" }) //~> 2017-03-12T05:45:10.765Z with a French locale + * @return {DateTime} + */; + DateTime.utc = function utc() { + var _lastOpts2 = lastOpts(arguments), + opts = _lastOpts2[0], + args = _lastOpts2[1], + year = args[0], + month = args[1], + day = args[2], + hour = args[3], + minute = args[4], + second = args[5], + millisecond = args[6]; + opts.zone = FixedOffsetZone.utcInstance; + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, opts); + } + + /** + * Create a DateTime from a JavaScript Date object. Uses the default zone. + * @param {Date} date - a JavaScript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */; + DateTime.fromJSDate = function fromJSDate(date, options) { + if (options === void 0) { + options = {}; + } + var ts = isDate(date) ? date.valueOf() : NaN; + if (Number.isNaN(ts)) { + return DateTime.invalid("invalid input"); + } + var zoneToUse = normalizeZone(options.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + return new DateTime({ + ts: ts, + zone: zoneToUse, + loc: Locale.fromObject(options) + }); + } + + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */; + DateTime.fromMillis = function fromMillis(milliseconds, options) { + if (options === void 0) { + options = {}; + } + if (!isNumber(milliseconds)) { + throw new InvalidArgumentError("fromMillis requires a numerical input, but received a " + typeof milliseconds + " with value " + milliseconds); + } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { + // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start + return DateTime.invalid("Timestamp out of range"); + } else { + return new DateTime({ + ts: milliseconds, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */; + DateTime.fromSeconds = function fromSeconds(seconds, options) { + if (options === void 0) { + options = {}; + } + if (!isNumber(seconds)) { + throw new InvalidArgumentError("fromSeconds requires a numerical input"); + } else { + return new DateTime({ + ts: seconds * 1000, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + + /** + * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.localWeekYear - a week year, according to the locale + * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale + * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {Object} opts - options for creating this DateTime + * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26' + * @return {DateTime} + */; + DateTime.fromObject = function fromObject(obj, opts) { + if (opts === void 0) { + opts = {}; + } + obj = obj || {}; + var zoneToUse = normalizeZone(opts.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + var loc = Locale.fromObject(opts); + var normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks); + var _usesLocalWeekValues = usesLocalWeekValues(normalized, loc), + minDaysInFirstWeek = _usesLocalWeekValues.minDaysInFirstWeek, + startOfWeek = _usesLocalWeekValues.startOfWeek; + var tsNow = Settings.now(), + offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber; + + // cases: + // just a weekday -> this week's instance of that weekday, no worries + // (gregorian data or ordinal) + (weekYear or weekNumber) -> error + // (gregorian month or day) + ordinal -> error + // otherwise just use weeks or ordinals or gregorian, depending on what's specified + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + var useWeekData = definiteWeekDef || normalized.weekday && !containsGregor; + + // configure ourselves to deal with gregorian dates or week stuff + var units, + defaultValues, + objNow = tsToObj(tsNow, offsetProvis); + if (useWeekData) { + units = orderedWeekUnits; + defaultValues = defaultWeekUnitValues; + objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek); + } else if (containsOrdinal) { + units = orderedOrdinalUnits; + defaultValues = defaultOrdinalUnitValues; + objNow = gregorianToOrdinal(objNow); + } else { + units = orderedUnits; + defaultValues = defaultUnitValues; + } + + // set default values for missing stuff + var foundFirst = false; + for (var _iterator2 = _createForOfIteratorHelperLoose(units), _step2; !(_step2 = _iterator2()).done;) { + var u = _step2.value; + var v = normalized[u]; + if (!isUndefined(v)) { + foundFirst = true; + } else if (foundFirst) { + normalized[u] = defaultValues[u]; + } else { + normalized[u] = objNow[u]; + } + } + + // make sure the values we have are in range + var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), + invalid = higherOrderInvalid || hasInvalidTimeData(normalized); + if (invalid) { + return DateTime.invalid(invalid); + } + + // compute the actual time + var gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, + _objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse), + tsFinal = _objToTS2[0], + offsetFinal = _objToTS2[1], + inst = new DateTime({ + ts: tsFinal, + zone: zoneToUse, + o: offsetFinal, + loc: loc + }); + + // gregorian data + weekday serves only to validate + if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { + return DateTime.invalid("mismatched weekday", "you can't specify both a weekday of " + normalized.weekday + " and a date of " + inst.toISO()); + } + if (!inst.isValid) { + return DateTime.invalid(inst.invalid); + } + return inst; + } + + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */; + DateTime.fromISO = function fromISO(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseISODate = parseISODate(text), + vals = _parseISODate[0], + parsedZone = _parseISODate[1]; + return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); + } + + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */; + DateTime.fromRFC2822 = function fromRFC2822(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseRFC2822Date = parseRFC2822Date(text), + vals = _parseRFC2822Date[0], + parsedZone = _parseRFC2822Date[1]; + return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); + } + + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */; + DateTime.fromHTTP = function fromHTTP(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseHTTPDate = parseHTTPDate(text), + vals = _parseHTTPDate[0], + parsedZone = _parseHTTPDate[1]; + return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); + } + + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens). + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */; + DateTime.fromFormat = function fromFormat(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + if (isUndefined(text) || isUndefined(fmt)) { + throw new InvalidArgumentError("fromFormat requires an input string and a format"); + } + var _opts = opts, + _opts$locale = _opts.locale, + locale = _opts$locale === void 0 ? null : _opts$locale, + _opts$numberingSystem = _opts.numberingSystem, + numberingSystem = _opts$numberingSystem === void 0 ? null : _opts$numberingSystem, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }), + _parseFromTokens = parseFromTokens(localeToUse, text, fmt), + vals = _parseFromTokens[0], + parsedZone = _parseFromTokens[1], + specificOffset = _parseFromTokens[2], + invalid = _parseFromTokens[3]; + if (invalid) { + return DateTime.invalid(invalid); + } else { + return parseDataToDateTime(vals, parsedZone, opts, "format " + fmt, text, specificOffset); + } + } + + /** + * @deprecated use fromFormat instead + */; + DateTime.fromString = function fromString(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + return DateTime.fromFormat(text, fmt, opts); + } + + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */; + DateTime.fromSQL = function fromSQL(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseSQL = parseSQL(text), + vals = _parseSQL[0], + parsedZone = _parseSQL[1]; + return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); + } + + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent. + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */; + DateTime.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); + } + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidDateTimeError(invalid); + } else { + return new DateTime({ + invalid: invalid + }); + } + } + + /** + * Check if an object is an instance of DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */; + DateTime.isDateTime = function isDateTime(o) { + return o && o.isLuxonDateTime || false; + } + + /** + * Produce the format string for a set of options + * @param formatOpts + * @param localeOpts + * @returns {string} + */; + DateTime.parseFormatForOpts = function parseFormatForOpts(formatOpts, localeOpts) { + if (localeOpts === void 0) { + localeOpts = {}; + } + var tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts)); + return !tokenList ? null : tokenList.map(function (t) { + return t ? t.val : null; + }).join(""); + } + + /** + * Produce the the fully expanded format token for the locale + * Does NOT quote characters, so quoted tokens will not round trip correctly + * @param fmt + * @param localeOpts + * @returns {string} + */; + DateTime.expandFormat = function expandFormat(fmt, localeOpts) { + if (localeOpts === void 0) { + localeOpts = {}; + } + var expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts)); + return expanded.map(function (t) { + return t.val; + }).join(""); + }; + DateTime.resetCache = function resetCache() { + zoneOffsetTs = undefined; + zoneOffsetGuessCache.clear(); + } + + // INFO + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */; + var _proto = DateTime.prototype; + _proto.get = function get(unit) { + return this[unit]; + } + + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */; + /** + * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC + * in this DateTime's zone. During DST changes local time can be ambiguous, for example + * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`. + * This method will return both possible DateTimes if this DateTime's local time is ambiguous. + * @returns {DateTime[]} + */ + _proto.getPossibleOffsets = function getPossibleOffsets() { + if (!this.isValid || this.isOffsetFixed) { + return [this]; + } + var dayMs = 86400000; + var minuteMs = 60000; + var localTS = objToLocalTS(this.c); + var oEarlier = this.zone.offset(localTS - dayMs); + var oLater = this.zone.offset(localTS + dayMs); + var o1 = this.zone.offset(localTS - oEarlier * minuteMs); + var o2 = this.zone.offset(localTS - oLater * minuteMs); + if (o1 === o2) { + return [this]; + } + var ts1 = localTS - o1 * minuteMs; + var ts2 = localTS - o2 * minuteMs; + var c1 = tsToObj(ts1, o1); + var c2 = tsToObj(ts2, o2); + if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) { + return [clone(this, { + ts: ts1 + }), clone(this, { + ts: ts2 + })]; + } + return [this]; + } + + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */; + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + _proto.resolvedLocaleOptions = function resolvedLocaleOptions(opts) { + if (opts === void 0) { + opts = {}; + } + var _Formatter$create$res = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this), + locale = _Formatter$create$res.locale, + numberingSystem = _Formatter$create$res.numberingSystem, + calendar = _Formatter$create$res.calendar; + return { + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: calendar + }; + } + + // TRANSFORM + + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link DateTime#setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */; + _proto.toUTC = function toUTC(offset, opts) { + if (offset === void 0) { + offset = 0; + } + if (opts === void 0) { + opts = {}; + } + return this.setZone(FixedOffsetZone.instance(offset), opts); + } + + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */; + _proto.toLocal = function toLocal() { + return this.setZone(Settings.defaultZone); + } + + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */; + _proto.setZone = function setZone(zone, _temp) { + var _ref2 = _temp === void 0 ? {} : _temp, + _ref2$keepLocalTime = _ref2.keepLocalTime, + keepLocalTime = _ref2$keepLocalTime === void 0 ? false : _ref2$keepLocalTime, + _ref2$keepCalendarTim = _ref2.keepCalendarTime, + keepCalendarTime = _ref2$keepCalendarTim === void 0 ? false : _ref2$keepCalendarTim; + zone = normalizeZone(zone, Settings.defaultZone); + if (zone.equals(this.zone)) { + return this; + } else if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } else { + var newTS = this.ts; + if (keepLocalTime || keepCalendarTime) { + var offsetGuess = zone.offset(this.ts); + var asObj = this.toObject(); + var _objToTS3 = objToTS(asObj, offsetGuess, zone); + newTS = _objToTS3[0]; + } + return clone(this, { + ts: newTS, + zone: zone + }); + } + } + + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */; + _proto.reconfigure = function reconfigure(_temp2) { + var _ref3 = _temp2 === void 0 ? {} : _temp2, + locale = _ref3.locale, + numberingSystem = _ref3.numberingSystem, + outputCalendar = _ref3.outputCalendar; + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: outputCalendar + }); + return clone(this, { + loc: loc + }); + } + + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */; + _proto.setLocale = function setLocale(locale) { + return this.reconfigure({ + locale: locale + }); + } + + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}. + * + * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`. + * They cannot be mixed with ISO-week units like `weekday`. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */; + _proto.set = function set(values) { + if (!this.isValid) return this; + var normalized = normalizeObject(values, normalizeUnitWithLocalWeeks); + var _usesLocalWeekValues2 = usesLocalWeekValues(normalized, this.loc), + minDaysInFirstWeek = _usesLocalWeekValues2.minDaysInFirstWeek, + startOfWeek = _usesLocalWeekValues2.startOfWeek; + var settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber; + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + var mixed; + if (settingWeekStuff) { + mixed = weekToGregorian(_extends({}, gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), normalized), minDaysInFirstWeek, startOfWeek); + } else if (!isUndefined(normalized.ordinal)) { + mixed = ordinalToGregorian(_extends({}, gregorianToOrdinal(this.c), normalized)); + } else { + mixed = _extends({}, this.toObject(), normalized); + + // if we didn't set the day but we ended up on an overflow date, + // use the last day of the right month + if (isUndefined(normalized.day)) { + mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); + } + } + var _objToTS4 = objToTS(mixed, this.o, this.zone), + ts = _objToTS4[0], + o = _objToTS4[1]; + return clone(this, { + ts: ts, + o: o + }); + } + + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.now().plus(123) //~> in 123 milliseconds + * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */; + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration); + return clone(this, adjustTime(this, dur)); + } + + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link DateTime#plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */; + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration).negate(); + return clone(this, adjustTime(this, dur)); + } + + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */; + _proto.startOf = function startOf(unit, _temp3) { + var _ref4 = _temp3 === void 0 ? {} : _temp3, + _ref4$useLocaleWeeks = _ref4.useLocaleWeeks, + useLocaleWeeks = _ref4$useLocaleWeeks === void 0 ? false : _ref4$useLocaleWeeks; + if (!this.isValid) return this; + var o = {}, + normalizedUnit = Duration.normalizeUnit(unit); + switch (normalizedUnit) { + case "years": + o.month = 1; + // falls through + case "quarters": + case "months": + o.day = 1; + // falls through + case "weeks": + case "days": + o.hour = 0; + // falls through + case "hours": + o.minute = 0; + // falls through + case "minutes": + o.second = 0; + // falls through + case "seconds": + o.millisecond = 0; + break; + // no default, invalid units throw in normalizeUnit() + } + + if (normalizedUnit === "weeks") { + if (useLocaleWeeks) { + var startOfWeek = this.loc.getStartOfWeek(); + var weekday = this.weekday; + if (weekday < startOfWeek) { + o.weekNumber = this.weekNumber - 1; + } + o.weekday = startOfWeek; + } else { + o.weekday = 1; + } + } + if (normalizedUnit === "quarters") { + var q = Math.ceil(this.month / 3); + o.month = (q - 1) * 3 + 1; + } + return this.set(o); + } + + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */; + _proto.endOf = function endOf(unit, opts) { + var _this$plus; + return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit, opts).minus(1) : this; + } + + // OUTPUT + + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.now().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.now().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */; + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID; + } + + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toLocaleString(); //=> 4/20/2017 + * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022' + * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32' + * @return {string} + */; + _proto.toLocaleString = function toLocaleString(formatOpts, opts) { + if (formatOpts === void 0) { + formatOpts = DATE_SHORT; + } + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID; + } + + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.now().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */; + _proto.toLocaleParts = function toLocaleParts(opts) { + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : []; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=false] - add the time zone format extension + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0. + * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z' + * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z' + * @return {string|null} + */; + _proto.toISO = function toISO(_temp4) { + var _ref5 = _temp4 === void 0 ? {} : _temp4, + _ref5$format = _ref5.format, + format = _ref5$format === void 0 ? "extended" : _ref5$format, + _ref5$suppressSeconds = _ref5.suppressSeconds, + suppressSeconds = _ref5$suppressSeconds === void 0 ? false : _ref5$suppressSeconds, + _ref5$suppressMillise = _ref5.suppressMilliseconds, + suppressMilliseconds = _ref5$suppressMillise === void 0 ? false : _ref5$suppressMillise, + _ref5$includeOffset = _ref5.includeOffset, + includeOffset = _ref5$includeOffset === void 0 ? true : _ref5$includeOffset, + _ref5$extendedZone = _ref5.extendedZone, + extendedZone = _ref5$extendedZone === void 0 ? false : _ref5$extendedZone, + _ref5$precision = _ref5.precision, + precision = _ref5$precision === void 0 ? "milliseconds" : _ref5$precision; + if (!this.isValid) { + return null; + } + precision = normalizeUnit(precision); + var ext = format === "extended"; + var c = _toISODate(this, ext, precision); + if (orderedUnits.indexOf(precision) >= 3) c += "T"; + c += _toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision); + return c; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'. + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05' + * @return {string|null} + */; + _proto.toISODate = function toISODate(_temp5) { + var _ref6 = _temp5 === void 0 ? {} : _temp5, + _ref6$format = _ref6.format, + format = _ref6$format === void 0 ? "extended" : _ref6$format, + _ref6$precision = _ref6.precision, + precision = _ref6$precision === void 0 ? "day" : _ref6$precision; + if (!this.isValid) { + return null; + } + return _toISODate(this, format === "extended", normalizeUnit(precision)); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */; + _proto.toISOWeekDate = function toISOWeekDate() { + return toTechFormat(this, "kkkk-'W'WW-c"); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=true] - add the time zone format extension + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0. + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z' + * @return {string} + */; + _proto.toISOTime = function toISOTime(_temp6) { + var _ref7 = _temp6 === void 0 ? {} : _temp6, + _ref7$suppressMillise = _ref7.suppressMilliseconds, + suppressMilliseconds = _ref7$suppressMillise === void 0 ? false : _ref7$suppressMillise, + _ref7$suppressSeconds = _ref7.suppressSeconds, + suppressSeconds = _ref7$suppressSeconds === void 0 ? false : _ref7$suppressSeconds, + _ref7$includeOffset = _ref7.includeOffset, + includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset, + _ref7$includePrefix = _ref7.includePrefix, + includePrefix = _ref7$includePrefix === void 0 ? false : _ref7$includePrefix, + _ref7$extendedZone = _ref7.extendedZone, + extendedZone = _ref7$extendedZone === void 0 ? false : _ref7$extendedZone, + _ref7$format = _ref7.format, + format = _ref7$format === void 0 ? "extended" : _ref7$format, + _ref7$precision = _ref7.precision, + precision = _ref7$precision === void 0 ? "milliseconds" : _ref7$precision; + if (!this.isValid) { + return null; + } + precision = normalizeUnit(precision); + var c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : ""; + return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision); + } + + /** + * Returns an RFC 2822-compatible string representation of this DateTime + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */; + _proto.toRFC2822 = function toRFC2822() { + return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); + } + + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */; + _proto.toHTTP = function toHTTP() { + return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string|null} + */; + _proto.toSQLDate = function toSQLDate() { + if (!this.isValid) { + return null; + } + return _toISODate(this, true); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */; + _proto.toSQLTime = function toSQLTime(_temp7) { + var _ref8 = _temp7 === void 0 ? {} : _temp7, + _ref8$includeOffset = _ref8.includeOffset, + includeOffset = _ref8$includeOffset === void 0 ? true : _ref8$includeOffset, + _ref8$includeZone = _ref8.includeZone, + includeZone = _ref8$includeZone === void 0 ? false : _ref8$includeZone, + _ref8$includeOffsetSp = _ref8.includeOffsetSpace, + includeOffsetSpace = _ref8$includeOffsetSp === void 0 ? true : _ref8$includeOffsetSp; + var fmt = "HH:mm:ss.SSS"; + if (includeZone || includeOffset) { + if (includeOffsetSpace) { + fmt += " "; + } + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += "ZZ"; + } + } + return toTechFormat(this, fmt, true); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */; + _proto.toSQL = function toSQL(opts) { + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) { + return null; + } + return this.toSQLDate() + " " + this.toSQLTime(opts); + } + + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */; + _proto.toString = function toString() { + return this.isValid ? this.toISO() : INVALID; + } + + /** + * Returns a string representation of this DateTime appropriate for the REPL. + * @return {string} + */; + _proto[_Symbol$for] = function () { + if (this.isValid) { + return "DateTime { ts: " + this.toISO() + ", zone: " + this.zone.name + ", locale: " + this.locale + " }"; + } else { + return "DateTime { Invalid, reason: " + this.invalidReason + " }"; + } + } + + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis} + * @return {number} + */; + _proto.valueOf = function valueOf() { + return this.toMillis(); + } + + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */; + _proto.toMillis = function toMillis() { + return this.isValid ? this.ts : NaN; + } + + /** + * Returns the epoch seconds (including milliseconds in the fractional part) of this DateTime. + * @return {number} + */; + _proto.toSeconds = function toSeconds() { + return this.isValid ? this.ts / 1000 : NaN; + } + + /** + * Returns the epoch seconds (as a whole number) of this DateTime. + * @return {number} + */; + _proto.toUnixInteger = function toUnixInteger() { + return this.isValid ? Math.floor(this.ts / 1000) : NaN; + } + + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */; + _proto.toJSON = function toJSON() { + return this.toISO(); + } + + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */; + _proto.toBSON = function toBSON() { + return this.toJSDate(); + } + + /** + * Returns a JavaScript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */; + _proto.toObject = function toObject(opts) { + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) return {}; + var base = _extends({}, this.c); + if (opts.includeConfig) { + base.outputCalendar = this.outputCalendar; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + return base; + } + + /** + * Returns a JavaScript Date equivalent to this DateTime. + * @return {Date} + */; + _proto.toJSDate = function toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } + + // COMPARE + + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */; + _proto.diff = function diff(otherDateTime, unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + if (opts === void 0) { + opts = {}; + } + if (!this.isValid || !otherDateTime.isValid) { + return Duration.invalid("created by diffing an invalid DateTime"); + } + var durOpts = _extends({ + locale: this.locale, + numberingSystem: this.numberingSystem + }, opts); + var units = maybeArray(unit).map(Duration.normalizeUnit), + otherIsLater = otherDateTime.valueOf() > this.valueOf(), + earlier = otherIsLater ? this : otherDateTime, + later = otherIsLater ? otherDateTime : this, + diffed = _diff(earlier, later, units, durOpts); + return otherIsLater ? diffed.negate() : diffed; + } + + /** + * Return the difference between this DateTime and right now. + * See {@link DateTime#diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */; + _proto.diffNow = function diffNow(unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + if (opts === void 0) { + opts = {}; + } + return this.diff(DateTime.now(), unit, opts); + } + + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval|DateTime} + */; + _proto.until = function until(otherDateTime) { + return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; + } + + /** + * Return whether this DateTime is in the same unit of time as another DateTime. + * Higher-order units must also be identical for this function to return `true`. + * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed. + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used + * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day + * @return {boolean} + */; + _proto.hasSame = function hasSame(otherDateTime, unit, opts) { + if (!this.isValid) return false; + var inputMs = otherDateTime.valueOf(); + var adjustedToZone = this.setZone(otherDateTime.zone, { + keepLocalTime: true + }); + return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts); + } + + /** + * Equality check + * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */; + _proto.equals = function equals(other) { + return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc); + } + + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {string} [options.rounding="trunc"] - rounding method to use when rounding the numbers in the output. Can be "trunc" (toward zero), "expand" (away from zero), "round", "floor", or "ceil". + * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.now().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.now().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */; + _proto.toRelative = function toRelative(options) { + if (options === void 0) { + options = {}; + } + if (!this.isValid) return null; + var base = options.base || DateTime.fromObject({}, { + zone: this.zone + }), + padding = options.padding ? this < base ? -options.padding : options.padding : 0; + var units = ["years", "months", "days", "hours", "minutes", "seconds"]; + var unit = options.unit; + if (Array.isArray(options.unit)) { + units = options.unit; + unit = undefined; + } + return diffRelative(base, this.plus(padding), _extends({}, options, { + numeric: "always", + units: units, + unit: unit + })); + } + + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.now().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */; + _proto.toRelativeCalendar = function toRelativeCalendar(options) { + if (options === void 0) { + options = {}; + } + if (!this.isValid) return null; + return diffRelative(options.base || DateTime.fromObject({}, { + zone: this.zone + }), this, _extends({}, options, { + numeric: "auto", + units: ["years", "months", "days"], + calendary: true + })); + } + + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */; + DateTime.min = function min() { + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("min requires all arguments be DateTimes"); + } + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.min); + } + + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */; + DateTime.max = function max() { + for (var _len2 = arguments.length, dateTimes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + dateTimes[_key2] = arguments[_key2]; + } + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("max requires all arguments be DateTimes"); + } + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.max); + } + + // MISC + + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */; + DateTime.fromFormatExplain = function fromFormatExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + var _options = options, + _options$locale = _options.locale, + locale = _options$locale === void 0 ? null : _options$locale, + _options$numberingSys = _options.numberingSystem, + numberingSystem = _options$numberingSys === void 0 ? null : _options$numberingSys, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + return explainFromTokens(localeToUse, text, fmt); + } + + /** + * @deprecated use fromFormatExplain instead + */; + DateTime.fromStringExplain = function fromStringExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + return DateTime.fromFormatExplain(text, fmt, options); + } + + /** + * Build a parser for `fmt` using the given locale. This parser can be passed + * to {@link DateTime.fromFormatParser} to a parse a date in this format. This + * can be used to optimize cases where many dates need to be parsed in a + * specific format. + * + * @param {String} fmt - the format the string is expected to be in (see + * description) + * @param {Object} options - options used to set locale and numberingSystem + * for parser + * @returns {TokenParser} - opaque object to be used + */; + DateTime.buildFormatParser = function buildFormatParser(fmt, options) { + if (options === void 0) { + options = {}; + } + var _options2 = options, + _options2$locale = _options2.locale, + locale = _options2$locale === void 0 ? null : _options2$locale, + _options2$numberingSy = _options2.numberingSystem, + numberingSystem = _options2$numberingSy === void 0 ? null : _options2$numberingSy, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + return new TokenParser(localeToUse, fmt); + } + + /** + * Create a DateTime from an input string and format parser. + * + * The format parser must have been created with the same locale as this call. + * + * @param {String} text - the string to parse + * @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser} + * @param {Object} opts - options taken by fromFormat() + * @returns {DateTime} + */; + DateTime.fromFormatParser = function fromFormatParser(text, formatParser, opts) { + if (opts === void 0) { + opts = {}; + } + if (isUndefined(text) || isUndefined(formatParser)) { + throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser"); + } + var _opts2 = opts, + _opts2$locale = _opts2.locale, + locale = _opts2$locale === void 0 ? null : _opts2$locale, + _opts2$numberingSyste = _opts2.numberingSystem, + numberingSystem = _opts2$numberingSyste === void 0 ? null : _opts2$numberingSyste, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + if (!localeToUse.equals(formatParser.locale)) { + throw new InvalidArgumentError("fromFormatParser called with a locale of " + localeToUse + ", " + ("but the format parser was created for " + formatParser.locale)); + } + var _formatParser$explain = formatParser.explainFromTokens(text), + result = _formatParser$explain.result, + zone = _formatParser$explain.zone, + specificOffset = _formatParser$explain.specificOffset, + invalidReason = _formatParser$explain.invalidReason; + if (invalidReason) { + return DateTime.invalid(invalidReason); + } else { + return parseDataToDateTime(result, zone, opts, "format " + formatParser.format, text, specificOffset); + } + } + + // FORMAT PRESETS + + /** + * {@link DateTime#toLocaleString} format like 10/14/1983 + * @type {Object} + */; + _createClass(DateTime, [{ + key: "isValid", + get: function get() { + return this.invalid === null; + } + + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + }, { + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + }, { + key: "outputCalendar", + get: function get() { + return this.isValid ? this.loc.outputCalendar : null; + } + + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + }, { + key: "zone", + get: function get() { + return this._zone; + } + + /** + * Get the name of the time zone. + * @type {string} + */ + }, { + key: "zoneName", + get: function get() { + return this.isValid ? this.zone.name : null; + } + + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + }, { + key: "year", + get: function get() { + return this.isValid ? this.c.year : NaN; + } + + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + }, { + key: "quarter", + get: function get() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + }, { + key: "month", + get: function get() { + return this.isValid ? this.c.month : NaN; + } + + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + }, { + key: "day", + get: function get() { + return this.isValid ? this.c.day : NaN; + } + + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + }, { + key: "hour", + get: function get() { + return this.isValid ? this.c.hour : NaN; + } + + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + }, { + key: "minute", + get: function get() { + return this.isValid ? this.c.minute : NaN; + } + + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + }, { + key: "second", + get: function get() { + return this.isValid ? this.c.second : NaN; + } + + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + }, { + key: "millisecond", + get: function get() { + return this.isValid ? this.c.millisecond : NaN; + } + + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 12, 31).weekYear //=> 2015 + * @type {number} + */ + }, { + key: "weekYear", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; + } + + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + }, { + key: "weekNumber", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; + } + + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + }, { + key: "weekday", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; + } + + /** + * Returns true if this date is on a weekend according to the locale, false otherwise + * @returns {boolean} + */ + }, { + key: "isWeekend", + get: function get() { + return this.isValid && this.loc.getWeekendDays().includes(this.weekday); + } + + /** + * Get the day of the week according to the locale. + * 1 is the first day of the week and 7 is the last day of the week. + * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1, + * @returns {number} + */ + }, { + key: "localWeekday", + get: function get() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN; + } + + /** + * Get the week number of the week year according to the locale. Different locales assign week numbers differently, + * because the week can start on different days of the week (see localWeekday) and because a different number of days + * is required for a week to count as the first week of a year. + * @returns {number} + */ + }, { + key: "localWeekNumber", + get: function get() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN; + } + + /** + * Get the week year according to the locale. Different locales assign week numbers (and therefor week years) + * differently, see localWeekNumber. + * @returns {number} + */ + }, { + key: "localWeekYear", + get: function get() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN; + } + + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + }, { + key: "ordinal", + get: function get() { + return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; + } + + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + }, { + key: "monthShort", + get: function get() { + return this.isValid ? Info.months("short", { + locObj: this.loc + })[this.month - 1] : null; + } + + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + }, { + key: "monthLong", + get: function get() { + return this.isValid ? Info.months("long", { + locObj: this.loc + })[this.month - 1] : null; + } + + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + }, { + key: "weekdayShort", + get: function get() { + return this.isValid ? Info.weekdays("short", { + locObj: this.loc + })[this.weekday - 1] : null; + } + + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + }, { + key: "weekdayLong", + get: function get() { + return this.isValid ? Info.weekdays("long", { + locObj: this.loc + })[this.weekday - 1] : null; + } + + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.now().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + }, { + key: "offset", + get: function get() { + return this.isValid ? +this.o : NaN; + } + + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + }, { + key: "offsetNameShort", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale + }); + } else { + return null; + } + } + + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + }, { + key: "offsetNameLong", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale + }); + } else { + return null; + } + } + + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + }, { + key: "isOffsetFixed", + get: function get() { + return this.isValid ? this.zone.isUniversal : null; + } + + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + }, { + key: "isInDST", + get: function get() { + if (this.isOffsetFixed) { + return false; + } else { + return this.offset > this.set({ + month: 1, + day: 1 + }).offset || this.offset > this.set({ + month: 5 + }).offset; + } + } + }, { + key: "isInLeapYear", + get: function get() { + return isLeapYear(this.year); + } + + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + }, { + key: "daysInMonth", + get: function get() { + return daysInMonth(this.year, this.month); + } + + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + }, { + key: "daysInYear", + get: function get() { + return this.isValid ? daysInYear(this.year) : NaN; + } + + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + }, { + key: "weeksInWeekYear", + get: function get() { + return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; + } + + /** + * Returns the number of weeks in this DateTime's local week year + * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52 + * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53 + * @type {number} + */ + }, { + key: "weeksInLocalWeekYear", + get: function get() { + return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN; + } + }], [{ + key: "DATE_SHORT", + get: function get() { + return DATE_SHORT; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_MED", + get: function get() { + return DATE_MED; + } + + /** + * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_MED_WITH_WEEKDAY", + get: function get() { + return DATE_MED_WITH_WEEKDAY; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_FULL", + get: function get() { + return DATE_FULL; + } + + /** + * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_HUGE", + get: function get() { + return DATE_HUGE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_SIMPLE", + get: function get() { + return TIME_SIMPLE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_WITH_SECONDS", + get: function get() { + return TIME_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_WITH_SHORT_OFFSET", + get: function get() { + return TIME_WITH_SHORT_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_WITH_LONG_OFFSET", + get: function get() { + return TIME_WITH_LONG_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_SIMPLE", + get: function get() { + return TIME_24_SIMPLE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_WITH_SECONDS", + get: function get() { + return TIME_24_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_WITH_SHORT_OFFSET", + get: function get() { + return TIME_24_WITH_SHORT_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_WITH_LONG_OFFSET", + get: function get() { + return TIME_24_WITH_LONG_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_SHORT", + get: function get() { + return DATETIME_SHORT; + } + + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_SHORT_WITH_SECONDS", + get: function get() { + return DATETIME_SHORT_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_MED", + get: function get() { + return DATETIME_MED; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_MED_WITH_SECONDS", + get: function get() { + return DATETIME_MED_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_MED_WITH_WEEKDAY", + get: function get() { + return DATETIME_MED_WITH_WEEKDAY; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_FULL", + get: function get() { + return DATETIME_FULL; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_FULL_WITH_SECONDS", + get: function get() { + return DATETIME_FULL_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_HUGE", + get: function get() { + return DATETIME_HUGE; + } + + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_HUGE_WITH_SECONDS", + get: function get() { + return DATETIME_HUGE_WITH_SECONDS; + } + }]); + return DateTime; +}(Symbol.for("nodejs.util.inspect.custom")); +function friendlyDateTime(dateTimeish) { + if (DateTime.isDateTime(dateTimeish)) { + return dateTimeish; + } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) { + return DateTime.fromJSDate(dateTimeish); + } else if (dateTimeish && typeof dateTimeish === "object") { + return DateTime.fromObject(dateTimeish); + } else { + throw new InvalidArgumentError("Unknown datetime argument: " + dateTimeish + ", of type " + typeof dateTimeish); + } +} + +var VERSION = "3.7.2"; + +exports.DateTime = DateTime; +exports.Duration = Duration; +exports.FixedOffsetZone = FixedOffsetZone; +exports.IANAZone = IANAZone; +exports.Info = Info; +exports.Interval = Interval; +exports.InvalidZone = InvalidZone; +exports.Settings = Settings; +exports.SystemZone = SystemZone; +exports.VERSION = VERSION; +exports.Zone = Zone; +//# sourceMappingURL=luxon.js.map diff --git a/node_modules/luxon/build/cjs-browser/luxon.js.map b/node_modules/luxon/build/cjs-browser/luxon.js.map new file mode 100644 index 00000000..e965cb94 --- /dev/null +++ b/node_modules/luxon/build/cjs-browser/luxon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"luxon.js","sources":["../../src/errors.js","../../src/impl/formats.js","../../src/zone.js","../../src/zones/systemZone.js","../../src/zones/IANAZone.js","../../src/impl/locale.js","../../src/zones/fixedOffsetZone.js","../../src/zones/invalidZone.js","../../src/impl/zoneUtil.js","../../src/impl/digits.js","../../src/settings.js","../../src/impl/invalid.js","../../src/impl/conversions.js","../../src/impl/util.js","../../src/impl/english.js","../../src/impl/formatter.js","../../src/impl/regexParser.js","../../src/duration.js","../../src/interval.js","../../src/info.js","../../src/impl/diff.js","../../src/impl/tokenParser.js","../../src/datetime.js","../../src/luxon.js"],"sourcesContent":["// these aren't really private, but nor are they really useful to document\n\n/**\n * @private\n */\nclass LuxonError extends Error {}\n\n/**\n * @private\n */\nexport class InvalidDateTimeError extends LuxonError {\n constructor(reason) {\n super(`Invalid DateTime: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidIntervalError extends LuxonError {\n constructor(reason) {\n super(`Invalid Interval: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidDurationError extends LuxonError {\n constructor(reason) {\n super(`Invalid Duration: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class ConflictingSpecificationError extends LuxonError {}\n\n/**\n * @private\n */\nexport class InvalidUnitError extends LuxonError {\n constructor(unit) {\n super(`Invalid unit ${unit}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidArgumentError extends LuxonError {}\n\n/**\n * @private\n */\nexport class ZoneIsAbstractError extends LuxonError {\n constructor() {\n super(\"Zone is an abstract class\");\n }\n}\n","/**\n * @private\n */\n\nconst n = \"numeric\",\n s = \"short\",\n l = \"long\";\n\nexport const DATE_SHORT = {\n year: n,\n month: n,\n day: n,\n};\n\nexport const DATE_MED = {\n year: n,\n month: s,\n day: n,\n};\n\nexport const DATE_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n};\n\nexport const DATE_FULL = {\n year: n,\n month: l,\n day: n,\n};\n\nexport const DATE_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n};\n\nexport const TIME_SIMPLE = {\n hour: n,\n minute: n,\n};\n\nexport const TIME_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const TIME_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const TIME_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n\nexport const TIME_24_SIMPLE = {\n hour: n,\n minute: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: s,\n};\n\nexport const TIME_24_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: l,\n};\n\nexport const DATETIME_SHORT = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_SHORT_WITH_SECONDS = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_MED_WITH_SECONDS = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_FULL = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_FULL_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n timeZoneName: l,\n};\n\nexport const DATETIME_HUGE_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n","import { ZoneIsAbstractError } from \"./errors.js\";\n\n/**\n * @interface\n */\nexport default class Zone {\n /**\n * The type of zone\n * @abstract\n * @type {string}\n */\n get type() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The name of this zone.\n * @abstract\n * @type {string}\n */\n get name() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The IANA name of this zone.\n * Defaults to `name` if not overwritten by a subclass.\n * @abstract\n * @type {string}\n */\n get ianaName() {\n return this.name;\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @type {boolean}\n */\n get isUniversal() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, opts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's value as a string\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is valid.\n * @abstract\n * @type {boolean}\n */\n get isValid() {\n throw new ZoneIsAbstractError();\n }\n}\n","import { formatOffset, parseZoneInfo } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * Represents the local zone for this JavaScript environment.\n * @implements {Zone}\n */\nexport default class SystemZone extends Zone {\n /**\n * Get a singleton instance of the local zone\n * @return {SystemZone}\n */\n static get instance() {\n if (singleton === null) {\n singleton = new SystemZone();\n }\n return singleton;\n }\n\n /** @override **/\n get type() {\n return \"system\";\n }\n\n /** @override **/\n get name() {\n return new Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n return -new Date(ts).getTimezoneOffset();\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"system\";\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import { formatOffset, parseZoneInfo, isUndefined, objToLocalTS } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nconst dtfCache = new Map();\nfunction makeDTF(zoneName) {\n let dtf = dtfCache.get(zoneName);\n if (dtf === undefined) {\n dtf = new Intl.DateTimeFormat(\"en-US\", {\n hour12: false,\n timeZone: zoneName,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n era: \"short\",\n });\n dtfCache.set(zoneName, dtf);\n }\n return dtf;\n}\n\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n era: 3,\n hour: 4,\n minute: 5,\n second: 6,\n};\n\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, \"\"),\n parsed = /(\\d+)\\/(\\d+)\\/(\\d+) (AD|BC),? (\\d+):(\\d+):(\\d+)/.exec(formatted),\n [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;\n return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];\n}\n\nfunction partsOffset(dtf, date) {\n const formatted = dtf.formatToParts(date);\n const filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const { type, value } = formatted[i];\n const pos = typeToPos[type];\n\n if (type === \"era\") {\n filled[pos] = value;\n } else if (!isUndefined(pos)) {\n filled[pos] = parseInt(value, 10);\n }\n }\n return filled;\n}\n\nconst ianaZoneCache = new Map();\n/**\n * A zone identified by an IANA identifier, like America/New_York\n * @implements {Zone}\n */\nexport default class IANAZone extends Zone {\n /**\n * @param {string} name - Zone name\n * @return {IANAZone}\n */\n static create(name) {\n let zone = ianaZoneCache.get(name);\n if (zone === undefined) {\n ianaZoneCache.set(name, (zone = new IANAZone(name)));\n }\n return zone;\n }\n\n /**\n * Reset local caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCache() {\n ianaZoneCache.clear();\n dtfCache.clear();\n }\n\n /**\n * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.\n * @param {string} s - The string to check validity on\n * @example IANAZone.isValidSpecifier(\"America/New_York\") //=> true\n * @example IANAZone.isValidSpecifier(\"Sport~~blorp\") //=> false\n * @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead.\n * @return {boolean}\n */\n static isValidSpecifier(s) {\n return this.isValidZone(s);\n }\n\n /**\n * Returns whether the provided string identifies a real zone\n * @param {string} zone - The string to check\n * @example IANAZone.isValidZone(\"America/New_York\") //=> true\n * @example IANAZone.isValidZone(\"Fantasia/Castle\") //=> false\n * @example IANAZone.isValidZone(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidZone(zone) {\n if (!zone) {\n return false;\n }\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: zone }).format();\n return true;\n } catch (e) {\n return false;\n }\n }\n\n constructor(name) {\n super();\n /** @private **/\n this.zoneName = name;\n /** @private **/\n this.valid = IANAZone.isValidZone(name);\n }\n\n /**\n * The type of zone. `iana` for all instances of `IANAZone`.\n * @override\n * @type {string}\n */\n get type() {\n return \"iana\";\n }\n\n /**\n * The name of this zone (i.e. the IANA zone name).\n * @override\n * @type {string}\n */\n get name() {\n return this.zoneName;\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year:\n * Always returns false for all IANA zones.\n * @override\n * @type {boolean}\n */\n get isUniversal() {\n return false;\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale, this.name);\n }\n\n /**\n * Returns the offset's value as a string\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @override\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n if (!this.valid) return NaN;\n const date = new Date(ts);\n\n if (isNaN(date)) return NaN;\n\n const dtf = makeDTF(this.name);\n let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts\n ? partsOffset(dtf, date)\n : hackyOffset(dtf, date);\n\n if (adOrBc === \"BC\") {\n year = -Math.abs(year) + 1;\n }\n\n // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat\n const adjustedHour = hour === 24 ? 0 : hour;\n\n const asUTC = objToLocalTS({\n year,\n month,\n day,\n hour: adjustedHour,\n minute,\n second,\n millisecond: 0,\n });\n\n let asTS = +date;\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return (asUTC - asTS) / (60 * 1000);\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @override\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n return otherZone.type === \"iana\" && otherZone.name === this.name;\n }\n\n /**\n * Return whether this Zone is valid.\n * @override\n * @type {boolean}\n */\n get isValid() {\n return this.valid;\n }\n}\n","import { hasLocaleWeekInfo, hasRelative, padStart, roundTo, validateWeekSettings } from \"./util.js\";\nimport * as English from \"./english.js\";\nimport Settings from \"../settings.js\";\nimport DateTime from \"../datetime.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n// todo - remap caching\n\nlet intlLFCache = {};\nfunction getCachedLF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlLFCache[key];\n if (!dtf) {\n dtf = new Intl.ListFormat(locString, opts);\n intlLFCache[key] = dtf;\n }\n return dtf;\n}\n\nconst intlDTCache = new Map();\nfunction getCachedDTF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlDTCache.get(key);\n if (dtf === undefined) {\n dtf = new Intl.DateTimeFormat(locString, opts);\n intlDTCache.set(key, dtf);\n }\n return dtf;\n}\n\nconst intlNumCache = new Map();\nfunction getCachedINF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let inf = intlNumCache.get(key);\n if (inf === undefined) {\n inf = new Intl.NumberFormat(locString, opts);\n intlNumCache.set(key, inf);\n }\n return inf;\n}\n\nconst intlRelCache = new Map();\nfunction getCachedRTF(locString, opts = {}) {\n const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options\n const key = JSON.stringify([locString, cacheKeyOpts]);\n let inf = intlRelCache.get(key);\n if (inf === undefined) {\n inf = new Intl.RelativeTimeFormat(locString, opts);\n intlRelCache.set(key, inf);\n }\n return inf;\n}\n\nlet sysLocaleCache = null;\nfunction systemLocale() {\n if (sysLocaleCache) {\n return sysLocaleCache;\n } else {\n sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;\n return sysLocaleCache;\n }\n}\n\nconst intlResolvedOptionsCache = new Map();\nfunction getCachedIntResolvedOptions(locString) {\n let opts = intlResolvedOptionsCache.get(locString);\n if (opts === undefined) {\n opts = new Intl.DateTimeFormat(locString).resolvedOptions();\n intlResolvedOptionsCache.set(locString, opts);\n }\n return opts;\n}\n\nconst weekInfoCache = new Map();\nfunction getCachedWeekInfo(locString) {\n let data = weekInfoCache.get(locString);\n if (!data) {\n const locale = new Intl.Locale(locString);\n // browsers currently implement this as a property, but spec says it should be a getter function\n data = \"getWeekInfo\" in locale ? locale.getWeekInfo() : locale.weekInfo;\n // minimalDays was removed from WeekInfo: https://github.com/tc39/proposal-intl-locale-info/issues/86\n if (!(\"minimalDays\" in data)) {\n data = { ...fallbackWeekSettings, ...data };\n }\n weekInfoCache.set(locString, data);\n }\n return data;\n}\n\nfunction parseLocaleString(localeStr) {\n // I really want to avoid writing a BCP 47 parser\n // see, e.g. https://github.com/wooorm/bcp-47\n // Instead, we'll do this:\n\n // a) if the string has no -u extensions, just leave it alone\n // b) if it does, use Intl to resolve everything\n // c) if Intl fails, try again without the -u\n\n // private subtags and unicode subtags have ordering requirements,\n // and we're not properly parsing this, so just strip out the\n // private ones if they exist.\n const xIndex = localeStr.indexOf(\"-x-\");\n if (xIndex !== -1) {\n localeStr = localeStr.substring(0, xIndex);\n }\n\n const uIndex = localeStr.indexOf(\"-u-\");\n if (uIndex === -1) {\n return [localeStr];\n } else {\n let options;\n let selectedStr;\n try {\n options = getCachedDTF(localeStr).resolvedOptions();\n selectedStr = localeStr;\n } catch (e) {\n const smaller = localeStr.substring(0, uIndex);\n options = getCachedDTF(smaller).resolvedOptions();\n selectedStr = smaller;\n }\n\n const { numberingSystem, calendar } = options;\n return [selectedStr, numberingSystem, calendar];\n }\n}\n\nfunction intlConfigString(localeStr, numberingSystem, outputCalendar) {\n if (outputCalendar || numberingSystem) {\n if (!localeStr.includes(\"-u-\")) {\n localeStr += \"-u\";\n }\n\n if (outputCalendar) {\n localeStr += `-ca-${outputCalendar}`;\n }\n\n if (numberingSystem) {\n localeStr += `-nu-${numberingSystem}`;\n }\n return localeStr;\n } else {\n return localeStr;\n }\n}\n\nfunction mapMonths(f) {\n const ms = [];\n for (let i = 1; i <= 12; i++) {\n const dt = DateTime.utc(2009, i, 1);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction mapWeekdays(f) {\n const ms = [];\n for (let i = 1; i <= 7; i++) {\n const dt = DateTime.utc(2016, 11, 13 + i);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction listStuff(loc, length, englishFn, intlFn) {\n const mode = loc.listingMode();\n\n if (mode === \"error\") {\n return null;\n } else if (mode === \"en\") {\n return englishFn(length);\n } else {\n return intlFn(length);\n }\n}\n\nfunction supportsFastNumbers(loc) {\n if (loc.numberingSystem && loc.numberingSystem !== \"latn\") {\n return false;\n } else {\n return (\n loc.numberingSystem === \"latn\" ||\n !loc.locale ||\n loc.locale.startsWith(\"en\") ||\n getCachedIntResolvedOptions(loc.locale).numberingSystem === \"latn\"\n );\n }\n}\n\n/**\n * @private\n */\n\nclass PolyNumberFormatter {\n constructor(intl, forceSimple, opts) {\n this.padTo = opts.padTo || 0;\n this.floor = opts.floor || false;\n\n const { padTo, floor, ...otherOpts } = opts;\n\n if (!forceSimple || Object.keys(otherOpts).length > 0) {\n const intlOpts = { useGrouping: false, ...opts };\n if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;\n this.inf = getCachedINF(intl, intlOpts);\n }\n }\n\n format(i) {\n if (this.inf) {\n const fixed = this.floor ? Math.floor(i) : i;\n return this.inf.format(fixed);\n } else {\n // to match the browser's numberformatter defaults\n const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);\n return padStart(fixed, this.padTo);\n }\n }\n}\n\n/**\n * @private\n */\n\nclass PolyDateFormatter {\n constructor(dt, intl, opts) {\n this.opts = opts;\n this.originalZone = undefined;\n\n let z = undefined;\n if (this.opts.timeZone) {\n // Don't apply any workarounds if a timeZone is explicitly provided in opts\n this.dt = dt;\n } else if (dt.zone.type === \"fixed\") {\n // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like.\n // That is why fixed-offset TZ is set to that unless it is:\n // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT.\n // 2. Unsupported by the browser:\n // - some do not support Etc/\n // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata\n const gmtOffset = -1 * (dt.offset / 60);\n const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;\n if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {\n z = offsetZ;\n this.dt = dt;\n } else {\n // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so\n // we manually apply the offset and substitute the zone as needed.\n z = \"UTC\";\n this.dt = dt.offset === 0 ? dt : dt.setZone(\"UTC\").plus({ minutes: dt.offset });\n this.originalZone = dt.zone;\n }\n } else if (dt.zone.type === \"system\") {\n this.dt = dt;\n } else if (dt.zone.type === \"iana\") {\n this.dt = dt;\n z = dt.zone.name;\n } else {\n // Custom zones can have any offset / offsetName so we just manually\n // apply the offset and substitute the zone as needed.\n z = \"UTC\";\n this.dt = dt.setZone(\"UTC\").plus({ minutes: dt.offset });\n this.originalZone = dt.zone;\n }\n\n const intlOpts = { ...this.opts };\n intlOpts.timeZone = intlOpts.timeZone || z;\n this.dtf = getCachedDTF(intl, intlOpts);\n }\n\n format() {\n if (this.originalZone) {\n // If we have to substitute in the actual zone name, we have to use\n // formatToParts so that the timezone can be replaced.\n return this.formatToParts()\n .map(({ value }) => value)\n .join(\"\");\n }\n return this.dtf.format(this.dt.toJSDate());\n }\n\n formatToParts() {\n const parts = this.dtf.formatToParts(this.dt.toJSDate());\n if (this.originalZone) {\n return parts.map((part) => {\n if (part.type === \"timeZoneName\") {\n const offsetName = this.originalZone.offsetName(this.dt.ts, {\n locale: this.dt.locale,\n format: this.opts.timeZoneName,\n });\n return {\n ...part,\n value: offsetName,\n };\n } else {\n return part;\n }\n });\n }\n return parts;\n }\n\n resolvedOptions() {\n return this.dtf.resolvedOptions();\n }\n}\n\n/**\n * @private\n */\nclass PolyRelFormatter {\n constructor(intl, isEnglish, opts) {\n this.opts = { style: \"long\", ...opts };\n if (!isEnglish && hasRelative()) {\n this.rtf = getCachedRTF(intl, opts);\n }\n }\n\n format(count, unit) {\n if (this.rtf) {\n return this.rtf.format(count, unit);\n } else {\n return English.formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== \"long\");\n }\n }\n\n formatToParts(count, unit) {\n if (this.rtf) {\n return this.rtf.formatToParts(count, unit);\n } else {\n return [];\n }\n }\n}\n\nconst fallbackWeekSettings = {\n firstDay: 1,\n minimalDays: 4,\n weekend: [6, 7],\n};\n\n/**\n * @private\n */\nexport default class Locale {\n static fromOpts(opts) {\n return Locale.create(\n opts.locale,\n opts.numberingSystem,\n opts.outputCalendar,\n opts.weekSettings,\n opts.defaultToEN\n );\n }\n\n static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {\n const specifiedLocale = locale || Settings.defaultLocale;\n // the system locale is useful for human-readable strings but annoying for parsing/formatting known formats\n const localeR = specifiedLocale || (defaultToEN ? \"en-US\" : systemLocale());\n const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;\n const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;\n const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;\n return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);\n }\n\n static resetCache() {\n sysLocaleCache = null;\n intlDTCache.clear();\n intlNumCache.clear();\n intlRelCache.clear();\n intlResolvedOptionsCache.clear();\n weekInfoCache.clear();\n }\n\n static fromObject({ locale, numberingSystem, outputCalendar, weekSettings } = {}) {\n return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);\n }\n\n constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {\n const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);\n\n this.locale = parsedLocale;\n this.numberingSystem = numbering || parsedNumberingSystem || null;\n this.outputCalendar = outputCalendar || parsedOutputCalendar || null;\n this.weekSettings = weekSettings;\n this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);\n\n this.weekdaysCache = { format: {}, standalone: {} };\n this.monthsCache = { format: {}, standalone: {} };\n this.meridiemCache = null;\n this.eraCache = {};\n\n this.specifiedLocale = specifiedLocale;\n this.fastNumbersCached = null;\n }\n\n get fastNumbers() {\n if (this.fastNumbersCached == null) {\n this.fastNumbersCached = supportsFastNumbers(this);\n }\n\n return this.fastNumbersCached;\n }\n\n listingMode() {\n const isActuallyEn = this.isEnglish();\n const hasNoWeirdness =\n (this.numberingSystem === null || this.numberingSystem === \"latn\") &&\n (this.outputCalendar === null || this.outputCalendar === \"gregory\");\n return isActuallyEn && hasNoWeirdness ? \"en\" : \"intl\";\n }\n\n clone(alts) {\n if (!alts || Object.getOwnPropertyNames(alts).length === 0) {\n return this;\n } else {\n return Locale.create(\n alts.locale || this.specifiedLocale,\n alts.numberingSystem || this.numberingSystem,\n alts.outputCalendar || this.outputCalendar,\n validateWeekSettings(alts.weekSettings) || this.weekSettings,\n alts.defaultToEN || false\n );\n }\n }\n\n redefaultToEN(alts = {}) {\n return this.clone({ ...alts, defaultToEN: true });\n }\n\n redefaultToSystem(alts = {}) {\n return this.clone({ ...alts, defaultToEN: false });\n }\n\n months(length, format = false) {\n return listStuff(this, length, English.months, () => {\n // Workaround for \"ja\" locale: formatToParts does not label all parts of the month\n // as \"month\" and for this locale there is no difference between \"format\" and \"non-format\".\n // As such, just use format() instead of formatToParts() and take the whole string\n const monthSpecialCase = this.intl === \"ja\" || this.intl.startsWith(\"ja-\");\n format &= !monthSpecialCase;\n const intl = format ? { month: length, day: \"numeric\" } : { month: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.monthsCache[formatStr][length]) {\n const mapper = !monthSpecialCase\n ? (dt) => this.extract(dt, intl, \"month\")\n : (dt) => this.dtFormatter(dt, intl).format();\n this.monthsCache[formatStr][length] = mapMonths(mapper);\n }\n return this.monthsCache[formatStr][length];\n });\n }\n\n weekdays(length, format = false) {\n return listStuff(this, length, English.weekdays, () => {\n const intl = format\n ? { weekday: length, year: \"numeric\", month: \"long\", day: \"numeric\" }\n : { weekday: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.weekdaysCache[formatStr][length]) {\n this.weekdaysCache[formatStr][length] = mapWeekdays((dt) =>\n this.extract(dt, intl, \"weekday\")\n );\n }\n return this.weekdaysCache[formatStr][length];\n });\n }\n\n meridiems() {\n return listStuff(\n this,\n undefined,\n () => English.meridiems,\n () => {\n // In theory there could be aribitrary day periods. We're gonna assume there are exactly two\n // for AM and PM. This is probably wrong, but it's makes parsing way easier.\n if (!this.meridiemCache) {\n const intl = { hour: \"numeric\", hourCycle: \"h12\" };\n this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(\n (dt) => this.extract(dt, intl, \"dayperiod\")\n );\n }\n\n return this.meridiemCache;\n }\n );\n }\n\n eras(length) {\n return listStuff(this, length, English.eras, () => {\n const intl = { era: length };\n\n // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates\n // to definitely enumerate them.\n if (!this.eraCache[length]) {\n this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map((dt) =>\n this.extract(dt, intl, \"era\")\n );\n }\n\n return this.eraCache[length];\n });\n }\n\n extract(dt, intlOpts, field) {\n const df = this.dtFormatter(dt, intlOpts),\n results = df.formatToParts(),\n matching = results.find((m) => m.type.toLowerCase() === field);\n return matching ? matching.value : null;\n }\n\n numberFormatter(opts = {}) {\n // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave)\n // (in contrast, the rest of the condition is used heavily)\n return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);\n }\n\n dtFormatter(dt, intlOpts = {}) {\n return new PolyDateFormatter(dt, this.intl, intlOpts);\n }\n\n relFormatter(opts = {}) {\n return new PolyRelFormatter(this.intl, this.isEnglish(), opts);\n }\n\n listFormatter(opts = {}) {\n return getCachedLF(this.intl, opts);\n }\n\n isEnglish() {\n return (\n this.locale === \"en\" ||\n this.locale.toLowerCase() === \"en-us\" ||\n getCachedIntResolvedOptions(this.intl).locale.startsWith(\"en-us\")\n );\n }\n\n getWeekSettings() {\n if (this.weekSettings) {\n return this.weekSettings;\n } else if (!hasLocaleWeekInfo()) {\n return fallbackWeekSettings;\n } else {\n return getCachedWeekInfo(this.locale);\n }\n }\n\n getStartOfWeek() {\n return this.getWeekSettings().firstDay;\n }\n\n getMinDaysInFirstWeek() {\n return this.getWeekSettings().minimalDays;\n }\n\n getWeekendDays() {\n return this.getWeekSettings().weekend;\n }\n\n equals(other) {\n return (\n this.locale === other.locale &&\n this.numberingSystem === other.numberingSystem &&\n this.outputCalendar === other.outputCalendar\n );\n }\n\n toString() {\n return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;\n }\n}\n","import { formatOffset, signedOffset } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * A zone with a fixed offset (meaning no DST)\n * @implements {Zone}\n */\nexport default class FixedOffsetZone extends Zone {\n /**\n * Get a singleton instance of UTC\n * @return {FixedOffsetZone}\n */\n static get utcInstance() {\n if (singleton === null) {\n singleton = new FixedOffsetZone(0);\n }\n return singleton;\n }\n\n /**\n * Get an instance with a specified offset\n * @param {number} offset - The offset in minutes\n * @return {FixedOffsetZone}\n */\n static instance(offset) {\n return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);\n }\n\n /**\n * Get an instance of FixedOffsetZone from a UTC offset string, like \"UTC+6\"\n * @param {string} s - The offset string to parse\n * @example FixedOffsetZone.parseSpecifier(\"UTC+6\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC+06\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC-6:00\")\n * @return {FixedOffsetZone}\n */\n static parseSpecifier(s) {\n if (s) {\n const r = s.match(/^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$/i);\n if (r) {\n return new FixedOffsetZone(signedOffset(r[1], r[2]));\n }\n }\n return null;\n }\n\n constructor(offset) {\n super();\n /** @private **/\n this.fixed = offset;\n }\n\n /**\n * The type of zone. `fixed` for all instances of `FixedOffsetZone`.\n * @override\n * @type {string}\n */\n get type() {\n return \"fixed\";\n }\n\n /**\n * The name of this zone.\n * All fixed zones' names always start with \"UTC\" (plus optional offset)\n * @override\n * @type {string}\n */\n get name() {\n return this.fixed === 0 ? \"UTC\" : `UTC${formatOffset(this.fixed, \"narrow\")}`;\n }\n\n /**\n * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`\n *\n * @override\n * @type {string}\n */\n get ianaName() {\n if (this.fixed === 0) {\n return \"Etc/UTC\";\n } else {\n return `Etc/GMT${formatOffset(-this.fixed, \"narrow\")}`;\n }\n }\n\n /**\n * Returns the offset's common name at the specified timestamp.\n *\n * For fixed offset zones this equals to the zone name.\n * @override\n */\n offsetName() {\n return this.name;\n }\n\n /**\n * Returns the offset's value as a string\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n return formatOffset(this.fixed, format);\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year:\n * Always returns true for all fixed offset zones.\n * @override\n * @type {boolean}\n */\n get isUniversal() {\n return true;\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n *\n * For fixed offset zones, this is constant and does not depend on a timestamp.\n * @override\n * @return {number}\n */\n offset() {\n return this.fixed;\n }\n\n /**\n * Return whether this Zone is equal to another zone (i.e. also fixed and same offset)\n * @override\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n return otherZone.type === \"fixed\" && otherZone.fixed === this.fixed;\n }\n\n /**\n * Return whether this Zone is valid:\n * All fixed offset zones are valid.\n * @override\n * @type {boolean}\n */\n get isValid() {\n return true;\n }\n}\n","import Zone from \"../zone.js\";\n\n/**\n * A zone that failed to parse. You should never need to instantiate this.\n * @implements {Zone}\n */\nexport default class InvalidZone extends Zone {\n constructor(zoneName) {\n super();\n /** @private */\n this.zoneName = zoneName;\n }\n\n /** @override **/\n get type() {\n return \"invalid\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName() {\n return null;\n }\n\n /** @override **/\n formatOffset() {\n return \"\";\n }\n\n /** @override **/\n offset() {\n return NaN;\n }\n\n /** @override **/\n equals() {\n return false;\n }\n\n /** @override **/\n get isValid() {\n return false;\n }\n}\n","/**\n * @private\n */\n\nimport Zone from \"../zone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport InvalidZone from \"../zones/invalidZone.js\";\n\nimport { isUndefined, isString, isNumber } from \"./util.js\";\nimport SystemZone from \"../zones/systemZone.js\";\n\nexport function normalizeZone(input, defaultZone) {\n let offset;\n if (isUndefined(input) || input === null) {\n return defaultZone;\n } else if (input instanceof Zone) {\n return input;\n } else if (isString(input)) {\n const lowered = input.toLowerCase();\n if (lowered === \"default\") return defaultZone;\n else if (lowered === \"local\" || lowered === \"system\") return SystemZone.instance;\n else if (lowered === \"utc\" || lowered === \"gmt\") return FixedOffsetZone.utcInstance;\n else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);\n } else if (isNumber(input)) {\n return FixedOffsetZone.instance(input);\n } else if (typeof input === \"object\" && \"offset\" in input && typeof input.offset === \"function\") {\n // This is dumb, but the instanceof check above doesn't seem to really work\n // so we're duck checking it\n return input;\n } else {\n return new InvalidZone(input);\n }\n}\n","const numberingSystems = {\n arab: \"[\\u0660-\\u0669]\",\n arabext: \"[\\u06F0-\\u06F9]\",\n bali: \"[\\u1B50-\\u1B59]\",\n beng: \"[\\u09E6-\\u09EF]\",\n deva: \"[\\u0966-\\u096F]\",\n fullwide: \"[\\uFF10-\\uFF19]\",\n gujr: \"[\\u0AE6-\\u0AEF]\",\n hanidec: \"[〇|一|二|三|四|五|六|七|八|九]\",\n khmr: \"[\\u17E0-\\u17E9]\",\n knda: \"[\\u0CE6-\\u0CEF]\",\n laoo: \"[\\u0ED0-\\u0ED9]\",\n limb: \"[\\u1946-\\u194F]\",\n mlym: \"[\\u0D66-\\u0D6F]\",\n mong: \"[\\u1810-\\u1819]\",\n mymr: \"[\\u1040-\\u1049]\",\n orya: \"[\\u0B66-\\u0B6F]\",\n tamldec: \"[\\u0BE6-\\u0BEF]\",\n telu: \"[\\u0C66-\\u0C6F]\",\n thai: \"[\\u0E50-\\u0E59]\",\n tibt: \"[\\u0F20-\\u0F29]\",\n latn: \"\\\\d\",\n};\n\nconst numberingSystemsUTF16 = {\n arab: [1632, 1641],\n arabext: [1776, 1785],\n bali: [6992, 7001],\n beng: [2534, 2543],\n deva: [2406, 2415],\n fullwide: [65296, 65303],\n gujr: [2790, 2799],\n khmr: [6112, 6121],\n knda: [3302, 3311],\n laoo: [3792, 3801],\n limb: [6470, 6479],\n mlym: [3430, 3439],\n mong: [6160, 6169],\n mymr: [4160, 4169],\n orya: [2918, 2927],\n tamldec: [3046, 3055],\n telu: [3174, 3183],\n thai: [3664, 3673],\n tibt: [3872, 3881],\n};\n\nconst hanidecChars = numberingSystems.hanidec.replace(/[\\[|\\]]/g, \"\").split(\"\");\n\nexport function parseDigits(str) {\n let value = parseInt(str, 10);\n if (isNaN(value)) {\n value = \"\";\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (str[i].search(numberingSystems.hanidec) !== -1) {\n value += hanidecChars.indexOf(str[i]);\n } else {\n for (const key in numberingSystemsUTF16) {\n const [min, max] = numberingSystemsUTF16[key];\n if (code >= min && code <= max) {\n value += code - min;\n }\n }\n }\n }\n return parseInt(value, 10);\n } else {\n return value;\n }\n}\n\n// cache of {numberingSystem: {append: regex}}\nconst digitRegexCache = new Map();\nexport function resetDigitRegexCache() {\n digitRegexCache.clear();\n}\n\nexport function digitRegex({ numberingSystem }, append = \"\") {\n const ns = numberingSystem || \"latn\";\n\n let appendCache = digitRegexCache.get(ns);\n if (appendCache === undefined) {\n appendCache = new Map();\n digitRegexCache.set(ns, appendCache);\n }\n let regex = appendCache.get(append);\n if (regex === undefined) {\n regex = new RegExp(`${numberingSystems[ns]}${append}`);\n appendCache.set(append, regex);\n }\n\n return regex;\n}\n","import SystemZone from \"./zones/systemZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport DateTime from \"./datetime.js\";\n\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport { validateWeekSettings } from \"./impl/util.js\";\nimport { resetDigitRegexCache } from \"./impl/digits.js\";\n\nlet now = () => Date.now(),\n defaultZone = \"system\",\n defaultLocale = null,\n defaultNumberingSystem = null,\n defaultOutputCalendar = null,\n twoDigitCutoffYear = 60,\n throwOnInvalid,\n defaultWeekSettings = null;\n\n/**\n * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.\n */\nexport default class Settings {\n /**\n * Get the callback for returning the current timestamp.\n * @type {function}\n */\n static get now() {\n return now;\n }\n\n /**\n * Set the callback for returning the current timestamp.\n * The function should return a number, which will be interpreted as an Epoch millisecond count\n * @type {function}\n * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future\n * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time\n */\n static set now(n) {\n now = n;\n }\n\n /**\n * Set the default time zone to create DateTimes in. Does not affect existing instances.\n * Use the value \"system\" to reset this value to the system's time zone.\n * @type {string}\n */\n static set defaultZone(zone) {\n defaultZone = zone;\n }\n\n /**\n * Get the default time zone object currently used to create DateTimes. Does not affect existing instances.\n * The default value is the system's time zone (the one set on the machine that runs this code).\n * @type {Zone}\n */\n static get defaultZone() {\n return normalizeZone(defaultZone, SystemZone.instance);\n }\n\n /**\n * Get the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultLocale() {\n return defaultLocale;\n }\n\n /**\n * Set the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultLocale(locale) {\n defaultLocale = locale;\n }\n\n /**\n * Get the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultNumberingSystem() {\n return defaultNumberingSystem;\n }\n\n /**\n * Set the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultNumberingSystem(numberingSystem) {\n defaultNumberingSystem = numberingSystem;\n }\n\n /**\n * Get the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultOutputCalendar() {\n return defaultOutputCalendar;\n }\n\n /**\n * Set the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultOutputCalendar(outputCalendar) {\n defaultOutputCalendar = outputCalendar;\n }\n\n /**\n * @typedef {Object} WeekSettings\n * @property {number} firstDay\n * @property {number} minimalDays\n * @property {number[]} weekend\n */\n\n /**\n * @return {WeekSettings|null}\n */\n static get defaultWeekSettings() {\n return defaultWeekSettings;\n }\n\n /**\n * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and\n * how many days are required in the first week of a year.\n * Does not affect existing instances.\n *\n * @param {WeekSettings|null} weekSettings\n */\n static set defaultWeekSettings(weekSettings) {\n defaultWeekSettings = validateWeekSettings(weekSettings);\n }\n\n /**\n * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.\n * @type {number}\n */\n static get twoDigitCutoffYear() {\n return twoDigitCutoffYear;\n }\n\n /**\n * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.\n * @type {number}\n * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century\n * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century\n * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950\n * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50\n * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50\n */\n static set twoDigitCutoffYear(cutoffYear) {\n twoDigitCutoffYear = cutoffYear % 100;\n }\n\n /**\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static get throwOnInvalid() {\n return throwOnInvalid;\n }\n\n /**\n * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static set throwOnInvalid(t) {\n throwOnInvalid = t;\n }\n\n /**\n * Reset Luxon's global caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCaches() {\n Locale.resetCache();\n IANAZone.resetCache();\n DateTime.resetCache();\n resetDigitRegexCache();\n }\n}\n","export default class Invalid {\n constructor(reason, explanation) {\n this.reason = reason;\n this.explanation = explanation;\n }\n\n toMessage() {\n if (this.explanation) {\n return `${this.reason}: ${this.explanation}`;\n } else {\n return this.reason;\n }\n }\n}\n","import {\n integerBetween,\n isLeapYear,\n timeObject,\n daysInYear,\n daysInMonth,\n weeksInWeekYear,\n isInteger,\n isUndefined,\n} from \"./util.js\";\nimport Invalid from \"./invalid.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],\n leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];\n\nfunction unitOutOfRange(unit, value) {\n return new Invalid(\n \"unit out of range\",\n `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`\n );\n}\n\nexport function dayOfWeek(year, month, day) {\n const d = new Date(Date.UTC(year, month - 1, day));\n\n if (year < 100 && year >= 0) {\n d.setUTCFullYear(d.getUTCFullYear() - 1900);\n }\n\n const js = d.getUTCDay();\n\n return js === 0 ? 7 : js;\n}\n\nfunction computeOrdinal(year, month, day) {\n return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];\n}\n\nfunction uncomputeOrdinal(year, ordinal) {\n const table = isLeapYear(year) ? leapLadder : nonLeapLadder,\n month0 = table.findIndex((i) => i < ordinal),\n day = ordinal - table[month0];\n return { month: month0 + 1, day };\n}\n\nexport function isoWeekdayToLocal(isoWeekday, startOfWeek) {\n return ((isoWeekday - startOfWeek + 7) % 7) + 1;\n}\n\n/**\n * @private\n */\n\nexport function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const { year, month, day } = gregObj,\n ordinal = computeOrdinal(year, month, day),\n weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);\n\n let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7),\n weekYear;\n\n if (weekNumber < 1) {\n weekYear = year - 1;\n weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);\n } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {\n weekYear = year + 1;\n weekNumber = 1;\n } else {\n weekYear = year;\n }\n\n return { weekYear, weekNumber, weekday, ...timeObject(gregObj) };\n}\n\nexport function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const { weekYear, weekNumber, weekday } = weekData,\n weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek),\n yearInDays = daysInYear(weekYear);\n\n let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek,\n year;\n\n if (ordinal < 1) {\n year = weekYear - 1;\n ordinal += daysInYear(year);\n } else if (ordinal > yearInDays) {\n year = weekYear + 1;\n ordinal -= daysInYear(weekYear);\n } else {\n year = weekYear;\n }\n\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(weekData) };\n}\n\nexport function gregorianToOrdinal(gregData) {\n const { year, month, day } = gregData;\n const ordinal = computeOrdinal(year, month, day);\n return { year, ordinal, ...timeObject(gregData) };\n}\n\nexport function ordinalToGregorian(ordinalData) {\n const { year, ordinal } = ordinalData;\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(ordinalData) };\n}\n\n/**\n * Check if local week units like localWeekday are used in obj.\n * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties.\n * Modifies obj in-place!\n * @param obj the object values\n */\nexport function usesLocalWeekValues(obj, loc) {\n const hasLocaleWeekData =\n !isUndefined(obj.localWeekday) ||\n !isUndefined(obj.localWeekNumber) ||\n !isUndefined(obj.localWeekYear);\n if (hasLocaleWeekData) {\n const hasIsoWeekData =\n !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);\n\n if (hasIsoWeekData) {\n throw new ConflictingSpecificationError(\n \"Cannot mix locale-based week fields with ISO-based week fields\"\n );\n }\n if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;\n if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;\n if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;\n delete obj.localWeekday;\n delete obj.localWeekNumber;\n delete obj.localWeekYear;\n return {\n minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),\n startOfWeek: loc.getStartOfWeek(),\n };\n } else {\n return { minDaysInFirstWeek: 4, startOfWeek: 1 };\n }\n}\n\nexport function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const validYear = isInteger(obj.weekYear),\n validWeek = integerBetween(\n obj.weekNumber,\n 1,\n weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)\n ),\n validWeekday = integerBetween(obj.weekday, 1, 7);\n\n if (!validYear) {\n return unitOutOfRange(\"weekYear\", obj.weekYear);\n } else if (!validWeek) {\n return unitOutOfRange(\"week\", obj.weekNumber);\n } else if (!validWeekday) {\n return unitOutOfRange(\"weekday\", obj.weekday);\n } else return false;\n}\n\nexport function hasInvalidOrdinalData(obj) {\n const validYear = isInteger(obj.year),\n validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validOrdinal) {\n return unitOutOfRange(\"ordinal\", obj.ordinal);\n } else return false;\n}\n\nexport function hasInvalidGregorianData(obj) {\n const validYear = isInteger(obj.year),\n validMonth = integerBetween(obj.month, 1, 12),\n validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validMonth) {\n return unitOutOfRange(\"month\", obj.month);\n } else if (!validDay) {\n return unitOutOfRange(\"day\", obj.day);\n } else return false;\n}\n\nexport function hasInvalidTimeData(obj) {\n const { hour, minute, second, millisecond } = obj;\n const validHour =\n integerBetween(hour, 0, 23) ||\n (hour === 24 && minute === 0 && second === 0 && millisecond === 0),\n validMinute = integerBetween(minute, 0, 59),\n validSecond = integerBetween(second, 0, 59),\n validMillisecond = integerBetween(millisecond, 0, 999);\n\n if (!validHour) {\n return unitOutOfRange(\"hour\", hour);\n } else if (!validMinute) {\n return unitOutOfRange(\"minute\", minute);\n } else if (!validSecond) {\n return unitOutOfRange(\"second\", second);\n } else if (!validMillisecond) {\n return unitOutOfRange(\"millisecond\", millisecond);\n } else return false;\n}\n","/*\n This is just a junk drawer, containing anything used across multiple classes.\n Because Luxon is small(ish), this should stay small and we won't worry about splitting\n it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.\n*/\n\nimport { InvalidArgumentError } from \"../errors.js\";\nimport Settings from \"../settings.js\";\nimport { dayOfWeek, isoWeekdayToLocal } from \"./conversions.js\";\n\n/**\n * @private\n */\n\n// TYPES\n\nexport function isUndefined(o) {\n return typeof o === \"undefined\";\n}\n\nexport function isNumber(o) {\n return typeof o === \"number\";\n}\n\nexport function isInteger(o) {\n return typeof o === \"number\" && o % 1 === 0;\n}\n\nexport function isString(o) {\n return typeof o === \"string\";\n}\n\nexport function isDate(o) {\n return Object.prototype.toString.call(o) === \"[object Date]\";\n}\n\n// CAPABILITIES\n\nexport function hasRelative() {\n try {\n return typeof Intl !== \"undefined\" && !!Intl.RelativeTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\nexport function hasLocaleWeekInfo() {\n try {\n return (\n typeof Intl !== \"undefined\" &&\n !!Intl.Locale &&\n (\"weekInfo\" in Intl.Locale.prototype || \"getWeekInfo\" in Intl.Locale.prototype)\n );\n } catch (e) {\n return false;\n }\n}\n\n// OBJECTS AND ARRAYS\n\nexport function maybeArray(thing) {\n return Array.isArray(thing) ? thing : [thing];\n}\n\nexport function bestBy(arr, by, compare) {\n if (arr.length === 0) {\n return undefined;\n }\n return arr.reduce((best, next) => {\n const pair = [by(next), next];\n if (!best) {\n return pair;\n } else if (compare(best[0], pair[0]) === best[0]) {\n return best;\n } else {\n return pair;\n }\n }, null)[1];\n}\n\nexport function pick(obj, keys) {\n return keys.reduce((a, k) => {\n a[k] = obj[k];\n return a;\n }, {});\n}\n\nexport function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport function validateWeekSettings(settings) {\n if (settings == null) {\n return null;\n } else if (typeof settings !== \"object\") {\n throw new InvalidArgumentError(\"Week settings must be an object\");\n } else {\n if (\n !integerBetween(settings.firstDay, 1, 7) ||\n !integerBetween(settings.minimalDays, 1, 7) ||\n !Array.isArray(settings.weekend) ||\n settings.weekend.some((v) => !integerBetween(v, 1, 7))\n ) {\n throw new InvalidArgumentError(\"Invalid week settings\");\n }\n return {\n firstDay: settings.firstDay,\n minimalDays: settings.minimalDays,\n weekend: Array.from(settings.weekend),\n };\n }\n}\n\n// NUMBERS AND STRINGS\n\nexport function integerBetween(thing, bottom, top) {\n return isInteger(thing) && thing >= bottom && thing <= top;\n}\n\n// x % n but takes the sign of n instead of x\nexport function floorMod(x, n) {\n return x - n * Math.floor(x / n);\n}\n\nexport function padStart(input, n = 2) {\n const isNeg = input < 0;\n let padded;\n if (isNeg) {\n padded = \"-\" + (\"\" + -input).padStart(n, \"0\");\n } else {\n padded = (\"\" + input).padStart(n, \"0\");\n }\n return padded;\n}\n\nexport function parseInteger(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseInt(string, 10);\n }\n}\n\nexport function parseFloating(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseFloat(string);\n }\n}\n\nexport function parseMillis(fraction) {\n // Return undefined (instead of 0) in these cases, where fraction is not set\n if (isUndefined(fraction) || fraction === null || fraction === \"\") {\n return undefined;\n } else {\n const f = parseFloat(\"0.\" + fraction) * 1000;\n return Math.floor(f);\n }\n}\n\nexport function roundTo(number, digits, rounding = \"round\") {\n const factor = 10 ** digits;\n switch (rounding) {\n case \"expand\":\n return number > 0\n ? Math.ceil(number * factor) / factor\n : Math.floor(number * factor) / factor;\n case \"trunc\":\n return Math.trunc(number * factor) / factor;\n case \"round\":\n return Math.round(number * factor) / factor;\n case \"floor\":\n return Math.floor(number * factor) / factor;\n case \"ceil\":\n return Math.ceil(number * factor) / factor;\n default:\n throw new RangeError(`Value rounding ${rounding} is out of range`);\n }\n}\n\n// DATE BASICS\n\nexport function isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\nexport function daysInMonth(year, month) {\n const modMonth = floorMod(month - 1, 12) + 1,\n modYear = year + (month - modMonth) / 12;\n\n if (modMonth === 2) {\n return isLeapYear(modYear) ? 29 : 28;\n } else {\n return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];\n }\n}\n\n// convert a calendar object to a local timestamp (epoch, but with the offset baked in)\nexport function objToLocalTS(obj) {\n let d = Date.UTC(\n obj.year,\n obj.month - 1,\n obj.day,\n obj.hour,\n obj.minute,\n obj.second,\n obj.millisecond\n );\n\n // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that\n if (obj.year < 100 && obj.year >= 0) {\n d = new Date(d);\n // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not\n // so if obj.year is in 99, but obj.day makes it roll over into year 100,\n // the calculations done by Date.UTC are using year 2000 - which is incorrect\n d.setUTCFullYear(obj.year, obj.month - 1, obj.day);\n }\n return +d;\n}\n\n// adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js\nfunction firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {\n const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);\n return -fwdlw + minDaysInFirstWeek - 1;\n}\n\nexport function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);\n const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);\n return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;\n}\n\nexport function untruncateYear(year) {\n if (year > 99) {\n return year;\n } else return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year;\n}\n\n// PARSING\n\nexport function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {\n const date = new Date(ts),\n intlOpts = {\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n };\n\n if (timeZone) {\n intlOpts.timeZone = timeZone;\n }\n\n const modified = { timeZoneName: offsetFormat, ...intlOpts };\n\n const parsed = new Intl.DateTimeFormat(locale, modified)\n .formatToParts(date)\n .find((m) => m.type.toLowerCase() === \"timezonename\");\n return parsed ? parsed.value : null;\n}\n\n// signedOffset('-5', '30') -> -330\nexport function signedOffset(offHourStr, offMinuteStr) {\n let offHour = parseInt(offHourStr, 10);\n\n // don't || this because we want to preserve -0\n if (Number.isNaN(offHour)) {\n offHour = 0;\n }\n\n const offMin = parseInt(offMinuteStr, 10) || 0,\n offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;\n return offHour * 60 + offMinSigned;\n}\n\n// COERCION\n\nexport function asNumber(value) {\n const numericValue = Number(value);\n if (typeof value === \"boolean\" || value === \"\" || !Number.isFinite(numericValue))\n throw new InvalidArgumentError(`Invalid unit value ${value}`);\n return numericValue;\n}\n\nexport function normalizeObject(obj, normalizer) {\n const normalized = {};\n for (const u in obj) {\n if (hasOwnProperty(obj, u)) {\n const v = obj[u];\n if (v === undefined || v === null) continue;\n normalized[normalizer(u)] = asNumber(v);\n }\n }\n return normalized;\n}\n\n/**\n * Returns the offset's value as a string\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\nexport function formatOffset(offset, format) {\n const hours = Math.trunc(Math.abs(offset / 60)),\n minutes = Math.trunc(Math.abs(offset % 60)),\n sign = offset >= 0 ? \"+\" : \"-\";\n\n switch (format) {\n case \"short\":\n return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;\n case \"narrow\":\n return `${sign}${hours}${minutes > 0 ? `:${minutes}` : \"\"}`;\n case \"techie\":\n return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;\n default:\n throw new RangeError(`Value format ${format} is out of range for property format`);\n }\n}\n\nexport function timeObject(obj) {\n return pick(obj, [\"hour\", \"minute\", \"second\", \"millisecond\"]);\n}\n","import * as Formats from \"./formats.js\";\nimport { pick } from \"./util.js\";\n\nfunction stringify(obj) {\n return JSON.stringify(obj, Object.keys(obj).sort());\n}\n\n/**\n * @private\n */\n\nexport const monthsLong = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n];\n\nexport const monthsShort = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n];\n\nexport const monthsNarrow = [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"];\n\nexport function months(length) {\n switch (length) {\n case \"narrow\":\n return [...monthsNarrow];\n case \"short\":\n return [...monthsShort];\n case \"long\":\n return [...monthsLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"];\n case \"2-digit\":\n return [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\"];\n default:\n return null;\n }\n}\n\nexport const weekdaysLong = [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\",\n];\n\nexport const weekdaysShort = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nexport const weekdaysNarrow = [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"];\n\nexport function weekdays(length) {\n switch (length) {\n case \"narrow\":\n return [...weekdaysNarrow];\n case \"short\":\n return [...weekdaysShort];\n case \"long\":\n return [...weekdaysLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"];\n default:\n return null;\n }\n}\n\nexport const meridiems = [\"AM\", \"PM\"];\n\nexport const erasLong = [\"Before Christ\", \"Anno Domini\"];\n\nexport const erasShort = [\"BC\", \"AD\"];\n\nexport const erasNarrow = [\"B\", \"A\"];\n\nexport function eras(length) {\n switch (length) {\n case \"narrow\":\n return [...erasNarrow];\n case \"short\":\n return [...erasShort];\n case \"long\":\n return [...erasLong];\n default:\n return null;\n }\n}\n\nexport function meridiemForDateTime(dt) {\n return meridiems[dt.hour < 12 ? 0 : 1];\n}\n\nexport function weekdayForDateTime(dt, length) {\n return weekdays(length)[dt.weekday - 1];\n}\n\nexport function monthForDateTime(dt, length) {\n return months(length)[dt.month - 1];\n}\n\nexport function eraForDateTime(dt, length) {\n return eras(length)[dt.year < 0 ? 0 : 1];\n}\n\nexport function formatRelativeTime(unit, count, numeric = \"always\", narrow = false) {\n const units = {\n years: [\"year\", \"yr.\"],\n quarters: [\"quarter\", \"qtr.\"],\n months: [\"month\", \"mo.\"],\n weeks: [\"week\", \"wk.\"],\n days: [\"day\", \"day\", \"days\"],\n hours: [\"hour\", \"hr.\"],\n minutes: [\"minute\", \"min.\"],\n seconds: [\"second\", \"sec.\"],\n };\n\n const lastable = [\"hours\", \"minutes\", \"seconds\"].indexOf(unit) === -1;\n\n if (numeric === \"auto\" && lastable) {\n const isDay = unit === \"days\";\n switch (count) {\n case 1:\n return isDay ? \"tomorrow\" : `next ${units[unit][0]}`;\n case -1:\n return isDay ? \"yesterday\" : `last ${units[unit][0]}`;\n case 0:\n return isDay ? \"today\" : `this ${units[unit][0]}`;\n default: // fall through\n }\n }\n\n const isInPast = Object.is(count, -0) || count < 0,\n fmtValue = Math.abs(count),\n singular = fmtValue === 1,\n lilUnits = units[unit],\n fmtUnit = narrow\n ? singular\n ? lilUnits[1]\n : lilUnits[2] || lilUnits[1]\n : singular\n ? units[unit][0]\n : unit;\n return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;\n}\n\nexport function formatString(knownFormat) {\n // these all have the offsets removed because we don't have access to them\n // without all the intl stuff this is backfilling\n const filtered = pick(knownFormat, [\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n \"hourCycle\",\n ]),\n key = stringify(filtered),\n dateTimeHuge = \"EEEE, LLLL d, yyyy, h:mm a\";\n switch (key) {\n case stringify(Formats.DATE_SHORT):\n return \"M/d/yyyy\";\n case stringify(Formats.DATE_MED):\n return \"LLL d, yyyy\";\n case stringify(Formats.DATE_MED_WITH_WEEKDAY):\n return \"EEE, LLL d, yyyy\";\n case stringify(Formats.DATE_FULL):\n return \"LLLL d, yyyy\";\n case stringify(Formats.DATE_HUGE):\n return \"EEEE, LLLL d, yyyy\";\n case stringify(Formats.TIME_SIMPLE):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_SECONDS):\n return \"h:mm:ss a\";\n case stringify(Formats.TIME_WITH_SHORT_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_LONG_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_24_SIMPLE):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_SECONDS):\n return \"HH:mm:ss\";\n case stringify(Formats.TIME_24_WITH_SHORT_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_LONG_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.DATETIME_SHORT):\n return \"M/d/yyyy, h:mm a\";\n case stringify(Formats.DATETIME_MED):\n return \"LLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL):\n return \"LLLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_HUGE):\n return dateTimeHuge;\n case stringify(Formats.DATETIME_SHORT_WITH_SECONDS):\n return \"M/d/yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_SECONDS):\n return \"LLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_WEEKDAY):\n return \"EEE, d LLL yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL_WITH_SECONDS):\n return \"LLLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_HUGE_WITH_SECONDS):\n return \"EEEE, LLLL d, yyyy, h:mm:ss a\";\n default:\n return dateTimeHuge;\n }\n}\n","import * as English from \"./english.js\";\nimport * as Formats from \"./formats.js\";\nimport { padStart } from \"./util.js\";\n\nfunction stringifyTokens(splits, tokenToString) {\n let s = \"\";\n for (const token of splits) {\n if (token.literal) {\n s += token.val;\n } else {\n s += tokenToString(token.val);\n }\n }\n return s;\n}\n\nconst macroTokenToFormatOpts = {\n D: Formats.DATE_SHORT,\n DD: Formats.DATE_MED,\n DDD: Formats.DATE_FULL,\n DDDD: Formats.DATE_HUGE,\n t: Formats.TIME_SIMPLE,\n tt: Formats.TIME_WITH_SECONDS,\n ttt: Formats.TIME_WITH_SHORT_OFFSET,\n tttt: Formats.TIME_WITH_LONG_OFFSET,\n T: Formats.TIME_24_SIMPLE,\n TT: Formats.TIME_24_WITH_SECONDS,\n TTT: Formats.TIME_24_WITH_SHORT_OFFSET,\n TTTT: Formats.TIME_24_WITH_LONG_OFFSET,\n f: Formats.DATETIME_SHORT,\n ff: Formats.DATETIME_MED,\n fff: Formats.DATETIME_FULL,\n ffff: Formats.DATETIME_HUGE,\n F: Formats.DATETIME_SHORT_WITH_SECONDS,\n FF: Formats.DATETIME_MED_WITH_SECONDS,\n FFF: Formats.DATETIME_FULL_WITH_SECONDS,\n FFFF: Formats.DATETIME_HUGE_WITH_SECONDS,\n};\n\n/**\n * @private\n */\n\nexport default class Formatter {\n static create(locale, opts = {}) {\n return new Formatter(locale, opts);\n }\n\n static parseFormat(fmt) {\n // white-space is always considered a literal in user-provided formats\n // the \" \" token has a special meaning (see unitForToken)\n\n let current = null,\n currentFull = \"\",\n bracketed = false;\n const splits = [];\n for (let i = 0; i < fmt.length; i++) {\n const c = fmt.charAt(i);\n if (c === \"'\") {\n // turn '' into a literal signal quote instead of just skipping the empty literal\n if (currentFull.length > 0 || bracketed) {\n splits.push({\n literal: bracketed || /^\\s+$/.test(currentFull),\n val: currentFull === \"\" ? \"'\" : currentFull,\n });\n }\n current = null;\n currentFull = \"\";\n bracketed = !bracketed;\n } else if (bracketed) {\n currentFull += c;\n } else if (c === current) {\n currentFull += c;\n } else {\n if (currentFull.length > 0) {\n splits.push({ literal: /^\\s+$/.test(currentFull), val: currentFull });\n }\n currentFull = c;\n current = c;\n }\n }\n\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed || /^\\s+$/.test(currentFull), val: currentFull });\n }\n\n return splits;\n }\n\n static macroTokenToFormatOpts(token) {\n return macroTokenToFormatOpts[token];\n }\n\n constructor(locale, formatOpts) {\n this.opts = formatOpts;\n this.loc = locale;\n this.systemLoc = null;\n }\n\n formatWithSystemDefault(dt, opts) {\n if (this.systemLoc === null) {\n this.systemLoc = this.loc.redefaultToSystem();\n }\n const df = this.systemLoc.dtFormatter(dt, { ...this.opts, ...opts });\n return df.format();\n }\n\n dtFormatter(dt, opts = {}) {\n return this.loc.dtFormatter(dt, { ...this.opts, ...opts });\n }\n\n formatDateTime(dt, opts) {\n return this.dtFormatter(dt, opts).format();\n }\n\n formatDateTimeParts(dt, opts) {\n return this.dtFormatter(dt, opts).formatToParts();\n }\n\n formatInterval(interval, opts) {\n const df = this.dtFormatter(interval.start, opts);\n return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());\n }\n\n resolvedOptions(dt, opts) {\n return this.dtFormatter(dt, opts).resolvedOptions();\n }\n\n num(n, p = 0, signDisplay = undefined) {\n // we get some perf out of doing this here, annoyingly\n if (this.opts.forceSimple) {\n return padStart(n, p);\n }\n\n const opts = { ...this.opts };\n\n if (p > 0) {\n opts.padTo = p;\n }\n if (signDisplay) {\n opts.signDisplay = signDisplay;\n }\n\n return this.loc.numberFormatter(opts).format(n);\n }\n\n formatDateTimeFromString(dt, fmt) {\n const knownEnglish = this.loc.listingMode() === \"en\",\n useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== \"gregory\",\n string = (opts, extract) => this.loc.extract(dt, opts, extract),\n formatOffset = (opts) => {\n if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {\n return \"Z\";\n }\n\n return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : \"\";\n },\n meridiem = () =>\n knownEnglish\n ? English.meridiemForDateTime(dt)\n : string({ hour: \"numeric\", hourCycle: \"h12\" }, \"dayperiod\"),\n month = (length, standalone) =>\n knownEnglish\n ? English.monthForDateTime(dt, length)\n : string(standalone ? { month: length } : { month: length, day: \"numeric\" }, \"month\"),\n weekday = (length, standalone) =>\n knownEnglish\n ? English.weekdayForDateTime(dt, length)\n : string(\n standalone ? { weekday: length } : { weekday: length, month: \"long\", day: \"numeric\" },\n \"weekday\"\n ),\n maybeMacro = (token) => {\n const formatOpts = Formatter.macroTokenToFormatOpts(token);\n if (formatOpts) {\n return this.formatWithSystemDefault(dt, formatOpts);\n } else {\n return token;\n }\n },\n era = (length) =>\n knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, \"era\"),\n tokenToString = (token) => {\n // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols\n switch (token) {\n // ms\n case \"S\":\n return this.num(dt.millisecond);\n case \"u\":\n // falls through\n case \"SSS\":\n return this.num(dt.millisecond, 3);\n // seconds\n case \"s\":\n return this.num(dt.second);\n case \"ss\":\n return this.num(dt.second, 2);\n // fractional seconds\n case \"uu\":\n return this.num(Math.floor(dt.millisecond / 10), 2);\n case \"uuu\":\n return this.num(Math.floor(dt.millisecond / 100));\n // minutes\n case \"m\":\n return this.num(dt.minute);\n case \"mm\":\n return this.num(dt.minute, 2);\n // hours\n case \"h\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);\n case \"hh\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);\n case \"H\":\n return this.num(dt.hour);\n case \"HH\":\n return this.num(dt.hour, 2);\n // offset\n case \"Z\":\n // like +6\n return formatOffset({ format: \"narrow\", allowZ: this.opts.allowZ });\n case \"ZZ\":\n // like +06:00\n return formatOffset({ format: \"short\", allowZ: this.opts.allowZ });\n case \"ZZZ\":\n // like +0600\n return formatOffset({ format: \"techie\", allowZ: this.opts.allowZ });\n case \"ZZZZ\":\n // like EST\n return dt.zone.offsetName(dt.ts, { format: \"short\", locale: this.loc.locale });\n case \"ZZZZZ\":\n // like Eastern Standard Time\n return dt.zone.offsetName(dt.ts, { format: \"long\", locale: this.loc.locale });\n // zone\n case \"z\":\n // like America/New_York\n return dt.zoneName;\n // meridiems\n case \"a\":\n return meridiem();\n // dates\n case \"d\":\n return useDateTimeFormatter ? string({ day: \"numeric\" }, \"day\") : this.num(dt.day);\n case \"dd\":\n return useDateTimeFormatter ? string({ day: \"2-digit\" }, \"day\") : this.num(dt.day, 2);\n // weekdays - standalone\n case \"c\":\n // like 1\n return this.num(dt.weekday);\n case \"ccc\":\n // like 'Tues'\n return weekday(\"short\", true);\n case \"cccc\":\n // like 'Tuesday'\n return weekday(\"long\", true);\n case \"ccccc\":\n // like 'T'\n return weekday(\"narrow\", true);\n // weekdays - format\n case \"E\":\n // like 1\n return this.num(dt.weekday);\n case \"EEE\":\n // like 'Tues'\n return weekday(\"short\", false);\n case \"EEEE\":\n // like 'Tuesday'\n return weekday(\"long\", false);\n case \"EEEEE\":\n // like 'T'\n return weekday(\"narrow\", false);\n // months - standalone\n case \"L\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\", day: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"LL\":\n // like 01, doesn't seem to work\n return useDateTimeFormatter\n ? string({ month: \"2-digit\", day: \"numeric\" }, \"month\")\n : this.num(dt.month, 2);\n case \"LLL\":\n // like Jan\n return month(\"short\", true);\n case \"LLLL\":\n // like January\n return month(\"long\", true);\n case \"LLLLL\":\n // like J\n return month(\"narrow\", true);\n // months - format\n case \"M\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"MM\":\n // like 01\n return useDateTimeFormatter\n ? string({ month: \"2-digit\" }, \"month\")\n : this.num(dt.month, 2);\n case \"MMM\":\n // like Jan\n return month(\"short\", false);\n case \"MMMM\":\n // like January\n return month(\"long\", false);\n case \"MMMMM\":\n // like J\n return month(\"narrow\", false);\n // years\n case \"y\":\n // like 2014\n return useDateTimeFormatter ? string({ year: \"numeric\" }, \"year\") : this.num(dt.year);\n case \"yy\":\n // like 14\n return useDateTimeFormatter\n ? string({ year: \"2-digit\" }, \"year\")\n : this.num(dt.year.toString().slice(-2), 2);\n case \"yyyy\":\n // like 0012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 4);\n case \"yyyyyy\":\n // like 000012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 6);\n // eras\n case \"G\":\n // like AD\n return era(\"short\");\n case \"GG\":\n // like Anno Domini\n return era(\"long\");\n case \"GGGGG\":\n return era(\"narrow\");\n case \"kk\":\n return this.num(dt.weekYear.toString().slice(-2), 2);\n case \"kkkk\":\n return this.num(dt.weekYear, 4);\n case \"W\":\n return this.num(dt.weekNumber);\n case \"WW\":\n return this.num(dt.weekNumber, 2);\n case \"n\":\n return this.num(dt.localWeekNumber);\n case \"nn\":\n return this.num(dt.localWeekNumber, 2);\n case \"ii\":\n return this.num(dt.localWeekYear.toString().slice(-2), 2);\n case \"iiii\":\n return this.num(dt.localWeekYear, 4);\n case \"o\":\n return this.num(dt.ordinal);\n case \"ooo\":\n return this.num(dt.ordinal, 3);\n case \"q\":\n // like 1\n return this.num(dt.quarter);\n case \"qq\":\n // like 01\n return this.num(dt.quarter, 2);\n case \"X\":\n return this.num(Math.floor(dt.ts / 1000));\n case \"x\":\n return this.num(dt.ts);\n default:\n return maybeMacro(token);\n }\n };\n\n return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);\n }\n\n formatDurationFromString(dur, fmt) {\n const invertLargest = this.opts.signMode === \"negativeLargestOnly\" ? -1 : 1;\n const tokenToField = (token) => {\n switch (token[0]) {\n case \"S\":\n return \"milliseconds\";\n case \"s\":\n return \"seconds\";\n case \"m\":\n return \"minutes\";\n case \"h\":\n return \"hours\";\n case \"d\":\n return \"days\";\n case \"w\":\n return \"weeks\";\n case \"M\":\n return \"months\";\n case \"y\":\n return \"years\";\n default:\n return null;\n }\n },\n tokenToString = (lildur, info) => (token) => {\n const mapped = tokenToField(token);\n if (mapped) {\n const inversionFactor =\n info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;\n let signDisplay;\n if (this.opts.signMode === \"negativeLargestOnly\" && mapped !== info.largestUnit) {\n signDisplay = \"never\";\n } else if (this.opts.signMode === \"all\") {\n signDisplay = \"always\";\n } else {\n // \"auto\" and \"negative\" are the same, but \"auto\" has better support\n signDisplay = \"auto\";\n }\n return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);\n } else {\n return token;\n }\n },\n tokens = Formatter.parseFormat(fmt),\n realTokens = tokens.reduce(\n (found, { literal, val }) => (literal ? found : found.concat(val)),\n []\n ),\n collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t)),\n durationInfo = {\n isNegativeDuration: collapsed < 0,\n // this relies on \"collapsed\" being based on \"shiftTo\", which builds up the object\n // in order\n largestUnit: Object.keys(collapsed.values)[0],\n };\n return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));\n }\n}\n","import {\n untruncateYear,\n signedOffset,\n parseInteger,\n parseMillis,\n isUndefined,\n parseFloating,\n} from \"./util.js\";\nimport * as English from \"./english.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n/*\n * This file handles parsing for well-specified formats. Here's how it works:\n * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.\n * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object\n * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.\n * Extractors can take a \"cursor\" representing the offset in the match to look at. This makes it easy to combine extractors.\n * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.\n * Some extractions are super dumb and simpleParse and fromStrings help DRY them.\n */\n\nconst ianaRegex = /[A-Za-z_+-]{1,256}(?::?\\/[A-Za-z0-9_+-]{1,256}(?:\\/[A-Za-z0-9_+-]{1,256})?)?/;\n\nfunction combineRegexes(...regexes) {\n const full = regexes.reduce((f, r) => f + r.source, \"\");\n return RegExp(`^${full}$`);\n}\n\nfunction combineExtractors(...extractors) {\n return (m) =>\n extractors\n .reduce(\n ([mergedVals, mergedZone, cursor], ex) => {\n const [val, zone, next] = ex(m, cursor);\n return [{ ...mergedVals, ...val }, zone || mergedZone, next];\n },\n [{}, null, 1]\n )\n .slice(0, 2);\n}\n\nfunction parse(s, ...patterns) {\n if (s == null) {\n return [null, null];\n }\n\n for (const [regex, extractor] of patterns) {\n const m = regex.exec(s);\n if (m) {\n return extractor(m);\n }\n }\n return [null, null];\n}\n\nfunction simpleParse(...keys) {\n return (match, cursor) => {\n const ret = {};\n let i;\n\n for (i = 0; i < keys.length; i++) {\n ret[keys[i]] = parseInteger(match[cursor + i]);\n }\n return [ret, null, cursor + i];\n };\n}\n\n// ISO and SQL parsing\nconst offsetRegex = /(?:([Zz])|([+-]\\d\\d)(?::?(\\d\\d))?)/;\nconst isoExtendedZone = `(?:${offsetRegex.source}?(?:\\\\[(${ianaRegex.source})\\\\])?)?`;\nconst isoTimeBaseRegex = /(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:[.,](\\d{1,30}))?)?)?/;\nconst isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);\nconst isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);\nconst isoYmdRegex = /([+-]\\d{6}|\\d{4})(?:-?(\\d\\d)(?:-?(\\d\\d))?)?/;\nconst isoWeekRegex = /(\\d{4})-?W(\\d\\d)(?:-?(\\d))?/;\nconst isoOrdinalRegex = /(\\d{4})-?(\\d{3})/;\nconst extractISOWeekData = simpleParse(\"weekYear\", \"weekNumber\", \"weekDay\");\nconst extractISOOrdinalData = simpleParse(\"year\", \"ordinal\");\nconst sqlYmdRegex = /(\\d{4})-(\\d\\d)-(\\d\\d)/; // dumbed-down version of the ISO one\nconst sqlTimeRegex = RegExp(\n `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`\n);\nconst sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);\n\nfunction int(match, pos, fallback) {\n const m = match[pos];\n return isUndefined(m) ? fallback : parseInteger(m);\n}\n\nfunction extractISOYmd(match, cursor) {\n const item = {\n year: int(match, cursor),\n month: int(match, cursor + 1, 1),\n day: int(match, cursor + 2, 1),\n };\n\n return [item, null, cursor + 3];\n}\n\nfunction extractISOTime(match, cursor) {\n const item = {\n hours: int(match, cursor, 0),\n minutes: int(match, cursor + 1, 0),\n seconds: int(match, cursor + 2, 0),\n milliseconds: parseMillis(match[cursor + 3]),\n };\n\n return [item, null, cursor + 4];\n}\n\nfunction extractISOOffset(match, cursor) {\n const local = !match[cursor] && !match[cursor + 1],\n fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),\n zone = local ? null : FixedOffsetZone.instance(fullOffset);\n return [{}, zone, cursor + 3];\n}\n\nfunction extractIANAZone(match, cursor) {\n const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;\n return [{}, zone, cursor + 1];\n}\n\n// ISO time parsing\n\nconst isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);\n\n// ISO duration parsing\n\nconst isoDuration =\n /^-?P(?:(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)Y)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)M)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)W)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)D)?(?:T(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)H)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)M)?(?:(-?\\d{1,20})(?:[.,](-?\\d{1,20}))?S)?)?)$/;\n\nfunction extractISODuration(match) {\n const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] =\n match;\n\n const hasNegativePrefix = s[0] === \"-\";\n const negativeSeconds = secondStr && secondStr[0] === \"-\";\n\n const maybeNegate = (num, force = false) =>\n num !== undefined && (force || (num && hasNegativePrefix)) ? -num : num;\n\n return [\n {\n years: maybeNegate(parseFloating(yearStr)),\n months: maybeNegate(parseFloating(monthStr)),\n weeks: maybeNegate(parseFloating(weekStr)),\n days: maybeNegate(parseFloating(dayStr)),\n hours: maybeNegate(parseFloating(hourStr)),\n minutes: maybeNegate(parseFloating(minuteStr)),\n seconds: maybeNegate(parseFloating(secondStr), secondStr === \"-0\"),\n milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds),\n },\n ];\n}\n\n// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York\n// and not just that we're in -240 *right now*. But since I don't think these are used that often\n// I'm just going to ignore that\nconst obsOffsets = {\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n};\n\nfunction fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {\n const result = {\n year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),\n month: English.monthsShort.indexOf(monthStr) + 1,\n day: parseInteger(dayStr),\n hour: parseInteger(hourStr),\n minute: parseInteger(minuteStr),\n };\n\n if (secondStr) result.second = parseInteger(secondStr);\n if (weekdayStr) {\n result.weekday =\n weekdayStr.length > 3\n ? English.weekdaysLong.indexOf(weekdayStr) + 1\n : English.weekdaysShort.indexOf(weekdayStr) + 1;\n }\n\n return result;\n}\n\n// RFC 2822/5322\nconst rfc2822 =\n /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\\d\\d)(\\d\\d)))$/;\n\nfunction extractRFC2822(match) {\n const [\n ,\n weekdayStr,\n dayStr,\n monthStr,\n yearStr,\n hourStr,\n minuteStr,\n secondStr,\n obsOffset,\n milOffset,\n offHourStr,\n offMinuteStr,\n ] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n\n let offset;\n if (obsOffset) {\n offset = obsOffsets[obsOffset];\n } else if (milOffset) {\n offset = 0;\n } else {\n offset = signedOffset(offHourStr, offMinuteStr);\n }\n\n return [result, new FixedOffsetZone(offset)];\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^()]*\\)|[\\n\\t]/g, \" \")\n .replace(/(\\s\\s+)/g, \" \")\n .trim();\n}\n\n// http date\n\nconst rfc1123 =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d\\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\\d{4}) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n rfc850 =\n /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\\d\\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n ascii =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \\d|\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) (\\d{4})$/;\n\nfunction extractRFC1123Or850(match) {\n const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nfunction extractASCII(match) {\n const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nconst isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);\nconst isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);\nconst isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);\nconst isoTimeCombinedRegex = combineRegexes(isoTimeRegex);\n\nconst extractISOYmdTimeAndOffset = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOWeekTimeAndOffset = combineExtractors(\n extractISOWeekData,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOOrdinalDateAndTime = combineExtractors(\n extractISOOrdinalData,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOTimeAndOffset = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\n/*\n * @private\n */\n\nexport function parseISODate(s) {\n return parse(\n s,\n [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],\n [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime],\n [isoTimeCombinedRegex, extractISOTimeAndOffset]\n );\n}\n\nexport function parseRFC2822Date(s) {\n return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);\n}\n\nexport function parseHTTPDate(s) {\n return parse(\n s,\n [rfc1123, extractRFC1123Or850],\n [rfc850, extractRFC1123Or850],\n [ascii, extractASCII]\n );\n}\n\nexport function parseISODuration(s) {\n return parse(s, [isoDuration, extractISODuration]);\n}\n\nconst extractISOTimeOnly = combineExtractors(extractISOTime);\n\nexport function parseISOTimeOnly(s) {\n return parse(s, [isoTimeOnly, extractISOTimeOnly]);\n}\n\nconst sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);\nconst sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);\n\nconst extractISOTimeOffsetAndIANAZone = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\nexport function parseSQL(s) {\n return parse(\n s,\n [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]\n );\n}\n","import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from \"./errors.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Locale from \"./impl/locale.js\";\nimport { parseISODuration, parseISOTimeOnly } from \"./impl/regexParser.js\";\nimport {\n asNumber,\n hasOwnProperty,\n isNumber,\n isUndefined,\n normalizeObject,\n roundTo,\n} from \"./impl/util.js\";\nimport Settings from \"./settings.js\";\nimport DateTime from \"./datetime.js\";\n\nconst INVALID = \"Invalid Duration\";\n\n// unit conversion constants\nexport const lowOrderMatrix = {\n weeks: {\n days: 7,\n hours: 7 * 24,\n minutes: 7 * 24 * 60,\n seconds: 7 * 24 * 60 * 60,\n milliseconds: 7 * 24 * 60 * 60 * 1000,\n },\n days: {\n hours: 24,\n minutes: 24 * 60,\n seconds: 24 * 60 * 60,\n milliseconds: 24 * 60 * 60 * 1000,\n },\n hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },\n minutes: { seconds: 60, milliseconds: 60 * 1000 },\n seconds: { milliseconds: 1000 },\n },\n casualMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: 52,\n days: 365,\n hours: 365 * 24,\n minutes: 365 * 24 * 60,\n seconds: 365 * 24 * 60 * 60,\n milliseconds: 365 * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: 13,\n days: 91,\n hours: 91 * 24,\n minutes: 91 * 24 * 60,\n seconds: 91 * 24 * 60 * 60,\n milliseconds: 91 * 24 * 60 * 60 * 1000,\n },\n months: {\n weeks: 4,\n days: 30,\n hours: 30 * 24,\n minutes: 30 * 24 * 60,\n seconds: 30 * 24 * 60 * 60,\n milliseconds: 30 * 24 * 60 * 60 * 1000,\n },\n\n ...lowOrderMatrix,\n },\n daysInYearAccurate = 146097.0 / 400,\n daysInMonthAccurate = 146097.0 / 4800,\n accurateMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: daysInYearAccurate / 7,\n days: daysInYearAccurate,\n hours: daysInYearAccurate * 24,\n minutes: daysInYearAccurate * 24 * 60,\n seconds: daysInYearAccurate * 24 * 60 * 60,\n milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: daysInYearAccurate / 28,\n days: daysInYearAccurate / 4,\n hours: (daysInYearAccurate * 24) / 4,\n minutes: (daysInYearAccurate * 24 * 60) / 4,\n seconds: (daysInYearAccurate * 24 * 60 * 60) / 4,\n milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4,\n },\n months: {\n weeks: daysInMonthAccurate / 7,\n days: daysInMonthAccurate,\n hours: daysInMonthAccurate * 24,\n minutes: daysInMonthAccurate * 24 * 60,\n seconds: daysInMonthAccurate * 24 * 60 * 60,\n milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000,\n },\n ...lowOrderMatrix,\n };\n\n// units ordered by size\nconst orderedUnits = [\n \"years\",\n \"quarters\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\",\n];\n\nconst reverseUnits = orderedUnits.slice(0).reverse();\n\n// clone really means \"create another instance just like this one, but with these changes\"\nfunction clone(dur, alts, clear = false) {\n // deep merge for vals\n const conf = {\n values: clear ? alts.values : { ...dur.values, ...(alts.values || {}) },\n loc: dur.loc.clone(alts.loc),\n conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,\n matrix: alts.matrix || dur.matrix,\n };\n return new Duration(conf);\n}\n\nfunction durationToMillis(matrix, vals) {\n let sum = vals.milliseconds ?? 0;\n for (const unit of reverseUnits.slice(1)) {\n if (vals[unit]) {\n sum += vals[unit] * matrix[unit][\"milliseconds\"];\n }\n }\n return sum;\n}\n\n// NB: mutates parameters\nfunction normalizeValues(matrix, vals) {\n // the logic below assumes the overall value of the duration is positive\n // if this is not the case, factor is used to make it so\n const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;\n\n orderedUnits.reduceRight((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n const previousVal = vals[previous] * factor;\n const conv = matrix[current][previous];\n\n // if (previousVal < 0):\n // lower order unit is negative (e.g. { years: 2, days: -2 })\n // normalize this by reducing the higher order unit by the appropriate amount\n // and increasing the lower order unit\n // this can never make the higher order unit negative, because this function only operates\n // on positive durations, so the amount of time represented by the lower order unit cannot\n // be larger than the higher order unit\n // else:\n // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 })\n // in this case we attempt to convert as much as possible from the lower order unit into\n // the higher order one\n //\n // Math.floor takes care of both of these cases, rounding away from 0\n // if previousVal < 0 it makes the absolute value larger\n // if previousVal >= it makes the absolute value smaller\n const rollUp = Math.floor(previousVal / conv);\n vals[current] += rollUp * factor;\n vals[previous] -= rollUp * conv * factor;\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n\n // try to convert any decimals into smaller units if possible\n // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 }\n orderedUnits.reduce((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n const fraction = vals[previous] % 1;\n vals[previous] -= fraction;\n vals[current] += fraction * matrix[previous][current];\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n}\n\n// Remove all properties with a value of 0 from an object\nfunction removeZeroes(vals) {\n const newVals = {};\n for (const [key, value] of Object.entries(vals)) {\n if (value !== 0) {\n newVals[key] = value;\n }\n }\n return newVals;\n}\n\n/**\n * A Duration object represents a period of time, like \"2 months\" or \"1 day, 1 hour\". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime#plus} to add a Duration object to a DateTime, producing another DateTime.\n *\n * Here is a brief overview of commonly used methods and getters in Duration:\n *\n * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.\n * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors.\n * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors.\n * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}.\n * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON}\n *\n * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.\n */\nexport default class Duration {\n /**\n * @private\n */\n constructor(config) {\n const accurate = config.conversionAccuracy === \"longterm\" || false;\n let matrix = accurate ? accurateMatrix : casualMatrix;\n\n if (config.matrix) {\n matrix = config.matrix;\n }\n\n /**\n * @access private\n */\n this.values = config.values;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.conversionAccuracy = accurate ? \"longterm\" : \"casual\";\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.matrix = matrix;\n /**\n * @access private\n */\n this.isLuxonDuration = true;\n }\n\n /**\n * Create Duration from a number of milliseconds.\n * @param {number} count of milliseconds\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromMillis(count, opts) {\n return Duration.fromObject({ milliseconds: count }, opts);\n }\n\n /**\n * Create a Duration from a JavaScript object with keys like 'years' and 'hours'.\n * If this object is empty then a zero milliseconds duration is returned.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.years\n * @param {number} obj.quarters\n * @param {number} obj.months\n * @param {number} obj.weeks\n * @param {number} obj.days\n * @param {number} obj.hours\n * @param {number} obj.minutes\n * @param {number} obj.seconds\n * @param {number} obj.milliseconds\n * @param {Object} [opts=[]] - options for creating this Duration\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the custom conversion system to use\n * @return {Duration}\n */\n static fromObject(obj, opts = {}) {\n if (obj == null || typeof obj !== \"object\") {\n throw new InvalidArgumentError(\n `Duration.fromObject: argument expected to be an object, got ${\n obj === null ? \"null\" : typeof obj\n }`\n );\n }\n\n return new Duration({\n values: normalizeObject(obj, Duration.normalizeUnit),\n loc: Locale.fromObject(opts),\n conversionAccuracy: opts.conversionAccuracy,\n matrix: opts.matrix,\n });\n }\n\n /**\n * Create a Duration from DurationLike.\n *\n * @param {Object | number | Duration} durationLike\n * One of:\n * - object with keys like 'years' and 'hours'.\n * - number representing milliseconds\n * - Duration instance\n * @return {Duration}\n */\n static fromDurationLike(durationLike) {\n if (isNumber(durationLike)) {\n return Duration.fromMillis(durationLike);\n } else if (Duration.isDuration(durationLike)) {\n return durationLike;\n } else if (typeof durationLike === \"object\") {\n return Duration.fromObject(durationLike);\n } else {\n throw new InvalidArgumentError(\n `Unknown duration argument ${durationLike} of type ${typeof durationLike}`\n );\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 duration string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the preset conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }\n * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }\n * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }\n * @return {Duration}\n */\n static fromISO(text, opts) {\n const [parsed] = parseISODuration(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 time string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 }\n * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @return {Duration}\n */\n static fromISOTime(text, opts) {\n const [parsed] = parseISOTimeOnly(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create an invalid Duration.\n * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Duration}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Duration is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDurationError(invalid);\n } else {\n return new Duration({ invalid });\n }\n }\n\n /**\n * @private\n */\n static normalizeUnit(unit) {\n const normalized = {\n year: \"years\",\n years: \"years\",\n quarter: \"quarters\",\n quarters: \"quarters\",\n month: \"months\",\n months: \"months\",\n week: \"weeks\",\n weeks: \"weeks\",\n day: \"days\",\n days: \"days\",\n hour: \"hours\",\n hours: \"hours\",\n minute: \"minutes\",\n minutes: \"minutes\",\n second: \"seconds\",\n seconds: \"seconds\",\n millisecond: \"milliseconds\",\n milliseconds: \"milliseconds\",\n }[unit ? unit.toLowerCase() : unit];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n }\n\n /**\n * Check if an object is a Duration. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDuration(o) {\n return (o && o.isLuxonDuration) || false;\n }\n\n /**\n * Get the locale of a Duration, such 'en-GB'\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:\n * * `S` for milliseconds\n * * `s` for seconds\n * * `m` for minutes\n * * `h` for hours\n * * `d` for days\n * * `w` for weeks\n * * `M` for months\n * * `y` for years\n * Notes:\n * * Add padding by repeating the token, e.g. \"yy\" pads the years to two digits, \"hhhh\" pads the hours out to four digits\n * * Tokens can be escaped by wrapping with single quotes.\n * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting.\n * @param {string} fmt - the format string\n * @param {Object} opts - options\n * @param {boolean} [opts.floor=true] - floor numerical values\n * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"y d s\") //=> \"1 6 2\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"yy dd sss\") //=> \"01 06 002\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"M S\") //=> \"12 518402000\"\n * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat(\"d s\", { signMode: \"all\" }) //=> \"+6 +2\"\n * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat(\"d s\", { signMode: \"all\" }) //=> \"-6 -2\"\n * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat(\"d s\", { signMode: \"negativeLargestOnly\" }) //=> \"-6 2\"\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n // reverse-compat since 1.2; we always round down now, never up, and we do it by default\n const fmtOpts = {\n ...opts,\n floor: opts.round !== false && opts.floor !== false,\n };\n return this.isValid\n ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a string representation of a Duration with all units included.\n * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options\n * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.\n * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.\n * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero\n * @example\n * ```js\n * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 })\n * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes'\n * dur.toHuman({ listStyle: \"long\" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes'\n * dur.toHuman({ unitDisplay: \"short\" }) //=> '1 mth, 0 wks, 5 hr, 6 min'\n * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes'\n * ```\n */\n toHuman(opts = {}) {\n if (!this.isValid) return INVALID;\n\n const showZeros = opts.showZeros !== false;\n\n const l = orderedUnits\n .map((unit) => {\n const val = this.values[unit];\n if (isUndefined(val) || (val === 0 && !showZeros)) {\n return null;\n }\n return this.loc\n .numberFormatter({ style: \"unit\", unitDisplay: \"long\", ...opts, unit: unit.slice(0, -1) })\n .format(val);\n })\n .filter((n) => n);\n\n return this.loc\n .listFormatter({ type: \"conjunction\", style: opts.listStyle || \"narrow\", ...opts })\n .format(l);\n }\n\n /**\n * Returns a JavaScript object with this Duration's values.\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }\n * @return {Object}\n */\n toObject() {\n if (!this.isValid) return {};\n return { ...this.values };\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'\n * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'\n * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'\n * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'\n * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'\n * @return {string}\n */\n toISO() {\n // we could use the formatter, but this is an easier way to get the minimum string\n if (!this.isValid) return null;\n\n let s = \"P\";\n if (this.years !== 0) s += this.years + \"Y\";\n if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + \"M\";\n if (this.weeks !== 0) s += this.weeks + \"W\";\n if (this.days !== 0) s += this.days + \"D\";\n if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)\n s += \"T\";\n if (this.hours !== 0) s += this.hours + \"H\";\n if (this.minutes !== 0) s += this.minutes + \"M\";\n if (this.seconds !== 0 || this.milliseconds !== 0)\n // this will handle \"floating point madness\" by removing extra decimal places\n // https://stackoverflow.com/questions/588004/is-floating-point-math-broken\n s += roundTo(this.seconds + this.milliseconds / 1000, 3) + \"S\";\n if (s === \"P\") s += \"T0S\";\n return s;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day.\n * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000'\n * @return {string}\n */\n toISOTime(opts = {}) {\n if (!this.isValid) return null;\n\n const millis = this.toMillis();\n if (millis < 0 || millis >= 86400000) return null;\n\n opts = {\n suppressMilliseconds: false,\n suppressSeconds: false,\n includePrefix: false,\n format: \"extended\",\n ...opts,\n includeOffset: false,\n };\n\n const dateTime = DateTime.fromMillis(millis, { zone: \"UTC\" });\n return dateTime.toISOTime(opts);\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in debugging.\n * @return {string}\n */\n toString() {\n return this.toISO();\n }\n\n /**\n * Returns a string representation of this Duration appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `Duration { values: ${JSON.stringify(this.values)} }`;\n } else {\n return `Duration { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns an milliseconds value of this Duration.\n * @return {number}\n */\n toMillis() {\n if (!this.isValid) return NaN;\n\n return durationToMillis(this.matrix, this.values);\n }\n\n /**\n * Returns an milliseconds value of this Duration. Alias of {@link toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Make this Duration longer by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n plus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration),\n result = {};\n\n for (const k of orderedUnits) {\n if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {\n result[k] = dur.get(k) + this.get(k);\n }\n }\n\n return clone(this, { values: result }, true);\n }\n\n /**\n * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n minus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration);\n return this.plus(dur.negate());\n }\n\n /**\n * Scale this Duration by the specified amount. Return a newly-constructed Duration.\n * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 }\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === \"hours\" ? x * 2 : x) //=> { hours: 2, minutes: 30 }\n * @return {Duration}\n */\n mapUnits(fn) {\n if (!this.isValid) return this;\n const result = {};\n for (const k of Object.keys(this.values)) {\n result[k] = asNumber(fn(this.values[k], k));\n }\n return clone(this, { values: result }, true);\n }\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2\n * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0\n * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3\n * @return {number}\n */\n get(unit) {\n return this[Duration.normalizeUnit(unit)];\n }\n\n /**\n * \"Set\" the values of specified units. Return a newly-constructed Duration.\n * @param {Object} values - a mapping of units to numbers\n * @example dur.set({ years: 2017 })\n * @example dur.set({ hours: 8, minutes: 30 })\n * @return {Duration}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const mixed = { ...this.values, ...normalizeObject(values, Duration.normalizeUnit) };\n return clone(this, { values: mixed });\n }\n\n /**\n * \"Set\" the locale and/or numberingSystem. Returns a newly-constructed Duration.\n * @example dur.reconfigure({ locale: 'en-GB' })\n * @return {Duration}\n */\n reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem });\n const opts = { loc, matrix, conversionAccuracy };\n return clone(this, opts);\n }\n\n /**\n * Return the length of the duration in the specified unit.\n * @param {string} unit - a unit such as 'minutes' or 'days'\n * @example Duration.fromObject({years: 1}).as('days') //=> 365\n * @example Duration.fromObject({years: 1}).as('months') //=> 12\n * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5\n * @return {number}\n */\n as(unit) {\n return this.isValid ? this.shiftTo(unit).get(unit) : NaN;\n }\n\n /**\n * Reduce this Duration to its canonical representation in its current units.\n * Assuming the overall value of the Duration is positive, this means:\n * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)\n * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise\n * the overall value would be negative, see third example)\n * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)\n *\n * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.\n * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }\n * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 }\n * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }\n * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 }\n * @return {Duration}\n */\n normalize() {\n if (!this.isValid) return this;\n const vals = this.toObject();\n normalizeValues(this.matrix, vals);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Rescale units to its largest representation\n * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 }\n * @return {Duration}\n */\n rescale() {\n if (!this.isValid) return this;\n const vals = removeZeroes(this.normalize().shiftToAll().toObject());\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Convert this Duration into its representation in a different set of units.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }\n * @return {Duration}\n */\n shiftTo(...units) {\n if (!this.isValid) return this;\n\n if (units.length === 0) {\n return this;\n }\n\n units = units.map((u) => Duration.normalizeUnit(u));\n\n const built = {},\n accumulated = {},\n vals = this.toObject();\n let lastUnit;\n\n for (const k of orderedUnits) {\n if (units.indexOf(k) >= 0) {\n lastUnit = k;\n\n let own = 0;\n\n // anything we haven't boiled down yet should get boiled to this unit\n for (const ak in accumulated) {\n own += this.matrix[ak][k] * accumulated[ak];\n accumulated[ak] = 0;\n }\n\n // plus anything that's already in this unit\n if (isNumber(vals[k])) {\n own += vals[k];\n }\n\n // only keep the integer part for now in the hopes of putting any decimal part\n // into a smaller unit later\n const i = Math.trunc(own);\n built[k] = i;\n accumulated[k] = (own * 1000 - i * 1000) / 1000;\n\n // otherwise, keep it in the wings to boil it later\n } else if (isNumber(vals[k])) {\n accumulated[k] = vals[k];\n }\n }\n\n // anything leftover becomes the decimal for the last unit\n // lastUnit must be defined since units is not empty\n for (const key in accumulated) {\n if (accumulated[key] !== 0) {\n built[lastUnit] +=\n key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];\n }\n }\n\n normalizeValues(this.matrix, built);\n return clone(this, { values: built }, true);\n }\n\n /**\n * Shift this Duration to all available units.\n * Same as shiftTo(\"years\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", \"seconds\", \"milliseconds\")\n * @return {Duration}\n */\n shiftToAll() {\n if (!this.isValid) return this;\n return this.shiftTo(\n \"years\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\"\n );\n }\n\n /**\n * Return the negative of this Duration.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }\n * @return {Duration}\n */\n negate() {\n if (!this.isValid) return this;\n const negated = {};\n for (const k of Object.keys(this.values)) {\n negated[k] = this.values[k] === 0 ? 0 : -this.values[k];\n }\n return clone(this, { values: negated }, true);\n }\n\n /**\n * Removes all units with values equal to 0 from this Duration.\n * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 }\n * @return {Duration}\n */\n removeZeros() {\n if (!this.isValid) return this;\n const vals = removeZeroes(this.values);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Get the years.\n * @type {number}\n */\n get years() {\n return this.isValid ? this.values.years || 0 : NaN;\n }\n\n /**\n * Get the quarters.\n * @type {number}\n */\n get quarters() {\n return this.isValid ? this.values.quarters || 0 : NaN;\n }\n\n /**\n * Get the months.\n * @type {number}\n */\n get months() {\n return this.isValid ? this.values.months || 0 : NaN;\n }\n\n /**\n * Get the weeks\n * @type {number}\n */\n get weeks() {\n return this.isValid ? this.values.weeks || 0 : NaN;\n }\n\n /**\n * Get the days.\n * @type {number}\n */\n get days() {\n return this.isValid ? this.values.days || 0 : NaN;\n }\n\n /**\n * Get the hours.\n * @type {number}\n */\n get hours() {\n return this.isValid ? this.values.hours || 0 : NaN;\n }\n\n /**\n * Get the minutes.\n * @type {number}\n */\n get minutes() {\n return this.isValid ? this.values.minutes || 0 : NaN;\n }\n\n /**\n * Get the seconds.\n * @return {number}\n */\n get seconds() {\n return this.isValid ? this.values.seconds || 0 : NaN;\n }\n\n /**\n * Get the milliseconds.\n * @return {number}\n */\n get milliseconds() {\n return this.isValid ? this.values.milliseconds || 0 : NaN;\n }\n\n /**\n * Returns whether the Duration is invalid. Invalid durations are returned by diff operations\n * on invalid DateTimes or Intervals.\n * @return {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this Duration became invalid, or null if the Duration is valid\n * @return {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Duration became invalid, or null if the Duration is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Equality check\n * Two Durations are equal iff they have the same units and the same values for each unit.\n * @param {Duration} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n if (!this.loc.equals(other.loc)) {\n return false;\n }\n\n function eq(v1, v2) {\n // Consider 0 and undefined as equal\n if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0;\n return v1 === v2;\n }\n\n for (const u of orderedUnits) {\n if (!eq(this.values[u], other.values[u])) {\n return false;\n }\n }\n return true;\n }\n}\n","import DateTime, { friendlyDateTime } from \"./datetime.js\";\nimport Duration from \"./duration.js\";\nimport Settings from \"./settings.js\";\nimport { InvalidArgumentError, InvalidIntervalError } from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport * as Formats from \"./impl/formats.js\";\n\nconst INVALID = \"Invalid Interval\";\n\n// checks if the start is equal to or before the end\nfunction validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\n \"end before start\",\n `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`\n );\n } else {\n return null;\n }\n}\n\n/**\n * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.\n *\n * Here is a brief overview of the most commonly used methods and getters in Interval:\n *\n * * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}.\n * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end.\n * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}.\n * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}.\n * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}\n * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}.\n */\nexport default class Interval {\n /**\n * @private\n */\n constructor(config) {\n /**\n * @access private\n */\n this.s = config.start;\n /**\n * @access private\n */\n this.e = config.end;\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.isLuxonInterval = true;\n }\n\n /**\n * Create an invalid Interval.\n * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Interval}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Interval is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidIntervalError(invalid);\n } else {\n return new Interval({ invalid });\n }\n }\n\n /**\n * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.\n * @param {DateTime|Date|Object} start\n * @param {DateTime|Date|Object} end\n * @return {Interval}\n */\n static fromDateTimes(start, end) {\n const builtStart = friendlyDateTime(start),\n builtEnd = friendlyDateTime(end);\n\n const validateError = validateStartEnd(builtStart, builtEnd);\n\n if (validateError == null) {\n return new Interval({\n start: builtStart,\n end: builtEnd,\n });\n } else {\n return validateError;\n }\n }\n\n /**\n * Create an Interval from a start DateTime and a Duration to extend to.\n * @param {DateTime|Date|Object} start\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static after(start, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(start);\n return Interval.fromDateTimes(dt, dt.plus(dur));\n }\n\n /**\n * Create an Interval from an end DateTime and a Duration to extend backwards to.\n * @param {DateTime|Date|Object} end\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static before(end, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(end);\n return Interval.fromDateTimes(dt.minus(dur), dt);\n }\n\n /**\n * Create an Interval from an ISO 8601 string.\n * Accepts `/`, `/`, and `/` formats.\n * @param {string} text - the ISO string to parse\n * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO}\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {Interval}\n */\n static fromISO(text, opts) {\n const [s, e] = (text || \"\").split(\"/\", 2);\n if (s && e) {\n let start, startIsValid;\n try {\n start = DateTime.fromISO(s, opts);\n startIsValid = start.isValid;\n } catch (e) {\n startIsValid = false;\n }\n\n let end, endIsValid;\n try {\n end = DateTime.fromISO(e, opts);\n endIsValid = end.isValid;\n } catch (e) {\n endIsValid = false;\n }\n\n if (startIsValid && endIsValid) {\n return Interval.fromDateTimes(start, end);\n }\n\n if (startIsValid) {\n const dur = Duration.fromISO(e, opts);\n if (dur.isValid) {\n return Interval.after(start, dur);\n }\n } else if (endIsValid) {\n const dur = Duration.fromISO(s, opts);\n if (dur.isValid) {\n return Interval.before(end, dur);\n }\n }\n }\n return Interval.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n\n /**\n * Check if an object is an Interval. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isInterval(o) {\n return (o && o.isLuxonInterval) || false;\n }\n\n /**\n * Returns the start of the Interval\n * @type {DateTime}\n */\n get start() {\n return this.isValid ? this.s : null;\n }\n\n /**\n * Returns the end of the Interval. This is the first instant which is not part of the interval\n * (Interval is half-open).\n * @type {DateTime}\n */\n get end() {\n return this.isValid ? this.e : null;\n }\n\n /**\n * Returns the last DateTime included in the interval (since end is not part of the interval)\n * @type {DateTime}\n */\n get lastDateTime() {\n return this.isValid ? (this.e ? this.e.minus(1) : null) : null;\n }\n\n /**\n * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.\n * @type {boolean}\n */\n get isValid() {\n return this.invalidReason === null;\n }\n\n /**\n * Returns an error code if this Interval is invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Interval became invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Returns the length of the Interval in the specified unit.\n * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.\n * @return {number}\n */\n length(unit = \"milliseconds\") {\n return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;\n }\n\n /**\n * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.\n * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'\n * asks 'what dates are included in this interval?', not 'how many days long is this interval?'\n * @param {string} [unit='milliseconds'] - the unit of time to count.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime\n * @return {number}\n */\n count(unit = \"milliseconds\", opts) {\n if (!this.isValid) return NaN;\n const start = this.start.startOf(unit, opts);\n let end;\n if (opts?.useLocaleWeeks) {\n end = this.end.reconfigure({ locale: start.locale });\n } else {\n end = this.end;\n }\n end = end.startOf(unit, opts);\n return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());\n }\n\n /**\n * Returns whether this Interval's start and end are both in the same unit of time\n * @param {string} unit - the unit of time to check sameness on\n * @return {boolean}\n */\n hasSame(unit) {\n return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;\n }\n\n /**\n * Return whether this Interval has the same start and end DateTimes.\n * @return {boolean}\n */\n isEmpty() {\n return this.s.valueOf() === this.e.valueOf();\n }\n\n /**\n * Return whether this Interval's start is after the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isAfter(dateTime) {\n if (!this.isValid) return false;\n return this.s > dateTime;\n }\n\n /**\n * Return whether this Interval's end is before the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isBefore(dateTime) {\n if (!this.isValid) return false;\n return this.e <= dateTime;\n }\n\n /**\n * Return whether this Interval contains the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n contains(dateTime) {\n if (!this.isValid) return false;\n return this.s <= dateTime && this.e > dateTime;\n }\n\n /**\n * \"Sets\" the start and/or end dates. Returns a newly-constructed Interval.\n * @param {Object} values - the values to set\n * @param {DateTime} values.start - the starting DateTime\n * @param {DateTime} values.end - the ending DateTime\n * @return {Interval}\n */\n set({ start, end } = {}) {\n if (!this.isValid) return this;\n return Interval.fromDateTimes(start || this.s, end || this.e);\n }\n\n /**\n * Split this Interval at each of the specified DateTimes\n * @param {...DateTime} dateTimes - the unit of time to count.\n * @return {Array}\n */\n splitAt(...dateTimes) {\n if (!this.isValid) return [];\n const sorted = dateTimes\n .map(friendlyDateTime)\n .filter((d) => this.contains(d))\n .sort((a, b) => a.toMillis() - b.toMillis()),\n results = [];\n let { s } = this,\n i = 0;\n\n while (s < this.e) {\n const added = sorted[i] || this.e,\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n i += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into smaller Intervals, each of the specified length.\n * Left over time is grouped into a smaller interval\n * @param {Duration|Object|number} duration - The length of each resulting interval.\n * @return {Array}\n */\n splitBy(duration) {\n const dur = Duration.fromDurationLike(duration);\n\n if (!this.isValid || !dur.isValid || dur.as(\"milliseconds\") === 0) {\n return [];\n }\n\n let { s } = this,\n idx = 1,\n next;\n\n const results = [];\n while (s < this.e) {\n const added = this.start.plus(dur.mapUnits((x) => x * idx));\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n idx += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into the specified number of smaller intervals.\n * @param {number} numberOfParts - The number of Intervals to divide the Interval into.\n * @return {Array}\n */\n divideEqually(numberOfParts) {\n if (!this.isValid) return [];\n return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);\n }\n\n /**\n * Return whether this Interval overlaps with the specified Interval\n * @param {Interval} other\n * @return {boolean}\n */\n overlaps(other) {\n return this.e > other.s && this.s < other.e;\n }\n\n /**\n * Return whether this Interval's end is adjacent to the specified Interval's start.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsStart(other) {\n if (!this.isValid) return false;\n return +this.e === +other.s;\n }\n\n /**\n * Return whether this Interval's start is adjacent to the specified Interval's end.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsEnd(other) {\n if (!this.isValid) return false;\n return +other.e === +this.s;\n }\n\n /**\n * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise.\n * @param {Interval} other\n * @return {boolean}\n */\n engulfs(other) {\n if (!this.isValid) return false;\n return this.s <= other.s && this.e >= other.e;\n }\n\n /**\n * Return whether this Interval has the same start and end as the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n return this.s.equals(other.s) && this.e.equals(other.e);\n }\n\n /**\n * Return an Interval representing the intersection of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.\n * Returns null if the intersection is empty, meaning, the intervals don't intersect.\n * @param {Interval} other\n * @return {Interval}\n */\n intersection(other) {\n if (!this.isValid) return this;\n const s = this.s > other.s ? this.s : other.s,\n e = this.e < other.e ? this.e : other.e;\n\n if (s >= e) {\n return null;\n } else {\n return Interval.fromDateTimes(s, e);\n }\n }\n\n /**\n * Return an Interval representing the union of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.\n * @param {Interval} other\n * @return {Interval}\n */\n union(other) {\n if (!this.isValid) return this;\n const s = this.s < other.s ? this.s : other.s,\n e = this.e > other.e ? this.e : other.e;\n return Interval.fromDateTimes(s, e);\n }\n\n /**\n * Merge an array of Intervals into an equivalent minimal set of Intervals.\n * Combines overlapping and adjacent Intervals.\n * The resulting array will contain the Intervals in ascending order, that is, starting with the earliest Interval\n * and ending with the latest.\n *\n * @param {Array} intervals\n * @return {Array}\n */\n static merge(intervals) {\n const [found, final] = intervals\n .sort((a, b) => a.s - b.s)\n .reduce(\n ([sofar, current], item) => {\n if (!current) {\n return [sofar, item];\n } else if (current.overlaps(item) || current.abutsStart(item)) {\n return [sofar, current.union(item)];\n } else {\n return [sofar.concat([current]), item];\n }\n },\n [[], null]\n );\n if (final) {\n found.push(final);\n }\n return found;\n }\n\n /**\n * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.\n * @param {Array} intervals\n * @return {Array}\n */\n static xor(intervals) {\n let start = null,\n currentCount = 0;\n const results = [],\n ends = intervals.map((i) => [\n { time: i.s, type: \"s\" },\n { time: i.e, type: \"e\" },\n ]),\n flattened = Array.prototype.concat(...ends),\n arr = flattened.sort((a, b) => a.time - b.time);\n\n for (const i of arr) {\n currentCount += i.type === \"s\" ? 1 : -1;\n\n if (currentCount === 1) {\n start = i.time;\n } else {\n if (start && +start !== +i.time) {\n results.push(Interval.fromDateTimes(start, i.time));\n }\n\n start = null;\n }\n }\n\n return Interval.merge(results);\n }\n\n /**\n * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.\n * @param {...Interval} intervals\n * @return {Array}\n */\n difference(...intervals) {\n return Interval.xor([this].concat(intervals))\n .map((i) => this.intersection(i))\n .filter((i) => i && !i.isEmpty());\n }\n\n /**\n * Returns a string representation of this Interval appropriate for debugging.\n * @return {string}\n */\n toString() {\n if (!this.isValid) return INVALID;\n return `[${this.s.toISO()} – ${this.e.toISO()})`;\n }\n\n /**\n * Returns a string representation of this Interval appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;\n } else {\n return `Interval { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns a localized string representing this Interval. Accepts the same options as the\n * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as\n * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method\n * is browser-specific, but in general it will return an appropriate representation of the\n * Interval in the assigned locale. Defaults to the system's locale if no locale has been\n * specified.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or\n * Intl.DateTimeFormat constructor options.\n * @param {Object} opts - Options to override the configuration of the start DateTime.\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022\n * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM\n * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p\n * @return {string}\n */\n toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) {\n return this.isValid\n ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this)\n : INVALID;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Interval.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISO(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of date of this Interval.\n * The time components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {string}\n */\n toISODate() {\n if (!this.isValid) return INVALID;\n return `${this.s.toISODate()}/${this.e.toISODate()}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of time of this Interval.\n * The date components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISOTime(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this Interval formatted according to the specified format\n * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible\n * formatting tool.\n * @param {string} dateFormat - The format string. This string formats the start and end time.\n * See {@link DateTime#toFormat} for details.\n * @param {Object} opts - Options.\n * @param {string} [opts.separator = ' – '] - A separator to place between the start and end\n * representations.\n * @return {string}\n */\n toFormat(dateFormat, { separator = \" – \" } = {}) {\n if (!this.isValid) return INVALID;\n return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;\n }\n\n /**\n * Return a Duration representing the time spanned by this interval.\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }\n * @return {Duration}\n */\n toDuration(unit, opts) {\n if (!this.isValid) {\n return Duration.invalid(this.invalidReason);\n }\n return this.e.diff(this.s, unit, opts);\n }\n\n /**\n * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes\n * @param {function} mapFn\n * @return {Interval}\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))\n */\n mapEndpoints(mapFn) {\n return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Settings from \"./settings.js\";\nimport Locale from \"./impl/locale.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nimport { hasLocaleWeekInfo, hasRelative } from \"./impl/util.js\";\n\n/**\n * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.\n */\nexport default class Info {\n /**\n * Return whether the specified zone contains a DST.\n * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.\n * @return {boolean}\n */\n static hasDST(zone = Settings.defaultZone) {\n const proto = DateTime.now().setZone(zone).set({ month: 12 });\n\n return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset;\n }\n\n /**\n * Return whether the specified zone is a valid IANA specifier.\n * @param {string} zone - Zone to check\n * @return {boolean}\n */\n static isValidIANAZone(zone) {\n return IANAZone.isValidZone(zone);\n }\n\n /**\n * Converts the input into a {@link Zone} instance.\n *\n * * If `input` is already a Zone instance, it is returned unchanged.\n * * If `input` is a string containing a valid time zone name, a Zone instance\n * with that name is returned.\n * * If `input` is a string that doesn't refer to a known time zone, a Zone\n * instance with {@link Zone#isValid} == false is returned.\n * * If `input is a number, a Zone instance with the specified fixed offset\n * in minutes is returned.\n * * If `input` is `null` or `undefined`, the default zone is returned.\n * @param {string|Zone|number} [input] - the value to be converted\n * @return {Zone}\n */\n static normalizeZone(input) {\n return normalizeZone(input, Settings.defaultZone);\n }\n\n /**\n * Get the weekday on which the week starts according to the given locale.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number} the start of the week, 1 for Monday through 7 for Sunday\n */\n static getStartOfWeek({ locale = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale)).getStartOfWeek();\n }\n\n /**\n * Get the minimum number of days necessary in a week before it is considered part of the next year according\n * to the given locale.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number}\n */\n static getMinimumDaysInFirstWeek({ locale = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();\n }\n\n /**\n * Get the weekdays, which are considered the weekend according to the given locale\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday\n */\n static getWeekendWeekdays({ locale = null, locObj = null } = {}) {\n // copy the array, because we cache it internally\n return (locObj || Locale.create(locale)).getWeekendDays().slice();\n }\n\n /**\n * Return an array of standalone month names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @example Info.months()[0] //=> 'January'\n * @example Info.months('short')[0] //=> 'Jan'\n * @example Info.months('numeric')[0] //=> '1'\n * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'\n * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'\n * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'\n * @return {Array}\n */\n static months(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);\n }\n\n /**\n * Return an array of format month names.\n * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that\n * changes the string.\n * See {@link Info#months}\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @return {Array}\n */\n static monthsFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);\n }\n\n /**\n * Return an array of standalone week names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the weekday representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @example Info.weekdays()[0] //=> 'Monday'\n * @example Info.weekdays('short')[0] //=> 'Mon'\n * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'\n * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'\n * @return {Array}\n */\n static weekdays(length = \"long\", { locale = null, numberingSystem = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);\n }\n\n /**\n * Return an array of format week names.\n * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that\n * changes the string.\n * See {@link Info#weekdays}\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale=null] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @return {Array}\n */\n static weekdaysFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);\n }\n\n /**\n * Return an array of meridiems.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.meridiems() //=> [ 'AM', 'PM' ]\n * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]\n * @return {Array}\n */\n static meridiems({ locale = null } = {}) {\n return Locale.create(locale).meridiems();\n }\n\n /**\n * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.\n * @param {string} [length='short'] - the length of the era representation, such as \"short\" or \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.eras() //=> [ 'BC', 'AD' ]\n * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]\n * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]\n * @return {Array}\n */\n static eras(length = \"short\", { locale = null } = {}) {\n return Locale.create(locale, null, \"gregory\").eras(length);\n }\n\n /**\n * Return the set of available features in this environment.\n * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.\n * Keys:\n * * `relative`: whether this environment supports relative time formatting\n * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale\n * @example Info.features() //=> { relative: false, localeWeek: true }\n * @return {Object}\n */\n static features() {\n return { relative: hasRelative(), localeWeek: hasLocaleWeekInfo() };\n }\n}\n","import Duration from \"../duration.js\";\n\nfunction dayDiff(earlier, later) {\n const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf(\"day\").valueOf(),\n ms = utcDayStart(later) - utcDayStart(earlier);\n return Math.floor(Duration.fromMillis(ms).as(\"days\"));\n}\n\nfunction highOrderDiffs(cursor, later, units) {\n const differs = [\n [\"years\", (a, b) => b.year - a.year],\n [\"quarters\", (a, b) => b.quarter - a.quarter + (b.year - a.year) * 4],\n [\"months\", (a, b) => b.month - a.month + (b.year - a.year) * 12],\n [\n \"weeks\",\n (a, b) => {\n const days = dayDiff(a, b);\n return (days - (days % 7)) / 7;\n },\n ],\n [\"days\", dayDiff],\n ];\n\n const results = {};\n const earlier = cursor;\n let lowestOrder, highWater;\n\n /* This loop tries to diff using larger units first.\n If we overshoot, we backtrack and try the next smaller unit.\n \"cursor\" starts out at the earlier timestamp and moves closer and closer to \"later\"\n as we use smaller and smaller units.\n highWater keeps track of where we would be if we added one more of the smallest unit,\n this is used later to potentially convert any difference smaller than the smallest higher order unit\n into a fraction of that smallest higher order unit\n */\n for (const [unit, differ] of differs) {\n if (units.indexOf(unit) >= 0) {\n lowestOrder = unit;\n\n results[unit] = differ(cursor, later);\n highWater = earlier.plus(results);\n\n if (highWater > later) {\n // we overshot the end point, backtrack cursor by 1\n results[unit]--;\n cursor = earlier.plus(results);\n\n // if we are still overshooting now, we need to backtrack again\n // this happens in certain situations when diffing times in different zones,\n // because this calculation ignores time zones\n if (cursor > later) {\n // keep the \"overshot by 1\" around as highWater\n highWater = cursor;\n // backtrack cursor by 1\n results[unit]--;\n cursor = earlier.plus(results);\n }\n } else {\n cursor = highWater;\n }\n }\n }\n\n return [cursor, results, highWater, lowestOrder];\n}\n\nexport default function (earlier, later, units, opts) {\n let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);\n\n const remainingMillis = later - cursor;\n\n const lowerOrderUnits = units.filter(\n (u) => [\"hours\", \"minutes\", \"seconds\", \"milliseconds\"].indexOf(u) >= 0\n );\n\n if (lowerOrderUnits.length === 0) {\n if (highWater < later) {\n highWater = cursor.plus({ [lowestOrder]: 1 });\n }\n\n if (highWater !== cursor) {\n results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);\n }\n }\n\n const duration = Duration.fromObject(results, opts);\n\n if (lowerOrderUnits.length > 0) {\n return Duration.fromMillis(remainingMillis, opts)\n .shiftTo(...lowerOrderUnits)\n .plus(duration);\n } else {\n return duration;\n }\n}\n","import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from \"./util.js\";\nimport Formatter from \"./formatter.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport DateTime from \"../datetime.js\";\nimport { digitRegex, parseDigits } from \"./digits.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst MISSING_FTP = \"missing Intl.DateTimeFormat.formatToParts support\";\n\nfunction intUnit(regex, post = (i) => i) {\n return { regex, deser: ([s]) => post(parseDigits(s)) };\n}\n\nconst NBSP = String.fromCharCode(160);\nconst spaceOrNBSP = `[ ${NBSP}]`;\nconst spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, \"g\");\n\nfunction fixListRegex(s) {\n // make dots optional and also make them literal\n // make space and non breakable space characters interchangeable\n return s.replace(/\\./g, \"\\\\.?\").replace(spaceOrNBSPRegExp, spaceOrNBSP);\n}\n\nfunction stripInsensitivities(s) {\n return s\n .replace(/\\./g, \"\") // ignore dots that were made optional\n .replace(spaceOrNBSPRegExp, \" \") // interchange space and nbsp\n .toLowerCase();\n}\n\nfunction oneOf(strings, startIndex) {\n if (strings === null) {\n return null;\n } else {\n return {\n regex: RegExp(strings.map(fixListRegex).join(\"|\")),\n deser: ([s]) =>\n strings.findIndex((i) => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex,\n };\n }\n}\n\nfunction offset(regex, groups) {\n return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };\n}\n\nfunction simple(regex) {\n return { regex, deser: ([s]) => s };\n}\n\nfunction escapeToken(value) {\n return value.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n}\n\n/**\n * @param token\n * @param {Locale} loc\n */\nfunction unitForToken(token, loc) {\n const one = digitRegex(loc),\n two = digitRegex(loc, \"{2}\"),\n three = digitRegex(loc, \"{3}\"),\n four = digitRegex(loc, \"{4}\"),\n six = digitRegex(loc, \"{6}\"),\n oneOrTwo = digitRegex(loc, \"{1,2}\"),\n oneToThree = digitRegex(loc, \"{1,3}\"),\n oneToSix = digitRegex(loc, \"{1,6}\"),\n oneToNine = digitRegex(loc, \"{1,9}\"),\n twoToFour = digitRegex(loc, \"{2,4}\"),\n fourToSix = digitRegex(loc, \"{4,6}\"),\n literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }),\n unitate = (t) => {\n if (token.literal) {\n return literal(t);\n }\n switch (t.val) {\n // era\n case \"G\":\n return oneOf(loc.eras(\"short\"), 0);\n case \"GG\":\n return oneOf(loc.eras(\"long\"), 0);\n // years\n case \"y\":\n return intUnit(oneToSix);\n case \"yy\":\n return intUnit(twoToFour, untruncateYear);\n case \"yyyy\":\n return intUnit(four);\n case \"yyyyy\":\n return intUnit(fourToSix);\n case \"yyyyyy\":\n return intUnit(six);\n // months\n case \"M\":\n return intUnit(oneOrTwo);\n case \"MM\":\n return intUnit(two);\n case \"MMM\":\n return oneOf(loc.months(\"short\", true), 1);\n case \"MMMM\":\n return oneOf(loc.months(\"long\", true), 1);\n case \"L\":\n return intUnit(oneOrTwo);\n case \"LL\":\n return intUnit(two);\n case \"LLL\":\n return oneOf(loc.months(\"short\", false), 1);\n case \"LLLL\":\n return oneOf(loc.months(\"long\", false), 1);\n // dates\n case \"d\":\n return intUnit(oneOrTwo);\n case \"dd\":\n return intUnit(two);\n // ordinals\n case \"o\":\n return intUnit(oneToThree);\n case \"ooo\":\n return intUnit(three);\n // time\n case \"HH\":\n return intUnit(two);\n case \"H\":\n return intUnit(oneOrTwo);\n case \"hh\":\n return intUnit(two);\n case \"h\":\n return intUnit(oneOrTwo);\n case \"mm\":\n return intUnit(two);\n case \"m\":\n return intUnit(oneOrTwo);\n case \"q\":\n return intUnit(oneOrTwo);\n case \"qq\":\n return intUnit(two);\n case \"s\":\n return intUnit(oneOrTwo);\n case \"ss\":\n return intUnit(two);\n case \"S\":\n return intUnit(oneToThree);\n case \"SSS\":\n return intUnit(three);\n case \"u\":\n return simple(oneToNine);\n case \"uu\":\n return simple(oneOrTwo);\n case \"uuu\":\n return intUnit(one);\n // meridiem\n case \"a\":\n return oneOf(loc.meridiems(), 0);\n // weekYear (k)\n case \"kkkk\":\n return intUnit(four);\n case \"kk\":\n return intUnit(twoToFour, untruncateYear);\n // weekNumber (W)\n case \"W\":\n return intUnit(oneOrTwo);\n case \"WW\":\n return intUnit(two);\n // weekdays\n case \"E\":\n case \"c\":\n return intUnit(one);\n case \"EEE\":\n return oneOf(loc.weekdays(\"short\", false), 1);\n case \"EEEE\":\n return oneOf(loc.weekdays(\"long\", false), 1);\n case \"ccc\":\n return oneOf(loc.weekdays(\"short\", true), 1);\n case \"cccc\":\n return oneOf(loc.weekdays(\"long\", true), 1);\n // offset/zone\n case \"Z\":\n case \"ZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);\n case \"ZZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);\n // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing\n // because we don't have any way to figure out what they are\n case \"z\":\n return simple(/[a-z_+-/]{1,256}?/i);\n // this special-case \"token\" represents a place where a macro-token expanded into a white-space literal\n // in this case we accept any non-newline white-space\n case \" \":\n return simple(/[^\\S\\n\\r]/);\n default:\n return literal(t);\n }\n };\n\n const unit = unitate(token) || {\n invalidReason: MISSING_FTP,\n };\n\n unit.token = token;\n\n return unit;\n}\n\nconst partTypeStyleToTokenVal = {\n year: {\n \"2-digit\": \"yy\",\n numeric: \"yyyyy\",\n },\n month: {\n numeric: \"M\",\n \"2-digit\": \"MM\",\n short: \"MMM\",\n long: \"MMMM\",\n },\n day: {\n numeric: \"d\",\n \"2-digit\": \"dd\",\n },\n weekday: {\n short: \"EEE\",\n long: \"EEEE\",\n },\n dayperiod: \"a\",\n dayPeriod: \"a\",\n hour12: {\n numeric: \"h\",\n \"2-digit\": \"hh\",\n },\n hour24: {\n numeric: \"H\",\n \"2-digit\": \"HH\",\n },\n minute: {\n numeric: \"m\",\n \"2-digit\": \"mm\",\n },\n second: {\n numeric: \"s\",\n \"2-digit\": \"ss\",\n },\n timeZoneName: {\n long: \"ZZZZZ\",\n short: \"ZZZ\",\n },\n};\n\nfunction tokenForPart(part, formatOpts, resolvedOpts) {\n const { type, value } = part;\n\n if (type === \"literal\") {\n const isSpace = /^\\s+$/.test(value);\n return {\n literal: !isSpace,\n val: isSpace ? \" \" : value,\n };\n }\n\n const style = formatOpts[type];\n\n // The user might have explicitly specified hour12 or hourCycle\n // if so, respect their decision\n // if not, refer back to the resolvedOpts, which are based on the locale\n let actualType = type;\n if (type === \"hour\") {\n if (formatOpts.hour12 != null) {\n actualType = formatOpts.hour12 ? \"hour12\" : \"hour24\";\n } else if (formatOpts.hourCycle != null) {\n if (formatOpts.hourCycle === \"h11\" || formatOpts.hourCycle === \"h12\") {\n actualType = \"hour12\";\n } else {\n actualType = \"hour24\";\n }\n } else {\n // tokens only differentiate between 24 hours or not,\n // so we do not need to check hourCycle here, which is less supported anyways\n actualType = resolvedOpts.hour12 ? \"hour12\" : \"hour24\";\n }\n }\n let val = partTypeStyleToTokenVal[actualType];\n if (typeof val === \"object\") {\n val = val[style];\n }\n\n if (val) {\n return {\n literal: false,\n val,\n };\n }\n\n return undefined;\n}\n\nfunction buildRegex(units) {\n const re = units.map((u) => u.regex).reduce((f, r) => `${f}(${r.source})`, \"\");\n return [`^${re}$`, units];\n}\n\nfunction match(input, regex, handlers) {\n const matches = input.match(regex);\n\n if (matches) {\n const all = {};\n let matchIndex = 1;\n for (const i in handlers) {\n if (hasOwnProperty(handlers, i)) {\n const h = handlers[i],\n groups = h.groups ? h.groups + 1 : 1;\n if (!h.literal && h.token) {\n all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));\n }\n matchIndex += groups;\n }\n }\n return [matches, all];\n } else {\n return [matches, {}];\n }\n}\n\nfunction dateTimeFromMatches(matches) {\n const toField = (token) => {\n switch (token) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n case \"H\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"o\":\n return \"ordinal\";\n case \"L\":\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n case \"E\":\n case \"c\":\n return \"weekday\";\n case \"W\":\n return \"weekNumber\";\n case \"k\":\n return \"weekYear\";\n case \"q\":\n return \"quarter\";\n default:\n return null;\n }\n };\n\n let zone = null;\n let specificOffset;\n if (!isUndefined(matches.z)) {\n zone = IANAZone.create(matches.z);\n }\n\n if (!isUndefined(matches.Z)) {\n if (!zone) {\n zone = new FixedOffsetZone(matches.Z);\n }\n specificOffset = matches.Z;\n }\n\n if (!isUndefined(matches.q)) {\n matches.M = (matches.q - 1) * 3 + 1;\n }\n\n if (!isUndefined(matches.h)) {\n if (matches.h < 12 && matches.a === 1) {\n matches.h += 12;\n } else if (matches.h === 12 && matches.a === 0) {\n matches.h = 0;\n }\n }\n\n if (matches.G === 0 && matches.y) {\n matches.y = -matches.y;\n }\n\n if (!isUndefined(matches.u)) {\n matches.S = parseMillis(matches.u);\n }\n\n const vals = Object.keys(matches).reduce((r, k) => {\n const f = toField(k);\n if (f) {\n r[f] = matches[k];\n }\n\n return r;\n }, {});\n\n return [vals, zone, specificOffset];\n}\n\nlet dummyDateTimeCache = null;\n\nfunction getDummyDateTime() {\n if (!dummyDateTimeCache) {\n dummyDateTimeCache = DateTime.fromMillis(1555555555555);\n }\n\n return dummyDateTimeCache;\n}\n\nfunction maybeExpandMacroToken(token, locale) {\n if (token.literal) {\n return token;\n }\n\n const formatOpts = Formatter.macroTokenToFormatOpts(token.val);\n const tokens = formatOptsToTokens(formatOpts, locale);\n\n if (tokens == null || tokens.includes(undefined)) {\n return token;\n }\n\n return tokens;\n}\n\nexport function expandMacroTokens(tokens, locale) {\n return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale)));\n}\n\n/**\n * @private\n */\n\nexport class TokenParser {\n constructor(locale, format) {\n this.locale = locale;\n this.format = format;\n this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale);\n this.units = this.tokens.map((t) => unitForToken(t, locale));\n this.disqualifyingUnit = this.units.find((t) => t.invalidReason);\n\n if (!this.disqualifyingUnit) {\n const [regexString, handlers] = buildRegex(this.units);\n this.regex = RegExp(regexString, \"i\");\n this.handlers = handlers;\n }\n }\n\n explainFromTokens(input) {\n if (!this.isValid) {\n return { input, tokens: this.tokens, invalidReason: this.invalidReason };\n } else {\n const [rawMatches, matches] = match(input, this.regex, this.handlers),\n [result, zone, specificOffset] = matches\n ? dateTimeFromMatches(matches)\n : [null, null, undefined];\n if (hasOwnProperty(matches, \"a\") && hasOwnProperty(matches, \"H\")) {\n throw new ConflictingSpecificationError(\n \"Can't include meridiem when specifying 24-hour format\"\n );\n }\n return {\n input,\n tokens: this.tokens,\n regex: this.regex,\n rawMatches,\n matches,\n result,\n zone,\n specificOffset,\n };\n }\n }\n\n get isValid() {\n return !this.disqualifyingUnit;\n }\n\n get invalidReason() {\n return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null;\n }\n}\n\nexport function explainFromTokens(locale, input, format) {\n const parser = new TokenParser(locale, format);\n return parser.explainFromTokens(input);\n}\n\nexport function parseFromTokens(locale, input, format) {\n const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format);\n return [result, zone, specificOffset, invalidReason];\n}\n\nexport function formatOptsToTokens(formatOpts, locale) {\n if (!formatOpts) {\n return null;\n }\n\n const formatter = Formatter.create(locale, formatOpts);\n const df = formatter.dtFormatter(getDummyDateTime());\n const parts = df.formatToParts();\n const resolvedOpts = df.resolvedOptions();\n return parts.map((p) => tokenForPart(p, formatOpts, resolvedOpts));\n}\n","import Duration from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Settings from \"./settings.js\";\nimport Info from \"./info.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport {\n isUndefined,\n maybeArray,\n isDate,\n isNumber,\n bestBy,\n daysInMonth,\n daysInYear,\n isLeapYear,\n weeksInWeekYear,\n normalizeObject,\n roundTo,\n objToLocalTS,\n padStart,\n} from \"./impl/util.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport diff from \"./impl/diff.js\";\nimport { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from \"./impl/regexParser.js\";\nimport {\n parseFromTokens,\n explainFromTokens,\n formatOptsToTokens,\n expandMacroTokens,\n TokenParser,\n} from \"./impl/tokenParser.js\";\nimport {\n gregorianToWeek,\n weekToGregorian,\n gregorianToOrdinal,\n ordinalToGregorian,\n hasInvalidGregorianData,\n hasInvalidWeekData,\n hasInvalidOrdinalData,\n hasInvalidTimeData,\n usesLocalWeekValues,\n isoWeekdayToLocal,\n} from \"./impl/conversions.js\";\nimport * as Formats from \"./impl/formats.js\";\nimport {\n InvalidArgumentError,\n ConflictingSpecificationError,\n InvalidUnitError,\n InvalidDateTimeError,\n} from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid DateTime\";\nconst MAX_DATE = 8.64e15;\n\nfunction unsupportedZone(zone) {\n return new Invalid(\"unsupported zone\", `the zone \"${zone.name}\" is not supported`);\n}\n\n// we cache week data on the DT object and this intermediates the cache\n/**\n * @param {DateTime} dt\n */\nfunction possiblyCachedWeekData(dt) {\n if (dt.weekData === null) {\n dt.weekData = gregorianToWeek(dt.c);\n }\n return dt.weekData;\n}\n\n/**\n * @param {DateTime} dt\n */\nfunction possiblyCachedLocalWeekData(dt) {\n if (dt.localWeekData === null) {\n dt.localWeekData = gregorianToWeek(\n dt.c,\n dt.loc.getMinDaysInFirstWeek(),\n dt.loc.getStartOfWeek()\n );\n }\n return dt.localWeekData;\n}\n\n// clone really means, \"make a new object with these modifications\". all \"setters\" really use this\n// to create a new object while only changing some of the properties\nfunction clone(inst, alts) {\n const current = {\n ts: inst.ts,\n zone: inst.zone,\n c: inst.c,\n o: inst.o,\n loc: inst.loc,\n invalid: inst.invalid,\n };\n return new DateTime({ ...current, ...alts, old: current });\n}\n\n// find the right offset a given local time. The o input is our guess, which determines which\n// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)\nfunction fixOffset(localTS, o, tz) {\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - o * 60 * 1000;\n\n // Test whether the zone matches the offset for this ts\n const o2 = tz.offset(utcGuess);\n\n // If so, offset didn't change and we're done\n if (o === o2) {\n return [utcGuess, o];\n }\n\n // If not, change the ts by the difference in the offset\n utcGuess -= (o2 - o) * 60 * 1000;\n\n // If that gives us the local time we want, we're done\n const o3 = tz.offset(utcGuess);\n if (o2 === o3) {\n return [utcGuess, o2];\n }\n\n // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time\n return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];\n}\n\n// convert an epoch timestamp into a calendar object with the given offset\nfunction tsToObj(ts, offset) {\n ts += offset * 60 * 1000;\n\n const d = new Date(ts);\n\n return {\n year: d.getUTCFullYear(),\n month: d.getUTCMonth() + 1,\n day: d.getUTCDate(),\n hour: d.getUTCHours(),\n minute: d.getUTCMinutes(),\n second: d.getUTCSeconds(),\n millisecond: d.getUTCMilliseconds(),\n };\n}\n\n// convert a calendar object to a epoch timestamp\nfunction objToTS(obj, offset, zone) {\n return fixOffset(objToLocalTS(obj), offset, zone);\n}\n\n// create a new DT instance by adding a duration, adjusting for DSTs\nfunction adjustTime(inst, dur) {\n const oPre = inst.o,\n year = inst.c.year + Math.trunc(dur.years),\n month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3,\n c = {\n ...inst.c,\n year,\n month,\n day:\n Math.min(inst.c.day, daysInMonth(year, month)) +\n Math.trunc(dur.days) +\n Math.trunc(dur.weeks) * 7,\n },\n millisToAdd = Duration.fromObject({\n years: dur.years - Math.trunc(dur.years),\n quarters: dur.quarters - Math.trunc(dur.quarters),\n months: dur.months - Math.trunc(dur.months),\n weeks: dur.weeks - Math.trunc(dur.weeks),\n days: dur.days - Math.trunc(dur.days),\n hours: dur.hours,\n minutes: dur.minutes,\n seconds: dur.seconds,\n milliseconds: dur.milliseconds,\n }).as(\"milliseconds\"),\n localTS = objToLocalTS(c);\n\n let [ts, o] = fixOffset(localTS, oPre, inst.zone);\n\n if (millisToAdd !== 0) {\n ts += millisToAdd;\n // that could have changed the offset by going over a DST, but we want to keep the ts the same\n o = inst.zone.offset(ts);\n }\n\n return { ts, o };\n}\n\n// helper useful in turning the results of parsing into real dates\n// by handling the zone options\nfunction parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {\n const { setZone, zone } = opts;\n if ((parsed && Object.keys(parsed).length !== 0) || parsedZone) {\n const interpretationZone = parsedZone || zone,\n inst = DateTime.fromObject(parsed, {\n ...opts,\n zone: interpretationZone,\n specificOffset,\n });\n return setZone ? inst : inst.setZone(zone);\n } else {\n return DateTime.invalid(\n new Invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ${format}`)\n );\n }\n}\n\n// if you want to output a technical format (e.g. RFC 2822), this helper\n// helps handle the details\nfunction toTechFormat(dt, format, allowZ = true) {\n return dt.isValid\n ? Formatter.create(Locale.create(\"en-US\"), {\n allowZ,\n forceSimple: true,\n }).formatDateTimeFromString(dt, format)\n : null;\n}\n\nfunction toISODate(o, extended, precision) {\n const longFormat = o.c.year > 9999 || o.c.year < 0;\n let c = \"\";\n if (longFormat && o.c.year >= 0) c += \"+\";\n c += padStart(o.c.year, longFormat ? 6 : 4);\n if (precision === \"year\") return c;\n if (extended) {\n c += \"-\";\n c += padStart(o.c.month);\n if (precision === \"month\") return c;\n c += \"-\";\n } else {\n c += padStart(o.c.month);\n if (precision === \"month\") return c;\n }\n c += padStart(o.c.day);\n return c;\n}\n\nfunction toISOTime(\n o,\n extended,\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n) {\n let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0,\n c = \"\";\n switch (precision) {\n case \"day\":\n case \"month\":\n case \"year\":\n break;\n default:\n c += padStart(o.c.hour);\n if (precision === \"hour\") break;\n if (extended) {\n c += \":\";\n c += padStart(o.c.minute);\n if (precision === \"minute\") break;\n if (showSeconds) {\n c += \":\";\n c += padStart(o.c.second);\n }\n } else {\n c += padStart(o.c.minute);\n if (precision === \"minute\") break;\n if (showSeconds) {\n c += padStart(o.c.second);\n }\n }\n if (precision === \"second\") break;\n if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) {\n c += \".\";\n c += padStart(o.c.millisecond, 3);\n }\n }\n\n if (includeOffset) {\n if (o.isOffsetFixed && o.offset === 0 && !extendedZone) {\n c += \"Z\";\n } else if (o.o < 0) {\n c += \"-\";\n c += padStart(Math.trunc(-o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(-o.o % 60));\n } else {\n c += \"+\";\n c += padStart(Math.trunc(o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(o.o % 60));\n }\n }\n\n if (extendedZone) {\n c += \"[\" + o.zone.ianaName + \"]\";\n }\n return c;\n}\n\n// defaults for unspecified units in the supported calendars\nconst defaultUnitValues = {\n month: 1,\n day: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultWeekUnitValues = {\n weekNumber: 1,\n weekday: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultOrdinalUnitValues = {\n ordinal: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n };\n\n// Units in the supported calendars, sorted by bigness\nconst orderedUnits = [\"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"millisecond\"],\n orderedWeekUnits = [\n \"weekYear\",\n \"weekNumber\",\n \"weekday\",\n \"hour\",\n \"minute\",\n \"second\",\n \"millisecond\",\n ],\n orderedOrdinalUnits = [\"year\", \"ordinal\", \"hour\", \"minute\", \"second\", \"millisecond\"];\n\n// standardize case and plurality in units\nfunction normalizeUnit(unit) {\n const normalized = {\n year: \"year\",\n years: \"year\",\n month: \"month\",\n months: \"month\",\n day: \"day\",\n days: \"day\",\n hour: \"hour\",\n hours: \"hour\",\n minute: \"minute\",\n minutes: \"minute\",\n quarter: \"quarter\",\n quarters: \"quarter\",\n second: \"second\",\n seconds: \"second\",\n millisecond: \"millisecond\",\n milliseconds: \"millisecond\",\n weekday: \"weekday\",\n weekdays: \"weekday\",\n weeknumber: \"weekNumber\",\n weeksnumber: \"weekNumber\",\n weeknumbers: \"weekNumber\",\n weekyear: \"weekYear\",\n weekyears: \"weekYear\",\n ordinal: \"ordinal\",\n }[unit.toLowerCase()];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n}\n\nfunction normalizeUnitWithLocalWeeks(unit) {\n switch (unit.toLowerCase()) {\n case \"localweekday\":\n case \"localweekdays\":\n return \"localWeekday\";\n case \"localweeknumber\":\n case \"localweeknumbers\":\n return \"localWeekNumber\";\n case \"localweekyear\":\n case \"localweekyears\":\n return \"localWeekYear\";\n default:\n return normalizeUnit(unit);\n }\n}\n\n// cache offsets for zones based on the current timestamp when this function is\n// first called. When we are handling a datetime from components like (year,\n// month, day, hour) in a time zone, we need a guess about what the timezone\n// offset is so that we can convert into a UTC timestamp. One way is to find the\n// offset of now in the zone. The actual date may have a different offset (for\n// example, if we handle a date in June while we're in December in a zone that\n// observes DST), but we can check and adjust that.\n//\n// When handling many dates, calculating the offset for now every time is\n// expensive. It's just a guess, so we can cache the offset to use even if we\n// are right on a time change boundary (we'll just correct in the other\n// direction). Using a timestamp from first read is a slight optimization for\n// handling dates close to the current date, since those dates will usually be\n// in the same offset (we could set the timestamp statically, instead). We use a\n// single timestamp for all zones to make things a bit more predictable.\n//\n// This is safe for quickDT (used by local() and utc()) because we don't fill in\n// higher-order units from tsNow (as we do in fromObject, this requires that\n// offset is calculated from tsNow).\n/**\n * @param {Zone} zone\n * @return {number}\n */\nfunction guessOffsetForZone(zone) {\n if (zoneOffsetTs === undefined) {\n zoneOffsetTs = Settings.now();\n }\n\n // Do not cache anything but IANA zones, because it is not safe to do so.\n // Guessing an offset which is not present in the zone can cause wrong results from fixOffset\n if (zone.type !== \"iana\") {\n return zone.offset(zoneOffsetTs);\n }\n const zoneName = zone.name;\n let offsetGuess = zoneOffsetGuessCache.get(zoneName);\n if (offsetGuess === undefined) {\n offsetGuess = zone.offset(zoneOffsetTs);\n zoneOffsetGuessCache.set(zoneName, offsetGuess);\n }\n return offsetGuess;\n}\n\n// this is a dumbed down version of fromObject() that runs about 60% faster\n// but doesn't do any validation, makes a bunch of assumptions about what units\n// are present, and so on.\nfunction quickDT(obj, opts) {\n const zone = normalizeZone(opts.zone, Settings.defaultZone);\n if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n }\n\n const loc = Locale.fromObject(opts);\n\n let ts, o;\n\n // assume we have the higher-order units\n if (!isUndefined(obj.year)) {\n for (const u of orderedUnits) {\n if (isUndefined(obj[u])) {\n obj[u] = defaultUnitValues[u];\n }\n }\n\n const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n const offsetProvis = guessOffsetForZone(zone);\n [ts, o] = objToTS(obj, offsetProvis, zone);\n } else {\n ts = Settings.now();\n }\n\n return new DateTime({ ts, zone, loc, o });\n}\n\nfunction diffRelative(start, end, opts) {\n const round = isUndefined(opts.round) ? true : opts.round,\n rounding = isUndefined(opts.rounding) ? \"trunc\" : opts.rounding,\n format = (c, unit) => {\n c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? \"round\" : rounding);\n const formatter = end.loc.clone(opts).relFormatter(opts);\n return formatter.format(c, unit);\n },\n differ = (unit) => {\n if (opts.calendary) {\n if (!end.hasSame(start, unit)) {\n return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);\n } else return 0;\n } else {\n return end.diff(start, unit).get(unit);\n }\n };\n\n if (opts.unit) {\n return format(differ(opts.unit), opts.unit);\n }\n\n for (const unit of opts.units) {\n const count = differ(unit);\n if (Math.abs(count) >= 1) {\n return format(count, unit);\n }\n }\n return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);\n}\n\nfunction lastOpts(argList) {\n let opts = {},\n args;\n if (argList.length > 0 && typeof argList[argList.length - 1] === \"object\") {\n opts = argList[argList.length - 1];\n args = Array.from(argList).slice(0, argList.length - 1);\n } else {\n args = Array.from(argList);\n }\n return [opts, args];\n}\n\n/**\n * Timestamp to use for cached zone offset guesses (exposed for test)\n */\nlet zoneOffsetTs;\n/**\n * Cache for zone offset guesses (exposed for test).\n *\n * This optimizes quickDT via guessOffsetForZone to avoid repeated calls of\n * zone.offset().\n */\nconst zoneOffsetGuessCache = new Map();\n\n/**\n * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them.\n *\n * A DateTime comprises of:\n * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch.\n * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone).\n * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`.\n *\n * Here is a brief overview of the most commonly used functionality it provides:\n *\n * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}.\n * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month},\n * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors.\n * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors.\n * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors.\n * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}.\n * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}.\n *\n * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.\n */\nexport default class DateTime {\n /**\n * @access private\n */\n constructor(config) {\n const zone = config.zone || Settings.defaultZone;\n\n let invalid =\n config.invalid ||\n (Number.isNaN(config.ts) ? new Invalid(\"invalid input\") : null) ||\n (!zone.isValid ? unsupportedZone(zone) : null);\n /**\n * @access private\n */\n this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;\n\n let c = null,\n o = null;\n if (!invalid) {\n const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);\n\n if (unchanged) {\n [c, o] = [config.old.c, config.old.o];\n } else {\n // If an offset has been passed and we have not been called from\n // clone(), we can trust it and avoid the offset calculation.\n const ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts);\n c = tsToObj(this.ts, ot);\n invalid = Number.isNaN(c.year) ? new Invalid(\"invalid input\") : null;\n c = invalid ? null : c;\n o = invalid ? null : ot;\n }\n }\n\n /**\n * @access private\n */\n this._zone = zone;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.invalid = invalid;\n /**\n * @access private\n */\n this.weekData = null;\n /**\n * @access private\n */\n this.localWeekData = null;\n /**\n * @access private\n */\n this.c = c;\n /**\n * @access private\n */\n this.o = o;\n /**\n * @access private\n */\n this.isLuxonDateTime = true;\n }\n\n // CONSTRUCT\n\n /**\n * Create a DateTime for the current instant, in the system's time zone.\n *\n * Use Settings to override these default values if needed.\n * @example DateTime.now().toISO() //~> now in the ISO format\n * @return {DateTime}\n */\n static now() {\n return new DateTime({});\n }\n\n /**\n * Create a local DateTime\n * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month, 1-indexed\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.local() //~> now\n * @example DateTime.local({ zone: \"America/New_York\" }) //~> now, in US east coast time\n * @example DateTime.local(2017) //~> 2017-01-01T00:00:00\n * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00\n * @example DateTime.local(2017, 3, 12, { locale: \"fr\" }) //~> 2017-03-12T00:00:00, with a French locale\n * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00\n * @example DateTime.local(2017, 3, 12, 5, { zone: \"utc\" }) //~> 2017-03-12T05:00:00, in UTC\n * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00\n * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10\n * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765\n * @return {DateTime}\n */\n static local() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime in UTC\n * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @param {Object} options - configuration options for the DateTime\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance\n * @example DateTime.utc() //~> now\n * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z\n * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z\n * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: \"fr\" }) //~> 2017-03-12T05:45:00Z with a French locale\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: \"fr\" }) //~> 2017-03-12T05:45:10.765Z with a French locale\n * @return {DateTime}\n */\n static utc() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n\n opts.zone = FixedOffsetZone.utcInstance;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime from a JavaScript Date object. Uses the default zone.\n * @param {Date} date - a JavaScript Date object\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @return {DateTime}\n */\n static fromJSDate(date, options = {}) {\n const ts = isDate(date) ? date.valueOf() : NaN;\n if (Number.isNaN(ts)) {\n return DateTime.invalid(\"invalid input\");\n }\n\n const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n return new DateTime({\n ts: ts,\n zone: zoneToUse,\n loc: Locale.fromObject(options),\n });\n }\n\n /**\n * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} milliseconds - a number of milliseconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromMillis(milliseconds, options = {}) {\n if (!isNumber(milliseconds)) {\n throw new InvalidArgumentError(\n `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`\n );\n } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {\n // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start\n return DateTime.invalid(\"Timestamp out of range\");\n } else {\n return new DateTime({\n ts: milliseconds,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} seconds - a number of seconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromSeconds(seconds, options = {}) {\n if (!isNumber(seconds)) {\n throw new InvalidArgumentError(\"fromSeconds requires a numerical input\");\n } else {\n return new DateTime({\n ts: seconds * 1000,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.year - a year, such as 1987\n * @param {number} obj.month - a month, 1-12\n * @param {number} obj.day - a day of the month, 1-31, depending on the month\n * @param {number} obj.ordinal - day of the year, 1-365 or 366\n * @param {number} obj.weekYear - an ISO week year\n * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year\n * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday\n * @param {number} obj.localWeekYear - a week year, according to the locale\n * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale\n * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale\n * @param {number} obj.hour - hour of the day, 0-23\n * @param {number} obj.minute - minute of the hour, 0-59\n * @param {number} obj.second - second of the minute, 0-59\n * @param {number} obj.millisecond - millisecond of the second, 0-999\n * @param {Object} opts - options for creating this DateTime\n * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()\n * @param {string} [opts.locale='system\\'s locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'\n * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }),\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })\n * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'\n * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: \"en-US\" }).toISODate() //=> '2021-12-26'\n * @return {DateTime}\n */\n static fromObject(obj, opts = {}) {\n obj = obj || {};\n const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n const loc = Locale.fromObject(opts);\n const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);\n const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, loc);\n\n const tsNow = Settings.now(),\n offsetProvis = !isUndefined(opts.specificOffset)\n ? opts.specificOffset\n : zoneToUse.offset(tsNow),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber;\n\n // cases:\n // just a weekday -> this week's instance of that weekday, no worries\n // (gregorian data or ordinal) + (weekYear or weekNumber) -> error\n // (gregorian month or day) + ordinal -> error\n // otherwise just use weeks or ordinals or gregorian, depending on what's specified\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor);\n\n // configure ourselves to deal with gregorian dates or week stuff\n let units,\n defaultValues,\n objNow = tsToObj(tsNow, offsetProvis);\n if (useWeekData) {\n units = orderedWeekUnits;\n defaultValues = defaultWeekUnitValues;\n objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);\n } else if (containsOrdinal) {\n units = orderedOrdinalUnits;\n defaultValues = defaultOrdinalUnitValues;\n objNow = gregorianToOrdinal(objNow);\n } else {\n units = orderedUnits;\n defaultValues = defaultUnitValues;\n }\n\n // set default values for missing stuff\n let foundFirst = false;\n for (const u of units) {\n const v = normalized[u];\n if (!isUndefined(v)) {\n foundFirst = true;\n } else if (foundFirst) {\n normalized[u] = defaultValues[u];\n } else {\n normalized[u] = objNow[u];\n }\n }\n\n // make sure the values we have are in range\n const higherOrderInvalid = useWeekData\n ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek)\n : containsOrdinal\n ? hasInvalidOrdinalData(normalized)\n : hasInvalidGregorianData(normalized),\n invalid = higherOrderInvalid || hasInvalidTimeData(normalized);\n\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n // compute the actual time\n const gregorian = useWeekData\n ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek)\n : containsOrdinal\n ? ordinalToGregorian(normalized)\n : normalized,\n [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),\n inst = new DateTime({\n ts: tsFinal,\n zone: zoneToUse,\n o: offsetFinal,\n loc,\n });\n\n // gregorian data + weekday serves only to validate\n if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {\n return DateTime.invalid(\n \"mismatched weekday\",\n `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`\n );\n }\n\n if (!inst.isValid) {\n return DateTime.invalid(inst.invalid);\n }\n\n return inst;\n }\n\n /**\n * Create a DateTime from an ISO 8601 string\n * @param {string} text - the ISO string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromISO('2016-05-25T09:08:34.123')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})\n * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})\n * @example DateTime.fromISO('2016-W05-4')\n * @return {DateTime}\n */\n static fromISO(text, opts = {}) {\n const [vals, parsedZone] = parseISODate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"ISO 8601\", text);\n }\n\n /**\n * Create a DateTime from an RFC 2822 string\n * @param {string} text - the RFC 2822 string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')\n * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')\n * @return {DateTime}\n */\n static fromRFC2822(text, opts = {}) {\n const [vals, parsedZone] = parseRFC2822Date(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"RFC 2822\", text);\n }\n\n /**\n * Create a DateTime from an HTTP header date\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @param {string} text - the HTTP header date\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')\n * @return {DateTime}\n */\n static fromHTTP(text, opts = {}) {\n const [vals, parsedZone] = parseHTTPDate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"HTTP\", opts);\n }\n\n /**\n * Create a DateTime from an input string and format string.\n * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens).\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see the link below for the formats)\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromFormat(text, fmt, opts = {}) {\n if (isUndefined(text) || isUndefined(fmt)) {\n throw new InvalidArgumentError(\"fromFormat requires an input string and a format\");\n }\n\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n }),\n [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);\n if (invalid) {\n return DateTime.invalid(invalid);\n } else {\n return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);\n }\n }\n\n /**\n * @deprecated use fromFormat instead\n */\n static fromString(text, fmt, opts = {}) {\n return DateTime.fromFormat(text, fmt, opts);\n }\n\n /**\n * Create a DateTime from a SQL date, time, or datetime\n * Defaults to en-US if no locale has been specified, regardless of the system's locale\n * @param {string} text - the string to parse\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @example DateTime.fromSQL('2017-05-15')\n * @example DateTime.fromSQL('2017-05-15 09:12:34')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })\n * @example DateTime.fromSQL('09:12:34.342')\n * @return {DateTime}\n */\n static fromSQL(text, opts = {}) {\n const [vals, parsedZone] = parseSQL(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"SQL\", text);\n }\n\n /**\n * Create an invalid DateTime.\n * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent.\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {DateTime}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the DateTime is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDateTimeError(invalid);\n } else {\n return new DateTime({ invalid });\n }\n }\n\n /**\n * Check if an object is an instance of DateTime. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDateTime(o) {\n return (o && o.isLuxonDateTime) || false;\n }\n\n /**\n * Produce the format string for a set of options\n * @param formatOpts\n * @param localeOpts\n * @returns {string}\n */\n static parseFormatForOpts(formatOpts, localeOpts = {}) {\n const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));\n return !tokenList ? null : tokenList.map((t) => (t ? t.val : null)).join(\"\");\n }\n\n /**\n * Produce the the fully expanded format token for the locale\n * Does NOT quote characters, so quoted tokens will not round trip correctly\n * @param fmt\n * @param localeOpts\n * @returns {string}\n */\n static expandFormat(fmt, localeOpts = {}) {\n const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));\n return expanded.map((t) => t.val).join(\"\");\n }\n\n static resetCache() {\n zoneOffsetTs = undefined;\n zoneOffsetGuessCache.clear();\n }\n\n // INFO\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example DateTime.local(2017, 7, 4).get('month'); //=> 7\n * @example DateTime.local(2017, 7, 4).get('day'); //=> 4\n * @return {number}\n */\n get(unit) {\n return this[unit];\n }\n\n /**\n * Returns whether the DateTime is valid. Invalid DateTimes occur when:\n * * The DateTime was created from invalid calendar information, such as the 13th month or February 30\n * * The DateTime was created by an operation on another invalid date\n * @type {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this DateTime is invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime\n *\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime\n *\n * @type {string}\n */\n get outputCalendar() {\n return this.isValid ? this.loc.outputCalendar : null;\n }\n\n /**\n * Get the time zone associated with this DateTime.\n * @type {Zone}\n */\n get zone() {\n return this._zone;\n }\n\n /**\n * Get the name of the time zone.\n * @type {string}\n */\n get zoneName() {\n return this.isValid ? this.zone.name : null;\n }\n\n /**\n * Get the year\n * @example DateTime.local(2017, 5, 25).year //=> 2017\n * @type {number}\n */\n get year() {\n return this.isValid ? this.c.year : NaN;\n }\n\n /**\n * Get the quarter\n * @example DateTime.local(2017, 5, 25).quarter //=> 2\n * @type {number}\n */\n get quarter() {\n return this.isValid ? Math.ceil(this.c.month / 3) : NaN;\n }\n\n /**\n * Get the month (1-12).\n * @example DateTime.local(2017, 5, 25).month //=> 5\n * @type {number}\n */\n get month() {\n return this.isValid ? this.c.month : NaN;\n }\n\n /**\n * Get the day of the month (1-30ish).\n * @example DateTime.local(2017, 5, 25).day //=> 25\n * @type {number}\n */\n get day() {\n return this.isValid ? this.c.day : NaN;\n }\n\n /**\n * Get the hour of the day (0-23).\n * @example DateTime.local(2017, 5, 25, 9).hour //=> 9\n * @type {number}\n */\n get hour() {\n return this.isValid ? this.c.hour : NaN;\n }\n\n /**\n * Get the minute of the hour (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30\n * @type {number}\n */\n get minute() {\n return this.isValid ? this.c.minute : NaN;\n }\n\n /**\n * Get the second of the minute (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52\n * @type {number}\n */\n get second() {\n return this.isValid ? this.c.second : NaN;\n }\n\n /**\n * Get the millisecond of the second (0-999).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654\n * @type {number}\n */\n get millisecond() {\n return this.isValid ? this.c.millisecond : NaN;\n }\n\n /**\n * Get the week year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 12, 31).weekYear //=> 2015\n * @type {number}\n */\n get weekYear() {\n return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the week number of the week year (1-52ish).\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2017, 5, 25).weekNumber //=> 21\n * @type {number}\n */\n get weekNumber() {\n return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the day of the week.\n * 1 is Monday and 7 is Sunday\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekday //=> 4\n * @type {number}\n */\n get weekday() {\n return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;\n }\n\n /**\n * Returns true if this date is on a weekend according to the locale, false otherwise\n * @returns {boolean}\n */\n get isWeekend() {\n return this.isValid && this.loc.getWeekendDays().includes(this.weekday);\n }\n\n /**\n * Get the day of the week according to the locale.\n * 1 is the first day of the week and 7 is the last day of the week.\n * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,\n * @returns {number}\n */\n get localWeekday() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;\n }\n\n /**\n * Get the week number of the week year according to the locale. Different locales assign week numbers differently,\n * because the week can start on different days of the week (see localWeekday) and because a different number of days\n * is required for a week to count as the first week of a year.\n * @returns {number}\n */\n get localWeekNumber() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the week year according to the locale. Different locales assign week numbers (and therefor week years)\n * differently, see localWeekNumber.\n * @returns {number}\n */\n get localWeekYear() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the ordinal (meaning the day of the year)\n * @example DateTime.local(2017, 5, 25).ordinal //=> 145\n * @type {number|DateTime}\n */\n get ordinal() {\n return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;\n }\n\n /**\n * Get the human readable short month name, such as 'Oct'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthShort //=> Oct\n * @type {string}\n */\n get monthShort() {\n return this.isValid ? Info.months(\"short\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable long month name, such as 'October'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthLong //=> October\n * @type {string}\n */\n get monthLong() {\n return this.isValid ? Info.months(\"long\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable short weekday, such as 'Mon'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon\n * @type {string}\n */\n get weekdayShort() {\n return this.isValid ? Info.weekdays(\"short\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the human readable long weekday, such as 'Monday'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday\n * @type {string}\n */\n get weekdayLong() {\n return this.isValid ? Info.weekdays(\"long\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the UTC offset of this DateTime in minutes\n * @example DateTime.now().offset //=> -240\n * @example DateTime.utc().offset //=> 0\n * @type {number}\n */\n get offset() {\n return this.isValid ? +this.o : NaN;\n }\n\n /**\n * Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameShort() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"short\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get the long human name for the zone's current offset, for example \"Eastern Standard Time\" or \"Eastern Daylight Time\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameLong() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"long\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get whether this zone's offset ever changes, as in a DST.\n * @type {boolean}\n */\n get isOffsetFixed() {\n return this.isValid ? this.zone.isUniversal : null;\n }\n\n /**\n * Get whether the DateTime is in a DST.\n * @type {boolean}\n */\n get isInDST() {\n if (this.isOffsetFixed) {\n return false;\n } else {\n return (\n this.offset > this.set({ month: 1, day: 1 }).offset ||\n this.offset > this.set({ month: 5 }).offset\n );\n }\n }\n\n /**\n * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC\n * in this DateTime's zone. During DST changes local time can be ambiguous, for example\n * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`.\n * This method will return both possible DateTimes if this DateTime's local time is ambiguous.\n * @returns {DateTime[]}\n */\n getPossibleOffsets() {\n if (!this.isValid || this.isOffsetFixed) {\n return [this];\n }\n const dayMs = 86400000;\n const minuteMs = 60000;\n const localTS = objToLocalTS(this.c);\n const oEarlier = this.zone.offset(localTS - dayMs);\n const oLater = this.zone.offset(localTS + dayMs);\n\n const o1 = this.zone.offset(localTS - oEarlier * minuteMs);\n const o2 = this.zone.offset(localTS - oLater * minuteMs);\n if (o1 === o2) {\n return [this];\n }\n const ts1 = localTS - o1 * minuteMs;\n const ts2 = localTS - o2 * minuteMs;\n const c1 = tsToObj(ts1, o1);\n const c2 = tsToObj(ts2, o2);\n if (\n c1.hour === c2.hour &&\n c1.minute === c2.minute &&\n c1.second === c2.second &&\n c1.millisecond === c2.millisecond\n ) {\n return [clone(this, { ts: ts1 }), clone(this, { ts: ts2 })];\n }\n return [this];\n }\n\n /**\n * Returns true if this DateTime is in a leap year, false otherwise\n * @example DateTime.local(2016).isInLeapYear //=> true\n * @example DateTime.local(2013).isInLeapYear //=> false\n * @type {boolean}\n */\n get isInLeapYear() {\n return isLeapYear(this.year);\n }\n\n /**\n * Returns the number of days in this DateTime's month\n * @example DateTime.local(2016, 2).daysInMonth //=> 29\n * @example DateTime.local(2016, 3).daysInMonth //=> 31\n * @type {number}\n */\n get daysInMonth() {\n return daysInMonth(this.year, this.month);\n }\n\n /**\n * Returns the number of days in this DateTime's year\n * @example DateTime.local(2016).daysInYear //=> 366\n * @example DateTime.local(2013).daysInYear //=> 365\n * @type {number}\n */\n get daysInYear() {\n return this.isValid ? daysInYear(this.year) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2004).weeksInWeekYear //=> 53\n * @example DateTime.local(2013).weeksInWeekYear //=> 52\n * @type {number}\n */\n get weeksInWeekYear() {\n return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's local week year\n * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52\n * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53\n * @type {number}\n */\n get weeksInLocalWeekYear() {\n return this.isValid\n ? weeksInWeekYear(\n this.localWeekYear,\n this.loc.getMinDaysInFirstWeek(),\n this.loc.getStartOfWeek()\n )\n : NaN;\n }\n\n /**\n * Returns the resolved Intl options for this DateTime.\n * This is useful in understanding the behavior of formatting methods\n * @param {Object} opts - the same options as toLocaleString\n * @return {Object}\n */\n resolvedLocaleOptions(opts = {}) {\n const { locale, numberingSystem, calendar } = Formatter.create(\n this.loc.clone(opts),\n opts\n ).resolvedOptions(this);\n return { locale, numberingSystem, outputCalendar: calendar };\n }\n\n // TRANSFORM\n\n /**\n * \"Set\" the DateTime's zone to UTC. Returns a newly-constructed DateTime.\n *\n * Equivalent to {@link DateTime#setZone}('utc')\n * @param {number} [offset=0] - optionally, an offset from UTC in minutes\n * @param {Object} [opts={}] - options to pass to `setZone()`\n * @return {DateTime}\n */\n toUTC(offset = 0, opts = {}) {\n return this.setZone(FixedOffsetZone.instance(offset), opts);\n }\n\n /**\n * \"Set\" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.\n *\n * Equivalent to `setZone('local')`\n * @return {DateTime}\n */\n toLocal() {\n return this.setZone(Settings.defaultZone);\n }\n\n /**\n * \"Set\" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.\n *\n * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones.\n * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class.\n * @param {Object} opts - options\n * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.\n * @return {DateTime}\n */\n setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {\n zone = normalizeZone(zone, Settings.defaultZone);\n if (zone.equals(this.zone)) {\n return this;\n } else if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n } else {\n let newTS = this.ts;\n if (keepLocalTime || keepCalendarTime) {\n const offsetGuess = zone.offset(this.ts);\n const asObj = this.toObject();\n [newTS] = objToTS(asObj, offsetGuess, zone);\n }\n return clone(this, { ts: newTS, zone });\n }\n }\n\n /**\n * \"Set\" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.\n * @param {Object} properties - the properties to set\n * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })\n * @return {DateTime}\n */\n reconfigure({ locale, numberingSystem, outputCalendar } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });\n return clone(this, { loc });\n }\n\n /**\n * \"Set\" the locale. Returns a newly-constructed DateTime.\n * Just a convenient alias for reconfigure({ locale })\n * @example DateTime.local(2017, 5, 25).setLocale('en-GB')\n * @return {DateTime}\n */\n setLocale(locale) {\n return this.reconfigure({ locale });\n }\n\n /**\n * \"Set\" the values of specified units. Returns a newly-constructed DateTime.\n * You can only set units with this method; for \"setting\" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.\n *\n * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.\n * They cannot be mixed with ISO-week units like `weekday`.\n * @param {Object} values - a mapping of units to numbers\n * @example dt.set({ year: 2017 })\n * @example dt.set({ hour: 8, minute: 30 })\n * @example dt.set({ weekday: 5 })\n * @example dt.set({ year: 2005, ordinal: 234 })\n * @return {DateTime}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);\n const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, this.loc);\n\n const settingWeekStuff =\n !isUndefined(normalized.weekYear) ||\n !isUndefined(normalized.weekNumber) ||\n !isUndefined(normalized.weekday),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber;\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n let mixed;\n if (settingWeekStuff) {\n mixed = weekToGregorian(\n { ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), ...normalized },\n minDaysInFirstWeek,\n startOfWeek\n );\n } else if (!isUndefined(normalized.ordinal)) {\n mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized });\n } else {\n mixed = { ...this.toObject(), ...normalized };\n\n // if we didn't set the day but we ended up on an overflow date,\n // use the last day of the right month\n if (isUndefined(normalized.day)) {\n mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);\n }\n }\n\n const [ts, o] = objToTS(mixed, this.o, this.zone);\n return clone(this, { ts, o });\n }\n\n /**\n * Add a period of time to this DateTime and return the resulting DateTime\n *\n * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @example DateTime.now().plus(123) //~> in 123 milliseconds\n * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes\n * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow\n * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday\n * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min\n * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min\n * @return {DateTime}\n */\n plus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration);\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * Subtract a period of time to this DateTime and return the resulting DateTime\n * See {@link DateTime#plus}\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n @return {DateTime}\n */\n minus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration).negate();\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * \"Set\" this DateTime to the beginning of a unit of time.\n * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week\n * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'\n * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'\n * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'\n * @return {DateTime}\n */\n startOf(unit, { useLocaleWeeks = false } = {}) {\n if (!this.isValid) return this;\n\n const o = {},\n normalizedUnit = Duration.normalizeUnit(unit);\n switch (normalizedUnit) {\n case \"years\":\n o.month = 1;\n // falls through\n case \"quarters\":\n case \"months\":\n o.day = 1;\n // falls through\n case \"weeks\":\n case \"days\":\n o.hour = 0;\n // falls through\n case \"hours\":\n o.minute = 0;\n // falls through\n case \"minutes\":\n o.second = 0;\n // falls through\n case \"seconds\":\n o.millisecond = 0;\n break;\n case \"milliseconds\":\n break;\n // no default, invalid units throw in normalizeUnit()\n }\n\n if (normalizedUnit === \"weeks\") {\n if (useLocaleWeeks) {\n const startOfWeek = this.loc.getStartOfWeek();\n const { weekday } = this;\n if (weekday < startOfWeek) {\n o.weekNumber = this.weekNumber - 1;\n }\n o.weekday = startOfWeek;\n } else {\n o.weekday = 1;\n }\n }\n\n if (normalizedUnit === \"quarters\") {\n const q = Math.ceil(this.month / 3);\n o.month = (q - 1) * 3 + 1;\n }\n\n return this.set(o);\n }\n\n /**\n * \"Set\" this DateTime to the end (meaning the last millisecond) of a unit of time\n * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week\n * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'\n * @return {DateTime}\n */\n endOf(unit, opts) {\n return this.isValid\n ? this.plus({ [unit]: 1 })\n .startOf(unit, opts)\n .minus(1)\n : this;\n }\n\n // OUTPUT\n\n /**\n * Returns a string representation of this DateTime formatted according to the specified format string.\n * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens).\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @param {string} fmt - the format string\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22'\n * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'\n * @example DateTime.now().toFormat('yyyy LLL dd', { locale: \"fr\" }) //=> '2017 avr. 22'\n * @example DateTime.now().toFormat(\"HH 'hours and' mm 'minutes'\") //=> '20 hours and 55 minutes'\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.\n * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation\n * of the DateTime in the assigned locale.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toLocaleString(); //=> 4/20/2017\n * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'\n * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'\n * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022'\n * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'\n * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'\n * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'\n * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'\n * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32'\n * @return {string}\n */\n toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this)\n : INVALID;\n }\n\n /**\n * Returns an array of format \"parts\", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts\n * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.\n * @example DateTime.now().toLocaleParts(); //=> [\n * //=> { type: 'day', value: '25' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'month', value: '05' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'year', value: '1982' }\n * //=> ]\n */\n toLocaleParts(opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this)\n : [];\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.extendedZone=false] - add the time zone format extension\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.\n * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'\n * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'\n * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'\n * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'\n * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z'\n * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z'\n * @return {string|null}\n */\n toISO({\n format = \"extended\",\n suppressSeconds = false,\n suppressMilliseconds = false,\n includeOffset = true,\n extendedZone = false,\n precision = \"milliseconds\",\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n precision = normalizeUnit(precision);\n const ext = format === \"extended\";\n\n let c = toISODate(this, ext, precision);\n if (orderedUnits.indexOf(precision) >= 3) c += \"T\";\n c += toISOTime(\n this,\n ext,\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n );\n return c;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's date component\n * @param {Object} opts - options\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'.\n * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'\n * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'\n * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05'\n * @return {string|null}\n */\n toISODate({ format = \"extended\", precision = \"day\" } = {}) {\n if (!this.isValid) {\n return null;\n }\n return toISODate(this, format === \"extended\", normalizeUnit(precision));\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's week date\n * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'\n * @return {string}\n */\n toISOWeekDate() {\n return toTechFormat(this, \"kkkk-'W'WW-c\");\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's time component\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.extendedZone=true] - add the time zone format extension\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z'\n * @return {string}\n */\n toISOTime({\n suppressMilliseconds = false,\n suppressSeconds = false,\n includeOffset = true,\n includePrefix = false,\n extendedZone = false,\n format = \"extended\",\n precision = \"milliseconds\",\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n precision = normalizeUnit(precision);\n let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? \"T\" : \"\";\n return (\n c +\n toISOTime(\n this,\n format === \"extended\",\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n )\n );\n }\n\n /**\n * Returns an RFC 2822-compatible string representation of this DateTime\n * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'\n * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'\n * @return {string}\n */\n toRFC2822() {\n return toTechFormat(this, \"EEE, dd LLL yyyy HH:mm:ss ZZZ\", false);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.\n * Specifically, the string conforms to RFC 1123.\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'\n * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'\n * @return {string}\n */\n toHTTP() {\n return toTechFormat(this.toUTC(), \"EEE, dd LLL yyyy HH:mm:ss 'GMT'\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Date\n * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'\n * @return {string|null}\n */\n toSQLDate() {\n if (!this.isValid) {\n return null;\n }\n return toISODate(this, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Time\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'\n * @example DateTime.utc().toSQL() //=> '05:15:16.345'\n * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00'\n * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345'\n * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'\n * @return {string}\n */\n toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) {\n let fmt = \"HH:mm:ss.SSS\";\n\n if (includeZone || includeOffset) {\n if (includeOffsetSpace) {\n fmt += \" \";\n }\n if (includeZone) {\n fmt += \"z\";\n } else if (includeOffset) {\n fmt += \"ZZ\";\n }\n }\n\n return toTechFormat(this, fmt, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'\n * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'\n * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'\n * @return {string}\n */\n toSQL(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for debugging\n * @return {string}\n */\n toString() {\n return this.isValid ? this.toISO() : INVALID;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;\n } else {\n return `DateTime { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime.\n * @return {number}\n */\n toMillis() {\n return this.isValid ? this.ts : NaN;\n }\n\n /**\n * Returns the epoch seconds (including milliseconds in the fractional part) of this DateTime.\n * @return {number}\n */\n toSeconds() {\n return this.isValid ? this.ts / 1000 : NaN;\n }\n\n /**\n * Returns the epoch seconds (as a whole number) of this DateTime.\n * @return {number}\n */\n toUnixInteger() {\n return this.isValid ? Math.floor(this.ts / 1000) : NaN;\n }\n\n /**\n * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns a BSON serializable equivalent to this DateTime.\n * @return {Date}\n */\n toBSON() {\n return this.toJSDate();\n }\n\n /**\n * Returns a JavaScript object with this DateTime's year, month, day, and so on.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = { ...this.c };\n\n if (opts.includeConfig) {\n base.outputCalendar = this.outputCalendar;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns a JavaScript Date equivalent to this DateTime.\n * @return {Date}\n */\n toJSDate() {\n return new Date(this.isValid ? this.ts : NaN);\n }\n\n // COMPARE\n\n /**\n * Return the difference between two DateTimes as a Duration.\n * @param {DateTime} otherDateTime - the DateTime to compare this one to\n * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example\n * var i1 = DateTime.fromISO('1982-05-25T09:45'),\n * i2 = DateTime.fromISO('1983-10-14T10:30');\n * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\n * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\n * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\n * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n * @return {Duration}\n */\n diff(otherDateTime, unit = \"milliseconds\", opts = {}) {\n if (!this.isValid || !otherDateTime.isValid) {\n return Duration.invalid(\"created by diffing an invalid DateTime\");\n }\n\n const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts };\n\n const units = maybeArray(unit).map(Duration.normalizeUnit),\n otherIsLater = otherDateTime.valueOf() > this.valueOf(),\n earlier = otherIsLater ? this : otherDateTime,\n later = otherIsLater ? otherDateTime : this,\n diffed = diff(earlier, later, units, durOpts);\n\n return otherIsLater ? diffed.negate() : diffed;\n }\n\n /**\n * Return the difference between this DateTime and right now.\n * See {@link DateTime#diff}\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n diffNow(unit = \"milliseconds\", opts = {}) {\n return this.diff(DateTime.now(), unit, opts);\n }\n\n /**\n * Return an Interval spanning between this DateTime and another DateTime\n * @param {DateTime} otherDateTime - the other end point of the Interval\n * @return {Interval|DateTime}\n */\n until(otherDateTime) {\n return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;\n }\n\n /**\n * Return whether this DateTime is in the same unit of time as another DateTime.\n * Higher-order units must also be identical for this function to return `true`.\n * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.\n * @param {DateTime} otherDateTime - the other DateTime\n * @param {string} unit - the unit of time to check sameness on\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used\n * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day\n * @return {boolean}\n */\n hasSame(otherDateTime, unit, opts) {\n if (!this.isValid) return false;\n\n const inputMs = otherDateTime.valueOf();\n const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true });\n return (\n adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts)\n );\n }\n\n /**\n * Equality check\n * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid.\n * To compare just the millisecond values, use `+dt1 === +dt2`.\n * @param {DateTime} other - the other DateTime\n * @return {boolean}\n */\n equals(other) {\n return (\n this.isValid &&\n other.isValid &&\n this.valueOf() === other.valueOf() &&\n this.zone.equals(other.zone) &&\n this.loc.equals(other.loc)\n );\n }\n\n /**\n * Returns a string representation of a this time relative to now, such as \"in two days\". Can only internationalize if your\n * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} [options.style=\"long\"] - the style of units, must be \"long\", \"short\", or \"narrow\"\n * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of \"years\", \"quarters\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", or \"seconds\"\n * @param {boolean} [options.round=true] - whether to round the numbers in the output.\n * @param {string} [options.rounding=\"trunc\"] - rounding method to use when rounding the numbers in the output. Can be \"trunc\" (toward zero), \"expand\" (away from zero), \"round\", \"floor\", or \"ceil\".\n * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelative() //=> \"in 1 day\"\n * @example DateTime.now().setLocale(\"es\").toRelative({ days: 1 }) //=> \"dentro de 1 día\"\n * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: \"fr\" }) //=> \"dans 23 heures\"\n * @example DateTime.now().minus({ days: 2 }).toRelative() //=> \"2 days ago\"\n * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: \"hours\" }) //=> \"48 hours ago\"\n * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> \"1.5 days ago\"\n */\n toRelative(options = {}) {\n if (!this.isValid) return null;\n const base = options.base || DateTime.fromObject({}, { zone: this.zone }),\n padding = options.padding ? (this < base ? -options.padding : options.padding) : 0;\n let units = [\"years\", \"months\", \"days\", \"hours\", \"minutes\", \"seconds\"];\n let unit = options.unit;\n if (Array.isArray(options.unit)) {\n units = options.unit;\n unit = undefined;\n }\n return diffRelative(base, this.plus(padding), {\n ...options,\n numeric: \"always\",\n units,\n unit,\n });\n }\n\n /**\n * Returns a string representation of this date relative to today, such as \"yesterday\" or \"next month\".\n * Only internationalizes on platforms that supports Intl.RelativeTimeFormat.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", or \"days\"\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> \"tomorrow\"\n * @example DateTime.now().setLocale(\"es\").plus({ days: 1 }).toRelative() //=> \"\"mañana\"\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: \"fr\" }) //=> \"demain\"\n * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> \"2 days ago\"\n */\n toRelativeCalendar(options = {}) {\n if (!this.isValid) return null;\n\n return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, {\n ...options,\n numeric: \"auto\",\n units: [\"years\", \"months\", \"days\"],\n calendary: true,\n });\n }\n\n /**\n * Return the min of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum\n * @return {DateTime} the min DateTime, or undefined if called with no argument\n */\n static min(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"min requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.min);\n }\n\n /**\n * Return the max of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum\n * @return {DateTime} the max DateTime, or undefined if called with no argument\n */\n static max(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"max requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.max);\n }\n\n // MISC\n\n /**\n * Explain how a string would be parsed by fromFormat()\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see description)\n * @param {Object} options - options taken by fromFormat()\n * @return {Object}\n */\n static fromFormatExplain(text, fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n return explainFromTokens(localeToUse, text, fmt);\n }\n\n /**\n * @deprecated use fromFormatExplain instead\n */\n static fromStringExplain(text, fmt, options = {}) {\n return DateTime.fromFormatExplain(text, fmt, options);\n }\n\n /**\n * Build a parser for `fmt` using the given locale. This parser can be passed\n * to {@link DateTime.fromFormatParser} to a parse a date in this format. This\n * can be used to optimize cases where many dates need to be parsed in a\n * specific format.\n *\n * @param {String} fmt - the format the string is expected to be in (see\n * description)\n * @param {Object} options - options used to set locale and numberingSystem\n * for parser\n * @returns {TokenParser} - opaque object to be used\n */\n static buildFormatParser(fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n return new TokenParser(localeToUse, fmt);\n }\n\n /**\n * Create a DateTime from an input string and format parser.\n *\n * The format parser must have been created with the same locale as this call.\n *\n * @param {String} text - the string to parse\n * @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser}\n * @param {Object} opts - options taken by fromFormat()\n * @returns {DateTime}\n */\n static fromFormatParser(text, formatParser, opts = {}) {\n if (isUndefined(text) || isUndefined(formatParser)) {\n throw new InvalidArgumentError(\n \"fromFormatParser requires an input string and a format parser\"\n );\n }\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n\n if (!localeToUse.equals(formatParser.locale)) {\n throw new InvalidArgumentError(\n `fromFormatParser called with a locale of ${localeToUse}, ` +\n `but the format parser was created for ${formatParser.locale}`\n );\n }\n\n const { result, zone, specificOffset, invalidReason } = formatParser.explainFromTokens(text);\n\n if (invalidReason) {\n return DateTime.invalid(invalidReason);\n } else {\n return parseDataToDateTime(\n result,\n zone,\n opts,\n `format ${formatParser.format}`,\n text,\n specificOffset\n );\n }\n }\n\n // FORMAT PRESETS\n\n /**\n * {@link DateTime#toLocaleString} format like 10/14/1983\n * @type {Object}\n */\n static get DATE_SHORT() {\n return Formats.DATE_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED() {\n return Formats.DATE_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED_WITH_WEEKDAY() {\n return Formats.DATE_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983'\n * @type {Object}\n */\n static get DATE_FULL() {\n return Formats.DATE_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983'\n * @type {Object}\n */\n static get DATE_HUGE() {\n return Formats.DATE_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_SIMPLE() {\n return Formats.TIME_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SECONDS() {\n return Formats.TIME_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SHORT_OFFSET() {\n return Formats.TIME_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_LONG_OFFSET() {\n return Formats.TIME_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_SIMPLE() {\n return Formats.TIME_24_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SECONDS() {\n return Formats.TIME_24_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SHORT_OFFSET() {\n return Formats.TIME_24_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_LONG_OFFSET() {\n return Formats.TIME_24_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT() {\n return Formats.DATETIME_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT_WITH_SECONDS() {\n return Formats.DATETIME_SHORT_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED() {\n return Formats.DATETIME_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_SECONDS() {\n return Formats.DATETIME_MED_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_WEEKDAY() {\n return Formats.DATETIME_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL() {\n return Formats.DATETIME_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL_WITH_SECONDS() {\n return Formats.DATETIME_FULL_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE() {\n return Formats.DATETIME_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE_WITH_SECONDS() {\n return Formats.DATETIME_HUGE_WITH_SECONDS;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDateTime(dateTimeish) {\n if (DateTime.isDateTime(dateTimeish)) {\n return dateTimeish;\n } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {\n return DateTime.fromJSDate(dateTimeish);\n } else if (dateTimeish && typeof dateTimeish === \"object\") {\n return DateTime.fromObject(dateTimeish);\n } else {\n throw new InvalidArgumentError(\n `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`\n );\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Duration from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Info from \"./info.js\";\nimport Zone from \"./zone.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport InvalidZone from \"./zones/invalidZone.js\";\nimport SystemZone from \"./zones/systemZone.js\";\nimport Settings from \"./settings.js\";\n\nconst VERSION = \"3.7.2\";\n\nexport {\n VERSION,\n DateTime,\n Duration,\n Interval,\n Info,\n Zone,\n FixedOffsetZone,\n IANAZone,\n InvalidZone,\n SystemZone,\n Settings,\n};\n"],"names":["LuxonError","_Error","_inheritsLoose","apply","arguments","_wrapNativeSuper","Error","InvalidDateTimeError","_LuxonError","reason","call","toMessage","InvalidIntervalError","_LuxonError2","InvalidDurationError","_LuxonError3","ConflictingSpecificationError","_LuxonError4","InvalidUnitError","_LuxonError5","unit","InvalidArgumentError","_LuxonError6","ZoneIsAbstractError","_LuxonError7","n","s","l","DATE_SHORT","year","month","day","DATE_MED","DATE_MED_WITH_WEEKDAY","weekday","DATE_FULL","DATE_HUGE","TIME_SIMPLE","hour","minute","TIME_WITH_SECONDS","second","TIME_WITH_SHORT_OFFSET","timeZoneName","TIME_WITH_LONG_OFFSET","TIME_24_SIMPLE","hourCycle","TIME_24_WITH_SECONDS","TIME_24_WITH_SHORT_OFFSET","TIME_24_WITH_LONG_OFFSET","DATETIME_SHORT","DATETIME_SHORT_WITH_SECONDS","DATETIME_MED","DATETIME_MED_WITH_SECONDS","DATETIME_MED_WITH_WEEKDAY","DATETIME_FULL","DATETIME_FULL_WITH_SECONDS","DATETIME_HUGE","DATETIME_HUGE_WITH_SECONDS","Zone","_proto","prototype","offsetName","ts","opts","formatOffset","format","offset","equals","otherZone","_createClass","key","get","name","singleton","SystemZone","_Zone","_ref","locale","parseZoneInfo","Date","getTimezoneOffset","type","Intl","DateTimeFormat","resolvedOptions","timeZone","dtfCache","Map","makeDTF","zoneName","dtf","undefined","hour12","era","set","typeToPos","hackyOffset","date","formatted","replace","parsed","exec","fMonth","fDay","fYear","fadOrBc","fHour","fMinute","fSecond","partsOffset","formatToParts","filled","i","length","_formatted$i","value","pos","isUndefined","parseInt","ianaZoneCache","IANAZone","create","zone","resetCache","clear","isValidSpecifier","isValidZone","e","_this","valid","NaN","isNaN","_ref2","adOrBc","Math","abs","adjustedHour","asUTC","objToLocalTS","millisecond","asTS","over","intlLFCache","getCachedLF","locString","JSON","stringify","ListFormat","intlDTCache","getCachedDTF","intlNumCache","getCachedINF","inf","NumberFormat","intlRelCache","getCachedRTF","_opts","base","cacheKeyOpts","_objectWithoutPropertiesLoose","_excluded","RelativeTimeFormat","sysLocaleCache","systemLocale","intlResolvedOptionsCache","getCachedIntResolvedOptions","weekInfoCache","getCachedWeekInfo","data","Locale","getWeekInfo","weekInfo","_extends","fallbackWeekSettings","parseLocaleString","localeStr","xIndex","indexOf","substring","uIndex","options","selectedStr","smaller","_options","numberingSystem","calendar","intlConfigString","outputCalendar","includes","mapMonths","f","ms","dt","DateTime","utc","push","mapWeekdays","listStuff","loc","englishFn","intlFn","mode","listingMode","supportsFastNumbers","startsWith","PolyNumberFormatter","intl","forceSimple","padTo","floor","otherOpts","_excluded2","Object","keys","intlOpts","useGrouping","minimumIntegerDigits","fixed","roundTo","padStart","PolyDateFormatter","originalZone","z","gmtOffset","offsetZ","setZone","plus","minutes","_proto2","map","join","toJSDate","parts","part","PolyRelFormatter","isEnglish","style","hasRelative","rtf","_proto3","count","English","numeric","firstDay","minimalDays","weekend","fromOpts","weekSettings","defaultToEN","specifiedLocale","Settings","defaultLocale","localeR","numberingSystemR","defaultNumberingSystem","outputCalendarR","defaultOutputCalendar","weekSettingsR","validateWeekSettings","defaultWeekSettings","fromObject","_temp","numbering","_parseLocaleString","parsedLocale","parsedNumberingSystem","parsedOutputCalendar","weekdaysCache","standalone","monthsCache","meridiemCache","eraCache","fastNumbersCached","_proto4","isActuallyEn","hasNoWeirdness","clone","alts","getOwnPropertyNames","redefaultToEN","redefaultToSystem","months","_this2","monthSpecialCase","formatStr","mapper","extract","dtFormatter","weekdays","_this3","meridiems","_this4","eras","_this5","field","df","results","matching","find","m","toLowerCase","numberFormatter","fastNumbers","relFormatter","listFormatter","getWeekSettings","hasLocaleWeekInfo","getStartOfWeek","getMinDaysInFirstWeek","getWeekendDays","other","toString","FixedOffsetZone","instance","utcInstance","parseSpecifier","r","match","signedOffset","InvalidZone","normalizeZone","input","defaultZone","isString","lowered","isNumber","numberingSystems","arab","arabext","bali","beng","deva","fullwide","gujr","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","latn","numberingSystemsUTF16","hanidecChars","split","parseDigits","str","code","charCodeAt","search","_numberingSystemsUTF","min","max","digitRegexCache","resetDigitRegexCache","digitRegex","append","ns","appendCache","regex","RegExp","now","twoDigitCutoffYear","throwOnInvalid","resetCaches","cutoffYear","t","Invalid","explanation","nonLeapLadder","leapLadder","unitOutOfRange","dayOfWeek","d","UTC","setUTCFullYear","getUTCFullYear","js","getUTCDay","computeOrdinal","isLeapYear","uncomputeOrdinal","ordinal","table","month0","findIndex","isoWeekdayToLocal","isoWeekday","startOfWeek","gregorianToWeek","gregObj","minDaysInFirstWeek","weekNumber","weekYear","weeksInWeekYear","timeObject","weekToGregorian","weekData","weekdayOfJan4","yearInDays","daysInYear","_uncomputeOrdinal","gregorianToOrdinal","gregData","ordinalToGregorian","ordinalData","_uncomputeOrdinal2","usesLocalWeekValues","obj","hasLocaleWeekData","localWeekday","localWeekNumber","localWeekYear","hasIsoWeekData","hasInvalidWeekData","validYear","isInteger","validWeek","integerBetween","validWeekday","hasInvalidOrdinalData","validOrdinal","hasInvalidGregorianData","validMonth","validDay","daysInMonth","hasInvalidTimeData","validHour","validMinute","validSecond","validMillisecond","o","isDate","maybeArray","thing","Array","isArray","bestBy","arr","by","compare","reduce","best","next","pair","pick","a","k","hasOwnProperty","prop","settings","some","v","from","bottom","top","floorMod","x","isNeg","padded","parseInteger","string","parseFloating","parseFloat","parseMillis","fraction","number","digits","rounding","factor","pow","ceil","trunc","round","RangeError","modMonth","modYear","firstWeekOffset","fwdlw","weekOffset","weekOffsetNext","untruncateYear","offsetFormat","modified","offHourStr","offMinuteStr","offHour","Number","offMin","offMinSigned","is","asNumber","numericValue","isFinite","normalizeObject","normalizer","normalized","u","hours","sign","monthsLong","monthsShort","monthsNarrow","concat","weekdaysLong","weekdaysShort","weekdaysNarrow","erasLong","erasShort","erasNarrow","meridiemForDateTime","weekdayForDateTime","monthForDateTime","eraForDateTime","formatRelativeTime","narrow","units","years","quarters","weeks","days","seconds","lastable","isDay","isInPast","fmtValue","singular","lilUnits","fmtUnit","stringifyTokens","splits","tokenToString","_iterator","_createForOfIteratorHelperLoose","_step","done","token","literal","val","macroTokenToFormatOpts","D","Formats","DD","DDD","DDDD","tt","ttt","tttt","T","TT","TTT","TTTT","ff","fff","ffff","F","FF","FFF","FFFF","Formatter","parseFormat","fmt","current","currentFull","bracketed","c","charAt","test","formatOpts","systemLoc","formatWithSystemDefault","formatDateTime","formatDateTimeParts","formatInterval","interval","start","formatRange","end","num","p","signDisplay","formatDateTimeFromString","knownEnglish","useDateTimeFormatter","isOffsetFixed","allowZ","isValid","meridiem","maybeMacro","slice","quarter","formatDurationFromString","dur","invertLargest","signMode","tokenToField","lildur","info","mapped","inversionFactor","isNegativeDuration","largestUnit","tokens","realTokens","found","collapsed","shiftTo","filter","durationInfo","values","ianaRegex","combineRegexes","_len","regexes","_key","full","source","combineExtractors","_len2","extractors","_key2","ex","mergedVals","mergedZone","cursor","_ex","parse","_len3","patterns","_key3","_i","_patterns","_patterns$_i","extractor","simpleParse","_len4","_key4","ret","offsetRegex","isoExtendedZone","isoTimeBaseRegex","isoTimeRegex","isoTimeExtensionRegex","isoYmdRegex","isoWeekRegex","isoOrdinalRegex","extractISOWeekData","extractISOOrdinalData","sqlYmdRegex","sqlTimeRegex","sqlTimeExtensionRegex","int","fallback","extractISOYmd","item","extractISOTime","milliseconds","extractISOOffset","local","fullOffset","extractIANAZone","isoTimeOnly","isoDuration","extractISODuration","yearStr","monthStr","weekStr","dayStr","hourStr","minuteStr","secondStr","millisecondsStr","hasNegativePrefix","negativeSeconds","maybeNegate","force","obsOffsets","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","fromStrings","weekdayStr","result","rfc2822","extractRFC2822","obsOffset","milOffset","preprocessRFC2822","trim","rfc1123","rfc850","ascii","extractRFC1123Or850","extractASCII","isoYmdWithTimeExtensionRegex","isoWeekWithTimeExtensionRegex","isoOrdinalWithTimeExtensionRegex","isoTimeCombinedRegex","extractISOYmdTimeAndOffset","extractISOWeekTimeAndOffset","extractISOOrdinalDateAndTime","extractISOTimeAndOffset","parseISODate","parseRFC2822Date","parseHTTPDate","parseISODuration","extractISOTimeOnly","parseISOTimeOnly","sqlYmdWithTimeExtensionRegex","sqlTimeCombinedRegex","extractISOTimeOffsetAndIANAZone","parseSQL","INVALID","lowOrderMatrix","casualMatrix","daysInYearAccurate","daysInMonthAccurate","accurateMatrix","orderedUnits","reverseUnits","reverse","conf","conversionAccuracy","matrix","Duration","durationToMillis","vals","_vals$milliseconds","sum","normalizeValues","reduceRight","previous","previousVal","conv","rollUp","removeZeroes","newVals","_Object$entries","entries","_Object$entries$_i","_Symbol$for","config","accurate","invalid","isLuxonDuration","fromMillis","normalizeUnit","fromDurationLike","durationLike","isDuration","fromISO","text","_parseISODuration","fromISOTime","_parseISOTimeOnly","week","toFormat","fmtOpts","toHuman","showZeros","unitDisplay","listStyle","toObject","toISO","toISOTime","millis","toMillis","suppressMilliseconds","suppressSeconds","includePrefix","includeOffset","dateTime","toJSON","invalidReason","valueOf","duration","_i2","_orderedUnits","minus","negate","mapUnits","fn","_i3","_Object$keys","mixed","reconfigure","as","normalize","rescale","shiftToAll","built","accumulated","lastUnit","_i4","_orderedUnits2","own","ak","negated","_i5","_Object$keys2","removeZeros","eq","v1","v2","_i6","_orderedUnits3","Symbol","for","validateStartEnd","Interval","isLuxonInterval","fromDateTimes","builtStart","friendlyDateTime","builtEnd","validateError","after","before","_split","startIsValid","endIsValid","isInterval","toDuration","startOf","useLocaleWeeks","diff","hasSame","isEmpty","isAfter","isBefore","contains","splitAt","dateTimes","sorted","sort","b","added","splitBy","idx","divideEqually","numberOfParts","overlaps","abutsStart","abutsEnd","engulfs","intersection","union","merge","intervals","_intervals$sort$reduc","sofar","final","xor","_Array$prototype","currentCount","ends","time","flattened","difference","toLocaleString","toISODate","dateFormat","_temp2","_ref3","_ref3$separator","separator","mapEndpoints","mapFn","Info","hasDST","proto","isUniversal","isValidIANAZone","_ref$locale","_ref$locObj","locObj","getMinimumDaysInFirstWeek","_ref2$locale","_ref2$locObj","getWeekendWeekdays","_temp3","_ref3$locale","_ref3$locObj","_temp4","_ref4","_ref4$locale","_ref4$numberingSystem","_ref4$locObj","_ref4$outputCalendar","monthsFormat","_temp5","_ref5","_ref5$locale","_ref5$numberingSystem","_ref5$locObj","_ref5$outputCalendar","_temp6","_ref6","_ref6$locale","_ref6$numberingSystem","_ref6$locObj","weekdaysFormat","_temp7","_ref7","_ref7$locale","_ref7$numberingSystem","_ref7$locObj","_temp8","_ref8","_ref8$locale","_temp9","_ref9","_ref9$locale","features","relative","localeWeek","dayDiff","earlier","later","utcDayStart","toUTC","keepLocalTime","highOrderDiffs","differs","lowestOrder","highWater","_differs","_differs$_i","differ","_highOrderDiffs","remainingMillis","lowerOrderUnits","_cursor$plus","_Duration$fromMillis","MISSING_FTP","intUnit","post","deser","NBSP","String","fromCharCode","spaceOrNBSP","spaceOrNBSPRegExp","fixListRegex","stripInsensitivities","oneOf","strings","startIndex","groups","h","simple","escapeToken","unitForToken","one","two","three","four","six","oneOrTwo","oneToThree","oneToSix","oneToNine","twoToFour","fourToSix","unitate","partTypeStyleToTokenVal","short","long","dayperiod","dayPeriod","hour24","tokenForPart","resolvedOpts","isSpace","actualType","buildRegex","re","handlers","matches","all","matchIndex","dateTimeFromMatches","toField","specificOffset","Z","q","M","G","y","S","dummyDateTimeCache","getDummyDateTime","maybeExpandMacroToken","formatOptsToTokens","expandMacroTokens","TokenParser","disqualifyingUnit","_buildRegex","regexString","explainFromTokens","_match","rawMatches","parser","parseFromTokens","_explainFromTokens","formatter","MAX_DATE","unsupportedZone","possiblyCachedWeekData","possiblyCachedLocalWeekData","localWeekData","inst","old","fixOffset","localTS","tz","utcGuess","o2","o3","tsToObj","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","objToTS","adjustTime","oPre","millisToAdd","_fixOffset","parseDataToDateTime","parsedZone","interpretationZone","toTechFormat","extended","precision","longFormat","extendedZone","showSeconds","ianaName","defaultUnitValues","defaultWeekUnitValues","defaultOrdinalUnitValues","orderedWeekUnits","orderedOrdinalUnits","weeknumber","weeksnumber","weeknumbers","weekyear","weekyears","normalizeUnitWithLocalWeeks","guessOffsetForZone","zoneOffsetTs","offsetGuess","zoneOffsetGuessCache","quickDT","offsetProvis","_objToTS","diffRelative","calendary","lastOpts","argList","args","unchanged","ot","_zone","isLuxonDateTime","_lastOpts","_lastOpts2","fromJSDate","zoneToUse","fromSeconds","_usesLocalWeekValues","tsNow","containsOrdinal","containsGregorYear","containsGregorMD","containsGregor","definiteWeekDef","useWeekData","defaultValues","objNow","foundFirst","_iterator2","_step2","higherOrderInvalid","gregorian","_objToTS2","tsFinal","offsetFinal","_parseISODate","fromRFC2822","_parseRFC2822Date","fromHTTP","_parseHTTPDate","fromFormat","_opts$locale","_opts$numberingSystem","localeToUse","_parseFromTokens","fromString","fromSQL","_parseSQL","isDateTime","parseFormatForOpts","localeOpts","tokenList","expandFormat","expanded","getPossibleOffsets","dayMs","minuteMs","oEarlier","oLater","o1","ts1","ts2","c1","c2","resolvedLocaleOptions","_Formatter$create$res","toLocal","_ref2$keepLocalTime","_ref2$keepCalendarTim","keepCalendarTime","newTS","asObj","_objToTS3","setLocale","_usesLocalWeekValues2","settingWeekStuff","_objToTS4","_ref4$useLocaleWeeks","normalizedUnit","endOf","_this$plus","toLocaleParts","_ref5$format","_ref5$suppressSeconds","_ref5$suppressMillise","_ref5$includeOffset","_ref5$extendedZone","_ref5$precision","ext","_ref6$format","_ref6$precision","toISOWeekDate","_ref7$suppressMillise","_ref7$suppressSeconds","_ref7$includeOffset","_ref7$includePrefix","_ref7$extendedZone","_ref7$format","_ref7$precision","toRFC2822","toHTTP","toSQLDate","toSQLTime","_ref8$includeOffset","_ref8$includeZone","includeZone","_ref8$includeOffsetSp","includeOffsetSpace","toSQL","toSeconds","toUnixInteger","toBSON","includeConfig","otherDateTime","durOpts","otherIsLater","diffed","diffNow","until","inputMs","adjustedToZone","toRelative","padding","toRelativeCalendar","every","fromFormatExplain","_options$locale","_options$numberingSys","fromStringExplain","buildFormatParser","_options2","_options2$locale","_options2$numberingSy","fromFormatParser","formatParser","_opts2","_opts2$locale","_opts2$numberingSyste","_formatParser$explain","dateTimeish","VERSION"],"mappings":";;;;;;;;;;;;;;;;;;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,EAAE,CAAC,EAAE;AAChF,IAAA,OAAOjlB,QAAQ,CAACy3B,UAAU,CAAC6H,WAAW,CAAC,CAAA;GACxC,MAAM,IAAIA,WAAW,IAAI,OAAOA,WAAW,KAAK,QAAQ,EAAE;AACzD,IAAA,OAAOt/B,QAAQ,CAACmE,UAAU,CAACm7B,WAAW,CAAC,CAAA;AACzC,GAAC,MAAM;AACL,IAAA,MAAM,IAAInqC,oBAAoB,CAAA,6BAAA,GACEmqC,WAAW,GAAa,YAAA,GAAA,OAAOA,WAC/D,CAAC,CAAA;AACH,GAAA;AACF;;AC/hFMC,IAAAA,OAAO,GAAG;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/luxon/build/es6/luxon.mjs b/node_modules/luxon/build/es6/luxon.mjs new file mode 100644 index 00000000..06e1d6cb --- /dev/null +++ b/node_modules/luxon/build/es6/luxon.mjs @@ -0,0 +1,8133 @@ +// these aren't really private, but nor are they really useful to document + +/** + * @private + */ +class LuxonError extends Error {} + +/** + * @private + */ +class InvalidDateTimeError extends LuxonError { + constructor(reason) { + super(`Invalid DateTime: ${reason.toMessage()}`); + } +} + +/** + * @private + */ +class InvalidIntervalError extends LuxonError { + constructor(reason) { + super(`Invalid Interval: ${reason.toMessage()}`); + } +} + +/** + * @private + */ +class InvalidDurationError extends LuxonError { + constructor(reason) { + super(`Invalid Duration: ${reason.toMessage()}`); + } +} + +/** + * @private + */ +class ConflictingSpecificationError extends LuxonError {} + +/** + * @private + */ +class InvalidUnitError extends LuxonError { + constructor(unit) { + super(`Invalid unit ${unit}`); + } +} + +/** + * @private + */ +class InvalidArgumentError extends LuxonError {} + +/** + * @private + */ +class ZoneIsAbstractError extends LuxonError { + constructor() { + super("Zone is an abstract class"); + } +} + +/** + * @private + */ + +const n = "numeric", + s = "short", + l = "long"; + +const DATE_SHORT = { + year: n, + month: n, + day: n, +}; + +const DATE_MED = { + year: n, + month: s, + day: n, +}; + +const DATE_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, +}; + +const DATE_FULL = { + year: n, + month: l, + day: n, +}; + +const DATE_HUGE = { + year: n, + month: l, + day: n, + weekday: l, +}; + +const TIME_SIMPLE = { + hour: n, + minute: n, +}; + +const TIME_WITH_SECONDS = { + hour: n, + minute: n, + second: n, +}; + +const TIME_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: s, +}; + +const TIME_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: l, +}; + +const TIME_24_SIMPLE = { + hour: n, + minute: n, + hourCycle: "h23", +}; + +const TIME_24_WITH_SECONDS = { + hour: n, + minute: n, + second: n, + hourCycle: "h23", +}; + +const TIME_24_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + hourCycle: "h23", + timeZoneName: s, +}; + +const TIME_24_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + hourCycle: "h23", + timeZoneName: l, +}; + +const DATETIME_SHORT = { + year: n, + month: n, + day: n, + hour: n, + minute: n, +}; + +const DATETIME_SHORT_WITH_SECONDS = { + year: n, + month: n, + day: n, + hour: n, + minute: n, + second: n, +}; + +const DATETIME_MED = { + year: n, + month: s, + day: n, + hour: n, + minute: n, +}; + +const DATETIME_MED_WITH_SECONDS = { + year: n, + month: s, + day: n, + hour: n, + minute: n, + second: n, +}; + +const DATETIME_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, + hour: n, + minute: n, +}; + +const DATETIME_FULL = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + timeZoneName: s, +}; + +const DATETIME_FULL_WITH_SECONDS = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + second: n, + timeZoneName: s, +}; + +const DATETIME_HUGE = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + timeZoneName: l, +}; + +const DATETIME_HUGE_WITH_SECONDS = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + second: n, + timeZoneName: l, +}; + +/** + * @interface + */ +class Zone { + /** + * The type of zone + * @abstract + * @type {string} + */ + get type() { + throw new ZoneIsAbstractError(); + } + + /** + * The name of this zone. + * @abstract + * @type {string} + */ + get name() { + throw new ZoneIsAbstractError(); + } + + /** + * The IANA name of this zone. + * Defaults to `name` if not overwritten by a subclass. + * @abstract + * @type {string} + */ + get ianaName() { + return this.name; + } + + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + get isUniversal() { + throw new ZoneIsAbstractError(); + } + + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + offsetName(ts, opts) { + throw new ZoneIsAbstractError(); + } + + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + formatOffset(ts, format) { + throw new ZoneIsAbstractError(); + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + offset(ts) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + equals(otherZone) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */ + get isValid() { + throw new ZoneIsAbstractError(); + } +} + +let singleton$1 = null; + +/** + * Represents the local zone for this JavaScript environment. + * @implements {Zone} + */ +class SystemZone extends Zone { + /** + * Get a singleton instance of the local zone + * @return {SystemZone} + */ + static get instance() { + if (singleton$1 === null) { + singleton$1 = new SystemZone(); + } + return singleton$1; + } + + /** @override **/ + get type() { + return "system"; + } + + /** @override **/ + get name() { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } + + /** @override **/ + get isUniversal() { + return false; + } + + /** @override **/ + offsetName(ts, { format, locale }) { + return parseZoneInfo(ts, format, locale); + } + + /** @override **/ + formatOffset(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** @override **/ + offset(ts) { + return -new Date(ts).getTimezoneOffset(); + } + + /** @override **/ + equals(otherZone) { + return otherZone.type === "system"; + } + + /** @override **/ + get isValid() { + return true; + } +} + +const dtfCache = new Map(); +function makeDTF(zoneName) { + let dtf = dtfCache.get(zoneName); + if (dtf === undefined) { + dtf = new Intl.DateTimeFormat("en-US", { + hour12: false, + timeZone: zoneName, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + era: "short", + }); + dtfCache.set(zoneName, dtf); + } + return dtf; +} + +const typeToPos = { + year: 0, + month: 1, + day: 2, + era: 3, + hour: 4, + minute: 5, + second: 6, +}; + +function hackyOffset(dtf, date) { + const formatted = dtf.format(date).replace(/\u200E/g, ""), + parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted), + [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed; + return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond]; +} + +function partsOffset(dtf, date) { + const formatted = dtf.formatToParts(date); + const filled = []; + for (let i = 0; i < formatted.length; i++) { + const { type, value } = formatted[i]; + const pos = typeToPos[type]; + + if (type === "era") { + filled[pos] = value; + } else if (!isUndefined(pos)) { + filled[pos] = parseInt(value, 10); + } + } + return filled; +} + +const ianaZoneCache = new Map(); +/** + * A zone identified by an IANA identifier, like America/New_York + * @implements {Zone} + */ +class IANAZone extends Zone { + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + static create(name) { + let zone = ianaZoneCache.get(name); + if (zone === undefined) { + ianaZoneCache.set(name, (zone = new IANAZone(name))); + } + return zone; + } + + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */ + static resetCache() { + ianaZoneCache.clear(); + dtfCache.clear(); + } + + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead. + * @return {boolean} + */ + static isValidSpecifier(s) { + return this.isValidZone(s); + } + + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */ + static isValidZone(zone) { + if (!zone) { + return false; + } + try { + new Intl.DateTimeFormat("en-US", { timeZone: zone }).format(); + return true; + } catch (e) { + return false; + } + } + + constructor(name) { + super(); + /** @private **/ + this.zoneName = name; + /** @private **/ + this.valid = IANAZone.isValidZone(name); + } + + /** + * The type of zone. `iana` for all instances of `IANAZone`. + * @override + * @type {string} + */ + get type() { + return "iana"; + } + + /** + * The name of this zone (i.e. the IANA zone name). + * @override + * @type {string} + */ + get name() { + return this.zoneName; + } + + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns false for all IANA zones. + * @override + * @type {boolean} + */ + get isUniversal() { + return false; + } + + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @override + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + offsetName(ts, { format, locale }) { + return parseZoneInfo(ts, format, locale, this.name); + } + + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + formatOffset(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @override + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + offset(ts) { + if (!this.valid) return NaN; + const date = new Date(ts); + + if (isNaN(date)) return NaN; + + const dtf = makeDTF(this.name); + let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts + ? partsOffset(dtf, date) + : hackyOffset(dtf, date); + + if (adOrBc === "BC") { + year = -Math.abs(year) + 1; + } + + // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat + const adjustedHour = hour === 24 ? 0 : hour; + + const asUTC = objToLocalTS({ + year, + month, + day, + hour: adjustedHour, + minute, + second, + millisecond: 0, + }); + + let asTS = +date; + const over = asTS % 1000; + asTS -= over >= 0 ? over : 1000 + over; + return (asUTC - asTS) / (60 * 1000); + } + + /** + * Return whether this Zone is equal to another zone + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + equals(otherZone) { + return otherZone.type === "iana" && otherZone.name === this.name; + } + + /** + * Return whether this Zone is valid. + * @override + * @type {boolean} + */ + get isValid() { + return this.valid; + } +} + +// todo - remap caching + +let intlLFCache = {}; +function getCachedLF(locString, opts = {}) { + const key = JSON.stringify([locString, opts]); + let dtf = intlLFCache[key]; + if (!dtf) { + dtf = new Intl.ListFormat(locString, opts); + intlLFCache[key] = dtf; + } + return dtf; +} + +const intlDTCache = new Map(); +function getCachedDTF(locString, opts = {}) { + const key = JSON.stringify([locString, opts]); + let dtf = intlDTCache.get(key); + if (dtf === undefined) { + dtf = new Intl.DateTimeFormat(locString, opts); + intlDTCache.set(key, dtf); + } + return dtf; +} + +const intlNumCache = new Map(); +function getCachedINF(locString, opts = {}) { + const key = JSON.stringify([locString, opts]); + let inf = intlNumCache.get(key); + if (inf === undefined) { + inf = new Intl.NumberFormat(locString, opts); + intlNumCache.set(key, inf); + } + return inf; +} + +const intlRelCache = new Map(); +function getCachedRTF(locString, opts = {}) { + const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options + const key = JSON.stringify([locString, cacheKeyOpts]); + let inf = intlRelCache.get(key); + if (inf === undefined) { + inf = new Intl.RelativeTimeFormat(locString, opts); + intlRelCache.set(key, inf); + } + return inf; +} + +let sysLocaleCache = null; +function systemLocale() { + if (sysLocaleCache) { + return sysLocaleCache; + } else { + sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale; + return sysLocaleCache; + } +} + +const intlResolvedOptionsCache = new Map(); +function getCachedIntResolvedOptions(locString) { + let opts = intlResolvedOptionsCache.get(locString); + if (opts === undefined) { + opts = new Intl.DateTimeFormat(locString).resolvedOptions(); + intlResolvedOptionsCache.set(locString, opts); + } + return opts; +} + +const weekInfoCache = new Map(); +function getCachedWeekInfo(locString) { + let data = weekInfoCache.get(locString); + if (!data) { + const locale = new Intl.Locale(locString); + // browsers currently implement this as a property, but spec says it should be a getter function + data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo; + // minimalDays was removed from WeekInfo: https://github.com/tc39/proposal-intl-locale-info/issues/86 + if (!("minimalDays" in data)) { + data = { ...fallbackWeekSettings, ...data }; + } + weekInfoCache.set(locString, data); + } + return data; +} + +function parseLocaleString(localeStr) { + // I really want to avoid writing a BCP 47 parser + // see, e.g. https://github.com/wooorm/bcp-47 + // Instead, we'll do this: + + // a) if the string has no -u extensions, just leave it alone + // b) if it does, use Intl to resolve everything + // c) if Intl fails, try again without the -u + + // private subtags and unicode subtags have ordering requirements, + // and we're not properly parsing this, so just strip out the + // private ones if they exist. + const xIndex = localeStr.indexOf("-x-"); + if (xIndex !== -1) { + localeStr = localeStr.substring(0, xIndex); + } + + const uIndex = localeStr.indexOf("-u-"); + if (uIndex === -1) { + return [localeStr]; + } else { + let options; + let selectedStr; + try { + options = getCachedDTF(localeStr).resolvedOptions(); + selectedStr = localeStr; + } catch (e) { + const smaller = localeStr.substring(0, uIndex); + options = getCachedDTF(smaller).resolvedOptions(); + selectedStr = smaller; + } + + const { numberingSystem, calendar } = options; + return [selectedStr, numberingSystem, calendar]; + } +} + +function intlConfigString(localeStr, numberingSystem, outputCalendar) { + if (outputCalendar || numberingSystem) { + if (!localeStr.includes("-u-")) { + localeStr += "-u"; + } + + if (outputCalendar) { + localeStr += `-ca-${outputCalendar}`; + } + + if (numberingSystem) { + localeStr += `-nu-${numberingSystem}`; + } + return localeStr; + } else { + return localeStr; + } +} + +function mapMonths(f) { + const ms = []; + for (let i = 1; i <= 12; i++) { + const dt = DateTime.utc(2009, i, 1); + ms.push(f(dt)); + } + return ms; +} + +function mapWeekdays(f) { + const ms = []; + for (let i = 1; i <= 7; i++) { + const dt = DateTime.utc(2016, 11, 13 + i); + ms.push(f(dt)); + } + return ms; +} + +function listStuff(loc, length, englishFn, intlFn) { + const mode = loc.listingMode(); + + if (mode === "error") { + return null; + } else if (mode === "en") { + return englishFn(length); + } else { + return intlFn(length); + } +} + +function supportsFastNumbers(loc) { + if (loc.numberingSystem && loc.numberingSystem !== "latn") { + return false; + } else { + return ( + loc.numberingSystem === "latn" || + !loc.locale || + loc.locale.startsWith("en") || + getCachedIntResolvedOptions(loc.locale).numberingSystem === "latn" + ); + } +} + +/** + * @private + */ + +class PolyNumberFormatter { + constructor(intl, forceSimple, opts) { + this.padTo = opts.padTo || 0; + this.floor = opts.floor || false; + + const { padTo, floor, ...otherOpts } = opts; + + if (!forceSimple || Object.keys(otherOpts).length > 0) { + const intlOpts = { useGrouping: false, ...opts }; + if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; + this.inf = getCachedINF(intl, intlOpts); + } + } + + format(i) { + if (this.inf) { + const fixed = this.floor ? Math.floor(i) : i; + return this.inf.format(fixed); + } else { + // to match the browser's numberformatter defaults + const fixed = this.floor ? Math.floor(i) : roundTo(i, 3); + return padStart(fixed, this.padTo); + } + } +} + +/** + * @private + */ + +class PolyDateFormatter { + constructor(dt, intl, opts) { + this.opts = opts; + this.originalZone = undefined; + + let z = undefined; + if (this.opts.timeZone) { + // Don't apply any workarounds if a timeZone is explicitly provided in opts + this.dt = dt; + } else if (dt.zone.type === "fixed") { + // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like. + // That is why fixed-offset TZ is set to that unless it is: + // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT. + // 2. Unsupported by the browser: + // - some do not support Etc/ + // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata + const gmtOffset = -1 * (dt.offset / 60); + const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`; + if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) { + z = offsetZ; + this.dt = dt; + } else { + // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so + // we manually apply the offset and substitute the zone as needed. + z = "UTC"; + this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({ minutes: dt.offset }); + this.originalZone = dt.zone; + } + } else if (dt.zone.type === "system") { + this.dt = dt; + } else if (dt.zone.type === "iana") { + this.dt = dt; + z = dt.zone.name; + } else { + // Custom zones can have any offset / offsetName so we just manually + // apply the offset and substitute the zone as needed. + z = "UTC"; + this.dt = dt.setZone("UTC").plus({ minutes: dt.offset }); + this.originalZone = dt.zone; + } + + const intlOpts = { ...this.opts }; + intlOpts.timeZone = intlOpts.timeZone || z; + this.dtf = getCachedDTF(intl, intlOpts); + } + + format() { + if (this.originalZone) { + // If we have to substitute in the actual zone name, we have to use + // formatToParts so that the timezone can be replaced. + return this.formatToParts() + .map(({ value }) => value) + .join(""); + } + return this.dtf.format(this.dt.toJSDate()); + } + + formatToParts() { + const parts = this.dtf.formatToParts(this.dt.toJSDate()); + if (this.originalZone) { + return parts.map((part) => { + if (part.type === "timeZoneName") { + const offsetName = this.originalZone.offsetName(this.dt.ts, { + locale: this.dt.locale, + format: this.opts.timeZoneName, + }); + return { + ...part, + value: offsetName, + }; + } else { + return part; + } + }); + } + return parts; + } + + resolvedOptions() { + return this.dtf.resolvedOptions(); + } +} + +/** + * @private + */ +class PolyRelFormatter { + constructor(intl, isEnglish, opts) { + this.opts = { style: "long", ...opts }; + if (!isEnglish && hasRelative()) { + this.rtf = getCachedRTF(intl, opts); + } + } + + format(count, unit) { + if (this.rtf) { + return this.rtf.format(count, unit); + } else { + return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); + } + } + + formatToParts(count, unit) { + if (this.rtf) { + return this.rtf.formatToParts(count, unit); + } else { + return []; + } + } +} + +const fallbackWeekSettings = { + firstDay: 1, + minimalDays: 4, + weekend: [6, 7], +}; + +/** + * @private + */ +class Locale { + static fromOpts(opts) { + return Locale.create( + opts.locale, + opts.numberingSystem, + opts.outputCalendar, + opts.weekSettings, + opts.defaultToEN + ); + } + + static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) { + const specifiedLocale = locale || Settings.defaultLocale; + // the system locale is useful for human-readable strings but annoying for parsing/formatting known formats + const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()); + const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem; + const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; + const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings; + return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale); + } + + static resetCache() { + sysLocaleCache = null; + intlDTCache.clear(); + intlNumCache.clear(); + intlRelCache.clear(); + intlResolvedOptionsCache.clear(); + weekInfoCache.clear(); + } + + static fromObject({ locale, numberingSystem, outputCalendar, weekSettings } = {}) { + return Locale.create(locale, numberingSystem, outputCalendar, weekSettings); + } + + constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale) { + const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale); + + this.locale = parsedLocale; + this.numberingSystem = numbering || parsedNumberingSystem || null; + this.outputCalendar = outputCalendar || parsedOutputCalendar || null; + this.weekSettings = weekSettings; + this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); + + this.weekdaysCache = { format: {}, standalone: {} }; + this.monthsCache = { format: {}, standalone: {} }; + this.meridiemCache = null; + this.eraCache = {}; + + this.specifiedLocale = specifiedLocale; + this.fastNumbersCached = null; + } + + get fastNumbers() { + if (this.fastNumbersCached == null) { + this.fastNumbersCached = supportsFastNumbers(this); + } + + return this.fastNumbersCached; + } + + listingMode() { + const isActuallyEn = this.isEnglish(); + const hasNoWeirdness = + (this.numberingSystem === null || this.numberingSystem === "latn") && + (this.outputCalendar === null || this.outputCalendar === "gregory"); + return isActuallyEn && hasNoWeirdness ? "en" : "intl"; + } + + clone(alts) { + if (!alts || Object.getOwnPropertyNames(alts).length === 0) { + return this; + } else { + return Locale.create( + alts.locale || this.specifiedLocale, + alts.numberingSystem || this.numberingSystem, + alts.outputCalendar || this.outputCalendar, + validateWeekSettings(alts.weekSettings) || this.weekSettings, + alts.defaultToEN || false + ); + } + } + + redefaultToEN(alts = {}) { + return this.clone({ ...alts, defaultToEN: true }); + } + + redefaultToSystem(alts = {}) { + return this.clone({ ...alts, defaultToEN: false }); + } + + months(length, format = false) { + return listStuff(this, length, months, () => { + // Workaround for "ja" locale: formatToParts does not label all parts of the month + // as "month" and for this locale there is no difference between "format" and "non-format". + // As such, just use format() instead of formatToParts() and take the whole string + const monthSpecialCase = this.intl === "ja" || this.intl.startsWith("ja-"); + format &= !monthSpecialCase; + const intl = format ? { month: length, day: "numeric" } : { month: length }, + formatStr = format ? "format" : "standalone"; + if (!this.monthsCache[formatStr][length]) { + const mapper = !monthSpecialCase + ? (dt) => this.extract(dt, intl, "month") + : (dt) => this.dtFormatter(dt, intl).format(); + this.monthsCache[formatStr][length] = mapMonths(mapper); + } + return this.monthsCache[formatStr][length]; + }); + } + + weekdays(length, format = false) { + return listStuff(this, length, weekdays, () => { + const intl = format + ? { weekday: length, year: "numeric", month: "long", day: "numeric" } + : { weekday: length }, + formatStr = format ? "format" : "standalone"; + if (!this.weekdaysCache[formatStr][length]) { + this.weekdaysCache[formatStr][length] = mapWeekdays((dt) => + this.extract(dt, intl, "weekday") + ); + } + return this.weekdaysCache[formatStr][length]; + }); + } + + meridiems() { + return listStuff( + this, + undefined, + () => meridiems, + () => { + // In theory there could be aribitrary day periods. We're gonna assume there are exactly two + // for AM and PM. This is probably wrong, but it's makes parsing way easier. + if (!this.meridiemCache) { + const intl = { hour: "numeric", hourCycle: "h12" }; + this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map( + (dt) => this.extract(dt, intl, "dayperiod") + ); + } + + return this.meridiemCache; + } + ); + } + + eras(length) { + return listStuff(this, length, eras, () => { + const intl = { era: length }; + + // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates + // to definitely enumerate them. + if (!this.eraCache[length]) { + this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map((dt) => + this.extract(dt, intl, "era") + ); + } + + return this.eraCache[length]; + }); + } + + extract(dt, intlOpts, field) { + const df = this.dtFormatter(dt, intlOpts), + results = df.formatToParts(), + matching = results.find((m) => m.type.toLowerCase() === field); + return matching ? matching.value : null; + } + + numberFormatter(opts = {}) { + // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave) + // (in contrast, the rest of the condition is used heavily) + return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); + } + + dtFormatter(dt, intlOpts = {}) { + return new PolyDateFormatter(dt, this.intl, intlOpts); + } + + relFormatter(opts = {}) { + return new PolyRelFormatter(this.intl, this.isEnglish(), opts); + } + + listFormatter(opts = {}) { + return getCachedLF(this.intl, opts); + } + + isEnglish() { + return ( + this.locale === "en" || + this.locale.toLowerCase() === "en-us" || + getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us") + ); + } + + getWeekSettings() { + if (this.weekSettings) { + return this.weekSettings; + } else if (!hasLocaleWeekInfo()) { + return fallbackWeekSettings; + } else { + return getCachedWeekInfo(this.locale); + } + } + + getStartOfWeek() { + return this.getWeekSettings().firstDay; + } + + getMinDaysInFirstWeek() { + return this.getWeekSettings().minimalDays; + } + + getWeekendDays() { + return this.getWeekSettings().weekend; + } + + equals(other) { + return ( + this.locale === other.locale && + this.numberingSystem === other.numberingSystem && + this.outputCalendar === other.outputCalendar + ); + } + + toString() { + return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`; + } +} + +let singleton = null; + +/** + * A zone with a fixed offset (meaning no DST) + * @implements {Zone} + */ +class FixedOffsetZone extends Zone { + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + static get utcInstance() { + if (singleton === null) { + singleton = new FixedOffsetZone(0); + } + return singleton; + } + + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + static instance(offset) { + return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset); + } + + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */ + static parseSpecifier(s) { + if (s) { + const r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + if (r) { + return new FixedOffsetZone(signedOffset(r[1], r[2])); + } + } + return null; + } + + constructor(offset) { + super(); + /** @private **/ + this.fixed = offset; + } + + /** + * The type of zone. `fixed` for all instances of `FixedOffsetZone`. + * @override + * @type {string} + */ + get type() { + return "fixed"; + } + + /** + * The name of this zone. + * All fixed zones' names always start with "UTC" (plus optional offset) + * @override + * @type {string} + */ + get name() { + return this.fixed === 0 ? "UTC" : `UTC${formatOffset(this.fixed, "narrow")}`; + } + + /** + * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn` + * + * @override + * @type {string} + */ + get ianaName() { + if (this.fixed === 0) { + return "Etc/UTC"; + } else { + return `Etc/GMT${formatOffset(-this.fixed, "narrow")}`; + } + } + + /** + * Returns the offset's common name at the specified timestamp. + * + * For fixed offset zones this equals to the zone name. + * @override + */ + offsetName() { + return this.name; + } + + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + formatOffset(ts, format) { + return formatOffset(this.fixed, format); + } + + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns true for all fixed offset zones. + * @override + * @type {boolean} + */ + get isUniversal() { + return true; + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * + * For fixed offset zones, this is constant and does not depend on a timestamp. + * @override + * @return {number} + */ + offset() { + return this.fixed; + } + + /** + * Return whether this Zone is equal to another zone (i.e. also fixed and same offset) + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + equals(otherZone) { + return otherZone.type === "fixed" && otherZone.fixed === this.fixed; + } + + /** + * Return whether this Zone is valid: + * All fixed offset zones are valid. + * @override + * @type {boolean} + */ + get isValid() { + return true; + } +} + +/** + * A zone that failed to parse. You should never need to instantiate this. + * @implements {Zone} + */ +class InvalidZone extends Zone { + constructor(zoneName) { + super(); + /** @private */ + this.zoneName = zoneName; + } + + /** @override **/ + get type() { + return "invalid"; + } + + /** @override **/ + get name() { + return this.zoneName; + } + + /** @override **/ + get isUniversal() { + return false; + } + + /** @override **/ + offsetName() { + return null; + } + + /** @override **/ + formatOffset() { + return ""; + } + + /** @override **/ + offset() { + return NaN; + } + + /** @override **/ + equals() { + return false; + } + + /** @override **/ + get isValid() { + return false; + } +} + +/** + * @private + */ + +function normalizeZone(input, defaultZone) { + if (isUndefined(input) || input === null) { + return defaultZone; + } else if (input instanceof Zone) { + return input; + } else if (isString(input)) { + const lowered = input.toLowerCase(); + if (lowered === "default") return defaultZone; + else if (lowered === "local" || lowered === "system") return SystemZone.instance; + else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance; + else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input); + } else if (isNumber(input)) { + return FixedOffsetZone.instance(input); + } else if (typeof input === "object" && "offset" in input && typeof input.offset === "function") { + // This is dumb, but the instanceof check above doesn't seem to really work + // so we're duck checking it + return input; + } else { + return new InvalidZone(input); + } +} + +const numberingSystems = { + arab: "[\u0660-\u0669]", + arabext: "[\u06F0-\u06F9]", + bali: "[\u1B50-\u1B59]", + beng: "[\u09E6-\u09EF]", + deva: "[\u0966-\u096F]", + fullwide: "[\uFF10-\uFF19]", + gujr: "[\u0AE6-\u0AEF]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[\u17E0-\u17E9]", + knda: "[\u0CE6-\u0CEF]", + laoo: "[\u0ED0-\u0ED9]", + limb: "[\u1946-\u194F]", + mlym: "[\u0D66-\u0D6F]", + mong: "[\u1810-\u1819]", + mymr: "[\u1040-\u1049]", + orya: "[\u0B66-\u0B6F]", + tamldec: "[\u0BE6-\u0BEF]", + telu: "[\u0C66-\u0C6F]", + thai: "[\u0E50-\u0E59]", + tibt: "[\u0F20-\u0F29]", + latn: "\\d", +}; + +const numberingSystemsUTF16 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881], +}; + +const hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); + +function parseDigits(str) { + let value = parseInt(str, 10); + if (isNaN(value)) { + value = ""; + for (let i = 0; i < str.length; i++) { + const code = str.charCodeAt(i); + + if (str[i].search(numberingSystems.hanidec) !== -1) { + value += hanidecChars.indexOf(str[i]); + } else { + for (const key in numberingSystemsUTF16) { + const [min, max] = numberingSystemsUTF16[key]; + if (code >= min && code <= max) { + value += code - min; + } + } + } + } + return parseInt(value, 10); + } else { + return value; + } +} + +// cache of {numberingSystem: {append: regex}} +const digitRegexCache = new Map(); +function resetDigitRegexCache() { + digitRegexCache.clear(); +} + +function digitRegex({ numberingSystem }, append = "") { + const ns = numberingSystem || "latn"; + + let appendCache = digitRegexCache.get(ns); + if (appendCache === undefined) { + appendCache = new Map(); + digitRegexCache.set(ns, appendCache); + } + let regex = appendCache.get(append); + if (regex === undefined) { + regex = new RegExp(`${numberingSystems[ns]}${append}`); + appendCache.set(append, regex); + } + + return regex; +} + +let now = () => Date.now(), + defaultZone = "system", + defaultLocale = null, + defaultNumberingSystem = null, + defaultOutputCalendar = null, + twoDigitCutoffYear = 60, + throwOnInvalid, + defaultWeekSettings = null; + +/** + * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here. + */ +class Settings { + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + static get now() { + return now; + } + + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */ + static set now(n) { + now = n; + } + + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * Use the value "system" to reset this value to the system's time zone. + * @type {string} + */ + static set defaultZone(zone) { + defaultZone = zone; + } + + /** + * Get the default time zone object currently used to create DateTimes. Does not affect existing instances. + * The default value is the system's time zone (the one set on the machine that runs this code). + * @type {Zone} + */ + static get defaultZone() { + return normalizeZone(defaultZone, SystemZone.instance); + } + + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultLocale() { + return defaultLocale; + } + + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultLocale(locale) { + defaultLocale = locale; + } + + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultNumberingSystem() { + return defaultNumberingSystem; + } + + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultNumberingSystem(numberingSystem) { + defaultNumberingSystem = numberingSystem; + } + + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultOutputCalendar() { + return defaultOutputCalendar; + } + + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultOutputCalendar(outputCalendar) { + defaultOutputCalendar = outputCalendar; + } + + /** + * @typedef {Object} WeekSettings + * @property {number} firstDay + * @property {number} minimalDays + * @property {number[]} weekend + */ + + /** + * @return {WeekSettings|null} + */ + static get defaultWeekSettings() { + return defaultWeekSettings; + } + + /** + * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and + * how many days are required in the first week of a year. + * Does not affect existing instances. + * + * @param {WeekSettings|null} weekSettings + */ + static set defaultWeekSettings(weekSettings) { + defaultWeekSettings = validateWeekSettings(weekSettings); + } + + /** + * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + */ + static get twoDigitCutoffYear() { + return twoDigitCutoffYear; + } + + /** + * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century + * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century + * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950 + * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50 + * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50 + */ + static set twoDigitCutoffYear(cutoffYear) { + twoDigitCutoffYear = cutoffYear % 100; + } + + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + static get throwOnInvalid() { + return throwOnInvalid; + } + + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + static set throwOnInvalid(t) { + throwOnInvalid = t; + } + + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + static resetCaches() { + Locale.resetCache(); + IANAZone.resetCache(); + DateTime.resetCache(); + resetDigitRegexCache(); + } +} + +class Invalid { + constructor(reason, explanation) { + this.reason = reason; + this.explanation = explanation; + } + + toMessage() { + if (this.explanation) { + return `${this.reason}: ${this.explanation}`; + } else { + return this.reason; + } + } +} + +const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], + leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; + +function unitOutOfRange(unit, value) { + return new Invalid( + "unit out of range", + `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid` + ); +} + +function dayOfWeek(year, month, day) { + const d = new Date(Date.UTC(year, month - 1, day)); + + if (year < 100 && year >= 0) { + d.setUTCFullYear(d.getUTCFullYear() - 1900); + } + + const js = d.getUTCDay(); + + return js === 0 ? 7 : js; +} + +function computeOrdinal(year, month, day) { + return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; +} + +function uncomputeOrdinal(year, ordinal) { + const table = isLeapYear(year) ? leapLadder : nonLeapLadder, + month0 = table.findIndex((i) => i < ordinal), + day = ordinal - table[month0]; + return { month: month0 + 1, day }; +} + +function isoWeekdayToLocal(isoWeekday, startOfWeek) { + return ((isoWeekday - startOfWeek + 7) % 7) + 1; +} + +/** + * @private + */ + +function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) { + const { year, month, day } = gregObj, + ordinal = computeOrdinal(year, month, day), + weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek); + + let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7), + weekYear; + + if (weekNumber < 1) { + weekYear = year - 1; + weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek); + } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) { + weekYear = year + 1; + weekNumber = 1; + } else { + weekYear = year; + } + + return { weekYear, weekNumber, weekday, ...timeObject(gregObj) }; +} + +function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) { + const { weekYear, weekNumber, weekday } = weekData, + weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek), + yearInDays = daysInYear(weekYear); + + let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek, + year; + + if (ordinal < 1) { + year = weekYear - 1; + ordinal += daysInYear(year); + } else if (ordinal > yearInDays) { + year = weekYear + 1; + ordinal -= daysInYear(weekYear); + } else { + year = weekYear; + } + + const { month, day } = uncomputeOrdinal(year, ordinal); + return { year, month, day, ...timeObject(weekData) }; +} + +function gregorianToOrdinal(gregData) { + const { year, month, day } = gregData; + const ordinal = computeOrdinal(year, month, day); + return { year, ordinal, ...timeObject(gregData) }; +} + +function ordinalToGregorian(ordinalData) { + const { year, ordinal } = ordinalData; + const { month, day } = uncomputeOrdinal(year, ordinal); + return { year, month, day, ...timeObject(ordinalData) }; +} + +/** + * Check if local week units like localWeekday are used in obj. + * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties. + * Modifies obj in-place! + * @param obj the object values + */ +function usesLocalWeekValues(obj, loc) { + const hasLocaleWeekData = + !isUndefined(obj.localWeekday) || + !isUndefined(obj.localWeekNumber) || + !isUndefined(obj.localWeekYear); + if (hasLocaleWeekData) { + const hasIsoWeekData = + !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear); + + if (hasIsoWeekData) { + throw new ConflictingSpecificationError( + "Cannot mix locale-based week fields with ISO-based week fields" + ); + } + if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday; + if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber; + if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear; + delete obj.localWeekday; + delete obj.localWeekNumber; + delete obj.localWeekYear; + return { + minDaysInFirstWeek: loc.getMinDaysInFirstWeek(), + startOfWeek: loc.getStartOfWeek(), + }; + } else { + return { minDaysInFirstWeek: 4, startOfWeek: 1 }; + } +} + +function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) { + const validYear = isInteger(obj.weekYear), + validWeek = integerBetween( + obj.weekNumber, + 1, + weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek) + ), + validWeekday = integerBetween(obj.weekday, 1, 7); + + if (!validYear) { + return unitOutOfRange("weekYear", obj.weekYear); + } else if (!validWeek) { + return unitOutOfRange("week", obj.weekNumber); + } else if (!validWeekday) { + return unitOutOfRange("weekday", obj.weekday); + } else return false; +} + +function hasInvalidOrdinalData(obj) { + const validYear = isInteger(obj.year), + validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validOrdinal) { + return unitOutOfRange("ordinal", obj.ordinal); + } else return false; +} + +function hasInvalidGregorianData(obj) { + const validYear = isInteger(obj.year), + validMonth = integerBetween(obj.month, 1, 12), + validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validMonth) { + return unitOutOfRange("month", obj.month); + } else if (!validDay) { + return unitOutOfRange("day", obj.day); + } else return false; +} + +function hasInvalidTimeData(obj) { + const { hour, minute, second, millisecond } = obj; + const validHour = + integerBetween(hour, 0, 23) || + (hour === 24 && minute === 0 && second === 0 && millisecond === 0), + validMinute = integerBetween(minute, 0, 59), + validSecond = integerBetween(second, 0, 59), + validMillisecond = integerBetween(millisecond, 0, 999); + + if (!validHour) { + return unitOutOfRange("hour", hour); + } else if (!validMinute) { + return unitOutOfRange("minute", minute); + } else if (!validSecond) { + return unitOutOfRange("second", second); + } else if (!validMillisecond) { + return unitOutOfRange("millisecond", millisecond); + } else return false; +} + +/* + This is just a junk drawer, containing anything used across multiple classes. + Because Luxon is small(ish), this should stay small and we won't worry about splitting + it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area. +*/ + +/** + * @private + */ + +// TYPES + +function isUndefined(o) { + return typeof o === "undefined"; +} + +function isNumber(o) { + return typeof o === "number"; +} + +function isInteger(o) { + return typeof o === "number" && o % 1 === 0; +} + +function isString(o) { + return typeof o === "string"; +} + +function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; +} + +// CAPABILITIES + +function hasRelative() { + try { + return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; + } catch (e) { + return false; + } +} + +function hasLocaleWeekInfo() { + try { + return ( + typeof Intl !== "undefined" && + !!Intl.Locale && + ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype) + ); + } catch (e) { + return false; + } +} + +// OBJECTS AND ARRAYS + +function maybeArray(thing) { + return Array.isArray(thing) ? thing : [thing]; +} + +function bestBy(arr, by, compare) { + if (arr.length === 0) { + return undefined; + } + return arr.reduce((best, next) => { + const pair = [by(next), next]; + if (!best) { + return pair; + } else if (compare(best[0], pair[0]) === best[0]) { + return best; + } else { + return pair; + } + }, null)[1]; +} + +function pick(obj, keys) { + return keys.reduce((a, k) => { + a[k] = obj[k]; + return a; + }, {}); +} + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +function validateWeekSettings(settings) { + if (settings == null) { + return null; + } else if (typeof settings !== "object") { + throw new InvalidArgumentError("Week settings must be an object"); + } else { + if ( + !integerBetween(settings.firstDay, 1, 7) || + !integerBetween(settings.minimalDays, 1, 7) || + !Array.isArray(settings.weekend) || + settings.weekend.some((v) => !integerBetween(v, 1, 7)) + ) { + throw new InvalidArgumentError("Invalid week settings"); + } + return { + firstDay: settings.firstDay, + minimalDays: settings.minimalDays, + weekend: Array.from(settings.weekend), + }; + } +} + +// NUMBERS AND STRINGS + +function integerBetween(thing, bottom, top) { + return isInteger(thing) && thing >= bottom && thing <= top; +} + +// x % n but takes the sign of n instead of x +function floorMod(x, n) { + return x - n * Math.floor(x / n); +} + +function padStart(input, n = 2) { + const isNeg = input < 0; + let padded; + if (isNeg) { + padded = "-" + ("" + -input).padStart(n, "0"); + } else { + padded = ("" + input).padStart(n, "0"); + } + return padded; +} + +function parseInteger(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseInt(string, 10); + } +} + +function parseFloating(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseFloat(string); + } +} + +function parseMillis(fraction) { + // Return undefined (instead of 0) in these cases, where fraction is not set + if (isUndefined(fraction) || fraction === null || fraction === "") { + return undefined; + } else { + const f = parseFloat("0." + fraction) * 1000; + return Math.floor(f); + } +} + +function roundTo(number, digits, rounding = "round") { + const factor = 10 ** digits; + switch (rounding) { + case "expand": + return number > 0 + ? Math.ceil(number * factor) / factor + : Math.floor(number * factor) / factor; + case "trunc": + return Math.trunc(number * factor) / factor; + case "round": + return Math.round(number * factor) / factor; + case "floor": + return Math.floor(number * factor) / factor; + case "ceil": + return Math.ceil(number * factor) / factor; + default: + throw new RangeError(`Value rounding ${rounding} is out of range`); + } +} + +// DATE BASICS + +function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} + +function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; +} + +function daysInMonth(year, month) { + const modMonth = floorMod(month - 1, 12) + 1, + modYear = year + (month - modMonth) / 12; + + if (modMonth === 2) { + return isLeapYear(modYear) ? 29 : 28; + } else { + return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; + } +} + +// convert a calendar object to a local timestamp (epoch, but with the offset baked in) +function objToLocalTS(obj) { + let d = Date.UTC( + obj.year, + obj.month - 1, + obj.day, + obj.hour, + obj.minute, + obj.second, + obj.millisecond + ); + + // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that + if (obj.year < 100 && obj.year >= 0) { + d = new Date(d); + // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not + // so if obj.year is in 99, but obj.day makes it roll over into year 100, + // the calculations done by Date.UTC are using year 2000 - which is incorrect + d.setUTCFullYear(obj.year, obj.month - 1, obj.day); + } + return +d; +} + +// adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js +function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) { + const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek); + return -fwdlw + minDaysInFirstWeek - 1; +} + +function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) { + const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek); + const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek); + return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7; +} + +function untruncateYear(year) { + if (year > 99) { + return year; + } else return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year; +} + +// PARSING + +function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) { + const date = new Date(ts), + intlOpts = { + hourCycle: "h23", + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + }; + + if (timeZone) { + intlOpts.timeZone = timeZone; + } + + const modified = { timeZoneName: offsetFormat, ...intlOpts }; + + const parsed = new Intl.DateTimeFormat(locale, modified) + .formatToParts(date) + .find((m) => m.type.toLowerCase() === "timezonename"); + return parsed ? parsed.value : null; +} + +// signedOffset('-5', '30') -> -330 +function signedOffset(offHourStr, offMinuteStr) { + let offHour = parseInt(offHourStr, 10); + + // don't || this because we want to preserve -0 + if (Number.isNaN(offHour)) { + offHour = 0; + } + + const offMin = parseInt(offMinuteStr, 10) || 0, + offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; + return offHour * 60 + offMinSigned; +} + +// COERCION + +function asNumber(value) { + const numericValue = Number(value); + if (typeof value === "boolean" || value === "" || !Number.isFinite(numericValue)) + throw new InvalidArgumentError(`Invalid unit value ${value}`); + return numericValue; +} + +function normalizeObject(obj, normalizer) { + const normalized = {}; + for (const u in obj) { + if (hasOwnProperty(obj, u)) { + const v = obj[u]; + if (v === undefined || v === null) continue; + normalized[normalizer(u)] = asNumber(v); + } + } + return normalized; +} + +/** + * Returns the offset's value as a string + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ +function formatOffset(offset, format) { + const hours = Math.trunc(Math.abs(offset / 60)), + minutes = Math.trunc(Math.abs(offset % 60)), + sign = offset >= 0 ? "+" : "-"; + + switch (format) { + case "short": + return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`; + case "narrow": + return `${sign}${hours}${minutes > 0 ? `:${minutes}` : ""}`; + case "techie": + return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`; + default: + throw new RangeError(`Value format ${format} is out of range for property format`); + } +} + +function timeObject(obj) { + return pick(obj, ["hour", "minute", "second", "millisecond"]); +} + +/** + * @private + */ + +const monthsLong = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", +]; + +const monthsShort = [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", +]; + +const monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; + +function months(length) { + switch (length) { + case "narrow": + return [...monthsNarrow]; + case "short": + return [...monthsShort]; + case "long": + return [...monthsLong]; + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + default: + return null; + } +} + +const weekdaysLong = [ + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday", +]; + +const weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; + +const weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; + +function weekdays(length) { + switch (length) { + case "narrow": + return [...weekdaysNarrow]; + case "short": + return [...weekdaysShort]; + case "long": + return [...weekdaysLong]; + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + default: + return null; + } +} + +const meridiems = ["AM", "PM"]; + +const erasLong = ["Before Christ", "Anno Domini"]; + +const erasShort = ["BC", "AD"]; + +const erasNarrow = ["B", "A"]; + +function eras(length) { + switch (length) { + case "narrow": + return [...erasNarrow]; + case "short": + return [...erasShort]; + case "long": + return [...erasLong]; + default: + return null; + } +} + +function meridiemForDateTime(dt) { + return meridiems[dt.hour < 12 ? 0 : 1]; +} + +function weekdayForDateTime(dt, length) { + return weekdays(length)[dt.weekday - 1]; +} + +function monthForDateTime(dt, length) { + return months(length)[dt.month - 1]; +} + +function eraForDateTime(dt, length) { + return eras(length)[dt.year < 0 ? 0 : 1]; +} + +function formatRelativeTime(unit, count, numeric = "always", narrow = false) { + const units = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."], + }; + + const lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; + + if (numeric === "auto" && lastable) { + const isDay = unit === "days"; + switch (count) { + case 1: + return isDay ? "tomorrow" : `next ${units[unit][0]}`; + case -1: + return isDay ? "yesterday" : `last ${units[unit][0]}`; + case 0: + return isDay ? "today" : `this ${units[unit][0]}`; + } + } + + const isInPast = Object.is(count, -0) || count < 0, + fmtValue = Math.abs(count), + singular = fmtValue === 1, + lilUnits = units[unit], + fmtUnit = narrow + ? singular + ? lilUnits[1] + : lilUnits[2] || lilUnits[1] + : singular + ? units[unit][0] + : unit; + return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`; +} + +function stringifyTokens(splits, tokenToString) { + let s = ""; + for (const token of splits) { + if (token.literal) { + s += token.val; + } else { + s += tokenToString(token.val); + } + } + return s; +} + +const macroTokenToFormatOpts = { + D: DATE_SHORT, + DD: DATE_MED, + DDD: DATE_FULL, + DDDD: DATE_HUGE, + t: TIME_SIMPLE, + tt: TIME_WITH_SECONDS, + ttt: TIME_WITH_SHORT_OFFSET, + tttt: TIME_WITH_LONG_OFFSET, + T: TIME_24_SIMPLE, + TT: TIME_24_WITH_SECONDS, + TTT: TIME_24_WITH_SHORT_OFFSET, + TTTT: TIME_24_WITH_LONG_OFFSET, + f: DATETIME_SHORT, + ff: DATETIME_MED, + fff: DATETIME_FULL, + ffff: DATETIME_HUGE, + F: DATETIME_SHORT_WITH_SECONDS, + FF: DATETIME_MED_WITH_SECONDS, + FFF: DATETIME_FULL_WITH_SECONDS, + FFFF: DATETIME_HUGE_WITH_SECONDS, +}; + +/** + * @private + */ + +class Formatter { + static create(locale, opts = {}) { + return new Formatter(locale, opts); + } + + static parseFormat(fmt) { + // white-space is always considered a literal in user-provided formats + // the " " token has a special meaning (see unitForToken) + + let current = null, + currentFull = "", + bracketed = false; + const splits = []; + for (let i = 0; i < fmt.length; i++) { + const c = fmt.charAt(i); + if (c === "'") { + // turn '' into a literal signal quote instead of just skipping the empty literal + if (currentFull.length > 0 || bracketed) { + splits.push({ + literal: bracketed || /^\s+$/.test(currentFull), + val: currentFull === "" ? "'" : currentFull, + }); + } + current = null; + currentFull = ""; + bracketed = !bracketed; + } else if (bracketed) { + currentFull += c; + } else if (c === current) { + currentFull += c; + } else { + if (currentFull.length > 0) { + splits.push({ literal: /^\s+$/.test(currentFull), val: currentFull }); + } + currentFull = c; + current = c; + } + } + + if (currentFull.length > 0) { + splits.push({ literal: bracketed || /^\s+$/.test(currentFull), val: currentFull }); + } + + return splits; + } + + static macroTokenToFormatOpts(token) { + return macroTokenToFormatOpts[token]; + } + + constructor(locale, formatOpts) { + this.opts = formatOpts; + this.loc = locale; + this.systemLoc = null; + } + + formatWithSystemDefault(dt, opts) { + if (this.systemLoc === null) { + this.systemLoc = this.loc.redefaultToSystem(); + } + const df = this.systemLoc.dtFormatter(dt, { ...this.opts, ...opts }); + return df.format(); + } + + dtFormatter(dt, opts = {}) { + return this.loc.dtFormatter(dt, { ...this.opts, ...opts }); + } + + formatDateTime(dt, opts) { + return this.dtFormatter(dt, opts).format(); + } + + formatDateTimeParts(dt, opts) { + return this.dtFormatter(dt, opts).formatToParts(); + } + + formatInterval(interval, opts) { + const df = this.dtFormatter(interval.start, opts); + return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate()); + } + + resolvedOptions(dt, opts) { + return this.dtFormatter(dt, opts).resolvedOptions(); + } + + num(n, p = 0, signDisplay = undefined) { + // we get some perf out of doing this here, annoyingly + if (this.opts.forceSimple) { + return padStart(n, p); + } + + const opts = { ...this.opts }; + + if (p > 0) { + opts.padTo = p; + } + if (signDisplay) { + opts.signDisplay = signDisplay; + } + + return this.loc.numberFormatter(opts).format(n); + } + + formatDateTimeFromString(dt, fmt) { + const knownEnglish = this.loc.listingMode() === "en", + useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", + string = (opts, extract) => this.loc.extract(dt, opts, extract), + formatOffset = (opts) => { + if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { + return "Z"; + } + + return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; + }, + meridiem = () => + knownEnglish + ? meridiemForDateTime(dt) + : string({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), + month = (length, standalone) => + knownEnglish + ? monthForDateTime(dt, length) + : string(standalone ? { month: length } : { month: length, day: "numeric" }, "month"), + weekday = (length, standalone) => + knownEnglish + ? weekdayForDateTime(dt, length) + : string( + standalone ? { weekday: length } : { weekday: length, month: "long", day: "numeric" }, + "weekday" + ), + maybeMacro = (token) => { + const formatOpts = Formatter.macroTokenToFormatOpts(token); + if (formatOpts) { + return this.formatWithSystemDefault(dt, formatOpts); + } else { + return token; + } + }, + era = (length) => + knownEnglish ? eraForDateTime(dt, length) : string({ era: length }, "era"), + tokenToString = (token) => { + // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols + switch (token) { + // ms + case "S": + return this.num(dt.millisecond); + case "u": + // falls through + case "SSS": + return this.num(dt.millisecond, 3); + // seconds + case "s": + return this.num(dt.second); + case "ss": + return this.num(dt.second, 2); + // fractional seconds + case "uu": + return this.num(Math.floor(dt.millisecond / 10), 2); + case "uuu": + return this.num(Math.floor(dt.millisecond / 100)); + // minutes + case "m": + return this.num(dt.minute); + case "mm": + return this.num(dt.minute, 2); + // hours + case "h": + return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); + case "hh": + return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); + case "H": + return this.num(dt.hour); + case "HH": + return this.num(dt.hour, 2); + // offset + case "Z": + // like +6 + return formatOffset({ format: "narrow", allowZ: this.opts.allowZ }); + case "ZZ": + // like +06:00 + return formatOffset({ format: "short", allowZ: this.opts.allowZ }); + case "ZZZ": + // like +0600 + return formatOffset({ format: "techie", allowZ: this.opts.allowZ }); + case "ZZZZ": + // like EST + return dt.zone.offsetName(dt.ts, { format: "short", locale: this.loc.locale }); + case "ZZZZZ": + // like Eastern Standard Time + return dt.zone.offsetName(dt.ts, { format: "long", locale: this.loc.locale }); + // zone + case "z": + // like America/New_York + return dt.zoneName; + // meridiems + case "a": + return meridiem(); + // dates + case "d": + return useDateTimeFormatter ? string({ day: "numeric" }, "day") : this.num(dt.day); + case "dd": + return useDateTimeFormatter ? string({ day: "2-digit" }, "day") : this.num(dt.day, 2); + // weekdays - standalone + case "c": + // like 1 + return this.num(dt.weekday); + case "ccc": + // like 'Tues' + return weekday("short", true); + case "cccc": + // like 'Tuesday' + return weekday("long", true); + case "ccccc": + // like 'T' + return weekday("narrow", true); + // weekdays - format + case "E": + // like 1 + return this.num(dt.weekday); + case "EEE": + // like 'Tues' + return weekday("short", false); + case "EEEE": + // like 'Tuesday' + return weekday("long", false); + case "EEEEE": + // like 'T' + return weekday("narrow", false); + // months - standalone + case "L": + // like 1 + return useDateTimeFormatter + ? string({ month: "numeric", day: "numeric" }, "month") + : this.num(dt.month); + case "LL": + // like 01, doesn't seem to work + return useDateTimeFormatter + ? string({ month: "2-digit", day: "numeric" }, "month") + : this.num(dt.month, 2); + case "LLL": + // like Jan + return month("short", true); + case "LLLL": + // like January + return month("long", true); + case "LLLLL": + // like J + return month("narrow", true); + // months - format + case "M": + // like 1 + return useDateTimeFormatter + ? string({ month: "numeric" }, "month") + : this.num(dt.month); + case "MM": + // like 01 + return useDateTimeFormatter + ? string({ month: "2-digit" }, "month") + : this.num(dt.month, 2); + case "MMM": + // like Jan + return month("short", false); + case "MMMM": + // like January + return month("long", false); + case "MMMMM": + // like J + return month("narrow", false); + // years + case "y": + // like 2014 + return useDateTimeFormatter ? string({ year: "numeric" }, "year") : this.num(dt.year); + case "yy": + // like 14 + return useDateTimeFormatter + ? string({ year: "2-digit" }, "year") + : this.num(dt.year.toString().slice(-2), 2); + case "yyyy": + // like 0012 + return useDateTimeFormatter + ? string({ year: "numeric" }, "year") + : this.num(dt.year, 4); + case "yyyyyy": + // like 000012 + return useDateTimeFormatter + ? string({ year: "numeric" }, "year") + : this.num(dt.year, 6); + // eras + case "G": + // like AD + return era("short"); + case "GG": + // like Anno Domini + return era("long"); + case "GGGGG": + return era("narrow"); + case "kk": + return this.num(dt.weekYear.toString().slice(-2), 2); + case "kkkk": + return this.num(dt.weekYear, 4); + case "W": + return this.num(dt.weekNumber); + case "WW": + return this.num(dt.weekNumber, 2); + case "n": + return this.num(dt.localWeekNumber); + case "nn": + return this.num(dt.localWeekNumber, 2); + case "ii": + return this.num(dt.localWeekYear.toString().slice(-2), 2); + case "iiii": + return this.num(dt.localWeekYear, 4); + case "o": + return this.num(dt.ordinal); + case "ooo": + return this.num(dt.ordinal, 3); + case "q": + // like 1 + return this.num(dt.quarter); + case "qq": + // like 01 + return this.num(dt.quarter, 2); + case "X": + return this.num(Math.floor(dt.ts / 1000)); + case "x": + return this.num(dt.ts); + default: + return maybeMacro(token); + } + }; + + return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); + } + + formatDurationFromString(dur, fmt) { + const invertLargest = this.opts.signMode === "negativeLargestOnly" ? -1 : 1; + const tokenToField = (token) => { + switch (token[0]) { + case "S": + return "milliseconds"; + case "s": + return "seconds"; + case "m": + return "minutes"; + case "h": + return "hours"; + case "d": + return "days"; + case "w": + return "weeks"; + case "M": + return "months"; + case "y": + return "years"; + default: + return null; + } + }, + tokenToString = (lildur, info) => (token) => { + const mapped = tokenToField(token); + if (mapped) { + const inversionFactor = + info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1; + let signDisplay; + if (this.opts.signMode === "negativeLargestOnly" && mapped !== info.largestUnit) { + signDisplay = "never"; + } else if (this.opts.signMode === "all") { + signDisplay = "always"; + } else { + // "auto" and "negative" are the same, but "auto" has better support + signDisplay = "auto"; + } + return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay); + } else { + return token; + } + }, + tokens = Formatter.parseFormat(fmt), + realTokens = tokens.reduce( + (found, { literal, val }) => (literal ? found : found.concat(val)), + [] + ), + collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t)), + durationInfo = { + isNegativeDuration: collapsed < 0, + // this relies on "collapsed" being based on "shiftTo", which builds up the object + // in order + largestUnit: Object.keys(collapsed.values)[0], + }; + return stringifyTokens(tokens, tokenToString(collapsed, durationInfo)); + } +} + +/* + * This file handles parsing for well-specified formats. Here's how it works: + * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. + * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object + * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. + * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. + * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. + * Some extractions are super dumb and simpleParse and fromStrings help DRY them. + */ + +const ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/; + +function combineRegexes(...regexes) { + const full = regexes.reduce((f, r) => f + r.source, ""); + return RegExp(`^${full}$`); +} + +function combineExtractors(...extractors) { + return (m) => + extractors + .reduce( + ([mergedVals, mergedZone, cursor], ex) => { + const [val, zone, next] = ex(m, cursor); + return [{ ...mergedVals, ...val }, zone || mergedZone, next]; + }, + [{}, null, 1] + ) + .slice(0, 2); +} + +function parse(s, ...patterns) { + if (s == null) { + return [null, null]; + } + + for (const [regex, extractor] of patterns) { + const m = regex.exec(s); + if (m) { + return extractor(m); + } + } + return [null, null]; +} + +function simpleParse(...keys) { + return (match, cursor) => { + const ret = {}; + let i; + + for (i = 0; i < keys.length; i++) { + ret[keys[i]] = parseInteger(match[cursor + i]); + } + return [ret, null, cursor + i]; + }; +} + +// ISO and SQL parsing +const offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/; +const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`; +const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/; +const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`); +const isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`); +const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/; +const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/; +const isoOrdinalRegex = /(\d{4})-?(\d{3})/; +const extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"); +const extractISOOrdinalData = simpleParse("year", "ordinal"); +const sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/; // dumbed-down version of the ISO one +const sqlTimeRegex = RegExp( + `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?` +); +const sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`); + +function int(match, pos, fallback) { + const m = match[pos]; + return isUndefined(m) ? fallback : parseInteger(m); +} + +function extractISOYmd(match, cursor) { + const item = { + year: int(match, cursor), + month: int(match, cursor + 1, 1), + day: int(match, cursor + 2, 1), + }; + + return [item, null, cursor + 3]; +} + +function extractISOTime(match, cursor) { + const item = { + hours: int(match, cursor, 0), + minutes: int(match, cursor + 1, 0), + seconds: int(match, cursor + 2, 0), + milliseconds: parseMillis(match[cursor + 3]), + }; + + return [item, null, cursor + 4]; +} + +function extractISOOffset(match, cursor) { + const local = !match[cursor] && !match[cursor + 1], + fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), + zone = local ? null : FixedOffsetZone.instance(fullOffset); + return [{}, zone, cursor + 3]; +} + +function extractIANAZone(match, cursor) { + const zone = match[cursor] ? IANAZone.create(match[cursor]) : null; + return [{}, zone, cursor + 1]; +} + +// ISO time parsing + +const isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`); + +// ISO duration parsing + +const isoDuration = + /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/; + +function extractISODuration(match) { + const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = + match; + + const hasNegativePrefix = s[0] === "-"; + const negativeSeconds = secondStr && secondStr[0] === "-"; + + const maybeNegate = (num, force = false) => + num !== undefined && (force || (num && hasNegativePrefix)) ? -num : num; + + return [ + { + years: maybeNegate(parseFloating(yearStr)), + months: maybeNegate(parseFloating(monthStr)), + weeks: maybeNegate(parseFloating(weekStr)), + days: maybeNegate(parseFloating(dayStr)), + hours: maybeNegate(parseFloating(hourStr)), + minutes: maybeNegate(parseFloating(minuteStr)), + seconds: maybeNegate(parseFloating(secondStr), secondStr === "-0"), + milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds), + }, + ]; +} + +// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York +// and not just that we're in -240 *right now*. But since I don't think these are used that often +// I'm just going to ignore that +const obsOffsets = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60, +}; + +function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + const result = { + year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), + month: monthsShort.indexOf(monthStr) + 1, + day: parseInteger(dayStr), + hour: parseInteger(hourStr), + minute: parseInteger(minuteStr), + }; + + if (secondStr) result.second = parseInteger(secondStr); + if (weekdayStr) { + result.weekday = + weekdayStr.length > 3 + ? weekdaysLong.indexOf(weekdayStr) + 1 + : weekdaysShort.indexOf(weekdayStr) + 1; + } + + return result; +} + +// RFC 2822/5322 +const rfc2822 = + /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; + +function extractRFC2822(match) { + const [ + , + weekdayStr, + dayStr, + monthStr, + yearStr, + hourStr, + minuteStr, + secondStr, + obsOffset, + milOffset, + offHourStr, + offMinuteStr, + ] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + + let offset; + if (obsOffset) { + offset = obsOffsets[obsOffset]; + } else if (milOffset) { + offset = 0; + } else { + offset = signedOffset(offHourStr, offMinuteStr); + } + + return [result, new FixedOffsetZone(offset)]; +} + +function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s + .replace(/\([^()]*\)|[\n\t]/g, " ") + .replace(/(\s\s+)/g, " ") + .trim(); +} + +// http date + +const rfc1123 = + /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, + rfc850 = + /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, + ascii = + /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; + +function extractRFC1123Or850(match) { + const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} + +function extractASCII(match) { + const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} + +const isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); +const isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); +const isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); +const isoTimeCombinedRegex = combineRegexes(isoTimeRegex); + +const extractISOYmdTimeAndOffset = combineExtractors( + extractISOYmd, + extractISOTime, + extractISOOffset, + extractIANAZone +); +const extractISOWeekTimeAndOffset = combineExtractors( + extractISOWeekData, + extractISOTime, + extractISOOffset, + extractIANAZone +); +const extractISOOrdinalDateAndTime = combineExtractors( + extractISOOrdinalData, + extractISOTime, + extractISOOffset, + extractIANAZone +); +const extractISOTimeAndOffset = combineExtractors( + extractISOTime, + extractISOOffset, + extractIANAZone +); + +/* + * @private + */ + +function parseISODate(s) { + return parse( + s, + [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], + [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], + [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], + [isoTimeCombinedRegex, extractISOTimeAndOffset] + ); +} + +function parseRFC2822Date(s) { + return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]); +} + +function parseHTTPDate(s) { + return parse( + s, + [rfc1123, extractRFC1123Or850], + [rfc850, extractRFC1123Or850], + [ascii, extractASCII] + ); +} + +function parseISODuration(s) { + return parse(s, [isoDuration, extractISODuration]); +} + +const extractISOTimeOnly = combineExtractors(extractISOTime); + +function parseISOTimeOnly(s) { + return parse(s, [isoTimeOnly, extractISOTimeOnly]); +} + +const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); +const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); + +const extractISOTimeOffsetAndIANAZone = combineExtractors( + extractISOTime, + extractISOOffset, + extractIANAZone +); + +function parseSQL(s) { + return parse( + s, + [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], + [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone] + ); +} + +const INVALID$2 = "Invalid Duration"; + +// unit conversion constants +const lowOrderMatrix = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1000, + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1000, + }, + hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 }, + minutes: { seconds: 60, milliseconds: 60 * 1000 }, + seconds: { milliseconds: 1000 }, + }, + casualMatrix = { + years: { + quarters: 4, + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1000, + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + seconds: 91 * 24 * 60 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1000, + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1000, + }, + + ...lowOrderMatrix, + }, + daysInYearAccurate = 146097.0 / 400, + daysInMonthAccurate = 146097.0 / 4800, + accurateMatrix = { + years: { + quarters: 4, + months: 12, + weeks: daysInYearAccurate / 7, + days: daysInYearAccurate, + hours: daysInYearAccurate * 24, + minutes: daysInYearAccurate * 24 * 60, + seconds: daysInYearAccurate * 24 * 60 * 60, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000, + }, + quarters: { + months: 3, + weeks: daysInYearAccurate / 28, + days: daysInYearAccurate / 4, + hours: (daysInYearAccurate * 24) / 4, + minutes: (daysInYearAccurate * 24 * 60) / 4, + seconds: (daysInYearAccurate * 24 * 60 * 60) / 4, + milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4, + }, + months: { + weeks: daysInMonthAccurate / 7, + days: daysInMonthAccurate, + hours: daysInMonthAccurate * 24, + minutes: daysInMonthAccurate * 24 * 60, + seconds: daysInMonthAccurate * 24 * 60 * 60, + milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000, + }, + ...lowOrderMatrix, + }; + +// units ordered by size +const orderedUnits$1 = [ + "years", + "quarters", + "months", + "weeks", + "days", + "hours", + "minutes", + "seconds", + "milliseconds", +]; + +const reverseUnits = orderedUnits$1.slice(0).reverse(); + +// clone really means "create another instance just like this one, but with these changes" +function clone$1(dur, alts, clear = false) { + // deep merge for vals + const conf = { + values: clear ? alts.values : { ...dur.values, ...(alts.values || {}) }, + loc: dur.loc.clone(alts.loc), + conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy, + matrix: alts.matrix || dur.matrix, + }; + return new Duration(conf); +} + +function durationToMillis(matrix, vals) { + let sum = vals.milliseconds ?? 0; + for (const unit of reverseUnits.slice(1)) { + if (vals[unit]) { + sum += vals[unit] * matrix[unit]["milliseconds"]; + } + } + return sum; +} + +// NB: mutates parameters +function normalizeValues(matrix, vals) { + // the logic below assumes the overall value of the duration is positive + // if this is not the case, factor is used to make it so + const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1; + + orderedUnits$1.reduceRight((previous, current) => { + if (!isUndefined(vals[current])) { + if (previous) { + const previousVal = vals[previous] * factor; + const conv = matrix[current][previous]; + + // if (previousVal < 0): + // lower order unit is negative (e.g. { years: 2, days: -2 }) + // normalize this by reducing the higher order unit by the appropriate amount + // and increasing the lower order unit + // this can never make the higher order unit negative, because this function only operates + // on positive durations, so the amount of time represented by the lower order unit cannot + // be larger than the higher order unit + // else: + // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 }) + // in this case we attempt to convert as much as possible from the lower order unit into + // the higher order one + // + // Math.floor takes care of both of these cases, rounding away from 0 + // if previousVal < 0 it makes the absolute value larger + // if previousVal >= it makes the absolute value smaller + const rollUp = Math.floor(previousVal / conv); + vals[current] += rollUp * factor; + vals[previous] -= rollUp * conv * factor; + } + return current; + } else { + return previous; + } + }, null); + + // try to convert any decimals into smaller units if possible + // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 } + orderedUnits$1.reduce((previous, current) => { + if (!isUndefined(vals[current])) { + if (previous) { + const fraction = vals[previous] % 1; + vals[previous] -= fraction; + vals[current] += fraction * matrix[previous][current]; + } + return current; + } else { + return previous; + } + }, null); +} + +// Remove all properties with a value of 0 from an object +function removeZeroes(vals) { + const newVals = {}; + for (const [key, value] of Object.entries(vals)) { + if (value !== 0) { + newVals[key] = value; + } + } + return newVals; +} + +/** + * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime#plus} to add a Duration object to a DateTime, producing another DateTime. + * + * Here is a brief overview of commonly used methods and getters in Duration: + * + * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. + * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors. + * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors. + * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}. + * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON} + * + * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. + */ +class Duration { + /** + * @private + */ + constructor(config) { + const accurate = config.conversionAccuracy === "longterm" || false; + let matrix = accurate ? accurateMatrix : casualMatrix; + + if (config.matrix) { + matrix = config.matrix; + } + + /** + * @access private + */ + this.values = config.values; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.conversionAccuracy = accurate ? "longterm" : "casual"; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.matrix = matrix; + /** + * @access private + */ + this.isLuxonDuration = true; + } + + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + static fromMillis(count, opts) { + return Duration.fromObject({ milliseconds: count }, opts); + } + + /** + * Create a Duration from a JavaScript object with keys like 'years' and 'hours'. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {Object} [opts=[]] - options for creating this Duration + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the custom conversion system to use + * @return {Duration} + */ + static fromObject(obj, opts = {}) { + if (obj == null || typeof obj !== "object") { + throw new InvalidArgumentError( + `Duration.fromObject: argument expected to be an object, got ${ + obj === null ? "null" : typeof obj + }` + ); + } + + return new Duration({ + values: normalizeObject(obj, Duration.normalizeUnit), + loc: Locale.fromObject(opts), + conversionAccuracy: opts.conversionAccuracy, + matrix: opts.matrix, + }); + } + + /** + * Create a Duration from DurationLike. + * + * @param {Object | number | Duration} durationLike + * One of: + * - object with keys like 'years' and 'hours'. + * - number representing milliseconds + * - Duration instance + * @return {Duration} + */ + static fromDurationLike(durationLike) { + if (isNumber(durationLike)) { + return Duration.fromMillis(durationLike); + } else if (Duration.isDuration(durationLike)) { + return durationLike; + } else if (typeof durationLike === "object") { + return Duration.fromObject(durationLike); + } else { + throw new InvalidArgumentError( + `Unknown duration argument ${durationLike} of type ${typeof durationLike}` + ); + } + } + + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the preset conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */ + static fromISO(text, opts) { + const [parsed] = parseISODuration(text); + if (parsed) { + return Duration.fromObject(parsed, opts); + } else { + return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); + } + } + + /** + * Create a Duration from an ISO 8601 time string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 } + * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @return {Duration} + */ + static fromISOTime(text, opts) { + const [parsed] = parseISOTimeOnly(text); + if (parsed) { + return Duration.fromObject(parsed, opts); + } else { + return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); + } + } + + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */ + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); + } + + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDurationError(invalid); + } else { + return new Duration({ invalid }); + } + } + + /** + * @private + */ + static normalizeUnit(unit) { + const normalized = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds", + }[unit ? unit.toLowerCase() : unit]; + + if (!normalized) throw new InvalidUnitError(unit); + + return normalized; + } + + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isDuration(o) { + return (o && o.isLuxonDuration) || false; + } + + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */ + get locale() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + get numberingSystem() { + return this.isValid ? this.loc.numberingSystem : null; + } + + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `w` for weeks + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * Tokens can be escaped by wrapping with single quotes. + * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat("d s", { signMode: "all" }) //=> "+6 +2" + * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "all" }) //=> "-6 -2" + * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "negativeLargestOnly" }) //=> "-6 2" + * @return {string} + */ + toFormat(fmt, opts = {}) { + // reverse-compat since 1.2; we always round down now, never up, and we do it by default + const fmtOpts = { + ...opts, + floor: opts.round !== false && opts.floor !== false, + }; + return this.isValid + ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) + : INVALID$2; + } + + /** + * Returns a string representation of a Duration with all units included. + * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options + * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`. + * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor. + * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero + * @example + * ```js + * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 }) + * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes' + * dur.toHuman({ listStyle: "long" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes' + * dur.toHuman({ unitDisplay: "short" }) //=> '1 mth, 0 wks, 5 hr, 6 min' + * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes' + * ``` + */ + toHuman(opts = {}) { + if (!this.isValid) return INVALID$2; + + const showZeros = opts.showZeros !== false; + + const l = orderedUnits$1 + .map((unit) => { + const val = this.values[unit]; + if (isUndefined(val) || (val === 0 && !showZeros)) { + return null; + } + return this.loc + .numberFormatter({ style: "unit", unitDisplay: "long", ...opts, unit: unit.slice(0, -1) }) + .format(val); + }) + .filter((n) => n); + + return this.loc + .listFormatter({ type: "conjunction", style: opts.listStyle || "narrow", ...opts }) + .format(l); + } + + /** + * Returns a JavaScript object with this Duration's values. + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */ + toObject() { + if (!this.isValid) return {}; + return { ...this.values }; + } + + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */ + toISO() { + // we could use the formatter, but this is an easier way to get the minimum string + if (!this.isValid) return null; + + let s = "P"; + if (this.years !== 0) s += this.years + "Y"; + if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + "M"; + if (this.weeks !== 0) s += this.weeks + "W"; + if (this.days !== 0) s += this.days + "D"; + if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) + s += "T"; + if (this.hours !== 0) s += this.hours + "H"; + if (this.minutes !== 0) s += this.minutes + "M"; + if (this.seconds !== 0 || this.milliseconds !== 0) + // this will handle "floating point madness" by removing extra decimal places + // https://stackoverflow.com/questions/588004/is-floating-point-math-broken + s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S"; + if (s === "P") s += "T0S"; + return s; + } + + /** + * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day. + * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours. + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000' + * @return {string} + */ + toISOTime(opts = {}) { + if (!this.isValid) return null; + + const millis = this.toMillis(); + if (millis < 0 || millis >= 86400000) return null; + + opts = { + suppressMilliseconds: false, + suppressSeconds: false, + includePrefix: false, + format: "extended", + ...opts, + includeOffset: false, + }; + + const dateTime = DateTime.fromMillis(millis, { zone: "UTC" }); + return dateTime.toISOTime(opts); + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */ + toJSON() { + return this.toISO(); + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */ + toString() { + return this.toISO(); + } + + /** + * Returns a string representation of this Duration appropriate for the REPL. + * @return {string} + */ + [Symbol.for("nodejs.util.inspect.custom")]() { + if (this.isValid) { + return `Duration { values: ${JSON.stringify(this.values)} }`; + } else { + return `Duration { Invalid, reason: ${this.invalidReason} }`; + } + } + + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */ + toMillis() { + if (!this.isValid) return NaN; + + return durationToMillis(this.matrix, this.values); + } + + /** + * Returns an milliseconds value of this Duration. Alias of {@link toMillis} + * @return {number} + */ + valueOf() { + return this.toMillis(); + } + + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + plus(duration) { + if (!this.isValid) return this; + + const dur = Duration.fromDurationLike(duration), + result = {}; + + for (const k of orderedUnits$1) { + if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { + result[k] = dur.get(k) + this.get(k); + } + } + + return clone$1(this, { values: result }, true); + } + + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + minus(duration) { + if (!this.isValid) return this; + + const dur = Duration.fromDurationLike(duration); + return this.plus(dur.negate()); + } + + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */ + mapUnits(fn) { + if (!this.isValid) return this; + const result = {}; + for (const k of Object.keys(this.values)) { + result[k] = asNumber(fn(this.values[k], k)); + } + return clone$1(this, { values: result }, true); + } + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3 + * @return {number} + */ + get(unit) { + return this[Duration.normalizeUnit(unit)]; + } + + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */ + set(values) { + if (!this.isValid) return this; + + const mixed = { ...this.values, ...normalizeObject(values, Duration.normalizeUnit) }; + return clone$1(this, { values: mixed }); + } + + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */ + reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) { + const loc = this.loc.clone({ locale, numberingSystem }); + const opts = { loc, matrix, conversionAccuracy }; + return clone$1(this, opts); + } + + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */ + as(unit) { + return this.isValid ? this.shiftTo(unit).get(unit) : NaN; + } + + /** + * Reduce this Duration to its canonical representation in its current units. + * Assuming the overall value of the Duration is positive, this means: + * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example) + * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise + * the overall value would be negative, see third example) + * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example) + * + * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 } + * @return {Duration} + */ + normalize() { + if (!this.isValid) return this; + const vals = this.toObject(); + normalizeValues(this.matrix, vals); + return clone$1(this, { values: vals }, true); + } + + /** + * Rescale units to its largest representation + * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 } + * @return {Duration} + */ + rescale() { + if (!this.isValid) return this; + const vals = removeZeroes(this.normalize().shiftToAll().toObject()); + return clone$1(this, { values: vals }, true); + } + + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */ + shiftTo(...units) { + if (!this.isValid) return this; + + if (units.length === 0) { + return this; + } + + units = units.map((u) => Duration.normalizeUnit(u)); + + const built = {}, + accumulated = {}, + vals = this.toObject(); + let lastUnit; + + for (const k of orderedUnits$1) { + if (units.indexOf(k) >= 0) { + lastUnit = k; + + let own = 0; + + // anything we haven't boiled down yet should get boiled to this unit + for (const ak in accumulated) { + own += this.matrix[ak][k] * accumulated[ak]; + accumulated[ak] = 0; + } + + // plus anything that's already in this unit + if (isNumber(vals[k])) { + own += vals[k]; + } + + // only keep the integer part for now in the hopes of putting any decimal part + // into a smaller unit later + const i = Math.trunc(own); + built[k] = i; + accumulated[k] = (own * 1000 - i * 1000) / 1000; + + // otherwise, keep it in the wings to boil it later + } else if (isNumber(vals[k])) { + accumulated[k] = vals[k]; + } + } + + // anything leftover becomes the decimal for the last unit + // lastUnit must be defined since units is not empty + for (const key in accumulated) { + if (accumulated[key] !== 0) { + built[lastUnit] += + key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; + } + } + + normalizeValues(this.matrix, built); + return clone$1(this, { values: built }, true); + } + + /** + * Shift this Duration to all available units. + * Same as shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds") + * @return {Duration} + */ + shiftToAll() { + if (!this.isValid) return this; + return this.shiftTo( + "years", + "months", + "weeks", + "days", + "hours", + "minutes", + "seconds", + "milliseconds" + ); + } + + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */ + negate() { + if (!this.isValid) return this; + const negated = {}; + for (const k of Object.keys(this.values)) { + negated[k] = this.values[k] === 0 ? 0 : -this.values[k]; + } + return clone$1(this, { values: negated }, true); + } + + /** + * Removes all units with values equal to 0 from this Duration. + * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 } + * @return {Duration} + */ + removeZeros() { + if (!this.isValid) return this; + const vals = removeZeroes(this.values); + return clone$1(this, { values: vals }, true); + } + + /** + * Get the years. + * @type {number} + */ + get years() { + return this.isValid ? this.values.years || 0 : NaN; + } + + /** + * Get the quarters. + * @type {number} + */ + get quarters() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + + /** + * Get the months. + * @type {number} + */ + get months() { + return this.isValid ? this.values.months || 0 : NaN; + } + + /** + * Get the weeks + * @type {number} + */ + get weeks() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + + /** + * Get the days. + * @type {number} + */ + get days() { + return this.isValid ? this.values.days || 0 : NaN; + } + + /** + * Get the hours. + * @type {number} + */ + get hours() { + return this.isValid ? this.values.hours || 0 : NaN; + } + + /** + * Get the minutes. + * @type {number} + */ + get minutes() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + + /** + * Get the seconds. + * @return {number} + */ + get seconds() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + + /** + * Get the milliseconds. + * @return {number} + */ + get milliseconds() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + get isValid() { + return this.invalid === null; + } + + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + if (!this.loc.equals(other.loc)) { + return false; + } + + function eq(v1, v2) { + // Consider 0 and undefined as equal + if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0; + return v1 === v2; + } + + for (const u of orderedUnits$1) { + if (!eq(this.values[u], other.values[u])) { + return false; + } + } + return true; + } +} + +const INVALID$1 = "Invalid Interval"; + +// checks if the start is equal to or before the end +function validateStartEnd(start, end) { + if (!start || !start.isValid) { + return Interval.invalid("missing or invalid start"); + } else if (!end || !end.isValid) { + return Interval.invalid("missing or invalid end"); + } else if (end < start) { + return Interval.invalid( + "end before start", + `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}` + ); + } else { + return null; + } +} + +/** + * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them. + * + * Here is a brief overview of the most commonly used methods and getters in Interval: + * + * * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}. + * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end. + * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}. + * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}. + * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs} + * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}. + */ +class Interval { + /** + * @private + */ + constructor(config) { + /** + * @access private + */ + this.s = config.start; + /** + * @access private + */ + this.e = config.end; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.isLuxonInterval = true; + } + + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); + } + + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidIntervalError(invalid); + } else { + return new Interval({ invalid }); + } + } + + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */ + static fromDateTimes(start, end) { + const builtStart = friendlyDateTime(start), + builtEnd = friendlyDateTime(end); + + const validateError = validateStartEnd(builtStart, builtEnd); + + if (validateError == null) { + return new Interval({ + start: builtStart, + end: builtEnd, + }); + } else { + return validateError; + } + } + + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + static after(start, duration) { + const dur = Duration.fromDurationLike(duration), + dt = friendlyDateTime(start); + return Interval.fromDateTimes(dt, dt.plus(dur)); + } + + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + static before(end, duration) { + const dur = Duration.fromDurationLike(duration), + dt = friendlyDateTime(end); + return Interval.fromDateTimes(dt.minus(dur), dt); + } + + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */ + static fromISO(text, opts) { + const [s, e] = (text || "").split("/", 2); + if (s && e) { + let start, startIsValid; + try { + start = DateTime.fromISO(s, opts); + startIsValid = start.isValid; + } catch (e) { + startIsValid = false; + } + + let end, endIsValid; + try { + end = DateTime.fromISO(e, opts); + endIsValid = end.isValid; + } catch (e) { + endIsValid = false; + } + + if (startIsValid && endIsValid) { + return Interval.fromDateTimes(start, end); + } + + if (startIsValid) { + const dur = Duration.fromISO(e, opts); + if (dur.isValid) { + return Interval.after(start, dur); + } + } else if (endIsValid) { + const dur = Duration.fromISO(s, opts); + if (dur.isValid) { + return Interval.before(end, dur); + } + } + } + return Interval.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); + } + + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isInterval(o) { + return (o && o.isLuxonInterval) || false; + } + + /** + * Returns the start of the Interval + * @type {DateTime} + */ + get start() { + return this.isValid ? this.s : null; + } + + /** + * Returns the end of the Interval. This is the first instant which is not part of the interval + * (Interval is half-open). + * @type {DateTime} + */ + get end() { + return this.isValid ? this.e : null; + } + + /** + * Returns the last DateTime included in the interval (since end is not part of the interval) + * @type {DateTime} + */ + get lastDateTime() { + return this.isValid ? (this.e ? this.e.minus(1) : null) : null; + } + + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + get isValid() { + return this.invalidReason === null; + } + + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + length(unit = "milliseconds") { + return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN; + } + + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime + * @return {number} + */ + count(unit = "milliseconds", opts) { + if (!this.isValid) return NaN; + const start = this.start.startOf(unit, opts); + let end; + if (opts?.useLocaleWeeks) { + end = this.end.reconfigure({ locale: start.locale }); + } else { + end = this.end; + } + end = end.startOf(unit, opts); + return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf()); + } + + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */ + hasSame(unit) { + return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false; + } + + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */ + isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + isAfter(dateTime) { + if (!this.isValid) return false; + return this.s > dateTime; + } + + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + isBefore(dateTime) { + if (!this.isValid) return false; + return this.e <= dateTime; + } + + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + contains(dateTime) { + if (!this.isValid) return false; + return this.s <= dateTime && this.e > dateTime; + } + + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */ + set({ start, end } = {}) { + if (!this.isValid) return this; + return Interval.fromDateTimes(start || this.s, end || this.e); + } + + /** + * Split this Interval at each of the specified DateTimes + * @param {...DateTime} dateTimes - the unit of time to count. + * @return {Array} + */ + splitAt(...dateTimes) { + if (!this.isValid) return []; + const sorted = dateTimes + .map(friendlyDateTime) + .filter((d) => this.contains(d)) + .sort((a, b) => a.toMillis() - b.toMillis()), + results = []; + let { s } = this, + i = 0; + + while (s < this.e) { + const added = sorted[i] || this.e, + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + i += 1; + } + + return results; + } + + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {Array} + */ + splitBy(duration) { + const dur = Duration.fromDurationLike(duration); + + if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { + return []; + } + + let { s } = this, + idx = 1, + next; + + const results = []; + while (s < this.e) { + const added = this.start.plus(dur.mapUnits((x) => x * idx)); + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + idx += 1; + } + + return results; + } + + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {Array} + */ + divideEqually(numberOfParts) { + if (!this.isValid) return []; + return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); + } + + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */ + overlaps(other) { + return this.e > other.s && this.s < other.e; + } + + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */ + abutsStart(other) { + if (!this.isValid) return false; + return +this.e === +other.s; + } + + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */ + abutsEnd(other) { + if (!this.isValid) return false; + return +other.e === +this.s; + } + + /** + * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise. + * @param {Interval} other + * @return {boolean} + */ + engulfs(other) { + if (!this.isValid) return false; + return this.s <= other.s && this.e >= other.e; + } + + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + return this.s.equals(other.s) && this.e.equals(other.e); + } + + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */ + intersection(other) { + if (!this.isValid) return this; + const s = this.s > other.s ? this.s : other.s, + e = this.e < other.e ? this.e : other.e; + + if (s >= e) { + return null; + } else { + return Interval.fromDateTimes(s, e); + } + } + + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */ + union(other) { + if (!this.isValid) return this; + const s = this.s < other.s ? this.s : other.s, + e = this.e > other.e ? this.e : other.e; + return Interval.fromDateTimes(s, e); + } + + /** + * Merge an array of Intervals into an equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * The resulting array will contain the Intervals in ascending order, that is, starting with the earliest Interval + * and ending with the latest. + * + * @param {Array} intervals + * @return {Array} + */ + static merge(intervals) { + const [found, final] = intervals + .sort((a, b) => a.s - b.s) + .reduce( + ([sofar, current], item) => { + if (!current) { + return [sofar, item]; + } else if (current.overlaps(item) || current.abutsStart(item)) { + return [sofar, current.union(item)]; + } else { + return [sofar.concat([current]), item]; + } + }, + [[], null] + ); + if (final) { + found.push(final); + } + return found; + } + + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {Array} intervals + * @return {Array} + */ + static xor(intervals) { + let start = null, + currentCount = 0; + const results = [], + ends = intervals.map((i) => [ + { time: i.s, type: "s" }, + { time: i.e, type: "e" }, + ]), + flattened = Array.prototype.concat(...ends), + arr = flattened.sort((a, b) => a.time - b.time); + + for (const i of arr) { + currentCount += i.type === "s" ? 1 : -1; + + if (currentCount === 1) { + start = i.time; + } else { + if (start && +start !== +i.time) { + results.push(Interval.fromDateTimes(start, i.time)); + } + + start = null; + } + } + + return Interval.merge(results); + } + + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {Array} + */ + difference(...intervals) { + return Interval.xor([this].concat(intervals)) + .map((i) => this.intersection(i)) + .filter((i) => i && !i.isEmpty()); + } + + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */ + toString() { + if (!this.isValid) return INVALID$1; + return `[${this.s.toISO()} – ${this.e.toISO()})`; + } + + /** + * Returns a string representation of this Interval appropriate for the REPL. + * @return {string} + */ + [Symbol.for("nodejs.util.inspect.custom")]() { + if (this.isValid) { + return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`; + } else { + return `Interval { Invalid, reason: ${this.invalidReason} }`; + } + } + + /** + * Returns a localized string representing this Interval. Accepts the same options as the + * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as + * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method + * is browser-specific, but in general it will return an appropriate representation of the + * Interval in the assigned locale. Defaults to the system's locale if no locale has been + * specified. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or + * Intl.DateTimeFormat constructor options. + * @param {Object} opts - Options to override the configuration of the start DateTime. + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022 + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p + * @return {string} + */ + toLocaleString(formatOpts = DATE_SHORT, opts = {}) { + return this.isValid + ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) + : INVALID$1; + } + + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */ + toISO(opts) { + if (!this.isValid) return INVALID$1; + return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`; + } + + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */ + toISODate() { + if (!this.isValid) return INVALID$1; + return `${this.s.toISODate()}/${this.e.toISODate()}`; + } + + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */ + toISOTime(opts) { + if (!this.isValid) return INVALID$1; + return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`; + } + + /** + * Returns a string representation of this Interval formatted according to the specified format + * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible + * formatting tool. + * @param {string} dateFormat - The format string. This string formats the start and end time. + * See {@link DateTime#toFormat} for details. + * @param {Object} opts - Options. + * @param {string} [opts.separator = ' – '] - A separator to place between the start and end + * representations. + * @return {string} + */ + toFormat(dateFormat, { separator = " – " } = {}) { + if (!this.isValid) return INVALID$1; + return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`; + } + + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */ + toDuration(unit, opts) { + if (!this.isValid) { + return Duration.invalid(this.invalidReason); + } + return this.e.diff(this.s, unit, opts); + } + + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */ + mapEndpoints(mapFn) { + return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); + } +} + +/** + * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment. + */ +class Info { + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + static hasDST(zone = Settings.defaultZone) { + const proto = DateTime.now().setZone(zone).set({ month: 12 }); + + return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset; + } + + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */ + static isValidIANAZone(zone) { + return IANAZone.isValidZone(zone); + } + + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone#isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */ + static normalizeZone(input) { + return normalizeZone(input, Settings.defaultZone); + } + + /** + * Get the weekday on which the week starts according to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} the start of the week, 1 for Monday through 7 for Sunday + */ + static getStartOfWeek({ locale = null, locObj = null } = {}) { + return (locObj || Locale.create(locale)).getStartOfWeek(); + } + + /** + * Get the minimum number of days necessary in a week before it is considered part of the next year according + * to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} + */ + static getMinimumDaysInFirstWeek({ locale = null, locObj = null } = {}) { + return (locObj || Locale.create(locale)).getMinDaysInFirstWeek(); + } + + /** + * Get the weekdays, which are considered the weekend according to the given locale + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday + */ + static getWeekendWeekdays({ locale = null, locObj = null } = {}) { + // copy the array, because we cache it internally + return (locObj || Locale.create(locale)).getWeekendDays().slice(); + } + + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {Array} + */ + static months( + length = "long", + { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {} + ) { + return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length); + } + + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link Info#months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {Array} + */ + static monthsFormat( + length = "long", + { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {} + ) { + return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true); + } + + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {Array} + */ + static weekdays(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) { + return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length); + } + + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link Info#weekdays} + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @return {Array} + */ + static weekdaysFormat( + length = "long", + { locale = null, numberingSystem = null, locObj = null } = {} + ) { + return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true); + } + + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {Array} + */ + static meridiems({ locale = null } = {}) { + return Locale.create(locale).meridiems(); + } + + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {Array} + */ + static eras(length = "short", { locale = null } = {}) { + return Locale.create(locale, null, "gregory").eras(length); + } + + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case. + * Keys: + * * `relative`: whether this environment supports relative time formatting + * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale + * @example Info.features() //=> { relative: false, localeWeek: true } + * @return {Object} + */ + static features() { + return { relative: hasRelative(), localeWeek: hasLocaleWeekInfo() }; + } +} + +function dayDiff(earlier, later) { + const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf("day").valueOf(), + ms = utcDayStart(later) - utcDayStart(earlier); + return Math.floor(Duration.fromMillis(ms).as("days")); +} + +function highOrderDiffs(cursor, later, units) { + const differs = [ + ["years", (a, b) => b.year - a.year], + ["quarters", (a, b) => b.quarter - a.quarter + (b.year - a.year) * 4], + ["months", (a, b) => b.month - a.month + (b.year - a.year) * 12], + [ + "weeks", + (a, b) => { + const days = dayDiff(a, b); + return (days - (days % 7)) / 7; + }, + ], + ["days", dayDiff], + ]; + + const results = {}; + const earlier = cursor; + let lowestOrder, highWater; + + /* This loop tries to diff using larger units first. + If we overshoot, we backtrack and try the next smaller unit. + "cursor" starts out at the earlier timestamp and moves closer and closer to "later" + as we use smaller and smaller units. + highWater keeps track of where we would be if we added one more of the smallest unit, + this is used later to potentially convert any difference smaller than the smallest higher order unit + into a fraction of that smallest higher order unit + */ + for (const [unit, differ] of differs) { + if (units.indexOf(unit) >= 0) { + lowestOrder = unit; + + results[unit] = differ(cursor, later); + highWater = earlier.plus(results); + + if (highWater > later) { + // we overshot the end point, backtrack cursor by 1 + results[unit]--; + cursor = earlier.plus(results); + + // if we are still overshooting now, we need to backtrack again + // this happens in certain situations when diffing times in different zones, + // because this calculation ignores time zones + if (cursor > later) { + // keep the "overshot by 1" around as highWater + highWater = cursor; + // backtrack cursor by 1 + results[unit]--; + cursor = earlier.plus(results); + } + } else { + cursor = highWater; + } + } + } + + return [cursor, results, highWater, lowestOrder]; +} + +function diff (earlier, later, units, opts) { + let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units); + + const remainingMillis = later - cursor; + + const lowerOrderUnits = units.filter( + (u) => ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0 + ); + + if (lowerOrderUnits.length === 0) { + if (highWater < later) { + highWater = cursor.plus({ [lowestOrder]: 1 }); + } + + if (highWater !== cursor) { + results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); + } + } + + const duration = Duration.fromObject(results, opts); + + if (lowerOrderUnits.length > 0) { + return Duration.fromMillis(remainingMillis, opts) + .shiftTo(...lowerOrderUnits) + .plus(duration); + } else { + return duration; + } +} + +const MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; + +function intUnit(regex, post = (i) => i) { + return { regex, deser: ([s]) => post(parseDigits(s)) }; +} + +const NBSP = String.fromCharCode(160); +const spaceOrNBSP = `[ ${NBSP}]`; +const spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g"); + +function fixListRegex(s) { + // make dots optional and also make them literal + // make space and non breakable space characters interchangeable + return s.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP); +} + +function stripInsensitivities(s) { + return s + .replace(/\./g, "") // ignore dots that were made optional + .replace(spaceOrNBSPRegExp, " ") // interchange space and nbsp + .toLowerCase(); +} + +function oneOf(strings, startIndex) { + if (strings === null) { + return null; + } else { + return { + regex: RegExp(strings.map(fixListRegex).join("|")), + deser: ([s]) => + strings.findIndex((i) => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex, + }; + } +} + +function offset(regex, groups) { + return { regex, deser: ([, h, m]) => signedOffset(h, m), groups }; +} + +function simple(regex) { + return { regex, deser: ([s]) => s }; +} + +function escapeToken(value) { + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); +} + +/** + * @param token + * @param {Locale} loc + */ +function unitForToken(token, loc) { + const one = digitRegex(loc), + two = digitRegex(loc, "{2}"), + three = digitRegex(loc, "{3}"), + four = digitRegex(loc, "{4}"), + six = digitRegex(loc, "{6}"), + oneOrTwo = digitRegex(loc, "{1,2}"), + oneToThree = digitRegex(loc, "{1,3}"), + oneToSix = digitRegex(loc, "{1,6}"), + oneToNine = digitRegex(loc, "{1,9}"), + twoToFour = digitRegex(loc, "{2,4}"), + fourToSix = digitRegex(loc, "{4,6}"), + literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }), + unitate = (t) => { + if (token.literal) { + return literal(t); + } + switch (t.val) { + // era + case "G": + return oneOf(loc.eras("short"), 0); + case "GG": + return oneOf(loc.eras("long"), 0); + // years + case "y": + return intUnit(oneToSix); + case "yy": + return intUnit(twoToFour, untruncateYear); + case "yyyy": + return intUnit(four); + case "yyyyy": + return intUnit(fourToSix); + case "yyyyyy": + return intUnit(six); + // months + case "M": + return intUnit(oneOrTwo); + case "MM": + return intUnit(two); + case "MMM": + return oneOf(loc.months("short", true), 1); + case "MMMM": + return oneOf(loc.months("long", true), 1); + case "L": + return intUnit(oneOrTwo); + case "LL": + return intUnit(two); + case "LLL": + return oneOf(loc.months("short", false), 1); + case "LLLL": + return oneOf(loc.months("long", false), 1); + // dates + case "d": + return intUnit(oneOrTwo); + case "dd": + return intUnit(two); + // ordinals + case "o": + return intUnit(oneToThree); + case "ooo": + return intUnit(three); + // time + case "HH": + return intUnit(two); + case "H": + return intUnit(oneOrTwo); + case "hh": + return intUnit(two); + case "h": + return intUnit(oneOrTwo); + case "mm": + return intUnit(two); + case "m": + return intUnit(oneOrTwo); + case "q": + return intUnit(oneOrTwo); + case "qq": + return intUnit(two); + case "s": + return intUnit(oneOrTwo); + case "ss": + return intUnit(two); + case "S": + return intUnit(oneToThree); + case "SSS": + return intUnit(three); + case "u": + return simple(oneToNine); + case "uu": + return simple(oneOrTwo); + case "uuu": + return intUnit(one); + // meridiem + case "a": + return oneOf(loc.meridiems(), 0); + // weekYear (k) + case "kkkk": + return intUnit(four); + case "kk": + return intUnit(twoToFour, untruncateYear); + // weekNumber (W) + case "W": + return intUnit(oneOrTwo); + case "WW": + return intUnit(two); + // weekdays + case "E": + case "c": + return intUnit(one); + case "EEE": + return oneOf(loc.weekdays("short", false), 1); + case "EEEE": + return oneOf(loc.weekdays("long", false), 1); + case "ccc": + return oneOf(loc.weekdays("short", true), 1); + case "cccc": + return oneOf(loc.weekdays("long", true), 1); + // offset/zone + case "Z": + case "ZZ": + return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2); + case "ZZZ": + return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2); + // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing + // because we don't have any way to figure out what they are + case "z": + return simple(/[a-z_+-/]{1,256}?/i); + // this special-case "token" represents a place where a macro-token expanded into a white-space literal + // in this case we accept any non-newline white-space + case " ": + return simple(/[^\S\n\r]/); + default: + return literal(t); + } + }; + + const unit = unitate(token) || { + invalidReason: MISSING_FTP, + }; + + unit.token = token; + + return unit; +} + +const partTypeStyleToTokenVal = { + year: { + "2-digit": "yy", + numeric: "yyyyy", + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM", + }, + day: { + numeric: "d", + "2-digit": "dd", + }, + weekday: { + short: "EEE", + long: "EEEE", + }, + dayperiod: "a", + dayPeriod: "a", + hour12: { + numeric: "h", + "2-digit": "hh", + }, + hour24: { + numeric: "H", + "2-digit": "HH", + }, + minute: { + numeric: "m", + "2-digit": "mm", + }, + second: { + numeric: "s", + "2-digit": "ss", + }, + timeZoneName: { + long: "ZZZZZ", + short: "ZZZ", + }, +}; + +function tokenForPart(part, formatOpts, resolvedOpts) { + const { type, value } = part; + + if (type === "literal") { + const isSpace = /^\s+$/.test(value); + return { + literal: !isSpace, + val: isSpace ? " " : value, + }; + } + + const style = formatOpts[type]; + + // The user might have explicitly specified hour12 or hourCycle + // if so, respect their decision + // if not, refer back to the resolvedOpts, which are based on the locale + let actualType = type; + if (type === "hour") { + if (formatOpts.hour12 != null) { + actualType = formatOpts.hour12 ? "hour12" : "hour24"; + } else if (formatOpts.hourCycle != null) { + if (formatOpts.hourCycle === "h11" || formatOpts.hourCycle === "h12") { + actualType = "hour12"; + } else { + actualType = "hour24"; + } + } else { + // tokens only differentiate between 24 hours or not, + // so we do not need to check hourCycle here, which is less supported anyways + actualType = resolvedOpts.hour12 ? "hour12" : "hour24"; + } + } + let val = partTypeStyleToTokenVal[actualType]; + if (typeof val === "object") { + val = val[style]; + } + + if (val) { + return { + literal: false, + val, + }; + } + + return undefined; +} + +function buildRegex(units) { + const re = units.map((u) => u.regex).reduce((f, r) => `${f}(${r.source})`, ""); + return [`^${re}$`, units]; +} + +function match(input, regex, handlers) { + const matches = input.match(regex); + + if (matches) { + const all = {}; + let matchIndex = 1; + for (const i in handlers) { + if (hasOwnProperty(handlers, i)) { + const h = handlers[i], + groups = h.groups ? h.groups + 1 : 1; + if (!h.literal && h.token) { + all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); + } + matchIndex += groups; + } + } + return [matches, all]; + } else { + return [matches, {}]; + } +} + +function dateTimeFromMatches(matches) { + const toField = (token) => { + switch (token) { + case "S": + return "millisecond"; + case "s": + return "second"; + case "m": + return "minute"; + case "h": + case "H": + return "hour"; + case "d": + return "day"; + case "o": + return "ordinal"; + case "L": + case "M": + return "month"; + case "y": + return "year"; + case "E": + case "c": + return "weekday"; + case "W": + return "weekNumber"; + case "k": + return "weekYear"; + case "q": + return "quarter"; + default: + return null; + } + }; + + let zone = null; + let specificOffset; + if (!isUndefined(matches.z)) { + zone = IANAZone.create(matches.z); + } + + if (!isUndefined(matches.Z)) { + if (!zone) { + zone = new FixedOffsetZone(matches.Z); + } + specificOffset = matches.Z; + } + + if (!isUndefined(matches.q)) { + matches.M = (matches.q - 1) * 3 + 1; + } + + if (!isUndefined(matches.h)) { + if (matches.h < 12 && matches.a === 1) { + matches.h += 12; + } else if (matches.h === 12 && matches.a === 0) { + matches.h = 0; + } + } + + if (matches.G === 0 && matches.y) { + matches.y = -matches.y; + } + + if (!isUndefined(matches.u)) { + matches.S = parseMillis(matches.u); + } + + const vals = Object.keys(matches).reduce((r, k) => { + const f = toField(k); + if (f) { + r[f] = matches[k]; + } + + return r; + }, {}); + + return [vals, zone, specificOffset]; +} + +let dummyDateTimeCache = null; + +function getDummyDateTime() { + if (!dummyDateTimeCache) { + dummyDateTimeCache = DateTime.fromMillis(1555555555555); + } + + return dummyDateTimeCache; +} + +function maybeExpandMacroToken(token, locale) { + if (token.literal) { + return token; + } + + const formatOpts = Formatter.macroTokenToFormatOpts(token.val); + const tokens = formatOptsToTokens(formatOpts, locale); + + if (tokens == null || tokens.includes(undefined)) { + return token; + } + + return tokens; +} + +function expandMacroTokens(tokens, locale) { + return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale))); +} + +/** + * @private + */ + +class TokenParser { + constructor(locale, format) { + this.locale = locale; + this.format = format; + this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale); + this.units = this.tokens.map((t) => unitForToken(t, locale)); + this.disqualifyingUnit = this.units.find((t) => t.invalidReason); + + if (!this.disqualifyingUnit) { + const [regexString, handlers] = buildRegex(this.units); + this.regex = RegExp(regexString, "i"); + this.handlers = handlers; + } + } + + explainFromTokens(input) { + if (!this.isValid) { + return { input, tokens: this.tokens, invalidReason: this.invalidReason }; + } else { + const [rawMatches, matches] = match(input, this.regex, this.handlers), + [result, zone, specificOffset] = matches + ? dateTimeFromMatches(matches) + : [null, null, undefined]; + if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { + throw new ConflictingSpecificationError( + "Can't include meridiem when specifying 24-hour format" + ); + } + return { + input, + tokens: this.tokens, + regex: this.regex, + rawMatches, + matches, + result, + zone, + specificOffset, + }; + } + } + + get isValid() { + return !this.disqualifyingUnit; + } + + get invalidReason() { + return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null; + } +} + +function explainFromTokens(locale, input, format) { + const parser = new TokenParser(locale, format); + return parser.explainFromTokens(input); +} + +function parseFromTokens(locale, input, format) { + const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format); + return [result, zone, specificOffset, invalidReason]; +} + +function formatOptsToTokens(formatOpts, locale) { + if (!formatOpts) { + return null; + } + + const formatter = Formatter.create(locale, formatOpts); + const df = formatter.dtFormatter(getDummyDateTime()); + const parts = df.formatToParts(); + const resolvedOpts = df.resolvedOptions(); + return parts.map((p) => tokenForPart(p, formatOpts, resolvedOpts)); +} + +const INVALID = "Invalid DateTime"; +const MAX_DATE = 8.64e15; + +function unsupportedZone(zone) { + return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`); +} + +// we cache week data on the DT object and this intermediates the cache +/** + * @param {DateTime} dt + */ +function possiblyCachedWeekData(dt) { + if (dt.weekData === null) { + dt.weekData = gregorianToWeek(dt.c); + } + return dt.weekData; +} + +/** + * @param {DateTime} dt + */ +function possiblyCachedLocalWeekData(dt) { + if (dt.localWeekData === null) { + dt.localWeekData = gregorianToWeek( + dt.c, + dt.loc.getMinDaysInFirstWeek(), + dt.loc.getStartOfWeek() + ); + } + return dt.localWeekData; +} + +// clone really means, "make a new object with these modifications". all "setters" really use this +// to create a new object while only changing some of the properties +function clone(inst, alts) { + const current = { + ts: inst.ts, + zone: inst.zone, + c: inst.c, + o: inst.o, + loc: inst.loc, + invalid: inst.invalid, + }; + return new DateTime({ ...current, ...alts, old: current }); +} + +// find the right offset a given local time. The o input is our guess, which determines which +// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST) +function fixOffset(localTS, o, tz) { + // Our UTC time is just a guess because our offset is just a guess + let utcGuess = localTS - o * 60 * 1000; + + // Test whether the zone matches the offset for this ts + const o2 = tz.offset(utcGuess); + + // If so, offset didn't change and we're done + if (o === o2) { + return [utcGuess, o]; + } + + // If not, change the ts by the difference in the offset + utcGuess -= (o2 - o) * 60 * 1000; + + // If that gives us the local time we want, we're done + const o3 = tz.offset(utcGuess); + if (o2 === o3) { + return [utcGuess, o2]; + } + + // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time + return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; +} + +// convert an epoch timestamp into a calendar object with the given offset +function tsToObj(ts, offset) { + ts += offset * 60 * 1000; + + const d = new Date(ts); + + return { + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate(), + hour: d.getUTCHours(), + minute: d.getUTCMinutes(), + second: d.getUTCSeconds(), + millisecond: d.getUTCMilliseconds(), + }; +} + +// convert a calendar object to a epoch timestamp +function objToTS(obj, offset, zone) { + return fixOffset(objToLocalTS(obj), offset, zone); +} + +// create a new DT instance by adding a duration, adjusting for DSTs +function adjustTime(inst, dur) { + const oPre = inst.o, + year = inst.c.year + Math.trunc(dur.years), + month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, + c = { + ...inst.c, + year, + month, + day: + Math.min(inst.c.day, daysInMonth(year, month)) + + Math.trunc(dur.days) + + Math.trunc(dur.weeks) * 7, + }, + millisToAdd = Duration.fromObject({ + years: dur.years - Math.trunc(dur.years), + quarters: dur.quarters - Math.trunc(dur.quarters), + months: dur.months - Math.trunc(dur.months), + weeks: dur.weeks - Math.trunc(dur.weeks), + days: dur.days - Math.trunc(dur.days), + hours: dur.hours, + minutes: dur.minutes, + seconds: dur.seconds, + milliseconds: dur.milliseconds, + }).as("milliseconds"), + localTS = objToLocalTS(c); + + let [ts, o] = fixOffset(localTS, oPre, inst.zone); + + if (millisToAdd !== 0) { + ts += millisToAdd; + // that could have changed the offset by going over a DST, but we want to keep the ts the same + o = inst.zone.offset(ts); + } + + return { ts, o }; +} + +// helper useful in turning the results of parsing into real dates +// by handling the zone options +function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) { + const { setZone, zone } = opts; + if ((parsed && Object.keys(parsed).length !== 0) || parsedZone) { + const interpretationZone = parsedZone || zone, + inst = DateTime.fromObject(parsed, { + ...opts, + zone: interpretationZone, + specificOffset, + }); + return setZone ? inst : inst.setZone(zone); + } else { + return DateTime.invalid( + new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`) + ); + } +} + +// if you want to output a technical format (e.g. RFC 2822), this helper +// helps handle the details +function toTechFormat(dt, format, allowZ = true) { + return dt.isValid + ? Formatter.create(Locale.create("en-US"), { + allowZ, + forceSimple: true, + }).formatDateTimeFromString(dt, format) + : null; +} + +function toISODate(o, extended, precision) { + const longFormat = o.c.year > 9999 || o.c.year < 0; + let c = ""; + if (longFormat && o.c.year >= 0) c += "+"; + c += padStart(o.c.year, longFormat ? 6 : 4); + if (precision === "year") return c; + if (extended) { + c += "-"; + c += padStart(o.c.month); + if (precision === "month") return c; + c += "-"; + } else { + c += padStart(o.c.month); + if (precision === "month") return c; + } + c += padStart(o.c.day); + return c; +} + +function toISOTime( + o, + extended, + suppressSeconds, + suppressMilliseconds, + includeOffset, + extendedZone, + precision +) { + let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0, + c = ""; + switch (precision) { + case "day": + case "month": + case "year": + break; + default: + c += padStart(o.c.hour); + if (precision === "hour") break; + if (extended) { + c += ":"; + c += padStart(o.c.minute); + if (precision === "minute") break; + if (showSeconds) { + c += ":"; + c += padStart(o.c.second); + } + } else { + c += padStart(o.c.minute); + if (precision === "minute") break; + if (showSeconds) { + c += padStart(o.c.second); + } + } + if (precision === "second") break; + if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) { + c += "."; + c += padStart(o.c.millisecond, 3); + } + } + + if (includeOffset) { + if (o.isOffsetFixed && o.offset === 0 && !extendedZone) { + c += "Z"; + } else if (o.o < 0) { + c += "-"; + c += padStart(Math.trunc(-o.o / 60)); + c += ":"; + c += padStart(Math.trunc(-o.o % 60)); + } else { + c += "+"; + c += padStart(Math.trunc(o.o / 60)); + c += ":"; + c += padStart(Math.trunc(o.o % 60)); + } + } + + if (extendedZone) { + c += "[" + o.zone.ianaName + "]"; + } + return c; +} + +// defaults for unspecified units in the supported calendars +const defaultUnitValues = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0, + }, + defaultWeekUnitValues = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0, + }, + defaultOrdinalUnitValues = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0, + }; + +// Units in the supported calendars, sorted by bigness +const orderedUnits = ["year", "month", "day", "hour", "minute", "second", "millisecond"], + orderedWeekUnits = [ + "weekYear", + "weekNumber", + "weekday", + "hour", + "minute", + "second", + "millisecond", + ], + orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; + +// standardize case and plurality in units +function normalizeUnit(unit) { + const normalized = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal", + }[unit.toLowerCase()]; + + if (!normalized) throw new InvalidUnitError(unit); + + return normalized; +} + +function normalizeUnitWithLocalWeeks(unit) { + switch (unit.toLowerCase()) { + case "localweekday": + case "localweekdays": + return "localWeekday"; + case "localweeknumber": + case "localweeknumbers": + return "localWeekNumber"; + case "localweekyear": + case "localweekyears": + return "localWeekYear"; + default: + return normalizeUnit(unit); + } +} + +// cache offsets for zones based on the current timestamp when this function is +// first called. When we are handling a datetime from components like (year, +// month, day, hour) in a time zone, we need a guess about what the timezone +// offset is so that we can convert into a UTC timestamp. One way is to find the +// offset of now in the zone. The actual date may have a different offset (for +// example, if we handle a date in June while we're in December in a zone that +// observes DST), but we can check and adjust that. +// +// When handling many dates, calculating the offset for now every time is +// expensive. It's just a guess, so we can cache the offset to use even if we +// are right on a time change boundary (we'll just correct in the other +// direction). Using a timestamp from first read is a slight optimization for +// handling dates close to the current date, since those dates will usually be +// in the same offset (we could set the timestamp statically, instead). We use a +// single timestamp for all zones to make things a bit more predictable. +// +// This is safe for quickDT (used by local() and utc()) because we don't fill in +// higher-order units from tsNow (as we do in fromObject, this requires that +// offset is calculated from tsNow). +/** + * @param {Zone} zone + * @return {number} + */ +function guessOffsetForZone(zone) { + if (zoneOffsetTs === undefined) { + zoneOffsetTs = Settings.now(); + } + + // Do not cache anything but IANA zones, because it is not safe to do so. + // Guessing an offset which is not present in the zone can cause wrong results from fixOffset + if (zone.type !== "iana") { + return zone.offset(zoneOffsetTs); + } + const zoneName = zone.name; + let offsetGuess = zoneOffsetGuessCache.get(zoneName); + if (offsetGuess === undefined) { + offsetGuess = zone.offset(zoneOffsetTs); + zoneOffsetGuessCache.set(zoneName, offsetGuess); + } + return offsetGuess; +} + +// this is a dumbed down version of fromObject() that runs about 60% faster +// but doesn't do any validation, makes a bunch of assumptions about what units +// are present, and so on. +function quickDT(obj, opts) { + const zone = normalizeZone(opts.zone, Settings.defaultZone); + if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } + + const loc = Locale.fromObject(opts); + + let ts, o; + + // assume we have the higher-order units + if (!isUndefined(obj.year)) { + for (const u of orderedUnits) { + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } + } + + const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + if (invalid) { + return DateTime.invalid(invalid); + } + + const offsetProvis = guessOffsetForZone(zone); + [ts, o] = objToTS(obj, offsetProvis, zone); + } else { + ts = Settings.now(); + } + + return new DateTime({ ts, zone, loc, o }); +} + +function diffRelative(start, end, opts) { + const round = isUndefined(opts.round) ? true : opts.round, + rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding, + format = (c, unit) => { + c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding); + const formatter = end.loc.clone(opts).relFormatter(opts); + return formatter.format(c, unit); + }, + differ = (unit) => { + if (opts.calendary) { + if (!end.hasSame(start, unit)) { + return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); + } else return 0; + } else { + return end.diff(start, unit).get(unit); + } + }; + + if (opts.unit) { + return format(differ(opts.unit), opts.unit); + } + + for (const unit of opts.units) { + const count = differ(unit); + if (Math.abs(count) >= 1) { + return format(count, unit); + } + } + return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]); +} + +function lastOpts(argList) { + let opts = {}, + args; + if (argList.length > 0 && typeof argList[argList.length - 1] === "object") { + opts = argList[argList.length - 1]; + args = Array.from(argList).slice(0, argList.length - 1); + } else { + args = Array.from(argList); + } + return [opts, args]; +} + +/** + * Timestamp to use for cached zone offset guesses (exposed for test) + */ +let zoneOffsetTs; +/** + * Cache for zone offset guesses (exposed for test). + * + * This optimizes quickDT via guessOffsetForZone to avoid repeated calls of + * zone.offset(). + */ +const zoneOffsetGuessCache = new Map(); + +/** + * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. + * + * A DateTime comprises of: + * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. + * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). + * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. + * + * Here is a brief overview of the most commonly used functionality it provides: + * + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month}, + * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors. + * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}. + * + * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. + */ +class DateTime { + /** + * @access private + */ + constructor(config) { + const zone = config.zone || Settings.defaultZone; + + let invalid = + config.invalid || + (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || + (!zone.isValid ? unsupportedZone(zone) : null); + /** + * @access private + */ + this.ts = isUndefined(config.ts) ? Settings.now() : config.ts; + + let c = null, + o = null; + if (!invalid) { + const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); + + if (unchanged) { + [c, o] = [config.old.c, config.old.o]; + } else { + // If an offset has been passed and we have not been called from + // clone(), we can trust it and avoid the offset calculation. + const ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts); + c = tsToObj(this.ts, ot); + invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; + c = invalid ? null : c; + o = invalid ? null : ot; + } + } + + /** + * @access private + */ + this._zone = zone; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.invalid = invalid; + /** + * @access private + */ + this.weekData = null; + /** + * @access private + */ + this.localWeekData = null; + /** + * @access private + */ + this.c = c; + /** + * @access private + */ + this.o = o; + /** + * @access private + */ + this.isLuxonDateTime = true; + } + + // CONSTRUCT + + /** + * Create a DateTime for the current instant, in the system's time zone. + * + * Use Settings to override these default values if needed. + * @example DateTime.now().toISO() //~> now in the ISO format + * @return {DateTime} + */ + static now() { + return new DateTime({}); + } + + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month, 1-indexed + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local({ zone: "America/New_York" }) //~> now, in US east coast time + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12, { locale: "fr" }) //~> 2017-03-12T00:00:00, with a French locale + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, { zone: "utc" }) //~> 2017-03-12T05:00:00, in UTC + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */ + static local() { + const [opts, args] = lastOpts(arguments), + [year, month, day, hour, minute, second, millisecond] = args; + return quickDT({ year, month, day, hour, minute, second, millisecond }, opts); + } + + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @param {Object} options - configuration options for the DateTime + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: "fr" }) //~> 2017-03-12T05:45:00Z with a French locale + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: "fr" }) //~> 2017-03-12T05:45:10.765Z with a French locale + * @return {DateTime} + */ + static utc() { + const [opts, args] = lastOpts(arguments), + [year, month, day, hour, minute, second, millisecond] = args; + + opts.zone = FixedOffsetZone.utcInstance; + return quickDT({ year, month, day, hour, minute, second, millisecond }, opts); + } + + /** + * Create a DateTime from a JavaScript Date object. Uses the default zone. + * @param {Date} date - a JavaScript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */ + static fromJSDate(date, options = {}) { + const ts = isDate(date) ? date.valueOf() : NaN; + if (Number.isNaN(ts)) { + return DateTime.invalid("invalid input"); + } + + const zoneToUse = normalizeZone(options.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + return new DateTime({ + ts: ts, + zone: zoneToUse, + loc: Locale.fromObject(options), + }); + } + + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromMillis(milliseconds, options = {}) { + if (!isNumber(milliseconds)) { + throw new InvalidArgumentError( + `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}` + ); + } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { + // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start + return DateTime.invalid("Timestamp out of range"); + } else { + return new DateTime({ + ts: milliseconds, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options), + }); + } + } + + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromSeconds(seconds, options = {}) { + if (!isNumber(seconds)) { + throw new InvalidArgumentError("fromSeconds requires a numerical input"); + } else { + return new DateTime({ + ts: seconds * 1000, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options), + }); + } + } + + /** + * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.localWeekYear - a week year, according to the locale + * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale + * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {Object} opts - options for creating this DateTime + * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26' + * @return {DateTime} + */ + static fromObject(obj, opts = {}) { + obj = obj || {}; + const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + const loc = Locale.fromObject(opts); + const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks); + const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, loc); + + const tsNow = Settings.now(), + offsetProvis = !isUndefined(opts.specificOffset) + ? opts.specificOffset + : zoneToUse.offset(tsNow), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber; + + // cases: + // just a weekday -> this week's instance of that weekday, no worries + // (gregorian data or ordinal) + (weekYear or weekNumber) -> error + // (gregorian month or day) + ordinal -> error + // otherwise just use weeks or ordinals or gregorian, depending on what's specified + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError( + "Can't mix weekYear/weekNumber units with year/month/day or ordinals" + ); + } + + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + + const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor); + + // configure ourselves to deal with gregorian dates or week stuff + let units, + defaultValues, + objNow = tsToObj(tsNow, offsetProvis); + if (useWeekData) { + units = orderedWeekUnits; + defaultValues = defaultWeekUnitValues; + objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek); + } else if (containsOrdinal) { + units = orderedOrdinalUnits; + defaultValues = defaultOrdinalUnitValues; + objNow = gregorianToOrdinal(objNow); + } else { + units = orderedUnits; + defaultValues = defaultUnitValues; + } + + // set default values for missing stuff + let foundFirst = false; + for (const u of units) { + const v = normalized[u]; + if (!isUndefined(v)) { + foundFirst = true; + } else if (foundFirst) { + normalized[u] = defaultValues[u]; + } else { + normalized[u] = objNow[u]; + } + } + + // make sure the values we have are in range + const higherOrderInvalid = useWeekData + ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) + : containsOrdinal + ? hasInvalidOrdinalData(normalized) + : hasInvalidGregorianData(normalized), + invalid = higherOrderInvalid || hasInvalidTimeData(normalized); + + if (invalid) { + return DateTime.invalid(invalid); + } + + // compute the actual time + const gregorian = useWeekData + ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) + : containsOrdinal + ? ordinalToGregorian(normalized) + : normalized, + [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), + inst = new DateTime({ + ts: tsFinal, + zone: zoneToUse, + o: offsetFinal, + loc, + }); + + // gregorian data + weekday serves only to validate + if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { + return DateTime.invalid( + "mismatched weekday", + `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}` + ); + } + + if (!inst.isValid) { + return DateTime.invalid(inst.invalid); + } + + return inst; + } + + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */ + static fromISO(text, opts = {}) { + const [vals, parsedZone] = parseISODate(text); + return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); + } + + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */ + static fromRFC2822(text, opts = {}) { + const [vals, parsedZone] = parseRFC2822Date(text); + return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); + } + + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */ + static fromHTTP(text, opts = {}) { + const [vals, parsedZone] = parseHTTPDate(text); + return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); + } + + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens). + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromFormat(text, fmt, opts = {}) { + if (isUndefined(text) || isUndefined(fmt)) { + throw new InvalidArgumentError("fromFormat requires an input string and a format"); + } + + const { locale = null, numberingSystem = null } = opts, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true, + }), + [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt); + if (invalid) { + return DateTime.invalid(invalid); + } else { + return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset); + } + } + + /** + * @deprecated use fromFormat instead + */ + static fromString(text, fmt, opts = {}) { + return DateTime.fromFormat(text, fmt, opts); + } + + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */ + static fromSQL(text, opts = {}) { + const [vals, parsedZone] = parseSQL(text); + return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); + } + + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent. + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */ + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); + } + + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDateTimeError(invalid); + } else { + return new DateTime({ invalid }); + } + } + + /** + * Check if an object is an instance of DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isDateTime(o) { + return (o && o.isLuxonDateTime) || false; + } + + /** + * Produce the format string for a set of options + * @param formatOpts + * @param localeOpts + * @returns {string} + */ + static parseFormatForOpts(formatOpts, localeOpts = {}) { + const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts)); + return !tokenList ? null : tokenList.map((t) => (t ? t.val : null)).join(""); + } + + /** + * Produce the the fully expanded format token for the locale + * Does NOT quote characters, so quoted tokens will not round trip correctly + * @param fmt + * @param localeOpts + * @returns {string} + */ + static expandFormat(fmt, localeOpts = {}) { + const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts)); + return expanded.map((t) => t.val).join(""); + } + + static resetCache() { + zoneOffsetTs = undefined; + zoneOffsetGuessCache.clear(); + } + + // INFO + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */ + get(unit) { + return this[unit]; + } + + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */ + get isValid() { + return this.invalid === null; + } + + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + get locale() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + get numberingSystem() { + return this.isValid ? this.loc.numberingSystem : null; + } + + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + get outputCalendar() { + return this.isValid ? this.loc.outputCalendar : null; + } + + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + get zone() { + return this._zone; + } + + /** + * Get the name of the time zone. + * @type {string} + */ + get zoneName() { + return this.isValid ? this.zone.name : null; + } + + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + get year() { + return this.isValid ? this.c.year : NaN; + } + + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + get quarter() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + get month() { + return this.isValid ? this.c.month : NaN; + } + + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + get day() { + return this.isValid ? this.c.day : NaN; + } + + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + get hour() { + return this.isValid ? this.c.hour : NaN; + } + + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + get minute() { + return this.isValid ? this.c.minute : NaN; + } + + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + get second() { + return this.isValid ? this.c.second : NaN; + } + + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + get millisecond() { + return this.isValid ? this.c.millisecond : NaN; + } + + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 12, 31).weekYear //=> 2015 + * @type {number} + */ + get weekYear() { + return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; + } + + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + get weekNumber() { + return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; + } + + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + get weekday() { + return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; + } + + /** + * Returns true if this date is on a weekend according to the locale, false otherwise + * @returns {boolean} + */ + get isWeekend() { + return this.isValid && this.loc.getWeekendDays().includes(this.weekday); + } + + /** + * Get the day of the week according to the locale. + * 1 is the first day of the week and 7 is the last day of the week. + * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1, + * @returns {number} + */ + get localWeekday() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN; + } + + /** + * Get the week number of the week year according to the locale. Different locales assign week numbers differently, + * because the week can start on different days of the week (see localWeekday) and because a different number of days + * is required for a week to count as the first week of a year. + * @returns {number} + */ + get localWeekNumber() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN; + } + + /** + * Get the week year according to the locale. Different locales assign week numbers (and therefor week years) + * differently, see localWeekNumber. + * @returns {number} + */ + get localWeekYear() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN; + } + + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + get ordinal() { + return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; + } + + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + get monthShort() { + return this.isValid ? Info.months("short", { locObj: this.loc })[this.month - 1] : null; + } + + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + get monthLong() { + return this.isValid ? Info.months("long", { locObj: this.loc })[this.month - 1] : null; + } + + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + get weekdayShort() { + return this.isValid ? Info.weekdays("short", { locObj: this.loc })[this.weekday - 1] : null; + } + + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + get weekdayLong() { + return this.isValid ? Info.weekdays("long", { locObj: this.loc })[this.weekday - 1] : null; + } + + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.now().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + get offset() { + return this.isValid ? +this.o : NaN; + } + + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + get offsetNameShort() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale, + }); + } else { + return null; + } + } + + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + get offsetNameLong() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale, + }); + } else { + return null; + } + } + + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + get isOffsetFixed() { + return this.isValid ? this.zone.isUniversal : null; + } + + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + get isInDST() { + if (this.isOffsetFixed) { + return false; + } else { + return ( + this.offset > this.set({ month: 1, day: 1 }).offset || + this.offset > this.set({ month: 5 }).offset + ); + } + } + + /** + * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC + * in this DateTime's zone. During DST changes local time can be ambiguous, for example + * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`. + * This method will return both possible DateTimes if this DateTime's local time is ambiguous. + * @returns {DateTime[]} + */ + getPossibleOffsets() { + if (!this.isValid || this.isOffsetFixed) { + return [this]; + } + const dayMs = 86400000; + const minuteMs = 60000; + const localTS = objToLocalTS(this.c); + const oEarlier = this.zone.offset(localTS - dayMs); + const oLater = this.zone.offset(localTS + dayMs); + + const o1 = this.zone.offset(localTS - oEarlier * minuteMs); + const o2 = this.zone.offset(localTS - oLater * minuteMs); + if (o1 === o2) { + return [this]; + } + const ts1 = localTS - o1 * minuteMs; + const ts2 = localTS - o2 * minuteMs; + const c1 = tsToObj(ts1, o1); + const c2 = tsToObj(ts2, o2); + if ( + c1.hour === c2.hour && + c1.minute === c2.minute && + c1.second === c2.second && + c1.millisecond === c2.millisecond + ) { + return [clone(this, { ts: ts1 }), clone(this, { ts: ts2 })]; + } + return [this]; + } + + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */ + get isInLeapYear() { + return isLeapYear(this.year); + } + + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + get daysInMonth() { + return daysInMonth(this.year, this.month); + } + + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + get daysInYear() { + return this.isValid ? daysInYear(this.year) : NaN; + } + + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + get weeksInWeekYear() { + return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; + } + + /** + * Returns the number of weeks in this DateTime's local week year + * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52 + * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53 + * @type {number} + */ + get weeksInLocalWeekYear() { + return this.isValid + ? weeksInWeekYear( + this.localWeekYear, + this.loc.getMinDaysInFirstWeek(), + this.loc.getStartOfWeek() + ) + : NaN; + } + + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + resolvedLocaleOptions(opts = {}) { + const { locale, numberingSystem, calendar } = Formatter.create( + this.loc.clone(opts), + opts + ).resolvedOptions(this); + return { locale, numberingSystem, outputCalendar: calendar }; + } + + // TRANSFORM + + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link DateTime#setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */ + toUTC(offset = 0, opts = {}) { + return this.setZone(FixedOffsetZone.instance(offset), opts); + } + + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */ + toLocal() { + return this.setZone(Settings.defaultZone); + } + + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */ + setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) { + zone = normalizeZone(zone, Settings.defaultZone); + if (zone.equals(this.zone)) { + return this; + } else if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } else { + let newTS = this.ts; + if (keepLocalTime || keepCalendarTime) { + const offsetGuess = zone.offset(this.ts); + const asObj = this.toObject(); + [newTS] = objToTS(asObj, offsetGuess, zone); + } + return clone(this, { ts: newTS, zone }); + } + } + + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */ + reconfigure({ locale, numberingSystem, outputCalendar } = {}) { + const loc = this.loc.clone({ locale, numberingSystem, outputCalendar }); + return clone(this, { loc }); + } + + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */ + setLocale(locale) { + return this.reconfigure({ locale }); + } + + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}. + * + * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`. + * They cannot be mixed with ISO-week units like `weekday`. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */ + set(values) { + if (!this.isValid) return this; + + const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks); + const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, this.loc); + + const settingWeekStuff = + !isUndefined(normalized.weekYear) || + !isUndefined(normalized.weekNumber) || + !isUndefined(normalized.weekday), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber; + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError( + "Can't mix weekYear/weekNumber units with year/month/day or ordinals" + ); + } + + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + + let mixed; + if (settingWeekStuff) { + mixed = weekToGregorian( + { ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), ...normalized }, + minDaysInFirstWeek, + startOfWeek + ); + } else if (!isUndefined(normalized.ordinal)) { + mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized }); + } else { + mixed = { ...this.toObject(), ...normalized }; + + // if we didn't set the day but we ended up on an overflow date, + // use the last day of the right month + if (isUndefined(normalized.day)) { + mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); + } + } + + const [ts, o] = objToTS(mixed, this.o, this.zone); + return clone(this, { ts, o }); + } + + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.now().plus(123) //~> in 123 milliseconds + * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */ + plus(duration) { + if (!this.isValid) return this; + const dur = Duration.fromDurationLike(duration); + return clone(this, adjustTime(this, dur)); + } + + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link DateTime#plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */ + minus(duration) { + if (!this.isValid) return this; + const dur = Duration.fromDurationLike(duration).negate(); + return clone(this, adjustTime(this, dur)); + } + + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */ + startOf(unit, { useLocaleWeeks = false } = {}) { + if (!this.isValid) return this; + + const o = {}, + normalizedUnit = Duration.normalizeUnit(unit); + switch (normalizedUnit) { + case "years": + o.month = 1; + // falls through + case "quarters": + case "months": + o.day = 1; + // falls through + case "weeks": + case "days": + o.hour = 0; + // falls through + case "hours": + o.minute = 0; + // falls through + case "minutes": + o.second = 0; + // falls through + case "seconds": + o.millisecond = 0; + break; + // no default, invalid units throw in normalizeUnit() + } + + if (normalizedUnit === "weeks") { + if (useLocaleWeeks) { + const startOfWeek = this.loc.getStartOfWeek(); + const { weekday } = this; + if (weekday < startOfWeek) { + o.weekNumber = this.weekNumber - 1; + } + o.weekday = startOfWeek; + } else { + o.weekday = 1; + } + } + + if (normalizedUnit === "quarters") { + const q = Math.ceil(this.month / 3); + o.month = (q - 1) * 3 + 1; + } + + return this.set(o); + } + + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */ + endOf(unit, opts) { + return this.isValid + ? this.plus({ [unit]: 1 }) + .startOf(unit, opts) + .minus(1) + : this; + } + + // OUTPUT + + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.now().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.now().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */ + toFormat(fmt, opts = {}) { + return this.isValid + ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) + : INVALID; + } + + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toLocaleString(); //=> 4/20/2017 + * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022' + * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32' + * @return {string} + */ + toLocaleString(formatOpts = DATE_SHORT, opts = {}) { + return this.isValid + ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) + : INVALID; + } + + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.now().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */ + toLocaleParts(opts = {}) { + return this.isValid + ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) + : []; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=false] - add the time zone format extension + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0. + * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z' + * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z' + * @return {string|null} + */ + toISO({ + format = "extended", + suppressSeconds = false, + suppressMilliseconds = false, + includeOffset = true, + extendedZone = false, + precision = "milliseconds", + } = {}) { + if (!this.isValid) { + return null; + } + + precision = normalizeUnit(precision); + const ext = format === "extended"; + + let c = toISODate(this, ext, precision); + if (orderedUnits.indexOf(precision) >= 3) c += "T"; + c += toISOTime( + this, + ext, + suppressSeconds, + suppressMilliseconds, + includeOffset, + extendedZone, + precision + ); + return c; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'. + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05' + * @return {string|null} + */ + toISODate({ format = "extended", precision = "day" } = {}) { + if (!this.isValid) { + return null; + } + return toISODate(this, format === "extended", normalizeUnit(precision)); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */ + toISOWeekDate() { + return toTechFormat(this, "kkkk-'W'WW-c"); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=true] - add the time zone format extension + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0. + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z' + * @return {string} + */ + toISOTime({ + suppressMilliseconds = false, + suppressSeconds = false, + includeOffset = true, + includePrefix = false, + extendedZone = false, + format = "extended", + precision = "milliseconds", + } = {}) { + if (!this.isValid) { + return null; + } + + precision = normalizeUnit(precision); + let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : ""; + return ( + c + + toISOTime( + this, + format === "extended", + suppressSeconds, + suppressMilliseconds, + includeOffset, + extendedZone, + precision + ) + ); + } + + /** + * Returns an RFC 2822-compatible string representation of this DateTime + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */ + toRFC2822() { + return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); + } + + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */ + toHTTP() { + return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string|null} + */ + toSQLDate() { + if (!this.isValid) { + return null; + } + return toISODate(this, true); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */ + toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) { + let fmt = "HH:mm:ss.SSS"; + + if (includeZone || includeOffset) { + if (includeOffsetSpace) { + fmt += " "; + } + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += "ZZ"; + } + } + + return toTechFormat(this, fmt, true); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */ + toSQL(opts = {}) { + if (!this.isValid) { + return null; + } + + return `${this.toSQLDate()} ${this.toSQLTime(opts)}`; + } + + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */ + toString() { + return this.isValid ? this.toISO() : INVALID; + } + + /** + * Returns a string representation of this DateTime appropriate for the REPL. + * @return {string} + */ + [Symbol.for("nodejs.util.inspect.custom")]() { + if (this.isValid) { + return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`; + } else { + return `DateTime { Invalid, reason: ${this.invalidReason} }`; + } + } + + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis} + * @return {number} + */ + valueOf() { + return this.toMillis(); + } + + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */ + toMillis() { + return this.isValid ? this.ts : NaN; + } + + /** + * Returns the epoch seconds (including milliseconds in the fractional part) of this DateTime. + * @return {number} + */ + toSeconds() { + return this.isValid ? this.ts / 1000 : NaN; + } + + /** + * Returns the epoch seconds (as a whole number) of this DateTime. + * @return {number} + */ + toUnixInteger() { + return this.isValid ? Math.floor(this.ts / 1000) : NaN; + } + + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */ + toJSON() { + return this.toISO(); + } + + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */ + toBSON() { + return this.toJSDate(); + } + + /** + * Returns a JavaScript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */ + toObject(opts = {}) { + if (!this.isValid) return {}; + + const base = { ...this.c }; + + if (opts.includeConfig) { + base.outputCalendar = this.outputCalendar; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + return base; + } + + /** + * Returns a JavaScript Date equivalent to this DateTime. + * @return {Date} + */ + toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } + + // COMPARE + + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */ + diff(otherDateTime, unit = "milliseconds", opts = {}) { + if (!this.isValid || !otherDateTime.isValid) { + return Duration.invalid("created by diffing an invalid DateTime"); + } + + const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts }; + + const units = maybeArray(unit).map(Duration.normalizeUnit), + otherIsLater = otherDateTime.valueOf() > this.valueOf(), + earlier = otherIsLater ? this : otherDateTime, + later = otherIsLater ? otherDateTime : this, + diffed = diff(earlier, later, units, durOpts); + + return otherIsLater ? diffed.negate() : diffed; + } + + /** + * Return the difference between this DateTime and right now. + * See {@link DateTime#diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + diffNow(unit = "milliseconds", opts = {}) { + return this.diff(DateTime.now(), unit, opts); + } + + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval|DateTime} + */ + until(otherDateTime) { + return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; + } + + /** + * Return whether this DateTime is in the same unit of time as another DateTime. + * Higher-order units must also be identical for this function to return `true`. + * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed. + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used + * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day + * @return {boolean} + */ + hasSame(otherDateTime, unit, opts) { + if (!this.isValid) return false; + + const inputMs = otherDateTime.valueOf(); + const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true }); + return ( + adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts) + ); + } + + /** + * Equality check + * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */ + equals(other) { + return ( + this.isValid && + other.isValid && + this.valueOf() === other.valueOf() && + this.zone.equals(other.zone) && + this.loc.equals(other.loc) + ); + } + + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {string} [options.rounding="trunc"] - rounding method to use when rounding the numbers in the output. Can be "trunc" (toward zero), "expand" (away from zero), "round", "floor", or "ceil". + * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.now().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.now().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */ + toRelative(options = {}) { + if (!this.isValid) return null; + const base = options.base || DateTime.fromObject({}, { zone: this.zone }), + padding = options.padding ? (this < base ? -options.padding : options.padding) : 0; + let units = ["years", "months", "days", "hours", "minutes", "seconds"]; + let unit = options.unit; + if (Array.isArray(options.unit)) { + units = options.unit; + unit = undefined; + } + return diffRelative(base, this.plus(padding), { + ...options, + numeric: "always", + units, + unit, + }); + } + + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.now().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */ + toRelativeCalendar(options = {}) { + if (!this.isValid) return null; + + return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, { + ...options, + numeric: "auto", + units: ["years", "months", "days"], + calendary: true, + }); + } + + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */ + static min(...dateTimes) { + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("min requires all arguments be DateTimes"); + } + return bestBy(dateTimes, (i) => i.valueOf(), Math.min); + } + + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */ + static max(...dateTimes) { + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("max requires all arguments be DateTimes"); + } + return bestBy(dateTimes, (i) => i.valueOf(), Math.max); + } + + // MISC + + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */ + static fromFormatExplain(text, fmt, options = {}) { + const { locale = null, numberingSystem = null } = options, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true, + }); + return explainFromTokens(localeToUse, text, fmt); + } + + /** + * @deprecated use fromFormatExplain instead + */ + static fromStringExplain(text, fmt, options = {}) { + return DateTime.fromFormatExplain(text, fmt, options); + } + + /** + * Build a parser for `fmt` using the given locale. This parser can be passed + * to {@link DateTime.fromFormatParser} to a parse a date in this format. This + * can be used to optimize cases where many dates need to be parsed in a + * specific format. + * + * @param {String} fmt - the format the string is expected to be in (see + * description) + * @param {Object} options - options used to set locale and numberingSystem + * for parser + * @returns {TokenParser} - opaque object to be used + */ + static buildFormatParser(fmt, options = {}) { + const { locale = null, numberingSystem = null } = options, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true, + }); + return new TokenParser(localeToUse, fmt); + } + + /** + * Create a DateTime from an input string and format parser. + * + * The format parser must have been created with the same locale as this call. + * + * @param {String} text - the string to parse + * @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser} + * @param {Object} opts - options taken by fromFormat() + * @returns {DateTime} + */ + static fromFormatParser(text, formatParser, opts = {}) { + if (isUndefined(text) || isUndefined(formatParser)) { + throw new InvalidArgumentError( + "fromFormatParser requires an input string and a format parser" + ); + } + const { locale = null, numberingSystem = null } = opts, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true, + }); + + if (!localeToUse.equals(formatParser.locale)) { + throw new InvalidArgumentError( + `fromFormatParser called with a locale of ${localeToUse}, ` + + `but the format parser was created for ${formatParser.locale}` + ); + } + + const { result, zone, specificOffset, invalidReason } = formatParser.explainFromTokens(text); + + if (invalidReason) { + return DateTime.invalid(invalidReason); + } else { + return parseDataToDateTime( + result, + zone, + opts, + `format ${formatParser.format}`, + text, + specificOffset + ); + } + } + + // FORMAT PRESETS + + /** + * {@link DateTime#toLocaleString} format like 10/14/1983 + * @type {Object} + */ + static get DATE_SHORT() { + return DATE_SHORT; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + static get DATE_MED() { + return DATE_MED; + } + + /** + * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983' + * @type {Object} + */ + static get DATE_MED_WITH_WEEKDAY() { + return DATE_MED_WITH_WEEKDAY; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + static get DATE_FULL() { + return DATE_FULL; + } + + /** + * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + static get DATE_HUGE() { + return DATE_HUGE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_SIMPLE() { + return TIME_SIMPLE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_SECONDS() { + return TIME_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_SHORT_OFFSET() { + return TIME_WITH_SHORT_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_LONG_OFFSET() { + return TIME_WITH_LONG_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + static get TIME_24_SIMPLE() { + return TIME_24_SIMPLE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_SECONDS() { + return TIME_24_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_SHORT_OFFSET() { + return TIME_24_WITH_SHORT_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_LONG_OFFSET() { + return TIME_24_WITH_LONG_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_SHORT() { + return DATETIME_SHORT; + } + + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_SHORT_WITH_SECONDS() { + return DATETIME_SHORT_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED() { + return DATETIME_MED; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED_WITH_SECONDS() { + return DATETIME_MED_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED_WITH_WEEKDAY() { + return DATETIME_MED_WITH_WEEKDAY; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_FULL() { + return DATETIME_FULL; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_FULL_WITH_SECONDS() { + return DATETIME_FULL_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_HUGE() { + return DATETIME_HUGE; + } + + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_HUGE_WITH_SECONDS() { + return DATETIME_HUGE_WITH_SECONDS; + } +} + +/** + * @private + */ +function friendlyDateTime(dateTimeish) { + if (DateTime.isDateTime(dateTimeish)) { + return dateTimeish; + } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) { + return DateTime.fromJSDate(dateTimeish); + } else if (dateTimeish && typeof dateTimeish === "object") { + return DateTime.fromObject(dateTimeish); + } else { + throw new InvalidArgumentError( + `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}` + ); + } +} + +const VERSION = "3.7.2"; + +export { DateTime, Duration, FixedOffsetZone, IANAZone, Info, Interval, InvalidZone, Settings, SystemZone, VERSION, Zone }; +//# sourceMappingURL=luxon.mjs.map diff --git a/node_modules/luxon/build/es6/luxon.mjs.map b/node_modules/luxon/build/es6/luxon.mjs.map new file mode 100644 index 00000000..68f1cf70 --- /dev/null +++ b/node_modules/luxon/build/es6/luxon.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"luxon.mjs","sources":["../../src/errors.js","../../src/impl/formats.js","../../src/zone.js","../../src/zones/systemZone.js","../../src/zones/IANAZone.js","../../src/impl/locale.js","../../src/zones/fixedOffsetZone.js","../../src/zones/invalidZone.js","../../src/impl/zoneUtil.js","../../src/impl/digits.js","../../src/settings.js","../../src/impl/invalid.js","../../src/impl/conversions.js","../../src/impl/util.js","../../src/impl/english.js","../../src/impl/formatter.js","../../src/impl/regexParser.js","../../src/duration.js","../../src/interval.js","../../src/info.js","../../src/impl/diff.js","../../src/impl/tokenParser.js","../../src/datetime.js","../../src/luxon.js"],"sourcesContent":["// these aren't really private, but nor are they really useful to document\n\n/**\n * @private\n */\nclass LuxonError extends Error {}\n\n/**\n * @private\n */\nexport class InvalidDateTimeError extends LuxonError {\n constructor(reason) {\n super(`Invalid DateTime: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidIntervalError extends LuxonError {\n constructor(reason) {\n super(`Invalid Interval: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidDurationError extends LuxonError {\n constructor(reason) {\n super(`Invalid Duration: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class ConflictingSpecificationError extends LuxonError {}\n\n/**\n * @private\n */\nexport class InvalidUnitError extends LuxonError {\n constructor(unit) {\n super(`Invalid unit ${unit}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidArgumentError extends LuxonError {}\n\n/**\n * @private\n */\nexport class ZoneIsAbstractError extends LuxonError {\n constructor() {\n super(\"Zone is an abstract class\");\n }\n}\n","/**\n * @private\n */\n\nconst n = \"numeric\",\n s = \"short\",\n l = \"long\";\n\nexport const DATE_SHORT = {\n year: n,\n month: n,\n day: n,\n};\n\nexport const DATE_MED = {\n year: n,\n month: s,\n day: n,\n};\n\nexport const DATE_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n};\n\nexport const DATE_FULL = {\n year: n,\n month: l,\n day: n,\n};\n\nexport const DATE_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n};\n\nexport const TIME_SIMPLE = {\n hour: n,\n minute: n,\n};\n\nexport const TIME_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const TIME_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const TIME_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n\nexport const TIME_24_SIMPLE = {\n hour: n,\n minute: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: s,\n};\n\nexport const TIME_24_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: l,\n};\n\nexport const DATETIME_SHORT = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_SHORT_WITH_SECONDS = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_MED_WITH_SECONDS = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_FULL = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_FULL_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n timeZoneName: l,\n};\n\nexport const DATETIME_HUGE_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n","import { ZoneIsAbstractError } from \"./errors.js\";\n\n/**\n * @interface\n */\nexport default class Zone {\n /**\n * The type of zone\n * @abstract\n * @type {string}\n */\n get type() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The name of this zone.\n * @abstract\n * @type {string}\n */\n get name() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The IANA name of this zone.\n * Defaults to `name` if not overwritten by a subclass.\n * @abstract\n * @type {string}\n */\n get ianaName() {\n return this.name;\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @type {boolean}\n */\n get isUniversal() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, opts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's value as a string\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is valid.\n * @abstract\n * @type {boolean}\n */\n get isValid() {\n throw new ZoneIsAbstractError();\n }\n}\n","import { formatOffset, parseZoneInfo } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * Represents the local zone for this JavaScript environment.\n * @implements {Zone}\n */\nexport default class SystemZone extends Zone {\n /**\n * Get a singleton instance of the local zone\n * @return {SystemZone}\n */\n static get instance() {\n if (singleton === null) {\n singleton = new SystemZone();\n }\n return singleton;\n }\n\n /** @override **/\n get type() {\n return \"system\";\n }\n\n /** @override **/\n get name() {\n return new Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n return -new Date(ts).getTimezoneOffset();\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"system\";\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import { formatOffset, parseZoneInfo, isUndefined, objToLocalTS } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nconst dtfCache = new Map();\nfunction makeDTF(zoneName) {\n let dtf = dtfCache.get(zoneName);\n if (dtf === undefined) {\n dtf = new Intl.DateTimeFormat(\"en-US\", {\n hour12: false,\n timeZone: zoneName,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n era: \"short\",\n });\n dtfCache.set(zoneName, dtf);\n }\n return dtf;\n}\n\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n era: 3,\n hour: 4,\n minute: 5,\n second: 6,\n};\n\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, \"\"),\n parsed = /(\\d+)\\/(\\d+)\\/(\\d+) (AD|BC),? (\\d+):(\\d+):(\\d+)/.exec(formatted),\n [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;\n return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];\n}\n\nfunction partsOffset(dtf, date) {\n const formatted = dtf.formatToParts(date);\n const filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const { type, value } = formatted[i];\n const pos = typeToPos[type];\n\n if (type === \"era\") {\n filled[pos] = value;\n } else if (!isUndefined(pos)) {\n filled[pos] = parseInt(value, 10);\n }\n }\n return filled;\n}\n\nconst ianaZoneCache = new Map();\n/**\n * A zone identified by an IANA identifier, like America/New_York\n * @implements {Zone}\n */\nexport default class IANAZone extends Zone {\n /**\n * @param {string} name - Zone name\n * @return {IANAZone}\n */\n static create(name) {\n let zone = ianaZoneCache.get(name);\n if (zone === undefined) {\n ianaZoneCache.set(name, (zone = new IANAZone(name)));\n }\n return zone;\n }\n\n /**\n * Reset local caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCache() {\n ianaZoneCache.clear();\n dtfCache.clear();\n }\n\n /**\n * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.\n * @param {string} s - The string to check validity on\n * @example IANAZone.isValidSpecifier(\"America/New_York\") //=> true\n * @example IANAZone.isValidSpecifier(\"Sport~~blorp\") //=> false\n * @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead.\n * @return {boolean}\n */\n static isValidSpecifier(s) {\n return this.isValidZone(s);\n }\n\n /**\n * Returns whether the provided string identifies a real zone\n * @param {string} zone - The string to check\n * @example IANAZone.isValidZone(\"America/New_York\") //=> true\n * @example IANAZone.isValidZone(\"Fantasia/Castle\") //=> false\n * @example IANAZone.isValidZone(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidZone(zone) {\n if (!zone) {\n return false;\n }\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: zone }).format();\n return true;\n } catch (e) {\n return false;\n }\n }\n\n constructor(name) {\n super();\n /** @private **/\n this.zoneName = name;\n /** @private **/\n this.valid = IANAZone.isValidZone(name);\n }\n\n /**\n * The type of zone. `iana` for all instances of `IANAZone`.\n * @override\n * @type {string}\n */\n get type() {\n return \"iana\";\n }\n\n /**\n * The name of this zone (i.e. the IANA zone name).\n * @override\n * @type {string}\n */\n get name() {\n return this.zoneName;\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year:\n * Always returns false for all IANA zones.\n * @override\n * @type {boolean}\n */\n get isUniversal() {\n return false;\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale, this.name);\n }\n\n /**\n * Returns the offset's value as a string\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @override\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n if (!this.valid) return NaN;\n const date = new Date(ts);\n\n if (isNaN(date)) return NaN;\n\n const dtf = makeDTF(this.name);\n let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts\n ? partsOffset(dtf, date)\n : hackyOffset(dtf, date);\n\n if (adOrBc === \"BC\") {\n year = -Math.abs(year) + 1;\n }\n\n // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat\n const adjustedHour = hour === 24 ? 0 : hour;\n\n const asUTC = objToLocalTS({\n year,\n month,\n day,\n hour: adjustedHour,\n minute,\n second,\n millisecond: 0,\n });\n\n let asTS = +date;\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return (asUTC - asTS) / (60 * 1000);\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @override\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n return otherZone.type === \"iana\" && otherZone.name === this.name;\n }\n\n /**\n * Return whether this Zone is valid.\n * @override\n * @type {boolean}\n */\n get isValid() {\n return this.valid;\n }\n}\n","import { hasLocaleWeekInfo, hasRelative, padStart, roundTo, validateWeekSettings } from \"./util.js\";\nimport * as English from \"./english.js\";\nimport Settings from \"../settings.js\";\nimport DateTime from \"../datetime.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n// todo - remap caching\n\nlet intlLFCache = {};\nfunction getCachedLF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlLFCache[key];\n if (!dtf) {\n dtf = new Intl.ListFormat(locString, opts);\n intlLFCache[key] = dtf;\n }\n return dtf;\n}\n\nconst intlDTCache = new Map();\nfunction getCachedDTF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlDTCache.get(key);\n if (dtf === undefined) {\n dtf = new Intl.DateTimeFormat(locString, opts);\n intlDTCache.set(key, dtf);\n }\n return dtf;\n}\n\nconst intlNumCache = new Map();\nfunction getCachedINF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let inf = intlNumCache.get(key);\n if (inf === undefined) {\n inf = new Intl.NumberFormat(locString, opts);\n intlNumCache.set(key, inf);\n }\n return inf;\n}\n\nconst intlRelCache = new Map();\nfunction getCachedRTF(locString, opts = {}) {\n const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options\n const key = JSON.stringify([locString, cacheKeyOpts]);\n let inf = intlRelCache.get(key);\n if (inf === undefined) {\n inf = new Intl.RelativeTimeFormat(locString, opts);\n intlRelCache.set(key, inf);\n }\n return inf;\n}\n\nlet sysLocaleCache = null;\nfunction systemLocale() {\n if (sysLocaleCache) {\n return sysLocaleCache;\n } else {\n sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;\n return sysLocaleCache;\n }\n}\n\nconst intlResolvedOptionsCache = new Map();\nfunction getCachedIntResolvedOptions(locString) {\n let opts = intlResolvedOptionsCache.get(locString);\n if (opts === undefined) {\n opts = new Intl.DateTimeFormat(locString).resolvedOptions();\n intlResolvedOptionsCache.set(locString, opts);\n }\n return opts;\n}\n\nconst weekInfoCache = new Map();\nfunction getCachedWeekInfo(locString) {\n let data = weekInfoCache.get(locString);\n if (!data) {\n const locale = new Intl.Locale(locString);\n // browsers currently implement this as a property, but spec says it should be a getter function\n data = \"getWeekInfo\" in locale ? locale.getWeekInfo() : locale.weekInfo;\n // minimalDays was removed from WeekInfo: https://github.com/tc39/proposal-intl-locale-info/issues/86\n if (!(\"minimalDays\" in data)) {\n data = { ...fallbackWeekSettings, ...data };\n }\n weekInfoCache.set(locString, data);\n }\n return data;\n}\n\nfunction parseLocaleString(localeStr) {\n // I really want to avoid writing a BCP 47 parser\n // see, e.g. https://github.com/wooorm/bcp-47\n // Instead, we'll do this:\n\n // a) if the string has no -u extensions, just leave it alone\n // b) if it does, use Intl to resolve everything\n // c) if Intl fails, try again without the -u\n\n // private subtags and unicode subtags have ordering requirements,\n // and we're not properly parsing this, so just strip out the\n // private ones if they exist.\n const xIndex = localeStr.indexOf(\"-x-\");\n if (xIndex !== -1) {\n localeStr = localeStr.substring(0, xIndex);\n }\n\n const uIndex = localeStr.indexOf(\"-u-\");\n if (uIndex === -1) {\n return [localeStr];\n } else {\n let options;\n let selectedStr;\n try {\n options = getCachedDTF(localeStr).resolvedOptions();\n selectedStr = localeStr;\n } catch (e) {\n const smaller = localeStr.substring(0, uIndex);\n options = getCachedDTF(smaller).resolvedOptions();\n selectedStr = smaller;\n }\n\n const { numberingSystem, calendar } = options;\n return [selectedStr, numberingSystem, calendar];\n }\n}\n\nfunction intlConfigString(localeStr, numberingSystem, outputCalendar) {\n if (outputCalendar || numberingSystem) {\n if (!localeStr.includes(\"-u-\")) {\n localeStr += \"-u\";\n }\n\n if (outputCalendar) {\n localeStr += `-ca-${outputCalendar}`;\n }\n\n if (numberingSystem) {\n localeStr += `-nu-${numberingSystem}`;\n }\n return localeStr;\n } else {\n return localeStr;\n }\n}\n\nfunction mapMonths(f) {\n const ms = [];\n for (let i = 1; i <= 12; i++) {\n const dt = DateTime.utc(2009, i, 1);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction mapWeekdays(f) {\n const ms = [];\n for (let i = 1; i <= 7; i++) {\n const dt = DateTime.utc(2016, 11, 13 + i);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction listStuff(loc, length, englishFn, intlFn) {\n const mode = loc.listingMode();\n\n if (mode === \"error\") {\n return null;\n } else if (mode === \"en\") {\n return englishFn(length);\n } else {\n return intlFn(length);\n }\n}\n\nfunction supportsFastNumbers(loc) {\n if (loc.numberingSystem && loc.numberingSystem !== \"latn\") {\n return false;\n } else {\n return (\n loc.numberingSystem === \"latn\" ||\n !loc.locale ||\n loc.locale.startsWith(\"en\") ||\n getCachedIntResolvedOptions(loc.locale).numberingSystem === \"latn\"\n );\n }\n}\n\n/**\n * @private\n */\n\nclass PolyNumberFormatter {\n constructor(intl, forceSimple, opts) {\n this.padTo = opts.padTo || 0;\n this.floor = opts.floor || false;\n\n const { padTo, floor, ...otherOpts } = opts;\n\n if (!forceSimple || Object.keys(otherOpts).length > 0) {\n const intlOpts = { useGrouping: false, ...opts };\n if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;\n this.inf = getCachedINF(intl, intlOpts);\n }\n }\n\n format(i) {\n if (this.inf) {\n const fixed = this.floor ? Math.floor(i) : i;\n return this.inf.format(fixed);\n } else {\n // to match the browser's numberformatter defaults\n const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);\n return padStart(fixed, this.padTo);\n }\n }\n}\n\n/**\n * @private\n */\n\nclass PolyDateFormatter {\n constructor(dt, intl, opts) {\n this.opts = opts;\n this.originalZone = undefined;\n\n let z = undefined;\n if (this.opts.timeZone) {\n // Don't apply any workarounds if a timeZone is explicitly provided in opts\n this.dt = dt;\n } else if (dt.zone.type === \"fixed\") {\n // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like.\n // That is why fixed-offset TZ is set to that unless it is:\n // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT.\n // 2. Unsupported by the browser:\n // - some do not support Etc/\n // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata\n const gmtOffset = -1 * (dt.offset / 60);\n const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;\n if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {\n z = offsetZ;\n this.dt = dt;\n } else {\n // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so\n // we manually apply the offset and substitute the zone as needed.\n z = \"UTC\";\n this.dt = dt.offset === 0 ? dt : dt.setZone(\"UTC\").plus({ minutes: dt.offset });\n this.originalZone = dt.zone;\n }\n } else if (dt.zone.type === \"system\") {\n this.dt = dt;\n } else if (dt.zone.type === \"iana\") {\n this.dt = dt;\n z = dt.zone.name;\n } else {\n // Custom zones can have any offset / offsetName so we just manually\n // apply the offset and substitute the zone as needed.\n z = \"UTC\";\n this.dt = dt.setZone(\"UTC\").plus({ minutes: dt.offset });\n this.originalZone = dt.zone;\n }\n\n const intlOpts = { ...this.opts };\n intlOpts.timeZone = intlOpts.timeZone || z;\n this.dtf = getCachedDTF(intl, intlOpts);\n }\n\n format() {\n if (this.originalZone) {\n // If we have to substitute in the actual zone name, we have to use\n // formatToParts so that the timezone can be replaced.\n return this.formatToParts()\n .map(({ value }) => value)\n .join(\"\");\n }\n return this.dtf.format(this.dt.toJSDate());\n }\n\n formatToParts() {\n const parts = this.dtf.formatToParts(this.dt.toJSDate());\n if (this.originalZone) {\n return parts.map((part) => {\n if (part.type === \"timeZoneName\") {\n const offsetName = this.originalZone.offsetName(this.dt.ts, {\n locale: this.dt.locale,\n format: this.opts.timeZoneName,\n });\n return {\n ...part,\n value: offsetName,\n };\n } else {\n return part;\n }\n });\n }\n return parts;\n }\n\n resolvedOptions() {\n return this.dtf.resolvedOptions();\n }\n}\n\n/**\n * @private\n */\nclass PolyRelFormatter {\n constructor(intl, isEnglish, opts) {\n this.opts = { style: \"long\", ...opts };\n if (!isEnglish && hasRelative()) {\n this.rtf = getCachedRTF(intl, opts);\n }\n }\n\n format(count, unit) {\n if (this.rtf) {\n return this.rtf.format(count, unit);\n } else {\n return English.formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== \"long\");\n }\n }\n\n formatToParts(count, unit) {\n if (this.rtf) {\n return this.rtf.formatToParts(count, unit);\n } else {\n return [];\n }\n }\n}\n\nconst fallbackWeekSettings = {\n firstDay: 1,\n minimalDays: 4,\n weekend: [6, 7],\n};\n\n/**\n * @private\n */\nexport default class Locale {\n static fromOpts(opts) {\n return Locale.create(\n opts.locale,\n opts.numberingSystem,\n opts.outputCalendar,\n opts.weekSettings,\n opts.defaultToEN\n );\n }\n\n static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {\n const specifiedLocale = locale || Settings.defaultLocale;\n // the system locale is useful for human-readable strings but annoying for parsing/formatting known formats\n const localeR = specifiedLocale || (defaultToEN ? \"en-US\" : systemLocale());\n const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;\n const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;\n const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;\n return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);\n }\n\n static resetCache() {\n sysLocaleCache = null;\n intlDTCache.clear();\n intlNumCache.clear();\n intlRelCache.clear();\n intlResolvedOptionsCache.clear();\n weekInfoCache.clear();\n }\n\n static fromObject({ locale, numberingSystem, outputCalendar, weekSettings } = {}) {\n return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);\n }\n\n constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {\n const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);\n\n this.locale = parsedLocale;\n this.numberingSystem = numbering || parsedNumberingSystem || null;\n this.outputCalendar = outputCalendar || parsedOutputCalendar || null;\n this.weekSettings = weekSettings;\n this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);\n\n this.weekdaysCache = { format: {}, standalone: {} };\n this.monthsCache = { format: {}, standalone: {} };\n this.meridiemCache = null;\n this.eraCache = {};\n\n this.specifiedLocale = specifiedLocale;\n this.fastNumbersCached = null;\n }\n\n get fastNumbers() {\n if (this.fastNumbersCached == null) {\n this.fastNumbersCached = supportsFastNumbers(this);\n }\n\n return this.fastNumbersCached;\n }\n\n listingMode() {\n const isActuallyEn = this.isEnglish();\n const hasNoWeirdness =\n (this.numberingSystem === null || this.numberingSystem === \"latn\") &&\n (this.outputCalendar === null || this.outputCalendar === \"gregory\");\n return isActuallyEn && hasNoWeirdness ? \"en\" : \"intl\";\n }\n\n clone(alts) {\n if (!alts || Object.getOwnPropertyNames(alts).length === 0) {\n return this;\n } else {\n return Locale.create(\n alts.locale || this.specifiedLocale,\n alts.numberingSystem || this.numberingSystem,\n alts.outputCalendar || this.outputCalendar,\n validateWeekSettings(alts.weekSettings) || this.weekSettings,\n alts.defaultToEN || false\n );\n }\n }\n\n redefaultToEN(alts = {}) {\n return this.clone({ ...alts, defaultToEN: true });\n }\n\n redefaultToSystem(alts = {}) {\n return this.clone({ ...alts, defaultToEN: false });\n }\n\n months(length, format = false) {\n return listStuff(this, length, English.months, () => {\n // Workaround for \"ja\" locale: formatToParts does not label all parts of the month\n // as \"month\" and for this locale there is no difference between \"format\" and \"non-format\".\n // As such, just use format() instead of formatToParts() and take the whole string\n const monthSpecialCase = this.intl === \"ja\" || this.intl.startsWith(\"ja-\");\n format &= !monthSpecialCase;\n const intl = format ? { month: length, day: \"numeric\" } : { month: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.monthsCache[formatStr][length]) {\n const mapper = !monthSpecialCase\n ? (dt) => this.extract(dt, intl, \"month\")\n : (dt) => this.dtFormatter(dt, intl).format();\n this.monthsCache[formatStr][length] = mapMonths(mapper);\n }\n return this.monthsCache[formatStr][length];\n });\n }\n\n weekdays(length, format = false) {\n return listStuff(this, length, English.weekdays, () => {\n const intl = format\n ? { weekday: length, year: \"numeric\", month: \"long\", day: \"numeric\" }\n : { weekday: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.weekdaysCache[formatStr][length]) {\n this.weekdaysCache[formatStr][length] = mapWeekdays((dt) =>\n this.extract(dt, intl, \"weekday\")\n );\n }\n return this.weekdaysCache[formatStr][length];\n });\n }\n\n meridiems() {\n return listStuff(\n this,\n undefined,\n () => English.meridiems,\n () => {\n // In theory there could be aribitrary day periods. We're gonna assume there are exactly two\n // for AM and PM. This is probably wrong, but it's makes parsing way easier.\n if (!this.meridiemCache) {\n const intl = { hour: \"numeric\", hourCycle: \"h12\" };\n this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(\n (dt) => this.extract(dt, intl, \"dayperiod\")\n );\n }\n\n return this.meridiemCache;\n }\n );\n }\n\n eras(length) {\n return listStuff(this, length, English.eras, () => {\n const intl = { era: length };\n\n // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates\n // to definitely enumerate them.\n if (!this.eraCache[length]) {\n this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map((dt) =>\n this.extract(dt, intl, \"era\")\n );\n }\n\n return this.eraCache[length];\n });\n }\n\n extract(dt, intlOpts, field) {\n const df = this.dtFormatter(dt, intlOpts),\n results = df.formatToParts(),\n matching = results.find((m) => m.type.toLowerCase() === field);\n return matching ? matching.value : null;\n }\n\n numberFormatter(opts = {}) {\n // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave)\n // (in contrast, the rest of the condition is used heavily)\n return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);\n }\n\n dtFormatter(dt, intlOpts = {}) {\n return new PolyDateFormatter(dt, this.intl, intlOpts);\n }\n\n relFormatter(opts = {}) {\n return new PolyRelFormatter(this.intl, this.isEnglish(), opts);\n }\n\n listFormatter(opts = {}) {\n return getCachedLF(this.intl, opts);\n }\n\n isEnglish() {\n return (\n this.locale === \"en\" ||\n this.locale.toLowerCase() === \"en-us\" ||\n getCachedIntResolvedOptions(this.intl).locale.startsWith(\"en-us\")\n );\n }\n\n getWeekSettings() {\n if (this.weekSettings) {\n return this.weekSettings;\n } else if (!hasLocaleWeekInfo()) {\n return fallbackWeekSettings;\n } else {\n return getCachedWeekInfo(this.locale);\n }\n }\n\n getStartOfWeek() {\n return this.getWeekSettings().firstDay;\n }\n\n getMinDaysInFirstWeek() {\n return this.getWeekSettings().minimalDays;\n }\n\n getWeekendDays() {\n return this.getWeekSettings().weekend;\n }\n\n equals(other) {\n return (\n this.locale === other.locale &&\n this.numberingSystem === other.numberingSystem &&\n this.outputCalendar === other.outputCalendar\n );\n }\n\n toString() {\n return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;\n }\n}\n","import { formatOffset, signedOffset } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * A zone with a fixed offset (meaning no DST)\n * @implements {Zone}\n */\nexport default class FixedOffsetZone extends Zone {\n /**\n * Get a singleton instance of UTC\n * @return {FixedOffsetZone}\n */\n static get utcInstance() {\n if (singleton === null) {\n singleton = new FixedOffsetZone(0);\n }\n return singleton;\n }\n\n /**\n * Get an instance with a specified offset\n * @param {number} offset - The offset in minutes\n * @return {FixedOffsetZone}\n */\n static instance(offset) {\n return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);\n }\n\n /**\n * Get an instance of FixedOffsetZone from a UTC offset string, like \"UTC+6\"\n * @param {string} s - The offset string to parse\n * @example FixedOffsetZone.parseSpecifier(\"UTC+6\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC+06\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC-6:00\")\n * @return {FixedOffsetZone}\n */\n static parseSpecifier(s) {\n if (s) {\n const r = s.match(/^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$/i);\n if (r) {\n return new FixedOffsetZone(signedOffset(r[1], r[2]));\n }\n }\n return null;\n }\n\n constructor(offset) {\n super();\n /** @private **/\n this.fixed = offset;\n }\n\n /**\n * The type of zone. `fixed` for all instances of `FixedOffsetZone`.\n * @override\n * @type {string}\n */\n get type() {\n return \"fixed\";\n }\n\n /**\n * The name of this zone.\n * All fixed zones' names always start with \"UTC\" (plus optional offset)\n * @override\n * @type {string}\n */\n get name() {\n return this.fixed === 0 ? \"UTC\" : `UTC${formatOffset(this.fixed, \"narrow\")}`;\n }\n\n /**\n * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`\n *\n * @override\n * @type {string}\n */\n get ianaName() {\n if (this.fixed === 0) {\n return \"Etc/UTC\";\n } else {\n return `Etc/GMT${formatOffset(-this.fixed, \"narrow\")}`;\n }\n }\n\n /**\n * Returns the offset's common name at the specified timestamp.\n *\n * For fixed offset zones this equals to the zone name.\n * @override\n */\n offsetName() {\n return this.name;\n }\n\n /**\n * Returns the offset's value as a string\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n return formatOffset(this.fixed, format);\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year:\n * Always returns true for all fixed offset zones.\n * @override\n * @type {boolean}\n */\n get isUniversal() {\n return true;\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n *\n * For fixed offset zones, this is constant and does not depend on a timestamp.\n * @override\n * @return {number}\n */\n offset() {\n return this.fixed;\n }\n\n /**\n * Return whether this Zone is equal to another zone (i.e. also fixed and same offset)\n * @override\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n return otherZone.type === \"fixed\" && otherZone.fixed === this.fixed;\n }\n\n /**\n * Return whether this Zone is valid:\n * All fixed offset zones are valid.\n * @override\n * @type {boolean}\n */\n get isValid() {\n return true;\n }\n}\n","import Zone from \"../zone.js\";\n\n/**\n * A zone that failed to parse. You should never need to instantiate this.\n * @implements {Zone}\n */\nexport default class InvalidZone extends Zone {\n constructor(zoneName) {\n super();\n /** @private */\n this.zoneName = zoneName;\n }\n\n /** @override **/\n get type() {\n return \"invalid\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName() {\n return null;\n }\n\n /** @override **/\n formatOffset() {\n return \"\";\n }\n\n /** @override **/\n offset() {\n return NaN;\n }\n\n /** @override **/\n equals() {\n return false;\n }\n\n /** @override **/\n get isValid() {\n return false;\n }\n}\n","/**\n * @private\n */\n\nimport Zone from \"../zone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport InvalidZone from \"../zones/invalidZone.js\";\n\nimport { isUndefined, isString, isNumber } from \"./util.js\";\nimport SystemZone from \"../zones/systemZone.js\";\n\nexport function normalizeZone(input, defaultZone) {\n let offset;\n if (isUndefined(input) || input === null) {\n return defaultZone;\n } else if (input instanceof Zone) {\n return input;\n } else if (isString(input)) {\n const lowered = input.toLowerCase();\n if (lowered === \"default\") return defaultZone;\n else if (lowered === \"local\" || lowered === \"system\") return SystemZone.instance;\n else if (lowered === \"utc\" || lowered === \"gmt\") return FixedOffsetZone.utcInstance;\n else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);\n } else if (isNumber(input)) {\n return FixedOffsetZone.instance(input);\n } else if (typeof input === \"object\" && \"offset\" in input && typeof input.offset === \"function\") {\n // This is dumb, but the instanceof check above doesn't seem to really work\n // so we're duck checking it\n return input;\n } else {\n return new InvalidZone(input);\n }\n}\n","const numberingSystems = {\n arab: \"[\\u0660-\\u0669]\",\n arabext: \"[\\u06F0-\\u06F9]\",\n bali: \"[\\u1B50-\\u1B59]\",\n beng: \"[\\u09E6-\\u09EF]\",\n deva: \"[\\u0966-\\u096F]\",\n fullwide: \"[\\uFF10-\\uFF19]\",\n gujr: \"[\\u0AE6-\\u0AEF]\",\n hanidec: \"[〇|一|二|三|四|五|六|七|八|九]\",\n khmr: \"[\\u17E0-\\u17E9]\",\n knda: \"[\\u0CE6-\\u0CEF]\",\n laoo: \"[\\u0ED0-\\u0ED9]\",\n limb: \"[\\u1946-\\u194F]\",\n mlym: \"[\\u0D66-\\u0D6F]\",\n mong: \"[\\u1810-\\u1819]\",\n mymr: \"[\\u1040-\\u1049]\",\n orya: \"[\\u0B66-\\u0B6F]\",\n tamldec: \"[\\u0BE6-\\u0BEF]\",\n telu: \"[\\u0C66-\\u0C6F]\",\n thai: \"[\\u0E50-\\u0E59]\",\n tibt: \"[\\u0F20-\\u0F29]\",\n latn: \"\\\\d\",\n};\n\nconst numberingSystemsUTF16 = {\n arab: [1632, 1641],\n arabext: [1776, 1785],\n bali: [6992, 7001],\n beng: [2534, 2543],\n deva: [2406, 2415],\n fullwide: [65296, 65303],\n gujr: [2790, 2799],\n khmr: [6112, 6121],\n knda: [3302, 3311],\n laoo: [3792, 3801],\n limb: [6470, 6479],\n mlym: [3430, 3439],\n mong: [6160, 6169],\n mymr: [4160, 4169],\n orya: [2918, 2927],\n tamldec: [3046, 3055],\n telu: [3174, 3183],\n thai: [3664, 3673],\n tibt: [3872, 3881],\n};\n\nconst hanidecChars = numberingSystems.hanidec.replace(/[\\[|\\]]/g, \"\").split(\"\");\n\nexport function parseDigits(str) {\n let value = parseInt(str, 10);\n if (isNaN(value)) {\n value = \"\";\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (str[i].search(numberingSystems.hanidec) !== -1) {\n value += hanidecChars.indexOf(str[i]);\n } else {\n for (const key in numberingSystemsUTF16) {\n const [min, max] = numberingSystemsUTF16[key];\n if (code >= min && code <= max) {\n value += code - min;\n }\n }\n }\n }\n return parseInt(value, 10);\n } else {\n return value;\n }\n}\n\n// cache of {numberingSystem: {append: regex}}\nconst digitRegexCache = new Map();\nexport function resetDigitRegexCache() {\n digitRegexCache.clear();\n}\n\nexport function digitRegex({ numberingSystem }, append = \"\") {\n const ns = numberingSystem || \"latn\";\n\n let appendCache = digitRegexCache.get(ns);\n if (appendCache === undefined) {\n appendCache = new Map();\n digitRegexCache.set(ns, appendCache);\n }\n let regex = appendCache.get(append);\n if (regex === undefined) {\n regex = new RegExp(`${numberingSystems[ns]}${append}`);\n appendCache.set(append, regex);\n }\n\n return regex;\n}\n","import SystemZone from \"./zones/systemZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport DateTime from \"./datetime.js\";\n\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport { validateWeekSettings } from \"./impl/util.js\";\nimport { resetDigitRegexCache } from \"./impl/digits.js\";\n\nlet now = () => Date.now(),\n defaultZone = \"system\",\n defaultLocale = null,\n defaultNumberingSystem = null,\n defaultOutputCalendar = null,\n twoDigitCutoffYear = 60,\n throwOnInvalid,\n defaultWeekSettings = null;\n\n/**\n * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.\n */\nexport default class Settings {\n /**\n * Get the callback for returning the current timestamp.\n * @type {function}\n */\n static get now() {\n return now;\n }\n\n /**\n * Set the callback for returning the current timestamp.\n * The function should return a number, which will be interpreted as an Epoch millisecond count\n * @type {function}\n * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future\n * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time\n */\n static set now(n) {\n now = n;\n }\n\n /**\n * Set the default time zone to create DateTimes in. Does not affect existing instances.\n * Use the value \"system\" to reset this value to the system's time zone.\n * @type {string}\n */\n static set defaultZone(zone) {\n defaultZone = zone;\n }\n\n /**\n * Get the default time zone object currently used to create DateTimes. Does not affect existing instances.\n * The default value is the system's time zone (the one set on the machine that runs this code).\n * @type {Zone}\n */\n static get defaultZone() {\n return normalizeZone(defaultZone, SystemZone.instance);\n }\n\n /**\n * Get the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultLocale() {\n return defaultLocale;\n }\n\n /**\n * Set the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultLocale(locale) {\n defaultLocale = locale;\n }\n\n /**\n * Get the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultNumberingSystem() {\n return defaultNumberingSystem;\n }\n\n /**\n * Set the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultNumberingSystem(numberingSystem) {\n defaultNumberingSystem = numberingSystem;\n }\n\n /**\n * Get the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultOutputCalendar() {\n return defaultOutputCalendar;\n }\n\n /**\n * Set the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultOutputCalendar(outputCalendar) {\n defaultOutputCalendar = outputCalendar;\n }\n\n /**\n * @typedef {Object} WeekSettings\n * @property {number} firstDay\n * @property {number} minimalDays\n * @property {number[]} weekend\n */\n\n /**\n * @return {WeekSettings|null}\n */\n static get defaultWeekSettings() {\n return defaultWeekSettings;\n }\n\n /**\n * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and\n * how many days are required in the first week of a year.\n * Does not affect existing instances.\n *\n * @param {WeekSettings|null} weekSettings\n */\n static set defaultWeekSettings(weekSettings) {\n defaultWeekSettings = validateWeekSettings(weekSettings);\n }\n\n /**\n * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.\n * @type {number}\n */\n static get twoDigitCutoffYear() {\n return twoDigitCutoffYear;\n }\n\n /**\n * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.\n * @type {number}\n * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century\n * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century\n * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950\n * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50\n * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50\n */\n static set twoDigitCutoffYear(cutoffYear) {\n twoDigitCutoffYear = cutoffYear % 100;\n }\n\n /**\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static get throwOnInvalid() {\n return throwOnInvalid;\n }\n\n /**\n * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static set throwOnInvalid(t) {\n throwOnInvalid = t;\n }\n\n /**\n * Reset Luxon's global caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCaches() {\n Locale.resetCache();\n IANAZone.resetCache();\n DateTime.resetCache();\n resetDigitRegexCache();\n }\n}\n","export default class Invalid {\n constructor(reason, explanation) {\n this.reason = reason;\n this.explanation = explanation;\n }\n\n toMessage() {\n if (this.explanation) {\n return `${this.reason}: ${this.explanation}`;\n } else {\n return this.reason;\n }\n }\n}\n","import {\n integerBetween,\n isLeapYear,\n timeObject,\n daysInYear,\n daysInMonth,\n weeksInWeekYear,\n isInteger,\n isUndefined,\n} from \"./util.js\";\nimport Invalid from \"./invalid.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],\n leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];\n\nfunction unitOutOfRange(unit, value) {\n return new Invalid(\n \"unit out of range\",\n `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`\n );\n}\n\nexport function dayOfWeek(year, month, day) {\n const d = new Date(Date.UTC(year, month - 1, day));\n\n if (year < 100 && year >= 0) {\n d.setUTCFullYear(d.getUTCFullYear() - 1900);\n }\n\n const js = d.getUTCDay();\n\n return js === 0 ? 7 : js;\n}\n\nfunction computeOrdinal(year, month, day) {\n return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];\n}\n\nfunction uncomputeOrdinal(year, ordinal) {\n const table = isLeapYear(year) ? leapLadder : nonLeapLadder,\n month0 = table.findIndex((i) => i < ordinal),\n day = ordinal - table[month0];\n return { month: month0 + 1, day };\n}\n\nexport function isoWeekdayToLocal(isoWeekday, startOfWeek) {\n return ((isoWeekday - startOfWeek + 7) % 7) + 1;\n}\n\n/**\n * @private\n */\n\nexport function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const { year, month, day } = gregObj,\n ordinal = computeOrdinal(year, month, day),\n weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);\n\n let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7),\n weekYear;\n\n if (weekNumber < 1) {\n weekYear = year - 1;\n weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);\n } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {\n weekYear = year + 1;\n weekNumber = 1;\n } else {\n weekYear = year;\n }\n\n return { weekYear, weekNumber, weekday, ...timeObject(gregObj) };\n}\n\nexport function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const { weekYear, weekNumber, weekday } = weekData,\n weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek),\n yearInDays = daysInYear(weekYear);\n\n let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek,\n year;\n\n if (ordinal < 1) {\n year = weekYear - 1;\n ordinal += daysInYear(year);\n } else if (ordinal > yearInDays) {\n year = weekYear + 1;\n ordinal -= daysInYear(weekYear);\n } else {\n year = weekYear;\n }\n\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(weekData) };\n}\n\nexport function gregorianToOrdinal(gregData) {\n const { year, month, day } = gregData;\n const ordinal = computeOrdinal(year, month, day);\n return { year, ordinal, ...timeObject(gregData) };\n}\n\nexport function ordinalToGregorian(ordinalData) {\n const { year, ordinal } = ordinalData;\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(ordinalData) };\n}\n\n/**\n * Check if local week units like localWeekday are used in obj.\n * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties.\n * Modifies obj in-place!\n * @param obj the object values\n */\nexport function usesLocalWeekValues(obj, loc) {\n const hasLocaleWeekData =\n !isUndefined(obj.localWeekday) ||\n !isUndefined(obj.localWeekNumber) ||\n !isUndefined(obj.localWeekYear);\n if (hasLocaleWeekData) {\n const hasIsoWeekData =\n !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);\n\n if (hasIsoWeekData) {\n throw new ConflictingSpecificationError(\n \"Cannot mix locale-based week fields with ISO-based week fields\"\n );\n }\n if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;\n if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;\n if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;\n delete obj.localWeekday;\n delete obj.localWeekNumber;\n delete obj.localWeekYear;\n return {\n minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),\n startOfWeek: loc.getStartOfWeek(),\n };\n } else {\n return { minDaysInFirstWeek: 4, startOfWeek: 1 };\n }\n}\n\nexport function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const validYear = isInteger(obj.weekYear),\n validWeek = integerBetween(\n obj.weekNumber,\n 1,\n weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)\n ),\n validWeekday = integerBetween(obj.weekday, 1, 7);\n\n if (!validYear) {\n return unitOutOfRange(\"weekYear\", obj.weekYear);\n } else if (!validWeek) {\n return unitOutOfRange(\"week\", obj.weekNumber);\n } else if (!validWeekday) {\n return unitOutOfRange(\"weekday\", obj.weekday);\n } else return false;\n}\n\nexport function hasInvalidOrdinalData(obj) {\n const validYear = isInteger(obj.year),\n validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validOrdinal) {\n return unitOutOfRange(\"ordinal\", obj.ordinal);\n } else return false;\n}\n\nexport function hasInvalidGregorianData(obj) {\n const validYear = isInteger(obj.year),\n validMonth = integerBetween(obj.month, 1, 12),\n validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validMonth) {\n return unitOutOfRange(\"month\", obj.month);\n } else if (!validDay) {\n return unitOutOfRange(\"day\", obj.day);\n } else return false;\n}\n\nexport function hasInvalidTimeData(obj) {\n const { hour, minute, second, millisecond } = obj;\n const validHour =\n integerBetween(hour, 0, 23) ||\n (hour === 24 && minute === 0 && second === 0 && millisecond === 0),\n validMinute = integerBetween(minute, 0, 59),\n validSecond = integerBetween(second, 0, 59),\n validMillisecond = integerBetween(millisecond, 0, 999);\n\n if (!validHour) {\n return unitOutOfRange(\"hour\", hour);\n } else if (!validMinute) {\n return unitOutOfRange(\"minute\", minute);\n } else if (!validSecond) {\n return unitOutOfRange(\"second\", second);\n } else if (!validMillisecond) {\n return unitOutOfRange(\"millisecond\", millisecond);\n } else return false;\n}\n","/*\n This is just a junk drawer, containing anything used across multiple classes.\n Because Luxon is small(ish), this should stay small and we won't worry about splitting\n it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.\n*/\n\nimport { InvalidArgumentError } from \"../errors.js\";\nimport Settings from \"../settings.js\";\nimport { dayOfWeek, isoWeekdayToLocal } from \"./conversions.js\";\n\n/**\n * @private\n */\n\n// TYPES\n\nexport function isUndefined(o) {\n return typeof o === \"undefined\";\n}\n\nexport function isNumber(o) {\n return typeof o === \"number\";\n}\n\nexport function isInteger(o) {\n return typeof o === \"number\" && o % 1 === 0;\n}\n\nexport function isString(o) {\n return typeof o === \"string\";\n}\n\nexport function isDate(o) {\n return Object.prototype.toString.call(o) === \"[object Date]\";\n}\n\n// CAPABILITIES\n\nexport function hasRelative() {\n try {\n return typeof Intl !== \"undefined\" && !!Intl.RelativeTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\nexport function hasLocaleWeekInfo() {\n try {\n return (\n typeof Intl !== \"undefined\" &&\n !!Intl.Locale &&\n (\"weekInfo\" in Intl.Locale.prototype || \"getWeekInfo\" in Intl.Locale.prototype)\n );\n } catch (e) {\n return false;\n }\n}\n\n// OBJECTS AND ARRAYS\n\nexport function maybeArray(thing) {\n return Array.isArray(thing) ? thing : [thing];\n}\n\nexport function bestBy(arr, by, compare) {\n if (arr.length === 0) {\n return undefined;\n }\n return arr.reduce((best, next) => {\n const pair = [by(next), next];\n if (!best) {\n return pair;\n } else if (compare(best[0], pair[0]) === best[0]) {\n return best;\n } else {\n return pair;\n }\n }, null)[1];\n}\n\nexport function pick(obj, keys) {\n return keys.reduce((a, k) => {\n a[k] = obj[k];\n return a;\n }, {});\n}\n\nexport function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport function validateWeekSettings(settings) {\n if (settings == null) {\n return null;\n } else if (typeof settings !== \"object\") {\n throw new InvalidArgumentError(\"Week settings must be an object\");\n } else {\n if (\n !integerBetween(settings.firstDay, 1, 7) ||\n !integerBetween(settings.minimalDays, 1, 7) ||\n !Array.isArray(settings.weekend) ||\n settings.weekend.some((v) => !integerBetween(v, 1, 7))\n ) {\n throw new InvalidArgumentError(\"Invalid week settings\");\n }\n return {\n firstDay: settings.firstDay,\n minimalDays: settings.minimalDays,\n weekend: Array.from(settings.weekend),\n };\n }\n}\n\n// NUMBERS AND STRINGS\n\nexport function integerBetween(thing, bottom, top) {\n return isInteger(thing) && thing >= bottom && thing <= top;\n}\n\n// x % n but takes the sign of n instead of x\nexport function floorMod(x, n) {\n return x - n * Math.floor(x / n);\n}\n\nexport function padStart(input, n = 2) {\n const isNeg = input < 0;\n let padded;\n if (isNeg) {\n padded = \"-\" + (\"\" + -input).padStart(n, \"0\");\n } else {\n padded = (\"\" + input).padStart(n, \"0\");\n }\n return padded;\n}\n\nexport function parseInteger(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseInt(string, 10);\n }\n}\n\nexport function parseFloating(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseFloat(string);\n }\n}\n\nexport function parseMillis(fraction) {\n // Return undefined (instead of 0) in these cases, where fraction is not set\n if (isUndefined(fraction) || fraction === null || fraction === \"\") {\n return undefined;\n } else {\n const f = parseFloat(\"0.\" + fraction) * 1000;\n return Math.floor(f);\n }\n}\n\nexport function roundTo(number, digits, rounding = \"round\") {\n const factor = 10 ** digits;\n switch (rounding) {\n case \"expand\":\n return number > 0\n ? Math.ceil(number * factor) / factor\n : Math.floor(number * factor) / factor;\n case \"trunc\":\n return Math.trunc(number * factor) / factor;\n case \"round\":\n return Math.round(number * factor) / factor;\n case \"floor\":\n return Math.floor(number * factor) / factor;\n case \"ceil\":\n return Math.ceil(number * factor) / factor;\n default:\n throw new RangeError(`Value rounding ${rounding} is out of range`);\n }\n}\n\n// DATE BASICS\n\nexport function isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\nexport function daysInMonth(year, month) {\n const modMonth = floorMod(month - 1, 12) + 1,\n modYear = year + (month - modMonth) / 12;\n\n if (modMonth === 2) {\n return isLeapYear(modYear) ? 29 : 28;\n } else {\n return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];\n }\n}\n\n// convert a calendar object to a local timestamp (epoch, but with the offset baked in)\nexport function objToLocalTS(obj) {\n let d = Date.UTC(\n obj.year,\n obj.month - 1,\n obj.day,\n obj.hour,\n obj.minute,\n obj.second,\n obj.millisecond\n );\n\n // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that\n if (obj.year < 100 && obj.year >= 0) {\n d = new Date(d);\n // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not\n // so if obj.year is in 99, but obj.day makes it roll over into year 100,\n // the calculations done by Date.UTC are using year 2000 - which is incorrect\n d.setUTCFullYear(obj.year, obj.month - 1, obj.day);\n }\n return +d;\n}\n\n// adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js\nfunction firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {\n const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);\n return -fwdlw + minDaysInFirstWeek - 1;\n}\n\nexport function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);\n const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);\n return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;\n}\n\nexport function untruncateYear(year) {\n if (year > 99) {\n return year;\n } else return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year;\n}\n\n// PARSING\n\nexport function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {\n const date = new Date(ts),\n intlOpts = {\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n };\n\n if (timeZone) {\n intlOpts.timeZone = timeZone;\n }\n\n const modified = { timeZoneName: offsetFormat, ...intlOpts };\n\n const parsed = new Intl.DateTimeFormat(locale, modified)\n .formatToParts(date)\n .find((m) => m.type.toLowerCase() === \"timezonename\");\n return parsed ? parsed.value : null;\n}\n\n// signedOffset('-5', '30') -> -330\nexport function signedOffset(offHourStr, offMinuteStr) {\n let offHour = parseInt(offHourStr, 10);\n\n // don't || this because we want to preserve -0\n if (Number.isNaN(offHour)) {\n offHour = 0;\n }\n\n const offMin = parseInt(offMinuteStr, 10) || 0,\n offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;\n return offHour * 60 + offMinSigned;\n}\n\n// COERCION\n\nexport function asNumber(value) {\n const numericValue = Number(value);\n if (typeof value === \"boolean\" || value === \"\" || !Number.isFinite(numericValue))\n throw new InvalidArgumentError(`Invalid unit value ${value}`);\n return numericValue;\n}\n\nexport function normalizeObject(obj, normalizer) {\n const normalized = {};\n for (const u in obj) {\n if (hasOwnProperty(obj, u)) {\n const v = obj[u];\n if (v === undefined || v === null) continue;\n normalized[normalizer(u)] = asNumber(v);\n }\n }\n return normalized;\n}\n\n/**\n * Returns the offset's value as a string\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\nexport function formatOffset(offset, format) {\n const hours = Math.trunc(Math.abs(offset / 60)),\n minutes = Math.trunc(Math.abs(offset % 60)),\n sign = offset >= 0 ? \"+\" : \"-\";\n\n switch (format) {\n case \"short\":\n return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;\n case \"narrow\":\n return `${sign}${hours}${minutes > 0 ? `:${minutes}` : \"\"}`;\n case \"techie\":\n return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;\n default:\n throw new RangeError(`Value format ${format} is out of range for property format`);\n }\n}\n\nexport function timeObject(obj) {\n return pick(obj, [\"hour\", \"minute\", \"second\", \"millisecond\"]);\n}\n","import * as Formats from \"./formats.js\";\nimport { pick } from \"./util.js\";\n\nfunction stringify(obj) {\n return JSON.stringify(obj, Object.keys(obj).sort());\n}\n\n/**\n * @private\n */\n\nexport const monthsLong = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n];\n\nexport const monthsShort = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n];\n\nexport const monthsNarrow = [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"];\n\nexport function months(length) {\n switch (length) {\n case \"narrow\":\n return [...monthsNarrow];\n case \"short\":\n return [...monthsShort];\n case \"long\":\n return [...monthsLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"];\n case \"2-digit\":\n return [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\"];\n default:\n return null;\n }\n}\n\nexport const weekdaysLong = [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\",\n];\n\nexport const weekdaysShort = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nexport const weekdaysNarrow = [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"];\n\nexport function weekdays(length) {\n switch (length) {\n case \"narrow\":\n return [...weekdaysNarrow];\n case \"short\":\n return [...weekdaysShort];\n case \"long\":\n return [...weekdaysLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"];\n default:\n return null;\n }\n}\n\nexport const meridiems = [\"AM\", \"PM\"];\n\nexport const erasLong = [\"Before Christ\", \"Anno Domini\"];\n\nexport const erasShort = [\"BC\", \"AD\"];\n\nexport const erasNarrow = [\"B\", \"A\"];\n\nexport function eras(length) {\n switch (length) {\n case \"narrow\":\n return [...erasNarrow];\n case \"short\":\n return [...erasShort];\n case \"long\":\n return [...erasLong];\n default:\n return null;\n }\n}\n\nexport function meridiemForDateTime(dt) {\n return meridiems[dt.hour < 12 ? 0 : 1];\n}\n\nexport function weekdayForDateTime(dt, length) {\n return weekdays(length)[dt.weekday - 1];\n}\n\nexport function monthForDateTime(dt, length) {\n return months(length)[dt.month - 1];\n}\n\nexport function eraForDateTime(dt, length) {\n return eras(length)[dt.year < 0 ? 0 : 1];\n}\n\nexport function formatRelativeTime(unit, count, numeric = \"always\", narrow = false) {\n const units = {\n years: [\"year\", \"yr.\"],\n quarters: [\"quarter\", \"qtr.\"],\n months: [\"month\", \"mo.\"],\n weeks: [\"week\", \"wk.\"],\n days: [\"day\", \"day\", \"days\"],\n hours: [\"hour\", \"hr.\"],\n minutes: [\"minute\", \"min.\"],\n seconds: [\"second\", \"sec.\"],\n };\n\n const lastable = [\"hours\", \"minutes\", \"seconds\"].indexOf(unit) === -1;\n\n if (numeric === \"auto\" && lastable) {\n const isDay = unit === \"days\";\n switch (count) {\n case 1:\n return isDay ? \"tomorrow\" : `next ${units[unit][0]}`;\n case -1:\n return isDay ? \"yesterday\" : `last ${units[unit][0]}`;\n case 0:\n return isDay ? \"today\" : `this ${units[unit][0]}`;\n default: // fall through\n }\n }\n\n const isInPast = Object.is(count, -0) || count < 0,\n fmtValue = Math.abs(count),\n singular = fmtValue === 1,\n lilUnits = units[unit],\n fmtUnit = narrow\n ? singular\n ? lilUnits[1]\n : lilUnits[2] || lilUnits[1]\n : singular\n ? units[unit][0]\n : unit;\n return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;\n}\n\nexport function formatString(knownFormat) {\n // these all have the offsets removed because we don't have access to them\n // without all the intl stuff this is backfilling\n const filtered = pick(knownFormat, [\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n \"hourCycle\",\n ]),\n key = stringify(filtered),\n dateTimeHuge = \"EEEE, LLLL d, yyyy, h:mm a\";\n switch (key) {\n case stringify(Formats.DATE_SHORT):\n return \"M/d/yyyy\";\n case stringify(Formats.DATE_MED):\n return \"LLL d, yyyy\";\n case stringify(Formats.DATE_MED_WITH_WEEKDAY):\n return \"EEE, LLL d, yyyy\";\n case stringify(Formats.DATE_FULL):\n return \"LLLL d, yyyy\";\n case stringify(Formats.DATE_HUGE):\n return \"EEEE, LLLL d, yyyy\";\n case stringify(Formats.TIME_SIMPLE):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_SECONDS):\n return \"h:mm:ss a\";\n case stringify(Formats.TIME_WITH_SHORT_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_LONG_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_24_SIMPLE):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_SECONDS):\n return \"HH:mm:ss\";\n case stringify(Formats.TIME_24_WITH_SHORT_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_LONG_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.DATETIME_SHORT):\n return \"M/d/yyyy, h:mm a\";\n case stringify(Formats.DATETIME_MED):\n return \"LLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL):\n return \"LLLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_HUGE):\n return dateTimeHuge;\n case stringify(Formats.DATETIME_SHORT_WITH_SECONDS):\n return \"M/d/yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_SECONDS):\n return \"LLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_WEEKDAY):\n return \"EEE, d LLL yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL_WITH_SECONDS):\n return \"LLLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_HUGE_WITH_SECONDS):\n return \"EEEE, LLLL d, yyyy, h:mm:ss a\";\n default:\n return dateTimeHuge;\n }\n}\n","import * as English from \"./english.js\";\nimport * as Formats from \"./formats.js\";\nimport { padStart } from \"./util.js\";\n\nfunction stringifyTokens(splits, tokenToString) {\n let s = \"\";\n for (const token of splits) {\n if (token.literal) {\n s += token.val;\n } else {\n s += tokenToString(token.val);\n }\n }\n return s;\n}\n\nconst macroTokenToFormatOpts = {\n D: Formats.DATE_SHORT,\n DD: Formats.DATE_MED,\n DDD: Formats.DATE_FULL,\n DDDD: Formats.DATE_HUGE,\n t: Formats.TIME_SIMPLE,\n tt: Formats.TIME_WITH_SECONDS,\n ttt: Formats.TIME_WITH_SHORT_OFFSET,\n tttt: Formats.TIME_WITH_LONG_OFFSET,\n T: Formats.TIME_24_SIMPLE,\n TT: Formats.TIME_24_WITH_SECONDS,\n TTT: Formats.TIME_24_WITH_SHORT_OFFSET,\n TTTT: Formats.TIME_24_WITH_LONG_OFFSET,\n f: Formats.DATETIME_SHORT,\n ff: Formats.DATETIME_MED,\n fff: Formats.DATETIME_FULL,\n ffff: Formats.DATETIME_HUGE,\n F: Formats.DATETIME_SHORT_WITH_SECONDS,\n FF: Formats.DATETIME_MED_WITH_SECONDS,\n FFF: Formats.DATETIME_FULL_WITH_SECONDS,\n FFFF: Formats.DATETIME_HUGE_WITH_SECONDS,\n};\n\n/**\n * @private\n */\n\nexport default class Formatter {\n static create(locale, opts = {}) {\n return new Formatter(locale, opts);\n }\n\n static parseFormat(fmt) {\n // white-space is always considered a literal in user-provided formats\n // the \" \" token has a special meaning (see unitForToken)\n\n let current = null,\n currentFull = \"\",\n bracketed = false;\n const splits = [];\n for (let i = 0; i < fmt.length; i++) {\n const c = fmt.charAt(i);\n if (c === \"'\") {\n // turn '' into a literal signal quote instead of just skipping the empty literal\n if (currentFull.length > 0 || bracketed) {\n splits.push({\n literal: bracketed || /^\\s+$/.test(currentFull),\n val: currentFull === \"\" ? \"'\" : currentFull,\n });\n }\n current = null;\n currentFull = \"\";\n bracketed = !bracketed;\n } else if (bracketed) {\n currentFull += c;\n } else if (c === current) {\n currentFull += c;\n } else {\n if (currentFull.length > 0) {\n splits.push({ literal: /^\\s+$/.test(currentFull), val: currentFull });\n }\n currentFull = c;\n current = c;\n }\n }\n\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed || /^\\s+$/.test(currentFull), val: currentFull });\n }\n\n return splits;\n }\n\n static macroTokenToFormatOpts(token) {\n return macroTokenToFormatOpts[token];\n }\n\n constructor(locale, formatOpts) {\n this.opts = formatOpts;\n this.loc = locale;\n this.systemLoc = null;\n }\n\n formatWithSystemDefault(dt, opts) {\n if (this.systemLoc === null) {\n this.systemLoc = this.loc.redefaultToSystem();\n }\n const df = this.systemLoc.dtFormatter(dt, { ...this.opts, ...opts });\n return df.format();\n }\n\n dtFormatter(dt, opts = {}) {\n return this.loc.dtFormatter(dt, { ...this.opts, ...opts });\n }\n\n formatDateTime(dt, opts) {\n return this.dtFormatter(dt, opts).format();\n }\n\n formatDateTimeParts(dt, opts) {\n return this.dtFormatter(dt, opts).formatToParts();\n }\n\n formatInterval(interval, opts) {\n const df = this.dtFormatter(interval.start, opts);\n return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());\n }\n\n resolvedOptions(dt, opts) {\n return this.dtFormatter(dt, opts).resolvedOptions();\n }\n\n num(n, p = 0, signDisplay = undefined) {\n // we get some perf out of doing this here, annoyingly\n if (this.opts.forceSimple) {\n return padStart(n, p);\n }\n\n const opts = { ...this.opts };\n\n if (p > 0) {\n opts.padTo = p;\n }\n if (signDisplay) {\n opts.signDisplay = signDisplay;\n }\n\n return this.loc.numberFormatter(opts).format(n);\n }\n\n formatDateTimeFromString(dt, fmt) {\n const knownEnglish = this.loc.listingMode() === \"en\",\n useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== \"gregory\",\n string = (opts, extract) => this.loc.extract(dt, opts, extract),\n formatOffset = (opts) => {\n if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {\n return \"Z\";\n }\n\n return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : \"\";\n },\n meridiem = () =>\n knownEnglish\n ? English.meridiemForDateTime(dt)\n : string({ hour: \"numeric\", hourCycle: \"h12\" }, \"dayperiod\"),\n month = (length, standalone) =>\n knownEnglish\n ? English.monthForDateTime(dt, length)\n : string(standalone ? { month: length } : { month: length, day: \"numeric\" }, \"month\"),\n weekday = (length, standalone) =>\n knownEnglish\n ? English.weekdayForDateTime(dt, length)\n : string(\n standalone ? { weekday: length } : { weekday: length, month: \"long\", day: \"numeric\" },\n \"weekday\"\n ),\n maybeMacro = (token) => {\n const formatOpts = Formatter.macroTokenToFormatOpts(token);\n if (formatOpts) {\n return this.formatWithSystemDefault(dt, formatOpts);\n } else {\n return token;\n }\n },\n era = (length) =>\n knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, \"era\"),\n tokenToString = (token) => {\n // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols\n switch (token) {\n // ms\n case \"S\":\n return this.num(dt.millisecond);\n case \"u\":\n // falls through\n case \"SSS\":\n return this.num(dt.millisecond, 3);\n // seconds\n case \"s\":\n return this.num(dt.second);\n case \"ss\":\n return this.num(dt.second, 2);\n // fractional seconds\n case \"uu\":\n return this.num(Math.floor(dt.millisecond / 10), 2);\n case \"uuu\":\n return this.num(Math.floor(dt.millisecond / 100));\n // minutes\n case \"m\":\n return this.num(dt.minute);\n case \"mm\":\n return this.num(dt.minute, 2);\n // hours\n case \"h\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);\n case \"hh\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);\n case \"H\":\n return this.num(dt.hour);\n case \"HH\":\n return this.num(dt.hour, 2);\n // offset\n case \"Z\":\n // like +6\n return formatOffset({ format: \"narrow\", allowZ: this.opts.allowZ });\n case \"ZZ\":\n // like +06:00\n return formatOffset({ format: \"short\", allowZ: this.opts.allowZ });\n case \"ZZZ\":\n // like +0600\n return formatOffset({ format: \"techie\", allowZ: this.opts.allowZ });\n case \"ZZZZ\":\n // like EST\n return dt.zone.offsetName(dt.ts, { format: \"short\", locale: this.loc.locale });\n case \"ZZZZZ\":\n // like Eastern Standard Time\n return dt.zone.offsetName(dt.ts, { format: \"long\", locale: this.loc.locale });\n // zone\n case \"z\":\n // like America/New_York\n return dt.zoneName;\n // meridiems\n case \"a\":\n return meridiem();\n // dates\n case \"d\":\n return useDateTimeFormatter ? string({ day: \"numeric\" }, \"day\") : this.num(dt.day);\n case \"dd\":\n return useDateTimeFormatter ? string({ day: \"2-digit\" }, \"day\") : this.num(dt.day, 2);\n // weekdays - standalone\n case \"c\":\n // like 1\n return this.num(dt.weekday);\n case \"ccc\":\n // like 'Tues'\n return weekday(\"short\", true);\n case \"cccc\":\n // like 'Tuesday'\n return weekday(\"long\", true);\n case \"ccccc\":\n // like 'T'\n return weekday(\"narrow\", true);\n // weekdays - format\n case \"E\":\n // like 1\n return this.num(dt.weekday);\n case \"EEE\":\n // like 'Tues'\n return weekday(\"short\", false);\n case \"EEEE\":\n // like 'Tuesday'\n return weekday(\"long\", false);\n case \"EEEEE\":\n // like 'T'\n return weekday(\"narrow\", false);\n // months - standalone\n case \"L\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\", day: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"LL\":\n // like 01, doesn't seem to work\n return useDateTimeFormatter\n ? string({ month: \"2-digit\", day: \"numeric\" }, \"month\")\n : this.num(dt.month, 2);\n case \"LLL\":\n // like Jan\n return month(\"short\", true);\n case \"LLLL\":\n // like January\n return month(\"long\", true);\n case \"LLLLL\":\n // like J\n return month(\"narrow\", true);\n // months - format\n case \"M\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"MM\":\n // like 01\n return useDateTimeFormatter\n ? string({ month: \"2-digit\" }, \"month\")\n : this.num(dt.month, 2);\n case \"MMM\":\n // like Jan\n return month(\"short\", false);\n case \"MMMM\":\n // like January\n return month(\"long\", false);\n case \"MMMMM\":\n // like J\n return month(\"narrow\", false);\n // years\n case \"y\":\n // like 2014\n return useDateTimeFormatter ? string({ year: \"numeric\" }, \"year\") : this.num(dt.year);\n case \"yy\":\n // like 14\n return useDateTimeFormatter\n ? string({ year: \"2-digit\" }, \"year\")\n : this.num(dt.year.toString().slice(-2), 2);\n case \"yyyy\":\n // like 0012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 4);\n case \"yyyyyy\":\n // like 000012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 6);\n // eras\n case \"G\":\n // like AD\n return era(\"short\");\n case \"GG\":\n // like Anno Domini\n return era(\"long\");\n case \"GGGGG\":\n return era(\"narrow\");\n case \"kk\":\n return this.num(dt.weekYear.toString().slice(-2), 2);\n case \"kkkk\":\n return this.num(dt.weekYear, 4);\n case \"W\":\n return this.num(dt.weekNumber);\n case \"WW\":\n return this.num(dt.weekNumber, 2);\n case \"n\":\n return this.num(dt.localWeekNumber);\n case \"nn\":\n return this.num(dt.localWeekNumber, 2);\n case \"ii\":\n return this.num(dt.localWeekYear.toString().slice(-2), 2);\n case \"iiii\":\n return this.num(dt.localWeekYear, 4);\n case \"o\":\n return this.num(dt.ordinal);\n case \"ooo\":\n return this.num(dt.ordinal, 3);\n case \"q\":\n // like 1\n return this.num(dt.quarter);\n case \"qq\":\n // like 01\n return this.num(dt.quarter, 2);\n case \"X\":\n return this.num(Math.floor(dt.ts / 1000));\n case \"x\":\n return this.num(dt.ts);\n default:\n return maybeMacro(token);\n }\n };\n\n return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);\n }\n\n formatDurationFromString(dur, fmt) {\n const invertLargest = this.opts.signMode === \"negativeLargestOnly\" ? -1 : 1;\n const tokenToField = (token) => {\n switch (token[0]) {\n case \"S\":\n return \"milliseconds\";\n case \"s\":\n return \"seconds\";\n case \"m\":\n return \"minutes\";\n case \"h\":\n return \"hours\";\n case \"d\":\n return \"days\";\n case \"w\":\n return \"weeks\";\n case \"M\":\n return \"months\";\n case \"y\":\n return \"years\";\n default:\n return null;\n }\n },\n tokenToString = (lildur, info) => (token) => {\n const mapped = tokenToField(token);\n if (mapped) {\n const inversionFactor =\n info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;\n let signDisplay;\n if (this.opts.signMode === \"negativeLargestOnly\" && mapped !== info.largestUnit) {\n signDisplay = \"never\";\n } else if (this.opts.signMode === \"all\") {\n signDisplay = \"always\";\n } else {\n // \"auto\" and \"negative\" are the same, but \"auto\" has better support\n signDisplay = \"auto\";\n }\n return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);\n } else {\n return token;\n }\n },\n tokens = Formatter.parseFormat(fmt),\n realTokens = tokens.reduce(\n (found, { literal, val }) => (literal ? found : found.concat(val)),\n []\n ),\n collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t)),\n durationInfo = {\n isNegativeDuration: collapsed < 0,\n // this relies on \"collapsed\" being based on \"shiftTo\", which builds up the object\n // in order\n largestUnit: Object.keys(collapsed.values)[0],\n };\n return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));\n }\n}\n","import {\n untruncateYear,\n signedOffset,\n parseInteger,\n parseMillis,\n isUndefined,\n parseFloating,\n} from \"./util.js\";\nimport * as English from \"./english.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n/*\n * This file handles parsing for well-specified formats. Here's how it works:\n * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.\n * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object\n * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.\n * Extractors can take a \"cursor\" representing the offset in the match to look at. This makes it easy to combine extractors.\n * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.\n * Some extractions are super dumb and simpleParse and fromStrings help DRY them.\n */\n\nconst ianaRegex = /[A-Za-z_+-]{1,256}(?::?\\/[A-Za-z0-9_+-]{1,256}(?:\\/[A-Za-z0-9_+-]{1,256})?)?/;\n\nfunction combineRegexes(...regexes) {\n const full = regexes.reduce((f, r) => f + r.source, \"\");\n return RegExp(`^${full}$`);\n}\n\nfunction combineExtractors(...extractors) {\n return (m) =>\n extractors\n .reduce(\n ([mergedVals, mergedZone, cursor], ex) => {\n const [val, zone, next] = ex(m, cursor);\n return [{ ...mergedVals, ...val }, zone || mergedZone, next];\n },\n [{}, null, 1]\n )\n .slice(0, 2);\n}\n\nfunction parse(s, ...patterns) {\n if (s == null) {\n return [null, null];\n }\n\n for (const [regex, extractor] of patterns) {\n const m = regex.exec(s);\n if (m) {\n return extractor(m);\n }\n }\n return [null, null];\n}\n\nfunction simpleParse(...keys) {\n return (match, cursor) => {\n const ret = {};\n let i;\n\n for (i = 0; i < keys.length; i++) {\n ret[keys[i]] = parseInteger(match[cursor + i]);\n }\n return [ret, null, cursor + i];\n };\n}\n\n// ISO and SQL parsing\nconst offsetRegex = /(?:([Zz])|([+-]\\d\\d)(?::?(\\d\\d))?)/;\nconst isoExtendedZone = `(?:${offsetRegex.source}?(?:\\\\[(${ianaRegex.source})\\\\])?)?`;\nconst isoTimeBaseRegex = /(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:[.,](\\d{1,30}))?)?)?/;\nconst isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);\nconst isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);\nconst isoYmdRegex = /([+-]\\d{6}|\\d{4})(?:-?(\\d\\d)(?:-?(\\d\\d))?)?/;\nconst isoWeekRegex = /(\\d{4})-?W(\\d\\d)(?:-?(\\d))?/;\nconst isoOrdinalRegex = /(\\d{4})-?(\\d{3})/;\nconst extractISOWeekData = simpleParse(\"weekYear\", \"weekNumber\", \"weekDay\");\nconst extractISOOrdinalData = simpleParse(\"year\", \"ordinal\");\nconst sqlYmdRegex = /(\\d{4})-(\\d\\d)-(\\d\\d)/; // dumbed-down version of the ISO one\nconst sqlTimeRegex = RegExp(\n `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`\n);\nconst sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);\n\nfunction int(match, pos, fallback) {\n const m = match[pos];\n return isUndefined(m) ? fallback : parseInteger(m);\n}\n\nfunction extractISOYmd(match, cursor) {\n const item = {\n year: int(match, cursor),\n month: int(match, cursor + 1, 1),\n day: int(match, cursor + 2, 1),\n };\n\n return [item, null, cursor + 3];\n}\n\nfunction extractISOTime(match, cursor) {\n const item = {\n hours: int(match, cursor, 0),\n minutes: int(match, cursor + 1, 0),\n seconds: int(match, cursor + 2, 0),\n milliseconds: parseMillis(match[cursor + 3]),\n };\n\n return [item, null, cursor + 4];\n}\n\nfunction extractISOOffset(match, cursor) {\n const local = !match[cursor] && !match[cursor + 1],\n fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),\n zone = local ? null : FixedOffsetZone.instance(fullOffset);\n return [{}, zone, cursor + 3];\n}\n\nfunction extractIANAZone(match, cursor) {\n const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;\n return [{}, zone, cursor + 1];\n}\n\n// ISO time parsing\n\nconst isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);\n\n// ISO duration parsing\n\nconst isoDuration =\n /^-?P(?:(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)Y)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)M)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)W)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)D)?(?:T(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)H)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)M)?(?:(-?\\d{1,20})(?:[.,](-?\\d{1,20}))?S)?)?)$/;\n\nfunction extractISODuration(match) {\n const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] =\n match;\n\n const hasNegativePrefix = s[0] === \"-\";\n const negativeSeconds = secondStr && secondStr[0] === \"-\";\n\n const maybeNegate = (num, force = false) =>\n num !== undefined && (force || (num && hasNegativePrefix)) ? -num : num;\n\n return [\n {\n years: maybeNegate(parseFloating(yearStr)),\n months: maybeNegate(parseFloating(monthStr)),\n weeks: maybeNegate(parseFloating(weekStr)),\n days: maybeNegate(parseFloating(dayStr)),\n hours: maybeNegate(parseFloating(hourStr)),\n minutes: maybeNegate(parseFloating(minuteStr)),\n seconds: maybeNegate(parseFloating(secondStr), secondStr === \"-0\"),\n milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds),\n },\n ];\n}\n\n// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York\n// and not just that we're in -240 *right now*. But since I don't think these are used that often\n// I'm just going to ignore that\nconst obsOffsets = {\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n};\n\nfunction fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {\n const result = {\n year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),\n month: English.monthsShort.indexOf(monthStr) + 1,\n day: parseInteger(dayStr),\n hour: parseInteger(hourStr),\n minute: parseInteger(minuteStr),\n };\n\n if (secondStr) result.second = parseInteger(secondStr);\n if (weekdayStr) {\n result.weekday =\n weekdayStr.length > 3\n ? English.weekdaysLong.indexOf(weekdayStr) + 1\n : English.weekdaysShort.indexOf(weekdayStr) + 1;\n }\n\n return result;\n}\n\n// RFC 2822/5322\nconst rfc2822 =\n /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\\d\\d)(\\d\\d)))$/;\n\nfunction extractRFC2822(match) {\n const [\n ,\n weekdayStr,\n dayStr,\n monthStr,\n yearStr,\n hourStr,\n minuteStr,\n secondStr,\n obsOffset,\n milOffset,\n offHourStr,\n offMinuteStr,\n ] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n\n let offset;\n if (obsOffset) {\n offset = obsOffsets[obsOffset];\n } else if (milOffset) {\n offset = 0;\n } else {\n offset = signedOffset(offHourStr, offMinuteStr);\n }\n\n return [result, new FixedOffsetZone(offset)];\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^()]*\\)|[\\n\\t]/g, \" \")\n .replace(/(\\s\\s+)/g, \" \")\n .trim();\n}\n\n// http date\n\nconst rfc1123 =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d\\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\\d{4}) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n rfc850 =\n /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\\d\\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n ascii =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \\d|\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) (\\d{4})$/;\n\nfunction extractRFC1123Or850(match) {\n const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nfunction extractASCII(match) {\n const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nconst isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);\nconst isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);\nconst isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);\nconst isoTimeCombinedRegex = combineRegexes(isoTimeRegex);\n\nconst extractISOYmdTimeAndOffset = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOWeekTimeAndOffset = combineExtractors(\n extractISOWeekData,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOOrdinalDateAndTime = combineExtractors(\n extractISOOrdinalData,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOTimeAndOffset = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\n/*\n * @private\n */\n\nexport function parseISODate(s) {\n return parse(\n s,\n [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],\n [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime],\n [isoTimeCombinedRegex, extractISOTimeAndOffset]\n );\n}\n\nexport function parseRFC2822Date(s) {\n return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);\n}\n\nexport function parseHTTPDate(s) {\n return parse(\n s,\n [rfc1123, extractRFC1123Or850],\n [rfc850, extractRFC1123Or850],\n [ascii, extractASCII]\n );\n}\n\nexport function parseISODuration(s) {\n return parse(s, [isoDuration, extractISODuration]);\n}\n\nconst extractISOTimeOnly = combineExtractors(extractISOTime);\n\nexport function parseISOTimeOnly(s) {\n return parse(s, [isoTimeOnly, extractISOTimeOnly]);\n}\n\nconst sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);\nconst sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);\n\nconst extractISOTimeOffsetAndIANAZone = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\nexport function parseSQL(s) {\n return parse(\n s,\n [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]\n );\n}\n","import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from \"./errors.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Locale from \"./impl/locale.js\";\nimport { parseISODuration, parseISOTimeOnly } from \"./impl/regexParser.js\";\nimport {\n asNumber,\n hasOwnProperty,\n isNumber,\n isUndefined,\n normalizeObject,\n roundTo,\n} from \"./impl/util.js\";\nimport Settings from \"./settings.js\";\nimport DateTime from \"./datetime.js\";\n\nconst INVALID = \"Invalid Duration\";\n\n// unit conversion constants\nexport const lowOrderMatrix = {\n weeks: {\n days: 7,\n hours: 7 * 24,\n minutes: 7 * 24 * 60,\n seconds: 7 * 24 * 60 * 60,\n milliseconds: 7 * 24 * 60 * 60 * 1000,\n },\n days: {\n hours: 24,\n minutes: 24 * 60,\n seconds: 24 * 60 * 60,\n milliseconds: 24 * 60 * 60 * 1000,\n },\n hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },\n minutes: { seconds: 60, milliseconds: 60 * 1000 },\n seconds: { milliseconds: 1000 },\n },\n casualMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: 52,\n days: 365,\n hours: 365 * 24,\n minutes: 365 * 24 * 60,\n seconds: 365 * 24 * 60 * 60,\n milliseconds: 365 * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: 13,\n days: 91,\n hours: 91 * 24,\n minutes: 91 * 24 * 60,\n seconds: 91 * 24 * 60 * 60,\n milliseconds: 91 * 24 * 60 * 60 * 1000,\n },\n months: {\n weeks: 4,\n days: 30,\n hours: 30 * 24,\n minutes: 30 * 24 * 60,\n seconds: 30 * 24 * 60 * 60,\n milliseconds: 30 * 24 * 60 * 60 * 1000,\n },\n\n ...lowOrderMatrix,\n },\n daysInYearAccurate = 146097.0 / 400,\n daysInMonthAccurate = 146097.0 / 4800,\n accurateMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: daysInYearAccurate / 7,\n days: daysInYearAccurate,\n hours: daysInYearAccurate * 24,\n minutes: daysInYearAccurate * 24 * 60,\n seconds: daysInYearAccurate * 24 * 60 * 60,\n milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: daysInYearAccurate / 28,\n days: daysInYearAccurate / 4,\n hours: (daysInYearAccurate * 24) / 4,\n minutes: (daysInYearAccurate * 24 * 60) / 4,\n seconds: (daysInYearAccurate * 24 * 60 * 60) / 4,\n milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4,\n },\n months: {\n weeks: daysInMonthAccurate / 7,\n days: daysInMonthAccurate,\n hours: daysInMonthAccurate * 24,\n minutes: daysInMonthAccurate * 24 * 60,\n seconds: daysInMonthAccurate * 24 * 60 * 60,\n milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000,\n },\n ...lowOrderMatrix,\n };\n\n// units ordered by size\nconst orderedUnits = [\n \"years\",\n \"quarters\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\",\n];\n\nconst reverseUnits = orderedUnits.slice(0).reverse();\n\n// clone really means \"create another instance just like this one, but with these changes\"\nfunction clone(dur, alts, clear = false) {\n // deep merge for vals\n const conf = {\n values: clear ? alts.values : { ...dur.values, ...(alts.values || {}) },\n loc: dur.loc.clone(alts.loc),\n conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,\n matrix: alts.matrix || dur.matrix,\n };\n return new Duration(conf);\n}\n\nfunction durationToMillis(matrix, vals) {\n let sum = vals.milliseconds ?? 0;\n for (const unit of reverseUnits.slice(1)) {\n if (vals[unit]) {\n sum += vals[unit] * matrix[unit][\"milliseconds\"];\n }\n }\n return sum;\n}\n\n// NB: mutates parameters\nfunction normalizeValues(matrix, vals) {\n // the logic below assumes the overall value of the duration is positive\n // if this is not the case, factor is used to make it so\n const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;\n\n orderedUnits.reduceRight((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n const previousVal = vals[previous] * factor;\n const conv = matrix[current][previous];\n\n // if (previousVal < 0):\n // lower order unit is negative (e.g. { years: 2, days: -2 })\n // normalize this by reducing the higher order unit by the appropriate amount\n // and increasing the lower order unit\n // this can never make the higher order unit negative, because this function only operates\n // on positive durations, so the amount of time represented by the lower order unit cannot\n // be larger than the higher order unit\n // else:\n // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 })\n // in this case we attempt to convert as much as possible from the lower order unit into\n // the higher order one\n //\n // Math.floor takes care of both of these cases, rounding away from 0\n // if previousVal < 0 it makes the absolute value larger\n // if previousVal >= it makes the absolute value smaller\n const rollUp = Math.floor(previousVal / conv);\n vals[current] += rollUp * factor;\n vals[previous] -= rollUp * conv * factor;\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n\n // try to convert any decimals into smaller units if possible\n // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 }\n orderedUnits.reduce((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n const fraction = vals[previous] % 1;\n vals[previous] -= fraction;\n vals[current] += fraction * matrix[previous][current];\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n}\n\n// Remove all properties with a value of 0 from an object\nfunction removeZeroes(vals) {\n const newVals = {};\n for (const [key, value] of Object.entries(vals)) {\n if (value !== 0) {\n newVals[key] = value;\n }\n }\n return newVals;\n}\n\n/**\n * A Duration object represents a period of time, like \"2 months\" or \"1 day, 1 hour\". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime#plus} to add a Duration object to a DateTime, producing another DateTime.\n *\n * Here is a brief overview of commonly used methods and getters in Duration:\n *\n * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.\n * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors.\n * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors.\n * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}.\n * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON}\n *\n * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.\n */\nexport default class Duration {\n /**\n * @private\n */\n constructor(config) {\n const accurate = config.conversionAccuracy === \"longterm\" || false;\n let matrix = accurate ? accurateMatrix : casualMatrix;\n\n if (config.matrix) {\n matrix = config.matrix;\n }\n\n /**\n * @access private\n */\n this.values = config.values;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.conversionAccuracy = accurate ? \"longterm\" : \"casual\";\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.matrix = matrix;\n /**\n * @access private\n */\n this.isLuxonDuration = true;\n }\n\n /**\n * Create Duration from a number of milliseconds.\n * @param {number} count of milliseconds\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromMillis(count, opts) {\n return Duration.fromObject({ milliseconds: count }, opts);\n }\n\n /**\n * Create a Duration from a JavaScript object with keys like 'years' and 'hours'.\n * If this object is empty then a zero milliseconds duration is returned.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.years\n * @param {number} obj.quarters\n * @param {number} obj.months\n * @param {number} obj.weeks\n * @param {number} obj.days\n * @param {number} obj.hours\n * @param {number} obj.minutes\n * @param {number} obj.seconds\n * @param {number} obj.milliseconds\n * @param {Object} [opts=[]] - options for creating this Duration\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the custom conversion system to use\n * @return {Duration}\n */\n static fromObject(obj, opts = {}) {\n if (obj == null || typeof obj !== \"object\") {\n throw new InvalidArgumentError(\n `Duration.fromObject: argument expected to be an object, got ${\n obj === null ? \"null\" : typeof obj\n }`\n );\n }\n\n return new Duration({\n values: normalizeObject(obj, Duration.normalizeUnit),\n loc: Locale.fromObject(opts),\n conversionAccuracy: opts.conversionAccuracy,\n matrix: opts.matrix,\n });\n }\n\n /**\n * Create a Duration from DurationLike.\n *\n * @param {Object | number | Duration} durationLike\n * One of:\n * - object with keys like 'years' and 'hours'.\n * - number representing milliseconds\n * - Duration instance\n * @return {Duration}\n */\n static fromDurationLike(durationLike) {\n if (isNumber(durationLike)) {\n return Duration.fromMillis(durationLike);\n } else if (Duration.isDuration(durationLike)) {\n return durationLike;\n } else if (typeof durationLike === \"object\") {\n return Duration.fromObject(durationLike);\n } else {\n throw new InvalidArgumentError(\n `Unknown duration argument ${durationLike} of type ${typeof durationLike}`\n );\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 duration string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the preset conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }\n * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }\n * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }\n * @return {Duration}\n */\n static fromISO(text, opts) {\n const [parsed] = parseISODuration(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 time string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 }\n * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @return {Duration}\n */\n static fromISOTime(text, opts) {\n const [parsed] = parseISOTimeOnly(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create an invalid Duration.\n * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Duration}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Duration is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDurationError(invalid);\n } else {\n return new Duration({ invalid });\n }\n }\n\n /**\n * @private\n */\n static normalizeUnit(unit) {\n const normalized = {\n year: \"years\",\n years: \"years\",\n quarter: \"quarters\",\n quarters: \"quarters\",\n month: \"months\",\n months: \"months\",\n week: \"weeks\",\n weeks: \"weeks\",\n day: \"days\",\n days: \"days\",\n hour: \"hours\",\n hours: \"hours\",\n minute: \"minutes\",\n minutes: \"minutes\",\n second: \"seconds\",\n seconds: \"seconds\",\n millisecond: \"milliseconds\",\n milliseconds: \"milliseconds\",\n }[unit ? unit.toLowerCase() : unit];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n }\n\n /**\n * Check if an object is a Duration. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDuration(o) {\n return (o && o.isLuxonDuration) || false;\n }\n\n /**\n * Get the locale of a Duration, such 'en-GB'\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:\n * * `S` for milliseconds\n * * `s` for seconds\n * * `m` for minutes\n * * `h` for hours\n * * `d` for days\n * * `w` for weeks\n * * `M` for months\n * * `y` for years\n * Notes:\n * * Add padding by repeating the token, e.g. \"yy\" pads the years to two digits, \"hhhh\" pads the hours out to four digits\n * * Tokens can be escaped by wrapping with single quotes.\n * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting.\n * @param {string} fmt - the format string\n * @param {Object} opts - options\n * @param {boolean} [opts.floor=true] - floor numerical values\n * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"y d s\") //=> \"1 6 2\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"yy dd sss\") //=> \"01 06 002\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"M S\") //=> \"12 518402000\"\n * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat(\"d s\", { signMode: \"all\" }) //=> \"+6 +2\"\n * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat(\"d s\", { signMode: \"all\" }) //=> \"-6 -2\"\n * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat(\"d s\", { signMode: \"negativeLargestOnly\" }) //=> \"-6 2\"\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n // reverse-compat since 1.2; we always round down now, never up, and we do it by default\n const fmtOpts = {\n ...opts,\n floor: opts.round !== false && opts.floor !== false,\n };\n return this.isValid\n ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a string representation of a Duration with all units included.\n * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options\n * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.\n * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.\n * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero\n * @example\n * ```js\n * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 })\n * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes'\n * dur.toHuman({ listStyle: \"long\" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes'\n * dur.toHuman({ unitDisplay: \"short\" }) //=> '1 mth, 0 wks, 5 hr, 6 min'\n * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes'\n * ```\n */\n toHuman(opts = {}) {\n if (!this.isValid) return INVALID;\n\n const showZeros = opts.showZeros !== false;\n\n const l = orderedUnits\n .map((unit) => {\n const val = this.values[unit];\n if (isUndefined(val) || (val === 0 && !showZeros)) {\n return null;\n }\n return this.loc\n .numberFormatter({ style: \"unit\", unitDisplay: \"long\", ...opts, unit: unit.slice(0, -1) })\n .format(val);\n })\n .filter((n) => n);\n\n return this.loc\n .listFormatter({ type: \"conjunction\", style: opts.listStyle || \"narrow\", ...opts })\n .format(l);\n }\n\n /**\n * Returns a JavaScript object with this Duration's values.\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }\n * @return {Object}\n */\n toObject() {\n if (!this.isValid) return {};\n return { ...this.values };\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'\n * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'\n * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'\n * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'\n * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'\n * @return {string}\n */\n toISO() {\n // we could use the formatter, but this is an easier way to get the minimum string\n if (!this.isValid) return null;\n\n let s = \"P\";\n if (this.years !== 0) s += this.years + \"Y\";\n if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + \"M\";\n if (this.weeks !== 0) s += this.weeks + \"W\";\n if (this.days !== 0) s += this.days + \"D\";\n if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)\n s += \"T\";\n if (this.hours !== 0) s += this.hours + \"H\";\n if (this.minutes !== 0) s += this.minutes + \"M\";\n if (this.seconds !== 0 || this.milliseconds !== 0)\n // this will handle \"floating point madness\" by removing extra decimal places\n // https://stackoverflow.com/questions/588004/is-floating-point-math-broken\n s += roundTo(this.seconds + this.milliseconds / 1000, 3) + \"S\";\n if (s === \"P\") s += \"T0S\";\n return s;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day.\n * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000'\n * @return {string}\n */\n toISOTime(opts = {}) {\n if (!this.isValid) return null;\n\n const millis = this.toMillis();\n if (millis < 0 || millis >= 86400000) return null;\n\n opts = {\n suppressMilliseconds: false,\n suppressSeconds: false,\n includePrefix: false,\n format: \"extended\",\n ...opts,\n includeOffset: false,\n };\n\n const dateTime = DateTime.fromMillis(millis, { zone: \"UTC\" });\n return dateTime.toISOTime(opts);\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in debugging.\n * @return {string}\n */\n toString() {\n return this.toISO();\n }\n\n /**\n * Returns a string representation of this Duration appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `Duration { values: ${JSON.stringify(this.values)} }`;\n } else {\n return `Duration { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns an milliseconds value of this Duration.\n * @return {number}\n */\n toMillis() {\n if (!this.isValid) return NaN;\n\n return durationToMillis(this.matrix, this.values);\n }\n\n /**\n * Returns an milliseconds value of this Duration. Alias of {@link toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Make this Duration longer by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n plus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration),\n result = {};\n\n for (const k of orderedUnits) {\n if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {\n result[k] = dur.get(k) + this.get(k);\n }\n }\n\n return clone(this, { values: result }, true);\n }\n\n /**\n * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n minus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration);\n return this.plus(dur.negate());\n }\n\n /**\n * Scale this Duration by the specified amount. Return a newly-constructed Duration.\n * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 }\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === \"hours\" ? x * 2 : x) //=> { hours: 2, minutes: 30 }\n * @return {Duration}\n */\n mapUnits(fn) {\n if (!this.isValid) return this;\n const result = {};\n for (const k of Object.keys(this.values)) {\n result[k] = asNumber(fn(this.values[k], k));\n }\n return clone(this, { values: result }, true);\n }\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2\n * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0\n * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3\n * @return {number}\n */\n get(unit) {\n return this[Duration.normalizeUnit(unit)];\n }\n\n /**\n * \"Set\" the values of specified units. Return a newly-constructed Duration.\n * @param {Object} values - a mapping of units to numbers\n * @example dur.set({ years: 2017 })\n * @example dur.set({ hours: 8, minutes: 30 })\n * @return {Duration}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const mixed = { ...this.values, ...normalizeObject(values, Duration.normalizeUnit) };\n return clone(this, { values: mixed });\n }\n\n /**\n * \"Set\" the locale and/or numberingSystem. Returns a newly-constructed Duration.\n * @example dur.reconfigure({ locale: 'en-GB' })\n * @return {Duration}\n */\n reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem });\n const opts = { loc, matrix, conversionAccuracy };\n return clone(this, opts);\n }\n\n /**\n * Return the length of the duration in the specified unit.\n * @param {string} unit - a unit such as 'minutes' or 'days'\n * @example Duration.fromObject({years: 1}).as('days') //=> 365\n * @example Duration.fromObject({years: 1}).as('months') //=> 12\n * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5\n * @return {number}\n */\n as(unit) {\n return this.isValid ? this.shiftTo(unit).get(unit) : NaN;\n }\n\n /**\n * Reduce this Duration to its canonical representation in its current units.\n * Assuming the overall value of the Duration is positive, this means:\n * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)\n * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise\n * the overall value would be negative, see third example)\n * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)\n *\n * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.\n * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }\n * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 }\n * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }\n * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 }\n * @return {Duration}\n */\n normalize() {\n if (!this.isValid) return this;\n const vals = this.toObject();\n normalizeValues(this.matrix, vals);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Rescale units to its largest representation\n * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 }\n * @return {Duration}\n */\n rescale() {\n if (!this.isValid) return this;\n const vals = removeZeroes(this.normalize().shiftToAll().toObject());\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Convert this Duration into its representation in a different set of units.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }\n * @return {Duration}\n */\n shiftTo(...units) {\n if (!this.isValid) return this;\n\n if (units.length === 0) {\n return this;\n }\n\n units = units.map((u) => Duration.normalizeUnit(u));\n\n const built = {},\n accumulated = {},\n vals = this.toObject();\n let lastUnit;\n\n for (const k of orderedUnits) {\n if (units.indexOf(k) >= 0) {\n lastUnit = k;\n\n let own = 0;\n\n // anything we haven't boiled down yet should get boiled to this unit\n for (const ak in accumulated) {\n own += this.matrix[ak][k] * accumulated[ak];\n accumulated[ak] = 0;\n }\n\n // plus anything that's already in this unit\n if (isNumber(vals[k])) {\n own += vals[k];\n }\n\n // only keep the integer part for now in the hopes of putting any decimal part\n // into a smaller unit later\n const i = Math.trunc(own);\n built[k] = i;\n accumulated[k] = (own * 1000 - i * 1000) / 1000;\n\n // otherwise, keep it in the wings to boil it later\n } else if (isNumber(vals[k])) {\n accumulated[k] = vals[k];\n }\n }\n\n // anything leftover becomes the decimal for the last unit\n // lastUnit must be defined since units is not empty\n for (const key in accumulated) {\n if (accumulated[key] !== 0) {\n built[lastUnit] +=\n key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];\n }\n }\n\n normalizeValues(this.matrix, built);\n return clone(this, { values: built }, true);\n }\n\n /**\n * Shift this Duration to all available units.\n * Same as shiftTo(\"years\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", \"seconds\", \"milliseconds\")\n * @return {Duration}\n */\n shiftToAll() {\n if (!this.isValid) return this;\n return this.shiftTo(\n \"years\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\"\n );\n }\n\n /**\n * Return the negative of this Duration.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }\n * @return {Duration}\n */\n negate() {\n if (!this.isValid) return this;\n const negated = {};\n for (const k of Object.keys(this.values)) {\n negated[k] = this.values[k] === 0 ? 0 : -this.values[k];\n }\n return clone(this, { values: negated }, true);\n }\n\n /**\n * Removes all units with values equal to 0 from this Duration.\n * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 }\n * @return {Duration}\n */\n removeZeros() {\n if (!this.isValid) return this;\n const vals = removeZeroes(this.values);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Get the years.\n * @type {number}\n */\n get years() {\n return this.isValid ? this.values.years || 0 : NaN;\n }\n\n /**\n * Get the quarters.\n * @type {number}\n */\n get quarters() {\n return this.isValid ? this.values.quarters || 0 : NaN;\n }\n\n /**\n * Get the months.\n * @type {number}\n */\n get months() {\n return this.isValid ? this.values.months || 0 : NaN;\n }\n\n /**\n * Get the weeks\n * @type {number}\n */\n get weeks() {\n return this.isValid ? this.values.weeks || 0 : NaN;\n }\n\n /**\n * Get the days.\n * @type {number}\n */\n get days() {\n return this.isValid ? this.values.days || 0 : NaN;\n }\n\n /**\n * Get the hours.\n * @type {number}\n */\n get hours() {\n return this.isValid ? this.values.hours || 0 : NaN;\n }\n\n /**\n * Get the minutes.\n * @type {number}\n */\n get minutes() {\n return this.isValid ? this.values.minutes || 0 : NaN;\n }\n\n /**\n * Get the seconds.\n * @return {number}\n */\n get seconds() {\n return this.isValid ? this.values.seconds || 0 : NaN;\n }\n\n /**\n * Get the milliseconds.\n * @return {number}\n */\n get milliseconds() {\n return this.isValid ? this.values.milliseconds || 0 : NaN;\n }\n\n /**\n * Returns whether the Duration is invalid. Invalid durations are returned by diff operations\n * on invalid DateTimes or Intervals.\n * @return {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this Duration became invalid, or null if the Duration is valid\n * @return {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Duration became invalid, or null if the Duration is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Equality check\n * Two Durations are equal iff they have the same units and the same values for each unit.\n * @param {Duration} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n if (!this.loc.equals(other.loc)) {\n return false;\n }\n\n function eq(v1, v2) {\n // Consider 0 and undefined as equal\n if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0;\n return v1 === v2;\n }\n\n for (const u of orderedUnits) {\n if (!eq(this.values[u], other.values[u])) {\n return false;\n }\n }\n return true;\n }\n}\n","import DateTime, { friendlyDateTime } from \"./datetime.js\";\nimport Duration from \"./duration.js\";\nimport Settings from \"./settings.js\";\nimport { InvalidArgumentError, InvalidIntervalError } from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport * as Formats from \"./impl/formats.js\";\n\nconst INVALID = \"Invalid Interval\";\n\n// checks if the start is equal to or before the end\nfunction validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\n \"end before start\",\n `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`\n );\n } else {\n return null;\n }\n}\n\n/**\n * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.\n *\n * Here is a brief overview of the most commonly used methods and getters in Interval:\n *\n * * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}.\n * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end.\n * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}.\n * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}.\n * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}\n * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}.\n */\nexport default class Interval {\n /**\n * @private\n */\n constructor(config) {\n /**\n * @access private\n */\n this.s = config.start;\n /**\n * @access private\n */\n this.e = config.end;\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.isLuxonInterval = true;\n }\n\n /**\n * Create an invalid Interval.\n * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Interval}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Interval is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidIntervalError(invalid);\n } else {\n return new Interval({ invalid });\n }\n }\n\n /**\n * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.\n * @param {DateTime|Date|Object} start\n * @param {DateTime|Date|Object} end\n * @return {Interval}\n */\n static fromDateTimes(start, end) {\n const builtStart = friendlyDateTime(start),\n builtEnd = friendlyDateTime(end);\n\n const validateError = validateStartEnd(builtStart, builtEnd);\n\n if (validateError == null) {\n return new Interval({\n start: builtStart,\n end: builtEnd,\n });\n } else {\n return validateError;\n }\n }\n\n /**\n * Create an Interval from a start DateTime and a Duration to extend to.\n * @param {DateTime|Date|Object} start\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static after(start, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(start);\n return Interval.fromDateTimes(dt, dt.plus(dur));\n }\n\n /**\n * Create an Interval from an end DateTime and a Duration to extend backwards to.\n * @param {DateTime|Date|Object} end\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static before(end, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(end);\n return Interval.fromDateTimes(dt.minus(dur), dt);\n }\n\n /**\n * Create an Interval from an ISO 8601 string.\n * Accepts `/`, `/`, and `/` formats.\n * @param {string} text - the ISO string to parse\n * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO}\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {Interval}\n */\n static fromISO(text, opts) {\n const [s, e] = (text || \"\").split(\"/\", 2);\n if (s && e) {\n let start, startIsValid;\n try {\n start = DateTime.fromISO(s, opts);\n startIsValid = start.isValid;\n } catch (e) {\n startIsValid = false;\n }\n\n let end, endIsValid;\n try {\n end = DateTime.fromISO(e, opts);\n endIsValid = end.isValid;\n } catch (e) {\n endIsValid = false;\n }\n\n if (startIsValid && endIsValid) {\n return Interval.fromDateTimes(start, end);\n }\n\n if (startIsValid) {\n const dur = Duration.fromISO(e, opts);\n if (dur.isValid) {\n return Interval.after(start, dur);\n }\n } else if (endIsValid) {\n const dur = Duration.fromISO(s, opts);\n if (dur.isValid) {\n return Interval.before(end, dur);\n }\n }\n }\n return Interval.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n\n /**\n * Check if an object is an Interval. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isInterval(o) {\n return (o && o.isLuxonInterval) || false;\n }\n\n /**\n * Returns the start of the Interval\n * @type {DateTime}\n */\n get start() {\n return this.isValid ? this.s : null;\n }\n\n /**\n * Returns the end of the Interval. This is the first instant which is not part of the interval\n * (Interval is half-open).\n * @type {DateTime}\n */\n get end() {\n return this.isValid ? this.e : null;\n }\n\n /**\n * Returns the last DateTime included in the interval (since end is not part of the interval)\n * @type {DateTime}\n */\n get lastDateTime() {\n return this.isValid ? (this.e ? this.e.minus(1) : null) : null;\n }\n\n /**\n * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.\n * @type {boolean}\n */\n get isValid() {\n return this.invalidReason === null;\n }\n\n /**\n * Returns an error code if this Interval is invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Interval became invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Returns the length of the Interval in the specified unit.\n * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.\n * @return {number}\n */\n length(unit = \"milliseconds\") {\n return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;\n }\n\n /**\n * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.\n * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'\n * asks 'what dates are included in this interval?', not 'how many days long is this interval?'\n * @param {string} [unit='milliseconds'] - the unit of time to count.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime\n * @return {number}\n */\n count(unit = \"milliseconds\", opts) {\n if (!this.isValid) return NaN;\n const start = this.start.startOf(unit, opts);\n let end;\n if (opts?.useLocaleWeeks) {\n end = this.end.reconfigure({ locale: start.locale });\n } else {\n end = this.end;\n }\n end = end.startOf(unit, opts);\n return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());\n }\n\n /**\n * Returns whether this Interval's start and end are both in the same unit of time\n * @param {string} unit - the unit of time to check sameness on\n * @return {boolean}\n */\n hasSame(unit) {\n return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;\n }\n\n /**\n * Return whether this Interval has the same start and end DateTimes.\n * @return {boolean}\n */\n isEmpty() {\n return this.s.valueOf() === this.e.valueOf();\n }\n\n /**\n * Return whether this Interval's start is after the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isAfter(dateTime) {\n if (!this.isValid) return false;\n return this.s > dateTime;\n }\n\n /**\n * Return whether this Interval's end is before the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isBefore(dateTime) {\n if (!this.isValid) return false;\n return this.e <= dateTime;\n }\n\n /**\n * Return whether this Interval contains the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n contains(dateTime) {\n if (!this.isValid) return false;\n return this.s <= dateTime && this.e > dateTime;\n }\n\n /**\n * \"Sets\" the start and/or end dates. Returns a newly-constructed Interval.\n * @param {Object} values - the values to set\n * @param {DateTime} values.start - the starting DateTime\n * @param {DateTime} values.end - the ending DateTime\n * @return {Interval}\n */\n set({ start, end } = {}) {\n if (!this.isValid) return this;\n return Interval.fromDateTimes(start || this.s, end || this.e);\n }\n\n /**\n * Split this Interval at each of the specified DateTimes\n * @param {...DateTime} dateTimes - the unit of time to count.\n * @return {Array}\n */\n splitAt(...dateTimes) {\n if (!this.isValid) return [];\n const sorted = dateTimes\n .map(friendlyDateTime)\n .filter((d) => this.contains(d))\n .sort((a, b) => a.toMillis() - b.toMillis()),\n results = [];\n let { s } = this,\n i = 0;\n\n while (s < this.e) {\n const added = sorted[i] || this.e,\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n i += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into smaller Intervals, each of the specified length.\n * Left over time is grouped into a smaller interval\n * @param {Duration|Object|number} duration - The length of each resulting interval.\n * @return {Array}\n */\n splitBy(duration) {\n const dur = Duration.fromDurationLike(duration);\n\n if (!this.isValid || !dur.isValid || dur.as(\"milliseconds\") === 0) {\n return [];\n }\n\n let { s } = this,\n idx = 1,\n next;\n\n const results = [];\n while (s < this.e) {\n const added = this.start.plus(dur.mapUnits((x) => x * idx));\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n idx += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into the specified number of smaller intervals.\n * @param {number} numberOfParts - The number of Intervals to divide the Interval into.\n * @return {Array}\n */\n divideEqually(numberOfParts) {\n if (!this.isValid) return [];\n return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);\n }\n\n /**\n * Return whether this Interval overlaps with the specified Interval\n * @param {Interval} other\n * @return {boolean}\n */\n overlaps(other) {\n return this.e > other.s && this.s < other.e;\n }\n\n /**\n * Return whether this Interval's end is adjacent to the specified Interval's start.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsStart(other) {\n if (!this.isValid) return false;\n return +this.e === +other.s;\n }\n\n /**\n * Return whether this Interval's start is adjacent to the specified Interval's end.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsEnd(other) {\n if (!this.isValid) return false;\n return +other.e === +this.s;\n }\n\n /**\n * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise.\n * @param {Interval} other\n * @return {boolean}\n */\n engulfs(other) {\n if (!this.isValid) return false;\n return this.s <= other.s && this.e >= other.e;\n }\n\n /**\n * Return whether this Interval has the same start and end as the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n return this.s.equals(other.s) && this.e.equals(other.e);\n }\n\n /**\n * Return an Interval representing the intersection of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.\n * Returns null if the intersection is empty, meaning, the intervals don't intersect.\n * @param {Interval} other\n * @return {Interval}\n */\n intersection(other) {\n if (!this.isValid) return this;\n const s = this.s > other.s ? this.s : other.s,\n e = this.e < other.e ? this.e : other.e;\n\n if (s >= e) {\n return null;\n } else {\n return Interval.fromDateTimes(s, e);\n }\n }\n\n /**\n * Return an Interval representing the union of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.\n * @param {Interval} other\n * @return {Interval}\n */\n union(other) {\n if (!this.isValid) return this;\n const s = this.s < other.s ? this.s : other.s,\n e = this.e > other.e ? this.e : other.e;\n return Interval.fromDateTimes(s, e);\n }\n\n /**\n * Merge an array of Intervals into an equivalent minimal set of Intervals.\n * Combines overlapping and adjacent Intervals.\n * The resulting array will contain the Intervals in ascending order, that is, starting with the earliest Interval\n * and ending with the latest.\n *\n * @param {Array} intervals\n * @return {Array}\n */\n static merge(intervals) {\n const [found, final] = intervals\n .sort((a, b) => a.s - b.s)\n .reduce(\n ([sofar, current], item) => {\n if (!current) {\n return [sofar, item];\n } else if (current.overlaps(item) || current.abutsStart(item)) {\n return [sofar, current.union(item)];\n } else {\n return [sofar.concat([current]), item];\n }\n },\n [[], null]\n );\n if (final) {\n found.push(final);\n }\n return found;\n }\n\n /**\n * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.\n * @param {Array} intervals\n * @return {Array}\n */\n static xor(intervals) {\n let start = null,\n currentCount = 0;\n const results = [],\n ends = intervals.map((i) => [\n { time: i.s, type: \"s\" },\n { time: i.e, type: \"e\" },\n ]),\n flattened = Array.prototype.concat(...ends),\n arr = flattened.sort((a, b) => a.time - b.time);\n\n for (const i of arr) {\n currentCount += i.type === \"s\" ? 1 : -1;\n\n if (currentCount === 1) {\n start = i.time;\n } else {\n if (start && +start !== +i.time) {\n results.push(Interval.fromDateTimes(start, i.time));\n }\n\n start = null;\n }\n }\n\n return Interval.merge(results);\n }\n\n /**\n * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.\n * @param {...Interval} intervals\n * @return {Array}\n */\n difference(...intervals) {\n return Interval.xor([this].concat(intervals))\n .map((i) => this.intersection(i))\n .filter((i) => i && !i.isEmpty());\n }\n\n /**\n * Returns a string representation of this Interval appropriate for debugging.\n * @return {string}\n */\n toString() {\n if (!this.isValid) return INVALID;\n return `[${this.s.toISO()} – ${this.e.toISO()})`;\n }\n\n /**\n * Returns a string representation of this Interval appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;\n } else {\n return `Interval { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns a localized string representing this Interval. Accepts the same options as the\n * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as\n * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method\n * is browser-specific, but in general it will return an appropriate representation of the\n * Interval in the assigned locale. Defaults to the system's locale if no locale has been\n * specified.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or\n * Intl.DateTimeFormat constructor options.\n * @param {Object} opts - Options to override the configuration of the start DateTime.\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022\n * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM\n * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p\n * @return {string}\n */\n toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) {\n return this.isValid\n ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this)\n : INVALID;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Interval.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISO(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of date of this Interval.\n * The time components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {string}\n */\n toISODate() {\n if (!this.isValid) return INVALID;\n return `${this.s.toISODate()}/${this.e.toISODate()}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of time of this Interval.\n * The date components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISOTime(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this Interval formatted according to the specified format\n * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible\n * formatting tool.\n * @param {string} dateFormat - The format string. This string formats the start and end time.\n * See {@link DateTime#toFormat} for details.\n * @param {Object} opts - Options.\n * @param {string} [opts.separator = ' – '] - A separator to place between the start and end\n * representations.\n * @return {string}\n */\n toFormat(dateFormat, { separator = \" – \" } = {}) {\n if (!this.isValid) return INVALID;\n return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;\n }\n\n /**\n * Return a Duration representing the time spanned by this interval.\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }\n * @return {Duration}\n */\n toDuration(unit, opts) {\n if (!this.isValid) {\n return Duration.invalid(this.invalidReason);\n }\n return this.e.diff(this.s, unit, opts);\n }\n\n /**\n * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes\n * @param {function} mapFn\n * @return {Interval}\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))\n */\n mapEndpoints(mapFn) {\n return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Settings from \"./settings.js\";\nimport Locale from \"./impl/locale.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nimport { hasLocaleWeekInfo, hasRelative } from \"./impl/util.js\";\n\n/**\n * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.\n */\nexport default class Info {\n /**\n * Return whether the specified zone contains a DST.\n * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.\n * @return {boolean}\n */\n static hasDST(zone = Settings.defaultZone) {\n const proto = DateTime.now().setZone(zone).set({ month: 12 });\n\n return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset;\n }\n\n /**\n * Return whether the specified zone is a valid IANA specifier.\n * @param {string} zone - Zone to check\n * @return {boolean}\n */\n static isValidIANAZone(zone) {\n return IANAZone.isValidZone(zone);\n }\n\n /**\n * Converts the input into a {@link Zone} instance.\n *\n * * If `input` is already a Zone instance, it is returned unchanged.\n * * If `input` is a string containing a valid time zone name, a Zone instance\n * with that name is returned.\n * * If `input` is a string that doesn't refer to a known time zone, a Zone\n * instance with {@link Zone#isValid} == false is returned.\n * * If `input is a number, a Zone instance with the specified fixed offset\n * in minutes is returned.\n * * If `input` is `null` or `undefined`, the default zone is returned.\n * @param {string|Zone|number} [input] - the value to be converted\n * @return {Zone}\n */\n static normalizeZone(input) {\n return normalizeZone(input, Settings.defaultZone);\n }\n\n /**\n * Get the weekday on which the week starts according to the given locale.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number} the start of the week, 1 for Monday through 7 for Sunday\n */\n static getStartOfWeek({ locale = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale)).getStartOfWeek();\n }\n\n /**\n * Get the minimum number of days necessary in a week before it is considered part of the next year according\n * to the given locale.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number}\n */\n static getMinimumDaysInFirstWeek({ locale = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();\n }\n\n /**\n * Get the weekdays, which are considered the weekend according to the given locale\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday\n */\n static getWeekendWeekdays({ locale = null, locObj = null } = {}) {\n // copy the array, because we cache it internally\n return (locObj || Locale.create(locale)).getWeekendDays().slice();\n }\n\n /**\n * Return an array of standalone month names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @example Info.months()[0] //=> 'January'\n * @example Info.months('short')[0] //=> 'Jan'\n * @example Info.months('numeric')[0] //=> '1'\n * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'\n * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'\n * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'\n * @return {Array}\n */\n static months(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);\n }\n\n /**\n * Return an array of format month names.\n * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that\n * changes the string.\n * See {@link Info#months}\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @return {Array}\n */\n static monthsFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);\n }\n\n /**\n * Return an array of standalone week names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the weekday representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @example Info.weekdays()[0] //=> 'Monday'\n * @example Info.weekdays('short')[0] //=> 'Mon'\n * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'\n * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'\n * @return {Array}\n */\n static weekdays(length = \"long\", { locale = null, numberingSystem = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);\n }\n\n /**\n * Return an array of format week names.\n * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that\n * changes the string.\n * See {@link Info#weekdays}\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale=null] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @return {Array}\n */\n static weekdaysFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);\n }\n\n /**\n * Return an array of meridiems.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.meridiems() //=> [ 'AM', 'PM' ]\n * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]\n * @return {Array}\n */\n static meridiems({ locale = null } = {}) {\n return Locale.create(locale).meridiems();\n }\n\n /**\n * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.\n * @param {string} [length='short'] - the length of the era representation, such as \"short\" or \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.eras() //=> [ 'BC', 'AD' ]\n * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]\n * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]\n * @return {Array}\n */\n static eras(length = \"short\", { locale = null } = {}) {\n return Locale.create(locale, null, \"gregory\").eras(length);\n }\n\n /**\n * Return the set of available features in this environment.\n * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.\n * Keys:\n * * `relative`: whether this environment supports relative time formatting\n * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale\n * @example Info.features() //=> { relative: false, localeWeek: true }\n * @return {Object}\n */\n static features() {\n return { relative: hasRelative(), localeWeek: hasLocaleWeekInfo() };\n }\n}\n","import Duration from \"../duration.js\";\n\nfunction dayDiff(earlier, later) {\n const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf(\"day\").valueOf(),\n ms = utcDayStart(later) - utcDayStart(earlier);\n return Math.floor(Duration.fromMillis(ms).as(\"days\"));\n}\n\nfunction highOrderDiffs(cursor, later, units) {\n const differs = [\n [\"years\", (a, b) => b.year - a.year],\n [\"quarters\", (a, b) => b.quarter - a.quarter + (b.year - a.year) * 4],\n [\"months\", (a, b) => b.month - a.month + (b.year - a.year) * 12],\n [\n \"weeks\",\n (a, b) => {\n const days = dayDiff(a, b);\n return (days - (days % 7)) / 7;\n },\n ],\n [\"days\", dayDiff],\n ];\n\n const results = {};\n const earlier = cursor;\n let lowestOrder, highWater;\n\n /* This loop tries to diff using larger units first.\n If we overshoot, we backtrack and try the next smaller unit.\n \"cursor\" starts out at the earlier timestamp and moves closer and closer to \"later\"\n as we use smaller and smaller units.\n highWater keeps track of where we would be if we added one more of the smallest unit,\n this is used later to potentially convert any difference smaller than the smallest higher order unit\n into a fraction of that smallest higher order unit\n */\n for (const [unit, differ] of differs) {\n if (units.indexOf(unit) >= 0) {\n lowestOrder = unit;\n\n results[unit] = differ(cursor, later);\n highWater = earlier.plus(results);\n\n if (highWater > later) {\n // we overshot the end point, backtrack cursor by 1\n results[unit]--;\n cursor = earlier.plus(results);\n\n // if we are still overshooting now, we need to backtrack again\n // this happens in certain situations when diffing times in different zones,\n // because this calculation ignores time zones\n if (cursor > later) {\n // keep the \"overshot by 1\" around as highWater\n highWater = cursor;\n // backtrack cursor by 1\n results[unit]--;\n cursor = earlier.plus(results);\n }\n } else {\n cursor = highWater;\n }\n }\n }\n\n return [cursor, results, highWater, lowestOrder];\n}\n\nexport default function (earlier, later, units, opts) {\n let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);\n\n const remainingMillis = later - cursor;\n\n const lowerOrderUnits = units.filter(\n (u) => [\"hours\", \"minutes\", \"seconds\", \"milliseconds\"].indexOf(u) >= 0\n );\n\n if (lowerOrderUnits.length === 0) {\n if (highWater < later) {\n highWater = cursor.plus({ [lowestOrder]: 1 });\n }\n\n if (highWater !== cursor) {\n results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);\n }\n }\n\n const duration = Duration.fromObject(results, opts);\n\n if (lowerOrderUnits.length > 0) {\n return Duration.fromMillis(remainingMillis, opts)\n .shiftTo(...lowerOrderUnits)\n .plus(duration);\n } else {\n return duration;\n }\n}\n","import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from \"./util.js\";\nimport Formatter from \"./formatter.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport DateTime from \"../datetime.js\";\nimport { digitRegex, parseDigits } from \"./digits.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst MISSING_FTP = \"missing Intl.DateTimeFormat.formatToParts support\";\n\nfunction intUnit(regex, post = (i) => i) {\n return { regex, deser: ([s]) => post(parseDigits(s)) };\n}\n\nconst NBSP = String.fromCharCode(160);\nconst spaceOrNBSP = `[ ${NBSP}]`;\nconst spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, \"g\");\n\nfunction fixListRegex(s) {\n // make dots optional and also make them literal\n // make space and non breakable space characters interchangeable\n return s.replace(/\\./g, \"\\\\.?\").replace(spaceOrNBSPRegExp, spaceOrNBSP);\n}\n\nfunction stripInsensitivities(s) {\n return s\n .replace(/\\./g, \"\") // ignore dots that were made optional\n .replace(spaceOrNBSPRegExp, \" \") // interchange space and nbsp\n .toLowerCase();\n}\n\nfunction oneOf(strings, startIndex) {\n if (strings === null) {\n return null;\n } else {\n return {\n regex: RegExp(strings.map(fixListRegex).join(\"|\")),\n deser: ([s]) =>\n strings.findIndex((i) => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex,\n };\n }\n}\n\nfunction offset(regex, groups) {\n return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };\n}\n\nfunction simple(regex) {\n return { regex, deser: ([s]) => s };\n}\n\nfunction escapeToken(value) {\n return value.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n}\n\n/**\n * @param token\n * @param {Locale} loc\n */\nfunction unitForToken(token, loc) {\n const one = digitRegex(loc),\n two = digitRegex(loc, \"{2}\"),\n three = digitRegex(loc, \"{3}\"),\n four = digitRegex(loc, \"{4}\"),\n six = digitRegex(loc, \"{6}\"),\n oneOrTwo = digitRegex(loc, \"{1,2}\"),\n oneToThree = digitRegex(loc, \"{1,3}\"),\n oneToSix = digitRegex(loc, \"{1,6}\"),\n oneToNine = digitRegex(loc, \"{1,9}\"),\n twoToFour = digitRegex(loc, \"{2,4}\"),\n fourToSix = digitRegex(loc, \"{4,6}\"),\n literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }),\n unitate = (t) => {\n if (token.literal) {\n return literal(t);\n }\n switch (t.val) {\n // era\n case \"G\":\n return oneOf(loc.eras(\"short\"), 0);\n case \"GG\":\n return oneOf(loc.eras(\"long\"), 0);\n // years\n case \"y\":\n return intUnit(oneToSix);\n case \"yy\":\n return intUnit(twoToFour, untruncateYear);\n case \"yyyy\":\n return intUnit(four);\n case \"yyyyy\":\n return intUnit(fourToSix);\n case \"yyyyyy\":\n return intUnit(six);\n // months\n case \"M\":\n return intUnit(oneOrTwo);\n case \"MM\":\n return intUnit(two);\n case \"MMM\":\n return oneOf(loc.months(\"short\", true), 1);\n case \"MMMM\":\n return oneOf(loc.months(\"long\", true), 1);\n case \"L\":\n return intUnit(oneOrTwo);\n case \"LL\":\n return intUnit(two);\n case \"LLL\":\n return oneOf(loc.months(\"short\", false), 1);\n case \"LLLL\":\n return oneOf(loc.months(\"long\", false), 1);\n // dates\n case \"d\":\n return intUnit(oneOrTwo);\n case \"dd\":\n return intUnit(two);\n // ordinals\n case \"o\":\n return intUnit(oneToThree);\n case \"ooo\":\n return intUnit(three);\n // time\n case \"HH\":\n return intUnit(two);\n case \"H\":\n return intUnit(oneOrTwo);\n case \"hh\":\n return intUnit(two);\n case \"h\":\n return intUnit(oneOrTwo);\n case \"mm\":\n return intUnit(two);\n case \"m\":\n return intUnit(oneOrTwo);\n case \"q\":\n return intUnit(oneOrTwo);\n case \"qq\":\n return intUnit(two);\n case \"s\":\n return intUnit(oneOrTwo);\n case \"ss\":\n return intUnit(two);\n case \"S\":\n return intUnit(oneToThree);\n case \"SSS\":\n return intUnit(three);\n case \"u\":\n return simple(oneToNine);\n case \"uu\":\n return simple(oneOrTwo);\n case \"uuu\":\n return intUnit(one);\n // meridiem\n case \"a\":\n return oneOf(loc.meridiems(), 0);\n // weekYear (k)\n case \"kkkk\":\n return intUnit(four);\n case \"kk\":\n return intUnit(twoToFour, untruncateYear);\n // weekNumber (W)\n case \"W\":\n return intUnit(oneOrTwo);\n case \"WW\":\n return intUnit(two);\n // weekdays\n case \"E\":\n case \"c\":\n return intUnit(one);\n case \"EEE\":\n return oneOf(loc.weekdays(\"short\", false), 1);\n case \"EEEE\":\n return oneOf(loc.weekdays(\"long\", false), 1);\n case \"ccc\":\n return oneOf(loc.weekdays(\"short\", true), 1);\n case \"cccc\":\n return oneOf(loc.weekdays(\"long\", true), 1);\n // offset/zone\n case \"Z\":\n case \"ZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);\n case \"ZZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);\n // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing\n // because we don't have any way to figure out what they are\n case \"z\":\n return simple(/[a-z_+-/]{1,256}?/i);\n // this special-case \"token\" represents a place where a macro-token expanded into a white-space literal\n // in this case we accept any non-newline white-space\n case \" \":\n return simple(/[^\\S\\n\\r]/);\n default:\n return literal(t);\n }\n };\n\n const unit = unitate(token) || {\n invalidReason: MISSING_FTP,\n };\n\n unit.token = token;\n\n return unit;\n}\n\nconst partTypeStyleToTokenVal = {\n year: {\n \"2-digit\": \"yy\",\n numeric: \"yyyyy\",\n },\n month: {\n numeric: \"M\",\n \"2-digit\": \"MM\",\n short: \"MMM\",\n long: \"MMMM\",\n },\n day: {\n numeric: \"d\",\n \"2-digit\": \"dd\",\n },\n weekday: {\n short: \"EEE\",\n long: \"EEEE\",\n },\n dayperiod: \"a\",\n dayPeriod: \"a\",\n hour12: {\n numeric: \"h\",\n \"2-digit\": \"hh\",\n },\n hour24: {\n numeric: \"H\",\n \"2-digit\": \"HH\",\n },\n minute: {\n numeric: \"m\",\n \"2-digit\": \"mm\",\n },\n second: {\n numeric: \"s\",\n \"2-digit\": \"ss\",\n },\n timeZoneName: {\n long: \"ZZZZZ\",\n short: \"ZZZ\",\n },\n};\n\nfunction tokenForPart(part, formatOpts, resolvedOpts) {\n const { type, value } = part;\n\n if (type === \"literal\") {\n const isSpace = /^\\s+$/.test(value);\n return {\n literal: !isSpace,\n val: isSpace ? \" \" : value,\n };\n }\n\n const style = formatOpts[type];\n\n // The user might have explicitly specified hour12 or hourCycle\n // if so, respect their decision\n // if not, refer back to the resolvedOpts, which are based on the locale\n let actualType = type;\n if (type === \"hour\") {\n if (formatOpts.hour12 != null) {\n actualType = formatOpts.hour12 ? \"hour12\" : \"hour24\";\n } else if (formatOpts.hourCycle != null) {\n if (formatOpts.hourCycle === \"h11\" || formatOpts.hourCycle === \"h12\") {\n actualType = \"hour12\";\n } else {\n actualType = \"hour24\";\n }\n } else {\n // tokens only differentiate between 24 hours or not,\n // so we do not need to check hourCycle here, which is less supported anyways\n actualType = resolvedOpts.hour12 ? \"hour12\" : \"hour24\";\n }\n }\n let val = partTypeStyleToTokenVal[actualType];\n if (typeof val === \"object\") {\n val = val[style];\n }\n\n if (val) {\n return {\n literal: false,\n val,\n };\n }\n\n return undefined;\n}\n\nfunction buildRegex(units) {\n const re = units.map((u) => u.regex).reduce((f, r) => `${f}(${r.source})`, \"\");\n return [`^${re}$`, units];\n}\n\nfunction match(input, regex, handlers) {\n const matches = input.match(regex);\n\n if (matches) {\n const all = {};\n let matchIndex = 1;\n for (const i in handlers) {\n if (hasOwnProperty(handlers, i)) {\n const h = handlers[i],\n groups = h.groups ? h.groups + 1 : 1;\n if (!h.literal && h.token) {\n all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));\n }\n matchIndex += groups;\n }\n }\n return [matches, all];\n } else {\n return [matches, {}];\n }\n}\n\nfunction dateTimeFromMatches(matches) {\n const toField = (token) => {\n switch (token) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n case \"H\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"o\":\n return \"ordinal\";\n case \"L\":\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n case \"E\":\n case \"c\":\n return \"weekday\";\n case \"W\":\n return \"weekNumber\";\n case \"k\":\n return \"weekYear\";\n case \"q\":\n return \"quarter\";\n default:\n return null;\n }\n };\n\n let zone = null;\n let specificOffset;\n if (!isUndefined(matches.z)) {\n zone = IANAZone.create(matches.z);\n }\n\n if (!isUndefined(matches.Z)) {\n if (!zone) {\n zone = new FixedOffsetZone(matches.Z);\n }\n specificOffset = matches.Z;\n }\n\n if (!isUndefined(matches.q)) {\n matches.M = (matches.q - 1) * 3 + 1;\n }\n\n if (!isUndefined(matches.h)) {\n if (matches.h < 12 && matches.a === 1) {\n matches.h += 12;\n } else if (matches.h === 12 && matches.a === 0) {\n matches.h = 0;\n }\n }\n\n if (matches.G === 0 && matches.y) {\n matches.y = -matches.y;\n }\n\n if (!isUndefined(matches.u)) {\n matches.S = parseMillis(matches.u);\n }\n\n const vals = Object.keys(matches).reduce((r, k) => {\n const f = toField(k);\n if (f) {\n r[f] = matches[k];\n }\n\n return r;\n }, {});\n\n return [vals, zone, specificOffset];\n}\n\nlet dummyDateTimeCache = null;\n\nfunction getDummyDateTime() {\n if (!dummyDateTimeCache) {\n dummyDateTimeCache = DateTime.fromMillis(1555555555555);\n }\n\n return dummyDateTimeCache;\n}\n\nfunction maybeExpandMacroToken(token, locale) {\n if (token.literal) {\n return token;\n }\n\n const formatOpts = Formatter.macroTokenToFormatOpts(token.val);\n const tokens = formatOptsToTokens(formatOpts, locale);\n\n if (tokens == null || tokens.includes(undefined)) {\n return token;\n }\n\n return tokens;\n}\n\nexport function expandMacroTokens(tokens, locale) {\n return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale)));\n}\n\n/**\n * @private\n */\n\nexport class TokenParser {\n constructor(locale, format) {\n this.locale = locale;\n this.format = format;\n this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale);\n this.units = this.tokens.map((t) => unitForToken(t, locale));\n this.disqualifyingUnit = this.units.find((t) => t.invalidReason);\n\n if (!this.disqualifyingUnit) {\n const [regexString, handlers] = buildRegex(this.units);\n this.regex = RegExp(regexString, \"i\");\n this.handlers = handlers;\n }\n }\n\n explainFromTokens(input) {\n if (!this.isValid) {\n return { input, tokens: this.tokens, invalidReason: this.invalidReason };\n } else {\n const [rawMatches, matches] = match(input, this.regex, this.handlers),\n [result, zone, specificOffset] = matches\n ? dateTimeFromMatches(matches)\n : [null, null, undefined];\n if (hasOwnProperty(matches, \"a\") && hasOwnProperty(matches, \"H\")) {\n throw new ConflictingSpecificationError(\n \"Can't include meridiem when specifying 24-hour format\"\n );\n }\n return {\n input,\n tokens: this.tokens,\n regex: this.regex,\n rawMatches,\n matches,\n result,\n zone,\n specificOffset,\n };\n }\n }\n\n get isValid() {\n return !this.disqualifyingUnit;\n }\n\n get invalidReason() {\n return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null;\n }\n}\n\nexport function explainFromTokens(locale, input, format) {\n const parser = new TokenParser(locale, format);\n return parser.explainFromTokens(input);\n}\n\nexport function parseFromTokens(locale, input, format) {\n const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format);\n return [result, zone, specificOffset, invalidReason];\n}\n\nexport function formatOptsToTokens(formatOpts, locale) {\n if (!formatOpts) {\n return null;\n }\n\n const formatter = Formatter.create(locale, formatOpts);\n const df = formatter.dtFormatter(getDummyDateTime());\n const parts = df.formatToParts();\n const resolvedOpts = df.resolvedOptions();\n return parts.map((p) => tokenForPart(p, formatOpts, resolvedOpts));\n}\n","import Duration from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Settings from \"./settings.js\";\nimport Info from \"./info.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport {\n isUndefined,\n maybeArray,\n isDate,\n isNumber,\n bestBy,\n daysInMonth,\n daysInYear,\n isLeapYear,\n weeksInWeekYear,\n normalizeObject,\n roundTo,\n objToLocalTS,\n padStart,\n} from \"./impl/util.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport diff from \"./impl/diff.js\";\nimport { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from \"./impl/regexParser.js\";\nimport {\n parseFromTokens,\n explainFromTokens,\n formatOptsToTokens,\n expandMacroTokens,\n TokenParser,\n} from \"./impl/tokenParser.js\";\nimport {\n gregorianToWeek,\n weekToGregorian,\n gregorianToOrdinal,\n ordinalToGregorian,\n hasInvalidGregorianData,\n hasInvalidWeekData,\n hasInvalidOrdinalData,\n hasInvalidTimeData,\n usesLocalWeekValues,\n isoWeekdayToLocal,\n} from \"./impl/conversions.js\";\nimport * as Formats from \"./impl/formats.js\";\nimport {\n InvalidArgumentError,\n ConflictingSpecificationError,\n InvalidUnitError,\n InvalidDateTimeError,\n} from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid DateTime\";\nconst MAX_DATE = 8.64e15;\n\nfunction unsupportedZone(zone) {\n return new Invalid(\"unsupported zone\", `the zone \"${zone.name}\" is not supported`);\n}\n\n// we cache week data on the DT object and this intermediates the cache\n/**\n * @param {DateTime} dt\n */\nfunction possiblyCachedWeekData(dt) {\n if (dt.weekData === null) {\n dt.weekData = gregorianToWeek(dt.c);\n }\n return dt.weekData;\n}\n\n/**\n * @param {DateTime} dt\n */\nfunction possiblyCachedLocalWeekData(dt) {\n if (dt.localWeekData === null) {\n dt.localWeekData = gregorianToWeek(\n dt.c,\n dt.loc.getMinDaysInFirstWeek(),\n dt.loc.getStartOfWeek()\n );\n }\n return dt.localWeekData;\n}\n\n// clone really means, \"make a new object with these modifications\". all \"setters\" really use this\n// to create a new object while only changing some of the properties\nfunction clone(inst, alts) {\n const current = {\n ts: inst.ts,\n zone: inst.zone,\n c: inst.c,\n o: inst.o,\n loc: inst.loc,\n invalid: inst.invalid,\n };\n return new DateTime({ ...current, ...alts, old: current });\n}\n\n// find the right offset a given local time. The o input is our guess, which determines which\n// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)\nfunction fixOffset(localTS, o, tz) {\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - o * 60 * 1000;\n\n // Test whether the zone matches the offset for this ts\n const o2 = tz.offset(utcGuess);\n\n // If so, offset didn't change and we're done\n if (o === o2) {\n return [utcGuess, o];\n }\n\n // If not, change the ts by the difference in the offset\n utcGuess -= (o2 - o) * 60 * 1000;\n\n // If that gives us the local time we want, we're done\n const o3 = tz.offset(utcGuess);\n if (o2 === o3) {\n return [utcGuess, o2];\n }\n\n // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time\n return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];\n}\n\n// convert an epoch timestamp into a calendar object with the given offset\nfunction tsToObj(ts, offset) {\n ts += offset * 60 * 1000;\n\n const d = new Date(ts);\n\n return {\n year: d.getUTCFullYear(),\n month: d.getUTCMonth() + 1,\n day: d.getUTCDate(),\n hour: d.getUTCHours(),\n minute: d.getUTCMinutes(),\n second: d.getUTCSeconds(),\n millisecond: d.getUTCMilliseconds(),\n };\n}\n\n// convert a calendar object to a epoch timestamp\nfunction objToTS(obj, offset, zone) {\n return fixOffset(objToLocalTS(obj), offset, zone);\n}\n\n// create a new DT instance by adding a duration, adjusting for DSTs\nfunction adjustTime(inst, dur) {\n const oPre = inst.o,\n year = inst.c.year + Math.trunc(dur.years),\n month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3,\n c = {\n ...inst.c,\n year,\n month,\n day:\n Math.min(inst.c.day, daysInMonth(year, month)) +\n Math.trunc(dur.days) +\n Math.trunc(dur.weeks) * 7,\n },\n millisToAdd = Duration.fromObject({\n years: dur.years - Math.trunc(dur.years),\n quarters: dur.quarters - Math.trunc(dur.quarters),\n months: dur.months - Math.trunc(dur.months),\n weeks: dur.weeks - Math.trunc(dur.weeks),\n days: dur.days - Math.trunc(dur.days),\n hours: dur.hours,\n minutes: dur.minutes,\n seconds: dur.seconds,\n milliseconds: dur.milliseconds,\n }).as(\"milliseconds\"),\n localTS = objToLocalTS(c);\n\n let [ts, o] = fixOffset(localTS, oPre, inst.zone);\n\n if (millisToAdd !== 0) {\n ts += millisToAdd;\n // that could have changed the offset by going over a DST, but we want to keep the ts the same\n o = inst.zone.offset(ts);\n }\n\n return { ts, o };\n}\n\n// helper useful in turning the results of parsing into real dates\n// by handling the zone options\nfunction parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {\n const { setZone, zone } = opts;\n if ((parsed && Object.keys(parsed).length !== 0) || parsedZone) {\n const interpretationZone = parsedZone || zone,\n inst = DateTime.fromObject(parsed, {\n ...opts,\n zone: interpretationZone,\n specificOffset,\n });\n return setZone ? inst : inst.setZone(zone);\n } else {\n return DateTime.invalid(\n new Invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ${format}`)\n );\n }\n}\n\n// if you want to output a technical format (e.g. RFC 2822), this helper\n// helps handle the details\nfunction toTechFormat(dt, format, allowZ = true) {\n return dt.isValid\n ? Formatter.create(Locale.create(\"en-US\"), {\n allowZ,\n forceSimple: true,\n }).formatDateTimeFromString(dt, format)\n : null;\n}\n\nfunction toISODate(o, extended, precision) {\n const longFormat = o.c.year > 9999 || o.c.year < 0;\n let c = \"\";\n if (longFormat && o.c.year >= 0) c += \"+\";\n c += padStart(o.c.year, longFormat ? 6 : 4);\n if (precision === \"year\") return c;\n if (extended) {\n c += \"-\";\n c += padStart(o.c.month);\n if (precision === \"month\") return c;\n c += \"-\";\n } else {\n c += padStart(o.c.month);\n if (precision === \"month\") return c;\n }\n c += padStart(o.c.day);\n return c;\n}\n\nfunction toISOTime(\n o,\n extended,\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n) {\n let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0,\n c = \"\";\n switch (precision) {\n case \"day\":\n case \"month\":\n case \"year\":\n break;\n default:\n c += padStart(o.c.hour);\n if (precision === \"hour\") break;\n if (extended) {\n c += \":\";\n c += padStart(o.c.minute);\n if (precision === \"minute\") break;\n if (showSeconds) {\n c += \":\";\n c += padStart(o.c.second);\n }\n } else {\n c += padStart(o.c.minute);\n if (precision === \"minute\") break;\n if (showSeconds) {\n c += padStart(o.c.second);\n }\n }\n if (precision === \"second\") break;\n if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) {\n c += \".\";\n c += padStart(o.c.millisecond, 3);\n }\n }\n\n if (includeOffset) {\n if (o.isOffsetFixed && o.offset === 0 && !extendedZone) {\n c += \"Z\";\n } else if (o.o < 0) {\n c += \"-\";\n c += padStart(Math.trunc(-o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(-o.o % 60));\n } else {\n c += \"+\";\n c += padStart(Math.trunc(o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(o.o % 60));\n }\n }\n\n if (extendedZone) {\n c += \"[\" + o.zone.ianaName + \"]\";\n }\n return c;\n}\n\n// defaults for unspecified units in the supported calendars\nconst defaultUnitValues = {\n month: 1,\n day: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultWeekUnitValues = {\n weekNumber: 1,\n weekday: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultOrdinalUnitValues = {\n ordinal: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n };\n\n// Units in the supported calendars, sorted by bigness\nconst orderedUnits = [\"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"millisecond\"],\n orderedWeekUnits = [\n \"weekYear\",\n \"weekNumber\",\n \"weekday\",\n \"hour\",\n \"minute\",\n \"second\",\n \"millisecond\",\n ],\n orderedOrdinalUnits = [\"year\", \"ordinal\", \"hour\", \"minute\", \"second\", \"millisecond\"];\n\n// standardize case and plurality in units\nfunction normalizeUnit(unit) {\n const normalized = {\n year: \"year\",\n years: \"year\",\n month: \"month\",\n months: \"month\",\n day: \"day\",\n days: \"day\",\n hour: \"hour\",\n hours: \"hour\",\n minute: \"minute\",\n minutes: \"minute\",\n quarter: \"quarter\",\n quarters: \"quarter\",\n second: \"second\",\n seconds: \"second\",\n millisecond: \"millisecond\",\n milliseconds: \"millisecond\",\n weekday: \"weekday\",\n weekdays: \"weekday\",\n weeknumber: \"weekNumber\",\n weeksnumber: \"weekNumber\",\n weeknumbers: \"weekNumber\",\n weekyear: \"weekYear\",\n weekyears: \"weekYear\",\n ordinal: \"ordinal\",\n }[unit.toLowerCase()];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n}\n\nfunction normalizeUnitWithLocalWeeks(unit) {\n switch (unit.toLowerCase()) {\n case \"localweekday\":\n case \"localweekdays\":\n return \"localWeekday\";\n case \"localweeknumber\":\n case \"localweeknumbers\":\n return \"localWeekNumber\";\n case \"localweekyear\":\n case \"localweekyears\":\n return \"localWeekYear\";\n default:\n return normalizeUnit(unit);\n }\n}\n\n// cache offsets for zones based on the current timestamp when this function is\n// first called. When we are handling a datetime from components like (year,\n// month, day, hour) in a time zone, we need a guess about what the timezone\n// offset is so that we can convert into a UTC timestamp. One way is to find the\n// offset of now in the zone. The actual date may have a different offset (for\n// example, if we handle a date in June while we're in December in a zone that\n// observes DST), but we can check and adjust that.\n//\n// When handling many dates, calculating the offset for now every time is\n// expensive. It's just a guess, so we can cache the offset to use even if we\n// are right on a time change boundary (we'll just correct in the other\n// direction). Using a timestamp from first read is a slight optimization for\n// handling dates close to the current date, since those dates will usually be\n// in the same offset (we could set the timestamp statically, instead). We use a\n// single timestamp for all zones to make things a bit more predictable.\n//\n// This is safe for quickDT (used by local() and utc()) because we don't fill in\n// higher-order units from tsNow (as we do in fromObject, this requires that\n// offset is calculated from tsNow).\n/**\n * @param {Zone} zone\n * @return {number}\n */\nfunction guessOffsetForZone(zone) {\n if (zoneOffsetTs === undefined) {\n zoneOffsetTs = Settings.now();\n }\n\n // Do not cache anything but IANA zones, because it is not safe to do so.\n // Guessing an offset which is not present in the zone can cause wrong results from fixOffset\n if (zone.type !== \"iana\") {\n return zone.offset(zoneOffsetTs);\n }\n const zoneName = zone.name;\n let offsetGuess = zoneOffsetGuessCache.get(zoneName);\n if (offsetGuess === undefined) {\n offsetGuess = zone.offset(zoneOffsetTs);\n zoneOffsetGuessCache.set(zoneName, offsetGuess);\n }\n return offsetGuess;\n}\n\n// this is a dumbed down version of fromObject() that runs about 60% faster\n// but doesn't do any validation, makes a bunch of assumptions about what units\n// are present, and so on.\nfunction quickDT(obj, opts) {\n const zone = normalizeZone(opts.zone, Settings.defaultZone);\n if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n }\n\n const loc = Locale.fromObject(opts);\n\n let ts, o;\n\n // assume we have the higher-order units\n if (!isUndefined(obj.year)) {\n for (const u of orderedUnits) {\n if (isUndefined(obj[u])) {\n obj[u] = defaultUnitValues[u];\n }\n }\n\n const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n const offsetProvis = guessOffsetForZone(zone);\n [ts, o] = objToTS(obj, offsetProvis, zone);\n } else {\n ts = Settings.now();\n }\n\n return new DateTime({ ts, zone, loc, o });\n}\n\nfunction diffRelative(start, end, opts) {\n const round = isUndefined(opts.round) ? true : opts.round,\n rounding = isUndefined(opts.rounding) ? \"trunc\" : opts.rounding,\n format = (c, unit) => {\n c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? \"round\" : rounding);\n const formatter = end.loc.clone(opts).relFormatter(opts);\n return formatter.format(c, unit);\n },\n differ = (unit) => {\n if (opts.calendary) {\n if (!end.hasSame(start, unit)) {\n return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);\n } else return 0;\n } else {\n return end.diff(start, unit).get(unit);\n }\n };\n\n if (opts.unit) {\n return format(differ(opts.unit), opts.unit);\n }\n\n for (const unit of opts.units) {\n const count = differ(unit);\n if (Math.abs(count) >= 1) {\n return format(count, unit);\n }\n }\n return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);\n}\n\nfunction lastOpts(argList) {\n let opts = {},\n args;\n if (argList.length > 0 && typeof argList[argList.length - 1] === \"object\") {\n opts = argList[argList.length - 1];\n args = Array.from(argList).slice(0, argList.length - 1);\n } else {\n args = Array.from(argList);\n }\n return [opts, args];\n}\n\n/**\n * Timestamp to use for cached zone offset guesses (exposed for test)\n */\nlet zoneOffsetTs;\n/**\n * Cache for zone offset guesses (exposed for test).\n *\n * This optimizes quickDT via guessOffsetForZone to avoid repeated calls of\n * zone.offset().\n */\nconst zoneOffsetGuessCache = new Map();\n\n/**\n * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them.\n *\n * A DateTime comprises of:\n * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch.\n * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone).\n * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`.\n *\n * Here is a brief overview of the most commonly used functionality it provides:\n *\n * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}.\n * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month},\n * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors.\n * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors.\n * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors.\n * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}.\n * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}.\n *\n * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.\n */\nexport default class DateTime {\n /**\n * @access private\n */\n constructor(config) {\n const zone = config.zone || Settings.defaultZone;\n\n let invalid =\n config.invalid ||\n (Number.isNaN(config.ts) ? new Invalid(\"invalid input\") : null) ||\n (!zone.isValid ? unsupportedZone(zone) : null);\n /**\n * @access private\n */\n this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;\n\n let c = null,\n o = null;\n if (!invalid) {\n const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);\n\n if (unchanged) {\n [c, o] = [config.old.c, config.old.o];\n } else {\n // If an offset has been passed and we have not been called from\n // clone(), we can trust it and avoid the offset calculation.\n const ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts);\n c = tsToObj(this.ts, ot);\n invalid = Number.isNaN(c.year) ? new Invalid(\"invalid input\") : null;\n c = invalid ? null : c;\n o = invalid ? null : ot;\n }\n }\n\n /**\n * @access private\n */\n this._zone = zone;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.invalid = invalid;\n /**\n * @access private\n */\n this.weekData = null;\n /**\n * @access private\n */\n this.localWeekData = null;\n /**\n * @access private\n */\n this.c = c;\n /**\n * @access private\n */\n this.o = o;\n /**\n * @access private\n */\n this.isLuxonDateTime = true;\n }\n\n // CONSTRUCT\n\n /**\n * Create a DateTime for the current instant, in the system's time zone.\n *\n * Use Settings to override these default values if needed.\n * @example DateTime.now().toISO() //~> now in the ISO format\n * @return {DateTime}\n */\n static now() {\n return new DateTime({});\n }\n\n /**\n * Create a local DateTime\n * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month, 1-indexed\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.local() //~> now\n * @example DateTime.local({ zone: \"America/New_York\" }) //~> now, in US east coast time\n * @example DateTime.local(2017) //~> 2017-01-01T00:00:00\n * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00\n * @example DateTime.local(2017, 3, 12, { locale: \"fr\" }) //~> 2017-03-12T00:00:00, with a French locale\n * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00\n * @example DateTime.local(2017, 3, 12, 5, { zone: \"utc\" }) //~> 2017-03-12T05:00:00, in UTC\n * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00\n * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10\n * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765\n * @return {DateTime}\n */\n static local() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime in UTC\n * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @param {Object} options - configuration options for the DateTime\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance\n * @example DateTime.utc() //~> now\n * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z\n * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z\n * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: \"fr\" }) //~> 2017-03-12T05:45:00Z with a French locale\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: \"fr\" }) //~> 2017-03-12T05:45:10.765Z with a French locale\n * @return {DateTime}\n */\n static utc() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n\n opts.zone = FixedOffsetZone.utcInstance;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime from a JavaScript Date object. Uses the default zone.\n * @param {Date} date - a JavaScript Date object\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @return {DateTime}\n */\n static fromJSDate(date, options = {}) {\n const ts = isDate(date) ? date.valueOf() : NaN;\n if (Number.isNaN(ts)) {\n return DateTime.invalid(\"invalid input\");\n }\n\n const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n return new DateTime({\n ts: ts,\n zone: zoneToUse,\n loc: Locale.fromObject(options),\n });\n }\n\n /**\n * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} milliseconds - a number of milliseconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromMillis(milliseconds, options = {}) {\n if (!isNumber(milliseconds)) {\n throw new InvalidArgumentError(\n `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`\n );\n } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {\n // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start\n return DateTime.invalid(\"Timestamp out of range\");\n } else {\n return new DateTime({\n ts: milliseconds,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} seconds - a number of seconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromSeconds(seconds, options = {}) {\n if (!isNumber(seconds)) {\n throw new InvalidArgumentError(\"fromSeconds requires a numerical input\");\n } else {\n return new DateTime({\n ts: seconds * 1000,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.year - a year, such as 1987\n * @param {number} obj.month - a month, 1-12\n * @param {number} obj.day - a day of the month, 1-31, depending on the month\n * @param {number} obj.ordinal - day of the year, 1-365 or 366\n * @param {number} obj.weekYear - an ISO week year\n * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year\n * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday\n * @param {number} obj.localWeekYear - a week year, according to the locale\n * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale\n * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale\n * @param {number} obj.hour - hour of the day, 0-23\n * @param {number} obj.minute - minute of the hour, 0-59\n * @param {number} obj.second - second of the minute, 0-59\n * @param {number} obj.millisecond - millisecond of the second, 0-999\n * @param {Object} opts - options for creating this DateTime\n * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()\n * @param {string} [opts.locale='system\\'s locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'\n * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }),\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })\n * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'\n * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: \"en-US\" }).toISODate() //=> '2021-12-26'\n * @return {DateTime}\n */\n static fromObject(obj, opts = {}) {\n obj = obj || {};\n const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n const loc = Locale.fromObject(opts);\n const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);\n const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, loc);\n\n const tsNow = Settings.now(),\n offsetProvis = !isUndefined(opts.specificOffset)\n ? opts.specificOffset\n : zoneToUse.offset(tsNow),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber;\n\n // cases:\n // just a weekday -> this week's instance of that weekday, no worries\n // (gregorian data or ordinal) + (weekYear or weekNumber) -> error\n // (gregorian month or day) + ordinal -> error\n // otherwise just use weeks or ordinals or gregorian, depending on what's specified\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor);\n\n // configure ourselves to deal with gregorian dates or week stuff\n let units,\n defaultValues,\n objNow = tsToObj(tsNow, offsetProvis);\n if (useWeekData) {\n units = orderedWeekUnits;\n defaultValues = defaultWeekUnitValues;\n objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);\n } else if (containsOrdinal) {\n units = orderedOrdinalUnits;\n defaultValues = defaultOrdinalUnitValues;\n objNow = gregorianToOrdinal(objNow);\n } else {\n units = orderedUnits;\n defaultValues = defaultUnitValues;\n }\n\n // set default values for missing stuff\n let foundFirst = false;\n for (const u of units) {\n const v = normalized[u];\n if (!isUndefined(v)) {\n foundFirst = true;\n } else if (foundFirst) {\n normalized[u] = defaultValues[u];\n } else {\n normalized[u] = objNow[u];\n }\n }\n\n // make sure the values we have are in range\n const higherOrderInvalid = useWeekData\n ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek)\n : containsOrdinal\n ? hasInvalidOrdinalData(normalized)\n : hasInvalidGregorianData(normalized),\n invalid = higherOrderInvalid || hasInvalidTimeData(normalized);\n\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n // compute the actual time\n const gregorian = useWeekData\n ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek)\n : containsOrdinal\n ? ordinalToGregorian(normalized)\n : normalized,\n [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),\n inst = new DateTime({\n ts: tsFinal,\n zone: zoneToUse,\n o: offsetFinal,\n loc,\n });\n\n // gregorian data + weekday serves only to validate\n if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {\n return DateTime.invalid(\n \"mismatched weekday\",\n `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`\n );\n }\n\n if (!inst.isValid) {\n return DateTime.invalid(inst.invalid);\n }\n\n return inst;\n }\n\n /**\n * Create a DateTime from an ISO 8601 string\n * @param {string} text - the ISO string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromISO('2016-05-25T09:08:34.123')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})\n * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})\n * @example DateTime.fromISO('2016-W05-4')\n * @return {DateTime}\n */\n static fromISO(text, opts = {}) {\n const [vals, parsedZone] = parseISODate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"ISO 8601\", text);\n }\n\n /**\n * Create a DateTime from an RFC 2822 string\n * @param {string} text - the RFC 2822 string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')\n * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')\n * @return {DateTime}\n */\n static fromRFC2822(text, opts = {}) {\n const [vals, parsedZone] = parseRFC2822Date(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"RFC 2822\", text);\n }\n\n /**\n * Create a DateTime from an HTTP header date\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @param {string} text - the HTTP header date\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')\n * @return {DateTime}\n */\n static fromHTTP(text, opts = {}) {\n const [vals, parsedZone] = parseHTTPDate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"HTTP\", opts);\n }\n\n /**\n * Create a DateTime from an input string and format string.\n * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens).\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see the link below for the formats)\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromFormat(text, fmt, opts = {}) {\n if (isUndefined(text) || isUndefined(fmt)) {\n throw new InvalidArgumentError(\"fromFormat requires an input string and a format\");\n }\n\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n }),\n [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);\n if (invalid) {\n return DateTime.invalid(invalid);\n } else {\n return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);\n }\n }\n\n /**\n * @deprecated use fromFormat instead\n */\n static fromString(text, fmt, opts = {}) {\n return DateTime.fromFormat(text, fmt, opts);\n }\n\n /**\n * Create a DateTime from a SQL date, time, or datetime\n * Defaults to en-US if no locale has been specified, regardless of the system's locale\n * @param {string} text - the string to parse\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @example DateTime.fromSQL('2017-05-15')\n * @example DateTime.fromSQL('2017-05-15 09:12:34')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })\n * @example DateTime.fromSQL('09:12:34.342')\n * @return {DateTime}\n */\n static fromSQL(text, opts = {}) {\n const [vals, parsedZone] = parseSQL(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"SQL\", text);\n }\n\n /**\n * Create an invalid DateTime.\n * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent.\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {DateTime}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the DateTime is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDateTimeError(invalid);\n } else {\n return new DateTime({ invalid });\n }\n }\n\n /**\n * Check if an object is an instance of DateTime. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDateTime(o) {\n return (o && o.isLuxonDateTime) || false;\n }\n\n /**\n * Produce the format string for a set of options\n * @param formatOpts\n * @param localeOpts\n * @returns {string}\n */\n static parseFormatForOpts(formatOpts, localeOpts = {}) {\n const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));\n return !tokenList ? null : tokenList.map((t) => (t ? t.val : null)).join(\"\");\n }\n\n /**\n * Produce the the fully expanded format token for the locale\n * Does NOT quote characters, so quoted tokens will not round trip correctly\n * @param fmt\n * @param localeOpts\n * @returns {string}\n */\n static expandFormat(fmt, localeOpts = {}) {\n const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));\n return expanded.map((t) => t.val).join(\"\");\n }\n\n static resetCache() {\n zoneOffsetTs = undefined;\n zoneOffsetGuessCache.clear();\n }\n\n // INFO\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example DateTime.local(2017, 7, 4).get('month'); //=> 7\n * @example DateTime.local(2017, 7, 4).get('day'); //=> 4\n * @return {number}\n */\n get(unit) {\n return this[unit];\n }\n\n /**\n * Returns whether the DateTime is valid. Invalid DateTimes occur when:\n * * The DateTime was created from invalid calendar information, such as the 13th month or February 30\n * * The DateTime was created by an operation on another invalid date\n * @type {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this DateTime is invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime\n *\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime\n *\n * @type {string}\n */\n get outputCalendar() {\n return this.isValid ? this.loc.outputCalendar : null;\n }\n\n /**\n * Get the time zone associated with this DateTime.\n * @type {Zone}\n */\n get zone() {\n return this._zone;\n }\n\n /**\n * Get the name of the time zone.\n * @type {string}\n */\n get zoneName() {\n return this.isValid ? this.zone.name : null;\n }\n\n /**\n * Get the year\n * @example DateTime.local(2017, 5, 25).year //=> 2017\n * @type {number}\n */\n get year() {\n return this.isValid ? this.c.year : NaN;\n }\n\n /**\n * Get the quarter\n * @example DateTime.local(2017, 5, 25).quarter //=> 2\n * @type {number}\n */\n get quarter() {\n return this.isValid ? Math.ceil(this.c.month / 3) : NaN;\n }\n\n /**\n * Get the month (1-12).\n * @example DateTime.local(2017, 5, 25).month //=> 5\n * @type {number}\n */\n get month() {\n return this.isValid ? this.c.month : NaN;\n }\n\n /**\n * Get the day of the month (1-30ish).\n * @example DateTime.local(2017, 5, 25).day //=> 25\n * @type {number}\n */\n get day() {\n return this.isValid ? this.c.day : NaN;\n }\n\n /**\n * Get the hour of the day (0-23).\n * @example DateTime.local(2017, 5, 25, 9).hour //=> 9\n * @type {number}\n */\n get hour() {\n return this.isValid ? this.c.hour : NaN;\n }\n\n /**\n * Get the minute of the hour (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30\n * @type {number}\n */\n get minute() {\n return this.isValid ? this.c.minute : NaN;\n }\n\n /**\n * Get the second of the minute (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52\n * @type {number}\n */\n get second() {\n return this.isValid ? this.c.second : NaN;\n }\n\n /**\n * Get the millisecond of the second (0-999).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654\n * @type {number}\n */\n get millisecond() {\n return this.isValid ? this.c.millisecond : NaN;\n }\n\n /**\n * Get the week year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 12, 31).weekYear //=> 2015\n * @type {number}\n */\n get weekYear() {\n return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the week number of the week year (1-52ish).\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2017, 5, 25).weekNumber //=> 21\n * @type {number}\n */\n get weekNumber() {\n return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the day of the week.\n * 1 is Monday and 7 is Sunday\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekday //=> 4\n * @type {number}\n */\n get weekday() {\n return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;\n }\n\n /**\n * Returns true if this date is on a weekend according to the locale, false otherwise\n * @returns {boolean}\n */\n get isWeekend() {\n return this.isValid && this.loc.getWeekendDays().includes(this.weekday);\n }\n\n /**\n * Get the day of the week according to the locale.\n * 1 is the first day of the week and 7 is the last day of the week.\n * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,\n * @returns {number}\n */\n get localWeekday() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;\n }\n\n /**\n * Get the week number of the week year according to the locale. Different locales assign week numbers differently,\n * because the week can start on different days of the week (see localWeekday) and because a different number of days\n * is required for a week to count as the first week of a year.\n * @returns {number}\n */\n get localWeekNumber() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the week year according to the locale. Different locales assign week numbers (and therefor week years)\n * differently, see localWeekNumber.\n * @returns {number}\n */\n get localWeekYear() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the ordinal (meaning the day of the year)\n * @example DateTime.local(2017, 5, 25).ordinal //=> 145\n * @type {number|DateTime}\n */\n get ordinal() {\n return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;\n }\n\n /**\n * Get the human readable short month name, such as 'Oct'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthShort //=> Oct\n * @type {string}\n */\n get monthShort() {\n return this.isValid ? Info.months(\"short\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable long month name, such as 'October'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthLong //=> October\n * @type {string}\n */\n get monthLong() {\n return this.isValid ? Info.months(\"long\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable short weekday, such as 'Mon'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon\n * @type {string}\n */\n get weekdayShort() {\n return this.isValid ? Info.weekdays(\"short\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the human readable long weekday, such as 'Monday'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday\n * @type {string}\n */\n get weekdayLong() {\n return this.isValid ? Info.weekdays(\"long\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the UTC offset of this DateTime in minutes\n * @example DateTime.now().offset //=> -240\n * @example DateTime.utc().offset //=> 0\n * @type {number}\n */\n get offset() {\n return this.isValid ? +this.o : NaN;\n }\n\n /**\n * Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameShort() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"short\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get the long human name for the zone's current offset, for example \"Eastern Standard Time\" or \"Eastern Daylight Time\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameLong() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"long\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get whether this zone's offset ever changes, as in a DST.\n * @type {boolean}\n */\n get isOffsetFixed() {\n return this.isValid ? this.zone.isUniversal : null;\n }\n\n /**\n * Get whether the DateTime is in a DST.\n * @type {boolean}\n */\n get isInDST() {\n if (this.isOffsetFixed) {\n return false;\n } else {\n return (\n this.offset > this.set({ month: 1, day: 1 }).offset ||\n this.offset > this.set({ month: 5 }).offset\n );\n }\n }\n\n /**\n * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC\n * in this DateTime's zone. During DST changes local time can be ambiguous, for example\n * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`.\n * This method will return both possible DateTimes if this DateTime's local time is ambiguous.\n * @returns {DateTime[]}\n */\n getPossibleOffsets() {\n if (!this.isValid || this.isOffsetFixed) {\n return [this];\n }\n const dayMs = 86400000;\n const minuteMs = 60000;\n const localTS = objToLocalTS(this.c);\n const oEarlier = this.zone.offset(localTS - dayMs);\n const oLater = this.zone.offset(localTS + dayMs);\n\n const o1 = this.zone.offset(localTS - oEarlier * minuteMs);\n const o2 = this.zone.offset(localTS - oLater * minuteMs);\n if (o1 === o2) {\n return [this];\n }\n const ts1 = localTS - o1 * minuteMs;\n const ts2 = localTS - o2 * minuteMs;\n const c1 = tsToObj(ts1, o1);\n const c2 = tsToObj(ts2, o2);\n if (\n c1.hour === c2.hour &&\n c1.minute === c2.minute &&\n c1.second === c2.second &&\n c1.millisecond === c2.millisecond\n ) {\n return [clone(this, { ts: ts1 }), clone(this, { ts: ts2 })];\n }\n return [this];\n }\n\n /**\n * Returns true if this DateTime is in a leap year, false otherwise\n * @example DateTime.local(2016).isInLeapYear //=> true\n * @example DateTime.local(2013).isInLeapYear //=> false\n * @type {boolean}\n */\n get isInLeapYear() {\n return isLeapYear(this.year);\n }\n\n /**\n * Returns the number of days in this DateTime's month\n * @example DateTime.local(2016, 2).daysInMonth //=> 29\n * @example DateTime.local(2016, 3).daysInMonth //=> 31\n * @type {number}\n */\n get daysInMonth() {\n return daysInMonth(this.year, this.month);\n }\n\n /**\n * Returns the number of days in this DateTime's year\n * @example DateTime.local(2016).daysInYear //=> 366\n * @example DateTime.local(2013).daysInYear //=> 365\n * @type {number}\n */\n get daysInYear() {\n return this.isValid ? daysInYear(this.year) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2004).weeksInWeekYear //=> 53\n * @example DateTime.local(2013).weeksInWeekYear //=> 52\n * @type {number}\n */\n get weeksInWeekYear() {\n return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's local week year\n * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52\n * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53\n * @type {number}\n */\n get weeksInLocalWeekYear() {\n return this.isValid\n ? weeksInWeekYear(\n this.localWeekYear,\n this.loc.getMinDaysInFirstWeek(),\n this.loc.getStartOfWeek()\n )\n : NaN;\n }\n\n /**\n * Returns the resolved Intl options for this DateTime.\n * This is useful in understanding the behavior of formatting methods\n * @param {Object} opts - the same options as toLocaleString\n * @return {Object}\n */\n resolvedLocaleOptions(opts = {}) {\n const { locale, numberingSystem, calendar } = Formatter.create(\n this.loc.clone(opts),\n opts\n ).resolvedOptions(this);\n return { locale, numberingSystem, outputCalendar: calendar };\n }\n\n // TRANSFORM\n\n /**\n * \"Set\" the DateTime's zone to UTC. Returns a newly-constructed DateTime.\n *\n * Equivalent to {@link DateTime#setZone}('utc')\n * @param {number} [offset=0] - optionally, an offset from UTC in minutes\n * @param {Object} [opts={}] - options to pass to `setZone()`\n * @return {DateTime}\n */\n toUTC(offset = 0, opts = {}) {\n return this.setZone(FixedOffsetZone.instance(offset), opts);\n }\n\n /**\n * \"Set\" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.\n *\n * Equivalent to `setZone('local')`\n * @return {DateTime}\n */\n toLocal() {\n return this.setZone(Settings.defaultZone);\n }\n\n /**\n * \"Set\" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.\n *\n * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones.\n * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class.\n * @param {Object} opts - options\n * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.\n * @return {DateTime}\n */\n setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {\n zone = normalizeZone(zone, Settings.defaultZone);\n if (zone.equals(this.zone)) {\n return this;\n } else if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n } else {\n let newTS = this.ts;\n if (keepLocalTime || keepCalendarTime) {\n const offsetGuess = zone.offset(this.ts);\n const asObj = this.toObject();\n [newTS] = objToTS(asObj, offsetGuess, zone);\n }\n return clone(this, { ts: newTS, zone });\n }\n }\n\n /**\n * \"Set\" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.\n * @param {Object} properties - the properties to set\n * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })\n * @return {DateTime}\n */\n reconfigure({ locale, numberingSystem, outputCalendar } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });\n return clone(this, { loc });\n }\n\n /**\n * \"Set\" the locale. Returns a newly-constructed DateTime.\n * Just a convenient alias for reconfigure({ locale })\n * @example DateTime.local(2017, 5, 25).setLocale('en-GB')\n * @return {DateTime}\n */\n setLocale(locale) {\n return this.reconfigure({ locale });\n }\n\n /**\n * \"Set\" the values of specified units. Returns a newly-constructed DateTime.\n * You can only set units with this method; for \"setting\" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.\n *\n * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.\n * They cannot be mixed with ISO-week units like `weekday`.\n * @param {Object} values - a mapping of units to numbers\n * @example dt.set({ year: 2017 })\n * @example dt.set({ hour: 8, minute: 30 })\n * @example dt.set({ weekday: 5 })\n * @example dt.set({ year: 2005, ordinal: 234 })\n * @return {DateTime}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);\n const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, this.loc);\n\n const settingWeekStuff =\n !isUndefined(normalized.weekYear) ||\n !isUndefined(normalized.weekNumber) ||\n !isUndefined(normalized.weekday),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber;\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n let mixed;\n if (settingWeekStuff) {\n mixed = weekToGregorian(\n { ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), ...normalized },\n minDaysInFirstWeek,\n startOfWeek\n );\n } else if (!isUndefined(normalized.ordinal)) {\n mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized });\n } else {\n mixed = { ...this.toObject(), ...normalized };\n\n // if we didn't set the day but we ended up on an overflow date,\n // use the last day of the right month\n if (isUndefined(normalized.day)) {\n mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);\n }\n }\n\n const [ts, o] = objToTS(mixed, this.o, this.zone);\n return clone(this, { ts, o });\n }\n\n /**\n * Add a period of time to this DateTime and return the resulting DateTime\n *\n * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @example DateTime.now().plus(123) //~> in 123 milliseconds\n * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes\n * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow\n * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday\n * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min\n * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min\n * @return {DateTime}\n */\n plus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration);\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * Subtract a period of time to this DateTime and return the resulting DateTime\n * See {@link DateTime#plus}\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n @return {DateTime}\n */\n minus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration).negate();\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * \"Set\" this DateTime to the beginning of a unit of time.\n * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week\n * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'\n * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'\n * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'\n * @return {DateTime}\n */\n startOf(unit, { useLocaleWeeks = false } = {}) {\n if (!this.isValid) return this;\n\n const o = {},\n normalizedUnit = Duration.normalizeUnit(unit);\n switch (normalizedUnit) {\n case \"years\":\n o.month = 1;\n // falls through\n case \"quarters\":\n case \"months\":\n o.day = 1;\n // falls through\n case \"weeks\":\n case \"days\":\n o.hour = 0;\n // falls through\n case \"hours\":\n o.minute = 0;\n // falls through\n case \"minutes\":\n o.second = 0;\n // falls through\n case \"seconds\":\n o.millisecond = 0;\n break;\n case \"milliseconds\":\n break;\n // no default, invalid units throw in normalizeUnit()\n }\n\n if (normalizedUnit === \"weeks\") {\n if (useLocaleWeeks) {\n const startOfWeek = this.loc.getStartOfWeek();\n const { weekday } = this;\n if (weekday < startOfWeek) {\n o.weekNumber = this.weekNumber - 1;\n }\n o.weekday = startOfWeek;\n } else {\n o.weekday = 1;\n }\n }\n\n if (normalizedUnit === \"quarters\") {\n const q = Math.ceil(this.month / 3);\n o.month = (q - 1) * 3 + 1;\n }\n\n return this.set(o);\n }\n\n /**\n * \"Set\" this DateTime to the end (meaning the last millisecond) of a unit of time\n * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week\n * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'\n * @return {DateTime}\n */\n endOf(unit, opts) {\n return this.isValid\n ? this.plus({ [unit]: 1 })\n .startOf(unit, opts)\n .minus(1)\n : this;\n }\n\n // OUTPUT\n\n /**\n * Returns a string representation of this DateTime formatted according to the specified format string.\n * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens).\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @param {string} fmt - the format string\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22'\n * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'\n * @example DateTime.now().toFormat('yyyy LLL dd', { locale: \"fr\" }) //=> '2017 avr. 22'\n * @example DateTime.now().toFormat(\"HH 'hours and' mm 'minutes'\") //=> '20 hours and 55 minutes'\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.\n * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation\n * of the DateTime in the assigned locale.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toLocaleString(); //=> 4/20/2017\n * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'\n * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'\n * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022'\n * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'\n * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'\n * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'\n * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'\n * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32'\n * @return {string}\n */\n toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this)\n : INVALID;\n }\n\n /**\n * Returns an array of format \"parts\", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts\n * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.\n * @example DateTime.now().toLocaleParts(); //=> [\n * //=> { type: 'day', value: '25' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'month', value: '05' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'year', value: '1982' }\n * //=> ]\n */\n toLocaleParts(opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this)\n : [];\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.extendedZone=false] - add the time zone format extension\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.\n * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'\n * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'\n * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'\n * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'\n * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z'\n * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z'\n * @return {string|null}\n */\n toISO({\n format = \"extended\",\n suppressSeconds = false,\n suppressMilliseconds = false,\n includeOffset = true,\n extendedZone = false,\n precision = \"milliseconds\",\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n precision = normalizeUnit(precision);\n const ext = format === \"extended\";\n\n let c = toISODate(this, ext, precision);\n if (orderedUnits.indexOf(precision) >= 3) c += \"T\";\n c += toISOTime(\n this,\n ext,\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n );\n return c;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's date component\n * @param {Object} opts - options\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'.\n * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'\n * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'\n * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05'\n * @return {string|null}\n */\n toISODate({ format = \"extended\", precision = \"day\" } = {}) {\n if (!this.isValid) {\n return null;\n }\n return toISODate(this, format === \"extended\", normalizeUnit(precision));\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's week date\n * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'\n * @return {string}\n */\n toISOWeekDate() {\n return toTechFormat(this, \"kkkk-'W'WW-c\");\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's time component\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.extendedZone=true] - add the time zone format extension\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z'\n * @return {string}\n */\n toISOTime({\n suppressMilliseconds = false,\n suppressSeconds = false,\n includeOffset = true,\n includePrefix = false,\n extendedZone = false,\n format = \"extended\",\n precision = \"milliseconds\",\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n precision = normalizeUnit(precision);\n let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? \"T\" : \"\";\n return (\n c +\n toISOTime(\n this,\n format === \"extended\",\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n )\n );\n }\n\n /**\n * Returns an RFC 2822-compatible string representation of this DateTime\n * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'\n * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'\n * @return {string}\n */\n toRFC2822() {\n return toTechFormat(this, \"EEE, dd LLL yyyy HH:mm:ss ZZZ\", false);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.\n * Specifically, the string conforms to RFC 1123.\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'\n * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'\n * @return {string}\n */\n toHTTP() {\n return toTechFormat(this.toUTC(), \"EEE, dd LLL yyyy HH:mm:ss 'GMT'\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Date\n * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'\n * @return {string|null}\n */\n toSQLDate() {\n if (!this.isValid) {\n return null;\n }\n return toISODate(this, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Time\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'\n * @example DateTime.utc().toSQL() //=> '05:15:16.345'\n * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00'\n * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345'\n * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'\n * @return {string}\n */\n toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) {\n let fmt = \"HH:mm:ss.SSS\";\n\n if (includeZone || includeOffset) {\n if (includeOffsetSpace) {\n fmt += \" \";\n }\n if (includeZone) {\n fmt += \"z\";\n } else if (includeOffset) {\n fmt += \"ZZ\";\n }\n }\n\n return toTechFormat(this, fmt, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'\n * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'\n * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'\n * @return {string}\n */\n toSQL(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for debugging\n * @return {string}\n */\n toString() {\n return this.isValid ? this.toISO() : INVALID;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;\n } else {\n return `DateTime { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime.\n * @return {number}\n */\n toMillis() {\n return this.isValid ? this.ts : NaN;\n }\n\n /**\n * Returns the epoch seconds (including milliseconds in the fractional part) of this DateTime.\n * @return {number}\n */\n toSeconds() {\n return this.isValid ? this.ts / 1000 : NaN;\n }\n\n /**\n * Returns the epoch seconds (as a whole number) of this DateTime.\n * @return {number}\n */\n toUnixInteger() {\n return this.isValid ? Math.floor(this.ts / 1000) : NaN;\n }\n\n /**\n * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns a BSON serializable equivalent to this DateTime.\n * @return {Date}\n */\n toBSON() {\n return this.toJSDate();\n }\n\n /**\n * Returns a JavaScript object with this DateTime's year, month, day, and so on.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = { ...this.c };\n\n if (opts.includeConfig) {\n base.outputCalendar = this.outputCalendar;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns a JavaScript Date equivalent to this DateTime.\n * @return {Date}\n */\n toJSDate() {\n return new Date(this.isValid ? this.ts : NaN);\n }\n\n // COMPARE\n\n /**\n * Return the difference between two DateTimes as a Duration.\n * @param {DateTime} otherDateTime - the DateTime to compare this one to\n * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example\n * var i1 = DateTime.fromISO('1982-05-25T09:45'),\n * i2 = DateTime.fromISO('1983-10-14T10:30');\n * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\n * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\n * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\n * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n * @return {Duration}\n */\n diff(otherDateTime, unit = \"milliseconds\", opts = {}) {\n if (!this.isValid || !otherDateTime.isValid) {\n return Duration.invalid(\"created by diffing an invalid DateTime\");\n }\n\n const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts };\n\n const units = maybeArray(unit).map(Duration.normalizeUnit),\n otherIsLater = otherDateTime.valueOf() > this.valueOf(),\n earlier = otherIsLater ? this : otherDateTime,\n later = otherIsLater ? otherDateTime : this,\n diffed = diff(earlier, later, units, durOpts);\n\n return otherIsLater ? diffed.negate() : diffed;\n }\n\n /**\n * Return the difference between this DateTime and right now.\n * See {@link DateTime#diff}\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n diffNow(unit = \"milliseconds\", opts = {}) {\n return this.diff(DateTime.now(), unit, opts);\n }\n\n /**\n * Return an Interval spanning between this DateTime and another DateTime\n * @param {DateTime} otherDateTime - the other end point of the Interval\n * @return {Interval|DateTime}\n */\n until(otherDateTime) {\n return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;\n }\n\n /**\n * Return whether this DateTime is in the same unit of time as another DateTime.\n * Higher-order units must also be identical for this function to return `true`.\n * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.\n * @param {DateTime} otherDateTime - the other DateTime\n * @param {string} unit - the unit of time to check sameness on\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used\n * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day\n * @return {boolean}\n */\n hasSame(otherDateTime, unit, opts) {\n if (!this.isValid) return false;\n\n const inputMs = otherDateTime.valueOf();\n const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true });\n return (\n adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts)\n );\n }\n\n /**\n * Equality check\n * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid.\n * To compare just the millisecond values, use `+dt1 === +dt2`.\n * @param {DateTime} other - the other DateTime\n * @return {boolean}\n */\n equals(other) {\n return (\n this.isValid &&\n other.isValid &&\n this.valueOf() === other.valueOf() &&\n this.zone.equals(other.zone) &&\n this.loc.equals(other.loc)\n );\n }\n\n /**\n * Returns a string representation of a this time relative to now, such as \"in two days\". Can only internationalize if your\n * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} [options.style=\"long\"] - the style of units, must be \"long\", \"short\", or \"narrow\"\n * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of \"years\", \"quarters\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", or \"seconds\"\n * @param {boolean} [options.round=true] - whether to round the numbers in the output.\n * @param {string} [options.rounding=\"trunc\"] - rounding method to use when rounding the numbers in the output. Can be \"trunc\" (toward zero), \"expand\" (away from zero), \"round\", \"floor\", or \"ceil\".\n * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelative() //=> \"in 1 day\"\n * @example DateTime.now().setLocale(\"es\").toRelative({ days: 1 }) //=> \"dentro de 1 día\"\n * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: \"fr\" }) //=> \"dans 23 heures\"\n * @example DateTime.now().minus({ days: 2 }).toRelative() //=> \"2 days ago\"\n * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: \"hours\" }) //=> \"48 hours ago\"\n * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> \"1.5 days ago\"\n */\n toRelative(options = {}) {\n if (!this.isValid) return null;\n const base = options.base || DateTime.fromObject({}, { zone: this.zone }),\n padding = options.padding ? (this < base ? -options.padding : options.padding) : 0;\n let units = [\"years\", \"months\", \"days\", \"hours\", \"minutes\", \"seconds\"];\n let unit = options.unit;\n if (Array.isArray(options.unit)) {\n units = options.unit;\n unit = undefined;\n }\n return diffRelative(base, this.plus(padding), {\n ...options,\n numeric: \"always\",\n units,\n unit,\n });\n }\n\n /**\n * Returns a string representation of this date relative to today, such as \"yesterday\" or \"next month\".\n * Only internationalizes on platforms that supports Intl.RelativeTimeFormat.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", or \"days\"\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> \"tomorrow\"\n * @example DateTime.now().setLocale(\"es\").plus({ days: 1 }).toRelative() //=> \"\"mañana\"\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: \"fr\" }) //=> \"demain\"\n * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> \"2 days ago\"\n */\n toRelativeCalendar(options = {}) {\n if (!this.isValid) return null;\n\n return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, {\n ...options,\n numeric: \"auto\",\n units: [\"years\", \"months\", \"days\"],\n calendary: true,\n });\n }\n\n /**\n * Return the min of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum\n * @return {DateTime} the min DateTime, or undefined if called with no argument\n */\n static min(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"min requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.min);\n }\n\n /**\n * Return the max of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum\n * @return {DateTime} the max DateTime, or undefined if called with no argument\n */\n static max(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"max requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.max);\n }\n\n // MISC\n\n /**\n * Explain how a string would be parsed by fromFormat()\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see description)\n * @param {Object} options - options taken by fromFormat()\n * @return {Object}\n */\n static fromFormatExplain(text, fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n return explainFromTokens(localeToUse, text, fmt);\n }\n\n /**\n * @deprecated use fromFormatExplain instead\n */\n static fromStringExplain(text, fmt, options = {}) {\n return DateTime.fromFormatExplain(text, fmt, options);\n }\n\n /**\n * Build a parser for `fmt` using the given locale. This parser can be passed\n * to {@link DateTime.fromFormatParser} to a parse a date in this format. This\n * can be used to optimize cases where many dates need to be parsed in a\n * specific format.\n *\n * @param {String} fmt - the format the string is expected to be in (see\n * description)\n * @param {Object} options - options used to set locale and numberingSystem\n * for parser\n * @returns {TokenParser} - opaque object to be used\n */\n static buildFormatParser(fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n return new TokenParser(localeToUse, fmt);\n }\n\n /**\n * Create a DateTime from an input string and format parser.\n *\n * The format parser must have been created with the same locale as this call.\n *\n * @param {String} text - the string to parse\n * @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser}\n * @param {Object} opts - options taken by fromFormat()\n * @returns {DateTime}\n */\n static fromFormatParser(text, formatParser, opts = {}) {\n if (isUndefined(text) || isUndefined(formatParser)) {\n throw new InvalidArgumentError(\n \"fromFormatParser requires an input string and a format parser\"\n );\n }\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n\n if (!localeToUse.equals(formatParser.locale)) {\n throw new InvalidArgumentError(\n `fromFormatParser called with a locale of ${localeToUse}, ` +\n `but the format parser was created for ${formatParser.locale}`\n );\n }\n\n const { result, zone, specificOffset, invalidReason } = formatParser.explainFromTokens(text);\n\n if (invalidReason) {\n return DateTime.invalid(invalidReason);\n } else {\n return parseDataToDateTime(\n result,\n zone,\n opts,\n `format ${formatParser.format}`,\n text,\n specificOffset\n );\n }\n }\n\n // FORMAT PRESETS\n\n /**\n * {@link DateTime#toLocaleString} format like 10/14/1983\n * @type {Object}\n */\n static get DATE_SHORT() {\n return Formats.DATE_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED() {\n return Formats.DATE_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED_WITH_WEEKDAY() {\n return Formats.DATE_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983'\n * @type {Object}\n */\n static get DATE_FULL() {\n return Formats.DATE_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983'\n * @type {Object}\n */\n static get DATE_HUGE() {\n return Formats.DATE_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_SIMPLE() {\n return Formats.TIME_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SECONDS() {\n return Formats.TIME_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SHORT_OFFSET() {\n return Formats.TIME_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_LONG_OFFSET() {\n return Formats.TIME_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_SIMPLE() {\n return Formats.TIME_24_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SECONDS() {\n return Formats.TIME_24_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SHORT_OFFSET() {\n return Formats.TIME_24_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_LONG_OFFSET() {\n return Formats.TIME_24_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT() {\n return Formats.DATETIME_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT_WITH_SECONDS() {\n return Formats.DATETIME_SHORT_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED() {\n return Formats.DATETIME_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_SECONDS() {\n return Formats.DATETIME_MED_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_WEEKDAY() {\n return Formats.DATETIME_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL() {\n return Formats.DATETIME_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL_WITH_SECONDS() {\n return Formats.DATETIME_FULL_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE() {\n return Formats.DATETIME_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE_WITH_SECONDS() {\n return Formats.DATETIME_HUGE_WITH_SECONDS;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDateTime(dateTimeish) {\n if (DateTime.isDateTime(dateTimeish)) {\n return dateTimeish;\n } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {\n return DateTime.fromJSDate(dateTimeish);\n } else if (dateTimeish && typeof dateTimeish === \"object\") {\n return DateTime.fromObject(dateTimeish);\n } else {\n throw new InvalidArgumentError(\n `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`\n );\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Duration from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Info from \"./info.js\";\nimport Zone from \"./zone.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport InvalidZone from \"./zones/invalidZone.js\";\nimport SystemZone from \"./zones/systemZone.js\";\nimport Settings from \"./settings.js\";\n\nconst VERSION = \"3.7.2\";\n\nexport {\n VERSION,\n DateTime,\n Duration,\n Interval,\n Info,\n Zone,\n FixedOffsetZone,\n IANAZone,\n InvalidZone,\n SystemZone,\n Settings,\n};\n"],"names":["singleton","English.formatRelativeTime","English.months","English.weekdays","English.meridiems","English.eras","Formats.DATE_SHORT","Formats.DATE_MED","Formats.DATE_FULL","Formats.DATE_HUGE","Formats.TIME_SIMPLE","Formats.TIME_WITH_SECONDS","Formats.TIME_WITH_SHORT_OFFSET","Formats.TIME_WITH_LONG_OFFSET","Formats.TIME_24_SIMPLE","Formats.TIME_24_WITH_SECONDS","Formats.TIME_24_WITH_SHORT_OFFSET","Formats.TIME_24_WITH_LONG_OFFSET","Formats.DATETIME_SHORT","Formats.DATETIME_MED","Formats.DATETIME_FULL","Formats.DATETIME_HUGE","Formats.DATETIME_SHORT_WITH_SECONDS","Formats.DATETIME_MED_WITH_SECONDS","Formats.DATETIME_FULL_WITH_SECONDS","Formats.DATETIME_HUGE_WITH_SECONDS","English.meridiemForDateTime","English.monthForDateTime","English.weekdayForDateTime","English.eraForDateTime","English.monthsShort","English.weekdaysLong","English.weekdaysShort","INVALID","orderedUnits","clone","Formats.DATE_MED_WITH_WEEKDAY","Formats.DATETIME_MED_WITH_WEEKDAY"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,MAAM,UAAU,SAAS,KAAK,CAAC,EAAE;AACjC;AACA;AACA;AACA;AACO,MAAM,oBAAoB,SAAS,UAAU,CAAC;AACrD,EAAE,WAAW,CAAC,MAAM,EAAE;AACtB,IAAI,KAAK,CAAC,CAAC,kBAAkB,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;AACrD,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACO,MAAM,oBAAoB,SAAS,UAAU,CAAC;AACrD,EAAE,WAAW,CAAC,MAAM,EAAE;AACtB,IAAI,KAAK,CAAC,CAAC,kBAAkB,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;AACrD,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACO,MAAM,oBAAoB,SAAS,UAAU,CAAC;AACrD,EAAE,WAAW,CAAC,MAAM,EAAE;AACtB,IAAI,KAAK,CAAC,CAAC,kBAAkB,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;AACrD,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACO,MAAM,6BAA6B,SAAS,UAAU,CAAC,EAAE;AAChE;AACA;AACA;AACA;AACO,MAAM,gBAAgB,SAAS,UAAU,CAAC;AACjD,EAAE,WAAW,CAAC,IAAI,EAAE;AACpB,IAAI,KAAK,CAAC,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAClC,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACO,MAAM,oBAAoB,SAAS,UAAU,CAAC,EAAE;AACv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,EAAE,OAAO,WAAW,CAAC,CAAC;AAChF,KAAK,CAAC;AACN,GAAG;AACH;;AC/hFK,MAAC,OAAO,GAAG;;;;"} \ No newline at end of file diff --git a/node_modules/luxon/build/global/luxon.js b/node_modules/luxon/build/global/luxon.js new file mode 100644 index 00000000..7d059e1b --- /dev/null +++ b/node_modules/luxon/build/global/luxon.js @@ -0,0 +1,8744 @@ +var luxon = (function (exports) { + 'use strict'; + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _extends() { + _extends = Object.assign ? Object.assign.bind() : function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + return target; + }; + return _extends.apply(this, arguments); + } + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + _setPrototypeOf(subClass, superClass); + } + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return _setPrototypeOf(o, p); + } + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct.bind(); + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + return _construct.apply(null, arguments); + } + function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; + } + function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + _cache.set(Class, Wrapper); + } + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; + return _wrapNativeSuper(Class); + } + function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function _createForOfIteratorHelperLoose(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (it) return (it = it.call(o)).next.bind(it); + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _toPrimitive(input, hint) { + if (typeof input !== "object" || input === null) return input; + var prim = input[Symbol.toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (typeof res !== "object") return res; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (hint === "string" ? String : Number)(input); + } + function _toPropertyKey(arg) { + var key = _toPrimitive(arg, "string"); + return typeof key === "symbol" ? key : String(key); + } + + // these aren't really private, but nor are they really useful to document + /** + * @private + */ + var LuxonError = /*#__PURE__*/function (_Error) { + _inheritsLoose(LuxonError, _Error); + function LuxonError() { + return _Error.apply(this, arguments) || this; + } + return LuxonError; + }( /*#__PURE__*/_wrapNativeSuper(Error)); + /** + * @private + */ + var InvalidDateTimeError = /*#__PURE__*/function (_LuxonError) { + _inheritsLoose(InvalidDateTimeError, _LuxonError); + function InvalidDateTimeError(reason) { + return _LuxonError.call(this, "Invalid DateTime: " + reason.toMessage()) || this; + } + return InvalidDateTimeError; + }(LuxonError); + + /** + * @private + */ + var InvalidIntervalError = /*#__PURE__*/function (_LuxonError2) { + _inheritsLoose(InvalidIntervalError, _LuxonError2); + function InvalidIntervalError(reason) { + return _LuxonError2.call(this, "Invalid Interval: " + reason.toMessage()) || this; + } + return InvalidIntervalError; + }(LuxonError); + + /** + * @private + */ + var InvalidDurationError = /*#__PURE__*/function (_LuxonError3) { + _inheritsLoose(InvalidDurationError, _LuxonError3); + function InvalidDurationError(reason) { + return _LuxonError3.call(this, "Invalid Duration: " + reason.toMessage()) || this; + } + return InvalidDurationError; + }(LuxonError); + + /** + * @private + */ + var ConflictingSpecificationError = /*#__PURE__*/function (_LuxonError4) { + _inheritsLoose(ConflictingSpecificationError, _LuxonError4); + function ConflictingSpecificationError() { + return _LuxonError4.apply(this, arguments) || this; + } + return ConflictingSpecificationError; + }(LuxonError); + + /** + * @private + */ + var InvalidUnitError = /*#__PURE__*/function (_LuxonError5) { + _inheritsLoose(InvalidUnitError, _LuxonError5); + function InvalidUnitError(unit) { + return _LuxonError5.call(this, "Invalid unit " + unit) || this; + } + return InvalidUnitError; + }(LuxonError); + + /** + * @private + */ + var InvalidArgumentError = /*#__PURE__*/function (_LuxonError6) { + _inheritsLoose(InvalidArgumentError, _LuxonError6); + function InvalidArgumentError() { + return _LuxonError6.apply(this, arguments) || this; + } + return InvalidArgumentError; + }(LuxonError); + + /** + * @private + */ + var ZoneIsAbstractError = /*#__PURE__*/function (_LuxonError7) { + _inheritsLoose(ZoneIsAbstractError, _LuxonError7); + function ZoneIsAbstractError() { + return _LuxonError7.call(this, "Zone is an abstract class") || this; + } + return ZoneIsAbstractError; + }(LuxonError); + + /** + * @private + */ + + var n = "numeric", + s = "short", + l = "long"; + var DATE_SHORT = { + year: n, + month: n, + day: n + }; + var DATE_MED = { + year: n, + month: s, + day: n + }; + var DATE_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s + }; + var DATE_FULL = { + year: n, + month: l, + day: n + }; + var DATE_HUGE = { + year: n, + month: l, + day: n, + weekday: l + }; + var TIME_SIMPLE = { + hour: n, + minute: n + }; + var TIME_WITH_SECONDS = { + hour: n, + minute: n, + second: n + }; + var TIME_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: s + }; + var TIME_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: l + }; + var TIME_24_SIMPLE = { + hour: n, + minute: n, + hourCycle: "h23" + }; + var TIME_24_WITH_SECONDS = { + hour: n, + minute: n, + second: n, + hourCycle: "h23" + }; + var TIME_24_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + hourCycle: "h23", + timeZoneName: s + }; + var TIME_24_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + hourCycle: "h23", + timeZoneName: l + }; + var DATETIME_SHORT = { + year: n, + month: n, + day: n, + hour: n, + minute: n + }; + var DATETIME_SHORT_WITH_SECONDS = { + year: n, + month: n, + day: n, + hour: n, + minute: n, + second: n + }; + var DATETIME_MED = { + year: n, + month: s, + day: n, + hour: n, + minute: n + }; + var DATETIME_MED_WITH_SECONDS = { + year: n, + month: s, + day: n, + hour: n, + minute: n, + second: n + }; + var DATETIME_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, + hour: n, + minute: n + }; + var DATETIME_FULL = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + timeZoneName: s + }; + var DATETIME_FULL_WITH_SECONDS = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + second: n, + timeZoneName: s + }; + var DATETIME_HUGE = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + timeZoneName: l + }; + var DATETIME_HUGE_WITH_SECONDS = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + second: n, + timeZoneName: l + }; + + /** + * @interface + */ + var Zone = /*#__PURE__*/function () { + function Zone() {} + var _proto = Zone.prototype; + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + _proto.offsetName = function offsetName(ts, opts) { + throw new ZoneIsAbstractError(); + } + + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */; + _proto.formatOffset = function formatOffset(ts, format) { + throw new ZoneIsAbstractError(); + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */; + _proto.offset = function offset(ts) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */; + _proto.equals = function equals(otherZone) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */; + _createClass(Zone, [{ + key: "type", + get: + /** + * The type of zone + * @abstract + * @type {string} + */ + function get() { + throw new ZoneIsAbstractError(); + } + + /** + * The name of this zone. + * @abstract + * @type {string} + */ + }, { + key: "name", + get: function get() { + throw new ZoneIsAbstractError(); + } + + /** + * The IANA name of this zone. + * Defaults to `name` if not overwritten by a subclass. + * @abstract + * @type {string} + */ + }, { + key: "ianaName", + get: function get() { + return this.name; + } + + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + }, { + key: "isUniversal", + get: function get() { + throw new ZoneIsAbstractError(); + } + }, { + key: "isValid", + get: function get() { + throw new ZoneIsAbstractError(); + } + }]); + return Zone; + }(); + + var singleton$1 = null; + + /** + * Represents the local zone for this JavaScript environment. + * @implements {Zone} + */ + var SystemZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(SystemZone, _Zone); + function SystemZone() { + return _Zone.apply(this, arguments) || this; + } + var _proto = SystemZone.prototype; + /** @override **/ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale); + } + + /** @override **/; + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** @override **/; + _proto.offset = function offset(ts) { + return -new Date(ts).getTimezoneOffset(); + } + + /** @override **/; + _proto.equals = function equals(otherZone) { + return otherZone.type === "system"; + } + + /** @override **/; + _createClass(SystemZone, [{ + key: "type", + get: /** @override **/ + function get() { + return "system"; + } + + /** @override **/ + }, { + key: "name", + get: function get() { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } + + /** @override **/ + }, { + key: "isUniversal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }], [{ + key: "instance", + get: + /** + * Get a singleton instance of the local zone + * @return {SystemZone} + */ + function get() { + if (singleton$1 === null) { + singleton$1 = new SystemZone(); + } + return singleton$1; + } + }]); + return SystemZone; + }(Zone); + + var dtfCache = new Map(); + function makeDTF(zoneName) { + var dtf = dtfCache.get(zoneName); + if (dtf === undefined) { + dtf = new Intl.DateTimeFormat("en-US", { + hour12: false, + timeZone: zoneName, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + era: "short" + }); + dtfCache.set(zoneName, dtf); + } + return dtf; + } + var typeToPos = { + year: 0, + month: 1, + day: 2, + era: 3, + hour: 4, + minute: 5, + second: 6 + }; + function hackyOffset(dtf, date) { + var formatted = dtf.format(date).replace(/\u200E/g, ""), + parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted), + fMonth = parsed[1], + fDay = parsed[2], + fYear = parsed[3], + fadOrBc = parsed[4], + fHour = parsed[5], + fMinute = parsed[6], + fSecond = parsed[7]; + return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond]; + } + function partsOffset(dtf, date) { + var formatted = dtf.formatToParts(date); + var filled = []; + for (var i = 0; i < formatted.length; i++) { + var _formatted$i = formatted[i], + type = _formatted$i.type, + value = _formatted$i.value; + var pos = typeToPos[type]; + if (type === "era") { + filled[pos] = value; + } else if (!isUndefined(pos)) { + filled[pos] = parseInt(value, 10); + } + } + return filled; + } + var ianaZoneCache = new Map(); + /** + * A zone identified by an IANA identifier, like America/New_York + * @implements {Zone} + */ + var IANAZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(IANAZone, _Zone); + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + IANAZone.create = function create(name) { + var zone = ianaZoneCache.get(name); + if (zone === undefined) { + ianaZoneCache.set(name, zone = new IANAZone(name)); + } + return zone; + } + + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */; + IANAZone.resetCache = function resetCache() { + ianaZoneCache.clear(); + dtfCache.clear(); + } + + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead. + * @return {boolean} + */; + IANAZone.isValidSpecifier = function isValidSpecifier(s) { + return this.isValidZone(s); + } + + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */; + IANAZone.isValidZone = function isValidZone(zone) { + if (!zone) { + return false; + } + try { + new Intl.DateTimeFormat("en-US", { + timeZone: zone + }).format(); + return true; + } catch (e) { + return false; + } + }; + function IANAZone(name) { + var _this; + _this = _Zone.call(this) || this; + /** @private **/ + _this.zoneName = name; + /** @private **/ + _this.valid = IANAZone.isValidZone(name); + return _this; + } + + /** + * The type of zone. `iana` for all instances of `IANAZone`. + * @override + * @type {string} + */ + var _proto = IANAZone.prototype; + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @override + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale, this.name); + } + + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */; + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @override + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */; + _proto.offset = function offset(ts) { + if (!this.valid) return NaN; + var date = new Date(ts); + if (isNaN(date)) return NaN; + var dtf = makeDTF(this.name); + var _ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date), + year = _ref2[0], + month = _ref2[1], + day = _ref2[2], + adOrBc = _ref2[3], + hour = _ref2[4], + minute = _ref2[5], + second = _ref2[6]; + if (adOrBc === "BC") { + year = -Math.abs(year) + 1; + } + + // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat + var adjustedHour = hour === 24 ? 0 : hour; + var asUTC = objToLocalTS({ + year: year, + month: month, + day: day, + hour: adjustedHour, + minute: minute, + second: second, + millisecond: 0 + }); + var asTS = +date; + var over = asTS % 1000; + asTS -= over >= 0 ? over : 1000 + over; + return (asUTC - asTS) / (60 * 1000); + } + + /** + * Return whether this Zone is equal to another zone + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */; + _proto.equals = function equals(otherZone) { + return otherZone.type === "iana" && otherZone.name === this.name; + } + + /** + * Return whether this Zone is valid. + * @override + * @type {boolean} + */; + _createClass(IANAZone, [{ + key: "type", + get: function get() { + return "iana"; + } + + /** + * The name of this zone (i.e. the IANA zone name). + * @override + * @type {string} + */ + }, { + key: "name", + get: function get() { + return this.zoneName; + } + + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns false for all IANA zones. + * @override + * @type {boolean} + */ + }, { + key: "isUniversal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return this.valid; + } + }]); + return IANAZone; + }(Zone); + + var _excluded = ["base"], + _excluded2 = ["padTo", "floor"]; + + // todo - remap caching + + var intlLFCache = {}; + function getCachedLF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var key = JSON.stringify([locString, opts]); + var dtf = intlLFCache[key]; + if (!dtf) { + dtf = new Intl.ListFormat(locString, opts); + intlLFCache[key] = dtf; + } + return dtf; + } + var intlDTCache = new Map(); + function getCachedDTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var key = JSON.stringify([locString, opts]); + var dtf = intlDTCache.get(key); + if (dtf === undefined) { + dtf = new Intl.DateTimeFormat(locString, opts); + intlDTCache.set(key, dtf); + } + return dtf; + } + var intlNumCache = new Map(); + function getCachedINF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var key = JSON.stringify([locString, opts]); + var inf = intlNumCache.get(key); + if (inf === undefined) { + inf = new Intl.NumberFormat(locString, opts); + intlNumCache.set(key, inf); + } + return inf; + } + var intlRelCache = new Map(); + function getCachedRTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + var _opts = opts; + _opts.base; + var cacheKeyOpts = _objectWithoutPropertiesLoose(_opts, _excluded); // exclude `base` from the options + var key = JSON.stringify([locString, cacheKeyOpts]); + var inf = intlRelCache.get(key); + if (inf === undefined) { + inf = new Intl.RelativeTimeFormat(locString, opts); + intlRelCache.set(key, inf); + } + return inf; + } + var sysLocaleCache = null; + function systemLocale() { + if (sysLocaleCache) { + return sysLocaleCache; + } else { + sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale; + return sysLocaleCache; + } + } + var intlResolvedOptionsCache = new Map(); + function getCachedIntResolvedOptions(locString) { + var opts = intlResolvedOptionsCache.get(locString); + if (opts === undefined) { + opts = new Intl.DateTimeFormat(locString).resolvedOptions(); + intlResolvedOptionsCache.set(locString, opts); + } + return opts; + } + var weekInfoCache = new Map(); + function getCachedWeekInfo(locString) { + var data = weekInfoCache.get(locString); + if (!data) { + var locale = new Intl.Locale(locString); + // browsers currently implement this as a property, but spec says it should be a getter function + data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo; + // minimalDays was removed from WeekInfo: https://github.com/tc39/proposal-intl-locale-info/issues/86 + if (!("minimalDays" in data)) { + data = _extends({}, fallbackWeekSettings, data); + } + weekInfoCache.set(locString, data); + } + return data; + } + function parseLocaleString(localeStr) { + // I really want to avoid writing a BCP 47 parser + // see, e.g. https://github.com/wooorm/bcp-47 + // Instead, we'll do this: + + // a) if the string has no -u extensions, just leave it alone + // b) if it does, use Intl to resolve everything + // c) if Intl fails, try again without the -u + + // private subtags and unicode subtags have ordering requirements, + // and we're not properly parsing this, so just strip out the + // private ones if they exist. + var xIndex = localeStr.indexOf("-x-"); + if (xIndex !== -1) { + localeStr = localeStr.substring(0, xIndex); + } + var uIndex = localeStr.indexOf("-u-"); + if (uIndex === -1) { + return [localeStr]; + } else { + var options; + var selectedStr; + try { + options = getCachedDTF(localeStr).resolvedOptions(); + selectedStr = localeStr; + } catch (e) { + var smaller = localeStr.substring(0, uIndex); + options = getCachedDTF(smaller).resolvedOptions(); + selectedStr = smaller; + } + var _options = options, + numberingSystem = _options.numberingSystem, + calendar = _options.calendar; + return [selectedStr, numberingSystem, calendar]; + } + } + function intlConfigString(localeStr, numberingSystem, outputCalendar) { + if (outputCalendar || numberingSystem) { + if (!localeStr.includes("-u-")) { + localeStr += "-u"; + } + if (outputCalendar) { + localeStr += "-ca-" + outputCalendar; + } + if (numberingSystem) { + localeStr += "-nu-" + numberingSystem; + } + return localeStr; + } else { + return localeStr; + } + } + function mapMonths(f) { + var ms = []; + for (var i = 1; i <= 12; i++) { + var dt = DateTime.utc(2009, i, 1); + ms.push(f(dt)); + } + return ms; + } + function mapWeekdays(f) { + var ms = []; + for (var i = 1; i <= 7; i++) { + var dt = DateTime.utc(2016, 11, 13 + i); + ms.push(f(dt)); + } + return ms; + } + function listStuff(loc, length, englishFn, intlFn) { + var mode = loc.listingMode(); + if (mode === "error") { + return null; + } else if (mode === "en") { + return englishFn(length); + } else { + return intlFn(length); + } + } + function supportsFastNumbers(loc) { + if (loc.numberingSystem && loc.numberingSystem !== "latn") { + return false; + } else { + return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || getCachedIntResolvedOptions(loc.locale).numberingSystem === "latn"; + } + } + + /** + * @private + */ + var PolyNumberFormatter = /*#__PURE__*/function () { + function PolyNumberFormatter(intl, forceSimple, opts) { + this.padTo = opts.padTo || 0; + this.floor = opts.floor || false; + opts.padTo; + opts.floor; + var otherOpts = _objectWithoutPropertiesLoose(opts, _excluded2); + if (!forceSimple || Object.keys(otherOpts).length > 0) { + var intlOpts = _extends({ + useGrouping: false + }, opts); + if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; + this.inf = getCachedINF(intl, intlOpts); + } + } + var _proto = PolyNumberFormatter.prototype; + _proto.format = function format(i) { + if (this.inf) { + var fixed = this.floor ? Math.floor(i) : i; + return this.inf.format(fixed); + } else { + // to match the browser's numberformatter defaults + var _fixed = this.floor ? Math.floor(i) : roundTo(i, 3); + return padStart(_fixed, this.padTo); + } + }; + return PolyNumberFormatter; + }(); + /** + * @private + */ + var PolyDateFormatter = /*#__PURE__*/function () { + function PolyDateFormatter(dt, intl, opts) { + this.opts = opts; + this.originalZone = undefined; + var z = undefined; + if (this.opts.timeZone) { + // Don't apply any workarounds if a timeZone is explicitly provided in opts + this.dt = dt; + } else if (dt.zone.type === "fixed") { + // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like. + // That is why fixed-offset TZ is set to that unless it is: + // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT. + // 2. Unsupported by the browser: + // - some do not support Etc/ + // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata + var gmtOffset = -1 * (dt.offset / 60); + var offsetZ = gmtOffset >= 0 ? "Etc/GMT+" + gmtOffset : "Etc/GMT" + gmtOffset; + if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) { + z = offsetZ; + this.dt = dt; + } else { + // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so + // we manually apply the offset and substitute the zone as needed. + z = "UTC"; + this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({ + minutes: dt.offset + }); + this.originalZone = dt.zone; + } + } else if (dt.zone.type === "system") { + this.dt = dt; + } else if (dt.zone.type === "iana") { + this.dt = dt; + z = dt.zone.name; + } else { + // Custom zones can have any offset / offsetName so we just manually + // apply the offset and substitute the zone as needed. + z = "UTC"; + this.dt = dt.setZone("UTC").plus({ + minutes: dt.offset + }); + this.originalZone = dt.zone; + } + var intlOpts = _extends({}, this.opts); + intlOpts.timeZone = intlOpts.timeZone || z; + this.dtf = getCachedDTF(intl, intlOpts); + } + var _proto2 = PolyDateFormatter.prototype; + _proto2.format = function format() { + if (this.originalZone) { + // If we have to substitute in the actual zone name, we have to use + // formatToParts so that the timezone can be replaced. + return this.formatToParts().map(function (_ref) { + var value = _ref.value; + return value; + }).join(""); + } + return this.dtf.format(this.dt.toJSDate()); + }; + _proto2.formatToParts = function formatToParts() { + var _this = this; + var parts = this.dtf.formatToParts(this.dt.toJSDate()); + if (this.originalZone) { + return parts.map(function (part) { + if (part.type === "timeZoneName") { + var offsetName = _this.originalZone.offsetName(_this.dt.ts, { + locale: _this.dt.locale, + format: _this.opts.timeZoneName + }); + return _extends({}, part, { + value: offsetName + }); + } else { + return part; + } + }); + } + return parts; + }; + _proto2.resolvedOptions = function resolvedOptions() { + return this.dtf.resolvedOptions(); + }; + return PolyDateFormatter; + }(); + /** + * @private + */ + var PolyRelFormatter = /*#__PURE__*/function () { + function PolyRelFormatter(intl, isEnglish, opts) { + this.opts = _extends({ + style: "long" + }, opts); + if (!isEnglish && hasRelative()) { + this.rtf = getCachedRTF(intl, opts); + } + } + var _proto3 = PolyRelFormatter.prototype; + _proto3.format = function format(count, unit) { + if (this.rtf) { + return this.rtf.format(count, unit); + } else { + return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); + } + }; + _proto3.formatToParts = function formatToParts(count, unit) { + if (this.rtf) { + return this.rtf.formatToParts(count, unit); + } else { + return []; + } + }; + return PolyRelFormatter; + }(); + var fallbackWeekSettings = { + firstDay: 1, + minimalDays: 4, + weekend: [6, 7] + }; + + /** + * @private + */ + var Locale = /*#__PURE__*/function () { + Locale.fromOpts = function fromOpts(opts) { + return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN); + }; + Locale.create = function create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN) { + if (defaultToEN === void 0) { + defaultToEN = false; + } + var specifiedLocale = locale || Settings.defaultLocale; + // the system locale is useful for human-readable strings but annoying for parsing/formatting known formats + var localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()); + var numberingSystemR = numberingSystem || Settings.defaultNumberingSystem; + var outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; + var weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings; + return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale); + }; + Locale.resetCache = function resetCache() { + sysLocaleCache = null; + intlDTCache.clear(); + intlNumCache.clear(); + intlRelCache.clear(); + intlResolvedOptionsCache.clear(); + weekInfoCache.clear(); + }; + Locale.fromObject = function fromObject(_temp) { + var _ref2 = _temp === void 0 ? {} : _temp, + locale = _ref2.locale, + numberingSystem = _ref2.numberingSystem, + outputCalendar = _ref2.outputCalendar, + weekSettings = _ref2.weekSettings; + return Locale.create(locale, numberingSystem, outputCalendar, weekSettings); + }; + function Locale(locale, numbering, outputCalendar, weekSettings, specifiedLocale) { + var _parseLocaleString = parseLocaleString(locale), + parsedLocale = _parseLocaleString[0], + parsedNumberingSystem = _parseLocaleString[1], + parsedOutputCalendar = _parseLocaleString[2]; + this.locale = parsedLocale; + this.numberingSystem = numbering || parsedNumberingSystem || null; + this.outputCalendar = outputCalendar || parsedOutputCalendar || null; + this.weekSettings = weekSettings; + this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); + this.weekdaysCache = { + format: {}, + standalone: {} + }; + this.monthsCache = { + format: {}, + standalone: {} + }; + this.meridiemCache = null; + this.eraCache = {}; + this.specifiedLocale = specifiedLocale; + this.fastNumbersCached = null; + } + var _proto4 = Locale.prototype; + _proto4.listingMode = function listingMode() { + var isActuallyEn = this.isEnglish(); + var hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); + return isActuallyEn && hasNoWeirdness ? "en" : "intl"; + }; + _proto4.clone = function clone(alts) { + if (!alts || Object.getOwnPropertyNames(alts).length === 0) { + return this; + } else { + return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false); + } + }; + _proto4.redefaultToEN = function redefaultToEN(alts) { + if (alts === void 0) { + alts = {}; + } + return this.clone(_extends({}, alts, { + defaultToEN: true + })); + }; + _proto4.redefaultToSystem = function redefaultToSystem(alts) { + if (alts === void 0) { + alts = {}; + } + return this.clone(_extends({}, alts, { + defaultToEN: false + })); + }; + _proto4.months = function months$1(length, format) { + var _this2 = this; + if (format === void 0) { + format = false; + } + return listStuff(this, length, months, function () { + // Workaround for "ja" locale: formatToParts does not label all parts of the month + // as "month" and for this locale there is no difference between "format" and "non-format". + // As such, just use format() instead of formatToParts() and take the whole string + var monthSpecialCase = _this2.intl === "ja" || _this2.intl.startsWith("ja-"); + format &= !monthSpecialCase; + var intl = format ? { + month: length, + day: "numeric" + } : { + month: length + }, + formatStr = format ? "format" : "standalone"; + if (!_this2.monthsCache[formatStr][length]) { + var mapper = !monthSpecialCase ? function (dt) { + return _this2.extract(dt, intl, "month"); + } : function (dt) { + return _this2.dtFormatter(dt, intl).format(); + }; + _this2.monthsCache[formatStr][length] = mapMonths(mapper); + } + return _this2.monthsCache[formatStr][length]; + }); + }; + _proto4.weekdays = function weekdays$1(length, format) { + var _this3 = this; + if (format === void 0) { + format = false; + } + return listStuff(this, length, weekdays, function () { + var intl = format ? { + weekday: length, + year: "numeric", + month: "long", + day: "numeric" + } : { + weekday: length + }, + formatStr = format ? "format" : "standalone"; + if (!_this3.weekdaysCache[formatStr][length]) { + _this3.weekdaysCache[formatStr][length] = mapWeekdays(function (dt) { + return _this3.extract(dt, intl, "weekday"); + }); + } + return _this3.weekdaysCache[formatStr][length]; + }); + }; + _proto4.meridiems = function meridiems$1() { + var _this4 = this; + return listStuff(this, undefined, function () { + return meridiems; + }, function () { + // In theory there could be aribitrary day periods. We're gonna assume there are exactly two + // for AM and PM. This is probably wrong, but it's makes parsing way easier. + if (!_this4.meridiemCache) { + var intl = { + hour: "numeric", + hourCycle: "h12" + }; + _this4.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(function (dt) { + return _this4.extract(dt, intl, "dayperiod"); + }); + } + return _this4.meridiemCache; + }); + }; + _proto4.eras = function eras$1(length) { + var _this5 = this; + return listStuff(this, length, eras, function () { + var intl = { + era: length + }; + + // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates + // to definitely enumerate them. + if (!_this5.eraCache[length]) { + _this5.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(function (dt) { + return _this5.extract(dt, intl, "era"); + }); + } + return _this5.eraCache[length]; + }); + }; + _proto4.extract = function extract(dt, intlOpts, field) { + var df = this.dtFormatter(dt, intlOpts), + results = df.formatToParts(), + matching = results.find(function (m) { + return m.type.toLowerCase() === field; + }); + return matching ? matching.value : null; + }; + _proto4.numberFormatter = function numberFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave) + // (in contrast, the rest of the condition is used heavily) + return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); + }; + _proto4.dtFormatter = function dtFormatter(dt, intlOpts) { + if (intlOpts === void 0) { + intlOpts = {}; + } + return new PolyDateFormatter(dt, this.intl, intlOpts); + }; + _proto4.relFormatter = function relFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + return new PolyRelFormatter(this.intl, this.isEnglish(), opts); + }; + _proto4.listFormatter = function listFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + return getCachedLF(this.intl, opts); + }; + _proto4.isEnglish = function isEnglish() { + return this.locale === "en" || this.locale.toLowerCase() === "en-us" || getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us"); + }; + _proto4.getWeekSettings = function getWeekSettings() { + if (this.weekSettings) { + return this.weekSettings; + } else if (!hasLocaleWeekInfo()) { + return fallbackWeekSettings; + } else { + return getCachedWeekInfo(this.locale); + } + }; + _proto4.getStartOfWeek = function getStartOfWeek() { + return this.getWeekSettings().firstDay; + }; + _proto4.getMinDaysInFirstWeek = function getMinDaysInFirstWeek() { + return this.getWeekSettings().minimalDays; + }; + _proto4.getWeekendDays = function getWeekendDays() { + return this.getWeekSettings().weekend; + }; + _proto4.equals = function equals(other) { + return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar; + }; + _proto4.toString = function toString() { + return "Locale(" + this.locale + ", " + this.numberingSystem + ", " + this.outputCalendar + ")"; + }; + _createClass(Locale, [{ + key: "fastNumbers", + get: function get() { + if (this.fastNumbersCached == null) { + this.fastNumbersCached = supportsFastNumbers(this); + } + return this.fastNumbersCached; + } + }]); + return Locale; + }(); + + var singleton = null; + + /** + * A zone with a fixed offset (meaning no DST) + * @implements {Zone} + */ + var FixedOffsetZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(FixedOffsetZone, _Zone); + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + FixedOffsetZone.instance = function instance(offset) { + return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset); + } + + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */; + FixedOffsetZone.parseSpecifier = function parseSpecifier(s) { + if (s) { + var r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + if (r) { + return new FixedOffsetZone(signedOffset(r[1], r[2])); + } + } + return null; + }; + function FixedOffsetZone(offset) { + var _this; + _this = _Zone.call(this) || this; + /** @private **/ + _this.fixed = offset; + return _this; + } + + /** + * The type of zone. `fixed` for all instances of `FixedOffsetZone`. + * @override + * @type {string} + */ + var _proto = FixedOffsetZone.prototype; + /** + * Returns the offset's common name at the specified timestamp. + * + * For fixed offset zones this equals to the zone name. + * @override + */ + _proto.offsetName = function offsetName() { + return this.name; + } + + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */; + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.fixed, format); + } + + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns true for all fixed offset zones. + * @override + * @type {boolean} + */; + /** + * Return the offset in minutes for this zone at the specified timestamp. + * + * For fixed offset zones, this is constant and does not depend on a timestamp. + * @override + * @return {number} + */ + _proto.offset = function offset() { + return this.fixed; + } + + /** + * Return whether this Zone is equal to another zone (i.e. also fixed and same offset) + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */; + _proto.equals = function equals(otherZone) { + return otherZone.type === "fixed" && otherZone.fixed === this.fixed; + } + + /** + * Return whether this Zone is valid: + * All fixed offset zones are valid. + * @override + * @type {boolean} + */; + _createClass(FixedOffsetZone, [{ + key: "type", + get: function get() { + return "fixed"; + } + + /** + * The name of this zone. + * All fixed zones' names always start with "UTC" (plus optional offset) + * @override + * @type {string} + */ + }, { + key: "name", + get: function get() { + return this.fixed === 0 ? "UTC" : "UTC" + formatOffset(this.fixed, "narrow"); + } + + /** + * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn` + * + * @override + * @type {string} + */ + }, { + key: "ianaName", + get: function get() { + if (this.fixed === 0) { + return "Etc/UTC"; + } else { + return "Etc/GMT" + formatOffset(-this.fixed, "narrow"); + } + } + }, { + key: "isUniversal", + get: function get() { + return true; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }], [{ + key: "utcInstance", + get: + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + function get() { + if (singleton === null) { + singleton = new FixedOffsetZone(0); + } + return singleton; + } + }]); + return FixedOffsetZone; + }(Zone); + + /** + * A zone that failed to parse. You should never need to instantiate this. + * @implements {Zone} + */ + var InvalidZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(InvalidZone, _Zone); + function InvalidZone(zoneName) { + var _this; + _this = _Zone.call(this) || this; + /** @private */ + _this.zoneName = zoneName; + return _this; + } + + /** @override **/ + var _proto = InvalidZone.prototype; + /** @override **/ + _proto.offsetName = function offsetName() { + return null; + } + + /** @override **/; + _proto.formatOffset = function formatOffset() { + return ""; + } + + /** @override **/; + _proto.offset = function offset() { + return NaN; + } + + /** @override **/; + _proto.equals = function equals() { + return false; + } + + /** @override **/; + _createClass(InvalidZone, [{ + key: "type", + get: function get() { + return "invalid"; + } + + /** @override **/ + }, { + key: "name", + get: function get() { + return this.zoneName; + } + + /** @override **/ + }, { + key: "isUniversal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return false; + } + }]); + return InvalidZone; + }(Zone); + + /** + * @private + */ + function normalizeZone(input, defaultZone) { + if (isUndefined(input) || input === null) { + return defaultZone; + } else if (input instanceof Zone) { + return input; + } else if (isString(input)) { + var lowered = input.toLowerCase(); + if (lowered === "default") return defaultZone;else if (lowered === "local" || lowered === "system") return SystemZone.instance;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input); + } else if (isNumber(input)) { + return FixedOffsetZone.instance(input); + } else if (typeof input === "object" && "offset" in input && typeof input.offset === "function") { + // This is dumb, but the instanceof check above doesn't seem to really work + // so we're duck checking it + return input; + } else { + return new InvalidZone(input); + } + } + + var numberingSystems = { + arab: "[\u0660-\u0669]", + arabext: "[\u06F0-\u06F9]", + bali: "[\u1B50-\u1B59]", + beng: "[\u09E6-\u09EF]", + deva: "[\u0966-\u096F]", + fullwide: "[\uFF10-\uFF19]", + gujr: "[\u0AE6-\u0AEF]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[\u17E0-\u17E9]", + knda: "[\u0CE6-\u0CEF]", + laoo: "[\u0ED0-\u0ED9]", + limb: "[\u1946-\u194F]", + mlym: "[\u0D66-\u0D6F]", + mong: "[\u1810-\u1819]", + mymr: "[\u1040-\u1049]", + orya: "[\u0B66-\u0B6F]", + tamldec: "[\u0BE6-\u0BEF]", + telu: "[\u0C66-\u0C6F]", + thai: "[\u0E50-\u0E59]", + tibt: "[\u0F20-\u0F29]", + latn: "\\d" + }; + var numberingSystemsUTF16 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881] + }; + var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); + function parseDigits(str) { + var value = parseInt(str, 10); + if (isNaN(value)) { + value = ""; + for (var i = 0; i < str.length; i++) { + var code = str.charCodeAt(i); + if (str[i].search(numberingSystems.hanidec) !== -1) { + value += hanidecChars.indexOf(str[i]); + } else { + for (var key in numberingSystemsUTF16) { + var _numberingSystemsUTF = numberingSystemsUTF16[key], + min = _numberingSystemsUTF[0], + max = _numberingSystemsUTF[1]; + if (code >= min && code <= max) { + value += code - min; + } + } + } + } + return parseInt(value, 10); + } else { + return value; + } + } + + // cache of {numberingSystem: {append: regex}} + var digitRegexCache = new Map(); + function resetDigitRegexCache() { + digitRegexCache.clear(); + } + function digitRegex(_ref, append) { + var numberingSystem = _ref.numberingSystem; + if (append === void 0) { + append = ""; + } + var ns = numberingSystem || "latn"; + var appendCache = digitRegexCache.get(ns); + if (appendCache === undefined) { + appendCache = new Map(); + digitRegexCache.set(ns, appendCache); + } + var regex = appendCache.get(append); + if (regex === undefined) { + regex = new RegExp("" + numberingSystems[ns] + append); + appendCache.set(append, regex); + } + return regex; + } + + var now = function now() { + return Date.now(); + }, + defaultZone = "system", + defaultLocale = null, + defaultNumberingSystem = null, + defaultOutputCalendar = null, + twoDigitCutoffYear = 60, + throwOnInvalid, + defaultWeekSettings = null; + + /** + * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here. + */ + var Settings = /*#__PURE__*/function () { + function Settings() {} + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + Settings.resetCaches = function resetCaches() { + Locale.resetCache(); + IANAZone.resetCache(); + DateTime.resetCache(); + resetDigitRegexCache(); + }; + _createClass(Settings, null, [{ + key: "now", + get: + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + function get() { + return now; + } + + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */, + set: function set(n) { + now = n; + } + + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * Use the value "system" to reset this value to the system's time zone. + * @type {string} + */ + }, { + key: "defaultZone", + get: + /** + * Get the default time zone object currently used to create DateTimes. Does not affect existing instances. + * The default value is the system's time zone (the one set on the machine that runs this code). + * @type {Zone} + */ + function get() { + return normalizeZone(defaultZone, SystemZone.instance); + } + + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(zone) { + defaultZone = zone; + } + }, { + key: "defaultLocale", + get: function get() { + return defaultLocale; + } + + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(locale) { + defaultLocale = locale; + } + + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + }, { + key: "defaultNumberingSystem", + get: function get() { + return defaultNumberingSystem; + } + + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(numberingSystem) { + defaultNumberingSystem = numberingSystem; + } + + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + }, { + key: "defaultOutputCalendar", + get: function get() { + return defaultOutputCalendar; + } + + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */, + set: function set(outputCalendar) { + defaultOutputCalendar = outputCalendar; + } + + /** + * @typedef {Object} WeekSettings + * @property {number} firstDay + * @property {number} minimalDays + * @property {number[]} weekend + */ + + /** + * @return {WeekSettings|null} + */ + }, { + key: "defaultWeekSettings", + get: function get() { + return defaultWeekSettings; + } + + /** + * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and + * how many days are required in the first week of a year. + * Does not affect existing instances. + * + * @param {WeekSettings|null} weekSettings + */, + set: function set(weekSettings) { + defaultWeekSettings = validateWeekSettings(weekSettings); + } + + /** + * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + */ + }, { + key: "twoDigitCutoffYear", + get: function get() { + return twoDigitCutoffYear; + } + + /** + * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century + * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century + * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950 + * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50 + * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50 + */, + set: function set(cutoffYear) { + twoDigitCutoffYear = cutoffYear % 100; + } + + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + }, { + key: "throwOnInvalid", + get: function get() { + return throwOnInvalid; + } + + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */, + set: function set(t) { + throwOnInvalid = t; + } + }]); + return Settings; + }(); + + var Invalid = /*#__PURE__*/function () { + function Invalid(reason, explanation) { + this.reason = reason; + this.explanation = explanation; + } + var _proto = Invalid.prototype; + _proto.toMessage = function toMessage() { + if (this.explanation) { + return this.reason + ": " + this.explanation; + } else { + return this.reason; + } + }; + return Invalid; + }(); + + var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], + leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; + function unitOutOfRange(unit, value) { + return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid"); + } + function dayOfWeek(year, month, day) { + var d = new Date(Date.UTC(year, month - 1, day)); + if (year < 100 && year >= 0) { + d.setUTCFullYear(d.getUTCFullYear() - 1900); + } + var js = d.getUTCDay(); + return js === 0 ? 7 : js; + } + function computeOrdinal(year, month, day) { + return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; + } + function uncomputeOrdinal(year, ordinal) { + var table = isLeapYear(year) ? leapLadder : nonLeapLadder, + month0 = table.findIndex(function (i) { + return i < ordinal; + }), + day = ordinal - table[month0]; + return { + month: month0 + 1, + day: day + }; + } + function isoWeekdayToLocal(isoWeekday, startOfWeek) { + return (isoWeekday - startOfWeek + 7) % 7 + 1; + } + + /** + * @private + */ + + function gregorianToWeek(gregObj, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var year = gregObj.year, + month = gregObj.month, + day = gregObj.day, + ordinal = computeOrdinal(year, month, day), + weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek); + var weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7), + weekYear; + if (weekNumber < 1) { + weekYear = year - 1; + weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek); + } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) { + weekYear = year + 1; + weekNumber = 1; + } else { + weekYear = year; + } + return _extends({ + weekYear: weekYear, + weekNumber: weekNumber, + weekday: weekday + }, timeObject(gregObj)); + } + function weekToGregorian(weekData, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var weekYear = weekData.weekYear, + weekNumber = weekData.weekNumber, + weekday = weekData.weekday, + weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek), + yearInDays = daysInYear(weekYear); + var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek, + year; + if (ordinal < 1) { + year = weekYear - 1; + ordinal += daysInYear(year); + } else if (ordinal > yearInDays) { + year = weekYear + 1; + ordinal -= daysInYear(weekYear); + } else { + year = weekYear; + } + var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal.month, + day = _uncomputeOrdinal.day; + return _extends({ + year: year, + month: month, + day: day + }, timeObject(weekData)); + } + function gregorianToOrdinal(gregData) { + var year = gregData.year, + month = gregData.month, + day = gregData.day; + var ordinal = computeOrdinal(year, month, day); + return _extends({ + year: year, + ordinal: ordinal + }, timeObject(gregData)); + } + function ordinalToGregorian(ordinalData) { + var year = ordinalData.year, + ordinal = ordinalData.ordinal; + var _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal2.month, + day = _uncomputeOrdinal2.day; + return _extends({ + year: year, + month: month, + day: day + }, timeObject(ordinalData)); + } + + /** + * Check if local week units like localWeekday are used in obj. + * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties. + * Modifies obj in-place! + * @param obj the object values + */ + function usesLocalWeekValues(obj, loc) { + var hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear); + if (hasLocaleWeekData) { + var hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear); + if (hasIsoWeekData) { + throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields"); + } + if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday; + if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber; + if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear; + delete obj.localWeekday; + delete obj.localWeekNumber; + delete obj.localWeekYear; + return { + minDaysInFirstWeek: loc.getMinDaysInFirstWeek(), + startOfWeek: loc.getStartOfWeek() + }; + } else { + return { + minDaysInFirstWeek: 4, + startOfWeek: 1 + }; + } + } + function hasInvalidWeekData(obj, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var validYear = isInteger(obj.weekYear), + validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)), + validWeekday = integerBetween(obj.weekday, 1, 7); + if (!validYear) { + return unitOutOfRange("weekYear", obj.weekYear); + } else if (!validWeek) { + return unitOutOfRange("week", obj.weekNumber); + } else if (!validWeekday) { + return unitOutOfRange("weekday", obj.weekday); + } else return false; + } + function hasInvalidOrdinalData(obj) { + var validYear = isInteger(obj.year), + validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validOrdinal) { + return unitOutOfRange("ordinal", obj.ordinal); + } else return false; + } + function hasInvalidGregorianData(obj) { + var validYear = isInteger(obj.year), + validMonth = integerBetween(obj.month, 1, 12), + validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validMonth) { + return unitOutOfRange("month", obj.month); + } else if (!validDay) { + return unitOutOfRange("day", obj.day); + } else return false; + } + function hasInvalidTimeData(obj) { + var hour = obj.hour, + minute = obj.minute, + second = obj.second, + millisecond = obj.millisecond; + var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, + validMinute = integerBetween(minute, 0, 59), + validSecond = integerBetween(second, 0, 59), + validMillisecond = integerBetween(millisecond, 0, 999); + if (!validHour) { + return unitOutOfRange("hour", hour); + } else if (!validMinute) { + return unitOutOfRange("minute", minute); + } else if (!validSecond) { + return unitOutOfRange("second", second); + } else if (!validMillisecond) { + return unitOutOfRange("millisecond", millisecond); + } else return false; + } + + /** + * @private + */ + + // TYPES + + function isUndefined(o) { + return typeof o === "undefined"; + } + function isNumber(o) { + return typeof o === "number"; + } + function isInteger(o) { + return typeof o === "number" && o % 1 === 0; + } + function isString(o) { + return typeof o === "string"; + } + function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; + } + + // CAPABILITIES + + function hasRelative() { + try { + return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; + } catch (e) { + return false; + } + } + function hasLocaleWeekInfo() { + try { + return typeof Intl !== "undefined" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype); + } catch (e) { + return false; + } + } + + // OBJECTS AND ARRAYS + + function maybeArray(thing) { + return Array.isArray(thing) ? thing : [thing]; + } + function bestBy(arr, by, compare) { + if (arr.length === 0) { + return undefined; + } + return arr.reduce(function (best, next) { + var pair = [by(next), next]; + if (!best) { + return pair; + } else if (compare(best[0], pair[0]) === best[0]) { + return best; + } else { + return pair; + } + }, null)[1]; + } + function pick(obj, keys) { + return keys.reduce(function (a, k) { + a[k] = obj[k]; + return a; + }, {}); + } + function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } + function validateWeekSettings(settings) { + if (settings == null) { + return null; + } else if (typeof settings !== "object") { + throw new InvalidArgumentError("Week settings must be an object"); + } else { + if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some(function (v) { + return !integerBetween(v, 1, 7); + })) { + throw new InvalidArgumentError("Invalid week settings"); + } + return { + firstDay: settings.firstDay, + minimalDays: settings.minimalDays, + weekend: Array.from(settings.weekend) + }; + } + } + + // NUMBERS AND STRINGS + + function integerBetween(thing, bottom, top) { + return isInteger(thing) && thing >= bottom && thing <= top; + } + + // x % n but takes the sign of n instead of x + function floorMod(x, n) { + return x - n * Math.floor(x / n); + } + function padStart(input, n) { + if (n === void 0) { + n = 2; + } + var isNeg = input < 0; + var padded; + if (isNeg) { + padded = "-" + ("" + -input).padStart(n, "0"); + } else { + padded = ("" + input).padStart(n, "0"); + } + return padded; + } + function parseInteger(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseInt(string, 10); + } + } + function parseFloating(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseFloat(string); + } + } + function parseMillis(fraction) { + // Return undefined (instead of 0) in these cases, where fraction is not set + if (isUndefined(fraction) || fraction === null || fraction === "") { + return undefined; + } else { + var f = parseFloat("0." + fraction) * 1000; + return Math.floor(f); + } + } + function roundTo(number, digits, rounding) { + if (rounding === void 0) { + rounding = "round"; + } + var factor = Math.pow(10, digits); + switch (rounding) { + case "expand": + return number > 0 ? Math.ceil(number * factor) / factor : Math.floor(number * factor) / factor; + case "trunc": + return Math.trunc(number * factor) / factor; + case "round": + return Math.round(number * factor) / factor; + case "floor": + return Math.floor(number * factor) / factor; + case "ceil": + return Math.ceil(number * factor) / factor; + default: + throw new RangeError("Value rounding " + rounding + " is out of range"); + } + } + + // DATE BASICS + + function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + } + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } + function daysInMonth(year, month) { + var modMonth = floorMod(month - 1, 12) + 1, + modYear = year + (month - modMonth) / 12; + if (modMonth === 2) { + return isLeapYear(modYear) ? 29 : 28; + } else { + return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; + } + } + + // convert a calendar object to a local timestamp (epoch, but with the offset baked in) + function objToLocalTS(obj) { + var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond); + + // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that + if (obj.year < 100 && obj.year >= 0) { + d = new Date(d); + // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not + // so if obj.year is in 99, but obj.day makes it roll over into year 100, + // the calculations done by Date.UTC are using year 2000 - which is incorrect + d.setUTCFullYear(obj.year, obj.month - 1, obj.day); + } + return +d; + } + + // adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js + function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) { + var fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek); + return -fwdlw + minDaysInFirstWeek - 1; + } + function weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek) { + if (minDaysInFirstWeek === void 0) { + minDaysInFirstWeek = 4; + } + if (startOfWeek === void 0) { + startOfWeek = 1; + } + var weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek); + var weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek); + return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7; + } + function untruncateYear(year) { + if (year > 99) { + return year; + } else return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year; + } + + // PARSING + + function parseZoneInfo(ts, offsetFormat, locale, timeZone) { + if (timeZone === void 0) { + timeZone = null; + } + var date = new Date(ts), + intlOpts = { + hourCycle: "h23", + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit" + }; + if (timeZone) { + intlOpts.timeZone = timeZone; + } + var modified = _extends({ + timeZoneName: offsetFormat + }, intlOpts); + var parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(function (m) { + return m.type.toLowerCase() === "timezonename"; + }); + return parsed ? parsed.value : null; + } + + // signedOffset('-5', '30') -> -330 + function signedOffset(offHourStr, offMinuteStr) { + var offHour = parseInt(offHourStr, 10); + + // don't || this because we want to preserve -0 + if (Number.isNaN(offHour)) { + offHour = 0; + } + var offMin = parseInt(offMinuteStr, 10) || 0, + offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; + return offHour * 60 + offMinSigned; + } + + // COERCION + + function asNumber(value) { + var numericValue = Number(value); + if (typeof value === "boolean" || value === "" || !Number.isFinite(numericValue)) throw new InvalidArgumentError("Invalid unit value " + value); + return numericValue; + } + function normalizeObject(obj, normalizer) { + var normalized = {}; + for (var u in obj) { + if (hasOwnProperty(obj, u)) { + var v = obj[u]; + if (v === undefined || v === null) continue; + normalized[normalizer(u)] = asNumber(v); + } + } + return normalized; + } + + /** + * Returns the offset's value as a string + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + function formatOffset(offset, format) { + var hours = Math.trunc(Math.abs(offset / 60)), + minutes = Math.trunc(Math.abs(offset % 60)), + sign = offset >= 0 ? "+" : "-"; + switch (format) { + case "short": + return "" + sign + padStart(hours, 2) + ":" + padStart(minutes, 2); + case "narrow": + return "" + sign + hours + (minutes > 0 ? ":" + minutes : ""); + case "techie": + return "" + sign + padStart(hours, 2) + padStart(minutes, 2); + default: + throw new RangeError("Value format " + format + " is out of range for property format"); + } + } + function timeObject(obj) { + return pick(obj, ["hour", "minute", "second", "millisecond"]); + } + + /** + * @private + */ + + var monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + var monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; + function months(length) { + switch (length) { + case "narrow": + return [].concat(monthsNarrow); + case "short": + return [].concat(monthsShort); + case "long": + return [].concat(monthsLong); + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + default: + return null; + } + } + var weekdaysLong = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; + var weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; + var weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; + function weekdays(length) { + switch (length) { + case "narrow": + return [].concat(weekdaysNarrow); + case "short": + return [].concat(weekdaysShort); + case "long": + return [].concat(weekdaysLong); + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + default: + return null; + } + } + var meridiems = ["AM", "PM"]; + var erasLong = ["Before Christ", "Anno Domini"]; + var erasShort = ["BC", "AD"]; + var erasNarrow = ["B", "A"]; + function eras(length) { + switch (length) { + case "narrow": + return [].concat(erasNarrow); + case "short": + return [].concat(erasShort); + case "long": + return [].concat(erasLong); + default: + return null; + } + } + function meridiemForDateTime(dt) { + return meridiems[dt.hour < 12 ? 0 : 1]; + } + function weekdayForDateTime(dt, length) { + return weekdays(length)[dt.weekday - 1]; + } + function monthForDateTime(dt, length) { + return months(length)[dt.month - 1]; + } + function eraForDateTime(dt, length) { + return eras(length)[dt.year < 0 ? 0 : 1]; + } + function formatRelativeTime(unit, count, numeric, narrow) { + if (numeric === void 0) { + numeric = "always"; + } + if (narrow === void 0) { + narrow = false; + } + var units = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."] + }; + var lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; + if (numeric === "auto" && lastable) { + var isDay = unit === "days"; + switch (count) { + case 1: + return isDay ? "tomorrow" : "next " + units[unit][0]; + case -1: + return isDay ? "yesterday" : "last " + units[unit][0]; + case 0: + return isDay ? "today" : "this " + units[unit][0]; + } + } + + var isInPast = Object.is(count, -0) || count < 0, + fmtValue = Math.abs(count), + singular = fmtValue === 1, + lilUnits = units[unit], + fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit; + return isInPast ? fmtValue + " " + fmtUnit + " ago" : "in " + fmtValue + " " + fmtUnit; + } + + function stringifyTokens(splits, tokenToString) { + var s = ""; + for (var _iterator = _createForOfIteratorHelperLoose(splits), _step; !(_step = _iterator()).done;) { + var token = _step.value; + if (token.literal) { + s += token.val; + } else { + s += tokenToString(token.val); + } + } + return s; + } + var _macroTokenToFormatOpts = { + D: DATE_SHORT, + DD: DATE_MED, + DDD: DATE_FULL, + DDDD: DATE_HUGE, + t: TIME_SIMPLE, + tt: TIME_WITH_SECONDS, + ttt: TIME_WITH_SHORT_OFFSET, + tttt: TIME_WITH_LONG_OFFSET, + T: TIME_24_SIMPLE, + TT: TIME_24_WITH_SECONDS, + TTT: TIME_24_WITH_SHORT_OFFSET, + TTTT: TIME_24_WITH_LONG_OFFSET, + f: DATETIME_SHORT, + ff: DATETIME_MED, + fff: DATETIME_FULL, + ffff: DATETIME_HUGE, + F: DATETIME_SHORT_WITH_SECONDS, + FF: DATETIME_MED_WITH_SECONDS, + FFF: DATETIME_FULL_WITH_SECONDS, + FFFF: DATETIME_HUGE_WITH_SECONDS + }; + + /** + * @private + */ + var Formatter = /*#__PURE__*/function () { + Formatter.create = function create(locale, opts) { + if (opts === void 0) { + opts = {}; + } + return new Formatter(locale, opts); + }; + Formatter.parseFormat = function parseFormat(fmt) { + // white-space is always considered a literal in user-provided formats + // the " " token has a special meaning (see unitForToken) + + var current = null, + currentFull = "", + bracketed = false; + var splits = []; + for (var i = 0; i < fmt.length; i++) { + var c = fmt.charAt(i); + if (c === "'") { + // turn '' into a literal signal quote instead of just skipping the empty literal + if (currentFull.length > 0 || bracketed) { + splits.push({ + literal: bracketed || /^\s+$/.test(currentFull), + val: currentFull === "" ? "'" : currentFull + }); + } + current = null; + currentFull = ""; + bracketed = !bracketed; + } else if (bracketed) { + currentFull += c; + } else if (c === current) { + currentFull += c; + } else { + if (currentFull.length > 0) { + splits.push({ + literal: /^\s+$/.test(currentFull), + val: currentFull + }); + } + currentFull = c; + current = c; + } + } + if (currentFull.length > 0) { + splits.push({ + literal: bracketed || /^\s+$/.test(currentFull), + val: currentFull + }); + } + return splits; + }; + Formatter.macroTokenToFormatOpts = function macroTokenToFormatOpts(token) { + return _macroTokenToFormatOpts[token]; + }; + function Formatter(locale, formatOpts) { + this.opts = formatOpts; + this.loc = locale; + this.systemLoc = null; + } + var _proto = Formatter.prototype; + _proto.formatWithSystemDefault = function formatWithSystemDefault(dt, opts) { + if (this.systemLoc === null) { + this.systemLoc = this.loc.redefaultToSystem(); + } + var df = this.systemLoc.dtFormatter(dt, _extends({}, this.opts, opts)); + return df.format(); + }; + _proto.dtFormatter = function dtFormatter(dt, opts) { + if (opts === void 0) { + opts = {}; + } + return this.loc.dtFormatter(dt, _extends({}, this.opts, opts)); + }; + _proto.formatDateTime = function formatDateTime(dt, opts) { + return this.dtFormatter(dt, opts).format(); + }; + _proto.formatDateTimeParts = function formatDateTimeParts(dt, opts) { + return this.dtFormatter(dt, opts).formatToParts(); + }; + _proto.formatInterval = function formatInterval(interval, opts) { + var df = this.dtFormatter(interval.start, opts); + return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate()); + }; + _proto.resolvedOptions = function resolvedOptions(dt, opts) { + return this.dtFormatter(dt, opts).resolvedOptions(); + }; + _proto.num = function num(n, p, signDisplay) { + if (p === void 0) { + p = 0; + } + if (signDisplay === void 0) { + signDisplay = undefined; + } + // we get some perf out of doing this here, annoyingly + if (this.opts.forceSimple) { + return padStart(n, p); + } + var opts = _extends({}, this.opts); + if (p > 0) { + opts.padTo = p; + } + if (signDisplay) { + opts.signDisplay = signDisplay; + } + return this.loc.numberFormatter(opts).format(n); + }; + _proto.formatDateTimeFromString = function formatDateTimeFromString(dt, fmt) { + var _this = this; + var knownEnglish = this.loc.listingMode() === "en", + useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", + string = function string(opts, extract) { + return _this.loc.extract(dt, opts, extract); + }, + formatOffset = function formatOffset(opts) { + if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { + return "Z"; + } + return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; + }, + meridiem = function meridiem() { + return knownEnglish ? meridiemForDateTime(dt) : string({ + hour: "numeric", + hourCycle: "h12" + }, "dayperiod"); + }, + month = function month(length, standalone) { + return knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { + month: length + } : { + month: length, + day: "numeric" + }, "month"); + }, + weekday = function weekday(length, standalone) { + return knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { + weekday: length + } : { + weekday: length, + month: "long", + day: "numeric" + }, "weekday"); + }, + maybeMacro = function maybeMacro(token) { + var formatOpts = Formatter.macroTokenToFormatOpts(token); + if (formatOpts) { + return _this.formatWithSystemDefault(dt, formatOpts); + } else { + return token; + } + }, + era = function era(length) { + return knownEnglish ? eraForDateTime(dt, length) : string({ + era: length + }, "era"); + }, + tokenToString = function tokenToString(token) { + // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols + switch (token) { + // ms + case "S": + return _this.num(dt.millisecond); + case "u": + // falls through + case "SSS": + return _this.num(dt.millisecond, 3); + // seconds + case "s": + return _this.num(dt.second); + case "ss": + return _this.num(dt.second, 2); + // fractional seconds + case "uu": + return _this.num(Math.floor(dt.millisecond / 10), 2); + case "uuu": + return _this.num(Math.floor(dt.millisecond / 100)); + // minutes + case "m": + return _this.num(dt.minute); + case "mm": + return _this.num(dt.minute, 2); + // hours + case "h": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); + case "hh": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); + case "H": + return _this.num(dt.hour); + case "HH": + return _this.num(dt.hour, 2); + // offset + case "Z": + // like +6 + return formatOffset({ + format: "narrow", + allowZ: _this.opts.allowZ + }); + case "ZZ": + // like +06:00 + return formatOffset({ + format: "short", + allowZ: _this.opts.allowZ + }); + case "ZZZ": + // like +0600 + return formatOffset({ + format: "techie", + allowZ: _this.opts.allowZ + }); + case "ZZZZ": + // like EST + return dt.zone.offsetName(dt.ts, { + format: "short", + locale: _this.loc.locale + }); + case "ZZZZZ": + // like Eastern Standard Time + return dt.zone.offsetName(dt.ts, { + format: "long", + locale: _this.loc.locale + }); + // zone + case "z": + // like America/New_York + return dt.zoneName; + // meridiems + case "a": + return meridiem(); + // dates + case "d": + return useDateTimeFormatter ? string({ + day: "numeric" + }, "day") : _this.num(dt.day); + case "dd": + return useDateTimeFormatter ? string({ + day: "2-digit" + }, "day") : _this.num(dt.day, 2); + // weekdays - standalone + case "c": + // like 1 + return _this.num(dt.weekday); + case "ccc": + // like 'Tues' + return weekday("short", true); + case "cccc": + // like 'Tuesday' + return weekday("long", true); + case "ccccc": + // like 'T' + return weekday("narrow", true); + // weekdays - format + case "E": + // like 1 + return _this.num(dt.weekday); + case "EEE": + // like 'Tues' + return weekday("short", false); + case "EEEE": + // like 'Tuesday' + return weekday("long", false); + case "EEEEE": + // like 'T' + return weekday("narrow", false); + // months - standalone + case "L": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric", + day: "numeric" + }, "month") : _this.num(dt.month); + case "LL": + // like 01, doesn't seem to work + return useDateTimeFormatter ? string({ + month: "2-digit", + day: "numeric" + }, "month") : _this.num(dt.month, 2); + case "LLL": + // like Jan + return month("short", true); + case "LLLL": + // like January + return month("long", true); + case "LLLLL": + // like J + return month("narrow", true); + // months - format + case "M": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric" + }, "month") : _this.num(dt.month); + case "MM": + // like 01 + return useDateTimeFormatter ? string({ + month: "2-digit" + }, "month") : _this.num(dt.month, 2); + case "MMM": + // like Jan + return month("short", false); + case "MMMM": + // like January + return month("long", false); + case "MMMMM": + // like J + return month("narrow", false); + // years + case "y": + // like 2014 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year); + case "yy": + // like 14 + return useDateTimeFormatter ? string({ + year: "2-digit" + }, "year") : _this.num(dt.year.toString().slice(-2), 2); + case "yyyy": + // like 0012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 4); + case "yyyyyy": + // like 000012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 6); + // eras + case "G": + // like AD + return era("short"); + case "GG": + // like Anno Domini + return era("long"); + case "GGGGG": + return era("narrow"); + case "kk": + return _this.num(dt.weekYear.toString().slice(-2), 2); + case "kkkk": + return _this.num(dt.weekYear, 4); + case "W": + return _this.num(dt.weekNumber); + case "WW": + return _this.num(dt.weekNumber, 2); + case "n": + return _this.num(dt.localWeekNumber); + case "nn": + return _this.num(dt.localWeekNumber, 2); + case "ii": + return _this.num(dt.localWeekYear.toString().slice(-2), 2); + case "iiii": + return _this.num(dt.localWeekYear, 4); + case "o": + return _this.num(dt.ordinal); + case "ooo": + return _this.num(dt.ordinal, 3); + case "q": + // like 1 + return _this.num(dt.quarter); + case "qq": + // like 01 + return _this.num(dt.quarter, 2); + case "X": + return _this.num(Math.floor(dt.ts / 1000)); + case "x": + return _this.num(dt.ts); + default: + return maybeMacro(token); + } + }; + return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); + }; + _proto.formatDurationFromString = function formatDurationFromString(dur, fmt) { + var _this2 = this; + var invertLargest = this.opts.signMode === "negativeLargestOnly" ? -1 : 1; + var tokenToField = function tokenToField(token) { + switch (token[0]) { + case "S": + return "milliseconds"; + case "s": + return "seconds"; + case "m": + return "minutes"; + case "h": + return "hours"; + case "d": + return "days"; + case "w": + return "weeks"; + case "M": + return "months"; + case "y": + return "years"; + default: + return null; + } + }, + tokenToString = function tokenToString(lildur, info) { + return function (token) { + var mapped = tokenToField(token); + if (mapped) { + var inversionFactor = info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1; + var signDisplay; + if (_this2.opts.signMode === "negativeLargestOnly" && mapped !== info.largestUnit) { + signDisplay = "never"; + } else if (_this2.opts.signMode === "all") { + signDisplay = "always"; + } else { + // "auto" and "negative" are the same, but "auto" has better support + signDisplay = "auto"; + } + return _this2.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay); + } else { + return token; + } + }; + }, + tokens = Formatter.parseFormat(fmt), + realTokens = tokens.reduce(function (found, _ref) { + var literal = _ref.literal, + val = _ref.val; + return literal ? found : found.concat(val); + }, []), + collapsed = dur.shiftTo.apply(dur, realTokens.map(tokenToField).filter(function (t) { + return t; + })), + durationInfo = { + isNegativeDuration: collapsed < 0, + // this relies on "collapsed" being based on "shiftTo", which builds up the object + // in order + largestUnit: Object.keys(collapsed.values)[0] + }; + return stringifyTokens(tokens, tokenToString(collapsed, durationInfo)); + }; + return Formatter; + }(); + + /* + * This file handles parsing for well-specified formats. Here's how it works: + * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. + * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object + * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. + * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. + * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. + * Some extractions are super dumb and simpleParse and fromStrings help DRY them. + */ + + var ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/; + function combineRegexes() { + for (var _len = arguments.length, regexes = new Array(_len), _key = 0; _key < _len; _key++) { + regexes[_key] = arguments[_key]; + } + var full = regexes.reduce(function (f, r) { + return f + r.source; + }, ""); + return RegExp("^" + full + "$"); + } + function combineExtractors() { + for (var _len2 = arguments.length, extractors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + extractors[_key2] = arguments[_key2]; + } + return function (m) { + return extractors.reduce(function (_ref, ex) { + var mergedVals = _ref[0], + mergedZone = _ref[1], + cursor = _ref[2]; + var _ex = ex(m, cursor), + val = _ex[0], + zone = _ex[1], + next = _ex[2]; + return [_extends({}, mergedVals, val), zone || mergedZone, next]; + }, [{}, null, 1]).slice(0, 2); + }; + } + function parse(s) { + if (s == null) { + return [null, null]; + } + for (var _len3 = arguments.length, patterns = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + patterns[_key3 - 1] = arguments[_key3]; + } + for (var _i = 0, _patterns = patterns; _i < _patterns.length; _i++) { + var _patterns$_i = _patterns[_i], + regex = _patterns$_i[0], + extractor = _patterns$_i[1]; + var m = regex.exec(s); + if (m) { + return extractor(m); + } + } + return [null, null]; + } + function simpleParse() { + for (var _len4 = arguments.length, keys = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + keys[_key4] = arguments[_key4]; + } + return function (match, cursor) { + var ret = {}; + var i; + for (i = 0; i < keys.length; i++) { + ret[keys[i]] = parseInteger(match[cursor + i]); + } + return [ret, null, cursor + i]; + }; + } + + // ISO and SQL parsing + var offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/; + var isoExtendedZone = "(?:" + offsetRegex.source + "?(?:\\[(" + ianaRegex.source + ")\\])?)?"; + var isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/; + var isoTimeRegex = RegExp("" + isoTimeBaseRegex.source + isoExtendedZone); + var isoTimeExtensionRegex = RegExp("(?:[Tt]" + isoTimeRegex.source + ")?"); + var isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/; + var isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/; + var isoOrdinalRegex = /(\d{4})-?(\d{3})/; + var extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"); + var extractISOOrdinalData = simpleParse("year", "ordinal"); + var sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/; // dumbed-down version of the ISO one + var sqlTimeRegex = RegExp(isoTimeBaseRegex.source + " ?(?:" + offsetRegex.source + "|(" + ianaRegex.source + "))?"); + var sqlTimeExtensionRegex = RegExp("(?: " + sqlTimeRegex.source + ")?"); + function int(match, pos, fallback) { + var m = match[pos]; + return isUndefined(m) ? fallback : parseInteger(m); + } + function extractISOYmd(match, cursor) { + var item = { + year: int(match, cursor), + month: int(match, cursor + 1, 1), + day: int(match, cursor + 2, 1) + }; + return [item, null, cursor + 3]; + } + function extractISOTime(match, cursor) { + var item = { + hours: int(match, cursor, 0), + minutes: int(match, cursor + 1, 0), + seconds: int(match, cursor + 2, 0), + milliseconds: parseMillis(match[cursor + 3]) + }; + return [item, null, cursor + 4]; + } + function extractISOOffset(match, cursor) { + var local = !match[cursor] && !match[cursor + 1], + fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), + zone = local ? null : FixedOffsetZone.instance(fullOffset); + return [{}, zone, cursor + 3]; + } + function extractIANAZone(match, cursor) { + var zone = match[cursor] ? IANAZone.create(match[cursor]) : null; + return [{}, zone, cursor + 1]; + } + + // ISO time parsing + + var isoTimeOnly = RegExp("^T?" + isoTimeBaseRegex.source + "$"); + + // ISO duration parsing + + var isoDuration = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/; + function extractISODuration(match) { + var s = match[0], + yearStr = match[1], + monthStr = match[2], + weekStr = match[3], + dayStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + millisecondsStr = match[8]; + var hasNegativePrefix = s[0] === "-"; + var negativeSeconds = secondStr && secondStr[0] === "-"; + var maybeNegate = function maybeNegate(num, force) { + if (force === void 0) { + force = false; + } + return num !== undefined && (force || num && hasNegativePrefix) ? -num : num; + }; + return [{ + years: maybeNegate(parseFloating(yearStr)), + months: maybeNegate(parseFloating(monthStr)), + weeks: maybeNegate(parseFloating(weekStr)), + days: maybeNegate(parseFloating(dayStr)), + hours: maybeNegate(parseFloating(hourStr)), + minutes: maybeNegate(parseFloating(minuteStr)), + seconds: maybeNegate(parseFloating(secondStr), secondStr === "-0"), + milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds) + }]; + } + + // These are a little braindead. EDT *should* tell us that we're in, say, America/New_York + // and not just that we're in -240 *right now*. But since I don't think these are used that often + // I'm just going to ignore that + var obsOffsets = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 + }; + function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + var result = { + year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), + month: monthsShort.indexOf(monthStr) + 1, + day: parseInteger(dayStr), + hour: parseInteger(hourStr), + minute: parseInteger(minuteStr) + }; + if (secondStr) result.second = parseInteger(secondStr); + if (weekdayStr) { + result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1; + } + return result; + } + + // RFC 2822/5322 + var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; + function extractRFC2822(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + obsOffset = match[8], + milOffset = match[9], + offHourStr = match[10], + offMinuteStr = match[11], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + var offset; + if (obsOffset) { + offset = obsOffsets[obsOffset]; + } else if (milOffset) { + offset = 0; + } else { + offset = signedOffset(offHourStr, offMinuteStr); + } + return [result, new FixedOffsetZone(offset)]; + } + function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); + } + + // http date + + var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, + rfc850 = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, + ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; + function extractRFC1123Or850(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; + } + function extractASCII(match) { + var weekdayStr = match[1], + monthStr = match[2], + dayStr = match[3], + hourStr = match[4], + minuteStr = match[5], + secondStr = match[6], + yearStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; + } + var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); + var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); + var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); + var isoTimeCombinedRegex = combineRegexes(isoTimeRegex); + var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone); + var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset, extractIANAZone); + var extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset, extractIANAZone); + var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); + + /* + * @private + */ + + function parseISODate(s) { + return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]); + } + function parseRFC2822Date(s) { + return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]); + } + function parseHTTPDate(s) { + return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]); + } + function parseISODuration(s) { + return parse(s, [isoDuration, extractISODuration]); + } + var extractISOTimeOnly = combineExtractors(extractISOTime); + function parseISOTimeOnly(s) { + return parse(s, [isoTimeOnly, extractISOTimeOnly]); + } + var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); + var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); + var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); + function parseSQL(s) { + return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]); + } + + var INVALID$2 = "Invalid Duration"; + + // unit conversion constants + var lowOrderMatrix = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1000 + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1000 + }, + hours: { + minutes: 60, + seconds: 60 * 60, + milliseconds: 60 * 60 * 1000 + }, + minutes: { + seconds: 60, + milliseconds: 60 * 1000 + }, + seconds: { + milliseconds: 1000 + } + }, + casualMatrix = _extends({ + years: { + quarters: 4, + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + seconds: 91 * 24 * 60 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1000 + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix), + daysInYearAccurate = 146097.0 / 400, + daysInMonthAccurate = 146097.0 / 4800, + accurateMatrix = _extends({ + years: { + quarters: 4, + months: 12, + weeks: daysInYearAccurate / 7, + days: daysInYearAccurate, + hours: daysInYearAccurate * 24, + minutes: daysInYearAccurate * 24 * 60, + seconds: daysInYearAccurate * 24 * 60 * 60, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: daysInYearAccurate / 28, + days: daysInYearAccurate / 4, + hours: daysInYearAccurate * 24 / 4, + minutes: daysInYearAccurate * 24 * 60 / 4, + seconds: daysInYearAccurate * 24 * 60 * 60 / 4, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 / 4 + }, + months: { + weeks: daysInMonthAccurate / 7, + days: daysInMonthAccurate, + hours: daysInMonthAccurate * 24, + minutes: daysInMonthAccurate * 24 * 60, + seconds: daysInMonthAccurate * 24 * 60 * 60, + milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix); + + // units ordered by size + var orderedUnits$1 = ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"]; + var reverseUnits = orderedUnits$1.slice(0).reverse(); + + // clone really means "create another instance just like this one, but with these changes" + function clone$1(dur, alts, clear) { + if (clear === void 0) { + clear = false; + } + // deep merge for vals + var conf = { + values: clear ? alts.values : _extends({}, dur.values, alts.values || {}), + loc: dur.loc.clone(alts.loc), + conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy, + matrix: alts.matrix || dur.matrix + }; + return new Duration(conf); + } + function durationToMillis(matrix, vals) { + var _vals$milliseconds; + var sum = (_vals$milliseconds = vals.milliseconds) != null ? _vals$milliseconds : 0; + for (var _iterator = _createForOfIteratorHelperLoose(reverseUnits.slice(1)), _step; !(_step = _iterator()).done;) { + var unit = _step.value; + if (vals[unit]) { + sum += vals[unit] * matrix[unit]["milliseconds"]; + } + } + return sum; + } + + // NB: mutates parameters + function normalizeValues(matrix, vals) { + // the logic below assumes the overall value of the duration is positive + // if this is not the case, factor is used to make it so + var factor = durationToMillis(matrix, vals) < 0 ? -1 : 1; + orderedUnits$1.reduceRight(function (previous, current) { + if (!isUndefined(vals[current])) { + if (previous) { + var previousVal = vals[previous] * factor; + var conv = matrix[current][previous]; + + // if (previousVal < 0): + // lower order unit is negative (e.g. { years: 2, days: -2 }) + // normalize this by reducing the higher order unit by the appropriate amount + // and increasing the lower order unit + // this can never make the higher order unit negative, because this function only operates + // on positive durations, so the amount of time represented by the lower order unit cannot + // be larger than the higher order unit + // else: + // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 }) + // in this case we attempt to convert as much as possible from the lower order unit into + // the higher order one + // + // Math.floor takes care of both of these cases, rounding away from 0 + // if previousVal < 0 it makes the absolute value larger + // if previousVal >= it makes the absolute value smaller + var rollUp = Math.floor(previousVal / conv); + vals[current] += rollUp * factor; + vals[previous] -= rollUp * conv * factor; + } + return current; + } else { + return previous; + } + }, null); + + // try to convert any decimals into smaller units if possible + // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 } + orderedUnits$1.reduce(function (previous, current) { + if (!isUndefined(vals[current])) { + if (previous) { + var fraction = vals[previous] % 1; + vals[previous] -= fraction; + vals[current] += fraction * matrix[previous][current]; + } + return current; + } else { + return previous; + } + }, null); + } + + // Remove all properties with a value of 0 from an object + function removeZeroes(vals) { + var newVals = {}; + for (var _i = 0, _Object$entries = Object.entries(vals); _i < _Object$entries.length; _i++) { + var _Object$entries$_i = _Object$entries[_i], + key = _Object$entries$_i[0], + value = _Object$entries$_i[1]; + if (value !== 0) { + newVals[key] = value; + } + } + return newVals; + } + + /** + * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime#plus} to add a Duration object to a DateTime, producing another DateTime. + * + * Here is a brief overview of commonly used methods and getters in Duration: + * + * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. + * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors. + * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors. + * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}. + * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON} + * + * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. + */ + var Duration = /*#__PURE__*/function (_Symbol$for) { + /** + * @private + */ + function Duration(config) { + var accurate = config.conversionAccuracy === "longterm" || false; + var matrix = accurate ? accurateMatrix : casualMatrix; + if (config.matrix) { + matrix = config.matrix; + } + + /** + * @access private + */ + this.values = config.values; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.conversionAccuracy = accurate ? "longterm" : "casual"; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.matrix = matrix; + /** + * @access private + */ + this.isLuxonDuration = true; + } + + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + Duration.fromMillis = function fromMillis(count, opts) { + return Duration.fromObject({ + milliseconds: count + }, opts); + } + + /** + * Create a Duration from a JavaScript object with keys like 'years' and 'hours'. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {Object} [opts=[]] - options for creating this Duration + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the custom conversion system to use + * @return {Duration} + */; + Duration.fromObject = function fromObject(obj, opts) { + if (opts === void 0) { + opts = {}; + } + if (obj == null || typeof obj !== "object") { + throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got " + (obj === null ? "null" : typeof obj)); + } + return new Duration({ + values: normalizeObject(obj, Duration.normalizeUnit), + loc: Locale.fromObject(opts), + conversionAccuracy: opts.conversionAccuracy, + matrix: opts.matrix + }); + } + + /** + * Create a Duration from DurationLike. + * + * @param {Object | number | Duration} durationLike + * One of: + * - object with keys like 'years' and 'hours'. + * - number representing milliseconds + * - Duration instance + * @return {Duration} + */; + Duration.fromDurationLike = function fromDurationLike(durationLike) { + if (isNumber(durationLike)) { + return Duration.fromMillis(durationLike); + } else if (Duration.isDuration(durationLike)) { + return durationLike; + } else if (typeof durationLike === "object") { + return Duration.fromObject(durationLike); + } else { + throw new InvalidArgumentError("Unknown duration argument " + durationLike + " of type " + typeof durationLike); + } + } + + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the preset conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */; + Duration.fromISO = function fromISO(text, opts) { + var _parseISODuration = parseISODuration(text), + parsed = _parseISODuration[0]; + if (parsed) { + return Duration.fromObject(parsed, opts); + } else { + return Duration.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + } + + /** + * Create a Duration from an ISO 8601 time string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 } + * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @return {Duration} + */; + Duration.fromISOTime = function fromISOTime(text, opts) { + var _parseISOTimeOnly = parseISOTimeOnly(text), + parsed = _parseISOTimeOnly[0]; + if (parsed) { + return Duration.fromObject(parsed, opts); + } else { + return Duration.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + } + + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */; + Duration.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); + } + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidDurationError(invalid); + } else { + return new Duration({ + invalid: invalid + }); + } + } + + /** + * @private + */; + Duration.normalizeUnit = function normalizeUnit(unit) { + var normalized = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds" + }[unit ? unit.toLowerCase() : unit]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } + + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */; + Duration.isDuration = function isDuration(o) { + return o && o.isLuxonDuration || false; + } + + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */; + var _proto = Duration.prototype; + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `w` for weeks + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * Tokens can be escaped by wrapping with single quotes. + * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat("d s", { signMode: "all" }) //=> "+6 +2" + * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "all" }) //=> "-6 -2" + * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "negativeLargestOnly" }) //=> "-6 2" + * @return {string} + */ + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + // reverse-compat since 1.2; we always round down now, never up, and we do it by default + var fmtOpts = _extends({}, opts, { + floor: opts.round !== false && opts.floor !== false + }); + return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2; + } + + /** + * Returns a string representation of a Duration with all units included. + * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options + * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`. + * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor. + * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero + * @example + * ```js + * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 }) + * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes' + * dur.toHuman({ listStyle: "long" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes' + * dur.toHuman({ unitDisplay: "short" }) //=> '1 mth, 0 wks, 5 hr, 6 min' + * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes' + * ``` + */; + _proto.toHuman = function toHuman(opts) { + var _this = this; + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) return INVALID$2; + var showZeros = opts.showZeros !== false; + var l = orderedUnits$1.map(function (unit) { + var val = _this.values[unit]; + if (isUndefined(val) || val === 0 && !showZeros) { + return null; + } + return _this.loc.numberFormatter(_extends({ + style: "unit", + unitDisplay: "long" + }, opts, { + unit: unit.slice(0, -1) + })).format(val); + }).filter(function (n) { + return n; + }); + return this.loc.listFormatter(_extends({ + type: "conjunction", + style: opts.listStyle || "narrow" + }, opts)).format(l); + } + + /** + * Returns a JavaScript object with this Duration's values. + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */; + _proto.toObject = function toObject() { + if (!this.isValid) return {}; + return _extends({}, this.values); + } + + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */; + _proto.toISO = function toISO() { + // we could use the formatter, but this is an easier way to get the minimum string + if (!this.isValid) return null; + var s = "P"; + if (this.years !== 0) s += this.years + "Y"; + if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + "M"; + if (this.weeks !== 0) s += this.weeks + "W"; + if (this.days !== 0) s += this.days + "D"; + if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) s += "T"; + if (this.hours !== 0) s += this.hours + "H"; + if (this.minutes !== 0) s += this.minutes + "M"; + if (this.seconds !== 0 || this.milliseconds !== 0) + // this will handle "floating point madness" by removing extra decimal places + // https://stackoverflow.com/questions/588004/is-floating-point-math-broken + s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S"; + if (s === "P") s += "T0S"; + return s; + } + + /** + * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day. + * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours. + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000' + * @return {string} + */; + _proto.toISOTime = function toISOTime(opts) { + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) return null; + var millis = this.toMillis(); + if (millis < 0 || millis >= 86400000) return null; + opts = _extends({ + suppressMilliseconds: false, + suppressSeconds: false, + includePrefix: false, + format: "extended" + }, opts, { + includeOffset: false + }); + var dateTime = DateTime.fromMillis(millis, { + zone: "UTC" + }); + return dateTime.toISOTime(opts); + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */; + _proto.toJSON = function toJSON() { + return this.toISO(); + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */; + _proto.toString = function toString() { + return this.toISO(); + } + + /** + * Returns a string representation of this Duration appropriate for the REPL. + * @return {string} + */; + _proto[_Symbol$for] = function () { + if (this.isValid) { + return "Duration { values: " + JSON.stringify(this.values) + " }"; + } else { + return "Duration { Invalid, reason: " + this.invalidReason + " }"; + } + } + + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */; + _proto.toMillis = function toMillis() { + if (!this.isValid) return NaN; + return durationToMillis(this.matrix, this.values); + } + + /** + * Returns an milliseconds value of this Duration. Alias of {@link toMillis} + * @return {number} + */; + _proto.valueOf = function valueOf() { + return this.toMillis(); + } + + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */; + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration), + result = {}; + for (var _i2 = 0, _orderedUnits = orderedUnits$1; _i2 < _orderedUnits.length; _i2++) { + var k = _orderedUnits[_i2]; + if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { + result[k] = dur.get(k) + this.get(k); + } + } + return clone$1(this, { + values: result + }, true); + } + + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */; + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration); + return this.plus(dur.negate()); + } + + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */; + _proto.mapUnits = function mapUnits(fn) { + if (!this.isValid) return this; + var result = {}; + for (var _i3 = 0, _Object$keys = Object.keys(this.values); _i3 < _Object$keys.length; _i3++) { + var k = _Object$keys[_i3]; + result[k] = asNumber(fn(this.values[k], k)); + } + return clone$1(this, { + values: result + }, true); + } + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3 + * @return {number} + */; + _proto.get = function get(unit) { + return this[Duration.normalizeUnit(unit)]; + } + + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */; + _proto.set = function set(values) { + if (!this.isValid) return this; + var mixed = _extends({}, this.values, normalizeObject(values, Duration.normalizeUnit)); + return clone$1(this, { + values: mixed + }); + } + + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */; + _proto.reconfigure = function reconfigure(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + locale = _ref.locale, + numberingSystem = _ref.numberingSystem, + conversionAccuracy = _ref.conversionAccuracy, + matrix = _ref.matrix; + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem + }); + var opts = { + loc: loc, + matrix: matrix, + conversionAccuracy: conversionAccuracy + }; + return clone$1(this, opts); + } + + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */; + _proto.as = function as(unit) { + return this.isValid ? this.shiftTo(unit).get(unit) : NaN; + } + + /** + * Reduce this Duration to its canonical representation in its current units. + * Assuming the overall value of the Duration is positive, this means: + * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example) + * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise + * the overall value would be negative, see third example) + * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example) + * + * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 } + * @return {Duration} + */; + _proto.normalize = function normalize() { + if (!this.isValid) return this; + var vals = this.toObject(); + normalizeValues(this.matrix, vals); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Rescale units to its largest representation + * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 } + * @return {Duration} + */; + _proto.rescale = function rescale() { + if (!this.isValid) return this; + var vals = removeZeroes(this.normalize().shiftToAll().toObject()); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */; + _proto.shiftTo = function shiftTo() { + for (var _len = arguments.length, units = new Array(_len), _key = 0; _key < _len; _key++) { + units[_key] = arguments[_key]; + } + if (!this.isValid) return this; + if (units.length === 0) { + return this; + } + units = units.map(function (u) { + return Duration.normalizeUnit(u); + }); + var built = {}, + accumulated = {}, + vals = this.toObject(); + var lastUnit; + for (var _i4 = 0, _orderedUnits2 = orderedUnits$1; _i4 < _orderedUnits2.length; _i4++) { + var k = _orderedUnits2[_i4]; + if (units.indexOf(k) >= 0) { + lastUnit = k; + var own = 0; + + // anything we haven't boiled down yet should get boiled to this unit + for (var ak in accumulated) { + own += this.matrix[ak][k] * accumulated[ak]; + accumulated[ak] = 0; + } + + // plus anything that's already in this unit + if (isNumber(vals[k])) { + own += vals[k]; + } + + // only keep the integer part for now in the hopes of putting any decimal part + // into a smaller unit later + var i = Math.trunc(own); + built[k] = i; + accumulated[k] = (own * 1000 - i * 1000) / 1000; + + // otherwise, keep it in the wings to boil it later + } else if (isNumber(vals[k])) { + accumulated[k] = vals[k]; + } + } + + // anything leftover becomes the decimal for the last unit + // lastUnit must be defined since units is not empty + for (var key in accumulated) { + if (accumulated[key] !== 0) { + built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; + } + } + normalizeValues(this.matrix, built); + return clone$1(this, { + values: built + }, true); + } + + /** + * Shift this Duration to all available units. + * Same as shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds") + * @return {Duration} + */; + _proto.shiftToAll = function shiftToAll() { + if (!this.isValid) return this; + return this.shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"); + } + + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */; + _proto.negate = function negate() { + if (!this.isValid) return this; + var negated = {}; + for (var _i5 = 0, _Object$keys2 = Object.keys(this.values); _i5 < _Object$keys2.length; _i5++) { + var k = _Object$keys2[_i5]; + negated[k] = this.values[k] === 0 ? 0 : -this.values[k]; + } + return clone$1(this, { + values: negated + }, true); + } + + /** + * Removes all units with values equal to 0 from this Duration. + * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 } + * @return {Duration} + */; + _proto.removeZeros = function removeZeros() { + if (!this.isValid) return this; + var vals = removeZeroes(this.values); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Get the years. + * @type {number} + */; + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + if (!this.loc.equals(other.loc)) { + return false; + } + function eq(v1, v2) { + // Consider 0 and undefined as equal + if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0; + return v1 === v2; + } + for (var _i6 = 0, _orderedUnits3 = orderedUnits$1; _i6 < _orderedUnits3.length; _i6++) { + var u = _orderedUnits3[_i6]; + if (!eq(this.values[u], other.values[u])) { + return false; + } + } + return true; + }; + _createClass(Duration, [{ + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + }, { + key: "years", + get: function get() { + return this.isValid ? this.values.years || 0 : NaN; + } + + /** + * Get the quarters. + * @type {number} + */ + }, { + key: "quarters", + get: function get() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + + /** + * Get the months. + * @type {number} + */ + }, { + key: "months", + get: function get() { + return this.isValid ? this.values.months || 0 : NaN; + } + + /** + * Get the weeks + * @type {number} + */ + }, { + key: "weeks", + get: function get() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + + /** + * Get the days. + * @type {number} + */ + }, { + key: "days", + get: function get() { + return this.isValid ? this.values.days || 0 : NaN; + } + + /** + * Get the hours. + * @type {number} + */ + }, { + key: "hours", + get: function get() { + return this.isValid ? this.values.hours || 0 : NaN; + } + + /** + * Get the minutes. + * @type {number} + */ + }, { + key: "minutes", + get: function get() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + + /** + * Get the seconds. + * @return {number} + */ + }, { + key: "seconds", + get: function get() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + + /** + * Get the milliseconds. + * @return {number} + */ + }, { + key: "milliseconds", + get: function get() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + }, { + key: "isValid", + get: function get() { + return this.invalid === null; + } + + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + return Duration; + }(Symbol.for("nodejs.util.inspect.custom")); + + var INVALID$1 = "Invalid Interval"; + + // checks if the start is equal to or before the end + function validateStartEnd(start, end) { + if (!start || !start.isValid) { + return Interval.invalid("missing or invalid start"); + } else if (!end || !end.isValid) { + return Interval.invalid("missing or invalid end"); + } else if (end < start) { + return Interval.invalid("end before start", "The end of an interval must be after its start, but you had start=" + start.toISO() + " and end=" + end.toISO()); + } else { + return null; + } + } + + /** + * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them. + * + * Here is a brief overview of the most commonly used methods and getters in Interval: + * + * * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}. + * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end. + * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}. + * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}. + * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs} + * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}. + */ + var Interval = /*#__PURE__*/function (_Symbol$for) { + /** + * @private + */ + function Interval(config) { + /** + * @access private + */ + this.s = config.start; + /** + * @access private + */ + this.e = config.end; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.isLuxonInterval = true; + } + + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + Interval.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); + } + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidIntervalError(invalid); + } else { + return new Interval({ + invalid: invalid + }); + } + } + + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */; + Interval.fromDateTimes = function fromDateTimes(start, end) { + var builtStart = friendlyDateTime(start), + builtEnd = friendlyDateTime(end); + var validateError = validateStartEnd(builtStart, builtEnd); + if (validateError == null) { + return new Interval({ + start: builtStart, + end: builtEnd + }); + } else { + return validateError; + } + } + + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */; + Interval.after = function after(start, duration) { + var dur = Duration.fromDurationLike(duration), + dt = friendlyDateTime(start); + return Interval.fromDateTimes(dt, dt.plus(dur)); + } + + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */; + Interval.before = function before(end, duration) { + var dur = Duration.fromDurationLike(duration), + dt = friendlyDateTime(end); + return Interval.fromDateTimes(dt.minus(dur), dt); + } + + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */; + Interval.fromISO = function fromISO(text, opts) { + var _split = (text || "").split("/", 2), + s = _split[0], + e = _split[1]; + if (s && e) { + var start, startIsValid; + try { + start = DateTime.fromISO(s, opts); + startIsValid = start.isValid; + } catch (e) { + startIsValid = false; + } + var end, endIsValid; + try { + end = DateTime.fromISO(e, opts); + endIsValid = end.isValid; + } catch (e) { + endIsValid = false; + } + if (startIsValid && endIsValid) { + return Interval.fromDateTimes(start, end); + } + if (startIsValid) { + var dur = Duration.fromISO(e, opts); + if (dur.isValid) { + return Interval.after(start, dur); + } + } else if (endIsValid) { + var _dur = Duration.fromISO(s, opts); + if (_dur.isValid) { + return Interval.before(end, _dur); + } + } + } + return Interval.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */; + Interval.isInterval = function isInterval(o) { + return o && o.isLuxonInterval || false; + } + + /** + * Returns the start of the Interval + * @type {DateTime} + */; + var _proto = Interval.prototype; + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + _proto.length = function length(unit) { + if (unit === void 0) { + unit = "milliseconds"; + } + return this.isValid ? this.toDuration.apply(this, [unit]).get(unit) : NaN; + } + + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime + * @return {number} + */; + _proto.count = function count(unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + if (!this.isValid) return NaN; + var start = this.start.startOf(unit, opts); + var end; + if (opts != null && opts.useLocaleWeeks) { + end = this.end.reconfigure({ + locale: start.locale + }); + } else { + end = this.end; + } + end = end.startOf(unit, opts); + return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf()); + } + + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */; + _proto.hasSame = function hasSame(unit) { + return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false; + } + + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */; + _proto.isEmpty = function isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */; + _proto.isAfter = function isAfter(dateTime) { + if (!this.isValid) return false; + return this.s > dateTime; + } + + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */; + _proto.isBefore = function isBefore(dateTime) { + if (!this.isValid) return false; + return this.e <= dateTime; + } + + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */; + _proto.contains = function contains(dateTime) { + if (!this.isValid) return false; + return this.s <= dateTime && this.e > dateTime; + } + + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */; + _proto.set = function set(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + start = _ref.start, + end = _ref.end; + if (!this.isValid) return this; + return Interval.fromDateTimes(start || this.s, end || this.e); + } + + /** + * Split this Interval at each of the specified DateTimes + * @param {...DateTime} dateTimes - the unit of time to count. + * @return {Array} + */; + _proto.splitAt = function splitAt() { + var _this = this; + if (!this.isValid) return []; + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + var sorted = dateTimes.map(friendlyDateTime).filter(function (d) { + return _this.contains(d); + }).sort(function (a, b) { + return a.toMillis() - b.toMillis(); + }), + results = []; + var s = this.s, + i = 0; + while (s < this.e) { + var added = sorted[i] || this.e, + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + i += 1; + } + return results; + } + + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {Array} + */; + _proto.splitBy = function splitBy(duration) { + var dur = Duration.fromDurationLike(duration); + if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { + return []; + } + var s = this.s, + idx = 1, + next; + var results = []; + while (s < this.e) { + var added = this.start.plus(dur.mapUnits(function (x) { + return x * idx; + })); + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + idx += 1; + } + return results; + } + + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {Array} + */; + _proto.divideEqually = function divideEqually(numberOfParts) { + if (!this.isValid) return []; + return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); + } + + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */; + _proto.overlaps = function overlaps(other) { + return this.e > other.s && this.s < other.e; + } + + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */; + _proto.abutsStart = function abutsStart(other) { + if (!this.isValid) return false; + return +this.e === +other.s; + } + + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */; + _proto.abutsEnd = function abutsEnd(other) { + if (!this.isValid) return false; + return +other.e === +this.s; + } + + /** + * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise. + * @param {Interval} other + * @return {boolean} + */; + _proto.engulfs = function engulfs(other) { + if (!this.isValid) return false; + return this.s <= other.s && this.e >= other.e; + } + + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */; + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + return this.s.equals(other.s) && this.e.equals(other.e); + } + + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */; + _proto.intersection = function intersection(other) { + if (!this.isValid) return this; + var s = this.s > other.s ? this.s : other.s, + e = this.e < other.e ? this.e : other.e; + if (s >= e) { + return null; + } else { + return Interval.fromDateTimes(s, e); + } + } + + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */; + _proto.union = function union(other) { + if (!this.isValid) return this; + var s = this.s < other.s ? this.s : other.s, + e = this.e > other.e ? this.e : other.e; + return Interval.fromDateTimes(s, e); + } + + /** + * Merge an array of Intervals into an equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * The resulting array will contain the Intervals in ascending order, that is, starting with the earliest Interval + * and ending with the latest. + * + * @param {Array} intervals + * @return {Array} + */; + Interval.merge = function merge(intervals) { + var _intervals$sort$reduc = intervals.sort(function (a, b) { + return a.s - b.s; + }).reduce(function (_ref2, item) { + var sofar = _ref2[0], + current = _ref2[1]; + if (!current) { + return [sofar, item]; + } else if (current.overlaps(item) || current.abutsStart(item)) { + return [sofar, current.union(item)]; + } else { + return [sofar.concat([current]), item]; + } + }, [[], null]), + found = _intervals$sort$reduc[0], + final = _intervals$sort$reduc[1]; + if (final) { + found.push(final); + } + return found; + } + + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {Array} intervals + * @return {Array} + */; + Interval.xor = function xor(intervals) { + var _Array$prototype; + var start = null, + currentCount = 0; + var results = [], + ends = intervals.map(function (i) { + return [{ + time: i.s, + type: "s" + }, { + time: i.e, + type: "e" + }]; + }), + flattened = (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, ends), + arr = flattened.sort(function (a, b) { + return a.time - b.time; + }); + for (var _iterator = _createForOfIteratorHelperLoose(arr), _step; !(_step = _iterator()).done;) { + var i = _step.value; + currentCount += i.type === "s" ? 1 : -1; + if (currentCount === 1) { + start = i.time; + } else { + if (start && +start !== +i.time) { + results.push(Interval.fromDateTimes(start, i.time)); + } + start = null; + } + } + return Interval.merge(results); + } + + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {Array} + */; + _proto.difference = function difference() { + var _this2 = this; + for (var _len2 = arguments.length, intervals = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + intervals[_key2] = arguments[_key2]; + } + return Interval.xor([this].concat(intervals)).map(function (i) { + return _this2.intersection(i); + }).filter(function (i) { + return i && !i.isEmpty(); + }); + } + + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */; + _proto.toString = function toString() { + if (!this.isValid) return INVALID$1; + return "[" + this.s.toISO() + " \u2013 " + this.e.toISO() + ")"; + } + + /** + * Returns a string representation of this Interval appropriate for the REPL. + * @return {string} + */; + _proto[_Symbol$for] = function () { + if (this.isValid) { + return "Interval { start: " + this.s.toISO() + ", end: " + this.e.toISO() + " }"; + } else { + return "Interval { Invalid, reason: " + this.invalidReason + " }"; + } + } + + /** + * Returns a localized string representing this Interval. Accepts the same options as the + * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as + * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method + * is browser-specific, but in general it will return an appropriate representation of the + * Interval in the assigned locale. Defaults to the system's locale if no locale has been + * specified. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or + * Intl.DateTimeFormat constructor options. + * @param {Object} opts - Options to override the configuration of the start DateTime. + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022 + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p + * @return {string} + */; + _proto.toLocaleString = function toLocaleString(formatOpts, opts) { + if (formatOpts === void 0) { + formatOpts = DATE_SHORT; + } + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) : INVALID$1; + } + + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */; + _proto.toISO = function toISO(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISO(opts) + "/" + this.e.toISO(opts); + } + + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */; + _proto.toISODate = function toISODate() { + if (!this.isValid) return INVALID$1; + return this.s.toISODate() + "/" + this.e.toISODate(); + } + + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */; + _proto.toISOTime = function toISOTime(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISOTime(opts) + "/" + this.e.toISOTime(opts); + } + + /** + * Returns a string representation of this Interval formatted according to the specified format + * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible + * formatting tool. + * @param {string} dateFormat - The format string. This string formats the start and end time. + * See {@link DateTime#toFormat} for details. + * @param {Object} opts - Options. + * @param {string} [opts.separator = ' – '] - A separator to place between the start and end + * representations. + * @return {string} + */; + _proto.toFormat = function toFormat(dateFormat, _temp2) { + var _ref3 = _temp2 === void 0 ? {} : _temp2, + _ref3$separator = _ref3.separator, + separator = _ref3$separator === void 0 ? " – " : _ref3$separator; + if (!this.isValid) return INVALID$1; + return "" + this.s.toFormat(dateFormat) + separator + this.e.toFormat(dateFormat); + } + + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */; + _proto.toDuration = function toDuration(unit, opts) { + if (!this.isValid) { + return Duration.invalid(this.invalidReason); + } + return this.e.diff(this.s, unit, opts); + } + + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */; + _proto.mapEndpoints = function mapEndpoints(mapFn) { + return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); + }; + _createClass(Interval, [{ + key: "start", + get: function get() { + return this.isValid ? this.s : null; + } + + /** + * Returns the end of the Interval. This is the first instant which is not part of the interval + * (Interval is half-open). + * @type {DateTime} + */ + }, { + key: "end", + get: function get() { + return this.isValid ? this.e : null; + } + + /** + * Returns the last DateTime included in the interval (since end is not part of the interval) + * @type {DateTime} + */ + }, { + key: "lastDateTime", + get: function get() { + return this.isValid ? this.e ? this.e.minus(1) : null : null; + } + + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + }, { + key: "isValid", + get: function get() { + return this.invalidReason === null; + } + + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + return Interval; + }(Symbol.for("nodejs.util.inspect.custom")); + + /** + * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment. + */ + var Info = /*#__PURE__*/function () { + function Info() {} + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + Info.hasDST = function hasDST(zone) { + if (zone === void 0) { + zone = Settings.defaultZone; + } + var proto = DateTime.now().setZone(zone).set({ + month: 12 + }); + return !zone.isUniversal && proto.offset !== proto.set({ + month: 6 + }).offset; + } + + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */; + Info.isValidIANAZone = function isValidIANAZone(zone) { + return IANAZone.isValidZone(zone); + } + + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone#isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */; + Info.normalizeZone = function normalizeZone$1(input) { + return normalizeZone(input, Settings.defaultZone); + } + + /** + * Get the weekday on which the week starts according to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} the start of the week, 1 for Monday through 7 for Sunday + */; + Info.getStartOfWeek = function getStartOfWeek(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + _ref$locale = _ref.locale, + locale = _ref$locale === void 0 ? null : _ref$locale, + _ref$locObj = _ref.locObj, + locObj = _ref$locObj === void 0 ? null : _ref$locObj; + return (locObj || Locale.create(locale)).getStartOfWeek(); + } + + /** + * Get the minimum number of days necessary in a week before it is considered part of the next year according + * to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} + */; + Info.getMinimumDaysInFirstWeek = function getMinimumDaysInFirstWeek(_temp2) { + var _ref2 = _temp2 === void 0 ? {} : _temp2, + _ref2$locale = _ref2.locale, + locale = _ref2$locale === void 0 ? null : _ref2$locale, + _ref2$locObj = _ref2.locObj, + locObj = _ref2$locObj === void 0 ? null : _ref2$locObj; + return (locObj || Locale.create(locale)).getMinDaysInFirstWeek(); + } + + /** + * Get the weekdays, which are considered the weekend according to the given locale + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday + */; + Info.getWeekendWeekdays = function getWeekendWeekdays(_temp3) { + var _ref3 = _temp3 === void 0 ? {} : _temp3, + _ref3$locale = _ref3.locale, + locale = _ref3$locale === void 0 ? null : _ref3$locale, + _ref3$locObj = _ref3.locObj, + locObj = _ref3$locObj === void 0 ? null : _ref3$locObj; + // copy the array, because we cache it internally + return (locObj || Locale.create(locale)).getWeekendDays().slice(); + } + + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {Array} + */; + Info.months = function months(length, _temp4) { + if (length === void 0) { + length = "long"; + } + var _ref4 = _temp4 === void 0 ? {} : _temp4, + _ref4$locale = _ref4.locale, + locale = _ref4$locale === void 0 ? null : _ref4$locale, + _ref4$numberingSystem = _ref4.numberingSystem, + numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem, + _ref4$locObj = _ref4.locObj, + locObj = _ref4$locObj === void 0 ? null : _ref4$locObj, + _ref4$outputCalendar = _ref4.outputCalendar, + outputCalendar = _ref4$outputCalendar === void 0 ? "gregory" : _ref4$outputCalendar; + return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length); + } + + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link Info#months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {Array} + */; + Info.monthsFormat = function monthsFormat(length, _temp5) { + if (length === void 0) { + length = "long"; + } + var _ref5 = _temp5 === void 0 ? {} : _temp5, + _ref5$locale = _ref5.locale, + locale = _ref5$locale === void 0 ? null : _ref5$locale, + _ref5$numberingSystem = _ref5.numberingSystem, + numberingSystem = _ref5$numberingSystem === void 0 ? null : _ref5$numberingSystem, + _ref5$locObj = _ref5.locObj, + locObj = _ref5$locObj === void 0 ? null : _ref5$locObj, + _ref5$outputCalendar = _ref5.outputCalendar, + outputCalendar = _ref5$outputCalendar === void 0 ? "gregory" : _ref5$outputCalendar; + return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true); + } + + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {Array} + */; + Info.weekdays = function weekdays(length, _temp6) { + if (length === void 0) { + length = "long"; + } + var _ref6 = _temp6 === void 0 ? {} : _temp6, + _ref6$locale = _ref6.locale, + locale = _ref6$locale === void 0 ? null : _ref6$locale, + _ref6$numberingSystem = _ref6.numberingSystem, + numberingSystem = _ref6$numberingSystem === void 0 ? null : _ref6$numberingSystem, + _ref6$locObj = _ref6.locObj, + locObj = _ref6$locObj === void 0 ? null : _ref6$locObj; + return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length); + } + + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link Info#weekdays} + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @return {Array} + */; + Info.weekdaysFormat = function weekdaysFormat(length, _temp7) { + if (length === void 0) { + length = "long"; + } + var _ref7 = _temp7 === void 0 ? {} : _temp7, + _ref7$locale = _ref7.locale, + locale = _ref7$locale === void 0 ? null : _ref7$locale, + _ref7$numberingSystem = _ref7.numberingSystem, + numberingSystem = _ref7$numberingSystem === void 0 ? null : _ref7$numberingSystem, + _ref7$locObj = _ref7.locObj, + locObj = _ref7$locObj === void 0 ? null : _ref7$locObj; + return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true); + } + + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {Array} + */; + Info.meridiems = function meridiems(_temp8) { + var _ref8 = _temp8 === void 0 ? {} : _temp8, + _ref8$locale = _ref8.locale, + locale = _ref8$locale === void 0 ? null : _ref8$locale; + return Locale.create(locale).meridiems(); + } + + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {Array} + */; + Info.eras = function eras(length, _temp9) { + if (length === void 0) { + length = "short"; + } + var _ref9 = _temp9 === void 0 ? {} : _temp9, + _ref9$locale = _ref9.locale, + locale = _ref9$locale === void 0 ? null : _ref9$locale; + return Locale.create(locale, null, "gregory").eras(length); + } + + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case. + * Keys: + * * `relative`: whether this environment supports relative time formatting + * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale + * @example Info.features() //=> { relative: false, localeWeek: true } + * @return {Object} + */; + Info.features = function features() { + return { + relative: hasRelative(), + localeWeek: hasLocaleWeekInfo() + }; + }; + return Info; + }(); + + function dayDiff(earlier, later) { + var utcDayStart = function utcDayStart(dt) { + return dt.toUTC(0, { + keepLocalTime: true + }).startOf("day").valueOf(); + }, + ms = utcDayStart(later) - utcDayStart(earlier); + return Math.floor(Duration.fromMillis(ms).as("days")); + } + function highOrderDiffs(cursor, later, units) { + var differs = [["years", function (a, b) { + return b.year - a.year; + }], ["quarters", function (a, b) { + return b.quarter - a.quarter + (b.year - a.year) * 4; + }], ["months", function (a, b) { + return b.month - a.month + (b.year - a.year) * 12; + }], ["weeks", function (a, b) { + var days = dayDiff(a, b); + return (days - days % 7) / 7; + }], ["days", dayDiff]]; + var results = {}; + var earlier = cursor; + var lowestOrder, highWater; + + /* This loop tries to diff using larger units first. + If we overshoot, we backtrack and try the next smaller unit. + "cursor" starts out at the earlier timestamp and moves closer and closer to "later" + as we use smaller and smaller units. + highWater keeps track of where we would be if we added one more of the smallest unit, + this is used later to potentially convert any difference smaller than the smallest higher order unit + into a fraction of that smallest higher order unit + */ + for (var _i = 0, _differs = differs; _i < _differs.length; _i++) { + var _differs$_i = _differs[_i], + unit = _differs$_i[0], + differ = _differs$_i[1]; + if (units.indexOf(unit) >= 0) { + lowestOrder = unit; + results[unit] = differ(cursor, later); + highWater = earlier.plus(results); + if (highWater > later) { + // we overshot the end point, backtrack cursor by 1 + results[unit]--; + cursor = earlier.plus(results); + + // if we are still overshooting now, we need to backtrack again + // this happens in certain situations when diffing times in different zones, + // because this calculation ignores time zones + if (cursor > later) { + // keep the "overshot by 1" around as highWater + highWater = cursor; + // backtrack cursor by 1 + results[unit]--; + cursor = earlier.plus(results); + } + } else { + cursor = highWater; + } + } + } + return [cursor, results, highWater, lowestOrder]; + } + function _diff (earlier, later, units, opts) { + var _highOrderDiffs = highOrderDiffs(earlier, later, units), + cursor = _highOrderDiffs[0], + results = _highOrderDiffs[1], + highWater = _highOrderDiffs[2], + lowestOrder = _highOrderDiffs[3]; + var remainingMillis = later - cursor; + var lowerOrderUnits = units.filter(function (u) { + return ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0; + }); + if (lowerOrderUnits.length === 0) { + if (highWater < later) { + var _cursor$plus; + highWater = cursor.plus((_cursor$plus = {}, _cursor$plus[lowestOrder] = 1, _cursor$plus)); + } + if (highWater !== cursor) { + results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); + } + } + var duration = Duration.fromObject(results, opts); + if (lowerOrderUnits.length > 0) { + var _Duration$fromMillis; + return (_Duration$fromMillis = Duration.fromMillis(remainingMillis, opts)).shiftTo.apply(_Duration$fromMillis, lowerOrderUnits).plus(duration); + } else { + return duration; + } + } + + var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; + function intUnit(regex, post) { + if (post === void 0) { + post = function post(i) { + return i; + }; + } + return { + regex: regex, + deser: function deser(_ref) { + var s = _ref[0]; + return post(parseDigits(s)); + } + }; + } + var NBSP = String.fromCharCode(160); + var spaceOrNBSP = "[ " + NBSP + "]"; + var spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g"); + function fixListRegex(s) { + // make dots optional and also make them literal + // make space and non breakable space characters interchangeable + return s.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP); + } + function stripInsensitivities(s) { + return s.replace(/\./g, "") // ignore dots that were made optional + .replace(spaceOrNBSPRegExp, " ") // interchange space and nbsp + .toLowerCase(); + } + function oneOf(strings, startIndex) { + if (strings === null) { + return null; + } else { + return { + regex: RegExp(strings.map(fixListRegex).join("|")), + deser: function deser(_ref2) { + var s = _ref2[0]; + return strings.findIndex(function (i) { + return stripInsensitivities(s) === stripInsensitivities(i); + }) + startIndex; + } + }; + } + } + function offset(regex, groups) { + return { + regex: regex, + deser: function deser(_ref3) { + var h = _ref3[1], + m = _ref3[2]; + return signedOffset(h, m); + }, + groups: groups + }; + } + function simple(regex) { + return { + regex: regex, + deser: function deser(_ref4) { + var s = _ref4[0]; + return s; + } + }; + } + function escapeToken(value) { + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); + } + + /** + * @param token + * @param {Locale} loc + */ + function unitForToken(token, loc) { + var one = digitRegex(loc), + two = digitRegex(loc, "{2}"), + three = digitRegex(loc, "{3}"), + four = digitRegex(loc, "{4}"), + six = digitRegex(loc, "{6}"), + oneOrTwo = digitRegex(loc, "{1,2}"), + oneToThree = digitRegex(loc, "{1,3}"), + oneToSix = digitRegex(loc, "{1,6}"), + oneToNine = digitRegex(loc, "{1,9}"), + twoToFour = digitRegex(loc, "{2,4}"), + fourToSix = digitRegex(loc, "{4,6}"), + literal = function literal(t) { + return { + regex: RegExp(escapeToken(t.val)), + deser: function deser(_ref5) { + var s = _ref5[0]; + return s; + }, + literal: true + }; + }, + unitate = function unitate(t) { + if (token.literal) { + return literal(t); + } + switch (t.val) { + // era + case "G": + return oneOf(loc.eras("short"), 0); + case "GG": + return oneOf(loc.eras("long"), 0); + // years + case "y": + return intUnit(oneToSix); + case "yy": + return intUnit(twoToFour, untruncateYear); + case "yyyy": + return intUnit(four); + case "yyyyy": + return intUnit(fourToSix); + case "yyyyyy": + return intUnit(six); + // months + case "M": + return intUnit(oneOrTwo); + case "MM": + return intUnit(two); + case "MMM": + return oneOf(loc.months("short", true), 1); + case "MMMM": + return oneOf(loc.months("long", true), 1); + case "L": + return intUnit(oneOrTwo); + case "LL": + return intUnit(two); + case "LLL": + return oneOf(loc.months("short", false), 1); + case "LLLL": + return oneOf(loc.months("long", false), 1); + // dates + case "d": + return intUnit(oneOrTwo); + case "dd": + return intUnit(two); + // ordinals + case "o": + return intUnit(oneToThree); + case "ooo": + return intUnit(three); + // time + case "HH": + return intUnit(two); + case "H": + return intUnit(oneOrTwo); + case "hh": + return intUnit(two); + case "h": + return intUnit(oneOrTwo); + case "mm": + return intUnit(two); + case "m": + return intUnit(oneOrTwo); + case "q": + return intUnit(oneOrTwo); + case "qq": + return intUnit(two); + case "s": + return intUnit(oneOrTwo); + case "ss": + return intUnit(two); + case "S": + return intUnit(oneToThree); + case "SSS": + return intUnit(three); + case "u": + return simple(oneToNine); + case "uu": + return simple(oneOrTwo); + case "uuu": + return intUnit(one); + // meridiem + case "a": + return oneOf(loc.meridiems(), 0); + // weekYear (k) + case "kkkk": + return intUnit(four); + case "kk": + return intUnit(twoToFour, untruncateYear); + // weekNumber (W) + case "W": + return intUnit(oneOrTwo); + case "WW": + return intUnit(two); + // weekdays + case "E": + case "c": + return intUnit(one); + case "EEE": + return oneOf(loc.weekdays("short", false), 1); + case "EEEE": + return oneOf(loc.weekdays("long", false), 1); + case "ccc": + return oneOf(loc.weekdays("short", true), 1); + case "cccc": + return oneOf(loc.weekdays("long", true), 1); + // offset/zone + case "Z": + case "ZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(?::(" + two.source + "))?"), 2); + case "ZZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(" + two.source + ")?"), 2); + // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing + // because we don't have any way to figure out what they are + case "z": + return simple(/[a-z_+-/]{1,256}?/i); + // this special-case "token" represents a place where a macro-token expanded into a white-space literal + // in this case we accept any non-newline white-space + case " ": + return simple(/[^\S\n\r]/); + default: + return literal(t); + } + }; + var unit = unitate(token) || { + invalidReason: MISSING_FTP + }; + unit.token = token; + return unit; + } + var partTypeStyleToTokenVal = { + year: { + "2-digit": "yy", + numeric: "yyyyy" + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM" + }, + day: { + numeric: "d", + "2-digit": "dd" + }, + weekday: { + short: "EEE", + long: "EEEE" + }, + dayperiod: "a", + dayPeriod: "a", + hour12: { + numeric: "h", + "2-digit": "hh" + }, + hour24: { + numeric: "H", + "2-digit": "HH" + }, + minute: { + numeric: "m", + "2-digit": "mm" + }, + second: { + numeric: "s", + "2-digit": "ss" + }, + timeZoneName: { + long: "ZZZZZ", + short: "ZZZ" + } + }; + function tokenForPart(part, formatOpts, resolvedOpts) { + var type = part.type, + value = part.value; + if (type === "literal") { + var isSpace = /^\s+$/.test(value); + return { + literal: !isSpace, + val: isSpace ? " " : value + }; + } + var style = formatOpts[type]; + + // The user might have explicitly specified hour12 or hourCycle + // if so, respect their decision + // if not, refer back to the resolvedOpts, which are based on the locale + var actualType = type; + if (type === "hour") { + if (formatOpts.hour12 != null) { + actualType = formatOpts.hour12 ? "hour12" : "hour24"; + } else if (formatOpts.hourCycle != null) { + if (formatOpts.hourCycle === "h11" || formatOpts.hourCycle === "h12") { + actualType = "hour12"; + } else { + actualType = "hour24"; + } + } else { + // tokens only differentiate between 24 hours or not, + // so we do not need to check hourCycle here, which is less supported anyways + actualType = resolvedOpts.hour12 ? "hour12" : "hour24"; + } + } + var val = partTypeStyleToTokenVal[actualType]; + if (typeof val === "object") { + val = val[style]; + } + if (val) { + return { + literal: false, + val: val + }; + } + return undefined; + } + function buildRegex(units) { + var re = units.map(function (u) { + return u.regex; + }).reduce(function (f, r) { + return f + "(" + r.source + ")"; + }, ""); + return ["^" + re + "$", units]; + } + function match(input, regex, handlers) { + var matches = input.match(regex); + if (matches) { + var all = {}; + var matchIndex = 1; + for (var i in handlers) { + if (hasOwnProperty(handlers, i)) { + var h = handlers[i], + groups = h.groups ? h.groups + 1 : 1; + if (!h.literal && h.token) { + all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); + } + matchIndex += groups; + } + } + return [matches, all]; + } else { + return [matches, {}]; + } + } + function dateTimeFromMatches(matches) { + var toField = function toField(token) { + switch (token) { + case "S": + return "millisecond"; + case "s": + return "second"; + case "m": + return "minute"; + case "h": + case "H": + return "hour"; + case "d": + return "day"; + case "o": + return "ordinal"; + case "L": + case "M": + return "month"; + case "y": + return "year"; + case "E": + case "c": + return "weekday"; + case "W": + return "weekNumber"; + case "k": + return "weekYear"; + case "q": + return "quarter"; + default: + return null; + } + }; + var zone = null; + var specificOffset; + if (!isUndefined(matches.z)) { + zone = IANAZone.create(matches.z); + } + if (!isUndefined(matches.Z)) { + if (!zone) { + zone = new FixedOffsetZone(matches.Z); + } + specificOffset = matches.Z; + } + if (!isUndefined(matches.q)) { + matches.M = (matches.q - 1) * 3 + 1; + } + if (!isUndefined(matches.h)) { + if (matches.h < 12 && matches.a === 1) { + matches.h += 12; + } else if (matches.h === 12 && matches.a === 0) { + matches.h = 0; + } + } + if (matches.G === 0 && matches.y) { + matches.y = -matches.y; + } + if (!isUndefined(matches.u)) { + matches.S = parseMillis(matches.u); + } + var vals = Object.keys(matches).reduce(function (r, k) { + var f = toField(k); + if (f) { + r[f] = matches[k]; + } + return r; + }, {}); + return [vals, zone, specificOffset]; + } + var dummyDateTimeCache = null; + function getDummyDateTime() { + if (!dummyDateTimeCache) { + dummyDateTimeCache = DateTime.fromMillis(1555555555555); + } + return dummyDateTimeCache; + } + function maybeExpandMacroToken(token, locale) { + if (token.literal) { + return token; + } + var formatOpts = Formatter.macroTokenToFormatOpts(token.val); + var tokens = formatOptsToTokens(formatOpts, locale); + if (tokens == null || tokens.includes(undefined)) { + return token; + } + return tokens; + } + function expandMacroTokens(tokens, locale) { + var _Array$prototype; + return (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, tokens.map(function (t) { + return maybeExpandMacroToken(t, locale); + })); + } + + /** + * @private + */ + + var TokenParser = /*#__PURE__*/function () { + function TokenParser(locale, format) { + this.locale = locale; + this.format = format; + this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale); + this.units = this.tokens.map(function (t) { + return unitForToken(t, locale); + }); + this.disqualifyingUnit = this.units.find(function (t) { + return t.invalidReason; + }); + if (!this.disqualifyingUnit) { + var _buildRegex = buildRegex(this.units), + regexString = _buildRegex[0], + handlers = _buildRegex[1]; + this.regex = RegExp(regexString, "i"); + this.handlers = handlers; + } + } + var _proto = TokenParser.prototype; + _proto.explainFromTokens = function explainFromTokens(input) { + if (!this.isValid) { + return { + input: input, + tokens: this.tokens, + invalidReason: this.invalidReason + }; + } else { + var _match = match(input, this.regex, this.handlers), + rawMatches = _match[0], + matches = _match[1], + _ref6 = matches ? dateTimeFromMatches(matches) : [null, null, undefined], + result = _ref6[0], + zone = _ref6[1], + specificOffset = _ref6[2]; + if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { + throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format"); + } + return { + input: input, + tokens: this.tokens, + regex: this.regex, + rawMatches: rawMatches, + matches: matches, + result: result, + zone: zone, + specificOffset: specificOffset + }; + } + }; + _createClass(TokenParser, [{ + key: "isValid", + get: function get() { + return !this.disqualifyingUnit; + } + }, { + key: "invalidReason", + get: function get() { + return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null; + } + }]); + return TokenParser; + }(); + function explainFromTokens(locale, input, format) { + var parser = new TokenParser(locale, format); + return parser.explainFromTokens(input); + } + function parseFromTokens(locale, input, format) { + var _explainFromTokens = explainFromTokens(locale, input, format), + result = _explainFromTokens.result, + zone = _explainFromTokens.zone, + specificOffset = _explainFromTokens.specificOffset, + invalidReason = _explainFromTokens.invalidReason; + return [result, zone, specificOffset, invalidReason]; + } + function formatOptsToTokens(formatOpts, locale) { + if (!formatOpts) { + return null; + } + var formatter = Formatter.create(locale, formatOpts); + var df = formatter.dtFormatter(getDummyDateTime()); + var parts = df.formatToParts(); + var resolvedOpts = df.resolvedOptions(); + return parts.map(function (p) { + return tokenForPart(p, formatOpts, resolvedOpts); + }); + } + + var INVALID = "Invalid DateTime"; + var MAX_DATE = 8.64e15; + function unsupportedZone(zone) { + return new Invalid("unsupported zone", "the zone \"" + zone.name + "\" is not supported"); + } + + // we cache week data on the DT object and this intermediates the cache + /** + * @param {DateTime} dt + */ + function possiblyCachedWeekData(dt) { + if (dt.weekData === null) { + dt.weekData = gregorianToWeek(dt.c); + } + return dt.weekData; + } + + /** + * @param {DateTime} dt + */ + function possiblyCachedLocalWeekData(dt) { + if (dt.localWeekData === null) { + dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek()); + } + return dt.localWeekData; + } + + // clone really means, "make a new object with these modifications". all "setters" really use this + // to create a new object while only changing some of the properties + function clone(inst, alts) { + var current = { + ts: inst.ts, + zone: inst.zone, + c: inst.c, + o: inst.o, + loc: inst.loc, + invalid: inst.invalid + }; + return new DateTime(_extends({}, current, alts, { + old: current + })); + } + + // find the right offset a given local time. The o input is our guess, which determines which + // offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST) + function fixOffset(localTS, o, tz) { + // Our UTC time is just a guess because our offset is just a guess + var utcGuess = localTS - o * 60 * 1000; + + // Test whether the zone matches the offset for this ts + var o2 = tz.offset(utcGuess); + + // If so, offset didn't change and we're done + if (o === o2) { + return [utcGuess, o]; + } + + // If not, change the ts by the difference in the offset + utcGuess -= (o2 - o) * 60 * 1000; + + // If that gives us the local time we want, we're done + var o3 = tz.offset(utcGuess); + if (o2 === o3) { + return [utcGuess, o2]; + } + + // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time + return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; + } + + // convert an epoch timestamp into a calendar object with the given offset + function tsToObj(ts, offset) { + ts += offset * 60 * 1000; + var d = new Date(ts); + return { + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate(), + hour: d.getUTCHours(), + minute: d.getUTCMinutes(), + second: d.getUTCSeconds(), + millisecond: d.getUTCMilliseconds() + }; + } + + // convert a calendar object to a epoch timestamp + function objToTS(obj, offset, zone) { + return fixOffset(objToLocalTS(obj), offset, zone); + } + + // create a new DT instance by adding a duration, adjusting for DSTs + function adjustTime(inst, dur) { + var oPre = inst.o, + year = inst.c.year + Math.trunc(dur.years), + month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, + c = _extends({}, inst.c, { + year: year, + month: month, + day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + Math.trunc(dur.weeks) * 7 + }), + millisToAdd = Duration.fromObject({ + years: dur.years - Math.trunc(dur.years), + quarters: dur.quarters - Math.trunc(dur.quarters), + months: dur.months - Math.trunc(dur.months), + weeks: dur.weeks - Math.trunc(dur.weeks), + days: dur.days - Math.trunc(dur.days), + hours: dur.hours, + minutes: dur.minutes, + seconds: dur.seconds, + milliseconds: dur.milliseconds + }).as("milliseconds"), + localTS = objToLocalTS(c); + var _fixOffset = fixOffset(localTS, oPre, inst.zone), + ts = _fixOffset[0], + o = _fixOffset[1]; + if (millisToAdd !== 0) { + ts += millisToAdd; + // that could have changed the offset by going over a DST, but we want to keep the ts the same + o = inst.zone.offset(ts); + } + return { + ts: ts, + o: o + }; + } + + // helper useful in turning the results of parsing into real dates + // by handling the zone options + function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) { + var setZone = opts.setZone, + zone = opts.zone; + if (parsed && Object.keys(parsed).length !== 0 || parsedZone) { + var interpretationZone = parsedZone || zone, + inst = DateTime.fromObject(parsed, _extends({}, opts, { + zone: interpretationZone, + specificOffset: specificOffset + })); + return setZone ? inst : inst.setZone(zone); + } else { + return DateTime.invalid(new Invalid("unparsable", "the input \"" + text + "\" can't be parsed as " + format)); + } + } + + // if you want to output a technical format (e.g. RFC 2822), this helper + // helps handle the details + function toTechFormat(dt, format, allowZ) { + if (allowZ === void 0) { + allowZ = true; + } + return dt.isValid ? Formatter.create(Locale.create("en-US"), { + allowZ: allowZ, + forceSimple: true + }).formatDateTimeFromString(dt, format) : null; + } + function _toISODate(o, extended, precision) { + var longFormat = o.c.year > 9999 || o.c.year < 0; + var c = ""; + if (longFormat && o.c.year >= 0) c += "+"; + c += padStart(o.c.year, longFormat ? 6 : 4); + if (precision === "year") return c; + if (extended) { + c += "-"; + c += padStart(o.c.month); + if (precision === "month") return c; + c += "-"; + } else { + c += padStart(o.c.month); + if (precision === "month") return c; + } + c += padStart(o.c.day); + return c; + } + function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision) { + var showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0, + c = ""; + switch (precision) { + case "day": + case "month": + case "year": + break; + default: + c += padStart(o.c.hour); + if (precision === "hour") break; + if (extended) { + c += ":"; + c += padStart(o.c.minute); + if (precision === "minute") break; + if (showSeconds) { + c += ":"; + c += padStart(o.c.second); + } + } else { + c += padStart(o.c.minute); + if (precision === "minute") break; + if (showSeconds) { + c += padStart(o.c.second); + } + } + if (precision === "second") break; + if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) { + c += "."; + c += padStart(o.c.millisecond, 3); + } + } + if (includeOffset) { + if (o.isOffsetFixed && o.offset === 0 && !extendedZone) { + c += "Z"; + } else if (o.o < 0) { + c += "-"; + c += padStart(Math.trunc(-o.o / 60)); + c += ":"; + c += padStart(Math.trunc(-o.o % 60)); + } else { + c += "+"; + c += padStart(Math.trunc(o.o / 60)); + c += ":"; + c += padStart(Math.trunc(o.o % 60)); + } + } + if (extendedZone) { + c += "[" + o.zone.ianaName + "]"; + } + return c; + } + + // defaults for unspecified units in the supported calendars + var defaultUnitValues = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultWeekUnitValues = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultOrdinalUnitValues = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }; + + // Units in the supported calendars, sorted by bigness + var orderedUnits = ["year", "month", "day", "hour", "minute", "second", "millisecond"], + orderedWeekUnits = ["weekYear", "weekNumber", "weekday", "hour", "minute", "second", "millisecond"], + orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; + + // standardize case and plurality in units + function normalizeUnit(unit) { + var normalized = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal" + }[unit.toLowerCase()]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } + function normalizeUnitWithLocalWeeks(unit) { + switch (unit.toLowerCase()) { + case "localweekday": + case "localweekdays": + return "localWeekday"; + case "localweeknumber": + case "localweeknumbers": + return "localWeekNumber"; + case "localweekyear": + case "localweekyears": + return "localWeekYear"; + default: + return normalizeUnit(unit); + } + } + + // cache offsets for zones based on the current timestamp when this function is + // first called. When we are handling a datetime from components like (year, + // month, day, hour) in a time zone, we need a guess about what the timezone + // offset is so that we can convert into a UTC timestamp. One way is to find the + // offset of now in the zone. The actual date may have a different offset (for + // example, if we handle a date in June while we're in December in a zone that + // observes DST), but we can check and adjust that. + // + // When handling many dates, calculating the offset for now every time is + // expensive. It's just a guess, so we can cache the offset to use even if we + // are right on a time change boundary (we'll just correct in the other + // direction). Using a timestamp from first read is a slight optimization for + // handling dates close to the current date, since those dates will usually be + // in the same offset (we could set the timestamp statically, instead). We use a + // single timestamp for all zones to make things a bit more predictable. + // + // This is safe for quickDT (used by local() and utc()) because we don't fill in + // higher-order units from tsNow (as we do in fromObject, this requires that + // offset is calculated from tsNow). + /** + * @param {Zone} zone + * @return {number} + */ + function guessOffsetForZone(zone) { + if (zoneOffsetTs === undefined) { + zoneOffsetTs = Settings.now(); + } + + // Do not cache anything but IANA zones, because it is not safe to do so. + // Guessing an offset which is not present in the zone can cause wrong results from fixOffset + if (zone.type !== "iana") { + return zone.offset(zoneOffsetTs); + } + var zoneName = zone.name; + var offsetGuess = zoneOffsetGuessCache.get(zoneName); + if (offsetGuess === undefined) { + offsetGuess = zone.offset(zoneOffsetTs); + zoneOffsetGuessCache.set(zoneName, offsetGuess); + } + return offsetGuess; + } + + // this is a dumbed down version of fromObject() that runs about 60% faster + // but doesn't do any validation, makes a bunch of assumptions about what units + // are present, and so on. + function quickDT(obj, opts) { + var zone = normalizeZone(opts.zone, Settings.defaultZone); + if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } + var loc = Locale.fromObject(opts); + var ts, o; + + // assume we have the higher-order units + if (!isUndefined(obj.year)) { + for (var _i = 0, _orderedUnits = orderedUnits; _i < _orderedUnits.length; _i++) { + var u = _orderedUnits[_i]; + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } + } + var invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + if (invalid) { + return DateTime.invalid(invalid); + } + var offsetProvis = guessOffsetForZone(zone); + var _objToTS = objToTS(obj, offsetProvis, zone); + ts = _objToTS[0]; + o = _objToTS[1]; + } else { + ts = Settings.now(); + } + return new DateTime({ + ts: ts, + zone: zone, + loc: loc, + o: o + }); + } + function diffRelative(start, end, opts) { + var round = isUndefined(opts.round) ? true : opts.round, + rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding, + format = function format(c, unit) { + c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding); + var formatter = end.loc.clone(opts).relFormatter(opts); + return formatter.format(c, unit); + }, + differ = function differ(unit) { + if (opts.calendary) { + if (!end.hasSame(start, unit)) { + return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); + } else return 0; + } else { + return end.diff(start, unit).get(unit); + } + }; + if (opts.unit) { + return format(differ(opts.unit), opts.unit); + } + for (var _iterator = _createForOfIteratorHelperLoose(opts.units), _step; !(_step = _iterator()).done;) { + var unit = _step.value; + var count = differ(unit); + if (Math.abs(count) >= 1) { + return format(count, unit); + } + } + return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]); + } + function lastOpts(argList) { + var opts = {}, + args; + if (argList.length > 0 && typeof argList[argList.length - 1] === "object") { + opts = argList[argList.length - 1]; + args = Array.from(argList).slice(0, argList.length - 1); + } else { + args = Array.from(argList); + } + return [opts, args]; + } + + /** + * Timestamp to use for cached zone offset guesses (exposed for test) + */ + var zoneOffsetTs; + /** + * Cache for zone offset guesses (exposed for test). + * + * This optimizes quickDT via guessOffsetForZone to avoid repeated calls of + * zone.offset(). + */ + var zoneOffsetGuessCache = new Map(); + + /** + * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. + * + * A DateTime comprises of: + * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. + * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). + * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. + * + * Here is a brief overview of the most commonly used functionality it provides: + * + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month}, + * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors. + * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}. + * + * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. + */ + var DateTime = /*#__PURE__*/function (_Symbol$for) { + /** + * @access private + */ + function DateTime(config) { + var zone = config.zone || Settings.defaultZone; + var invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null); + /** + * @access private + */ + this.ts = isUndefined(config.ts) ? Settings.now() : config.ts; + var c = null, + o = null; + if (!invalid) { + var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); + if (unchanged) { + var _ref = [config.old.c, config.old.o]; + c = _ref[0]; + o = _ref[1]; + } else { + // If an offset has been passed and we have not been called from + // clone(), we can trust it and avoid the offset calculation. + var ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts); + c = tsToObj(this.ts, ot); + invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; + c = invalid ? null : c; + o = invalid ? null : ot; + } + } + + /** + * @access private + */ + this._zone = zone; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.invalid = invalid; + /** + * @access private + */ + this.weekData = null; + /** + * @access private + */ + this.localWeekData = null; + /** + * @access private + */ + this.c = c; + /** + * @access private + */ + this.o = o; + /** + * @access private + */ + this.isLuxonDateTime = true; + } + + // CONSTRUCT + + /** + * Create a DateTime for the current instant, in the system's time zone. + * + * Use Settings to override these default values if needed. + * @example DateTime.now().toISO() //~> now in the ISO format + * @return {DateTime} + */ + DateTime.now = function now() { + return new DateTime({}); + } + + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month, 1-indexed + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local({ zone: "America/New_York" }) //~> now, in US east coast time + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12, { locale: "fr" }) //~> 2017-03-12T00:00:00, with a French locale + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, { zone: "utc" }) //~> 2017-03-12T05:00:00, in UTC + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */; + DateTime.local = function local() { + var _lastOpts = lastOpts(arguments), + opts = _lastOpts[0], + args = _lastOpts[1], + year = args[0], + month = args[1], + day = args[2], + hour = args[3], + minute = args[4], + second = args[5], + millisecond = args[6]; + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, opts); + } + + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @param {Object} options - configuration options for the DateTime + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: "fr" }) //~> 2017-03-12T05:45:00Z with a French locale + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: "fr" }) //~> 2017-03-12T05:45:10.765Z with a French locale + * @return {DateTime} + */; + DateTime.utc = function utc() { + var _lastOpts2 = lastOpts(arguments), + opts = _lastOpts2[0], + args = _lastOpts2[1], + year = args[0], + month = args[1], + day = args[2], + hour = args[3], + minute = args[4], + second = args[5], + millisecond = args[6]; + opts.zone = FixedOffsetZone.utcInstance; + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, opts); + } + + /** + * Create a DateTime from a JavaScript Date object. Uses the default zone. + * @param {Date} date - a JavaScript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */; + DateTime.fromJSDate = function fromJSDate(date, options) { + if (options === void 0) { + options = {}; + } + var ts = isDate(date) ? date.valueOf() : NaN; + if (Number.isNaN(ts)) { + return DateTime.invalid("invalid input"); + } + var zoneToUse = normalizeZone(options.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + return new DateTime({ + ts: ts, + zone: zoneToUse, + loc: Locale.fromObject(options) + }); + } + + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */; + DateTime.fromMillis = function fromMillis(milliseconds, options) { + if (options === void 0) { + options = {}; + } + if (!isNumber(milliseconds)) { + throw new InvalidArgumentError("fromMillis requires a numerical input, but received a " + typeof milliseconds + " with value " + milliseconds); + } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { + // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start + return DateTime.invalid("Timestamp out of range"); + } else { + return new DateTime({ + ts: milliseconds, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */; + DateTime.fromSeconds = function fromSeconds(seconds, options) { + if (options === void 0) { + options = {}; + } + if (!isNumber(seconds)) { + throw new InvalidArgumentError("fromSeconds requires a numerical input"); + } else { + return new DateTime({ + ts: seconds * 1000, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + + /** + * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.localWeekYear - a week year, according to the locale + * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale + * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {Object} opts - options for creating this DateTime + * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26' + * @return {DateTime} + */; + DateTime.fromObject = function fromObject(obj, opts) { + if (opts === void 0) { + opts = {}; + } + obj = obj || {}; + var zoneToUse = normalizeZone(opts.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + var loc = Locale.fromObject(opts); + var normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks); + var _usesLocalWeekValues = usesLocalWeekValues(normalized, loc), + minDaysInFirstWeek = _usesLocalWeekValues.minDaysInFirstWeek, + startOfWeek = _usesLocalWeekValues.startOfWeek; + var tsNow = Settings.now(), + offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber; + + // cases: + // just a weekday -> this week's instance of that weekday, no worries + // (gregorian data or ordinal) + (weekYear or weekNumber) -> error + // (gregorian month or day) + ordinal -> error + // otherwise just use weeks or ordinals or gregorian, depending on what's specified + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + var useWeekData = definiteWeekDef || normalized.weekday && !containsGregor; + + // configure ourselves to deal with gregorian dates or week stuff + var units, + defaultValues, + objNow = tsToObj(tsNow, offsetProvis); + if (useWeekData) { + units = orderedWeekUnits; + defaultValues = defaultWeekUnitValues; + objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek); + } else if (containsOrdinal) { + units = orderedOrdinalUnits; + defaultValues = defaultOrdinalUnitValues; + objNow = gregorianToOrdinal(objNow); + } else { + units = orderedUnits; + defaultValues = defaultUnitValues; + } + + // set default values for missing stuff + var foundFirst = false; + for (var _iterator2 = _createForOfIteratorHelperLoose(units), _step2; !(_step2 = _iterator2()).done;) { + var u = _step2.value; + var v = normalized[u]; + if (!isUndefined(v)) { + foundFirst = true; + } else if (foundFirst) { + normalized[u] = defaultValues[u]; + } else { + normalized[u] = objNow[u]; + } + } + + // make sure the values we have are in range + var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), + invalid = higherOrderInvalid || hasInvalidTimeData(normalized); + if (invalid) { + return DateTime.invalid(invalid); + } + + // compute the actual time + var gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, + _objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse), + tsFinal = _objToTS2[0], + offsetFinal = _objToTS2[1], + inst = new DateTime({ + ts: tsFinal, + zone: zoneToUse, + o: offsetFinal, + loc: loc + }); + + // gregorian data + weekday serves only to validate + if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { + return DateTime.invalid("mismatched weekday", "you can't specify both a weekday of " + normalized.weekday + " and a date of " + inst.toISO()); + } + if (!inst.isValid) { + return DateTime.invalid(inst.invalid); + } + return inst; + } + + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */; + DateTime.fromISO = function fromISO(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseISODate = parseISODate(text), + vals = _parseISODate[0], + parsedZone = _parseISODate[1]; + return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); + } + + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */; + DateTime.fromRFC2822 = function fromRFC2822(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseRFC2822Date = parseRFC2822Date(text), + vals = _parseRFC2822Date[0], + parsedZone = _parseRFC2822Date[1]; + return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); + } + + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */; + DateTime.fromHTTP = function fromHTTP(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseHTTPDate = parseHTTPDate(text), + vals = _parseHTTPDate[0], + parsedZone = _parseHTTPDate[1]; + return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); + } + + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens). + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */; + DateTime.fromFormat = function fromFormat(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + if (isUndefined(text) || isUndefined(fmt)) { + throw new InvalidArgumentError("fromFormat requires an input string and a format"); + } + var _opts = opts, + _opts$locale = _opts.locale, + locale = _opts$locale === void 0 ? null : _opts$locale, + _opts$numberingSystem = _opts.numberingSystem, + numberingSystem = _opts$numberingSystem === void 0 ? null : _opts$numberingSystem, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }), + _parseFromTokens = parseFromTokens(localeToUse, text, fmt), + vals = _parseFromTokens[0], + parsedZone = _parseFromTokens[1], + specificOffset = _parseFromTokens[2], + invalid = _parseFromTokens[3]; + if (invalid) { + return DateTime.invalid(invalid); + } else { + return parseDataToDateTime(vals, parsedZone, opts, "format " + fmt, text, specificOffset); + } + } + + /** + * @deprecated use fromFormat instead + */; + DateTime.fromString = function fromString(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + return DateTime.fromFormat(text, fmt, opts); + } + + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */; + DateTime.fromSQL = function fromSQL(text, opts) { + if (opts === void 0) { + opts = {}; + } + var _parseSQL = parseSQL(text), + vals = _parseSQL[0], + parsedZone = _parseSQL[1]; + return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); + } + + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent. + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */; + DateTime.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); + } + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidDateTimeError(invalid); + } else { + return new DateTime({ + invalid: invalid + }); + } + } + + /** + * Check if an object is an instance of DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */; + DateTime.isDateTime = function isDateTime(o) { + return o && o.isLuxonDateTime || false; + } + + /** + * Produce the format string for a set of options + * @param formatOpts + * @param localeOpts + * @returns {string} + */; + DateTime.parseFormatForOpts = function parseFormatForOpts(formatOpts, localeOpts) { + if (localeOpts === void 0) { + localeOpts = {}; + } + var tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts)); + return !tokenList ? null : tokenList.map(function (t) { + return t ? t.val : null; + }).join(""); + } + + /** + * Produce the the fully expanded format token for the locale + * Does NOT quote characters, so quoted tokens will not round trip correctly + * @param fmt + * @param localeOpts + * @returns {string} + */; + DateTime.expandFormat = function expandFormat(fmt, localeOpts) { + if (localeOpts === void 0) { + localeOpts = {}; + } + var expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts)); + return expanded.map(function (t) { + return t.val; + }).join(""); + }; + DateTime.resetCache = function resetCache() { + zoneOffsetTs = undefined; + zoneOffsetGuessCache.clear(); + } + + // INFO + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */; + var _proto = DateTime.prototype; + _proto.get = function get(unit) { + return this[unit]; + } + + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */; + /** + * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC + * in this DateTime's zone. During DST changes local time can be ambiguous, for example + * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`. + * This method will return both possible DateTimes if this DateTime's local time is ambiguous. + * @returns {DateTime[]} + */ + _proto.getPossibleOffsets = function getPossibleOffsets() { + if (!this.isValid || this.isOffsetFixed) { + return [this]; + } + var dayMs = 86400000; + var minuteMs = 60000; + var localTS = objToLocalTS(this.c); + var oEarlier = this.zone.offset(localTS - dayMs); + var oLater = this.zone.offset(localTS + dayMs); + var o1 = this.zone.offset(localTS - oEarlier * minuteMs); + var o2 = this.zone.offset(localTS - oLater * minuteMs); + if (o1 === o2) { + return [this]; + } + var ts1 = localTS - o1 * minuteMs; + var ts2 = localTS - o2 * minuteMs; + var c1 = tsToObj(ts1, o1); + var c2 = tsToObj(ts2, o2); + if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) { + return [clone(this, { + ts: ts1 + }), clone(this, { + ts: ts2 + })]; + } + return [this]; + } + + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */; + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + _proto.resolvedLocaleOptions = function resolvedLocaleOptions(opts) { + if (opts === void 0) { + opts = {}; + } + var _Formatter$create$res = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this), + locale = _Formatter$create$res.locale, + numberingSystem = _Formatter$create$res.numberingSystem, + calendar = _Formatter$create$res.calendar; + return { + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: calendar + }; + } + + // TRANSFORM + + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link DateTime#setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */; + _proto.toUTC = function toUTC(offset, opts) { + if (offset === void 0) { + offset = 0; + } + if (opts === void 0) { + opts = {}; + } + return this.setZone(FixedOffsetZone.instance(offset), opts); + } + + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */; + _proto.toLocal = function toLocal() { + return this.setZone(Settings.defaultZone); + } + + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */; + _proto.setZone = function setZone(zone, _temp) { + var _ref2 = _temp === void 0 ? {} : _temp, + _ref2$keepLocalTime = _ref2.keepLocalTime, + keepLocalTime = _ref2$keepLocalTime === void 0 ? false : _ref2$keepLocalTime, + _ref2$keepCalendarTim = _ref2.keepCalendarTime, + keepCalendarTime = _ref2$keepCalendarTim === void 0 ? false : _ref2$keepCalendarTim; + zone = normalizeZone(zone, Settings.defaultZone); + if (zone.equals(this.zone)) { + return this; + } else if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } else { + var newTS = this.ts; + if (keepLocalTime || keepCalendarTime) { + var offsetGuess = zone.offset(this.ts); + var asObj = this.toObject(); + var _objToTS3 = objToTS(asObj, offsetGuess, zone); + newTS = _objToTS3[0]; + } + return clone(this, { + ts: newTS, + zone: zone + }); + } + } + + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */; + _proto.reconfigure = function reconfigure(_temp2) { + var _ref3 = _temp2 === void 0 ? {} : _temp2, + locale = _ref3.locale, + numberingSystem = _ref3.numberingSystem, + outputCalendar = _ref3.outputCalendar; + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: outputCalendar + }); + return clone(this, { + loc: loc + }); + } + + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */; + _proto.setLocale = function setLocale(locale) { + return this.reconfigure({ + locale: locale + }); + } + + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}. + * + * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`. + * They cannot be mixed with ISO-week units like `weekday`. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */; + _proto.set = function set(values) { + if (!this.isValid) return this; + var normalized = normalizeObject(values, normalizeUnitWithLocalWeeks); + var _usesLocalWeekValues2 = usesLocalWeekValues(normalized, this.loc), + minDaysInFirstWeek = _usesLocalWeekValues2.minDaysInFirstWeek, + startOfWeek = _usesLocalWeekValues2.startOfWeek; + var settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber; + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + var mixed; + if (settingWeekStuff) { + mixed = weekToGregorian(_extends({}, gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), normalized), minDaysInFirstWeek, startOfWeek); + } else if (!isUndefined(normalized.ordinal)) { + mixed = ordinalToGregorian(_extends({}, gregorianToOrdinal(this.c), normalized)); + } else { + mixed = _extends({}, this.toObject(), normalized); + + // if we didn't set the day but we ended up on an overflow date, + // use the last day of the right month + if (isUndefined(normalized.day)) { + mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); + } + } + var _objToTS4 = objToTS(mixed, this.o, this.zone), + ts = _objToTS4[0], + o = _objToTS4[1]; + return clone(this, { + ts: ts, + o: o + }); + } + + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.now().plus(123) //~> in 123 milliseconds + * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */; + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration); + return clone(this, adjustTime(this, dur)); + } + + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link DateTime#plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */; + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = Duration.fromDurationLike(duration).negate(); + return clone(this, adjustTime(this, dur)); + } + + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */; + _proto.startOf = function startOf(unit, _temp3) { + var _ref4 = _temp3 === void 0 ? {} : _temp3, + _ref4$useLocaleWeeks = _ref4.useLocaleWeeks, + useLocaleWeeks = _ref4$useLocaleWeeks === void 0 ? false : _ref4$useLocaleWeeks; + if (!this.isValid) return this; + var o = {}, + normalizedUnit = Duration.normalizeUnit(unit); + switch (normalizedUnit) { + case "years": + o.month = 1; + // falls through + case "quarters": + case "months": + o.day = 1; + // falls through + case "weeks": + case "days": + o.hour = 0; + // falls through + case "hours": + o.minute = 0; + // falls through + case "minutes": + o.second = 0; + // falls through + case "seconds": + o.millisecond = 0; + break; + // no default, invalid units throw in normalizeUnit() + } + + if (normalizedUnit === "weeks") { + if (useLocaleWeeks) { + var startOfWeek = this.loc.getStartOfWeek(); + var weekday = this.weekday; + if (weekday < startOfWeek) { + o.weekNumber = this.weekNumber - 1; + } + o.weekday = startOfWeek; + } else { + o.weekday = 1; + } + } + if (normalizedUnit === "quarters") { + var q = Math.ceil(this.month / 3); + o.month = (q - 1) * 3 + 1; + } + return this.set(o); + } + + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */; + _proto.endOf = function endOf(unit, opts) { + var _this$plus; + return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit, opts).minus(1) : this; + } + + // OUTPUT + + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.now().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.now().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */; + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID; + } + + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toLocaleString(); //=> 4/20/2017 + * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022' + * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32' + * @return {string} + */; + _proto.toLocaleString = function toLocaleString(formatOpts, opts) { + if (formatOpts === void 0) { + formatOpts = DATE_SHORT; + } + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID; + } + + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.now().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */; + _proto.toLocaleParts = function toLocaleParts(opts) { + if (opts === void 0) { + opts = {}; + } + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : []; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=false] - add the time zone format extension + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0. + * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z' + * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z' + * @return {string|null} + */; + _proto.toISO = function toISO(_temp4) { + var _ref5 = _temp4 === void 0 ? {} : _temp4, + _ref5$format = _ref5.format, + format = _ref5$format === void 0 ? "extended" : _ref5$format, + _ref5$suppressSeconds = _ref5.suppressSeconds, + suppressSeconds = _ref5$suppressSeconds === void 0 ? false : _ref5$suppressSeconds, + _ref5$suppressMillise = _ref5.suppressMilliseconds, + suppressMilliseconds = _ref5$suppressMillise === void 0 ? false : _ref5$suppressMillise, + _ref5$includeOffset = _ref5.includeOffset, + includeOffset = _ref5$includeOffset === void 0 ? true : _ref5$includeOffset, + _ref5$extendedZone = _ref5.extendedZone, + extendedZone = _ref5$extendedZone === void 0 ? false : _ref5$extendedZone, + _ref5$precision = _ref5.precision, + precision = _ref5$precision === void 0 ? "milliseconds" : _ref5$precision; + if (!this.isValid) { + return null; + } + precision = normalizeUnit(precision); + var ext = format === "extended"; + var c = _toISODate(this, ext, precision); + if (orderedUnits.indexOf(precision) >= 3) c += "T"; + c += _toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision); + return c; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'. + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05' + * @return {string|null} + */; + _proto.toISODate = function toISODate(_temp5) { + var _ref6 = _temp5 === void 0 ? {} : _temp5, + _ref6$format = _ref6.format, + format = _ref6$format === void 0 ? "extended" : _ref6$format, + _ref6$precision = _ref6.precision, + precision = _ref6$precision === void 0 ? "day" : _ref6$precision; + if (!this.isValid) { + return null; + } + return _toISODate(this, format === "extended", normalizeUnit(precision)); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */; + _proto.toISOWeekDate = function toISOWeekDate() { + return toTechFormat(this, "kkkk-'W'WW-c"); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=true] - add the time zone format extension + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0. + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z' + * @return {string} + */; + _proto.toISOTime = function toISOTime(_temp6) { + var _ref7 = _temp6 === void 0 ? {} : _temp6, + _ref7$suppressMillise = _ref7.suppressMilliseconds, + suppressMilliseconds = _ref7$suppressMillise === void 0 ? false : _ref7$suppressMillise, + _ref7$suppressSeconds = _ref7.suppressSeconds, + suppressSeconds = _ref7$suppressSeconds === void 0 ? false : _ref7$suppressSeconds, + _ref7$includeOffset = _ref7.includeOffset, + includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset, + _ref7$includePrefix = _ref7.includePrefix, + includePrefix = _ref7$includePrefix === void 0 ? false : _ref7$includePrefix, + _ref7$extendedZone = _ref7.extendedZone, + extendedZone = _ref7$extendedZone === void 0 ? false : _ref7$extendedZone, + _ref7$format = _ref7.format, + format = _ref7$format === void 0 ? "extended" : _ref7$format, + _ref7$precision = _ref7.precision, + precision = _ref7$precision === void 0 ? "milliseconds" : _ref7$precision; + if (!this.isValid) { + return null; + } + precision = normalizeUnit(precision); + var c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : ""; + return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision); + } + + /** + * Returns an RFC 2822-compatible string representation of this DateTime + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */; + _proto.toRFC2822 = function toRFC2822() { + return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); + } + + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */; + _proto.toHTTP = function toHTTP() { + return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string|null} + */; + _proto.toSQLDate = function toSQLDate() { + if (!this.isValid) { + return null; + } + return _toISODate(this, true); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */; + _proto.toSQLTime = function toSQLTime(_temp7) { + var _ref8 = _temp7 === void 0 ? {} : _temp7, + _ref8$includeOffset = _ref8.includeOffset, + includeOffset = _ref8$includeOffset === void 0 ? true : _ref8$includeOffset, + _ref8$includeZone = _ref8.includeZone, + includeZone = _ref8$includeZone === void 0 ? false : _ref8$includeZone, + _ref8$includeOffsetSp = _ref8.includeOffsetSpace, + includeOffsetSpace = _ref8$includeOffsetSp === void 0 ? true : _ref8$includeOffsetSp; + var fmt = "HH:mm:ss.SSS"; + if (includeZone || includeOffset) { + if (includeOffsetSpace) { + fmt += " "; + } + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += "ZZ"; + } + } + return toTechFormat(this, fmt, true); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */; + _proto.toSQL = function toSQL(opts) { + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) { + return null; + } + return this.toSQLDate() + " " + this.toSQLTime(opts); + } + + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */; + _proto.toString = function toString() { + return this.isValid ? this.toISO() : INVALID; + } + + /** + * Returns a string representation of this DateTime appropriate for the REPL. + * @return {string} + */; + _proto[_Symbol$for] = function () { + if (this.isValid) { + return "DateTime { ts: " + this.toISO() + ", zone: " + this.zone.name + ", locale: " + this.locale + " }"; + } else { + return "DateTime { Invalid, reason: " + this.invalidReason + " }"; + } + } + + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis} + * @return {number} + */; + _proto.valueOf = function valueOf() { + return this.toMillis(); + } + + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */; + _proto.toMillis = function toMillis() { + return this.isValid ? this.ts : NaN; + } + + /** + * Returns the epoch seconds (including milliseconds in the fractional part) of this DateTime. + * @return {number} + */; + _proto.toSeconds = function toSeconds() { + return this.isValid ? this.ts / 1000 : NaN; + } + + /** + * Returns the epoch seconds (as a whole number) of this DateTime. + * @return {number} + */; + _proto.toUnixInteger = function toUnixInteger() { + return this.isValid ? Math.floor(this.ts / 1000) : NaN; + } + + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */; + _proto.toJSON = function toJSON() { + return this.toISO(); + } + + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */; + _proto.toBSON = function toBSON() { + return this.toJSDate(); + } + + /** + * Returns a JavaScript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */; + _proto.toObject = function toObject(opts) { + if (opts === void 0) { + opts = {}; + } + if (!this.isValid) return {}; + var base = _extends({}, this.c); + if (opts.includeConfig) { + base.outputCalendar = this.outputCalendar; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + return base; + } + + /** + * Returns a JavaScript Date equivalent to this DateTime. + * @return {Date} + */; + _proto.toJSDate = function toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } + + // COMPARE + + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */; + _proto.diff = function diff(otherDateTime, unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + if (opts === void 0) { + opts = {}; + } + if (!this.isValid || !otherDateTime.isValid) { + return Duration.invalid("created by diffing an invalid DateTime"); + } + var durOpts = _extends({ + locale: this.locale, + numberingSystem: this.numberingSystem + }, opts); + var units = maybeArray(unit).map(Duration.normalizeUnit), + otherIsLater = otherDateTime.valueOf() > this.valueOf(), + earlier = otherIsLater ? this : otherDateTime, + later = otherIsLater ? otherDateTime : this, + diffed = _diff(earlier, later, units, durOpts); + return otherIsLater ? diffed.negate() : diffed; + } + + /** + * Return the difference between this DateTime and right now. + * See {@link DateTime#diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */; + _proto.diffNow = function diffNow(unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + if (opts === void 0) { + opts = {}; + } + return this.diff(DateTime.now(), unit, opts); + } + + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval|DateTime} + */; + _proto.until = function until(otherDateTime) { + return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; + } + + /** + * Return whether this DateTime is in the same unit of time as another DateTime. + * Higher-order units must also be identical for this function to return `true`. + * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed. + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used + * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day + * @return {boolean} + */; + _proto.hasSame = function hasSame(otherDateTime, unit, opts) { + if (!this.isValid) return false; + var inputMs = otherDateTime.valueOf(); + var adjustedToZone = this.setZone(otherDateTime.zone, { + keepLocalTime: true + }); + return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts); + } + + /** + * Equality check + * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */; + _proto.equals = function equals(other) { + return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc); + } + + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {string} [options.rounding="trunc"] - rounding method to use when rounding the numbers in the output. Can be "trunc" (toward zero), "expand" (away from zero), "round", "floor", or "ceil". + * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.now().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.now().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */; + _proto.toRelative = function toRelative(options) { + if (options === void 0) { + options = {}; + } + if (!this.isValid) return null; + var base = options.base || DateTime.fromObject({}, { + zone: this.zone + }), + padding = options.padding ? this < base ? -options.padding : options.padding : 0; + var units = ["years", "months", "days", "hours", "minutes", "seconds"]; + var unit = options.unit; + if (Array.isArray(options.unit)) { + units = options.unit; + unit = undefined; + } + return diffRelative(base, this.plus(padding), _extends({}, options, { + numeric: "always", + units: units, + unit: unit + })); + } + + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.now().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */; + _proto.toRelativeCalendar = function toRelativeCalendar(options) { + if (options === void 0) { + options = {}; + } + if (!this.isValid) return null; + return diffRelative(options.base || DateTime.fromObject({}, { + zone: this.zone + }), this, _extends({}, options, { + numeric: "auto", + units: ["years", "months", "days"], + calendary: true + })); + } + + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */; + DateTime.min = function min() { + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("min requires all arguments be DateTimes"); + } + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.min); + } + + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */; + DateTime.max = function max() { + for (var _len2 = arguments.length, dateTimes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + dateTimes[_key2] = arguments[_key2]; + } + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("max requires all arguments be DateTimes"); + } + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.max); + } + + // MISC + + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */; + DateTime.fromFormatExplain = function fromFormatExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + var _options = options, + _options$locale = _options.locale, + locale = _options$locale === void 0 ? null : _options$locale, + _options$numberingSys = _options.numberingSystem, + numberingSystem = _options$numberingSys === void 0 ? null : _options$numberingSys, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + return explainFromTokens(localeToUse, text, fmt); + } + + /** + * @deprecated use fromFormatExplain instead + */; + DateTime.fromStringExplain = function fromStringExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + return DateTime.fromFormatExplain(text, fmt, options); + } + + /** + * Build a parser for `fmt` using the given locale. This parser can be passed + * to {@link DateTime.fromFormatParser} to a parse a date in this format. This + * can be used to optimize cases where many dates need to be parsed in a + * specific format. + * + * @param {String} fmt - the format the string is expected to be in (see + * description) + * @param {Object} options - options used to set locale and numberingSystem + * for parser + * @returns {TokenParser} - opaque object to be used + */; + DateTime.buildFormatParser = function buildFormatParser(fmt, options) { + if (options === void 0) { + options = {}; + } + var _options2 = options, + _options2$locale = _options2.locale, + locale = _options2$locale === void 0 ? null : _options2$locale, + _options2$numberingSy = _options2.numberingSystem, + numberingSystem = _options2$numberingSy === void 0 ? null : _options2$numberingSy, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + return new TokenParser(localeToUse, fmt); + } + + /** + * Create a DateTime from an input string and format parser. + * + * The format parser must have been created with the same locale as this call. + * + * @param {String} text - the string to parse + * @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser} + * @param {Object} opts - options taken by fromFormat() + * @returns {DateTime} + */; + DateTime.fromFormatParser = function fromFormatParser(text, formatParser, opts) { + if (opts === void 0) { + opts = {}; + } + if (isUndefined(text) || isUndefined(formatParser)) { + throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser"); + } + var _opts2 = opts, + _opts2$locale = _opts2.locale, + locale = _opts2$locale === void 0 ? null : _opts2$locale, + _opts2$numberingSyste = _opts2.numberingSystem, + numberingSystem = _opts2$numberingSyste === void 0 ? null : _opts2$numberingSyste, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + if (!localeToUse.equals(formatParser.locale)) { + throw new InvalidArgumentError("fromFormatParser called with a locale of " + localeToUse + ", " + ("but the format parser was created for " + formatParser.locale)); + } + var _formatParser$explain = formatParser.explainFromTokens(text), + result = _formatParser$explain.result, + zone = _formatParser$explain.zone, + specificOffset = _formatParser$explain.specificOffset, + invalidReason = _formatParser$explain.invalidReason; + if (invalidReason) { + return DateTime.invalid(invalidReason); + } else { + return parseDataToDateTime(result, zone, opts, "format " + formatParser.format, text, specificOffset); + } + } + + // FORMAT PRESETS + + /** + * {@link DateTime#toLocaleString} format like 10/14/1983 + * @type {Object} + */; + _createClass(DateTime, [{ + key: "isValid", + get: function get() { + return this.invalid === null; + } + + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + }, { + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + }, { + key: "outputCalendar", + get: function get() { + return this.isValid ? this.loc.outputCalendar : null; + } + + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + }, { + key: "zone", + get: function get() { + return this._zone; + } + + /** + * Get the name of the time zone. + * @type {string} + */ + }, { + key: "zoneName", + get: function get() { + return this.isValid ? this.zone.name : null; + } + + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + }, { + key: "year", + get: function get() { + return this.isValid ? this.c.year : NaN; + } + + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + }, { + key: "quarter", + get: function get() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + }, { + key: "month", + get: function get() { + return this.isValid ? this.c.month : NaN; + } + + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + }, { + key: "day", + get: function get() { + return this.isValid ? this.c.day : NaN; + } + + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + }, { + key: "hour", + get: function get() { + return this.isValid ? this.c.hour : NaN; + } + + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + }, { + key: "minute", + get: function get() { + return this.isValid ? this.c.minute : NaN; + } + + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + }, { + key: "second", + get: function get() { + return this.isValid ? this.c.second : NaN; + } + + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + }, { + key: "millisecond", + get: function get() { + return this.isValid ? this.c.millisecond : NaN; + } + + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 12, 31).weekYear //=> 2015 + * @type {number} + */ + }, { + key: "weekYear", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; + } + + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + }, { + key: "weekNumber", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; + } + + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + }, { + key: "weekday", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; + } + + /** + * Returns true if this date is on a weekend according to the locale, false otherwise + * @returns {boolean} + */ + }, { + key: "isWeekend", + get: function get() { + return this.isValid && this.loc.getWeekendDays().includes(this.weekday); + } + + /** + * Get the day of the week according to the locale. + * 1 is the first day of the week and 7 is the last day of the week. + * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1, + * @returns {number} + */ + }, { + key: "localWeekday", + get: function get() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN; + } + + /** + * Get the week number of the week year according to the locale. Different locales assign week numbers differently, + * because the week can start on different days of the week (see localWeekday) and because a different number of days + * is required for a week to count as the first week of a year. + * @returns {number} + */ + }, { + key: "localWeekNumber", + get: function get() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN; + } + + /** + * Get the week year according to the locale. Different locales assign week numbers (and therefor week years) + * differently, see localWeekNumber. + * @returns {number} + */ + }, { + key: "localWeekYear", + get: function get() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN; + } + + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + }, { + key: "ordinal", + get: function get() { + return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; + } + + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + }, { + key: "monthShort", + get: function get() { + return this.isValid ? Info.months("short", { + locObj: this.loc + })[this.month - 1] : null; + } + + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + }, { + key: "monthLong", + get: function get() { + return this.isValid ? Info.months("long", { + locObj: this.loc + })[this.month - 1] : null; + } + + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + }, { + key: "weekdayShort", + get: function get() { + return this.isValid ? Info.weekdays("short", { + locObj: this.loc + })[this.weekday - 1] : null; + } + + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + }, { + key: "weekdayLong", + get: function get() { + return this.isValid ? Info.weekdays("long", { + locObj: this.loc + })[this.weekday - 1] : null; + } + + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.now().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + }, { + key: "offset", + get: function get() { + return this.isValid ? +this.o : NaN; + } + + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + }, { + key: "offsetNameShort", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale + }); + } else { + return null; + } + } + + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + }, { + key: "offsetNameLong", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale + }); + } else { + return null; + } + } + + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + }, { + key: "isOffsetFixed", + get: function get() { + return this.isValid ? this.zone.isUniversal : null; + } + + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + }, { + key: "isInDST", + get: function get() { + if (this.isOffsetFixed) { + return false; + } else { + return this.offset > this.set({ + month: 1, + day: 1 + }).offset || this.offset > this.set({ + month: 5 + }).offset; + } + } + }, { + key: "isInLeapYear", + get: function get() { + return isLeapYear(this.year); + } + + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + }, { + key: "daysInMonth", + get: function get() { + return daysInMonth(this.year, this.month); + } + + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + }, { + key: "daysInYear", + get: function get() { + return this.isValid ? daysInYear(this.year) : NaN; + } + + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + }, { + key: "weeksInWeekYear", + get: function get() { + return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; + } + + /** + * Returns the number of weeks in this DateTime's local week year + * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52 + * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53 + * @type {number} + */ + }, { + key: "weeksInLocalWeekYear", + get: function get() { + return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN; + } + }], [{ + key: "DATE_SHORT", + get: function get() { + return DATE_SHORT; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_MED", + get: function get() { + return DATE_MED; + } + + /** + * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_MED_WITH_WEEKDAY", + get: function get() { + return DATE_MED_WITH_WEEKDAY; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_FULL", + get: function get() { + return DATE_FULL; + } + + /** + * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + }, { + key: "DATE_HUGE", + get: function get() { + return DATE_HUGE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_SIMPLE", + get: function get() { + return TIME_SIMPLE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_WITH_SECONDS", + get: function get() { + return TIME_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_WITH_SHORT_OFFSET", + get: function get() { + return TIME_WITH_SHORT_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "TIME_WITH_LONG_OFFSET", + get: function get() { + return TIME_WITH_LONG_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_SIMPLE", + get: function get() { + return TIME_24_SIMPLE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_WITH_SECONDS", + get: function get() { + return TIME_24_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_WITH_SHORT_OFFSET", + get: function get() { + return TIME_24_WITH_SHORT_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + }, { + key: "TIME_24_WITH_LONG_OFFSET", + get: function get() { + return TIME_24_WITH_LONG_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_SHORT", + get: function get() { + return DATETIME_SHORT; + } + + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_SHORT_WITH_SECONDS", + get: function get() { + return DATETIME_SHORT_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_MED", + get: function get() { + return DATETIME_MED; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_MED_WITH_SECONDS", + get: function get() { + return DATETIME_MED_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_MED_WITH_WEEKDAY", + get: function get() { + return DATETIME_MED_WITH_WEEKDAY; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_FULL", + get: function get() { + return DATETIME_FULL; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_FULL_WITH_SECONDS", + get: function get() { + return DATETIME_FULL_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_HUGE", + get: function get() { + return DATETIME_HUGE; + } + + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + }, { + key: "DATETIME_HUGE_WITH_SECONDS", + get: function get() { + return DATETIME_HUGE_WITH_SECONDS; + } + }]); + return DateTime; + }(Symbol.for("nodejs.util.inspect.custom")); + function friendlyDateTime(dateTimeish) { + if (DateTime.isDateTime(dateTimeish)) { + return dateTimeish; + } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) { + return DateTime.fromJSDate(dateTimeish); + } else if (dateTimeish && typeof dateTimeish === "object") { + return DateTime.fromObject(dateTimeish); + } else { + throw new InvalidArgumentError("Unknown datetime argument: " + dateTimeish + ", of type " + typeof dateTimeish); + } + } + + var VERSION = "3.7.2"; + + exports.DateTime = DateTime; + exports.Duration = Duration; + exports.FixedOffsetZone = FixedOffsetZone; + exports.IANAZone = IANAZone; + exports.Info = Info; + exports.Interval = Interval; + exports.InvalidZone = InvalidZone; + exports.Settings = Settings; + exports.SystemZone = SystemZone; + exports.VERSION = VERSION; + exports.Zone = Zone; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}); +//# sourceMappingURL=luxon.js.map diff --git a/node_modules/luxon/build/global/luxon.js.map b/node_modules/luxon/build/global/luxon.js.map new file mode 100644 index 00000000..a7bbf8d6 --- /dev/null +++ b/node_modules/luxon/build/global/luxon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"luxon.js","sources":["../../src/errors.js","../../src/impl/formats.js","../../src/zone.js","../../src/zones/systemZone.js","../../src/zones/IANAZone.js","../../src/impl/locale.js","../../src/zones/fixedOffsetZone.js","../../src/zones/invalidZone.js","../../src/impl/zoneUtil.js","../../src/impl/digits.js","../../src/settings.js","../../src/impl/invalid.js","../../src/impl/conversions.js","../../src/impl/util.js","../../src/impl/english.js","../../src/impl/formatter.js","../../src/impl/regexParser.js","../../src/duration.js","../../src/interval.js","../../src/info.js","../../src/impl/diff.js","../../src/impl/tokenParser.js","../../src/datetime.js","../../src/luxon.js"],"sourcesContent":["// these aren't really private, but nor are they really useful to document\n\n/**\n * @private\n */\nclass LuxonError extends Error {}\n\n/**\n * @private\n */\nexport class InvalidDateTimeError extends LuxonError {\n constructor(reason) {\n super(`Invalid DateTime: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidIntervalError extends LuxonError {\n constructor(reason) {\n super(`Invalid Interval: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidDurationError extends LuxonError {\n constructor(reason) {\n super(`Invalid Duration: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class ConflictingSpecificationError extends LuxonError {}\n\n/**\n * @private\n */\nexport class InvalidUnitError extends LuxonError {\n constructor(unit) {\n super(`Invalid unit ${unit}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidArgumentError extends LuxonError {}\n\n/**\n * @private\n */\nexport class ZoneIsAbstractError extends LuxonError {\n constructor() {\n super(\"Zone is an abstract class\");\n }\n}\n","/**\n * @private\n */\n\nconst n = \"numeric\",\n s = \"short\",\n l = \"long\";\n\nexport const DATE_SHORT = {\n year: n,\n month: n,\n day: n,\n};\n\nexport const DATE_MED = {\n year: n,\n month: s,\n day: n,\n};\n\nexport const DATE_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n};\n\nexport const DATE_FULL = {\n year: n,\n month: l,\n day: n,\n};\n\nexport const DATE_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n};\n\nexport const TIME_SIMPLE = {\n hour: n,\n minute: n,\n};\n\nexport const TIME_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const TIME_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const TIME_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n\nexport const TIME_24_SIMPLE = {\n hour: n,\n minute: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: s,\n};\n\nexport const TIME_24_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: l,\n};\n\nexport const DATETIME_SHORT = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_SHORT_WITH_SECONDS = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_MED_WITH_SECONDS = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_FULL = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_FULL_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n timeZoneName: l,\n};\n\nexport const DATETIME_HUGE_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n","import { ZoneIsAbstractError } from \"./errors.js\";\n\n/**\n * @interface\n */\nexport default class Zone {\n /**\n * The type of zone\n * @abstract\n * @type {string}\n */\n get type() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The name of this zone.\n * @abstract\n * @type {string}\n */\n get name() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The IANA name of this zone.\n * Defaults to `name` if not overwritten by a subclass.\n * @abstract\n * @type {string}\n */\n get ianaName() {\n return this.name;\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @type {boolean}\n */\n get isUniversal() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, opts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's value as a string\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is valid.\n * @abstract\n * @type {boolean}\n */\n get isValid() {\n throw new ZoneIsAbstractError();\n }\n}\n","import { formatOffset, parseZoneInfo } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * Represents the local zone for this JavaScript environment.\n * @implements {Zone}\n */\nexport default class SystemZone extends Zone {\n /**\n * Get a singleton instance of the local zone\n * @return {SystemZone}\n */\n static get instance() {\n if (singleton === null) {\n singleton = new SystemZone();\n }\n return singleton;\n }\n\n /** @override **/\n get type() {\n return \"system\";\n }\n\n /** @override **/\n get name() {\n return new Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n return -new Date(ts).getTimezoneOffset();\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"system\";\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import { formatOffset, parseZoneInfo, isUndefined, objToLocalTS } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nconst dtfCache = new Map();\nfunction makeDTF(zoneName) {\n let dtf = dtfCache.get(zoneName);\n if (dtf === undefined) {\n dtf = new Intl.DateTimeFormat(\"en-US\", {\n hour12: false,\n timeZone: zoneName,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n era: \"short\",\n });\n dtfCache.set(zoneName, dtf);\n }\n return dtf;\n}\n\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n era: 3,\n hour: 4,\n minute: 5,\n second: 6,\n};\n\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, \"\"),\n parsed = /(\\d+)\\/(\\d+)\\/(\\d+) (AD|BC),? (\\d+):(\\d+):(\\d+)/.exec(formatted),\n [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;\n return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];\n}\n\nfunction partsOffset(dtf, date) {\n const formatted = dtf.formatToParts(date);\n const filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const { type, value } = formatted[i];\n const pos = typeToPos[type];\n\n if (type === \"era\") {\n filled[pos] = value;\n } else if (!isUndefined(pos)) {\n filled[pos] = parseInt(value, 10);\n }\n }\n return filled;\n}\n\nconst ianaZoneCache = new Map();\n/**\n * A zone identified by an IANA identifier, like America/New_York\n * @implements {Zone}\n */\nexport default class IANAZone extends Zone {\n /**\n * @param {string} name - Zone name\n * @return {IANAZone}\n */\n static create(name) {\n let zone = ianaZoneCache.get(name);\n if (zone === undefined) {\n ianaZoneCache.set(name, (zone = new IANAZone(name)));\n }\n return zone;\n }\n\n /**\n * Reset local caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCache() {\n ianaZoneCache.clear();\n dtfCache.clear();\n }\n\n /**\n * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.\n * @param {string} s - The string to check validity on\n * @example IANAZone.isValidSpecifier(\"America/New_York\") //=> true\n * @example IANAZone.isValidSpecifier(\"Sport~~blorp\") //=> false\n * @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead.\n * @return {boolean}\n */\n static isValidSpecifier(s) {\n return this.isValidZone(s);\n }\n\n /**\n * Returns whether the provided string identifies a real zone\n * @param {string} zone - The string to check\n * @example IANAZone.isValidZone(\"America/New_York\") //=> true\n * @example IANAZone.isValidZone(\"Fantasia/Castle\") //=> false\n * @example IANAZone.isValidZone(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidZone(zone) {\n if (!zone) {\n return false;\n }\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: zone }).format();\n return true;\n } catch (e) {\n return false;\n }\n }\n\n constructor(name) {\n super();\n /** @private **/\n this.zoneName = name;\n /** @private **/\n this.valid = IANAZone.isValidZone(name);\n }\n\n /**\n * The type of zone. `iana` for all instances of `IANAZone`.\n * @override\n * @type {string}\n */\n get type() {\n return \"iana\";\n }\n\n /**\n * The name of this zone (i.e. the IANA zone name).\n * @override\n * @type {string}\n */\n get name() {\n return this.zoneName;\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year:\n * Always returns false for all IANA zones.\n * @override\n * @type {boolean}\n */\n get isUniversal() {\n return false;\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale, this.name);\n }\n\n /**\n * Returns the offset's value as a string\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @override\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n if (!this.valid) return NaN;\n const date = new Date(ts);\n\n if (isNaN(date)) return NaN;\n\n const dtf = makeDTF(this.name);\n let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts\n ? partsOffset(dtf, date)\n : hackyOffset(dtf, date);\n\n if (adOrBc === \"BC\") {\n year = -Math.abs(year) + 1;\n }\n\n // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat\n const adjustedHour = hour === 24 ? 0 : hour;\n\n const asUTC = objToLocalTS({\n year,\n month,\n day,\n hour: adjustedHour,\n minute,\n second,\n millisecond: 0,\n });\n\n let asTS = +date;\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return (asUTC - asTS) / (60 * 1000);\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @override\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n return otherZone.type === \"iana\" && otherZone.name === this.name;\n }\n\n /**\n * Return whether this Zone is valid.\n * @override\n * @type {boolean}\n */\n get isValid() {\n return this.valid;\n }\n}\n","import { hasLocaleWeekInfo, hasRelative, padStart, roundTo, validateWeekSettings } from \"./util.js\";\nimport * as English from \"./english.js\";\nimport Settings from \"../settings.js\";\nimport DateTime from \"../datetime.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n// todo - remap caching\n\nlet intlLFCache = {};\nfunction getCachedLF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlLFCache[key];\n if (!dtf) {\n dtf = new Intl.ListFormat(locString, opts);\n intlLFCache[key] = dtf;\n }\n return dtf;\n}\n\nconst intlDTCache = new Map();\nfunction getCachedDTF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlDTCache.get(key);\n if (dtf === undefined) {\n dtf = new Intl.DateTimeFormat(locString, opts);\n intlDTCache.set(key, dtf);\n }\n return dtf;\n}\n\nconst intlNumCache = new Map();\nfunction getCachedINF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let inf = intlNumCache.get(key);\n if (inf === undefined) {\n inf = new Intl.NumberFormat(locString, opts);\n intlNumCache.set(key, inf);\n }\n return inf;\n}\n\nconst intlRelCache = new Map();\nfunction getCachedRTF(locString, opts = {}) {\n const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options\n const key = JSON.stringify([locString, cacheKeyOpts]);\n let inf = intlRelCache.get(key);\n if (inf === undefined) {\n inf = new Intl.RelativeTimeFormat(locString, opts);\n intlRelCache.set(key, inf);\n }\n return inf;\n}\n\nlet sysLocaleCache = null;\nfunction systemLocale() {\n if (sysLocaleCache) {\n return sysLocaleCache;\n } else {\n sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;\n return sysLocaleCache;\n }\n}\n\nconst intlResolvedOptionsCache = new Map();\nfunction getCachedIntResolvedOptions(locString) {\n let opts = intlResolvedOptionsCache.get(locString);\n if (opts === undefined) {\n opts = new Intl.DateTimeFormat(locString).resolvedOptions();\n intlResolvedOptionsCache.set(locString, opts);\n }\n return opts;\n}\n\nconst weekInfoCache = new Map();\nfunction getCachedWeekInfo(locString) {\n let data = weekInfoCache.get(locString);\n if (!data) {\n const locale = new Intl.Locale(locString);\n // browsers currently implement this as a property, but spec says it should be a getter function\n data = \"getWeekInfo\" in locale ? locale.getWeekInfo() : locale.weekInfo;\n // minimalDays was removed from WeekInfo: https://github.com/tc39/proposal-intl-locale-info/issues/86\n if (!(\"minimalDays\" in data)) {\n data = { ...fallbackWeekSettings, ...data };\n }\n weekInfoCache.set(locString, data);\n }\n return data;\n}\n\nfunction parseLocaleString(localeStr) {\n // I really want to avoid writing a BCP 47 parser\n // see, e.g. https://github.com/wooorm/bcp-47\n // Instead, we'll do this:\n\n // a) if the string has no -u extensions, just leave it alone\n // b) if it does, use Intl to resolve everything\n // c) if Intl fails, try again without the -u\n\n // private subtags and unicode subtags have ordering requirements,\n // and we're not properly parsing this, so just strip out the\n // private ones if they exist.\n const xIndex = localeStr.indexOf(\"-x-\");\n if (xIndex !== -1) {\n localeStr = localeStr.substring(0, xIndex);\n }\n\n const uIndex = localeStr.indexOf(\"-u-\");\n if (uIndex === -1) {\n return [localeStr];\n } else {\n let options;\n let selectedStr;\n try {\n options = getCachedDTF(localeStr).resolvedOptions();\n selectedStr = localeStr;\n } catch (e) {\n const smaller = localeStr.substring(0, uIndex);\n options = getCachedDTF(smaller).resolvedOptions();\n selectedStr = smaller;\n }\n\n const { numberingSystem, calendar } = options;\n return [selectedStr, numberingSystem, calendar];\n }\n}\n\nfunction intlConfigString(localeStr, numberingSystem, outputCalendar) {\n if (outputCalendar || numberingSystem) {\n if (!localeStr.includes(\"-u-\")) {\n localeStr += \"-u\";\n }\n\n if (outputCalendar) {\n localeStr += `-ca-${outputCalendar}`;\n }\n\n if (numberingSystem) {\n localeStr += `-nu-${numberingSystem}`;\n }\n return localeStr;\n } else {\n return localeStr;\n }\n}\n\nfunction mapMonths(f) {\n const ms = [];\n for (let i = 1; i <= 12; i++) {\n const dt = DateTime.utc(2009, i, 1);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction mapWeekdays(f) {\n const ms = [];\n for (let i = 1; i <= 7; i++) {\n const dt = DateTime.utc(2016, 11, 13 + i);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction listStuff(loc, length, englishFn, intlFn) {\n const mode = loc.listingMode();\n\n if (mode === \"error\") {\n return null;\n } else if (mode === \"en\") {\n return englishFn(length);\n } else {\n return intlFn(length);\n }\n}\n\nfunction supportsFastNumbers(loc) {\n if (loc.numberingSystem && loc.numberingSystem !== \"latn\") {\n return false;\n } else {\n return (\n loc.numberingSystem === \"latn\" ||\n !loc.locale ||\n loc.locale.startsWith(\"en\") ||\n getCachedIntResolvedOptions(loc.locale).numberingSystem === \"latn\"\n );\n }\n}\n\n/**\n * @private\n */\n\nclass PolyNumberFormatter {\n constructor(intl, forceSimple, opts) {\n this.padTo = opts.padTo || 0;\n this.floor = opts.floor || false;\n\n const { padTo, floor, ...otherOpts } = opts;\n\n if (!forceSimple || Object.keys(otherOpts).length > 0) {\n const intlOpts = { useGrouping: false, ...opts };\n if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;\n this.inf = getCachedINF(intl, intlOpts);\n }\n }\n\n format(i) {\n if (this.inf) {\n const fixed = this.floor ? Math.floor(i) : i;\n return this.inf.format(fixed);\n } else {\n // to match the browser's numberformatter defaults\n const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);\n return padStart(fixed, this.padTo);\n }\n }\n}\n\n/**\n * @private\n */\n\nclass PolyDateFormatter {\n constructor(dt, intl, opts) {\n this.opts = opts;\n this.originalZone = undefined;\n\n let z = undefined;\n if (this.opts.timeZone) {\n // Don't apply any workarounds if a timeZone is explicitly provided in opts\n this.dt = dt;\n } else if (dt.zone.type === \"fixed\") {\n // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like.\n // That is why fixed-offset TZ is set to that unless it is:\n // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT.\n // 2. Unsupported by the browser:\n // - some do not support Etc/\n // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata\n const gmtOffset = -1 * (dt.offset / 60);\n const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;\n if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {\n z = offsetZ;\n this.dt = dt;\n } else {\n // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so\n // we manually apply the offset and substitute the zone as needed.\n z = \"UTC\";\n this.dt = dt.offset === 0 ? dt : dt.setZone(\"UTC\").plus({ minutes: dt.offset });\n this.originalZone = dt.zone;\n }\n } else if (dt.zone.type === \"system\") {\n this.dt = dt;\n } else if (dt.zone.type === \"iana\") {\n this.dt = dt;\n z = dt.zone.name;\n } else {\n // Custom zones can have any offset / offsetName so we just manually\n // apply the offset and substitute the zone as needed.\n z = \"UTC\";\n this.dt = dt.setZone(\"UTC\").plus({ minutes: dt.offset });\n this.originalZone = dt.zone;\n }\n\n const intlOpts = { ...this.opts };\n intlOpts.timeZone = intlOpts.timeZone || z;\n this.dtf = getCachedDTF(intl, intlOpts);\n }\n\n format() {\n if (this.originalZone) {\n // If we have to substitute in the actual zone name, we have to use\n // formatToParts so that the timezone can be replaced.\n return this.formatToParts()\n .map(({ value }) => value)\n .join(\"\");\n }\n return this.dtf.format(this.dt.toJSDate());\n }\n\n formatToParts() {\n const parts = this.dtf.formatToParts(this.dt.toJSDate());\n if (this.originalZone) {\n return parts.map((part) => {\n if (part.type === \"timeZoneName\") {\n const offsetName = this.originalZone.offsetName(this.dt.ts, {\n locale: this.dt.locale,\n format: this.opts.timeZoneName,\n });\n return {\n ...part,\n value: offsetName,\n };\n } else {\n return part;\n }\n });\n }\n return parts;\n }\n\n resolvedOptions() {\n return this.dtf.resolvedOptions();\n }\n}\n\n/**\n * @private\n */\nclass PolyRelFormatter {\n constructor(intl, isEnglish, opts) {\n this.opts = { style: \"long\", ...opts };\n if (!isEnglish && hasRelative()) {\n this.rtf = getCachedRTF(intl, opts);\n }\n }\n\n format(count, unit) {\n if (this.rtf) {\n return this.rtf.format(count, unit);\n } else {\n return English.formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== \"long\");\n }\n }\n\n formatToParts(count, unit) {\n if (this.rtf) {\n return this.rtf.formatToParts(count, unit);\n } else {\n return [];\n }\n }\n}\n\nconst fallbackWeekSettings = {\n firstDay: 1,\n minimalDays: 4,\n weekend: [6, 7],\n};\n\n/**\n * @private\n */\nexport default class Locale {\n static fromOpts(opts) {\n return Locale.create(\n opts.locale,\n opts.numberingSystem,\n opts.outputCalendar,\n opts.weekSettings,\n opts.defaultToEN\n );\n }\n\n static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {\n const specifiedLocale = locale || Settings.defaultLocale;\n // the system locale is useful for human-readable strings but annoying for parsing/formatting known formats\n const localeR = specifiedLocale || (defaultToEN ? \"en-US\" : systemLocale());\n const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;\n const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;\n const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;\n return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);\n }\n\n static resetCache() {\n sysLocaleCache = null;\n intlDTCache.clear();\n intlNumCache.clear();\n intlRelCache.clear();\n intlResolvedOptionsCache.clear();\n weekInfoCache.clear();\n }\n\n static fromObject({ locale, numberingSystem, outputCalendar, weekSettings } = {}) {\n return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);\n }\n\n constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {\n const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);\n\n this.locale = parsedLocale;\n this.numberingSystem = numbering || parsedNumberingSystem || null;\n this.outputCalendar = outputCalendar || parsedOutputCalendar || null;\n this.weekSettings = weekSettings;\n this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);\n\n this.weekdaysCache = { format: {}, standalone: {} };\n this.monthsCache = { format: {}, standalone: {} };\n this.meridiemCache = null;\n this.eraCache = {};\n\n this.specifiedLocale = specifiedLocale;\n this.fastNumbersCached = null;\n }\n\n get fastNumbers() {\n if (this.fastNumbersCached == null) {\n this.fastNumbersCached = supportsFastNumbers(this);\n }\n\n return this.fastNumbersCached;\n }\n\n listingMode() {\n const isActuallyEn = this.isEnglish();\n const hasNoWeirdness =\n (this.numberingSystem === null || this.numberingSystem === \"latn\") &&\n (this.outputCalendar === null || this.outputCalendar === \"gregory\");\n return isActuallyEn && hasNoWeirdness ? \"en\" : \"intl\";\n }\n\n clone(alts) {\n if (!alts || Object.getOwnPropertyNames(alts).length === 0) {\n return this;\n } else {\n return Locale.create(\n alts.locale || this.specifiedLocale,\n alts.numberingSystem || this.numberingSystem,\n alts.outputCalendar || this.outputCalendar,\n validateWeekSettings(alts.weekSettings) || this.weekSettings,\n alts.defaultToEN || false\n );\n }\n }\n\n redefaultToEN(alts = {}) {\n return this.clone({ ...alts, defaultToEN: true });\n }\n\n redefaultToSystem(alts = {}) {\n return this.clone({ ...alts, defaultToEN: false });\n }\n\n months(length, format = false) {\n return listStuff(this, length, English.months, () => {\n // Workaround for \"ja\" locale: formatToParts does not label all parts of the month\n // as \"month\" and for this locale there is no difference between \"format\" and \"non-format\".\n // As such, just use format() instead of formatToParts() and take the whole string\n const monthSpecialCase = this.intl === \"ja\" || this.intl.startsWith(\"ja-\");\n format &= !monthSpecialCase;\n const intl = format ? { month: length, day: \"numeric\" } : { month: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.monthsCache[formatStr][length]) {\n const mapper = !monthSpecialCase\n ? (dt) => this.extract(dt, intl, \"month\")\n : (dt) => this.dtFormatter(dt, intl).format();\n this.monthsCache[formatStr][length] = mapMonths(mapper);\n }\n return this.monthsCache[formatStr][length];\n });\n }\n\n weekdays(length, format = false) {\n return listStuff(this, length, English.weekdays, () => {\n const intl = format\n ? { weekday: length, year: \"numeric\", month: \"long\", day: \"numeric\" }\n : { weekday: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.weekdaysCache[formatStr][length]) {\n this.weekdaysCache[formatStr][length] = mapWeekdays((dt) =>\n this.extract(dt, intl, \"weekday\")\n );\n }\n return this.weekdaysCache[formatStr][length];\n });\n }\n\n meridiems() {\n return listStuff(\n this,\n undefined,\n () => English.meridiems,\n () => {\n // In theory there could be aribitrary day periods. We're gonna assume there are exactly two\n // for AM and PM. This is probably wrong, but it's makes parsing way easier.\n if (!this.meridiemCache) {\n const intl = { hour: \"numeric\", hourCycle: \"h12\" };\n this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(\n (dt) => this.extract(dt, intl, \"dayperiod\")\n );\n }\n\n return this.meridiemCache;\n }\n );\n }\n\n eras(length) {\n return listStuff(this, length, English.eras, () => {\n const intl = { era: length };\n\n // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates\n // to definitely enumerate them.\n if (!this.eraCache[length]) {\n this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map((dt) =>\n this.extract(dt, intl, \"era\")\n );\n }\n\n return this.eraCache[length];\n });\n }\n\n extract(dt, intlOpts, field) {\n const df = this.dtFormatter(dt, intlOpts),\n results = df.formatToParts(),\n matching = results.find((m) => m.type.toLowerCase() === field);\n return matching ? matching.value : null;\n }\n\n numberFormatter(opts = {}) {\n // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave)\n // (in contrast, the rest of the condition is used heavily)\n return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);\n }\n\n dtFormatter(dt, intlOpts = {}) {\n return new PolyDateFormatter(dt, this.intl, intlOpts);\n }\n\n relFormatter(opts = {}) {\n return new PolyRelFormatter(this.intl, this.isEnglish(), opts);\n }\n\n listFormatter(opts = {}) {\n return getCachedLF(this.intl, opts);\n }\n\n isEnglish() {\n return (\n this.locale === \"en\" ||\n this.locale.toLowerCase() === \"en-us\" ||\n getCachedIntResolvedOptions(this.intl).locale.startsWith(\"en-us\")\n );\n }\n\n getWeekSettings() {\n if (this.weekSettings) {\n return this.weekSettings;\n } else if (!hasLocaleWeekInfo()) {\n return fallbackWeekSettings;\n } else {\n return getCachedWeekInfo(this.locale);\n }\n }\n\n getStartOfWeek() {\n return this.getWeekSettings().firstDay;\n }\n\n getMinDaysInFirstWeek() {\n return this.getWeekSettings().minimalDays;\n }\n\n getWeekendDays() {\n return this.getWeekSettings().weekend;\n }\n\n equals(other) {\n return (\n this.locale === other.locale &&\n this.numberingSystem === other.numberingSystem &&\n this.outputCalendar === other.outputCalendar\n );\n }\n\n toString() {\n return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;\n }\n}\n","import { formatOffset, signedOffset } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * A zone with a fixed offset (meaning no DST)\n * @implements {Zone}\n */\nexport default class FixedOffsetZone extends Zone {\n /**\n * Get a singleton instance of UTC\n * @return {FixedOffsetZone}\n */\n static get utcInstance() {\n if (singleton === null) {\n singleton = new FixedOffsetZone(0);\n }\n return singleton;\n }\n\n /**\n * Get an instance with a specified offset\n * @param {number} offset - The offset in minutes\n * @return {FixedOffsetZone}\n */\n static instance(offset) {\n return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);\n }\n\n /**\n * Get an instance of FixedOffsetZone from a UTC offset string, like \"UTC+6\"\n * @param {string} s - The offset string to parse\n * @example FixedOffsetZone.parseSpecifier(\"UTC+6\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC+06\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC-6:00\")\n * @return {FixedOffsetZone}\n */\n static parseSpecifier(s) {\n if (s) {\n const r = s.match(/^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$/i);\n if (r) {\n return new FixedOffsetZone(signedOffset(r[1], r[2]));\n }\n }\n return null;\n }\n\n constructor(offset) {\n super();\n /** @private **/\n this.fixed = offset;\n }\n\n /**\n * The type of zone. `fixed` for all instances of `FixedOffsetZone`.\n * @override\n * @type {string}\n */\n get type() {\n return \"fixed\";\n }\n\n /**\n * The name of this zone.\n * All fixed zones' names always start with \"UTC\" (plus optional offset)\n * @override\n * @type {string}\n */\n get name() {\n return this.fixed === 0 ? \"UTC\" : `UTC${formatOffset(this.fixed, \"narrow\")}`;\n }\n\n /**\n * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`\n *\n * @override\n * @type {string}\n */\n get ianaName() {\n if (this.fixed === 0) {\n return \"Etc/UTC\";\n } else {\n return `Etc/GMT${formatOffset(-this.fixed, \"narrow\")}`;\n }\n }\n\n /**\n * Returns the offset's common name at the specified timestamp.\n *\n * For fixed offset zones this equals to the zone name.\n * @override\n */\n offsetName() {\n return this.name;\n }\n\n /**\n * Returns the offset's value as a string\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n return formatOffset(this.fixed, format);\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year:\n * Always returns true for all fixed offset zones.\n * @override\n * @type {boolean}\n */\n get isUniversal() {\n return true;\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n *\n * For fixed offset zones, this is constant and does not depend on a timestamp.\n * @override\n * @return {number}\n */\n offset() {\n return this.fixed;\n }\n\n /**\n * Return whether this Zone is equal to another zone (i.e. also fixed and same offset)\n * @override\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n return otherZone.type === \"fixed\" && otherZone.fixed === this.fixed;\n }\n\n /**\n * Return whether this Zone is valid:\n * All fixed offset zones are valid.\n * @override\n * @type {boolean}\n */\n get isValid() {\n return true;\n }\n}\n","import Zone from \"../zone.js\";\n\n/**\n * A zone that failed to parse. You should never need to instantiate this.\n * @implements {Zone}\n */\nexport default class InvalidZone extends Zone {\n constructor(zoneName) {\n super();\n /** @private */\n this.zoneName = zoneName;\n }\n\n /** @override **/\n get type() {\n return \"invalid\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName() {\n return null;\n }\n\n /** @override **/\n formatOffset() {\n return \"\";\n }\n\n /** @override **/\n offset() {\n return NaN;\n }\n\n /** @override **/\n equals() {\n return false;\n }\n\n /** @override **/\n get isValid() {\n return false;\n }\n}\n","/**\n * @private\n */\n\nimport Zone from \"../zone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport InvalidZone from \"../zones/invalidZone.js\";\n\nimport { isUndefined, isString, isNumber } from \"./util.js\";\nimport SystemZone from \"../zones/systemZone.js\";\n\nexport function normalizeZone(input, defaultZone) {\n let offset;\n if (isUndefined(input) || input === null) {\n return defaultZone;\n } else if (input instanceof Zone) {\n return input;\n } else if (isString(input)) {\n const lowered = input.toLowerCase();\n if (lowered === \"default\") return defaultZone;\n else if (lowered === \"local\" || lowered === \"system\") return SystemZone.instance;\n else if (lowered === \"utc\" || lowered === \"gmt\") return FixedOffsetZone.utcInstance;\n else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);\n } else if (isNumber(input)) {\n return FixedOffsetZone.instance(input);\n } else if (typeof input === \"object\" && \"offset\" in input && typeof input.offset === \"function\") {\n // This is dumb, but the instanceof check above doesn't seem to really work\n // so we're duck checking it\n return input;\n } else {\n return new InvalidZone(input);\n }\n}\n","const numberingSystems = {\n arab: \"[\\u0660-\\u0669]\",\n arabext: \"[\\u06F0-\\u06F9]\",\n bali: \"[\\u1B50-\\u1B59]\",\n beng: \"[\\u09E6-\\u09EF]\",\n deva: \"[\\u0966-\\u096F]\",\n fullwide: \"[\\uFF10-\\uFF19]\",\n gujr: \"[\\u0AE6-\\u0AEF]\",\n hanidec: \"[〇|一|二|三|四|五|六|七|八|九]\",\n khmr: \"[\\u17E0-\\u17E9]\",\n knda: \"[\\u0CE6-\\u0CEF]\",\n laoo: \"[\\u0ED0-\\u0ED9]\",\n limb: \"[\\u1946-\\u194F]\",\n mlym: \"[\\u0D66-\\u0D6F]\",\n mong: \"[\\u1810-\\u1819]\",\n mymr: \"[\\u1040-\\u1049]\",\n orya: \"[\\u0B66-\\u0B6F]\",\n tamldec: \"[\\u0BE6-\\u0BEF]\",\n telu: \"[\\u0C66-\\u0C6F]\",\n thai: \"[\\u0E50-\\u0E59]\",\n tibt: \"[\\u0F20-\\u0F29]\",\n latn: \"\\\\d\",\n};\n\nconst numberingSystemsUTF16 = {\n arab: [1632, 1641],\n arabext: [1776, 1785],\n bali: [6992, 7001],\n beng: [2534, 2543],\n deva: [2406, 2415],\n fullwide: [65296, 65303],\n gujr: [2790, 2799],\n khmr: [6112, 6121],\n knda: [3302, 3311],\n laoo: [3792, 3801],\n limb: [6470, 6479],\n mlym: [3430, 3439],\n mong: [6160, 6169],\n mymr: [4160, 4169],\n orya: [2918, 2927],\n tamldec: [3046, 3055],\n telu: [3174, 3183],\n thai: [3664, 3673],\n tibt: [3872, 3881],\n};\n\nconst hanidecChars = numberingSystems.hanidec.replace(/[\\[|\\]]/g, \"\").split(\"\");\n\nexport function parseDigits(str) {\n let value = parseInt(str, 10);\n if (isNaN(value)) {\n value = \"\";\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (str[i].search(numberingSystems.hanidec) !== -1) {\n value += hanidecChars.indexOf(str[i]);\n } else {\n for (const key in numberingSystemsUTF16) {\n const [min, max] = numberingSystemsUTF16[key];\n if (code >= min && code <= max) {\n value += code - min;\n }\n }\n }\n }\n return parseInt(value, 10);\n } else {\n return value;\n }\n}\n\n// cache of {numberingSystem: {append: regex}}\nconst digitRegexCache = new Map();\nexport function resetDigitRegexCache() {\n digitRegexCache.clear();\n}\n\nexport function digitRegex({ numberingSystem }, append = \"\") {\n const ns = numberingSystem || \"latn\";\n\n let appendCache = digitRegexCache.get(ns);\n if (appendCache === undefined) {\n appendCache = new Map();\n digitRegexCache.set(ns, appendCache);\n }\n let regex = appendCache.get(append);\n if (regex === undefined) {\n regex = new RegExp(`${numberingSystems[ns]}${append}`);\n appendCache.set(append, regex);\n }\n\n return regex;\n}\n","import SystemZone from \"./zones/systemZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport DateTime from \"./datetime.js\";\n\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport { validateWeekSettings } from \"./impl/util.js\";\nimport { resetDigitRegexCache } from \"./impl/digits.js\";\n\nlet now = () => Date.now(),\n defaultZone = \"system\",\n defaultLocale = null,\n defaultNumberingSystem = null,\n defaultOutputCalendar = null,\n twoDigitCutoffYear = 60,\n throwOnInvalid,\n defaultWeekSettings = null;\n\n/**\n * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.\n */\nexport default class Settings {\n /**\n * Get the callback for returning the current timestamp.\n * @type {function}\n */\n static get now() {\n return now;\n }\n\n /**\n * Set the callback for returning the current timestamp.\n * The function should return a number, which will be interpreted as an Epoch millisecond count\n * @type {function}\n * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future\n * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time\n */\n static set now(n) {\n now = n;\n }\n\n /**\n * Set the default time zone to create DateTimes in. Does not affect existing instances.\n * Use the value \"system\" to reset this value to the system's time zone.\n * @type {string}\n */\n static set defaultZone(zone) {\n defaultZone = zone;\n }\n\n /**\n * Get the default time zone object currently used to create DateTimes. Does not affect existing instances.\n * The default value is the system's time zone (the one set on the machine that runs this code).\n * @type {Zone}\n */\n static get defaultZone() {\n return normalizeZone(defaultZone, SystemZone.instance);\n }\n\n /**\n * Get the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultLocale() {\n return defaultLocale;\n }\n\n /**\n * Set the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultLocale(locale) {\n defaultLocale = locale;\n }\n\n /**\n * Get the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultNumberingSystem() {\n return defaultNumberingSystem;\n }\n\n /**\n * Set the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultNumberingSystem(numberingSystem) {\n defaultNumberingSystem = numberingSystem;\n }\n\n /**\n * Get the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultOutputCalendar() {\n return defaultOutputCalendar;\n }\n\n /**\n * Set the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultOutputCalendar(outputCalendar) {\n defaultOutputCalendar = outputCalendar;\n }\n\n /**\n * @typedef {Object} WeekSettings\n * @property {number} firstDay\n * @property {number} minimalDays\n * @property {number[]} weekend\n */\n\n /**\n * @return {WeekSettings|null}\n */\n static get defaultWeekSettings() {\n return defaultWeekSettings;\n }\n\n /**\n * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and\n * how many days are required in the first week of a year.\n * Does not affect existing instances.\n *\n * @param {WeekSettings|null} weekSettings\n */\n static set defaultWeekSettings(weekSettings) {\n defaultWeekSettings = validateWeekSettings(weekSettings);\n }\n\n /**\n * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.\n * @type {number}\n */\n static get twoDigitCutoffYear() {\n return twoDigitCutoffYear;\n }\n\n /**\n * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.\n * @type {number}\n * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century\n * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century\n * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950\n * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50\n * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50\n */\n static set twoDigitCutoffYear(cutoffYear) {\n twoDigitCutoffYear = cutoffYear % 100;\n }\n\n /**\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static get throwOnInvalid() {\n return throwOnInvalid;\n }\n\n /**\n * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static set throwOnInvalid(t) {\n throwOnInvalid = t;\n }\n\n /**\n * Reset Luxon's global caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCaches() {\n Locale.resetCache();\n IANAZone.resetCache();\n DateTime.resetCache();\n resetDigitRegexCache();\n }\n}\n","export default class Invalid {\n constructor(reason, explanation) {\n this.reason = reason;\n this.explanation = explanation;\n }\n\n toMessage() {\n if (this.explanation) {\n return `${this.reason}: ${this.explanation}`;\n } else {\n return this.reason;\n }\n }\n}\n","import {\n integerBetween,\n isLeapYear,\n timeObject,\n daysInYear,\n daysInMonth,\n weeksInWeekYear,\n isInteger,\n isUndefined,\n} from \"./util.js\";\nimport Invalid from \"./invalid.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],\n leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];\n\nfunction unitOutOfRange(unit, value) {\n return new Invalid(\n \"unit out of range\",\n `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`\n );\n}\n\nexport function dayOfWeek(year, month, day) {\n const d = new Date(Date.UTC(year, month - 1, day));\n\n if (year < 100 && year >= 0) {\n d.setUTCFullYear(d.getUTCFullYear() - 1900);\n }\n\n const js = d.getUTCDay();\n\n return js === 0 ? 7 : js;\n}\n\nfunction computeOrdinal(year, month, day) {\n return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];\n}\n\nfunction uncomputeOrdinal(year, ordinal) {\n const table = isLeapYear(year) ? leapLadder : nonLeapLadder,\n month0 = table.findIndex((i) => i < ordinal),\n day = ordinal - table[month0];\n return { month: month0 + 1, day };\n}\n\nexport function isoWeekdayToLocal(isoWeekday, startOfWeek) {\n return ((isoWeekday - startOfWeek + 7) % 7) + 1;\n}\n\n/**\n * @private\n */\n\nexport function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const { year, month, day } = gregObj,\n ordinal = computeOrdinal(year, month, day),\n weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);\n\n let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7),\n weekYear;\n\n if (weekNumber < 1) {\n weekYear = year - 1;\n weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);\n } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {\n weekYear = year + 1;\n weekNumber = 1;\n } else {\n weekYear = year;\n }\n\n return { weekYear, weekNumber, weekday, ...timeObject(gregObj) };\n}\n\nexport function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const { weekYear, weekNumber, weekday } = weekData,\n weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek),\n yearInDays = daysInYear(weekYear);\n\n let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek,\n year;\n\n if (ordinal < 1) {\n year = weekYear - 1;\n ordinal += daysInYear(year);\n } else if (ordinal > yearInDays) {\n year = weekYear + 1;\n ordinal -= daysInYear(weekYear);\n } else {\n year = weekYear;\n }\n\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(weekData) };\n}\n\nexport function gregorianToOrdinal(gregData) {\n const { year, month, day } = gregData;\n const ordinal = computeOrdinal(year, month, day);\n return { year, ordinal, ...timeObject(gregData) };\n}\n\nexport function ordinalToGregorian(ordinalData) {\n const { year, ordinal } = ordinalData;\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(ordinalData) };\n}\n\n/**\n * Check if local week units like localWeekday are used in obj.\n * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties.\n * Modifies obj in-place!\n * @param obj the object values\n */\nexport function usesLocalWeekValues(obj, loc) {\n const hasLocaleWeekData =\n !isUndefined(obj.localWeekday) ||\n !isUndefined(obj.localWeekNumber) ||\n !isUndefined(obj.localWeekYear);\n if (hasLocaleWeekData) {\n const hasIsoWeekData =\n !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);\n\n if (hasIsoWeekData) {\n throw new ConflictingSpecificationError(\n \"Cannot mix locale-based week fields with ISO-based week fields\"\n );\n }\n if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;\n if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;\n if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;\n delete obj.localWeekday;\n delete obj.localWeekNumber;\n delete obj.localWeekYear;\n return {\n minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),\n startOfWeek: loc.getStartOfWeek(),\n };\n } else {\n return { minDaysInFirstWeek: 4, startOfWeek: 1 };\n }\n}\n\nexport function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const validYear = isInteger(obj.weekYear),\n validWeek = integerBetween(\n obj.weekNumber,\n 1,\n weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)\n ),\n validWeekday = integerBetween(obj.weekday, 1, 7);\n\n if (!validYear) {\n return unitOutOfRange(\"weekYear\", obj.weekYear);\n } else if (!validWeek) {\n return unitOutOfRange(\"week\", obj.weekNumber);\n } else if (!validWeekday) {\n return unitOutOfRange(\"weekday\", obj.weekday);\n } else return false;\n}\n\nexport function hasInvalidOrdinalData(obj) {\n const validYear = isInteger(obj.year),\n validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validOrdinal) {\n return unitOutOfRange(\"ordinal\", obj.ordinal);\n } else return false;\n}\n\nexport function hasInvalidGregorianData(obj) {\n const validYear = isInteger(obj.year),\n validMonth = integerBetween(obj.month, 1, 12),\n validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validMonth) {\n return unitOutOfRange(\"month\", obj.month);\n } else if (!validDay) {\n return unitOutOfRange(\"day\", obj.day);\n } else return false;\n}\n\nexport function hasInvalidTimeData(obj) {\n const { hour, minute, second, millisecond } = obj;\n const validHour =\n integerBetween(hour, 0, 23) ||\n (hour === 24 && minute === 0 && second === 0 && millisecond === 0),\n validMinute = integerBetween(minute, 0, 59),\n validSecond = integerBetween(second, 0, 59),\n validMillisecond = integerBetween(millisecond, 0, 999);\n\n if (!validHour) {\n return unitOutOfRange(\"hour\", hour);\n } else if (!validMinute) {\n return unitOutOfRange(\"minute\", minute);\n } else if (!validSecond) {\n return unitOutOfRange(\"second\", second);\n } else if (!validMillisecond) {\n return unitOutOfRange(\"millisecond\", millisecond);\n } else return false;\n}\n","/*\n This is just a junk drawer, containing anything used across multiple classes.\n Because Luxon is small(ish), this should stay small and we won't worry about splitting\n it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.\n*/\n\nimport { InvalidArgumentError } from \"../errors.js\";\nimport Settings from \"../settings.js\";\nimport { dayOfWeek, isoWeekdayToLocal } from \"./conversions.js\";\n\n/**\n * @private\n */\n\n// TYPES\n\nexport function isUndefined(o) {\n return typeof o === \"undefined\";\n}\n\nexport function isNumber(o) {\n return typeof o === \"number\";\n}\n\nexport function isInteger(o) {\n return typeof o === \"number\" && o % 1 === 0;\n}\n\nexport function isString(o) {\n return typeof o === \"string\";\n}\n\nexport function isDate(o) {\n return Object.prototype.toString.call(o) === \"[object Date]\";\n}\n\n// CAPABILITIES\n\nexport function hasRelative() {\n try {\n return typeof Intl !== \"undefined\" && !!Intl.RelativeTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\nexport function hasLocaleWeekInfo() {\n try {\n return (\n typeof Intl !== \"undefined\" &&\n !!Intl.Locale &&\n (\"weekInfo\" in Intl.Locale.prototype || \"getWeekInfo\" in Intl.Locale.prototype)\n );\n } catch (e) {\n return false;\n }\n}\n\n// OBJECTS AND ARRAYS\n\nexport function maybeArray(thing) {\n return Array.isArray(thing) ? thing : [thing];\n}\n\nexport function bestBy(arr, by, compare) {\n if (arr.length === 0) {\n return undefined;\n }\n return arr.reduce((best, next) => {\n const pair = [by(next), next];\n if (!best) {\n return pair;\n } else if (compare(best[0], pair[0]) === best[0]) {\n return best;\n } else {\n return pair;\n }\n }, null)[1];\n}\n\nexport function pick(obj, keys) {\n return keys.reduce((a, k) => {\n a[k] = obj[k];\n return a;\n }, {});\n}\n\nexport function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport function validateWeekSettings(settings) {\n if (settings == null) {\n return null;\n } else if (typeof settings !== \"object\") {\n throw new InvalidArgumentError(\"Week settings must be an object\");\n } else {\n if (\n !integerBetween(settings.firstDay, 1, 7) ||\n !integerBetween(settings.minimalDays, 1, 7) ||\n !Array.isArray(settings.weekend) ||\n settings.weekend.some((v) => !integerBetween(v, 1, 7))\n ) {\n throw new InvalidArgumentError(\"Invalid week settings\");\n }\n return {\n firstDay: settings.firstDay,\n minimalDays: settings.minimalDays,\n weekend: Array.from(settings.weekend),\n };\n }\n}\n\n// NUMBERS AND STRINGS\n\nexport function integerBetween(thing, bottom, top) {\n return isInteger(thing) && thing >= bottom && thing <= top;\n}\n\n// x % n but takes the sign of n instead of x\nexport function floorMod(x, n) {\n return x - n * Math.floor(x / n);\n}\n\nexport function padStart(input, n = 2) {\n const isNeg = input < 0;\n let padded;\n if (isNeg) {\n padded = \"-\" + (\"\" + -input).padStart(n, \"0\");\n } else {\n padded = (\"\" + input).padStart(n, \"0\");\n }\n return padded;\n}\n\nexport function parseInteger(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseInt(string, 10);\n }\n}\n\nexport function parseFloating(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseFloat(string);\n }\n}\n\nexport function parseMillis(fraction) {\n // Return undefined (instead of 0) in these cases, where fraction is not set\n if (isUndefined(fraction) || fraction === null || fraction === \"\") {\n return undefined;\n } else {\n const f = parseFloat(\"0.\" + fraction) * 1000;\n return Math.floor(f);\n }\n}\n\nexport function roundTo(number, digits, rounding = \"round\") {\n const factor = 10 ** digits;\n switch (rounding) {\n case \"expand\":\n return number > 0\n ? Math.ceil(number * factor) / factor\n : Math.floor(number * factor) / factor;\n case \"trunc\":\n return Math.trunc(number * factor) / factor;\n case \"round\":\n return Math.round(number * factor) / factor;\n case \"floor\":\n return Math.floor(number * factor) / factor;\n case \"ceil\":\n return Math.ceil(number * factor) / factor;\n default:\n throw new RangeError(`Value rounding ${rounding} is out of range`);\n }\n}\n\n// DATE BASICS\n\nexport function isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\nexport function daysInMonth(year, month) {\n const modMonth = floorMod(month - 1, 12) + 1,\n modYear = year + (month - modMonth) / 12;\n\n if (modMonth === 2) {\n return isLeapYear(modYear) ? 29 : 28;\n } else {\n return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];\n }\n}\n\n// convert a calendar object to a local timestamp (epoch, but with the offset baked in)\nexport function objToLocalTS(obj) {\n let d = Date.UTC(\n obj.year,\n obj.month - 1,\n obj.day,\n obj.hour,\n obj.minute,\n obj.second,\n obj.millisecond\n );\n\n // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that\n if (obj.year < 100 && obj.year >= 0) {\n d = new Date(d);\n // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not\n // so if obj.year is in 99, but obj.day makes it roll over into year 100,\n // the calculations done by Date.UTC are using year 2000 - which is incorrect\n d.setUTCFullYear(obj.year, obj.month - 1, obj.day);\n }\n return +d;\n}\n\n// adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js\nfunction firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {\n const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);\n return -fwdlw + minDaysInFirstWeek - 1;\n}\n\nexport function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);\n const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);\n return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;\n}\n\nexport function untruncateYear(year) {\n if (year > 99) {\n return year;\n } else return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year;\n}\n\n// PARSING\n\nexport function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {\n const date = new Date(ts),\n intlOpts = {\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n };\n\n if (timeZone) {\n intlOpts.timeZone = timeZone;\n }\n\n const modified = { timeZoneName: offsetFormat, ...intlOpts };\n\n const parsed = new Intl.DateTimeFormat(locale, modified)\n .formatToParts(date)\n .find((m) => m.type.toLowerCase() === \"timezonename\");\n return parsed ? parsed.value : null;\n}\n\n// signedOffset('-5', '30') -> -330\nexport function signedOffset(offHourStr, offMinuteStr) {\n let offHour = parseInt(offHourStr, 10);\n\n // don't || this because we want to preserve -0\n if (Number.isNaN(offHour)) {\n offHour = 0;\n }\n\n const offMin = parseInt(offMinuteStr, 10) || 0,\n offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;\n return offHour * 60 + offMinSigned;\n}\n\n// COERCION\n\nexport function asNumber(value) {\n const numericValue = Number(value);\n if (typeof value === \"boolean\" || value === \"\" || !Number.isFinite(numericValue))\n throw new InvalidArgumentError(`Invalid unit value ${value}`);\n return numericValue;\n}\n\nexport function normalizeObject(obj, normalizer) {\n const normalized = {};\n for (const u in obj) {\n if (hasOwnProperty(obj, u)) {\n const v = obj[u];\n if (v === undefined || v === null) continue;\n normalized[normalizer(u)] = asNumber(v);\n }\n }\n return normalized;\n}\n\n/**\n * Returns the offset's value as a string\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\nexport function formatOffset(offset, format) {\n const hours = Math.trunc(Math.abs(offset / 60)),\n minutes = Math.trunc(Math.abs(offset % 60)),\n sign = offset >= 0 ? \"+\" : \"-\";\n\n switch (format) {\n case \"short\":\n return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;\n case \"narrow\":\n return `${sign}${hours}${minutes > 0 ? `:${minutes}` : \"\"}`;\n case \"techie\":\n return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;\n default:\n throw new RangeError(`Value format ${format} is out of range for property format`);\n }\n}\n\nexport function timeObject(obj) {\n return pick(obj, [\"hour\", \"minute\", \"second\", \"millisecond\"]);\n}\n","import * as Formats from \"./formats.js\";\nimport { pick } from \"./util.js\";\n\nfunction stringify(obj) {\n return JSON.stringify(obj, Object.keys(obj).sort());\n}\n\n/**\n * @private\n */\n\nexport const monthsLong = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n];\n\nexport const monthsShort = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n];\n\nexport const monthsNarrow = [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"];\n\nexport function months(length) {\n switch (length) {\n case \"narrow\":\n return [...monthsNarrow];\n case \"short\":\n return [...monthsShort];\n case \"long\":\n return [...monthsLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"];\n case \"2-digit\":\n return [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\"];\n default:\n return null;\n }\n}\n\nexport const weekdaysLong = [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\",\n];\n\nexport const weekdaysShort = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nexport const weekdaysNarrow = [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"];\n\nexport function weekdays(length) {\n switch (length) {\n case \"narrow\":\n return [...weekdaysNarrow];\n case \"short\":\n return [...weekdaysShort];\n case \"long\":\n return [...weekdaysLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"];\n default:\n return null;\n }\n}\n\nexport const meridiems = [\"AM\", \"PM\"];\n\nexport const erasLong = [\"Before Christ\", \"Anno Domini\"];\n\nexport const erasShort = [\"BC\", \"AD\"];\n\nexport const erasNarrow = [\"B\", \"A\"];\n\nexport function eras(length) {\n switch (length) {\n case \"narrow\":\n return [...erasNarrow];\n case \"short\":\n return [...erasShort];\n case \"long\":\n return [...erasLong];\n default:\n return null;\n }\n}\n\nexport function meridiemForDateTime(dt) {\n return meridiems[dt.hour < 12 ? 0 : 1];\n}\n\nexport function weekdayForDateTime(dt, length) {\n return weekdays(length)[dt.weekday - 1];\n}\n\nexport function monthForDateTime(dt, length) {\n return months(length)[dt.month - 1];\n}\n\nexport function eraForDateTime(dt, length) {\n return eras(length)[dt.year < 0 ? 0 : 1];\n}\n\nexport function formatRelativeTime(unit, count, numeric = \"always\", narrow = false) {\n const units = {\n years: [\"year\", \"yr.\"],\n quarters: [\"quarter\", \"qtr.\"],\n months: [\"month\", \"mo.\"],\n weeks: [\"week\", \"wk.\"],\n days: [\"day\", \"day\", \"days\"],\n hours: [\"hour\", \"hr.\"],\n minutes: [\"minute\", \"min.\"],\n seconds: [\"second\", \"sec.\"],\n };\n\n const lastable = [\"hours\", \"minutes\", \"seconds\"].indexOf(unit) === -1;\n\n if (numeric === \"auto\" && lastable) {\n const isDay = unit === \"days\";\n switch (count) {\n case 1:\n return isDay ? \"tomorrow\" : `next ${units[unit][0]}`;\n case -1:\n return isDay ? \"yesterday\" : `last ${units[unit][0]}`;\n case 0:\n return isDay ? \"today\" : `this ${units[unit][0]}`;\n default: // fall through\n }\n }\n\n const isInPast = Object.is(count, -0) || count < 0,\n fmtValue = Math.abs(count),\n singular = fmtValue === 1,\n lilUnits = units[unit],\n fmtUnit = narrow\n ? singular\n ? lilUnits[1]\n : lilUnits[2] || lilUnits[1]\n : singular\n ? units[unit][0]\n : unit;\n return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;\n}\n\nexport function formatString(knownFormat) {\n // these all have the offsets removed because we don't have access to them\n // without all the intl stuff this is backfilling\n const filtered = pick(knownFormat, [\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n \"hourCycle\",\n ]),\n key = stringify(filtered),\n dateTimeHuge = \"EEEE, LLLL d, yyyy, h:mm a\";\n switch (key) {\n case stringify(Formats.DATE_SHORT):\n return \"M/d/yyyy\";\n case stringify(Formats.DATE_MED):\n return \"LLL d, yyyy\";\n case stringify(Formats.DATE_MED_WITH_WEEKDAY):\n return \"EEE, LLL d, yyyy\";\n case stringify(Formats.DATE_FULL):\n return \"LLLL d, yyyy\";\n case stringify(Formats.DATE_HUGE):\n return \"EEEE, LLLL d, yyyy\";\n case stringify(Formats.TIME_SIMPLE):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_SECONDS):\n return \"h:mm:ss a\";\n case stringify(Formats.TIME_WITH_SHORT_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_LONG_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_24_SIMPLE):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_SECONDS):\n return \"HH:mm:ss\";\n case stringify(Formats.TIME_24_WITH_SHORT_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_LONG_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.DATETIME_SHORT):\n return \"M/d/yyyy, h:mm a\";\n case stringify(Formats.DATETIME_MED):\n return \"LLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL):\n return \"LLLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_HUGE):\n return dateTimeHuge;\n case stringify(Formats.DATETIME_SHORT_WITH_SECONDS):\n return \"M/d/yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_SECONDS):\n return \"LLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_WEEKDAY):\n return \"EEE, d LLL yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL_WITH_SECONDS):\n return \"LLLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_HUGE_WITH_SECONDS):\n return \"EEEE, LLLL d, yyyy, h:mm:ss a\";\n default:\n return dateTimeHuge;\n }\n}\n","import * as English from \"./english.js\";\nimport * as Formats from \"./formats.js\";\nimport { padStart } from \"./util.js\";\n\nfunction stringifyTokens(splits, tokenToString) {\n let s = \"\";\n for (const token of splits) {\n if (token.literal) {\n s += token.val;\n } else {\n s += tokenToString(token.val);\n }\n }\n return s;\n}\n\nconst macroTokenToFormatOpts = {\n D: Formats.DATE_SHORT,\n DD: Formats.DATE_MED,\n DDD: Formats.DATE_FULL,\n DDDD: Formats.DATE_HUGE,\n t: Formats.TIME_SIMPLE,\n tt: Formats.TIME_WITH_SECONDS,\n ttt: Formats.TIME_WITH_SHORT_OFFSET,\n tttt: Formats.TIME_WITH_LONG_OFFSET,\n T: Formats.TIME_24_SIMPLE,\n TT: Formats.TIME_24_WITH_SECONDS,\n TTT: Formats.TIME_24_WITH_SHORT_OFFSET,\n TTTT: Formats.TIME_24_WITH_LONG_OFFSET,\n f: Formats.DATETIME_SHORT,\n ff: Formats.DATETIME_MED,\n fff: Formats.DATETIME_FULL,\n ffff: Formats.DATETIME_HUGE,\n F: Formats.DATETIME_SHORT_WITH_SECONDS,\n FF: Formats.DATETIME_MED_WITH_SECONDS,\n FFF: Formats.DATETIME_FULL_WITH_SECONDS,\n FFFF: Formats.DATETIME_HUGE_WITH_SECONDS,\n};\n\n/**\n * @private\n */\n\nexport default class Formatter {\n static create(locale, opts = {}) {\n return new Formatter(locale, opts);\n }\n\n static parseFormat(fmt) {\n // white-space is always considered a literal in user-provided formats\n // the \" \" token has a special meaning (see unitForToken)\n\n let current = null,\n currentFull = \"\",\n bracketed = false;\n const splits = [];\n for (let i = 0; i < fmt.length; i++) {\n const c = fmt.charAt(i);\n if (c === \"'\") {\n // turn '' into a literal signal quote instead of just skipping the empty literal\n if (currentFull.length > 0 || bracketed) {\n splits.push({\n literal: bracketed || /^\\s+$/.test(currentFull),\n val: currentFull === \"\" ? \"'\" : currentFull,\n });\n }\n current = null;\n currentFull = \"\";\n bracketed = !bracketed;\n } else if (bracketed) {\n currentFull += c;\n } else if (c === current) {\n currentFull += c;\n } else {\n if (currentFull.length > 0) {\n splits.push({ literal: /^\\s+$/.test(currentFull), val: currentFull });\n }\n currentFull = c;\n current = c;\n }\n }\n\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed || /^\\s+$/.test(currentFull), val: currentFull });\n }\n\n return splits;\n }\n\n static macroTokenToFormatOpts(token) {\n return macroTokenToFormatOpts[token];\n }\n\n constructor(locale, formatOpts) {\n this.opts = formatOpts;\n this.loc = locale;\n this.systemLoc = null;\n }\n\n formatWithSystemDefault(dt, opts) {\n if (this.systemLoc === null) {\n this.systemLoc = this.loc.redefaultToSystem();\n }\n const df = this.systemLoc.dtFormatter(dt, { ...this.opts, ...opts });\n return df.format();\n }\n\n dtFormatter(dt, opts = {}) {\n return this.loc.dtFormatter(dt, { ...this.opts, ...opts });\n }\n\n formatDateTime(dt, opts) {\n return this.dtFormatter(dt, opts).format();\n }\n\n formatDateTimeParts(dt, opts) {\n return this.dtFormatter(dt, opts).formatToParts();\n }\n\n formatInterval(interval, opts) {\n const df = this.dtFormatter(interval.start, opts);\n return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());\n }\n\n resolvedOptions(dt, opts) {\n return this.dtFormatter(dt, opts).resolvedOptions();\n }\n\n num(n, p = 0, signDisplay = undefined) {\n // we get some perf out of doing this here, annoyingly\n if (this.opts.forceSimple) {\n return padStart(n, p);\n }\n\n const opts = { ...this.opts };\n\n if (p > 0) {\n opts.padTo = p;\n }\n if (signDisplay) {\n opts.signDisplay = signDisplay;\n }\n\n return this.loc.numberFormatter(opts).format(n);\n }\n\n formatDateTimeFromString(dt, fmt) {\n const knownEnglish = this.loc.listingMode() === \"en\",\n useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== \"gregory\",\n string = (opts, extract) => this.loc.extract(dt, opts, extract),\n formatOffset = (opts) => {\n if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {\n return \"Z\";\n }\n\n return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : \"\";\n },\n meridiem = () =>\n knownEnglish\n ? English.meridiemForDateTime(dt)\n : string({ hour: \"numeric\", hourCycle: \"h12\" }, \"dayperiod\"),\n month = (length, standalone) =>\n knownEnglish\n ? English.monthForDateTime(dt, length)\n : string(standalone ? { month: length } : { month: length, day: \"numeric\" }, \"month\"),\n weekday = (length, standalone) =>\n knownEnglish\n ? English.weekdayForDateTime(dt, length)\n : string(\n standalone ? { weekday: length } : { weekday: length, month: \"long\", day: \"numeric\" },\n \"weekday\"\n ),\n maybeMacro = (token) => {\n const formatOpts = Formatter.macroTokenToFormatOpts(token);\n if (formatOpts) {\n return this.formatWithSystemDefault(dt, formatOpts);\n } else {\n return token;\n }\n },\n era = (length) =>\n knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, \"era\"),\n tokenToString = (token) => {\n // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols\n switch (token) {\n // ms\n case \"S\":\n return this.num(dt.millisecond);\n case \"u\":\n // falls through\n case \"SSS\":\n return this.num(dt.millisecond, 3);\n // seconds\n case \"s\":\n return this.num(dt.second);\n case \"ss\":\n return this.num(dt.second, 2);\n // fractional seconds\n case \"uu\":\n return this.num(Math.floor(dt.millisecond / 10), 2);\n case \"uuu\":\n return this.num(Math.floor(dt.millisecond / 100));\n // minutes\n case \"m\":\n return this.num(dt.minute);\n case \"mm\":\n return this.num(dt.minute, 2);\n // hours\n case \"h\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);\n case \"hh\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);\n case \"H\":\n return this.num(dt.hour);\n case \"HH\":\n return this.num(dt.hour, 2);\n // offset\n case \"Z\":\n // like +6\n return formatOffset({ format: \"narrow\", allowZ: this.opts.allowZ });\n case \"ZZ\":\n // like +06:00\n return formatOffset({ format: \"short\", allowZ: this.opts.allowZ });\n case \"ZZZ\":\n // like +0600\n return formatOffset({ format: \"techie\", allowZ: this.opts.allowZ });\n case \"ZZZZ\":\n // like EST\n return dt.zone.offsetName(dt.ts, { format: \"short\", locale: this.loc.locale });\n case \"ZZZZZ\":\n // like Eastern Standard Time\n return dt.zone.offsetName(dt.ts, { format: \"long\", locale: this.loc.locale });\n // zone\n case \"z\":\n // like America/New_York\n return dt.zoneName;\n // meridiems\n case \"a\":\n return meridiem();\n // dates\n case \"d\":\n return useDateTimeFormatter ? string({ day: \"numeric\" }, \"day\") : this.num(dt.day);\n case \"dd\":\n return useDateTimeFormatter ? string({ day: \"2-digit\" }, \"day\") : this.num(dt.day, 2);\n // weekdays - standalone\n case \"c\":\n // like 1\n return this.num(dt.weekday);\n case \"ccc\":\n // like 'Tues'\n return weekday(\"short\", true);\n case \"cccc\":\n // like 'Tuesday'\n return weekday(\"long\", true);\n case \"ccccc\":\n // like 'T'\n return weekday(\"narrow\", true);\n // weekdays - format\n case \"E\":\n // like 1\n return this.num(dt.weekday);\n case \"EEE\":\n // like 'Tues'\n return weekday(\"short\", false);\n case \"EEEE\":\n // like 'Tuesday'\n return weekday(\"long\", false);\n case \"EEEEE\":\n // like 'T'\n return weekday(\"narrow\", false);\n // months - standalone\n case \"L\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\", day: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"LL\":\n // like 01, doesn't seem to work\n return useDateTimeFormatter\n ? string({ month: \"2-digit\", day: \"numeric\" }, \"month\")\n : this.num(dt.month, 2);\n case \"LLL\":\n // like Jan\n return month(\"short\", true);\n case \"LLLL\":\n // like January\n return month(\"long\", true);\n case \"LLLLL\":\n // like J\n return month(\"narrow\", true);\n // months - format\n case \"M\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"MM\":\n // like 01\n return useDateTimeFormatter\n ? string({ month: \"2-digit\" }, \"month\")\n : this.num(dt.month, 2);\n case \"MMM\":\n // like Jan\n return month(\"short\", false);\n case \"MMMM\":\n // like January\n return month(\"long\", false);\n case \"MMMMM\":\n // like J\n return month(\"narrow\", false);\n // years\n case \"y\":\n // like 2014\n return useDateTimeFormatter ? string({ year: \"numeric\" }, \"year\") : this.num(dt.year);\n case \"yy\":\n // like 14\n return useDateTimeFormatter\n ? string({ year: \"2-digit\" }, \"year\")\n : this.num(dt.year.toString().slice(-2), 2);\n case \"yyyy\":\n // like 0012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 4);\n case \"yyyyyy\":\n // like 000012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 6);\n // eras\n case \"G\":\n // like AD\n return era(\"short\");\n case \"GG\":\n // like Anno Domini\n return era(\"long\");\n case \"GGGGG\":\n return era(\"narrow\");\n case \"kk\":\n return this.num(dt.weekYear.toString().slice(-2), 2);\n case \"kkkk\":\n return this.num(dt.weekYear, 4);\n case \"W\":\n return this.num(dt.weekNumber);\n case \"WW\":\n return this.num(dt.weekNumber, 2);\n case \"n\":\n return this.num(dt.localWeekNumber);\n case \"nn\":\n return this.num(dt.localWeekNumber, 2);\n case \"ii\":\n return this.num(dt.localWeekYear.toString().slice(-2), 2);\n case \"iiii\":\n return this.num(dt.localWeekYear, 4);\n case \"o\":\n return this.num(dt.ordinal);\n case \"ooo\":\n return this.num(dt.ordinal, 3);\n case \"q\":\n // like 1\n return this.num(dt.quarter);\n case \"qq\":\n // like 01\n return this.num(dt.quarter, 2);\n case \"X\":\n return this.num(Math.floor(dt.ts / 1000));\n case \"x\":\n return this.num(dt.ts);\n default:\n return maybeMacro(token);\n }\n };\n\n return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);\n }\n\n formatDurationFromString(dur, fmt) {\n const invertLargest = this.opts.signMode === \"negativeLargestOnly\" ? -1 : 1;\n const tokenToField = (token) => {\n switch (token[0]) {\n case \"S\":\n return \"milliseconds\";\n case \"s\":\n return \"seconds\";\n case \"m\":\n return \"minutes\";\n case \"h\":\n return \"hours\";\n case \"d\":\n return \"days\";\n case \"w\":\n return \"weeks\";\n case \"M\":\n return \"months\";\n case \"y\":\n return \"years\";\n default:\n return null;\n }\n },\n tokenToString = (lildur, info) => (token) => {\n const mapped = tokenToField(token);\n if (mapped) {\n const inversionFactor =\n info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;\n let signDisplay;\n if (this.opts.signMode === \"negativeLargestOnly\" && mapped !== info.largestUnit) {\n signDisplay = \"never\";\n } else if (this.opts.signMode === \"all\") {\n signDisplay = \"always\";\n } else {\n // \"auto\" and \"negative\" are the same, but \"auto\" has better support\n signDisplay = \"auto\";\n }\n return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);\n } else {\n return token;\n }\n },\n tokens = Formatter.parseFormat(fmt),\n realTokens = tokens.reduce(\n (found, { literal, val }) => (literal ? found : found.concat(val)),\n []\n ),\n collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t)),\n durationInfo = {\n isNegativeDuration: collapsed < 0,\n // this relies on \"collapsed\" being based on \"shiftTo\", which builds up the object\n // in order\n largestUnit: Object.keys(collapsed.values)[0],\n };\n return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));\n }\n}\n","import {\n untruncateYear,\n signedOffset,\n parseInteger,\n parseMillis,\n isUndefined,\n parseFloating,\n} from \"./util.js\";\nimport * as English from \"./english.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n/*\n * This file handles parsing for well-specified formats. Here's how it works:\n * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.\n * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object\n * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.\n * Extractors can take a \"cursor\" representing the offset in the match to look at. This makes it easy to combine extractors.\n * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.\n * Some extractions are super dumb and simpleParse and fromStrings help DRY them.\n */\n\nconst ianaRegex = /[A-Za-z_+-]{1,256}(?::?\\/[A-Za-z0-9_+-]{1,256}(?:\\/[A-Za-z0-9_+-]{1,256})?)?/;\n\nfunction combineRegexes(...regexes) {\n const full = regexes.reduce((f, r) => f + r.source, \"\");\n return RegExp(`^${full}$`);\n}\n\nfunction combineExtractors(...extractors) {\n return (m) =>\n extractors\n .reduce(\n ([mergedVals, mergedZone, cursor], ex) => {\n const [val, zone, next] = ex(m, cursor);\n return [{ ...mergedVals, ...val }, zone || mergedZone, next];\n },\n [{}, null, 1]\n )\n .slice(0, 2);\n}\n\nfunction parse(s, ...patterns) {\n if (s == null) {\n return [null, null];\n }\n\n for (const [regex, extractor] of patterns) {\n const m = regex.exec(s);\n if (m) {\n return extractor(m);\n }\n }\n return [null, null];\n}\n\nfunction simpleParse(...keys) {\n return (match, cursor) => {\n const ret = {};\n let i;\n\n for (i = 0; i < keys.length; i++) {\n ret[keys[i]] = parseInteger(match[cursor + i]);\n }\n return [ret, null, cursor + i];\n };\n}\n\n// ISO and SQL parsing\nconst offsetRegex = /(?:([Zz])|([+-]\\d\\d)(?::?(\\d\\d))?)/;\nconst isoExtendedZone = `(?:${offsetRegex.source}?(?:\\\\[(${ianaRegex.source})\\\\])?)?`;\nconst isoTimeBaseRegex = /(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:[.,](\\d{1,30}))?)?)?/;\nconst isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);\nconst isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);\nconst isoYmdRegex = /([+-]\\d{6}|\\d{4})(?:-?(\\d\\d)(?:-?(\\d\\d))?)?/;\nconst isoWeekRegex = /(\\d{4})-?W(\\d\\d)(?:-?(\\d))?/;\nconst isoOrdinalRegex = /(\\d{4})-?(\\d{3})/;\nconst extractISOWeekData = simpleParse(\"weekYear\", \"weekNumber\", \"weekDay\");\nconst extractISOOrdinalData = simpleParse(\"year\", \"ordinal\");\nconst sqlYmdRegex = /(\\d{4})-(\\d\\d)-(\\d\\d)/; // dumbed-down version of the ISO one\nconst sqlTimeRegex = RegExp(\n `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`\n);\nconst sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);\n\nfunction int(match, pos, fallback) {\n const m = match[pos];\n return isUndefined(m) ? fallback : parseInteger(m);\n}\n\nfunction extractISOYmd(match, cursor) {\n const item = {\n year: int(match, cursor),\n month: int(match, cursor + 1, 1),\n day: int(match, cursor + 2, 1),\n };\n\n return [item, null, cursor + 3];\n}\n\nfunction extractISOTime(match, cursor) {\n const item = {\n hours: int(match, cursor, 0),\n minutes: int(match, cursor + 1, 0),\n seconds: int(match, cursor + 2, 0),\n milliseconds: parseMillis(match[cursor + 3]),\n };\n\n return [item, null, cursor + 4];\n}\n\nfunction extractISOOffset(match, cursor) {\n const local = !match[cursor] && !match[cursor + 1],\n fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),\n zone = local ? null : FixedOffsetZone.instance(fullOffset);\n return [{}, zone, cursor + 3];\n}\n\nfunction extractIANAZone(match, cursor) {\n const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;\n return [{}, zone, cursor + 1];\n}\n\n// ISO time parsing\n\nconst isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);\n\n// ISO duration parsing\n\nconst isoDuration =\n /^-?P(?:(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)Y)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)M)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)W)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)D)?(?:T(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)H)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)M)?(?:(-?\\d{1,20})(?:[.,](-?\\d{1,20}))?S)?)?)$/;\n\nfunction extractISODuration(match) {\n const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] =\n match;\n\n const hasNegativePrefix = s[0] === \"-\";\n const negativeSeconds = secondStr && secondStr[0] === \"-\";\n\n const maybeNegate = (num, force = false) =>\n num !== undefined && (force || (num && hasNegativePrefix)) ? -num : num;\n\n return [\n {\n years: maybeNegate(parseFloating(yearStr)),\n months: maybeNegate(parseFloating(monthStr)),\n weeks: maybeNegate(parseFloating(weekStr)),\n days: maybeNegate(parseFloating(dayStr)),\n hours: maybeNegate(parseFloating(hourStr)),\n minutes: maybeNegate(parseFloating(minuteStr)),\n seconds: maybeNegate(parseFloating(secondStr), secondStr === \"-0\"),\n milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds),\n },\n ];\n}\n\n// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York\n// and not just that we're in -240 *right now*. But since I don't think these are used that often\n// I'm just going to ignore that\nconst obsOffsets = {\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n};\n\nfunction fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {\n const result = {\n year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),\n month: English.monthsShort.indexOf(monthStr) + 1,\n day: parseInteger(dayStr),\n hour: parseInteger(hourStr),\n minute: parseInteger(minuteStr),\n };\n\n if (secondStr) result.second = parseInteger(secondStr);\n if (weekdayStr) {\n result.weekday =\n weekdayStr.length > 3\n ? English.weekdaysLong.indexOf(weekdayStr) + 1\n : English.weekdaysShort.indexOf(weekdayStr) + 1;\n }\n\n return result;\n}\n\n// RFC 2822/5322\nconst rfc2822 =\n /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\\d\\d)(\\d\\d)))$/;\n\nfunction extractRFC2822(match) {\n const [\n ,\n weekdayStr,\n dayStr,\n monthStr,\n yearStr,\n hourStr,\n minuteStr,\n secondStr,\n obsOffset,\n milOffset,\n offHourStr,\n offMinuteStr,\n ] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n\n let offset;\n if (obsOffset) {\n offset = obsOffsets[obsOffset];\n } else if (milOffset) {\n offset = 0;\n } else {\n offset = signedOffset(offHourStr, offMinuteStr);\n }\n\n return [result, new FixedOffsetZone(offset)];\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^()]*\\)|[\\n\\t]/g, \" \")\n .replace(/(\\s\\s+)/g, \" \")\n .trim();\n}\n\n// http date\n\nconst rfc1123 =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d\\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\\d{4}) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n rfc850 =\n /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\\d\\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n ascii =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \\d|\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) (\\d{4})$/;\n\nfunction extractRFC1123Or850(match) {\n const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nfunction extractASCII(match) {\n const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nconst isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);\nconst isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);\nconst isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);\nconst isoTimeCombinedRegex = combineRegexes(isoTimeRegex);\n\nconst extractISOYmdTimeAndOffset = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOWeekTimeAndOffset = combineExtractors(\n extractISOWeekData,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOOrdinalDateAndTime = combineExtractors(\n extractISOOrdinalData,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOTimeAndOffset = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\n/*\n * @private\n */\n\nexport function parseISODate(s) {\n return parse(\n s,\n [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],\n [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime],\n [isoTimeCombinedRegex, extractISOTimeAndOffset]\n );\n}\n\nexport function parseRFC2822Date(s) {\n return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);\n}\n\nexport function parseHTTPDate(s) {\n return parse(\n s,\n [rfc1123, extractRFC1123Or850],\n [rfc850, extractRFC1123Or850],\n [ascii, extractASCII]\n );\n}\n\nexport function parseISODuration(s) {\n return parse(s, [isoDuration, extractISODuration]);\n}\n\nconst extractISOTimeOnly = combineExtractors(extractISOTime);\n\nexport function parseISOTimeOnly(s) {\n return parse(s, [isoTimeOnly, extractISOTimeOnly]);\n}\n\nconst sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);\nconst sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);\n\nconst extractISOTimeOffsetAndIANAZone = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\nexport function parseSQL(s) {\n return parse(\n s,\n [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]\n );\n}\n","import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from \"./errors.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Locale from \"./impl/locale.js\";\nimport { parseISODuration, parseISOTimeOnly } from \"./impl/regexParser.js\";\nimport {\n asNumber,\n hasOwnProperty,\n isNumber,\n isUndefined,\n normalizeObject,\n roundTo,\n} from \"./impl/util.js\";\nimport Settings from \"./settings.js\";\nimport DateTime from \"./datetime.js\";\n\nconst INVALID = \"Invalid Duration\";\n\n// unit conversion constants\nexport const lowOrderMatrix = {\n weeks: {\n days: 7,\n hours: 7 * 24,\n minutes: 7 * 24 * 60,\n seconds: 7 * 24 * 60 * 60,\n milliseconds: 7 * 24 * 60 * 60 * 1000,\n },\n days: {\n hours: 24,\n minutes: 24 * 60,\n seconds: 24 * 60 * 60,\n milliseconds: 24 * 60 * 60 * 1000,\n },\n hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },\n minutes: { seconds: 60, milliseconds: 60 * 1000 },\n seconds: { milliseconds: 1000 },\n },\n casualMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: 52,\n days: 365,\n hours: 365 * 24,\n minutes: 365 * 24 * 60,\n seconds: 365 * 24 * 60 * 60,\n milliseconds: 365 * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: 13,\n days: 91,\n hours: 91 * 24,\n minutes: 91 * 24 * 60,\n seconds: 91 * 24 * 60 * 60,\n milliseconds: 91 * 24 * 60 * 60 * 1000,\n },\n months: {\n weeks: 4,\n days: 30,\n hours: 30 * 24,\n minutes: 30 * 24 * 60,\n seconds: 30 * 24 * 60 * 60,\n milliseconds: 30 * 24 * 60 * 60 * 1000,\n },\n\n ...lowOrderMatrix,\n },\n daysInYearAccurate = 146097.0 / 400,\n daysInMonthAccurate = 146097.0 / 4800,\n accurateMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: daysInYearAccurate / 7,\n days: daysInYearAccurate,\n hours: daysInYearAccurate * 24,\n minutes: daysInYearAccurate * 24 * 60,\n seconds: daysInYearAccurate * 24 * 60 * 60,\n milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: daysInYearAccurate / 28,\n days: daysInYearAccurate / 4,\n hours: (daysInYearAccurate * 24) / 4,\n minutes: (daysInYearAccurate * 24 * 60) / 4,\n seconds: (daysInYearAccurate * 24 * 60 * 60) / 4,\n milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4,\n },\n months: {\n weeks: daysInMonthAccurate / 7,\n days: daysInMonthAccurate,\n hours: daysInMonthAccurate * 24,\n minutes: daysInMonthAccurate * 24 * 60,\n seconds: daysInMonthAccurate * 24 * 60 * 60,\n milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000,\n },\n ...lowOrderMatrix,\n };\n\n// units ordered by size\nconst orderedUnits = [\n \"years\",\n \"quarters\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\",\n];\n\nconst reverseUnits = orderedUnits.slice(0).reverse();\n\n// clone really means \"create another instance just like this one, but with these changes\"\nfunction clone(dur, alts, clear = false) {\n // deep merge for vals\n const conf = {\n values: clear ? alts.values : { ...dur.values, ...(alts.values || {}) },\n loc: dur.loc.clone(alts.loc),\n conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,\n matrix: alts.matrix || dur.matrix,\n };\n return new Duration(conf);\n}\n\nfunction durationToMillis(matrix, vals) {\n let sum = vals.milliseconds ?? 0;\n for (const unit of reverseUnits.slice(1)) {\n if (vals[unit]) {\n sum += vals[unit] * matrix[unit][\"milliseconds\"];\n }\n }\n return sum;\n}\n\n// NB: mutates parameters\nfunction normalizeValues(matrix, vals) {\n // the logic below assumes the overall value of the duration is positive\n // if this is not the case, factor is used to make it so\n const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;\n\n orderedUnits.reduceRight((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n const previousVal = vals[previous] * factor;\n const conv = matrix[current][previous];\n\n // if (previousVal < 0):\n // lower order unit is negative (e.g. { years: 2, days: -2 })\n // normalize this by reducing the higher order unit by the appropriate amount\n // and increasing the lower order unit\n // this can never make the higher order unit negative, because this function only operates\n // on positive durations, so the amount of time represented by the lower order unit cannot\n // be larger than the higher order unit\n // else:\n // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 })\n // in this case we attempt to convert as much as possible from the lower order unit into\n // the higher order one\n //\n // Math.floor takes care of both of these cases, rounding away from 0\n // if previousVal < 0 it makes the absolute value larger\n // if previousVal >= it makes the absolute value smaller\n const rollUp = Math.floor(previousVal / conv);\n vals[current] += rollUp * factor;\n vals[previous] -= rollUp * conv * factor;\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n\n // try to convert any decimals into smaller units if possible\n // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 }\n orderedUnits.reduce((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n const fraction = vals[previous] % 1;\n vals[previous] -= fraction;\n vals[current] += fraction * matrix[previous][current];\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n}\n\n// Remove all properties with a value of 0 from an object\nfunction removeZeroes(vals) {\n const newVals = {};\n for (const [key, value] of Object.entries(vals)) {\n if (value !== 0) {\n newVals[key] = value;\n }\n }\n return newVals;\n}\n\n/**\n * A Duration object represents a period of time, like \"2 months\" or \"1 day, 1 hour\". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime#plus} to add a Duration object to a DateTime, producing another DateTime.\n *\n * Here is a brief overview of commonly used methods and getters in Duration:\n *\n * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.\n * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors.\n * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors.\n * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}.\n * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON}\n *\n * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.\n */\nexport default class Duration {\n /**\n * @private\n */\n constructor(config) {\n const accurate = config.conversionAccuracy === \"longterm\" || false;\n let matrix = accurate ? accurateMatrix : casualMatrix;\n\n if (config.matrix) {\n matrix = config.matrix;\n }\n\n /**\n * @access private\n */\n this.values = config.values;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.conversionAccuracy = accurate ? \"longterm\" : \"casual\";\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.matrix = matrix;\n /**\n * @access private\n */\n this.isLuxonDuration = true;\n }\n\n /**\n * Create Duration from a number of milliseconds.\n * @param {number} count of milliseconds\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromMillis(count, opts) {\n return Duration.fromObject({ milliseconds: count }, opts);\n }\n\n /**\n * Create a Duration from a JavaScript object with keys like 'years' and 'hours'.\n * If this object is empty then a zero milliseconds duration is returned.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.years\n * @param {number} obj.quarters\n * @param {number} obj.months\n * @param {number} obj.weeks\n * @param {number} obj.days\n * @param {number} obj.hours\n * @param {number} obj.minutes\n * @param {number} obj.seconds\n * @param {number} obj.milliseconds\n * @param {Object} [opts=[]] - options for creating this Duration\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the custom conversion system to use\n * @return {Duration}\n */\n static fromObject(obj, opts = {}) {\n if (obj == null || typeof obj !== \"object\") {\n throw new InvalidArgumentError(\n `Duration.fromObject: argument expected to be an object, got ${\n obj === null ? \"null\" : typeof obj\n }`\n );\n }\n\n return new Duration({\n values: normalizeObject(obj, Duration.normalizeUnit),\n loc: Locale.fromObject(opts),\n conversionAccuracy: opts.conversionAccuracy,\n matrix: opts.matrix,\n });\n }\n\n /**\n * Create a Duration from DurationLike.\n *\n * @param {Object | number | Duration} durationLike\n * One of:\n * - object with keys like 'years' and 'hours'.\n * - number representing milliseconds\n * - Duration instance\n * @return {Duration}\n */\n static fromDurationLike(durationLike) {\n if (isNumber(durationLike)) {\n return Duration.fromMillis(durationLike);\n } else if (Duration.isDuration(durationLike)) {\n return durationLike;\n } else if (typeof durationLike === \"object\") {\n return Duration.fromObject(durationLike);\n } else {\n throw new InvalidArgumentError(\n `Unknown duration argument ${durationLike} of type ${typeof durationLike}`\n );\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 duration string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the preset conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }\n * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }\n * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }\n * @return {Duration}\n */\n static fromISO(text, opts) {\n const [parsed] = parseISODuration(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 time string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 }\n * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @return {Duration}\n */\n static fromISOTime(text, opts) {\n const [parsed] = parseISOTimeOnly(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create an invalid Duration.\n * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Duration}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Duration is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDurationError(invalid);\n } else {\n return new Duration({ invalid });\n }\n }\n\n /**\n * @private\n */\n static normalizeUnit(unit) {\n const normalized = {\n year: \"years\",\n years: \"years\",\n quarter: \"quarters\",\n quarters: \"quarters\",\n month: \"months\",\n months: \"months\",\n week: \"weeks\",\n weeks: \"weeks\",\n day: \"days\",\n days: \"days\",\n hour: \"hours\",\n hours: \"hours\",\n minute: \"minutes\",\n minutes: \"minutes\",\n second: \"seconds\",\n seconds: \"seconds\",\n millisecond: \"milliseconds\",\n milliseconds: \"milliseconds\",\n }[unit ? unit.toLowerCase() : unit];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n }\n\n /**\n * Check if an object is a Duration. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDuration(o) {\n return (o && o.isLuxonDuration) || false;\n }\n\n /**\n * Get the locale of a Duration, such 'en-GB'\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:\n * * `S` for milliseconds\n * * `s` for seconds\n * * `m` for minutes\n * * `h` for hours\n * * `d` for days\n * * `w` for weeks\n * * `M` for months\n * * `y` for years\n * Notes:\n * * Add padding by repeating the token, e.g. \"yy\" pads the years to two digits, \"hhhh\" pads the hours out to four digits\n * * Tokens can be escaped by wrapping with single quotes.\n * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting.\n * @param {string} fmt - the format string\n * @param {Object} opts - options\n * @param {boolean} [opts.floor=true] - floor numerical values\n * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"y d s\") //=> \"1 6 2\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"yy dd sss\") //=> \"01 06 002\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"M S\") //=> \"12 518402000\"\n * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat(\"d s\", { signMode: \"all\" }) //=> \"+6 +2\"\n * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat(\"d s\", { signMode: \"all\" }) //=> \"-6 -2\"\n * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat(\"d s\", { signMode: \"negativeLargestOnly\" }) //=> \"-6 2\"\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n // reverse-compat since 1.2; we always round down now, never up, and we do it by default\n const fmtOpts = {\n ...opts,\n floor: opts.round !== false && opts.floor !== false,\n };\n return this.isValid\n ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a string representation of a Duration with all units included.\n * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options\n * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.\n * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.\n * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero\n * @example\n * ```js\n * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 })\n * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes'\n * dur.toHuman({ listStyle: \"long\" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes'\n * dur.toHuman({ unitDisplay: \"short\" }) //=> '1 mth, 0 wks, 5 hr, 6 min'\n * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes'\n * ```\n */\n toHuman(opts = {}) {\n if (!this.isValid) return INVALID;\n\n const showZeros = opts.showZeros !== false;\n\n const l = orderedUnits\n .map((unit) => {\n const val = this.values[unit];\n if (isUndefined(val) || (val === 0 && !showZeros)) {\n return null;\n }\n return this.loc\n .numberFormatter({ style: \"unit\", unitDisplay: \"long\", ...opts, unit: unit.slice(0, -1) })\n .format(val);\n })\n .filter((n) => n);\n\n return this.loc\n .listFormatter({ type: \"conjunction\", style: opts.listStyle || \"narrow\", ...opts })\n .format(l);\n }\n\n /**\n * Returns a JavaScript object with this Duration's values.\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }\n * @return {Object}\n */\n toObject() {\n if (!this.isValid) return {};\n return { ...this.values };\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'\n * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'\n * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'\n * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'\n * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'\n * @return {string}\n */\n toISO() {\n // we could use the formatter, but this is an easier way to get the minimum string\n if (!this.isValid) return null;\n\n let s = \"P\";\n if (this.years !== 0) s += this.years + \"Y\";\n if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + \"M\";\n if (this.weeks !== 0) s += this.weeks + \"W\";\n if (this.days !== 0) s += this.days + \"D\";\n if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)\n s += \"T\";\n if (this.hours !== 0) s += this.hours + \"H\";\n if (this.minutes !== 0) s += this.minutes + \"M\";\n if (this.seconds !== 0 || this.milliseconds !== 0)\n // this will handle \"floating point madness\" by removing extra decimal places\n // https://stackoverflow.com/questions/588004/is-floating-point-math-broken\n s += roundTo(this.seconds + this.milliseconds / 1000, 3) + \"S\";\n if (s === \"P\") s += \"T0S\";\n return s;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day.\n * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000'\n * @return {string}\n */\n toISOTime(opts = {}) {\n if (!this.isValid) return null;\n\n const millis = this.toMillis();\n if (millis < 0 || millis >= 86400000) return null;\n\n opts = {\n suppressMilliseconds: false,\n suppressSeconds: false,\n includePrefix: false,\n format: \"extended\",\n ...opts,\n includeOffset: false,\n };\n\n const dateTime = DateTime.fromMillis(millis, { zone: \"UTC\" });\n return dateTime.toISOTime(opts);\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in debugging.\n * @return {string}\n */\n toString() {\n return this.toISO();\n }\n\n /**\n * Returns a string representation of this Duration appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `Duration { values: ${JSON.stringify(this.values)} }`;\n } else {\n return `Duration { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns an milliseconds value of this Duration.\n * @return {number}\n */\n toMillis() {\n if (!this.isValid) return NaN;\n\n return durationToMillis(this.matrix, this.values);\n }\n\n /**\n * Returns an milliseconds value of this Duration. Alias of {@link toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Make this Duration longer by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n plus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration),\n result = {};\n\n for (const k of orderedUnits) {\n if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {\n result[k] = dur.get(k) + this.get(k);\n }\n }\n\n return clone(this, { values: result }, true);\n }\n\n /**\n * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n minus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration);\n return this.plus(dur.negate());\n }\n\n /**\n * Scale this Duration by the specified amount. Return a newly-constructed Duration.\n * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 }\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === \"hours\" ? x * 2 : x) //=> { hours: 2, minutes: 30 }\n * @return {Duration}\n */\n mapUnits(fn) {\n if (!this.isValid) return this;\n const result = {};\n for (const k of Object.keys(this.values)) {\n result[k] = asNumber(fn(this.values[k], k));\n }\n return clone(this, { values: result }, true);\n }\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2\n * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0\n * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3\n * @return {number}\n */\n get(unit) {\n return this[Duration.normalizeUnit(unit)];\n }\n\n /**\n * \"Set\" the values of specified units. Return a newly-constructed Duration.\n * @param {Object} values - a mapping of units to numbers\n * @example dur.set({ years: 2017 })\n * @example dur.set({ hours: 8, minutes: 30 })\n * @return {Duration}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const mixed = { ...this.values, ...normalizeObject(values, Duration.normalizeUnit) };\n return clone(this, { values: mixed });\n }\n\n /**\n * \"Set\" the locale and/or numberingSystem. Returns a newly-constructed Duration.\n * @example dur.reconfigure({ locale: 'en-GB' })\n * @return {Duration}\n */\n reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem });\n const opts = { loc, matrix, conversionAccuracy };\n return clone(this, opts);\n }\n\n /**\n * Return the length of the duration in the specified unit.\n * @param {string} unit - a unit such as 'minutes' or 'days'\n * @example Duration.fromObject({years: 1}).as('days') //=> 365\n * @example Duration.fromObject({years: 1}).as('months') //=> 12\n * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5\n * @return {number}\n */\n as(unit) {\n return this.isValid ? this.shiftTo(unit).get(unit) : NaN;\n }\n\n /**\n * Reduce this Duration to its canonical representation in its current units.\n * Assuming the overall value of the Duration is positive, this means:\n * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)\n * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise\n * the overall value would be negative, see third example)\n * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)\n *\n * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.\n * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }\n * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 }\n * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }\n * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 }\n * @return {Duration}\n */\n normalize() {\n if (!this.isValid) return this;\n const vals = this.toObject();\n normalizeValues(this.matrix, vals);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Rescale units to its largest representation\n * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 }\n * @return {Duration}\n */\n rescale() {\n if (!this.isValid) return this;\n const vals = removeZeroes(this.normalize().shiftToAll().toObject());\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Convert this Duration into its representation in a different set of units.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }\n * @return {Duration}\n */\n shiftTo(...units) {\n if (!this.isValid) return this;\n\n if (units.length === 0) {\n return this;\n }\n\n units = units.map((u) => Duration.normalizeUnit(u));\n\n const built = {},\n accumulated = {},\n vals = this.toObject();\n let lastUnit;\n\n for (const k of orderedUnits) {\n if (units.indexOf(k) >= 0) {\n lastUnit = k;\n\n let own = 0;\n\n // anything we haven't boiled down yet should get boiled to this unit\n for (const ak in accumulated) {\n own += this.matrix[ak][k] * accumulated[ak];\n accumulated[ak] = 0;\n }\n\n // plus anything that's already in this unit\n if (isNumber(vals[k])) {\n own += vals[k];\n }\n\n // only keep the integer part for now in the hopes of putting any decimal part\n // into a smaller unit later\n const i = Math.trunc(own);\n built[k] = i;\n accumulated[k] = (own * 1000 - i * 1000) / 1000;\n\n // otherwise, keep it in the wings to boil it later\n } else if (isNumber(vals[k])) {\n accumulated[k] = vals[k];\n }\n }\n\n // anything leftover becomes the decimal for the last unit\n // lastUnit must be defined since units is not empty\n for (const key in accumulated) {\n if (accumulated[key] !== 0) {\n built[lastUnit] +=\n key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];\n }\n }\n\n normalizeValues(this.matrix, built);\n return clone(this, { values: built }, true);\n }\n\n /**\n * Shift this Duration to all available units.\n * Same as shiftTo(\"years\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", \"seconds\", \"milliseconds\")\n * @return {Duration}\n */\n shiftToAll() {\n if (!this.isValid) return this;\n return this.shiftTo(\n \"years\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\"\n );\n }\n\n /**\n * Return the negative of this Duration.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }\n * @return {Duration}\n */\n negate() {\n if (!this.isValid) return this;\n const negated = {};\n for (const k of Object.keys(this.values)) {\n negated[k] = this.values[k] === 0 ? 0 : -this.values[k];\n }\n return clone(this, { values: negated }, true);\n }\n\n /**\n * Removes all units with values equal to 0 from this Duration.\n * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 }\n * @return {Duration}\n */\n removeZeros() {\n if (!this.isValid) return this;\n const vals = removeZeroes(this.values);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Get the years.\n * @type {number}\n */\n get years() {\n return this.isValid ? this.values.years || 0 : NaN;\n }\n\n /**\n * Get the quarters.\n * @type {number}\n */\n get quarters() {\n return this.isValid ? this.values.quarters || 0 : NaN;\n }\n\n /**\n * Get the months.\n * @type {number}\n */\n get months() {\n return this.isValid ? this.values.months || 0 : NaN;\n }\n\n /**\n * Get the weeks\n * @type {number}\n */\n get weeks() {\n return this.isValid ? this.values.weeks || 0 : NaN;\n }\n\n /**\n * Get the days.\n * @type {number}\n */\n get days() {\n return this.isValid ? this.values.days || 0 : NaN;\n }\n\n /**\n * Get the hours.\n * @type {number}\n */\n get hours() {\n return this.isValid ? this.values.hours || 0 : NaN;\n }\n\n /**\n * Get the minutes.\n * @type {number}\n */\n get minutes() {\n return this.isValid ? this.values.minutes || 0 : NaN;\n }\n\n /**\n * Get the seconds.\n * @return {number}\n */\n get seconds() {\n return this.isValid ? this.values.seconds || 0 : NaN;\n }\n\n /**\n * Get the milliseconds.\n * @return {number}\n */\n get milliseconds() {\n return this.isValid ? this.values.milliseconds || 0 : NaN;\n }\n\n /**\n * Returns whether the Duration is invalid. Invalid durations are returned by diff operations\n * on invalid DateTimes or Intervals.\n * @return {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this Duration became invalid, or null if the Duration is valid\n * @return {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Duration became invalid, or null if the Duration is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Equality check\n * Two Durations are equal iff they have the same units and the same values for each unit.\n * @param {Duration} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n if (!this.loc.equals(other.loc)) {\n return false;\n }\n\n function eq(v1, v2) {\n // Consider 0 and undefined as equal\n if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0;\n return v1 === v2;\n }\n\n for (const u of orderedUnits) {\n if (!eq(this.values[u], other.values[u])) {\n return false;\n }\n }\n return true;\n }\n}\n","import DateTime, { friendlyDateTime } from \"./datetime.js\";\nimport Duration from \"./duration.js\";\nimport Settings from \"./settings.js\";\nimport { InvalidArgumentError, InvalidIntervalError } from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport * as Formats from \"./impl/formats.js\";\n\nconst INVALID = \"Invalid Interval\";\n\n// checks if the start is equal to or before the end\nfunction validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\n \"end before start\",\n `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`\n );\n } else {\n return null;\n }\n}\n\n/**\n * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.\n *\n * Here is a brief overview of the most commonly used methods and getters in Interval:\n *\n * * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}.\n * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end.\n * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}.\n * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}.\n * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}\n * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}.\n */\nexport default class Interval {\n /**\n * @private\n */\n constructor(config) {\n /**\n * @access private\n */\n this.s = config.start;\n /**\n * @access private\n */\n this.e = config.end;\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.isLuxonInterval = true;\n }\n\n /**\n * Create an invalid Interval.\n * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Interval}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Interval is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidIntervalError(invalid);\n } else {\n return new Interval({ invalid });\n }\n }\n\n /**\n * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.\n * @param {DateTime|Date|Object} start\n * @param {DateTime|Date|Object} end\n * @return {Interval}\n */\n static fromDateTimes(start, end) {\n const builtStart = friendlyDateTime(start),\n builtEnd = friendlyDateTime(end);\n\n const validateError = validateStartEnd(builtStart, builtEnd);\n\n if (validateError == null) {\n return new Interval({\n start: builtStart,\n end: builtEnd,\n });\n } else {\n return validateError;\n }\n }\n\n /**\n * Create an Interval from a start DateTime and a Duration to extend to.\n * @param {DateTime|Date|Object} start\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static after(start, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(start);\n return Interval.fromDateTimes(dt, dt.plus(dur));\n }\n\n /**\n * Create an Interval from an end DateTime and a Duration to extend backwards to.\n * @param {DateTime|Date|Object} end\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static before(end, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(end);\n return Interval.fromDateTimes(dt.minus(dur), dt);\n }\n\n /**\n * Create an Interval from an ISO 8601 string.\n * Accepts `/`, `/`, and `/` formats.\n * @param {string} text - the ISO string to parse\n * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO}\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {Interval}\n */\n static fromISO(text, opts) {\n const [s, e] = (text || \"\").split(\"/\", 2);\n if (s && e) {\n let start, startIsValid;\n try {\n start = DateTime.fromISO(s, opts);\n startIsValid = start.isValid;\n } catch (e) {\n startIsValid = false;\n }\n\n let end, endIsValid;\n try {\n end = DateTime.fromISO(e, opts);\n endIsValid = end.isValid;\n } catch (e) {\n endIsValid = false;\n }\n\n if (startIsValid && endIsValid) {\n return Interval.fromDateTimes(start, end);\n }\n\n if (startIsValid) {\n const dur = Duration.fromISO(e, opts);\n if (dur.isValid) {\n return Interval.after(start, dur);\n }\n } else if (endIsValid) {\n const dur = Duration.fromISO(s, opts);\n if (dur.isValid) {\n return Interval.before(end, dur);\n }\n }\n }\n return Interval.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n\n /**\n * Check if an object is an Interval. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isInterval(o) {\n return (o && o.isLuxonInterval) || false;\n }\n\n /**\n * Returns the start of the Interval\n * @type {DateTime}\n */\n get start() {\n return this.isValid ? this.s : null;\n }\n\n /**\n * Returns the end of the Interval. This is the first instant which is not part of the interval\n * (Interval is half-open).\n * @type {DateTime}\n */\n get end() {\n return this.isValid ? this.e : null;\n }\n\n /**\n * Returns the last DateTime included in the interval (since end is not part of the interval)\n * @type {DateTime}\n */\n get lastDateTime() {\n return this.isValid ? (this.e ? this.e.minus(1) : null) : null;\n }\n\n /**\n * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.\n * @type {boolean}\n */\n get isValid() {\n return this.invalidReason === null;\n }\n\n /**\n * Returns an error code if this Interval is invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Interval became invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Returns the length of the Interval in the specified unit.\n * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.\n * @return {number}\n */\n length(unit = \"milliseconds\") {\n return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;\n }\n\n /**\n * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.\n * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'\n * asks 'what dates are included in this interval?', not 'how many days long is this interval?'\n * @param {string} [unit='milliseconds'] - the unit of time to count.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime\n * @return {number}\n */\n count(unit = \"milliseconds\", opts) {\n if (!this.isValid) return NaN;\n const start = this.start.startOf(unit, opts);\n let end;\n if (opts?.useLocaleWeeks) {\n end = this.end.reconfigure({ locale: start.locale });\n } else {\n end = this.end;\n }\n end = end.startOf(unit, opts);\n return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());\n }\n\n /**\n * Returns whether this Interval's start and end are both in the same unit of time\n * @param {string} unit - the unit of time to check sameness on\n * @return {boolean}\n */\n hasSame(unit) {\n return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;\n }\n\n /**\n * Return whether this Interval has the same start and end DateTimes.\n * @return {boolean}\n */\n isEmpty() {\n return this.s.valueOf() === this.e.valueOf();\n }\n\n /**\n * Return whether this Interval's start is after the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isAfter(dateTime) {\n if (!this.isValid) return false;\n return this.s > dateTime;\n }\n\n /**\n * Return whether this Interval's end is before the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isBefore(dateTime) {\n if (!this.isValid) return false;\n return this.e <= dateTime;\n }\n\n /**\n * Return whether this Interval contains the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n contains(dateTime) {\n if (!this.isValid) return false;\n return this.s <= dateTime && this.e > dateTime;\n }\n\n /**\n * \"Sets\" the start and/or end dates. Returns a newly-constructed Interval.\n * @param {Object} values - the values to set\n * @param {DateTime} values.start - the starting DateTime\n * @param {DateTime} values.end - the ending DateTime\n * @return {Interval}\n */\n set({ start, end } = {}) {\n if (!this.isValid) return this;\n return Interval.fromDateTimes(start || this.s, end || this.e);\n }\n\n /**\n * Split this Interval at each of the specified DateTimes\n * @param {...DateTime} dateTimes - the unit of time to count.\n * @return {Array}\n */\n splitAt(...dateTimes) {\n if (!this.isValid) return [];\n const sorted = dateTimes\n .map(friendlyDateTime)\n .filter((d) => this.contains(d))\n .sort((a, b) => a.toMillis() - b.toMillis()),\n results = [];\n let { s } = this,\n i = 0;\n\n while (s < this.e) {\n const added = sorted[i] || this.e,\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n i += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into smaller Intervals, each of the specified length.\n * Left over time is grouped into a smaller interval\n * @param {Duration|Object|number} duration - The length of each resulting interval.\n * @return {Array}\n */\n splitBy(duration) {\n const dur = Duration.fromDurationLike(duration);\n\n if (!this.isValid || !dur.isValid || dur.as(\"milliseconds\") === 0) {\n return [];\n }\n\n let { s } = this,\n idx = 1,\n next;\n\n const results = [];\n while (s < this.e) {\n const added = this.start.plus(dur.mapUnits((x) => x * idx));\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n idx += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into the specified number of smaller intervals.\n * @param {number} numberOfParts - The number of Intervals to divide the Interval into.\n * @return {Array}\n */\n divideEqually(numberOfParts) {\n if (!this.isValid) return [];\n return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);\n }\n\n /**\n * Return whether this Interval overlaps with the specified Interval\n * @param {Interval} other\n * @return {boolean}\n */\n overlaps(other) {\n return this.e > other.s && this.s < other.e;\n }\n\n /**\n * Return whether this Interval's end is adjacent to the specified Interval's start.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsStart(other) {\n if (!this.isValid) return false;\n return +this.e === +other.s;\n }\n\n /**\n * Return whether this Interval's start is adjacent to the specified Interval's end.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsEnd(other) {\n if (!this.isValid) return false;\n return +other.e === +this.s;\n }\n\n /**\n * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise.\n * @param {Interval} other\n * @return {boolean}\n */\n engulfs(other) {\n if (!this.isValid) return false;\n return this.s <= other.s && this.e >= other.e;\n }\n\n /**\n * Return whether this Interval has the same start and end as the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n return this.s.equals(other.s) && this.e.equals(other.e);\n }\n\n /**\n * Return an Interval representing the intersection of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.\n * Returns null if the intersection is empty, meaning, the intervals don't intersect.\n * @param {Interval} other\n * @return {Interval}\n */\n intersection(other) {\n if (!this.isValid) return this;\n const s = this.s > other.s ? this.s : other.s,\n e = this.e < other.e ? this.e : other.e;\n\n if (s >= e) {\n return null;\n } else {\n return Interval.fromDateTimes(s, e);\n }\n }\n\n /**\n * Return an Interval representing the union of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.\n * @param {Interval} other\n * @return {Interval}\n */\n union(other) {\n if (!this.isValid) return this;\n const s = this.s < other.s ? this.s : other.s,\n e = this.e > other.e ? this.e : other.e;\n return Interval.fromDateTimes(s, e);\n }\n\n /**\n * Merge an array of Intervals into an equivalent minimal set of Intervals.\n * Combines overlapping and adjacent Intervals.\n * The resulting array will contain the Intervals in ascending order, that is, starting with the earliest Interval\n * and ending with the latest.\n *\n * @param {Array} intervals\n * @return {Array}\n */\n static merge(intervals) {\n const [found, final] = intervals\n .sort((a, b) => a.s - b.s)\n .reduce(\n ([sofar, current], item) => {\n if (!current) {\n return [sofar, item];\n } else if (current.overlaps(item) || current.abutsStart(item)) {\n return [sofar, current.union(item)];\n } else {\n return [sofar.concat([current]), item];\n }\n },\n [[], null]\n );\n if (final) {\n found.push(final);\n }\n return found;\n }\n\n /**\n * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.\n * @param {Array} intervals\n * @return {Array}\n */\n static xor(intervals) {\n let start = null,\n currentCount = 0;\n const results = [],\n ends = intervals.map((i) => [\n { time: i.s, type: \"s\" },\n { time: i.e, type: \"e\" },\n ]),\n flattened = Array.prototype.concat(...ends),\n arr = flattened.sort((a, b) => a.time - b.time);\n\n for (const i of arr) {\n currentCount += i.type === \"s\" ? 1 : -1;\n\n if (currentCount === 1) {\n start = i.time;\n } else {\n if (start && +start !== +i.time) {\n results.push(Interval.fromDateTimes(start, i.time));\n }\n\n start = null;\n }\n }\n\n return Interval.merge(results);\n }\n\n /**\n * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.\n * @param {...Interval} intervals\n * @return {Array}\n */\n difference(...intervals) {\n return Interval.xor([this].concat(intervals))\n .map((i) => this.intersection(i))\n .filter((i) => i && !i.isEmpty());\n }\n\n /**\n * Returns a string representation of this Interval appropriate for debugging.\n * @return {string}\n */\n toString() {\n if (!this.isValid) return INVALID;\n return `[${this.s.toISO()} – ${this.e.toISO()})`;\n }\n\n /**\n * Returns a string representation of this Interval appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;\n } else {\n return `Interval { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns a localized string representing this Interval. Accepts the same options as the\n * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as\n * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method\n * is browser-specific, but in general it will return an appropriate representation of the\n * Interval in the assigned locale. Defaults to the system's locale if no locale has been\n * specified.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or\n * Intl.DateTimeFormat constructor options.\n * @param {Object} opts - Options to override the configuration of the start DateTime.\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022\n * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM\n * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p\n * @return {string}\n */\n toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) {\n return this.isValid\n ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this)\n : INVALID;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Interval.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISO(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of date of this Interval.\n * The time components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {string}\n */\n toISODate() {\n if (!this.isValid) return INVALID;\n return `${this.s.toISODate()}/${this.e.toISODate()}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of time of this Interval.\n * The date components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISOTime(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this Interval formatted according to the specified format\n * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible\n * formatting tool.\n * @param {string} dateFormat - The format string. This string formats the start and end time.\n * See {@link DateTime#toFormat} for details.\n * @param {Object} opts - Options.\n * @param {string} [opts.separator = ' – '] - A separator to place between the start and end\n * representations.\n * @return {string}\n */\n toFormat(dateFormat, { separator = \" – \" } = {}) {\n if (!this.isValid) return INVALID;\n return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;\n }\n\n /**\n * Return a Duration representing the time spanned by this interval.\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }\n * @return {Duration}\n */\n toDuration(unit, opts) {\n if (!this.isValid) {\n return Duration.invalid(this.invalidReason);\n }\n return this.e.diff(this.s, unit, opts);\n }\n\n /**\n * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes\n * @param {function} mapFn\n * @return {Interval}\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))\n */\n mapEndpoints(mapFn) {\n return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Settings from \"./settings.js\";\nimport Locale from \"./impl/locale.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nimport { hasLocaleWeekInfo, hasRelative } from \"./impl/util.js\";\n\n/**\n * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.\n */\nexport default class Info {\n /**\n * Return whether the specified zone contains a DST.\n * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.\n * @return {boolean}\n */\n static hasDST(zone = Settings.defaultZone) {\n const proto = DateTime.now().setZone(zone).set({ month: 12 });\n\n return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset;\n }\n\n /**\n * Return whether the specified zone is a valid IANA specifier.\n * @param {string} zone - Zone to check\n * @return {boolean}\n */\n static isValidIANAZone(zone) {\n return IANAZone.isValidZone(zone);\n }\n\n /**\n * Converts the input into a {@link Zone} instance.\n *\n * * If `input` is already a Zone instance, it is returned unchanged.\n * * If `input` is a string containing a valid time zone name, a Zone instance\n * with that name is returned.\n * * If `input` is a string that doesn't refer to a known time zone, a Zone\n * instance with {@link Zone#isValid} == false is returned.\n * * If `input is a number, a Zone instance with the specified fixed offset\n * in minutes is returned.\n * * If `input` is `null` or `undefined`, the default zone is returned.\n * @param {string|Zone|number} [input] - the value to be converted\n * @return {Zone}\n */\n static normalizeZone(input) {\n return normalizeZone(input, Settings.defaultZone);\n }\n\n /**\n * Get the weekday on which the week starts according to the given locale.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number} the start of the week, 1 for Monday through 7 for Sunday\n */\n static getStartOfWeek({ locale = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale)).getStartOfWeek();\n }\n\n /**\n * Get the minimum number of days necessary in a week before it is considered part of the next year according\n * to the given locale.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number}\n */\n static getMinimumDaysInFirstWeek({ locale = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();\n }\n\n /**\n * Get the weekdays, which are considered the weekend according to the given locale\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday\n */\n static getWeekendWeekdays({ locale = null, locObj = null } = {}) {\n // copy the array, because we cache it internally\n return (locObj || Locale.create(locale)).getWeekendDays().slice();\n }\n\n /**\n * Return an array of standalone month names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @example Info.months()[0] //=> 'January'\n * @example Info.months('short')[0] //=> 'Jan'\n * @example Info.months('numeric')[0] //=> '1'\n * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'\n * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'\n * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'\n * @return {Array}\n */\n static months(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);\n }\n\n /**\n * Return an array of format month names.\n * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that\n * changes the string.\n * See {@link Info#months}\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @return {Array}\n */\n static monthsFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);\n }\n\n /**\n * Return an array of standalone week names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the weekday representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @example Info.weekdays()[0] //=> 'Monday'\n * @example Info.weekdays('short')[0] //=> 'Mon'\n * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'\n * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'\n * @return {Array}\n */\n static weekdays(length = \"long\", { locale = null, numberingSystem = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);\n }\n\n /**\n * Return an array of format week names.\n * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that\n * changes the string.\n * See {@link Info#weekdays}\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale=null] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @return {Array}\n */\n static weekdaysFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);\n }\n\n /**\n * Return an array of meridiems.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.meridiems() //=> [ 'AM', 'PM' ]\n * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]\n * @return {Array}\n */\n static meridiems({ locale = null } = {}) {\n return Locale.create(locale).meridiems();\n }\n\n /**\n * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.\n * @param {string} [length='short'] - the length of the era representation, such as \"short\" or \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.eras() //=> [ 'BC', 'AD' ]\n * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]\n * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]\n * @return {Array}\n */\n static eras(length = \"short\", { locale = null } = {}) {\n return Locale.create(locale, null, \"gregory\").eras(length);\n }\n\n /**\n * Return the set of available features in this environment.\n * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.\n * Keys:\n * * `relative`: whether this environment supports relative time formatting\n * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale\n * @example Info.features() //=> { relative: false, localeWeek: true }\n * @return {Object}\n */\n static features() {\n return { relative: hasRelative(), localeWeek: hasLocaleWeekInfo() };\n }\n}\n","import Duration from \"../duration.js\";\n\nfunction dayDiff(earlier, later) {\n const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf(\"day\").valueOf(),\n ms = utcDayStart(later) - utcDayStart(earlier);\n return Math.floor(Duration.fromMillis(ms).as(\"days\"));\n}\n\nfunction highOrderDiffs(cursor, later, units) {\n const differs = [\n [\"years\", (a, b) => b.year - a.year],\n [\"quarters\", (a, b) => b.quarter - a.quarter + (b.year - a.year) * 4],\n [\"months\", (a, b) => b.month - a.month + (b.year - a.year) * 12],\n [\n \"weeks\",\n (a, b) => {\n const days = dayDiff(a, b);\n return (days - (days % 7)) / 7;\n },\n ],\n [\"days\", dayDiff],\n ];\n\n const results = {};\n const earlier = cursor;\n let lowestOrder, highWater;\n\n /* This loop tries to diff using larger units first.\n If we overshoot, we backtrack and try the next smaller unit.\n \"cursor\" starts out at the earlier timestamp and moves closer and closer to \"later\"\n as we use smaller and smaller units.\n highWater keeps track of where we would be if we added one more of the smallest unit,\n this is used later to potentially convert any difference smaller than the smallest higher order unit\n into a fraction of that smallest higher order unit\n */\n for (const [unit, differ] of differs) {\n if (units.indexOf(unit) >= 0) {\n lowestOrder = unit;\n\n results[unit] = differ(cursor, later);\n highWater = earlier.plus(results);\n\n if (highWater > later) {\n // we overshot the end point, backtrack cursor by 1\n results[unit]--;\n cursor = earlier.plus(results);\n\n // if we are still overshooting now, we need to backtrack again\n // this happens in certain situations when diffing times in different zones,\n // because this calculation ignores time zones\n if (cursor > later) {\n // keep the \"overshot by 1\" around as highWater\n highWater = cursor;\n // backtrack cursor by 1\n results[unit]--;\n cursor = earlier.plus(results);\n }\n } else {\n cursor = highWater;\n }\n }\n }\n\n return [cursor, results, highWater, lowestOrder];\n}\n\nexport default function (earlier, later, units, opts) {\n let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);\n\n const remainingMillis = later - cursor;\n\n const lowerOrderUnits = units.filter(\n (u) => [\"hours\", \"minutes\", \"seconds\", \"milliseconds\"].indexOf(u) >= 0\n );\n\n if (lowerOrderUnits.length === 0) {\n if (highWater < later) {\n highWater = cursor.plus({ [lowestOrder]: 1 });\n }\n\n if (highWater !== cursor) {\n results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);\n }\n }\n\n const duration = Duration.fromObject(results, opts);\n\n if (lowerOrderUnits.length > 0) {\n return Duration.fromMillis(remainingMillis, opts)\n .shiftTo(...lowerOrderUnits)\n .plus(duration);\n } else {\n return duration;\n }\n}\n","import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from \"./util.js\";\nimport Formatter from \"./formatter.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport DateTime from \"../datetime.js\";\nimport { digitRegex, parseDigits } from \"./digits.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst MISSING_FTP = \"missing Intl.DateTimeFormat.formatToParts support\";\n\nfunction intUnit(regex, post = (i) => i) {\n return { regex, deser: ([s]) => post(parseDigits(s)) };\n}\n\nconst NBSP = String.fromCharCode(160);\nconst spaceOrNBSP = `[ ${NBSP}]`;\nconst spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, \"g\");\n\nfunction fixListRegex(s) {\n // make dots optional and also make them literal\n // make space and non breakable space characters interchangeable\n return s.replace(/\\./g, \"\\\\.?\").replace(spaceOrNBSPRegExp, spaceOrNBSP);\n}\n\nfunction stripInsensitivities(s) {\n return s\n .replace(/\\./g, \"\") // ignore dots that were made optional\n .replace(spaceOrNBSPRegExp, \" \") // interchange space and nbsp\n .toLowerCase();\n}\n\nfunction oneOf(strings, startIndex) {\n if (strings === null) {\n return null;\n } else {\n return {\n regex: RegExp(strings.map(fixListRegex).join(\"|\")),\n deser: ([s]) =>\n strings.findIndex((i) => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex,\n };\n }\n}\n\nfunction offset(regex, groups) {\n return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };\n}\n\nfunction simple(regex) {\n return { regex, deser: ([s]) => s };\n}\n\nfunction escapeToken(value) {\n return value.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n}\n\n/**\n * @param token\n * @param {Locale} loc\n */\nfunction unitForToken(token, loc) {\n const one = digitRegex(loc),\n two = digitRegex(loc, \"{2}\"),\n three = digitRegex(loc, \"{3}\"),\n four = digitRegex(loc, \"{4}\"),\n six = digitRegex(loc, \"{6}\"),\n oneOrTwo = digitRegex(loc, \"{1,2}\"),\n oneToThree = digitRegex(loc, \"{1,3}\"),\n oneToSix = digitRegex(loc, \"{1,6}\"),\n oneToNine = digitRegex(loc, \"{1,9}\"),\n twoToFour = digitRegex(loc, \"{2,4}\"),\n fourToSix = digitRegex(loc, \"{4,6}\"),\n literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }),\n unitate = (t) => {\n if (token.literal) {\n return literal(t);\n }\n switch (t.val) {\n // era\n case \"G\":\n return oneOf(loc.eras(\"short\"), 0);\n case \"GG\":\n return oneOf(loc.eras(\"long\"), 0);\n // years\n case \"y\":\n return intUnit(oneToSix);\n case \"yy\":\n return intUnit(twoToFour, untruncateYear);\n case \"yyyy\":\n return intUnit(four);\n case \"yyyyy\":\n return intUnit(fourToSix);\n case \"yyyyyy\":\n return intUnit(six);\n // months\n case \"M\":\n return intUnit(oneOrTwo);\n case \"MM\":\n return intUnit(two);\n case \"MMM\":\n return oneOf(loc.months(\"short\", true), 1);\n case \"MMMM\":\n return oneOf(loc.months(\"long\", true), 1);\n case \"L\":\n return intUnit(oneOrTwo);\n case \"LL\":\n return intUnit(two);\n case \"LLL\":\n return oneOf(loc.months(\"short\", false), 1);\n case \"LLLL\":\n return oneOf(loc.months(\"long\", false), 1);\n // dates\n case \"d\":\n return intUnit(oneOrTwo);\n case \"dd\":\n return intUnit(two);\n // ordinals\n case \"o\":\n return intUnit(oneToThree);\n case \"ooo\":\n return intUnit(three);\n // time\n case \"HH\":\n return intUnit(two);\n case \"H\":\n return intUnit(oneOrTwo);\n case \"hh\":\n return intUnit(two);\n case \"h\":\n return intUnit(oneOrTwo);\n case \"mm\":\n return intUnit(two);\n case \"m\":\n return intUnit(oneOrTwo);\n case \"q\":\n return intUnit(oneOrTwo);\n case \"qq\":\n return intUnit(two);\n case \"s\":\n return intUnit(oneOrTwo);\n case \"ss\":\n return intUnit(two);\n case \"S\":\n return intUnit(oneToThree);\n case \"SSS\":\n return intUnit(three);\n case \"u\":\n return simple(oneToNine);\n case \"uu\":\n return simple(oneOrTwo);\n case \"uuu\":\n return intUnit(one);\n // meridiem\n case \"a\":\n return oneOf(loc.meridiems(), 0);\n // weekYear (k)\n case \"kkkk\":\n return intUnit(four);\n case \"kk\":\n return intUnit(twoToFour, untruncateYear);\n // weekNumber (W)\n case \"W\":\n return intUnit(oneOrTwo);\n case \"WW\":\n return intUnit(two);\n // weekdays\n case \"E\":\n case \"c\":\n return intUnit(one);\n case \"EEE\":\n return oneOf(loc.weekdays(\"short\", false), 1);\n case \"EEEE\":\n return oneOf(loc.weekdays(\"long\", false), 1);\n case \"ccc\":\n return oneOf(loc.weekdays(\"short\", true), 1);\n case \"cccc\":\n return oneOf(loc.weekdays(\"long\", true), 1);\n // offset/zone\n case \"Z\":\n case \"ZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);\n case \"ZZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);\n // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing\n // because we don't have any way to figure out what they are\n case \"z\":\n return simple(/[a-z_+-/]{1,256}?/i);\n // this special-case \"token\" represents a place where a macro-token expanded into a white-space literal\n // in this case we accept any non-newline white-space\n case \" \":\n return simple(/[^\\S\\n\\r]/);\n default:\n return literal(t);\n }\n };\n\n const unit = unitate(token) || {\n invalidReason: MISSING_FTP,\n };\n\n unit.token = token;\n\n return unit;\n}\n\nconst partTypeStyleToTokenVal = {\n year: {\n \"2-digit\": \"yy\",\n numeric: \"yyyyy\",\n },\n month: {\n numeric: \"M\",\n \"2-digit\": \"MM\",\n short: \"MMM\",\n long: \"MMMM\",\n },\n day: {\n numeric: \"d\",\n \"2-digit\": \"dd\",\n },\n weekday: {\n short: \"EEE\",\n long: \"EEEE\",\n },\n dayperiod: \"a\",\n dayPeriod: \"a\",\n hour12: {\n numeric: \"h\",\n \"2-digit\": \"hh\",\n },\n hour24: {\n numeric: \"H\",\n \"2-digit\": \"HH\",\n },\n minute: {\n numeric: \"m\",\n \"2-digit\": \"mm\",\n },\n second: {\n numeric: \"s\",\n \"2-digit\": \"ss\",\n },\n timeZoneName: {\n long: \"ZZZZZ\",\n short: \"ZZZ\",\n },\n};\n\nfunction tokenForPart(part, formatOpts, resolvedOpts) {\n const { type, value } = part;\n\n if (type === \"literal\") {\n const isSpace = /^\\s+$/.test(value);\n return {\n literal: !isSpace,\n val: isSpace ? \" \" : value,\n };\n }\n\n const style = formatOpts[type];\n\n // The user might have explicitly specified hour12 or hourCycle\n // if so, respect their decision\n // if not, refer back to the resolvedOpts, which are based on the locale\n let actualType = type;\n if (type === \"hour\") {\n if (formatOpts.hour12 != null) {\n actualType = formatOpts.hour12 ? \"hour12\" : \"hour24\";\n } else if (formatOpts.hourCycle != null) {\n if (formatOpts.hourCycle === \"h11\" || formatOpts.hourCycle === \"h12\") {\n actualType = \"hour12\";\n } else {\n actualType = \"hour24\";\n }\n } else {\n // tokens only differentiate between 24 hours or not,\n // so we do not need to check hourCycle here, which is less supported anyways\n actualType = resolvedOpts.hour12 ? \"hour12\" : \"hour24\";\n }\n }\n let val = partTypeStyleToTokenVal[actualType];\n if (typeof val === \"object\") {\n val = val[style];\n }\n\n if (val) {\n return {\n literal: false,\n val,\n };\n }\n\n return undefined;\n}\n\nfunction buildRegex(units) {\n const re = units.map((u) => u.regex).reduce((f, r) => `${f}(${r.source})`, \"\");\n return [`^${re}$`, units];\n}\n\nfunction match(input, regex, handlers) {\n const matches = input.match(regex);\n\n if (matches) {\n const all = {};\n let matchIndex = 1;\n for (const i in handlers) {\n if (hasOwnProperty(handlers, i)) {\n const h = handlers[i],\n groups = h.groups ? h.groups + 1 : 1;\n if (!h.literal && h.token) {\n all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));\n }\n matchIndex += groups;\n }\n }\n return [matches, all];\n } else {\n return [matches, {}];\n }\n}\n\nfunction dateTimeFromMatches(matches) {\n const toField = (token) => {\n switch (token) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n case \"H\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"o\":\n return \"ordinal\";\n case \"L\":\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n case \"E\":\n case \"c\":\n return \"weekday\";\n case \"W\":\n return \"weekNumber\";\n case \"k\":\n return \"weekYear\";\n case \"q\":\n return \"quarter\";\n default:\n return null;\n }\n };\n\n let zone = null;\n let specificOffset;\n if (!isUndefined(matches.z)) {\n zone = IANAZone.create(matches.z);\n }\n\n if (!isUndefined(matches.Z)) {\n if (!zone) {\n zone = new FixedOffsetZone(matches.Z);\n }\n specificOffset = matches.Z;\n }\n\n if (!isUndefined(matches.q)) {\n matches.M = (matches.q - 1) * 3 + 1;\n }\n\n if (!isUndefined(matches.h)) {\n if (matches.h < 12 && matches.a === 1) {\n matches.h += 12;\n } else if (matches.h === 12 && matches.a === 0) {\n matches.h = 0;\n }\n }\n\n if (matches.G === 0 && matches.y) {\n matches.y = -matches.y;\n }\n\n if (!isUndefined(matches.u)) {\n matches.S = parseMillis(matches.u);\n }\n\n const vals = Object.keys(matches).reduce((r, k) => {\n const f = toField(k);\n if (f) {\n r[f] = matches[k];\n }\n\n return r;\n }, {});\n\n return [vals, zone, specificOffset];\n}\n\nlet dummyDateTimeCache = null;\n\nfunction getDummyDateTime() {\n if (!dummyDateTimeCache) {\n dummyDateTimeCache = DateTime.fromMillis(1555555555555);\n }\n\n return dummyDateTimeCache;\n}\n\nfunction maybeExpandMacroToken(token, locale) {\n if (token.literal) {\n return token;\n }\n\n const formatOpts = Formatter.macroTokenToFormatOpts(token.val);\n const tokens = formatOptsToTokens(formatOpts, locale);\n\n if (tokens == null || tokens.includes(undefined)) {\n return token;\n }\n\n return tokens;\n}\n\nexport function expandMacroTokens(tokens, locale) {\n return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale)));\n}\n\n/**\n * @private\n */\n\nexport class TokenParser {\n constructor(locale, format) {\n this.locale = locale;\n this.format = format;\n this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale);\n this.units = this.tokens.map((t) => unitForToken(t, locale));\n this.disqualifyingUnit = this.units.find((t) => t.invalidReason);\n\n if (!this.disqualifyingUnit) {\n const [regexString, handlers] = buildRegex(this.units);\n this.regex = RegExp(regexString, \"i\");\n this.handlers = handlers;\n }\n }\n\n explainFromTokens(input) {\n if (!this.isValid) {\n return { input, tokens: this.tokens, invalidReason: this.invalidReason };\n } else {\n const [rawMatches, matches] = match(input, this.regex, this.handlers),\n [result, zone, specificOffset] = matches\n ? dateTimeFromMatches(matches)\n : [null, null, undefined];\n if (hasOwnProperty(matches, \"a\") && hasOwnProperty(matches, \"H\")) {\n throw new ConflictingSpecificationError(\n \"Can't include meridiem when specifying 24-hour format\"\n );\n }\n return {\n input,\n tokens: this.tokens,\n regex: this.regex,\n rawMatches,\n matches,\n result,\n zone,\n specificOffset,\n };\n }\n }\n\n get isValid() {\n return !this.disqualifyingUnit;\n }\n\n get invalidReason() {\n return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null;\n }\n}\n\nexport function explainFromTokens(locale, input, format) {\n const parser = new TokenParser(locale, format);\n return parser.explainFromTokens(input);\n}\n\nexport function parseFromTokens(locale, input, format) {\n const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format);\n return [result, zone, specificOffset, invalidReason];\n}\n\nexport function formatOptsToTokens(formatOpts, locale) {\n if (!formatOpts) {\n return null;\n }\n\n const formatter = Formatter.create(locale, formatOpts);\n const df = formatter.dtFormatter(getDummyDateTime());\n const parts = df.formatToParts();\n const resolvedOpts = df.resolvedOptions();\n return parts.map((p) => tokenForPart(p, formatOpts, resolvedOpts));\n}\n","import Duration from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Settings from \"./settings.js\";\nimport Info from \"./info.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport {\n isUndefined,\n maybeArray,\n isDate,\n isNumber,\n bestBy,\n daysInMonth,\n daysInYear,\n isLeapYear,\n weeksInWeekYear,\n normalizeObject,\n roundTo,\n objToLocalTS,\n padStart,\n} from \"./impl/util.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport diff from \"./impl/diff.js\";\nimport { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from \"./impl/regexParser.js\";\nimport {\n parseFromTokens,\n explainFromTokens,\n formatOptsToTokens,\n expandMacroTokens,\n TokenParser,\n} from \"./impl/tokenParser.js\";\nimport {\n gregorianToWeek,\n weekToGregorian,\n gregorianToOrdinal,\n ordinalToGregorian,\n hasInvalidGregorianData,\n hasInvalidWeekData,\n hasInvalidOrdinalData,\n hasInvalidTimeData,\n usesLocalWeekValues,\n isoWeekdayToLocal,\n} from \"./impl/conversions.js\";\nimport * as Formats from \"./impl/formats.js\";\nimport {\n InvalidArgumentError,\n ConflictingSpecificationError,\n InvalidUnitError,\n InvalidDateTimeError,\n} from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid DateTime\";\nconst MAX_DATE = 8.64e15;\n\nfunction unsupportedZone(zone) {\n return new Invalid(\"unsupported zone\", `the zone \"${zone.name}\" is not supported`);\n}\n\n// we cache week data on the DT object and this intermediates the cache\n/**\n * @param {DateTime} dt\n */\nfunction possiblyCachedWeekData(dt) {\n if (dt.weekData === null) {\n dt.weekData = gregorianToWeek(dt.c);\n }\n return dt.weekData;\n}\n\n/**\n * @param {DateTime} dt\n */\nfunction possiblyCachedLocalWeekData(dt) {\n if (dt.localWeekData === null) {\n dt.localWeekData = gregorianToWeek(\n dt.c,\n dt.loc.getMinDaysInFirstWeek(),\n dt.loc.getStartOfWeek()\n );\n }\n return dt.localWeekData;\n}\n\n// clone really means, \"make a new object with these modifications\". all \"setters\" really use this\n// to create a new object while only changing some of the properties\nfunction clone(inst, alts) {\n const current = {\n ts: inst.ts,\n zone: inst.zone,\n c: inst.c,\n o: inst.o,\n loc: inst.loc,\n invalid: inst.invalid,\n };\n return new DateTime({ ...current, ...alts, old: current });\n}\n\n// find the right offset a given local time. The o input is our guess, which determines which\n// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)\nfunction fixOffset(localTS, o, tz) {\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - o * 60 * 1000;\n\n // Test whether the zone matches the offset for this ts\n const o2 = tz.offset(utcGuess);\n\n // If so, offset didn't change and we're done\n if (o === o2) {\n return [utcGuess, o];\n }\n\n // If not, change the ts by the difference in the offset\n utcGuess -= (o2 - o) * 60 * 1000;\n\n // If that gives us the local time we want, we're done\n const o3 = tz.offset(utcGuess);\n if (o2 === o3) {\n return [utcGuess, o2];\n }\n\n // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time\n return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];\n}\n\n// convert an epoch timestamp into a calendar object with the given offset\nfunction tsToObj(ts, offset) {\n ts += offset * 60 * 1000;\n\n const d = new Date(ts);\n\n return {\n year: d.getUTCFullYear(),\n month: d.getUTCMonth() + 1,\n day: d.getUTCDate(),\n hour: d.getUTCHours(),\n minute: d.getUTCMinutes(),\n second: d.getUTCSeconds(),\n millisecond: d.getUTCMilliseconds(),\n };\n}\n\n// convert a calendar object to a epoch timestamp\nfunction objToTS(obj, offset, zone) {\n return fixOffset(objToLocalTS(obj), offset, zone);\n}\n\n// create a new DT instance by adding a duration, adjusting for DSTs\nfunction adjustTime(inst, dur) {\n const oPre = inst.o,\n year = inst.c.year + Math.trunc(dur.years),\n month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3,\n c = {\n ...inst.c,\n year,\n month,\n day:\n Math.min(inst.c.day, daysInMonth(year, month)) +\n Math.trunc(dur.days) +\n Math.trunc(dur.weeks) * 7,\n },\n millisToAdd = Duration.fromObject({\n years: dur.years - Math.trunc(dur.years),\n quarters: dur.quarters - Math.trunc(dur.quarters),\n months: dur.months - Math.trunc(dur.months),\n weeks: dur.weeks - Math.trunc(dur.weeks),\n days: dur.days - Math.trunc(dur.days),\n hours: dur.hours,\n minutes: dur.minutes,\n seconds: dur.seconds,\n milliseconds: dur.milliseconds,\n }).as(\"milliseconds\"),\n localTS = objToLocalTS(c);\n\n let [ts, o] = fixOffset(localTS, oPre, inst.zone);\n\n if (millisToAdd !== 0) {\n ts += millisToAdd;\n // that could have changed the offset by going over a DST, but we want to keep the ts the same\n o = inst.zone.offset(ts);\n }\n\n return { ts, o };\n}\n\n// helper useful in turning the results of parsing into real dates\n// by handling the zone options\nfunction parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {\n const { setZone, zone } = opts;\n if ((parsed && Object.keys(parsed).length !== 0) || parsedZone) {\n const interpretationZone = parsedZone || zone,\n inst = DateTime.fromObject(parsed, {\n ...opts,\n zone: interpretationZone,\n specificOffset,\n });\n return setZone ? inst : inst.setZone(zone);\n } else {\n return DateTime.invalid(\n new Invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ${format}`)\n );\n }\n}\n\n// if you want to output a technical format (e.g. RFC 2822), this helper\n// helps handle the details\nfunction toTechFormat(dt, format, allowZ = true) {\n return dt.isValid\n ? Formatter.create(Locale.create(\"en-US\"), {\n allowZ,\n forceSimple: true,\n }).formatDateTimeFromString(dt, format)\n : null;\n}\n\nfunction toISODate(o, extended, precision) {\n const longFormat = o.c.year > 9999 || o.c.year < 0;\n let c = \"\";\n if (longFormat && o.c.year >= 0) c += \"+\";\n c += padStart(o.c.year, longFormat ? 6 : 4);\n if (precision === \"year\") return c;\n if (extended) {\n c += \"-\";\n c += padStart(o.c.month);\n if (precision === \"month\") return c;\n c += \"-\";\n } else {\n c += padStart(o.c.month);\n if (precision === \"month\") return c;\n }\n c += padStart(o.c.day);\n return c;\n}\n\nfunction toISOTime(\n o,\n extended,\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n) {\n let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0,\n c = \"\";\n switch (precision) {\n case \"day\":\n case \"month\":\n case \"year\":\n break;\n default:\n c += padStart(o.c.hour);\n if (precision === \"hour\") break;\n if (extended) {\n c += \":\";\n c += padStart(o.c.minute);\n if (precision === \"minute\") break;\n if (showSeconds) {\n c += \":\";\n c += padStart(o.c.second);\n }\n } else {\n c += padStart(o.c.minute);\n if (precision === \"minute\") break;\n if (showSeconds) {\n c += padStart(o.c.second);\n }\n }\n if (precision === \"second\") break;\n if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) {\n c += \".\";\n c += padStart(o.c.millisecond, 3);\n }\n }\n\n if (includeOffset) {\n if (o.isOffsetFixed && o.offset === 0 && !extendedZone) {\n c += \"Z\";\n } else if (o.o < 0) {\n c += \"-\";\n c += padStart(Math.trunc(-o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(-o.o % 60));\n } else {\n c += \"+\";\n c += padStart(Math.trunc(o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(o.o % 60));\n }\n }\n\n if (extendedZone) {\n c += \"[\" + o.zone.ianaName + \"]\";\n }\n return c;\n}\n\n// defaults for unspecified units in the supported calendars\nconst defaultUnitValues = {\n month: 1,\n day: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultWeekUnitValues = {\n weekNumber: 1,\n weekday: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultOrdinalUnitValues = {\n ordinal: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n };\n\n// Units in the supported calendars, sorted by bigness\nconst orderedUnits = [\"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"millisecond\"],\n orderedWeekUnits = [\n \"weekYear\",\n \"weekNumber\",\n \"weekday\",\n \"hour\",\n \"minute\",\n \"second\",\n \"millisecond\",\n ],\n orderedOrdinalUnits = [\"year\", \"ordinal\", \"hour\", \"minute\", \"second\", \"millisecond\"];\n\n// standardize case and plurality in units\nfunction normalizeUnit(unit) {\n const normalized = {\n year: \"year\",\n years: \"year\",\n month: \"month\",\n months: \"month\",\n day: \"day\",\n days: \"day\",\n hour: \"hour\",\n hours: \"hour\",\n minute: \"minute\",\n minutes: \"minute\",\n quarter: \"quarter\",\n quarters: \"quarter\",\n second: \"second\",\n seconds: \"second\",\n millisecond: \"millisecond\",\n milliseconds: \"millisecond\",\n weekday: \"weekday\",\n weekdays: \"weekday\",\n weeknumber: \"weekNumber\",\n weeksnumber: \"weekNumber\",\n weeknumbers: \"weekNumber\",\n weekyear: \"weekYear\",\n weekyears: \"weekYear\",\n ordinal: \"ordinal\",\n }[unit.toLowerCase()];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n}\n\nfunction normalizeUnitWithLocalWeeks(unit) {\n switch (unit.toLowerCase()) {\n case \"localweekday\":\n case \"localweekdays\":\n return \"localWeekday\";\n case \"localweeknumber\":\n case \"localweeknumbers\":\n return \"localWeekNumber\";\n case \"localweekyear\":\n case \"localweekyears\":\n return \"localWeekYear\";\n default:\n return normalizeUnit(unit);\n }\n}\n\n// cache offsets for zones based on the current timestamp when this function is\n// first called. When we are handling a datetime from components like (year,\n// month, day, hour) in a time zone, we need a guess about what the timezone\n// offset is so that we can convert into a UTC timestamp. One way is to find the\n// offset of now in the zone. The actual date may have a different offset (for\n// example, if we handle a date in June while we're in December in a zone that\n// observes DST), but we can check and adjust that.\n//\n// When handling many dates, calculating the offset for now every time is\n// expensive. It's just a guess, so we can cache the offset to use even if we\n// are right on a time change boundary (we'll just correct in the other\n// direction). Using a timestamp from first read is a slight optimization for\n// handling dates close to the current date, since those dates will usually be\n// in the same offset (we could set the timestamp statically, instead). We use a\n// single timestamp for all zones to make things a bit more predictable.\n//\n// This is safe for quickDT (used by local() and utc()) because we don't fill in\n// higher-order units from tsNow (as we do in fromObject, this requires that\n// offset is calculated from tsNow).\n/**\n * @param {Zone} zone\n * @return {number}\n */\nfunction guessOffsetForZone(zone) {\n if (zoneOffsetTs === undefined) {\n zoneOffsetTs = Settings.now();\n }\n\n // Do not cache anything but IANA zones, because it is not safe to do so.\n // Guessing an offset which is not present in the zone can cause wrong results from fixOffset\n if (zone.type !== \"iana\") {\n return zone.offset(zoneOffsetTs);\n }\n const zoneName = zone.name;\n let offsetGuess = zoneOffsetGuessCache.get(zoneName);\n if (offsetGuess === undefined) {\n offsetGuess = zone.offset(zoneOffsetTs);\n zoneOffsetGuessCache.set(zoneName, offsetGuess);\n }\n return offsetGuess;\n}\n\n// this is a dumbed down version of fromObject() that runs about 60% faster\n// but doesn't do any validation, makes a bunch of assumptions about what units\n// are present, and so on.\nfunction quickDT(obj, opts) {\n const zone = normalizeZone(opts.zone, Settings.defaultZone);\n if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n }\n\n const loc = Locale.fromObject(opts);\n\n let ts, o;\n\n // assume we have the higher-order units\n if (!isUndefined(obj.year)) {\n for (const u of orderedUnits) {\n if (isUndefined(obj[u])) {\n obj[u] = defaultUnitValues[u];\n }\n }\n\n const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n const offsetProvis = guessOffsetForZone(zone);\n [ts, o] = objToTS(obj, offsetProvis, zone);\n } else {\n ts = Settings.now();\n }\n\n return new DateTime({ ts, zone, loc, o });\n}\n\nfunction diffRelative(start, end, opts) {\n const round = isUndefined(opts.round) ? true : opts.round,\n rounding = isUndefined(opts.rounding) ? \"trunc\" : opts.rounding,\n format = (c, unit) => {\n c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? \"round\" : rounding);\n const formatter = end.loc.clone(opts).relFormatter(opts);\n return formatter.format(c, unit);\n },\n differ = (unit) => {\n if (opts.calendary) {\n if (!end.hasSame(start, unit)) {\n return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);\n } else return 0;\n } else {\n return end.diff(start, unit).get(unit);\n }\n };\n\n if (opts.unit) {\n return format(differ(opts.unit), opts.unit);\n }\n\n for (const unit of opts.units) {\n const count = differ(unit);\n if (Math.abs(count) >= 1) {\n return format(count, unit);\n }\n }\n return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);\n}\n\nfunction lastOpts(argList) {\n let opts = {},\n args;\n if (argList.length > 0 && typeof argList[argList.length - 1] === \"object\") {\n opts = argList[argList.length - 1];\n args = Array.from(argList).slice(0, argList.length - 1);\n } else {\n args = Array.from(argList);\n }\n return [opts, args];\n}\n\n/**\n * Timestamp to use for cached zone offset guesses (exposed for test)\n */\nlet zoneOffsetTs;\n/**\n * Cache for zone offset guesses (exposed for test).\n *\n * This optimizes quickDT via guessOffsetForZone to avoid repeated calls of\n * zone.offset().\n */\nconst zoneOffsetGuessCache = new Map();\n\n/**\n * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them.\n *\n * A DateTime comprises of:\n * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch.\n * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone).\n * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`.\n *\n * Here is a brief overview of the most commonly used functionality it provides:\n *\n * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}.\n * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month},\n * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors.\n * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors.\n * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors.\n * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}.\n * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}.\n *\n * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.\n */\nexport default class DateTime {\n /**\n * @access private\n */\n constructor(config) {\n const zone = config.zone || Settings.defaultZone;\n\n let invalid =\n config.invalid ||\n (Number.isNaN(config.ts) ? new Invalid(\"invalid input\") : null) ||\n (!zone.isValid ? unsupportedZone(zone) : null);\n /**\n * @access private\n */\n this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;\n\n let c = null,\n o = null;\n if (!invalid) {\n const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);\n\n if (unchanged) {\n [c, o] = [config.old.c, config.old.o];\n } else {\n // If an offset has been passed and we have not been called from\n // clone(), we can trust it and avoid the offset calculation.\n const ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts);\n c = tsToObj(this.ts, ot);\n invalid = Number.isNaN(c.year) ? new Invalid(\"invalid input\") : null;\n c = invalid ? null : c;\n o = invalid ? null : ot;\n }\n }\n\n /**\n * @access private\n */\n this._zone = zone;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.invalid = invalid;\n /**\n * @access private\n */\n this.weekData = null;\n /**\n * @access private\n */\n this.localWeekData = null;\n /**\n * @access private\n */\n this.c = c;\n /**\n * @access private\n */\n this.o = o;\n /**\n * @access private\n */\n this.isLuxonDateTime = true;\n }\n\n // CONSTRUCT\n\n /**\n * Create a DateTime for the current instant, in the system's time zone.\n *\n * Use Settings to override these default values if needed.\n * @example DateTime.now().toISO() //~> now in the ISO format\n * @return {DateTime}\n */\n static now() {\n return new DateTime({});\n }\n\n /**\n * Create a local DateTime\n * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month, 1-indexed\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.local() //~> now\n * @example DateTime.local({ zone: \"America/New_York\" }) //~> now, in US east coast time\n * @example DateTime.local(2017) //~> 2017-01-01T00:00:00\n * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00\n * @example DateTime.local(2017, 3, 12, { locale: \"fr\" }) //~> 2017-03-12T00:00:00, with a French locale\n * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00\n * @example DateTime.local(2017, 3, 12, 5, { zone: \"utc\" }) //~> 2017-03-12T05:00:00, in UTC\n * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00\n * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10\n * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765\n * @return {DateTime}\n */\n static local() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime in UTC\n * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @param {Object} options - configuration options for the DateTime\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance\n * @example DateTime.utc() //~> now\n * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z\n * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z\n * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: \"fr\" }) //~> 2017-03-12T05:45:00Z with a French locale\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: \"fr\" }) //~> 2017-03-12T05:45:10.765Z with a French locale\n * @return {DateTime}\n */\n static utc() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n\n opts.zone = FixedOffsetZone.utcInstance;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime from a JavaScript Date object. Uses the default zone.\n * @param {Date} date - a JavaScript Date object\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @return {DateTime}\n */\n static fromJSDate(date, options = {}) {\n const ts = isDate(date) ? date.valueOf() : NaN;\n if (Number.isNaN(ts)) {\n return DateTime.invalid(\"invalid input\");\n }\n\n const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n return new DateTime({\n ts: ts,\n zone: zoneToUse,\n loc: Locale.fromObject(options),\n });\n }\n\n /**\n * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} milliseconds - a number of milliseconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromMillis(milliseconds, options = {}) {\n if (!isNumber(milliseconds)) {\n throw new InvalidArgumentError(\n `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`\n );\n } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {\n // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start\n return DateTime.invalid(\"Timestamp out of range\");\n } else {\n return new DateTime({\n ts: milliseconds,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} seconds - a number of seconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromSeconds(seconds, options = {}) {\n if (!isNumber(seconds)) {\n throw new InvalidArgumentError(\"fromSeconds requires a numerical input\");\n } else {\n return new DateTime({\n ts: seconds * 1000,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.year - a year, such as 1987\n * @param {number} obj.month - a month, 1-12\n * @param {number} obj.day - a day of the month, 1-31, depending on the month\n * @param {number} obj.ordinal - day of the year, 1-365 or 366\n * @param {number} obj.weekYear - an ISO week year\n * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year\n * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday\n * @param {number} obj.localWeekYear - a week year, according to the locale\n * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale\n * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale\n * @param {number} obj.hour - hour of the day, 0-23\n * @param {number} obj.minute - minute of the hour, 0-59\n * @param {number} obj.second - second of the minute, 0-59\n * @param {number} obj.millisecond - millisecond of the second, 0-999\n * @param {Object} opts - options for creating this DateTime\n * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()\n * @param {string} [opts.locale='system\\'s locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'\n * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }),\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })\n * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'\n * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: \"en-US\" }).toISODate() //=> '2021-12-26'\n * @return {DateTime}\n */\n static fromObject(obj, opts = {}) {\n obj = obj || {};\n const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n const loc = Locale.fromObject(opts);\n const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);\n const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, loc);\n\n const tsNow = Settings.now(),\n offsetProvis = !isUndefined(opts.specificOffset)\n ? opts.specificOffset\n : zoneToUse.offset(tsNow),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber;\n\n // cases:\n // just a weekday -> this week's instance of that weekday, no worries\n // (gregorian data or ordinal) + (weekYear or weekNumber) -> error\n // (gregorian month or day) + ordinal -> error\n // otherwise just use weeks or ordinals or gregorian, depending on what's specified\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor);\n\n // configure ourselves to deal with gregorian dates or week stuff\n let units,\n defaultValues,\n objNow = tsToObj(tsNow, offsetProvis);\n if (useWeekData) {\n units = orderedWeekUnits;\n defaultValues = defaultWeekUnitValues;\n objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);\n } else if (containsOrdinal) {\n units = orderedOrdinalUnits;\n defaultValues = defaultOrdinalUnitValues;\n objNow = gregorianToOrdinal(objNow);\n } else {\n units = orderedUnits;\n defaultValues = defaultUnitValues;\n }\n\n // set default values for missing stuff\n let foundFirst = false;\n for (const u of units) {\n const v = normalized[u];\n if (!isUndefined(v)) {\n foundFirst = true;\n } else if (foundFirst) {\n normalized[u] = defaultValues[u];\n } else {\n normalized[u] = objNow[u];\n }\n }\n\n // make sure the values we have are in range\n const higherOrderInvalid = useWeekData\n ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek)\n : containsOrdinal\n ? hasInvalidOrdinalData(normalized)\n : hasInvalidGregorianData(normalized),\n invalid = higherOrderInvalid || hasInvalidTimeData(normalized);\n\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n // compute the actual time\n const gregorian = useWeekData\n ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek)\n : containsOrdinal\n ? ordinalToGregorian(normalized)\n : normalized,\n [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),\n inst = new DateTime({\n ts: tsFinal,\n zone: zoneToUse,\n o: offsetFinal,\n loc,\n });\n\n // gregorian data + weekday serves only to validate\n if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {\n return DateTime.invalid(\n \"mismatched weekday\",\n `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`\n );\n }\n\n if (!inst.isValid) {\n return DateTime.invalid(inst.invalid);\n }\n\n return inst;\n }\n\n /**\n * Create a DateTime from an ISO 8601 string\n * @param {string} text - the ISO string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromISO('2016-05-25T09:08:34.123')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})\n * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})\n * @example DateTime.fromISO('2016-W05-4')\n * @return {DateTime}\n */\n static fromISO(text, opts = {}) {\n const [vals, parsedZone] = parseISODate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"ISO 8601\", text);\n }\n\n /**\n * Create a DateTime from an RFC 2822 string\n * @param {string} text - the RFC 2822 string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')\n * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')\n * @return {DateTime}\n */\n static fromRFC2822(text, opts = {}) {\n const [vals, parsedZone] = parseRFC2822Date(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"RFC 2822\", text);\n }\n\n /**\n * Create a DateTime from an HTTP header date\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @param {string} text - the HTTP header date\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')\n * @return {DateTime}\n */\n static fromHTTP(text, opts = {}) {\n const [vals, parsedZone] = parseHTTPDate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"HTTP\", opts);\n }\n\n /**\n * Create a DateTime from an input string and format string.\n * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens).\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see the link below for the formats)\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromFormat(text, fmt, opts = {}) {\n if (isUndefined(text) || isUndefined(fmt)) {\n throw new InvalidArgumentError(\"fromFormat requires an input string and a format\");\n }\n\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n }),\n [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);\n if (invalid) {\n return DateTime.invalid(invalid);\n } else {\n return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);\n }\n }\n\n /**\n * @deprecated use fromFormat instead\n */\n static fromString(text, fmt, opts = {}) {\n return DateTime.fromFormat(text, fmt, opts);\n }\n\n /**\n * Create a DateTime from a SQL date, time, or datetime\n * Defaults to en-US if no locale has been specified, regardless of the system's locale\n * @param {string} text - the string to parse\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @example DateTime.fromSQL('2017-05-15')\n * @example DateTime.fromSQL('2017-05-15 09:12:34')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })\n * @example DateTime.fromSQL('09:12:34.342')\n * @return {DateTime}\n */\n static fromSQL(text, opts = {}) {\n const [vals, parsedZone] = parseSQL(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"SQL\", text);\n }\n\n /**\n * Create an invalid DateTime.\n * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent.\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {DateTime}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the DateTime is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDateTimeError(invalid);\n } else {\n return new DateTime({ invalid });\n }\n }\n\n /**\n * Check if an object is an instance of DateTime. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDateTime(o) {\n return (o && o.isLuxonDateTime) || false;\n }\n\n /**\n * Produce the format string for a set of options\n * @param formatOpts\n * @param localeOpts\n * @returns {string}\n */\n static parseFormatForOpts(formatOpts, localeOpts = {}) {\n const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));\n return !tokenList ? null : tokenList.map((t) => (t ? t.val : null)).join(\"\");\n }\n\n /**\n * Produce the the fully expanded format token for the locale\n * Does NOT quote characters, so quoted tokens will not round trip correctly\n * @param fmt\n * @param localeOpts\n * @returns {string}\n */\n static expandFormat(fmt, localeOpts = {}) {\n const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));\n return expanded.map((t) => t.val).join(\"\");\n }\n\n static resetCache() {\n zoneOffsetTs = undefined;\n zoneOffsetGuessCache.clear();\n }\n\n // INFO\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example DateTime.local(2017, 7, 4).get('month'); //=> 7\n * @example DateTime.local(2017, 7, 4).get('day'); //=> 4\n * @return {number}\n */\n get(unit) {\n return this[unit];\n }\n\n /**\n * Returns whether the DateTime is valid. Invalid DateTimes occur when:\n * * The DateTime was created from invalid calendar information, such as the 13th month or February 30\n * * The DateTime was created by an operation on another invalid date\n * @type {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this DateTime is invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime\n *\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime\n *\n * @type {string}\n */\n get outputCalendar() {\n return this.isValid ? this.loc.outputCalendar : null;\n }\n\n /**\n * Get the time zone associated with this DateTime.\n * @type {Zone}\n */\n get zone() {\n return this._zone;\n }\n\n /**\n * Get the name of the time zone.\n * @type {string}\n */\n get zoneName() {\n return this.isValid ? this.zone.name : null;\n }\n\n /**\n * Get the year\n * @example DateTime.local(2017, 5, 25).year //=> 2017\n * @type {number}\n */\n get year() {\n return this.isValid ? this.c.year : NaN;\n }\n\n /**\n * Get the quarter\n * @example DateTime.local(2017, 5, 25).quarter //=> 2\n * @type {number}\n */\n get quarter() {\n return this.isValid ? Math.ceil(this.c.month / 3) : NaN;\n }\n\n /**\n * Get the month (1-12).\n * @example DateTime.local(2017, 5, 25).month //=> 5\n * @type {number}\n */\n get month() {\n return this.isValid ? this.c.month : NaN;\n }\n\n /**\n * Get the day of the month (1-30ish).\n * @example DateTime.local(2017, 5, 25).day //=> 25\n * @type {number}\n */\n get day() {\n return this.isValid ? this.c.day : NaN;\n }\n\n /**\n * Get the hour of the day (0-23).\n * @example DateTime.local(2017, 5, 25, 9).hour //=> 9\n * @type {number}\n */\n get hour() {\n return this.isValid ? this.c.hour : NaN;\n }\n\n /**\n * Get the minute of the hour (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30\n * @type {number}\n */\n get minute() {\n return this.isValid ? this.c.minute : NaN;\n }\n\n /**\n * Get the second of the minute (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52\n * @type {number}\n */\n get second() {\n return this.isValid ? this.c.second : NaN;\n }\n\n /**\n * Get the millisecond of the second (0-999).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654\n * @type {number}\n */\n get millisecond() {\n return this.isValid ? this.c.millisecond : NaN;\n }\n\n /**\n * Get the week year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 12, 31).weekYear //=> 2015\n * @type {number}\n */\n get weekYear() {\n return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the week number of the week year (1-52ish).\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2017, 5, 25).weekNumber //=> 21\n * @type {number}\n */\n get weekNumber() {\n return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the day of the week.\n * 1 is Monday and 7 is Sunday\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekday //=> 4\n * @type {number}\n */\n get weekday() {\n return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;\n }\n\n /**\n * Returns true if this date is on a weekend according to the locale, false otherwise\n * @returns {boolean}\n */\n get isWeekend() {\n return this.isValid && this.loc.getWeekendDays().includes(this.weekday);\n }\n\n /**\n * Get the day of the week according to the locale.\n * 1 is the first day of the week and 7 is the last day of the week.\n * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,\n * @returns {number}\n */\n get localWeekday() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;\n }\n\n /**\n * Get the week number of the week year according to the locale. Different locales assign week numbers differently,\n * because the week can start on different days of the week (see localWeekday) and because a different number of days\n * is required for a week to count as the first week of a year.\n * @returns {number}\n */\n get localWeekNumber() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the week year according to the locale. Different locales assign week numbers (and therefor week years)\n * differently, see localWeekNumber.\n * @returns {number}\n */\n get localWeekYear() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the ordinal (meaning the day of the year)\n * @example DateTime.local(2017, 5, 25).ordinal //=> 145\n * @type {number|DateTime}\n */\n get ordinal() {\n return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;\n }\n\n /**\n * Get the human readable short month name, such as 'Oct'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthShort //=> Oct\n * @type {string}\n */\n get monthShort() {\n return this.isValid ? Info.months(\"short\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable long month name, such as 'October'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthLong //=> October\n * @type {string}\n */\n get monthLong() {\n return this.isValid ? Info.months(\"long\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable short weekday, such as 'Mon'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon\n * @type {string}\n */\n get weekdayShort() {\n return this.isValid ? Info.weekdays(\"short\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the human readable long weekday, such as 'Monday'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday\n * @type {string}\n */\n get weekdayLong() {\n return this.isValid ? Info.weekdays(\"long\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the UTC offset of this DateTime in minutes\n * @example DateTime.now().offset //=> -240\n * @example DateTime.utc().offset //=> 0\n * @type {number}\n */\n get offset() {\n return this.isValid ? +this.o : NaN;\n }\n\n /**\n * Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameShort() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"short\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get the long human name for the zone's current offset, for example \"Eastern Standard Time\" or \"Eastern Daylight Time\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameLong() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"long\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get whether this zone's offset ever changes, as in a DST.\n * @type {boolean}\n */\n get isOffsetFixed() {\n return this.isValid ? this.zone.isUniversal : null;\n }\n\n /**\n * Get whether the DateTime is in a DST.\n * @type {boolean}\n */\n get isInDST() {\n if (this.isOffsetFixed) {\n return false;\n } else {\n return (\n this.offset > this.set({ month: 1, day: 1 }).offset ||\n this.offset > this.set({ month: 5 }).offset\n );\n }\n }\n\n /**\n * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC\n * in this DateTime's zone. During DST changes local time can be ambiguous, for example\n * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`.\n * This method will return both possible DateTimes if this DateTime's local time is ambiguous.\n * @returns {DateTime[]}\n */\n getPossibleOffsets() {\n if (!this.isValid || this.isOffsetFixed) {\n return [this];\n }\n const dayMs = 86400000;\n const minuteMs = 60000;\n const localTS = objToLocalTS(this.c);\n const oEarlier = this.zone.offset(localTS - dayMs);\n const oLater = this.zone.offset(localTS + dayMs);\n\n const o1 = this.zone.offset(localTS - oEarlier * minuteMs);\n const o2 = this.zone.offset(localTS - oLater * minuteMs);\n if (o1 === o2) {\n return [this];\n }\n const ts1 = localTS - o1 * minuteMs;\n const ts2 = localTS - o2 * minuteMs;\n const c1 = tsToObj(ts1, o1);\n const c2 = tsToObj(ts2, o2);\n if (\n c1.hour === c2.hour &&\n c1.minute === c2.minute &&\n c1.second === c2.second &&\n c1.millisecond === c2.millisecond\n ) {\n return [clone(this, { ts: ts1 }), clone(this, { ts: ts2 })];\n }\n return [this];\n }\n\n /**\n * Returns true if this DateTime is in a leap year, false otherwise\n * @example DateTime.local(2016).isInLeapYear //=> true\n * @example DateTime.local(2013).isInLeapYear //=> false\n * @type {boolean}\n */\n get isInLeapYear() {\n return isLeapYear(this.year);\n }\n\n /**\n * Returns the number of days in this DateTime's month\n * @example DateTime.local(2016, 2).daysInMonth //=> 29\n * @example DateTime.local(2016, 3).daysInMonth //=> 31\n * @type {number}\n */\n get daysInMonth() {\n return daysInMonth(this.year, this.month);\n }\n\n /**\n * Returns the number of days in this DateTime's year\n * @example DateTime.local(2016).daysInYear //=> 366\n * @example DateTime.local(2013).daysInYear //=> 365\n * @type {number}\n */\n get daysInYear() {\n return this.isValid ? daysInYear(this.year) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2004).weeksInWeekYear //=> 53\n * @example DateTime.local(2013).weeksInWeekYear //=> 52\n * @type {number}\n */\n get weeksInWeekYear() {\n return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's local week year\n * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52\n * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53\n * @type {number}\n */\n get weeksInLocalWeekYear() {\n return this.isValid\n ? weeksInWeekYear(\n this.localWeekYear,\n this.loc.getMinDaysInFirstWeek(),\n this.loc.getStartOfWeek()\n )\n : NaN;\n }\n\n /**\n * Returns the resolved Intl options for this DateTime.\n * This is useful in understanding the behavior of formatting methods\n * @param {Object} opts - the same options as toLocaleString\n * @return {Object}\n */\n resolvedLocaleOptions(opts = {}) {\n const { locale, numberingSystem, calendar } = Formatter.create(\n this.loc.clone(opts),\n opts\n ).resolvedOptions(this);\n return { locale, numberingSystem, outputCalendar: calendar };\n }\n\n // TRANSFORM\n\n /**\n * \"Set\" the DateTime's zone to UTC. Returns a newly-constructed DateTime.\n *\n * Equivalent to {@link DateTime#setZone}('utc')\n * @param {number} [offset=0] - optionally, an offset from UTC in minutes\n * @param {Object} [opts={}] - options to pass to `setZone()`\n * @return {DateTime}\n */\n toUTC(offset = 0, opts = {}) {\n return this.setZone(FixedOffsetZone.instance(offset), opts);\n }\n\n /**\n * \"Set\" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.\n *\n * Equivalent to `setZone('local')`\n * @return {DateTime}\n */\n toLocal() {\n return this.setZone(Settings.defaultZone);\n }\n\n /**\n * \"Set\" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.\n *\n * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones.\n * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class.\n * @param {Object} opts - options\n * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.\n * @return {DateTime}\n */\n setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {\n zone = normalizeZone(zone, Settings.defaultZone);\n if (zone.equals(this.zone)) {\n return this;\n } else if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n } else {\n let newTS = this.ts;\n if (keepLocalTime || keepCalendarTime) {\n const offsetGuess = zone.offset(this.ts);\n const asObj = this.toObject();\n [newTS] = objToTS(asObj, offsetGuess, zone);\n }\n return clone(this, { ts: newTS, zone });\n }\n }\n\n /**\n * \"Set\" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.\n * @param {Object} properties - the properties to set\n * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })\n * @return {DateTime}\n */\n reconfigure({ locale, numberingSystem, outputCalendar } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });\n return clone(this, { loc });\n }\n\n /**\n * \"Set\" the locale. Returns a newly-constructed DateTime.\n * Just a convenient alias for reconfigure({ locale })\n * @example DateTime.local(2017, 5, 25).setLocale('en-GB')\n * @return {DateTime}\n */\n setLocale(locale) {\n return this.reconfigure({ locale });\n }\n\n /**\n * \"Set\" the values of specified units. Returns a newly-constructed DateTime.\n * You can only set units with this method; for \"setting\" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.\n *\n * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.\n * They cannot be mixed with ISO-week units like `weekday`.\n * @param {Object} values - a mapping of units to numbers\n * @example dt.set({ year: 2017 })\n * @example dt.set({ hour: 8, minute: 30 })\n * @example dt.set({ weekday: 5 })\n * @example dt.set({ year: 2005, ordinal: 234 })\n * @return {DateTime}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);\n const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, this.loc);\n\n const settingWeekStuff =\n !isUndefined(normalized.weekYear) ||\n !isUndefined(normalized.weekNumber) ||\n !isUndefined(normalized.weekday),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber;\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n let mixed;\n if (settingWeekStuff) {\n mixed = weekToGregorian(\n { ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), ...normalized },\n minDaysInFirstWeek,\n startOfWeek\n );\n } else if (!isUndefined(normalized.ordinal)) {\n mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized });\n } else {\n mixed = { ...this.toObject(), ...normalized };\n\n // if we didn't set the day but we ended up on an overflow date,\n // use the last day of the right month\n if (isUndefined(normalized.day)) {\n mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);\n }\n }\n\n const [ts, o] = objToTS(mixed, this.o, this.zone);\n return clone(this, { ts, o });\n }\n\n /**\n * Add a period of time to this DateTime and return the resulting DateTime\n *\n * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @example DateTime.now().plus(123) //~> in 123 milliseconds\n * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes\n * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow\n * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday\n * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min\n * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min\n * @return {DateTime}\n */\n plus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration);\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * Subtract a period of time to this DateTime and return the resulting DateTime\n * See {@link DateTime#plus}\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n @return {DateTime}\n */\n minus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration).negate();\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * \"Set\" this DateTime to the beginning of a unit of time.\n * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week\n * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'\n * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'\n * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'\n * @return {DateTime}\n */\n startOf(unit, { useLocaleWeeks = false } = {}) {\n if (!this.isValid) return this;\n\n const o = {},\n normalizedUnit = Duration.normalizeUnit(unit);\n switch (normalizedUnit) {\n case \"years\":\n o.month = 1;\n // falls through\n case \"quarters\":\n case \"months\":\n o.day = 1;\n // falls through\n case \"weeks\":\n case \"days\":\n o.hour = 0;\n // falls through\n case \"hours\":\n o.minute = 0;\n // falls through\n case \"minutes\":\n o.second = 0;\n // falls through\n case \"seconds\":\n o.millisecond = 0;\n break;\n case \"milliseconds\":\n break;\n // no default, invalid units throw in normalizeUnit()\n }\n\n if (normalizedUnit === \"weeks\") {\n if (useLocaleWeeks) {\n const startOfWeek = this.loc.getStartOfWeek();\n const { weekday } = this;\n if (weekday < startOfWeek) {\n o.weekNumber = this.weekNumber - 1;\n }\n o.weekday = startOfWeek;\n } else {\n o.weekday = 1;\n }\n }\n\n if (normalizedUnit === \"quarters\") {\n const q = Math.ceil(this.month / 3);\n o.month = (q - 1) * 3 + 1;\n }\n\n return this.set(o);\n }\n\n /**\n * \"Set\" this DateTime to the end (meaning the last millisecond) of a unit of time\n * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week\n * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'\n * @return {DateTime}\n */\n endOf(unit, opts) {\n return this.isValid\n ? this.plus({ [unit]: 1 })\n .startOf(unit, opts)\n .minus(1)\n : this;\n }\n\n // OUTPUT\n\n /**\n * Returns a string representation of this DateTime formatted according to the specified format string.\n * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens).\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @param {string} fmt - the format string\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22'\n * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'\n * @example DateTime.now().toFormat('yyyy LLL dd', { locale: \"fr\" }) //=> '2017 avr. 22'\n * @example DateTime.now().toFormat(\"HH 'hours and' mm 'minutes'\") //=> '20 hours and 55 minutes'\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.\n * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation\n * of the DateTime in the assigned locale.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toLocaleString(); //=> 4/20/2017\n * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'\n * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'\n * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022'\n * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'\n * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'\n * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'\n * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'\n * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32'\n * @return {string}\n */\n toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this)\n : INVALID;\n }\n\n /**\n * Returns an array of format \"parts\", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts\n * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.\n * @example DateTime.now().toLocaleParts(); //=> [\n * //=> { type: 'day', value: '25' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'month', value: '05' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'year', value: '1982' }\n * //=> ]\n */\n toLocaleParts(opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this)\n : [];\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.extendedZone=false] - add the time zone format extension\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.\n * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'\n * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'\n * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'\n * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'\n * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z'\n * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z'\n * @return {string|null}\n */\n toISO({\n format = \"extended\",\n suppressSeconds = false,\n suppressMilliseconds = false,\n includeOffset = true,\n extendedZone = false,\n precision = \"milliseconds\",\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n precision = normalizeUnit(precision);\n const ext = format === \"extended\";\n\n let c = toISODate(this, ext, precision);\n if (orderedUnits.indexOf(precision) >= 3) c += \"T\";\n c += toISOTime(\n this,\n ext,\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n );\n return c;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's date component\n * @param {Object} opts - options\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'.\n * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'\n * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'\n * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05'\n * @return {string|null}\n */\n toISODate({ format = \"extended\", precision = \"day\" } = {}) {\n if (!this.isValid) {\n return null;\n }\n return toISODate(this, format === \"extended\", normalizeUnit(precision));\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's week date\n * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'\n * @return {string}\n */\n toISOWeekDate() {\n return toTechFormat(this, \"kkkk-'W'WW-c\");\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's time component\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.extendedZone=true] - add the time zone format extension\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z'\n * @return {string}\n */\n toISOTime({\n suppressMilliseconds = false,\n suppressSeconds = false,\n includeOffset = true,\n includePrefix = false,\n extendedZone = false,\n format = \"extended\",\n precision = \"milliseconds\",\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n precision = normalizeUnit(precision);\n let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? \"T\" : \"\";\n return (\n c +\n toISOTime(\n this,\n format === \"extended\",\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n )\n );\n }\n\n /**\n * Returns an RFC 2822-compatible string representation of this DateTime\n * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'\n * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'\n * @return {string}\n */\n toRFC2822() {\n return toTechFormat(this, \"EEE, dd LLL yyyy HH:mm:ss ZZZ\", false);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.\n * Specifically, the string conforms to RFC 1123.\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'\n * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'\n * @return {string}\n */\n toHTTP() {\n return toTechFormat(this.toUTC(), \"EEE, dd LLL yyyy HH:mm:ss 'GMT'\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Date\n * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'\n * @return {string|null}\n */\n toSQLDate() {\n if (!this.isValid) {\n return null;\n }\n return toISODate(this, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Time\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'\n * @example DateTime.utc().toSQL() //=> '05:15:16.345'\n * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00'\n * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345'\n * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'\n * @return {string}\n */\n toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) {\n let fmt = \"HH:mm:ss.SSS\";\n\n if (includeZone || includeOffset) {\n if (includeOffsetSpace) {\n fmt += \" \";\n }\n if (includeZone) {\n fmt += \"z\";\n } else if (includeOffset) {\n fmt += \"ZZ\";\n }\n }\n\n return toTechFormat(this, fmt, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'\n * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'\n * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'\n * @return {string}\n */\n toSQL(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for debugging\n * @return {string}\n */\n toString() {\n return this.isValid ? this.toISO() : INVALID;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;\n } else {\n return `DateTime { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime.\n * @return {number}\n */\n toMillis() {\n return this.isValid ? this.ts : NaN;\n }\n\n /**\n * Returns the epoch seconds (including milliseconds in the fractional part) of this DateTime.\n * @return {number}\n */\n toSeconds() {\n return this.isValid ? this.ts / 1000 : NaN;\n }\n\n /**\n * Returns the epoch seconds (as a whole number) of this DateTime.\n * @return {number}\n */\n toUnixInteger() {\n return this.isValid ? Math.floor(this.ts / 1000) : NaN;\n }\n\n /**\n * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns a BSON serializable equivalent to this DateTime.\n * @return {Date}\n */\n toBSON() {\n return this.toJSDate();\n }\n\n /**\n * Returns a JavaScript object with this DateTime's year, month, day, and so on.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = { ...this.c };\n\n if (opts.includeConfig) {\n base.outputCalendar = this.outputCalendar;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns a JavaScript Date equivalent to this DateTime.\n * @return {Date}\n */\n toJSDate() {\n return new Date(this.isValid ? this.ts : NaN);\n }\n\n // COMPARE\n\n /**\n * Return the difference between two DateTimes as a Duration.\n * @param {DateTime} otherDateTime - the DateTime to compare this one to\n * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example\n * var i1 = DateTime.fromISO('1982-05-25T09:45'),\n * i2 = DateTime.fromISO('1983-10-14T10:30');\n * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\n * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\n * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\n * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n * @return {Duration}\n */\n diff(otherDateTime, unit = \"milliseconds\", opts = {}) {\n if (!this.isValid || !otherDateTime.isValid) {\n return Duration.invalid(\"created by diffing an invalid DateTime\");\n }\n\n const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts };\n\n const units = maybeArray(unit).map(Duration.normalizeUnit),\n otherIsLater = otherDateTime.valueOf() > this.valueOf(),\n earlier = otherIsLater ? this : otherDateTime,\n later = otherIsLater ? otherDateTime : this,\n diffed = diff(earlier, later, units, durOpts);\n\n return otherIsLater ? diffed.negate() : diffed;\n }\n\n /**\n * Return the difference between this DateTime and right now.\n * See {@link DateTime#diff}\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n diffNow(unit = \"milliseconds\", opts = {}) {\n return this.diff(DateTime.now(), unit, opts);\n }\n\n /**\n * Return an Interval spanning between this DateTime and another DateTime\n * @param {DateTime} otherDateTime - the other end point of the Interval\n * @return {Interval|DateTime}\n */\n until(otherDateTime) {\n return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;\n }\n\n /**\n * Return whether this DateTime is in the same unit of time as another DateTime.\n * Higher-order units must also be identical for this function to return `true`.\n * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.\n * @param {DateTime} otherDateTime - the other DateTime\n * @param {string} unit - the unit of time to check sameness on\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used\n * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day\n * @return {boolean}\n */\n hasSame(otherDateTime, unit, opts) {\n if (!this.isValid) return false;\n\n const inputMs = otherDateTime.valueOf();\n const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true });\n return (\n adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts)\n );\n }\n\n /**\n * Equality check\n * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid.\n * To compare just the millisecond values, use `+dt1 === +dt2`.\n * @param {DateTime} other - the other DateTime\n * @return {boolean}\n */\n equals(other) {\n return (\n this.isValid &&\n other.isValid &&\n this.valueOf() === other.valueOf() &&\n this.zone.equals(other.zone) &&\n this.loc.equals(other.loc)\n );\n }\n\n /**\n * Returns a string representation of a this time relative to now, such as \"in two days\". Can only internationalize if your\n * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} [options.style=\"long\"] - the style of units, must be \"long\", \"short\", or \"narrow\"\n * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of \"years\", \"quarters\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", or \"seconds\"\n * @param {boolean} [options.round=true] - whether to round the numbers in the output.\n * @param {string} [options.rounding=\"trunc\"] - rounding method to use when rounding the numbers in the output. Can be \"trunc\" (toward zero), \"expand\" (away from zero), \"round\", \"floor\", or \"ceil\".\n * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelative() //=> \"in 1 day\"\n * @example DateTime.now().setLocale(\"es\").toRelative({ days: 1 }) //=> \"dentro de 1 día\"\n * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: \"fr\" }) //=> \"dans 23 heures\"\n * @example DateTime.now().minus({ days: 2 }).toRelative() //=> \"2 days ago\"\n * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: \"hours\" }) //=> \"48 hours ago\"\n * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> \"1.5 days ago\"\n */\n toRelative(options = {}) {\n if (!this.isValid) return null;\n const base = options.base || DateTime.fromObject({}, { zone: this.zone }),\n padding = options.padding ? (this < base ? -options.padding : options.padding) : 0;\n let units = [\"years\", \"months\", \"days\", \"hours\", \"minutes\", \"seconds\"];\n let unit = options.unit;\n if (Array.isArray(options.unit)) {\n units = options.unit;\n unit = undefined;\n }\n return diffRelative(base, this.plus(padding), {\n ...options,\n numeric: \"always\",\n units,\n unit,\n });\n }\n\n /**\n * Returns a string representation of this date relative to today, such as \"yesterday\" or \"next month\".\n * Only internationalizes on platforms that supports Intl.RelativeTimeFormat.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", or \"days\"\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> \"tomorrow\"\n * @example DateTime.now().setLocale(\"es\").plus({ days: 1 }).toRelative() //=> \"\"mañana\"\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: \"fr\" }) //=> \"demain\"\n * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> \"2 days ago\"\n */\n toRelativeCalendar(options = {}) {\n if (!this.isValid) return null;\n\n return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, {\n ...options,\n numeric: \"auto\",\n units: [\"years\", \"months\", \"days\"],\n calendary: true,\n });\n }\n\n /**\n * Return the min of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum\n * @return {DateTime} the min DateTime, or undefined if called with no argument\n */\n static min(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"min requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.min);\n }\n\n /**\n * Return the max of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum\n * @return {DateTime} the max DateTime, or undefined if called with no argument\n */\n static max(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"max requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.max);\n }\n\n // MISC\n\n /**\n * Explain how a string would be parsed by fromFormat()\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see description)\n * @param {Object} options - options taken by fromFormat()\n * @return {Object}\n */\n static fromFormatExplain(text, fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n return explainFromTokens(localeToUse, text, fmt);\n }\n\n /**\n * @deprecated use fromFormatExplain instead\n */\n static fromStringExplain(text, fmt, options = {}) {\n return DateTime.fromFormatExplain(text, fmt, options);\n }\n\n /**\n * Build a parser for `fmt` using the given locale. This parser can be passed\n * to {@link DateTime.fromFormatParser} to a parse a date in this format. This\n * can be used to optimize cases where many dates need to be parsed in a\n * specific format.\n *\n * @param {String} fmt - the format the string is expected to be in (see\n * description)\n * @param {Object} options - options used to set locale and numberingSystem\n * for parser\n * @returns {TokenParser} - opaque object to be used\n */\n static buildFormatParser(fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n return new TokenParser(localeToUse, fmt);\n }\n\n /**\n * Create a DateTime from an input string and format parser.\n *\n * The format parser must have been created with the same locale as this call.\n *\n * @param {String} text - the string to parse\n * @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser}\n * @param {Object} opts - options taken by fromFormat()\n * @returns {DateTime}\n */\n static fromFormatParser(text, formatParser, opts = {}) {\n if (isUndefined(text) || isUndefined(formatParser)) {\n throw new InvalidArgumentError(\n \"fromFormatParser requires an input string and a format parser\"\n );\n }\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n\n if (!localeToUse.equals(formatParser.locale)) {\n throw new InvalidArgumentError(\n `fromFormatParser called with a locale of ${localeToUse}, ` +\n `but the format parser was created for ${formatParser.locale}`\n );\n }\n\n const { result, zone, specificOffset, invalidReason } = formatParser.explainFromTokens(text);\n\n if (invalidReason) {\n return DateTime.invalid(invalidReason);\n } else {\n return parseDataToDateTime(\n result,\n zone,\n opts,\n `format ${formatParser.format}`,\n text,\n specificOffset\n );\n }\n }\n\n // FORMAT PRESETS\n\n /**\n * {@link DateTime#toLocaleString} format like 10/14/1983\n * @type {Object}\n */\n static get DATE_SHORT() {\n return Formats.DATE_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED() {\n return Formats.DATE_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED_WITH_WEEKDAY() {\n return Formats.DATE_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983'\n * @type {Object}\n */\n static get DATE_FULL() {\n return Formats.DATE_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983'\n * @type {Object}\n */\n static get DATE_HUGE() {\n return Formats.DATE_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_SIMPLE() {\n return Formats.TIME_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SECONDS() {\n return Formats.TIME_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SHORT_OFFSET() {\n return Formats.TIME_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_LONG_OFFSET() {\n return Formats.TIME_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_SIMPLE() {\n return Formats.TIME_24_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SECONDS() {\n return Formats.TIME_24_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SHORT_OFFSET() {\n return Formats.TIME_24_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_LONG_OFFSET() {\n return Formats.TIME_24_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT() {\n return Formats.DATETIME_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT_WITH_SECONDS() {\n return Formats.DATETIME_SHORT_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED() {\n return Formats.DATETIME_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_SECONDS() {\n return Formats.DATETIME_MED_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_WEEKDAY() {\n return Formats.DATETIME_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL() {\n return Formats.DATETIME_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL_WITH_SECONDS() {\n return Formats.DATETIME_FULL_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE() {\n return Formats.DATETIME_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE_WITH_SECONDS() {\n return Formats.DATETIME_HUGE_WITH_SECONDS;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDateTime(dateTimeish) {\n if (DateTime.isDateTime(dateTimeish)) {\n return dateTimeish;\n } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {\n return DateTime.fromJSDate(dateTimeish);\n } else if (dateTimeish && typeof dateTimeish === \"object\") {\n return DateTime.fromObject(dateTimeish);\n } else {\n throw new InvalidArgumentError(\n `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`\n );\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Duration from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Info from \"./info.js\";\nimport Zone from \"./zone.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport InvalidZone from \"./zones/invalidZone.js\";\nimport SystemZone from \"./zones/systemZone.js\";\nimport Settings from \"./settings.js\";\n\nconst VERSION = \"3.7.2\";\n\nexport {\n VERSION,\n DateTime,\n Duration,\n Interval,\n Info,\n Zone,\n FixedOffsetZone,\n IANAZone,\n InvalidZone,\n SystemZone,\n Settings,\n};\n"],"names":["LuxonError","_Error","_inheritsLoose","apply","arguments","_wrapNativeSuper","Error","InvalidDateTimeError","_LuxonError","reason","call","toMessage","InvalidIntervalError","_LuxonError2","InvalidDurationError","_LuxonError3","ConflictingSpecificationError","_LuxonError4","InvalidUnitError","_LuxonError5","unit","InvalidArgumentError","_LuxonError6","ZoneIsAbstractError","_LuxonError7","n","s","l","DATE_SHORT","year","month","day","DATE_MED","DATE_MED_WITH_WEEKDAY","weekday","DATE_FULL","DATE_HUGE","TIME_SIMPLE","hour","minute","TIME_WITH_SECONDS","second","TIME_WITH_SHORT_OFFSET","timeZoneName","TIME_WITH_LONG_OFFSET","TIME_24_SIMPLE","hourCycle","TIME_24_WITH_SECONDS","TIME_24_WITH_SHORT_OFFSET","TIME_24_WITH_LONG_OFFSET","DATETIME_SHORT","DATETIME_SHORT_WITH_SECONDS","DATETIME_MED","DATETIME_MED_WITH_SECONDS","DATETIME_MED_WITH_WEEKDAY","DATETIME_FULL","DATETIME_FULL_WITH_SECONDS","DATETIME_HUGE","DATETIME_HUGE_WITH_SECONDS","Zone","_proto","prototype","offsetName","ts","opts","formatOffset","format","offset","equals","otherZone","_createClass","key","get","name","singleton","SystemZone","_Zone","_ref","locale","parseZoneInfo","Date","getTimezoneOffset","type","Intl","DateTimeFormat","resolvedOptions","timeZone","dtfCache","Map","makeDTF","zoneName","dtf","undefined","hour12","era","set","typeToPos","hackyOffset","date","formatted","replace","parsed","exec","fMonth","fDay","fYear","fadOrBc","fHour","fMinute","fSecond","partsOffset","formatToParts","filled","i","length","_formatted$i","value","pos","isUndefined","parseInt","ianaZoneCache","IANAZone","create","zone","resetCache","clear","isValidSpecifier","isValidZone","e","_this","valid","NaN","isNaN","_ref2","adOrBc","Math","abs","adjustedHour","asUTC","objToLocalTS","millisecond","asTS","over","intlLFCache","getCachedLF","locString","JSON","stringify","ListFormat","intlDTCache","getCachedDTF","intlNumCache","getCachedINF","inf","NumberFormat","intlRelCache","getCachedRTF","_opts","base","cacheKeyOpts","_objectWithoutPropertiesLoose","_excluded","RelativeTimeFormat","sysLocaleCache","systemLocale","intlResolvedOptionsCache","getCachedIntResolvedOptions","weekInfoCache","getCachedWeekInfo","data","Locale","getWeekInfo","weekInfo","_extends","fallbackWeekSettings","parseLocaleString","localeStr","xIndex","indexOf","substring","uIndex","options","selectedStr","smaller","_options","numberingSystem","calendar","intlConfigString","outputCalendar","includes","mapMonths","f","ms","dt","DateTime","utc","push","mapWeekdays","listStuff","loc","englishFn","intlFn","mode","listingMode","supportsFastNumbers","startsWith","PolyNumberFormatter","intl","forceSimple","padTo","floor","otherOpts","_excluded2","Object","keys","intlOpts","useGrouping","minimumIntegerDigits","fixed","roundTo","padStart","PolyDateFormatter","originalZone","z","gmtOffset","offsetZ","setZone","plus","minutes","_proto2","map","join","toJSDate","parts","part","PolyRelFormatter","isEnglish","style","hasRelative","rtf","_proto3","count","English","numeric","firstDay","minimalDays","weekend","fromOpts","weekSettings","defaultToEN","specifiedLocale","Settings","defaultLocale","localeR","numberingSystemR","defaultNumberingSystem","outputCalendarR","defaultOutputCalendar","weekSettingsR","validateWeekSettings","defaultWeekSettings","fromObject","_temp","numbering","_parseLocaleString","parsedLocale","parsedNumberingSystem","parsedOutputCalendar","weekdaysCache","standalone","monthsCache","meridiemCache","eraCache","fastNumbersCached","_proto4","isActuallyEn","hasNoWeirdness","clone","alts","getOwnPropertyNames","redefaultToEN","redefaultToSystem","months","_this2","monthSpecialCase","formatStr","mapper","extract","dtFormatter","weekdays","_this3","meridiems","_this4","eras","_this5","field","df","results","matching","find","m","toLowerCase","numberFormatter","fastNumbers","relFormatter","listFormatter","getWeekSettings","hasLocaleWeekInfo","getStartOfWeek","getMinDaysInFirstWeek","getWeekendDays","other","toString","FixedOffsetZone","instance","utcInstance","parseSpecifier","r","match","signedOffset","InvalidZone","normalizeZone","input","defaultZone","isString","lowered","isNumber","numberingSystems","arab","arabext","bali","beng","deva","fullwide","gujr","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","latn","numberingSystemsUTF16","hanidecChars","split","parseDigits","str","code","charCodeAt","search","_numberingSystemsUTF","min","max","digitRegexCache","resetDigitRegexCache","digitRegex","append","ns","appendCache","regex","RegExp","now","twoDigitCutoffYear","throwOnInvalid","resetCaches","cutoffYear","t","Invalid","explanation","nonLeapLadder","leapLadder","unitOutOfRange","dayOfWeek","d","UTC","setUTCFullYear","getUTCFullYear","js","getUTCDay","computeOrdinal","isLeapYear","uncomputeOrdinal","ordinal","table","month0","findIndex","isoWeekdayToLocal","isoWeekday","startOfWeek","gregorianToWeek","gregObj","minDaysInFirstWeek","weekNumber","weekYear","weeksInWeekYear","timeObject","weekToGregorian","weekData","weekdayOfJan4","yearInDays","daysInYear","_uncomputeOrdinal","gregorianToOrdinal","gregData","ordinalToGregorian","ordinalData","_uncomputeOrdinal2","usesLocalWeekValues","obj","hasLocaleWeekData","localWeekday","localWeekNumber","localWeekYear","hasIsoWeekData","hasInvalidWeekData","validYear","isInteger","validWeek","integerBetween","validWeekday","hasInvalidOrdinalData","validOrdinal","hasInvalidGregorianData","validMonth","validDay","daysInMonth","hasInvalidTimeData","validHour","validMinute","validSecond","validMillisecond","o","isDate","maybeArray","thing","Array","isArray","bestBy","arr","by","compare","reduce","best","next","pair","pick","a","k","hasOwnProperty","prop","settings","some","v","from","bottom","top","floorMod","x","isNeg","padded","parseInteger","string","parseFloating","parseFloat","parseMillis","fraction","number","digits","rounding","factor","pow","ceil","trunc","round","RangeError","modMonth","modYear","firstWeekOffset","fwdlw","weekOffset","weekOffsetNext","untruncateYear","offsetFormat","modified","offHourStr","offMinuteStr","offHour","Number","offMin","offMinSigned","is","asNumber","numericValue","isFinite","normalizeObject","normalizer","normalized","u","hours","sign","monthsLong","monthsShort","monthsNarrow","concat","weekdaysLong","weekdaysShort","weekdaysNarrow","erasLong","erasShort","erasNarrow","meridiemForDateTime","weekdayForDateTime","monthForDateTime","eraForDateTime","formatRelativeTime","narrow","units","years","quarters","weeks","days","seconds","lastable","isDay","isInPast","fmtValue","singular","lilUnits","fmtUnit","stringifyTokens","splits","tokenToString","_iterator","_createForOfIteratorHelperLoose","_step","done","token","literal","val","macroTokenToFormatOpts","D","Formats","DD","DDD","DDDD","tt","ttt","tttt","T","TT","TTT","TTTT","ff","fff","ffff","F","FF","FFF","FFFF","Formatter","parseFormat","fmt","current","currentFull","bracketed","c","charAt","test","formatOpts","systemLoc","formatWithSystemDefault","formatDateTime","formatDateTimeParts","formatInterval","interval","start","formatRange","end","num","p","signDisplay","formatDateTimeFromString","knownEnglish","useDateTimeFormatter","isOffsetFixed","allowZ","isValid","meridiem","maybeMacro","slice","quarter","formatDurationFromString","dur","invertLargest","signMode","tokenToField","lildur","info","mapped","inversionFactor","isNegativeDuration","largestUnit","tokens","realTokens","found","collapsed","shiftTo","filter","durationInfo","values","ianaRegex","combineRegexes","_len","regexes","_key","full","source","combineExtractors","_len2","extractors","_key2","ex","mergedVals","mergedZone","cursor","_ex","parse","_len3","patterns","_key3","_i","_patterns","_patterns$_i","extractor","simpleParse","_len4","_key4","ret","offsetRegex","isoExtendedZone","isoTimeBaseRegex","isoTimeRegex","isoTimeExtensionRegex","isoYmdRegex","isoWeekRegex","isoOrdinalRegex","extractISOWeekData","extractISOOrdinalData","sqlYmdRegex","sqlTimeRegex","sqlTimeExtensionRegex","int","fallback","extractISOYmd","item","extractISOTime","milliseconds","extractISOOffset","local","fullOffset","extractIANAZone","isoTimeOnly","isoDuration","extractISODuration","yearStr","monthStr","weekStr","dayStr","hourStr","minuteStr","secondStr","millisecondsStr","hasNegativePrefix","negativeSeconds","maybeNegate","force","obsOffsets","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","fromStrings","weekdayStr","result","rfc2822","extractRFC2822","obsOffset","milOffset","preprocessRFC2822","trim","rfc1123","rfc850","ascii","extractRFC1123Or850","extractASCII","isoYmdWithTimeExtensionRegex","isoWeekWithTimeExtensionRegex","isoOrdinalWithTimeExtensionRegex","isoTimeCombinedRegex","extractISOYmdTimeAndOffset","extractISOWeekTimeAndOffset","extractISOOrdinalDateAndTime","extractISOTimeAndOffset","parseISODate","parseRFC2822Date","parseHTTPDate","parseISODuration","extractISOTimeOnly","parseISOTimeOnly","sqlYmdWithTimeExtensionRegex","sqlTimeCombinedRegex","extractISOTimeOffsetAndIANAZone","parseSQL","INVALID","lowOrderMatrix","casualMatrix","daysInYearAccurate","daysInMonthAccurate","accurateMatrix","orderedUnits","reverseUnits","reverse","conf","conversionAccuracy","matrix","Duration","durationToMillis","vals","_vals$milliseconds","sum","normalizeValues","reduceRight","previous","previousVal","conv","rollUp","removeZeroes","newVals","_Object$entries","entries","_Object$entries$_i","_Symbol$for","config","accurate","invalid","isLuxonDuration","fromMillis","normalizeUnit","fromDurationLike","durationLike","isDuration","fromISO","text","_parseISODuration","fromISOTime","_parseISOTimeOnly","week","toFormat","fmtOpts","toHuman","showZeros","unitDisplay","listStyle","toObject","toISO","toISOTime","millis","toMillis","suppressMilliseconds","suppressSeconds","includePrefix","includeOffset","dateTime","toJSON","invalidReason","valueOf","duration","_i2","_orderedUnits","minus","negate","mapUnits","fn","_i3","_Object$keys","mixed","reconfigure","as","normalize","rescale","shiftToAll","built","accumulated","lastUnit","_i4","_orderedUnits2","own","ak","negated","_i5","_Object$keys2","removeZeros","eq","v1","v2","_i6","_orderedUnits3","Symbol","for","validateStartEnd","Interval","isLuxonInterval","fromDateTimes","builtStart","friendlyDateTime","builtEnd","validateError","after","before","_split","startIsValid","endIsValid","isInterval","toDuration","startOf","useLocaleWeeks","diff","hasSame","isEmpty","isAfter","isBefore","contains","splitAt","dateTimes","sorted","sort","b","added","splitBy","idx","divideEqually","numberOfParts","overlaps","abutsStart","abutsEnd","engulfs","intersection","union","merge","intervals","_intervals$sort$reduc","sofar","final","xor","_Array$prototype","currentCount","ends","time","flattened","difference","toLocaleString","toISODate","dateFormat","_temp2","_ref3","_ref3$separator","separator","mapEndpoints","mapFn","Info","hasDST","proto","isUniversal","isValidIANAZone","_ref$locale","_ref$locObj","locObj","getMinimumDaysInFirstWeek","_ref2$locale","_ref2$locObj","getWeekendWeekdays","_temp3","_ref3$locale","_ref3$locObj","_temp4","_ref4","_ref4$locale","_ref4$numberingSystem","_ref4$locObj","_ref4$outputCalendar","monthsFormat","_temp5","_ref5","_ref5$locale","_ref5$numberingSystem","_ref5$locObj","_ref5$outputCalendar","_temp6","_ref6","_ref6$locale","_ref6$numberingSystem","_ref6$locObj","weekdaysFormat","_temp7","_ref7","_ref7$locale","_ref7$numberingSystem","_ref7$locObj","_temp8","_ref8","_ref8$locale","_temp9","_ref9","_ref9$locale","features","relative","localeWeek","dayDiff","earlier","later","utcDayStart","toUTC","keepLocalTime","highOrderDiffs","differs","lowestOrder","highWater","_differs","_differs$_i","differ","_highOrderDiffs","remainingMillis","lowerOrderUnits","_cursor$plus","_Duration$fromMillis","MISSING_FTP","intUnit","post","deser","NBSP","String","fromCharCode","spaceOrNBSP","spaceOrNBSPRegExp","fixListRegex","stripInsensitivities","oneOf","strings","startIndex","groups","h","simple","escapeToken","unitForToken","one","two","three","four","six","oneOrTwo","oneToThree","oneToSix","oneToNine","twoToFour","fourToSix","unitate","partTypeStyleToTokenVal","short","long","dayperiod","dayPeriod","hour24","tokenForPart","resolvedOpts","isSpace","actualType","buildRegex","re","handlers","matches","all","matchIndex","dateTimeFromMatches","toField","specificOffset","Z","q","M","G","y","S","dummyDateTimeCache","getDummyDateTime","maybeExpandMacroToken","formatOptsToTokens","expandMacroTokens","TokenParser","disqualifyingUnit","_buildRegex","regexString","explainFromTokens","_match","rawMatches","parser","parseFromTokens","_explainFromTokens","formatter","MAX_DATE","unsupportedZone","possiblyCachedWeekData","possiblyCachedLocalWeekData","localWeekData","inst","old","fixOffset","localTS","tz","utcGuess","o2","o3","tsToObj","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","objToTS","adjustTime","oPre","millisToAdd","_fixOffset","parseDataToDateTime","parsedZone","interpretationZone","toTechFormat","extended","precision","longFormat","extendedZone","showSeconds","ianaName","defaultUnitValues","defaultWeekUnitValues","defaultOrdinalUnitValues","orderedWeekUnits","orderedOrdinalUnits","weeknumber","weeksnumber","weeknumbers","weekyear","weekyears","normalizeUnitWithLocalWeeks","guessOffsetForZone","zoneOffsetTs","offsetGuess","zoneOffsetGuessCache","quickDT","offsetProvis","_objToTS","diffRelative","calendary","lastOpts","argList","args","unchanged","ot","_zone","isLuxonDateTime","_lastOpts","_lastOpts2","fromJSDate","zoneToUse","fromSeconds","_usesLocalWeekValues","tsNow","containsOrdinal","containsGregorYear","containsGregorMD","containsGregor","definiteWeekDef","useWeekData","defaultValues","objNow","foundFirst","_iterator2","_step2","higherOrderInvalid","gregorian","_objToTS2","tsFinal","offsetFinal","_parseISODate","fromRFC2822","_parseRFC2822Date","fromHTTP","_parseHTTPDate","fromFormat","_opts$locale","_opts$numberingSystem","localeToUse","_parseFromTokens","fromString","fromSQL","_parseSQL","isDateTime","parseFormatForOpts","localeOpts","tokenList","expandFormat","expanded","getPossibleOffsets","dayMs","minuteMs","oEarlier","oLater","o1","ts1","ts2","c1","c2","resolvedLocaleOptions","_Formatter$create$res","toLocal","_ref2$keepLocalTime","_ref2$keepCalendarTim","keepCalendarTime","newTS","asObj","_objToTS3","setLocale","_usesLocalWeekValues2","settingWeekStuff","_objToTS4","_ref4$useLocaleWeeks","normalizedUnit","endOf","_this$plus","toLocaleParts","_ref5$format","_ref5$suppressSeconds","_ref5$suppressMillise","_ref5$includeOffset","_ref5$extendedZone","_ref5$precision","ext","_ref6$format","_ref6$precision","toISOWeekDate","_ref7$suppressMillise","_ref7$suppressSeconds","_ref7$includeOffset","_ref7$includePrefix","_ref7$extendedZone","_ref7$format","_ref7$precision","toRFC2822","toHTTP","toSQLDate","toSQLTime","_ref8$includeOffset","_ref8$includeZone","includeZone","_ref8$includeOffsetSp","includeOffsetSpace","toSQL","toSeconds","toUnixInteger","toBSON","includeConfig","otherDateTime","durOpts","otherIsLater","diffed","diffNow","until","inputMs","adjustedToZone","toRelative","padding","toRelativeCalendar","every","fromFormatExplain","_options$locale","_options$numberingSys","fromStringExplain","buildFormatParser","_options2","_options2$locale","_options2$numberingSy","fromFormatParser","formatParser","_opts2","_opts2$locale","_opts2$numberingSyste","_formatParser$explain","dateTimeish","VERSION"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EAEA;EACA;EACA;EAFA,IAGMA,UAAU,0BAAAC,MAAA,EAAA;IAAAC,cAAA,CAAAF,UAAA,EAAAC,MAAA,CAAA,CAAA;EAAA,EAAA,SAAAD,UAAA,GAAA;EAAA,IAAA,OAAAC,MAAA,CAAAE,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA,IAAA,IAAA,CAAA;EAAA,GAAA;EAAA,EAAA,OAAAJ,UAAA,CAAA;EAAA,CAAAK,eAAAA,gBAAA,CAASC,KAAK,CAAA,CAAA,CAAA;EAE9B;EACA;EACA;EACaC,IAAAA,oBAAoB,0BAAAC,WAAA,EAAA;IAAAN,cAAA,CAAAK,oBAAA,EAAAC,WAAA,CAAA,CAAA;IAC/B,SAAAD,oBAAAA,CAAYE,MAAM,EAAE;MAAA,OAClBD,WAAA,CAAAE,IAAA,CAAA,IAAA,EAAA,oBAAA,GAA2BD,MAAM,CAACE,SAAS,EAAI,CAAC,IAAA,IAAA,CAAA;EAClD,GAAA;EAAC,EAAA,OAAAJ,oBAAA,CAAA;EAAA,CAAA,CAHuCP,UAAU,CAAA,CAAA;;EAMpD;EACA;EACA;EACaY,IAAAA,oBAAoB,0BAAAC,YAAA,EAAA;IAAAX,cAAA,CAAAU,o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IA,WAAW,CAACra,OAAO,IAAI7c,QAAQ,CAACk3B,WAAW,CAACra,OAAO,EAAE,CAAC,EAAE;EAChF,IAAA,OAAOjlB,QAAQ,CAACy3B,UAAU,CAAC6H,WAAW,CAAC,CAAA;KACxC,MAAM,IAAIA,WAAW,IAAI,OAAOA,WAAW,KAAK,QAAQ,EAAE;EACzD,IAAA,OAAOt/B,QAAQ,CAACmE,UAAU,CAACm7B,WAAW,CAAC,CAAA;EACzC,GAAC,MAAM;EACL,IAAA,MAAM,IAAInqC,oBAAoB,CAAA,6BAAA,GACEmqC,WAAW,GAAa,YAAA,GAAA,OAAOA,WAC/D,CAAC,CAAA;EACH,GAAA;EACF;;AC/hFMC,MAAAA,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/luxon/build/global/luxon.min.js b/node_modules/luxon/build/global/luxon.min.js new file mode 100644 index 00000000..9b013034 --- /dev/null +++ b/node_modules/luxon/build/global/luxon.min.js @@ -0,0 +1 @@ +var luxon=function(e){"use strict";function L(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var t=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t}(q(Error)),P=function(t){function e(e){return t.call(this,"Invalid DateTime: "+e.toMessage())||this}return o(e,t),e}(t),Y=function(t){function e(e){return t.call(this,"Invalid Interval: "+e.toMessage())||this}return o(e,t),e}(t),H=function(t){function e(e){return t.call(this,"Invalid Duration: "+e.toMessage())||this}return o(e,t),e}(t),w=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t}(t),J=function(t){function e(e){return t.call(this,"Invalid unit "+e)||this}return o(e,t),e}(t),u=function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t}(t),n=function(e){function t(){return e.call(this,"Zone is an abstract class")||this}return o(t,e),t}(t),t="numeric",r="short",a="long",G={year:t,month:t,day:t},$={year:t,month:r,day:t},B={year:t,month:r,day:t,weekday:r},Q={year:t,month:a,day:t},K={year:t,month:a,day:t,weekday:a},X={hour:t,minute:t},ee={hour:t,minute:t,second:t},te={hour:t,minute:t,second:t,timeZoneName:r},ne={hour:t,minute:t,second:t,timeZoneName:a},re={hour:t,minute:t,hourCycle:"h23"},ie={hour:t,minute:t,second:t,hourCycle:"h23"},oe={hour:t,minute:t,second:t,hourCycle:"h23",timeZoneName:r},ae={hour:t,minute:t,second:t,hourCycle:"h23",timeZoneName:a},se={year:t,month:t,day:t,hour:t,minute:t},ue={year:t,month:t,day:t,hour:t,minute:t,second:t},le={year:t,month:r,day:t,hour:t,minute:t},ce={year:t,month:r,day:t,hour:t,minute:t,second:t},fe={year:t,month:r,day:t,weekday:r,hour:t,minute:t},de={year:t,month:a,day:t,hour:t,minute:t,timeZoneName:r},he={year:t,month:a,day:t,hour:t,minute:t,second:t,timeZoneName:r},me={year:t,month:a,day:t,weekday:a,hour:t,minute:t,timeZoneName:a},ye={year:t,month:a,day:t,weekday:a,hour:t,minute:t,second:t,timeZoneName:a},s=function(){function e(){}var t=e.prototype;return t.offsetName=function(e,t){throw new n},t.formatOffset=function(e,t){throw new n},t.offset=function(e){throw new n},t.equals=function(e){throw new n},i(e,[{key:"type",get:function(){throw new n}},{key:"name",get:function(){throw new n}},{key:"ianaName",get:function(){return this.name}},{key:"isUniversal",get:function(){throw new n}},{key:"isValid",get:function(){throw new n}}]),e}(),ve=null,ge=function(e){function t(){return e.apply(this,arguments)||this}o(t,e);var n=t.prototype;return n.offsetName=function(e,t){return Ot(e,t.format,t.locale)},n.formatOffset=function(e,t){return Dt(this.offset(e),t)},n.offset=function(e){return-new Date(e).getTimezoneOffset()},n.equals=function(e){return"system"===e.type},i(t,[{key:"type",get:function(){return"system"}},{key:"name",get:function(){return(new Intl.DateTimeFormat).resolvedOptions().timeZone}},{key:"isUniversal",get:function(){return!1}},{key:"isValid",get:function(){return!0}}],[{key:"instance",get:function(){return ve=null===ve?new t:ve}}]),t}(s),pe=new Map;var ke={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};var we=new Map,c=function(n){function r(e){var t=n.call(this)||this;return t.zoneName=e,t.valid=r.isValidZone(e),t}o(r,n),r.create=function(e){var t=we.get(e);return void 0===t&&we.set(e,t=new r(e)),t},r.resetCache=function(){we.clear(),pe.clear()},r.isValidSpecifier=function(e){return this.isValidZone(e)},r.isValidZone=function(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch(e){return!1}};var e=r.prototype;return e.offsetName=function(e,t){return Ot(e,t.format,t.locale,this.name)},e.formatOffset=function(e,t){return Dt(this.offset(e),t)},e.offset=function(e){var t,n,r,i,o,a,s,u;return!this.valid||(e=new Date(e),isNaN(e))?NaN:(i=this.name,void 0===(o=pe.get(i))&&(o=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),pe.set(i,o)),a=(i=(i=o).formatToParts?function(e,t){for(var n=e.formatToParts(t),r=[],i=0;ibt(i,t,n)?(r=i+1,a=1):r=i,l({weekYear:r,weekNumber:a,weekday:o},It(e))}function it(e,t,n){void 0===n&&(n=1);var r,i=e.weekYear,o=e.weekNumber,a=e.weekday,n=nt(Xe(i,1,t=void 0===t?4:t),n),s=D(i),o=7*o+a-n-7+t,a=(o<1?o+=D(r=i-1):sO.twoDigitCutoffYear?1900+e:2e3+e}function Ot(e,t,n,r){void 0===r&&(r=null);var e=new Date(e),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"},r=(r&&(i.timeZone=r),l({timeZoneName:t},i)),t=new Intl.DateTimeFormat(n,r).formatToParts(e).find(function(e){return"timezonename"===e.type.toLowerCase()});return t?t.value:null}function Tt(e,t){e=parseInt(e,10),Number.isNaN(e)&&(e=0),t=parseInt(t,10)||0;return 60*e+(e<0||Object.is(e,-0)?-t:t)}function Nt(e){var t=Number(e);if("boolean"!=typeof e&&""!==e&&Number.isFinite(t))return t;throw new u("Invalid unit value "+e)}function Mt(e,t){var n,r,i={};for(n in e)h(e,n)&&null!=(r=e[n])&&(i[t(n)]=Nt(r));return i}function Dt(e,t){var n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=0<=e?"+":"-";switch(t){case"short":return i+m(n,2)+":"+m(r,2);case"narrow":return i+n+(0e},t.isBefore=function(e){return!!this.isValid&&this.e<=e},t.contains=function(e){return!!this.isValid&&this.s<=e&&this.e>e},t.set=function(e){var e=void 0===e?{}:e,t=e.start,e=e.end;return this.isValid?l.fromDateTimes(t||this.s,e||this.e):this},t.splitAt=function(){var t=this;if(!this.isValid)return[];for(var e=arguments.length,n=new Array(e),r=0;r+this.e?this.e:u;o.push(l.fromDateTimes(a,u)),a=u,s+=1}return o},t.splitBy=function(e){var t=x.fromDurationLike(e);if(!this.isValid||!t.isValid||0===t.as("milliseconds"))return[];for(var n=this.s,r=1,i=[];n+this.e?this.e:o;i.push(l.fromDateTimes(n,o)),n=o,r+=1}return i},t.divideEqually=function(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]},t.overlaps=function(e){return this.e>e.s&&this.s=e.e},t.equals=function(e){return!(!this.isValid||!e.isValid)&&this.s.equals(e.s)&&this.e.equals(e.e)},t.intersection=function(e){var t;return this.isValid?(t=(this.s>e.s?this:e).s,(e=(this.ee.e?this:e).e,l.fromDateTimes(t,e)):this},l.merge=function(e){var e=e.sort(function(e,t){return e.s-t.s}).reduce(function(e,t){var n=e[0],e=e[1];return e?e.overlaps(t)||e.abutsStart(t)?[n,e.union(t)]:[n.concat([e]),t]:[n,t]},[[],null]),t=e[0],e=e[1];return e&&t.push(e),t},l.xor=function(e){for(var t,n=null,r=0,i=[],e=e.map(function(e){return[{time:e.s,type:"s"},{time:e.e,type:"e"}]}),o=R((t=Array.prototype).concat.apply(t,e).sort(function(e,t){return e.time-t.time}));!(a=o()).done;)var a=a.value,n=1===(r+="s"===a.type?1:-1)?a.time:(n&&+n!=+a.time&&i.push(l.fromDateTimes(n,a.time)),null);return l.merge(i)},t.difference=function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;rthis.valueOf())?this:e,r?e:this,t,n),r?e.negate():e):x.invalid("created by diffing an invalid DateTime")},t.diffNow=function(e,t){return void 0===e&&(e="milliseconds"),void 0===t&&(t={}),this.diff(k.now(),e,t)},t.until=function(e){return this.isValid?Zn.fromDateTimes(this,e):this},t.hasSame=function(e,t,n){var r;return!!this.isValid&&(r=e.valueOf(),(e=this.setZone(e.zone,{keepLocalTime:!0})).startOf(t,n)<=r)&&r<=e.endOf(t,n)},t.equals=function(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)},t.toRelative=function(e){var t,n,r,i;return this.isValid?(t=(e=void 0===e?{}:e).base||k.fromObject({},{zone:this.zone}),n=e.padding?thisthis.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset)}},{key:"isInLeapYear",get:function(){return gt(this.year)}},{key:"daysInMonth",get:function(){return pt(this.year,this.month)}},{key:"daysInYear",get:function(){return this.isValid?D(this.year):NaN}},{key:"weeksInWeekYear",get:function(){return this.isValid?bt(this.weekYear):NaN}},{key:"weeksInLocalWeekYear",get:function(){return this.isValid?bt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}}],[{key:"DATE_SHORT",get:function(){return G}},{key:"DATE_MED",get:function(){return $}},{key:"DATE_MED_WITH_WEEKDAY",get:function(){return B}},{key:"DATE_FULL",get:function(){return Q}},{key:"DATE_HUGE",get:function(){return K}},{key:"TIME_SIMPLE",get:function(){return X}},{key:"TIME_WITH_SECONDS",get:function(){return ee}},{key:"TIME_WITH_SHORT_OFFSET",get:function(){return te}},{key:"TIME_WITH_LONG_OFFSET",get:function(){return ne}},{key:"TIME_24_SIMPLE",get:function(){return re}},{key:"TIME_24_WITH_SECONDS",get:function(){return ie}},{key:"TIME_24_WITH_SHORT_OFFSET",get:function(){return oe}},{key:"TIME_24_WITH_LONG_OFFSET",get:function(){return ae}},{key:"DATETIME_SHORT",get:function(){return se}},{key:"DATETIME_SHORT_WITH_SECONDS",get:function(){return ue}},{key:"DATETIME_MED",get:function(){return le}},{key:"DATETIME_MED_WITH_SECONDS",get:function(){return ce}},{key:"DATETIME_MED_WITH_WEEKDAY",get:function(){return fe}},{key:"DATETIME_FULL",get:function(){return de}},{key:"DATETIME_FULL_WITH_SECONDS",get:function(){return he}},{key:"DATETIME_HUGE",get:function(){return me}},{key:"DATETIME_HUGE_WITH_SECONDS",get:function(){return ye}}]),k}(Symbol.for("nodejs.util.inspect.custom"));function Or(e){if(W.isDateTime(e))return e;if(e&&e.valueOf&&v(e.valueOf()))return W.fromJSDate(e);if(e&&"object"==typeof e)return W.fromObject(e);throw new u("Unknown datetime argument: "+e+", of type "+typeof e)}return e.DateTime=W,e.Duration=x,e.FixedOffsetZone=f,e.IANAZone=c,e.Info=Wn,e.Interval=Zn,e.InvalidZone=ze,e.Settings=O,e.SystemZone=ge,e.VERSION="3.7.2",e.Zone=s,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); \ No newline at end of file diff --git a/node_modules/luxon/build/global/luxon.min.js.map b/node_modules/luxon/build/global/luxon.min.js.map new file mode 100644 index 00000000..64d99aa3 --- /dev/null +++ b/node_modules/luxon/build/global/luxon.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"build/global/luxon.js","sources":["0"],"names":["luxon","exports","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","arg","key","input","hint","prim","Symbol","toPrimitive","undefined","String","Number","res","call","TypeError","_createClass","Constructor","protoProps","staticProps","prototype","_extends","assign","bind","arguments","source","hasOwnProperty","apply","this","_inheritsLoose","subClass","superClass","create","_setPrototypeOf","constructor","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","__proto__","p","_construct","Parent","args","Class","Reflect","construct","sham","Proxy","Boolean","valueOf","e","a","push","instance","Function","_wrapNativeSuper","_cache","Map","toString","indexOf","has","get","set","Wrapper","value","_objectWithoutPropertiesLoose","excluded","sourceKeys","keys","_arrayLikeToArray","arr","len","arr2","Array","_createForOfIteratorHelperLoose","allowArrayLike","it","iterator","next","isArray","minLen","n","slice","name","from","test","done","LuxonError","_Error","Error","InvalidDateTimeError","_LuxonError","reason","toMessage","InvalidIntervalError","_LuxonError2","InvalidDurationError","_LuxonError3","ConflictingSpecificationError","_LuxonError4","InvalidUnitError","_LuxonError5","unit","InvalidArgumentError","_LuxonError6","ZoneIsAbstractError","_LuxonError7","s","l","DATE_SHORT","year","month","day","DATE_MED","DATE_MED_WITH_WEEKDAY","weekday","DATE_FULL","DATE_HUGE","TIME_SIMPLE","hour","minute","TIME_WITH_SECONDS","second","TIME_WITH_SHORT_OFFSET","timeZoneName","TIME_WITH_LONG_OFFSET","TIME_24_SIMPLE","hourCycle","TIME_24_WITH_SECONDS","TIME_24_WITH_SHORT_OFFSET","TIME_24_WITH_LONG_OFFSET","DATETIME_SHORT","DATETIME_SHORT_WITH_SECONDS","DATETIME_MED","DATETIME_MED_WITH_SECONDS","DATETIME_MED_WITH_WEEKDAY","DATETIME_FULL","DATETIME_FULL_WITH_SECONDS","DATETIME_HUGE","DATETIME_HUGE_WITH_SECONDS","Zone","_proto","offsetName","ts","opts","formatOffset","format","offset","equals","otherZone","singleton$1","SystemZone","_Zone","_ref","parseZoneInfo","locale","Date","getTimezoneOffset","type","Intl","DateTimeFormat","resolvedOptions","timeZone","dtfCache","typeToPos","era","ianaZoneCache","IANAZone","_this","zoneName","valid","isValidZone","zone","resetCache","clear","isValidSpecifier","adOrBc","dtf","date","fDay","adjustedHour","over","isNaN","NaN","hour12","_ref2","formatToParts","formatted","filled","_formatted$i","pos","isUndefined","parseInt","replace","fMonth","parsed","exec","asTS","objToLocalTS","Math","abs","millisecond","_excluded","_excluded2","intlLFCache","intlDTCache","getCachedDTF","locString","JSON","stringify","intlNumCache","intlRelCache","sysLocaleCache","intlResolvedOptionsCache","getCachedIntResolvedOptions","weekInfoCache","listStuff","loc","englishFn","intlFn","mode","listingMode","PolyNumberFormatter","intl","forceSimple","padTo","floor","otherOpts","intlOpts","useGrouping","minimumIntegerDigits","inf","NumberFormat","fixed","padStart","roundTo","PolyDateFormatter","dt","z","originalZone","offsetZ","gmtOffset","setZone","plus","minutes","_proto2","map","join","toJSDate","parts","part","PolyRelFormatter","isEnglish","style","hasRelative","rtf","_opts","base","cacheKeyOpts","RelativeTimeFormat","_proto3","count","formatRelativeTime","numeric","narrow","units","years","quarters","months","weeks","days","hours","seconds","lastable","isDay","isInPast","is","singular","fmtValue","lilUnits","fmtUnit","fallbackWeekSettings","firstDay","minimalDays","weekend","Locale","numbering","outputCalendar","weekSettings","specifiedLocale","_parseLocaleString","localeStr","xIndex","uIndex","substring","options","selectedStr","smaller","_options","numberingSystem","calendar","parsedLocale","parsedNumberingSystem","parsedOutputCalendar","includes","weekdaysCache","standalone","monthsCache","meridiemCache","eraCache","fastNumbersCached","fromOpts","defaultToEN","Settings","defaultLocale","defaultNumberingSystem","defaultOutputCalendar","validateWeekSettings","defaultWeekSettings","fromObject","_temp","_proto4","isActuallyEn","hasNoWeirdness","clone","alts","getOwnPropertyNames","redefaultToEN","redefaultToSystem","_this2","monthSpecialCase","startsWith","formatStr","f","ms","DateTime","utc","dtFormatter","extract","weekdays","_this3","meridiems","_this4","eras","_this5","field","matching","find","m","toLowerCase","numberFormatter","fastNumbers","relFormatter","listFormatter","ListFormat","getWeekSettings","hasLocaleWeekInfo","data","getWeekInfo","weekInfo","getStartOfWeek","getMinDaysInFirstWeek","getWeekendDays","other","singleton","FixedOffsetZone","utcInstance","parseSpecifier","r","match","signedOffset","InvalidZone","normalizeZone","defaultZone","lowered","isNumber","numberingSystems","arab","arabext","bali","beng","deva","fullwide","gujr","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","latn","numberingSystemsUTF16","hanidecChars","split","digitRegexCache","digitRegex","append","ns","appendCache","regex","RegExp","throwOnInvalid","now","twoDigitCutoffYear","resetCaches","cutoffYear","t","Invalid","explanation","nonLeapLadder","leapLadder","unitOutOfRange","dayOfWeek","d","UTC","setUTCFullYear","getUTCFullYear","js","getUTCDay","computeOrdinal","isLeapYear","uncomputeOrdinal","ordinal","table","month0","findIndex","isoWeekdayToLocal","isoWeekday","startOfWeek","gregorianToWeek","gregObj","minDaysInFirstWeek","weekYear","weekNumber","weeksInWeekYear","timeObject","weekToGregorian","weekData","weekdayOfJan4","yearInDays","daysInYear","_uncomputeOrdinal","gregorianToOrdinal","gregData","ordinalToGregorian","ordinalData","_uncomputeOrdinal2","usesLocalWeekValues","obj","localWeekday","localWeekNumber","localWeekYear","hasInvalidGregorianData","validYear","isInteger","validMonth","integerBetween","validDay","daysInMonth","hasInvalidTimeData","validHour","validMinute","validSecond","validMillisecond","bestBy","by","compare","reduce","best","pair","prop","settings","some","v","thing","bottom","top","padded","parseInteger","string","parseFloating","parseFloat","parseMillis","fraction","number","digits","rounding","factor","pow","ceil","trunc","round","RangeError","modMonth","x","firstWeekOffset","weekOffset","weekOffsetNext","untruncateYear","offsetFormat","modified","offHourStr","offMinuteStr","offHour","offMin","asNumber","numericValue","isFinite","normalizeObject","normalizer","u","normalized","sign","k","monthsLong","monthsShort","monthsNarrow","concat","weekdaysLong","weekdaysShort","weekdaysNarrow","erasLong","erasShort","erasNarrow","stringifyTokens","splits","tokenToString","_iterator","_step","token","literal","val","_macroTokenToFormatOpts","D","DD","DDD","DDDD","tt","ttt","tttt","T","TT","TTT","TTTT","ff","fff","ffff","F","FF","FFF","FFFF","Formatter","formatOpts","systemLoc","parseFormat","fmt","current","currentFull","bracketed","c","charAt","macroTokenToFormatOpts","formatWithSystemDefault","formatDateTime","formatDateTimeParts","formatInterval","interval","start","formatRange","end","num","signDisplay","formatDateTimeFromString","knownEnglish","useDateTimeFormatter","isOffsetFixed","allowZ","isValid","meridiem","maybeMacro","quarter","formatDurationFromString","dur","lildur","info","invertLargest","signMode","tokenToField","tokens","realTokens","found","collapsed","shiftTo","filter","durationInfo","isNegativeDuration","largestUnit","values","inversionFactor","mapped","ianaRegex","combineRegexes","_len","regexes","_key","full","combineExtractors","_len2","extractors","_key2","ex","mergedVals","mergedZone","cursor","_ex","parse","_len3","patterns","_key3","_i","_patterns","_patterns$_i","extractor","simpleParse","_len4","_key4","ret","offsetRegex","isoTimeBaseRegex","isoTimeRegex","isoTimeExtensionRegex","extractISOWeekData","extractISOOrdinalData","sqlTimeRegex","sqlTimeExtensionRegex","int","fallback","extractISOTime","milliseconds","extractISOOffset","local","fullOffset","extractIANAZone","isoTimeOnly","isoDuration","extractISODuration","maybeNegate","force","hasNegativePrefix","yearStr","monthStr","weekStr","dayStr","hourStr","minuteStr","secondStr","millisecondsStr","negativeSeconds","obsOffsets","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","fromStrings","weekdayStr","result","rfc2822","extractRFC2822","obsOffset","milOffset","rfc1123","rfc850","ascii","extractRFC1123Or850","extractASCII","isoYmdWithTimeExtensionRegex","isoWeekWithTimeExtensionRegex","isoOrdinalWithTimeExtensionRegex","isoTimeCombinedRegex","extractISOYmdTimeAndOffset","extractISOWeekTimeAndOffset","extractISOOrdinalDateAndTime","extractISOTimeAndOffset","extractISOTimeOnly","sqlYmdWithTimeExtensionRegex","sqlTimeCombinedRegex","extractISOTimeOffsetAndIANAZone","INVALID$2","lowOrderMatrix","casualMatrix","daysInYearAccurate","daysInMonthAccurate","accurateMatrix","orderedUnits$1","reverseUnits","reverse","clone$1","conf","conversionAccuracy","matrix","Duration","durationToMillis","vals","_vals$milliseconds","sum","normalizeValues","reduceRight","previous","conv","rollUp","previousVal","removeZeroes","newVals","_Object$entries","entries","_Object$entries$_i","_Symbol$for","config","accurate","invalid","isLuxonDuration","fromMillis","normalizeUnit","fromDurationLike","durationLike","isDuration","fromISO","text","fromISOTime","week","toFormat","fmtOpts","toHuman","showZeros","unitDisplay","listStyle","toObject","toISO","toISOTime","millis","toMillis","suppressMilliseconds","suppressSeconds","includePrefix","includeOffset","toJSON","invalidReason","duration","_i2","_orderedUnits","minus","negate","mapUnits","fn","_i3","_Object$keys","reconfigure","as","normalize","rescale","shiftToAll","built","accumulated","_i4","_orderedUnits2","ak","lastUnit","own","negated","_i5","_Object$keys2","removeZeros","v1","_i6","_orderedUnits3","v2","for","INVALID$1","Interval","isLuxonInterval","fromDateTimes","builtStart","friendlyDateTime","builtEnd","validateError","after","before","endIsValid","_split","startIsValid","_dur","isInterval","toDuration","startOf","useLocaleWeeks","diff","hasSame","isEmpty","isAfter","dateTime","isBefore","contains","splitAt","dateTimes","sorted","sort","b","results","added","splitBy","idx","divideEqually","numberOfParts","overlaps","abutsStart","abutsEnd","engulfs","intersection","union","merge","intervals","_intervals$sort$reduc","item","sofar","final","xor","_Array$prototype","currentCount","ends","time","difference","toLocaleString","toISODate","dateFormat","_temp2","_ref3$separator","separator","mapEndpoints","mapFn","Info","hasDST","proto","isUniversal","isValidIANAZone","_ref$locale","_ref$locObj","locObj","getMinimumDaysInFirstWeek","_ref2$locale","_ref2$locObj","getWeekendWeekdays","_temp3","_ref3","_ref3$locale","_ref3$locObj","_temp4","_ref4","_ref4$locale","_ref4$numberingSystem","_ref4$locObj","_ref4$outputCalendar","monthsFormat","_temp5","_ref5","_ref5$locale","_ref5$numberingSystem","_ref5$locObj","_ref5$outputCalendar","_temp6","_ref6","_ref6$locale","_ref6$numberingSystem","_ref6$locObj","weekdaysFormat","_temp7","_ref7","_ref7$locale","_ref7$numberingSystem","_ref7$locObj","_temp8","_ref8$locale","_temp9","_ref9$locale","features","relative","localeWeek","dayDiff","earlier","later","utcDayStart","toUTC","keepLocalTime","_diff","_highOrderDiffs","lowestOrder","highWater","_differs","_differs$_i","differ","remainingMillis","lowerOrderUnits","_cursor$plus","_Duration$fromMillis","MISSING_FTP","intUnit","post","deser","str","code","charCodeAt","search","_numberingSystemsUTF","min","max","spaceOrNBSP","fromCharCode","spaceOrNBSPRegExp","fixListRegex","stripInsensitivities","oneOf","strings","startIndex","groups","simple","unitForToken","one","two","three","four","six","oneOrTwo","oneToThree","oneToSix","oneToNine","twoToFour","fourToSix","partTypeStyleToTokenVal","2-digit","short","long","dayperiod","dayPeriod","hour24","dummyDateTimeCache","expandMacroTokens","formatOptsToTokens","TokenParser","handlers","disqualifyingUnit","_buildRegex","explainFromTokens","_match","matches","h","all","matchIndex","rawMatches","Z","specificOffset","q","M","G","y","S","resolvedOpts","df","isSpace","actualType","INVALID","unsupportedZone","possiblyCachedWeekData","possiblyCachedLocalWeekData","localWeekData","inst","old","fixOffset","localTS","tz","utcGuess","o2","o3","tsToObj","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","objToTS","adjustTime","oPre","millisToAdd","_fixOffset","parseDataToDateTime","parsedZone","toTechFormat","_toISODate","extended","precision","longFormat","_toISOTime","extendedZone","showSeconds","ianaName","zoneOffsetTs","defaultUnitValues","defaultWeekUnitValues","defaultOrdinalUnitValues","orderedUnits","orderedWeekUnits","orderedOrdinalUnits","weeknumber","weeksnumber","weeknumbers","weekyear","weekyears","normalizeUnitWithLocalWeeks","quickDT","offsetGuess","_objToTS","zoneOffsetGuessCache","diffRelative","calendary","lastOpts","argList","ot","_zone","isLuxonDateTime","_lastOpts","_lastOpts2","fromJSDate","zoneToUse","fromSeconds","_usesLocalWeekValues","tsNow","offsetProvis","containsOrdinal","containsGregorYear","containsGregorMD","containsGregor","definiteWeekDef","defaultValues","useWeekData","objNow","foundFirst","_iterator2","_step2","validWeek","validWeekday","validOrdinal","_objToTS2","_parseISODate","fromRFC2822","_parseRFC2822Date","trim","fromHTTP","_parseHTTPDate","fromFormat","_opts$locale","_opts$numberingSystem","localeToUse","_parseFromTokens","_explainFromTokens","fromString","fromSQL","_parseSQL","isDateTime","parseFormatForOpts","localeOpts","tokenList","expandFormat","getPossibleOffsets","ts1","ts2","c1","c2","oEarlier","oLater","o1","resolvedLocaleOptions","_Formatter$create$res","toLocal","newTS","_ref2$keepLocalTime","_ref2$keepCalendarTim","keepCalendarTime","setLocale","mixed","_usesLocalWeekValues2","settingWeekStuff","_objToTS4","_ref4$useLocaleWeeks","normalizedUnit","endOf","_this$plus","toLocaleParts","_ref5$format","_ref5$suppressSeconds","_ref5$suppressMillise","_ref5$includeOffset","_ref5$extendedZone","_ref5$precision","ext","_ref6$format","_ref6$precision","toISOWeekDate","_ref7$suppressMillise","_ref7$suppressSeconds","_ref7$includeOffset","_ref7$includePrefix","_ref7$extendedZone","_ref7$format","_ref7$precision","toRFC2822","toHTTP","toSQLDate","toSQLTime","_ref8","_ref8$includeOffset","_ref8$includeZone","includeZone","_ref8$includeOffsetSp","includeOffsetSpace","toSQL","toSeconds","toUnixInteger","toBSON","includeConfig","otherDateTime","otherIsLater","durOpts","diffed","diffNow","until","inputMs","adjustedToZone","toRelative","padding","toRelativeCalendar","every","fromFormatExplain","_options$locale","_options$numberingSys","fromStringExplain","buildFormatParser","_options2","_options2$locale","_options2$numberingSy","fromFormatParser","formatParser","_opts2","_opts2$locale","_opts2$numberingSyste","_formatParser$explain","dateTimeish","VERSION"],"mappings":"AAAA,IAAIA,MAAQ,SAAWC,GACrB,aAEA,SAASC,EAAkBC,EAAQC,GACjC,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,CAAC,GAAI,CACrC,IAAIE,EAAaH,EAAMC,GACvBE,EAAWC,WAAaD,EAAWC,YAAc,CAAA,EACjDD,EAAWE,aAAe,CAAA,EACtB,UAAWF,IAAYA,EAAWG,SAAW,CAAA,GACjDC,OAAOC,eAAeT,EAuJ1B,SAAwBU,GAClBC,EAXN,SAAsBC,EAAOC,GAC3B,GAAqB,UAAjB,OAAOD,GAAgC,OAAVA,EAAgB,OAAOA,EACxD,IAAIE,EAAOF,EAAMG,OAAOC,aACxB,GAAaC,KAAA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of file diff --git a/node_modules/luxon/build/node/luxon.js b/node_modules/luxon/build/node/luxon.js new file mode 100644 index 00000000..a8ee891f --- /dev/null +++ b/node_modules/luxon/build/node/luxon.js @@ -0,0 +1,7792 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +// these aren't really private, but nor are they really useful to document + +/** + * @private + */ +class LuxonError extends Error {} + +/** + * @private + */ +class InvalidDateTimeError extends LuxonError { + constructor(reason) { + super(`Invalid DateTime: ${reason.toMessage()}`); + } +} + +/** + * @private + */ +class InvalidIntervalError extends LuxonError { + constructor(reason) { + super(`Invalid Interval: ${reason.toMessage()}`); + } +} + +/** + * @private + */ +class InvalidDurationError extends LuxonError { + constructor(reason) { + super(`Invalid Duration: ${reason.toMessage()}`); + } +} + +/** + * @private + */ +class ConflictingSpecificationError extends LuxonError {} + +/** + * @private + */ +class InvalidUnitError extends LuxonError { + constructor(unit) { + super(`Invalid unit ${unit}`); + } +} + +/** + * @private + */ +class InvalidArgumentError extends LuxonError {} + +/** + * @private + */ +class ZoneIsAbstractError extends LuxonError { + constructor() { + super("Zone is an abstract class"); + } +} + +/** + * @private + */ + +const n = "numeric", + s = "short", + l = "long"; +const DATE_SHORT = { + year: n, + month: n, + day: n +}; +const DATE_MED = { + year: n, + month: s, + day: n +}; +const DATE_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s +}; +const DATE_FULL = { + year: n, + month: l, + day: n +}; +const DATE_HUGE = { + year: n, + month: l, + day: n, + weekday: l +}; +const TIME_SIMPLE = { + hour: n, + minute: n +}; +const TIME_WITH_SECONDS = { + hour: n, + minute: n, + second: n +}; +const TIME_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: s +}; +const TIME_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: l +}; +const TIME_24_SIMPLE = { + hour: n, + minute: n, + hourCycle: "h23" +}; +const TIME_24_WITH_SECONDS = { + hour: n, + minute: n, + second: n, + hourCycle: "h23" +}; +const TIME_24_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + hourCycle: "h23", + timeZoneName: s +}; +const TIME_24_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + hourCycle: "h23", + timeZoneName: l +}; +const DATETIME_SHORT = { + year: n, + month: n, + day: n, + hour: n, + minute: n +}; +const DATETIME_SHORT_WITH_SECONDS = { + year: n, + month: n, + day: n, + hour: n, + minute: n, + second: n +}; +const DATETIME_MED = { + year: n, + month: s, + day: n, + hour: n, + minute: n +}; +const DATETIME_MED_WITH_SECONDS = { + year: n, + month: s, + day: n, + hour: n, + minute: n, + second: n +}; +const DATETIME_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, + hour: n, + minute: n +}; +const DATETIME_FULL = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + timeZoneName: s +}; +const DATETIME_FULL_WITH_SECONDS = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + second: n, + timeZoneName: s +}; +const DATETIME_HUGE = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + timeZoneName: l +}; +const DATETIME_HUGE_WITH_SECONDS = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + second: n, + timeZoneName: l +}; + +/** + * @interface + */ +class Zone { + /** + * The type of zone + * @abstract + * @type {string} + */ + get type() { + throw new ZoneIsAbstractError(); + } + + /** + * The name of this zone. + * @abstract + * @type {string} + */ + get name() { + throw new ZoneIsAbstractError(); + } + + /** + * The IANA name of this zone. + * Defaults to `name` if not overwritten by a subclass. + * @abstract + * @type {string} + */ + get ianaName() { + return this.name; + } + + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + get isUniversal() { + throw new ZoneIsAbstractError(); + } + + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + offsetName(ts, opts) { + throw new ZoneIsAbstractError(); + } + + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + formatOffset(ts, format) { + throw new ZoneIsAbstractError(); + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + offset(ts) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + equals(otherZone) { + throw new ZoneIsAbstractError(); + } + + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */ + get isValid() { + throw new ZoneIsAbstractError(); + } +} + +let singleton$1 = null; + +/** + * Represents the local zone for this JavaScript environment. + * @implements {Zone} + */ +class SystemZone extends Zone { + /** + * Get a singleton instance of the local zone + * @return {SystemZone} + */ + static get instance() { + if (singleton$1 === null) { + singleton$1 = new SystemZone(); + } + return singleton$1; + } + + /** @override **/ + get type() { + return "system"; + } + + /** @override **/ + get name() { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } + + /** @override **/ + get isUniversal() { + return false; + } + + /** @override **/ + offsetName(ts, { + format, + locale + }) { + return parseZoneInfo(ts, format, locale); + } + + /** @override **/ + formatOffset(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** @override **/ + offset(ts) { + return -new Date(ts).getTimezoneOffset(); + } + + /** @override **/ + equals(otherZone) { + return otherZone.type === "system"; + } + + /** @override **/ + get isValid() { + return true; + } +} + +const dtfCache = new Map(); +function makeDTF(zoneName) { + let dtf = dtfCache.get(zoneName); + if (dtf === undefined) { + dtf = new Intl.DateTimeFormat("en-US", { + hour12: false, + timeZone: zoneName, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + era: "short" + }); + dtfCache.set(zoneName, dtf); + } + return dtf; +} +const typeToPos = { + year: 0, + month: 1, + day: 2, + era: 3, + hour: 4, + minute: 5, + second: 6 +}; +function hackyOffset(dtf, date) { + const formatted = dtf.format(date).replace(/\u200E/g, ""), + parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted), + [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed; + return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond]; +} +function partsOffset(dtf, date) { + const formatted = dtf.formatToParts(date); + const filled = []; + for (let i = 0; i < formatted.length; i++) { + const { + type, + value + } = formatted[i]; + const pos = typeToPos[type]; + if (type === "era") { + filled[pos] = value; + } else if (!isUndefined(pos)) { + filled[pos] = parseInt(value, 10); + } + } + return filled; +} +const ianaZoneCache = new Map(); +/** + * A zone identified by an IANA identifier, like America/New_York + * @implements {Zone} + */ +class IANAZone extends Zone { + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + static create(name) { + let zone = ianaZoneCache.get(name); + if (zone === undefined) { + ianaZoneCache.set(name, zone = new IANAZone(name)); + } + return zone; + } + + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */ + static resetCache() { + ianaZoneCache.clear(); + dtfCache.clear(); + } + + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead. + * @return {boolean} + */ + static isValidSpecifier(s) { + return this.isValidZone(s); + } + + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */ + static isValidZone(zone) { + if (!zone) { + return false; + } + try { + new Intl.DateTimeFormat("en-US", { + timeZone: zone + }).format(); + return true; + } catch (e) { + return false; + } + } + constructor(name) { + super(); + /** @private **/ + this.zoneName = name; + /** @private **/ + this.valid = IANAZone.isValidZone(name); + } + + /** + * The type of zone. `iana` for all instances of `IANAZone`. + * @override + * @type {string} + */ + get type() { + return "iana"; + } + + /** + * The name of this zone (i.e. the IANA zone name). + * @override + * @type {string} + */ + get name() { + return this.zoneName; + } + + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns false for all IANA zones. + * @override + * @type {boolean} + */ + get isUniversal() { + return false; + } + + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @override + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + offsetName(ts, { + format, + locale + }) { + return parseZoneInfo(ts, format, locale, this.name); + } + + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + formatOffset(ts, format) { + return formatOffset(this.offset(ts), format); + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @override + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + offset(ts) { + if (!this.valid) return NaN; + const date = new Date(ts); + if (isNaN(date)) return NaN; + const dtf = makeDTF(this.name); + let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date); + if (adOrBc === "BC") { + year = -Math.abs(year) + 1; + } + + // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat + const adjustedHour = hour === 24 ? 0 : hour; + const asUTC = objToLocalTS({ + year, + month, + day, + hour: adjustedHour, + minute, + second, + millisecond: 0 + }); + let asTS = +date; + const over = asTS % 1000; + asTS -= over >= 0 ? over : 1000 + over; + return (asUTC - asTS) / (60 * 1000); + } + + /** + * Return whether this Zone is equal to another zone + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + equals(otherZone) { + return otherZone.type === "iana" && otherZone.name === this.name; + } + + /** + * Return whether this Zone is valid. + * @override + * @type {boolean} + */ + get isValid() { + return this.valid; + } +} + +// todo - remap caching + +let intlLFCache = {}; +function getCachedLF(locString, opts = {}) { + const key = JSON.stringify([locString, opts]); + let dtf = intlLFCache[key]; + if (!dtf) { + dtf = new Intl.ListFormat(locString, opts); + intlLFCache[key] = dtf; + } + return dtf; +} +const intlDTCache = new Map(); +function getCachedDTF(locString, opts = {}) { + const key = JSON.stringify([locString, opts]); + let dtf = intlDTCache.get(key); + if (dtf === undefined) { + dtf = new Intl.DateTimeFormat(locString, opts); + intlDTCache.set(key, dtf); + } + return dtf; +} +const intlNumCache = new Map(); +function getCachedINF(locString, opts = {}) { + const key = JSON.stringify([locString, opts]); + let inf = intlNumCache.get(key); + if (inf === undefined) { + inf = new Intl.NumberFormat(locString, opts); + intlNumCache.set(key, inf); + } + return inf; +} +const intlRelCache = new Map(); +function getCachedRTF(locString, opts = {}) { + const { + base, + ...cacheKeyOpts + } = opts; // exclude `base` from the options + const key = JSON.stringify([locString, cacheKeyOpts]); + let inf = intlRelCache.get(key); + if (inf === undefined) { + inf = new Intl.RelativeTimeFormat(locString, opts); + intlRelCache.set(key, inf); + } + return inf; +} +let sysLocaleCache = null; +function systemLocale() { + if (sysLocaleCache) { + return sysLocaleCache; + } else { + sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale; + return sysLocaleCache; + } +} +const intlResolvedOptionsCache = new Map(); +function getCachedIntResolvedOptions(locString) { + let opts = intlResolvedOptionsCache.get(locString); + if (opts === undefined) { + opts = new Intl.DateTimeFormat(locString).resolvedOptions(); + intlResolvedOptionsCache.set(locString, opts); + } + return opts; +} +const weekInfoCache = new Map(); +function getCachedWeekInfo(locString) { + let data = weekInfoCache.get(locString); + if (!data) { + const locale = new Intl.Locale(locString); + // browsers currently implement this as a property, but spec says it should be a getter function + data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo; + // minimalDays was removed from WeekInfo: https://github.com/tc39/proposal-intl-locale-info/issues/86 + if (!("minimalDays" in data)) { + data = { + ...fallbackWeekSettings, + ...data + }; + } + weekInfoCache.set(locString, data); + } + return data; +} +function parseLocaleString(localeStr) { + // I really want to avoid writing a BCP 47 parser + // see, e.g. https://github.com/wooorm/bcp-47 + // Instead, we'll do this: + + // a) if the string has no -u extensions, just leave it alone + // b) if it does, use Intl to resolve everything + // c) if Intl fails, try again without the -u + + // private subtags and unicode subtags have ordering requirements, + // and we're not properly parsing this, so just strip out the + // private ones if they exist. + const xIndex = localeStr.indexOf("-x-"); + if (xIndex !== -1) { + localeStr = localeStr.substring(0, xIndex); + } + const uIndex = localeStr.indexOf("-u-"); + if (uIndex === -1) { + return [localeStr]; + } else { + let options; + let selectedStr; + try { + options = getCachedDTF(localeStr).resolvedOptions(); + selectedStr = localeStr; + } catch (e) { + const smaller = localeStr.substring(0, uIndex); + options = getCachedDTF(smaller).resolvedOptions(); + selectedStr = smaller; + } + const { + numberingSystem, + calendar + } = options; + return [selectedStr, numberingSystem, calendar]; + } +} +function intlConfigString(localeStr, numberingSystem, outputCalendar) { + if (outputCalendar || numberingSystem) { + if (!localeStr.includes("-u-")) { + localeStr += "-u"; + } + if (outputCalendar) { + localeStr += `-ca-${outputCalendar}`; + } + if (numberingSystem) { + localeStr += `-nu-${numberingSystem}`; + } + return localeStr; + } else { + return localeStr; + } +} +function mapMonths(f) { + const ms = []; + for (let i = 1; i <= 12; i++) { + const dt = DateTime.utc(2009, i, 1); + ms.push(f(dt)); + } + return ms; +} +function mapWeekdays(f) { + const ms = []; + for (let i = 1; i <= 7; i++) { + const dt = DateTime.utc(2016, 11, 13 + i); + ms.push(f(dt)); + } + return ms; +} +function listStuff(loc, length, englishFn, intlFn) { + const mode = loc.listingMode(); + if (mode === "error") { + return null; + } else if (mode === "en") { + return englishFn(length); + } else { + return intlFn(length); + } +} +function supportsFastNumbers(loc) { + if (loc.numberingSystem && loc.numberingSystem !== "latn") { + return false; + } else { + return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || getCachedIntResolvedOptions(loc.locale).numberingSystem === "latn"; + } +} + +/** + * @private + */ + +class PolyNumberFormatter { + constructor(intl, forceSimple, opts) { + this.padTo = opts.padTo || 0; + this.floor = opts.floor || false; + const { + padTo, + floor, + ...otherOpts + } = opts; + if (!forceSimple || Object.keys(otherOpts).length > 0) { + const intlOpts = { + useGrouping: false, + ...opts + }; + if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; + this.inf = getCachedINF(intl, intlOpts); + } + } + format(i) { + if (this.inf) { + const fixed = this.floor ? Math.floor(i) : i; + return this.inf.format(fixed); + } else { + // to match the browser's numberformatter defaults + const fixed = this.floor ? Math.floor(i) : roundTo(i, 3); + return padStart(fixed, this.padTo); + } + } +} + +/** + * @private + */ + +class PolyDateFormatter { + constructor(dt, intl, opts) { + this.opts = opts; + this.originalZone = undefined; + let z = undefined; + if (this.opts.timeZone) { + // Don't apply any workarounds if a timeZone is explicitly provided in opts + this.dt = dt; + } else if (dt.zone.type === "fixed") { + // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like. + // That is why fixed-offset TZ is set to that unless it is: + // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT. + // 2. Unsupported by the browser: + // - some do not support Etc/ + // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata + const gmtOffset = -1 * (dt.offset / 60); + const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`; + if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) { + z = offsetZ; + this.dt = dt; + } else { + // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so + // we manually apply the offset and substitute the zone as needed. + z = "UTC"; + this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({ + minutes: dt.offset + }); + this.originalZone = dt.zone; + } + } else if (dt.zone.type === "system") { + this.dt = dt; + } else if (dt.zone.type === "iana") { + this.dt = dt; + z = dt.zone.name; + } else { + // Custom zones can have any offset / offsetName so we just manually + // apply the offset and substitute the zone as needed. + z = "UTC"; + this.dt = dt.setZone("UTC").plus({ + minutes: dt.offset + }); + this.originalZone = dt.zone; + } + const intlOpts = { + ...this.opts + }; + intlOpts.timeZone = intlOpts.timeZone || z; + this.dtf = getCachedDTF(intl, intlOpts); + } + format() { + if (this.originalZone) { + // If we have to substitute in the actual zone name, we have to use + // formatToParts so that the timezone can be replaced. + return this.formatToParts().map(({ + value + }) => value).join(""); + } + return this.dtf.format(this.dt.toJSDate()); + } + formatToParts() { + const parts = this.dtf.formatToParts(this.dt.toJSDate()); + if (this.originalZone) { + return parts.map(part => { + if (part.type === "timeZoneName") { + const offsetName = this.originalZone.offsetName(this.dt.ts, { + locale: this.dt.locale, + format: this.opts.timeZoneName + }); + return { + ...part, + value: offsetName + }; + } else { + return part; + } + }); + } + return parts; + } + resolvedOptions() { + return this.dtf.resolvedOptions(); + } +} + +/** + * @private + */ +class PolyRelFormatter { + constructor(intl, isEnglish, opts) { + this.opts = { + style: "long", + ...opts + }; + if (!isEnglish && hasRelative()) { + this.rtf = getCachedRTF(intl, opts); + } + } + format(count, unit) { + if (this.rtf) { + return this.rtf.format(count, unit); + } else { + return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); + } + } + formatToParts(count, unit) { + if (this.rtf) { + return this.rtf.formatToParts(count, unit); + } else { + return []; + } + } +} +const fallbackWeekSettings = { + firstDay: 1, + minimalDays: 4, + weekend: [6, 7] +}; + +/** + * @private + */ +class Locale { + static fromOpts(opts) { + return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN); + } + static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) { + const specifiedLocale = locale || Settings.defaultLocale; + // the system locale is useful for human-readable strings but annoying for parsing/formatting known formats + const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()); + const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem; + const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; + const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings; + return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale); + } + static resetCache() { + sysLocaleCache = null; + intlDTCache.clear(); + intlNumCache.clear(); + intlRelCache.clear(); + intlResolvedOptionsCache.clear(); + weekInfoCache.clear(); + } + static fromObject({ + locale, + numberingSystem, + outputCalendar, + weekSettings + } = {}) { + return Locale.create(locale, numberingSystem, outputCalendar, weekSettings); + } + constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale) { + const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale); + this.locale = parsedLocale; + this.numberingSystem = numbering || parsedNumberingSystem || null; + this.outputCalendar = outputCalendar || parsedOutputCalendar || null; + this.weekSettings = weekSettings; + this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); + this.weekdaysCache = { + format: {}, + standalone: {} + }; + this.monthsCache = { + format: {}, + standalone: {} + }; + this.meridiemCache = null; + this.eraCache = {}; + this.specifiedLocale = specifiedLocale; + this.fastNumbersCached = null; + } + get fastNumbers() { + if (this.fastNumbersCached == null) { + this.fastNumbersCached = supportsFastNumbers(this); + } + return this.fastNumbersCached; + } + listingMode() { + const isActuallyEn = this.isEnglish(); + const hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); + return isActuallyEn && hasNoWeirdness ? "en" : "intl"; + } + clone(alts) { + if (!alts || Object.getOwnPropertyNames(alts).length === 0) { + return this; + } else { + return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false); + } + } + redefaultToEN(alts = {}) { + return this.clone({ + ...alts, + defaultToEN: true + }); + } + redefaultToSystem(alts = {}) { + return this.clone({ + ...alts, + defaultToEN: false + }); + } + months(length, format = false) { + return listStuff(this, length, months, () => { + // Workaround for "ja" locale: formatToParts does not label all parts of the month + // as "month" and for this locale there is no difference between "format" and "non-format". + // As such, just use format() instead of formatToParts() and take the whole string + const monthSpecialCase = this.intl === "ja" || this.intl.startsWith("ja-"); + format &= !monthSpecialCase; + const intl = format ? { + month: length, + day: "numeric" + } : { + month: length + }, + formatStr = format ? "format" : "standalone"; + if (!this.monthsCache[formatStr][length]) { + const mapper = !monthSpecialCase ? dt => this.extract(dt, intl, "month") : dt => this.dtFormatter(dt, intl).format(); + this.monthsCache[formatStr][length] = mapMonths(mapper); + } + return this.monthsCache[formatStr][length]; + }); + } + weekdays(length, format = false) { + return listStuff(this, length, weekdays, () => { + const intl = format ? { + weekday: length, + year: "numeric", + month: "long", + day: "numeric" + } : { + weekday: length + }, + formatStr = format ? "format" : "standalone"; + if (!this.weekdaysCache[formatStr][length]) { + this.weekdaysCache[formatStr][length] = mapWeekdays(dt => this.extract(dt, intl, "weekday")); + } + return this.weekdaysCache[formatStr][length]; + }); + } + meridiems() { + return listStuff(this, undefined, () => meridiems, () => { + // In theory there could be aribitrary day periods. We're gonna assume there are exactly two + // for AM and PM. This is probably wrong, but it's makes parsing way easier. + if (!this.meridiemCache) { + const intl = { + hour: "numeric", + hourCycle: "h12" + }; + this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(dt => this.extract(dt, intl, "dayperiod")); + } + return this.meridiemCache; + }); + } + eras(length) { + return listStuff(this, length, eras, () => { + const intl = { + era: length + }; + + // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates + // to definitely enumerate them. + if (!this.eraCache[length]) { + this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(dt => this.extract(dt, intl, "era")); + } + return this.eraCache[length]; + }); + } + extract(dt, intlOpts, field) { + const df = this.dtFormatter(dt, intlOpts), + results = df.formatToParts(), + matching = results.find(m => m.type.toLowerCase() === field); + return matching ? matching.value : null; + } + numberFormatter(opts = {}) { + // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave) + // (in contrast, the rest of the condition is used heavily) + return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); + } + dtFormatter(dt, intlOpts = {}) { + return new PolyDateFormatter(dt, this.intl, intlOpts); + } + relFormatter(opts = {}) { + return new PolyRelFormatter(this.intl, this.isEnglish(), opts); + } + listFormatter(opts = {}) { + return getCachedLF(this.intl, opts); + } + isEnglish() { + return this.locale === "en" || this.locale.toLowerCase() === "en-us" || getCachedIntResolvedOptions(this.intl).locale.startsWith("en-us"); + } + getWeekSettings() { + if (this.weekSettings) { + return this.weekSettings; + } else if (!hasLocaleWeekInfo()) { + return fallbackWeekSettings; + } else { + return getCachedWeekInfo(this.locale); + } + } + getStartOfWeek() { + return this.getWeekSettings().firstDay; + } + getMinDaysInFirstWeek() { + return this.getWeekSettings().minimalDays; + } + getWeekendDays() { + return this.getWeekSettings().weekend; + } + equals(other) { + return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar; + } + toString() { + return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`; + } +} + +let singleton = null; + +/** + * A zone with a fixed offset (meaning no DST) + * @implements {Zone} + */ +class FixedOffsetZone extends Zone { + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + static get utcInstance() { + if (singleton === null) { + singleton = new FixedOffsetZone(0); + } + return singleton; + } + + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + static instance(offset) { + return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset); + } + + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */ + static parseSpecifier(s) { + if (s) { + const r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + if (r) { + return new FixedOffsetZone(signedOffset(r[1], r[2])); + } + } + return null; + } + constructor(offset) { + super(); + /** @private **/ + this.fixed = offset; + } + + /** + * The type of zone. `fixed` for all instances of `FixedOffsetZone`. + * @override + * @type {string} + */ + get type() { + return "fixed"; + } + + /** + * The name of this zone. + * All fixed zones' names always start with "UTC" (plus optional offset) + * @override + * @type {string} + */ + get name() { + return this.fixed === 0 ? "UTC" : `UTC${formatOffset(this.fixed, "narrow")}`; + } + + /** + * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn` + * + * @override + * @type {string} + */ + get ianaName() { + if (this.fixed === 0) { + return "Etc/UTC"; + } else { + return `Etc/GMT${formatOffset(-this.fixed, "narrow")}`; + } + } + + /** + * Returns the offset's common name at the specified timestamp. + * + * For fixed offset zones this equals to the zone name. + * @override + */ + offsetName() { + return this.name; + } + + /** + * Returns the offset's value as a string + * @override + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + formatOffset(ts, format) { + return formatOffset(this.fixed, format); + } + + /** + * Returns whether the offset is known to be fixed for the whole year: + * Always returns true for all fixed offset zones. + * @override + * @type {boolean} + */ + get isUniversal() { + return true; + } + + /** + * Return the offset in minutes for this zone at the specified timestamp. + * + * For fixed offset zones, this is constant and does not depend on a timestamp. + * @override + * @return {number} + */ + offset() { + return this.fixed; + } + + /** + * Return whether this Zone is equal to another zone (i.e. also fixed and same offset) + * @override + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + equals(otherZone) { + return otherZone.type === "fixed" && otherZone.fixed === this.fixed; + } + + /** + * Return whether this Zone is valid: + * All fixed offset zones are valid. + * @override + * @type {boolean} + */ + get isValid() { + return true; + } +} + +/** + * A zone that failed to parse. You should never need to instantiate this. + * @implements {Zone} + */ +class InvalidZone extends Zone { + constructor(zoneName) { + super(); + /** @private */ + this.zoneName = zoneName; + } + + /** @override **/ + get type() { + return "invalid"; + } + + /** @override **/ + get name() { + return this.zoneName; + } + + /** @override **/ + get isUniversal() { + return false; + } + + /** @override **/ + offsetName() { + return null; + } + + /** @override **/ + formatOffset() { + return ""; + } + + /** @override **/ + offset() { + return NaN; + } + + /** @override **/ + equals() { + return false; + } + + /** @override **/ + get isValid() { + return false; + } +} + +/** + * @private + */ +function normalizeZone(input, defaultZone) { + if (isUndefined(input) || input === null) { + return defaultZone; + } else if (input instanceof Zone) { + return input; + } else if (isString(input)) { + const lowered = input.toLowerCase(); + if (lowered === "default") return defaultZone;else if (lowered === "local" || lowered === "system") return SystemZone.instance;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input); + } else if (isNumber(input)) { + return FixedOffsetZone.instance(input); + } else if (typeof input === "object" && "offset" in input && typeof input.offset === "function") { + // This is dumb, but the instanceof check above doesn't seem to really work + // so we're duck checking it + return input; + } else { + return new InvalidZone(input); + } +} + +const numberingSystems = { + arab: "[\u0660-\u0669]", + arabext: "[\u06F0-\u06F9]", + bali: "[\u1B50-\u1B59]", + beng: "[\u09E6-\u09EF]", + deva: "[\u0966-\u096F]", + fullwide: "[\uFF10-\uFF19]", + gujr: "[\u0AE6-\u0AEF]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[\u17E0-\u17E9]", + knda: "[\u0CE6-\u0CEF]", + laoo: "[\u0ED0-\u0ED9]", + limb: "[\u1946-\u194F]", + mlym: "[\u0D66-\u0D6F]", + mong: "[\u1810-\u1819]", + mymr: "[\u1040-\u1049]", + orya: "[\u0B66-\u0B6F]", + tamldec: "[\u0BE6-\u0BEF]", + telu: "[\u0C66-\u0C6F]", + thai: "[\u0E50-\u0E59]", + tibt: "[\u0F20-\u0F29]", + latn: "\\d" +}; +const numberingSystemsUTF16 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881] +}; +const hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); +function parseDigits(str) { + let value = parseInt(str, 10); + if (isNaN(value)) { + value = ""; + for (let i = 0; i < str.length; i++) { + const code = str.charCodeAt(i); + if (str[i].search(numberingSystems.hanidec) !== -1) { + value += hanidecChars.indexOf(str[i]); + } else { + for (const key in numberingSystemsUTF16) { + const [min, max] = numberingSystemsUTF16[key]; + if (code >= min && code <= max) { + value += code - min; + } + } + } + } + return parseInt(value, 10); + } else { + return value; + } +} + +// cache of {numberingSystem: {append: regex}} +const digitRegexCache = new Map(); +function resetDigitRegexCache() { + digitRegexCache.clear(); +} +function digitRegex({ + numberingSystem +}, append = "") { + const ns = numberingSystem || "latn"; + let appendCache = digitRegexCache.get(ns); + if (appendCache === undefined) { + appendCache = new Map(); + digitRegexCache.set(ns, appendCache); + } + let regex = appendCache.get(append); + if (regex === undefined) { + regex = new RegExp(`${numberingSystems[ns]}${append}`); + appendCache.set(append, regex); + } + return regex; +} + +let now = () => Date.now(), + defaultZone = "system", + defaultLocale = null, + defaultNumberingSystem = null, + defaultOutputCalendar = null, + twoDigitCutoffYear = 60, + throwOnInvalid, + defaultWeekSettings = null; + +/** + * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here. + */ +class Settings { + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + static get now() { + return now; + } + + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */ + static set now(n) { + now = n; + } + + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * Use the value "system" to reset this value to the system's time zone. + * @type {string} + */ + static set defaultZone(zone) { + defaultZone = zone; + } + + /** + * Get the default time zone object currently used to create DateTimes. Does not affect existing instances. + * The default value is the system's time zone (the one set on the machine that runs this code). + * @type {Zone} + */ + static get defaultZone() { + return normalizeZone(defaultZone, SystemZone.instance); + } + + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultLocale() { + return defaultLocale; + } + + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultLocale(locale) { + defaultLocale = locale; + } + + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultNumberingSystem() { + return defaultNumberingSystem; + } + + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultNumberingSystem(numberingSystem) { + defaultNumberingSystem = numberingSystem; + } + + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static get defaultOutputCalendar() { + return defaultOutputCalendar; + } + + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + static set defaultOutputCalendar(outputCalendar) { + defaultOutputCalendar = outputCalendar; + } + + /** + * @typedef {Object} WeekSettings + * @property {number} firstDay + * @property {number} minimalDays + * @property {number[]} weekend + */ + + /** + * @return {WeekSettings|null} + */ + static get defaultWeekSettings() { + return defaultWeekSettings; + } + + /** + * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and + * how many days are required in the first week of a year. + * Does not affect existing instances. + * + * @param {WeekSettings|null} weekSettings + */ + static set defaultWeekSettings(weekSettings) { + defaultWeekSettings = validateWeekSettings(weekSettings); + } + + /** + * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + */ + static get twoDigitCutoffYear() { + return twoDigitCutoffYear; + } + + /** + * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx. + * @type {number} + * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century + * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century + * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950 + * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50 + * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50 + */ + static set twoDigitCutoffYear(cutoffYear) { + twoDigitCutoffYear = cutoffYear % 100; + } + + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + static get throwOnInvalid() { + return throwOnInvalid; + } + + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + static set throwOnInvalid(t) { + throwOnInvalid = t; + } + + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + static resetCaches() { + Locale.resetCache(); + IANAZone.resetCache(); + DateTime.resetCache(); + resetDigitRegexCache(); + } +} + +class Invalid { + constructor(reason, explanation) { + this.reason = reason; + this.explanation = explanation; + } + toMessage() { + if (this.explanation) { + return `${this.reason}: ${this.explanation}`; + } else { + return this.reason; + } + } +} + +const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], + leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; +function unitOutOfRange(unit, value) { + return new Invalid("unit out of range", `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`); +} +function dayOfWeek(year, month, day) { + const d = new Date(Date.UTC(year, month - 1, day)); + if (year < 100 && year >= 0) { + d.setUTCFullYear(d.getUTCFullYear() - 1900); + } + const js = d.getUTCDay(); + return js === 0 ? 7 : js; +} +function computeOrdinal(year, month, day) { + return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; +} +function uncomputeOrdinal(year, ordinal) { + const table = isLeapYear(year) ? leapLadder : nonLeapLadder, + month0 = table.findIndex(i => i < ordinal), + day = ordinal - table[month0]; + return { + month: month0 + 1, + day + }; +} +function isoWeekdayToLocal(isoWeekday, startOfWeek) { + return (isoWeekday - startOfWeek + 7) % 7 + 1; +} + +/** + * @private + */ + +function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) { + const { + year, + month, + day + } = gregObj, + ordinal = computeOrdinal(year, month, day), + weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek); + let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7), + weekYear; + if (weekNumber < 1) { + weekYear = year - 1; + weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek); + } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) { + weekYear = year + 1; + weekNumber = 1; + } else { + weekYear = year; + } + return { + weekYear, + weekNumber, + weekday, + ...timeObject(gregObj) + }; +} +function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) { + const { + weekYear, + weekNumber, + weekday + } = weekData, + weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek), + yearInDays = daysInYear(weekYear); + let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek, + year; + if (ordinal < 1) { + year = weekYear - 1; + ordinal += daysInYear(year); + } else if (ordinal > yearInDays) { + year = weekYear + 1; + ordinal -= daysInYear(weekYear); + } else { + year = weekYear; + } + const { + month, + day + } = uncomputeOrdinal(year, ordinal); + return { + year, + month, + day, + ...timeObject(weekData) + }; +} +function gregorianToOrdinal(gregData) { + const { + year, + month, + day + } = gregData; + const ordinal = computeOrdinal(year, month, day); + return { + year, + ordinal, + ...timeObject(gregData) + }; +} +function ordinalToGregorian(ordinalData) { + const { + year, + ordinal + } = ordinalData; + const { + month, + day + } = uncomputeOrdinal(year, ordinal); + return { + year, + month, + day, + ...timeObject(ordinalData) + }; +} + +/** + * Check if local week units like localWeekday are used in obj. + * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties. + * Modifies obj in-place! + * @param obj the object values + */ +function usesLocalWeekValues(obj, loc) { + const hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear); + if (hasLocaleWeekData) { + const hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear); + if (hasIsoWeekData) { + throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields"); + } + if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday; + if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber; + if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear; + delete obj.localWeekday; + delete obj.localWeekNumber; + delete obj.localWeekYear; + return { + minDaysInFirstWeek: loc.getMinDaysInFirstWeek(), + startOfWeek: loc.getStartOfWeek() + }; + } else { + return { + minDaysInFirstWeek: 4, + startOfWeek: 1 + }; + } +} +function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) { + const validYear = isInteger(obj.weekYear), + validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)), + validWeekday = integerBetween(obj.weekday, 1, 7); + if (!validYear) { + return unitOutOfRange("weekYear", obj.weekYear); + } else if (!validWeek) { + return unitOutOfRange("week", obj.weekNumber); + } else if (!validWeekday) { + return unitOutOfRange("weekday", obj.weekday); + } else return false; +} +function hasInvalidOrdinalData(obj) { + const validYear = isInteger(obj.year), + validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validOrdinal) { + return unitOutOfRange("ordinal", obj.ordinal); + } else return false; +} +function hasInvalidGregorianData(obj) { + const validYear = isInteger(obj.year), + validMonth = integerBetween(obj.month, 1, 12), + validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validMonth) { + return unitOutOfRange("month", obj.month); + } else if (!validDay) { + return unitOutOfRange("day", obj.day); + } else return false; +} +function hasInvalidTimeData(obj) { + const { + hour, + minute, + second, + millisecond + } = obj; + const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, + validMinute = integerBetween(minute, 0, 59), + validSecond = integerBetween(second, 0, 59), + validMillisecond = integerBetween(millisecond, 0, 999); + if (!validHour) { + return unitOutOfRange("hour", hour); + } else if (!validMinute) { + return unitOutOfRange("minute", minute); + } else if (!validSecond) { + return unitOutOfRange("second", second); + } else if (!validMillisecond) { + return unitOutOfRange("millisecond", millisecond); + } else return false; +} + +/* + This is just a junk drawer, containing anything used across multiple classes. + Because Luxon is small(ish), this should stay small and we won't worry about splitting + it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area. +*/ + +/** + * @private + */ + +// TYPES + +function isUndefined(o) { + return typeof o === "undefined"; +} +function isNumber(o) { + return typeof o === "number"; +} +function isInteger(o) { + return typeof o === "number" && o % 1 === 0; +} +function isString(o) { + return typeof o === "string"; +} +function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; +} + +// CAPABILITIES + +function hasRelative() { + try { + return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; + } catch (e) { + return false; + } +} +function hasLocaleWeekInfo() { + try { + return typeof Intl !== "undefined" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype); + } catch (e) { + return false; + } +} + +// OBJECTS AND ARRAYS + +function maybeArray(thing) { + return Array.isArray(thing) ? thing : [thing]; +} +function bestBy(arr, by, compare) { + if (arr.length === 0) { + return undefined; + } + return arr.reduce((best, next) => { + const pair = [by(next), next]; + if (!best) { + return pair; + } else if (compare(best[0], pair[0]) === best[0]) { + return best; + } else { + return pair; + } + }, null)[1]; +} +function pick(obj, keys) { + return keys.reduce((a, k) => { + a[k] = obj[k]; + return a; + }, {}); +} +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} +function validateWeekSettings(settings) { + if (settings == null) { + return null; + } else if (typeof settings !== "object") { + throw new InvalidArgumentError("Week settings must be an object"); + } else { + if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some(v => !integerBetween(v, 1, 7))) { + throw new InvalidArgumentError("Invalid week settings"); + } + return { + firstDay: settings.firstDay, + minimalDays: settings.minimalDays, + weekend: Array.from(settings.weekend) + }; + } +} + +// NUMBERS AND STRINGS + +function integerBetween(thing, bottom, top) { + return isInteger(thing) && thing >= bottom && thing <= top; +} + +// x % n but takes the sign of n instead of x +function floorMod(x, n) { + return x - n * Math.floor(x / n); +} +function padStart(input, n = 2) { + const isNeg = input < 0; + let padded; + if (isNeg) { + padded = "-" + ("" + -input).padStart(n, "0"); + } else { + padded = ("" + input).padStart(n, "0"); + } + return padded; +} +function parseInteger(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseInt(string, 10); + } +} +function parseFloating(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseFloat(string); + } +} +function parseMillis(fraction) { + // Return undefined (instead of 0) in these cases, where fraction is not set + if (isUndefined(fraction) || fraction === null || fraction === "") { + return undefined; + } else { + const f = parseFloat("0." + fraction) * 1000; + return Math.floor(f); + } +} +function roundTo(number, digits, rounding = "round") { + const factor = 10 ** digits; + switch (rounding) { + case "expand": + return number > 0 ? Math.ceil(number * factor) / factor : Math.floor(number * factor) / factor; + case "trunc": + return Math.trunc(number * factor) / factor; + case "round": + return Math.round(number * factor) / factor; + case "floor": + return Math.floor(number * factor) / factor; + case "ceil": + return Math.ceil(number * factor) / factor; + default: + throw new RangeError(`Value rounding ${rounding} is out of range`); + } +} + +// DATE BASICS + +function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} +function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; +} +function daysInMonth(year, month) { + const modMonth = floorMod(month - 1, 12) + 1, + modYear = year + (month - modMonth) / 12; + if (modMonth === 2) { + return isLeapYear(modYear) ? 29 : 28; + } else { + return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; + } +} + +// convert a calendar object to a local timestamp (epoch, but with the offset baked in) +function objToLocalTS(obj) { + let d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond); + + // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that + if (obj.year < 100 && obj.year >= 0) { + d = new Date(d); + // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not + // so if obj.year is in 99, but obj.day makes it roll over into year 100, + // the calculations done by Date.UTC are using year 2000 - which is incorrect + d.setUTCFullYear(obj.year, obj.month - 1, obj.day); + } + return +d; +} + +// adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js +function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) { + const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek); + return -fwdlw + minDaysInFirstWeek - 1; +} +function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) { + const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek); + const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek); + return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7; +} +function untruncateYear(year) { + if (year > 99) { + return year; + } else return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year; +} + +// PARSING + +function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) { + const date = new Date(ts), + intlOpts = { + hourCycle: "h23", + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit" + }; + if (timeZone) { + intlOpts.timeZone = timeZone; + } + const modified = { + timeZoneName: offsetFormat, + ...intlOpts + }; + const parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(m => m.type.toLowerCase() === "timezonename"); + return parsed ? parsed.value : null; +} + +// signedOffset('-5', '30') -> -330 +function signedOffset(offHourStr, offMinuteStr) { + let offHour = parseInt(offHourStr, 10); + + // don't || this because we want to preserve -0 + if (Number.isNaN(offHour)) { + offHour = 0; + } + const offMin = parseInt(offMinuteStr, 10) || 0, + offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; + return offHour * 60 + offMinSigned; +} + +// COERCION + +function asNumber(value) { + const numericValue = Number(value); + if (typeof value === "boolean" || value === "" || !Number.isFinite(numericValue)) throw new InvalidArgumentError(`Invalid unit value ${value}`); + return numericValue; +} +function normalizeObject(obj, normalizer) { + const normalized = {}; + for (const u in obj) { + if (hasOwnProperty(obj, u)) { + const v = obj[u]; + if (v === undefined || v === null) continue; + normalized[normalizer(u)] = asNumber(v); + } + } + return normalized; +} + +/** + * Returns the offset's value as a string + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ +function formatOffset(offset, format) { + const hours = Math.trunc(Math.abs(offset / 60)), + minutes = Math.trunc(Math.abs(offset % 60)), + sign = offset >= 0 ? "+" : "-"; + switch (format) { + case "short": + return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`; + case "narrow": + return `${sign}${hours}${minutes > 0 ? `:${minutes}` : ""}`; + case "techie": + return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`; + default: + throw new RangeError(`Value format ${format} is out of range for property format`); + } +} +function timeObject(obj) { + return pick(obj, ["hour", "minute", "second", "millisecond"]); +} + +/** + * @private + */ + +const monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; +const monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; +const monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; +function months(length) { + switch (length) { + case "narrow": + return [...monthsNarrow]; + case "short": + return [...monthsShort]; + case "long": + return [...monthsLong]; + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + default: + return null; + } +} +const weekdaysLong = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; +const weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; +const weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; +function weekdays(length) { + switch (length) { + case "narrow": + return [...weekdaysNarrow]; + case "short": + return [...weekdaysShort]; + case "long": + return [...weekdaysLong]; + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + default: + return null; + } +} +const meridiems = ["AM", "PM"]; +const erasLong = ["Before Christ", "Anno Domini"]; +const erasShort = ["BC", "AD"]; +const erasNarrow = ["B", "A"]; +function eras(length) { + switch (length) { + case "narrow": + return [...erasNarrow]; + case "short": + return [...erasShort]; + case "long": + return [...erasLong]; + default: + return null; + } +} +function meridiemForDateTime(dt) { + return meridiems[dt.hour < 12 ? 0 : 1]; +} +function weekdayForDateTime(dt, length) { + return weekdays(length)[dt.weekday - 1]; +} +function monthForDateTime(dt, length) { + return months(length)[dt.month - 1]; +} +function eraForDateTime(dt, length) { + return eras(length)[dt.year < 0 ? 0 : 1]; +} +function formatRelativeTime(unit, count, numeric = "always", narrow = false) { + const units = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."] + }; + const lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; + if (numeric === "auto" && lastable) { + const isDay = unit === "days"; + switch (count) { + case 1: + return isDay ? "tomorrow" : `next ${units[unit][0]}`; + case -1: + return isDay ? "yesterday" : `last ${units[unit][0]}`; + case 0: + return isDay ? "today" : `this ${units[unit][0]}`; + } + } + + const isInPast = Object.is(count, -0) || count < 0, + fmtValue = Math.abs(count), + singular = fmtValue === 1, + lilUnits = units[unit], + fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit; + return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`; +} + +function stringifyTokens(splits, tokenToString) { + let s = ""; + for (const token of splits) { + if (token.literal) { + s += token.val; + } else { + s += tokenToString(token.val); + } + } + return s; +} +const macroTokenToFormatOpts = { + D: DATE_SHORT, + DD: DATE_MED, + DDD: DATE_FULL, + DDDD: DATE_HUGE, + t: TIME_SIMPLE, + tt: TIME_WITH_SECONDS, + ttt: TIME_WITH_SHORT_OFFSET, + tttt: TIME_WITH_LONG_OFFSET, + T: TIME_24_SIMPLE, + TT: TIME_24_WITH_SECONDS, + TTT: TIME_24_WITH_SHORT_OFFSET, + TTTT: TIME_24_WITH_LONG_OFFSET, + f: DATETIME_SHORT, + ff: DATETIME_MED, + fff: DATETIME_FULL, + ffff: DATETIME_HUGE, + F: DATETIME_SHORT_WITH_SECONDS, + FF: DATETIME_MED_WITH_SECONDS, + FFF: DATETIME_FULL_WITH_SECONDS, + FFFF: DATETIME_HUGE_WITH_SECONDS +}; + +/** + * @private + */ + +class Formatter { + static create(locale, opts = {}) { + return new Formatter(locale, opts); + } + static parseFormat(fmt) { + // white-space is always considered a literal in user-provided formats + // the " " token has a special meaning (see unitForToken) + + let current = null, + currentFull = "", + bracketed = false; + const splits = []; + for (let i = 0; i < fmt.length; i++) { + const c = fmt.charAt(i); + if (c === "'") { + // turn '' into a literal signal quote instead of just skipping the empty literal + if (currentFull.length > 0 || bracketed) { + splits.push({ + literal: bracketed || /^\s+$/.test(currentFull), + val: currentFull === "" ? "'" : currentFull + }); + } + current = null; + currentFull = ""; + bracketed = !bracketed; + } else if (bracketed) { + currentFull += c; + } else if (c === current) { + currentFull += c; + } else { + if (currentFull.length > 0) { + splits.push({ + literal: /^\s+$/.test(currentFull), + val: currentFull + }); + } + currentFull = c; + current = c; + } + } + if (currentFull.length > 0) { + splits.push({ + literal: bracketed || /^\s+$/.test(currentFull), + val: currentFull + }); + } + return splits; + } + static macroTokenToFormatOpts(token) { + return macroTokenToFormatOpts[token]; + } + constructor(locale, formatOpts) { + this.opts = formatOpts; + this.loc = locale; + this.systemLoc = null; + } + formatWithSystemDefault(dt, opts) { + if (this.systemLoc === null) { + this.systemLoc = this.loc.redefaultToSystem(); + } + const df = this.systemLoc.dtFormatter(dt, { + ...this.opts, + ...opts + }); + return df.format(); + } + dtFormatter(dt, opts = {}) { + return this.loc.dtFormatter(dt, { + ...this.opts, + ...opts + }); + } + formatDateTime(dt, opts) { + return this.dtFormatter(dt, opts).format(); + } + formatDateTimeParts(dt, opts) { + return this.dtFormatter(dt, opts).formatToParts(); + } + formatInterval(interval, opts) { + const df = this.dtFormatter(interval.start, opts); + return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate()); + } + resolvedOptions(dt, opts) { + return this.dtFormatter(dt, opts).resolvedOptions(); + } + num(n, p = 0, signDisplay = undefined) { + // we get some perf out of doing this here, annoyingly + if (this.opts.forceSimple) { + return padStart(n, p); + } + const opts = { + ...this.opts + }; + if (p > 0) { + opts.padTo = p; + } + if (signDisplay) { + opts.signDisplay = signDisplay; + } + return this.loc.numberFormatter(opts).format(n); + } + formatDateTimeFromString(dt, fmt) { + const knownEnglish = this.loc.listingMode() === "en", + useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", + string = (opts, extract) => this.loc.extract(dt, opts, extract), + formatOffset = opts => { + if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { + return "Z"; + } + return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; + }, + meridiem = () => knownEnglish ? meridiemForDateTime(dt) : string({ + hour: "numeric", + hourCycle: "h12" + }, "dayperiod"), + month = (length, standalone) => knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { + month: length + } : { + month: length, + day: "numeric" + }, "month"), + weekday = (length, standalone) => knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { + weekday: length + } : { + weekday: length, + month: "long", + day: "numeric" + }, "weekday"), + maybeMacro = token => { + const formatOpts = Formatter.macroTokenToFormatOpts(token); + if (formatOpts) { + return this.formatWithSystemDefault(dt, formatOpts); + } else { + return token; + } + }, + era = length => knownEnglish ? eraForDateTime(dt, length) : string({ + era: length + }, "era"), + tokenToString = token => { + // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols + switch (token) { + // ms + case "S": + return this.num(dt.millisecond); + case "u": + // falls through + case "SSS": + return this.num(dt.millisecond, 3); + // seconds + case "s": + return this.num(dt.second); + case "ss": + return this.num(dt.second, 2); + // fractional seconds + case "uu": + return this.num(Math.floor(dt.millisecond / 10), 2); + case "uuu": + return this.num(Math.floor(dt.millisecond / 100)); + // minutes + case "m": + return this.num(dt.minute); + case "mm": + return this.num(dt.minute, 2); + // hours + case "h": + return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); + case "hh": + return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); + case "H": + return this.num(dt.hour); + case "HH": + return this.num(dt.hour, 2); + // offset + case "Z": + // like +6 + return formatOffset({ + format: "narrow", + allowZ: this.opts.allowZ + }); + case "ZZ": + // like +06:00 + return formatOffset({ + format: "short", + allowZ: this.opts.allowZ + }); + case "ZZZ": + // like +0600 + return formatOffset({ + format: "techie", + allowZ: this.opts.allowZ + }); + case "ZZZZ": + // like EST + return dt.zone.offsetName(dt.ts, { + format: "short", + locale: this.loc.locale + }); + case "ZZZZZ": + // like Eastern Standard Time + return dt.zone.offsetName(dt.ts, { + format: "long", + locale: this.loc.locale + }); + // zone + case "z": + // like America/New_York + return dt.zoneName; + // meridiems + case "a": + return meridiem(); + // dates + case "d": + return useDateTimeFormatter ? string({ + day: "numeric" + }, "day") : this.num(dt.day); + case "dd": + return useDateTimeFormatter ? string({ + day: "2-digit" + }, "day") : this.num(dt.day, 2); + // weekdays - standalone + case "c": + // like 1 + return this.num(dt.weekday); + case "ccc": + // like 'Tues' + return weekday("short", true); + case "cccc": + // like 'Tuesday' + return weekday("long", true); + case "ccccc": + // like 'T' + return weekday("narrow", true); + // weekdays - format + case "E": + // like 1 + return this.num(dt.weekday); + case "EEE": + // like 'Tues' + return weekday("short", false); + case "EEEE": + // like 'Tuesday' + return weekday("long", false); + case "EEEEE": + // like 'T' + return weekday("narrow", false); + // months - standalone + case "L": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric", + day: "numeric" + }, "month") : this.num(dt.month); + case "LL": + // like 01, doesn't seem to work + return useDateTimeFormatter ? string({ + month: "2-digit", + day: "numeric" + }, "month") : this.num(dt.month, 2); + case "LLL": + // like Jan + return month("short", true); + case "LLLL": + // like January + return month("long", true); + case "LLLLL": + // like J + return month("narrow", true); + // months - format + case "M": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric" + }, "month") : this.num(dt.month); + case "MM": + // like 01 + return useDateTimeFormatter ? string({ + month: "2-digit" + }, "month") : this.num(dt.month, 2); + case "MMM": + // like Jan + return month("short", false); + case "MMMM": + // like January + return month("long", false); + case "MMMMM": + // like J + return month("narrow", false); + // years + case "y": + // like 2014 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : this.num(dt.year); + case "yy": + // like 14 + return useDateTimeFormatter ? string({ + year: "2-digit" + }, "year") : this.num(dt.year.toString().slice(-2), 2); + case "yyyy": + // like 0012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : this.num(dt.year, 4); + case "yyyyyy": + // like 000012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : this.num(dt.year, 6); + // eras + case "G": + // like AD + return era("short"); + case "GG": + // like Anno Domini + return era("long"); + case "GGGGG": + return era("narrow"); + case "kk": + return this.num(dt.weekYear.toString().slice(-2), 2); + case "kkkk": + return this.num(dt.weekYear, 4); + case "W": + return this.num(dt.weekNumber); + case "WW": + return this.num(dt.weekNumber, 2); + case "n": + return this.num(dt.localWeekNumber); + case "nn": + return this.num(dt.localWeekNumber, 2); + case "ii": + return this.num(dt.localWeekYear.toString().slice(-2), 2); + case "iiii": + return this.num(dt.localWeekYear, 4); + case "o": + return this.num(dt.ordinal); + case "ooo": + return this.num(dt.ordinal, 3); + case "q": + // like 1 + return this.num(dt.quarter); + case "qq": + // like 01 + return this.num(dt.quarter, 2); + case "X": + return this.num(Math.floor(dt.ts / 1000)); + case "x": + return this.num(dt.ts); + default: + return maybeMacro(token); + } + }; + return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); + } + formatDurationFromString(dur, fmt) { + const invertLargest = this.opts.signMode === "negativeLargestOnly" ? -1 : 1; + const tokenToField = token => { + switch (token[0]) { + case "S": + return "milliseconds"; + case "s": + return "seconds"; + case "m": + return "minutes"; + case "h": + return "hours"; + case "d": + return "days"; + case "w": + return "weeks"; + case "M": + return "months"; + case "y": + return "years"; + default: + return null; + } + }, + tokenToString = (lildur, info) => token => { + const mapped = tokenToField(token); + if (mapped) { + const inversionFactor = info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1; + let signDisplay; + if (this.opts.signMode === "negativeLargestOnly" && mapped !== info.largestUnit) { + signDisplay = "never"; + } else if (this.opts.signMode === "all") { + signDisplay = "always"; + } else { + // "auto" and "negative" are the same, but "auto" has better support + signDisplay = "auto"; + } + return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay); + } else { + return token; + } + }, + tokens = Formatter.parseFormat(fmt), + realTokens = tokens.reduce((found, { + literal, + val + }) => literal ? found : found.concat(val), []), + collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter(t => t)), + durationInfo = { + isNegativeDuration: collapsed < 0, + // this relies on "collapsed" being based on "shiftTo", which builds up the object + // in order + largestUnit: Object.keys(collapsed.values)[0] + }; + return stringifyTokens(tokens, tokenToString(collapsed, durationInfo)); + } +} + +/* + * This file handles parsing for well-specified formats. Here's how it works: + * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. + * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object + * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. + * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. + * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. + * Some extractions are super dumb and simpleParse and fromStrings help DRY them. + */ + +const ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/; +function combineRegexes(...regexes) { + const full = regexes.reduce((f, r) => f + r.source, ""); + return RegExp(`^${full}$`); +} +function combineExtractors(...extractors) { + return m => extractors.reduce(([mergedVals, mergedZone, cursor], ex) => { + const [val, zone, next] = ex(m, cursor); + return [{ + ...mergedVals, + ...val + }, zone || mergedZone, next]; + }, [{}, null, 1]).slice(0, 2); +} +function parse(s, ...patterns) { + if (s == null) { + return [null, null]; + } + for (const [regex, extractor] of patterns) { + const m = regex.exec(s); + if (m) { + return extractor(m); + } + } + return [null, null]; +} +function simpleParse(...keys) { + return (match, cursor) => { + const ret = {}; + let i; + for (i = 0; i < keys.length; i++) { + ret[keys[i]] = parseInteger(match[cursor + i]); + } + return [ret, null, cursor + i]; + }; +} + +// ISO and SQL parsing +const offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/; +const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`; +const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/; +const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`); +const isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`); +const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/; +const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/; +const isoOrdinalRegex = /(\d{4})-?(\d{3})/; +const extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"); +const extractISOOrdinalData = simpleParse("year", "ordinal"); +const sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/; // dumbed-down version of the ISO one +const sqlTimeRegex = RegExp(`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`); +const sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`); +function int(match, pos, fallback) { + const m = match[pos]; + return isUndefined(m) ? fallback : parseInteger(m); +} +function extractISOYmd(match, cursor) { + const item = { + year: int(match, cursor), + month: int(match, cursor + 1, 1), + day: int(match, cursor + 2, 1) + }; + return [item, null, cursor + 3]; +} +function extractISOTime(match, cursor) { + const item = { + hours: int(match, cursor, 0), + minutes: int(match, cursor + 1, 0), + seconds: int(match, cursor + 2, 0), + milliseconds: parseMillis(match[cursor + 3]) + }; + return [item, null, cursor + 4]; +} +function extractISOOffset(match, cursor) { + const local = !match[cursor] && !match[cursor + 1], + fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), + zone = local ? null : FixedOffsetZone.instance(fullOffset); + return [{}, zone, cursor + 3]; +} +function extractIANAZone(match, cursor) { + const zone = match[cursor] ? IANAZone.create(match[cursor]) : null; + return [{}, zone, cursor + 1]; +} + +// ISO time parsing + +const isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`); + +// ISO duration parsing + +const isoDuration = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/; +function extractISODuration(match) { + const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = match; + const hasNegativePrefix = s[0] === "-"; + const negativeSeconds = secondStr && secondStr[0] === "-"; + const maybeNegate = (num, force = false) => num !== undefined && (force || num && hasNegativePrefix) ? -num : num; + return [{ + years: maybeNegate(parseFloating(yearStr)), + months: maybeNegate(parseFloating(monthStr)), + weeks: maybeNegate(parseFloating(weekStr)), + days: maybeNegate(parseFloating(dayStr)), + hours: maybeNegate(parseFloating(hourStr)), + minutes: maybeNegate(parseFloating(minuteStr)), + seconds: maybeNegate(parseFloating(secondStr), secondStr === "-0"), + milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds) + }]; +} + +// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York +// and not just that we're in -240 *right now*. But since I don't think these are used that often +// I'm just going to ignore that +const obsOffsets = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 +}; +function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + const result = { + year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), + month: monthsShort.indexOf(monthStr) + 1, + day: parseInteger(dayStr), + hour: parseInteger(hourStr), + minute: parseInteger(minuteStr) + }; + if (secondStr) result.second = parseInteger(secondStr); + if (weekdayStr) { + result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1; + } + return result; +} + +// RFC 2822/5322 +const rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; +function extractRFC2822(match) { + const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr, obsOffset, milOffset, offHourStr, offMinuteStr] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + let offset; + if (obsOffset) { + offset = obsOffsets[obsOffset]; + } else if (milOffset) { + offset = 0; + } else { + offset = signedOffset(offHourStr, offMinuteStr); + } + return [result, new FixedOffsetZone(offset)]; +} +function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); +} + +// http date + +const rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, + rfc850 = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, + ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; +function extractRFC1123Or850(match) { + const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} +function extractASCII(match) { + const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match, + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; +} +const isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); +const isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); +const isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); +const isoTimeCombinedRegex = combineRegexes(isoTimeRegex); +const extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone); +const extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset, extractIANAZone); +const extractISOOrdinalDateAndTime = combineExtractors(extractISOOrdinalData, extractISOTime, extractISOOffset, extractIANAZone); +const extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); + +/* + * @private + */ + +function parseISODate(s) { + return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]); +} +function parseRFC2822Date(s) { + return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]); +} +function parseHTTPDate(s) { + return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]); +} +function parseISODuration(s) { + return parse(s, [isoDuration, extractISODuration]); +} +const extractISOTimeOnly = combineExtractors(extractISOTime); +function parseISOTimeOnly(s) { + return parse(s, [isoTimeOnly, extractISOTimeOnly]); +} +const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); +const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); +const extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); +function parseSQL(s) { + return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]); +} + +const INVALID$2 = "Invalid Duration"; + +// unit conversion constants +const lowOrderMatrix = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1000 + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1000 + }, + hours: { + minutes: 60, + seconds: 60 * 60, + milliseconds: 60 * 60 * 1000 + }, + minutes: { + seconds: 60, + milliseconds: 60 * 1000 + }, + seconds: { + milliseconds: 1000 + } + }, + casualMatrix = { + years: { + quarters: 4, + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + seconds: 91 * 24 * 60 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1000 + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1000 + }, + ...lowOrderMatrix + }, + daysInYearAccurate = 146097.0 / 400, + daysInMonthAccurate = 146097.0 / 4800, + accurateMatrix = { + years: { + quarters: 4, + months: 12, + weeks: daysInYearAccurate / 7, + days: daysInYearAccurate, + hours: daysInYearAccurate * 24, + minutes: daysInYearAccurate * 24 * 60, + seconds: daysInYearAccurate * 24 * 60 * 60, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: daysInYearAccurate / 28, + days: daysInYearAccurate / 4, + hours: daysInYearAccurate * 24 / 4, + minutes: daysInYearAccurate * 24 * 60 / 4, + seconds: daysInYearAccurate * 24 * 60 * 60 / 4, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 / 4 + }, + months: { + weeks: daysInMonthAccurate / 7, + days: daysInMonthAccurate, + hours: daysInMonthAccurate * 24, + minutes: daysInMonthAccurate * 24 * 60, + seconds: daysInMonthAccurate * 24 * 60 * 60, + milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000 + }, + ...lowOrderMatrix + }; + +// units ordered by size +const orderedUnits$1 = ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"]; +const reverseUnits = orderedUnits$1.slice(0).reverse(); + +// clone really means "create another instance just like this one, but with these changes" +function clone$1(dur, alts, clear = false) { + // deep merge for vals + const conf = { + values: clear ? alts.values : { + ...dur.values, + ...(alts.values || {}) + }, + loc: dur.loc.clone(alts.loc), + conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy, + matrix: alts.matrix || dur.matrix + }; + return new Duration(conf); +} +function durationToMillis(matrix, vals) { + var _vals$milliseconds; + let sum = (_vals$milliseconds = vals.milliseconds) != null ? _vals$milliseconds : 0; + for (const unit of reverseUnits.slice(1)) { + if (vals[unit]) { + sum += vals[unit] * matrix[unit]["milliseconds"]; + } + } + return sum; +} + +// NB: mutates parameters +function normalizeValues(matrix, vals) { + // the logic below assumes the overall value of the duration is positive + // if this is not the case, factor is used to make it so + const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1; + orderedUnits$1.reduceRight((previous, current) => { + if (!isUndefined(vals[current])) { + if (previous) { + const previousVal = vals[previous] * factor; + const conv = matrix[current][previous]; + + // if (previousVal < 0): + // lower order unit is negative (e.g. { years: 2, days: -2 }) + // normalize this by reducing the higher order unit by the appropriate amount + // and increasing the lower order unit + // this can never make the higher order unit negative, because this function only operates + // on positive durations, so the amount of time represented by the lower order unit cannot + // be larger than the higher order unit + // else: + // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 }) + // in this case we attempt to convert as much as possible from the lower order unit into + // the higher order one + // + // Math.floor takes care of both of these cases, rounding away from 0 + // if previousVal < 0 it makes the absolute value larger + // if previousVal >= it makes the absolute value smaller + const rollUp = Math.floor(previousVal / conv); + vals[current] += rollUp * factor; + vals[previous] -= rollUp * conv * factor; + } + return current; + } else { + return previous; + } + }, null); + + // try to convert any decimals into smaller units if possible + // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 } + orderedUnits$1.reduce((previous, current) => { + if (!isUndefined(vals[current])) { + if (previous) { + const fraction = vals[previous] % 1; + vals[previous] -= fraction; + vals[current] += fraction * matrix[previous][current]; + } + return current; + } else { + return previous; + } + }, null); +} + +// Remove all properties with a value of 0 from an object +function removeZeroes(vals) { + const newVals = {}; + for (const [key, value] of Object.entries(vals)) { + if (value !== 0) { + newVals[key] = value; + } + } + return newVals; +} + +/** + * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime#plus} to add a Duration object to a DateTime, producing another DateTime. + * + * Here is a brief overview of commonly used methods and getters in Duration: + * + * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. + * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors. + * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors. + * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}. + * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON} + * + * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. + */ +class Duration { + /** + * @private + */ + constructor(config) { + const accurate = config.conversionAccuracy === "longterm" || false; + let matrix = accurate ? accurateMatrix : casualMatrix; + if (config.matrix) { + matrix = config.matrix; + } + + /** + * @access private + */ + this.values = config.values; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.conversionAccuracy = accurate ? "longterm" : "casual"; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.matrix = matrix; + /** + * @access private + */ + this.isLuxonDuration = true; + } + + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + static fromMillis(count, opts) { + return Duration.fromObject({ + milliseconds: count + }, opts); + } + + /** + * Create a Duration from a JavaScript object with keys like 'years' and 'hours'. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {Object} [opts=[]] - options for creating this Duration + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the custom conversion system to use + * @return {Duration} + */ + static fromObject(obj, opts = {}) { + if (obj == null || typeof obj !== "object") { + throw new InvalidArgumentError(`Duration.fromObject: argument expected to be an object, got ${obj === null ? "null" : typeof obj}`); + } + return new Duration({ + values: normalizeObject(obj, Duration.normalizeUnit), + loc: Locale.fromObject(opts), + conversionAccuracy: opts.conversionAccuracy, + matrix: opts.matrix + }); + } + + /** + * Create a Duration from DurationLike. + * + * @param {Object | number | Duration} durationLike + * One of: + * - object with keys like 'years' and 'hours'. + * - number representing milliseconds + * - Duration instance + * @return {Duration} + */ + static fromDurationLike(durationLike) { + if (isNumber(durationLike)) { + return Duration.fromMillis(durationLike); + } else if (Duration.isDuration(durationLike)) { + return durationLike; + } else if (typeof durationLike === "object") { + return Duration.fromObject(durationLike); + } else { + throw new InvalidArgumentError(`Unknown duration argument ${durationLike} of type ${typeof durationLike}`); + } + } + + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the preset conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */ + static fromISO(text, opts) { + const [parsed] = parseISODuration(text); + if (parsed) { + return Duration.fromObject(parsed, opts); + } else { + return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); + } + } + + /** + * Create a Duration from an ISO 8601 time string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use + * @param {string} [opts.matrix=Object] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 } + * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } + * @return {Duration} + */ + static fromISOTime(text, opts) { + const [parsed] = parseISOTimeOnly(text); + if (parsed) { + return Duration.fromObject(parsed, opts); + } else { + return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); + } + } + + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */ + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); + } + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidDurationError(invalid); + } else { + return new Duration({ + invalid + }); + } + } + + /** + * @private + */ + static normalizeUnit(unit) { + const normalized = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds" + }[unit ? unit.toLowerCase() : unit]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } + + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isDuration(o) { + return o && o.isLuxonDuration || false; + } + + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */ + get locale() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + get numberingSystem() { + return this.isValid ? this.loc.numberingSystem : null; + } + + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `w` for weeks + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * Tokens can be escaped by wrapping with single quotes. + * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat("d s", { signMode: "all" }) //=> "+6 +2" + * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "all" }) //=> "-6 -2" + * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "negativeLargestOnly" }) //=> "-6 2" + * @return {string} + */ + toFormat(fmt, opts = {}) { + // reverse-compat since 1.2; we always round down now, never up, and we do it by default + const fmtOpts = { + ...opts, + floor: opts.round !== false && opts.floor !== false + }; + return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2; + } + + /** + * Returns a string representation of a Duration with all units included. + * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options + * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`. + * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor. + * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero + * @example + * ```js + * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 }) + * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes' + * dur.toHuman({ listStyle: "long" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes' + * dur.toHuman({ unitDisplay: "short" }) //=> '1 mth, 0 wks, 5 hr, 6 min' + * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes' + * ``` + */ + toHuman(opts = {}) { + if (!this.isValid) return INVALID$2; + const showZeros = opts.showZeros !== false; + const l = orderedUnits$1.map(unit => { + const val = this.values[unit]; + if (isUndefined(val) || val === 0 && !showZeros) { + return null; + } + return this.loc.numberFormatter({ + style: "unit", + unitDisplay: "long", + ...opts, + unit: unit.slice(0, -1) + }).format(val); + }).filter(n => n); + return this.loc.listFormatter({ + type: "conjunction", + style: opts.listStyle || "narrow", + ...opts + }).format(l); + } + + /** + * Returns a JavaScript object with this Duration's values. + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */ + toObject() { + if (!this.isValid) return {}; + return { + ...this.values + }; + } + + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */ + toISO() { + // we could use the formatter, but this is an easier way to get the minimum string + if (!this.isValid) return null; + let s = "P"; + if (this.years !== 0) s += this.years + "Y"; + if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + "M"; + if (this.weeks !== 0) s += this.weeks + "W"; + if (this.days !== 0) s += this.days + "D"; + if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) s += "T"; + if (this.hours !== 0) s += this.hours + "H"; + if (this.minutes !== 0) s += this.minutes + "M"; + if (this.seconds !== 0 || this.milliseconds !== 0) + // this will handle "floating point madness" by removing extra decimal places + // https://stackoverflow.com/questions/588004/is-floating-point-math-broken + s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S"; + if (s === "P") s += "T0S"; + return s; + } + + /** + * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day. + * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours. + * @see https://en.wikipedia.org/wiki/ISO_8601#Times + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000' + * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000' + * @return {string} + */ + toISOTime(opts = {}) { + if (!this.isValid) return null; + const millis = this.toMillis(); + if (millis < 0 || millis >= 86400000) return null; + opts = { + suppressMilliseconds: false, + suppressSeconds: false, + includePrefix: false, + format: "extended", + ...opts, + includeOffset: false + }; + const dateTime = DateTime.fromMillis(millis, { + zone: "UTC" + }); + return dateTime.toISOTime(opts); + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */ + toJSON() { + return this.toISO(); + } + + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */ + toString() { + return this.toISO(); + } + + /** + * Returns a string representation of this Duration appropriate for the REPL. + * @return {string} + */ + [Symbol.for("nodejs.util.inspect.custom")]() { + if (this.isValid) { + return `Duration { values: ${JSON.stringify(this.values)} }`; + } else { + return `Duration { Invalid, reason: ${this.invalidReason} }`; + } + } + + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */ + toMillis() { + if (!this.isValid) return NaN; + return durationToMillis(this.matrix, this.values); + } + + /** + * Returns an milliseconds value of this Duration. Alias of {@link toMillis} + * @return {number} + */ + valueOf() { + return this.toMillis(); + } + + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + plus(duration) { + if (!this.isValid) return this; + const dur = Duration.fromDurationLike(duration), + result = {}; + for (const k of orderedUnits$1) { + if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { + result[k] = dur.get(k) + this.get(k); + } + } + return clone$1(this, { + values: result + }, true); + } + + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + minus(duration) { + if (!this.isValid) return this; + const dur = Duration.fromDurationLike(duration); + return this.plus(dur.negate()); + } + + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */ + mapUnits(fn) { + if (!this.isValid) return this; + const result = {}; + for (const k of Object.keys(this.values)) { + result[k] = asNumber(fn(this.values[k], k)); + } + return clone$1(this, { + values: result + }, true); + } + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3 + * @return {number} + */ + get(unit) { + return this[Duration.normalizeUnit(unit)]; + } + + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */ + set(values) { + if (!this.isValid) return this; + const mixed = { + ...this.values, + ...normalizeObject(values, Duration.normalizeUnit) + }; + return clone$1(this, { + values: mixed + }); + } + + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */ + reconfigure({ + locale, + numberingSystem, + conversionAccuracy, + matrix + } = {}) { + const loc = this.loc.clone({ + locale, + numberingSystem + }); + const opts = { + loc, + matrix, + conversionAccuracy + }; + return clone$1(this, opts); + } + + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */ + as(unit) { + return this.isValid ? this.shiftTo(unit).get(unit) : NaN; + } + + /** + * Reduce this Duration to its canonical representation in its current units. + * Assuming the overall value of the Duration is positive, this means: + * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example) + * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise + * the overall value would be negative, see third example) + * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example) + * + * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 } + * @return {Duration} + */ + normalize() { + if (!this.isValid) return this; + const vals = this.toObject(); + normalizeValues(this.matrix, vals); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Rescale units to its largest representation + * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 } + * @return {Duration} + */ + rescale() { + if (!this.isValid) return this; + const vals = removeZeroes(this.normalize().shiftToAll().toObject()); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */ + shiftTo(...units) { + if (!this.isValid) return this; + if (units.length === 0) { + return this; + } + units = units.map(u => Duration.normalizeUnit(u)); + const built = {}, + accumulated = {}, + vals = this.toObject(); + let lastUnit; + for (const k of orderedUnits$1) { + if (units.indexOf(k) >= 0) { + lastUnit = k; + let own = 0; + + // anything we haven't boiled down yet should get boiled to this unit + for (const ak in accumulated) { + own += this.matrix[ak][k] * accumulated[ak]; + accumulated[ak] = 0; + } + + // plus anything that's already in this unit + if (isNumber(vals[k])) { + own += vals[k]; + } + + // only keep the integer part for now in the hopes of putting any decimal part + // into a smaller unit later + const i = Math.trunc(own); + built[k] = i; + accumulated[k] = (own * 1000 - i * 1000) / 1000; + + // otherwise, keep it in the wings to boil it later + } else if (isNumber(vals[k])) { + accumulated[k] = vals[k]; + } + } + + // anything leftover becomes the decimal for the last unit + // lastUnit must be defined since units is not empty + for (const key in accumulated) { + if (accumulated[key] !== 0) { + built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; + } + } + normalizeValues(this.matrix, built); + return clone$1(this, { + values: built + }, true); + } + + /** + * Shift this Duration to all available units. + * Same as shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds") + * @return {Duration} + */ + shiftToAll() { + if (!this.isValid) return this; + return this.shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"); + } + + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */ + negate() { + if (!this.isValid) return this; + const negated = {}; + for (const k of Object.keys(this.values)) { + negated[k] = this.values[k] === 0 ? 0 : -this.values[k]; + } + return clone$1(this, { + values: negated + }, true); + } + + /** + * Removes all units with values equal to 0 from this Duration. + * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 } + * @return {Duration} + */ + removeZeros() { + if (!this.isValid) return this; + const vals = removeZeroes(this.values); + return clone$1(this, { + values: vals + }, true); + } + + /** + * Get the years. + * @type {number} + */ + get years() { + return this.isValid ? this.values.years || 0 : NaN; + } + + /** + * Get the quarters. + * @type {number} + */ + get quarters() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + + /** + * Get the months. + * @type {number} + */ + get months() { + return this.isValid ? this.values.months || 0 : NaN; + } + + /** + * Get the weeks + * @type {number} + */ + get weeks() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + + /** + * Get the days. + * @type {number} + */ + get days() { + return this.isValid ? this.values.days || 0 : NaN; + } + + /** + * Get the hours. + * @type {number} + */ + get hours() { + return this.isValid ? this.values.hours || 0 : NaN; + } + + /** + * Get the minutes. + * @type {number} + */ + get minutes() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + + /** + * Get the seconds. + * @return {number} + */ + get seconds() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + + /** + * Get the milliseconds. + * @return {number} + */ + get milliseconds() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + get isValid() { + return this.invalid === null; + } + + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + if (!this.loc.equals(other.loc)) { + return false; + } + function eq(v1, v2) { + // Consider 0 and undefined as equal + if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0; + return v1 === v2; + } + for (const u of orderedUnits$1) { + if (!eq(this.values[u], other.values[u])) { + return false; + } + } + return true; + } +} + +const INVALID$1 = "Invalid Interval"; + +// checks if the start is equal to or before the end +function validateStartEnd(start, end) { + if (!start || !start.isValid) { + return Interval.invalid("missing or invalid start"); + } else if (!end || !end.isValid) { + return Interval.invalid("missing or invalid end"); + } else if (end < start) { + return Interval.invalid("end before start", `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`); + } else { + return null; + } +} + +/** + * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them. + * + * Here is a brief overview of the most commonly used methods and getters in Interval: + * + * * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}. + * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end. + * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}. + * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}. + * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs} + * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}. + */ +class Interval { + /** + * @private + */ + constructor(config) { + /** + * @access private + */ + this.s = config.start; + /** + * @access private + */ + this.e = config.end; + /** + * @access private + */ + this.invalid = config.invalid || null; + /** + * @access private + */ + this.isLuxonInterval = true; + } + + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); + } + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidIntervalError(invalid); + } else { + return new Interval({ + invalid + }); + } + } + + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */ + static fromDateTimes(start, end) { + const builtStart = friendlyDateTime(start), + builtEnd = friendlyDateTime(end); + const validateError = validateStartEnd(builtStart, builtEnd); + if (validateError == null) { + return new Interval({ + start: builtStart, + end: builtEnd + }); + } else { + return validateError; + } + } + + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + static after(start, duration) { + const dur = Duration.fromDurationLike(duration), + dt = friendlyDateTime(start); + return Interval.fromDateTimes(dt, dt.plus(dur)); + } + + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + static before(end, duration) { + const dur = Duration.fromDurationLike(duration), + dt = friendlyDateTime(end); + return Interval.fromDateTimes(dt.minus(dur), dt); + } + + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */ + static fromISO(text, opts) { + const [s, e] = (text || "").split("/", 2); + if (s && e) { + let start, startIsValid; + try { + start = DateTime.fromISO(s, opts); + startIsValid = start.isValid; + } catch (e) { + startIsValid = false; + } + let end, endIsValid; + try { + end = DateTime.fromISO(e, opts); + endIsValid = end.isValid; + } catch (e) { + endIsValid = false; + } + if (startIsValid && endIsValid) { + return Interval.fromDateTimes(start, end); + } + if (startIsValid) { + const dur = Duration.fromISO(e, opts); + if (dur.isValid) { + return Interval.after(start, dur); + } + } else if (endIsValid) { + const dur = Duration.fromISO(s, opts); + if (dur.isValid) { + return Interval.before(end, dur); + } + } + } + return Interval.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); + } + + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isInterval(o) { + return o && o.isLuxonInterval || false; + } + + /** + * Returns the start of the Interval + * @type {DateTime} + */ + get start() { + return this.isValid ? this.s : null; + } + + /** + * Returns the end of the Interval. This is the first instant which is not part of the interval + * (Interval is half-open). + * @type {DateTime} + */ + get end() { + return this.isValid ? this.e : null; + } + + /** + * Returns the last DateTime included in the interval (since end is not part of the interval) + * @type {DateTime} + */ + get lastDateTime() { + return this.isValid ? this.e ? this.e.minus(1) : null : null; + } + + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + get isValid() { + return this.invalidReason === null; + } + + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + length(unit = "milliseconds") { + return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN; + } + + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime + * @return {number} + */ + count(unit = "milliseconds", opts) { + if (!this.isValid) return NaN; + const start = this.start.startOf(unit, opts); + let end; + if (opts != null && opts.useLocaleWeeks) { + end = this.end.reconfigure({ + locale: start.locale + }); + } else { + end = this.end; + } + end = end.startOf(unit, opts); + return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf()); + } + + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */ + hasSame(unit) { + return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false; + } + + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */ + isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + isAfter(dateTime) { + if (!this.isValid) return false; + return this.s > dateTime; + } + + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + isBefore(dateTime) { + if (!this.isValid) return false; + return this.e <= dateTime; + } + + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + contains(dateTime) { + if (!this.isValid) return false; + return this.s <= dateTime && this.e > dateTime; + } + + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */ + set({ + start, + end + } = {}) { + if (!this.isValid) return this; + return Interval.fromDateTimes(start || this.s, end || this.e); + } + + /** + * Split this Interval at each of the specified DateTimes + * @param {...DateTime} dateTimes - the unit of time to count. + * @return {Array} + */ + splitAt(...dateTimes) { + if (!this.isValid) return []; + const sorted = dateTimes.map(friendlyDateTime).filter(d => this.contains(d)).sort((a, b) => a.toMillis() - b.toMillis()), + results = []; + let { + s + } = this, + i = 0; + while (s < this.e) { + const added = sorted[i] || this.e, + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + i += 1; + } + return results; + } + + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {Array} + */ + splitBy(duration) { + const dur = Duration.fromDurationLike(duration); + if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { + return []; + } + let { + s + } = this, + idx = 1, + next; + const results = []; + while (s < this.e) { + const added = this.start.plus(dur.mapUnits(x => x * idx)); + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + idx += 1; + } + return results; + } + + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {Array} + */ + divideEqually(numberOfParts) { + if (!this.isValid) return []; + return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); + } + + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */ + overlaps(other) { + return this.e > other.s && this.s < other.e; + } + + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */ + abutsStart(other) { + if (!this.isValid) return false; + return +this.e === +other.s; + } + + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */ + abutsEnd(other) { + if (!this.isValid) return false; + return +other.e === +this.s; + } + + /** + * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise. + * @param {Interval} other + * @return {boolean} + */ + engulfs(other) { + if (!this.isValid) return false; + return this.s <= other.s && this.e >= other.e; + } + + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + return this.s.equals(other.s) && this.e.equals(other.e); + } + + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */ + intersection(other) { + if (!this.isValid) return this; + const s = this.s > other.s ? this.s : other.s, + e = this.e < other.e ? this.e : other.e; + if (s >= e) { + return null; + } else { + return Interval.fromDateTimes(s, e); + } + } + + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */ + union(other) { + if (!this.isValid) return this; + const s = this.s < other.s ? this.s : other.s, + e = this.e > other.e ? this.e : other.e; + return Interval.fromDateTimes(s, e); + } + + /** + * Merge an array of Intervals into an equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * The resulting array will contain the Intervals in ascending order, that is, starting with the earliest Interval + * and ending with the latest. + * + * @param {Array} intervals + * @return {Array} + */ + static merge(intervals) { + const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce(([sofar, current], item) => { + if (!current) { + return [sofar, item]; + } else if (current.overlaps(item) || current.abutsStart(item)) { + return [sofar, current.union(item)]; + } else { + return [sofar.concat([current]), item]; + } + }, [[], null]); + if (final) { + found.push(final); + } + return found; + } + + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {Array} intervals + * @return {Array} + */ + static xor(intervals) { + let start = null, + currentCount = 0; + const results = [], + ends = intervals.map(i => [{ + time: i.s, + type: "s" + }, { + time: i.e, + type: "e" + }]), + flattened = Array.prototype.concat(...ends), + arr = flattened.sort((a, b) => a.time - b.time); + for (const i of arr) { + currentCount += i.type === "s" ? 1 : -1; + if (currentCount === 1) { + start = i.time; + } else { + if (start && +start !== +i.time) { + results.push(Interval.fromDateTimes(start, i.time)); + } + start = null; + } + } + return Interval.merge(results); + } + + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {Array} + */ + difference(...intervals) { + return Interval.xor([this].concat(intervals)).map(i => this.intersection(i)).filter(i => i && !i.isEmpty()); + } + + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */ + toString() { + if (!this.isValid) return INVALID$1; + return `[${this.s.toISO()} – ${this.e.toISO()})`; + } + + /** + * Returns a string representation of this Interval appropriate for the REPL. + * @return {string} + */ + [Symbol.for("nodejs.util.inspect.custom")]() { + if (this.isValid) { + return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`; + } else { + return `Interval { Invalid, reason: ${this.invalidReason} }`; + } + } + + /** + * Returns a localized string representing this Interval. Accepts the same options as the + * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as + * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method + * is browser-specific, but in general it will return an appropriate representation of the + * Interval in the assigned locale. Defaults to the system's locale if no locale has been + * specified. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or + * Intl.DateTimeFormat constructor options. + * @param {Object} opts - Options to override the configuration of the start DateTime. + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022 + * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022 + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM + * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p + * @return {string} + */ + toLocaleString(formatOpts = DATE_SHORT, opts = {}) { + return this.isValid ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) : INVALID$1; + } + + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */ + toISO(opts) { + if (!this.isValid) return INVALID$1; + return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`; + } + + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */ + toISODate() { + if (!this.isValid) return INVALID$1; + return `${this.s.toISODate()}/${this.e.toISODate()}`; + } + + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime#toISO} + * @return {string} + */ + toISOTime(opts) { + if (!this.isValid) return INVALID$1; + return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`; + } + + /** + * Returns a string representation of this Interval formatted according to the specified format + * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible + * formatting tool. + * @param {string} dateFormat - The format string. This string formats the start and end time. + * See {@link DateTime#toFormat} for details. + * @param {Object} opts - Options. + * @param {string} [opts.separator = ' – '] - A separator to place between the start and end + * representations. + * @return {string} + */ + toFormat(dateFormat, { + separator = " – " + } = {}) { + if (!this.isValid) return INVALID$1; + return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`; + } + + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */ + toDuration(unit, opts) { + if (!this.isValid) { + return Duration.invalid(this.invalidReason); + } + return this.e.diff(this.s, unit, opts); + } + + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */ + mapEndpoints(mapFn) { + return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); + } +} + +/** + * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment. + */ +class Info { + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + static hasDST(zone = Settings.defaultZone) { + const proto = DateTime.now().setZone(zone).set({ + month: 12 + }); + return !zone.isUniversal && proto.offset !== proto.set({ + month: 6 + }).offset; + } + + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */ + static isValidIANAZone(zone) { + return IANAZone.isValidZone(zone); + } + + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone#isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */ + static normalizeZone(input) { + return normalizeZone(input, Settings.defaultZone); + } + + /** + * Get the weekday on which the week starts according to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} the start of the week, 1 for Monday through 7 for Sunday + */ + static getStartOfWeek({ + locale = null, + locObj = null + } = {}) { + return (locObj || Locale.create(locale)).getStartOfWeek(); + } + + /** + * Get the minimum number of days necessary in a week before it is considered part of the next year according + * to the given locale. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number} + */ + static getMinimumDaysInFirstWeek({ + locale = null, + locObj = null + } = {}) { + return (locObj || Locale.create(locale)).getMinDaysInFirstWeek(); + } + + /** + * Get the weekdays, which are considered the weekend according to the given locale + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.locObj=null] - an existing locale object to use + * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday + */ + static getWeekendWeekdays({ + locale = null, + locObj = null + } = {}) { + // copy the array, because we cache it internally + return (locObj || Locale.create(locale)).getWeekendDays().slice(); + } + + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {Array} + */ + static months(length = "long", { + locale = null, + numberingSystem = null, + locObj = null, + outputCalendar = "gregory" + } = {}) { + return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length); + } + + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link Info#months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {Array} + */ + static monthsFormat(length = "long", { + locale = null, + numberingSystem = null, + locObj = null, + outputCalendar = "gregory" + } = {}) { + return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true); + } + + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {Array} + */ + static weekdays(length = "long", { + locale = null, + numberingSystem = null, + locObj = null + } = {}) { + return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length); + } + + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link Info#weekdays} + * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.locObj=null] - an existing locale object to use + * @return {Array} + */ + static weekdaysFormat(length = "long", { + locale = null, + numberingSystem = null, + locObj = null + } = {}) { + return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true); + } + + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {Array} + */ + static meridiems({ + locale = null + } = {}) { + return Locale.create(locale).meridiems(); + } + + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {Array} + */ + static eras(length = "short", { + locale = null + } = {}) { + return Locale.create(locale, null, "gregory").eras(length); + } + + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case. + * Keys: + * * `relative`: whether this environment supports relative time formatting + * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale + * @example Info.features() //=> { relative: false, localeWeek: true } + * @return {Object} + */ + static features() { + return { + relative: hasRelative(), + localeWeek: hasLocaleWeekInfo() + }; + } +} + +function dayDiff(earlier, later) { + const utcDayStart = dt => dt.toUTC(0, { + keepLocalTime: true + }).startOf("day").valueOf(), + ms = utcDayStart(later) - utcDayStart(earlier); + return Math.floor(Duration.fromMillis(ms).as("days")); +} +function highOrderDiffs(cursor, later, units) { + const differs = [["years", (a, b) => b.year - a.year], ["quarters", (a, b) => b.quarter - a.quarter + (b.year - a.year) * 4], ["months", (a, b) => b.month - a.month + (b.year - a.year) * 12], ["weeks", (a, b) => { + const days = dayDiff(a, b); + return (days - days % 7) / 7; + }], ["days", dayDiff]]; + const results = {}; + const earlier = cursor; + let lowestOrder, highWater; + + /* This loop tries to diff using larger units first. + If we overshoot, we backtrack and try the next smaller unit. + "cursor" starts out at the earlier timestamp and moves closer and closer to "later" + as we use smaller and smaller units. + highWater keeps track of where we would be if we added one more of the smallest unit, + this is used later to potentially convert any difference smaller than the smallest higher order unit + into a fraction of that smallest higher order unit + */ + for (const [unit, differ] of differs) { + if (units.indexOf(unit) >= 0) { + lowestOrder = unit; + results[unit] = differ(cursor, later); + highWater = earlier.plus(results); + if (highWater > later) { + // we overshot the end point, backtrack cursor by 1 + results[unit]--; + cursor = earlier.plus(results); + + // if we are still overshooting now, we need to backtrack again + // this happens in certain situations when diffing times in different zones, + // because this calculation ignores time zones + if (cursor > later) { + // keep the "overshot by 1" around as highWater + highWater = cursor; + // backtrack cursor by 1 + results[unit]--; + cursor = earlier.plus(results); + } + } else { + cursor = highWater; + } + } + } + return [cursor, results, highWater, lowestOrder]; +} +function diff (earlier, later, units, opts) { + let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units); + const remainingMillis = later - cursor; + const lowerOrderUnits = units.filter(u => ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0); + if (lowerOrderUnits.length === 0) { + if (highWater < later) { + highWater = cursor.plus({ + [lowestOrder]: 1 + }); + } + if (highWater !== cursor) { + results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); + } + } + const duration = Duration.fromObject(results, opts); + if (lowerOrderUnits.length > 0) { + return Duration.fromMillis(remainingMillis, opts).shiftTo(...lowerOrderUnits).plus(duration); + } else { + return duration; + } +} + +const MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; +function intUnit(regex, post = i => i) { + return { + regex, + deser: ([s]) => post(parseDigits(s)) + }; +} +const NBSP = String.fromCharCode(160); +const spaceOrNBSP = `[ ${NBSP}]`; +const spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g"); +function fixListRegex(s) { + // make dots optional and also make them literal + // make space and non breakable space characters interchangeable + return s.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP); +} +function stripInsensitivities(s) { + return s.replace(/\./g, "") // ignore dots that were made optional + .replace(spaceOrNBSPRegExp, " ") // interchange space and nbsp + .toLowerCase(); +} +function oneOf(strings, startIndex) { + if (strings === null) { + return null; + } else { + return { + regex: RegExp(strings.map(fixListRegex).join("|")), + deser: ([s]) => strings.findIndex(i => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex + }; + } +} +function offset(regex, groups) { + return { + regex, + deser: ([, h, m]) => signedOffset(h, m), + groups + }; +} +function simple(regex) { + return { + regex, + deser: ([s]) => s + }; +} +function escapeToken(value) { + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); +} + +/** + * @param token + * @param {Locale} loc + */ +function unitForToken(token, loc) { + const one = digitRegex(loc), + two = digitRegex(loc, "{2}"), + three = digitRegex(loc, "{3}"), + four = digitRegex(loc, "{4}"), + six = digitRegex(loc, "{6}"), + oneOrTwo = digitRegex(loc, "{1,2}"), + oneToThree = digitRegex(loc, "{1,3}"), + oneToSix = digitRegex(loc, "{1,6}"), + oneToNine = digitRegex(loc, "{1,9}"), + twoToFour = digitRegex(loc, "{2,4}"), + fourToSix = digitRegex(loc, "{4,6}"), + literal = t => ({ + regex: RegExp(escapeToken(t.val)), + deser: ([s]) => s, + literal: true + }), + unitate = t => { + if (token.literal) { + return literal(t); + } + switch (t.val) { + // era + case "G": + return oneOf(loc.eras("short"), 0); + case "GG": + return oneOf(loc.eras("long"), 0); + // years + case "y": + return intUnit(oneToSix); + case "yy": + return intUnit(twoToFour, untruncateYear); + case "yyyy": + return intUnit(four); + case "yyyyy": + return intUnit(fourToSix); + case "yyyyyy": + return intUnit(six); + // months + case "M": + return intUnit(oneOrTwo); + case "MM": + return intUnit(two); + case "MMM": + return oneOf(loc.months("short", true), 1); + case "MMMM": + return oneOf(loc.months("long", true), 1); + case "L": + return intUnit(oneOrTwo); + case "LL": + return intUnit(two); + case "LLL": + return oneOf(loc.months("short", false), 1); + case "LLLL": + return oneOf(loc.months("long", false), 1); + // dates + case "d": + return intUnit(oneOrTwo); + case "dd": + return intUnit(two); + // ordinals + case "o": + return intUnit(oneToThree); + case "ooo": + return intUnit(three); + // time + case "HH": + return intUnit(two); + case "H": + return intUnit(oneOrTwo); + case "hh": + return intUnit(two); + case "h": + return intUnit(oneOrTwo); + case "mm": + return intUnit(two); + case "m": + return intUnit(oneOrTwo); + case "q": + return intUnit(oneOrTwo); + case "qq": + return intUnit(two); + case "s": + return intUnit(oneOrTwo); + case "ss": + return intUnit(two); + case "S": + return intUnit(oneToThree); + case "SSS": + return intUnit(three); + case "u": + return simple(oneToNine); + case "uu": + return simple(oneOrTwo); + case "uuu": + return intUnit(one); + // meridiem + case "a": + return oneOf(loc.meridiems(), 0); + // weekYear (k) + case "kkkk": + return intUnit(four); + case "kk": + return intUnit(twoToFour, untruncateYear); + // weekNumber (W) + case "W": + return intUnit(oneOrTwo); + case "WW": + return intUnit(two); + // weekdays + case "E": + case "c": + return intUnit(one); + case "EEE": + return oneOf(loc.weekdays("short", false), 1); + case "EEEE": + return oneOf(loc.weekdays("long", false), 1); + case "ccc": + return oneOf(loc.weekdays("short", true), 1); + case "cccc": + return oneOf(loc.weekdays("long", true), 1); + // offset/zone + case "Z": + case "ZZ": + return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2); + case "ZZZ": + return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2); + // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing + // because we don't have any way to figure out what they are + case "z": + return simple(/[a-z_+-/]{1,256}?/i); + // this special-case "token" represents a place where a macro-token expanded into a white-space literal + // in this case we accept any non-newline white-space + case " ": + return simple(/[^\S\n\r]/); + default: + return literal(t); + } + }; + const unit = unitate(token) || { + invalidReason: MISSING_FTP + }; + unit.token = token; + return unit; +} +const partTypeStyleToTokenVal = { + year: { + "2-digit": "yy", + numeric: "yyyyy" + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM" + }, + day: { + numeric: "d", + "2-digit": "dd" + }, + weekday: { + short: "EEE", + long: "EEEE" + }, + dayperiod: "a", + dayPeriod: "a", + hour12: { + numeric: "h", + "2-digit": "hh" + }, + hour24: { + numeric: "H", + "2-digit": "HH" + }, + minute: { + numeric: "m", + "2-digit": "mm" + }, + second: { + numeric: "s", + "2-digit": "ss" + }, + timeZoneName: { + long: "ZZZZZ", + short: "ZZZ" + } +}; +function tokenForPart(part, formatOpts, resolvedOpts) { + const { + type, + value + } = part; + if (type === "literal") { + const isSpace = /^\s+$/.test(value); + return { + literal: !isSpace, + val: isSpace ? " " : value + }; + } + const style = formatOpts[type]; + + // The user might have explicitly specified hour12 or hourCycle + // if so, respect their decision + // if not, refer back to the resolvedOpts, which are based on the locale + let actualType = type; + if (type === "hour") { + if (formatOpts.hour12 != null) { + actualType = formatOpts.hour12 ? "hour12" : "hour24"; + } else if (formatOpts.hourCycle != null) { + if (formatOpts.hourCycle === "h11" || formatOpts.hourCycle === "h12") { + actualType = "hour12"; + } else { + actualType = "hour24"; + } + } else { + // tokens only differentiate between 24 hours or not, + // so we do not need to check hourCycle here, which is less supported anyways + actualType = resolvedOpts.hour12 ? "hour12" : "hour24"; + } + } + let val = partTypeStyleToTokenVal[actualType]; + if (typeof val === "object") { + val = val[style]; + } + if (val) { + return { + literal: false, + val + }; + } + return undefined; +} +function buildRegex(units) { + const re = units.map(u => u.regex).reduce((f, r) => `${f}(${r.source})`, ""); + return [`^${re}$`, units]; +} +function match(input, regex, handlers) { + const matches = input.match(regex); + if (matches) { + const all = {}; + let matchIndex = 1; + for (const i in handlers) { + if (hasOwnProperty(handlers, i)) { + const h = handlers[i], + groups = h.groups ? h.groups + 1 : 1; + if (!h.literal && h.token) { + all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); + } + matchIndex += groups; + } + } + return [matches, all]; + } else { + return [matches, {}]; + } +} +function dateTimeFromMatches(matches) { + const toField = token => { + switch (token) { + case "S": + return "millisecond"; + case "s": + return "second"; + case "m": + return "minute"; + case "h": + case "H": + return "hour"; + case "d": + return "day"; + case "o": + return "ordinal"; + case "L": + case "M": + return "month"; + case "y": + return "year"; + case "E": + case "c": + return "weekday"; + case "W": + return "weekNumber"; + case "k": + return "weekYear"; + case "q": + return "quarter"; + default: + return null; + } + }; + let zone = null; + let specificOffset; + if (!isUndefined(matches.z)) { + zone = IANAZone.create(matches.z); + } + if (!isUndefined(matches.Z)) { + if (!zone) { + zone = new FixedOffsetZone(matches.Z); + } + specificOffset = matches.Z; + } + if (!isUndefined(matches.q)) { + matches.M = (matches.q - 1) * 3 + 1; + } + if (!isUndefined(matches.h)) { + if (matches.h < 12 && matches.a === 1) { + matches.h += 12; + } else if (matches.h === 12 && matches.a === 0) { + matches.h = 0; + } + } + if (matches.G === 0 && matches.y) { + matches.y = -matches.y; + } + if (!isUndefined(matches.u)) { + matches.S = parseMillis(matches.u); + } + const vals = Object.keys(matches).reduce((r, k) => { + const f = toField(k); + if (f) { + r[f] = matches[k]; + } + return r; + }, {}); + return [vals, zone, specificOffset]; +} +let dummyDateTimeCache = null; +function getDummyDateTime() { + if (!dummyDateTimeCache) { + dummyDateTimeCache = DateTime.fromMillis(1555555555555); + } + return dummyDateTimeCache; +} +function maybeExpandMacroToken(token, locale) { + if (token.literal) { + return token; + } + const formatOpts = Formatter.macroTokenToFormatOpts(token.val); + const tokens = formatOptsToTokens(formatOpts, locale); + if (tokens == null || tokens.includes(undefined)) { + return token; + } + return tokens; +} +function expandMacroTokens(tokens, locale) { + return Array.prototype.concat(...tokens.map(t => maybeExpandMacroToken(t, locale))); +} + +/** + * @private + */ + +class TokenParser { + constructor(locale, format) { + this.locale = locale; + this.format = format; + this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale); + this.units = this.tokens.map(t => unitForToken(t, locale)); + this.disqualifyingUnit = this.units.find(t => t.invalidReason); + if (!this.disqualifyingUnit) { + const [regexString, handlers] = buildRegex(this.units); + this.regex = RegExp(regexString, "i"); + this.handlers = handlers; + } + } + explainFromTokens(input) { + if (!this.isValid) { + return { + input, + tokens: this.tokens, + invalidReason: this.invalidReason + }; + } else { + const [rawMatches, matches] = match(input, this.regex, this.handlers), + [result, zone, specificOffset] = matches ? dateTimeFromMatches(matches) : [null, null, undefined]; + if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { + throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format"); + } + return { + input, + tokens: this.tokens, + regex: this.regex, + rawMatches, + matches, + result, + zone, + specificOffset + }; + } + } + get isValid() { + return !this.disqualifyingUnit; + } + get invalidReason() { + return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null; + } +} +function explainFromTokens(locale, input, format) { + const parser = new TokenParser(locale, format); + return parser.explainFromTokens(input); +} +function parseFromTokens(locale, input, format) { + const { + result, + zone, + specificOffset, + invalidReason + } = explainFromTokens(locale, input, format); + return [result, zone, specificOffset, invalidReason]; +} +function formatOptsToTokens(formatOpts, locale) { + if (!formatOpts) { + return null; + } + const formatter = Formatter.create(locale, formatOpts); + const df = formatter.dtFormatter(getDummyDateTime()); + const parts = df.formatToParts(); + const resolvedOpts = df.resolvedOptions(); + return parts.map(p => tokenForPart(p, formatOpts, resolvedOpts)); +} + +const INVALID = "Invalid DateTime"; +const MAX_DATE = 8.64e15; +function unsupportedZone(zone) { + return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`); +} + +// we cache week data on the DT object and this intermediates the cache +/** + * @param {DateTime} dt + */ +function possiblyCachedWeekData(dt) { + if (dt.weekData === null) { + dt.weekData = gregorianToWeek(dt.c); + } + return dt.weekData; +} + +/** + * @param {DateTime} dt + */ +function possiblyCachedLocalWeekData(dt) { + if (dt.localWeekData === null) { + dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek()); + } + return dt.localWeekData; +} + +// clone really means, "make a new object with these modifications". all "setters" really use this +// to create a new object while only changing some of the properties +function clone(inst, alts) { + const current = { + ts: inst.ts, + zone: inst.zone, + c: inst.c, + o: inst.o, + loc: inst.loc, + invalid: inst.invalid + }; + return new DateTime({ + ...current, + ...alts, + old: current + }); +} + +// find the right offset a given local time. The o input is our guess, which determines which +// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST) +function fixOffset(localTS, o, tz) { + // Our UTC time is just a guess because our offset is just a guess + let utcGuess = localTS - o * 60 * 1000; + + // Test whether the zone matches the offset for this ts + const o2 = tz.offset(utcGuess); + + // If so, offset didn't change and we're done + if (o === o2) { + return [utcGuess, o]; + } + + // If not, change the ts by the difference in the offset + utcGuess -= (o2 - o) * 60 * 1000; + + // If that gives us the local time we want, we're done + const o3 = tz.offset(utcGuess); + if (o2 === o3) { + return [utcGuess, o2]; + } + + // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time + return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; +} + +// convert an epoch timestamp into a calendar object with the given offset +function tsToObj(ts, offset) { + ts += offset * 60 * 1000; + const d = new Date(ts); + return { + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate(), + hour: d.getUTCHours(), + minute: d.getUTCMinutes(), + second: d.getUTCSeconds(), + millisecond: d.getUTCMilliseconds() + }; +} + +// convert a calendar object to a epoch timestamp +function objToTS(obj, offset, zone) { + return fixOffset(objToLocalTS(obj), offset, zone); +} + +// create a new DT instance by adding a duration, adjusting for DSTs +function adjustTime(inst, dur) { + const oPre = inst.o, + year = inst.c.year + Math.trunc(dur.years), + month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, + c = { + ...inst.c, + year, + month, + day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + Math.trunc(dur.weeks) * 7 + }, + millisToAdd = Duration.fromObject({ + years: dur.years - Math.trunc(dur.years), + quarters: dur.quarters - Math.trunc(dur.quarters), + months: dur.months - Math.trunc(dur.months), + weeks: dur.weeks - Math.trunc(dur.weeks), + days: dur.days - Math.trunc(dur.days), + hours: dur.hours, + minutes: dur.minutes, + seconds: dur.seconds, + milliseconds: dur.milliseconds + }).as("milliseconds"), + localTS = objToLocalTS(c); + let [ts, o] = fixOffset(localTS, oPre, inst.zone); + if (millisToAdd !== 0) { + ts += millisToAdd; + // that could have changed the offset by going over a DST, but we want to keep the ts the same + o = inst.zone.offset(ts); + } + return { + ts, + o + }; +} + +// helper useful in turning the results of parsing into real dates +// by handling the zone options +function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) { + const { + setZone, + zone + } = opts; + if (parsed && Object.keys(parsed).length !== 0 || parsedZone) { + const interpretationZone = parsedZone || zone, + inst = DateTime.fromObject(parsed, { + ...opts, + zone: interpretationZone, + specificOffset + }); + return setZone ? inst : inst.setZone(zone); + } else { + return DateTime.invalid(new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`)); + } +} + +// if you want to output a technical format (e.g. RFC 2822), this helper +// helps handle the details +function toTechFormat(dt, format, allowZ = true) { + return dt.isValid ? Formatter.create(Locale.create("en-US"), { + allowZ, + forceSimple: true + }).formatDateTimeFromString(dt, format) : null; +} +function toISODate(o, extended, precision) { + const longFormat = o.c.year > 9999 || o.c.year < 0; + let c = ""; + if (longFormat && o.c.year >= 0) c += "+"; + c += padStart(o.c.year, longFormat ? 6 : 4); + if (precision === "year") return c; + if (extended) { + c += "-"; + c += padStart(o.c.month); + if (precision === "month") return c; + c += "-"; + } else { + c += padStart(o.c.month); + if (precision === "month") return c; + } + c += padStart(o.c.day); + return c; +} +function toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision) { + let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0, + c = ""; + switch (precision) { + case "day": + case "month": + case "year": + break; + default: + c += padStart(o.c.hour); + if (precision === "hour") break; + if (extended) { + c += ":"; + c += padStart(o.c.minute); + if (precision === "minute") break; + if (showSeconds) { + c += ":"; + c += padStart(o.c.second); + } + } else { + c += padStart(o.c.minute); + if (precision === "minute") break; + if (showSeconds) { + c += padStart(o.c.second); + } + } + if (precision === "second") break; + if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) { + c += "."; + c += padStart(o.c.millisecond, 3); + } + } + if (includeOffset) { + if (o.isOffsetFixed && o.offset === 0 && !extendedZone) { + c += "Z"; + } else if (o.o < 0) { + c += "-"; + c += padStart(Math.trunc(-o.o / 60)); + c += ":"; + c += padStart(Math.trunc(-o.o % 60)); + } else { + c += "+"; + c += padStart(Math.trunc(o.o / 60)); + c += ":"; + c += padStart(Math.trunc(o.o % 60)); + } + } + if (extendedZone) { + c += "[" + o.zone.ianaName + "]"; + } + return c; +} + +// defaults for unspecified units in the supported calendars +const defaultUnitValues = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultWeekUnitValues = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultOrdinalUnitValues = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }; + +// Units in the supported calendars, sorted by bigness +const orderedUnits = ["year", "month", "day", "hour", "minute", "second", "millisecond"], + orderedWeekUnits = ["weekYear", "weekNumber", "weekday", "hour", "minute", "second", "millisecond"], + orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; + +// standardize case and plurality in units +function normalizeUnit(unit) { + const normalized = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal" + }[unit.toLowerCase()]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; +} +function normalizeUnitWithLocalWeeks(unit) { + switch (unit.toLowerCase()) { + case "localweekday": + case "localweekdays": + return "localWeekday"; + case "localweeknumber": + case "localweeknumbers": + return "localWeekNumber"; + case "localweekyear": + case "localweekyears": + return "localWeekYear"; + default: + return normalizeUnit(unit); + } +} + +// cache offsets for zones based on the current timestamp when this function is +// first called. When we are handling a datetime from components like (year, +// month, day, hour) in a time zone, we need a guess about what the timezone +// offset is so that we can convert into a UTC timestamp. One way is to find the +// offset of now in the zone. The actual date may have a different offset (for +// example, if we handle a date in June while we're in December in a zone that +// observes DST), but we can check and adjust that. +// +// When handling many dates, calculating the offset for now every time is +// expensive. It's just a guess, so we can cache the offset to use even if we +// are right on a time change boundary (we'll just correct in the other +// direction). Using a timestamp from first read is a slight optimization for +// handling dates close to the current date, since those dates will usually be +// in the same offset (we could set the timestamp statically, instead). We use a +// single timestamp for all zones to make things a bit more predictable. +// +// This is safe for quickDT (used by local() and utc()) because we don't fill in +// higher-order units from tsNow (as we do in fromObject, this requires that +// offset is calculated from tsNow). +/** + * @param {Zone} zone + * @return {number} + */ +function guessOffsetForZone(zone) { + if (zoneOffsetTs === undefined) { + zoneOffsetTs = Settings.now(); + } + + // Do not cache anything but IANA zones, because it is not safe to do so. + // Guessing an offset which is not present in the zone can cause wrong results from fixOffset + if (zone.type !== "iana") { + return zone.offset(zoneOffsetTs); + } + const zoneName = zone.name; + let offsetGuess = zoneOffsetGuessCache.get(zoneName); + if (offsetGuess === undefined) { + offsetGuess = zone.offset(zoneOffsetTs); + zoneOffsetGuessCache.set(zoneName, offsetGuess); + } + return offsetGuess; +} + +// this is a dumbed down version of fromObject() that runs about 60% faster +// but doesn't do any validation, makes a bunch of assumptions about what units +// are present, and so on. +function quickDT(obj, opts) { + const zone = normalizeZone(opts.zone, Settings.defaultZone); + if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } + const loc = Locale.fromObject(opts); + let ts, o; + + // assume we have the higher-order units + if (!isUndefined(obj.year)) { + for (const u of orderedUnits) { + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } + } + const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + if (invalid) { + return DateTime.invalid(invalid); + } + const offsetProvis = guessOffsetForZone(zone); + [ts, o] = objToTS(obj, offsetProvis, zone); + } else { + ts = Settings.now(); + } + return new DateTime({ + ts, + zone, + loc, + o + }); +} +function diffRelative(start, end, opts) { + const round = isUndefined(opts.round) ? true : opts.round, + rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding, + format = (c, unit) => { + c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding); + const formatter = end.loc.clone(opts).relFormatter(opts); + return formatter.format(c, unit); + }, + differ = unit => { + if (opts.calendary) { + if (!end.hasSame(start, unit)) { + return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); + } else return 0; + } else { + return end.diff(start, unit).get(unit); + } + }; + if (opts.unit) { + return format(differ(opts.unit), opts.unit); + } + for (const unit of opts.units) { + const count = differ(unit); + if (Math.abs(count) >= 1) { + return format(count, unit); + } + } + return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]); +} +function lastOpts(argList) { + let opts = {}, + args; + if (argList.length > 0 && typeof argList[argList.length - 1] === "object") { + opts = argList[argList.length - 1]; + args = Array.from(argList).slice(0, argList.length - 1); + } else { + args = Array.from(argList); + } + return [opts, args]; +} + +/** + * Timestamp to use for cached zone offset guesses (exposed for test) + */ +let zoneOffsetTs; +/** + * Cache for zone offset guesses (exposed for test). + * + * This optimizes quickDT via guessOffsetForZone to avoid repeated calls of + * zone.offset(). + */ +const zoneOffsetGuessCache = new Map(); + +/** + * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. + * + * A DateTime comprises of: + * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. + * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). + * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. + * + * Here is a brief overview of the most commonly used functionality it provides: + * + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month}, + * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors. + * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}. + * + * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. + */ +class DateTime { + /** + * @access private + */ + constructor(config) { + const zone = config.zone || Settings.defaultZone; + let invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null); + /** + * @access private + */ + this.ts = isUndefined(config.ts) ? Settings.now() : config.ts; + let c = null, + o = null; + if (!invalid) { + const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); + if (unchanged) { + [c, o] = [config.old.c, config.old.o]; + } else { + // If an offset has been passed and we have not been called from + // clone(), we can trust it and avoid the offset calculation. + const ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts); + c = tsToObj(this.ts, ot); + invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; + c = invalid ? null : c; + o = invalid ? null : ot; + } + } + + /** + * @access private + */ + this._zone = zone; + /** + * @access private + */ + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + this.invalid = invalid; + /** + * @access private + */ + this.weekData = null; + /** + * @access private + */ + this.localWeekData = null; + /** + * @access private + */ + this.c = c; + /** + * @access private + */ + this.o = o; + /** + * @access private + */ + this.isLuxonDateTime = true; + } + + // CONSTRUCT + + /** + * Create a DateTime for the current instant, in the system's time zone. + * + * Use Settings to override these default values if needed. + * @example DateTime.now().toISO() //~> now in the ISO format + * @return {DateTime} + */ + static now() { + return new DateTime({}); + } + + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month, 1-indexed + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local({ zone: "America/New_York" }) //~> now, in US east coast time + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12, { locale: "fr" }) //~> 2017-03-12T00:00:00, with a French locale + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, { zone: "utc" }) //~> 2017-03-12T05:00:00, in UTC + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */ + static local() { + const [opts, args] = lastOpts(arguments), + [year, month, day, hour, minute, second, millisecond] = args; + return quickDT({ + year, + month, + day, + hour, + minute, + second, + millisecond + }, opts); + } + + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @param {Object} options - configuration options for the DateTime + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: "fr" }) //~> 2017-03-12T05:45:00Z with a French locale + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: "fr" }) //~> 2017-03-12T05:45:10.765Z with a French locale + * @return {DateTime} + */ + static utc() { + const [opts, args] = lastOpts(arguments), + [year, month, day, hour, minute, second, millisecond] = args; + opts.zone = FixedOffsetZone.utcInstance; + return quickDT({ + year, + month, + day, + hour, + minute, + second, + millisecond + }, opts); + } + + /** + * Create a DateTime from a JavaScript Date object. Uses the default zone. + * @param {Date} date - a JavaScript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */ + static fromJSDate(date, options = {}) { + const ts = isDate(date) ? date.valueOf() : NaN; + if (Number.isNaN(ts)) { + return DateTime.invalid("invalid input"); + } + const zoneToUse = normalizeZone(options.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + return new DateTime({ + ts: ts, + zone: zoneToUse, + loc: Locale.fromObject(options) + }); + } + + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromMillis(milliseconds, options = {}) { + if (!isNumber(milliseconds)) { + throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`); + } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { + // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start + return DateTime.invalid("Timestamp out of range"); + } else { + return new DateTime({ + ts: milliseconds, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromSeconds(seconds, options = {}) { + if (!isNumber(seconds)) { + throw new InvalidArgumentError("fromSeconds requires a numerical input"); + } else { + return new DateTime({ + ts: seconds * 1000, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + + /** + * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.localWeekYear - a week year, according to the locale + * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale + * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {Object} opts - options for creating this DateTime + * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26' + * @return {DateTime} + */ + static fromObject(obj, opts = {}) { + obj = obj || {}; + const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone); + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + const loc = Locale.fromObject(opts); + const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks); + const { + minDaysInFirstWeek, + startOfWeek + } = usesLocalWeekValues(normalized, loc); + const tsNow = Settings.now(), + offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber; + + // cases: + // just a weekday -> this week's instance of that weekday, no worries + // (gregorian data or ordinal) + (weekYear or weekNumber) -> error + // (gregorian month or day) + ordinal -> error + // otherwise just use weeks or ordinals or gregorian, depending on what's specified + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + const useWeekData = definiteWeekDef || normalized.weekday && !containsGregor; + + // configure ourselves to deal with gregorian dates or week stuff + let units, + defaultValues, + objNow = tsToObj(tsNow, offsetProvis); + if (useWeekData) { + units = orderedWeekUnits; + defaultValues = defaultWeekUnitValues; + objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek); + } else if (containsOrdinal) { + units = orderedOrdinalUnits; + defaultValues = defaultOrdinalUnitValues; + objNow = gregorianToOrdinal(objNow); + } else { + units = orderedUnits; + defaultValues = defaultUnitValues; + } + + // set default values for missing stuff + let foundFirst = false; + for (const u of units) { + const v = normalized[u]; + if (!isUndefined(v)) { + foundFirst = true; + } else if (foundFirst) { + normalized[u] = defaultValues[u]; + } else { + normalized[u] = objNow[u]; + } + } + + // make sure the values we have are in range + const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), + invalid = higherOrderInvalid || hasInvalidTimeData(normalized); + if (invalid) { + return DateTime.invalid(invalid); + } + + // compute the actual time + const gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, + [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), + inst = new DateTime({ + ts: tsFinal, + zone: zoneToUse, + o: offsetFinal, + loc + }); + + // gregorian data + weekday serves only to validate + if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { + return DateTime.invalid("mismatched weekday", `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`); + } + if (!inst.isValid) { + return DateTime.invalid(inst.invalid); + } + return inst; + } + + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance + * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance + * @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */ + static fromISO(text, opts = {}) { + const [vals, parsedZone] = parseISODate(text); + return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); + } + + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */ + static fromRFC2822(text, opts = {}) { + const [vals, parsedZone] = parseRFC2822Date(text); + return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); + } + + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */ + static fromHTTP(text, opts = {}) { + const [vals, parsedZone] = parseHTTPDate(text); + return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); + } + + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens). + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */ + static fromFormat(text, fmt, opts = {}) { + if (isUndefined(text) || isUndefined(fmt)) { + throw new InvalidArgumentError("fromFormat requires an input string and a format"); + } + const { + locale = null, + numberingSystem = null + } = opts, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true + }), + [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt); + if (invalid) { + return DateTime.invalid(invalid); + } else { + return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset); + } + } + + /** + * @deprecated use fromFormat instead + */ + static fromString(text, fmt, opts = {}) { + return DateTime.fromFormat(text, fmt, opts); + } + + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */ + static fromSQL(text, opts = {}) { + const [vals, parsedZone] = parseSQL(text); + return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); + } + + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent. + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */ + static invalid(reason, explanation = null) { + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); + } + const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + if (Settings.throwOnInvalid) { + throw new InvalidDateTimeError(invalid); + } else { + return new DateTime({ + invalid + }); + } + } + + /** + * Check if an object is an instance of DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + static isDateTime(o) { + return o && o.isLuxonDateTime || false; + } + + /** + * Produce the format string for a set of options + * @param formatOpts + * @param localeOpts + * @returns {string} + */ + static parseFormatForOpts(formatOpts, localeOpts = {}) { + const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts)); + return !tokenList ? null : tokenList.map(t => t ? t.val : null).join(""); + } + + /** + * Produce the the fully expanded format token for the locale + * Does NOT quote characters, so quoted tokens will not round trip correctly + * @param fmt + * @param localeOpts + * @returns {string} + */ + static expandFormat(fmt, localeOpts = {}) { + const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts)); + return expanded.map(t => t.val).join(""); + } + static resetCache() { + zoneOffsetTs = undefined; + zoneOffsetGuessCache.clear(); + } + + // INFO + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */ + get(unit) { + return this[unit]; + } + + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */ + get isValid() { + return this.invalid === null; + } + + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + get invalidReason() { + return this.invalid ? this.invalid.reason : null; + } + + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + get invalidExplanation() { + return this.invalid ? this.invalid.explanation : null; + } + + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + get locale() { + return this.isValid ? this.loc.locale : null; + } + + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + get numberingSystem() { + return this.isValid ? this.loc.numberingSystem : null; + } + + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + get outputCalendar() { + return this.isValid ? this.loc.outputCalendar : null; + } + + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + get zone() { + return this._zone; + } + + /** + * Get the name of the time zone. + * @type {string} + */ + get zoneName() { + return this.isValid ? this.zone.name : null; + } + + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + get year() { + return this.isValid ? this.c.year : NaN; + } + + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + get quarter() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + get month() { + return this.isValid ? this.c.month : NaN; + } + + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + get day() { + return this.isValid ? this.c.day : NaN; + } + + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + get hour() { + return this.isValid ? this.c.hour : NaN; + } + + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + get minute() { + return this.isValid ? this.c.minute : NaN; + } + + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + get second() { + return this.isValid ? this.c.second : NaN; + } + + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + get millisecond() { + return this.isValid ? this.c.millisecond : NaN; + } + + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 12, 31).weekYear //=> 2015 + * @type {number} + */ + get weekYear() { + return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; + } + + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + get weekNumber() { + return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; + } + + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + get weekday() { + return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; + } + + /** + * Returns true if this date is on a weekend according to the locale, false otherwise + * @returns {boolean} + */ + get isWeekend() { + return this.isValid && this.loc.getWeekendDays().includes(this.weekday); + } + + /** + * Get the day of the week according to the locale. + * 1 is the first day of the week and 7 is the last day of the week. + * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1, + * @returns {number} + */ + get localWeekday() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN; + } + + /** + * Get the week number of the week year according to the locale. Different locales assign week numbers differently, + * because the week can start on different days of the week (see localWeekday) and because a different number of days + * is required for a week to count as the first week of a year. + * @returns {number} + */ + get localWeekNumber() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN; + } + + /** + * Get the week year according to the locale. Different locales assign week numbers (and therefor week years) + * differently, see localWeekNumber. + * @returns {number} + */ + get localWeekYear() { + return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN; + } + + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + get ordinal() { + return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; + } + + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + get monthShort() { + return this.isValid ? Info.months("short", { + locObj: this.loc + })[this.month - 1] : null; + } + + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + get monthLong() { + return this.isValid ? Info.months("long", { + locObj: this.loc + })[this.month - 1] : null; + } + + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + get weekdayShort() { + return this.isValid ? Info.weekdays("short", { + locObj: this.loc + })[this.weekday - 1] : null; + } + + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + get weekdayLong() { + return this.isValid ? Info.weekdays("long", { + locObj: this.loc + })[this.weekday - 1] : null; + } + + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.now().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + get offset() { + return this.isValid ? +this.o : NaN; + } + + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + get offsetNameShort() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale + }); + } else { + return null; + } + } + + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + get offsetNameLong() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale + }); + } else { + return null; + } + } + + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + get isOffsetFixed() { + return this.isValid ? this.zone.isUniversal : null; + } + + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + get isInDST() { + if (this.isOffsetFixed) { + return false; + } else { + return this.offset > this.set({ + month: 1, + day: 1 + }).offset || this.offset > this.set({ + month: 5 + }).offset; + } + } + + /** + * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC + * in this DateTime's zone. During DST changes local time can be ambiguous, for example + * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`. + * This method will return both possible DateTimes if this DateTime's local time is ambiguous. + * @returns {DateTime[]} + */ + getPossibleOffsets() { + if (!this.isValid || this.isOffsetFixed) { + return [this]; + } + const dayMs = 86400000; + const minuteMs = 60000; + const localTS = objToLocalTS(this.c); + const oEarlier = this.zone.offset(localTS - dayMs); + const oLater = this.zone.offset(localTS + dayMs); + const o1 = this.zone.offset(localTS - oEarlier * minuteMs); + const o2 = this.zone.offset(localTS - oLater * minuteMs); + if (o1 === o2) { + return [this]; + } + const ts1 = localTS - o1 * minuteMs; + const ts2 = localTS - o2 * minuteMs; + const c1 = tsToObj(ts1, o1); + const c2 = tsToObj(ts2, o2); + if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) { + return [clone(this, { + ts: ts1 + }), clone(this, { + ts: ts2 + })]; + } + return [this]; + } + + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */ + get isInLeapYear() { + return isLeapYear(this.year); + } + + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + get daysInMonth() { + return daysInMonth(this.year, this.month); + } + + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + get daysInYear() { + return this.isValid ? daysInYear(this.year) : NaN; + } + + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + get weeksInWeekYear() { + return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; + } + + /** + * Returns the number of weeks in this DateTime's local week year + * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52 + * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53 + * @type {number} + */ + get weeksInLocalWeekYear() { + return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN; + } + + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + resolvedLocaleOptions(opts = {}) { + const { + locale, + numberingSystem, + calendar + } = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this); + return { + locale, + numberingSystem, + outputCalendar: calendar + }; + } + + // TRANSFORM + + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link DateTime#setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */ + toUTC(offset = 0, opts = {}) { + return this.setZone(FixedOffsetZone.instance(offset), opts); + } + + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */ + toLocal() { + return this.setZone(Settings.defaultZone); + } + + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */ + setZone(zone, { + keepLocalTime = false, + keepCalendarTime = false + } = {}) { + zone = normalizeZone(zone, Settings.defaultZone); + if (zone.equals(this.zone)) { + return this; + } else if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } else { + let newTS = this.ts; + if (keepLocalTime || keepCalendarTime) { + const offsetGuess = zone.offset(this.ts); + const asObj = this.toObject(); + [newTS] = objToTS(asObj, offsetGuess, zone); + } + return clone(this, { + ts: newTS, + zone + }); + } + } + + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */ + reconfigure({ + locale, + numberingSystem, + outputCalendar + } = {}) { + const loc = this.loc.clone({ + locale, + numberingSystem, + outputCalendar + }); + return clone(this, { + loc + }); + } + + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */ + setLocale(locale) { + return this.reconfigure({ + locale + }); + } + + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}. + * + * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`. + * They cannot be mixed with ISO-week units like `weekday`. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */ + set(values) { + if (!this.isValid) return this; + const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks); + const { + minDaysInFirstWeek, + startOfWeek + } = usesLocalWeekValues(normalized, this.loc); + const settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber; + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + let mixed; + if (settingWeekStuff) { + mixed = weekToGregorian({ + ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), + ...normalized + }, minDaysInFirstWeek, startOfWeek); + } else if (!isUndefined(normalized.ordinal)) { + mixed = ordinalToGregorian({ + ...gregorianToOrdinal(this.c), + ...normalized + }); + } else { + mixed = { + ...this.toObject(), + ...normalized + }; + + // if we didn't set the day but we ended up on an overflow date, + // use the last day of the right month + if (isUndefined(normalized.day)) { + mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); + } + } + const [ts, o] = objToTS(mixed, this.o, this.zone); + return clone(this, { + ts, + o + }); + } + + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.now().plus(123) //~> in 123 milliseconds + * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */ + plus(duration) { + if (!this.isValid) return this; + const dur = Duration.fromDurationLike(duration); + return clone(this, adjustTime(this, dur)); + } + + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link DateTime#plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */ + minus(duration) { + if (!this.isValid) return this; + const dur = Duration.fromDurationLike(duration).negate(); + return clone(this, adjustTime(this, dur)); + } + + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */ + startOf(unit, { + useLocaleWeeks = false + } = {}) { + if (!this.isValid) return this; + const o = {}, + normalizedUnit = Duration.normalizeUnit(unit); + switch (normalizedUnit) { + case "years": + o.month = 1; + // falls through + case "quarters": + case "months": + o.day = 1; + // falls through + case "weeks": + case "days": + o.hour = 0; + // falls through + case "hours": + o.minute = 0; + // falls through + case "minutes": + o.second = 0; + // falls through + case "seconds": + o.millisecond = 0; + break; + // no default, invalid units throw in normalizeUnit() + } + + if (normalizedUnit === "weeks") { + if (useLocaleWeeks) { + const startOfWeek = this.loc.getStartOfWeek(); + const { + weekday + } = this; + if (weekday < startOfWeek) { + o.weekNumber = this.weekNumber - 1; + } + o.weekday = startOfWeek; + } else { + o.weekday = 1; + } + } + if (normalizedUnit === "quarters") { + const q = Math.ceil(this.month / 3); + o.month = (q - 1) * 3 + 1; + } + return this.set(o); + } + + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */ + endOf(unit, opts) { + return this.isValid ? this.plus({ + [unit]: 1 + }).startOf(unit, opts).minus(1) : this; + } + + // OUTPUT + + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.now().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.now().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */ + toFormat(fmt, opts = {}) { + return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID; + } + + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @param {Object} opts - opts to override the configuration options on this DateTime + * @example DateTime.now().toLocaleString(); //=> 4/20/2017 + * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022' + * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32' + * @return {string} + */ + toLocaleString(formatOpts = DATE_SHORT, opts = {}) { + return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID; + } + + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.now().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */ + toLocaleParts(opts = {}) { + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : []; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=false] - add the time zone format extension + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0. + * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z' + * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z' + * @return {string|null} + */ + toISO({ + format = "extended", + suppressSeconds = false, + suppressMilliseconds = false, + includeOffset = true, + extendedZone = false, + precision = "milliseconds" + } = {}) { + if (!this.isValid) { + return null; + } + precision = normalizeUnit(precision); + const ext = format === "extended"; + let c = toISODate(this, ext, precision); + if (orderedUnits.indexOf(precision) >= 3) c += "T"; + c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision); + return c; + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'. + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05' + * @return {string|null} + */ + toISODate({ + format = "extended", + precision = "day" + } = {}) { + if (!this.isValid) { + return null; + } + return toISODate(this, format === "extended", normalizeUnit(precision)); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */ + toISOWeekDate() { + return toTechFormat(this, "kkkk-'W'WW-c"); + } + + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.extendedZone=true] - add the time zone format extension + * @param {boolean} [opts.includePrefix=false] - include the `T` prefix + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0. + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z' + * @return {string} + */ + toISOTime({ + suppressMilliseconds = false, + suppressSeconds = false, + includeOffset = true, + includePrefix = false, + extendedZone = false, + format = "extended", + precision = "milliseconds" + } = {}) { + if (!this.isValid) { + return null; + } + precision = normalizeUnit(precision); + let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : ""; + return c + toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset, extendedZone, precision); + } + + /** + * Returns an RFC 2822-compatible string representation of this DateTime + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */ + toRFC2822() { + return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); + } + + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */ + toHTTP() { + return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string|null} + */ + toSQLDate() { + if (!this.isValid) { + return null; + } + return toISODate(this, true); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */ + toSQLTime({ + includeOffset = true, + includeZone = false, + includeOffsetSpace = true + } = {}) { + let fmt = "HH:mm:ss.SSS"; + if (includeZone || includeOffset) { + if (includeOffsetSpace) { + fmt += " "; + } + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += "ZZ"; + } + } + return toTechFormat(this, fmt, true); + } + + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */ + toSQL(opts = {}) { + if (!this.isValid) { + return null; + } + return `${this.toSQLDate()} ${this.toSQLTime(opts)}`; + } + + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */ + toString() { + return this.isValid ? this.toISO() : INVALID; + } + + /** + * Returns a string representation of this DateTime appropriate for the REPL. + * @return {string} + */ + [Symbol.for("nodejs.util.inspect.custom")]() { + if (this.isValid) { + return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`; + } else { + return `DateTime { Invalid, reason: ${this.invalidReason} }`; + } + } + + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis} + * @return {number} + */ + valueOf() { + return this.toMillis(); + } + + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */ + toMillis() { + return this.isValid ? this.ts : NaN; + } + + /** + * Returns the epoch seconds (including milliseconds in the fractional part) of this DateTime. + * @return {number} + */ + toSeconds() { + return this.isValid ? this.ts / 1000 : NaN; + } + + /** + * Returns the epoch seconds (as a whole number) of this DateTime. + * @return {number} + */ + toUnixInteger() { + return this.isValid ? Math.floor(this.ts / 1000) : NaN; + } + + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */ + toJSON() { + return this.toISO(); + } + + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */ + toBSON() { + return this.toJSDate(); + } + + /** + * Returns a JavaScript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */ + toObject(opts = {}) { + if (!this.isValid) return {}; + const base = { + ...this.c + }; + if (opts.includeConfig) { + base.outputCalendar = this.outputCalendar; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + return base; + } + + /** + * Returns a JavaScript Date equivalent to this DateTime. + * @return {Date} + */ + toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } + + // COMPARE + + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */ + diff(otherDateTime, unit = "milliseconds", opts = {}) { + if (!this.isValid || !otherDateTime.isValid) { + return Duration.invalid("created by diffing an invalid DateTime"); + } + const durOpts = { + locale: this.locale, + numberingSystem: this.numberingSystem, + ...opts + }; + const units = maybeArray(unit).map(Duration.normalizeUnit), + otherIsLater = otherDateTime.valueOf() > this.valueOf(), + earlier = otherIsLater ? this : otherDateTime, + later = otherIsLater ? otherDateTime : this, + diffed = diff(earlier, later, units, durOpts); + return otherIsLater ? diffed.negate() : diffed; + } + + /** + * Return the difference between this DateTime and right now. + * See {@link DateTime#diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + diffNow(unit = "milliseconds", opts = {}) { + return this.diff(DateTime.now(), unit, opts); + } + + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval|DateTime} + */ + until(otherDateTime) { + return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; + } + + /** + * Return whether this DateTime is in the same unit of time as another DateTime. + * Higher-order units must also be identical for this function to return `true`. + * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed. + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @param {Object} opts - options + * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used + * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day + * @return {boolean} + */ + hasSame(otherDateTime, unit, opts) { + if (!this.isValid) return false; + const inputMs = otherDateTime.valueOf(); + const adjustedToZone = this.setZone(otherDateTime.zone, { + keepLocalTime: true + }); + return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts); + } + + /** + * Equality check + * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */ + equals(other) { + return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc); + } + + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {string} [options.rounding="trunc"] - rounding method to use when rounding the numbers in the output. Can be "trunc" (toward zero), "expand" (away from zero), "round", "floor", or "ceil". + * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.now().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.now().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */ + toRelative(options = {}) { + if (!this.isValid) return null; + const base = options.base || DateTime.fromObject({}, { + zone: this.zone + }), + padding = options.padding ? this < base ? -options.padding : options.padding : 0; + let units = ["years", "months", "days", "hours", "minutes", "seconds"]; + let unit = options.unit; + if (Array.isArray(options.unit)) { + units = options.unit; + unit = undefined; + } + return diffRelative(base, this.plus(padding), { + ...options, + numeric: "always", + units, + unit + }); + } + + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.now().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */ + toRelativeCalendar(options = {}) { + if (!this.isValid) return null; + return diffRelative(options.base || DateTime.fromObject({}, { + zone: this.zone + }), this, { + ...options, + numeric: "auto", + units: ["years", "months", "days"], + calendary: true + }); + } + + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */ + static min(...dateTimes) { + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("min requires all arguments be DateTimes"); + } + return bestBy(dateTimes, i => i.valueOf(), Math.min); + } + + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */ + static max(...dateTimes) { + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("max requires all arguments be DateTimes"); + } + return bestBy(dateTimes, i => i.valueOf(), Math.max); + } + + // MISC + + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */ + static fromFormatExplain(text, fmt, options = {}) { + const { + locale = null, + numberingSystem = null + } = options, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true + }); + return explainFromTokens(localeToUse, text, fmt); + } + + /** + * @deprecated use fromFormatExplain instead + */ + static fromStringExplain(text, fmt, options = {}) { + return DateTime.fromFormatExplain(text, fmt, options); + } + + /** + * Build a parser for `fmt` using the given locale. This parser can be passed + * to {@link DateTime.fromFormatParser} to a parse a date in this format. This + * can be used to optimize cases where many dates need to be parsed in a + * specific format. + * + * @param {String} fmt - the format the string is expected to be in (see + * description) + * @param {Object} options - options used to set locale and numberingSystem + * for parser + * @returns {TokenParser} - opaque object to be used + */ + static buildFormatParser(fmt, options = {}) { + const { + locale = null, + numberingSystem = null + } = options, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true + }); + return new TokenParser(localeToUse, fmt); + } + + /** + * Create a DateTime from an input string and format parser. + * + * The format parser must have been created with the same locale as this call. + * + * @param {String} text - the string to parse + * @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser} + * @param {Object} opts - options taken by fromFormat() + * @returns {DateTime} + */ + static fromFormatParser(text, formatParser, opts = {}) { + if (isUndefined(text) || isUndefined(formatParser)) { + throw new InvalidArgumentError("fromFormatParser requires an input string and a format parser"); + } + const { + locale = null, + numberingSystem = null + } = opts, + localeToUse = Locale.fromOpts({ + locale, + numberingSystem, + defaultToEN: true + }); + if (!localeToUse.equals(formatParser.locale)) { + throw new InvalidArgumentError(`fromFormatParser called with a locale of ${localeToUse}, ` + `but the format parser was created for ${formatParser.locale}`); + } + const { + result, + zone, + specificOffset, + invalidReason + } = formatParser.explainFromTokens(text); + if (invalidReason) { + return DateTime.invalid(invalidReason); + } else { + return parseDataToDateTime(result, zone, opts, `format ${formatParser.format}`, text, specificOffset); + } + } + + // FORMAT PRESETS + + /** + * {@link DateTime#toLocaleString} format like 10/14/1983 + * @type {Object} + */ + static get DATE_SHORT() { + return DATE_SHORT; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + static get DATE_MED() { + return DATE_MED; + } + + /** + * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983' + * @type {Object} + */ + static get DATE_MED_WITH_WEEKDAY() { + return DATE_MED_WITH_WEEKDAY; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + static get DATE_FULL() { + return DATE_FULL; + } + + /** + * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + static get DATE_HUGE() { + return DATE_HUGE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_SIMPLE() { + return TIME_SIMPLE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_SECONDS() { + return TIME_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_SHORT_OFFSET() { + return TIME_WITH_SHORT_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get TIME_WITH_LONG_OFFSET() { + return TIME_WITH_LONG_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + static get TIME_24_SIMPLE() { + return TIME_24_SIMPLE; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_SECONDS() { + return TIME_24_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_SHORT_OFFSET() { + return TIME_24_WITH_SHORT_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + static get TIME_24_WITH_LONG_OFFSET() { + return TIME_24_WITH_LONG_OFFSET; + } + + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_SHORT() { + return DATETIME_SHORT; + } + + /** + * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_SHORT_WITH_SECONDS() { + return DATETIME_SHORT_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED() { + return DATETIME_MED; + } + + /** + * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED_WITH_SECONDS() { + return DATETIME_MED_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_MED_WITH_WEEKDAY() { + return DATETIME_MED_WITH_WEEKDAY; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_FULL() { + return DATETIME_FULL; + } + + /** + * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_FULL_WITH_SECONDS() { + return DATETIME_FULL_WITH_SECONDS; + } + + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_HUGE() { + return DATETIME_HUGE; + } + + /** + * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + static get DATETIME_HUGE_WITH_SECONDS() { + return DATETIME_HUGE_WITH_SECONDS; + } +} + +/** + * @private + */ +function friendlyDateTime(dateTimeish) { + if (DateTime.isDateTime(dateTimeish)) { + return dateTimeish; + } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) { + return DateTime.fromJSDate(dateTimeish); + } else if (dateTimeish && typeof dateTimeish === "object") { + return DateTime.fromObject(dateTimeish); + } else { + throw new InvalidArgumentError(`Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`); + } +} + +const VERSION = "3.7.2"; + +exports.DateTime = DateTime; +exports.Duration = Duration; +exports.FixedOffsetZone = FixedOffsetZone; +exports.IANAZone = IANAZone; +exports.Info = Info; +exports.Interval = Interval; +exports.InvalidZone = InvalidZone; +exports.Settings = Settings; +exports.SystemZone = SystemZone; +exports.VERSION = VERSION; +exports.Zone = Zone; +//# sourceMappingURL=luxon.js.map diff --git a/node_modules/luxon/build/node/luxon.js.map b/node_modules/luxon/build/node/luxon.js.map new file mode 100644 index 00000000..bcb08350 --- /dev/null +++ b/node_modules/luxon/build/node/luxon.js.map @@ -0,0 +1 @@ +{"version":3,"file":"luxon.js","sources":["../../src/errors.js","../../src/impl/formats.js","../../src/zone.js","../../src/zones/systemZone.js","../../src/zones/IANAZone.js","../../src/impl/locale.js","../../src/zones/fixedOffsetZone.js","../../src/zones/invalidZone.js","../../src/impl/zoneUtil.js","../../src/impl/digits.js","../../src/settings.js","../../src/impl/invalid.js","../../src/impl/conversions.js","../../src/impl/util.js","../../src/impl/english.js","../../src/impl/formatter.js","../../src/impl/regexParser.js","../../src/duration.js","../../src/interval.js","../../src/info.js","../../src/impl/diff.js","../../src/impl/tokenParser.js","../../src/datetime.js","../../src/luxon.js"],"sourcesContent":["// these aren't really private, but nor are they really useful to document\n\n/**\n * @private\n */\nclass LuxonError extends Error {}\n\n/**\n * @private\n */\nexport class InvalidDateTimeError extends LuxonError {\n constructor(reason) {\n super(`Invalid DateTime: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidIntervalError extends LuxonError {\n constructor(reason) {\n super(`Invalid Interval: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidDurationError extends LuxonError {\n constructor(reason) {\n super(`Invalid Duration: ${reason.toMessage()}`);\n }\n}\n\n/**\n * @private\n */\nexport class ConflictingSpecificationError extends LuxonError {}\n\n/**\n * @private\n */\nexport class InvalidUnitError extends LuxonError {\n constructor(unit) {\n super(`Invalid unit ${unit}`);\n }\n}\n\n/**\n * @private\n */\nexport class InvalidArgumentError extends LuxonError {}\n\n/**\n * @private\n */\nexport class ZoneIsAbstractError extends LuxonError {\n constructor() {\n super(\"Zone is an abstract class\");\n }\n}\n","/**\n * @private\n */\n\nconst n = \"numeric\",\n s = \"short\",\n l = \"long\";\n\nexport const DATE_SHORT = {\n year: n,\n month: n,\n day: n,\n};\n\nexport const DATE_MED = {\n year: n,\n month: s,\n day: n,\n};\n\nexport const DATE_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n};\n\nexport const DATE_FULL = {\n year: n,\n month: l,\n day: n,\n};\n\nexport const DATE_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n};\n\nexport const TIME_SIMPLE = {\n hour: n,\n minute: n,\n};\n\nexport const TIME_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const TIME_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const TIME_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n\nexport const TIME_24_SIMPLE = {\n hour: n,\n minute: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SECONDS = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n};\n\nexport const TIME_24_WITH_SHORT_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: s,\n};\n\nexport const TIME_24_WITH_LONG_OFFSET = {\n hour: n,\n minute: n,\n second: n,\n hourCycle: \"h23\",\n timeZoneName: l,\n};\n\nexport const DATETIME_SHORT = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_SHORT_WITH_SECONDS = {\n year: n,\n month: n,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_MED_WITH_SECONDS = {\n year: n,\n month: s,\n day: n,\n hour: n,\n minute: n,\n second: n,\n};\n\nexport const DATETIME_MED_WITH_WEEKDAY = {\n year: n,\n month: s,\n day: n,\n weekday: s,\n hour: n,\n minute: n,\n};\n\nexport const DATETIME_FULL = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_FULL_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: s,\n};\n\nexport const DATETIME_HUGE = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n timeZoneName: l,\n};\n\nexport const DATETIME_HUGE_WITH_SECONDS = {\n year: n,\n month: l,\n day: n,\n weekday: l,\n hour: n,\n minute: n,\n second: n,\n timeZoneName: l,\n};\n","import { ZoneIsAbstractError } from \"./errors.js\";\n\n/**\n * @interface\n */\nexport default class Zone {\n /**\n * The type of zone\n * @abstract\n * @type {string}\n */\n get type() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The name of this zone.\n * @abstract\n * @type {string}\n */\n get name() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * The IANA name of this zone.\n * Defaults to `name` if not overwritten by a subclass.\n * @abstract\n * @type {string}\n */\n get ianaName() {\n return this.name;\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year.\n * @abstract\n * @type {boolean}\n */\n get isUniversal() {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, opts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Returns the offset's value as a string\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @abstract\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @abstract\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n throw new ZoneIsAbstractError();\n }\n\n /**\n * Return whether this Zone is valid.\n * @abstract\n * @type {boolean}\n */\n get isValid() {\n throw new ZoneIsAbstractError();\n }\n}\n","import { formatOffset, parseZoneInfo } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * Represents the local zone for this JavaScript environment.\n * @implements {Zone}\n */\nexport default class SystemZone extends Zone {\n /**\n * Get a singleton instance of the local zone\n * @return {SystemZone}\n */\n static get instance() {\n if (singleton === null) {\n singleton = new SystemZone();\n }\n return singleton;\n }\n\n /** @override **/\n get type() {\n return \"system\";\n }\n\n /** @override **/\n get name() {\n return new Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale);\n }\n\n /** @override **/\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /** @override **/\n offset(ts) {\n return -new Date(ts).getTimezoneOffset();\n }\n\n /** @override **/\n equals(otherZone) {\n return otherZone.type === \"system\";\n }\n\n /** @override **/\n get isValid() {\n return true;\n }\n}\n","import { formatOffset, parseZoneInfo, isUndefined, objToLocalTS } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nconst dtfCache = new Map();\nfunction makeDTF(zoneName) {\n let dtf = dtfCache.get(zoneName);\n if (dtf === undefined) {\n dtf = new Intl.DateTimeFormat(\"en-US\", {\n hour12: false,\n timeZone: zoneName,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n era: \"short\",\n });\n dtfCache.set(zoneName, dtf);\n }\n return dtf;\n}\n\nconst typeToPos = {\n year: 0,\n month: 1,\n day: 2,\n era: 3,\n hour: 4,\n minute: 5,\n second: 6,\n};\n\nfunction hackyOffset(dtf, date) {\n const formatted = dtf.format(date).replace(/\\u200E/g, \"\"),\n parsed = /(\\d+)\\/(\\d+)\\/(\\d+) (AD|BC),? (\\d+):(\\d+):(\\d+)/.exec(formatted),\n [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;\n return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];\n}\n\nfunction partsOffset(dtf, date) {\n const formatted = dtf.formatToParts(date);\n const filled = [];\n for (let i = 0; i < formatted.length; i++) {\n const { type, value } = formatted[i];\n const pos = typeToPos[type];\n\n if (type === \"era\") {\n filled[pos] = value;\n } else if (!isUndefined(pos)) {\n filled[pos] = parseInt(value, 10);\n }\n }\n return filled;\n}\n\nconst ianaZoneCache = new Map();\n/**\n * A zone identified by an IANA identifier, like America/New_York\n * @implements {Zone}\n */\nexport default class IANAZone extends Zone {\n /**\n * @param {string} name - Zone name\n * @return {IANAZone}\n */\n static create(name) {\n let zone = ianaZoneCache.get(name);\n if (zone === undefined) {\n ianaZoneCache.set(name, (zone = new IANAZone(name)));\n }\n return zone;\n }\n\n /**\n * Reset local caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCache() {\n ianaZoneCache.clear();\n dtfCache.clear();\n }\n\n /**\n * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.\n * @param {string} s - The string to check validity on\n * @example IANAZone.isValidSpecifier(\"America/New_York\") //=> true\n * @example IANAZone.isValidSpecifier(\"Sport~~blorp\") //=> false\n * @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead.\n * @return {boolean}\n */\n static isValidSpecifier(s) {\n return this.isValidZone(s);\n }\n\n /**\n * Returns whether the provided string identifies a real zone\n * @param {string} zone - The string to check\n * @example IANAZone.isValidZone(\"America/New_York\") //=> true\n * @example IANAZone.isValidZone(\"Fantasia/Castle\") //=> false\n * @example IANAZone.isValidZone(\"Sport~~blorp\") //=> false\n * @return {boolean}\n */\n static isValidZone(zone) {\n if (!zone) {\n return false;\n }\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: zone }).format();\n return true;\n } catch (e) {\n return false;\n }\n }\n\n constructor(name) {\n super();\n /** @private **/\n this.zoneName = name;\n /** @private **/\n this.valid = IANAZone.isValidZone(name);\n }\n\n /**\n * The type of zone. `iana` for all instances of `IANAZone`.\n * @override\n * @type {string}\n */\n get type() {\n return \"iana\";\n }\n\n /**\n * The name of this zone (i.e. the IANA zone name).\n * @override\n * @type {string}\n */\n get name() {\n return this.zoneName;\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year:\n * Always returns false for all IANA zones.\n * @override\n * @type {boolean}\n */\n get isUniversal() {\n return false;\n }\n\n /**\n * Returns the offset's common name (such as EST) at the specified timestamp\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the name\n * @param {Object} opts - Options to affect the format\n * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.\n * @param {string} opts.locale - What locale to return the offset name in.\n * @return {string}\n */\n offsetName(ts, { format, locale }) {\n return parseZoneInfo(ts, format, locale, this.name);\n }\n\n /**\n * Returns the offset's value as a string\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n return formatOffset(this.offset(ts), format);\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n * @override\n * @param {number} ts - Epoch milliseconds for which to compute the offset\n * @return {number}\n */\n offset(ts) {\n if (!this.valid) return NaN;\n const date = new Date(ts);\n\n if (isNaN(date)) return NaN;\n\n const dtf = makeDTF(this.name);\n let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts\n ? partsOffset(dtf, date)\n : hackyOffset(dtf, date);\n\n if (adOrBc === \"BC\") {\n year = -Math.abs(year) + 1;\n }\n\n // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat\n const adjustedHour = hour === 24 ? 0 : hour;\n\n const asUTC = objToLocalTS({\n year,\n month,\n day,\n hour: adjustedHour,\n minute,\n second,\n millisecond: 0,\n });\n\n let asTS = +date;\n const over = asTS % 1000;\n asTS -= over >= 0 ? over : 1000 + over;\n return (asUTC - asTS) / (60 * 1000);\n }\n\n /**\n * Return whether this Zone is equal to another zone\n * @override\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n return otherZone.type === \"iana\" && otherZone.name === this.name;\n }\n\n /**\n * Return whether this Zone is valid.\n * @override\n * @type {boolean}\n */\n get isValid() {\n return this.valid;\n }\n}\n","import { hasLocaleWeekInfo, hasRelative, padStart, roundTo, validateWeekSettings } from \"./util.js\";\nimport * as English from \"./english.js\";\nimport Settings from \"../settings.js\";\nimport DateTime from \"../datetime.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n// todo - remap caching\n\nlet intlLFCache = {};\nfunction getCachedLF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlLFCache[key];\n if (!dtf) {\n dtf = new Intl.ListFormat(locString, opts);\n intlLFCache[key] = dtf;\n }\n return dtf;\n}\n\nconst intlDTCache = new Map();\nfunction getCachedDTF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let dtf = intlDTCache.get(key);\n if (dtf === undefined) {\n dtf = new Intl.DateTimeFormat(locString, opts);\n intlDTCache.set(key, dtf);\n }\n return dtf;\n}\n\nconst intlNumCache = new Map();\nfunction getCachedINF(locString, opts = {}) {\n const key = JSON.stringify([locString, opts]);\n let inf = intlNumCache.get(key);\n if (inf === undefined) {\n inf = new Intl.NumberFormat(locString, opts);\n intlNumCache.set(key, inf);\n }\n return inf;\n}\n\nconst intlRelCache = new Map();\nfunction getCachedRTF(locString, opts = {}) {\n const { base, ...cacheKeyOpts } = opts; // exclude `base` from the options\n const key = JSON.stringify([locString, cacheKeyOpts]);\n let inf = intlRelCache.get(key);\n if (inf === undefined) {\n inf = new Intl.RelativeTimeFormat(locString, opts);\n intlRelCache.set(key, inf);\n }\n return inf;\n}\n\nlet sysLocaleCache = null;\nfunction systemLocale() {\n if (sysLocaleCache) {\n return sysLocaleCache;\n } else {\n sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;\n return sysLocaleCache;\n }\n}\n\nconst intlResolvedOptionsCache = new Map();\nfunction getCachedIntResolvedOptions(locString) {\n let opts = intlResolvedOptionsCache.get(locString);\n if (opts === undefined) {\n opts = new Intl.DateTimeFormat(locString).resolvedOptions();\n intlResolvedOptionsCache.set(locString, opts);\n }\n return opts;\n}\n\nconst weekInfoCache = new Map();\nfunction getCachedWeekInfo(locString) {\n let data = weekInfoCache.get(locString);\n if (!data) {\n const locale = new Intl.Locale(locString);\n // browsers currently implement this as a property, but spec says it should be a getter function\n data = \"getWeekInfo\" in locale ? locale.getWeekInfo() : locale.weekInfo;\n // minimalDays was removed from WeekInfo: https://github.com/tc39/proposal-intl-locale-info/issues/86\n if (!(\"minimalDays\" in data)) {\n data = { ...fallbackWeekSettings, ...data };\n }\n weekInfoCache.set(locString, data);\n }\n return data;\n}\n\nfunction parseLocaleString(localeStr) {\n // I really want to avoid writing a BCP 47 parser\n // see, e.g. https://github.com/wooorm/bcp-47\n // Instead, we'll do this:\n\n // a) if the string has no -u extensions, just leave it alone\n // b) if it does, use Intl to resolve everything\n // c) if Intl fails, try again without the -u\n\n // private subtags and unicode subtags have ordering requirements,\n // and we're not properly parsing this, so just strip out the\n // private ones if they exist.\n const xIndex = localeStr.indexOf(\"-x-\");\n if (xIndex !== -1) {\n localeStr = localeStr.substring(0, xIndex);\n }\n\n const uIndex = localeStr.indexOf(\"-u-\");\n if (uIndex === -1) {\n return [localeStr];\n } else {\n let options;\n let selectedStr;\n try {\n options = getCachedDTF(localeStr).resolvedOptions();\n selectedStr = localeStr;\n } catch (e) {\n const smaller = localeStr.substring(0, uIndex);\n options = getCachedDTF(smaller).resolvedOptions();\n selectedStr = smaller;\n }\n\n const { numberingSystem, calendar } = options;\n return [selectedStr, numberingSystem, calendar];\n }\n}\n\nfunction intlConfigString(localeStr, numberingSystem, outputCalendar) {\n if (outputCalendar || numberingSystem) {\n if (!localeStr.includes(\"-u-\")) {\n localeStr += \"-u\";\n }\n\n if (outputCalendar) {\n localeStr += `-ca-${outputCalendar}`;\n }\n\n if (numberingSystem) {\n localeStr += `-nu-${numberingSystem}`;\n }\n return localeStr;\n } else {\n return localeStr;\n }\n}\n\nfunction mapMonths(f) {\n const ms = [];\n for (let i = 1; i <= 12; i++) {\n const dt = DateTime.utc(2009, i, 1);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction mapWeekdays(f) {\n const ms = [];\n for (let i = 1; i <= 7; i++) {\n const dt = DateTime.utc(2016, 11, 13 + i);\n ms.push(f(dt));\n }\n return ms;\n}\n\nfunction listStuff(loc, length, englishFn, intlFn) {\n const mode = loc.listingMode();\n\n if (mode === \"error\") {\n return null;\n } else if (mode === \"en\") {\n return englishFn(length);\n } else {\n return intlFn(length);\n }\n}\n\nfunction supportsFastNumbers(loc) {\n if (loc.numberingSystem && loc.numberingSystem !== \"latn\") {\n return false;\n } else {\n return (\n loc.numberingSystem === \"latn\" ||\n !loc.locale ||\n loc.locale.startsWith(\"en\") ||\n getCachedIntResolvedOptions(loc.locale).numberingSystem === \"latn\"\n );\n }\n}\n\n/**\n * @private\n */\n\nclass PolyNumberFormatter {\n constructor(intl, forceSimple, opts) {\n this.padTo = opts.padTo || 0;\n this.floor = opts.floor || false;\n\n const { padTo, floor, ...otherOpts } = opts;\n\n if (!forceSimple || Object.keys(otherOpts).length > 0) {\n const intlOpts = { useGrouping: false, ...opts };\n if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;\n this.inf = getCachedINF(intl, intlOpts);\n }\n }\n\n format(i) {\n if (this.inf) {\n const fixed = this.floor ? Math.floor(i) : i;\n return this.inf.format(fixed);\n } else {\n // to match the browser's numberformatter defaults\n const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);\n return padStart(fixed, this.padTo);\n }\n }\n}\n\n/**\n * @private\n */\n\nclass PolyDateFormatter {\n constructor(dt, intl, opts) {\n this.opts = opts;\n this.originalZone = undefined;\n\n let z = undefined;\n if (this.opts.timeZone) {\n // Don't apply any workarounds if a timeZone is explicitly provided in opts\n this.dt = dt;\n } else if (dt.zone.type === \"fixed\") {\n // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like.\n // That is why fixed-offset TZ is set to that unless it is:\n // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT.\n // 2. Unsupported by the browser:\n // - some do not support Etc/\n // - < Etc/GMT-14, > Etc/GMT+12, and 30-minute or 45-minute offsets are not part of tzdata\n const gmtOffset = -1 * (dt.offset / 60);\n const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;\n if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {\n z = offsetZ;\n this.dt = dt;\n } else {\n // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so\n // we manually apply the offset and substitute the zone as needed.\n z = \"UTC\";\n this.dt = dt.offset === 0 ? dt : dt.setZone(\"UTC\").plus({ minutes: dt.offset });\n this.originalZone = dt.zone;\n }\n } else if (dt.zone.type === \"system\") {\n this.dt = dt;\n } else if (dt.zone.type === \"iana\") {\n this.dt = dt;\n z = dt.zone.name;\n } else {\n // Custom zones can have any offset / offsetName so we just manually\n // apply the offset and substitute the zone as needed.\n z = \"UTC\";\n this.dt = dt.setZone(\"UTC\").plus({ minutes: dt.offset });\n this.originalZone = dt.zone;\n }\n\n const intlOpts = { ...this.opts };\n intlOpts.timeZone = intlOpts.timeZone || z;\n this.dtf = getCachedDTF(intl, intlOpts);\n }\n\n format() {\n if (this.originalZone) {\n // If we have to substitute in the actual zone name, we have to use\n // formatToParts so that the timezone can be replaced.\n return this.formatToParts()\n .map(({ value }) => value)\n .join(\"\");\n }\n return this.dtf.format(this.dt.toJSDate());\n }\n\n formatToParts() {\n const parts = this.dtf.formatToParts(this.dt.toJSDate());\n if (this.originalZone) {\n return parts.map((part) => {\n if (part.type === \"timeZoneName\") {\n const offsetName = this.originalZone.offsetName(this.dt.ts, {\n locale: this.dt.locale,\n format: this.opts.timeZoneName,\n });\n return {\n ...part,\n value: offsetName,\n };\n } else {\n return part;\n }\n });\n }\n return parts;\n }\n\n resolvedOptions() {\n return this.dtf.resolvedOptions();\n }\n}\n\n/**\n * @private\n */\nclass PolyRelFormatter {\n constructor(intl, isEnglish, opts) {\n this.opts = { style: \"long\", ...opts };\n if (!isEnglish && hasRelative()) {\n this.rtf = getCachedRTF(intl, opts);\n }\n }\n\n format(count, unit) {\n if (this.rtf) {\n return this.rtf.format(count, unit);\n } else {\n return English.formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== \"long\");\n }\n }\n\n formatToParts(count, unit) {\n if (this.rtf) {\n return this.rtf.formatToParts(count, unit);\n } else {\n return [];\n }\n }\n}\n\nconst fallbackWeekSettings = {\n firstDay: 1,\n minimalDays: 4,\n weekend: [6, 7],\n};\n\n/**\n * @private\n */\nexport default class Locale {\n static fromOpts(opts) {\n return Locale.create(\n opts.locale,\n opts.numberingSystem,\n opts.outputCalendar,\n opts.weekSettings,\n opts.defaultToEN\n );\n }\n\n static create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN = false) {\n const specifiedLocale = locale || Settings.defaultLocale;\n // the system locale is useful for human-readable strings but annoying for parsing/formatting known formats\n const localeR = specifiedLocale || (defaultToEN ? \"en-US\" : systemLocale());\n const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;\n const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;\n const weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;\n return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);\n }\n\n static resetCache() {\n sysLocaleCache = null;\n intlDTCache.clear();\n intlNumCache.clear();\n intlRelCache.clear();\n intlResolvedOptionsCache.clear();\n weekInfoCache.clear();\n }\n\n static fromObject({ locale, numberingSystem, outputCalendar, weekSettings } = {}) {\n return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);\n }\n\n constructor(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {\n const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);\n\n this.locale = parsedLocale;\n this.numberingSystem = numbering || parsedNumberingSystem || null;\n this.outputCalendar = outputCalendar || parsedOutputCalendar || null;\n this.weekSettings = weekSettings;\n this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);\n\n this.weekdaysCache = { format: {}, standalone: {} };\n this.monthsCache = { format: {}, standalone: {} };\n this.meridiemCache = null;\n this.eraCache = {};\n\n this.specifiedLocale = specifiedLocale;\n this.fastNumbersCached = null;\n }\n\n get fastNumbers() {\n if (this.fastNumbersCached == null) {\n this.fastNumbersCached = supportsFastNumbers(this);\n }\n\n return this.fastNumbersCached;\n }\n\n listingMode() {\n const isActuallyEn = this.isEnglish();\n const hasNoWeirdness =\n (this.numberingSystem === null || this.numberingSystem === \"latn\") &&\n (this.outputCalendar === null || this.outputCalendar === \"gregory\");\n return isActuallyEn && hasNoWeirdness ? \"en\" : \"intl\";\n }\n\n clone(alts) {\n if (!alts || Object.getOwnPropertyNames(alts).length === 0) {\n return this;\n } else {\n return Locale.create(\n alts.locale || this.specifiedLocale,\n alts.numberingSystem || this.numberingSystem,\n alts.outputCalendar || this.outputCalendar,\n validateWeekSettings(alts.weekSettings) || this.weekSettings,\n alts.defaultToEN || false\n );\n }\n }\n\n redefaultToEN(alts = {}) {\n return this.clone({ ...alts, defaultToEN: true });\n }\n\n redefaultToSystem(alts = {}) {\n return this.clone({ ...alts, defaultToEN: false });\n }\n\n months(length, format = false) {\n return listStuff(this, length, English.months, () => {\n // Workaround for \"ja\" locale: formatToParts does not label all parts of the month\n // as \"month\" and for this locale there is no difference between \"format\" and \"non-format\".\n // As such, just use format() instead of formatToParts() and take the whole string\n const monthSpecialCase = this.intl === \"ja\" || this.intl.startsWith(\"ja-\");\n format &= !monthSpecialCase;\n const intl = format ? { month: length, day: \"numeric\" } : { month: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.monthsCache[formatStr][length]) {\n const mapper = !monthSpecialCase\n ? (dt) => this.extract(dt, intl, \"month\")\n : (dt) => this.dtFormatter(dt, intl).format();\n this.monthsCache[formatStr][length] = mapMonths(mapper);\n }\n return this.monthsCache[formatStr][length];\n });\n }\n\n weekdays(length, format = false) {\n return listStuff(this, length, English.weekdays, () => {\n const intl = format\n ? { weekday: length, year: \"numeric\", month: \"long\", day: \"numeric\" }\n : { weekday: length },\n formatStr = format ? \"format\" : \"standalone\";\n if (!this.weekdaysCache[formatStr][length]) {\n this.weekdaysCache[formatStr][length] = mapWeekdays((dt) =>\n this.extract(dt, intl, \"weekday\")\n );\n }\n return this.weekdaysCache[formatStr][length];\n });\n }\n\n meridiems() {\n return listStuff(\n this,\n undefined,\n () => English.meridiems,\n () => {\n // In theory there could be aribitrary day periods. We're gonna assume there are exactly two\n // for AM and PM. This is probably wrong, but it's makes parsing way easier.\n if (!this.meridiemCache) {\n const intl = { hour: \"numeric\", hourCycle: \"h12\" };\n this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(\n (dt) => this.extract(dt, intl, \"dayperiod\")\n );\n }\n\n return this.meridiemCache;\n }\n );\n }\n\n eras(length) {\n return listStuff(this, length, English.eras, () => {\n const intl = { era: length };\n\n // This is problematic. Different calendars are going to define eras totally differently. What I need is the minimum set of dates\n // to definitely enumerate them.\n if (!this.eraCache[length]) {\n this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map((dt) =>\n this.extract(dt, intl, \"era\")\n );\n }\n\n return this.eraCache[length];\n });\n }\n\n extract(dt, intlOpts, field) {\n const df = this.dtFormatter(dt, intlOpts),\n results = df.formatToParts(),\n matching = results.find((m) => m.type.toLowerCase() === field);\n return matching ? matching.value : null;\n }\n\n numberFormatter(opts = {}) {\n // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave)\n // (in contrast, the rest of the condition is used heavily)\n return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);\n }\n\n dtFormatter(dt, intlOpts = {}) {\n return new PolyDateFormatter(dt, this.intl, intlOpts);\n }\n\n relFormatter(opts = {}) {\n return new PolyRelFormatter(this.intl, this.isEnglish(), opts);\n }\n\n listFormatter(opts = {}) {\n return getCachedLF(this.intl, opts);\n }\n\n isEnglish() {\n return (\n this.locale === \"en\" ||\n this.locale.toLowerCase() === \"en-us\" ||\n getCachedIntResolvedOptions(this.intl).locale.startsWith(\"en-us\")\n );\n }\n\n getWeekSettings() {\n if (this.weekSettings) {\n return this.weekSettings;\n } else if (!hasLocaleWeekInfo()) {\n return fallbackWeekSettings;\n } else {\n return getCachedWeekInfo(this.locale);\n }\n }\n\n getStartOfWeek() {\n return this.getWeekSettings().firstDay;\n }\n\n getMinDaysInFirstWeek() {\n return this.getWeekSettings().minimalDays;\n }\n\n getWeekendDays() {\n return this.getWeekSettings().weekend;\n }\n\n equals(other) {\n return (\n this.locale === other.locale &&\n this.numberingSystem === other.numberingSystem &&\n this.outputCalendar === other.outputCalendar\n );\n }\n\n toString() {\n return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;\n }\n}\n","import { formatOffset, signedOffset } from \"../impl/util.js\";\nimport Zone from \"../zone.js\";\n\nlet singleton = null;\n\n/**\n * A zone with a fixed offset (meaning no DST)\n * @implements {Zone}\n */\nexport default class FixedOffsetZone extends Zone {\n /**\n * Get a singleton instance of UTC\n * @return {FixedOffsetZone}\n */\n static get utcInstance() {\n if (singleton === null) {\n singleton = new FixedOffsetZone(0);\n }\n return singleton;\n }\n\n /**\n * Get an instance with a specified offset\n * @param {number} offset - The offset in minutes\n * @return {FixedOffsetZone}\n */\n static instance(offset) {\n return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);\n }\n\n /**\n * Get an instance of FixedOffsetZone from a UTC offset string, like \"UTC+6\"\n * @param {string} s - The offset string to parse\n * @example FixedOffsetZone.parseSpecifier(\"UTC+6\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC+06\")\n * @example FixedOffsetZone.parseSpecifier(\"UTC-6:00\")\n * @return {FixedOffsetZone}\n */\n static parseSpecifier(s) {\n if (s) {\n const r = s.match(/^utc(?:([+-]\\d{1,2})(?::(\\d{2}))?)?$/i);\n if (r) {\n return new FixedOffsetZone(signedOffset(r[1], r[2]));\n }\n }\n return null;\n }\n\n constructor(offset) {\n super();\n /** @private **/\n this.fixed = offset;\n }\n\n /**\n * The type of zone. `fixed` for all instances of `FixedOffsetZone`.\n * @override\n * @type {string}\n */\n get type() {\n return \"fixed\";\n }\n\n /**\n * The name of this zone.\n * All fixed zones' names always start with \"UTC\" (plus optional offset)\n * @override\n * @type {string}\n */\n get name() {\n return this.fixed === 0 ? \"UTC\" : `UTC${formatOffset(this.fixed, \"narrow\")}`;\n }\n\n /**\n * The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`\n *\n * @override\n * @type {string}\n */\n get ianaName() {\n if (this.fixed === 0) {\n return \"Etc/UTC\";\n } else {\n return `Etc/GMT${formatOffset(-this.fixed, \"narrow\")}`;\n }\n }\n\n /**\n * Returns the offset's common name at the specified timestamp.\n *\n * For fixed offset zones this equals to the zone name.\n * @override\n */\n offsetName() {\n return this.name;\n }\n\n /**\n * Returns the offset's value as a string\n * @override\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\n formatOffset(ts, format) {\n return formatOffset(this.fixed, format);\n }\n\n /**\n * Returns whether the offset is known to be fixed for the whole year:\n * Always returns true for all fixed offset zones.\n * @override\n * @type {boolean}\n */\n get isUniversal() {\n return true;\n }\n\n /**\n * Return the offset in minutes for this zone at the specified timestamp.\n *\n * For fixed offset zones, this is constant and does not depend on a timestamp.\n * @override\n * @return {number}\n */\n offset() {\n return this.fixed;\n }\n\n /**\n * Return whether this Zone is equal to another zone (i.e. also fixed and same offset)\n * @override\n * @param {Zone} otherZone - the zone to compare\n * @return {boolean}\n */\n equals(otherZone) {\n return otherZone.type === \"fixed\" && otherZone.fixed === this.fixed;\n }\n\n /**\n * Return whether this Zone is valid:\n * All fixed offset zones are valid.\n * @override\n * @type {boolean}\n */\n get isValid() {\n return true;\n }\n}\n","import Zone from \"../zone.js\";\n\n/**\n * A zone that failed to parse. You should never need to instantiate this.\n * @implements {Zone}\n */\nexport default class InvalidZone extends Zone {\n constructor(zoneName) {\n super();\n /** @private */\n this.zoneName = zoneName;\n }\n\n /** @override **/\n get type() {\n return \"invalid\";\n }\n\n /** @override **/\n get name() {\n return this.zoneName;\n }\n\n /** @override **/\n get isUniversal() {\n return false;\n }\n\n /** @override **/\n offsetName() {\n return null;\n }\n\n /** @override **/\n formatOffset() {\n return \"\";\n }\n\n /** @override **/\n offset() {\n return NaN;\n }\n\n /** @override **/\n equals() {\n return false;\n }\n\n /** @override **/\n get isValid() {\n return false;\n }\n}\n","/**\n * @private\n */\n\nimport Zone from \"../zone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport InvalidZone from \"../zones/invalidZone.js\";\n\nimport { isUndefined, isString, isNumber } from \"./util.js\";\nimport SystemZone from \"../zones/systemZone.js\";\n\nexport function normalizeZone(input, defaultZone) {\n let offset;\n if (isUndefined(input) || input === null) {\n return defaultZone;\n } else if (input instanceof Zone) {\n return input;\n } else if (isString(input)) {\n const lowered = input.toLowerCase();\n if (lowered === \"default\") return defaultZone;\n else if (lowered === \"local\" || lowered === \"system\") return SystemZone.instance;\n else if (lowered === \"utc\" || lowered === \"gmt\") return FixedOffsetZone.utcInstance;\n else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);\n } else if (isNumber(input)) {\n return FixedOffsetZone.instance(input);\n } else if (typeof input === \"object\" && \"offset\" in input && typeof input.offset === \"function\") {\n // This is dumb, but the instanceof check above doesn't seem to really work\n // so we're duck checking it\n return input;\n } else {\n return new InvalidZone(input);\n }\n}\n","const numberingSystems = {\n arab: \"[\\u0660-\\u0669]\",\n arabext: \"[\\u06F0-\\u06F9]\",\n bali: \"[\\u1B50-\\u1B59]\",\n beng: \"[\\u09E6-\\u09EF]\",\n deva: \"[\\u0966-\\u096F]\",\n fullwide: \"[\\uFF10-\\uFF19]\",\n gujr: \"[\\u0AE6-\\u0AEF]\",\n hanidec: \"[〇|一|二|三|四|五|六|七|八|九]\",\n khmr: \"[\\u17E0-\\u17E9]\",\n knda: \"[\\u0CE6-\\u0CEF]\",\n laoo: \"[\\u0ED0-\\u0ED9]\",\n limb: \"[\\u1946-\\u194F]\",\n mlym: \"[\\u0D66-\\u0D6F]\",\n mong: \"[\\u1810-\\u1819]\",\n mymr: \"[\\u1040-\\u1049]\",\n orya: \"[\\u0B66-\\u0B6F]\",\n tamldec: \"[\\u0BE6-\\u0BEF]\",\n telu: \"[\\u0C66-\\u0C6F]\",\n thai: \"[\\u0E50-\\u0E59]\",\n tibt: \"[\\u0F20-\\u0F29]\",\n latn: \"\\\\d\",\n};\n\nconst numberingSystemsUTF16 = {\n arab: [1632, 1641],\n arabext: [1776, 1785],\n bali: [6992, 7001],\n beng: [2534, 2543],\n deva: [2406, 2415],\n fullwide: [65296, 65303],\n gujr: [2790, 2799],\n khmr: [6112, 6121],\n knda: [3302, 3311],\n laoo: [3792, 3801],\n limb: [6470, 6479],\n mlym: [3430, 3439],\n mong: [6160, 6169],\n mymr: [4160, 4169],\n orya: [2918, 2927],\n tamldec: [3046, 3055],\n telu: [3174, 3183],\n thai: [3664, 3673],\n tibt: [3872, 3881],\n};\n\nconst hanidecChars = numberingSystems.hanidec.replace(/[\\[|\\]]/g, \"\").split(\"\");\n\nexport function parseDigits(str) {\n let value = parseInt(str, 10);\n if (isNaN(value)) {\n value = \"\";\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n\n if (str[i].search(numberingSystems.hanidec) !== -1) {\n value += hanidecChars.indexOf(str[i]);\n } else {\n for (const key in numberingSystemsUTF16) {\n const [min, max] = numberingSystemsUTF16[key];\n if (code >= min && code <= max) {\n value += code - min;\n }\n }\n }\n }\n return parseInt(value, 10);\n } else {\n return value;\n }\n}\n\n// cache of {numberingSystem: {append: regex}}\nconst digitRegexCache = new Map();\nexport function resetDigitRegexCache() {\n digitRegexCache.clear();\n}\n\nexport function digitRegex({ numberingSystem }, append = \"\") {\n const ns = numberingSystem || \"latn\";\n\n let appendCache = digitRegexCache.get(ns);\n if (appendCache === undefined) {\n appendCache = new Map();\n digitRegexCache.set(ns, appendCache);\n }\n let regex = appendCache.get(append);\n if (regex === undefined) {\n regex = new RegExp(`${numberingSystems[ns]}${append}`);\n appendCache.set(append, regex);\n }\n\n return regex;\n}\n","import SystemZone from \"./zones/systemZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport DateTime from \"./datetime.js\";\n\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport { validateWeekSettings } from \"./impl/util.js\";\nimport { resetDigitRegexCache } from \"./impl/digits.js\";\n\nlet now = () => Date.now(),\n defaultZone = \"system\",\n defaultLocale = null,\n defaultNumberingSystem = null,\n defaultOutputCalendar = null,\n twoDigitCutoffYear = 60,\n throwOnInvalid,\n defaultWeekSettings = null;\n\n/**\n * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.\n */\nexport default class Settings {\n /**\n * Get the callback for returning the current timestamp.\n * @type {function}\n */\n static get now() {\n return now;\n }\n\n /**\n * Set the callback for returning the current timestamp.\n * The function should return a number, which will be interpreted as an Epoch millisecond count\n * @type {function}\n * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future\n * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time\n */\n static set now(n) {\n now = n;\n }\n\n /**\n * Set the default time zone to create DateTimes in. Does not affect existing instances.\n * Use the value \"system\" to reset this value to the system's time zone.\n * @type {string}\n */\n static set defaultZone(zone) {\n defaultZone = zone;\n }\n\n /**\n * Get the default time zone object currently used to create DateTimes. Does not affect existing instances.\n * The default value is the system's time zone (the one set on the machine that runs this code).\n * @type {Zone}\n */\n static get defaultZone() {\n return normalizeZone(defaultZone, SystemZone.instance);\n }\n\n /**\n * Get the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultLocale() {\n return defaultLocale;\n }\n\n /**\n * Set the default locale to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultLocale(locale) {\n defaultLocale = locale;\n }\n\n /**\n * Get the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultNumberingSystem() {\n return defaultNumberingSystem;\n }\n\n /**\n * Set the default numbering system to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultNumberingSystem(numberingSystem) {\n defaultNumberingSystem = numberingSystem;\n }\n\n /**\n * Get the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static get defaultOutputCalendar() {\n return defaultOutputCalendar;\n }\n\n /**\n * Set the default output calendar to create DateTimes with. Does not affect existing instances.\n * @type {string}\n */\n static set defaultOutputCalendar(outputCalendar) {\n defaultOutputCalendar = outputCalendar;\n }\n\n /**\n * @typedef {Object} WeekSettings\n * @property {number} firstDay\n * @property {number} minimalDays\n * @property {number[]} weekend\n */\n\n /**\n * @return {WeekSettings|null}\n */\n static get defaultWeekSettings() {\n return defaultWeekSettings;\n }\n\n /**\n * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and\n * how many days are required in the first week of a year.\n * Does not affect existing instances.\n *\n * @param {WeekSettings|null} weekSettings\n */\n static set defaultWeekSettings(weekSettings) {\n defaultWeekSettings = validateWeekSettings(weekSettings);\n }\n\n /**\n * Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.\n * @type {number}\n */\n static get twoDigitCutoffYear() {\n return twoDigitCutoffYear;\n }\n\n /**\n * Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.\n * @type {number}\n * @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century\n * @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century\n * @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950\n * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50\n * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50\n */\n static set twoDigitCutoffYear(cutoffYear) {\n twoDigitCutoffYear = cutoffYear % 100;\n }\n\n /**\n * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static get throwOnInvalid() {\n return throwOnInvalid;\n }\n\n /**\n * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals\n * @type {boolean}\n */\n static set throwOnInvalid(t) {\n throwOnInvalid = t;\n }\n\n /**\n * Reset Luxon's global caches. Should only be necessary in testing scenarios.\n * @return {void}\n */\n static resetCaches() {\n Locale.resetCache();\n IANAZone.resetCache();\n DateTime.resetCache();\n resetDigitRegexCache();\n }\n}\n","export default class Invalid {\n constructor(reason, explanation) {\n this.reason = reason;\n this.explanation = explanation;\n }\n\n toMessage() {\n if (this.explanation) {\n return `${this.reason}: ${this.explanation}`;\n } else {\n return this.reason;\n }\n }\n}\n","import {\n integerBetween,\n isLeapYear,\n timeObject,\n daysInYear,\n daysInMonth,\n weeksInWeekYear,\n isInteger,\n isUndefined,\n} from \"./util.js\";\nimport Invalid from \"./invalid.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],\n leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];\n\nfunction unitOutOfRange(unit, value) {\n return new Invalid(\n \"unit out of range\",\n `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`\n );\n}\n\nexport function dayOfWeek(year, month, day) {\n const d = new Date(Date.UTC(year, month - 1, day));\n\n if (year < 100 && year >= 0) {\n d.setUTCFullYear(d.getUTCFullYear() - 1900);\n }\n\n const js = d.getUTCDay();\n\n return js === 0 ? 7 : js;\n}\n\nfunction computeOrdinal(year, month, day) {\n return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];\n}\n\nfunction uncomputeOrdinal(year, ordinal) {\n const table = isLeapYear(year) ? leapLadder : nonLeapLadder,\n month0 = table.findIndex((i) => i < ordinal),\n day = ordinal - table[month0];\n return { month: month0 + 1, day };\n}\n\nexport function isoWeekdayToLocal(isoWeekday, startOfWeek) {\n return ((isoWeekday - startOfWeek + 7) % 7) + 1;\n}\n\n/**\n * @private\n */\n\nexport function gregorianToWeek(gregObj, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const { year, month, day } = gregObj,\n ordinal = computeOrdinal(year, month, day),\n weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);\n\n let weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7),\n weekYear;\n\n if (weekNumber < 1) {\n weekYear = year - 1;\n weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);\n } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {\n weekYear = year + 1;\n weekNumber = 1;\n } else {\n weekYear = year;\n }\n\n return { weekYear, weekNumber, weekday, ...timeObject(gregObj) };\n}\n\nexport function weekToGregorian(weekData, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const { weekYear, weekNumber, weekday } = weekData,\n weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek),\n yearInDays = daysInYear(weekYear);\n\n let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek,\n year;\n\n if (ordinal < 1) {\n year = weekYear - 1;\n ordinal += daysInYear(year);\n } else if (ordinal > yearInDays) {\n year = weekYear + 1;\n ordinal -= daysInYear(weekYear);\n } else {\n year = weekYear;\n }\n\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(weekData) };\n}\n\nexport function gregorianToOrdinal(gregData) {\n const { year, month, day } = gregData;\n const ordinal = computeOrdinal(year, month, day);\n return { year, ordinal, ...timeObject(gregData) };\n}\n\nexport function ordinalToGregorian(ordinalData) {\n const { year, ordinal } = ordinalData;\n const { month, day } = uncomputeOrdinal(year, ordinal);\n return { year, month, day, ...timeObject(ordinalData) };\n}\n\n/**\n * Check if local week units like localWeekday are used in obj.\n * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties.\n * Modifies obj in-place!\n * @param obj the object values\n */\nexport function usesLocalWeekValues(obj, loc) {\n const hasLocaleWeekData =\n !isUndefined(obj.localWeekday) ||\n !isUndefined(obj.localWeekNumber) ||\n !isUndefined(obj.localWeekYear);\n if (hasLocaleWeekData) {\n const hasIsoWeekData =\n !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);\n\n if (hasIsoWeekData) {\n throw new ConflictingSpecificationError(\n \"Cannot mix locale-based week fields with ISO-based week fields\"\n );\n }\n if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;\n if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;\n if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;\n delete obj.localWeekday;\n delete obj.localWeekNumber;\n delete obj.localWeekYear;\n return {\n minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),\n startOfWeek: loc.getStartOfWeek(),\n };\n } else {\n return { minDaysInFirstWeek: 4, startOfWeek: 1 };\n }\n}\n\nexport function hasInvalidWeekData(obj, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const validYear = isInteger(obj.weekYear),\n validWeek = integerBetween(\n obj.weekNumber,\n 1,\n weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)\n ),\n validWeekday = integerBetween(obj.weekday, 1, 7);\n\n if (!validYear) {\n return unitOutOfRange(\"weekYear\", obj.weekYear);\n } else if (!validWeek) {\n return unitOutOfRange(\"week\", obj.weekNumber);\n } else if (!validWeekday) {\n return unitOutOfRange(\"weekday\", obj.weekday);\n } else return false;\n}\n\nexport function hasInvalidOrdinalData(obj) {\n const validYear = isInteger(obj.year),\n validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validOrdinal) {\n return unitOutOfRange(\"ordinal\", obj.ordinal);\n } else return false;\n}\n\nexport function hasInvalidGregorianData(obj) {\n const validYear = isInteger(obj.year),\n validMonth = integerBetween(obj.month, 1, 12),\n validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));\n\n if (!validYear) {\n return unitOutOfRange(\"year\", obj.year);\n } else if (!validMonth) {\n return unitOutOfRange(\"month\", obj.month);\n } else if (!validDay) {\n return unitOutOfRange(\"day\", obj.day);\n } else return false;\n}\n\nexport function hasInvalidTimeData(obj) {\n const { hour, minute, second, millisecond } = obj;\n const validHour =\n integerBetween(hour, 0, 23) ||\n (hour === 24 && minute === 0 && second === 0 && millisecond === 0),\n validMinute = integerBetween(minute, 0, 59),\n validSecond = integerBetween(second, 0, 59),\n validMillisecond = integerBetween(millisecond, 0, 999);\n\n if (!validHour) {\n return unitOutOfRange(\"hour\", hour);\n } else if (!validMinute) {\n return unitOutOfRange(\"minute\", minute);\n } else if (!validSecond) {\n return unitOutOfRange(\"second\", second);\n } else if (!validMillisecond) {\n return unitOutOfRange(\"millisecond\", millisecond);\n } else return false;\n}\n","/*\n This is just a junk drawer, containing anything used across multiple classes.\n Because Luxon is small(ish), this should stay small and we won't worry about splitting\n it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.\n*/\n\nimport { InvalidArgumentError } from \"../errors.js\";\nimport Settings from \"../settings.js\";\nimport { dayOfWeek, isoWeekdayToLocal } from \"./conversions.js\";\n\n/**\n * @private\n */\n\n// TYPES\n\nexport function isUndefined(o) {\n return typeof o === \"undefined\";\n}\n\nexport function isNumber(o) {\n return typeof o === \"number\";\n}\n\nexport function isInteger(o) {\n return typeof o === \"number\" && o % 1 === 0;\n}\n\nexport function isString(o) {\n return typeof o === \"string\";\n}\n\nexport function isDate(o) {\n return Object.prototype.toString.call(o) === \"[object Date]\";\n}\n\n// CAPABILITIES\n\nexport function hasRelative() {\n try {\n return typeof Intl !== \"undefined\" && !!Intl.RelativeTimeFormat;\n } catch (e) {\n return false;\n }\n}\n\nexport function hasLocaleWeekInfo() {\n try {\n return (\n typeof Intl !== \"undefined\" &&\n !!Intl.Locale &&\n (\"weekInfo\" in Intl.Locale.prototype || \"getWeekInfo\" in Intl.Locale.prototype)\n );\n } catch (e) {\n return false;\n }\n}\n\n// OBJECTS AND ARRAYS\n\nexport function maybeArray(thing) {\n return Array.isArray(thing) ? thing : [thing];\n}\n\nexport function bestBy(arr, by, compare) {\n if (arr.length === 0) {\n return undefined;\n }\n return arr.reduce((best, next) => {\n const pair = [by(next), next];\n if (!best) {\n return pair;\n } else if (compare(best[0], pair[0]) === best[0]) {\n return best;\n } else {\n return pair;\n }\n }, null)[1];\n}\n\nexport function pick(obj, keys) {\n return keys.reduce((a, k) => {\n a[k] = obj[k];\n return a;\n }, {});\n}\n\nexport function hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport function validateWeekSettings(settings) {\n if (settings == null) {\n return null;\n } else if (typeof settings !== \"object\") {\n throw new InvalidArgumentError(\"Week settings must be an object\");\n } else {\n if (\n !integerBetween(settings.firstDay, 1, 7) ||\n !integerBetween(settings.minimalDays, 1, 7) ||\n !Array.isArray(settings.weekend) ||\n settings.weekend.some((v) => !integerBetween(v, 1, 7))\n ) {\n throw new InvalidArgumentError(\"Invalid week settings\");\n }\n return {\n firstDay: settings.firstDay,\n minimalDays: settings.minimalDays,\n weekend: Array.from(settings.weekend),\n };\n }\n}\n\n// NUMBERS AND STRINGS\n\nexport function integerBetween(thing, bottom, top) {\n return isInteger(thing) && thing >= bottom && thing <= top;\n}\n\n// x % n but takes the sign of n instead of x\nexport function floorMod(x, n) {\n return x - n * Math.floor(x / n);\n}\n\nexport function padStart(input, n = 2) {\n const isNeg = input < 0;\n let padded;\n if (isNeg) {\n padded = \"-\" + (\"\" + -input).padStart(n, \"0\");\n } else {\n padded = (\"\" + input).padStart(n, \"0\");\n }\n return padded;\n}\n\nexport function parseInteger(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseInt(string, 10);\n }\n}\n\nexport function parseFloating(string) {\n if (isUndefined(string) || string === null || string === \"\") {\n return undefined;\n } else {\n return parseFloat(string);\n }\n}\n\nexport function parseMillis(fraction) {\n // Return undefined (instead of 0) in these cases, where fraction is not set\n if (isUndefined(fraction) || fraction === null || fraction === \"\") {\n return undefined;\n } else {\n const f = parseFloat(\"0.\" + fraction) * 1000;\n return Math.floor(f);\n }\n}\n\nexport function roundTo(number, digits, rounding = \"round\") {\n const factor = 10 ** digits;\n switch (rounding) {\n case \"expand\":\n return number > 0\n ? Math.ceil(number * factor) / factor\n : Math.floor(number * factor) / factor;\n case \"trunc\":\n return Math.trunc(number * factor) / factor;\n case \"round\":\n return Math.round(number * factor) / factor;\n case \"floor\":\n return Math.floor(number * factor) / factor;\n case \"ceil\":\n return Math.ceil(number * factor) / factor;\n default:\n throw new RangeError(`Value rounding ${rounding} is out of range`);\n }\n}\n\n// DATE BASICS\n\nexport function isLeapYear(year) {\n return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n}\n\nexport function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\nexport function daysInMonth(year, month) {\n const modMonth = floorMod(month - 1, 12) + 1,\n modYear = year + (month - modMonth) / 12;\n\n if (modMonth === 2) {\n return isLeapYear(modYear) ? 29 : 28;\n } else {\n return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];\n }\n}\n\n// convert a calendar object to a local timestamp (epoch, but with the offset baked in)\nexport function objToLocalTS(obj) {\n let d = Date.UTC(\n obj.year,\n obj.month - 1,\n obj.day,\n obj.hour,\n obj.minute,\n obj.second,\n obj.millisecond\n );\n\n // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that\n if (obj.year < 100 && obj.year >= 0) {\n d = new Date(d);\n // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not\n // so if obj.year is in 99, but obj.day makes it roll over into year 100,\n // the calculations done by Date.UTC are using year 2000 - which is incorrect\n d.setUTCFullYear(obj.year, obj.month - 1, obj.day);\n }\n return +d;\n}\n\n// adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js\nfunction firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {\n const fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);\n return -fwdlw + minDaysInFirstWeek - 1;\n}\n\nexport function weeksInWeekYear(weekYear, minDaysInFirstWeek = 4, startOfWeek = 1) {\n const weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);\n const weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);\n return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;\n}\n\nexport function untruncateYear(year) {\n if (year > 99) {\n return year;\n } else return year > Settings.twoDigitCutoffYear ? 1900 + year : 2000 + year;\n}\n\n// PARSING\n\nexport function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {\n const date = new Date(ts),\n intlOpts = {\n hourCycle: \"h23\",\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n };\n\n if (timeZone) {\n intlOpts.timeZone = timeZone;\n }\n\n const modified = { timeZoneName: offsetFormat, ...intlOpts };\n\n const parsed = new Intl.DateTimeFormat(locale, modified)\n .formatToParts(date)\n .find((m) => m.type.toLowerCase() === \"timezonename\");\n return parsed ? parsed.value : null;\n}\n\n// signedOffset('-5', '30') -> -330\nexport function signedOffset(offHourStr, offMinuteStr) {\n let offHour = parseInt(offHourStr, 10);\n\n // don't || this because we want to preserve -0\n if (Number.isNaN(offHour)) {\n offHour = 0;\n }\n\n const offMin = parseInt(offMinuteStr, 10) || 0,\n offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;\n return offHour * 60 + offMinSigned;\n}\n\n// COERCION\n\nexport function asNumber(value) {\n const numericValue = Number(value);\n if (typeof value === \"boolean\" || value === \"\" || !Number.isFinite(numericValue))\n throw new InvalidArgumentError(`Invalid unit value ${value}`);\n return numericValue;\n}\n\nexport function normalizeObject(obj, normalizer) {\n const normalized = {};\n for (const u in obj) {\n if (hasOwnProperty(obj, u)) {\n const v = obj[u];\n if (v === undefined || v === null) continue;\n normalized[normalizer(u)] = asNumber(v);\n }\n }\n return normalized;\n}\n\n/**\n * Returns the offset's value as a string\n * @param {number} ts - Epoch milliseconds for which to get the offset\n * @param {string} format - What style of offset to return.\n * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively\n * @return {string}\n */\nexport function formatOffset(offset, format) {\n const hours = Math.trunc(Math.abs(offset / 60)),\n minutes = Math.trunc(Math.abs(offset % 60)),\n sign = offset >= 0 ? \"+\" : \"-\";\n\n switch (format) {\n case \"short\":\n return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;\n case \"narrow\":\n return `${sign}${hours}${minutes > 0 ? `:${minutes}` : \"\"}`;\n case \"techie\":\n return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;\n default:\n throw new RangeError(`Value format ${format} is out of range for property format`);\n }\n}\n\nexport function timeObject(obj) {\n return pick(obj, [\"hour\", \"minute\", \"second\", \"millisecond\"]);\n}\n","import * as Formats from \"./formats.js\";\nimport { pick } from \"./util.js\";\n\nfunction stringify(obj) {\n return JSON.stringify(obj, Object.keys(obj).sort());\n}\n\n/**\n * @private\n */\n\nexport const monthsLong = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n];\n\nexport const monthsShort = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n];\n\nexport const monthsNarrow = [\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"];\n\nexport function months(length) {\n switch (length) {\n case \"narrow\":\n return [...monthsNarrow];\n case \"short\":\n return [...monthsShort];\n case \"long\":\n return [...monthsLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\"];\n case \"2-digit\":\n return [\"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"07\", \"08\", \"09\", \"10\", \"11\", \"12\"];\n default:\n return null;\n }\n}\n\nexport const weekdaysLong = [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\",\n];\n\nexport const weekdaysShort = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\nexport const weekdaysNarrow = [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"];\n\nexport function weekdays(length) {\n switch (length) {\n case \"narrow\":\n return [...weekdaysNarrow];\n case \"short\":\n return [...weekdaysShort];\n case \"long\":\n return [...weekdaysLong];\n case \"numeric\":\n return [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\"];\n default:\n return null;\n }\n}\n\nexport const meridiems = [\"AM\", \"PM\"];\n\nexport const erasLong = [\"Before Christ\", \"Anno Domini\"];\n\nexport const erasShort = [\"BC\", \"AD\"];\n\nexport const erasNarrow = [\"B\", \"A\"];\n\nexport function eras(length) {\n switch (length) {\n case \"narrow\":\n return [...erasNarrow];\n case \"short\":\n return [...erasShort];\n case \"long\":\n return [...erasLong];\n default:\n return null;\n }\n}\n\nexport function meridiemForDateTime(dt) {\n return meridiems[dt.hour < 12 ? 0 : 1];\n}\n\nexport function weekdayForDateTime(dt, length) {\n return weekdays(length)[dt.weekday - 1];\n}\n\nexport function monthForDateTime(dt, length) {\n return months(length)[dt.month - 1];\n}\n\nexport function eraForDateTime(dt, length) {\n return eras(length)[dt.year < 0 ? 0 : 1];\n}\n\nexport function formatRelativeTime(unit, count, numeric = \"always\", narrow = false) {\n const units = {\n years: [\"year\", \"yr.\"],\n quarters: [\"quarter\", \"qtr.\"],\n months: [\"month\", \"mo.\"],\n weeks: [\"week\", \"wk.\"],\n days: [\"day\", \"day\", \"days\"],\n hours: [\"hour\", \"hr.\"],\n minutes: [\"minute\", \"min.\"],\n seconds: [\"second\", \"sec.\"],\n };\n\n const lastable = [\"hours\", \"minutes\", \"seconds\"].indexOf(unit) === -1;\n\n if (numeric === \"auto\" && lastable) {\n const isDay = unit === \"days\";\n switch (count) {\n case 1:\n return isDay ? \"tomorrow\" : `next ${units[unit][0]}`;\n case -1:\n return isDay ? \"yesterday\" : `last ${units[unit][0]}`;\n case 0:\n return isDay ? \"today\" : `this ${units[unit][0]}`;\n default: // fall through\n }\n }\n\n const isInPast = Object.is(count, -0) || count < 0,\n fmtValue = Math.abs(count),\n singular = fmtValue === 1,\n lilUnits = units[unit],\n fmtUnit = narrow\n ? singular\n ? lilUnits[1]\n : lilUnits[2] || lilUnits[1]\n : singular\n ? units[unit][0]\n : unit;\n return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;\n}\n\nexport function formatString(knownFormat) {\n // these all have the offsets removed because we don't have access to them\n // without all the intl stuff this is backfilling\n const filtered = pick(knownFormat, [\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n \"hourCycle\",\n ]),\n key = stringify(filtered),\n dateTimeHuge = \"EEEE, LLLL d, yyyy, h:mm a\";\n switch (key) {\n case stringify(Formats.DATE_SHORT):\n return \"M/d/yyyy\";\n case stringify(Formats.DATE_MED):\n return \"LLL d, yyyy\";\n case stringify(Formats.DATE_MED_WITH_WEEKDAY):\n return \"EEE, LLL d, yyyy\";\n case stringify(Formats.DATE_FULL):\n return \"LLLL d, yyyy\";\n case stringify(Formats.DATE_HUGE):\n return \"EEEE, LLLL d, yyyy\";\n case stringify(Formats.TIME_SIMPLE):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_SECONDS):\n return \"h:mm:ss a\";\n case stringify(Formats.TIME_WITH_SHORT_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_WITH_LONG_OFFSET):\n return \"h:mm a\";\n case stringify(Formats.TIME_24_SIMPLE):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_SECONDS):\n return \"HH:mm:ss\";\n case stringify(Formats.TIME_24_WITH_SHORT_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.TIME_24_WITH_LONG_OFFSET):\n return \"HH:mm\";\n case stringify(Formats.DATETIME_SHORT):\n return \"M/d/yyyy, h:mm a\";\n case stringify(Formats.DATETIME_MED):\n return \"LLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL):\n return \"LLLL d, yyyy, h:mm a\";\n case stringify(Formats.DATETIME_HUGE):\n return dateTimeHuge;\n case stringify(Formats.DATETIME_SHORT_WITH_SECONDS):\n return \"M/d/yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_SECONDS):\n return \"LLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_MED_WITH_WEEKDAY):\n return \"EEE, d LLL yyyy, h:mm a\";\n case stringify(Formats.DATETIME_FULL_WITH_SECONDS):\n return \"LLLL d, yyyy, h:mm:ss a\";\n case stringify(Formats.DATETIME_HUGE_WITH_SECONDS):\n return \"EEEE, LLLL d, yyyy, h:mm:ss a\";\n default:\n return dateTimeHuge;\n }\n}\n","import * as English from \"./english.js\";\nimport * as Formats from \"./formats.js\";\nimport { padStart } from \"./util.js\";\n\nfunction stringifyTokens(splits, tokenToString) {\n let s = \"\";\n for (const token of splits) {\n if (token.literal) {\n s += token.val;\n } else {\n s += tokenToString(token.val);\n }\n }\n return s;\n}\n\nconst macroTokenToFormatOpts = {\n D: Formats.DATE_SHORT,\n DD: Formats.DATE_MED,\n DDD: Formats.DATE_FULL,\n DDDD: Formats.DATE_HUGE,\n t: Formats.TIME_SIMPLE,\n tt: Formats.TIME_WITH_SECONDS,\n ttt: Formats.TIME_WITH_SHORT_OFFSET,\n tttt: Formats.TIME_WITH_LONG_OFFSET,\n T: Formats.TIME_24_SIMPLE,\n TT: Formats.TIME_24_WITH_SECONDS,\n TTT: Formats.TIME_24_WITH_SHORT_OFFSET,\n TTTT: Formats.TIME_24_WITH_LONG_OFFSET,\n f: Formats.DATETIME_SHORT,\n ff: Formats.DATETIME_MED,\n fff: Formats.DATETIME_FULL,\n ffff: Formats.DATETIME_HUGE,\n F: Formats.DATETIME_SHORT_WITH_SECONDS,\n FF: Formats.DATETIME_MED_WITH_SECONDS,\n FFF: Formats.DATETIME_FULL_WITH_SECONDS,\n FFFF: Formats.DATETIME_HUGE_WITH_SECONDS,\n};\n\n/**\n * @private\n */\n\nexport default class Formatter {\n static create(locale, opts = {}) {\n return new Formatter(locale, opts);\n }\n\n static parseFormat(fmt) {\n // white-space is always considered a literal in user-provided formats\n // the \" \" token has a special meaning (see unitForToken)\n\n let current = null,\n currentFull = \"\",\n bracketed = false;\n const splits = [];\n for (let i = 0; i < fmt.length; i++) {\n const c = fmt.charAt(i);\n if (c === \"'\") {\n // turn '' into a literal signal quote instead of just skipping the empty literal\n if (currentFull.length > 0 || bracketed) {\n splits.push({\n literal: bracketed || /^\\s+$/.test(currentFull),\n val: currentFull === \"\" ? \"'\" : currentFull,\n });\n }\n current = null;\n currentFull = \"\";\n bracketed = !bracketed;\n } else if (bracketed) {\n currentFull += c;\n } else if (c === current) {\n currentFull += c;\n } else {\n if (currentFull.length > 0) {\n splits.push({ literal: /^\\s+$/.test(currentFull), val: currentFull });\n }\n currentFull = c;\n current = c;\n }\n }\n\n if (currentFull.length > 0) {\n splits.push({ literal: bracketed || /^\\s+$/.test(currentFull), val: currentFull });\n }\n\n return splits;\n }\n\n static macroTokenToFormatOpts(token) {\n return macroTokenToFormatOpts[token];\n }\n\n constructor(locale, formatOpts) {\n this.opts = formatOpts;\n this.loc = locale;\n this.systemLoc = null;\n }\n\n formatWithSystemDefault(dt, opts) {\n if (this.systemLoc === null) {\n this.systemLoc = this.loc.redefaultToSystem();\n }\n const df = this.systemLoc.dtFormatter(dt, { ...this.opts, ...opts });\n return df.format();\n }\n\n dtFormatter(dt, opts = {}) {\n return this.loc.dtFormatter(dt, { ...this.opts, ...opts });\n }\n\n formatDateTime(dt, opts) {\n return this.dtFormatter(dt, opts).format();\n }\n\n formatDateTimeParts(dt, opts) {\n return this.dtFormatter(dt, opts).formatToParts();\n }\n\n formatInterval(interval, opts) {\n const df = this.dtFormatter(interval.start, opts);\n return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());\n }\n\n resolvedOptions(dt, opts) {\n return this.dtFormatter(dt, opts).resolvedOptions();\n }\n\n num(n, p = 0, signDisplay = undefined) {\n // we get some perf out of doing this here, annoyingly\n if (this.opts.forceSimple) {\n return padStart(n, p);\n }\n\n const opts = { ...this.opts };\n\n if (p > 0) {\n opts.padTo = p;\n }\n if (signDisplay) {\n opts.signDisplay = signDisplay;\n }\n\n return this.loc.numberFormatter(opts).format(n);\n }\n\n formatDateTimeFromString(dt, fmt) {\n const knownEnglish = this.loc.listingMode() === \"en\",\n useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== \"gregory\",\n string = (opts, extract) => this.loc.extract(dt, opts, extract),\n formatOffset = (opts) => {\n if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {\n return \"Z\";\n }\n\n return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : \"\";\n },\n meridiem = () =>\n knownEnglish\n ? English.meridiemForDateTime(dt)\n : string({ hour: \"numeric\", hourCycle: \"h12\" }, \"dayperiod\"),\n month = (length, standalone) =>\n knownEnglish\n ? English.monthForDateTime(dt, length)\n : string(standalone ? { month: length } : { month: length, day: \"numeric\" }, \"month\"),\n weekday = (length, standalone) =>\n knownEnglish\n ? English.weekdayForDateTime(dt, length)\n : string(\n standalone ? { weekday: length } : { weekday: length, month: \"long\", day: \"numeric\" },\n \"weekday\"\n ),\n maybeMacro = (token) => {\n const formatOpts = Formatter.macroTokenToFormatOpts(token);\n if (formatOpts) {\n return this.formatWithSystemDefault(dt, formatOpts);\n } else {\n return token;\n }\n },\n era = (length) =>\n knownEnglish ? English.eraForDateTime(dt, length) : string({ era: length }, \"era\"),\n tokenToString = (token) => {\n // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols\n switch (token) {\n // ms\n case \"S\":\n return this.num(dt.millisecond);\n case \"u\":\n // falls through\n case \"SSS\":\n return this.num(dt.millisecond, 3);\n // seconds\n case \"s\":\n return this.num(dt.second);\n case \"ss\":\n return this.num(dt.second, 2);\n // fractional seconds\n case \"uu\":\n return this.num(Math.floor(dt.millisecond / 10), 2);\n case \"uuu\":\n return this.num(Math.floor(dt.millisecond / 100));\n // minutes\n case \"m\":\n return this.num(dt.minute);\n case \"mm\":\n return this.num(dt.minute, 2);\n // hours\n case \"h\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);\n case \"hh\":\n return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);\n case \"H\":\n return this.num(dt.hour);\n case \"HH\":\n return this.num(dt.hour, 2);\n // offset\n case \"Z\":\n // like +6\n return formatOffset({ format: \"narrow\", allowZ: this.opts.allowZ });\n case \"ZZ\":\n // like +06:00\n return formatOffset({ format: \"short\", allowZ: this.opts.allowZ });\n case \"ZZZ\":\n // like +0600\n return formatOffset({ format: \"techie\", allowZ: this.opts.allowZ });\n case \"ZZZZ\":\n // like EST\n return dt.zone.offsetName(dt.ts, { format: \"short\", locale: this.loc.locale });\n case \"ZZZZZ\":\n // like Eastern Standard Time\n return dt.zone.offsetName(dt.ts, { format: \"long\", locale: this.loc.locale });\n // zone\n case \"z\":\n // like America/New_York\n return dt.zoneName;\n // meridiems\n case \"a\":\n return meridiem();\n // dates\n case \"d\":\n return useDateTimeFormatter ? string({ day: \"numeric\" }, \"day\") : this.num(dt.day);\n case \"dd\":\n return useDateTimeFormatter ? string({ day: \"2-digit\" }, \"day\") : this.num(dt.day, 2);\n // weekdays - standalone\n case \"c\":\n // like 1\n return this.num(dt.weekday);\n case \"ccc\":\n // like 'Tues'\n return weekday(\"short\", true);\n case \"cccc\":\n // like 'Tuesday'\n return weekday(\"long\", true);\n case \"ccccc\":\n // like 'T'\n return weekday(\"narrow\", true);\n // weekdays - format\n case \"E\":\n // like 1\n return this.num(dt.weekday);\n case \"EEE\":\n // like 'Tues'\n return weekday(\"short\", false);\n case \"EEEE\":\n // like 'Tuesday'\n return weekday(\"long\", false);\n case \"EEEEE\":\n // like 'T'\n return weekday(\"narrow\", false);\n // months - standalone\n case \"L\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\", day: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"LL\":\n // like 01, doesn't seem to work\n return useDateTimeFormatter\n ? string({ month: \"2-digit\", day: \"numeric\" }, \"month\")\n : this.num(dt.month, 2);\n case \"LLL\":\n // like Jan\n return month(\"short\", true);\n case \"LLLL\":\n // like January\n return month(\"long\", true);\n case \"LLLLL\":\n // like J\n return month(\"narrow\", true);\n // months - format\n case \"M\":\n // like 1\n return useDateTimeFormatter\n ? string({ month: \"numeric\" }, \"month\")\n : this.num(dt.month);\n case \"MM\":\n // like 01\n return useDateTimeFormatter\n ? string({ month: \"2-digit\" }, \"month\")\n : this.num(dt.month, 2);\n case \"MMM\":\n // like Jan\n return month(\"short\", false);\n case \"MMMM\":\n // like January\n return month(\"long\", false);\n case \"MMMMM\":\n // like J\n return month(\"narrow\", false);\n // years\n case \"y\":\n // like 2014\n return useDateTimeFormatter ? string({ year: \"numeric\" }, \"year\") : this.num(dt.year);\n case \"yy\":\n // like 14\n return useDateTimeFormatter\n ? string({ year: \"2-digit\" }, \"year\")\n : this.num(dt.year.toString().slice(-2), 2);\n case \"yyyy\":\n // like 0012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 4);\n case \"yyyyyy\":\n // like 000012\n return useDateTimeFormatter\n ? string({ year: \"numeric\" }, \"year\")\n : this.num(dt.year, 6);\n // eras\n case \"G\":\n // like AD\n return era(\"short\");\n case \"GG\":\n // like Anno Domini\n return era(\"long\");\n case \"GGGGG\":\n return era(\"narrow\");\n case \"kk\":\n return this.num(dt.weekYear.toString().slice(-2), 2);\n case \"kkkk\":\n return this.num(dt.weekYear, 4);\n case \"W\":\n return this.num(dt.weekNumber);\n case \"WW\":\n return this.num(dt.weekNumber, 2);\n case \"n\":\n return this.num(dt.localWeekNumber);\n case \"nn\":\n return this.num(dt.localWeekNumber, 2);\n case \"ii\":\n return this.num(dt.localWeekYear.toString().slice(-2), 2);\n case \"iiii\":\n return this.num(dt.localWeekYear, 4);\n case \"o\":\n return this.num(dt.ordinal);\n case \"ooo\":\n return this.num(dt.ordinal, 3);\n case \"q\":\n // like 1\n return this.num(dt.quarter);\n case \"qq\":\n // like 01\n return this.num(dt.quarter, 2);\n case \"X\":\n return this.num(Math.floor(dt.ts / 1000));\n case \"x\":\n return this.num(dt.ts);\n default:\n return maybeMacro(token);\n }\n };\n\n return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);\n }\n\n formatDurationFromString(dur, fmt) {\n const invertLargest = this.opts.signMode === \"negativeLargestOnly\" ? -1 : 1;\n const tokenToField = (token) => {\n switch (token[0]) {\n case \"S\":\n return \"milliseconds\";\n case \"s\":\n return \"seconds\";\n case \"m\":\n return \"minutes\";\n case \"h\":\n return \"hours\";\n case \"d\":\n return \"days\";\n case \"w\":\n return \"weeks\";\n case \"M\":\n return \"months\";\n case \"y\":\n return \"years\";\n default:\n return null;\n }\n },\n tokenToString = (lildur, info) => (token) => {\n const mapped = tokenToField(token);\n if (mapped) {\n const inversionFactor =\n info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;\n let signDisplay;\n if (this.opts.signMode === \"negativeLargestOnly\" && mapped !== info.largestUnit) {\n signDisplay = \"never\";\n } else if (this.opts.signMode === \"all\") {\n signDisplay = \"always\";\n } else {\n // \"auto\" and \"negative\" are the same, but \"auto\" has better support\n signDisplay = \"auto\";\n }\n return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);\n } else {\n return token;\n }\n },\n tokens = Formatter.parseFormat(fmt),\n realTokens = tokens.reduce(\n (found, { literal, val }) => (literal ? found : found.concat(val)),\n []\n ),\n collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t)),\n durationInfo = {\n isNegativeDuration: collapsed < 0,\n // this relies on \"collapsed\" being based on \"shiftTo\", which builds up the object\n // in order\n largestUnit: Object.keys(collapsed.values)[0],\n };\n return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));\n }\n}\n","import {\n untruncateYear,\n signedOffset,\n parseInteger,\n parseMillis,\n isUndefined,\n parseFloating,\n} from \"./util.js\";\nimport * as English from \"./english.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\n\n/*\n * This file handles parsing for well-specified formats. Here's how it works:\n * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.\n * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object\n * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.\n * Extractors can take a \"cursor\" representing the offset in the match to look at. This makes it easy to combine extractors.\n * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.\n * Some extractions are super dumb and simpleParse and fromStrings help DRY them.\n */\n\nconst ianaRegex = /[A-Za-z_+-]{1,256}(?::?\\/[A-Za-z0-9_+-]{1,256}(?:\\/[A-Za-z0-9_+-]{1,256})?)?/;\n\nfunction combineRegexes(...regexes) {\n const full = regexes.reduce((f, r) => f + r.source, \"\");\n return RegExp(`^${full}$`);\n}\n\nfunction combineExtractors(...extractors) {\n return (m) =>\n extractors\n .reduce(\n ([mergedVals, mergedZone, cursor], ex) => {\n const [val, zone, next] = ex(m, cursor);\n return [{ ...mergedVals, ...val }, zone || mergedZone, next];\n },\n [{}, null, 1]\n )\n .slice(0, 2);\n}\n\nfunction parse(s, ...patterns) {\n if (s == null) {\n return [null, null];\n }\n\n for (const [regex, extractor] of patterns) {\n const m = regex.exec(s);\n if (m) {\n return extractor(m);\n }\n }\n return [null, null];\n}\n\nfunction simpleParse(...keys) {\n return (match, cursor) => {\n const ret = {};\n let i;\n\n for (i = 0; i < keys.length; i++) {\n ret[keys[i]] = parseInteger(match[cursor + i]);\n }\n return [ret, null, cursor + i];\n };\n}\n\n// ISO and SQL parsing\nconst offsetRegex = /(?:([Zz])|([+-]\\d\\d)(?::?(\\d\\d))?)/;\nconst isoExtendedZone = `(?:${offsetRegex.source}?(?:\\\\[(${ianaRegex.source})\\\\])?)?`;\nconst isoTimeBaseRegex = /(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:[.,](\\d{1,30}))?)?)?/;\nconst isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);\nconst isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);\nconst isoYmdRegex = /([+-]\\d{6}|\\d{4})(?:-?(\\d\\d)(?:-?(\\d\\d))?)?/;\nconst isoWeekRegex = /(\\d{4})-?W(\\d\\d)(?:-?(\\d))?/;\nconst isoOrdinalRegex = /(\\d{4})-?(\\d{3})/;\nconst extractISOWeekData = simpleParse(\"weekYear\", \"weekNumber\", \"weekDay\");\nconst extractISOOrdinalData = simpleParse(\"year\", \"ordinal\");\nconst sqlYmdRegex = /(\\d{4})-(\\d\\d)-(\\d\\d)/; // dumbed-down version of the ISO one\nconst sqlTimeRegex = RegExp(\n `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`\n);\nconst sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);\n\nfunction int(match, pos, fallback) {\n const m = match[pos];\n return isUndefined(m) ? fallback : parseInteger(m);\n}\n\nfunction extractISOYmd(match, cursor) {\n const item = {\n year: int(match, cursor),\n month: int(match, cursor + 1, 1),\n day: int(match, cursor + 2, 1),\n };\n\n return [item, null, cursor + 3];\n}\n\nfunction extractISOTime(match, cursor) {\n const item = {\n hours: int(match, cursor, 0),\n minutes: int(match, cursor + 1, 0),\n seconds: int(match, cursor + 2, 0),\n milliseconds: parseMillis(match[cursor + 3]),\n };\n\n return [item, null, cursor + 4];\n}\n\nfunction extractISOOffset(match, cursor) {\n const local = !match[cursor] && !match[cursor + 1],\n fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),\n zone = local ? null : FixedOffsetZone.instance(fullOffset);\n return [{}, zone, cursor + 3];\n}\n\nfunction extractIANAZone(match, cursor) {\n const zone = match[cursor] ? IANAZone.create(match[cursor]) : null;\n return [{}, zone, cursor + 1];\n}\n\n// ISO time parsing\n\nconst isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);\n\n// ISO duration parsing\n\nconst isoDuration =\n /^-?P(?:(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)Y)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)M)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)W)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)D)?(?:T(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)H)?(?:(-?\\d{1,20}(?:\\.\\d{1,20})?)M)?(?:(-?\\d{1,20})(?:[.,](-?\\d{1,20}))?S)?)?)$/;\n\nfunction extractISODuration(match) {\n const [s, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] =\n match;\n\n const hasNegativePrefix = s[0] === \"-\";\n const negativeSeconds = secondStr && secondStr[0] === \"-\";\n\n const maybeNegate = (num, force = false) =>\n num !== undefined && (force || (num && hasNegativePrefix)) ? -num : num;\n\n return [\n {\n years: maybeNegate(parseFloating(yearStr)),\n months: maybeNegate(parseFloating(monthStr)),\n weeks: maybeNegate(parseFloating(weekStr)),\n days: maybeNegate(parseFloating(dayStr)),\n hours: maybeNegate(parseFloating(hourStr)),\n minutes: maybeNegate(parseFloating(minuteStr)),\n seconds: maybeNegate(parseFloating(secondStr), secondStr === \"-0\"),\n milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds),\n },\n ];\n}\n\n// These are a little braindead. EDT *should* tell us that we're in, say, America/New_York\n// and not just that we're in -240 *right now*. But since I don't think these are used that often\n// I'm just going to ignore that\nconst obsOffsets = {\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n};\n\nfunction fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {\n const result = {\n year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),\n month: English.monthsShort.indexOf(monthStr) + 1,\n day: parseInteger(dayStr),\n hour: parseInteger(hourStr),\n minute: parseInteger(minuteStr),\n };\n\n if (secondStr) result.second = parseInteger(secondStr);\n if (weekdayStr) {\n result.weekday =\n weekdayStr.length > 3\n ? English.weekdaysLong.indexOf(weekdayStr) + 1\n : English.weekdaysShort.indexOf(weekdayStr) + 1;\n }\n\n return result;\n}\n\n// RFC 2822/5322\nconst rfc2822 =\n /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\\d\\d)(\\d\\d)))$/;\n\nfunction extractRFC2822(match) {\n const [\n ,\n weekdayStr,\n dayStr,\n monthStr,\n yearStr,\n hourStr,\n minuteStr,\n secondStr,\n obsOffset,\n milOffset,\n offHourStr,\n offMinuteStr,\n ] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n\n let offset;\n if (obsOffset) {\n offset = obsOffsets[obsOffset];\n } else if (milOffset) {\n offset = 0;\n } else {\n offset = signedOffset(offHourStr, offMinuteStr);\n }\n\n return [result, new FixedOffsetZone(offset)];\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^()]*\\)|[\\n\\t]/g, \" \")\n .replace(/(\\s\\s+)/g, \" \")\n .trim();\n}\n\n// http date\n\nconst rfc1123 =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d\\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\\d{4}) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n rfc850 =\n /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\\d\\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) GMT$/,\n ascii =\n /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \\d|\\d\\d) (\\d\\d):(\\d\\d):(\\d\\d) (\\d{4})$/;\n\nfunction extractRFC1123Or850(match) {\n const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nfunction extractASCII(match) {\n const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match,\n result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);\n return [result, FixedOffsetZone.utcInstance];\n}\n\nconst isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);\nconst isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);\nconst isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);\nconst isoTimeCombinedRegex = combineRegexes(isoTimeRegex);\n\nconst extractISOYmdTimeAndOffset = combineExtractors(\n extractISOYmd,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOWeekTimeAndOffset = combineExtractors(\n extractISOWeekData,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOOrdinalDateAndTime = combineExtractors(\n extractISOOrdinalData,\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\nconst extractISOTimeAndOffset = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\n/*\n * @private\n */\n\nexport function parseISODate(s) {\n return parse(\n s,\n [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],\n [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime],\n [isoTimeCombinedRegex, extractISOTimeAndOffset]\n );\n}\n\nexport function parseRFC2822Date(s) {\n return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);\n}\n\nexport function parseHTTPDate(s) {\n return parse(\n s,\n [rfc1123, extractRFC1123Or850],\n [rfc850, extractRFC1123Or850],\n [ascii, extractASCII]\n );\n}\n\nexport function parseISODuration(s) {\n return parse(s, [isoDuration, extractISODuration]);\n}\n\nconst extractISOTimeOnly = combineExtractors(extractISOTime);\n\nexport function parseISOTimeOnly(s) {\n return parse(s, [isoTimeOnly, extractISOTimeOnly]);\n}\n\nconst sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);\nconst sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);\n\nconst extractISOTimeOffsetAndIANAZone = combineExtractors(\n extractISOTime,\n extractISOOffset,\n extractIANAZone\n);\n\nexport function parseSQL(s) {\n return parse(\n s,\n [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],\n [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]\n );\n}\n","import { InvalidArgumentError, InvalidDurationError, InvalidUnitError } from \"./errors.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Locale from \"./impl/locale.js\";\nimport { parseISODuration, parseISOTimeOnly } from \"./impl/regexParser.js\";\nimport {\n asNumber,\n hasOwnProperty,\n isNumber,\n isUndefined,\n normalizeObject,\n roundTo,\n} from \"./impl/util.js\";\nimport Settings from \"./settings.js\";\nimport DateTime from \"./datetime.js\";\n\nconst INVALID = \"Invalid Duration\";\n\n// unit conversion constants\nexport const lowOrderMatrix = {\n weeks: {\n days: 7,\n hours: 7 * 24,\n minutes: 7 * 24 * 60,\n seconds: 7 * 24 * 60 * 60,\n milliseconds: 7 * 24 * 60 * 60 * 1000,\n },\n days: {\n hours: 24,\n minutes: 24 * 60,\n seconds: 24 * 60 * 60,\n milliseconds: 24 * 60 * 60 * 1000,\n },\n hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },\n minutes: { seconds: 60, milliseconds: 60 * 1000 },\n seconds: { milliseconds: 1000 },\n },\n casualMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: 52,\n days: 365,\n hours: 365 * 24,\n minutes: 365 * 24 * 60,\n seconds: 365 * 24 * 60 * 60,\n milliseconds: 365 * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: 13,\n days: 91,\n hours: 91 * 24,\n minutes: 91 * 24 * 60,\n seconds: 91 * 24 * 60 * 60,\n milliseconds: 91 * 24 * 60 * 60 * 1000,\n },\n months: {\n weeks: 4,\n days: 30,\n hours: 30 * 24,\n minutes: 30 * 24 * 60,\n seconds: 30 * 24 * 60 * 60,\n milliseconds: 30 * 24 * 60 * 60 * 1000,\n },\n\n ...lowOrderMatrix,\n },\n daysInYearAccurate = 146097.0 / 400,\n daysInMonthAccurate = 146097.0 / 4800,\n accurateMatrix = {\n years: {\n quarters: 4,\n months: 12,\n weeks: daysInYearAccurate / 7,\n days: daysInYearAccurate,\n hours: daysInYearAccurate * 24,\n minutes: daysInYearAccurate * 24 * 60,\n seconds: daysInYearAccurate * 24 * 60 * 60,\n milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000,\n },\n quarters: {\n months: 3,\n weeks: daysInYearAccurate / 28,\n days: daysInYearAccurate / 4,\n hours: (daysInYearAccurate * 24) / 4,\n minutes: (daysInYearAccurate * 24 * 60) / 4,\n seconds: (daysInYearAccurate * 24 * 60 * 60) / 4,\n milliseconds: (daysInYearAccurate * 24 * 60 * 60 * 1000) / 4,\n },\n months: {\n weeks: daysInMonthAccurate / 7,\n days: daysInMonthAccurate,\n hours: daysInMonthAccurate * 24,\n minutes: daysInMonthAccurate * 24 * 60,\n seconds: daysInMonthAccurate * 24 * 60 * 60,\n milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000,\n },\n ...lowOrderMatrix,\n };\n\n// units ordered by size\nconst orderedUnits = [\n \"years\",\n \"quarters\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\",\n];\n\nconst reverseUnits = orderedUnits.slice(0).reverse();\n\n// clone really means \"create another instance just like this one, but with these changes\"\nfunction clone(dur, alts, clear = false) {\n // deep merge for vals\n const conf = {\n values: clear ? alts.values : { ...dur.values, ...(alts.values || {}) },\n loc: dur.loc.clone(alts.loc),\n conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,\n matrix: alts.matrix || dur.matrix,\n };\n return new Duration(conf);\n}\n\nfunction durationToMillis(matrix, vals) {\n let sum = vals.milliseconds ?? 0;\n for (const unit of reverseUnits.slice(1)) {\n if (vals[unit]) {\n sum += vals[unit] * matrix[unit][\"milliseconds\"];\n }\n }\n return sum;\n}\n\n// NB: mutates parameters\nfunction normalizeValues(matrix, vals) {\n // the logic below assumes the overall value of the duration is positive\n // if this is not the case, factor is used to make it so\n const factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;\n\n orderedUnits.reduceRight((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n const previousVal = vals[previous] * factor;\n const conv = matrix[current][previous];\n\n // if (previousVal < 0):\n // lower order unit is negative (e.g. { years: 2, days: -2 })\n // normalize this by reducing the higher order unit by the appropriate amount\n // and increasing the lower order unit\n // this can never make the higher order unit negative, because this function only operates\n // on positive durations, so the amount of time represented by the lower order unit cannot\n // be larger than the higher order unit\n // else:\n // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 })\n // in this case we attempt to convert as much as possible from the lower order unit into\n // the higher order one\n //\n // Math.floor takes care of both of these cases, rounding away from 0\n // if previousVal < 0 it makes the absolute value larger\n // if previousVal >= it makes the absolute value smaller\n const rollUp = Math.floor(previousVal / conv);\n vals[current] += rollUp * factor;\n vals[previous] -= rollUp * conv * factor;\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n\n // try to convert any decimals into smaller units if possible\n // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 }\n orderedUnits.reduce((previous, current) => {\n if (!isUndefined(vals[current])) {\n if (previous) {\n const fraction = vals[previous] % 1;\n vals[previous] -= fraction;\n vals[current] += fraction * matrix[previous][current];\n }\n return current;\n } else {\n return previous;\n }\n }, null);\n}\n\n// Remove all properties with a value of 0 from an object\nfunction removeZeroes(vals) {\n const newVals = {};\n for (const [key, value] of Object.entries(vals)) {\n if (value !== 0) {\n newVals[key] = value;\n }\n }\n return newVals;\n}\n\n/**\n * A Duration object represents a period of time, like \"2 months\" or \"1 day, 1 hour\". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime#plus} to add a Duration object to a DateTime, producing another DateTime.\n *\n * Here is a brief overview of commonly used methods and getters in Duration:\n *\n * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.\n * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors.\n * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors.\n * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}.\n * * **Output** To convert the Duration into other representations, see {@link Duration#as}, {@link Duration#toISO}, {@link Duration#toFormat}, and {@link Duration#toJSON}\n *\n * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.\n */\nexport default class Duration {\n /**\n * @private\n */\n constructor(config) {\n const accurate = config.conversionAccuracy === \"longterm\" || false;\n let matrix = accurate ? accurateMatrix : casualMatrix;\n\n if (config.matrix) {\n matrix = config.matrix;\n }\n\n /**\n * @access private\n */\n this.values = config.values;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.conversionAccuracy = accurate ? \"longterm\" : \"casual\";\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.matrix = matrix;\n /**\n * @access private\n */\n this.isLuxonDuration = true;\n }\n\n /**\n * Create Duration from a number of milliseconds.\n * @param {number} count of milliseconds\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n static fromMillis(count, opts) {\n return Duration.fromObject({ milliseconds: count }, opts);\n }\n\n /**\n * Create a Duration from a JavaScript object with keys like 'years' and 'hours'.\n * If this object is empty then a zero milliseconds duration is returned.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.years\n * @param {number} obj.quarters\n * @param {number} obj.months\n * @param {number} obj.weeks\n * @param {number} obj.days\n * @param {number} obj.hours\n * @param {number} obj.minutes\n * @param {number} obj.seconds\n * @param {number} obj.milliseconds\n * @param {Object} [opts=[]] - options for creating this Duration\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the custom conversion system to use\n * @return {Duration}\n */\n static fromObject(obj, opts = {}) {\n if (obj == null || typeof obj !== \"object\") {\n throw new InvalidArgumentError(\n `Duration.fromObject: argument expected to be an object, got ${\n obj === null ? \"null\" : typeof obj\n }`\n );\n }\n\n return new Duration({\n values: normalizeObject(obj, Duration.normalizeUnit),\n loc: Locale.fromObject(opts),\n conversionAccuracy: opts.conversionAccuracy,\n matrix: opts.matrix,\n });\n }\n\n /**\n * Create a Duration from DurationLike.\n *\n * @param {Object | number | Duration} durationLike\n * One of:\n * - object with keys like 'years' and 'hours'.\n * - number representing milliseconds\n * - Duration instance\n * @return {Duration}\n */\n static fromDurationLike(durationLike) {\n if (isNumber(durationLike)) {\n return Duration.fromMillis(durationLike);\n } else if (Duration.isDuration(durationLike)) {\n return durationLike;\n } else if (typeof durationLike === \"object\") {\n return Duration.fromObject(durationLike);\n } else {\n throw new InvalidArgumentError(\n `Unknown duration argument ${durationLike} of type ${typeof durationLike}`\n );\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 duration string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the preset conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }\n * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }\n * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }\n * @return {Duration}\n */\n static fromISO(text, opts) {\n const [parsed] = parseISODuration(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create a Duration from an ISO 8601 time string.\n * @param {string} text - text to parse\n * @param {Object} opts - options for parsing\n * @param {string} [opts.locale='en-US'] - the locale to use\n * @param {string} opts.numberingSystem - the numbering system to use\n * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use\n * @param {string} [opts.matrix=Object] - the conversion system to use\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 }\n * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }\n * @return {Duration}\n */\n static fromISOTime(text, opts) {\n const [parsed] = parseISOTimeOnly(text);\n if (parsed) {\n return Duration.fromObject(parsed, opts);\n } else {\n return Duration.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n }\n\n /**\n * Create an invalid Duration.\n * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Duration}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Duration is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDurationError(invalid);\n } else {\n return new Duration({ invalid });\n }\n }\n\n /**\n * @private\n */\n static normalizeUnit(unit) {\n const normalized = {\n year: \"years\",\n years: \"years\",\n quarter: \"quarters\",\n quarters: \"quarters\",\n month: \"months\",\n months: \"months\",\n week: \"weeks\",\n weeks: \"weeks\",\n day: \"days\",\n days: \"days\",\n hour: \"hours\",\n hours: \"hours\",\n minute: \"minutes\",\n minutes: \"minutes\",\n second: \"seconds\",\n seconds: \"seconds\",\n millisecond: \"milliseconds\",\n milliseconds: \"milliseconds\",\n }[unit ? unit.toLowerCase() : unit];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n }\n\n /**\n * Check if an object is a Duration. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDuration(o) {\n return (o && o.isLuxonDuration) || false;\n }\n\n /**\n * Get the locale of a Duration, such 'en-GB'\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens:\n * * `S` for milliseconds\n * * `s` for seconds\n * * `m` for minutes\n * * `h` for hours\n * * `d` for days\n * * `w` for weeks\n * * `M` for months\n * * `y` for years\n * Notes:\n * * Add padding by repeating the token, e.g. \"yy\" pads the years to two digits, \"hhhh\" pads the hours out to four digits\n * * Tokens can be escaped by wrapping with single quotes.\n * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting.\n * @param {string} fmt - the format string\n * @param {Object} opts - options\n * @param {boolean} [opts.floor=true] - floor numerical values\n * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"y d s\") //=> \"1 6 2\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"yy dd sss\") //=> \"01 06 002\"\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat(\"M S\") //=> \"12 518402000\"\n * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat(\"d s\", { signMode: \"all\" }) //=> \"+6 +2\"\n * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat(\"d s\", { signMode: \"all\" }) //=> \"-6 -2\"\n * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat(\"d s\", { signMode: \"negativeLargestOnly\" }) //=> \"-6 2\"\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n // reverse-compat since 1.2; we always round down now, never up, and we do it by default\n const fmtOpts = {\n ...opts,\n floor: opts.round !== false && opts.floor !== false,\n };\n return this.isValid\n ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a string representation of a Duration with all units included.\n * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options\n * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.\n * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.\n * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero\n * @example\n * ```js\n * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 })\n * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes'\n * dur.toHuman({ listStyle: \"long\" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes'\n * dur.toHuman({ unitDisplay: \"short\" }) //=> '1 mth, 0 wks, 5 hr, 6 min'\n * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes'\n * ```\n */\n toHuman(opts = {}) {\n if (!this.isValid) return INVALID;\n\n const showZeros = opts.showZeros !== false;\n\n const l = orderedUnits\n .map((unit) => {\n const val = this.values[unit];\n if (isUndefined(val) || (val === 0 && !showZeros)) {\n return null;\n }\n return this.loc\n .numberFormatter({ style: \"unit\", unitDisplay: \"long\", ...opts, unit: unit.slice(0, -1) })\n .format(val);\n })\n .filter((n) => n);\n\n return this.loc\n .listFormatter({ type: \"conjunction\", style: opts.listStyle || \"narrow\", ...opts })\n .format(l);\n }\n\n /**\n * Returns a JavaScript object with this Duration's values.\n * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }\n * @return {Object}\n */\n toObject() {\n if (!this.isValid) return {};\n return { ...this.values };\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Durations\n * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'\n * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'\n * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'\n * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'\n * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'\n * @return {string}\n */\n toISO() {\n // we could use the formatter, but this is an easier way to get the minimum string\n if (!this.isValid) return null;\n\n let s = \"P\";\n if (this.years !== 0) s += this.years + \"Y\";\n if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + \"M\";\n if (this.weeks !== 0) s += this.weeks + \"W\";\n if (this.days !== 0) s += this.days + \"D\";\n if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)\n s += \"T\";\n if (this.hours !== 0) s += this.hours + \"H\";\n if (this.minutes !== 0) s += this.minutes + \"M\";\n if (this.seconds !== 0 || this.milliseconds !== 0)\n // this will handle \"floating point madness\" by removing extra decimal places\n // https://stackoverflow.com/questions/588004/is-floating-point-math-broken\n s += roundTo(this.seconds + this.milliseconds / 1000, 3) + \"S\";\n if (s === \"P\") s += \"T0S\";\n return s;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day.\n * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Times\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000'\n * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000'\n * @return {string}\n */\n toISOTime(opts = {}) {\n if (!this.isValid) return null;\n\n const millis = this.toMillis();\n if (millis < 0 || millis >= 86400000) return null;\n\n opts = {\n suppressMilliseconds: false,\n suppressSeconds: false,\n includePrefix: false,\n format: \"extended\",\n ...opts,\n includeOffset: false,\n };\n\n const dateTime = DateTime.fromMillis(millis, { zone: \"UTC\" });\n return dateTime.toISOTime(opts);\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns an ISO 8601 representation of this Duration appropriate for use in debugging.\n * @return {string}\n */\n toString() {\n return this.toISO();\n }\n\n /**\n * Returns a string representation of this Duration appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `Duration { values: ${JSON.stringify(this.values)} }`;\n } else {\n return `Duration { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns an milliseconds value of this Duration.\n * @return {number}\n */\n toMillis() {\n if (!this.isValid) return NaN;\n\n return durationToMillis(this.matrix, this.values);\n }\n\n /**\n * Returns an milliseconds value of this Duration. Alias of {@link toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Make this Duration longer by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n plus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration),\n result = {};\n\n for (const k of orderedUnits) {\n if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {\n result[k] = dur.get(k) + this.get(k);\n }\n }\n\n return clone(this, { values: result }, true);\n }\n\n /**\n * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @return {Duration}\n */\n minus(duration) {\n if (!this.isValid) return this;\n\n const dur = Duration.fromDurationLike(duration);\n return this.plus(dur.negate());\n }\n\n /**\n * Scale this Duration by the specified amount. Return a newly-constructed Duration.\n * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 }\n * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === \"hours\" ? x * 2 : x) //=> { hours: 2, minutes: 30 }\n * @return {Duration}\n */\n mapUnits(fn) {\n if (!this.isValid) return this;\n const result = {};\n for (const k of Object.keys(this.values)) {\n result[k] = asNumber(fn(this.values[k], k));\n }\n return clone(this, { values: result }, true);\n }\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2\n * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0\n * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3\n * @return {number}\n */\n get(unit) {\n return this[Duration.normalizeUnit(unit)];\n }\n\n /**\n * \"Set\" the values of specified units. Return a newly-constructed Duration.\n * @param {Object} values - a mapping of units to numbers\n * @example dur.set({ years: 2017 })\n * @example dur.set({ hours: 8, minutes: 30 })\n * @return {Duration}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const mixed = { ...this.values, ...normalizeObject(values, Duration.normalizeUnit) };\n return clone(this, { values: mixed });\n }\n\n /**\n * \"Set\" the locale and/or numberingSystem. Returns a newly-constructed Duration.\n * @example dur.reconfigure({ locale: 'en-GB' })\n * @return {Duration}\n */\n reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem });\n const opts = { loc, matrix, conversionAccuracy };\n return clone(this, opts);\n }\n\n /**\n * Return the length of the duration in the specified unit.\n * @param {string} unit - a unit such as 'minutes' or 'days'\n * @example Duration.fromObject({years: 1}).as('days') //=> 365\n * @example Duration.fromObject({years: 1}).as('months') //=> 12\n * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5\n * @return {number}\n */\n as(unit) {\n return this.isValid ? this.shiftTo(unit).get(unit) : NaN;\n }\n\n /**\n * Reduce this Duration to its canonical representation in its current units.\n * Assuming the overall value of the Duration is positive, this means:\n * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)\n * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise\n * the overall value would be negative, see third example)\n * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)\n *\n * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.\n * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }\n * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 }\n * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }\n * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 }\n * @return {Duration}\n */\n normalize() {\n if (!this.isValid) return this;\n const vals = this.toObject();\n normalizeValues(this.matrix, vals);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Rescale units to its largest representation\n * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 }\n * @return {Duration}\n */\n rescale() {\n if (!this.isValid) return this;\n const vals = removeZeroes(this.normalize().shiftToAll().toObject());\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Convert this Duration into its representation in a different set of units.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }\n * @return {Duration}\n */\n shiftTo(...units) {\n if (!this.isValid) return this;\n\n if (units.length === 0) {\n return this;\n }\n\n units = units.map((u) => Duration.normalizeUnit(u));\n\n const built = {},\n accumulated = {},\n vals = this.toObject();\n let lastUnit;\n\n for (const k of orderedUnits) {\n if (units.indexOf(k) >= 0) {\n lastUnit = k;\n\n let own = 0;\n\n // anything we haven't boiled down yet should get boiled to this unit\n for (const ak in accumulated) {\n own += this.matrix[ak][k] * accumulated[ak];\n accumulated[ak] = 0;\n }\n\n // plus anything that's already in this unit\n if (isNumber(vals[k])) {\n own += vals[k];\n }\n\n // only keep the integer part for now in the hopes of putting any decimal part\n // into a smaller unit later\n const i = Math.trunc(own);\n built[k] = i;\n accumulated[k] = (own * 1000 - i * 1000) / 1000;\n\n // otherwise, keep it in the wings to boil it later\n } else if (isNumber(vals[k])) {\n accumulated[k] = vals[k];\n }\n }\n\n // anything leftover becomes the decimal for the last unit\n // lastUnit must be defined since units is not empty\n for (const key in accumulated) {\n if (accumulated[key] !== 0) {\n built[lastUnit] +=\n key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];\n }\n }\n\n normalizeValues(this.matrix, built);\n return clone(this, { values: built }, true);\n }\n\n /**\n * Shift this Duration to all available units.\n * Same as shiftTo(\"years\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", \"seconds\", \"milliseconds\")\n * @return {Duration}\n */\n shiftToAll() {\n if (!this.isValid) return this;\n return this.shiftTo(\n \"years\",\n \"months\",\n \"weeks\",\n \"days\",\n \"hours\",\n \"minutes\",\n \"seconds\",\n \"milliseconds\"\n );\n }\n\n /**\n * Return the negative of this Duration.\n * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }\n * @return {Duration}\n */\n negate() {\n if (!this.isValid) return this;\n const negated = {};\n for (const k of Object.keys(this.values)) {\n negated[k] = this.values[k] === 0 ? 0 : -this.values[k];\n }\n return clone(this, { values: negated }, true);\n }\n\n /**\n * Removes all units with values equal to 0 from this Duration.\n * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 }\n * @return {Duration}\n */\n removeZeros() {\n if (!this.isValid) return this;\n const vals = removeZeroes(this.values);\n return clone(this, { values: vals }, true);\n }\n\n /**\n * Get the years.\n * @type {number}\n */\n get years() {\n return this.isValid ? this.values.years || 0 : NaN;\n }\n\n /**\n * Get the quarters.\n * @type {number}\n */\n get quarters() {\n return this.isValid ? this.values.quarters || 0 : NaN;\n }\n\n /**\n * Get the months.\n * @type {number}\n */\n get months() {\n return this.isValid ? this.values.months || 0 : NaN;\n }\n\n /**\n * Get the weeks\n * @type {number}\n */\n get weeks() {\n return this.isValid ? this.values.weeks || 0 : NaN;\n }\n\n /**\n * Get the days.\n * @type {number}\n */\n get days() {\n return this.isValid ? this.values.days || 0 : NaN;\n }\n\n /**\n * Get the hours.\n * @type {number}\n */\n get hours() {\n return this.isValid ? this.values.hours || 0 : NaN;\n }\n\n /**\n * Get the minutes.\n * @type {number}\n */\n get minutes() {\n return this.isValid ? this.values.minutes || 0 : NaN;\n }\n\n /**\n * Get the seconds.\n * @return {number}\n */\n get seconds() {\n return this.isValid ? this.values.seconds || 0 : NaN;\n }\n\n /**\n * Get the milliseconds.\n * @return {number}\n */\n get milliseconds() {\n return this.isValid ? this.values.milliseconds || 0 : NaN;\n }\n\n /**\n * Returns whether the Duration is invalid. Invalid durations are returned by diff operations\n * on invalid DateTimes or Intervals.\n * @return {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this Duration became invalid, or null if the Duration is valid\n * @return {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Duration became invalid, or null if the Duration is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Equality check\n * Two Durations are equal iff they have the same units and the same values for each unit.\n * @param {Duration} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n if (!this.loc.equals(other.loc)) {\n return false;\n }\n\n function eq(v1, v2) {\n // Consider 0 and undefined as equal\n if (v1 === undefined || v1 === 0) return v2 === undefined || v2 === 0;\n return v1 === v2;\n }\n\n for (const u of orderedUnits) {\n if (!eq(this.values[u], other.values[u])) {\n return false;\n }\n }\n return true;\n }\n}\n","import DateTime, { friendlyDateTime } from \"./datetime.js\";\nimport Duration from \"./duration.js\";\nimport Settings from \"./settings.js\";\nimport { InvalidArgumentError, InvalidIntervalError } from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport * as Formats from \"./impl/formats.js\";\n\nconst INVALID = \"Invalid Interval\";\n\n// checks if the start is equal to or before the end\nfunction validateStartEnd(start, end) {\n if (!start || !start.isValid) {\n return Interval.invalid(\"missing or invalid start\");\n } else if (!end || !end.isValid) {\n return Interval.invalid(\"missing or invalid end\");\n } else if (end < start) {\n return Interval.invalid(\n \"end before start\",\n `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`\n );\n } else {\n return null;\n }\n}\n\n/**\n * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.\n *\n * Here is a brief overview of the most commonly used methods and getters in Interval:\n *\n * * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}.\n * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end.\n * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}.\n * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}.\n * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}\n * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}.\n */\nexport default class Interval {\n /**\n * @private\n */\n constructor(config) {\n /**\n * @access private\n */\n this.s = config.start;\n /**\n * @access private\n */\n this.e = config.end;\n /**\n * @access private\n */\n this.invalid = config.invalid || null;\n /**\n * @access private\n */\n this.isLuxonInterval = true;\n }\n\n /**\n * Create an invalid Interval.\n * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {Interval}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the Interval is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidIntervalError(invalid);\n } else {\n return new Interval({ invalid });\n }\n }\n\n /**\n * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.\n * @param {DateTime|Date|Object} start\n * @param {DateTime|Date|Object} end\n * @return {Interval}\n */\n static fromDateTimes(start, end) {\n const builtStart = friendlyDateTime(start),\n builtEnd = friendlyDateTime(end);\n\n const validateError = validateStartEnd(builtStart, builtEnd);\n\n if (validateError == null) {\n return new Interval({\n start: builtStart,\n end: builtEnd,\n });\n } else {\n return validateError;\n }\n }\n\n /**\n * Create an Interval from a start DateTime and a Duration to extend to.\n * @param {DateTime|Date|Object} start\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static after(start, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(start);\n return Interval.fromDateTimes(dt, dt.plus(dur));\n }\n\n /**\n * Create an Interval from an end DateTime and a Duration to extend backwards to.\n * @param {DateTime|Date|Object} end\n * @param {Duration|Object|number} duration - the length of the Interval.\n * @return {Interval}\n */\n static before(end, duration) {\n const dur = Duration.fromDurationLike(duration),\n dt = friendlyDateTime(end);\n return Interval.fromDateTimes(dt.minus(dur), dt);\n }\n\n /**\n * Create an Interval from an ISO 8601 string.\n * Accepts `/`, `/`, and `/` formats.\n * @param {string} text - the ISO string to parse\n * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO}\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {Interval}\n */\n static fromISO(text, opts) {\n const [s, e] = (text || \"\").split(\"/\", 2);\n if (s && e) {\n let start, startIsValid;\n try {\n start = DateTime.fromISO(s, opts);\n startIsValid = start.isValid;\n } catch (e) {\n startIsValid = false;\n }\n\n let end, endIsValid;\n try {\n end = DateTime.fromISO(e, opts);\n endIsValid = end.isValid;\n } catch (e) {\n endIsValid = false;\n }\n\n if (startIsValid && endIsValid) {\n return Interval.fromDateTimes(start, end);\n }\n\n if (startIsValid) {\n const dur = Duration.fromISO(e, opts);\n if (dur.isValid) {\n return Interval.after(start, dur);\n }\n } else if (endIsValid) {\n const dur = Duration.fromISO(s, opts);\n if (dur.isValid) {\n return Interval.before(end, dur);\n }\n }\n }\n return Interval.invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ISO 8601`);\n }\n\n /**\n * Check if an object is an Interval. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isInterval(o) {\n return (o && o.isLuxonInterval) || false;\n }\n\n /**\n * Returns the start of the Interval\n * @type {DateTime}\n */\n get start() {\n return this.isValid ? this.s : null;\n }\n\n /**\n * Returns the end of the Interval. This is the first instant which is not part of the interval\n * (Interval is half-open).\n * @type {DateTime}\n */\n get end() {\n return this.isValid ? this.e : null;\n }\n\n /**\n * Returns the last DateTime included in the interval (since end is not part of the interval)\n * @type {DateTime}\n */\n get lastDateTime() {\n return this.isValid ? (this.e ? this.e.minus(1) : null) : null;\n }\n\n /**\n * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.\n * @type {boolean}\n */\n get isValid() {\n return this.invalidReason === null;\n }\n\n /**\n * Returns an error code if this Interval is invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this Interval became invalid, or null if the Interval is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Returns the length of the Interval in the specified unit.\n * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.\n * @return {number}\n */\n length(unit = \"milliseconds\") {\n return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;\n }\n\n /**\n * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.\n * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'\n * asks 'what dates are included in this interval?', not 'how many days long is this interval?'\n * @param {string} [unit='milliseconds'] - the unit of time to count.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime\n * @return {number}\n */\n count(unit = \"milliseconds\", opts) {\n if (!this.isValid) return NaN;\n const start = this.start.startOf(unit, opts);\n let end;\n if (opts?.useLocaleWeeks) {\n end = this.end.reconfigure({ locale: start.locale });\n } else {\n end = this.end;\n }\n end = end.startOf(unit, opts);\n return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());\n }\n\n /**\n * Returns whether this Interval's start and end are both in the same unit of time\n * @param {string} unit - the unit of time to check sameness on\n * @return {boolean}\n */\n hasSame(unit) {\n return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;\n }\n\n /**\n * Return whether this Interval has the same start and end DateTimes.\n * @return {boolean}\n */\n isEmpty() {\n return this.s.valueOf() === this.e.valueOf();\n }\n\n /**\n * Return whether this Interval's start is after the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isAfter(dateTime) {\n if (!this.isValid) return false;\n return this.s > dateTime;\n }\n\n /**\n * Return whether this Interval's end is before the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n isBefore(dateTime) {\n if (!this.isValid) return false;\n return this.e <= dateTime;\n }\n\n /**\n * Return whether this Interval contains the specified DateTime.\n * @param {DateTime} dateTime\n * @return {boolean}\n */\n contains(dateTime) {\n if (!this.isValid) return false;\n return this.s <= dateTime && this.e > dateTime;\n }\n\n /**\n * \"Sets\" the start and/or end dates. Returns a newly-constructed Interval.\n * @param {Object} values - the values to set\n * @param {DateTime} values.start - the starting DateTime\n * @param {DateTime} values.end - the ending DateTime\n * @return {Interval}\n */\n set({ start, end } = {}) {\n if (!this.isValid) return this;\n return Interval.fromDateTimes(start || this.s, end || this.e);\n }\n\n /**\n * Split this Interval at each of the specified DateTimes\n * @param {...DateTime} dateTimes - the unit of time to count.\n * @return {Array}\n */\n splitAt(...dateTimes) {\n if (!this.isValid) return [];\n const sorted = dateTimes\n .map(friendlyDateTime)\n .filter((d) => this.contains(d))\n .sort((a, b) => a.toMillis() - b.toMillis()),\n results = [];\n let { s } = this,\n i = 0;\n\n while (s < this.e) {\n const added = sorted[i] || this.e,\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n i += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into smaller Intervals, each of the specified length.\n * Left over time is grouped into a smaller interval\n * @param {Duration|Object|number} duration - The length of each resulting interval.\n * @return {Array}\n */\n splitBy(duration) {\n const dur = Duration.fromDurationLike(duration);\n\n if (!this.isValid || !dur.isValid || dur.as(\"milliseconds\") === 0) {\n return [];\n }\n\n let { s } = this,\n idx = 1,\n next;\n\n const results = [];\n while (s < this.e) {\n const added = this.start.plus(dur.mapUnits((x) => x * idx));\n next = +added > +this.e ? this.e : added;\n results.push(Interval.fromDateTimes(s, next));\n s = next;\n idx += 1;\n }\n\n return results;\n }\n\n /**\n * Split this Interval into the specified number of smaller intervals.\n * @param {number} numberOfParts - The number of Intervals to divide the Interval into.\n * @return {Array}\n */\n divideEqually(numberOfParts) {\n if (!this.isValid) return [];\n return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);\n }\n\n /**\n * Return whether this Interval overlaps with the specified Interval\n * @param {Interval} other\n * @return {boolean}\n */\n overlaps(other) {\n return this.e > other.s && this.s < other.e;\n }\n\n /**\n * Return whether this Interval's end is adjacent to the specified Interval's start.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsStart(other) {\n if (!this.isValid) return false;\n return +this.e === +other.s;\n }\n\n /**\n * Return whether this Interval's start is adjacent to the specified Interval's end.\n * @param {Interval} other\n * @return {boolean}\n */\n abutsEnd(other) {\n if (!this.isValid) return false;\n return +other.e === +this.s;\n }\n\n /**\n * Returns true if this Interval fully contains the specified Interval, specifically if the intersect (of this Interval and the other Interval) is equal to the other Interval; false otherwise.\n * @param {Interval} other\n * @return {boolean}\n */\n engulfs(other) {\n if (!this.isValid) return false;\n return this.s <= other.s && this.e >= other.e;\n }\n\n /**\n * Return whether this Interval has the same start and end as the specified Interval.\n * @param {Interval} other\n * @return {boolean}\n */\n equals(other) {\n if (!this.isValid || !other.isValid) {\n return false;\n }\n\n return this.s.equals(other.s) && this.e.equals(other.e);\n }\n\n /**\n * Return an Interval representing the intersection of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.\n * Returns null if the intersection is empty, meaning, the intervals don't intersect.\n * @param {Interval} other\n * @return {Interval}\n */\n intersection(other) {\n if (!this.isValid) return this;\n const s = this.s > other.s ? this.s : other.s,\n e = this.e < other.e ? this.e : other.e;\n\n if (s >= e) {\n return null;\n } else {\n return Interval.fromDateTimes(s, e);\n }\n }\n\n /**\n * Return an Interval representing the union of this Interval and the specified Interval.\n * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.\n * @param {Interval} other\n * @return {Interval}\n */\n union(other) {\n if (!this.isValid) return this;\n const s = this.s < other.s ? this.s : other.s,\n e = this.e > other.e ? this.e : other.e;\n return Interval.fromDateTimes(s, e);\n }\n\n /**\n * Merge an array of Intervals into an equivalent minimal set of Intervals.\n * Combines overlapping and adjacent Intervals.\n * The resulting array will contain the Intervals in ascending order, that is, starting with the earliest Interval\n * and ending with the latest.\n *\n * @param {Array} intervals\n * @return {Array}\n */\n static merge(intervals) {\n const [found, final] = intervals\n .sort((a, b) => a.s - b.s)\n .reduce(\n ([sofar, current], item) => {\n if (!current) {\n return [sofar, item];\n } else if (current.overlaps(item) || current.abutsStart(item)) {\n return [sofar, current.union(item)];\n } else {\n return [sofar.concat([current]), item];\n }\n },\n [[], null]\n );\n if (final) {\n found.push(final);\n }\n return found;\n }\n\n /**\n * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.\n * @param {Array} intervals\n * @return {Array}\n */\n static xor(intervals) {\n let start = null,\n currentCount = 0;\n const results = [],\n ends = intervals.map((i) => [\n { time: i.s, type: \"s\" },\n { time: i.e, type: \"e\" },\n ]),\n flattened = Array.prototype.concat(...ends),\n arr = flattened.sort((a, b) => a.time - b.time);\n\n for (const i of arr) {\n currentCount += i.type === \"s\" ? 1 : -1;\n\n if (currentCount === 1) {\n start = i.time;\n } else {\n if (start && +start !== +i.time) {\n results.push(Interval.fromDateTimes(start, i.time));\n }\n\n start = null;\n }\n }\n\n return Interval.merge(results);\n }\n\n /**\n * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.\n * @param {...Interval} intervals\n * @return {Array}\n */\n difference(...intervals) {\n return Interval.xor([this].concat(intervals))\n .map((i) => this.intersection(i))\n .filter((i) => i && !i.isEmpty());\n }\n\n /**\n * Returns a string representation of this Interval appropriate for debugging.\n * @return {string}\n */\n toString() {\n if (!this.isValid) return INVALID;\n return `[${this.s.toISO()} – ${this.e.toISO()})`;\n }\n\n /**\n * Returns a string representation of this Interval appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`;\n } else {\n return `Interval { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns a localized string representing this Interval. Accepts the same options as the\n * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as\n * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method\n * is browser-specific, but in general it will return an appropriate representation of the\n * Interval in the assigned locale. Defaults to the system's locale if no locale has been\n * specified.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or\n * Intl.DateTimeFormat constructor options.\n * @param {Object} opts - Options to override the configuration of the start DateTime.\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022\n * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022\n * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM\n * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 – 8:00 p\n * @return {string}\n */\n toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) {\n return this.isValid\n ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this)\n : INVALID;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this Interval.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISO(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of date of this Interval.\n * The time components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @return {string}\n */\n toISODate() {\n if (!this.isValid) return INVALID;\n return `${this.s.toISODate()}/${this.e.toISODate()}`;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of time of this Interval.\n * The date components are ignored.\n * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals\n * @param {Object} opts - The same options as {@link DateTime#toISO}\n * @return {string}\n */\n toISOTime(opts) {\n if (!this.isValid) return INVALID;\n return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this Interval formatted according to the specified format\n * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible\n * formatting tool.\n * @param {string} dateFormat - The format string. This string formats the start and end time.\n * See {@link DateTime#toFormat} for details.\n * @param {Object} opts - Options.\n * @param {string} [opts.separator = ' – '] - A separator to place between the start and end\n * representations.\n * @return {string}\n */\n toFormat(dateFormat, { separator = \" – \" } = {}) {\n if (!this.isValid) return INVALID;\n return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;\n }\n\n /**\n * Return a Duration representing the time spanned by this interval.\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }\n * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }\n * @return {Duration}\n */\n toDuration(unit, opts) {\n if (!this.isValid) {\n return Duration.invalid(this.invalidReason);\n }\n return this.e.diff(this.s, unit, opts);\n }\n\n /**\n * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes\n * @param {function} mapFn\n * @return {Interval}\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())\n * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))\n */\n mapEndpoints(mapFn) {\n return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Settings from \"./settings.js\";\nimport Locale from \"./impl/locale.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\n\nimport { hasLocaleWeekInfo, hasRelative } from \"./impl/util.js\";\n\n/**\n * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.\n */\nexport default class Info {\n /**\n * Return whether the specified zone contains a DST.\n * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.\n * @return {boolean}\n */\n static hasDST(zone = Settings.defaultZone) {\n const proto = DateTime.now().setZone(zone).set({ month: 12 });\n\n return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset;\n }\n\n /**\n * Return whether the specified zone is a valid IANA specifier.\n * @param {string} zone - Zone to check\n * @return {boolean}\n */\n static isValidIANAZone(zone) {\n return IANAZone.isValidZone(zone);\n }\n\n /**\n * Converts the input into a {@link Zone} instance.\n *\n * * If `input` is already a Zone instance, it is returned unchanged.\n * * If `input` is a string containing a valid time zone name, a Zone instance\n * with that name is returned.\n * * If `input` is a string that doesn't refer to a known time zone, a Zone\n * instance with {@link Zone#isValid} == false is returned.\n * * If `input is a number, a Zone instance with the specified fixed offset\n * in minutes is returned.\n * * If `input` is `null` or `undefined`, the default zone is returned.\n * @param {string|Zone|number} [input] - the value to be converted\n * @return {Zone}\n */\n static normalizeZone(input) {\n return normalizeZone(input, Settings.defaultZone);\n }\n\n /**\n * Get the weekday on which the week starts according to the given locale.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number} the start of the week, 1 for Monday through 7 for Sunday\n */\n static getStartOfWeek({ locale = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale)).getStartOfWeek();\n }\n\n /**\n * Get the minimum number of days necessary in a week before it is considered part of the next year according\n * to the given locale.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number}\n */\n static getMinimumDaysInFirstWeek({ locale = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();\n }\n\n /**\n * Get the weekdays, which are considered the weekend according to the given locale\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday\n */\n static getWeekendWeekdays({ locale = null, locObj = null } = {}) {\n // copy the array, because we cache it internally\n return (locObj || Locale.create(locale)).getWeekendDays().slice();\n }\n\n /**\n * Return an array of standalone month names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @example Info.months()[0] //=> 'January'\n * @example Info.months('short')[0] //=> 'Jan'\n * @example Info.months('numeric')[0] //=> '1'\n * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'\n * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'\n * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'\n * @return {Array}\n */\n static months(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);\n }\n\n /**\n * Return an array of format month names.\n * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that\n * changes the string.\n * See {@link Info#months}\n * @param {string} [length='long'] - the length of the month representation, such as \"numeric\", \"2-digit\", \"narrow\", \"short\", \"long\"\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @param {string} [opts.outputCalendar='gregory'] - the calendar\n * @return {Array}\n */\n static monthsFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null, outputCalendar = \"gregory\" } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);\n }\n\n /**\n * Return an array of standalone week names.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param {string} [length='long'] - the length of the weekday representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @example Info.weekdays()[0] //=> 'Monday'\n * @example Info.weekdays('short')[0] //=> 'Mon'\n * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'\n * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'\n * @return {Array}\n */\n static weekdays(length = \"long\", { locale = null, numberingSystem = null, locObj = null } = {}) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);\n }\n\n /**\n * Return an array of format week names.\n * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that\n * changes the string.\n * See {@link Info#weekdays}\n * @param {string} [length='long'] - the length of the month representation, such as \"narrow\", \"short\", \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale=null] - the locale code\n * @param {string} [opts.numberingSystem=null] - the numbering system\n * @param {string} [opts.locObj=null] - an existing locale object to use\n * @return {Array}\n */\n static weekdaysFormat(\n length = \"long\",\n { locale = null, numberingSystem = null, locObj = null } = {}\n ) {\n return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);\n }\n\n /**\n * Return an array of meridiems.\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.meridiems() //=> [ 'AM', 'PM' ]\n * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]\n * @return {Array}\n */\n static meridiems({ locale = null } = {}) {\n return Locale.create(locale).meridiems();\n }\n\n /**\n * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.\n * @param {string} [length='short'] - the length of the era representation, such as \"short\" or \"long\".\n * @param {Object} opts - options\n * @param {string} [opts.locale] - the locale code\n * @example Info.eras() //=> [ 'BC', 'AD' ]\n * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]\n * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]\n * @return {Array}\n */\n static eras(length = \"short\", { locale = null } = {}) {\n return Locale.create(locale, null, \"gregory\").eras(length);\n }\n\n /**\n * Return the set of available features in this environment.\n * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.\n * Keys:\n * * `relative`: whether this environment supports relative time formatting\n * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale\n * @example Info.features() //=> { relative: false, localeWeek: true }\n * @return {Object}\n */\n static features() {\n return { relative: hasRelative(), localeWeek: hasLocaleWeekInfo() };\n }\n}\n","import Duration from \"../duration.js\";\n\nfunction dayDiff(earlier, later) {\n const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf(\"day\").valueOf(),\n ms = utcDayStart(later) - utcDayStart(earlier);\n return Math.floor(Duration.fromMillis(ms).as(\"days\"));\n}\n\nfunction highOrderDiffs(cursor, later, units) {\n const differs = [\n [\"years\", (a, b) => b.year - a.year],\n [\"quarters\", (a, b) => b.quarter - a.quarter + (b.year - a.year) * 4],\n [\"months\", (a, b) => b.month - a.month + (b.year - a.year) * 12],\n [\n \"weeks\",\n (a, b) => {\n const days = dayDiff(a, b);\n return (days - (days % 7)) / 7;\n },\n ],\n [\"days\", dayDiff],\n ];\n\n const results = {};\n const earlier = cursor;\n let lowestOrder, highWater;\n\n /* This loop tries to diff using larger units first.\n If we overshoot, we backtrack and try the next smaller unit.\n \"cursor\" starts out at the earlier timestamp and moves closer and closer to \"later\"\n as we use smaller and smaller units.\n highWater keeps track of where we would be if we added one more of the smallest unit,\n this is used later to potentially convert any difference smaller than the smallest higher order unit\n into a fraction of that smallest higher order unit\n */\n for (const [unit, differ] of differs) {\n if (units.indexOf(unit) >= 0) {\n lowestOrder = unit;\n\n results[unit] = differ(cursor, later);\n highWater = earlier.plus(results);\n\n if (highWater > later) {\n // we overshot the end point, backtrack cursor by 1\n results[unit]--;\n cursor = earlier.plus(results);\n\n // if we are still overshooting now, we need to backtrack again\n // this happens in certain situations when diffing times in different zones,\n // because this calculation ignores time zones\n if (cursor > later) {\n // keep the \"overshot by 1\" around as highWater\n highWater = cursor;\n // backtrack cursor by 1\n results[unit]--;\n cursor = earlier.plus(results);\n }\n } else {\n cursor = highWater;\n }\n }\n }\n\n return [cursor, results, highWater, lowestOrder];\n}\n\nexport default function (earlier, later, units, opts) {\n let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);\n\n const remainingMillis = later - cursor;\n\n const lowerOrderUnits = units.filter(\n (u) => [\"hours\", \"minutes\", \"seconds\", \"milliseconds\"].indexOf(u) >= 0\n );\n\n if (lowerOrderUnits.length === 0) {\n if (highWater < later) {\n highWater = cursor.plus({ [lowestOrder]: 1 });\n }\n\n if (highWater !== cursor) {\n results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);\n }\n }\n\n const duration = Duration.fromObject(results, opts);\n\n if (lowerOrderUnits.length > 0) {\n return Duration.fromMillis(remainingMillis, opts)\n .shiftTo(...lowerOrderUnits)\n .plus(duration);\n } else {\n return duration;\n }\n}\n","import { parseMillis, isUndefined, untruncateYear, signedOffset, hasOwnProperty } from \"./util.js\";\nimport Formatter from \"./formatter.js\";\nimport FixedOffsetZone from \"../zones/fixedOffsetZone.js\";\nimport IANAZone from \"../zones/IANAZone.js\";\nimport DateTime from \"../datetime.js\";\nimport { digitRegex, parseDigits } from \"./digits.js\";\nimport { ConflictingSpecificationError } from \"../errors.js\";\n\nconst MISSING_FTP = \"missing Intl.DateTimeFormat.formatToParts support\";\n\nfunction intUnit(regex, post = (i) => i) {\n return { regex, deser: ([s]) => post(parseDigits(s)) };\n}\n\nconst NBSP = String.fromCharCode(160);\nconst spaceOrNBSP = `[ ${NBSP}]`;\nconst spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, \"g\");\n\nfunction fixListRegex(s) {\n // make dots optional and also make them literal\n // make space and non breakable space characters interchangeable\n return s.replace(/\\./g, \"\\\\.?\").replace(spaceOrNBSPRegExp, spaceOrNBSP);\n}\n\nfunction stripInsensitivities(s) {\n return s\n .replace(/\\./g, \"\") // ignore dots that were made optional\n .replace(spaceOrNBSPRegExp, \" \") // interchange space and nbsp\n .toLowerCase();\n}\n\nfunction oneOf(strings, startIndex) {\n if (strings === null) {\n return null;\n } else {\n return {\n regex: RegExp(strings.map(fixListRegex).join(\"|\")),\n deser: ([s]) =>\n strings.findIndex((i) => stripInsensitivities(s) === stripInsensitivities(i)) + startIndex,\n };\n }\n}\n\nfunction offset(regex, groups) {\n return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };\n}\n\nfunction simple(regex) {\n return { regex, deser: ([s]) => s };\n}\n\nfunction escapeToken(value) {\n return value.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#\\s]/g, \"\\\\$&\");\n}\n\n/**\n * @param token\n * @param {Locale} loc\n */\nfunction unitForToken(token, loc) {\n const one = digitRegex(loc),\n two = digitRegex(loc, \"{2}\"),\n three = digitRegex(loc, \"{3}\"),\n four = digitRegex(loc, \"{4}\"),\n six = digitRegex(loc, \"{6}\"),\n oneOrTwo = digitRegex(loc, \"{1,2}\"),\n oneToThree = digitRegex(loc, \"{1,3}\"),\n oneToSix = digitRegex(loc, \"{1,6}\"),\n oneToNine = digitRegex(loc, \"{1,9}\"),\n twoToFour = digitRegex(loc, \"{2,4}\"),\n fourToSix = digitRegex(loc, \"{4,6}\"),\n literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s]) => s, literal: true }),\n unitate = (t) => {\n if (token.literal) {\n return literal(t);\n }\n switch (t.val) {\n // era\n case \"G\":\n return oneOf(loc.eras(\"short\"), 0);\n case \"GG\":\n return oneOf(loc.eras(\"long\"), 0);\n // years\n case \"y\":\n return intUnit(oneToSix);\n case \"yy\":\n return intUnit(twoToFour, untruncateYear);\n case \"yyyy\":\n return intUnit(four);\n case \"yyyyy\":\n return intUnit(fourToSix);\n case \"yyyyyy\":\n return intUnit(six);\n // months\n case \"M\":\n return intUnit(oneOrTwo);\n case \"MM\":\n return intUnit(two);\n case \"MMM\":\n return oneOf(loc.months(\"short\", true), 1);\n case \"MMMM\":\n return oneOf(loc.months(\"long\", true), 1);\n case \"L\":\n return intUnit(oneOrTwo);\n case \"LL\":\n return intUnit(two);\n case \"LLL\":\n return oneOf(loc.months(\"short\", false), 1);\n case \"LLLL\":\n return oneOf(loc.months(\"long\", false), 1);\n // dates\n case \"d\":\n return intUnit(oneOrTwo);\n case \"dd\":\n return intUnit(two);\n // ordinals\n case \"o\":\n return intUnit(oneToThree);\n case \"ooo\":\n return intUnit(three);\n // time\n case \"HH\":\n return intUnit(two);\n case \"H\":\n return intUnit(oneOrTwo);\n case \"hh\":\n return intUnit(two);\n case \"h\":\n return intUnit(oneOrTwo);\n case \"mm\":\n return intUnit(two);\n case \"m\":\n return intUnit(oneOrTwo);\n case \"q\":\n return intUnit(oneOrTwo);\n case \"qq\":\n return intUnit(two);\n case \"s\":\n return intUnit(oneOrTwo);\n case \"ss\":\n return intUnit(two);\n case \"S\":\n return intUnit(oneToThree);\n case \"SSS\":\n return intUnit(three);\n case \"u\":\n return simple(oneToNine);\n case \"uu\":\n return simple(oneOrTwo);\n case \"uuu\":\n return intUnit(one);\n // meridiem\n case \"a\":\n return oneOf(loc.meridiems(), 0);\n // weekYear (k)\n case \"kkkk\":\n return intUnit(four);\n case \"kk\":\n return intUnit(twoToFour, untruncateYear);\n // weekNumber (W)\n case \"W\":\n return intUnit(oneOrTwo);\n case \"WW\":\n return intUnit(two);\n // weekdays\n case \"E\":\n case \"c\":\n return intUnit(one);\n case \"EEE\":\n return oneOf(loc.weekdays(\"short\", false), 1);\n case \"EEEE\":\n return oneOf(loc.weekdays(\"long\", false), 1);\n case \"ccc\":\n return oneOf(loc.weekdays(\"short\", true), 1);\n case \"cccc\":\n return oneOf(loc.weekdays(\"long\", true), 1);\n // offset/zone\n case \"Z\":\n case \"ZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);\n case \"ZZZ\":\n return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);\n // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing\n // because we don't have any way to figure out what they are\n case \"z\":\n return simple(/[a-z_+-/]{1,256}?/i);\n // this special-case \"token\" represents a place where a macro-token expanded into a white-space literal\n // in this case we accept any non-newline white-space\n case \" \":\n return simple(/[^\\S\\n\\r]/);\n default:\n return literal(t);\n }\n };\n\n const unit = unitate(token) || {\n invalidReason: MISSING_FTP,\n };\n\n unit.token = token;\n\n return unit;\n}\n\nconst partTypeStyleToTokenVal = {\n year: {\n \"2-digit\": \"yy\",\n numeric: \"yyyyy\",\n },\n month: {\n numeric: \"M\",\n \"2-digit\": \"MM\",\n short: \"MMM\",\n long: \"MMMM\",\n },\n day: {\n numeric: \"d\",\n \"2-digit\": \"dd\",\n },\n weekday: {\n short: \"EEE\",\n long: \"EEEE\",\n },\n dayperiod: \"a\",\n dayPeriod: \"a\",\n hour12: {\n numeric: \"h\",\n \"2-digit\": \"hh\",\n },\n hour24: {\n numeric: \"H\",\n \"2-digit\": \"HH\",\n },\n minute: {\n numeric: \"m\",\n \"2-digit\": \"mm\",\n },\n second: {\n numeric: \"s\",\n \"2-digit\": \"ss\",\n },\n timeZoneName: {\n long: \"ZZZZZ\",\n short: \"ZZZ\",\n },\n};\n\nfunction tokenForPart(part, formatOpts, resolvedOpts) {\n const { type, value } = part;\n\n if (type === \"literal\") {\n const isSpace = /^\\s+$/.test(value);\n return {\n literal: !isSpace,\n val: isSpace ? \" \" : value,\n };\n }\n\n const style = formatOpts[type];\n\n // The user might have explicitly specified hour12 or hourCycle\n // if so, respect their decision\n // if not, refer back to the resolvedOpts, which are based on the locale\n let actualType = type;\n if (type === \"hour\") {\n if (formatOpts.hour12 != null) {\n actualType = formatOpts.hour12 ? \"hour12\" : \"hour24\";\n } else if (formatOpts.hourCycle != null) {\n if (formatOpts.hourCycle === \"h11\" || formatOpts.hourCycle === \"h12\") {\n actualType = \"hour12\";\n } else {\n actualType = \"hour24\";\n }\n } else {\n // tokens only differentiate between 24 hours or not,\n // so we do not need to check hourCycle here, which is less supported anyways\n actualType = resolvedOpts.hour12 ? \"hour12\" : \"hour24\";\n }\n }\n let val = partTypeStyleToTokenVal[actualType];\n if (typeof val === \"object\") {\n val = val[style];\n }\n\n if (val) {\n return {\n literal: false,\n val,\n };\n }\n\n return undefined;\n}\n\nfunction buildRegex(units) {\n const re = units.map((u) => u.regex).reduce((f, r) => `${f}(${r.source})`, \"\");\n return [`^${re}$`, units];\n}\n\nfunction match(input, regex, handlers) {\n const matches = input.match(regex);\n\n if (matches) {\n const all = {};\n let matchIndex = 1;\n for (const i in handlers) {\n if (hasOwnProperty(handlers, i)) {\n const h = handlers[i],\n groups = h.groups ? h.groups + 1 : 1;\n if (!h.literal && h.token) {\n all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));\n }\n matchIndex += groups;\n }\n }\n return [matches, all];\n } else {\n return [matches, {}];\n }\n}\n\nfunction dateTimeFromMatches(matches) {\n const toField = (token) => {\n switch (token) {\n case \"S\":\n return \"millisecond\";\n case \"s\":\n return \"second\";\n case \"m\":\n return \"minute\";\n case \"h\":\n case \"H\":\n return \"hour\";\n case \"d\":\n return \"day\";\n case \"o\":\n return \"ordinal\";\n case \"L\":\n case \"M\":\n return \"month\";\n case \"y\":\n return \"year\";\n case \"E\":\n case \"c\":\n return \"weekday\";\n case \"W\":\n return \"weekNumber\";\n case \"k\":\n return \"weekYear\";\n case \"q\":\n return \"quarter\";\n default:\n return null;\n }\n };\n\n let zone = null;\n let specificOffset;\n if (!isUndefined(matches.z)) {\n zone = IANAZone.create(matches.z);\n }\n\n if (!isUndefined(matches.Z)) {\n if (!zone) {\n zone = new FixedOffsetZone(matches.Z);\n }\n specificOffset = matches.Z;\n }\n\n if (!isUndefined(matches.q)) {\n matches.M = (matches.q - 1) * 3 + 1;\n }\n\n if (!isUndefined(matches.h)) {\n if (matches.h < 12 && matches.a === 1) {\n matches.h += 12;\n } else if (matches.h === 12 && matches.a === 0) {\n matches.h = 0;\n }\n }\n\n if (matches.G === 0 && matches.y) {\n matches.y = -matches.y;\n }\n\n if (!isUndefined(matches.u)) {\n matches.S = parseMillis(matches.u);\n }\n\n const vals = Object.keys(matches).reduce((r, k) => {\n const f = toField(k);\n if (f) {\n r[f] = matches[k];\n }\n\n return r;\n }, {});\n\n return [vals, zone, specificOffset];\n}\n\nlet dummyDateTimeCache = null;\n\nfunction getDummyDateTime() {\n if (!dummyDateTimeCache) {\n dummyDateTimeCache = DateTime.fromMillis(1555555555555);\n }\n\n return dummyDateTimeCache;\n}\n\nfunction maybeExpandMacroToken(token, locale) {\n if (token.literal) {\n return token;\n }\n\n const formatOpts = Formatter.macroTokenToFormatOpts(token.val);\n const tokens = formatOptsToTokens(formatOpts, locale);\n\n if (tokens == null || tokens.includes(undefined)) {\n return token;\n }\n\n return tokens;\n}\n\nexport function expandMacroTokens(tokens, locale) {\n return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale)));\n}\n\n/**\n * @private\n */\n\nexport class TokenParser {\n constructor(locale, format) {\n this.locale = locale;\n this.format = format;\n this.tokens = expandMacroTokens(Formatter.parseFormat(format), locale);\n this.units = this.tokens.map((t) => unitForToken(t, locale));\n this.disqualifyingUnit = this.units.find((t) => t.invalidReason);\n\n if (!this.disqualifyingUnit) {\n const [regexString, handlers] = buildRegex(this.units);\n this.regex = RegExp(regexString, \"i\");\n this.handlers = handlers;\n }\n }\n\n explainFromTokens(input) {\n if (!this.isValid) {\n return { input, tokens: this.tokens, invalidReason: this.invalidReason };\n } else {\n const [rawMatches, matches] = match(input, this.regex, this.handlers),\n [result, zone, specificOffset] = matches\n ? dateTimeFromMatches(matches)\n : [null, null, undefined];\n if (hasOwnProperty(matches, \"a\") && hasOwnProperty(matches, \"H\")) {\n throw new ConflictingSpecificationError(\n \"Can't include meridiem when specifying 24-hour format\"\n );\n }\n return {\n input,\n tokens: this.tokens,\n regex: this.regex,\n rawMatches,\n matches,\n result,\n zone,\n specificOffset,\n };\n }\n }\n\n get isValid() {\n return !this.disqualifyingUnit;\n }\n\n get invalidReason() {\n return this.disqualifyingUnit ? this.disqualifyingUnit.invalidReason : null;\n }\n}\n\nexport function explainFromTokens(locale, input, format) {\n const parser = new TokenParser(locale, format);\n return parser.explainFromTokens(input);\n}\n\nexport function parseFromTokens(locale, input, format) {\n const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format);\n return [result, zone, specificOffset, invalidReason];\n}\n\nexport function formatOptsToTokens(formatOpts, locale) {\n if (!formatOpts) {\n return null;\n }\n\n const formatter = Formatter.create(locale, formatOpts);\n const df = formatter.dtFormatter(getDummyDateTime());\n const parts = df.formatToParts();\n const resolvedOpts = df.resolvedOptions();\n return parts.map((p) => tokenForPart(p, formatOpts, resolvedOpts));\n}\n","import Duration from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Settings from \"./settings.js\";\nimport Info from \"./info.js\";\nimport Formatter from \"./impl/formatter.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport Locale from \"./impl/locale.js\";\nimport {\n isUndefined,\n maybeArray,\n isDate,\n isNumber,\n bestBy,\n daysInMonth,\n daysInYear,\n isLeapYear,\n weeksInWeekYear,\n normalizeObject,\n roundTo,\n objToLocalTS,\n padStart,\n} from \"./impl/util.js\";\nimport { normalizeZone } from \"./impl/zoneUtil.js\";\nimport diff from \"./impl/diff.js\";\nimport { parseRFC2822Date, parseISODate, parseHTTPDate, parseSQL } from \"./impl/regexParser.js\";\nimport {\n parseFromTokens,\n explainFromTokens,\n formatOptsToTokens,\n expandMacroTokens,\n TokenParser,\n} from \"./impl/tokenParser.js\";\nimport {\n gregorianToWeek,\n weekToGregorian,\n gregorianToOrdinal,\n ordinalToGregorian,\n hasInvalidGregorianData,\n hasInvalidWeekData,\n hasInvalidOrdinalData,\n hasInvalidTimeData,\n usesLocalWeekValues,\n isoWeekdayToLocal,\n} from \"./impl/conversions.js\";\nimport * as Formats from \"./impl/formats.js\";\nimport {\n InvalidArgumentError,\n ConflictingSpecificationError,\n InvalidUnitError,\n InvalidDateTimeError,\n} from \"./errors.js\";\nimport Invalid from \"./impl/invalid.js\";\n\nconst INVALID = \"Invalid DateTime\";\nconst MAX_DATE = 8.64e15;\n\nfunction unsupportedZone(zone) {\n return new Invalid(\"unsupported zone\", `the zone \"${zone.name}\" is not supported`);\n}\n\n// we cache week data on the DT object and this intermediates the cache\n/**\n * @param {DateTime} dt\n */\nfunction possiblyCachedWeekData(dt) {\n if (dt.weekData === null) {\n dt.weekData = gregorianToWeek(dt.c);\n }\n return dt.weekData;\n}\n\n/**\n * @param {DateTime} dt\n */\nfunction possiblyCachedLocalWeekData(dt) {\n if (dt.localWeekData === null) {\n dt.localWeekData = gregorianToWeek(\n dt.c,\n dt.loc.getMinDaysInFirstWeek(),\n dt.loc.getStartOfWeek()\n );\n }\n return dt.localWeekData;\n}\n\n// clone really means, \"make a new object with these modifications\". all \"setters\" really use this\n// to create a new object while only changing some of the properties\nfunction clone(inst, alts) {\n const current = {\n ts: inst.ts,\n zone: inst.zone,\n c: inst.c,\n o: inst.o,\n loc: inst.loc,\n invalid: inst.invalid,\n };\n return new DateTime({ ...current, ...alts, old: current });\n}\n\n// find the right offset a given local time. The o input is our guess, which determines which\n// offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)\nfunction fixOffset(localTS, o, tz) {\n // Our UTC time is just a guess because our offset is just a guess\n let utcGuess = localTS - o * 60 * 1000;\n\n // Test whether the zone matches the offset for this ts\n const o2 = tz.offset(utcGuess);\n\n // If so, offset didn't change and we're done\n if (o === o2) {\n return [utcGuess, o];\n }\n\n // If not, change the ts by the difference in the offset\n utcGuess -= (o2 - o) * 60 * 1000;\n\n // If that gives us the local time we want, we're done\n const o3 = tz.offset(utcGuess);\n if (o2 === o3) {\n return [utcGuess, o2];\n }\n\n // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time\n return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];\n}\n\n// convert an epoch timestamp into a calendar object with the given offset\nfunction tsToObj(ts, offset) {\n ts += offset * 60 * 1000;\n\n const d = new Date(ts);\n\n return {\n year: d.getUTCFullYear(),\n month: d.getUTCMonth() + 1,\n day: d.getUTCDate(),\n hour: d.getUTCHours(),\n minute: d.getUTCMinutes(),\n second: d.getUTCSeconds(),\n millisecond: d.getUTCMilliseconds(),\n };\n}\n\n// convert a calendar object to a epoch timestamp\nfunction objToTS(obj, offset, zone) {\n return fixOffset(objToLocalTS(obj), offset, zone);\n}\n\n// create a new DT instance by adding a duration, adjusting for DSTs\nfunction adjustTime(inst, dur) {\n const oPre = inst.o,\n year = inst.c.year + Math.trunc(dur.years),\n month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3,\n c = {\n ...inst.c,\n year,\n month,\n day:\n Math.min(inst.c.day, daysInMonth(year, month)) +\n Math.trunc(dur.days) +\n Math.trunc(dur.weeks) * 7,\n },\n millisToAdd = Duration.fromObject({\n years: dur.years - Math.trunc(dur.years),\n quarters: dur.quarters - Math.trunc(dur.quarters),\n months: dur.months - Math.trunc(dur.months),\n weeks: dur.weeks - Math.trunc(dur.weeks),\n days: dur.days - Math.trunc(dur.days),\n hours: dur.hours,\n minutes: dur.minutes,\n seconds: dur.seconds,\n milliseconds: dur.milliseconds,\n }).as(\"milliseconds\"),\n localTS = objToLocalTS(c);\n\n let [ts, o] = fixOffset(localTS, oPre, inst.zone);\n\n if (millisToAdd !== 0) {\n ts += millisToAdd;\n // that could have changed the offset by going over a DST, but we want to keep the ts the same\n o = inst.zone.offset(ts);\n }\n\n return { ts, o };\n}\n\n// helper useful in turning the results of parsing into real dates\n// by handling the zone options\nfunction parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {\n const { setZone, zone } = opts;\n if ((parsed && Object.keys(parsed).length !== 0) || parsedZone) {\n const interpretationZone = parsedZone || zone,\n inst = DateTime.fromObject(parsed, {\n ...opts,\n zone: interpretationZone,\n specificOffset,\n });\n return setZone ? inst : inst.setZone(zone);\n } else {\n return DateTime.invalid(\n new Invalid(\"unparsable\", `the input \"${text}\" can't be parsed as ${format}`)\n );\n }\n}\n\n// if you want to output a technical format (e.g. RFC 2822), this helper\n// helps handle the details\nfunction toTechFormat(dt, format, allowZ = true) {\n return dt.isValid\n ? Formatter.create(Locale.create(\"en-US\"), {\n allowZ,\n forceSimple: true,\n }).formatDateTimeFromString(dt, format)\n : null;\n}\n\nfunction toISODate(o, extended, precision) {\n const longFormat = o.c.year > 9999 || o.c.year < 0;\n let c = \"\";\n if (longFormat && o.c.year >= 0) c += \"+\";\n c += padStart(o.c.year, longFormat ? 6 : 4);\n if (precision === \"year\") return c;\n if (extended) {\n c += \"-\";\n c += padStart(o.c.month);\n if (precision === \"month\") return c;\n c += \"-\";\n } else {\n c += padStart(o.c.month);\n if (precision === \"month\") return c;\n }\n c += padStart(o.c.day);\n return c;\n}\n\nfunction toISOTime(\n o,\n extended,\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n) {\n let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0,\n c = \"\";\n switch (precision) {\n case \"day\":\n case \"month\":\n case \"year\":\n break;\n default:\n c += padStart(o.c.hour);\n if (precision === \"hour\") break;\n if (extended) {\n c += \":\";\n c += padStart(o.c.minute);\n if (precision === \"minute\") break;\n if (showSeconds) {\n c += \":\";\n c += padStart(o.c.second);\n }\n } else {\n c += padStart(o.c.minute);\n if (precision === \"minute\") break;\n if (showSeconds) {\n c += padStart(o.c.second);\n }\n }\n if (precision === \"second\") break;\n if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) {\n c += \".\";\n c += padStart(o.c.millisecond, 3);\n }\n }\n\n if (includeOffset) {\n if (o.isOffsetFixed && o.offset === 0 && !extendedZone) {\n c += \"Z\";\n } else if (o.o < 0) {\n c += \"-\";\n c += padStart(Math.trunc(-o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(-o.o % 60));\n } else {\n c += \"+\";\n c += padStart(Math.trunc(o.o / 60));\n c += \":\";\n c += padStart(Math.trunc(o.o % 60));\n }\n }\n\n if (extendedZone) {\n c += \"[\" + o.zone.ianaName + \"]\";\n }\n return c;\n}\n\n// defaults for unspecified units in the supported calendars\nconst defaultUnitValues = {\n month: 1,\n day: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultWeekUnitValues = {\n weekNumber: 1,\n weekday: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n },\n defaultOrdinalUnitValues = {\n ordinal: 1,\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n };\n\n// Units in the supported calendars, sorted by bigness\nconst orderedUnits = [\"year\", \"month\", \"day\", \"hour\", \"minute\", \"second\", \"millisecond\"],\n orderedWeekUnits = [\n \"weekYear\",\n \"weekNumber\",\n \"weekday\",\n \"hour\",\n \"minute\",\n \"second\",\n \"millisecond\",\n ],\n orderedOrdinalUnits = [\"year\", \"ordinal\", \"hour\", \"minute\", \"second\", \"millisecond\"];\n\n// standardize case and plurality in units\nfunction normalizeUnit(unit) {\n const normalized = {\n year: \"year\",\n years: \"year\",\n month: \"month\",\n months: \"month\",\n day: \"day\",\n days: \"day\",\n hour: \"hour\",\n hours: \"hour\",\n minute: \"minute\",\n minutes: \"minute\",\n quarter: \"quarter\",\n quarters: \"quarter\",\n second: \"second\",\n seconds: \"second\",\n millisecond: \"millisecond\",\n milliseconds: \"millisecond\",\n weekday: \"weekday\",\n weekdays: \"weekday\",\n weeknumber: \"weekNumber\",\n weeksnumber: \"weekNumber\",\n weeknumbers: \"weekNumber\",\n weekyear: \"weekYear\",\n weekyears: \"weekYear\",\n ordinal: \"ordinal\",\n }[unit.toLowerCase()];\n\n if (!normalized) throw new InvalidUnitError(unit);\n\n return normalized;\n}\n\nfunction normalizeUnitWithLocalWeeks(unit) {\n switch (unit.toLowerCase()) {\n case \"localweekday\":\n case \"localweekdays\":\n return \"localWeekday\";\n case \"localweeknumber\":\n case \"localweeknumbers\":\n return \"localWeekNumber\";\n case \"localweekyear\":\n case \"localweekyears\":\n return \"localWeekYear\";\n default:\n return normalizeUnit(unit);\n }\n}\n\n// cache offsets for zones based on the current timestamp when this function is\n// first called. When we are handling a datetime from components like (year,\n// month, day, hour) in a time zone, we need a guess about what the timezone\n// offset is so that we can convert into a UTC timestamp. One way is to find the\n// offset of now in the zone. The actual date may have a different offset (for\n// example, if we handle a date in June while we're in December in a zone that\n// observes DST), but we can check and adjust that.\n//\n// When handling many dates, calculating the offset for now every time is\n// expensive. It's just a guess, so we can cache the offset to use even if we\n// are right on a time change boundary (we'll just correct in the other\n// direction). Using a timestamp from first read is a slight optimization for\n// handling dates close to the current date, since those dates will usually be\n// in the same offset (we could set the timestamp statically, instead). We use a\n// single timestamp for all zones to make things a bit more predictable.\n//\n// This is safe for quickDT (used by local() and utc()) because we don't fill in\n// higher-order units from tsNow (as we do in fromObject, this requires that\n// offset is calculated from tsNow).\n/**\n * @param {Zone} zone\n * @return {number}\n */\nfunction guessOffsetForZone(zone) {\n if (zoneOffsetTs === undefined) {\n zoneOffsetTs = Settings.now();\n }\n\n // Do not cache anything but IANA zones, because it is not safe to do so.\n // Guessing an offset which is not present in the zone can cause wrong results from fixOffset\n if (zone.type !== \"iana\") {\n return zone.offset(zoneOffsetTs);\n }\n const zoneName = zone.name;\n let offsetGuess = zoneOffsetGuessCache.get(zoneName);\n if (offsetGuess === undefined) {\n offsetGuess = zone.offset(zoneOffsetTs);\n zoneOffsetGuessCache.set(zoneName, offsetGuess);\n }\n return offsetGuess;\n}\n\n// this is a dumbed down version of fromObject() that runs about 60% faster\n// but doesn't do any validation, makes a bunch of assumptions about what units\n// are present, and so on.\nfunction quickDT(obj, opts) {\n const zone = normalizeZone(opts.zone, Settings.defaultZone);\n if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n }\n\n const loc = Locale.fromObject(opts);\n\n let ts, o;\n\n // assume we have the higher-order units\n if (!isUndefined(obj.year)) {\n for (const u of orderedUnits) {\n if (isUndefined(obj[u])) {\n obj[u] = defaultUnitValues[u];\n }\n }\n\n const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n const offsetProvis = guessOffsetForZone(zone);\n [ts, o] = objToTS(obj, offsetProvis, zone);\n } else {\n ts = Settings.now();\n }\n\n return new DateTime({ ts, zone, loc, o });\n}\n\nfunction diffRelative(start, end, opts) {\n const round = isUndefined(opts.round) ? true : opts.round,\n rounding = isUndefined(opts.rounding) ? \"trunc\" : opts.rounding,\n format = (c, unit) => {\n c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? \"round\" : rounding);\n const formatter = end.loc.clone(opts).relFormatter(opts);\n return formatter.format(c, unit);\n },\n differ = (unit) => {\n if (opts.calendary) {\n if (!end.hasSame(start, unit)) {\n return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);\n } else return 0;\n } else {\n return end.diff(start, unit).get(unit);\n }\n };\n\n if (opts.unit) {\n return format(differ(opts.unit), opts.unit);\n }\n\n for (const unit of opts.units) {\n const count = differ(unit);\n if (Math.abs(count) >= 1) {\n return format(count, unit);\n }\n }\n return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);\n}\n\nfunction lastOpts(argList) {\n let opts = {},\n args;\n if (argList.length > 0 && typeof argList[argList.length - 1] === \"object\") {\n opts = argList[argList.length - 1];\n args = Array.from(argList).slice(0, argList.length - 1);\n } else {\n args = Array.from(argList);\n }\n return [opts, args];\n}\n\n/**\n * Timestamp to use for cached zone offset guesses (exposed for test)\n */\nlet zoneOffsetTs;\n/**\n * Cache for zone offset guesses (exposed for test).\n *\n * This optimizes quickDT via guessOffsetForZone to avoid repeated calls of\n * zone.offset().\n */\nconst zoneOffsetGuessCache = new Map();\n\n/**\n * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them.\n *\n * A DateTime comprises of:\n * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch.\n * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone).\n * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`.\n *\n * Here is a brief overview of the most commonly used functionality it provides:\n *\n * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}.\n * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month},\n * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors.\n * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors.\n * * **Configuration** See the {@link DateTime#locale} and {@link DateTime#numberingSystem} accessors.\n * * **Transformation**: To transform the DateTime into other DateTimes, use {@link DateTime#set}, {@link DateTime#reconfigure}, {@link DateTime#setZone}, {@link DateTime#setLocale}, {@link DateTime.plus}, {@link DateTime#minus}, {@link DateTime#endOf}, {@link DateTime#startOf}, {@link DateTime#toUTC}, and {@link DateTime#toLocal}.\n * * **Output**: To convert the DateTime to other representations, use the {@link DateTime#toRelative}, {@link DateTime#toRelativeCalendar}, {@link DateTime#toJSON}, {@link DateTime#toISO}, {@link DateTime#toHTTP}, {@link DateTime#toObject}, {@link DateTime#toRFC2822}, {@link DateTime#toString}, {@link DateTime#toLocaleString}, {@link DateTime#toFormat}, {@link DateTime#toMillis} and {@link DateTime#toJSDate}.\n *\n * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.\n */\nexport default class DateTime {\n /**\n * @access private\n */\n constructor(config) {\n const zone = config.zone || Settings.defaultZone;\n\n let invalid =\n config.invalid ||\n (Number.isNaN(config.ts) ? new Invalid(\"invalid input\") : null) ||\n (!zone.isValid ? unsupportedZone(zone) : null);\n /**\n * @access private\n */\n this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;\n\n let c = null,\n o = null;\n if (!invalid) {\n const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);\n\n if (unchanged) {\n [c, o] = [config.old.c, config.old.o];\n } else {\n // If an offset has been passed and we have not been called from\n // clone(), we can trust it and avoid the offset calculation.\n const ot = isNumber(config.o) && !config.old ? config.o : zone.offset(this.ts);\n c = tsToObj(this.ts, ot);\n invalid = Number.isNaN(c.year) ? new Invalid(\"invalid input\") : null;\n c = invalid ? null : c;\n o = invalid ? null : ot;\n }\n }\n\n /**\n * @access private\n */\n this._zone = zone;\n /**\n * @access private\n */\n this.loc = config.loc || Locale.create();\n /**\n * @access private\n */\n this.invalid = invalid;\n /**\n * @access private\n */\n this.weekData = null;\n /**\n * @access private\n */\n this.localWeekData = null;\n /**\n * @access private\n */\n this.c = c;\n /**\n * @access private\n */\n this.o = o;\n /**\n * @access private\n */\n this.isLuxonDateTime = true;\n }\n\n // CONSTRUCT\n\n /**\n * Create a DateTime for the current instant, in the system's time zone.\n *\n * Use Settings to override these default values if needed.\n * @example DateTime.now().toISO() //~> now in the ISO format\n * @return {DateTime}\n */\n static now() {\n return new DateTime({});\n }\n\n /**\n * Create a local DateTime\n * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month, 1-indexed\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @example DateTime.local() //~> now\n * @example DateTime.local({ zone: \"America/New_York\" }) //~> now, in US east coast time\n * @example DateTime.local(2017) //~> 2017-01-01T00:00:00\n * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00\n * @example DateTime.local(2017, 3, 12, { locale: \"fr\" }) //~> 2017-03-12T00:00:00, with a French locale\n * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00\n * @example DateTime.local(2017, 3, 12, 5, { zone: \"utc\" }) //~> 2017-03-12T05:00:00, in UTC\n * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00\n * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10\n * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765\n * @return {DateTime}\n */\n static local() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime in UTC\n * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used\n * @param {number} [month=1] - The month, 1-indexed\n * @param {number} [day=1] - The day of the month\n * @param {number} [hour=0] - The hour of the day, in 24-hour time\n * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59\n * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59\n * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999\n * @param {Object} options - configuration options for the DateTime\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @param {string} [options.weekSettings] - the week settings to set on the resulting DateTime instance\n * @example DateTime.utc() //~> now\n * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z\n * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z\n * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: \"fr\" }) //~> 2017-03-12T05:45:00Z with a French locale\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z\n * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: \"fr\" }) //~> 2017-03-12T05:45:10.765Z with a French locale\n * @return {DateTime}\n */\n static utc() {\n const [opts, args] = lastOpts(arguments),\n [year, month, day, hour, minute, second, millisecond] = args;\n\n opts.zone = FixedOffsetZone.utcInstance;\n return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);\n }\n\n /**\n * Create a DateTime from a JavaScript Date object. Uses the default zone.\n * @param {Date} date - a JavaScript Date object\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @return {DateTime}\n */\n static fromJSDate(date, options = {}) {\n const ts = isDate(date) ? date.valueOf() : NaN;\n if (Number.isNaN(ts)) {\n return DateTime.invalid(\"invalid input\");\n }\n\n const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n return new DateTime({\n ts: ts,\n zone: zoneToUse,\n loc: Locale.fromObject(options),\n });\n }\n\n /**\n * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} milliseconds - a number of milliseconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromMillis(milliseconds, options = {}) {\n if (!isNumber(milliseconds)) {\n throw new InvalidArgumentError(\n `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`\n );\n } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {\n // this isn't perfect because we can still end up out of range because of additional shifting, but it's a start\n return DateTime.invalid(\"Timestamp out of range\");\n } else {\n return new DateTime({\n ts: milliseconds,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone.\n * @param {number} seconds - a number of seconds since 1970 UTC\n * @param {Object} options - configuration options for the DateTime\n * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into\n * @param {string} [options.locale] - a locale to set on the resulting DateTime instance\n * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} options.weekSettings - the week settings to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromSeconds(seconds, options = {}) {\n if (!isNumber(seconds)) {\n throw new InvalidArgumentError(\"fromSeconds requires a numerical input\");\n } else {\n return new DateTime({\n ts: seconds * 1000,\n zone: normalizeZone(options.zone, Settings.defaultZone),\n loc: Locale.fromObject(options),\n });\n }\n }\n\n /**\n * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults.\n * @param {Object} obj - the object to create the DateTime from\n * @param {number} obj.year - a year, such as 1987\n * @param {number} obj.month - a month, 1-12\n * @param {number} obj.day - a day of the month, 1-31, depending on the month\n * @param {number} obj.ordinal - day of the year, 1-365 or 366\n * @param {number} obj.weekYear - an ISO week year\n * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year\n * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday\n * @param {number} obj.localWeekYear - a week year, according to the locale\n * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale\n * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale\n * @param {number} obj.hour - hour of the day, 0-23\n * @param {number} obj.minute - minute of the hour, 0-59\n * @param {number} obj.second - second of the minute, 0-59\n * @param {number} obj.millisecond - millisecond of the second, 0-999\n * @param {Object} opts - options for creating this DateTime\n * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()\n * @param {string} [opts.locale='system\\'s locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'\n * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01'\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }),\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })\n * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })\n * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'\n * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: \"en-US\" }).toISODate() //=> '2021-12-26'\n * @return {DateTime}\n */\n static fromObject(obj, opts = {}) {\n obj = obj || {};\n const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);\n if (!zoneToUse.isValid) {\n return DateTime.invalid(unsupportedZone(zoneToUse));\n }\n\n const loc = Locale.fromObject(opts);\n const normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);\n const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, loc);\n\n const tsNow = Settings.now(),\n offsetProvis = !isUndefined(opts.specificOffset)\n ? opts.specificOffset\n : zoneToUse.offset(tsNow),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber;\n\n // cases:\n // just a weekday -> this week's instance of that weekday, no worries\n // (gregorian data or ordinal) + (weekYear or weekNumber) -> error\n // (gregorian month or day) + ordinal -> error\n // otherwise just use weeks or ordinals or gregorian, depending on what's specified\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n const useWeekData = definiteWeekDef || (normalized.weekday && !containsGregor);\n\n // configure ourselves to deal with gregorian dates or week stuff\n let units,\n defaultValues,\n objNow = tsToObj(tsNow, offsetProvis);\n if (useWeekData) {\n units = orderedWeekUnits;\n defaultValues = defaultWeekUnitValues;\n objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);\n } else if (containsOrdinal) {\n units = orderedOrdinalUnits;\n defaultValues = defaultOrdinalUnitValues;\n objNow = gregorianToOrdinal(objNow);\n } else {\n units = orderedUnits;\n defaultValues = defaultUnitValues;\n }\n\n // set default values for missing stuff\n let foundFirst = false;\n for (const u of units) {\n const v = normalized[u];\n if (!isUndefined(v)) {\n foundFirst = true;\n } else if (foundFirst) {\n normalized[u] = defaultValues[u];\n } else {\n normalized[u] = objNow[u];\n }\n }\n\n // make sure the values we have are in range\n const higherOrderInvalid = useWeekData\n ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek)\n : containsOrdinal\n ? hasInvalidOrdinalData(normalized)\n : hasInvalidGregorianData(normalized),\n invalid = higherOrderInvalid || hasInvalidTimeData(normalized);\n\n if (invalid) {\n return DateTime.invalid(invalid);\n }\n\n // compute the actual time\n const gregorian = useWeekData\n ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek)\n : containsOrdinal\n ? ordinalToGregorian(normalized)\n : normalized,\n [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse),\n inst = new DateTime({\n ts: tsFinal,\n zone: zoneToUse,\n o: offsetFinal,\n loc,\n });\n\n // gregorian data + weekday serves only to validate\n if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {\n return DateTime.invalid(\n \"mismatched weekday\",\n `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`\n );\n }\n\n if (!inst.isValid) {\n return DateTime.invalid(inst.invalid);\n }\n\n return inst;\n }\n\n /**\n * Create a DateTime from an ISO 8601 string\n * @param {string} text - the ISO string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance\n * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance\n * @param {string} [opts.weekSettings] - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromISO('2016-05-25T09:08:34.123')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')\n * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})\n * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})\n * @example DateTime.fromISO('2016-W05-4')\n * @return {DateTime}\n */\n static fromISO(text, opts = {}) {\n const [vals, parsedZone] = parseISODate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"ISO 8601\", text);\n }\n\n /**\n * Create a DateTime from an RFC 2822 string\n * @param {string} text - the RFC 2822 string\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')\n * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600')\n * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')\n * @return {DateTime}\n */\n static fromRFC2822(text, opts = {}) {\n const [vals, parsedZone] = parseRFC2822Date(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"RFC 2822\", text);\n }\n\n /**\n * Create a DateTime from an HTTP header date\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @param {string} text - the HTTP header date\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.\n * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.\n * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')\n * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994')\n * @return {DateTime}\n */\n static fromHTTP(text, opts = {}) {\n const [vals, parsedZone] = parseHTTPDate(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"HTTP\", opts);\n }\n\n /**\n * Create a DateTime from an input string and format string.\n * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens).\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see the link below for the formats)\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @return {DateTime}\n */\n static fromFormat(text, fmt, opts = {}) {\n if (isUndefined(text) || isUndefined(fmt)) {\n throw new InvalidArgumentError(\"fromFormat requires an input string and a format\");\n }\n\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n }),\n [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);\n if (invalid) {\n return DateTime.invalid(invalid);\n } else {\n return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);\n }\n }\n\n /**\n * @deprecated use fromFormat instead\n */\n static fromString(text, fmt, opts = {}) {\n return DateTime.fromFormat(text, fmt, opts);\n }\n\n /**\n * Create a DateTime from a SQL date, time, or datetime\n * Defaults to en-US if no locale has been specified, regardless of the system's locale\n * @param {string} text - the string to parse\n * @param {Object} opts - options to affect the creation\n * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone\n * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one\n * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale\n * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system\n * @param {string} opts.weekSettings - the week settings to set on the resulting DateTime instance\n * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance\n * @example DateTime.fromSQL('2017-05-15')\n * @example DateTime.fromSQL('2017-05-15 09:12:34')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })\n * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })\n * @example DateTime.fromSQL('09:12:34.342')\n * @return {DateTime}\n */\n static fromSQL(text, opts = {}) {\n const [vals, parsedZone] = parseSQL(text);\n return parseDataToDateTime(vals, parsedZone, opts, \"SQL\", text);\n }\n\n /**\n * Create an invalid DateTime.\n * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent.\n * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information\n * @return {DateTime}\n */\n static invalid(reason, explanation = null) {\n if (!reason) {\n throw new InvalidArgumentError(\"need to specify a reason the DateTime is invalid\");\n }\n\n const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);\n\n if (Settings.throwOnInvalid) {\n throw new InvalidDateTimeError(invalid);\n } else {\n return new DateTime({ invalid });\n }\n }\n\n /**\n * Check if an object is an instance of DateTime. Works across context boundaries\n * @param {object} o\n * @return {boolean}\n */\n static isDateTime(o) {\n return (o && o.isLuxonDateTime) || false;\n }\n\n /**\n * Produce the format string for a set of options\n * @param formatOpts\n * @param localeOpts\n * @returns {string}\n */\n static parseFormatForOpts(formatOpts, localeOpts = {}) {\n const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));\n return !tokenList ? null : tokenList.map((t) => (t ? t.val : null)).join(\"\");\n }\n\n /**\n * Produce the the fully expanded format token for the locale\n * Does NOT quote characters, so quoted tokens will not round trip correctly\n * @param fmt\n * @param localeOpts\n * @returns {string}\n */\n static expandFormat(fmt, localeOpts = {}) {\n const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));\n return expanded.map((t) => t.val).join(\"\");\n }\n\n static resetCache() {\n zoneOffsetTs = undefined;\n zoneOffsetGuessCache.clear();\n }\n\n // INFO\n\n /**\n * Get the value of unit.\n * @param {string} unit - a unit such as 'minute' or 'day'\n * @example DateTime.local(2017, 7, 4).get('month'); //=> 7\n * @example DateTime.local(2017, 7, 4).get('day'); //=> 4\n * @return {number}\n */\n get(unit) {\n return this[unit];\n }\n\n /**\n * Returns whether the DateTime is valid. Invalid DateTimes occur when:\n * * The DateTime was created from invalid calendar information, such as the 13th month or February 30\n * * The DateTime was created by an operation on another invalid date\n * @type {boolean}\n */\n get isValid() {\n return this.invalid === null;\n }\n\n /**\n * Returns an error code if this DateTime is invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidReason() {\n return this.invalid ? this.invalid.reason : null;\n }\n\n /**\n * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid\n * @type {string}\n */\n get invalidExplanation() {\n return this.invalid ? this.invalid.explanation : null;\n }\n\n /**\n * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime\n *\n * @type {string}\n */\n get locale() {\n return this.isValid ? this.loc.locale : null;\n }\n\n /**\n * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime\n *\n * @type {string}\n */\n get numberingSystem() {\n return this.isValid ? this.loc.numberingSystem : null;\n }\n\n /**\n * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime\n *\n * @type {string}\n */\n get outputCalendar() {\n return this.isValid ? this.loc.outputCalendar : null;\n }\n\n /**\n * Get the time zone associated with this DateTime.\n * @type {Zone}\n */\n get zone() {\n return this._zone;\n }\n\n /**\n * Get the name of the time zone.\n * @type {string}\n */\n get zoneName() {\n return this.isValid ? this.zone.name : null;\n }\n\n /**\n * Get the year\n * @example DateTime.local(2017, 5, 25).year //=> 2017\n * @type {number}\n */\n get year() {\n return this.isValid ? this.c.year : NaN;\n }\n\n /**\n * Get the quarter\n * @example DateTime.local(2017, 5, 25).quarter //=> 2\n * @type {number}\n */\n get quarter() {\n return this.isValid ? Math.ceil(this.c.month / 3) : NaN;\n }\n\n /**\n * Get the month (1-12).\n * @example DateTime.local(2017, 5, 25).month //=> 5\n * @type {number}\n */\n get month() {\n return this.isValid ? this.c.month : NaN;\n }\n\n /**\n * Get the day of the month (1-30ish).\n * @example DateTime.local(2017, 5, 25).day //=> 25\n * @type {number}\n */\n get day() {\n return this.isValid ? this.c.day : NaN;\n }\n\n /**\n * Get the hour of the day (0-23).\n * @example DateTime.local(2017, 5, 25, 9).hour //=> 9\n * @type {number}\n */\n get hour() {\n return this.isValid ? this.c.hour : NaN;\n }\n\n /**\n * Get the minute of the hour (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30\n * @type {number}\n */\n get minute() {\n return this.isValid ? this.c.minute : NaN;\n }\n\n /**\n * Get the second of the minute (0-59).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52\n * @type {number}\n */\n get second() {\n return this.isValid ? this.c.second : NaN;\n }\n\n /**\n * Get the millisecond of the second (0-999).\n * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654\n * @type {number}\n */\n get millisecond() {\n return this.isValid ? this.c.millisecond : NaN;\n }\n\n /**\n * Get the week year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 12, 31).weekYear //=> 2015\n * @type {number}\n */\n get weekYear() {\n return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the week number of the week year (1-52ish).\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2017, 5, 25).weekNumber //=> 21\n * @type {number}\n */\n get weekNumber() {\n return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the day of the week.\n * 1 is Monday and 7 is Sunday\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2014, 11, 31).weekday //=> 4\n * @type {number}\n */\n get weekday() {\n return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;\n }\n\n /**\n * Returns true if this date is on a weekend according to the locale, false otherwise\n * @returns {boolean}\n */\n get isWeekend() {\n return this.isValid && this.loc.getWeekendDays().includes(this.weekday);\n }\n\n /**\n * Get the day of the week according to the locale.\n * 1 is the first day of the week and 7 is the last day of the week.\n * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,\n * @returns {number}\n */\n get localWeekday() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;\n }\n\n /**\n * Get the week number of the week year according to the locale. Different locales assign week numbers differently,\n * because the week can start on different days of the week (see localWeekday) and because a different number of days\n * is required for a week to count as the first week of a year.\n * @returns {number}\n */\n get localWeekNumber() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;\n }\n\n /**\n * Get the week year according to the locale. Different locales assign week numbers (and therefor week years)\n * differently, see localWeekNumber.\n * @returns {number}\n */\n get localWeekYear() {\n return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;\n }\n\n /**\n * Get the ordinal (meaning the day of the year)\n * @example DateTime.local(2017, 5, 25).ordinal //=> 145\n * @type {number|DateTime}\n */\n get ordinal() {\n return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;\n }\n\n /**\n * Get the human readable short month name, such as 'Oct'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthShort //=> Oct\n * @type {string}\n */\n get monthShort() {\n return this.isValid ? Info.months(\"short\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable long month name, such as 'October'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).monthLong //=> October\n * @type {string}\n */\n get monthLong() {\n return this.isValid ? Info.months(\"long\", { locObj: this.loc })[this.month - 1] : null;\n }\n\n /**\n * Get the human readable short weekday, such as 'Mon'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon\n * @type {string}\n */\n get weekdayShort() {\n return this.isValid ? Info.weekdays(\"short\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the human readable long weekday, such as 'Monday'.\n * Defaults to the system's locale if no locale has been specified\n * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday\n * @type {string}\n */\n get weekdayLong() {\n return this.isValid ? Info.weekdays(\"long\", { locObj: this.loc })[this.weekday - 1] : null;\n }\n\n /**\n * Get the UTC offset of this DateTime in minutes\n * @example DateTime.now().offset //=> -240\n * @example DateTime.utc().offset //=> 0\n * @type {number}\n */\n get offset() {\n return this.isValid ? +this.o : NaN;\n }\n\n /**\n * Get the short human name for the zone's current offset, for example \"EST\" or \"EDT\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameShort() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"short\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get the long human name for the zone's current offset, for example \"Eastern Standard Time\" or \"Eastern Daylight Time\".\n * Defaults to the system's locale if no locale has been specified\n * @type {string}\n */\n get offsetNameLong() {\n if (this.isValid) {\n return this.zone.offsetName(this.ts, {\n format: \"long\",\n locale: this.locale,\n });\n } else {\n return null;\n }\n }\n\n /**\n * Get whether this zone's offset ever changes, as in a DST.\n * @type {boolean}\n */\n get isOffsetFixed() {\n return this.isValid ? this.zone.isUniversal : null;\n }\n\n /**\n * Get whether the DateTime is in a DST.\n * @type {boolean}\n */\n get isInDST() {\n if (this.isOffsetFixed) {\n return false;\n } else {\n return (\n this.offset > this.set({ month: 1, day: 1 }).offset ||\n this.offset > this.set({ month: 5 }).offset\n );\n }\n }\n\n /**\n * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC\n * in this DateTime's zone. During DST changes local time can be ambiguous, for example\n * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`.\n * This method will return both possible DateTimes if this DateTime's local time is ambiguous.\n * @returns {DateTime[]}\n */\n getPossibleOffsets() {\n if (!this.isValid || this.isOffsetFixed) {\n return [this];\n }\n const dayMs = 86400000;\n const minuteMs = 60000;\n const localTS = objToLocalTS(this.c);\n const oEarlier = this.zone.offset(localTS - dayMs);\n const oLater = this.zone.offset(localTS + dayMs);\n\n const o1 = this.zone.offset(localTS - oEarlier * minuteMs);\n const o2 = this.zone.offset(localTS - oLater * minuteMs);\n if (o1 === o2) {\n return [this];\n }\n const ts1 = localTS - o1 * minuteMs;\n const ts2 = localTS - o2 * minuteMs;\n const c1 = tsToObj(ts1, o1);\n const c2 = tsToObj(ts2, o2);\n if (\n c1.hour === c2.hour &&\n c1.minute === c2.minute &&\n c1.second === c2.second &&\n c1.millisecond === c2.millisecond\n ) {\n return [clone(this, { ts: ts1 }), clone(this, { ts: ts2 })];\n }\n return [this];\n }\n\n /**\n * Returns true if this DateTime is in a leap year, false otherwise\n * @example DateTime.local(2016).isInLeapYear //=> true\n * @example DateTime.local(2013).isInLeapYear //=> false\n * @type {boolean}\n */\n get isInLeapYear() {\n return isLeapYear(this.year);\n }\n\n /**\n * Returns the number of days in this DateTime's month\n * @example DateTime.local(2016, 2).daysInMonth //=> 29\n * @example DateTime.local(2016, 3).daysInMonth //=> 31\n * @type {number}\n */\n get daysInMonth() {\n return daysInMonth(this.year, this.month);\n }\n\n /**\n * Returns the number of days in this DateTime's year\n * @example DateTime.local(2016).daysInYear //=> 366\n * @example DateTime.local(2013).daysInYear //=> 365\n * @type {number}\n */\n get daysInYear() {\n return this.isValid ? daysInYear(this.year) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's year\n * @see https://en.wikipedia.org/wiki/ISO_week_date\n * @example DateTime.local(2004).weeksInWeekYear //=> 53\n * @example DateTime.local(2013).weeksInWeekYear //=> 52\n * @type {number}\n */\n get weeksInWeekYear() {\n return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;\n }\n\n /**\n * Returns the number of weeks in this DateTime's local week year\n * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52\n * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53\n * @type {number}\n */\n get weeksInLocalWeekYear() {\n return this.isValid\n ? weeksInWeekYear(\n this.localWeekYear,\n this.loc.getMinDaysInFirstWeek(),\n this.loc.getStartOfWeek()\n )\n : NaN;\n }\n\n /**\n * Returns the resolved Intl options for this DateTime.\n * This is useful in understanding the behavior of formatting methods\n * @param {Object} opts - the same options as toLocaleString\n * @return {Object}\n */\n resolvedLocaleOptions(opts = {}) {\n const { locale, numberingSystem, calendar } = Formatter.create(\n this.loc.clone(opts),\n opts\n ).resolvedOptions(this);\n return { locale, numberingSystem, outputCalendar: calendar };\n }\n\n // TRANSFORM\n\n /**\n * \"Set\" the DateTime's zone to UTC. Returns a newly-constructed DateTime.\n *\n * Equivalent to {@link DateTime#setZone}('utc')\n * @param {number} [offset=0] - optionally, an offset from UTC in minutes\n * @param {Object} [opts={}] - options to pass to `setZone()`\n * @return {DateTime}\n */\n toUTC(offset = 0, opts = {}) {\n return this.setZone(FixedOffsetZone.instance(offset), opts);\n }\n\n /**\n * \"Set\" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.\n *\n * Equivalent to `setZone('local')`\n * @return {DateTime}\n */\n toLocal() {\n return this.setZone(Settings.defaultZone);\n }\n\n /**\n * \"Set\" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.\n *\n * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC} which provide simple convenience wrappers for commonly used zones.\n * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class.\n * @param {Object} opts - options\n * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.\n * @return {DateTime}\n */\n setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {\n zone = normalizeZone(zone, Settings.defaultZone);\n if (zone.equals(this.zone)) {\n return this;\n } else if (!zone.isValid) {\n return DateTime.invalid(unsupportedZone(zone));\n } else {\n let newTS = this.ts;\n if (keepLocalTime || keepCalendarTime) {\n const offsetGuess = zone.offset(this.ts);\n const asObj = this.toObject();\n [newTS] = objToTS(asObj, offsetGuess, zone);\n }\n return clone(this, { ts: newTS, zone });\n }\n }\n\n /**\n * \"Set\" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.\n * @param {Object} properties - the properties to set\n * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })\n * @return {DateTime}\n */\n reconfigure({ locale, numberingSystem, outputCalendar } = {}) {\n const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });\n return clone(this, { loc });\n }\n\n /**\n * \"Set\" the locale. Returns a newly-constructed DateTime.\n * Just a convenient alias for reconfigure({ locale })\n * @example DateTime.local(2017, 5, 25).setLocale('en-GB')\n * @return {DateTime}\n */\n setLocale(locale) {\n return this.reconfigure({ locale });\n }\n\n /**\n * \"Set\" the values of specified units. Returns a newly-constructed DateTime.\n * You can only set units with this method; for \"setting\" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.\n *\n * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.\n * They cannot be mixed with ISO-week units like `weekday`.\n * @param {Object} values - a mapping of units to numbers\n * @example dt.set({ year: 2017 })\n * @example dt.set({ hour: 8, minute: 30 })\n * @example dt.set({ weekday: 5 })\n * @example dt.set({ year: 2005, ordinal: 234 })\n * @return {DateTime}\n */\n set(values) {\n if (!this.isValid) return this;\n\n const normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);\n const { minDaysInFirstWeek, startOfWeek } = usesLocalWeekValues(normalized, this.loc);\n\n const settingWeekStuff =\n !isUndefined(normalized.weekYear) ||\n !isUndefined(normalized.weekNumber) ||\n !isUndefined(normalized.weekday),\n containsOrdinal = !isUndefined(normalized.ordinal),\n containsGregorYear = !isUndefined(normalized.year),\n containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),\n containsGregor = containsGregorYear || containsGregorMD,\n definiteWeekDef = normalized.weekYear || normalized.weekNumber;\n\n if ((containsGregor || containsOrdinal) && definiteWeekDef) {\n throw new ConflictingSpecificationError(\n \"Can't mix weekYear/weekNumber units with year/month/day or ordinals\"\n );\n }\n\n if (containsGregorMD && containsOrdinal) {\n throw new ConflictingSpecificationError(\"Can't mix ordinal dates with month/day\");\n }\n\n let mixed;\n if (settingWeekStuff) {\n mixed = weekToGregorian(\n { ...gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), ...normalized },\n minDaysInFirstWeek,\n startOfWeek\n );\n } else if (!isUndefined(normalized.ordinal)) {\n mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized });\n } else {\n mixed = { ...this.toObject(), ...normalized };\n\n // if we didn't set the day but we ended up on an overflow date,\n // use the last day of the right month\n if (isUndefined(normalized.day)) {\n mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);\n }\n }\n\n const [ts, o] = objToTS(mixed, this.o, this.zone);\n return clone(this, { ts, o });\n }\n\n /**\n * Add a period of time to this DateTime and return the resulting DateTime\n *\n * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.\n * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n * @example DateTime.now().plus(123) //~> in 123 milliseconds\n * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes\n * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow\n * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday\n * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min\n * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min\n * @return {DateTime}\n */\n plus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration);\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * Subtract a period of time to this DateTime and return the resulting DateTime\n * See {@link DateTime#plus}\n * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()\n @return {DateTime}\n */\n minus(duration) {\n if (!this.isValid) return this;\n const dur = Duration.fromDurationLike(duration).negate();\n return clone(this, adjustTime(this, dur));\n }\n\n /**\n * \"Set\" this DateTime to the beginning of a unit of time.\n * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week\n * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'\n * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'\n * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'\n * @return {DateTime}\n */\n startOf(unit, { useLocaleWeeks = false } = {}) {\n if (!this.isValid) return this;\n\n const o = {},\n normalizedUnit = Duration.normalizeUnit(unit);\n switch (normalizedUnit) {\n case \"years\":\n o.month = 1;\n // falls through\n case \"quarters\":\n case \"months\":\n o.day = 1;\n // falls through\n case \"weeks\":\n case \"days\":\n o.hour = 0;\n // falls through\n case \"hours\":\n o.minute = 0;\n // falls through\n case \"minutes\":\n o.second = 0;\n // falls through\n case \"seconds\":\n o.millisecond = 0;\n break;\n case \"milliseconds\":\n break;\n // no default, invalid units throw in normalizeUnit()\n }\n\n if (normalizedUnit === \"weeks\") {\n if (useLocaleWeeks) {\n const startOfWeek = this.loc.getStartOfWeek();\n const { weekday } = this;\n if (weekday < startOfWeek) {\n o.weekNumber = this.weekNumber - 1;\n }\n o.weekday = startOfWeek;\n } else {\n o.weekday = 1;\n }\n }\n\n if (normalizedUnit === \"quarters\") {\n const q = Math.ceil(this.month / 3);\n o.month = (q - 1) * 3 + 1;\n }\n\n return this.set(o);\n }\n\n /**\n * \"Set\" this DateTime to the end (meaning the last millisecond) of a unit of time\n * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week\n * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'\n * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'\n * @return {DateTime}\n */\n endOf(unit, opts) {\n return this.isValid\n ? this.plus({ [unit]: 1 })\n .startOf(unit, opts)\n .minus(1)\n : this;\n }\n\n // OUTPUT\n\n /**\n * Returns a string representation of this DateTime formatted according to the specified format string.\n * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens).\n * Defaults to en-US if no locale has been specified, regardless of the system's locale.\n * @param {string} fmt - the format string\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22'\n * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'\n * @example DateTime.now().toFormat('yyyy LLL dd', { locale: \"fr\" }) //=> '2017 avr. 22'\n * @example DateTime.now().toFormat(\"HH 'hours and' mm 'minutes'\") //=> '20 hours and 55 minutes'\n * @return {string}\n */\n toFormat(fmt, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt)\n : INVALID;\n }\n\n /**\n * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.\n * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation\n * of the DateTime in the assigned locale.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat\n * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options\n * @param {Object} opts - opts to override the configuration options on this DateTime\n * @example DateTime.now().toLocaleString(); //=> 4/20/2017\n * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'\n * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'\n * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022'\n * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'\n * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'\n * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'\n * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM'\n * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32'\n * @return {string}\n */\n toLocaleString(formatOpts = Formats.DATE_SHORT, opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this)\n : INVALID;\n }\n\n /**\n * Returns an array of format \"parts\", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.\n * Defaults to the system's locale if no locale has been specified\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts\n * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.\n * @example DateTime.now().toLocaleParts(); //=> [\n * //=> { type: 'day', value: '25' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'month', value: '05' },\n * //=> { type: 'literal', value: '/' },\n * //=> { type: 'year', value: '1982' }\n * //=> ]\n */\n toLocaleParts(opts = {}) {\n return this.isValid\n ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this)\n : [];\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.extendedZone=false] - add the time zone format extension\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.\n * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'\n * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'\n * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'\n * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'\n * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z'\n * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z'\n * @return {string|null}\n */\n toISO({\n format = \"extended\",\n suppressSeconds = false,\n suppressMilliseconds = false,\n includeOffset = true,\n extendedZone = false,\n precision = \"milliseconds\",\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n precision = normalizeUnit(precision);\n const ext = format === \"extended\";\n\n let c = toISODate(this, ext, precision);\n if (orderedUnits.indexOf(precision) >= 3) c += \"T\";\n c += toISOTime(\n this,\n ext,\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n );\n return c;\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's date component\n * @param {Object} opts - options\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'.\n * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'\n * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'\n * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05'\n * @return {string|null}\n */\n toISODate({ format = \"extended\", precision = \"day\" } = {}) {\n if (!this.isValid) {\n return null;\n }\n return toISODate(this, format === \"extended\", normalizeUnit(precision));\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's week date\n * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'\n * @return {string}\n */\n toISOWeekDate() {\n return toTechFormat(this, \"kkkk-'W'WW-c\");\n }\n\n /**\n * Returns an ISO 8601-compliant string representation of this DateTime's time component\n * @param {Object} opts - options\n * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0\n * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.extendedZone=true] - add the time zone format extension\n * @param {boolean} [opts.includePrefix=false] - include the `T` prefix\n * @param {string} [opts.format='extended'] - choose between the basic and extended format\n * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'\n * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z'\n * @return {string}\n */\n toISOTime({\n suppressMilliseconds = false,\n suppressSeconds = false,\n includeOffset = true,\n includePrefix = false,\n extendedZone = false,\n format = \"extended\",\n precision = \"milliseconds\",\n } = {}) {\n if (!this.isValid) {\n return null;\n }\n\n precision = normalizeUnit(precision);\n let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? \"T\" : \"\";\n return (\n c +\n toISOTime(\n this,\n format === \"extended\",\n suppressSeconds,\n suppressMilliseconds,\n includeOffset,\n extendedZone,\n precision\n )\n );\n }\n\n /**\n * Returns an RFC 2822-compatible string representation of this DateTime\n * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'\n * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'\n * @return {string}\n */\n toRFC2822() {\n return toTechFormat(this, \"EEE, dd LLL yyyy HH:mm:ss ZZZ\", false);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.\n * Specifically, the string conforms to RFC 1123.\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1\n * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'\n * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'\n * @return {string}\n */\n toHTTP() {\n return toTechFormat(this.toUTC(), \"EEE, dd LLL yyyy HH:mm:ss 'GMT'\");\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Date\n * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'\n * @return {string|null}\n */\n toSQLDate() {\n if (!this.isValid) {\n return null;\n }\n return toISODate(this, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL Time\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'\n * @example DateTime.utc().toSQL() //=> '05:15:16.345'\n * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00'\n * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345'\n * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'\n * @return {string}\n */\n toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) {\n let fmt = \"HH:mm:ss.SSS\";\n\n if (includeZone || includeOffset) {\n if (includeOffsetSpace) {\n fmt += \" \";\n }\n if (includeZone) {\n fmt += \"z\";\n } else if (includeOffset) {\n fmt += \"ZZ\";\n }\n }\n\n return toTechFormat(this, fmt, true);\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for use in SQL DateTime\n * @param {Object} opts - options\n * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.\n * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'\n * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00'\n * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'\n * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'\n * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York'\n * @return {string}\n */\n toSQL(opts = {}) {\n if (!this.isValid) {\n return null;\n }\n\n return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for debugging\n * @return {string}\n */\n toString() {\n return this.isValid ? this.toISO() : INVALID;\n }\n\n /**\n * Returns a string representation of this DateTime appropriate for the REPL.\n * @return {string}\n */\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n if (this.isValid) {\n return `DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`;\n } else {\n return `DateTime { Invalid, reason: ${this.invalidReason} }`;\n }\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}\n * @return {number}\n */\n valueOf() {\n return this.toMillis();\n }\n\n /**\n * Returns the epoch milliseconds of this DateTime.\n * @return {number}\n */\n toMillis() {\n return this.isValid ? this.ts : NaN;\n }\n\n /**\n * Returns the epoch seconds (including milliseconds in the fractional part) of this DateTime.\n * @return {number}\n */\n toSeconds() {\n return this.isValid ? this.ts / 1000 : NaN;\n }\n\n /**\n * Returns the epoch seconds (as a whole number) of this DateTime.\n * @return {number}\n */\n toUnixInteger() {\n return this.isValid ? Math.floor(this.ts / 1000) : NaN;\n }\n\n /**\n * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.\n * @return {string}\n */\n toJSON() {\n return this.toISO();\n }\n\n /**\n * Returns a BSON serializable equivalent to this DateTime.\n * @return {Date}\n */\n toBSON() {\n return this.toJSDate();\n }\n\n /**\n * Returns a JavaScript object with this DateTime's year, month, day, and so on.\n * @param opts - options for generating the object\n * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output\n * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }\n * @return {Object}\n */\n toObject(opts = {}) {\n if (!this.isValid) return {};\n\n const base = { ...this.c };\n\n if (opts.includeConfig) {\n base.outputCalendar = this.outputCalendar;\n base.numberingSystem = this.loc.numberingSystem;\n base.locale = this.loc.locale;\n }\n return base;\n }\n\n /**\n * Returns a JavaScript Date equivalent to this DateTime.\n * @return {Date}\n */\n toJSDate() {\n return new Date(this.isValid ? this.ts : NaN);\n }\n\n // COMPARE\n\n /**\n * Return the difference between two DateTimes as a Duration.\n * @param {DateTime} otherDateTime - the DateTime to compare this one to\n * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @example\n * var i1 = DateTime.fromISO('1982-05-25T09:45'),\n * i2 = DateTime.fromISO('1983-10-14T10:30');\n * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }\n * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }\n * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }\n * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }\n * @return {Duration}\n */\n diff(otherDateTime, unit = \"milliseconds\", opts = {}) {\n if (!this.isValid || !otherDateTime.isValid) {\n return Duration.invalid(\"created by diffing an invalid DateTime\");\n }\n\n const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts };\n\n const units = maybeArray(unit).map(Duration.normalizeUnit),\n otherIsLater = otherDateTime.valueOf() > this.valueOf(),\n earlier = otherIsLater ? this : otherDateTime,\n later = otherIsLater ? otherDateTime : this,\n diffed = diff(earlier, later, units, durOpts);\n\n return otherIsLater ? diffed.negate() : diffed;\n }\n\n /**\n * Return the difference between this DateTime and right now.\n * See {@link DateTime#diff}\n * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration\n * @param {Object} opts - options that affect the creation of the Duration\n * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use\n * @return {Duration}\n */\n diffNow(unit = \"milliseconds\", opts = {}) {\n return this.diff(DateTime.now(), unit, opts);\n }\n\n /**\n * Return an Interval spanning between this DateTime and another DateTime\n * @param {DateTime} otherDateTime - the other end point of the Interval\n * @return {Interval|DateTime}\n */\n until(otherDateTime) {\n return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;\n }\n\n /**\n * Return whether this DateTime is in the same unit of time as another DateTime.\n * Higher-order units must also be identical for this function to return `true`.\n * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.\n * @param {DateTime} otherDateTime - the other DateTime\n * @param {string} unit - the unit of time to check sameness on\n * @param {Object} opts - options\n * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used\n * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day\n * @return {boolean}\n */\n hasSame(otherDateTime, unit, opts) {\n if (!this.isValid) return false;\n\n const inputMs = otherDateTime.valueOf();\n const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true });\n return (\n adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts)\n );\n }\n\n /**\n * Equality check\n * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid.\n * To compare just the millisecond values, use `+dt1 === +dt2`.\n * @param {DateTime} other - the other DateTime\n * @return {boolean}\n */\n equals(other) {\n return (\n this.isValid &&\n other.isValid &&\n this.valueOf() === other.valueOf() &&\n this.zone.equals(other.zone) &&\n this.loc.equals(other.loc)\n );\n }\n\n /**\n * Returns a string representation of a this time relative to now, such as \"in two days\". Can only internationalize if your\n * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} [options.style=\"long\"] - the style of units, must be \"long\", \"short\", or \"narrow\"\n * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of \"years\", \"quarters\", \"months\", \"weeks\", \"days\", \"hours\", \"minutes\", or \"seconds\"\n * @param {boolean} [options.round=true] - whether to round the numbers in the output.\n * @param {string} [options.rounding=\"trunc\"] - rounding method to use when rounding the numbers in the output. Can be \"trunc\" (toward zero), \"expand\" (away from zero), \"round\", \"floor\", or \"ceil\".\n * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelative() //=> \"in 1 day\"\n * @example DateTime.now().setLocale(\"es\").toRelative({ days: 1 }) //=> \"dentro de 1 día\"\n * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: \"fr\" }) //=> \"dans 23 heures\"\n * @example DateTime.now().minus({ days: 2 }).toRelative() //=> \"2 days ago\"\n * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: \"hours\" }) //=> \"48 hours ago\"\n * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> \"1.5 days ago\"\n */\n toRelative(options = {}) {\n if (!this.isValid) return null;\n const base = options.base || DateTime.fromObject({}, { zone: this.zone }),\n padding = options.padding ? (this < base ? -options.padding : options.padding) : 0;\n let units = [\"years\", \"months\", \"days\", \"hours\", \"minutes\", \"seconds\"];\n let unit = options.unit;\n if (Array.isArray(options.unit)) {\n units = options.unit;\n unit = undefined;\n }\n return diffRelative(base, this.plus(padding), {\n ...options,\n numeric: \"always\",\n units,\n unit,\n });\n }\n\n /**\n * Returns a string representation of this date relative to today, such as \"yesterday\" or \"next month\".\n * Only internationalizes on platforms that supports Intl.RelativeTimeFormat.\n * @param {Object} options - options that affect the output\n * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.\n * @param {string} options.locale - override the locale of this DateTime\n * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of \"years\", \"quarters\", \"months\", \"weeks\", or \"days\"\n * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> \"tomorrow\"\n * @example DateTime.now().setLocale(\"es\").plus({ days: 1 }).toRelative() //=> \"\"mañana\"\n * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: \"fr\" }) //=> \"demain\"\n * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> \"2 days ago\"\n */\n toRelativeCalendar(options = {}) {\n if (!this.isValid) return null;\n\n return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, {\n ...options,\n numeric: \"auto\",\n units: [\"years\", \"months\", \"days\"],\n calendary: true,\n });\n }\n\n /**\n * Return the min of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum\n * @return {DateTime} the min DateTime, or undefined if called with no argument\n */\n static min(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"min requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.min);\n }\n\n /**\n * Return the max of several date times\n * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum\n * @return {DateTime} the max DateTime, or undefined if called with no argument\n */\n static max(...dateTimes) {\n if (!dateTimes.every(DateTime.isDateTime)) {\n throw new InvalidArgumentError(\"max requires all arguments be DateTimes\");\n }\n return bestBy(dateTimes, (i) => i.valueOf(), Math.max);\n }\n\n // MISC\n\n /**\n * Explain how a string would be parsed by fromFormat()\n * @param {string} text - the string to parse\n * @param {string} fmt - the format the string is expected to be in (see description)\n * @param {Object} options - options taken by fromFormat()\n * @return {Object}\n */\n static fromFormatExplain(text, fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n return explainFromTokens(localeToUse, text, fmt);\n }\n\n /**\n * @deprecated use fromFormatExplain instead\n */\n static fromStringExplain(text, fmt, options = {}) {\n return DateTime.fromFormatExplain(text, fmt, options);\n }\n\n /**\n * Build a parser for `fmt` using the given locale. This parser can be passed\n * to {@link DateTime.fromFormatParser} to a parse a date in this format. This\n * can be used to optimize cases where many dates need to be parsed in a\n * specific format.\n *\n * @param {String} fmt - the format the string is expected to be in (see\n * description)\n * @param {Object} options - options used to set locale and numberingSystem\n * for parser\n * @returns {TokenParser} - opaque object to be used\n */\n static buildFormatParser(fmt, options = {}) {\n const { locale = null, numberingSystem = null } = options,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n return new TokenParser(localeToUse, fmt);\n }\n\n /**\n * Create a DateTime from an input string and format parser.\n *\n * The format parser must have been created with the same locale as this call.\n *\n * @param {String} text - the string to parse\n * @param {TokenParser} formatParser - parser from {@link DateTime.buildFormatParser}\n * @param {Object} opts - options taken by fromFormat()\n * @returns {DateTime}\n */\n static fromFormatParser(text, formatParser, opts = {}) {\n if (isUndefined(text) || isUndefined(formatParser)) {\n throw new InvalidArgumentError(\n \"fromFormatParser requires an input string and a format parser\"\n );\n }\n const { locale = null, numberingSystem = null } = opts,\n localeToUse = Locale.fromOpts({\n locale,\n numberingSystem,\n defaultToEN: true,\n });\n\n if (!localeToUse.equals(formatParser.locale)) {\n throw new InvalidArgumentError(\n `fromFormatParser called with a locale of ${localeToUse}, ` +\n `but the format parser was created for ${formatParser.locale}`\n );\n }\n\n const { result, zone, specificOffset, invalidReason } = formatParser.explainFromTokens(text);\n\n if (invalidReason) {\n return DateTime.invalid(invalidReason);\n } else {\n return parseDataToDateTime(\n result,\n zone,\n opts,\n `format ${formatParser.format}`,\n text,\n specificOffset\n );\n }\n }\n\n // FORMAT PRESETS\n\n /**\n * {@link DateTime#toLocaleString} format like 10/14/1983\n * @type {Object}\n */\n static get DATE_SHORT() {\n return Formats.DATE_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED() {\n return Formats.DATE_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983'\n * @type {Object}\n */\n static get DATE_MED_WITH_WEEKDAY() {\n return Formats.DATE_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983'\n * @type {Object}\n */\n static get DATE_FULL() {\n return Formats.DATE_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983'\n * @type {Object}\n */\n static get DATE_HUGE() {\n return Formats.DATE_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_SIMPLE() {\n return Formats.TIME_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SECONDS() {\n return Formats.TIME_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_SHORT_OFFSET() {\n return Formats.TIME_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get TIME_WITH_LONG_OFFSET() {\n return Formats.TIME_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_SIMPLE() {\n return Formats.TIME_24_SIMPLE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SECONDS() {\n return Formats.TIME_24_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_SHORT_OFFSET() {\n return Formats.TIME_24_WITH_SHORT_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.\n * @type {Object}\n */\n static get TIME_24_WITH_LONG_OFFSET() {\n return Formats.TIME_24_WITH_LONG_OFFSET;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT() {\n return Formats.DATETIME_SHORT;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_SHORT_WITH_SECONDS() {\n return Formats.DATETIME_SHORT_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED() {\n return Formats.DATETIME_MED;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_SECONDS() {\n return Formats.DATETIME_MED_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_MED_WITH_WEEKDAY() {\n return Formats.DATETIME_MED_WITH_WEEKDAY;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL() {\n return Formats.DATETIME_FULL;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_FULL_WITH_SECONDS() {\n return Formats.DATETIME_FULL_WITH_SECONDS;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE() {\n return Formats.DATETIME_HUGE;\n }\n\n /**\n * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.\n * @type {Object}\n */\n static get DATETIME_HUGE_WITH_SECONDS() {\n return Formats.DATETIME_HUGE_WITH_SECONDS;\n }\n}\n\n/**\n * @private\n */\nexport function friendlyDateTime(dateTimeish) {\n if (DateTime.isDateTime(dateTimeish)) {\n return dateTimeish;\n } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {\n return DateTime.fromJSDate(dateTimeish);\n } else if (dateTimeish && typeof dateTimeish === \"object\") {\n return DateTime.fromObject(dateTimeish);\n } else {\n throw new InvalidArgumentError(\n `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`\n );\n }\n}\n","import DateTime from \"./datetime.js\";\nimport Duration from \"./duration.js\";\nimport Interval from \"./interval.js\";\nimport Info from \"./info.js\";\nimport Zone from \"./zone.js\";\nimport FixedOffsetZone from \"./zones/fixedOffsetZone.js\";\nimport IANAZone from \"./zones/IANAZone.js\";\nimport InvalidZone from \"./zones/invalidZone.js\";\nimport SystemZone from \"./zones/systemZone.js\";\nimport Settings from \"./settings.js\";\n\nconst VERSION = \"3.7.2\";\n\nexport {\n VERSION,\n DateTime,\n Duration,\n Interval,\n Info,\n Zone,\n FixedOffsetZone,\n IANAZone,\n InvalidZone,\n SystemZone,\n Settings,\n};\n"],"names":["LuxonError","Error","InvalidDateTimeError","constructor","reason","toMessage","InvalidIntervalError","InvalidDurationError","ConflictingSpecificationError","InvalidUnitError","unit","InvalidArgumentError","ZoneIsAbstractError","n","s","l","DATE_SHORT","year","month","day","DATE_MED","DATE_MED_WITH_WEEKDAY","weekday","DATE_FULL","DATE_HUGE","TIME_SIMPLE","hour","minute","TIME_WITH_SECONDS","second","TIME_WITH_SHORT_OFFSET","timeZoneName","TIME_WITH_LONG_OFFSET","TIME_24_SIMPLE","hourCycle","TIME_24_WITH_SECONDS","TIME_24_WITH_SHORT_OFFSET","TIME_24_WITH_LONG_OFFSET","DATETIME_SHORT","DATETIME_SHORT_WITH_SECONDS","DATETIME_MED","DATETIME_MED_WITH_SECONDS","DATETIME_MED_WITH_WEEKDAY","DATETIME_FULL","DATETIME_FULL_WITH_SECONDS","DATETIME_HUGE","DATETIME_HUGE_WITH_SECONDS","Zone","type","name","ianaName","isUniversal","offsetName","ts","opts","formatOffset","format","offset","equals","otherZone","isValid","singleton","SystemZone","instance","Intl","DateTimeFormat","resolvedOptions","timeZone","locale","parseZoneInfo","Date","getTimezoneOffset","dtfCache","Map","makeDTF","zoneName","dtf","get","undefined","hour12","era","set","typeToPos","hackyOffset","date","formatted","replace","parsed","exec","fMonth","fDay","fYear","fadOrBc","fHour","fMinute","fSecond","partsOffset","formatToParts","filled","i","length","value","pos","isUndefined","parseInt","ianaZoneCache","IANAZone","create","zone","resetCache","clear","isValidSpecifier","isValidZone","e","valid","NaN","isNaN","adOrBc","Math","abs","adjustedHour","asUTC","objToLocalTS","millisecond","asTS","over","intlLFCache","getCachedLF","locString","key","JSON","stringify","ListFormat","intlDTCache","getCachedDTF","intlNumCache","getCachedINF","inf","NumberFormat","intlRelCache","getCachedRTF","base","cacheKeyOpts","RelativeTimeFormat","sysLocaleCache","systemLocale","intlResolvedOptionsCache","getCachedIntResolvedOptions","weekInfoCache","getCachedWeekInfo","data","Locale","getWeekInfo","weekInfo","fallbackWeekSettings","parseLocaleString","localeStr","xIndex","indexOf","substring","uIndex","options","selectedStr","smaller","numberingSystem","calendar","intlConfigString","outputCalendar","includes","mapMonths","f","ms","dt","DateTime","utc","push","mapWeekdays","listStuff","loc","englishFn","intlFn","mode","listingMode","supportsFastNumbers","startsWith","PolyNumberFormatter","intl","forceSimple","padTo","floor","otherOpts","Object","keys","intlOpts","useGrouping","minimumIntegerDigits","fixed","roundTo","padStart","PolyDateFormatter","originalZone","z","gmtOffset","offsetZ","setZone","plus","minutes","map","join","toJSDate","parts","part","PolyRelFormatter","isEnglish","style","hasRelative","rtf","count","English","numeric","firstDay","minimalDays","weekend","fromOpts","weekSettings","defaultToEN","specifiedLocale","Settings","defaultLocale","localeR","numberingSystemR","defaultNumberingSystem","outputCalendarR","defaultOutputCalendar","weekSettingsR","validateWeekSettings","defaultWeekSettings","fromObject","numbering","parsedLocale","parsedNumberingSystem","parsedOutputCalendar","weekdaysCache","standalone","monthsCache","meridiemCache","eraCache","fastNumbersCached","fastNumbers","isActuallyEn","hasNoWeirdness","clone","alts","getOwnPropertyNames","redefaultToEN","redefaultToSystem","months","monthSpecialCase","formatStr","mapper","extract","dtFormatter","weekdays","meridiems","eras","field","df","results","matching","find","m","toLowerCase","numberFormatter","relFormatter","listFormatter","getWeekSettings","hasLocaleWeekInfo","getStartOfWeek","getMinDaysInFirstWeek","getWeekendDays","other","toString","FixedOffsetZone","utcInstance","parseSpecifier","r","match","signedOffset","InvalidZone","normalizeZone","input","defaultZone","isString","lowered","isNumber","numberingSystems","arab","arabext","bali","beng","deva","fullwide","gujr","hanidec","khmr","knda","laoo","limb","mlym","mong","mymr","orya","tamldec","telu","thai","tibt","latn","numberingSystemsUTF16","hanidecChars","split","parseDigits","str","code","charCodeAt","search","min","max","digitRegexCache","resetDigitRegexCache","digitRegex","append","ns","appendCache","regex","RegExp","now","twoDigitCutoffYear","throwOnInvalid","cutoffYear","t","resetCaches","Invalid","explanation","nonLeapLadder","leapLadder","unitOutOfRange","dayOfWeek","d","UTC","setUTCFullYear","getUTCFullYear","js","getUTCDay","computeOrdinal","isLeapYear","uncomputeOrdinal","ordinal","table","month0","findIndex","isoWeekdayToLocal","isoWeekday","startOfWeek","gregorianToWeek","gregObj","minDaysInFirstWeek","weekNumber","weekYear","weeksInWeekYear","timeObject","weekToGregorian","weekData","weekdayOfJan4","yearInDays","daysInYear","gregorianToOrdinal","gregData","ordinalToGregorian","ordinalData","usesLocalWeekValues","obj","hasLocaleWeekData","localWeekday","localWeekNumber","localWeekYear","hasIsoWeekData","hasInvalidWeekData","validYear","isInteger","validWeek","integerBetween","validWeekday","hasInvalidOrdinalData","validOrdinal","hasInvalidGregorianData","validMonth","validDay","daysInMonth","hasInvalidTimeData","validHour","validMinute","validSecond","validMillisecond","o","isDate","prototype","call","maybeArray","thing","Array","isArray","bestBy","arr","by","compare","reduce","best","next","pair","pick","a","k","hasOwnProperty","prop","settings","some","v","from","bottom","top","floorMod","x","isNeg","padded","parseInteger","string","parseFloating","parseFloat","parseMillis","fraction","number","digits","rounding","factor","ceil","trunc","round","RangeError","modMonth","modYear","firstWeekOffset","fwdlw","weekOffset","weekOffsetNext","untruncateYear","offsetFormat","modified","offHourStr","offMinuteStr","offHour","Number","offMin","offMinSigned","is","asNumber","numericValue","isFinite","normalizeObject","normalizer","normalized","u","hours","sign","monthsLong","monthsShort","monthsNarrow","weekdaysLong","weekdaysShort","weekdaysNarrow","erasLong","erasShort","erasNarrow","meridiemForDateTime","weekdayForDateTime","monthForDateTime","eraForDateTime","formatRelativeTime","narrow","units","years","quarters","weeks","days","seconds","lastable","isDay","isInPast","fmtValue","singular","lilUnits","fmtUnit","stringifyTokens","splits","tokenToString","token","literal","val","macroTokenToFormatOpts","D","Formats","DD","DDD","DDDD","tt","ttt","tttt","T","TT","TTT","TTTT","ff","fff","ffff","F","FF","FFF","FFFF","Formatter","parseFormat","fmt","current","currentFull","bracketed","c","charAt","test","formatOpts","systemLoc","formatWithSystemDefault","formatDateTime","formatDateTimeParts","formatInterval","interval","start","formatRange","end","num","p","signDisplay","formatDateTimeFromString","knownEnglish","useDateTimeFormatter","isOffsetFixed","allowZ","meridiem","maybeMacro","slice","quarter","formatDurationFromString","dur","invertLargest","signMode","tokenToField","lildur","info","mapped","inversionFactor","isNegativeDuration","largestUnit","tokens","realTokens","found","concat","collapsed","shiftTo","filter","durationInfo","values","ianaRegex","combineRegexes","regexes","full","source","combineExtractors","extractors","mergedVals","mergedZone","cursor","ex","parse","patterns","extractor","simpleParse","ret","offsetRegex","isoExtendedZone","isoTimeBaseRegex","isoTimeRegex","isoTimeExtensionRegex","isoYmdRegex","isoWeekRegex","isoOrdinalRegex","extractISOWeekData","extractISOOrdinalData","sqlYmdRegex","sqlTimeRegex","sqlTimeExtensionRegex","int","fallback","extractISOYmd","item","extractISOTime","milliseconds","extractISOOffset","local","fullOffset","extractIANAZone","isoTimeOnly","isoDuration","extractISODuration","yearStr","monthStr","weekStr","dayStr","hourStr","minuteStr","secondStr","millisecondsStr","hasNegativePrefix","negativeSeconds","maybeNegate","force","obsOffsets","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","fromStrings","weekdayStr","result","rfc2822","extractRFC2822","obsOffset","milOffset","preprocessRFC2822","trim","rfc1123","rfc850","ascii","extractRFC1123Or850","extractASCII","isoYmdWithTimeExtensionRegex","isoWeekWithTimeExtensionRegex","isoOrdinalWithTimeExtensionRegex","isoTimeCombinedRegex","extractISOYmdTimeAndOffset","extractISOWeekTimeAndOffset","extractISOOrdinalDateAndTime","extractISOTimeAndOffset","parseISODate","parseRFC2822Date","parseHTTPDate","parseISODuration","extractISOTimeOnly","parseISOTimeOnly","sqlYmdWithTimeExtensionRegex","sqlTimeCombinedRegex","extractISOTimeOffsetAndIANAZone","parseSQL","INVALID","lowOrderMatrix","casualMatrix","daysInYearAccurate","daysInMonthAccurate","accurateMatrix","orderedUnits","reverseUnits","reverse","conf","conversionAccuracy","matrix","Duration","durationToMillis","vals","_vals$milliseconds","sum","normalizeValues","reduceRight","previous","previousVal","conv","rollUp","removeZeroes","newVals","entries","config","accurate","invalid","isLuxonDuration","fromMillis","normalizeUnit","fromDurationLike","durationLike","isDuration","fromISO","text","fromISOTime","week","toFormat","fmtOpts","toHuman","showZeros","unitDisplay","listStyle","toObject","toISO","toISOTime","millis","toMillis","suppressMilliseconds","suppressSeconds","includePrefix","includeOffset","dateTime","toJSON","Symbol","for","invalidReason","valueOf","duration","minus","negate","mapUnits","fn","mixed","reconfigure","as","normalize","rescale","shiftToAll","built","accumulated","lastUnit","own","ak","negated","removeZeros","invalidExplanation","eq","v1","v2","validateStartEnd","Interval","isLuxonInterval","fromDateTimes","builtStart","friendlyDateTime","builtEnd","validateError","after","before","startIsValid","endIsValid","isInterval","lastDateTime","toDuration","startOf","useLocaleWeeks","diff","hasSame","isEmpty","isAfter","isBefore","contains","splitAt","dateTimes","sorted","sort","b","added","splitBy","idx","divideEqually","numberOfParts","overlaps","abutsStart","abutsEnd","engulfs","intersection","union","merge","intervals","final","sofar","xor","currentCount","ends","time","flattened","difference","toLocaleString","toISODate","dateFormat","separator","mapEndpoints","mapFn","Info","hasDST","proto","isValidIANAZone","locObj","getMinimumDaysInFirstWeek","getWeekendWeekdays","monthsFormat","weekdaysFormat","features","relative","localeWeek","dayDiff","earlier","later","utcDayStart","toUTC","keepLocalTime","highOrderDiffs","differs","lowestOrder","highWater","differ","remainingMillis","lowerOrderUnits","MISSING_FTP","intUnit","post","deser","NBSP","String","fromCharCode","spaceOrNBSP","spaceOrNBSPRegExp","fixListRegex","stripInsensitivities","oneOf","strings","startIndex","groups","h","simple","escapeToken","unitForToken","one","two","three","four","six","oneOrTwo","oneToThree","oneToSix","oneToNine","twoToFour","fourToSix","unitate","partTypeStyleToTokenVal","short","long","dayperiod","dayPeriod","hour24","tokenForPart","resolvedOpts","isSpace","actualType","buildRegex","re","handlers","matches","all","matchIndex","dateTimeFromMatches","toField","specificOffset","Z","q","M","G","y","S","dummyDateTimeCache","getDummyDateTime","maybeExpandMacroToken","formatOptsToTokens","expandMacroTokens","TokenParser","disqualifyingUnit","regexString","explainFromTokens","rawMatches","parser","parseFromTokens","formatter","MAX_DATE","unsupportedZone","possiblyCachedWeekData","possiblyCachedLocalWeekData","localWeekData","inst","old","fixOffset","localTS","tz","utcGuess","o2","o3","tsToObj","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","objToTS","adjustTime","oPre","millisToAdd","parseDataToDateTime","parsedZone","interpretationZone","toTechFormat","extended","precision","longFormat","extendedZone","showSeconds","defaultUnitValues","defaultWeekUnitValues","defaultOrdinalUnitValues","orderedWeekUnits","orderedOrdinalUnits","weeknumber","weeksnumber","weeknumbers","weekyear","weekyears","normalizeUnitWithLocalWeeks","guessOffsetForZone","zoneOffsetTs","offsetGuess","zoneOffsetGuessCache","quickDT","offsetProvis","diffRelative","calendary","lastOpts","argList","args","unchanged","ot","_zone","isLuxonDateTime","arguments","fromJSDate","zoneToUse","fromSeconds","tsNow","containsOrdinal","containsGregorYear","containsGregorMD","containsGregor","definiteWeekDef","useWeekData","defaultValues","objNow","foundFirst","higherOrderInvalid","gregorian","tsFinal","offsetFinal","fromRFC2822","fromHTTP","fromFormat","localeToUse","fromString","fromSQL","isDateTime","parseFormatForOpts","localeOpts","tokenList","expandFormat","expanded","isWeekend","monthShort","monthLong","weekdayShort","weekdayLong","offsetNameShort","offsetNameLong","isInDST","getPossibleOffsets","dayMs","minuteMs","oEarlier","oLater","o1","ts1","ts2","c1","c2","isInLeapYear","weeksInLocalWeekYear","resolvedLocaleOptions","toLocal","keepCalendarTime","newTS","asObj","setLocale","settingWeekStuff","normalizedUnit","endOf","toLocaleParts","ext","toISOWeekDate","toRFC2822","toHTTP","toSQLDate","toSQLTime","includeZone","includeOffsetSpace","toSQL","toSeconds","toUnixInteger","toBSON","includeConfig","otherDateTime","durOpts","otherIsLater","diffed","diffNow","until","inputMs","adjustedToZone","toRelative","padding","toRelativeCalendar","every","fromFormatExplain","fromStringExplain","buildFormatParser","fromFormatParser","formatParser","dateTimeish","VERSION"],"mappings":";;;;AAAA;;AAEA;AACA;AACA;AACA,MAAMA,UAAU,SAASC,KAAK,CAAC,EAAA;;AAE/B;AACA;AACA;AACO,MAAMC,oBAAoB,SAASF,UAAU,CAAC;EACnDG,WAAWA,CAACC,MAAM,EAAE;IA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ACA;AACA;EACE,WAAWnd,yBAAyBA,GAAG;IACrC,OAAOmd,yBAAiC,CAAA;AAC1C,GAAA;;AAEA;AACF;AACA;AACA;EACE,WAAWld,aAAaA,GAAG;IACzB,OAAOkd,aAAqB,CAAA;AAC9B,GAAA;;AAEA;AACF;AACA;AACA;EACE,WAAWjd,0BAA0BA,GAAG;IACtC,OAAOid,0BAAkC,CAAA;AAC3C,GAAA;;AAEA;AACF;AACA;AACA;EACE,WAAWhd,aAAaA,GAAG;IACzB,OAAOgd,aAAqB,CAAA;AAC9B,GAAA;;AAEA;AACF;AACA;AACA;EACE,WAAW/c,0BAA0BA,GAAG;IACtC,OAAO+c,0BAAkC,CAAA;AAC3C,GAAA;AACF,CAAA;;AAEA;AACA;AACA;AACO,SAAS4P,gBAAgBA,CAACqS,WAAW,EAAE;AAC5C,EAAA,IAAIj3B,QAAQ,CAAC+yB,UAAU,CAACkE,WAAW,CAAC,EAAE;AACpC,IAAA,OAAOA,WAAW,CAAA;AACpB,GAAC,MAAM,IAAIA,WAAW,IAAIA,WAAW,CAACjU,OAAO,IAAIvb,QAAQ,CAACwvB,WAAW,CAACjU,OAAO,EAAE,CAAC,EAAE;AAChF,IAAA,OAAOhjB,QAAQ,CAACwxB,UAAU,CAACyF,WAAW,CAAC,CAAA;GACxC,MAAM,IAAIA,WAAW,IAAI,OAAOA,WAAW,KAAK,QAAQ,EAAE;AACzD,IAAA,OAAOj3B,QAAQ,CAACgE,UAAU,CAACizB,WAAW,CAAC,CAAA;AACzC,GAAC,MAAM;IACL,MAAM,IAAInhC,oBAAoB,CAC3B,CAAA,2BAAA,EAA6BmhC,WAAY,CAAY,UAAA,EAAA,OAAOA,WAAY,CAAA,CAC3E,CAAC,CAAA;AACH,GAAA;AACF;;AC/hFMC,MAAAA,OAAO,GAAG;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/luxon/package.json b/node_modules/luxon/package.json new file mode 100644 index 00000000..f80269b1 --- /dev/null +++ b/node_modules/luxon/package.json @@ -0,0 +1,87 @@ +{ + "name": "luxon", + "version": "3.7.2", + "description": "Immutable date wrapper", + "author": "Isaac Cambron", + "keywords": [ + "date", + "immutable" + ], + "repository": "https://github.com/moment/luxon", + "exports": { + ".": { + "import": "./build/es6/luxon.mjs", + "require": "./build/node/luxon.js" + }, + "./package.json": "./package.json" + }, + "scripts": { + "build": "babel-node tasks/buildAll.js", + "build-node": "babel-node tasks/buildNode.js", + "build-global": "babel-node tasks/buildGlobal.js", + "jest": "jest", + "test": "jest --coverage", + "api-docs": "mkdir -p build && documentation build src/luxon.js -f html -o build/api-docs && sed -i.bak 's/<\\/body>/ +``` + +``` +// "lite" version + +``` + +## Quick Start + +For the full version (800+ MIME types, 1,000+ extensions): + +```javascript +const mime = require('mime'); + +mime.getType('txt'); // ⇨ 'text/plain' +mime.getExtension('text/plain'); // ⇨ 'txt' +``` + +See [Mime API](#mime-api) below for API details. + +## Lite Version + +The "lite" version of this module omits vendor-specific (`*/vnd.*`) and +experimental (`*/x-*`) types. It weighs in at ~2.5KB, compared to 8KB for the +full version. To load the lite version: + +```javascript +const mime = require('mime/lite'); +``` + +## Mime .vs. mime-types .vs. mime-db modules + +For those of you wondering about the difference between these [popular] NPM modules, +here's a brief rundown ... + +[`mime-db`](https://github.com/jshttp/mime-db) is "the source of +truth" for MIME type information. It is not an API. Rather, it is a canonical +dataset of mime type definitions pulled from IANA, Apache, NGINX, and custom mappings +submitted by the Node.js community. + +[`mime-types`](https://github.com/jshttp/mime-types) is a thin +wrapper around mime-db that provides an API drop-in compatible(ish) with `mime @ < v1.3.6` API. + +`mime` is, as of v2, a self-contained module bundled with a pre-optimized version +of the `mime-db` dataset. It provides a simplified API with the following characteristics: + +* Intelligently resolved type conflicts (See [mime-score](https://github.com/broofa/mime-score) for details) +* Method naming consistent with industry best-practices +* Compact footprint. E.g. The minified+compressed sizes of the various modules: + +Module | Size +--- | --- +`mime-db` | 18 KB +`mime-types` | same as mime-db +`mime` | 8 KB +`mime/lite` | 2 KB + +## Mime API + +Both `require('mime')` and `require('mime/lite')` return instances of the MIME +class, documented below. + +Note: Inputs to this API are case-insensitive. Outputs (returned values) will +be lowercase. + +### new Mime(typeMap, ... more maps) + +Most users of this module will not need to create Mime instances directly. +However if you would like to create custom mappings, you may do so as follows +... + +```javascript +// Require Mime class +const Mime = require('mime/Mime'); + +// Define mime type -> extensions map +const typeMap = { + 'text/abc': ['abc', 'alpha', 'bet'], + 'text/def': ['leppard'] +}; + +// Create and use Mime instance +const myMime = new Mime(typeMap); +myMime.getType('abc'); // ⇨ 'text/abc' +myMime.getExtension('text/def'); // ⇨ 'leppard' +``` + +If more than one map argument is provided, each map is `define()`ed (see below), in order. + +### mime.getType(pathOrExtension) + +Get mime type for the given path or extension. E.g. + +```javascript +mime.getType('js'); // ⇨ 'application/javascript' +mime.getType('json'); // ⇨ 'application/json' + +mime.getType('txt'); // ⇨ 'text/plain' +mime.getType('dir/text.txt'); // ⇨ 'text/plain' +mime.getType('dir\\text.txt'); // ⇨ 'text/plain' +mime.getType('.text.txt'); // ⇨ 'text/plain' +mime.getType('.txt'); // ⇨ 'text/plain' +``` + +`null` is returned in cases where an extension is not detected or recognized + +```javascript +mime.getType('foo/txt'); // ⇨ null +mime.getType('bogus_type'); // ⇨ null +``` + +### mime.getExtension(type) +Get extension for the given mime type. Charset options (often included in +Content-Type headers) are ignored. + +```javascript +mime.getExtension('text/plain'); // ⇨ 'txt' +mime.getExtension('application/json'); // ⇨ 'json' +mime.getExtension('text/html; charset=utf8'); // ⇨ 'html' +``` + +### mime.define(typeMap[, force = false]) + +Define [more] type mappings. + +`typeMap` is a map of type -> extensions, as documented in `new Mime`, above. + +By default this method will throw an error if you try to map a type to an +extension that is already assigned to another type. Passing `true` for the +`force` argument will suppress this behavior (overriding any previous mapping). + +```javascript +mime.define({'text/x-abc': ['abc', 'abcd']}); + +mime.getType('abcd'); // ⇨ 'text/x-abc' +mime.getExtension('text/x-abc') // ⇨ 'abc' +``` + +## Command Line + + mime [path_or_extension] + +E.g. + + > mime scripts/jquery.js + application/javascript + +---- +Markdown generated from [src/README_js.md](src/README_js.md) by [![RunMD Logo](http://i.imgur.com/h0FVyzU.png)](https://github.com/broofa/runmd) \ No newline at end of file diff --git a/node_modules/mime/cli.js b/node_modules/mime/cli.js new file mode 100644 index 00000000..ab70a49c --- /dev/null +++ b/node_modules/mime/cli.js @@ -0,0 +1,46 @@ +#!/usr/bin/env node + +'use strict'; + +process.title = 'mime'; +let mime = require('.'); +let pkg = require('./package.json'); +let args = process.argv.splice(2); + +if (args.includes('--version') || args.includes('-v') || args.includes('--v')) { + console.log(pkg.version); + process.exit(0); +} else if (args.includes('--name') || args.includes('-n') || args.includes('--n')) { + console.log(pkg.name); + process.exit(0); +} else if (args.includes('--help') || args.includes('-h') || args.includes('--h')) { + console.log(pkg.name + ' - ' + pkg.description + '\n'); + console.log(`Usage: + + mime [flags] [path_or_extension] + + Flags: + --help, -h Show this message + --version, -v Display the version + --name, -n Print the name of the program + + Note: the command will exit after it executes if a command is specified + The path_or_extension is the path to the file or the extension of the file. + + Examples: + mime --help + mime --version + mime --name + mime -v + mime src/log.js + mime new.py + mime foo.sh + `); + process.exit(0); +} + +let file = args[0]; +let type = mime.getType(file); + +process.stdout.write(type + '\n'); + diff --git a/node_modules/mime/index.js b/node_modules/mime/index.js new file mode 100644 index 00000000..fadcf8d6 --- /dev/null +++ b/node_modules/mime/index.js @@ -0,0 +1,4 @@ +'use strict'; + +let Mime = require('./Mime'); +module.exports = new Mime(require('./types/standard'), require('./types/other')); diff --git a/node_modules/mime/lite.js b/node_modules/mime/lite.js new file mode 100644 index 00000000..835cffb3 --- /dev/null +++ b/node_modules/mime/lite.js @@ -0,0 +1,4 @@ +'use strict'; + +let Mime = require('./Mime'); +module.exports = new Mime(require('./types/standard')); diff --git a/node_modules/mime/package.json b/node_modules/mime/package.json new file mode 100644 index 00000000..84f51323 --- /dev/null +++ b/node_modules/mime/package.json @@ -0,0 +1,52 @@ +{ + "author": { + "name": "Robert Kieffer", + "url": "http://github.com/broofa", + "email": "robert@broofa.com" + }, + "engines": { + "node": ">=10.0.0" + }, + "bin": { + "mime": "cli.js" + }, + "contributors": [], + "description": "A comprehensive library for mime-type mapping", + "license": "MIT", + "dependencies": {}, + "devDependencies": { + "benchmark": "*", + "chalk": "4.1.2", + "eslint": "8.1.0", + "mime-db": "1.50.0", + "mime-score": "1.2.0", + "mime-types": "2.1.33", + "mocha": "9.1.3", + "runmd": "*", + "standard-version": "9.3.2" + }, + "files": [ + "index.js", + "lite.js", + "Mime.js", + "cli.js", + "/types" + ], + "scripts": { + "prepare": "node src/build.js && runmd --output README.md src/README_js.md", + "release": "standard-version", + "benchmark": "node src/benchmark.js", + "md": "runmd --watch --output README.md src/README_js.md", + "test": "mocha src/test.js" + }, + "keywords": [ + "util", + "mime" + ], + "name": "mime", + "repository": { + "url": "https://github.com/broofa/mime", + "type": "git" + }, + "version": "3.0.0" +} diff --git a/node_modules/mime/types/other.js b/node_modules/mime/types/other.js new file mode 100644 index 00000000..bb6a0353 --- /dev/null +++ b/node_modules/mime/types/other.js @@ -0,0 +1 @@ +module.exports = {"application/prs.cww":["cww"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.sap.vds":["vds"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]}; \ No newline at end of file diff --git a/node_modules/mime/types/standard.js b/node_modules/mime/types/standard.js new file mode 100644 index 00000000..5ee9937e --- /dev/null +++ b/node_modules/mime/types/standard.js @@ -0,0 +1 @@ +module.exports = {"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}; \ No newline at end of file diff --git a/node_modules/minimatch/LICENSE b/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/minimatch/README.md b/node_modules/minimatch/README.md new file mode 100644 index 00000000..60d88502 --- /dev/null +++ b/node_modules/minimatch/README.md @@ -0,0 +1,267 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://travis-ci.org/isaacs/minimatch.svg?branch=master)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Important Security Consideration! + +> [!WARNING] +> This library uses JavaScript regular expressions. Please read +> the following warning carefully, and be thoughtful about what +> you provide to this library in production systems. + +_Any_ library in JavaScript that deals with matching string +patterns using regular expressions will be subject to +[ReDoS](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS) +if the pattern is generated using untrusted input. + +Efforts have been made to mitigate risk as much as is feasible in +such a library, providing maximum recursion depths and so forth, +but these measures can only ultimately protect against accidents, +not malice. A dedicated attacker can _always_ find patterns that +cannot be defended against by a bash-compatible glob pattern +matching system that uses JavaScript regular expressions. + +To be extremely clear: + +> [!WARNING] +> **If you create a system where you take user input, and use +> that input as the source of a Regular Expression pattern, in +> this or any extant glob matcher in JavaScript, you will be +> pwned.** + +A future version of this library _may_ use a different matching +algorithm which does not exhibit backtracking problems. If and +when that happens, it will likely be a sweeping change, and those +improvements will **not** be backported to legacy versions. + +In the near term, it is not reasonable to continue to play +whack-a-mole with security advisories, and so any future ReDoS +reports will be considered "working as intended", and resolved +entirely by this warning. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + +### partial + +Compare a partial path to a pattern. As long as the parts of the path that +are present are not contradicted by the pattern, it will be treated as a +match. This is useful in applications where you're walking through a +folder structure, and don't yet have the full path, but want to ensure that +you do not walk down paths that can never be a match. + +For example, + +```js +minimatch('/a/b', '/a/*/c/d', { partial: true }) // true, might be /a/b/c/d +minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d +minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a +``` + +### allowWindowsEscape + +Windows path separator `\` is by default converted to `/`, which +prohibits the usage of `\` as a escape character. This flag skips that +behavior and allows using the escape character. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/node_modules/minimatch/minimatch.js b/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000..2e4a058a --- /dev/null +++ b/node_modules/minimatch/minimatch.js @@ -0,0 +1,1005 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = (function () { try { return require('path') } catch (e) {}}()) || { + sep: '/' +} +minimatch.sep = path.sep + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + b = b || {} + var t = {} + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || typeof def !== 'object' || !Object.keys(def).length) { + return minimatch + } + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + m.Minimatch.defaults = function defaults (options) { + return orig.defaults(ext(def, options)).Minimatch + } + + m.filter = function filter (pattern, options) { + return orig.filter(pattern, ext(def, options)) + } + + m.defaults = function defaults (options) { + return orig.defaults(ext(def, options)) + } + + m.makeRe = function makeRe (pattern, options) { + return orig.makeRe(pattern, ext(def, options)) + } + + m.braceExpand = function braceExpand (pattern, options) { + return orig.braceExpand(pattern, ext(def, options)) + } + + m.match = function (list, pattern, options) { + return orig.match(list, pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + assertValidPattern(pattern) + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + assertValidPattern(pattern) + + if (!options) options = {} + + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (!options.allowWindowsEscape && path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.maxGlobstarRecursion = options.maxGlobstarRecursion !== undefined + ? options.maxGlobstarRecursion : 200 + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + this.partial = !!options.partial + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) } + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + assertValidPattern(pattern) + + // Thanks to Yeting Li for + // improving this regexp to avoid a ReDOS vulnerability. + if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +var MAX_PATTERN_LENGTH = 1024 * 64 +var assertValidPattern = function (pattern) { + if (typeof pattern !== 'string') { + throw new TypeError('invalid pattern') + } + + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError('pattern is too long') + } +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + assertValidPattern(pattern) + + var options = this.options + + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + /* istanbul ignore next */ + case '/': { + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + } + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // coalesce consecutive non-globstar * characters + if (c === '*' && stateChar === '*') continue + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '[': case '.': case '(': addPatternStart = true + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] + + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) + + nlLast += nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) /* istanbul ignore next - should be impossible */ { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) /* istanbul ignore next - should be impossible */ { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = function match (f, partial) { + if (typeof partial === 'undefined') partial = this.partial + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + if (pattern.indexOf(GLOBSTAR) !== -1) { + return this._matchGlobstar(file, pattern, partial, 0, 0) + } + return this._matchOne(file, pattern, partial, 0, 0) +} + +Minimatch.prototype._matchGlobstar = function (file, pattern, partial, fileIndex, patternIndex) { + var i + + // find first globstar from patternIndex + var firstgs = -1 + for (i = patternIndex; i < pattern.length; i++) { + if (pattern[i] === GLOBSTAR) { firstgs = i; break } + } + + // find last globstar + var lastgs = -1 + for (i = pattern.length - 1; i >= 0; i--) { + if (pattern[i] === GLOBSTAR) { lastgs = i; break } + } + + var head = pattern.slice(patternIndex, firstgs) + var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs) + var tail = partial ? [] : pattern.slice(lastgs + 1) + + // check the head + if (head.length) { + var fileHead = file.slice(fileIndex, fileIndex + head.length) + if (!this._matchOne(fileHead, head, partial, 0, 0)) { + return false + } + fileIndex += head.length + } + + // check the tail + var fileTailMatch = 0 + if (tail.length) { + if (tail.length + fileIndex > file.length) return false + + var tailStart = file.length - tail.length + if (this._matchOne(file, tail, partial, tailStart, 0)) { + fileTailMatch = tail.length + } else { + // affordance for stuff like a/**/* matching a/b/ + if (file[file.length - 1] !== '' || + fileIndex + tail.length === file.length) { + return false + } + tailStart-- + if (!this._matchOne(file, tail, partial, tailStart, 0)) { + return false + } + fileTailMatch = tail.length + 1 + } + } + + // if body is empty (single ** between head and tail) + if (!body.length) { + var sawSome = !!fileTailMatch + for (i = fileIndex; i < file.length - fileTailMatch; i++) { + var f = String(file[i]) + sawSome = true + if (f === '.' || f === '..' || + (!this.options.dot && f.charAt(0) === '.')) { + return false + } + } + return partial || sawSome + } + + // split body into segments at each GLOBSTAR + var bodySegments = [[[], 0]] + var currentBody = bodySegments[0] + var nonGsParts = 0 + var nonGsPartsSums = [0] + for (var bi = 0; bi < body.length; bi++) { + var b = body[bi] + if (b === GLOBSTAR) { + nonGsPartsSums.push(nonGsParts) + currentBody = [[], 0] + bodySegments.push(currentBody) + } else { + currentBody[0].push(b) + nonGsParts++ + } + } + + var idx = bodySegments.length - 1 + var fileLength = file.length - fileTailMatch + for (var si = 0; si < bodySegments.length; si++) { + bodySegments[si][1] = fileLength - + (nonGsPartsSums[idx--] + bodySegments[si][0].length) + } + + return !!this._matchGlobStarBodySections( + file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch + ) +} + +// return false for "nope, not matching" +// return null for "not matching, cannot keep trying" +Minimatch.prototype._matchGlobStarBodySections = function ( + file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail +) { + var bs = bodySegments[bodyIndex] + if (!bs) { + // just make sure there are no bad dots + for (var i = fileIndex; i < file.length; i++) { + sawTail = true + var f = file[i] + if (f === '.' || f === '..' || + (!this.options.dot && f.charAt(0) === '.')) { + return false + } + } + return sawTail + } + + var body = bs[0] + var after = bs[1] + while (fileIndex <= after) { + var m = this._matchOne( + file.slice(0, fileIndex + body.length), + body, + partial, + fileIndex, + 0 + ) + // if limit exceeded, no match. intentional false negative, + // acceptable break in correctness for security. + if (m && globStarDepth < this.maxGlobstarRecursion) { + var sub = this._matchGlobStarBodySections( + file, bodySegments, + fileIndex + body.length, bodyIndex + 1, + partial, globStarDepth + 1, sawTail + ) + if (sub !== false) { + return sub + } + } + var f = file[fileIndex] + if (f === '.' || f === '..' || + (!this.options.dot && f.charAt(0) === '.')) { + return false + } + fileIndex++ + } + return partial || null +} + +Minimatch.prototype._matchOne = function (file, pattern, partial, fileIndex, patternIndex) { + var fi, pi, fl, pl + for ( + fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++ + ) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + /* istanbul ignore if */ + if (p === false || p === GLOBSTAR) return false + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + hit = f === p + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else /* istanbul ignore else */ if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return (fi === fl - 1) && (file[fi] === '') + } + + // should be unreachable. + /* istanbul ignore next */ + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/node_modules/minimatch/package.json b/node_modules/minimatch/package.json new file mode 100644 index 00000000..563d2184 --- /dev/null +++ b/node_modules/minimatch/package.json @@ -0,0 +1,33 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me)", + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "3.1.5", + "publishConfig": { + "tag": "legacy-v3" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "devDependencies": { + "tap": "^15.1.6" + }, + "license": "ISC", + "files": [ + "minimatch.js" + ] +} diff --git a/node_modules/minimist/.eslintrc b/node_modules/minimist/.eslintrc new file mode 100644 index 00000000..bd1a5e04 --- /dev/null +++ b/node_modules/minimist/.eslintrc @@ -0,0 +1,29 @@ +{ + "root": true, + + "extends": "@ljharb/eslint-config/node/0.4", + + "rules": { + "array-element-newline": 0, + "complexity": 0, + "func-style": [2, "declaration"], + "max-lines-per-function": 0, + "max-nested-callbacks": 1, + "max-statements-per-line": 1, + "max-statements": 0, + "multiline-comment-style": 0, + "no-continue": 1, + "no-param-reassign": 1, + "no-restricted-syntax": 1, + "object-curly-newline": 0, + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "camelcase": 0, + }, + }, + ] +} diff --git a/node_modules/minimist/.github/FUNDING.yml b/node_modules/minimist/.github/FUNDING.yml new file mode 100644 index 00000000..a9366222 --- /dev/null +++ b/node_modules/minimist/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/minimist +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/node_modules/minimist/.nycrc b/node_modules/minimist/.nycrc new file mode 100644 index 00000000..55c3d293 --- /dev/null +++ b/node_modules/minimist/.nycrc @@ -0,0 +1,14 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "example", + "test" + ] +} diff --git a/node_modules/minimist/CHANGELOG.md b/node_modules/minimist/CHANGELOG.md new file mode 100644 index 00000000..c9a1e15e --- /dev/null +++ b/node_modules/minimist/CHANGELOG.md @@ -0,0 +1,298 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.8](https://github.com/minimistjs/minimist/compare/v1.2.7...v1.2.8) - 2023-02-09 + +### Merged + +- [Fix] Fix long option followed by single dash [`#17`](https://github.com/minimistjs/minimist/pull/17) +- [Tests] Remove duplicate test [`#12`](https://github.com/minimistjs/minimist/pull/12) +- [Fix] opt.string works with multiple aliases [`#10`](https://github.com/minimistjs/minimist/pull/10) + +### Fixed + +- [Fix] Fix long option followed by single dash (#17) [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Tests] Remove duplicate test (#12) [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] Fix long option followed by single dash [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Fix] opt.string works with multiple aliases (#10) [`#9`](https://github.com/minimistjs/minimist/issues/9) +- [Fix] Fix handling of short option with non-trivial equals [`#5`](https://github.com/minimistjs/minimist/issues/5) +- [Tests] Remove duplicate test [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] opt.string works with multiple aliases [`#9`](https://github.com/minimistjs/minimist/issues/9) + +### Commits + +- Merge tag 'v0.2.3' [`a026794`](https://github.com/minimistjs/minimist/commit/a0267947c7870fc5847cf2d437fbe33f392767da) +- [eslint] fix indentation and whitespace [`5368ca4`](https://github.com/minimistjs/minimist/commit/5368ca4147e974138a54cc0dc4cea8f756546b70) +- [eslint] fix indentation and whitespace [`e5f5067`](https://github.com/minimistjs/minimist/commit/e5f5067259ceeaf0b098d14bec910f87e58708c7) +- [eslint] more cleanup [`62fde7d`](https://github.com/minimistjs/minimist/commit/62fde7d935f83417fb046741531a9e2346a36976) +- [eslint] more cleanup [`36ac5d0`](https://github.com/minimistjs/minimist/commit/36ac5d0d95e4947d074e5737d94814034ca335d1) +- [meta] add `auto-changelog` [`73923d2`](https://github.com/minimistjs/minimist/commit/73923d223553fca08b1ba77e3fbc2a492862ae4c) +- [actions] add reusable workflows [`d80727d`](https://github.com/minimistjs/minimist/commit/d80727df77bfa9e631044d7f16368d8f09242c91) +- [eslint] add eslint; rules to enable later are warnings [`48bc06a`](https://github.com/minimistjs/minimist/commit/48bc06a1b41f00e9cdf183db34f7a51ba70e98d4) +- [eslint] fix indentation [`34b0f1c`](https://github.com/minimistjs/minimist/commit/34b0f1ccaa45183c3c4f06a91f9b405180a6f982) +- [readme] rename and add badges [`5df0fe4`](https://github.com/minimistjs/minimist/commit/5df0fe49211bd09a3636f8686a7cb3012c3e98f0) +- [Dev Deps] switch from `covert` to `nyc` [`a48b128`](https://github.com/minimistjs/minimist/commit/a48b128fdb8d427dfb20a15273f83e38d97bef07) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`f0fb958`](https://github.com/minimistjs/minimist/commit/f0fb958e9a1fe980cdffc436a211b0bda58f621b) +- [meta] create FUNDING.yml; add `funding` in package.json [`3639e0c`](https://github.com/minimistjs/minimist/commit/3639e0c819359a366387e425ab6eabf4c78d3caa) +- [meta] use `npmignore` to autogenerate an npmignore file [`be2e038`](https://github.com/minimistjs/minimist/commit/be2e038c342d8333b32f0fde67a0026b79c8150e) +- Only apps should have lockfiles [`282b570`](https://github.com/minimistjs/minimist/commit/282b570e7489d01b03f2d6d3dabf79cd3e5f84cf) +- isConstructorOrProto adapted from PR [`ef9153f`](https://github.com/minimistjs/minimist/commit/ef9153fc52b6cea0744b2239921c5dcae4697f11) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`098873c`](https://github.com/minimistjs/minimist/commit/098873c213cdb7c92e55ae1ef5aa1af3a8192a79) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`3124ed3`](https://github.com/minimistjs/minimist/commit/3124ed3e46306301ebb3c834874ce0241555c2c4) +- [meta] add `safe-publish-latest` [`4b927de`](https://github.com/minimistjs/minimist/commit/4b927de696d561c636b4f43bf49d4597cb36d6d6) +- [Tests] add `aud` in `posttest` [`b32d9bd`](https://github.com/minimistjs/minimist/commit/b32d9bd0ab340f4e9f8c3a97ff2a4424f25fab8c) +- [meta] update repo URLs [`f9fdfc0`](https://github.com/minimistjs/minimist/commit/f9fdfc032c54884d9a9996a390c63cd0719bbe1a) +- [actions] Avoid 0.6 tests due to build failures [`ba92fe6`](https://github.com/minimistjs/minimist/commit/ba92fe6ebbdc0431cca9a2ea8f27beb492f5e4ec) +- [Dev Deps] update `tape` [`950eaa7`](https://github.com/minimistjs/minimist/commit/950eaa74f112e04d23e9c606c67472c46739b473) +- [Dev Deps] add missing `npmignore` dev dep [`3226afa`](https://github.com/minimistjs/minimist/commit/3226afaf09e9d127ca369742437fe6e88f752d6b) +- Merge tag 'v0.2.2' [`980d7ac`](https://github.com/minimistjs/minimist/commit/980d7ac61a0b4bd552711251ac107d506b23e41f) + +## [v1.2.7](https://github.com/minimistjs/minimist/compare/v1.2.6...v1.2.7) - 2022-10-10 + +### Commits + +- [meta] add `auto-changelog` [`0ebf4eb`](https://github.com/minimistjs/minimist/commit/0ebf4ebcd5f7787a5524d31a849ef41316b83c3c) +- [actions] add reusable workflows [`e115b63`](https://github.com/minimistjs/minimist/commit/e115b63fa9d3909f33b00a2db647ff79068388de) +- [eslint] add eslint; rules to enable later are warnings [`f58745b`](https://github.com/minimistjs/minimist/commit/f58745b9bb84348e1be72af7dbba5840c7c13013) +- [Dev Deps] switch from `covert` to `nyc` [`ab03356`](https://github.com/minimistjs/minimist/commit/ab033567b9c8b31117cb026dc7f1e592ce455c65) +- [readme] rename and add badges [`236f4a0`](https://github.com/minimistjs/minimist/commit/236f4a07e4ebe5ee44f1496ec6974991ab293ffd) +- [meta] create FUNDING.yml; add `funding` in package.json [`783a49b`](https://github.com/minimistjs/minimist/commit/783a49bfd47e8335d3098a8cac75662cf71eb32a) +- [meta] use `npmignore` to autogenerate an npmignore file [`f81ece6`](https://github.com/minimistjs/minimist/commit/f81ece6aaec2fa14e69ff4f1e0407a8c4e2635a2) +- Only apps should have lockfiles [`56cad44`](https://github.com/minimistjs/minimist/commit/56cad44c7f879b9bb5ec18fcc349308024a89bfc) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`49c5f9f`](https://github.com/minimistjs/minimist/commit/49c5f9fb7e6a92db9eb340cc679de92fb3aacded) +- [Tests] add `aud` in `posttest` [`228ae93`](https://github.com/minimistjs/minimist/commit/228ae938f3cd9db9dfd8bd7458b076a7b2aef280) +- [meta] add `safe-publish-latest` [`01fc23f`](https://github.com/minimistjs/minimist/commit/01fc23f5104f85c75059972e01dd33796ab529ff) +- [meta] update repo URLs [`6b164c7`](https://github.com/minimistjs/minimist/commit/6b164c7d68e0b6bf32f894699effdfb7c63041dd) + +## [v1.2.6](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.6) - 2022-03-21 + +### Commits + +- test from prototype pollution PR [`bc8ecee`](https://github.com/minimistjs/minimist/commit/bc8ecee43875261f4f17eb20b1243d3ed15e70eb) +- isConstructorOrProto adapted from PR [`c2b9819`](https://github.com/minimistjs/minimist/commit/c2b981977fa834b223b408cfb860f933c9811e4d) +- security notice for additional prototype pollution issue [`ef88b93`](https://github.com/minimistjs/minimist/commit/ef88b9325f77b5ee643ccfc97e2ebda577e4c4e2) + +## [v1.2.5](https://github.com/minimistjs/minimist/compare/v1.2.4...v1.2.5) - 2020-03-12 + +## [v1.2.4](https://github.com/minimistjs/minimist/compare/v1.2.3...v1.2.4) - 2020-03-11 + +### Commits + +- security notice [`4cf1354`](https://github.com/minimistjs/minimist/commit/4cf1354839cb972e38496d35e12f806eea92c11f) +- additional test for constructor prototype pollution [`1043d21`](https://github.com/minimistjs/minimist/commit/1043d212c3caaf871966e710f52cfdf02f9eea4b) + +## [v1.2.3](https://github.com/minimistjs/minimist/compare/v1.2.2...v1.2.3) - 2020-03-10 + +### Commits + +- more failing proto pollution tests [`13c01a5`](https://github.com/minimistjs/minimist/commit/13c01a5327736903704984b7f65616b8476850cc) +- even more aggressive checks for protocol pollution [`38a4d1c`](https://github.com/minimistjs/minimist/commit/38a4d1caead72ef99e824bb420a2528eec03d9ab) + +## [v1.2.2](https://github.com/minimistjs/minimist/compare/v1.2.1...v1.2.2) - 2020-03-10 + +### Commits + +- failing test for protocol pollution [`0efed03`](https://github.com/minimistjs/minimist/commit/0efed0340ec8433638758f7ca0c77cb20a0bfbab) +- cleanup [`67d3722`](https://github.com/minimistjs/minimist/commit/67d3722413448d00a62963d2d30c34656a92d7e2) +- console.dir -> console.log [`47acf72`](https://github.com/minimistjs/minimist/commit/47acf72c715a630bf9ea013867f47f1dd69dfc54) +- don't assign onto __proto__ [`63e7ed0`](https://github.com/minimistjs/minimist/commit/63e7ed05aa4b1889ec2f3b196426db4500cbda94) + +## [v1.2.1](https://github.com/minimistjs/minimist/compare/v1.2.0...v1.2.1) - 2020-03-10 + +### Merged + +- move the `opts['--']` example back where it belongs [`#63`](https://github.com/minimistjs/minimist/pull/63) + +### Commits + +- add test [`6be5dae`](https://github.com/minimistjs/minimist/commit/6be5dae35a32a987bcf4137fcd6c19c5200ee909) +- fix bad boolean regexp [`ac3fc79`](https://github.com/minimistjs/minimist/commit/ac3fc796e63b95128fdbdf67ea7fad71bd59aa76) + +## [v1.2.0](https://github.com/minimistjs/minimist/compare/v1.1.3...v1.2.0) - 2015-08-24 + +### Commits + +- failing -k=v short test [`63416b8`](https://github.com/minimistjs/minimist/commit/63416b8cd1d0d70e4714564cce465a36e4dd26d7) +- kv short fix [`6bbe145`](https://github.com/minimistjs/minimist/commit/6bbe14529166245e86424f220a2321442fe88dc3) +- failing kv short test [`f72ab7f`](https://github.com/minimistjs/minimist/commit/f72ab7f4572adc52902c9b6873cc969192f01b10) +- fixed kv test [`f5a48c3`](https://github.com/minimistjs/minimist/commit/f5a48c3e50e40ca54f00c8e84de4b4d6e9897fa8) +- enforce space between arg key and value [`86b321a`](https://github.com/minimistjs/minimist/commit/86b321affe648a8e016c095a4f0efa9d9074f502) + +## [v1.1.3](https://github.com/minimistjs/minimist/compare/v1.1.2...v1.1.3) - 2015-08-06 + +### Commits + +- add failing test - boolean alias array [`0fa3c5b`](https://github.com/minimistjs/minimist/commit/0fa3c5b3dd98551ddecf5392831b4c21211743fc) +- fix boolean values with multiple aliases [`9c0a6e7`](https://github.com/minimistjs/minimist/commit/9c0a6e7de25a273b11bbf9a7464f0bd833779795) + +## [v1.1.2](https://github.com/minimistjs/minimist/compare/v1.1.1...v1.1.2) - 2015-07-22 + +### Commits + +- Convert boolean arguments to boolean values [`8f3dc27`](https://github.com/minimistjs/minimist/commit/8f3dc27cf833f1d54671b6d0bcb55c2fe19672a9) +- use non-ancient npm, node 0.12 and iojs [`61ed1d0`](https://github.com/minimistjs/minimist/commit/61ed1d034b9ec7282764ce76f3992b1a0b4906ae) +- an older npm for 0.8 [`25cf778`](https://github.com/minimistjs/minimist/commit/25cf778b1220e7838a526832ad6972f75244054f) + +## [v1.1.1](https://github.com/minimistjs/minimist/compare/v1.1.0...v1.1.1) - 2015-03-10 + +### Commits + +- check that they type of a value is a boolean, not just that it is currently set to a boolean [`6863198`](https://github.com/minimistjs/minimist/commit/6863198e36139830ff1f20ffdceaddd93f2c1db9) +- upgrade tape, fix type issues from old tape version [`806712d`](https://github.com/minimistjs/minimist/commit/806712df91604ed02b8e39aa372b84aea659ee34) +- test for setting a boolean to a null default [`8c444fe`](https://github.com/minimistjs/minimist/commit/8c444fe89384ded7d441c120915ea60620b01dd3) +- if the previous value was a boolean, without an default (or with an alias) don't make an array either [`e5f419a`](https://github.com/minimistjs/minimist/commit/e5f419a3b5b3bc3f9e5ac71b7040621af70ed2dd) + +## [v1.1.0](https://github.com/minimistjs/minimist/compare/v1.0.0...v1.1.0) - 2014-08-10 + +### Commits + +- add support for handling "unknown" options not registered with the parser. [`6f3cc5d`](https://github.com/minimistjs/minimist/commit/6f3cc5d4e84524932a6ef2ce3592acc67cdd4383) +- reformat package.json [`02ed371`](https://github.com/minimistjs/minimist/commit/02ed37115194d3697ff358e8e25e5e66bab1d9f8) +- coverage script [`e5531ba`](https://github.com/minimistjs/minimist/commit/e5531ba0479da3b8138d3d8cac545d84ccb1c8df) +- extra fn to get 100% coverage again [`a6972da`](https://github.com/minimistjs/minimist/commit/a6972da89e56bf77642f8ec05a13b6558db93498) + +## [v1.0.0](https://github.com/minimistjs/minimist/compare/v0.2.3...v1.0.0) - 2014-08-10 + +### Commits + +- added stopEarly option [`471c7e4`](https://github.com/minimistjs/minimist/commit/471c7e4a7e910fc7ad8f9df850a186daf32c64e9) +- fix list [`fef6ae7`](https://github.com/minimistjs/minimist/commit/fef6ae79c38b9dc1c49569abb7cd04eb965eac5e) + +## [v0.2.3](https://github.com/minimistjs/minimist/compare/v0.2.2...v0.2.3) - 2023-02-09 + +### Merged + +- [Fix] Fix long option followed by single dash [`#17`](https://github.com/minimistjs/minimist/pull/17) +- [Tests] Remove duplicate test [`#12`](https://github.com/minimistjs/minimist/pull/12) +- [Fix] opt.string works with multiple aliases [`#10`](https://github.com/minimistjs/minimist/pull/10) + +### Fixed + +- [Fix] Fix long option followed by single dash (#17) [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Tests] Remove duplicate test (#12) [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] opt.string works with multiple aliases (#10) [`#9`](https://github.com/minimistjs/minimist/issues/9) + +### Commits + +- [eslint] fix indentation and whitespace [`e5f5067`](https://github.com/minimistjs/minimist/commit/e5f5067259ceeaf0b098d14bec910f87e58708c7) +- [eslint] more cleanup [`36ac5d0`](https://github.com/minimistjs/minimist/commit/36ac5d0d95e4947d074e5737d94814034ca335d1) +- [eslint] fix indentation [`34b0f1c`](https://github.com/minimistjs/minimist/commit/34b0f1ccaa45183c3c4f06a91f9b405180a6f982) +- isConstructorOrProto adapted from PR [`ef9153f`](https://github.com/minimistjs/minimist/commit/ef9153fc52b6cea0744b2239921c5dcae4697f11) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`098873c`](https://github.com/minimistjs/minimist/commit/098873c213cdb7c92e55ae1ef5aa1af3a8192a79) +- [Dev Deps] add missing `npmignore` dev dep [`3226afa`](https://github.com/minimistjs/minimist/commit/3226afaf09e9d127ca369742437fe6e88f752d6b) + +## [v0.2.2](https://github.com/minimistjs/minimist/compare/v0.2.1...v0.2.2) - 2022-10-10 + +### Commits + +- [meta] add `auto-changelog` [`73923d2`](https://github.com/minimistjs/minimist/commit/73923d223553fca08b1ba77e3fbc2a492862ae4c) +- [actions] add reusable workflows [`d80727d`](https://github.com/minimistjs/minimist/commit/d80727df77bfa9e631044d7f16368d8f09242c91) +- [eslint] add eslint; rules to enable later are warnings [`48bc06a`](https://github.com/minimistjs/minimist/commit/48bc06a1b41f00e9cdf183db34f7a51ba70e98d4) +- [readme] rename and add badges [`5df0fe4`](https://github.com/minimistjs/minimist/commit/5df0fe49211bd09a3636f8686a7cb3012c3e98f0) +- [Dev Deps] switch from `covert` to `nyc` [`a48b128`](https://github.com/minimistjs/minimist/commit/a48b128fdb8d427dfb20a15273f83e38d97bef07) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`f0fb958`](https://github.com/minimistjs/minimist/commit/f0fb958e9a1fe980cdffc436a211b0bda58f621b) +- [meta] create FUNDING.yml; add `funding` in package.json [`3639e0c`](https://github.com/minimistjs/minimist/commit/3639e0c819359a366387e425ab6eabf4c78d3caa) +- [meta] use `npmignore` to autogenerate an npmignore file [`be2e038`](https://github.com/minimistjs/minimist/commit/be2e038c342d8333b32f0fde67a0026b79c8150e) +- Only apps should have lockfiles [`282b570`](https://github.com/minimistjs/minimist/commit/282b570e7489d01b03f2d6d3dabf79cd3e5f84cf) +- [meta] add `safe-publish-latest` [`4b927de`](https://github.com/minimistjs/minimist/commit/4b927de696d561c636b4f43bf49d4597cb36d6d6) +- [Tests] add `aud` in `posttest` [`b32d9bd`](https://github.com/minimistjs/minimist/commit/b32d9bd0ab340f4e9f8c3a97ff2a4424f25fab8c) +- [meta] update repo URLs [`f9fdfc0`](https://github.com/minimistjs/minimist/commit/f9fdfc032c54884d9a9996a390c63cd0719bbe1a) + +## [v0.2.1](https://github.com/minimistjs/minimist/compare/v0.2.0...v0.2.1) - 2020-03-12 + +## [v0.2.0](https://github.com/minimistjs/minimist/compare/v0.1.0...v0.2.0) - 2014-06-19 + +### Commits + +- support all-boolean mode [`450a97f`](https://github.com/minimistjs/minimist/commit/450a97f6e2bc85c7a4a13185c19a818d9a5ebe69) + +## [v0.1.0](https://github.com/minimistjs/minimist/compare/v0.0.10...v0.1.0) - 2014-05-12 + +### Commits + +- Provide a mechanism to segregate -- arguments [`ce4a1e6`](https://github.com/minimistjs/minimist/commit/ce4a1e63a7e8d5ab88d2a3768adefa6af98a445a) +- documented argv['--'] [`14db0e6`](https://github.com/minimistjs/minimist/commit/14db0e6dbc6d2b9e472adaa54dad7004b364634f) +- Adding a test-case for notFlags segregation [`715c1e3`](https://github.com/minimistjs/minimist/commit/715c1e3714be223f998f6c537af6b505f0236c16) + +## [v0.0.10](https://github.com/minimistjs/minimist/compare/v0.0.9...v0.0.10) - 2014-05-11 + +### Commits + +- dedicated boolean test [`46e448f`](https://github.com/minimistjs/minimist/commit/46e448f9f513cfeb2bcc8b688b9b47ba1e515c2b) +- dedicated num test [`9bf2d36`](https://github.com/minimistjs/minimist/commit/9bf2d36f1d3b8795be90b8f7de0a937f098aa394) +- aliased values treated as strings [`1ab743b`](https://github.com/minimistjs/minimist/commit/1ab743bad4484d69f1259bed42f9531de01119de) +- cover the case of already numbers, at 100% coverage [`b2bb044`](https://github.com/minimistjs/minimist/commit/b2bb04436599d77a2ce029e8e555e25b3aa55d13) +- another test for higher coverage [`3662624`](https://github.com/minimistjs/minimist/commit/3662624be976d5489d486a856849c048d13be903) + +## [v0.0.9](https://github.com/minimistjs/minimist/compare/v0.0.8...v0.0.9) - 2014-05-08 + +### Commits + +- Eliminate `longest` fn. [`824f642`](https://github.com/minimistjs/minimist/commit/824f642038d1b02ede68b6261d1d65163390929a) + +## [v0.0.8](https://github.com/minimistjs/minimist/compare/v0.0.7...v0.0.8) - 2014-02-20 + +### Commits + +- return '' if flag is string and empty [`fa63ed4`](https://github.com/minimistjs/minimist/commit/fa63ed4651a4ef4eefddce34188e0d98d745a263) +- handle joined single letters [`66c248f`](https://github.com/minimistjs/minimist/commit/66c248f0241d4d421d193b022e9e365f11178534) + +## [v0.0.7](https://github.com/minimistjs/minimist/compare/v0.0.6...v0.0.7) - 2014-02-08 + +### Commits + +- another swap of .test for .match [`d1da408`](https://github.com/minimistjs/minimist/commit/d1da40819acbe846d89a5c02721211e3c1260dde) + +## [v0.0.6](https://github.com/minimistjs/minimist/compare/v0.0.5...v0.0.6) - 2014-02-08 + +### Commits + +- use .test() instead of .match() to not crash on non-string values in the arguments array [`7e0d1ad`](https://github.com/minimistjs/minimist/commit/7e0d1add8c9e5b9b20a4d3d0f9a94d824c578da1) + +## [v0.0.5](https://github.com/minimistjs/minimist/compare/v0.0.4...v0.0.5) - 2013-09-18 + +### Commits + +- Improve '--' handling. [`b11822c`](https://github.com/minimistjs/minimist/commit/b11822c09cc9d2460f30384d12afc0b953c037a4) + +## [v0.0.4](https://github.com/minimistjs/minimist/compare/v0.0.3...v0.0.4) - 2013-09-17 + +## [v0.0.3](https://github.com/minimistjs/minimist/compare/v0.0.2...v0.0.3) - 2013-09-12 + +### Commits + +- failing test for single dash preceeding a double dash [`b465514`](https://github.com/minimistjs/minimist/commit/b465514b82c9ae28972d714facd951deb2ad762b) +- fix for the dot test [`6a095f1`](https://github.com/minimistjs/minimist/commit/6a095f1d364c8fab2d6753d2291a0649315d297a) + +## [v0.0.2](https://github.com/minimistjs/minimist/compare/v0.0.1...v0.0.2) - 2013-08-28 + +### Commits + +- allow dotted aliases & defaults [`321c33e`](https://github.com/minimistjs/minimist/commit/321c33e755485faaeb44eeb1c05d33b2e0a5a7c4) +- use a better version of ff [`e40f611`](https://github.com/minimistjs/minimist/commit/e40f61114cf7be6f7947f7b3eed345853a67dbbb) + +## [v0.0.1](https://github.com/minimistjs/minimist/compare/v0.0.0...v0.0.1) - 2013-06-25 + +### Commits + +- remove trailing commas [`6ff0fa0`](https://github.com/minimistjs/minimist/commit/6ff0fa055064f15dbe06d50b89d5173a6796e1db) + +## v0.0.0 - 2013-06-25 + +### Commits + +- half of the parse test ported [`3079326`](https://github.com/minimistjs/minimist/commit/307932601325087de6cf94188eb798ffc4f3088a) +- stripped down code and a passing test from optimist [`7cced88`](https://github.com/minimistjs/minimist/commit/7cced88d82e399d1a03ed23eb667f04d3f320d10) +- ported parse tests completely over [`9448754`](https://github.com/minimistjs/minimist/commit/944875452e0820df6830b1408c26a0f7d3e1db04) +- docs, package.json [`a5bf46a`](https://github.com/minimistjs/minimist/commit/a5bf46ac9bb3bd114a9c340276c62c1091e538d5) +- move more short tests into short.js [`503edb5`](https://github.com/minimistjs/minimist/commit/503edb5c41d89c0d40831ee517154fc13b0f18b9) +- default bool test was wrong, not the code [`1b9f5db`](https://github.com/minimistjs/minimist/commit/1b9f5db4741b49962846081b68518de824992097) +- passing long tests ripped out of parse.js [`7972c4a`](https://github.com/minimistjs/minimist/commit/7972c4aff1f4803079e1668006658e2a761a0428) +- badges [`84c0370`](https://github.com/minimistjs/minimist/commit/84c037063664d42878aace715fe6572ce01b6f3b) +- all the tests now ported, some failures [`64239ed`](https://github.com/minimistjs/minimist/commit/64239edfe92c711c4eb0da254fcdfad2a5fdb605) +- failing short test [`f8a5341`](https://github.com/minimistjs/minimist/commit/f8a534112dd1138d2fad722def56a848480c446f) +- fixed the numeric test [`6b034f3`](https://github.com/minimistjs/minimist/commit/6b034f37c79342c60083ed97fd222e16928aac51) diff --git a/node_modules/minimist/LICENSE b/node_modules/minimist/LICENSE new file mode 100644 index 00000000..ee27ba4b --- /dev/null +++ b/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/minimist/README.md b/node_modules/minimist/README.md new file mode 100644 index 00000000..74da3234 --- /dev/null +++ b/node_modules/minimist/README.md @@ -0,0 +1,121 @@ +# minimist [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.log(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ + _: ['foo', 'bar', 'baz'], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' +} +``` + +# security + +Previous versions had a prototype pollution bug that could cause privilege +escalation in some circumstances when handling untrusted user input. + +Please use version 1.2.6 or later: + +* https://security.snyk.io/vuln/SNYK-JS-MINIMIST-2429795 (version <=1.2.5) +* https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 (version <=1.2.3) + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a boolean, string or array of strings to always treat as +booleans. if `true` will treat all double hyphenated arguments without equal signs +as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values +* `opts.stopEarly` - when true, populate `argv._` with everything after the +first non-option +* `opts['--']` - when true, populate `argv._` with everything before the `--` +and `argv['--']` with everything after the `--`. Here's an example: + + ``` + > require('./')('one two three -- four five --six'.split(' '), { '--': true }) + { + _: ['one', 'two', 'three'], + '--': ['four', 'five', '--six'] + } + ``` + + Note that with `opts['--']` set, parsing for arguments still stops after the + `--`. + +* `opts.unknown` - a function which is invoked with a command line parameter not +defined in the `opts` configuration object. If the function returns `false`, the +unknown option is not added to `argv`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT + +[package-url]: https://npmjs.org/package/minimist +[npm-version-svg]: https://versionbadg.es/minimistjs/minimist.svg +[npm-badge-png]: https://nodei.co/npm/minimist.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/minimist.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/minimist.svg +[downloads-url]: https://npm-stat.com/charts.html?package=minimist +[codecov-image]: https://codecov.io/gh/minimistjs/minimist/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/minimistjs/minimist/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/minimistjs/minimist +[actions-url]: https://github.com/minimistjs/minimist/actions diff --git a/node_modules/minimist/example/parse.js b/node_modules/minimist/example/parse.js new file mode 100644 index 00000000..9d90ffb2 --- /dev/null +++ b/node_modules/minimist/example/parse.js @@ -0,0 +1,4 @@ +'use strict'; + +var argv = require('../')(process.argv.slice(2)); +console.log(argv); diff --git a/node_modules/minimist/index.js b/node_modules/minimist/index.js new file mode 100644 index 00000000..f020f394 --- /dev/null +++ b/node_modules/minimist/index.js @@ -0,0 +1,263 @@ +'use strict'; + +function hasKey(obj, keys) { + var o = obj; + keys.slice(0, -1).forEach(function (key) { + o = o[key] || {}; + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function isNumber(x) { + if (typeof x === 'number') { return true; } + if ((/^0x[0-9a-f]+$/i).test(x)) { return true; } + return (/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/).test(x); +} + +function isConstructorOrProto(obj, key) { + return (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__'; +} + +module.exports = function (args, opts) { + if (!opts) { opts = {}; } + + var flags = { + bools: {}, + strings: {}, + unknownFn: null, + }; + + if (typeof opts.unknown === 'function') { + flags.unknownFn = opts.unknown; + } + + if (typeof opts.boolean === 'boolean' && opts.boolean) { + flags.allBools = true; + } else { + [].concat(opts.boolean).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + } + + var aliases = {}; + + function aliasIsBoolean(key) { + return aliases[key].some(function (x) { + return flags.bools[x]; + }); + } + + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + [].concat(aliases[key]).forEach(function (k) { + flags.strings[k] = true; + }); + } + }); + + var defaults = opts.default || {}; + + var argv = { _: [] }; + + function argDefined(key, arg) { + return (flags.allBools && (/^--[^=]+$/).test(arg)) + || flags.strings[key] + || flags.bools[key] + || aliases[key]; + } + + function setKey(obj, keys, value) { + var o = obj; + for (var i = 0; i < keys.length - 1; i++) { + var key = keys[i]; + if (isConstructorOrProto(o, key)) { return; } + if (o[key] === undefined) { o[key] = {}; } + if ( + o[key] === Object.prototype + || o[key] === Number.prototype + || o[key] === String.prototype + ) { + o[key] = {}; + } + if (o[key] === Array.prototype) { o[key] = []; } + o = o[key]; + } + + var lastKey = keys[keys.length - 1]; + if (isConstructorOrProto(o, lastKey)) { return; } + if ( + o === Object.prototype + || o === Number.prototype + || o === String.prototype + ) { + o = {}; + } + if (o === Array.prototype) { o = []; } + if (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') { + o[lastKey] = value; + } else if (Array.isArray(o[lastKey])) { + o[lastKey].push(value); + } else { + o[lastKey] = [o[lastKey], value]; + } + } + + function setArg(key, val, arg) { + if (arg && flags.unknownFn && !argDefined(key, arg)) { + if (flags.unknownFn(arg) === false) { return; } + } + + var value = !flags.strings[key] && isNumber(val) + ? Number(val) + : val; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--') + 1); + args = args.slice(0, args.indexOf('--')); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + var key; + var next; + + if ((/^--.+=/).test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + key = m[1]; + var value = m[2]; + if (flags.bools[key]) { + value = value !== 'false'; + } + setArg(key, value, arg); + } else if ((/^--no-.+/).test(arg)) { + key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false, arg); + } else if ((/^--.+/).test(arg)) { + key = arg.match(/^--(.+)/)[1]; + next = args[i + 1]; + if ( + next !== undefined + && !(/^(-|--)[^-]/).test(next) + && !flags.bools[key] + && !flags.allBools + && (aliases[key] ? !aliasIsBoolean(key) : true) + ) { + setArg(key, next, arg); + i += 1; + } else if ((/^(true|false)$/).test(next)) { + setArg(key, next === 'true', arg); + i += 1; + } else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } else if ((/^-[^-]+/).test(arg)) { + var letters = arg.slice(1, -1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + next = arg.slice(j + 2); + + if (next === '-') { + setArg(letters[j], next, arg); + continue; + } + + if ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') { + setArg(letters[j], next.slice(1), arg); + broken = true; + break; + } + + if ( + (/[A-Za-z]/).test(letters[j]) + && (/-?\d+(\.\d*)?(e-?\d+)?$/).test(next) + ) { + setArg(letters[j], next, arg); + broken = true; + break; + } + + if (letters[j + 1] && letters[j + 1].match(/\W/)) { + setArg(letters[j], arg.slice(j + 2), arg); + broken = true; + break; + } else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); + } + } + + key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if ( + args[i + 1] + && !(/^(-|--)[^-]/).test(args[i + 1]) + && !flags.bools[key] + && (aliases[key] ? !aliasIsBoolean(key) : true) + ) { + setArg(key, args[i + 1], arg); + i += 1; + } else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) { + setArg(key, args[i + 1] === 'true', arg); + i += 1; + } else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + } else { + if (!flags.unknownFn || flags.unknownFn(arg) !== false) { + argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg)); + } + if (opts.stopEarly) { + argv._.push.apply(argv._, args.slice(i + 1)); + break; + } + } + } + + Object.keys(defaults).forEach(function (k) { + if (!hasKey(argv, k.split('.'))) { + setKey(argv, k.split('.'), defaults[k]); + + (aliases[k] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[k]); + }); + } + }); + + if (opts['--']) { + argv['--'] = notFlags.slice(); + } else { + notFlags.forEach(function (k) { + argv._.push(k); + }); + } + + return argv; +}; diff --git a/node_modules/minimist/package.json b/node_modules/minimist/package.json new file mode 100644 index 00000000..c10a3344 --- /dev/null +++ b/node_modules/minimist/package.json @@ -0,0 +1,75 @@ +{ + "name": "minimist", + "version": "1.2.8", + "description": "parse argument options", + "main": "index.js", + "devDependencies": { + "@ljharb/eslint-config": "^21.0.1", + "aud": "^2.0.2", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.6.3" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=auto", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/minimistjs/minimist.git" + }, + "homepage": "https://github.com/minimistjs/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/node_modules/minimist/test/all_bool.js b/node_modules/minimist/test/all_bool.js new file mode 100644 index 00000000..befa0c99 --- /dev/null +++ b/node_modules/minimist/test/all_bool.js @@ -0,0 +1,34 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('flag boolean true (default all --args to boolean)', function (t) { + var argv = parse(['moo', '--honk', 'cow'], { + boolean: true, + }); + + t.deepEqual(argv, { + honk: true, + _: ['moo', 'cow'], + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); + +test('flag boolean true only affects double hyphen arguments without equals signs', function (t) { + var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { + boolean: true, + }); + + t.deepEqual(argv, { + honk: true, + tacos: 'good', + p: 55, + _: ['moo', 'cow'], + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); diff --git a/node_modules/minimist/test/bool.js b/node_modules/minimist/test/bool.js new file mode 100644 index 00000000..e58d47e4 --- /dev/null +++ b/node_modules/minimist/test/bool.js @@ -0,0 +1,177 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false }, + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'], + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse(['-x', '-z', 'one', 'two', 'three'], { + boolean: ['x', 'y', 'z'], + }); + + t.deepEqual(argv, { + x: true, + y: false, + z: true, + _: ['one', 'two', 'three'], + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); +test('boolean and alias with chainable api', function (t) { + var aliased = ['-h', 'derp']; + var regular = ['--herp', 'derp']; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' }, + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' }, + }); + var expected = { + herp: true, + h: true, + _: ['derp'], + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = ['-h', 'derp']; + var regular = ['--herp', 'derp']; + var opts = { + alias: { h: 'herp' }, + boolean: 'herp', + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + _: ['derp'], + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias array with options hash', function (t) { + var aliased = ['-h', 'derp']; + var regular = ['--herp', 'derp']; + var alt = ['--harp', 'derp']; + var opts = { + alias: { h: ['herp', 'harp'] }, + boolean: 'h', + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var altPropertyArgv = parse(alt, opts); + var expected = { + harp: true, + herp: true, + h: true, + _: ['derp'], + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.same(altPropertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = ['-h', 'true']; + var regular = ['--herp', 'true']; + var opts = { + alias: { h: 'herp' }, + boolean: 'h', + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + _: [], + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function (t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool', + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool', + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); + +test('boolean --boool=true', function (t) { + var parsed = parse(['--boool=true'], { + default: { + boool: false, + }, + boolean: ['boool'], + }); + + t.same(parsed.boool, true); + t.end(); +}); + +test('boolean --boool=false', function (t) { + var parsed = parse(['--boool=false'], { + default: { + boool: true, + }, + boolean: ['boool'], + }); + + t.same(parsed.boool, false); + t.end(); +}); + +test('boolean using something similar to true', function (t) { + var opts = { boolean: 'h' }; + var result = parse(['-h', 'true.txt'], opts); + var expected = { + h: true, + _: ['true.txt'], + }; + + t.same(result, expected); + t.end(); +}); diff --git a/node_modules/minimist/test/dash.js b/node_modules/minimist/test/dash.js new file mode 100644 index 00000000..70788177 --- /dev/null +++ b/node_modules/minimist/test/dash.js @@ -0,0 +1,43 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(6); + t.deepEqual(parse(['-n', '-']), { n: '-', _: [] }); + t.deepEqual(parse(['--nnn', '-']), { nnn: '-', _: [] }); + t.deepEqual(parse(['-']), { _: ['-'] }); + t.deepEqual(parse(['-f-']), { f: '-', _: [] }); + t.deepEqual( + parse(['-b', '-'], { boolean: 'b' }), + { b: true, _: ['-'] } + ); + t.deepEqual( + parse(['-s', '-'], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(2); + t.deepEqual(parse(['-a', '--', 'b']), { a: true, _: ['b'] }); + t.deepEqual(parse(['--a', '--', 'b']), { a: true, _: ['b'] }); +}); + +test('move arguments after the -- into their own `--` array', function (t) { + t.plan(1); + t.deepEqual( + parse(['--name', 'John', 'before', '--', 'after'], { '--': true }), + { name: 'John', _: ['before'], '--': ['after'] } + ); +}); + +test('--- option value', function (t) { + // A multi-dash value is largely an edge case, but check the behaviour is as expected, + // and in particular the same for short option and long option (as made consistent in Jan 2023). + t.plan(2); + t.deepEqual(parse(['-n', '---']), { n: '---', _: [] }); + t.deepEqual(parse(['--nnn', '---']), { nnn: '---', _: [] }); +}); + diff --git a/node_modules/minimist/test/default_bool.js b/node_modules/minimist/test/default_bool.js new file mode 100644 index 00000000..4e9f6250 --- /dev/null +++ b/node_modules/minimist/test/default_bool.js @@ -0,0 +1,37 @@ +'use strict'; + +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true }, + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false }, + }); + t.equal(argv.somefalse, false); + t.end(); +}); + +test('boolean default to null', function (t) { + var argv = parse([], { + boolean: 'maybe', + default: { maybe: null }, + }); + t.equal(argv.maybe, null); + + var argvLong = parse(['--maybe'], { + boolean: 'maybe', + default: { maybe: null }, + }); + t.equal(argvLong.maybe, true); + t.end(); +}); diff --git a/node_modules/minimist/test/dotted.js b/node_modules/minimist/test/dotted.js new file mode 100644 index 00000000..126ff033 --- /dev/null +++ b/node_modules/minimist/test/dotted.js @@ -0,0 +1,24 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], { default: { 'a.b': 11 }, alias: { 'a.b': 'aa.bb' } }); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', { default: { 'a.b': 11 }, alias: { 'a.b': 'aa.bb' } }); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); + +test('dotted default with no alias', function (t) { + var argv = parse('', { default: { 'a.b': 11 } }); + t.equal(argv.a.b, 11); + t.end(); +}); diff --git a/node_modules/minimist/test/kv_short.js b/node_modules/minimist/test/kv_short.js new file mode 100644 index 00000000..6d1b53a7 --- /dev/null +++ b/node_modules/minimist/test/kv_short.js @@ -0,0 +1,32 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('short -k=v', function (t) { + t.plan(1); + + var argv = parse(['-b=123']); + t.deepEqual(argv, { b: 123, _: [] }); +}); + +test('multi short -k=v', function (t) { + t.plan(1); + + var argv = parse(['-a=whatever', '-b=robots']); + t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] }); +}); + +test('short with embedded equals -k=a=b', function (t) { + t.plan(1); + + var argv = parse(['-k=a=b']); + t.deepEqual(argv, { k: 'a=b', _: [] }); +}); + +test('short with later equals like -ab=c', function (t) { + t.plan(1); + + var argv = parse(['-ab=c']); + t.deepEqual(argv, { a: true, b: 'c', _: [] }); +}); diff --git a/node_modules/minimist/test/long.js b/node_modules/minimist/test/long.js new file mode 100644 index 00000000..9fef51f1 --- /dev/null +++ b/node_modules/minimist/test/long.js @@ -0,0 +1,33 @@ +'use strict'; + +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse(['--bool']), + { bool: true, _: [] }, + 'long boolean' + ); + t.deepEqual( + parse(['--pow', 'xixxle']), + { pow: 'xixxle', _: [] }, + 'long capture sp' + ); + t.deepEqual( + parse(['--pow=xixxle']), + { pow: 'xixxle', _: [] }, + 'long capture eq' + ); + t.deepEqual( + parse(['--host', 'localhost', '--port', '555']), + { host: 'localhost', port: 555, _: [] }, + 'long captures sp' + ); + t.deepEqual( + parse(['--host=localhost', '--port=555']), + { host: 'localhost', port: 555, _: [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/node_modules/minimist/test/num.js b/node_modules/minimist/test/num.js new file mode 100644 index 00000000..074393ec --- /dev/null +++ b/node_modules/minimist/test/num.js @@ -0,0 +1,38 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789', + ]); + t.deepEqual(argv, { + x: 1234, + y: 5.67, + z: 1e7, + w: '10f', + hex: 0xdeadbeef, + _: [789], + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('already a number', function (t) { + var argv = parse(['-x', 1234, 789]); + t.deepEqual(argv, { x: 1234, _: [789] }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); diff --git a/node_modules/minimist/test/parse.js b/node_modules/minimist/test/parse.js new file mode 100644 index 00000000..65d9d909 --- /dev/null +++ b/node_modules/minimist/test/parse.js @@ -0,0 +1,209 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse(['--no-moo']), + { moo: false, _: [] }, + 'no' + ); + t.deepEqual( + parse(['-v', 'a', '-v', 'b', '-v', 'c']), + { v: ['a', 'b', 'c'], _: [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek', + ]), + { + c: true, + a: true, + t: true, + s: 'woo', + h: 'awesome', + b: true, + bool: true, + key: 'value', + multi: ['quux', 'baz'], + meep: false, + name: 'meowmers', + _: ['bare', '--not-a-flag', 'eek'], + } + ); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse(['-t', 'moo'], { boolean: 't' }); + t.deepEqual(argv, { t: true, _: ['moo'] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: ['t', 'verbose'], + default: { verbose: true }, + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'], + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('newlines in params', function (t) { + var args = parse(['-s', 'X\nX']); + t.deepEqual(args, { _: [], s: 'X\nX' }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse(['--s=X\nX']); + t.deepEqual(args, { _: [], s: 'X\nX' }); + t.end(); +}); + +test('strings', function (t) { + var s = parse(['-s', '0001234'], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse(['-x', '56'], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([' ', ' '], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function (t) { + var s = parse(['-s'], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse(['--str'], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse(['-art'], { + string: ['a', 't'], + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + +test('string and alias', function (t) { + var x = parse(['--str', '000123'], { + string: 's', + alias: { s: 'str' }, + }); + + t.equal(x.str, '000123'); + t.equal(typeof x.str, 'string'); + t.equal(x.s, '000123'); + t.equal(typeof x.s, 'string'); + + var y = parse(['-s', '000123'], { + string: 'str', + alias: { str: 's' }, + }); + + t.equal(y.str, '000123'); + t.equal(typeof y.str, 'string'); + t.equal(y.s, '000123'); + t.equal(typeof y.s, 'string'); + + var z = parse(['-s123'], { + alias: { str: ['s', 'S'] }, + string: ['str'], + }); + + t.deepEqual( + z, + { _: [], s: '123', S: '123', str: '123' }, + 'opt.string works with multiple aliases' + ); + t.end(); +}); + +test('slashBreak', function (t) { + t.same( + parse(['-I/foo/bar/baz']), + { I: '/foo/bar/baz', _: [] } + ); + t.same( + parse(['-xyz/foo/bar/baz']), + { x: true, y: true, z: '/foo/bar/baz', _: [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse(['-f', '11', '--zoom', '55'], { + alias: { z: 'zoom' }, + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse(['-f', '11', '--zoom', '55'], { + alias: { z: ['zm', 'zoom'] }, + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop', + ]); + + t.same(argv.foo, { + bar: 3, + baz: 4, + quux: { + quibble: 5, + o_O: true, + }, + }); + t.same(argv.beep, { boop: true }); + t.end(); +}); diff --git a/node_modules/minimist/test/parse_modified.js b/node_modules/minimist/test/parse_modified.js new file mode 100644 index 00000000..32965d13 --- /dev/null +++ b/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,11 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions', function (t) { + t.plan(1); + + var argv = parse(['-b', '123'], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: [123] }); +}); diff --git a/node_modules/minimist/test/proto.js b/node_modules/minimist/test/proto.js new file mode 100644 index 00000000..6e629dd3 --- /dev/null +++ b/node_modules/minimist/test/proto.js @@ -0,0 +1,64 @@ +'use strict'; + +/* eslint no-proto: 0 */ + +var parse = require('../'); +var test = require('tape'); + +test('proto pollution', function (t) { + var argv = parse(['--__proto__.x', '123']); + t.equal({}.x, undefined); + t.equal(argv.__proto__.x, undefined); + t.equal(argv.x, undefined); + t.end(); +}); + +test('proto pollution (array)', function (t) { + var argv = parse(['--x', '4', '--x', '5', '--x.__proto__.z', '789']); + t.equal({}.z, undefined); + t.deepEqual(argv.x, [4, 5]); + t.equal(argv.x.z, undefined); + t.equal(argv.x.__proto__.z, undefined); + t.end(); +}); + +test('proto pollution (number)', function (t) { + var argv = parse(['--x', '5', '--x.__proto__.z', '100']); + t.equal({}.z, undefined); + t.equal((4).z, undefined); + t.equal(argv.x, 5); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (string)', function (t) { + var argv = parse(['--x', 'abc', '--x.__proto__.z', 'def']); + t.equal({}.z, undefined); + t.equal('...'.z, undefined); + t.equal(argv.x, 'abc'); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (constructor)', function (t) { + var argv = parse(['--constructor.prototype.y', '123']); + t.equal({}.y, undefined); + t.equal(argv.y, undefined); + t.end(); +}); + +test('proto pollution (constructor function)', function (t) { + var argv = parse(['--_.concat.constructor.prototype.y', '123']); + function fnToBeTested() {} + t.equal(fnToBeTested.y, undefined); + t.equal(argv.y, undefined); + t.end(); +}); + +// powered by snyk - https://github.com/backstage/backstage/issues/10343 +test('proto pollution (constructor function) snyk', function (t) { + var argv = parse('--_.constructor.constructor.prototype.foo bar'.split(' ')); + t.equal(function () {}.foo, undefined); + t.equal(argv.y, undefined); + t.end(); +}); diff --git a/node_modules/minimist/test/short.js b/node_modules/minimist/test/short.js new file mode 100644 index 00000000..4a7b8438 --- /dev/null +++ b/node_modules/minimist/test/short.js @@ -0,0 +1,69 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse(['-n123']), { n: 123, _: [] }); + t.deepEqual( + parse(['-123', '456']), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse(['-b']), + { b: true, _: [] }, + 'short boolean' + ); + t.deepEqual( + parse(['foo', 'bar', 'baz']), + { _: ['foo', 'bar', 'baz'] }, + 'bare' + ); + t.deepEqual( + parse(['-cats']), + { c: true, a: true, t: true, s: true, _: [] }, + 'group' + ); + t.deepEqual( + parse(['-cats', 'meow']), + { c: true, a: true, t: true, s: 'meow', _: [] }, + 'short group next' + ); + t.deepEqual( + parse(['-h', 'localhost']), + { h: 'localhost', _: [] }, + 'short capture' + ); + t.deepEqual( + parse(['-h', 'localhost', '-p', '555']), + { h: 'localhost', p: 555, _: [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse(['-h', 'localhost', '-fp', '555', 'script.js']), + { + f: true, p: 555, h: 'localhost', + _: ['script.js'], + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse(['-h', 'localhost', '-fp', '555', 'script.js']), + { + f: true, p: 555, h: 'localhost', + _: ['script.js'], + } + ); + t.end(); +}); diff --git a/node_modules/minimist/test/stop_early.js b/node_modules/minimist/test/stop_early.js new file mode 100644 index 00000000..52a6a919 --- /dev/null +++ b/node_modules/minimist/test/stop_early.js @@ -0,0 +1,17 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('stops parsing on the first non-option when stopEarly is set', function (t) { + var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], { + stopEarly: true, + }); + + t.deepEqual(argv, { + aaa: 'bbb', + _: ['ccc', '--ddd'], + }); + + t.end(); +}); diff --git a/node_modules/minimist/test/unknown.js b/node_modules/minimist/test/unknown.js new file mode 100644 index 00000000..4f2e0ca4 --- /dev/null +++ b/node_modules/minimist/test/unknown.js @@ -0,0 +1,104 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('boolean and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['-h', 'true', '--derp', 'true']; + var regular = ['--herp', 'true', '-d', 'true']; + var opts = { + alias: { h: 'herp' }, + boolean: 'h', + unknown: unknownFn, + }; + parse(aliased, opts); + parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('flag boolean true any double hyphen argument is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], { + boolean: true, + unknown: unknownFn, + }); + t.same(unknown, ['--tacos=good', 'cow', '-p']); + t.same(argv, { + honk: true, + _: [], + }); + t.end(); +}); + +test('string and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['-h', 'hello', '--derp', 'goodbye']; + var regular = ['--herp', 'hello', '-d', 'moon']; + var opts = { + alias: { h: 'herp' }, + string: 'h', + unknown: unknownFn, + }; + parse(aliased, opts); + parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('default and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['-h', 'hello']; + var regular = ['--herp', 'hello']; + var opts = { + default: { h: 'bar' }, + alias: { h: 'herp' }, + unknown: unknownFn, + }; + parse(aliased, opts); + parse(regular, opts); + + t.same(unknown, []); + t.end(); + unknownFn(); // exercise fn for 100% coverage +}); + +test('value following -- is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['--bad', '--', 'good', 'arg']; + var opts = { + '--': true, + unknown: unknownFn, + }; + var argv = parse(aliased, opts); + + t.same(unknown, ['--bad']); + t.same(argv, { + '--': ['good', 'arg'], + _: [], + }); + t.end(); +}); diff --git a/node_modules/minimist/test/whitespace.js b/node_modules/minimist/test/whitespace.js new file mode 100644 index 00000000..4fdaf1d3 --- /dev/null +++ b/node_modules/minimist/test/whitespace.js @@ -0,0 +1,10 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace', function (t) { + t.plan(1); + var x = parse(['-x', '\t']).x; + t.equal(x, '\t'); +}); diff --git a/node_modules/minipass/LICENSE.md b/node_modules/minipass/LICENSE.md new file mode 100644 index 00000000..c5402b95 --- /dev/null +++ b/node_modules/minipass/LICENSE.md @@ -0,0 +1,55 @@ +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** diff --git a/node_modules/minipass/README.md b/node_modules/minipass/README.md new file mode 100644 index 00000000..11263305 --- /dev/null +++ b/node_modules/minipass/README.md @@ -0,0 +1,825 @@ +# minipass + +A _very_ minimal implementation of a [PassThrough +stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough) + +[It's very +fast](https://docs.google.com/spreadsheets/d/1K_HR5oh3r80b8WVMWCPPjfuWXUgfkmhlX7FGI6JJ8tY/edit?usp=sharing) +for objects, strings, and buffers. + +Supports `pipe()`ing (including multi-`pipe()` and backpressure +transmission), buffering data until either a `data` event handler +or `pipe()` is added (so you don't lose the first chunk), and +most other cases where PassThrough is a good idea. + +There is a `read()` method, but it's much more efficient to +consume data from this stream via `'data'` events or by calling +`pipe()` into some other stream. Calling `read()` requires the +buffer to be flattened in some cases, which requires copying +memory. + +If you set `objectMode: true` in the options, then whatever is +written will be emitted. Otherwise, it'll do a minimal amount of +Buffer copying to ensure proper Streams semantics when `read(n)` +is called. + +`objectMode` can only be set at instantiation. Attempting to +write something other than a String or Buffer without having set +`objectMode` in the options will throw an error. + +This is not a `through` or `through2` stream. It doesn't +transform the data, it just passes it right through. If you want +to transform the data, extend the class, and override the +`write()` method. Once you're done transforming the data however +you want, call `super.write()` with the transform output. + +For some examples of streams that extend Minipass in various +ways, check out: + +- [minizlib](http://npm.im/minizlib) +- [fs-minipass](http://npm.im/fs-minipass) +- [tar](http://npm.im/tar) +- [minipass-collect](http://npm.im/minipass-collect) +- [minipass-flush](http://npm.im/minipass-flush) +- [minipass-pipeline](http://npm.im/minipass-pipeline) +- [tap](http://npm.im/tap) +- [tap-parser](http://npm.im/tap-parser) +- [treport](http://npm.im/treport) +- [minipass-fetch](http://npm.im/minipass-fetch) +- [pacote](http://npm.im/pacote) +- [make-fetch-happen](http://npm.im/make-fetch-happen) +- [cacache](http://npm.im/cacache) +- [ssri](http://npm.im/ssri) +- [npm-registry-fetch](http://npm.im/npm-registry-fetch) +- [minipass-json-stream](http://npm.im/minipass-json-stream) +- [minipass-sized](http://npm.im/minipass-sized) + +## Usage in TypeScript + +The `Minipass` class takes three type template definitions: + +- `RType` the type being read, which defaults to `Buffer`. If + `RType` is `string`, then the constructor _must_ get an options + object specifying either an `encoding` or `objectMode: true`. + If it's anything other than `string` or `Buffer`, then it + _must_ get an options object specifying `objectMode: true`. +- `WType` the type being written. If `RType` is `Buffer` or + `string`, then this defaults to `ContiguousData` (Buffer, + string, ArrayBuffer, or ArrayBufferView). Otherwise, it + defaults to `RType`. +- `Events` type mapping event names to the arguments emitted + with that event, which extends `Minipass.Events`. + +To declare types for custom events in subclasses, extend the +third parameter with your own event signatures. For example: + +```js +import { Minipass } from 'minipass' + +// a NDJSON stream that emits 'jsonError' when it can't stringify +export interface Events extends Minipass.Events { + jsonError: [e: Error] +} + +export class NDJSONStream extends Minipass { + constructor() { + super({ objectMode: true }) + } + + // data is type `any` because that's WType + write(data, encoding, cb) { + try { + const json = JSON.stringify(data) + return super.write(json + '\n', encoding, cb) + } catch (er) { + if (!er instanceof Error) { + er = Object.assign(new Error('json stringify failed'), { + cause: er, + }) + } + // trying to emit with something OTHER than an error will + // fail, because we declared the event arguments type. + this.emit('jsonError', er) + } + } +} + +const s = new NDJSONStream() +s.on('jsonError', e => { + // here, TS knows that e is an Error +}) +``` + +Emitting/handling events that aren't declared in this way is +fine, but the arguments will be typed as `unknown`. + +## Differences from Node.js Streams + +There are several things that make Minipass streams different +from (and in some ways superior to) Node.js core streams. + +Please read these caveats if you are familiar with node-core +streams and intend to use Minipass streams in your programs. + +You can avoid most of these differences entirely (for a very +small performance penalty) by setting `{async: true}` in the +constructor options. + +### Timing + +Minipass streams are designed to support synchronous use-cases. +Thus, data is emitted as soon as it is available, always. It is +buffered until read, but no longer. Another way to look at it is +that Minipass streams are exactly as synchronous as the logic +that writes into them. + +This can be surprising if your code relies on +`PassThrough.write()` always providing data on the next tick +rather than the current one, or being able to call `resume()` and +not have the entire buffer disappear immediately. + +However, without this synchronicity guarantee, there would be no +way for Minipass to achieve the speeds it does, or support the +synchronous use cases that it does. Simply put, waiting takes +time. + +This non-deferring approach makes Minipass streams much easier to +reason about, especially in the context of Promises and other +flow-control mechanisms. + +Example: + +```js +// hybrid module, either works +import { Minipass } from 'minipass' +// or: +const { Minipass } = require('minipass') + +const stream = new Minipass() +stream.on('data', () => console.log('data event')) +console.log('before write') +stream.write('hello') +console.log('after write') +// output: +// before write +// data event +// after write +``` + +### Exception: Async Opt-In + +If you wish to have a Minipass stream with behavior that more +closely mimics Node.js core streams, you can set the stream in +async mode either by setting `async: true` in the constructor +options, or by setting `stream.async = true` later on. + +```js +// hybrid module, either works +import { Minipass } from 'minipass' +// or: +const { Minipass } = require('minipass') + +const asyncStream = new Minipass({ async: true }) +asyncStream.on('data', () => console.log('data event')) +console.log('before write') +asyncStream.write('hello') +console.log('after write') +// output: +// before write +// after write +// data event <-- this is deferred until the next tick +``` + +Switching _out_ of async mode is unsafe, as it could cause data +corruption, and so is not enabled. Example: + +```js +import { Minipass } from 'minipass' +const stream = new Minipass({ encoding: 'utf8' }) +stream.on('data', chunk => console.log(chunk)) +stream.async = true +console.log('before writes') +stream.write('hello') +setStreamSyncAgainSomehow(stream) // <-- this doesn't actually exist! +stream.write('world') +console.log('after writes') +// hypothetical output would be: +// before writes +// world +// after writes +// hello +// NOT GOOD! +``` + +To avoid this problem, once set into async mode, any attempt to +make the stream sync again will be ignored. + +```js +const { Minipass } = require('minipass') +const stream = new Minipass({ encoding: 'utf8' }) +stream.on('data', chunk => console.log(chunk)) +stream.async = true +console.log('before writes') +stream.write('hello') +stream.async = false // <-- no-op, stream already async +stream.write('world') +console.log('after writes') +// actual output: +// before writes +// after writes +// hello +// world +``` + +### No High/Low Water Marks + +Node.js core streams will optimistically fill up a buffer, +returning `true` on all writes until the limit is hit, even if +the data has nowhere to go. Then, they will not attempt to draw +more data in until the buffer size dips below a minimum value. + +Minipass streams are much simpler. The `write()` method will +return `true` if the data has somewhere to go (which is to say, +given the timing guarantees, that the data is already there by +the time `write()` returns). + +If the data has nowhere to go, then `write()` returns false, and +the data sits in a buffer, to be drained out immediately as soon +as anyone consumes it. + +Since nothing is ever buffered unnecessarily, there is much less +copying data, and less bookkeeping about buffer capacity levels. + +### Hazards of Buffering (or: Why Minipass Is So Fast) + +Since data written to a Minipass stream is immediately written +all the way through the pipeline, and `write()` always returns +true/false based on whether the data was fully flushed, +backpressure is communicated immediately to the upstream caller. +This minimizes buffering. + +Consider this case: + +```js +const { PassThrough } = require('stream') +const p1 = new PassThrough({ highWaterMark: 1024 }) +const p2 = new PassThrough({ highWaterMark: 1024 }) +const p3 = new PassThrough({ highWaterMark: 1024 }) +const p4 = new PassThrough({ highWaterMark: 1024 }) + +p1.pipe(p2).pipe(p3).pipe(p4) +p4.on('data', () => console.log('made it through')) + +// this returns false and buffers, then writes to p2 on next tick (1) +// p2 returns false and buffers, pausing p1, then writes to p3 on next tick (2) +// p3 returns false and buffers, pausing p2, then writes to p4 on next tick (3) +// p4 returns false and buffers, pausing p3, then emits 'data' and 'drain' +// on next tick (4) +// p3 sees p4's 'drain' event, and calls resume(), emitting 'resume' and +// 'drain' on next tick (5) +// p2 sees p3's 'drain', calls resume(), emits 'resume' and 'drain' on next tick (6) +// p1 sees p2's 'drain', calls resume(), emits 'resume' and 'drain' on next +// tick (7) + +p1.write(Buffer.alloc(2048)) // returns false +``` + +Along the way, the data was buffered and deferred at each stage, +and multiple event deferrals happened, for an unblocked pipeline +where it was perfectly safe to write all the way through! + +Furthermore, setting a `highWaterMark` of `1024` might lead +someone reading the code to think an advisory maximum of 1KiB is +being set for the pipeline. However, the actual advisory +buffering level is the _sum_ of `highWaterMark` values, since +each one has its own bucket. + +Consider the Minipass case: + +```js +const m1 = new Minipass() +const m2 = new Minipass() +const m3 = new Minipass() +const m4 = new Minipass() + +m1.pipe(m2).pipe(m3).pipe(m4) +m4.on('data', () => console.log('made it through')) + +// m1 is flowing, so it writes the data to m2 immediately +// m2 is flowing, so it writes the data to m3 immediately +// m3 is flowing, so it writes the data to m4 immediately +// m4 is flowing, so it fires the 'data' event immediately, returns true +// m4's write returned true, so m3 is still flowing, returns true +// m3's write returned true, so m2 is still flowing, returns true +// m2's write returned true, so m1 is still flowing, returns true +// No event deferrals or buffering along the way! + +m1.write(Buffer.alloc(2048)) // returns true +``` + +It is extremely unlikely that you _don't_ want to buffer any data +written, or _ever_ buffer data that can be flushed all the way +through. Neither node-core streams nor Minipass ever fail to +buffer written data, but node-core streams do a lot of +unnecessary buffering and pausing. + +As always, the faster implementation is the one that does less +stuff and waits less time to do it. + +### Immediately emit `end` for empty streams (when not paused) + +If a stream is not paused, and `end()` is called before writing +any data into it, then it will emit `end` immediately. + +If you have logic that occurs on the `end` event which you don't +want to potentially happen immediately (for example, closing file +descriptors, moving on to the next entry in an archive parse +stream, etc.) then be sure to call `stream.pause()` on creation, +and then `stream.resume()` once you are ready to respond to the +`end` event. + +However, this is _usually_ not a problem because: + +### Emit `end` When Asked + +One hazard of immediately emitting `'end'` is that you may not +yet have had a chance to add a listener. In order to avoid this +hazard, Minipass streams safely re-emit the `'end'` event if a +new listener is added after `'end'` has been emitted. + +Ie, if you do `stream.on('end', someFunction)`, and the stream +has already emitted `end`, then it will call the handler right +away. (You can think of this somewhat like attaching a new +`.then(fn)` to a previously-resolved Promise.) + +To prevent calling handlers multiple times who would not expect +multiple ends to occur, all listeners are removed from the +`'end'` event whenever it is emitted. + +### Emit `error` When Asked + +The most recent error object passed to the `'error'` event is +stored on the stream. If a new `'error'` event handler is added, +and an error was previously emitted, then the event handler will +be called immediately (or on `process.nextTick` in the case of +async streams). + +This makes it much more difficult to end up trying to interact +with a broken stream, if the error handler is added after an +error was previously emitted. + +### Impact of "immediate flow" on Tee-streams + +A "tee stream" is a stream piping to multiple destinations: + +```js +const tee = new Minipass() +t.pipe(dest1) +t.pipe(dest2) +t.write('foo') // goes to both destinations +``` + +Since Minipass streams _immediately_ process any pending data +through the pipeline when a new pipe destination is added, this +can have surprising effects, especially when a stream comes in +from some other function and may or may not have data in its +buffer. + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.pipe(dest1) // 'foo' chunk flows to dest1 immediately, and is gone +src.pipe(dest2) // gets nothing! +``` + +One solution is to create a dedicated tee-stream junction that +pipes to both locations, and then pipe to _that_ instead. + +```js +// Safe example: tee to both places +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.pipe(dest1) +tee.pipe(dest2) +src.pipe(tee) // tee gets 'foo', pipes to both locations +``` + +The same caveat applies to `on('data')` event listeners. The +first one added will _immediately_ receive all of the data, +leaving nothing for the second: + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.on('data', handler1) // receives 'foo' right away +src.on('data', handler2) // nothing to see here! +``` + +Using a dedicated tee-stream can be used in this case as well: + +```js +// Safe example: tee to both data handlers +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.on('data', handler1) +tee.on('data', handler2) +src.pipe(tee) +``` + +All of the hazards in this section are avoided by setting `{ +async: true }` in the Minipass constructor, or by setting +`stream.async = true` afterwards. Note that this does add some +overhead, so should only be done in cases where you are willing +to lose a bit of performance in order to avoid having to refactor +program logic. + +## USAGE + +It's a stream! Use it like a stream and it'll most likely do what +you want. + +```js +import { Minipass } from 'minipass' +const mp = new Minipass(options) // options is optional +mp.write('foo') +mp.pipe(someOtherStream) +mp.end('bar') +``` + +### OPTIONS + +- `encoding` How would you like the data coming _out_ of the + stream to be encoded? Accepts any values that can be passed to + `Buffer.toString()`. +- `objectMode` Emit data exactly as it comes in. This will be + flipped on by default if you write() something other than a + string or Buffer at any point. Setting `objectMode: true` will + prevent setting any encoding value. +- `async` Defaults to `false`. Set to `true` to defer data + emission until next tick. This reduces performance slightly, + but makes Minipass streams use timing behavior closer to Node + core streams. See [Timing](#timing) for more details. +- `signal` An `AbortSignal` that will cause the stream to unhook + itself from everything and become as inert as possible. Note + that providing a `signal` parameter will make `'error'` events + no longer throw if they are unhandled, but they will still be + emitted to handlers if any are attached. + +### API + +Implements the user-facing portions of Node.js's `Readable` and +`Writable` streams. + +### Methods + +- `write(chunk, [encoding], [callback])` - Put data in. (Note + that, in the base Minipass class, the same data will come out.) + Returns `false` if the stream will buffer the next write, or + true if it's still in "flowing" mode. +- `end([chunk, [encoding]], [callback])` - Signal that you have + no more data to write. This will queue an `end` event to be + fired when all the data has been consumed. +- `pause()` - No more data for a while, please. This also + prevents `end` from being emitted for empty streams until the + stream is resumed. +- `resume()` - Resume the stream. If there's data in the buffer, + it is all discarded. Any buffered events are immediately + emitted. +- `pipe(dest)` - Send all output to the stream provided. When + data is emitted, it is immediately written to any and all pipe + destinations. (Or written on next tick in `async` mode.) +- `unpipe(dest)` - Stop piping to the destination stream. This is + immediate, meaning that any asynchronously queued data will + _not_ make it to the destination when running in `async` mode. + - `options.end` - Boolean, end the destination stream when the + source stream ends. Default `true`. + - `options.proxyErrors` - Boolean, proxy `error` events from + the source stream to the destination stream. Note that errors + are _not_ proxied after the pipeline terminates, either due + to the source emitting `'end'` or manually unpiping with + `src.unpipe(dest)`. Default `false`. +- `on(ev, fn)`, `emit(ev, fn)` - Minipass streams are + EventEmitters. Some events are given special treatment, + however. (See below under "events".) +- `promise()` - Returns a Promise that resolves when the stream + emits `end`, or rejects if the stream emits `error`. +- `collect()` - Return a Promise that resolves on `end` with an + array containing each chunk of data that was emitted, or + rejects if the stream emits `error`. Note that this consumes + the stream data. +- `concat()` - Same as `collect()`, but concatenates the data + into a single Buffer object. Will reject the returned promise + if the stream is in objectMode, or if it goes into objectMode + by the end of the data. +- `read(n)` - Consume `n` bytes of data out of the buffer. If `n` + is not provided, then consume all of it. If `n` bytes are not + available, then it returns null. **Note** consuming streams in + this way is less efficient, and can lead to unnecessary Buffer + copying. +- `destroy([er])` - Destroy the stream. If an error is provided, + then an `'error'` event is emitted. If the stream has a + `close()` method, and has not emitted a `'close'` event yet, + then `stream.close()` will be called. Any Promises returned by + `.promise()`, `.collect()` or `.concat()` will be rejected. + After being destroyed, writing to the stream will emit an + error. No more data will be emitted if the stream is destroyed, + even if it was previously buffered. + +### Properties + +- `bufferLength` Read-only. Total number of bytes buffered, or in + the case of objectMode, the total number of objects. +- `encoding` Read-only. The encoding that has been set. +- `flowing` Read-only. Boolean indicating whether a chunk written + to the stream will be immediately emitted. +- `emittedEnd` Read-only. Boolean indicating whether the end-ish + events (ie, `end`, `prefinish`, `finish`) have been emitted. + Note that listening on any end-ish event will immediateyl + re-emit it if it has already been emitted. +- `writable` Whether the stream is writable. Default `true`. Set + to `false` when `end()` +- `readable` Whether the stream is readable. Default `true`. +- `pipes` An array of Pipe objects referencing streams that this + stream is piping into. +- `destroyed` A getter that indicates whether the stream was + destroyed. +- `paused` True if the stream has been explicitly paused, + otherwise false. +- `objectMode` Indicates whether the stream is in `objectMode`. +- `aborted` Readonly property set when the `AbortSignal` + dispatches an `abort` event. + +### Events + +- `data` Emitted when there's data to read. Argument is the data + to read. This is never emitted while not flowing. If a listener + is attached, that will resume the stream. +- `end` Emitted when there's no more data to read. This will be + emitted immediately for empty streams when `end()` is called. + If a listener is attached, and `end` was already emitted, then + it will be emitted again. All listeners are removed when `end` + is emitted. +- `prefinish` An end-ish event that follows the same logic as + `end` and is emitted in the same conditions where `end` is + emitted. Emitted after `'end'`. +- `finish` An end-ish event that follows the same logic as `end` + and is emitted in the same conditions where `end` is emitted. + Emitted after `'prefinish'`. +- `close` An indication that an underlying resource has been + released. Minipass does not emit this event, but will defer it + until after `end` has been emitted, since it throws off some + stream libraries otherwise. +- `drain` Emitted when the internal buffer empties, and it is + again suitable to `write()` into the stream. +- `readable` Emitted when data is buffered and ready to be read + by a consumer. +- `resume` Emitted when stream changes state from buffering to + flowing mode. (Ie, when `resume` is called, `pipe` is called, + or a `data` event listener is added.) + +### Static Methods + +- `Minipass.isStream(stream)` Returns `true` if the argument is a + stream, and false otherwise. To be considered a stream, the + object must be either an instance of Minipass, or an + EventEmitter that has either a `pipe()` method, or both + `write()` and `end()` methods. (Pretty much any stream in + node-land will return `true` for this.) + +## EXAMPLES + +Here are some examples of things you can do with Minipass +streams. + +### simple "are you done yet" promise + +```js +mp.promise().then( + () => { + // stream is finished + }, + er => { + // stream emitted an error + } +) +``` + +### collecting + +```js +mp.collect().then(all => { + // all is an array of all the data emitted + // encoding is supported in this case, so + // so the result will be a collection of strings if + // an encoding is specified, or buffers/objects if not. + // + // In an async function, you may do + // const data = await stream.collect() +}) +``` + +### collecting into a single blob + +This is a bit slower because it concatenates the data into one +chunk for you, but if you're going to do it yourself anyway, it's +convenient this way: + +```js +mp.concat().then(onebigchunk => { + // onebigchunk is a string if the stream + // had an encoding set, or a buffer otherwise. +}) +``` + +### iteration + +You can iterate over streams synchronously or asynchronously in +platforms that support it. + +Synchronous iteration will end when the currently available data +is consumed, even if the `end` event has not been reached. In +string and buffer mode, the data is concatenated, so unless +multiple writes are occurring in the same tick as the `read()`, +sync iteration loops will generally only have a single iteration. + +To consume chunks in this way exactly as they have been written, +with no flattening, create the stream with the `{ objectMode: +true }` option. + +```js +const mp = new Minipass({ objectMode: true }) +mp.write('a') +mp.write('b') +for (let letter of mp) { + console.log(letter) // a, b +} +mp.write('c') +mp.write('d') +for (let letter of mp) { + console.log(letter) // c, d +} +mp.write('e') +mp.end() +for (let letter of mp) { + console.log(letter) // e +} +for (let letter of mp) { + console.log(letter) // nothing +} +``` + +Asynchronous iteration will continue until the end event is reached, +consuming all of the data. + +```js +const mp = new Minipass({ encoding: 'utf8' }) + +// some source of some data +let i = 5 +const inter = setInterval(() => { + if (i-- > 0) mp.write(Buffer.from('foo\n', 'utf8')) + else { + mp.end() + clearInterval(inter) + } +}, 100) + +// consume the data with asynchronous iteration +async function consume() { + for await (let chunk of mp) { + console.log(chunk) + } + return 'ok' +} + +consume().then(res => console.log(res)) +// logs `foo\n` 5 times, and then `ok` +``` + +### subclass that `console.log()`s everything written into it + +```js +class Logger extends Minipass { + write(chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end(chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } +} + +someSource.pipe(new Logger()).pipe(someDest) +``` + +### same thing, but using an inline anonymous class + +```js +// js classes are fun +someSource + .pipe( + new (class extends Minipass { + emit(ev, ...data) { + // let's also log events, because debugging some weird thing + console.log('EMIT', ev) + return super.emit(ev, ...data) + } + write(chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end(chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } + })() + ) + .pipe(someDest) +``` + +### subclass that defers 'end' for some reason + +```js +class SlowEnd extends Minipass { + emit(ev, ...args) { + if (ev === 'end') { + console.log('going to end, hold on a sec') + setTimeout(() => { + console.log('ok, ready to end now') + super.emit('end', ...args) + }, 100) + return true + } else { + return super.emit(ev, ...args) + } + } +} +``` + +### transform that creates newline-delimited JSON + +```js +class NDJSONEncode extends Minipass { + write(obj, cb) { + try { + // JSON.stringify can throw, emit an error on that + return super.write(JSON.stringify(obj) + '\n', 'utf8', cb) + } catch (er) { + this.emit('error', er) + } + } + end(obj, cb) { + if (typeof obj === 'function') { + cb = obj + obj = undefined + } + if (obj !== undefined) { + this.write(obj) + } + return super.end(cb) + } +} +``` + +### transform that parses newline-delimited JSON + +```js +class NDJSONDecode extends Minipass { + constructor(options) { + // always be in object mode, as far as Minipass is concerned + super({ objectMode: true }) + this._jsonBuffer = '' + } + write(chunk, encoding, cb) { + if ( + typeof chunk === 'string' && + typeof encoding === 'string' && + encoding !== 'utf8' + ) { + chunk = Buffer.from(chunk, encoding).toString() + } else if (Buffer.isBuffer(chunk)) { + chunk = chunk.toString() + } + if (typeof encoding === 'function') { + cb = encoding + } + const jsonData = (this._jsonBuffer + chunk).split('\n') + this._jsonBuffer = jsonData.pop() + for (let i = 0; i < jsonData.length; i++) { + try { + // JSON.parse can throw, emit an error on that + super.write(JSON.parse(jsonData[i])) + } catch (er) { + this.emit('error', er) + continue + } + } + if (cb) cb() + } +} +``` diff --git a/node_modules/minipass/dist/commonjs/index.d.ts b/node_modules/minipass/dist/commonjs/index.d.ts new file mode 100644 index 00000000..3e75b578 --- /dev/null +++ b/node_modules/minipass/dist/commonjs/index.d.ts @@ -0,0 +1,545 @@ +import { EventEmitter } from 'node:events'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Same as StringDecoder, but exposing the `lastNeed` flag on the type + */ +type SD = StringDecoder & { + lastNeed: boolean; +}; +export type { SD, Pipe, PipeProxyErrors }; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export declare const isStream: (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; +}) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; +}) | (NodeJS.ReadStream & { + fd: number; +}) | (NodeJS.WriteStream & { + fd: number; +}); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export declare const isReadable: (s: any) => s is Minipass.Readable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export declare const isWritable: (s: any) => s is Minipass.Readable; +declare const EOF: unique symbol; +declare const MAYBE_EMIT_END: unique symbol; +declare const EMITTED_END: unique symbol; +declare const EMITTING_END: unique symbol; +declare const EMITTED_ERROR: unique symbol; +declare const CLOSED: unique symbol; +declare const READ: unique symbol; +declare const FLUSH: unique symbol; +declare const FLUSHCHUNK: unique symbol; +declare const ENCODING: unique symbol; +declare const DECODER: unique symbol; +declare const FLOWING: unique symbol; +declare const PAUSED: unique symbol; +declare const RESUME: unique symbol; +declare const BUFFER: unique symbol; +declare const PIPES: unique symbol; +declare const BUFFERLENGTH: unique symbol; +declare const BUFFERPUSH: unique symbol; +declare const BUFFERSHIFT: unique symbol; +declare const OBJECTMODE: unique symbol; +declare const DESTROYED: unique symbol; +declare const ERROR: unique symbol; +declare const EMITDATA: unique symbol; +declare const EMITEND: unique symbol; +declare const EMITEND2: unique symbol; +declare const ASYNC: unique symbol; +declare const ABORT: unique symbol; +declare const ABORTED: unique symbol; +declare const SIGNAL: unique symbol; +declare const DATALISTENERS: unique symbol; +declare const DISCARDED: unique symbol; +/** + * Options that may be passed to stream.pipe() + */ +export interface PipeOptions { + /** + * end the destination stream when the source stream ends + */ + end?: boolean; + /** + * proxy errors from the source stream to the destination stream + */ + proxyErrors?: boolean; +} +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +declare class Pipe { + src: Minipass; + dest: Minipass; + opts: PipeOptions; + ondrain: () => any; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); + unpipe(): void; + proxyErrors(_er: any): void; + end(): void; +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +declare class PipeProxyErrors extends Pipe { + unpipe(): void; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); +} +export declare namespace Minipass { + /** + * Encoding used to create a stream that outputs strings rather than + * Buffer objects. + */ + export type Encoding = BufferEncoding | 'buffer' | null; + /** + * Any stream that Minipass can pipe into + */ + export type Writable = Minipass | NodeJS.WriteStream | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); + /** + * Any stream that can be read from + */ + export type Readable = Minipass | NodeJS.ReadStream | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }); + /** + * Utility type that can be iterated sync or async + */ + export type DualIterable = Iterable & AsyncIterable; + type EventArguments = Record; + /** + * The listing of events that a Minipass class can emit. + * Extend this when extending the Minipass class, and pass as + * the third template argument. The key is the name of the event, + * and the value is the argument list. + * + * Any undeclared events will still be allowed, but the handler will get + * arguments as `unknown[]`. + */ + export interface Events extends EventArguments { + readable: []; + data: [chunk: RType]; + error: [er: unknown]; + abort: [reason: unknown]; + drain: []; + resume: []; + end: []; + finish: []; + prefinish: []; + close: []; + [DESTROYED]: [er?: unknown]; + [ERROR]: [er: unknown]; + } + /** + * String or buffer-like data that can be joined and sliced + */ + export type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string; + export type BufferOrString = Buffer | string; + /** + * Options passed to the Minipass constructor. + */ + export type SharedOptions = { + /** + * Defer all data emission and other events until the end of the + * current tick, similar to Node core streams + */ + async?: boolean; + /** + * A signal which will abort the stream + */ + signal?: AbortSignal; + /** + * Output string encoding. Set to `null` or `'buffer'` (or omit) to + * emit Buffer objects rather than strings. + * + * Conflicts with `objectMode` + */ + encoding?: BufferEncoding | null | 'buffer'; + /** + * Output data exactly as it was written, supporting non-buffer/string + * data (such as arbitrary objects, falsey values, etc.) + * + * Conflicts with `encoding` + */ + objectMode?: boolean; + }; + /** + * Options for a string encoded output + */ + export type EncodingOptions = SharedOptions & { + encoding: BufferEncoding; + objectMode?: false; + }; + /** + * Options for contiguous data buffer output + */ + export type BufferOptions = SharedOptions & { + encoding?: null | 'buffer'; + objectMode?: false; + }; + /** + * Options for objectMode arbitrary output + */ + export type ObjectModeOptions = SharedOptions & { + objectMode: true; + encoding?: null; + }; + /** + * Utility type to determine allowed options based on read type + */ + export type Options = ObjectModeOptions | (T extends string ? EncodingOptions : T extends Buffer ? BufferOptions : SharedOptions); + export {}; +} +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export declare class Minipass = Minipass.Events> extends EventEmitter implements Minipass.DualIterable { + [FLOWING]: boolean; + [PAUSED]: boolean; + [PIPES]: Pipe[]; + [BUFFER]: RType[]; + [OBJECTMODE]: boolean; + [ENCODING]: BufferEncoding | null; + [ASYNC]: boolean; + [DECODER]: SD | null; + [EOF]: boolean; + [EMITTED_END]: boolean; + [EMITTING_END]: boolean; + [CLOSED]: boolean; + [EMITTED_ERROR]: unknown; + [BUFFERLENGTH]: number; + [DESTROYED]: boolean; + [SIGNAL]?: AbortSignal; + [ABORTED]: boolean; + [DATALISTENERS]: number; + [DISCARDED]: boolean; + /** + * true if the stream can be written + */ + writable: boolean; + /** + * true if the stream can be read + */ + readable: boolean; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args: [Minipass.ObjectModeOptions] | (RType extends Buffer ? [] | [Minipass.Options] : [Minipass.Options])); + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength(): number; + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding(): BufferEncoding | null; + /** + * @deprecated - This is a read only property + */ + set encoding(_enc: BufferEncoding | null); + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc: Minipass.Encoding): void; + /** + * True if this is an objectMode stream + */ + get objectMode(): boolean; + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om: boolean); + /** + * true if this is an async stream + */ + get ['async'](): boolean; + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a: boolean); + [ABORT](): void; + /** + * True if the stream has been aborted. + */ + get aborted(): boolean; + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_: boolean); + /** + * Write data into the stream + * + * If the chunk written is a string, and encoding is not specified, then + * `utf8` will be assumed. If the stream encoding matches the encoding of + * a written string, and the state of the string decoder allows it, then + * the string will be passed through to either the output or the internal + * buffer without any processing. Otherwise, it will be turned into a + * Buffer object for processing into the desired encoding. + * + * If provided, `cb` function is called immediately before return for + * sync streams, or on next tick for async streams, because for this + * base class, a chunk is considered "processed" once it is accepted + * and either emitted or buffered. That is, the callback does not indicate + * that the chunk has been eventually emitted, though of course child + * classes can override this function to do whatever processing is required + * and call `super.write(...)` only once processing is completed. + */ + write(chunk: WType, cb?: () => void): boolean; + write(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): boolean; + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n?: number | null): RType | null; + [READ](n: number | null, chunk: RType): RType; + /** + * End the stream, optionally providing a final write. + * + * See {@link Minipass#write} for argument descriptions + */ + end(cb?: () => void): this; + end(chunk: WType, cb?: () => void): this; + end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this; + [RESUME](): void; + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume(): void; + /** + * Pause the stream + */ + pause(): void; + /** + * true if the stream has been forcibly destroyed + */ + get destroyed(): boolean; + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing(): boolean; + /** + * true if the stream is currently in a paused state + */ + get paused(): boolean; + [BUFFERPUSH](chunk: RType): void; + [BUFFERSHIFT](): RType; + [FLUSH](noDrain?: boolean): void; + [FLUSHCHUNK](chunk: RType): boolean; + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest: W, opts?: PipeOptions): W; + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest: W): void; + /** + * Alias for {@link Minipass#on} + */ + addListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev?: Event): this; + /** + * true if the 'end' event has been emitted + */ + get emittedEnd(): boolean; + [MAYBE_EMIT_END](): void; + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev: Event, ...args: Events[Event]): boolean; + [EMITDATA](data: RType): boolean; + [EMITEND](): boolean; + [EMITEND2](): boolean; + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + collect(): Promise; + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + concat(): Promise; + /** + * Return a void Promise that resolves once the stream ends. + */ + promise(): Promise; + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator](): AsyncGenerator; + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator](): Generator; + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er?: unknown): this; + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream(): (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }) | (NodeJS.ReadStream & { + fd: number; + }) | (NodeJS.WriteStream & { + fd: number; + }); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/minipass/dist/commonjs/index.d.ts.map b/node_modules/minipass/dist/commonjs/index.d.ts.map new file mode 100644 index 00000000..7bce611b --- /dev/null +++ b/node_modules/minipass/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;GAEG;AACH,KAAK,EAAE,GAAG,aAAa,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAA;AAE/C,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;EAQH,CAAA;AAElB;;GAEG;AACH,eAAO,MAAM,UAAU,oCAM2C,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,UAAU,oCAK6B,CAAA;AAEpD,QAAA,MAAM,GAAG,eAAgB,CAAA;AACzB,QAAA,MAAM,cAAc,eAAyB,CAAA;AAC7C,QAAA,MAAM,WAAW,eAAuB,CAAA;AACxC,QAAA,MAAM,YAAY,eAAwB,CAAA;AAC1C,QAAA,MAAM,aAAa,eAAyB,CAAA;AAC5C,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,OAAO,eAA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OAuBG;IACH,IAAI,CAAC,KAAK,SAAS,MAAM,MAAM,EAC7B,EAAE,EAAE,KAAK,EACT,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GACrB,OAAO,CAgDT;IAED,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,WAOrB;IAED,CAAC,OAAO,CAAC,YAQR;IAED,CAAC,QAAQ,CAAC,YAiBT;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAezD;IAED;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAU7B;IAED;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAM7B;IAED;;;;OAIG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CA4D1D;IAED;;;;;OAKG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAiChD;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,QAwBnB;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;;;;;;;;;;;OAElB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/minipass/dist/commonjs/index.js b/node_modules/minipass/dist/commonjs/index.js new file mode 100644 index 00000000..91f3a5cf --- /dev/null +++ b/node_modules/minipass/dist/commonjs/index.js @@ -0,0 +1,1038 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Minipass = exports.isWritable = exports.isReadable = exports.isStream = void 0; +const proc = typeof process === 'object' && process + ? process + : { + stdout: null, + stderr: null, + }; +const node_events_1 = require("node:events"); +const node_stream_1 = __importDefault(require("node:stream")); +const node_string_decoder_1 = require("node:string_decoder"); +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +const isStream = (s) => !!s && + typeof s === 'object' && + (s instanceof Minipass || + s instanceof node_stream_1.default || + (0, exports.isReadable)(s) || + (0, exports.isWritable)(s)) +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +; +exports.isStream = isStream; +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +const isReadable = (s) => !!s && + typeof s === 'object' && + s instanceof node_events_1.EventEmitter && + typeof s.pipe === 'function' && + // node core Writable streams have a pipe() method, but it throws + s.pipe !== node_stream_1.default.Writable.prototype.pipe +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +; +exports.isReadable = isReadable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +const isWritable = (s) => !!s && + typeof s === 'object' && + s instanceof node_events_1.EventEmitter && + typeof s.write === 'function' && + typeof s.end === 'function'; +exports.isWritable = isWritable; +const EOF = Symbol('EOF'); +const MAYBE_EMIT_END = Symbol('maybeEmitEnd'); +const EMITTED_END = Symbol('emittedEnd'); +const EMITTING_END = Symbol('emittingEnd'); +const EMITTED_ERROR = Symbol('emittedError'); +const CLOSED = Symbol('closed'); +const READ = Symbol('read'); +const FLUSH = Symbol('flush'); +const FLUSHCHUNK = Symbol('flushChunk'); +const ENCODING = Symbol('encoding'); +const DECODER = Symbol('decoder'); +const FLOWING = Symbol('flowing'); +const PAUSED = Symbol('paused'); +const RESUME = Symbol('resume'); +const BUFFER = Symbol('buffer'); +const PIPES = Symbol('pipes'); +const BUFFERLENGTH = Symbol('bufferLength'); +const BUFFERPUSH = Symbol('bufferPush'); +const BUFFERSHIFT = Symbol('bufferShift'); +const OBJECTMODE = Symbol('objectMode'); +// internal event when stream is destroyed +const DESTROYED = Symbol('destroyed'); +// internal event when stream has an error +const ERROR = Symbol('error'); +const EMITDATA = Symbol('emitData'); +const EMITEND = Symbol('emitEnd'); +const EMITEND2 = Symbol('emitEnd2'); +const ASYNC = Symbol('async'); +const ABORT = Symbol('abort'); +const ABORTED = Symbol('aborted'); +const SIGNAL = Symbol('signal'); +const DATALISTENERS = Symbol('dataListeners'); +const DISCARDED = Symbol('discarded'); +const defer = (fn) => Promise.resolve().then(fn); +const nodefer = (fn) => fn(); +const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish'; +const isArrayBufferLike = (b) => b instanceof ArrayBuffer || + (!!b && + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0); +const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +class Pipe { + src; + dest; + opts; + ondrain; + constructor(src, dest, opts) { + this.src = src; + this.dest = dest; + this.opts = opts; + this.ondrain = () => src[RESUME](); + this.dest.on('drain', this.ondrain); + } + unpipe() { + this.dest.removeListener('drain', this.ondrain); + } + // only here for the prototype + /* c8 ignore start */ + proxyErrors(_er) { } + /* c8 ignore stop */ + end() { + this.unpipe(); + if (this.opts.end) + this.dest.end(); + } +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +class PipeProxyErrors extends Pipe { + unpipe() { + this.src.removeListener('error', this.proxyErrors); + super.unpipe(); + } + constructor(src, dest, opts) { + super(src, dest, opts); + this.proxyErrors = (er) => this.dest.emit('error', er); + src.on('error', this.proxyErrors); + } +} +const isObjectModeOptions = (o) => !!o.objectMode; +const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer'; +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +class Minipass extends node_events_1.EventEmitter { + [FLOWING] = false; + [PAUSED] = false; + [PIPES] = []; + [BUFFER] = []; + [OBJECTMODE]; + [ENCODING]; + [ASYNC]; + [DECODER]; + [EOF] = false; + [EMITTED_END] = false; + [EMITTING_END] = false; + [CLOSED] = false; + [EMITTED_ERROR] = null; + [BUFFERLENGTH] = 0; + [DESTROYED] = false; + [SIGNAL]; + [ABORTED] = false; + [DATALISTENERS] = 0; + [DISCARDED] = false; + /** + * true if the stream can be written + */ + writable = true; + /** + * true if the stream can be read + */ + readable = true; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args) { + const options = (args[0] || + {}); + super(); + if (options.objectMode && typeof options.encoding === 'string') { + throw new TypeError('Encoding and objectMode may not be used together'); + } + if (isObjectModeOptions(options)) { + this[OBJECTMODE] = true; + this[ENCODING] = null; + } + else if (isEncodingOptions(options)) { + this[ENCODING] = options.encoding; + this[OBJECTMODE] = false; + } + else { + this[OBJECTMODE] = false; + this[ENCODING] = null; + } + this[ASYNC] = !!options.async; + this[DECODER] = this[ENCODING] + ? new node_string_decoder_1.StringDecoder(this[ENCODING]) + : null; + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposeBuffer === true) { + Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] }); + } + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposePipes === true) { + Object.defineProperty(this, 'pipes', { get: () => this[PIPES] }); + } + const { signal } = options; + if (signal) { + this[SIGNAL] = signal; + if (signal.aborted) { + this[ABORT](); + } + else { + signal.addEventListener('abort', () => this[ABORT]()); + } + } + } + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength() { + return this[BUFFERLENGTH]; + } + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding() { + return this[ENCODING]; + } + /** + * @deprecated - This is a read only property + */ + set encoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * True if this is an objectMode stream + */ + get objectMode() { + return this[OBJECTMODE]; + } + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om) { + throw new Error('objectMode must be set at instantiation time'); + } + /** + * true if this is an async stream + */ + get ['async']() { + return this[ASYNC]; + } + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a) { + this[ASYNC] = this[ASYNC] || !!a; + } + // drop everything and get out of the flow completely + [ABORT]() { + this[ABORTED] = true; + this.emit('abort', this[SIGNAL]?.reason); + this.destroy(this[SIGNAL]?.reason); + } + /** + * True if the stream has been aborted. + */ + get aborted() { + return this[ABORTED]; + } + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_) { } + write(chunk, encoding, cb) { + if (this[ABORTED]) + return false; + if (this[EOF]) + throw new Error('write after end'); + if (this[DESTROYED]) { + this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' })); + return true; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (!encoding) + encoding = 'utf8'; + const fn = this[ASYNC] ? defer : nodefer; + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything is only allowed if in object mode, so throw + if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); + } + else if (isArrayBufferLike(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk); + } + else if (typeof chunk !== 'string') { + throw new Error('Non-contiguous data written to non-objectMode stream'); + } + } + // handle object mode up front, since it's simpler + // this yields better performance, fewer checks later. + if (this[OBJECTMODE]) { + // maybe impossible? + /* c8 ignore start */ + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + /* c8 ignore stop */ + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // at this point the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!chunk.length) { + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) { + //@ts-ignore - sinful unsafe type change + chunk = Buffer.from(chunk, encoding); + } + if (Buffer.isBuffer(chunk) && this[ENCODING]) { + //@ts-ignore - sinful unsafe type change + chunk = this[DECODER].write(chunk); + } + // Note: flushing CAN potentially switch us into not-flowing mode + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n) { + if (this[DESTROYED]) + return null; + this[DISCARDED] = false; + if (this[BUFFERLENGTH] === 0 || + n === 0 || + (n && n > this[BUFFERLENGTH])) { + this[MAYBE_EMIT_END](); + return null; + } + if (this[OBJECTMODE]) + n = null; + if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { + // not object mode, so if we have an encoding, then RType is string + // otherwise, must be Buffer + this[BUFFER] = [ + (this[ENCODING] + ? this[BUFFER].join('') + : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])), + ]; + } + const ret = this[READ](n || null, this[BUFFER][0]); + this[MAYBE_EMIT_END](); + return ret; + } + [READ](n, chunk) { + if (this[OBJECTMODE]) + this[BUFFERSHIFT](); + else { + const c = chunk; + if (n === c.length || n === null) + this[BUFFERSHIFT](); + else if (typeof c === 'string') { + this[BUFFER][0] = c.slice(n); + chunk = c.slice(0, n); + this[BUFFERLENGTH] -= n; + } + else { + this[BUFFER][0] = c.subarray(n); + chunk = c.subarray(0, n); + this[BUFFERLENGTH] -= n; + } + } + this.emit('data', chunk); + if (!this[BUFFER].length && !this[EOF]) + this.emit('drain'); + return chunk; + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (chunk !== undefined) + this.write(chunk, encoding); + if (cb) + this.once('end', cb); + this[EOF] = true; + this.writable = false; + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this[FLOWING] || !this[PAUSED]) + this[MAYBE_EMIT_END](); + return this; + } + // don't let the internal resume be overwritten + [RESUME]() { + if (this[DESTROYED]) + return; + if (!this[DATALISTENERS] && !this[PIPES].length) { + this[DISCARDED] = true; + } + this[PAUSED] = false; + this[FLOWING] = true; + this.emit('resume'); + if (this[BUFFER].length) + this[FLUSH](); + else if (this[EOF]) + this[MAYBE_EMIT_END](); + else + this.emit('drain'); + } + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume() { + return this[RESUME](); + } + /** + * Pause the stream + */ + pause() { + this[FLOWING] = false; + this[PAUSED] = true; + this[DISCARDED] = false; + } + /** + * true if the stream has been forcibly destroyed + */ + get destroyed() { + return this[DESTROYED]; + } + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing() { + return this[FLOWING]; + } + /** + * true if the stream is currently in a paused state + */ + get paused() { + return this[PAUSED]; + } + [BUFFERPUSH](chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1; + else + this[BUFFERLENGTH] += chunk.length; + this[BUFFER].push(chunk); + } + [BUFFERSHIFT]() { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1; + else + this[BUFFERLENGTH] -= this[BUFFER][0].length; + return this[BUFFER].shift(); + } + [FLUSH](noDrain = false) { + do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && + this[BUFFER].length); + if (!noDrain && !this[BUFFER].length && !this[EOF]) + this.emit('drain'); + } + [FLUSHCHUNK](chunk) { + this.emit('data', chunk); + return this[FLOWING]; + } + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest, opts) { + if (this[DESTROYED]) + return dest; + this[DISCARDED] = false; + const ended = this[EMITTED_END]; + opts = opts || {}; + if (dest === proc.stdout || dest === proc.stderr) + opts.end = false; + else + opts.end = opts.end !== false; + opts.proxyErrors = !!opts.proxyErrors; + // piping an ended stream ends immediately + if (ended) { + if (opts.end) + dest.end(); + } + else { + // "as" here just ignores the WType, which pipes don't care about, + // since they're only consuming from us, and writing to the dest + this[PIPES].push(!opts.proxyErrors + ? new Pipe(this, dest, opts) + : new PipeProxyErrors(this, dest, opts)); + if (this[ASYNC]) + defer(() => this[RESUME]()); + else + this[RESUME](); + } + return dest; + } + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest) { + const p = this[PIPES].find(p => p.dest === dest); + if (p) { + if (this[PIPES].length === 1) { + if (this[FLOWING] && this[DATALISTENERS] === 0) { + this[FLOWING] = false; + } + this[PIPES] = []; + } + else + this[PIPES].splice(this[PIPES].indexOf(p), 1); + p.unpipe(); + } + } + /** + * Alias for {@link Minipass#on} + */ + addListener(ev, handler) { + return this.on(ev, handler); + } + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev, handler) { + const ret = super.on(ev, handler); + if (ev === 'data') { + this[DISCARDED] = false; + this[DATALISTENERS]++; + if (!this[PIPES].length && !this[FLOWING]) { + this[RESUME](); + } + } + else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) { + super.emit('readable'); + } + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev); + this.removeAllListeners(ev); + } + else if (ev === 'error' && this[EMITTED_ERROR]) { + const h = handler; + if (this[ASYNC]) + defer(() => h.call(this, this[EMITTED_ERROR])); + else + h.call(this, this[EMITTED_ERROR]); + } + return ret; + } + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev, handler) { + return this.off(ev, handler); + } + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev, handler) { + const ret = super.off(ev, handler); + // if we previously had listeners, and now we don't, and we don't + // have any pipes, then stop the flow, unless it's been explicitly + // put in a discarded flowing state via stream.resume(). + if (ev === 'data') { + this[DATALISTENERS] = this.listeners('data').length; + if (this[DATALISTENERS] === 0 && + !this[DISCARDED] && + !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev) { + const ret = super.removeAllListeners(ev); + if (ev === 'data' || ev === undefined) { + this[DATALISTENERS] = 0; + if (!this[DISCARDED] && !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * true if the 'end' event has been emitted + */ + get emittedEnd() { + return this[EMITTED_END]; + } + [MAYBE_EMIT_END]() { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this[BUFFER].length === 0 && + this[EOF]) { + this[EMITTING_END] = true; + this.emit('end'); + this.emit('prefinish'); + this.emit('finish'); + if (this[CLOSED]) + this.emit('close'); + this[EMITTING_END] = false; + } + } + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev, ...args) { + const data = args[0]; + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && + ev !== 'close' && + ev !== DESTROYED && + this[DESTROYED]) { + return false; + } + else if (ev === 'data') { + return !this[OBJECTMODE] && !data + ? false + : this[ASYNC] + ? (defer(() => this[EMITDATA](data)), true) + : this[EMITDATA](data); + } + else if (ev === 'end') { + return this[EMITEND](); + } + else if (ev === 'close') { + this[CLOSED] = true; + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END] && !this[DESTROYED]) + return false; + const ret = super.emit('close'); + this.removeAllListeners('close'); + return ret; + } + else if (ev === 'error') { + this[EMITTED_ERROR] = data; + super.emit(ERROR, data); + const ret = !this[SIGNAL] || this.listeners('error').length + ? super.emit('error', data) + : false; + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'resume') { + const ret = super.emit('resume'); + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'finish' || ev === 'prefinish') { + const ret = super.emit(ev); + this.removeAllListeners(ev); + return ret; + } + // Some other unknown event + const ret = super.emit(ev, ...args); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITDATA](data) { + for (const p of this[PIPES]) { + if (p.dest.write(data) === false) + this.pause(); + } + const ret = this[DISCARDED] ? false : super.emit('data', data); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITEND]() { + if (this[EMITTED_END]) + return false; + this[EMITTED_END] = true; + this.readable = false; + return this[ASYNC] + ? (defer(() => this[EMITEND2]()), true) + : this[EMITEND2](); + } + [EMITEND2]() { + if (this[DECODER]) { + const data = this[DECODER].end(); + if (data) { + for (const p of this[PIPES]) { + p.dest.write(data); + } + if (!this[DISCARDED]) + super.emit('data', data); + } + } + for (const p of this[PIPES]) { + p.end(); + } + const ret = super.emit('end'); + this.removeAllListeners('end'); + return ret; + } + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + async collect() { + const buf = Object.assign([], { + dataLength: 0, + }); + if (!this[OBJECTMODE]) + buf.dataLength = 0; + // set the promise first, in case an error is raised + // by triggering the flow here. + const p = this.promise(); + this.on('data', c => { + buf.push(c); + if (!this[OBJECTMODE]) + buf.dataLength += c.length; + }); + await p; + return buf; + } + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + async concat() { + if (this[OBJECTMODE]) { + throw new Error('cannot concat in objectMode'); + } + const buf = await this.collect(); + return (this[ENCODING] + ? buf.join('') + : Buffer.concat(buf, buf.dataLength)); + } + /** + * Return a void Promise that resolves once the stream ends. + */ + async promise() { + return new Promise((resolve, reject) => { + this.on(DESTROYED, () => reject(new Error('stream destroyed'))); + this.on('error', er => reject(er)); + this.on('end', () => resolve()); + }); + } + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = async () => { + this.pause(); + stopped = true; + return { value: undefined, done: true }; + }; + const next = () => { + if (stopped) + return stop(); + const res = this.read(); + if (res !== null) + return Promise.resolve({ done: false, value: res }); + if (this[EOF]) + return stop(); + let resolve; + let reject; + const onerr = (er) => { + this.off('data', ondata); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + stop(); + reject(er); + }; + const ondata = (value) => { + this.off('error', onerr); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + this.pause(); + resolve({ value, done: !!this[EOF] }); + }; + const onend = () => { + this.off('error', onerr); + this.off('data', ondata); + this.off(DESTROYED, ondestroy); + stop(); + resolve({ done: true, value: undefined }); + }; + const ondestroy = () => onerr(new Error('stream destroyed')); + return new Promise((res, rej) => { + reject = rej; + resolve = res; + this.once(DESTROYED, ondestroy); + this.once('error', onerr); + this.once('end', onend); + this.once('data', ondata); + }); + }; + return { + next, + throw: stop, + return: stop, + [Symbol.asyncIterator]() { + return this; + }, + [Symbol.asyncDispose]: async () => { }, + }; + } + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = () => { + this.pause(); + this.off(ERROR, stop); + this.off(DESTROYED, stop); + this.off('end', stop); + stopped = true; + return { done: true, value: undefined }; + }; + const next = () => { + if (stopped) + return stop(); + const value = this.read(); + return value === null ? stop() : { done: false, value }; + }; + this.once('end', stop); + this.once(ERROR, stop); + this.once(DESTROYED, stop); + return { + next, + throw: stop, + return: stop, + [Symbol.iterator]() { + return this; + }, + [Symbol.dispose]: () => { }, + }; + } + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er); + else + this.emit(DESTROYED); + return this; + } + this[DESTROYED] = true; + this[DISCARDED] = true; + // throw away all buffered data, it's never coming out + this[BUFFER].length = 0; + this[BUFFERLENGTH] = 0; + const wc = this; + if (typeof wc.close === 'function' && !this[CLOSED]) + wc.close(); + if (er) + this.emit('error', er); + // if no error to emit, still reject pending promises + else + this.emit(DESTROYED); + return this; + } + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream() { + return exports.isStream; + } +} +exports.Minipass = Minipass; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/minipass/dist/commonjs/index.js.map b/node_modules/minipass/dist/commonjs/index.js.map new file mode 100644 index 00000000..1687b4c9 --- /dev/null +++ b/node_modules/minipass/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC;QACE,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;KACb,CAAA;AACP,6CAA0C;AAC1C,8DAAgC;AAChC,6DAAmD;AASnD;;;GAGG;AACI,MAAM,QAAQ,GAAG,CACtB,CAAM,EACsC,EAAE,CAC9C,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,CAAC,YAAY,QAAQ;QACpB,CAAC,YAAY,qBAAM;QACnB,IAAA,QAAA,UAAU,EAAC,CAAC,CAAC;QACb,IAAA,QAAA,UAAU,EAAC,CAAC,CAAC,CAAC;AAElB;;GAEG;AAJe,CAAA;AARL,QAAA,QAAQ,GAAR,QAAQ,CAQH;AAElB;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,0BAAY;IACzB,OAAQ,CAAuB,CAAC,IAAI,KAAK,UAAU;IACnD,iEAAiE;IAChE,CAAuB,CAAC,IAAI,KAAK,qBAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI;AAElE;;GAEG;AAJ+D,CAAA;AANrD,QAAA,UAAU,GA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AA,CACF;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAY,EAAE;QACpB,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACpB,IAAI,EAAE;gBAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;;gBACzB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACzB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QACtB,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QAEtB,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QAEtB,MAAM,EAAE,GAAG,IAEV,CAAA;QACD,IAAI,OAAO,EAAE,CAAC,KAAK,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,EAAE,CAAC,KAAK,EAAE,CAAA;QAE/D,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QAC9B,qDAAqD;;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEzB,OAAO,IAAI,CAAA;IAAA,CACZ;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ,GAAG;QACpB,OAAO,QAAA,QAAQ,CAAA;IAAA,CAChB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/minipass/dist/commonjs/package.json b/node_modules/minipass/dist/commonjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/node_modules/minipass/dist/commonjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/node_modules/minipass/dist/esm/index.d.ts b/node_modules/minipass/dist/esm/index.d.ts new file mode 100644 index 00000000..3e75b578 --- /dev/null +++ b/node_modules/minipass/dist/esm/index.d.ts @@ -0,0 +1,545 @@ +import { EventEmitter } from 'node:events'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Same as StringDecoder, but exposing the `lastNeed` flag on the type + */ +type SD = StringDecoder & { + lastNeed: boolean; +}; +export type { SD, Pipe, PipeProxyErrors }; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export declare const isStream: (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; +}) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; +}) | (NodeJS.ReadStream & { + fd: number; +}) | (NodeJS.WriteStream & { + fd: number; +}); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export declare const isReadable: (s: any) => s is Minipass.Readable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export declare const isWritable: (s: any) => s is Minipass.Readable; +declare const EOF: unique symbol; +declare const MAYBE_EMIT_END: unique symbol; +declare const EMITTED_END: unique symbol; +declare const EMITTING_END: unique symbol; +declare const EMITTED_ERROR: unique symbol; +declare const CLOSED: unique symbol; +declare const READ: unique symbol; +declare const FLUSH: unique symbol; +declare const FLUSHCHUNK: unique symbol; +declare const ENCODING: unique symbol; +declare const DECODER: unique symbol; +declare const FLOWING: unique symbol; +declare const PAUSED: unique symbol; +declare const RESUME: unique symbol; +declare const BUFFER: unique symbol; +declare const PIPES: unique symbol; +declare const BUFFERLENGTH: unique symbol; +declare const BUFFERPUSH: unique symbol; +declare const BUFFERSHIFT: unique symbol; +declare const OBJECTMODE: unique symbol; +declare const DESTROYED: unique symbol; +declare const ERROR: unique symbol; +declare const EMITDATA: unique symbol; +declare const EMITEND: unique symbol; +declare const EMITEND2: unique symbol; +declare const ASYNC: unique symbol; +declare const ABORT: unique symbol; +declare const ABORTED: unique symbol; +declare const SIGNAL: unique symbol; +declare const DATALISTENERS: unique symbol; +declare const DISCARDED: unique symbol; +/** + * Options that may be passed to stream.pipe() + */ +export interface PipeOptions { + /** + * end the destination stream when the source stream ends + */ + end?: boolean; + /** + * proxy errors from the source stream to the destination stream + */ + proxyErrors?: boolean; +} +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +declare class Pipe { + src: Minipass; + dest: Minipass; + opts: PipeOptions; + ondrain: () => any; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); + unpipe(): void; + proxyErrors(_er: any): void; + end(): void; +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +declare class PipeProxyErrors extends Pipe { + unpipe(): void; + constructor(src: Minipass, dest: Minipass.Writable, opts: PipeOptions); +} +export declare namespace Minipass { + /** + * Encoding used to create a stream that outputs strings rather than + * Buffer objects. + */ + export type Encoding = BufferEncoding | 'buffer' | null; + /** + * Any stream that Minipass can pipe into + */ + export type Writable = Minipass | NodeJS.WriteStream | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); + /** + * Any stream that can be read from + */ + export type Readable = Minipass | NodeJS.ReadStream | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }); + /** + * Utility type that can be iterated sync or async + */ + export type DualIterable = Iterable & AsyncIterable; + type EventArguments = Record; + /** + * The listing of events that a Minipass class can emit. + * Extend this when extending the Minipass class, and pass as + * the third template argument. The key is the name of the event, + * and the value is the argument list. + * + * Any undeclared events will still be allowed, but the handler will get + * arguments as `unknown[]`. + */ + export interface Events extends EventArguments { + readable: []; + data: [chunk: RType]; + error: [er: unknown]; + abort: [reason: unknown]; + drain: []; + resume: []; + end: []; + finish: []; + prefinish: []; + close: []; + [DESTROYED]: [er?: unknown]; + [ERROR]: [er: unknown]; + } + /** + * String or buffer-like data that can be joined and sliced + */ + export type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string; + export type BufferOrString = Buffer | string; + /** + * Options passed to the Minipass constructor. + */ + export type SharedOptions = { + /** + * Defer all data emission and other events until the end of the + * current tick, similar to Node core streams + */ + async?: boolean; + /** + * A signal which will abort the stream + */ + signal?: AbortSignal; + /** + * Output string encoding. Set to `null` or `'buffer'` (or omit) to + * emit Buffer objects rather than strings. + * + * Conflicts with `objectMode` + */ + encoding?: BufferEncoding | null | 'buffer'; + /** + * Output data exactly as it was written, supporting non-buffer/string + * data (such as arbitrary objects, falsey values, etc.) + * + * Conflicts with `encoding` + */ + objectMode?: boolean; + }; + /** + * Options for a string encoded output + */ + export type EncodingOptions = SharedOptions & { + encoding: BufferEncoding; + objectMode?: false; + }; + /** + * Options for contiguous data buffer output + */ + export type BufferOptions = SharedOptions & { + encoding?: null | 'buffer'; + objectMode?: false; + }; + /** + * Options for objectMode arbitrary output + */ + export type ObjectModeOptions = SharedOptions & { + objectMode: true; + encoding?: null; + }; + /** + * Utility type to determine allowed options based on read type + */ + export type Options = ObjectModeOptions | (T extends string ? EncodingOptions : T extends Buffer ? BufferOptions : SharedOptions); + export {}; +} +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export declare class Minipass = Minipass.Events> extends EventEmitter implements Minipass.DualIterable { + [FLOWING]: boolean; + [PAUSED]: boolean; + [PIPES]: Pipe[]; + [BUFFER]: RType[]; + [OBJECTMODE]: boolean; + [ENCODING]: BufferEncoding | null; + [ASYNC]: boolean; + [DECODER]: SD | null; + [EOF]: boolean; + [EMITTED_END]: boolean; + [EMITTING_END]: boolean; + [CLOSED]: boolean; + [EMITTED_ERROR]: unknown; + [BUFFERLENGTH]: number; + [DESTROYED]: boolean; + [SIGNAL]?: AbortSignal; + [ABORTED]: boolean; + [DATALISTENERS]: number; + [DISCARDED]: boolean; + /** + * true if the stream can be written + */ + writable: boolean; + /** + * true if the stream can be read + */ + readable: boolean; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args: [Minipass.ObjectModeOptions] | (RType extends Buffer ? [] | [Minipass.Options] : [Minipass.Options])); + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength(): number; + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding(): BufferEncoding | null; + /** + * @deprecated - This is a read only property + */ + set encoding(_enc: BufferEncoding | null); + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc: Minipass.Encoding): void; + /** + * True if this is an objectMode stream + */ + get objectMode(): boolean; + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om: boolean); + /** + * true if this is an async stream + */ + get ['async'](): boolean; + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a: boolean); + [ABORT](): void; + /** + * True if the stream has been aborted. + */ + get aborted(): boolean; + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_: boolean); + /** + * Write data into the stream + * + * If the chunk written is a string, and encoding is not specified, then + * `utf8` will be assumed. If the stream encoding matches the encoding of + * a written string, and the state of the string decoder allows it, then + * the string will be passed through to either the output or the internal + * buffer without any processing. Otherwise, it will be turned into a + * Buffer object for processing into the desired encoding. + * + * If provided, `cb` function is called immediately before return for + * sync streams, or on next tick for async streams, because for this + * base class, a chunk is considered "processed" once it is accepted + * and either emitted or buffered. That is, the callback does not indicate + * that the chunk has been eventually emitted, though of course child + * classes can override this function to do whatever processing is required + * and call `super.write(...)` only once processing is completed. + */ + write(chunk: WType, cb?: () => void): boolean; + write(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): boolean; + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n?: number | null): RType | null; + [READ](n: number | null, chunk: RType): RType; + /** + * End the stream, optionally providing a final write. + * + * See {@link Minipass#write} for argument descriptions + */ + end(cb?: () => void): this; + end(chunk: WType, cb?: () => void): this; + end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this; + [RESUME](): void; + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume(): void; + /** + * Pause the stream + */ + pause(): void; + /** + * true if the stream has been forcibly destroyed + */ + get destroyed(): boolean; + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing(): boolean; + /** + * true if the stream is currently in a paused state + */ + get paused(): boolean; + [BUFFERPUSH](chunk: RType): void; + [BUFFERSHIFT](): RType; + [FLUSH](noDrain?: boolean): void; + [FLUSHCHUNK](chunk: RType): boolean; + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest: W, opts?: PipeOptions): W; + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest: W): void; + /** + * Alias for {@link Minipass#on} + */ + addListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev?: Event): this; + /** + * true if the 'end' event has been emitted + */ + get emittedEnd(): boolean; + [MAYBE_EMIT_END](): void; + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev: Event, ...args: Events[Event]): boolean; + [EMITDATA](data: RType): boolean; + [EMITEND](): boolean; + [EMITEND2](): boolean; + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + collect(): Promise; + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + concat(): Promise; + /** + * Return a void Promise that resolves once the stream ends. + */ + promise(): Promise; + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator](): AsyncGenerator; + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator](): Generator; + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er?: unknown): this; + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream(): (s: any) => s is Minipass | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }) | (NodeJS.ReadStream & { + fd: number; + }) | (NodeJS.WriteStream & { + fd: number; + }); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/minipass/dist/esm/index.d.ts.map b/node_modules/minipass/dist/esm/index.d.ts.map new file mode 100644 index 00000000..7bce611b --- /dev/null +++ b/node_modules/minipass/dist/esm/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;GAEG;AACH,KAAK,EAAE,GAAG,aAAa,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAA;AAE/C,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;EAQH,CAAA;AAElB;;GAEG;AACH,eAAO,MAAM,UAAU,oCAM2C,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,UAAU,oCAK6B,CAAA;AAEpD,QAAA,MAAM,GAAG,eAAgB,CAAA;AACzB,QAAA,MAAM,cAAc,eAAyB,CAAA;AAC7C,QAAA,MAAM,WAAW,eAAuB,CAAA;AACxC,QAAA,MAAM,YAAY,eAAwB,CAAA;AAC1C,QAAA,MAAM,aAAa,eAAyB,CAAA;AAC5C,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,QAAQ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CAAC,SAef;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,CAAC,KAAK,SAAS,MAAM,MAAM,EAC7B,EAAE,EAAE,KAAK,EACT,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GACrB,OAAO,CAgDT;IAED,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,WAOrB;IAED,CAAC,OAAO,CAAC,YAQR;IAED,CAAC,QAAQ,CAAC,YAiBT;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAezD;IAED;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAU7B;IAED;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAM7B;IAED;;;;OAIG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CA4D1D;IAED;;;;;OAKG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAiChD;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,QAwBnB;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;;;;;;;;;;;OAElB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/minipass/dist/esm/index.js b/node_modules/minipass/dist/esm/index.js new file mode 100644 index 00000000..5df55461 --- /dev/null +++ b/node_modules/minipass/dist/esm/index.js @@ -0,0 +1,1020 @@ +const proc = typeof process === 'object' && process + ? process + : { + stdout: null, + stderr: null, + }; +import { EventEmitter } from 'node:events'; +import Stream from 'node:stream'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export const isStream = (s) => !!s && + typeof s === 'object' && + (s instanceof Minipass || + s instanceof Stream || + isReadable(s) || + isWritable(s)); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export const isReadable = (s) => !!s && + typeof s === 'object' && + s instanceof EventEmitter && + typeof s.pipe === 'function' && + // node core Writable streams have a pipe() method, but it throws + s.pipe !== Stream.Writable.prototype.pipe; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export const isWritable = (s) => !!s && + typeof s === 'object' && + s instanceof EventEmitter && + typeof s.write === 'function' && + typeof s.end === 'function'; +const EOF = Symbol('EOF'); +const MAYBE_EMIT_END = Symbol('maybeEmitEnd'); +const EMITTED_END = Symbol('emittedEnd'); +const EMITTING_END = Symbol('emittingEnd'); +const EMITTED_ERROR = Symbol('emittedError'); +const CLOSED = Symbol('closed'); +const READ = Symbol('read'); +const FLUSH = Symbol('flush'); +const FLUSHCHUNK = Symbol('flushChunk'); +const ENCODING = Symbol('encoding'); +const DECODER = Symbol('decoder'); +const FLOWING = Symbol('flowing'); +const PAUSED = Symbol('paused'); +const RESUME = Symbol('resume'); +const BUFFER = Symbol('buffer'); +const PIPES = Symbol('pipes'); +const BUFFERLENGTH = Symbol('bufferLength'); +const BUFFERPUSH = Symbol('bufferPush'); +const BUFFERSHIFT = Symbol('bufferShift'); +const OBJECTMODE = Symbol('objectMode'); +// internal event when stream is destroyed +const DESTROYED = Symbol('destroyed'); +// internal event when stream has an error +const ERROR = Symbol('error'); +const EMITDATA = Symbol('emitData'); +const EMITEND = Symbol('emitEnd'); +const EMITEND2 = Symbol('emitEnd2'); +const ASYNC = Symbol('async'); +const ABORT = Symbol('abort'); +const ABORTED = Symbol('aborted'); +const SIGNAL = Symbol('signal'); +const DATALISTENERS = Symbol('dataListeners'); +const DISCARDED = Symbol('discarded'); +const defer = (fn) => Promise.resolve().then(fn); +const nodefer = (fn) => fn(); +const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish'; +const isArrayBufferLike = (b) => b instanceof ArrayBuffer || + (!!b && + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0); +const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +class Pipe { + src; + dest; + opts; + ondrain; + constructor(src, dest, opts) { + this.src = src; + this.dest = dest; + this.opts = opts; + this.ondrain = () => src[RESUME](); + this.dest.on('drain', this.ondrain); + } + unpipe() { + this.dest.removeListener('drain', this.ondrain); + } + // only here for the prototype + /* c8 ignore start */ + proxyErrors(_er) { } + /* c8 ignore stop */ + end() { + this.unpipe(); + if (this.opts.end) + this.dest.end(); + } +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +class PipeProxyErrors extends Pipe { + unpipe() { + this.src.removeListener('error', this.proxyErrors); + super.unpipe(); + } + constructor(src, dest, opts) { + super(src, dest, opts); + this.proxyErrors = (er) => this.dest.emit('error', er); + src.on('error', this.proxyErrors); + } +} +const isObjectModeOptions = (o) => !!o.objectMode; +const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer'; +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export class Minipass extends EventEmitter { + [FLOWING] = false; + [PAUSED] = false; + [PIPES] = []; + [BUFFER] = []; + [OBJECTMODE]; + [ENCODING]; + [ASYNC]; + [DECODER]; + [EOF] = false; + [EMITTED_END] = false; + [EMITTING_END] = false; + [CLOSED] = false; + [EMITTED_ERROR] = null; + [BUFFERLENGTH] = 0; + [DESTROYED] = false; + [SIGNAL]; + [ABORTED] = false; + [DATALISTENERS] = 0; + [DISCARDED] = false; + /** + * true if the stream can be written + */ + writable = true; + /** + * true if the stream can be read + */ + readable = true; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args) { + const options = (args[0] || + {}); + super(); + if (options.objectMode && typeof options.encoding === 'string') { + throw new TypeError('Encoding and objectMode may not be used together'); + } + if (isObjectModeOptions(options)) { + this[OBJECTMODE] = true; + this[ENCODING] = null; + } + else if (isEncodingOptions(options)) { + this[ENCODING] = options.encoding; + this[OBJECTMODE] = false; + } + else { + this[OBJECTMODE] = false; + this[ENCODING] = null; + } + this[ASYNC] = !!options.async; + this[DECODER] = this[ENCODING] + ? new StringDecoder(this[ENCODING]) + : null; + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposeBuffer === true) { + Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] }); + } + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposePipes === true) { + Object.defineProperty(this, 'pipes', { get: () => this[PIPES] }); + } + const { signal } = options; + if (signal) { + this[SIGNAL] = signal; + if (signal.aborted) { + this[ABORT](); + } + else { + signal.addEventListener('abort', () => this[ABORT]()); + } + } + } + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength() { + return this[BUFFERLENGTH]; + } + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding() { + return this[ENCODING]; + } + /** + * @deprecated - This is a read only property + */ + set encoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * True if this is an objectMode stream + */ + get objectMode() { + return this[OBJECTMODE]; + } + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om) { + throw new Error('objectMode must be set at instantiation time'); + } + /** + * true if this is an async stream + */ + get ['async']() { + return this[ASYNC]; + } + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a) { + this[ASYNC] = this[ASYNC] || !!a; + } + // drop everything and get out of the flow completely + [ABORT]() { + this[ABORTED] = true; + this.emit('abort', this[SIGNAL]?.reason); + this.destroy(this[SIGNAL]?.reason); + } + /** + * True if the stream has been aborted. + */ + get aborted() { + return this[ABORTED]; + } + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_) { } + write(chunk, encoding, cb) { + if (this[ABORTED]) + return false; + if (this[EOF]) + throw new Error('write after end'); + if (this[DESTROYED]) { + this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' })); + return true; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (!encoding) + encoding = 'utf8'; + const fn = this[ASYNC] ? defer : nodefer; + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything is only allowed if in object mode, so throw + if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); + } + else if (isArrayBufferLike(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk); + } + else if (typeof chunk !== 'string') { + throw new Error('Non-contiguous data written to non-objectMode stream'); + } + } + // handle object mode up front, since it's simpler + // this yields better performance, fewer checks later. + if (this[OBJECTMODE]) { + // maybe impossible? + /* c8 ignore start */ + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + /* c8 ignore stop */ + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // at this point the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!chunk.length) { + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) { + //@ts-ignore - sinful unsafe type change + chunk = Buffer.from(chunk, encoding); + } + if (Buffer.isBuffer(chunk) && this[ENCODING]) { + //@ts-ignore - sinful unsafe type change + chunk = this[DECODER].write(chunk); + } + // Note: flushing CAN potentially switch us into not-flowing mode + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n) { + if (this[DESTROYED]) + return null; + this[DISCARDED] = false; + if (this[BUFFERLENGTH] === 0 || + n === 0 || + (n && n > this[BUFFERLENGTH])) { + this[MAYBE_EMIT_END](); + return null; + } + if (this[OBJECTMODE]) + n = null; + if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { + // not object mode, so if we have an encoding, then RType is string + // otherwise, must be Buffer + this[BUFFER] = [ + (this[ENCODING] + ? this[BUFFER].join('') + : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])), + ]; + } + const ret = this[READ](n || null, this[BUFFER][0]); + this[MAYBE_EMIT_END](); + return ret; + } + [READ](n, chunk) { + if (this[OBJECTMODE]) + this[BUFFERSHIFT](); + else { + const c = chunk; + if (n === c.length || n === null) + this[BUFFERSHIFT](); + else if (typeof c === 'string') { + this[BUFFER][0] = c.slice(n); + chunk = c.slice(0, n); + this[BUFFERLENGTH] -= n; + } + else { + this[BUFFER][0] = c.subarray(n); + chunk = c.subarray(0, n); + this[BUFFERLENGTH] -= n; + } + } + this.emit('data', chunk); + if (!this[BUFFER].length && !this[EOF]) + this.emit('drain'); + return chunk; + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (chunk !== undefined) + this.write(chunk, encoding); + if (cb) + this.once('end', cb); + this[EOF] = true; + this.writable = false; + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this[FLOWING] || !this[PAUSED]) + this[MAYBE_EMIT_END](); + return this; + } + // don't let the internal resume be overwritten + [RESUME]() { + if (this[DESTROYED]) + return; + if (!this[DATALISTENERS] && !this[PIPES].length) { + this[DISCARDED] = true; + } + this[PAUSED] = false; + this[FLOWING] = true; + this.emit('resume'); + if (this[BUFFER].length) + this[FLUSH](); + else if (this[EOF]) + this[MAYBE_EMIT_END](); + else + this.emit('drain'); + } + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume() { + return this[RESUME](); + } + /** + * Pause the stream + */ + pause() { + this[FLOWING] = false; + this[PAUSED] = true; + this[DISCARDED] = false; + } + /** + * true if the stream has been forcibly destroyed + */ + get destroyed() { + return this[DESTROYED]; + } + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing() { + return this[FLOWING]; + } + /** + * true if the stream is currently in a paused state + */ + get paused() { + return this[PAUSED]; + } + [BUFFERPUSH](chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1; + else + this[BUFFERLENGTH] += chunk.length; + this[BUFFER].push(chunk); + } + [BUFFERSHIFT]() { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1; + else + this[BUFFERLENGTH] -= this[BUFFER][0].length; + return this[BUFFER].shift(); + } + [FLUSH](noDrain = false) { + do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && + this[BUFFER].length); + if (!noDrain && !this[BUFFER].length && !this[EOF]) + this.emit('drain'); + } + [FLUSHCHUNK](chunk) { + this.emit('data', chunk); + return this[FLOWING]; + } + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest, opts) { + if (this[DESTROYED]) + return dest; + this[DISCARDED] = false; + const ended = this[EMITTED_END]; + opts = opts || {}; + if (dest === proc.stdout || dest === proc.stderr) + opts.end = false; + else + opts.end = opts.end !== false; + opts.proxyErrors = !!opts.proxyErrors; + // piping an ended stream ends immediately + if (ended) { + if (opts.end) + dest.end(); + } + else { + // "as" here just ignores the WType, which pipes don't care about, + // since they're only consuming from us, and writing to the dest + this[PIPES].push(!opts.proxyErrors + ? new Pipe(this, dest, opts) + : new PipeProxyErrors(this, dest, opts)); + if (this[ASYNC]) + defer(() => this[RESUME]()); + else + this[RESUME](); + } + return dest; + } + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest) { + const p = this[PIPES].find(p => p.dest === dest); + if (p) { + if (this[PIPES].length === 1) { + if (this[FLOWING] && this[DATALISTENERS] === 0) { + this[FLOWING] = false; + } + this[PIPES] = []; + } + else + this[PIPES].splice(this[PIPES].indexOf(p), 1); + p.unpipe(); + } + } + /** + * Alias for {@link Minipass#on} + */ + addListener(ev, handler) { + return this.on(ev, handler); + } + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev, handler) { + const ret = super.on(ev, handler); + if (ev === 'data') { + this[DISCARDED] = false; + this[DATALISTENERS]++; + if (!this[PIPES].length && !this[FLOWING]) { + this[RESUME](); + } + } + else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) { + super.emit('readable'); + } + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev); + this.removeAllListeners(ev); + } + else if (ev === 'error' && this[EMITTED_ERROR]) { + const h = handler; + if (this[ASYNC]) + defer(() => h.call(this, this[EMITTED_ERROR])); + else + h.call(this, this[EMITTED_ERROR]); + } + return ret; + } + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev, handler) { + return this.off(ev, handler); + } + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev, handler) { + const ret = super.off(ev, handler); + // if we previously had listeners, and now we don't, and we don't + // have any pipes, then stop the flow, unless it's been explicitly + // put in a discarded flowing state via stream.resume(). + if (ev === 'data') { + this[DATALISTENERS] = this.listeners('data').length; + if (this[DATALISTENERS] === 0 && + !this[DISCARDED] && + !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev) { + const ret = super.removeAllListeners(ev); + if (ev === 'data' || ev === undefined) { + this[DATALISTENERS] = 0; + if (!this[DISCARDED] && !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * true if the 'end' event has been emitted + */ + get emittedEnd() { + return this[EMITTED_END]; + } + [MAYBE_EMIT_END]() { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this[BUFFER].length === 0 && + this[EOF]) { + this[EMITTING_END] = true; + this.emit('end'); + this.emit('prefinish'); + this.emit('finish'); + if (this[CLOSED]) + this.emit('close'); + this[EMITTING_END] = false; + } + } + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev, ...args) { + const data = args[0]; + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && + ev !== 'close' && + ev !== DESTROYED && + this[DESTROYED]) { + return false; + } + else if (ev === 'data') { + return !this[OBJECTMODE] && !data + ? false + : this[ASYNC] + ? (defer(() => this[EMITDATA](data)), true) + : this[EMITDATA](data); + } + else if (ev === 'end') { + return this[EMITEND](); + } + else if (ev === 'close') { + this[CLOSED] = true; + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END] && !this[DESTROYED]) + return false; + const ret = super.emit('close'); + this.removeAllListeners('close'); + return ret; + } + else if (ev === 'error') { + this[EMITTED_ERROR] = data; + super.emit(ERROR, data); + const ret = !this[SIGNAL] || this.listeners('error').length + ? super.emit('error', data) + : false; + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'resume') { + const ret = super.emit('resume'); + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'finish' || ev === 'prefinish') { + const ret = super.emit(ev); + this.removeAllListeners(ev); + return ret; + } + // Some other unknown event + const ret = super.emit(ev, ...args); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITDATA](data) { + for (const p of this[PIPES]) { + if (p.dest.write(data) === false) + this.pause(); + } + const ret = this[DISCARDED] ? false : super.emit('data', data); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITEND]() { + if (this[EMITTED_END]) + return false; + this[EMITTED_END] = true; + this.readable = false; + return this[ASYNC] + ? (defer(() => this[EMITEND2]()), true) + : this[EMITEND2](); + } + [EMITEND2]() { + if (this[DECODER]) { + const data = this[DECODER].end(); + if (data) { + for (const p of this[PIPES]) { + p.dest.write(data); + } + if (!this[DISCARDED]) + super.emit('data', data); + } + } + for (const p of this[PIPES]) { + p.end(); + } + const ret = super.emit('end'); + this.removeAllListeners('end'); + return ret; + } + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + async collect() { + const buf = Object.assign([], { + dataLength: 0, + }); + if (!this[OBJECTMODE]) + buf.dataLength = 0; + // set the promise first, in case an error is raised + // by triggering the flow here. + const p = this.promise(); + this.on('data', c => { + buf.push(c); + if (!this[OBJECTMODE]) + buf.dataLength += c.length; + }); + await p; + return buf; + } + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + async concat() { + if (this[OBJECTMODE]) { + throw new Error('cannot concat in objectMode'); + } + const buf = await this.collect(); + return (this[ENCODING] + ? buf.join('') + : Buffer.concat(buf, buf.dataLength)); + } + /** + * Return a void Promise that resolves once the stream ends. + */ + async promise() { + return new Promise((resolve, reject) => { + this.on(DESTROYED, () => reject(new Error('stream destroyed'))); + this.on('error', er => reject(er)); + this.on('end', () => resolve()); + }); + } + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = async () => { + this.pause(); + stopped = true; + return { value: undefined, done: true }; + }; + const next = () => { + if (stopped) + return stop(); + const res = this.read(); + if (res !== null) + return Promise.resolve({ done: false, value: res }); + if (this[EOF]) + return stop(); + let resolve; + let reject; + const onerr = (er) => { + this.off('data', ondata); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + stop(); + reject(er); + }; + const ondata = (value) => { + this.off('error', onerr); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + this.pause(); + resolve({ value, done: !!this[EOF] }); + }; + const onend = () => { + this.off('error', onerr); + this.off('data', ondata); + this.off(DESTROYED, ondestroy); + stop(); + resolve({ done: true, value: undefined }); + }; + const ondestroy = () => onerr(new Error('stream destroyed')); + return new Promise((res, rej) => { + reject = rej; + resolve = res; + this.once(DESTROYED, ondestroy); + this.once('error', onerr); + this.once('end', onend); + this.once('data', ondata); + }); + }; + return { + next, + throw: stop, + return: stop, + [Symbol.asyncIterator]() { + return this; + }, + [Symbol.asyncDispose]: async () => { }, + }; + } + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = () => { + this.pause(); + this.off(ERROR, stop); + this.off(DESTROYED, stop); + this.off('end', stop); + stopped = true; + return { done: true, value: undefined }; + }; + const next = () => { + if (stopped) + return stop(); + const value = this.read(); + return value === null ? stop() : { done: false, value }; + }; + this.once('end', stop); + this.once(ERROR, stop); + this.once(DESTROYED, stop); + return { + next, + throw: stop, + return: stop, + [Symbol.iterator]() { + return this; + }, + [Symbol.dispose]: () => { }, + }; + } + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er); + else + this.emit(DESTROYED); + return this; + } + this[DESTROYED] = true; + this[DISCARDED] = true; + // throw away all buffered data, it's never coming out + this[BUFFER].length = 0; + this[BUFFERLENGTH] = 0; + const wc = this; + if (typeof wc.close === 'function' && !this[CLOSED]) + wc.close(); + if (er) + this.emit('error', er); + // if no error to emit, still reject pending promises + else + this.emit(DESTROYED); + return this; + } + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream() { + return isStream; + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/minipass/dist/esm/index.js.map b/node_modules/minipass/dist/esm/index.js.map new file mode 100644 index 00000000..4d87920c --- /dev/null +++ b/node_modules/minipass/dist/esm/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","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I,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QAEtB,MAAM,EAAE,GAAG,IAEV,CAAA;QACD,IAAI,OAAO,EAAE,CAAC,KAAK,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,EAAE,CAAC,KAAK,EAAE,CAAA;QAE/D,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QAC9B,qDAAqD;;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEzB,OAAO,IAAI,CAAA;IAAA,CACZ;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ,GAAG;QACpB,OAAO,QAAQ,CAAA;IAAA,CAChB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe {\n src: Minipass\n dest: Minipass\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable = Iterable & AsyncIterable\n\n type EventArguments = Record\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events = Minipass.Events\n >\n extends EventEmitter\n implements Minipass.DualIterable\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options]\n : [Minipass.Options])\n ) {\n const options: Minipass.Options = (args[0] ||\n {}) as Minipass.Options\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this as Minipass, dest, opts)\n : new PipeProxyErrors(this as Minipass, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/node_modules/minipass/dist/esm/package.json b/node_modules/minipass/dist/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/node_modules/minipass/dist/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/minipass/package.json b/node_modules/minipass/package.json new file mode 100644 index 00000000..800f215c --- /dev/null +++ b/node_modules/minipass/package.json @@ -0,0 +1,77 @@ +{ + "name": "minipass", + "version": "7.1.3", + "description": "minimal implementation of a PassThrough stream", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js", + "type": "module", + "tshy": { + "selfLink": false, + "compiler": "tsgo", + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "files": [ + "dist" + ], + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "prepare": "tshy", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "test": "tap", + "snap": "tap", + "format": "prettier --write . --loglevel warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" + }, + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "devDependencies": { + "@types/end-of-stream": "^1.4.2", + "@types/node": "^25.2.3", + "end-of-stream": "^1.4.0", + "node-abort-controller": "^3.1.1", + "prettier": "^3.8.1", + "tap": "^21.6.1", + "through2": "^2.0.3", + "tshy": "^3.3.2", + "typedoc": "^0.28.17" + }, + "repository": "https://github.com/isaacs/minipass", + "keywords": [ + "passthrough", + "stream" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } +} diff --git a/node_modules/moo/LICENSE b/node_modules/moo/LICENSE new file mode 100644 index 00000000..3810d823 --- /dev/null +++ b/node_modules/moo/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2017, Tim Radvan (tjvr) +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 the copyright holder 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 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 THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/moo/README.md b/node_modules/moo/README.md new file mode 100644 index 00000000..52b985e3 --- /dev/null +++ b/node_modules/moo/README.md @@ -0,0 +1,383 @@ +![](cow.png) + +Moo! +==== + +Moo is a highly-optimised tokenizer/lexer generator. Use it to tokenize your strings, before parsing 'em with a parser like [nearley](https://github.com/hardmath123/nearley) or whatever else you're into. + +* [Fast](#is-it-fast) +* [Convenient](#usage) +* uses [Regular Expressions](#on-regular-expressions) +* tracks [Line Numbers](#line-numbers) +* handles [Keywords](#keywords) +* supports [States](#states) +* custom [Errors](#errors) +* is even [Iterable](#iteration) +* has no dependencies +* 4KB minified + gzipped +* Moo! + +Is it fast? +----------- + +Yup! Flying-cows-and-singed-steak fast. + +Moo is the fastest JS tokenizer around. It's **~2–10x** faster than most other tokenizers; it's a **couple orders of magnitude** faster than some of the slower ones. + +Define your tokens **using regular expressions**. Moo will compile 'em down to a **single RegExp for performance**. It uses the new ES6 **sticky flag** where possible to make things faster; otherwise it falls back to an almost-as-efficient workaround. (For more than you ever wanted to know about this, read [adventures in the land of substrings and RegExps](http://mrale.ph/blog/2016/11/23/making-less-dart-faster.html).) + +You _might_ be able to go faster still by writing your lexer by hand rather than using RegExps, but that's icky. + +Oh, and it [avoids parsing RegExps by itself](https://hackernoon.com/the-madness-of-parsing-real-world-javascript-regexps-d9ee336df983#.2l8qu3l76). Because that would be horrible. + + +Usage +----- + +First, you need to do the needful: `$ npm install moo`, or whatever will ship this code to your computer. Alternatively, grab the `moo.js` file by itself and slap it into your web page via a ` + + + + +
{{ "%+010d"|sprintf:-123 }}
+
{{ "%+010d"|vsprintf:[-123] }}
+
{{ "%+010d"|fmt:-123 }}
+
{{ "%+010d"|vfmt:[-123] }}
+
{{ "I've got %2$d apples and %1$d oranges."|fmt:4:2 }}
+
{{ "I've got %(apples)d apples and %(oranges)d oranges."|fmt:{apples: 2, oranges: 4} }}
+ + + + diff --git a/node_modules/sprintf-js/dist/angular-sprintf.min.js b/node_modules/sprintf-js/dist/angular-sprintf.min.js new file mode 100644 index 00000000..dbaf744d --- /dev/null +++ b/node_modules/sprintf-js/dist/angular-sprintf.min.js @@ -0,0 +1,4 @@ +/*! sprintf-js | Alexandru Marasteanu (http://alexei.ro/) | BSD-3-Clause */ + +angular.module("sprintf",[]).filter("sprintf",function(){return function(){return sprintf.apply(null,arguments)}}).filter("fmt",["$filter",function(a){return a("sprintf")}]).filter("vsprintf",function(){return function(a,b){return vsprintf(a,b)}}).filter("vfmt",["$filter",function(a){return a("vsprintf")}]); +//# sourceMappingURL=angular-sprintf.min.map \ No newline at end of file diff --git a/node_modules/sprintf-js/dist/angular-sprintf.min.js.map b/node_modules/sprintf-js/dist/angular-sprintf.min.js.map new file mode 100644 index 00000000..055964c6 --- /dev/null +++ b/node_modules/sprintf-js/dist/angular-sprintf.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"} \ No newline at end of file diff --git a/node_modules/sprintf-js/dist/angular-sprintf.min.map b/node_modules/sprintf-js/dist/angular-sprintf.min.map new file mode 100644 index 00000000..055964c6 --- /dev/null +++ b/node_modules/sprintf-js/dist/angular-sprintf.min.map @@ -0,0 +1 @@ +{"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"} \ No newline at end of file diff --git a/node_modules/sprintf-js/dist/sprintf.min.js b/node_modules/sprintf-js/dist/sprintf.min.js new file mode 100644 index 00000000..dc61e51a --- /dev/null +++ b/node_modules/sprintf-js/dist/sprintf.min.js @@ -0,0 +1,4 @@ +/*! sprintf-js | Alexandru Marasteanu (http://alexei.ro/) | BSD-3-Clause */ + +!function(a){function b(){var a=arguments[0],c=b.cache;return c[a]&&c.hasOwnProperty(a)||(c[a]=b.parse(a)),b.format.call(null,c[a],arguments)}function c(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function d(a,b){return Array(b+1).join(a)}var e={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};b.format=function(a,f){var g,h,i,j,k,l,m,n=1,o=a.length,p="",q=[],r=!0,s="";for(h=0;o>h;h++)if(p=c(a[h]),"string"===p)q[q.length]=a[h];else if("array"===p){if(j=a[h],j[2])for(g=f[n],i=0;i=0),j[8]){case"b":g=g.toString(2);break;case"c":g=String.fromCharCode(g);break;case"d":case"i":g=parseInt(g,10);break;case"j":g=JSON.stringify(g,null,j[6]?parseInt(j[6]):0);break;case"e":g=j[7]?g.toExponential(j[7]):g.toExponential();break;case"f":g=j[7]?parseFloat(g).toFixed(j[7]):parseFloat(g);break;case"g":g=j[7]?parseFloat(g).toPrecision(j[7]):parseFloat(g);break;case"o":g=g.toString(8);break;case"s":g=(g=String(g))&&j[7]?g.substring(0,j[7]):g;break;case"u":g>>>=0;break;case"x":g=g.toString(16);break;case"X":g=g.toString(16).toUpperCase()}e.json.test(j[8])?q[q.length]=g:(!e.number.test(j[8])||r&&!j[3]?s="":(s=r?"+":"-",g=g.toString().replace(e.sign,"")),l=j[4]?"0"===j[4]?"0":j[4].charAt(1):" ",m=j[6]-(s+g).length,k=j[6]&&m>0?d(l,m):"",q[q.length]=j[5]?s+g+k:"0"===l?s+k+g:k+s+g)}return q.join("")},b.cache={},b.parse=function(a){for(var b=a,c=[],d=[],f=0;b;){if(null!==(c=e.text.exec(b)))d[d.length]=c[0];else if(null!==(c=e.modulo.exec(b)))d[d.length]="%";else{if(null===(c=e.placeholder.exec(b)))throw new SyntaxError("[sprintf] unexpected placeholder");if(c[2]){f|=1;var g=[],h=c[2],i=[];if(null===(i=e.key.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(g[g.length]=i[1];""!==(h=h.substring(i[0].length));)if(null!==(i=e.key_access.exec(h)))g[g.length]=i[1];else{if(null===(i=e.index_access.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");g[g.length]=i[1]}c[2]=g}else f|=2;if(3===f)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");d[d.length]=c}b=b.substring(c[0].length)}return d};var f=function(a,c,d){return d=(c||[]).slice(0),d.splice(0,0,a),b.apply(null,d)};"undefined"!=typeof exports?(exports.sprintf=b,exports.vsprintf=f):(a.sprintf=b,a.vsprintf=f,"function"==typeof define&&define.amd&&define(function(){return{sprintf:b,vsprintf:f}}))}("undefined"==typeof window?this:window); +//# sourceMappingURL=sprintf.min.map \ No newline at end of file diff --git a/node_modules/sprintf-js/dist/sprintf.min.js.map b/node_modules/sprintf-js/dist/sprintf.min.js.map new file mode 100644 index 00000000..369dbafa --- /dev/null +++ b/node_modules/sprintf-js/dist/sprintf.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sprintf.min.js","sources":["../src/sprintf.js"],"names":["window","sprintf","key","arguments","cache","hasOwnProperty","parse","format","call","get_type","variable","Object","prototype","toString","slice","toLowerCase","str_repeat","input","multiplier","Array","join","re","not_string","number","json","not_json","text","modulo","placeholder","key_access","index_access","sign","parse_tree","argv","arg","i","k","match","pad","pad_character","pad_length","cursor","tree_length","length","node_type","output","is_positive","Error","test","isNaN","TypeError","String","fromCharCode","parseInt","JSON","stringify","toExponential","parseFloat","toFixed","substring","toUpperCase","replace","charAt","fmt","_fmt","arg_names","exec","SyntaxError","field_list","replacement_field","field_match","vsprintf","_argv","splice","apply","exports","define","amd","this"],"mappings":";;CAAA,SAAUA,GAeN,QAASC,KACL,GAAIC,GAAMC,UAAU,GAAIC,EAAQH,EAAQG,KAIxC,OAHMA,GAAMF,IAAQE,EAAMC,eAAeH,KACrCE,EAAMF,GAAOD,EAAQK,MAAMJ,IAExBD,EAAQM,OAAOC,KAAK,KAAMJ,EAAMF,GAAMC,WA4JjD,QAASM,GAASC,GACd,MAAOC,QAAOC,UAAUC,SAASL,KAAKE,GAAUI,MAAM,EAAG,IAAIC,cAGjE,QAASC,GAAWC,EAAOC,GACvB,MAAOC,OAAMD,EAAa,GAAGE,KAAKH,GApLtC,GAAII,IACAC,WAAY,OACZC,OAAQ,SACRC,KAAM,MACNC,SAAU,OACVC,KAAM,YACNC,OAAQ,WACRC,YAAa,yFACb1B,IAAK,sBACL2B,WAAY,wBACZC,aAAc,aACdC,KAAM,UAWV9B,GAAQM,OAAS,SAASyB,EAAYC,GAClC,GAAiEC,GAAkBC,EAAGC,EAAGC,EAAOC,EAAKC,EAAeC,EAAhHC,EAAS,EAAGC,EAAcV,EAAWW,OAAQC,EAAY,GAASC,KAA0DC,GAAc,EAAMf,EAAO,EAC3J,KAAKI,EAAI,EAAOO,EAAJP,EAAiBA,IAEzB,GADAS,EAAYnC,EAASuB,EAAWG,IACd,WAAdS,EACAC,EAAOA,EAAOF,QAAUX,EAAWG,OAElC,IAAkB,UAAdS,EAAuB,CAE5B,GADAP,EAAQL,EAAWG,GACfE,EAAM,GAEN,IADAH,EAAMD,EAAKQ,GACNL,EAAI,EAAGA,E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CD,EAAWA,EAAWzB,QAAU2B,EAAY,OAE3C,CAAA,GAAgE,QAA3DA,EAAcjD,EAAGS,aAAaoC,KAAKG,IAIzC,KAAM,IAAIF,aAAY,+CAHtBC,GAAWA,EAAWzB,QAAU2B,EAAY,GAUxDjC,EAAM,GAAK+B,MAGXH,IAAa,CAEjB,IAAkB,IAAdA,EACA,KAAM,IAAIlB,OAAM,4EAEpBf,GAAWA,EAAWW,QAAUN,EAKpC2B,EAAOA,EAAKL,UAAUtB,EAAM,GAAGM,QAEnC,MAAOX,GAGX,IAAIuC,GAAW,SAASR,EAAK9B,EAAMuC,GAG/B,MAFAA,IAASvC,OAAYnB,MAAM,GAC3B0D,EAAMC,OAAO,EAAG,EAAGV,GACZ9D,EAAQyE,MAAM,KAAMF,GAiBR,oBAAZG,UACPA,QAAQ1E,QAAUA,EAClB0E,QAAQJ,SAAWA,IAGnBvE,EAAOC,QAAUA,EACjBD,EAAOuE,SAAWA,EAEI,kBAAXK,SAAyBA,OAAOC,KACvCD,OAAO,WACH,OACI3E,QAASA,EACTsE,SAAUA,OAKT,mBAAXvE,QAAyB8E,KAAO9E"} \ No newline at end of file diff --git a/node_modules/sprintf-js/dist/sprintf.min.map b/node_modules/sprintf-js/dist/sprintf.min.map new file mode 100644 index 00000000..ee011aaa --- /dev/null +++ b/node_modules/sprintf-js/dist/sprintf.min.map @@ -0,0 +1 @@ +{"version":3,"file":"sprintf.min.js","sources":["../src/sprintf.js"],"names":["window","sprintf","key","arguments","cache","hasOwnProperty","parse","format","call","get_type","variable","Object","prototype","toString","slice","toLowerCase","str_repeat","input","multiplier","Array","join","re","not_string","number","json","not_json","text","modulo","placeholder","key_access","index_access","sign","parse_tree","argv","arg","i","k","match","pad","pad_character","pad_length","cursor","tree_length","length","node_type","output","is_positive","Error","test","isNaN","TypeError","String","fromCharCode","parseInt","JSON","stringify","toExponential","parseFloat","toFixed","toPrecision","substring","toUpperCase","replace","charAt","fmt","_fmt","arg_names","exec","SyntaxError","field_list","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AAY,GAUxDlC,EAAM,GAAKgC,MAGXH,IAAa,CAEjB,IAAkB,IAAdA,EACA,KAAM,IAAInB,OAAM,4EAEpBf,GAAWA,EAAWW,QAAUN,EAKpC4B,EAAOA,EAAKL,UAAUvB,EAAM,GAAGM,QAEnC,MAAOX,GAGX,IAAIwC,GAAW,SAASR,EAAK/B,EAAMwC,GAG/B,MAFAA,IAASxC,OAAYnB,MAAM,GAC3B2D,EAAMC,OAAO,EAAG,EAAGV,GACZ/D,EAAQ0E,MAAM,KAAMF,GAiBR,oBAAZG,UACPA,QAAQ3E,QAAUA,EAClB2E,QAAQJ,SAAWA,IAGnBxE,EAAOC,QAAUA,EACjBD,EAAOwE,SAAWA,EAEI,kBAAXK,SAAyBA,OAAOC,KACvCD,OAAO,WACH,OACI5E,QAASA,EACTuE,SAAUA,OAKT,mBAAXxE,QAAyB+E,KAAO/E"} \ No newline at end of file diff --git a/node_modules/sprintf-js/gruntfile.js b/node_modules/sprintf-js/gruntfile.js new file mode 100644 index 00000000..246e1c3b --- /dev/null +++ b/node_modules/sprintf-js/gruntfile.js @@ -0,0 +1,36 @@ +module.exports = function(grunt) { + grunt.initConfig({ + pkg: grunt.file.readJSON("package.json"), + + uglify: { + options: { + banner: "/*! <%= pkg.name %> | <%= pkg.author %> | <%= pkg.license %> */\n", + sourceMap: true + }, + build: { + files: [ + { + src: "src/sprintf.js", + dest: "dist/sprintf.min.js" + }, + { + src: "src/angular-sprintf.js", + dest: "dist/angular-sprintf.min.js" + } + ] + } + }, + + watch: { + js: { + files: "src/*.js", + tasks: ["uglify"] + } + } + }) + + grunt.loadNpmTasks("grunt-contrib-uglify") + grunt.loadNpmTasks("grunt-contrib-watch") + + grunt.registerTask("default", ["uglify", "watch"]) +} diff --git a/node_modules/sprintf-js/package.json b/node_modules/sprintf-js/package.json new file mode 100644 index 00000000..75f7eca7 --- /dev/null +++ b/node_modules/sprintf-js/package.json @@ -0,0 +1,22 @@ +{ + "name": "sprintf-js", + "version": "1.0.3", + "description": "JavaScript sprintf implementation", + "author": "Alexandru Marasteanu (http://alexei.ro/)", + "main": "src/sprintf.js", + "scripts": { + "test": "mocha test/test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/alexei/sprintf.js.git" + }, + "license": "BSD-3-Clause", + "readmeFilename": "README.md", + "devDependencies": { + "mocha": "*", + "grunt": "*", + "grunt-contrib-watch": "*", + "grunt-contrib-uglify": "*" + } +} diff --git a/node_modules/sprintf-js/src/angular-sprintf.js b/node_modules/sprintf-js/src/angular-sprintf.js new file mode 100644 index 00000000..9c69123b --- /dev/null +++ b/node_modules/sprintf-js/src/angular-sprintf.js @@ -0,0 +1,18 @@ +angular. + module("sprintf", []). + filter("sprintf", function() { + return function() { + return sprintf.apply(null, arguments) + } + }). + filter("fmt", ["$filter", function($filter) { + return $filter("sprintf") + }]). + filter("vsprintf", function() { + return function(format, argv) { + return vsprintf(format, argv) + } + }). + filter("vfmt", ["$filter", function($filter) { + return $filter("vsprintf") + }]) diff --git a/node_modules/sprintf-js/src/sprintf.js b/node_modules/sprintf-js/src/sprintf.js new file mode 100644 index 00000000..c0fc7c08 --- /dev/null +++ b/node_modules/sprintf-js/src/sprintf.js @@ -0,0 +1,208 @@ +(function(window) { + var re = { + not_string: /[^s]/, + number: /[diefg]/, + json: /[j]/, + not_json: /[^j]/, + text: /^[^\x25]+/, + modulo: /^\x25{2}/, + placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/, + key: /^([a-z_][a-z_\d]*)/i, + key_access: /^\.([a-z_][a-z_\d]*)/i, + index_access: /^\[(\d+)\]/, + sign: /^[\+\-]/ + } + + function sprintf() { + var key = arguments[0], cache = sprintf.cache + if (!(cache[key] && cache.hasOwnProperty(key))) { + cache[key] = sprintf.parse(key) + } + return sprintf.format.call(null, cache[key], arguments) + } + + sprintf.format = function(parse_tree, argv) { + var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = "" + for (i = 0; i < tree_length; i++) { + node_type = get_type(parse_tree[i]) + if (node_type === "string") { + output[output.length] = parse_tree[i] + } + else if (node_type === "array") { + match = parse_tree[i] // convenience purposes only + if (match[2]) { // keyword argument + arg = argv[cursor] + for (k = 0; k < match[2].length; k++) { + if (!arg.hasOwnProperty(match[2][k])) { + throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k])) + } + arg = arg[match[2][k]] + } + } + else if (match[1]) { // positional argument (explicit) + arg = argv[match[1]] + } + else { // positional argument (implicit) + arg = argv[cursor++] + } + + if (get_type(arg) == "function") { + arg = arg() + } + + if (re.not_string.test(match[8]) && re.not_json.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) { + throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg))) + } + + if (re.number.test(match[8])) { + is_positive = arg >= 0 + } + + switch (match[8]) { + case "b": + arg = arg.toString(2) + break + case "c": + arg = String.fromCharCode(arg) + break + case "d": + case "i": + arg = parseInt(arg, 10) + break + case "j": + arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0) + break + case "e": + arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential() + break + case "f": + arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) + break + case "g": + arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg) + break + case "o": + arg = arg.toString(8) + break + case "s": + arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg) + break + case "u": + arg = arg >>> 0 + break + case "x": + arg = arg.toString(16) + break + case "X": + arg = arg.toString(16).toUpperCase() + break + } + if (re.json.test(match[8])) { + output[output.length] = arg + } + else { + if (re.number.test(match[8]) && (!is_positive || match[3])) { + sign = is_positive ? "+" : "-" + arg = arg.toString().replace(re.sign, "") + } + else { + sign = "" + } + pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " " + pad_length = match[6] - (sign + arg).length + pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : "") : "" + output[output.length] = match[5] ? sign + arg + pad : (pad_character === "0" ? sign + pad + arg : pad + sign + arg) + } + } + } + return output.join("") + } + + sprintf.cache = {} + + sprintf.parse = function(fmt) { + var _fmt = fmt, match = [], parse_tree = [], arg_names = 0 + while (_fmt) { + if ((match = re.text.exec(_fmt)) !== null) { + parse_tree[parse_tree.length] = match[0] + } + else if ((match = re.modulo.exec(_fmt)) !== null) { + parse_tree[parse_tree.length] = "%" + } + else if ((match = re.placeholder.exec(_fmt)) !== null) { + if (match[2]) { + arg_names |= 1 + var field_list = [], replacement_field = match[2], field_match = [] + if ((field_match = re.key.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") { + if ((field_match = re.key_access.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + } + else if ((field_match = re.index_access.exec(replacement_field)) !== null) { + field_list[field_list.length] = field_match[1] + } + else { + throw new SyntaxError("[sprintf] failed to parse named argument key") + } + } + } + else { + throw new SyntaxError("[sprintf] failed to parse named argument key") + } + match[2] = field_list + } + else { + arg_names |= 2 + } + if (arg_names === 3) { + throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported") + } + parse_tree[parse_tree.length] = match + } + else { + throw new SyntaxError("[sprintf] unexpected placeholder") + } + _fmt = _fmt.substring(match[0].length) + } + return parse_tree + } + + var vsprintf = function(fmt, argv, _argv) { + _argv = (argv || []).slice(0) + _argv.splice(0, 0, fmt) + return sprintf.apply(null, _argv) + } + + /** + * helpers + */ + function get_type(variable) { + return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase() + } + + function str_repeat(input, multiplier) { + return Array(multiplier + 1).join(input) + } + + /** + * export to either browser or node.js + */ + if (typeof exports !== "undefined") { + exports.sprintf = sprintf + exports.vsprintf = vsprintf + } + else { + window.sprintf = sprintf + window.vsprintf = vsprintf + + if (typeof define === "function" && define.amd) { + define(function() { + return { + sprintf: sprintf, + vsprintf: vsprintf + } + }) + } + } +})(typeof window === "undefined" ? this : window); diff --git a/node_modules/sprintf-js/test/test.js b/node_modules/sprintf-js/test/test.js new file mode 100644 index 00000000..6f57b253 --- /dev/null +++ b/node_modules/sprintf-js/test/test.js @@ -0,0 +1,82 @@ +var assert = require("assert"), + sprintfjs = require("../src/sprintf.js"), + sprintf = sprintfjs.sprintf, + vsprintf = sprintfjs.vsprintf + +describe("sprintfjs", function() { + var pi = 3.141592653589793 + + it("should return formated strings for simple placeholders", function() { + assert.equal("%", sprintf("%%")) + assert.equal("10", sprintf("%b", 2)) + assert.equal("A", sprintf("%c", 65)) + assert.equal("2", sprintf("%d", 2)) + assert.equal("2", sprintf("%i", 2)) + assert.equal("2", sprintf("%d", "2")) + assert.equal("2", sprintf("%i", "2")) + assert.equal('{"foo":"bar"}', sprintf("%j", {foo: "bar"})) + assert.equal('["foo","bar"]', sprintf("%j", ["foo", "bar"])) + assert.equal("2e+0", sprintf("%e", 2)) + assert.equal("2", sprintf("%u", 2)) + assert.equal("4294967294", sprintf("%u", -2)) + assert.equal("2.2", sprintf("%f", 2.2)) + assert.equal("3.141592653589793", sprintf("%g", pi)) + assert.equal("10", sprintf("%o", 8)) + assert.equal("%s", sprintf("%s", "%s")) + assert.equal("ff", sprintf("%x", 255)) + assert.equal("FF", sprintf("%X", 255)) + assert.equal("Polly wants a cracker", sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")) + assert.equal("Hello world!", sprintf("Hello %(who)s!", {"who": "world"})) + }) + + it("should return formated strings for complex placeholders", function() { + // sign + assert.equal("2", sprintf("%d", 2)) + assert.equal("-2", sprintf("%d", -2)) + assert.equal("+2", sprintf("%+d", 2)) + assert.equal("-2", sprintf("%+d", -2)) + assert.equal("2", sprintf("%i", 2)) + assert.equal("-2", sprintf("%i", -2)) + assert.equal("+2", sprintf("%+i", 2)) + assert.equal("-2", sprintf("%+i", -2)) + assert.equal("2.2", sprintf("%f", 2.2)) + assert.equal("-2.2", sprintf("%f", -2.2)) + assert.equal("+2.2", sprintf("%+f", 2.2)) + assert.equal("-2.2", sprintf("%+f", -2.2)) + assert.equal("-2.3", sprintf("%+.1f", -2.34)) + assert.equal("-0.0", sprintf("%+.1f", -0.01)) + assert.equal("3.14159", sprintf("%.6g", pi)) + assert.equal("3.14", sprintf("%.3g", pi)) + assert.equal("3", sprintf("%.1g", pi)) + assert.equal("-000000123", sprintf("%+010d", -123)) + assert.equal("______-123", sprintf("%+'_10d", -123)) + assert.equal("-234.34 123.2", sprintf("%f %f", -234.34, 123.2)) + + // padding + assert.equal("-0002", sprintf("%05d", -2)) + assert.equal("-0002", sprintf("%05i", -2)) + assert.equal(" <", sprintf("%5s", "<")) + assert.equal("0000<", sprintf("%05s", "<")) + assert.equal("____<", sprintf("%'_5s", "<")) + assert.equal("> ", sprintf("%-5s", ">")) + assert.equal(">0000", sprintf("%0-5s", ">")) + assert.equal(">____", sprintf("%'_-5s", ">")) + assert.equal("xxxxxx", sprintf("%5s", "xxxxxx")) + assert.equal("1234", sprintf("%02u", 1234)) + assert.equal(" -10.235", sprintf("%8.3f", -10.23456)) + assert.equal("-12.34 xxx", sprintf("%f %s", -12.34, "xxx")) + assert.equal('{\n "foo": "bar"\n}', sprintf("%2j", {foo: "bar"})) + assert.equal('[\n "foo",\n "bar"\n]', sprintf("%2j", ["foo", "bar"])) + + // precision + assert.equal("2.3", sprintf("%.1f", 2.345)) + assert.equal("xxxxx", sprintf("%5.5s", "xxxxxx")) + assert.equal(" x", sprintf("%5.1s", "xxxxxx")) + + }) + + it("should return formated strings for callbacks", function() { + assert.equal("foobar", sprintf("%s", function() { return "foobar" })) + assert.equal(Date.now(), sprintf("%s", Date.now)) // should pass... + }) +}) diff --git a/node_modules/ssri/LICENSE.md b/node_modules/ssri/LICENSE.md new file mode 100644 index 00000000..e3353888 --- /dev/null +++ b/node_modules/ssri/LICENSE.md @@ -0,0 +1,16 @@ +ISC License + +Copyright 2021 (c) npm, Inc. + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted, provided that the +above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER DISCLAIMS +ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE +USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/ssri/README.md b/node_modules/ssri/README.md new file mode 100644 index 00000000..6f46aa5b --- /dev/null +++ b/node_modules/ssri/README.md @@ -0,0 +1,528 @@ +# ssri [![npm version](https://img.shields.io/npm/v/ssri.svg)](https://npm.im/ssri) [![license](https://img.shields.io/npm/l/ssri.svg)](https://npm.im/ssri) [![Travis](https://img.shields.io/travis/npm/ssri.svg)](https://travis-ci.org/npm/ssri) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/npm/ssri?svg=true)](https://ci.appveyor.com/project/npm/ssri) [![Coverage Status](https://coveralls.io/repos/github/npm/ssri/badge.svg?branch=latest)](https://coveralls.io/github/npm/ssri?branch=latest) + +[`ssri`](https://github.com/npm/ssri), short for Standard Subresource +Integrity, is a Node.js utility for parsing, manipulating, serializing, +generating, and verifying [Subresource +Integrity](https://w3c.github.io/webappsec/specs/subresourceintegrity/) hashes. + +## Install + +`$ npm install --save ssri` + +## Table of Contents + +* [Example](#example) +* [Features](#features) +* [Contributing](#contributing) +* [API](#api) + * Parsing & Serializing + * [`parse`](#parse) + * [`stringify`](#stringify) + * [`Integrity#concat`](#integrity-concat) + * [`Integrity#merge`](#integrity-merge) + * [`Integrity#toString`](#integrity-to-string) + * [`Integrity#toJSON`](#integrity-to-json) + * [`Integrity#match`](#integrity-match) + * [`Integrity#pickAlgorithm`](#integrity-pick-algorithm) + * [`Integrity#hexDigest`](#integrity-hex-digest) + * Integrity Generation + * [`fromHex`](#from-hex) + * [`fromData`](#from-data) + * [`fromStream`](#from-stream) + * [`create`](#create) + * Integrity Verification + * [`checkData`](#check-data) + * [`checkStream`](#check-stream) + * [`integrityStream`](#integrity-stream) + +### Example + +```javascript +const ssri = require('ssri') + +const integrity = 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' + +// Parsing and serializing +const parsed = ssri.parse(integrity) +ssri.stringify(parsed) // === integrity (works on non-Integrity objects) +parsed.toString() // === integrity + +// Async stream functions +ssri.checkStream(fs.createReadStream('./my-file'), integrity).then(...) +ssri.fromStream(fs.createReadStream('./my-file')).then(sri => { + sri.toString() === integrity +}) +fs.createReadStream('./my-file').pipe(ssri.createCheckerStream(sri)) + +// Sync data functions +ssri.fromData(fs.readFileSync('./my-file')) // === parsed +ssri.checkData(fs.readFileSync('./my-file'), integrity) // => 'sha512' +``` + +### Features + +* Parses and stringifies SRI strings. +* Generates SRI strings from raw data or Streams. +* Strict standard compliance. +* `?foo` metadata option support. +* Multiple entries for the same algorithm. +* Object-based integrity hash manipulation. +* Small footprint: no dependencies, concise implementation. +* Full test coverage. +* Customizable algorithm picker. + +### Contributing + +The ssri team enthusiastically welcomes contributions and project participation! +There's a bunch of things you can do if you want to contribute! The [Contributor +Guide](CONTRIBUTING.md) has all the information you need for everything from +reporting bugs to contributing entire new features. Please don't hesitate to +jump in if you'd like to, or even ask us questions if something isn't clear. + +### API + +#### `> ssri.parse(sri, [opts]) -> Integrity` + +Parses `sri` into an `Integrity` data structure. `sri` can be an integrity +string, an `Hash`-like with `digest` and `algorithm` fields and an optional +`options` field, or an `Integrity`-like object. The resulting object will be an +`Integrity` instance that has this shape: + +```javascript +{ + 'sha1': [{algorithm: 'sha1', digest: 'deadbeef', options: []}], + 'sha512': [ + {algorithm: 'sha512', digest: 'c0ffee', options: []}, + {algorithm: 'sha512', digest: 'bad1dea', options: ['foo']} + ], +} +``` + +If `opts.single` is truthy, a single `Hash` object will be returned. That is, a +single object that looks like `{algorithm, digest, options}`, as opposed to a +larger object with multiple of these. + +If `opts.strict` is truthy, the resulting object will be filtered such that +it strictly follows the Subresource Integrity spec, throwing away any entries +with any invalid components. This also means a restricted set of algorithms +will be used -- the spec limits them to `sha256`, `sha384`, and `sha512`. + +Strict mode is recommended if the integrity strings are intended for use in +browsers, or in other situations where strict adherence to the spec is needed. + +##### Example + +```javascript +ssri.parse('sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo') // -> Integrity object +``` + +#### `> ssri.stringify(sri, [opts]) -> String` + +This function is identical to [`Integrity#toString()`](#integrity-to-string), +except it can be used on _any_ object that [`parse`](#parse) can handle -- that +is, a string, an `Hash`-like, or an `Integrity`-like. + +The `opts.sep` option defines the string to use when joining multiple entries +together. To be spec-compliant, this _must_ be whitespace. The default is a +single space (`' '`). + +If `opts.strict` is true, the integrity string will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +// Useful for cleaning up input SRI strings: +ssri.stringify('\n\rsha512-foo\n\t\tsha384-bar') +// -> 'sha512-foo sha384-bar' + +// Hash-like: only a single entry. +ssri.stringify({ + algorithm: 'sha512', + digest:'9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==', + options: ['foo'] +}) +// -> +// 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' + +// Integrity-like: full multi-entry syntax. Similar to output of `ssri.parse` +ssri.stringify({ + 'sha512': [ + { + algorithm: 'sha512', + digest:'9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==', + options: ['foo'] + } + ] +}) +// -> +// 'sha512-9KhgCRIx/AmzC8xqYJTZRrnO8OW2Pxyl2DIMZSBOr0oDvtEFyht3xpp71j/r/pAe1DM+JI/A+line3jUBgzQ7A==?foo' +``` + +#### `> Integrity#concat(otherIntegrity, [opts]) -> Integrity` + +Concatenates an `Integrity` object with another IntegrityLike, or an integrity +string. + +This is functionally equivalent to concatenating the string format of both +integrity arguments, and calling [`ssri.parse`](#ssri-parse) on the new string. + +If `opts.strict` is true, the new `Integrity` will be created using strict +parsing rules. See [`ssri.parse`](#parse). + +##### Example + +```javascript +// This will combine the integrity checks for two different versions of +// your index.js file so you can use a single integrity string and serve +// either of these to clients, from a single `