From b9482c397b79c22992c03250480ef23b1ccdcec3 Mon Sep 17 00:00:00 2001 From: Niels Holt Date: Tue, 6 Feb 2024 23:19:38 +0100 Subject: [PATCH] Adjust to fcoo-havnelods 3.1.2 --- bower.json | 2 +- demo/bower_components.css | 6383 +++--- demo/bower_components.js | 40038 ++++++++++++++++++++++------------ demo/index.html | 3 + dist/fcoo-maps-havnelods.js | 96 +- package.json | 2 +- src/fcoo-maps-havnelods.js | 96 +- 7 files changed, 29791 insertions(+), 16829 deletions(-) diff --git a/bower.json b/bower.json index 860b693..2b0622c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "fcoo-maps-havnelods", - "version": "1.1.2", + "version": "1.2.0", "homepage": "https://github.com/FCOO/fcoo-maps-havnelods", "authors": [ "Niels Holt" diff --git a/demo/bower_components.css b/demo/bower_components.css index 5c96f9e..c91ffb5 100644 --- a/demo/bower_components.css +++ b/demo/bower_components.css @@ -961,6 +961,141 @@ svg.leaflet-image-layer.leaflet-interactive path { } } +@charset "UTF-8"; +/*********************************************** + fcoo-colors.scss, + + (c) 2023, FCOO + + https://github.com/fcoo/fcoo-colors + https://github.com/fcoo + + +************************************************/ +/*********************************************************************** + +leaflet-bootstrap-marker-mixin.scss + +*************************************************************************/ +/*********************************************************************** +marker-circle-color +Create style for bsMarkerCircle in different colors +*************************************************************************/ +/*********************************************************************** +lbm-circle-and-icon-classes +Create class for bsMarkerCircle named $name with color and color-border +*************************************************************************/ +/*********************************************************************** +lbm-marker-and-icon-classes +Create class for bsMarkerCircle named $name with color and color-border +*************************************************************************/ +/*********************************************************************** +fa-lbm-color +Create class for color and border-color used by L.bsMarkerAsIcon (and $.bsMarkerAsIcon) +to create fa-icon looking like the marker +*************************************************************************/ +/*********************************************** + _leaflet-polyline-mixin.scss + + (c) 2018, FCOO + + https://github.com/FCOO/leaflet-polyline + https://github.com/FCOO + +************************************************/ +/********************************************************** + fcoo-colors-variables.scss, + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO +**********************************************************/ +/********************************************************** +The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf +**********************************************************/ +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +in src/_fcoo-color-mixin.scss +**********************************************************/ +/********************************************************** + fcoo-colors-mixin.scss + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO + +**********************************************************/ +/********************************************************** +Functions to get colors in different (relative) gradients +**********************************************************/ +/********************************************************** +marker-and-polygon-color +create color-classes for bsMarker and bsPolyline +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +**********************************************************/ +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +:root { + --fc-time-past-color: #EADCC1; + --fc-time-past-text-color: #000; + --fc-time-now-color: #3B7511; + --fc-time-now-text-color: #fff; + --fc-time-future-color: #94B5C2; + --fc-time-future-text-color: #000; +} + +.time-past-text-color { + color: var(--fc-time-past-text-color); +} + +.time-past-color { + background-color: var(--fc-time-past-color); +} + +.time-now-text-color { + color: var(--fc-time-now-text-color); +} + +.time-now-color { + background-color: var(--fc-time-now-color); +} + +.time-future-text-color { + color: var(--fc-time-future-text-color); +} + +.time-future-color { + background-color: var(--fc-time-future-color); +} + +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +in src/_fcoo-color-mixin.scss +**********************************************************/ +:root { + --_fcoo-default-app-base-color: #3f5b58; + --fcoo-app-base-color: var(--_fcoo-app-base-color, var(--_fcoo-default-app-base-color)); + --_fcoo-default-app-base-text-color: #ffffff; + --fcoo-app-base-text-color: var(--_fcoo-app-base-text-color, var(--_fcoo-default-app-base-text-color)); +} + +.fcoo-app-base-text-color { + color: var(--fcoo-app-base-text-color); +} + +.fcoo-app-base-color { + background-color: var(--fcoo-app-base-color); +} @charset "UTF-8"; /*********************************************** fcoo-fontawesome.scss, @@ -16412,6 +16547,241 @@ Move the icon MOVE em in x or y direction .fa-move-y-75 { transform: translateY(0.75em); } +@charset "UTF-8"; +/*********************************************** +fcoo-application-logo-and-color.scss, + +Defines default application-color +************************************************/ +/********************************************************** + fcoo-colors-include.scss, + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO + + + Contain all include for a packages using + the scss-variables and scss-mixins of fcoo-colors + + The scss file must also include + + //COLOR-HELPER + @import "../bower_components/sass-color-helpers/stylesheets/color-helpers"; + + //LEAFLET-BOOTSTRAP-MARKER-MIXIN - mixin to create colors for marker (bsMarker) + @import "../bower_components/leaflet-bootstrap-marker-mixin/dist/leaflet-bootstrap-marker-mixin"; + + //LEAFLET-POLYLINE-MIXIN - mixin to create colors for polyline and polygon + @import "../bower_components/leaflet-polyline-mixin/dist/leaflet-polyline-mixin"; + +**********************************************************/ +/********************************************************** + fcoo-colors-variables.scss, + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO +**********************************************************/ +/********************************************************** +The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf +**********************************************************/ +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +in src/_fcoo-color-mixin.scss +**********************************************************/ +/********************************************************** + fcoo-colors-mixin.scss + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO + +**********************************************************/ +/********************************************************** +Functions to get colors in different (relative) gradients +**********************************************************/ +/********************************************************** +marker-and-polygon-color +create color-classes for bsMarker and bsPolyline +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +**********************************************************/ +/***************************************************** +FONT-FAMILY +Standard font-family from fmi.dk and Forsvarsministeriets koncernfælles Designmanual 2018 +*****************************************************/ +:root { + --fmn-font-family: Verdana, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; +} + +/***************************************************** +LOADING and WORKING +Style for the
covering the page during loading +*****************************************************/ +html.loading .hide-for-loading { + display: none !important; +} + +html.no-loading .show-for-loading { + display: none !important; +} + +/* Blinking dots from https://martinwolf.org/before-2018/blog/2015/01/pure-css-savingloading-dots-animation/ */ +@keyframes blink { + 0% { + opacity: 0.2; + } + 20% { + opacity: 1; + } + 100% { + opacity: 0.2; + } +} +div.loading { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + z-index: 2147483647; + background-color: var(--fcoo-app-base-color); + opacity: 1; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + cursor: progress; +} +div.loading > div { + position: absolute; + width: 100%; + margin: 0; + padding: 0; + cursor: inherit; + text-align: center; +} +div.loading > div.version { + font-family: var(--fmn-font-family); + font-size: 2rem; + top: 0; + height: 3rem; + line-height: 3rem; + margin-bottom: -3rem; + background-color: red; + color: white; +} +div.loading > div.version:empty { + visibility: hidden; +} +div.loading > div.logo { + background-repeat: no-repeat; + background-size: contain; + background-position: center; +} +html.logo-portrait div.loading > div.logo { + height: 80vmin; + width: 100%; +} +html.no-logo-portrait div.loading > div.logo { + height: 100%; + width: 80vmin; +} +html.fab-text-color-is-white div.loading > div.logo { + background-image: var(--fcoo-app-logo_black-url) !important; + background-image: var(--fcoo-app-logo_white-url); +} +html.no-fab-text-color-is-white div.loading > div.logo { + background-image: var(--fcoo-app-logo_white-url) !important; + background-image: var(--fcoo-app-logo_black-url); +} +div.loading > div.dots { + height: 1em; + bottom: 0; + font-size: 6rem; + display: flex; + align-items: end; + justify-content: center; +} +div.loading > div.dots span { + font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif; + color: var(--fcoo-app-base-text-color); + width: 0.25em; + animation-name: blink; + animation-duration: 1.4s; + animation-iteration-count: infinite; + animation-fill-mode: both; +} +div.loading > div.dots span:nth-child(2) { + animation-delay: 0.2s; +} +div.loading > div.dots span:nth-child(3) { + animation-delay: 0.4s; +} +html.no-loading div.loading { + width: 0; + height: 0; + opacity: 0; + transition: opacity 0.4s ease-out 0s, width 0s ease-in-out 0.4s, height 0s ease-in-out 0.4s; +} +html.no-loading div.loading:before, html.no-loading div.loading > div { + display: none !important; +} + +html.working .hide-for-working { + display: none !important; +} + +html.no-working .show-for-working { + display: none !important; +} + +div.working { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + z-index: 2147483647; + background-color: white; + opacity: 0.5; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + cursor: progress; + --fa-animation-duration: 1s; +} + +/***************************************************** + +*****************************************************/ +:root { + --fcoo-app-logo-wh-ratio: var(--_fcoo-app-logo-wh-ratio, 1); +} + +.fcoo-app-standard-logo { + width: 200px; + height: 160px; + background-image: var(--fcoo-app-logo-url); + background-repeat: no-repeat; + background-size: contain; + background-position: center; +} +html.logo-portrait .fcoo-app-standard-logo { + width: calc(160px * var(--fcoo-app-logo-wh-ratio)); + height: 160px; +} +html.no-logo-portrait .fcoo-app-standard-logo { + width: 200px; + height: calc(200px / var(--fcoo-app-logo-wh-ratio)); +} /*********************************************** jquery-base-slider.scss, Description from README.md @@ -16432,122 +16802,164 @@ The scss is divided in two parts: First the common part equal for all types and left: 0; width: 100%; height: 100%; - overflow-x: hidden; } - .base-slider-container-outer .base-slider-container-full-width { - position: relative; - left: 0; - overflow-y: visible; } + overflow-x: hidden; +} +.base-slider-container-outer .base-slider-container-full-width { + position: relative; + left: 0; + overflow-y: visible; +} /*************************************************************** COMMON STYLE ***************************************************************/ +.pre-line, .grid .grid-color.pre, .base-slider-container .line .line-color.pre { + left: -50%; + width: 50%; + background-color: rgba(0, 0, 0, 0.1); +} + +.post-line, .grid .grid-color.post, .base-slider-container .line .line-color.post { + left: 100%; + width: 50%; + background-color: rgba(0, 0, 0, 0.1); +} + .base-slider-container { position: relative; display: block; user-select: none; - box-sizing: border-box; } - .base-slider-container .line-background { - position: absolute; - display: block; - width: 100%; - top: 0; } - .base-slider-container .line { - position: relative; - display: block; - width: 100%; - height: 4px; - left: -1px; - overflow: hidden; - outline: none !important; - box-sizing: content-box; - background-color: transparent; - border: 1px solid #afb3bb; - border-bottom-left-radius: 2px; - border-top-left-radius: 2px; - border-bottom-right-radius: 2px; - border-top-right-radius: 2px; } - .base-slider-container .line .line-color { - position: absolute; - display: block; - height: 100%; } - .base-slider-container .line .line-color:first-child { - border-bottom-left-radius: 2px; - border-top-left-radius: 2px; } - .base-slider-container .line .line-color:last-child:not(:first-child) { - border-bottom-right-radius: 2px; - border-top-right-radius: 2px; } - .base-slider-container .handle { - position: absolute; - display: block; - z-index: 10; - top: 20.33px; - background-size: 100% 100%; - background-repeat: no-repeat; - background-attachment: local; - background-position: 0% 0%; } - .base-slider-container .handle.type-last { - z-index: 12; } - .base-slider-container .handle.pin { - position: absolute; - z-index: 100; - height: 10.2857142857px !important; - margin-top: -8.2285714286px; - width: 16px; - margin-left: -8px; - font-size: 10.2857142857px; - text-align: center; - background-image: none !important; } - .base-slider-container .marker-outer { - position: absolute; - top: 0px; - z-index: 2; - cursor: default; - font-family: Arial, sans-serif; - font-size: 10px; } - .base-slider-container .marker-outer .marker { - box-sizing: border-box; - width: 100%; - height: 100%; - margin-left: -50%; - padding: 0; } - .base-slider-container .marker-outer.frame .marker:after { - position: absolute; - display: block; - top: 100%; - left: 0; - width: 0; - height: 0; - margin-left: -3px; - content: ""; - overflow: hidden; - border: 3px solid transparent; - border-top-color: black; } - .base-slider-container .marker-outer .marker-text { - display: inline-block; - cursor: inherit; - box-sizing: border-box; - line-height: 1.333; - padding: 1px 5px; - border: 1px solid transparent; - border-radius: 4px; - white-space: nowrap; - text-shadow: none; } - .base-slider-container .marker-outer.min-max .marker-text { - color: #555; - background-color: #d1d6e0; - border: 1px solid #afb3bb; - border-radius: 4px; } - .base-slider-container .marker-outer.single-from-to .marker-text { - color: #111; } - .base-slider-container .marker-outer.single-from-to.frame .marker-text { - background: white; - border: 1px solid black; } + box-sizing: border-box; +} +.base-slider-container .line-background { + position: absolute; + display: block; + width: 100%; + top: 0; +} +.base-slider-container.fixed .line { + overflow: visible; +} +.base-slider-container .line { + position: relative; + display: block; + width: 100%; + height: 4px; + left: -1px; + overflow: hidden; + outline: none !important; + box-sizing: content-box; + background-color: transparent; + border: 1px solid rgb(175, 179, 187); + border-bottom-left-radius: 2px; + border-top-left-radius: 2px; + border-bottom-right-radius: 2px; + border-top-right-radius: 2px; +} +.base-slider-container .line .line-color { + position: absolute; + display: block; + height: 100%; +} +.base-slider-container .line .line-color.pre { + top: -1px; + border: 1px solid rgb(175, 179, 187); +} +.base-slider-container .line .line-color.post { + top: -1px; + border: 1px solid rgb(175, 179, 187); +} +.base-slider-container .line .line-color:first-child { + border-bottom-left-radius: 2px; + border-top-left-radius: 2px; +} +.base-slider-container .line .line-color:last-child:not(:first-child) { + border-bottom-right-radius: 2px; + border-top-right-radius: 2px; +} +.base-slider-container .handle { + position: absolute; + display: block; + z-index: 10; + top: 20.33px; + background-size: 100% 100%; + background-repeat: no-repeat; + background-attachment: local; + background-position: 0% 0%; +} +.base-slider-container .handle.type-last { + z-index: 12; +} +.base-slider-container .handle.pin { + position: absolute; + z-index: 100; + height: 10.2857142857px !important; + margin-top: -8.2285714286px; + width: 16px; + margin-left: -8px; + font-size: 10.2857142857px; + text-align: center; + background-image: none !important; +} +.base-slider-container .marker-outer { + position: absolute; + top: 0px; + z-index: 2; + cursor: default; + font-family: Arial, sans-serif; + font-size: 10px; +} +.base-slider-container .marker-outer .marker { + box-sizing: border-box; + width: 100%; + height: 100%; + margin-left: -50%; + padding: 0; +} +.base-slider-container .marker-outer.frame .marker:after { + position: absolute; + display: block; + top: 100%; + left: 0; + width: 0; + height: 0; + margin-left: -3px; + content: ""; + overflow: hidden; + border: 3px solid transparent; + border-top-color: black; +} +.base-slider-container .marker-outer .marker-text { + display: inline-block; + cursor: inherit; + box-sizing: border-box; + line-height: 1.333; + padding: 1px 5px; + border: 1px solid transparent; + border-radius: 4px; + white-space: nowrap; + text-shadow: none; +} +.base-slider-container .marker-outer.min-max .marker-text { + color: #555; + background-color: rgb(209, 214, 224); + border: 1px solid rgb(175, 179, 187); + border-radius: 4px; +} +.base-slider-container .marker-outer.single-from-to .marker-text { + color: #111; +} +.base-slider-container .marker-outer.single-from-to.frame .marker-text { + background: white; + border: 1px solid black; +} .grid-canvas { position: absolute; bottom: 0; z-index: 3; - cursor: default; } + cursor: default; +} .grid { position: absolute; @@ -16556,37 +16968,42 @@ COMMON STYLE z-index: 2; width: 100%; height: 25px; - cursor: default; } - .grid.label-between-ticks { - height: 10px; } - .grid .grid-color { - position: absolute; - z-index: 1; - top: 0; - height: 9px; - font-size: 18px; - text-align: center; - line-height: 9px; - overflow: hidden; } - .grid .grid-color.gt-max { - left: 100%; - width: 0; - height: 0; - border: 0 solid transparent; - border-bottom-width: 4.5px; - border-top-width: 4.5px; - border-left: 9px solid black; } - .grid .grid-color.lt-min { - left: -9px; - width: 0; - height: 0; - border: 0 solid transparent; - border-top-width: 4.5px; - border-bottom-width: 4.5px; - border-right: 9px solid black; } - + cursor: default; +} +.grid.label-between-ticks { + height: 10px; +} +.grid .grid-color { + position: absolute; + z-index: 1; + top: 0; + height: 9px; + font-size: 18px; + text-align: center; + line-height: 9px; + overflow: hidden; +} +.grid .grid-color.gt-max { + left: 100%; + width: 0; + height: 0; + border: 0 solid transparent; + border-bottom-width: 4.5px; + border-top-width: 4.5px; + border-left: 9px solid black; +} +.grid .grid-color.lt-min { + left: -9px; + width: 0; + height: 0; + border: 0 solid transparent; + border-top-width: 4.5px; + border-bottom-width: 4.5px; + border-right: 9px solid black; +} .disabled { - opacity: 0.4; } + opacity: 0.4; +} .hidden-input { position: absolute !important; @@ -16603,333 +17020,469 @@ COMMON STYLE z-index: -9999 !important; background: none !important; border-style: solid !important; - border-color: transparent !important; } + border-color: transparent !important; +} /*************************************************************** STYLE FOR SPECIFIC TYPE ***************************************************************/ .base-slider-container.horizontal { + /* REMOVED + .line-background { + height: $handle-top + $handle-height; + } + */ /**************************************************** - Special case for no marker and pin: - Adjust all top-position by adding top-margin if the pin is heigher than the handle - ****************************************************/ } - .base-slider-container.horizontal .line-background { - height: 44.33px; } - .base-slider-container.horizontal .line { - top: 29.33px; } - .base-slider-container.horizontal .handle { - box-sizing: border-box; - width: 16px; - height: 24px; - margin-left: -8px; - background-image: url("images/handle.horizontal.svg"); } - html.mouse-hover .base-slider-container.horizontal.active .handle:hover, html.mouse-hover .base-slider-container.horizontal.active .handle.hover { - background-image: url("images/handle.horizontal.hover.svg"); } - .base-slider-container.horizontal .pin { - top: 29.33px; } - .base-slider-container.horizontal .grid { - top: 44.33px; } - .base-slider-container.horizontal.ticks-on-line .grid { - top: 29.33px; } - .base-slider-container.horizontal.ticks-on-line.no-marker .grid { - top: 9px; } - .base-slider-container.horizontal.no-marker .line, - .base-slider-container.horizontal.no-marker .pin { - top: 9px !important; } - .base-slider-container.horizontal.no-marker .handle { - top: 0px; } - .base-slider-container.horizontal.no-marker .grid { - top: 24px; } - .base-slider-container.horizontal.no-marker.has-pin { - margin-top: 0; } + Special case for no marker and pin: + Adjust all top-position by adding top-margin if the pin is heigher than the handle + ****************************************************/ +} +.base-slider-container.horizontal .line { + top: 29.33px; +} +.base-slider-container.horizontal .handle { + box-sizing: border-box; + width: 16px; + height: 24px; + margin-left: -8px; + background-image: url("images/handle.horizontal.svg"); +} +html.mouse-hover .base-slider-container.horizontal.active .handle:hover, html.mouse-hover .base-slider-container.horizontal.active .handle.hover { + background-image: url("images/handle.horizontal.hover.svg"); +} +.base-slider-container.horizontal .pin { + top: 29.33px; +} +.base-slider-container.horizontal .grid { + top: 44.33px; +} +.base-slider-container.horizontal.ticks-on-line .grid { + top: 29.33px; +} +.base-slider-container.horizontal.ticks-on-line.no-marker .grid { + top: 9px; +} +.base-slider-container.horizontal.no-marker .line, +.base-slider-container.horizontal.no-marker .pin { + top: 9px !important; +} +.base-slider-container.horizontal.no-marker .handle { + top: 0px; +} +.base-slider-container.horizontal.no-marker .grid { + top: 24px; +} +.base-slider-container.horizontal.no-marker.has-pin { + margin-top: 0; +} .base-slider-container.vertical { + /* REMOVED + .line-background { + height: $handle-top + $handle-height; + } + */ /**************************************************** - Special case for no marker and pin: - Adjust all top-position by adding top-margin if the pin is heigher than the handle - ****************************************************/ } - .base-slider-container.vertical .line-background { - height: 36.33px; } - .base-slider-container.vertical .line { - top: 25.33px; } - .base-slider-container.vertical .handle { - box-sizing: border-box; - width: 24px; - height: 16px; - margin-left: -12px; - background-image: url("images/handle.vertical.svg"); } - html.mouse-hover .base-slider-container.vertical.active .handle:hover, html.mouse-hover .base-slider-container.vertical.active .handle.hover { - background-image: url("images/handle.vertical.hover.svg"); } - .base-slider-container.vertical .pin { - top: 25.33px; } - .base-slider-container.vertical .grid { - top: 36.33px; } - .base-slider-container.vertical.ticks-on-line .grid { - top: 25.33px; } - .base-slider-container.vertical.ticks-on-line.no-marker .grid { - top: 5px; } - .base-slider-container.vertical.no-marker .line, - .base-slider-container.vertical.no-marker .pin { - top: 5px !important; } - .base-slider-container.vertical.no-marker .handle { - top: 0px; } - .base-slider-container.vertical.no-marker .grid { - top: 16px; } - .base-slider-container.vertical.no-marker.has-pin { - margin-top: 3.2285714286px; } + Special case for no marker and pin: + Adjust all top-position by adding top-margin if the pin is heigher than the handle + ****************************************************/ +} +.base-slider-container.vertical .line { + top: 25.33px; +} +.base-slider-container.vertical .handle { + box-sizing: border-box; + width: 24px; + height: 16px; + margin-left: -12px; + background-image: url("images/handle.vertical.svg"); +} +html.mouse-hover .base-slider-container.vertical.active .handle:hover, html.mouse-hover .base-slider-container.vertical.active .handle.hover { + background-image: url("images/handle.vertical.hover.svg"); +} +.base-slider-container.vertical .pin { + top: 25.33px; +} +.base-slider-container.vertical .grid { + top: 36.33px; +} +.base-slider-container.vertical.ticks-on-line .grid { + top: 25.33px; +} +.base-slider-container.vertical.ticks-on-line.no-marker .grid { + top: 5px; +} +.base-slider-container.vertical.no-marker .line, +.base-slider-container.vertical.no-marker .pin { + top: 5px !important; +} +.base-slider-container.vertical.no-marker .handle { + top: 0px; +} +.base-slider-container.vertical.no-marker .grid { + top: 16px; +} +.base-slider-container.vertical.no-marker.has-pin { + margin-top: 3.2285714286px; +} .base-slider-container.down { + /* REMOVED + .line-background { + height: $handle-top + $handle-height; + } + */ /**************************************************** - Special case for no marker and pin: - Adjust all top-position by adding top-margin if the pin is heigher than the handle - ****************************************************/ } - .base-slider-container.down .line-background { - height: 44.33px; } - .base-slider-container.down .line { - top: 29.33px; } - .base-slider-container.down .handle { - box-sizing: border-box; - width: 16px; - height: 24px; - margin-left: -8px; - background-image: url("images/handle.down.svg"); } - html.mouse-hover .base-slider-container.down.active .handle:hover, html.mouse-hover .base-slider-container.down.active .handle.hover { - background-image: url("images/handle.down.hover.svg"); } - .base-slider-container.down .pin { - top: 29.33px; } - .base-slider-container.down .grid { - top: 44.33px; } - .base-slider-container.down.ticks-on-line .grid { - top: 29.33px; } - .base-slider-container.down.ticks-on-line.no-marker .grid { - top: 9px; } - .base-slider-container.down.no-marker .line, - .base-slider-container.down.no-marker .pin { - top: 9px !important; } - .base-slider-container.down.no-marker .handle { - top: 0px; } - .base-slider-container.down.no-marker .grid { - top: 24px; } - .base-slider-container.down.no-marker.has-pin { - margin-top: 0; } + Special case for no marker and pin: + Adjust all top-position by adding top-margin if the pin is heigher than the handle + ****************************************************/ +} +.base-slider-container.down .line { + top: 29.33px; +} +.base-slider-container.down .handle { + box-sizing: border-box; + width: 16px; + height: 24px; + margin-left: -8px; + background-image: url("images/handle.down.svg"); +} +html.mouse-hover .base-slider-container.down.active .handle:hover, html.mouse-hover .base-slider-container.down.active .handle.hover { + background-image: url("images/handle.down.hover.svg"); +} +.base-slider-container.down .pin { + top: 29.33px; +} +.base-slider-container.down .grid { + top: 44.33px; +} +.base-slider-container.down.ticks-on-line .grid { + top: 29.33px; +} +.base-slider-container.down.ticks-on-line.no-marker .grid { + top: 9px; +} +.base-slider-container.down.no-marker .line, +.base-slider-container.down.no-marker .pin { + top: 9px !important; +} +.base-slider-container.down.no-marker .handle { + top: 0px; +} +.base-slider-container.down.no-marker .grid { + top: 24px; +} +.base-slider-container.down.no-marker.has-pin { + margin-top: 0; +} .base-slider-container.up { + /* REMOVED + .line-background { + height: $handle-top + $handle-height; + } + */ /**************************************************** - Special case for no marker and pin: - Adjust all top-position by adding top-margin if the pin is heigher than the handle - ****************************************************/ } - .base-slider-container.up .line-background { - height: 44.33px; } - .base-slider-container.up .line { - top: 29.33px; } - .base-slider-container.up .handle { - box-sizing: border-box; - width: 16px; - height: 24px; - margin-left: -8px; - background-image: url("images/handle.up.svg"); } - html.mouse-hover .base-slider-container.up.active .handle:hover, html.mouse-hover .base-slider-container.up.active .handle.hover { - background-image: url("images/handle.up.hover.svg"); } - .base-slider-container.up .pin { - top: 29.33px; } - .base-slider-container.up .grid { - top: 44.33px; } - .base-slider-container.up.ticks-on-line .grid { - top: 29.33px; } - .base-slider-container.up.ticks-on-line.no-marker .grid { - top: 9px; } - .base-slider-container.up.no-marker .line, - .base-slider-container.up.no-marker .pin { - top: 9px !important; } - .base-slider-container.up.no-marker .handle { - top: 0px; } - .base-slider-container.up.no-marker .grid { - top: 24px; } - .base-slider-container.up.no-marker.has-pin { - margin-top: 0; } + Special case for no marker and pin: + Adjust all top-position by adding top-margin if the pin is heigher than the handle + ****************************************************/ +} +.base-slider-container.up .line { + top: 29.33px; +} +.base-slider-container.up .handle { + box-sizing: border-box; + width: 16px; + height: 24px; + margin-left: -8px; + background-image: url("images/handle.up.svg"); +} +html.mouse-hover .base-slider-container.up.active .handle:hover, html.mouse-hover .base-slider-container.up.active .handle.hover { + background-image: url("images/handle.up.hover.svg"); +} +.base-slider-container.up .pin { + top: 29.33px; +} +.base-slider-container.up .grid { + top: 44.33px; +} +.base-slider-container.up.ticks-on-line .grid { + top: 29.33px; +} +.base-slider-container.up.ticks-on-line.no-marker .grid { + top: 9px; +} +.base-slider-container.up.no-marker .line, +.base-slider-container.up.no-marker .pin { + top: 9px !important; +} +.base-slider-container.up.no-marker .handle { + top: 0px; +} +.base-slider-container.up.no-marker .grid { + top: 24px; +} +.base-slider-container.up.no-marker.has-pin { + margin-top: 0; +} .base-slider-container.right { + /* REMOVED + .line-background { + height: $handle-top + $handle-height; + } + */ /**************************************************** - Special case for no marker and pin: - Adjust all top-position by adding top-margin if the pin is heigher than the handle - ****************************************************/ } - .base-slider-container.right .line-background { - height: 36.33px; } - .base-slider-container.right .line { - top: 25.33px; } - .base-slider-container.right .handle { - box-sizing: border-box; - width: 24px; - height: 16px; - margin-left: -12px; - background-image: url("images/handle.right.svg"); } - html.mouse-hover .base-slider-container.right.active .handle:hover, html.mouse-hover .base-slider-container.right.active .handle.hover { - background-image: url("images/handle.right.hover.svg"); } - .base-slider-container.right .pin { - top: 25.33px; } - .base-slider-container.right .grid { - top: 36.33px; } - .base-slider-container.right.ticks-on-line .grid { - top: 25.33px; } - .base-slider-container.right.ticks-on-line.no-marker .grid { - top: 5px; } - .base-slider-container.right.no-marker .line, - .base-slider-container.right.no-marker .pin { - top: 5px !important; } - .base-slider-container.right.no-marker .handle { - top: 0px; } - .base-slider-container.right.no-marker .grid { - top: 16px; } - .base-slider-container.right.no-marker.has-pin { - margin-top: 3.2285714286px; } + Special case for no marker and pin: + Adjust all top-position by adding top-margin if the pin is heigher than the handle + ****************************************************/ +} +.base-slider-container.right .line { + top: 25.33px; +} +.base-slider-container.right .handle { + box-sizing: border-box; + width: 24px; + height: 16px; + margin-left: -12px; + background-image: url("images/handle.right.svg"); +} +html.mouse-hover .base-slider-container.right.active .handle:hover, html.mouse-hover .base-slider-container.right.active .handle.hover { + background-image: url("images/handle.right.hover.svg"); +} +.base-slider-container.right .pin { + top: 25.33px; +} +.base-slider-container.right .grid { + top: 36.33px; +} +.base-slider-container.right.ticks-on-line .grid { + top: 25.33px; +} +.base-slider-container.right.ticks-on-line.no-marker .grid { + top: 5px; +} +.base-slider-container.right.no-marker .line, +.base-slider-container.right.no-marker .pin { + top: 5px !important; +} +.base-slider-container.right.no-marker .handle { + top: 0px; +} +.base-slider-container.right.no-marker .grid { + top: 16px; +} +.base-slider-container.right.no-marker.has-pin { + margin-top: 3.2285714286px; +} .base-slider-container.left { + /* REMOVED + .line-background { + height: $handle-top + $handle-height; + } + */ /**************************************************** - Special case for no marker and pin: - Adjust all top-position by adding top-margin if the pin is heigher than the handle - ****************************************************/ } - .base-slider-container.left .line-background { - height: 36.33px; } - .base-slider-container.left .line { - top: 25.33px; } - .base-slider-container.left .handle { - box-sizing: border-box; - width: 24px; - height: 16px; - margin-left: -12px; - background-image: url("images/handle.left.svg"); } - html.mouse-hover .base-slider-container.left.active .handle:hover, html.mouse-hover .base-slider-container.left.active .handle.hover { - background-image: url("images/handle.left.hover.svg"); } - .base-slider-container.left .pin { - top: 25.33px; } - .base-slider-container.left .grid { - top: 36.33px; } - .base-slider-container.left.ticks-on-line .grid { - top: 25.33px; } - .base-slider-container.left.ticks-on-line.no-marker .grid { - top: 5px; } - .base-slider-container.left.no-marker .line, - .base-slider-container.left.no-marker .pin { - top: 5px !important; } - .base-slider-container.left.no-marker .handle { - top: 0px; } - .base-slider-container.left.no-marker .grid { - top: 16px; } - .base-slider-container.left.no-marker.has-pin { - margin-top: 3.2285714286px; } + Special case for no marker and pin: + Adjust all top-position by adding top-margin if the pin is heigher than the handle + ****************************************************/ +} +.base-slider-container.left .line { + top: 25.33px; +} +.base-slider-container.left .handle { + box-sizing: border-box; + width: 24px; + height: 16px; + margin-left: -12px; + background-image: url("images/handle.left.svg"); +} +html.mouse-hover .base-slider-container.left.active .handle:hover, html.mouse-hover .base-slider-container.left.active .handle.hover { + background-image: url("images/handle.left.hover.svg"); +} +.base-slider-container.left .pin { + top: 25.33px; +} +.base-slider-container.left .grid { + top: 36.33px; +} +.base-slider-container.left.ticks-on-line .grid { + top: 25.33px; +} +.base-slider-container.left.ticks-on-line.no-marker .grid { + top: 5px; +} +.base-slider-container.left.no-marker .line, +.base-slider-container.left.no-marker .pin { + top: 5px !important; +} +.base-slider-container.left.no-marker .handle { + top: 0px; +} +.base-slider-container.left.no-marker .grid { + top: 16px; +} +.base-slider-container.left.no-marker.has-pin { + margin-top: 3.2285714286px; +} .base-slider-container.round { + /* REMOVED + .line-background { + height: $handle-top + $handle-height; + } + */ /**************************************************** - Special case for no marker and pin: - Adjust all top-position by adding top-margin if the pin is heigher than the handle - ****************************************************/ } - .base-slider-container.round .line-background { - height: 40.33px; } - .base-slider-container.round .line { - top: 27.33px; } - .base-slider-container.round .handle { - box-sizing: border-box; - width: 20px; - height: 20px; - margin-left: -10px; - background-image: url("images/handle.round.svg"); } - html.mouse-hover .base-slider-container.round.active .handle:hover, html.mouse-hover .base-slider-container.round.active .handle.hover { - background-image: url("images/handle.round.hover.svg"); } - .base-slider-container.round .pin { - top: 27.33px; } - .base-slider-container.round .grid { - top: 40.33px; } - .base-slider-container.round.ticks-on-line .grid { - top: 27.33px; } - .base-slider-container.round.ticks-on-line.no-marker .grid { - top: 7px; } - .base-slider-container.round.no-marker .line, - .base-slider-container.round.no-marker .pin { - top: 7px !important; } - .base-slider-container.round.no-marker .handle { - top: 0px; } - .base-slider-container.round.no-marker .grid { - top: 20px; } - .base-slider-container.round.no-marker.has-pin { - margin-top: 1.2285714286px; } + Special case for no marker and pin: + Adjust all top-position by adding top-margin if the pin is heigher than the handle + ****************************************************/ +} +.base-slider-container.round .line { + top: 27.33px; +} +.base-slider-container.round .handle { + box-sizing: border-box; + width: 20px; + height: 20px; + margin-left: -10px; + background-image: url("images/handle.round.svg"); +} +html.mouse-hover .base-slider-container.round.active .handle:hover, html.mouse-hover .base-slider-container.round.active .handle.hover { + background-image: url("images/handle.round.hover.svg"); +} +.base-slider-container.round .pin { + top: 27.33px; +} +.base-slider-container.round .grid { + top: 40.33px; +} +.base-slider-container.round.ticks-on-line .grid { + top: 27.33px; +} +.base-slider-container.round.ticks-on-line.no-marker .grid { + top: 7px; +} +.base-slider-container.round.no-marker .line, +.base-slider-container.round.no-marker .pin { + top: 7px !important; +} +.base-slider-container.round.no-marker .handle { + top: 0px; +} +.base-slider-container.round.no-marker .grid { + top: 20px; +} +.base-slider-container.round.no-marker.has-pin { + margin-top: 1.2285714286px; +} .base-slider-container.fixed { + /* REMOVED + .line-background { + height: $handle-top + $handle-height; + } + */ /**************************************************** - Special case for no marker and pin: - Adjust all top-position by adding top-margin if the pin is heigher than the handle - ****************************************************/ } - .base-slider-container.fixed .line-background { - height: 40.33px; } - .base-slider-container.fixed .line { - top: 22.33px; } - .base-slider-container.fixed .handle { - box-sizing: border-box; - width: 13.3333333333px; - height: 20px; - margin-left: -6.6666666667px; - background-image: url("images/handle.fixed.svg"); } - .base-slider-container.fixed .pin { - top: 22.33px; } - .base-slider-container.fixed .grid { - top: 28.33px; } - .base-slider-container.fixed.ticks-on-line .grid { - top: 22.33px; } - .base-slider-container.fixed.ticks-on-line.no-marker .grid { - top: 2px; } - .base-slider-container.fixed.no-marker .line, - .base-slider-container.fixed.no-marker .pin { - top: 2px !important; } - .base-slider-container.fixed.no-marker .handle { - top: 0px; } - .base-slider-container.fixed.no-marker .grid { - top: 20px; } - .base-slider-container.fixed.no-marker.has-pin { - margin-top: 6.2285714286px; } - -.base-slider-container.range { - /**************************************************** - Special case for no marker and pin: - Adjust all top-position by adding top-margin if the pin is heigher than the handle - ****************************************************/ } - .base-slider-container.range .line-background { - height: 26.33px; } - .base-slider-container.range .line { - top: 20.33px; } - .base-slider-container.range .handle { - box-sizing: border-box; - width: 6px; - height: 6px; - margin-left: -3px; } - .base-slider-container.range .handle.from { - background-image: url("images/handle.range.from.svg"); } - .base-slider-container.range .handle.to { - background-image: url("images/handle.range.to.svg"); } - .base-slider-container.range .pin { - top: 20.33px; } - .base-slider-container.range .grid { - top: 26.33px; } - .base-slider-container.range.ticks-on-line .grid { - top: 20.33px; } - .base-slider-container.range.ticks-on-line.no-marker .grid { - top: 0px; } - .base-slider-container.range.no-marker .line, - .base-slider-container.range.no-marker .pin { - top: 0px !important; } - .base-slider-container.range.no-marker .handle { - top: 0px; } - .base-slider-container.range.no-marker .grid { - top: 6px; } - .base-slider-container.range.no-marker.has-pin { - margin-top: 8.2285714286px; } - -.base-slider-container { - width: calc(100% - 24px); - margin-left: 12px; - margin-right: 12px; } - -@charset "UTF-8"; -/*********************************************** - jquery-scroll-container.scss, + Special case for no marker and pin: + Adjust all top-position by adding top-margin if the pin is heigher than the handle + ****************************************************/ +} +.base-slider-container.fixed .line { + top: 22.33px; +} +.base-slider-container.fixed .handle { + box-sizing: border-box; + width: 13.3333333333px; + height: 20px; + margin-left: -6.6666666667px; + background-image: url("images/handle.fixed.svg"); +} +.base-slider-container.fixed .pin { + top: 22.33px; +} +.base-slider-container.fixed .grid { + top: 28.33px; +} +.base-slider-container.fixed.ticks-on-line .grid { + top: 22.33px; +} +.base-slider-container.fixed.ticks-on-line.no-marker .grid { + top: 2px; +} +.base-slider-container.fixed.no-marker .line, +.base-slider-container.fixed.no-marker .pin { + top: 2px !important; +} +.base-slider-container.fixed.no-marker .handle { + top: 0px; +} +.base-slider-container.fixed.no-marker .grid { + top: 20px; +} +.base-slider-container.fixed.no-marker.has-pin { + margin-top: 6.2285714286px; +} + +.base-slider-container.range { + /* REMOVED + .line-background { + height: $handle-top + $handle-height; + } + */ + /**************************************************** + Special case for no marker and pin: + Adjust all top-position by adding top-margin if the pin is heigher than the handle + ****************************************************/ +} +.base-slider-container.range .line { + top: 20.33px; +} +.base-slider-container.range .handle { + box-sizing: border-box; + width: 6px; + height: 6px; + margin-left: -3px; +} +.base-slider-container.range .handle.from { + background-image: url("images/handle.range.from.svg"); +} +.base-slider-container.range .handle.to { + background-image: url("images/handle.range.to.svg"); +} +.base-slider-container.range .pin { + top: 20.33px; +} +.base-slider-container.range .grid { + top: 26.33px; +} +.base-slider-container.range.ticks-on-line .grid { + top: 20.33px; +} +.base-slider-container.range.ticks-on-line.no-marker .grid { + top: 0px; +} +.base-slider-container.range.no-marker .line, +.base-slider-container.range.no-marker .pin { + top: 0px !important; +} +.base-slider-container.range.no-marker .handle { + top: 0px; +} +.base-slider-container.range.no-marker .grid { + top: 6px; +} +.base-slider-container.range.no-marker.has-pin { + margin-top: 8.2285714286px; +} + +.base-slider-container { + width: calc(100% - 24px); + margin-left: 12px; + margin-right: 12px; +} +@charset "UTF-8"; +/*********************************************** + jquery-scroll-container.scss, (c) 2017, FCOO @@ -17256,7 +17809,7 @@ Modal ************************************************/ /*********************************************** Button And Modal -Opacity for semi-transparent and transparent content +Opacity for semi-transparent and transparent content using color-mix ************************************************/ :root, [data-bs-theme=light] { @@ -17353,6 +17906,7 @@ Opacity for semi-transparent and transparent content --bs-link-hover-color: #1a1e21; --bs-link-hover-color-rgb: 26, 30, 33; --bs-code-color: #d63384; + --bs-highlight-color: #212529; --bs-highlight-bg: #fff3cd; --bs-border-width: 1px; --bs-border-style: solid; @@ -17380,18 +17934,18 @@ Opacity for semi-transparent and transparent content [data-bs-theme=dark] { color-scheme: dark; - --bs-body-color: #adb5bd; - --bs-body-color-rgb: 173, 181, 189; + --bs-body-color: #dee2e6; + --bs-body-color-rgb: 222, 226, 230; --bs-body-bg: #212529; --bs-body-bg-rgb: 33, 37, 41; --bs-emphasis-color: #fff; --bs-emphasis-color-rgb: 255, 255, 255; - --bs-secondary-color: rgba(173, 181, 189, 0.75); - --bs-secondary-color-rgb: 173, 181, 189; + --bs-secondary-color: rgba(222, 226, 230, 0.75); + --bs-secondary-color-rgb: 222, 226, 230; --bs-secondary-bg: #343a40; --bs-secondary-bg-rgb: 52, 58, 64; - --bs-tertiary-color: rgba(173, 181, 189, 0.5); - --bs-tertiary-color-rgb: 173, 181, 189; + --bs-tertiary-color: rgba(222, 226, 230, 0.5); + --bs-tertiary-color-rgb: 222, 226, 230; --bs-tertiary-bg: #2b3035; --bs-tertiary-bg-rgb: 43, 48, 53; --bs-primary-text-emphasis: #6ea8fe; @@ -17424,6 +17978,8 @@ Opacity for semi-transparent and transparent content --bs-link-color-rgb: 110, 168, 254; --bs-link-hover-color-rgb: 139, 185, 254; --bs-code-color: #e685b5; + --bs-highlight-color: #dee2e6; + --bs-highlight-bg: #664d03; --bs-border-color: #495057; --bs-border-color-translucent: rgba(255, 255, 255, 0.15); --bs-form-valid-color: #75b798; @@ -17557,6 +18113,7 @@ small, .small { mark, .mark { padding: 0.1875em; + color: var(--bs-highlight-color); background-color: var(--bs-highlight-bg); } @@ -17767,8 +18324,8 @@ legend + * { } [type=search] { - outline-offset: -2px; -webkit-appearance: textfield; + outline-offset: -2px; } /* rtl:raw: @@ -18011,7 +18568,7 @@ progress { .row-cols-3 > * { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .row-cols-4 > * { @@ -18026,7 +18583,7 @@ progress { .row-cols-6 > * { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-auto { @@ -18216,7 +18773,7 @@ progress { } .row-cols-sm-3 > * { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .row-cols-sm-4 > * { flex: 0 0 auto; @@ -18228,7 +18785,7 @@ progress { } .row-cols-sm-6 > * { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-sm-auto { flex: 0 0 auto; @@ -18385,7 +18942,7 @@ progress { } .row-cols-md-3 > * { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .row-cols-md-4 > * { flex: 0 0 auto; @@ -18397,7 +18954,7 @@ progress { } .row-cols-md-6 > * { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-md-auto { flex: 0 0 auto; @@ -18554,7 +19111,7 @@ progress { } .row-cols-lg-3 > * { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .row-cols-lg-4 > * { flex: 0 0 auto; @@ -18566,7 +19123,7 @@ progress { } .row-cols-lg-6 > * { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-lg-auto { flex: 0 0 auto; @@ -18723,7 +19280,7 @@ progress { } .row-cols-xl-3 > * { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .row-cols-xl-4 > * { flex: 0 0 auto; @@ -18735,7 +19292,7 @@ progress { } .row-cols-xl-6 > * { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-xl-auto { flex: 0 0 auto; @@ -18892,7 +19449,7 @@ progress { } .row-cols-xxl-3 > * { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .row-cols-xxl-4 > * { flex: 0 0 auto; @@ -18904,7 +19461,7 @@ progress { } .row-cols-xxl-6 > * { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-xxl-auto { flex: 0 0 auto; @@ -19048,16 +19605,16 @@ progress { --bs-table-bg-type: initial; --bs-table-color-state: initial; --bs-table-bg-state: initial; - --bs-table-color: var(--bs-body-color); + --bs-table-color: var(--bs-emphasis-color); --bs-table-bg: var(--bs-body-bg); --bs-table-border-color: var(--bs-border-color); --bs-table-accent-bg: transparent; - --bs-table-striped-color: var(--bs-body-color); - --bs-table-striped-bg: rgba(0, 0, 0, 0.05); - --bs-table-active-color: var(--bs-body-color); - --bs-table-active-bg: rgba(0, 0, 0, 0.1); - --bs-table-hover-color: var(--bs-body-color); - --bs-table-hover-bg: rgba(0, 0, 0, 0.075); + --bs-table-striped-color: var(--bs-emphasis-color); + --bs-table-striped-bg: rgba(var(--bs-emphasis-color-rgb), 0.05); + --bs-table-active-color: var(--bs-emphasis-color); + --bs-table-active-bg: rgba(var(--bs-emphasis-color-rgb), 0.1); + --bs-table-hover-color: var(--bs-emphasis-color); + --bs-table-hover-bg: rgba(var(--bs-emphasis-color-rgb), 0.075); width: 100%; margin-bottom: 1rem; vertical-align: top; @@ -19126,7 +19683,7 @@ progress { .table-primary { --bs-table-color: #000; --bs-table-bg: #cfe2ff; - --bs-table-border-color: #bacbe6; + --bs-table-border-color: #a6b5cc; --bs-table-striped-bg: #c5d7f2; --bs-table-striped-color: #000; --bs-table-active-bg: #bacbe6; @@ -19140,7 +19697,7 @@ progress { .table-secondary { --bs-table-color: #000; --bs-table-bg: #e2e3e5; - --bs-table-border-color: #cbccce; + --bs-table-border-color: #b5b6b7; --bs-table-striped-bg: #d7d8da; --bs-table-striped-color: #000; --bs-table-active-bg: #cbccce; @@ -19154,7 +19711,7 @@ progress { .table-success { --bs-table-color: #000; --bs-table-bg: #d1e7dd; - --bs-table-border-color: #bcd0c7; + --bs-table-border-color: #a7b9b1; --bs-table-striped-bg: #c7dbd2; --bs-table-striped-color: #000; --bs-table-active-bg: #bcd0c7; @@ -19168,7 +19725,7 @@ progress { .table-info { --bs-table-color: #000; --bs-table-bg: #cff4fc; - --bs-table-border-color: #badce3; + --bs-table-border-color: #a6c3ca; --bs-table-striped-bg: #c5e8ef; --bs-table-striped-color: #000; --bs-table-active-bg: #badce3; @@ -19182,7 +19739,7 @@ progress { .table-warning { --bs-table-color: #000; --bs-table-bg: #fff3cd; - --bs-table-border-color: #e6dbb9; + --bs-table-border-color: #ccc2a4; --bs-table-striped-bg: #f2e7c3; --bs-table-striped-color: #000; --bs-table-active-bg: #e6dbb9; @@ -19196,7 +19753,7 @@ progress { .table-danger { --bs-table-color: #000; --bs-table-bg: #f8d7da; - --bs-table-border-color: #dfc2c4; + --bs-table-border-color: #c6acae; --bs-table-striped-bg: #eccccf; --bs-table-striped-color: #000; --bs-table-active-bg: #dfc2c4; @@ -19210,7 +19767,7 @@ progress { .table-light { --bs-table-color: #000; --bs-table-bg: #f8f9fa; - --bs-table-border-color: #dfe0e1; + --bs-table-border-color: #c6c7c8; --bs-table-striped-bg: #ecedee; --bs-table-striped-color: #000; --bs-table-active-bg: #dfe0e1; @@ -19224,7 +19781,7 @@ progress { .table-dark { --bs-table-color: #fff; --bs-table-bg: #212529; - --bs-table-border-color: #373b3e; + --bs-table-border-color: #4d5154; --bs-table-striped-bg: #2c3034; --bs-table-striped-color: #fff; --bs-table-active-bg: #373b3e; @@ -19308,10 +19865,10 @@ progress { font-weight: 400; line-height: 1.5; color: var(--bs-body-color); + appearance: none; background-color: var(--bs-body-bg); background-clip: padding-box; border: var(--bs-border-width) solid #adb5bd; - appearance: none; border-radius: var(--bs-border-radius); transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } @@ -19458,6 +20015,7 @@ textarea.form-control-lg { font-weight: 400; line-height: 1.5; color: var(--bs-body-color); + appearance: none; background-color: var(--bs-body-bg); background-image: var(--bs-form-select-bg-img), var(--bs-form-select-bg-icon, none); background-repeat: no-repeat; @@ -19466,7 +20024,6 @@ textarea.form-control-lg { border: var(--bs-border-width) solid #adb5bd; border-radius: var(--bs-border-radius); transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; - appearance: none; } @media (prefers-reduced-motion: reduce) { .form-select { @@ -19507,7 +20064,7 @@ textarea.form-control-lg { } [data-bs-theme=dark] .form-select { - --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23adb5bd' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); + --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dee2e6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); } .form-check { @@ -19534,17 +20091,18 @@ textarea.form-control-lg { .form-check-input { --bs-form-check-bg: var(--bs-body-bg); + flex-shrink: 0; width: 1em; height: 1em; margin-top: 0.25em; vertical-align: top; + appearance: none; background-color: var(--bs-form-check-bg); background-image: var(--bs-form-check-bg-image); background-repeat: no-repeat; background-position: center; background-size: contain; border: 1px solid #adb5bd; - appearance: none; print-color-adjust: exact; } .form-check-input[type=checkbox] { @@ -19643,8 +20201,8 @@ textarea.form-control-lg { width: 100%; height: calc(1rem + 2px); padding: 0; - background-color: transparent; appearance: none; + background-color: transparent; } .form-range:focus { outline: 0; @@ -19662,11 +20220,11 @@ textarea.form-control-lg { width: 1rem; height: 1rem; margin-top: -0.25rem; + appearance: none; background-color: #0d6efd; border: 0; border-radius: 1rem; transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; - appearance: none; } @media (prefers-reduced-motion: reduce) { .form-range::-webkit-slider-thumb { @@ -19681,18 +20239,18 @@ textarea.form-control-lg { height: 0.5rem; color: transparent; cursor: pointer; - background-color: var(--bs-tertiary-bg); + background-color: var(--bs-secondary-bg); border-color: transparent; border-radius: 1rem; } .form-range::-moz-range-thumb { width: 1rem; height: 1rem; + appearance: none; background-color: #0d6efd; border: 0; border-radius: 1rem; transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; - appearance: none; } @media (prefers-reduced-motion: reduce) { .form-range::-moz-range-thumb { @@ -19707,7 +20265,7 @@ textarea.form-control-lg { height: 0.5rem; color: transparent; cursor: pointer; - background-color: var(--bs-tertiary-bg); + background-color: var(--bs-secondary-bg); border-color: transparent; border-radius: 1rem; } @@ -19801,10 +20359,12 @@ textarea.form-control-lg { .form-floating > .form-control-plaintext ~ label { border-width: var(--bs-border-width) 0; } -.form-floating > :disabled ~ label { +.form-floating > :disabled ~ label, +.form-floating > .form-control:disabled ~ label { color: #6c757d; } -.form-floating > :disabled ~ label::after { +.form-floating > :disabled ~ label::after, +.form-floating > .form-control:disabled ~ label::after { background-color: var(--bs-secondary-bg); } @@ -20541,7 +21101,7 @@ textarea.form-control-lg { --bs-dropdown-inner-border-radius: calc(var(--bs-border-radius) - var(--bs-border-width)); --bs-dropdown-divider-bg: var(--bs-border-color-translucent); --bs-dropdown-divider-margin-y: 0.5rem; - --bs-dropdown-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); + --bs-dropdown-box-shadow: var(--bs-box-shadow); --bs-dropdown-link-color: var(--bs-body-color); --bs-dropdown-link-hover-color: var(--bs-body-color); --bs-dropdown-link-hover-bg: var(--bs-tertiary-bg); @@ -20965,7 +21525,7 @@ textarea.form-control-lg { outline: 0; box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); } -.nav-link.disabled { +.nav-link.disabled, .nav-link:disabled { color: var(--bs-nav-link-disabled-color); pointer-events: none; cursor: default; @@ -20991,11 +21551,6 @@ textarea.form-control-lg { isolation: isolate; border-color: var(--bs-nav-tabs-link-hover-border-color); } -.nav-tabs .nav-link.disabled, .nav-tabs .nav-link:disabled { - color: var(--bs-nav-link-disabled-color); - background-color: transparent; - border-color: transparent; -} .nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { color: var(--bs-nav-tabs-link-active-color); @@ -21016,11 +21571,6 @@ textarea.form-control-lg { .nav-pills .nav-link { border-radius: var(--bs-nav-pills-border-radius); } -.nav-pills .nav-link:disabled { - color: var(--bs-nav-link-disabled-color); - background-color: transparent; - border-color: transparent; -} .nav-pills .nav-link.active, .nav-pills .show > .nav-link { color: var(--bs-nav-pills-link-active-color); @@ -22449,7 +22999,7 @@ textarea.form-control-lg { --bs-modal-border-color: var(--jb-container-border-color); --bs-modal-border-width: 1px; --bs-modal-border-radius: 0.375rem; - --bs-modal-box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); + --bs-modal-box-shadow: var(--bs-box-shadow-sm); --bs-modal-inner-border-radius: calc(0.375rem - 1px); --bs-modal-header-padding-x: 0.375rem; --bs-modal-header-padding-y: 0.375rem; @@ -22590,7 +23140,7 @@ textarea.form-control-lg { @media (min-width: 576px) { .modal { --bs-modal-margin: 1.75rem; - --bs-modal-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); + --bs-modal-box-shadow: var(--bs-box-shadow); } .modal-dialog { max-width: var(--bs-modal-width); @@ -22842,7 +23392,7 @@ textarea.form-control-lg { --bs-popover-border-color: var(--jb-container-border-color); --bs-popover-border-radius: 0.375rem; --bs-popover-inner-border-radius: calc(0.375rem - 1px); - --bs-popover-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); + --bs-popover-box-shadow: var(--bs-box-shadow); --bs-popover-header-padding-x: 0.375rem; --bs-popover-header-padding-y: 0.375rem; --bs-popover-header-font-size: 1rem; @@ -23212,42 +23762,42 @@ textarea.form-control-lg { .text-bg-primary { color: #fff !important; - background-color: RGBA(13, 110, 253, var(--bs-bg-opacity, 1)) !important; + background-color: RGBA(var(--bs-primary-rgb), var(--bs-bg-opacity, 1)) !important; } .text-bg-secondary { color: #fff !important; - background-color: RGBA(108, 117, 125, var(--bs-bg-opacity, 1)) !important; + background-color: RGBA(var(--bs-secondary-rgb), var(--bs-bg-opacity, 1)) !important; } .text-bg-success { color: #fff !important; - background-color: RGBA(25, 135, 84, var(--bs-bg-opacity, 1)) !important; + background-color: RGBA(var(--bs-success-rgb), var(--bs-bg-opacity, 1)) !important; } .text-bg-info { color: #000 !important; - background-color: RGBA(13, 202, 240, var(--bs-bg-opacity, 1)) !important; + background-color: RGBA(var(--bs-info-rgb), var(--bs-bg-opacity, 1)) !important; } .text-bg-warning { color: #000 !important; - background-color: RGBA(255, 193, 7, var(--bs-bg-opacity, 1)) !important; + background-color: RGBA(var(--bs-warning-rgb), var(--bs-bg-opacity, 1)) !important; } .text-bg-danger { color: #fff !important; - background-color: RGBA(220, 53, 69, var(--bs-bg-opacity, 1)) !important; + background-color: RGBA(var(--bs-danger-rgb), var(--bs-bg-opacity, 1)) !important; } .text-bg-light { color: #000 !important; - background-color: RGBA(248, 249, 250, var(--bs-bg-opacity, 1)) !important; + background-color: RGBA(var(--bs-light-rgb), var(--bs-bg-opacity, 1)) !important; } .text-bg-dark { color: #fff !important; - background-color: RGBA(33, 37, 41, var(--bs-bg-opacity, 1)) !important; + background-color: RGBA(var(--bs-dark-rgb), var(--bs-bg-opacity, 1)) !important; } .link-primary { @@ -23531,7 +24081,7 @@ textarea.form-control-lg { .vr { display: inline-block; align-self: stretch; - width: 1px; + width: var(--bs-border-width); min-height: 1em; background-color: currentcolor; opacity: 0.25; @@ -23706,15 +24256,15 @@ textarea.form-control-lg { } .shadow { - box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; + box-shadow: var(--bs-box-shadow) !important; } .shadow-sm { - box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; + box-shadow: var(--bs-box-shadow-sm) !important; } .shadow-lg { - box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important; + box-shadow: var(--bs-box-shadow-lg) !important; } .shadow-none { @@ -29063,7 +29613,7 @@ Contains global scss- and css-variable --bs-modal-border-color: var(--jb-container-border-color); --bs-modal-border-width: 1px; --bs-modal-border-radius: 0.375rem; - --bs-modal-box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); + --bs-modal-box-shadow: var(--bs-box-shadow-sm); --bs-modal-inner-border-radius: calc(0.375rem - 1px); --bs-modal-header-padding-x: 0.375rem; --bs-modal-header-padding-y: 0.375rem; @@ -29673,6 +30223,59 @@ NOTE: remove ".css" from file in @import to include code @import 'sliding_exits/slideOutRight.css'; @import 'sliding_exits/slideOutUp.css'; */ +/************************************************************ +COMMON + +Common classes for differnet elements +************************************************************/ +.min-width-1em { + min-width: 1em !important; +} + +.min-width-2em { + min-width: 2em !important; +} + +.min-width-3em { + min-width: 3em !important; +} + +.min-width-4em { + min-width: 4em !important; +} + +.min-width-5em { + min-width: 5em !important; +} + +.min-width-6em { + min-width: 6em !important; +} + +.min-width-7em { + min-width: 7em !important; +} + +.min-width-8em { + min-width: 8em !important; +} + +.min-width-9em { + min-width: 9em !important; +} + +.min-width-10em { + min-width: 10em !important; +} + +.min-width-11em { + min-width: 11em !important; +} + +.min-width-12em { + min-width: 12em !important; +} + /************************************************ STYLE FOR DIFFERENT ELEMENTS *************************************************/ @@ -29736,6 +30339,10 @@ Bootstrap allready have the following classes font-size: 0.75em !important; } +.font-size-0-9em { + font-size: 0.9em !important; +} + .font-size-1-1em { font-size: 1.1em !important; } @@ -29792,6 +30399,26 @@ Bootstrap allready have the following classes flex-shrink: 0; line-height: 1; } +.container-stacked-icons.width-1-1em:not(:last-child) { + width: 1.1em; + text-align: left; +} +.container-stacked-icons.width-1-2em:not(:last-child) { + width: 1.2em; + text-align: left; +} +.container-stacked-icons.width-1-3em:not(:last-child) { + width: 1.3em; + text-align: left; +} +.container-stacked-icons.width-1-4em:not(:last-child) { + width: 1.4em; + text-align: left; +} +.container-stacked-icons.width-1-5em:not(:last-child) { + width: 1.5em; + text-align: left; +} .container-stacked-icons .stacked-icon { width: 1em; } @@ -29873,6 +30500,9 @@ Also overwrite default bootstrap behaviour */ .btn-jb { + display: inline-flex; + align-items: center; + justify-content: center; --bs-btn-border-color: #adb5bd; --bs-btn-hover-border-color: #b5bcc4; --bs-btn-active-border-color: #b5bcc4; @@ -29918,6 +30548,13 @@ Also overwrite default bootstrap behaviour .btn-jb.standard-checkbox .standard-checkbox-checked-color { color: rgb(30, 144, 255); } +.btn-jb.standard-checkbox.checkbox-at-left { + position: relative; +} +.btn-jb.standard-checkbox.checkbox-at-left > .container-stacked-icons:first-child { + position: absolute; + left: var(--bs-btn-padding-x); +} .btn-jb.standard-checkbox.semi-selected .standard-checkbox-checked-color { color: #fd7e14; } @@ -29975,9 +30612,6 @@ Also overwrite default bootstrap behaviour vertical-align: top; } .btn-jb.square { - display: inline-flex; - align-items: center; - justify-content: center; --bs-btn-padding-y: 0; --bs-btn-padding-x: 0; height: var(--bs-btn-square-dimention); @@ -30620,12 +31254,25 @@ div.modal-dialog.modal-flex-width.modal-extra-width { div.modal-dialog.modal-flex-width.modal-mega-width { width: var(--jb-modal-xl-rem); } +div.modal-dialog.modal-max-width:not(.modal-full-screen) { + width: calc(100% - 20px); +} +div.modal-dialog.modal-full-width:not(.modal-full-screen) { + width: 100%; +} +div.modal-dialog.modal-full-screen { + width: 100%; +} +div.modal-dialog.modal-full-screen:not(.modal-full-screen-with-border) .modal-content { + border: none; + border-radius: 0px; +} div.modal-dialog.modal-dialog-inline .modal-content { box-shadow: none; max-height: inherit; } div.modal-dialog:not(.modal-flex-width) .modal-content .modal-body > .jquery-scroll-container { - width: calc( 100% - 2*1px - 2*var(--jsc-scroll-padding) ); + width: calc(100% - 2 * 1px - 2 * var(--jsc-scroll-padding)); margin-left: auto; margin-right: auto; } @@ -30868,7 +31515,7 @@ div.modal-dialog .modal-content.modal-minimized.modal-minimized-semi-transparent background: none; } div.modal-dialog .modal-content.modal-minimized.modal-minimized-semi-transparent .modal-body, div.modal-dialog .modal-content.modal-minimized.modal-minimized-semi-transparent .modal-body-fixed, div.modal-dialog .modal-content.modal-minimized.modal-minimized-semi-transparent .modal-footer, div.modal-dialog .modal-content.modal-normal.modal-normal-semi-transparent .modal-body, div.modal-dialog .modal-content.modal-normal.modal-normal-semi-transparent .modal-body-fixed, div.modal-dialog .modal-content.modal-normal.modal-normal-semi-transparent .modal-footer, div.modal-dialog .modal-content.modal-extended.modal-extended-semi-transparent .modal-body, div.modal-dialog .modal-content.modal-extended.modal-extended-semi-transparent .modal-body-fixed, div.modal-dialog .modal-content.modal-extended.modal-extended-semi-transparent .modal-footer { - background: rgba(var(--bs-body-bg), 0.5); + background: color-mix(in srgb, var(--bs-body-bg), transparent 50%); } div.modal-dialog .modal-content.modal-minimized.modal-minimized-clickable .modal-body, div.modal-dialog .modal-content.modal-minimized.modal-minimized-clickable .modal-body-fixed, div.modal-dialog .modal-content.modal-normal.modal-normal-clickable .modal-body, div.modal-dialog .modal-content.modal-normal.modal-normal-clickable .modal-body-fixed, div.modal-dialog .modal-content.modal-extended.modal-extended-clickable .modal-body, div.modal-dialog .modal-content.modal-extended.modal-extended-clickable .modal-body-fixed { cursor: pointer; @@ -31046,7 +31693,7 @@ form.form-xs, .input-group-container-xs, .input-group-xs { border-top: var(--bs-border-width) solid var(--jb-structure-border-color); } .input-group-container.child-with-label { - padding-top: calc( 0.75 * var(--bs-input-label-font-size) + var(--bs-input-padding-y) ); + padding-top: calc(0.75 * var(--bs-input-label-font-size) + var(--bs-input-padding-y)); } .input-group-container.small-bottom-padding + .input-group-container { padding-top: var(--bs-input-padding-y); @@ -31199,6 +31846,11 @@ TABLE Adjustmernt to Bootstrap table ************************************************************/ .table.jb-table { + /******************************************************* + For some (unknown) reason the height of the table needs + to be 1px to allow height=100% of elements inside td + ********************************************************/ + height: 1px; /******************************************************* For some (unknown) reason the padding and font-size of table cells are not set using var(...) @@ -31521,13 +32173,13 @@ Is a modification to Bootstrap modal-class right: 20px; } .modal.noty-container.noty-container-topCenter, .modal.noty-container.noty-container-bottomCenter { - transform: translate(calc(-50% - 1px/2)) translateZ(0) scale(1, 1); + transform: translate(calc(-50% - 1px / 2)) translateZ(0) scale(1, 1); } .modal.noty-container.noty-container-center { - transform: translate(calc(-50% - 1px/2), calc(-50% - 1px/2)) translateZ(0) scale(1, 1); + transform: translate(calc(-50% - 1px / 2), calc(-50% - 1px / 2)) translateZ(0) scale(1, 1); } .modal.noty-container.noty-container-centerLeft, .modal.noty-container.noty-container-centerRight { - transform: translate(0, calc(-50% - 1px/2)) translateZ(0) scale(1, 1); + transform: translate(0, calc(-50% - 1px / 2)) translateZ(0) scale(1, 1); } @keyframes noty_anim_height { @@ -31625,6 +32277,8 @@ CAROUSEL max-width: -moz-fit-content; max-height: fit-content; max-height: -moz-fit-content; + width: initial !important; + height: initial !important; margin: auto; } .carousel .carousel-indicators { @@ -31648,19 +32302,37 @@ CAROUSEL white-space: nowrap; } .carousel .carousel-caption .carousel-caption-inner .caption { + max-width: 100%; + display: flex; + flex-direction: row; font-size: var(--bs-footer-font-size); --bs-footer-font-size: 0.75rem; --bs-footer-padding-y: 0.25rem; --bs-footer-padding-x: 0.25rem; } +.carousel .carousel-caption .carousel-caption-inner .caption span { + flex-shrink: 1; +} .carousel .carousel-caption .carousel-caption-inner .caption.caption-sm { --bs-footer-font-size: 0.6875rem; --bs-footer-padding-y: 0.125rem; --bs-footer-padding-x: 0.125rem; } -/*# sourceMappingURL=jquery-bootstrap.css.map */ - +/************************************************************ +MODAL-IMAGE + +Style for elements used to display any image in a modal-window + +************************************************************/ +.c-zoom__wrapper { + display: none; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; +} /*********************************************** lang-flag-icon.scss, Version 2.x @@ -33229,7 +33901,8 @@ jquery-scroll-container-variables.scss :root { --jsc-scroll-size: 10px; --jsc-scroll-padding: 10px; - --jsc-scroll-auto-padding: 10px; } + --jsc-scroll-auto-padding: 10px; +} /************************************************************ VARIABLES @@ -33248,7 +33921,7 @@ Modal ************************************************/ /*********************************************** Button And Modal -Opacity for semi-transparent and transparent content +Opacity for semi-transparent and transparent content using color-mix ************************************************/ /************************************************************ MIXIN @@ -33292,7 +33965,8 @@ COLORS AND STYLE --mm-item-closed-bg: null; --mm-panel-opened-bg: rgba(0,0,0, 0.05); --mm-shadow: 0 0 10px rgba(0, 0, 0, 0.3); - --chevrolet-dim: 0.625rem; } + --chevrolet-dim: 0.625rem; +} .mm-menu.mm-menu-sm { --mm-font-size: 0.875rem; @@ -33300,7 +33974,8 @@ COLORS AND STYLE --mm-listitem-size: 2.4375rem; --mm-navbar-size: 2.4375rem; --mm-iconbar-size: 2.4375rem; - --chevrolet-dim: 0.3125rem; } + --chevrolet-dim: 0.3125rem; +} /*********************************************** IMPORT MMENU SCSS @@ -33330,14 +34005,17 @@ IMPORT MMENU SCSS --mm-color-background: #f3f3f3; --mm-color-background-highlight: rgba(0, 0, 0, 0.05); --mm-color-background-emphasis: rgba(255, 255, 255, 0.4); - --mm-shadow: 0 0 10px rgba(0, 0, 0, 0.3); } + --mm-shadow: 0 0 10px rgba(0, 0, 0, 0.3); +} .mm-hidden { - display: none !important; } + display: none !important; +} .mm-wrapper { overflow-x: hidden; - position: relative; } + position: relative; +} .mm-menu { display: flex; @@ -33358,14 +34036,16 @@ IMPORT MMENU SCSS line-height: var(--mm-line-height); -webkit-tap-highlight-color: var(--mm-color-background-emphasis); -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; } - .mm-menu a, - .mm-menu a:link, - .mm-menu a:active, - .mm-menu a:visited, - .mm-menu a:hover { - text-decoration: none; - color: inherit; } + -moz-osx-font-smoothing: grayscale; +} +.mm-menu a, +.mm-menu a:link, +.mm-menu a:active, +.mm-menu a:visited, +.mm-menu a:hover { + text-decoration: none; + color: inherit; +} .mm-panel { z-index: 0; @@ -33378,33 +34058,43 @@ IMPORT MMENU SCSS border-color: var(--mm-color-border); background: var(--mm-color-background); transform: translate3d(100%, 0, 0); - transition: transform 0.4s ease; } - .mm-panel:not(.mm-hidden) { - display: block; } - .mm-panel:after { - content: ''; - display: block; - height: var(--mm-listitem-size); } - .mm-panel_opened { - z-index: 1; - transform: translate3d(0%, 0, 0); } - .mm-panel_opened-parent { - transform: translate3d(-30%, 0, 0); } - .mm-panel_highest { - z-index: 2; } - .mm-panel_noanimation { - transition: none !important; } - .mm-panel_noanimation.mm-panel_opened-parent { - transform: translate3d(0, 0, 0); } - .mm-panels > .mm-panel { - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; } + transition: transform 0.4s ease; +} +.mm-panel:not(.mm-hidden) { + display: block; +} +.mm-panel:after { + content: ""; + display: block; + height: var(--mm-listitem-size); +} +.mm-panel_opened { + z-index: 1; + transform: translate3d(0%, 0, 0); +} +.mm-panel_opened-parent { + transform: translate3d(-30%, 0, 0); +} +.mm-panel_highest { + z-index: 2; +} +.mm-panel_noanimation { + transition: none !important; +} +.mm-panel_noanimation.mm-panel_opened-parent { + transform: translate3d(0, 0, 0); +} +.mm-panels > .mm-panel { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; +} .mm-panel__content { - padding: 20px 20px 0; } + padding: 20px 20px 0; +} .mm-panels { position: relative; @@ -33413,30 +34103,36 @@ IMPORT MMENU SCSS overflow: hidden; background: var(--mm-color-background); border-color: var(--mm-color-border); - color: var(--mm-color-text); } + color: var(--mm-color-text); +} .mm-listitem_vertical > .mm-panel { display: none; width: 100%; padding: 10px 0 10px 10px; - transform: none !important; } - .mm-listitem_vertical > .mm-panel:before, .mm-listitem_vertical > .mm-panel:after { - content: none; - display: none; } + transform: none !important; +} +.mm-listitem_vertical > .mm-panel:before, .mm-listitem_vertical > .mm-panel:after { + content: none; + display: none; +} .mm-listitem_opened > .mm-panel { - display: block; } + display: block; +} .mm-listitem_vertical > .mm-listitem__btn { height: var(--mm-listitem-size); - bottom: auto; } - + bottom: auto; +} .mm-listitem_vertical .mm-listitem:last-child:after { - border-color: transparent; } + border-color: transparent; +} .mm-listitem_opened > .mm-listitem__btn:after { transform: rotate(225deg); - right: 19px; } + right: 19px; +} .mm-btn { flex-grow: 0; @@ -33444,12 +34140,14 @@ IMPORT MMENU SCSS position: relative; box-sizing: border-box; width: 50px; - padding: 0; } - .mm-btn:before, .mm-btn:after { - border: 2px solid var(--mm-color-button); } + padding: 0; +} +.mm-btn:before, .mm-btn:after { + border: 2px solid var(--mm-color-button); +} -.mm-btn_prev:before, .mm-btn_next:after { - content: ''; +.mm-btn_next:after, .mm-btn_prev:before { + content: ""; border-bottom: none; border-right: none; box-sizing: content-box; @@ -33459,20 +34157,21 @@ IMPORT MMENU SCSS margin: auto; position: absolute; top: 0; - bottom: 0; } + bottom: 0; +} .mm-btn_prev:before { transform: rotate(-45deg); left: 23px; - right: auto; } - + right: auto; +} .mm-btn_next:after { transform: rotate(135deg); right: 23px; - left: auto; } - + left: auto; +} .mm-btn_close:before, .mm-btn_close:after { - content: ''; + content: ""; box-sizing: content-box; display: block; width: 5px; @@ -33481,17 +34180,18 @@ IMPORT MMENU SCSS position: absolute; top: 0; bottom: 0; - transform: rotate(-45deg); } - + transform: rotate(-45deg); +} .mm-btn_close:before { border-right: none; border-bottom: none; - right: 18px; } - + right: 18px; +} .mm-btn_close:after { border-left: none; border-top: none; - right: 25px; } + right: 25px; +} .mm-navbar { display: flex; @@ -33501,44 +34201,55 @@ IMPORT MMENU SCSS color: var(--mm-color-text-dimmed); text-align: center; opacity: 1; - transition: opacity 0.4s ease; } - @supports (position: sticky) { - .mm-navbar_sticky { - position: sticky; - top: 0; - z-index: 1; } } - .mm-navbar > * { - flex-grow: 1; - display: flex; - align-items: center; - justify-content: center; - box-sizing: border-box; } + transition: opacity 0.4s ease; +} +@supports (position: sticky) { + .mm-navbar_sticky { + position: sticky; + top: 0; + z-index: 1; + } +} +.mm-navbar > * { + flex-grow: 1; + display: flex; + align-items: center; + justify-content: center; + box-sizing: border-box; +} .mm-navbar__btn { - flex-grow: 0; } + flex-grow: 0; +} .mm-navbar__title { flex: 1 1 50%; display: flex; padding-left: 20px; padding-right: 20px; - overflow: hidden; } - .mm-navbar__title:not(:last-child) { - padding-right: 0; } - .mm-navbar__title > span { - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; } - .mm-navbar__btn:not(.mm-hidden) + .mm-navbar__title { - padding-left: 0; } - .mm-navbar__btn:not(.mm-hidden) + .mm-navbar__title:last-child { - padding-right: 50px; } + overflow: hidden; +} +.mm-navbar__title:not(:last-child) { + padding-right: 0; +} +.mm-navbar__title > span { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} +.mm-navbar__btn:not(.mm-hidden) + .mm-navbar__title { + padding-left: 0; +} +.mm-navbar__btn:not(.mm-hidden) + .mm-navbar__title:last-child { + padding-right: 50px; +} .mm-listview { list-style: none; display: block; padding: 0; - margin: 0; } + margin: 0; +} .mm-listitem { color: var(--mm-color-text); @@ -33549,27 +34260,31 @@ IMPORT MMENU SCSS margin: 0; position: relative; display: flex; - flex-wrap: wrap; } - .mm-listitem:after { - content: ''; - border-color: inherit; - border-bottom-width: 1px; - border-bottom-style: solid; - display: block; - position: absolute; - left: 20px; - right: 0; - bottom: 0; } - .mm-listitem a, - .mm-listitem a:hover { - text-decoration: none; } + flex-wrap: wrap; +} +.mm-listitem:after { + content: ""; + border-color: inherit; + border-bottom-width: 1px; + border-bottom-style: solid; + display: block; + position: absolute; + left: 20px; + right: 0; + bottom: 0; +} +.mm-listitem a, +.mm-listitem a:hover { + text-decoration: none; +} -.mm-listitem__text, .mm-listitem__btn { +.mm-listitem__btn, .mm-listitem__text { display: block; padding: calc((var(--mm-listitem-size) - var(--mm-line-height)) / 2); padding-left: 0; padding-right: 0; - color: inherit; } + color: inherit; +} .mm-listitem__text { text-overflow: ellipsis; @@ -33578,65 +34293,79 @@ IMPORT MMENU SCSS padding-left: 20px; padding-right: 10px; flex-grow: 1; - flex-basis: 10%; } + flex-basis: 10%; +} .mm-listitem__btn { background: rgba(3, 2, 1, 0); border-color: inherit; width: auto; padding-right: 50px; - position: relative; } - .mm-listitem__btn:not(.mm-listitem__text) { - border-left-width: 1px; - border-left-style: solid; } + position: relative; +} +.mm-listitem__btn:not(.mm-listitem__text) { + border-left-width: 1px; + border-left-style: solid; +} .mm-listitem_selected > .mm-listitem__text { - background: var(--mm-color-background-emphasis); } - + background: var(--mm-color-background-emphasis); +} .mm-listitem_opened > .mm-listitem__btn, .mm-listitem_opened > .mm-panel { - background: var(--mm-color-background-highlight); } + background: var(--mm-color-background-highlight); +} .mm-page { box-sizing: border-box; - position: relative; } + position: relative; +} .mm-slideout { transition: transform 0.4s ease; - z-index: 1; } + z-index: 1; +} .mm-wrapper_opened { overflow-x: hidden; - position: relative; } - .mm-wrapper_opened .mm-page { - min-height: 100vh; } - + position: relative; +} +.mm-wrapper_opened .mm-page { + min-height: 100vh; +} .mm-wrapper_background .mm-page { - background: inherit; } + background: inherit; +} .mm-menu_offcanvas { position: fixed; right: auto; - z-index: 0; } - .mm-menu_offcanvas:not(.mm-menu_opened) { - display: none; } + z-index: 0; +} +.mm-menu_offcanvas:not(.mm-menu_opened) { + display: none; +} .mm-menu_offcanvas { width: 80%; min-width: 240px; - max-width: 440px; } + max-width: 440px; +} .mm-wrapper_opening .mm-menu_offcanvas.mm-menu_opened ~ .mm-slideout { - transform: translate3d(80vw, 0, 0); } + transform: translate3d(80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_offcanvas.mm-menu_opened ~ .mm-slideout { - transform: translate3d(240px, 0, 0); } } - + transform: translate3d(240px, 0, 0); + } +} @media all and (min-width: 550px) { .mm-wrapper_opening .mm-menu_offcanvas.mm-menu_opened ~ .mm-slideout { - transform: translate3d(440px, 0, 0); } } - + transform: translate3d(440px, 0, 0); + } +} .mm-wrapper__blocker { background: rgba(3, 2, 1, 0); overflow: hidden; @@ -33646,14 +34375,18 @@ IMPORT MMENU SCSS right: 0; bottom: 0; left: 0; - z-index: 2; } + z-index: 2; +} .mm-wrapper_blocking { - overflow: hidden; } - .mm-wrapper_blocking body { - overflow: hidden; } - .mm-wrapper_blocking .mm-wrapper__blocker { - display: block; } + overflow: hidden; +} +.mm-wrapper_blocking body { + overflow: hidden; +} +.mm-wrapper_blocking .mm-wrapper__blocker { + display: block; +} .mm-sronly { border: 0 !important; @@ -33666,302 +34399,376 @@ IMPORT MMENU SCSS min-height: 1px !important; padding: 0 !important; overflow: hidden !important; - position: absolute !important; } + position: absolute !important; +} .mm-menu_autoheight:not(.mm-menu_offcanvas) { - position: relative; } - + position: relative; +} .mm-menu_autoheight.mm-menu_position-top, .mm-menu_autoheight.mm-menu_position-bottom { - max-height: 80%; } - + max-height: 80%; +} .mm-menu_autoheight-measuring .mm-panel { - display: block !important; } - + display: block !important; +} .mm-menu_autoheight-measuring .mm-panels > .mm-panel { bottom: auto !important; - height: auto !important; } - + height: auto !important; +} .mm-menu_autoheight-measuring .mm-listitem_vertical:not(.mm-listitem_opened) .mm-panel { - display: none !important; } + display: none !important; +} -[class*='mm-menu_columns-'] { - transition-property: width; } - [class*='mm-menu_columns-'] .mm-panels > .mm-panel { - right: auto; - transition-property: width, transform; } - [class*='mm-menu_columns-'] .mm-panels > .mm-panel_opened, [class*='mm-menu_columns-'] .mm-panels > .mm-panel_opened-parent { - display: block !important; } +[class*=mm-menu_columns-] { + transition-property: width; +} +[class*=mm-menu_columns-] .mm-panels > .mm-panel { + right: auto; + transition-property: width, transform; +} +[class*=mm-menu_columns-] .mm-panels > .mm-panel_opened, [class*=mm-menu_columns-] .mm-panels > .mm-panel_opened-parent { + display: block !important; +} -[class*='mm-panel_columns-'] { +[class*=mm-panel_columns-] { border-right: 1px solid; - border-color: inherit; } + border-color: inherit; +} .mm-menu_columns-1 .mm-panel_columns-0, .mm-menu_columns-2 .mm-panel_columns-1, .mm-menu_columns-3 .mm-panel_columns-2, .mm-menu_columns-4 .mm-panel_columns-3 { - border-right: none; } + border-right: none; +} -[class*='mm-menu_columns-'] .mm-panels > .mm-panel_columns-0 { - transform: translate3d(0%, 0, 0); } +[class*=mm-menu_columns-] .mm-panels > .mm-panel_columns-0 { + transform: translate3d(0%, 0, 0); +} .mm-menu_columns-0 .mm-panels > .mm-panel { - z-index: 0; } - .mm-menu_columns-0 .mm-panels > .mm-panel else { - width: 100%; } - .mm-menu_columns-0 .mm-panels > .mm-panel:not(.mm-panel_opened):not(.mm-panel_opened-parent) { - transform: translate3d(100%, 0, 0); } + z-index: 0; +} +.mm-menu_columns-0 .mm-panels > .mm-panel else { + width: 100%; +} +.mm-menu_columns-0 .mm-panels > .mm-panel:not(.mm-panel_opened):not(.mm-panel_opened-parent) { + transform: translate3d(100%, 0, 0); +} .mm-menu_columns-0 { width: 80%; min-width: 240px; - max-width: 0px; } + max-width: 0px; +} .mm-wrapper_opening .mm-menu_columns-0.mm-menu_opened ~ .mm-slideout { - transform: translate3d(80vw, 0, 0); } + transform: translate3d(80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_columns-0.mm-menu_opened ~ .mm-slideout { - transform: translate3d(240px, 0, 0); } } - + transform: translate3d(240px, 0, 0); + } +} @media all and (min-width: 0px) { .mm-wrapper_opening .mm-menu_columns-0.mm-menu_opened ~ .mm-slideout { - transform: translate3d(0px, 0, 0); } } - + transform: translate3d(0px, 0, 0); + } +} .mm-wrapper_opening .mm-menu_columns-0.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-80vw, 0, 0); } + transform: translate3d(-80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_columns-0.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-240px, 0, 0); } } - + transform: translate3d(-240px, 0, 0); + } +} @media all and (min-width: 0px) { .mm-wrapper_opening .mm-menu_columns-0.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(0px, 0, 0); } } - -[class*='mm-menu_columns-'] .mm-panels > .mm-panel_columns-1 { - transform: translate3d(100%, 0, 0); } + transform: translate3d(0px, 0, 0); + } +} +[class*=mm-menu_columns-] .mm-panels > .mm-panel_columns-1 { + transform: translate3d(100%, 0, 0); +} .mm-menu_columns-1 .mm-panels > .mm-panel { z-index: 1; - width: 100%; } - .mm-menu_columns-1 .mm-panels > .mm-panel else { - width: 100%; } - .mm-menu_columns-1 .mm-panels > .mm-panel:not(.mm-panel_opened):not(.mm-panel_opened-parent) { - transform: translate3d(200%, 0, 0); } + width: 100%; +} +.mm-menu_columns-1 .mm-panels > .mm-panel else { + width: 100%; +} +.mm-menu_columns-1 .mm-panels > .mm-panel:not(.mm-panel_opened):not(.mm-panel_opened-parent) { + transform: translate3d(200%, 0, 0); +} .mm-menu_columns-1 { width: 80%; min-width: 240px; - max-width: 440px; } + max-width: 440px; +} .mm-wrapper_opening .mm-menu_columns-1.mm-menu_opened ~ .mm-slideout { - transform: translate3d(80vw, 0, 0); } + transform: translate3d(80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_columns-1.mm-menu_opened ~ .mm-slideout { - transform: translate3d(240px, 0, 0); } } - + transform: translate3d(240px, 0, 0); + } +} @media all and (min-width: 550px) { .mm-wrapper_opening .mm-menu_columns-1.mm-menu_opened ~ .mm-slideout { - transform: translate3d(440px, 0, 0); } } - + transform: translate3d(440px, 0, 0); + } +} .mm-wrapper_opening .mm-menu_columns-1.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-80vw, 0, 0); } + transform: translate3d(-80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_columns-1.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-240px, 0, 0); } } - + transform: translate3d(-240px, 0, 0); + } +} @media all and (min-width: 550px) { .mm-wrapper_opening .mm-menu_columns-1.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-440px, 0, 0); } } - -[class*='mm-menu_columns-'] .mm-panels > .mm-panel_columns-2 { - transform: translate3d(200%, 0, 0); } + transform: translate3d(-440px, 0, 0); + } +} +[class*=mm-menu_columns-] .mm-panels > .mm-panel_columns-2 { + transform: translate3d(200%, 0, 0); +} .mm-menu_columns-2 .mm-panels > .mm-panel { z-index: 2; - width: 50%; } - .mm-menu_columns-2 .mm-panels > .mm-panel else { - width: 100%; } - .mm-menu_columns-2 .mm-panels > .mm-panel:not(.mm-panel_opened):not(.mm-panel_opened-parent) { - transform: translate3d(300%, 0, 0); } + width: 50%; +} +.mm-menu_columns-2 .mm-panels > .mm-panel else { + width: 100%; +} +.mm-menu_columns-2 .mm-panels > .mm-panel:not(.mm-panel_opened):not(.mm-panel_opened-parent) { + transform: translate3d(300%, 0, 0); +} .mm-menu_columns-2 { width: 80%; min-width: 240px; - max-width: 880px; } + max-width: 880px; +} .mm-wrapper_opening .mm-menu_columns-2.mm-menu_opened ~ .mm-slideout { - transform: translate3d(80vw, 0, 0); } + transform: translate3d(80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_columns-2.mm-menu_opened ~ .mm-slideout { - transform: translate3d(240px, 0, 0); } } - + transform: translate3d(240px, 0, 0); + } +} @media all and (min-width: 1100px) { .mm-wrapper_opening .mm-menu_columns-2.mm-menu_opened ~ .mm-slideout { - transform: translate3d(880px, 0, 0); } } - + transform: translate3d(880px, 0, 0); + } +} .mm-wrapper_opening .mm-menu_columns-2.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-80vw, 0, 0); } + transform: translate3d(-80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_columns-2.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-240px, 0, 0); } } - + transform: translate3d(-240px, 0, 0); + } +} @media all and (min-width: 1100px) { .mm-wrapper_opening .mm-menu_columns-2.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-880px, 0, 0); } } - -[class*='mm-menu_columns-'] .mm-panels > .mm-panel_columns-3 { - transform: translate3d(300%, 0, 0); } + transform: translate3d(-880px, 0, 0); + } +} +[class*=mm-menu_columns-] .mm-panels > .mm-panel_columns-3 { + transform: translate3d(300%, 0, 0); +} .mm-menu_columns-3 .mm-panels > .mm-panel { z-index: 3; - width: 33.34%; } - .mm-menu_columns-3 .mm-panels > .mm-panel else { - width: 100%; } - .mm-menu_columns-3 .mm-panels > .mm-panel:not(.mm-panel_opened):not(.mm-panel_opened-parent) { - transform: translate3d(400%, 0, 0); } + width: 33.34%; +} +.mm-menu_columns-3 .mm-panels > .mm-panel else { + width: 100%; +} +.mm-menu_columns-3 .mm-panels > .mm-panel:not(.mm-panel_opened):not(.mm-panel_opened-parent) { + transform: translate3d(400%, 0, 0); +} .mm-menu_columns-3 { width: 80%; min-width: 240px; - max-width: 1320px; } + max-width: 1320px; +} .mm-wrapper_opening .mm-menu_columns-3.mm-menu_opened ~ .mm-slideout { - transform: translate3d(80vw, 0, 0); } + transform: translate3d(80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_columns-3.mm-menu_opened ~ .mm-slideout { - transform: translate3d(240px, 0, 0); } } - + transform: translate3d(240px, 0, 0); + } +} @media all and (min-width: 1650px) { .mm-wrapper_opening .mm-menu_columns-3.mm-menu_opened ~ .mm-slideout { - transform: translate3d(1320px, 0, 0); } } - + transform: translate3d(1320px, 0, 0); + } +} .mm-wrapper_opening .mm-menu_columns-3.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-80vw, 0, 0); } + transform: translate3d(-80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_columns-3.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-240px, 0, 0); } } - + transform: translate3d(-240px, 0, 0); + } +} @media all and (min-width: 1650px) { .mm-wrapper_opening .mm-menu_columns-3.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-1320px, 0, 0); } } - -[class*='mm-menu_columns-'] .mm-panels > .mm-panel_columns-4 { - transform: translate3d(400%, 0, 0); } + transform: translate3d(-1320px, 0, 0); + } +} +[class*=mm-menu_columns-] .mm-panels > .mm-panel_columns-4 { + transform: translate3d(400%, 0, 0); +} .mm-menu_columns-4 .mm-panels > .mm-panel { z-index: 4; - width: 25%; } - .mm-menu_columns-4 .mm-panels > .mm-panel else { - width: 100%; } - .mm-menu_columns-4 .mm-panels > .mm-panel:not(.mm-panel_opened):not(.mm-panel_opened-parent) { - transform: translate3d(500%, 0, 0); } + width: 25%; +} +.mm-menu_columns-4 .mm-panels > .mm-panel else { + width: 100%; +} +.mm-menu_columns-4 .mm-panels > .mm-panel:not(.mm-panel_opened):not(.mm-panel_opened-parent) { + transform: translate3d(500%, 0, 0); +} .mm-menu_columns-4 { width: 80%; min-width: 240px; - max-width: 1760px; } + max-width: 1760px; +} .mm-wrapper_opening .mm-menu_columns-4.mm-menu_opened ~ .mm-slideout { - transform: translate3d(80vw, 0, 0); } + transform: translate3d(80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_columns-4.mm-menu_opened ~ .mm-slideout { - transform: translate3d(240px, 0, 0); } } - + transform: translate3d(240px, 0, 0); + } +} @media all and (min-width: 2200px) { .mm-wrapper_opening .mm-menu_columns-4.mm-menu_opened ~ .mm-slideout { - transform: translate3d(1760px, 0, 0); } } - + transform: translate3d(1760px, 0, 0); + } +} .mm-wrapper_opening .mm-menu_columns-4.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-80vw, 0, 0); } + transform: translate3d(-80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_columns-4.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-240px, 0, 0); } } - + transform: translate3d(-240px, 0, 0); + } +} @media all and (min-width: 2200px) { .mm-wrapper_opening .mm-menu_columns-4.mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-1760px, 0, 0); } } - -[class*='mm-menu_columns-'].mm-menu_position-bottom, [class*='mm-menu_columns-'].mm-menu_position-top { + transform: translate3d(-1760px, 0, 0); + } +} +[class*=mm-menu_columns-].mm-menu_position-bottom, [class*=mm-menu_columns-].mm-menu_position-top { width: 100%; max-width: 100%; - min-width: 100%; } + min-width: 100%; +} -.mm-wrapper_opening [class*='mm-menu_columns-'].mm-menu_position-front { - transition-property: width, min-width, max-width, transform; } +.mm-wrapper_opening [class*=mm-menu_columns-].mm-menu_position-front { + transition-property: width, min-width, max-width, transform; +} .mm-counter { display: block; padding-left: 20px; float: right; text-align: right; - color: var(--mm-color-text-dimmed); } + color: var(--mm-color-text-dimmed); +} .mm-listitem_nosubitems > .mm-counter { - display: none; } + display: none; +} .mm-divider { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; min-height: var(--mm-line-height); - padding: calc( ((var(--mm-listitem-size) * 0.65) - var(--mm-line-height)) * 0.5); + padding: calc((var(--mm-listitem-size) * 0.65 - var(--mm-line-height)) * 0.5); padding-right: 10px; padding-left: 20px; font-size: 75%; text-transform: uppercase; background: var(--mm-color-background); opacity: 1; - transition: opacity 0.4s ease; } - @supports (position: sticky) { - .mm-divider { - position: sticky; - z-index: 2; - top: 0; } - .mm-navbar_sticky:not(.mm-hidden) ~ .mm-listview .mm-divider { - top: var(--mm-navbar-size); } } - .mm-divider:before { - content: ''; - position: absolute; + transition: opacity 0.4s ease; +} +@supports (position: sticky) { + .mm-divider { + position: sticky; + z-index: 2; top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: -1; - background: var(--mm-color-background-highlight); } + } + .mm-navbar_sticky:not(.mm-hidden) ~ .mm-listview .mm-divider { + top: var(--mm-navbar-size); + } +} +.mm-divider:before { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: -1; + background: var(--mm-color-background-highlight); +} .mm-wrapper_dragging .mm-menu, .mm-wrapper_dragging .mm-slideout { transition-duration: 0s !important; - user-select: none !important; } - + user-select: none !important; +} .mm-wrapper_dragging .mm-menu { - pointer-events: none !important; } - + pointer-events: none !important; +} .mm-wrapper_dragging .mm-wrapper__blocker { - display: none !important; } + display: none !important; +} :root { - --mm-iconbar-size: 50px; } + --mm-iconbar-size: 50px; +} .mm-menu_iconbar-left .mm-panels, .mm-menu_iconbar-left .mm-navbars_top, .mm-menu_iconbar-left .mm-navbars_bottom { - margin-left: var(--mm-iconbar-size); } - + margin-left: var(--mm-iconbar-size); +} .mm-menu_iconbar-right .mm-panels, .mm-menu_iconbar-right .mm-navbars_top, .mm-menu_iconbar-right .mm-navbars_bottom { - margin-right: var(--mm-iconbar-size); } + margin-right: var(--mm-iconbar-size); +} .mm-iconbar { display: none; @@ -33976,18 +34783,21 @@ IMPORT MMENU SCSS border-color: var(--mm-color-border); background: var(--mm-color-background); color: var(--mm-color-text-dimmed); - text-align: center; } - .mm-menu_iconbar-left .mm-iconbar, - .mm-menu_iconbar-right .mm-iconbar { - display: flex; - flex-direction: column; - justify-content: space-between; } - .mm-menu_iconbar-left .mm-iconbar { - border-right-width: 1px; - left: 0; } - .mm-menu_iconbar-right .mm-iconbar { - border-left-width: 1px; - right: 0; } + text-align: center; +} +.mm-menu_iconbar-left .mm-iconbar, .mm-menu_iconbar-right .mm-iconbar { + display: flex; + flex-direction: column; + justify-content: space-between; +} +.mm-menu_iconbar-left .mm-iconbar { + border-right-width: 1px; + left: 0; +} +.mm-menu_iconbar-right .mm-iconbar { + border-left-width: 1px; + right: 0; +} .mm-iconbar__top, .mm-iconbar__bottom { @@ -33995,85 +34805,106 @@ IMPORT MMENU SCSS -webkit-overflow-scrolling: touch; overflow: hidden; overflow-y: auto; - overscroll-behavior: contain; } - .mm-iconbar__top > *, - .mm-iconbar__bottom > * { - box-sizing: border-box; - display: block; - padding: 12.5px 0; } - .mm-iconbar__top a, - .mm-iconbar__top a:hover, - .mm-iconbar__bottom a, - .mm-iconbar__bottom a:hover { - text-decoration: none; } + overscroll-behavior: contain; +} +.mm-iconbar__top > *, +.mm-iconbar__bottom > * { + box-sizing: border-box; + display: block; + padding: 12.5px 0; +} +.mm-iconbar__top a, +.mm-iconbar__top a:hover, +.mm-iconbar__bottom a, +.mm-iconbar__bottom a:hover { + text-decoration: none; +} .mm-iconbar__tab_selected { - background: var(--mm-color-background-emphasis); } + background: var(--mm-color-background-emphasis); +} :root { - --mm-iconpanel-size: 50px; } + --mm-iconpanel-size: 50px; +} .mm-panel_iconpanel-1 { - width: calc(100% - (var(--mm-iconpanel-size) * 1)); } + width: calc(100% - (var(--mm-iconpanel-size) * 1)); +} .mm-panel_iconpanel-2 { - width: calc(100% - (var(--mm-iconpanel-size) * 2)); } + width: calc(100% - (var(--mm-iconpanel-size) * 2)); +} .mm-panel_iconpanel-3 { - width: calc(100% - (var(--mm-iconpanel-size) * 3)); } + width: calc(100% - (var(--mm-iconpanel-size) * 3)); +} .mm-panel_iconpanel-first ~ .mm-panel { - width: calc(100% - var(--mm-iconpanel-size)); } + width: calc(100% - var(--mm-iconpanel-size)); +} .mm-menu_iconpanel .mm-panels > .mm-panel { left: auto; - transition-property: transform, width; } - .mm-menu_iconpanel .mm-panels > .mm-panel_opened, .mm-menu_iconpanel .mm-panels > .mm-panel_opened-parent { - display: block !important; } - .mm-menu_iconpanel .mm-panels > .mm-panel_opened-parent { - overflow-y: hidden; - transform: unset; } - .mm-menu_iconpanel .mm-panels > .mm-panel:not(.mm-panel_iconpanel-first):not(.mm-panel_iconpanel-0) { - border-left-width: 1px; - border-left-style: solid; } + transition-property: transform, width; +} +.mm-menu_iconpanel .mm-panels > .mm-panel_opened, .mm-menu_iconpanel .mm-panels > .mm-panel_opened-parent { + display: block !important; +} +.mm-menu_iconpanel .mm-panels > .mm-panel_opened-parent { + overflow-y: hidden; + transform: unset; +} +.mm-menu_iconpanel .mm-panels > .mm-panel:not(.mm-panel_iconpanel-first):not(.mm-panel_iconpanel-0) { + border-left-width: 1px; + border-left-style: solid; +} .mm-menu_hidenavbar .mm-panel_opened-parent .mm-navbar, .mm-menu_hidedivider .mm-panel_opened-parent .mm-divider { - opacity: 0; } + opacity: 0; +} -.mm-menu_keyboardfocus a:focus, -.mm-menu_keyboardfocus.mm-menu_opened ~ .mm-wrapper__blocker a:focus { +.mm-menu_keyboardfocus a:focus, .mm-menu_keyboardfocus.mm-menu_opened ~ .mm-wrapper__blocker a:focus { background: var(--mm-color-background-emphasis); - outline: none; } + outline: none; +} .mm-wrapper__blocker .mm-tabstart { cursor: default; display: block; width: 100%; - height: 100%; } - + height: 100%; +} .mm-wrapper__blocker .mm-tabend { opacity: 0; position: absolute; - bottom: 0; } + bottom: 0; +} .mm-navbars_top { - flex-shrink: 0; } - .mm-navbars_top .mm-navbar:not(:last-child) { - border-bottom: none; } + flex-shrink: 0; +} +.mm-navbars_top .mm-navbar:not(:last-child) { + border-bottom: none; +} .mm-navbars_bottom { - flex-shrink: 0; } - .mm-navbars_bottom .mm-navbar { - border-bottom: none; } - .mm-navbars_bottom .mm-navbar:first-child { - border-top: 1px solid var(--mm-color-border); } + flex-shrink: 0; +} +.mm-navbars_bottom .mm-navbar { + border-bottom: none; +} +.mm-navbars_bottom .mm-navbar:first-child { + border-top: 1px solid var(--mm-color-border); +} .mm-btn:not(.mm-hidden) + .mm-navbar__searchfield .mm-searchfield__input { - padding-left: 0; } - + padding-left: 0; +} .mm-navbar__searchfield:not(:last-child) .mm-searchfield__input { - padding-right: 0; } + padding-right: 0; +} .mm-navbar__breadcrumbs { text-overflow: ellipsis; @@ -34084,92 +34915,107 @@ IMPORT MMENU SCSS justify-content: flex-start; padding: 0 20px; overflow-x: auto; - -webkit-overflow-scrolling: touch; } - .mm-navbar__breadcrumbs > * { - display: flex; - align-items: center; - justify-content: center; - padding-right: 6px; } - .mm-navbar__breadcrumbs > a { - text-decoration: underline; } - .mm-navbar__breadcrumbs:not(:last-child) { - padding-right: 0; } - .mm-btn:not(.mm-hidden) + .mm-navbar__breadcrumbs { - padding-left: 0; } + -webkit-overflow-scrolling: touch; +} +.mm-navbar__breadcrumbs > * { + display: flex; + align-items: center; + justify-content: center; + padding-right: 6px; +} +.mm-navbar__breadcrumbs > a { + text-decoration: underline; +} +.mm-navbar__breadcrumbs:not(:last-child) { + padding-right: 0; +} +.mm-btn:not(.mm-hidden) + .mm-navbar__breadcrumbs { + padding-left: 0; +} .mm-navbar_tabs > * { padding: 0 10px; - border: 1px solid transparent; } + border: 1px solid transparent; +} .mm-navbar__tab_selected { background: var(--mm-color-background); - color: var(--mm-color-text); } - .mm-navbar__tab_selected:not(:first-child) { - border-left-color: var(--mm-color-border); } - .mm-navbar__tab_selected:not(:last-child) { - border-right-color: var(--mm-color-border); } + color: var(--mm-color-text); +} +.mm-navbar__tab_selected:not(:first-child) { + border-left-color: var(--mm-color-border); +} +.mm-navbar__tab_selected:not(:last-child) { + border-right-color: var(--mm-color-border); +} .mm-navbars_top .mm-navbar_tabs { - border-bottom: none; } - + border-bottom: none; +} .mm-navbars_top .mm-navbar_tabs > * { - border-bottom-color: var(--mm-color-border); } - + border-bottom-color: var(--mm-color-border); +} .mm-navbars_top .mm-navbar__tab_selected { border-top-color: var(--mm-color-border); - border-bottom-color: transparent; } - + border-bottom-color: transparent; +} .mm-navbars_top.mm-navbars_has-tabs .mm-navbar { - background: var(--mm-color-background-emphasis); } - + background: var(--mm-color-background-emphasis); +} .mm-navbars_top.mm-navbars_has-tabs .mm-navbar_tabs ~ .mm-navbar { - background: var(--mm-color-background); } + background: var(--mm-color-background); +} .mm-navbars_bottom .mm-navbar_tabs:first-child { - border-top: none; } - + border-top: none; +} .mm-navbars_bottom .mm-navbar_tabs > * { - border-top-color: var(--mm-color-border); } - + border-top-color: var(--mm-color-border); +} .mm-navbars_bottom .mm-navbar__tab_selected { border-bottom-color: var(--mm-color-border); - border-top-color: transparent; } - + border-top-color: transparent; +} .mm-navbars_bottom.mm-navbars_has-tabs .mm-navbar { - background: var(--mm-color-background); } - + background: var(--mm-color-background); +} .mm-navbars_bottom.mm-navbars_has-tabs .mm-navbar_tabs, .mm-navbars_bottom.mm-navbars_has-tabs .mm-navbar_tabs ~ .mm-navbar { - background: var(--mm-color-background-emphasis); } + background: var(--mm-color-background-emphasis); +} .mm-searchfield { display: flex; flex-grow: 1; height: var(--mm-navbar-size); padding: 0; - overflow: hidden; } - .mm-searchfield input { - display: block; - width: 100%; - max-width: 100%; - height: calc(var(--mm-navbar-size) * 0.7); - min-height: unset; - max-height: unset; - margin: 0; - padding: 0 10px; - box-sizing: border-box; - border: none !important; - border-radius: 4px; - line-height: calc(var(--mm-navbar-size) * 0.7); - box-shadow: none !important; - outline: none !important; - font: inherit; - font-size: inherit; } - .mm-searchfield input, .mm-searchfield input:hover, .mm-searchfield input:focus { - background: var(--mm-color-background-highlight); - color: var(--mm-color-text); } - .mm-searchfield input::-ms-clear { - display: none; } + overflow: hidden; +} +.mm-searchfield input { + display: block; + width: 100%; + max-width: 100%; + height: calc(var(--mm-navbar-size) * 0.7); + min-height: unset; + max-height: unset; + margin: 0; + padding: 0 10px; + box-sizing: border-box; + border: none !important; + border-radius: 4px; + line-height: calc(var(--mm-navbar-size) * 0.7); + box-shadow: none !important; + outline: none !important; + font: inherit; + font-size: inherit; +} +.mm-searchfield input, .mm-searchfield input:hover, .mm-searchfield input:focus { + background: var(--mm-color-background-highlight); + color: var(--mm-color-text); +} +.mm-searchfield input::-ms-clear { + display: none; +} .mm-searchfield__input { display: flex; @@ -34179,25 +35025,29 @@ IMPORT MMENU SCSS width: 100%; max-width: 100%; padding: 0 10px; - box-sizing: border-box; } + box-sizing: border-box; +} .mm-panel__noresultsmsg { padding: 50px 0; color: var(--mm-color-text-dimmed); text-align: center; - font-size: 150%; } + font-size: 150%; +} .mm-searchfield__btn { position: absolute; right: 0; top: 0; - bottom: 0; } + bottom: 0; +} .mm-panel_search { left: 0 !important; right: 0 !important; width: 100% !important; - border-left: none !important; } + border-left: none !important; +} .mm-searchfield__cancel { display: block; @@ -34205,20 +35055,24 @@ IMPORT MMENU SCSS margin-right: -100px; line-height: var(--mm-navbar-size); text-decoration: none; - transition: margin 0.4s ease; } + transition: margin 0.4s ease; +} .mm-searchfield__cancel-active { - margin-right: 0; } + margin-right: 0; +} .mm-listitem_nosubitems > .mm-listitem__btn { - display: none; } - + display: none; +} .mm-listitem_nosubitems > .mm-listitem__text { - padding-right: 10px; } + padding-right: 10px; +} .mm-listitem_onlysubitems > .mm-listitem__text:not(.mm-listitem__btn) { z-index: -1; - pointer-events: none; } + pointer-events: none; +} .mm-sectionindexer { background: inherit; @@ -34234,75 +35088,93 @@ IMPORT MMENU SCSS transition: right 0.4s ease; display: flex; flex-direction: column; - justify-content: space-evenly; } - .mm-sectionindexer a { - color: var(--mm-color-text-dimmed); - line-height: 1; - text-decoration: none; - display: block; } - .mm-sectionindexer ~ .mm-panel { - padding-right: 0; } - .mm-sectionindexer_active { - right: 0; } - .mm-sectionindexer_active ~ .mm-panel { - padding-right: 20px; } + justify-content: space-evenly; +} +.mm-sectionindexer a { + color: var(--mm-color-text-dimmed); + line-height: 1; + text-decoration: none; + display: block; +} +.mm-sectionindexer ~ .mm-panel { + padding-right: 0; +} +.mm-sectionindexer_active { + right: 0; +} +.mm-sectionindexer_active ~ .mm-panel { + padding-right: 20px; +} .mm-menu_selected-hover .mm-listitem__text, .mm-menu_selected-hover .mm-listitem__btn, .mm-menu_selected-parent .mm-listitem__text, .mm-menu_selected-parent .mm-listitem__btn { - transition: background-color 0.4s ease; } - + transition: background-color 0.4s ease; +} .mm-menu_selected-hover .mm-listview:hover > .mm-listitem_selected:not(:hover) > .mm-listitem__text { - background: none; } - + background: none; +} .mm-menu_selected-hover .mm-listitem__text:hover, .mm-menu_selected-hover .mm-listitem__btn:hover { - background: var(--mm-color-background-emphasis); } - + background: var(--mm-color-background-emphasis); +} .mm-menu_selected-parent .mm-panel_opened-parent .mm-listitem:not(.mm-listitem_selected-parent) > .mm-listitem__text { - background: none; } - + background: none; +} .mm-menu_selected-parent .mm-listitem_selected-parent > .mm-listitem__text, .mm-menu_selected-parent .mm-listitem_selected-parent > .mm-listitem__btn { - background: var(--mm-color-background-emphasis); } + background: var(--mm-color-background-emphasis); +} .mm-menu_border-none .mm-listitem:after { - content: none; } + content: none; +} .mm-menu_border-full .mm-listitem:after { - left: 0 !important; } + left: 0 !important; +} .mm-menu_fx-menu-slide { - transition: transform 0.4s ease; } + transition: transform 0.4s ease; +} .mm-wrapper_opened .mm-menu_fx-menu-slide { - transform: translate3d(-30%, 0, 0); } + transform: translate3d(-30%, 0, 0); +} .mm-wrapper_opening .mm-menu_fx-menu-slide { - transform: translate3d(0%, 0, 0); } + transform: translate3d(0%, 0, 0); +} .mm-wrapper_opened .mm-menu_fx-menu-slide.mm-menu_position-right { - transform: translate3d(30%, 0, 0); } + transform: translate3d(30%, 0, 0); +} .mm-wrapper_opening .mm-menu_fx-menu-slide.mm-menu_position-right { - transform: translate3d(0%, 0, 0); } + transform: translate3d(0%, 0, 0); +} .mm-menu_fx-panels-none .mm-panel, .mm-panel_fx-none { - transition-property: none; } - .mm-menu_fx-panels-none .mm-panel.mm-panel_opened-parent, - .mm-panel_fx-none.mm-panel_opened-parent { - transform: translate3d(0, 0, 0); } + transition-property: none; +} +.mm-menu_fx-panels-none .mm-panel.mm-panel_opened-parent, +.mm-panel_fx-none.mm-panel_opened-parent { + transform: translate3d(0, 0, 0); +} .mm-menu_fx-panels-slide-0 .mm-panel_opened-parent { - transform: translate3d(0, 0, 0); } + transform: translate3d(0, 0, 0); +} .mm-menu_fx-panels-slide-100 .mm-panel_opened-parent { - transform: translate3d(-100%, 0, 0); } + transform: translate3d(-100%, 0, 0); +} .mm-menu_multiline .mm-listitem__text { text-overflow: clip; - white-space: normal; } + white-space: normal; +} .mm-menu_popup { transition: opacity 0.4s ease; @@ -34316,146 +35188,193 @@ IMPORT MMENU SCSS bottom: auto; right: auto; z-index: 2; - transform: translate3d(-50%, -50%, 0); } - .mm-menu_popup.mm-menu_opened ~ .mm-slideout { - transform: none !important; - z-index: 0; } - .mm-menu_popup.mm-menu_opened ~ .mm-wrapper__blocker { - transition-delay: 0s !important; - z-index: 1; } - .mm-wrapper_opening .mm-menu_popup { - opacity: 1; } + transform: translate3d(-50%, -50%, 0); +} +.mm-menu_popup.mm-menu_opened ~ .mm-slideout { + transform: none !important; + z-index: 0; +} +.mm-menu_popup.mm-menu_opened ~ .mm-wrapper__blocker { + transition-delay: 0s !important; + z-index: 1; +} +.mm-wrapper_opening .mm-menu_popup { + opacity: 1; +} .mm-menu_position-right { left: auto; - right: 0; } + right: 0; +} .mm-wrapper_opening .mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-80vw, 0, 0); } + transform: translate3d(-80vw, 0, 0); +} @media all and (max-width: 300px) { .mm-wrapper_opening .mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-240px, 0, 0); } } - + transform: translate3d(-240px, 0, 0); + } +} @media all and (min-width: 550px) { .mm-wrapper_opening .mm-menu_position-right.mm-menu_opened ~ .mm-slideout { - transform: translate3d(-440px, 0, 0); } } - + transform: translate3d(-440px, 0, 0); + } +} .mm-menu_position-front, .mm-menu_position-top, .mm-menu_position-bottom { - transition: transform 0.4s ease; } - .mm-menu_position-front.mm-menu_opened, .mm-menu_position-top.mm-menu_opened, .mm-menu_position-bottom.mm-menu_opened { - z-index: 2; } - .mm-menu_position-front.mm-menu_opened ~ .mm-slideout, .mm-menu_position-top.mm-menu_opened ~ .mm-slideout, .mm-menu_position-bottom.mm-menu_opened ~ .mm-slideout { - transform: none !important; - z-index: 0; } - .mm-menu_position-front.mm-menu_opened ~ .mm-wrapper__blocker, .mm-menu_position-top.mm-menu_opened ~ .mm-wrapper__blocker, .mm-menu_position-bottom.mm-menu_opened ~ .mm-wrapper__blocker { - z-index: 1; } + transition: transform 0.4s ease; +} +.mm-menu_position-front.mm-menu_opened, .mm-menu_position-top.mm-menu_opened, .mm-menu_position-bottom.mm-menu_opened { + z-index: 2; +} +.mm-menu_position-front.mm-menu_opened ~ .mm-slideout, .mm-menu_position-top.mm-menu_opened ~ .mm-slideout, .mm-menu_position-bottom.mm-menu_opened ~ .mm-slideout { + transform: none !important; + z-index: 0; +} +.mm-menu_position-front.mm-menu_opened ~ .mm-wrapper__blocker, .mm-menu_position-top.mm-menu_opened ~ .mm-wrapper__blocker, .mm-menu_position-bottom.mm-menu_opened ~ .mm-wrapper__blocker { + z-index: 1; +} .mm-menu_position-front { - transform: translate3d(-100%, 0, 0); } - .mm-menu_position-front.mm-menu_position-right { - transform: translate3d(100%, 0, 0); } + transform: translate3d(-100%, 0, 0); +} +.mm-menu_position-front.mm-menu_position-right { + transform: translate3d(100%, 0, 0); +} .mm-menu_position-top, .mm-menu_position-bottom { width: 100%; min-width: 100%; - max-width: 100%; } + max-width: 100%; +} .mm-menu_position-top { - transform: translate3d(0, -100%, 0); } + transform: translate3d(0, -100%, 0); +} .mm-menu_position-top { height: 80vh; min-height: 140px; - max-height: 880px; } + max-height: 880px; +} .mm-menu_position-bottom { transform: translate3d(0, 100%, 0); - top: auto; } + top: auto; +} .mm-menu_position-bottom { height: 80vh; min-height: 140px; - max-height: 880px; } + max-height: 880px; +} .mm-wrapper_opening .mm-menu_position-front, .mm-wrapper_opening .mm-menu_position-top, .mm-wrapper_opening .mm-menu_position-bottom { - transform: translate3d(0, 0, 0); } + transform: translate3d(0, 0, 0); +} body.modal-open .mm-slideout { - z-index: unset; } + z-index: unset; +} /*********************************************** ADJUST MMENU AND JQUERY-BOOTSTRAP ELEMENTS ***********************************************/ .mm-menu .mm-listitem__text { padding-left: 0.375rem; - padding-right: 0.375rem; } - + padding-right: 0.375rem; +} .mm-menu-sm .mm-listitem__text { padding-left: 0.25rem; - padding-right: 0.25rem; } + padding-right: 0.25rem; +} .mm-menu .mm-listitem__btn { padding-left: 0.375rem; - padding-right: calc(2.8 * var(--chevrolet-dim)); } - + padding-right: calc(2.8 * var(--chevrolet-dim)); +} .mm-menu-sm .mm-listitem__btn { - padding-left: 0.25rem; } + padding-left: 0.25rem; +} .mm-menu .mm-listitem:after { - left: 0.375rem; } - + left: 0.375rem; +} .mm-menu-sm .mm-listitem:after { - left: 0.25rem; } + left: 0.25rem; +} .mm-listitem_vertical > .mm-panel { - padding: 0 0 0 5px !important; } + padding: 0 0 0 5px !important; +} .mm-menu .mm-listitem_opened > .mm-listitem__btn { color: var(--mm-item-opened-color); - background: var(--mm-item-opened-bg); } - + background: var(--mm-item-opened-bg); +} .mm-menu .mm-listitem:not(.mm-listitem_opened) > .mm-listitem__btn { color: var(--mm-item-closed-color); - background: var(--mm-item-closed-bg); } + background: var(--mm-item-closed-bg); +} .mm-listitem { font-size: var(--mm-font-size); - min-height: var(--mm-line-height); } - .mm-listitem .mm-listitem-content { - line-height: 1.5 !important; } + min-height: var(--mm-line-height); +} +.mm-listitem .mm-listitem-content { + line-height: 1.5 !important; +} .mm-btn_prev:before, .mm-btn_next:after { width: var(--chevrolet-dim) !important; height: var(--chevrolet-dim) !important; - right: var(--chevrolet-dim) !important; } + right: var(--chevrolet-dim) !important; +} .mm-iconbar .btn.standard.square { + display: inline-flex; margin-left: auto; margin-right: auto; - margin-bottom: calc( (var(--mm-listitem-size) - var(--bs-btn-square-dimention)) / 2); } + margin-bottom: calc((var(--mm-listitem-size) - var(--bs-btn-square-dimention)) / 2); +} .mm-listitem__text { display: flex; - flex-wrap: wrap; } - .mm-listitem__text > *:first-child { - flex: 1; } + flex-wrap: wrap; +} +.mm-listitem__text > *:first-child { + flex: 1; +} a.btn.mm-favorite-icons { - height: var(--mm-line-height); } + height: var(--mm-line-height); +} .button-bar-container { padding: 0; - margin: 0; } - .button-bar-container:last-child { - margin-bottom: 2px; } - .button-bar-container.padding-left { - padding-left: 1.5em; } - .button-bar-container.padding-right { - padding-right: 2.375rem; } - .mm-menu-sm .button-bar-container.padding-right { - padding-right: 1.9375rem; } - + margin: 0; +} +.button-bar-container:last-child { + margin-bottom: 2px; +} +.button-bar-container.padding-left { + padding-left: 1.5em; +} +.button-bar-container.padding-right { + padding-right: 2.375rem; +} +.mm-menu-sm .button-bar-container.padding-right { + padding-right: 1.9375rem; +} + +.mm-listitem.only-buttons { + --mm-line-height: 0; + padding-top: 2px; +} +.mm-listitem.only-buttons.no-padding-right .mm-listitem__text { + padding-right: 0; +} +@charset "UTF-8"; /*********************************************** fcoo-application.scss, @@ -34466,7 +35385,6 @@ a.btn.mm-favorite-icons { ************************************************/ -@use "sass:color"; /************************************************************ INCLUDE-JQUERY-BOOTSTRAP-VARIABLES USED IN FOR OTHER PACKAGES TO INCLUDE ALL SCSS-FILES NEEDED @@ -34623,7 +35541,8 @@ jquery-scroll-container-variables.scss :root { --jsc-scroll-size: 10px; --jsc-scroll-padding: 10px; - --jsc-scroll-auto-padding: 10px; } + --jsc-scroll-auto-padding: 10px; +} /************************************************************ VARIABLES @@ -34642,7 +35561,7 @@ Modal ************************************************/ /*********************************************** Button And Modal -Opacity for semi-transparent and transparent content +Opacity for semi-transparent and transparent content using color-mix ************************************************/ /************************************************************ MIXIN @@ -34662,6 +35581,65 @@ button-border-color-variant button-background-color-variant Adjust text-, border-, and background-color for a button ************************************************************/ +/********************************************************** + fcoo-colors-include.scss, + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO + + + Contain all include for a packages using + the scss-variables and scss-mixins of fcoo-colors + + The scss file must also include + + //COLOR-HELPER + @import "../bower_components/sass-color-helpers/stylesheets/color-helpers"; + + //LEAFLET-BOOTSTRAP-MARKER-MIXIN - mixin to create colors for marker (bsMarker) + @import "../bower_components/leaflet-bootstrap-marker-mixin/dist/leaflet-bootstrap-marker-mixin"; + + //LEAFLET-POLYLINE-MIXIN - mixin to create colors for polyline and polygon + @import "../bower_components/leaflet-polyline-mixin/dist/leaflet-polyline-mixin"; + +**********************************************************/ +/********************************************************** + fcoo-colors-variables.scss, + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO +**********************************************************/ +/********************************************************** +The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf +**********************************************************/ +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +in src/_fcoo-color-mixin.scss +**********************************************************/ +/********************************************************** + fcoo-colors-mixin.scss + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO + +**********************************************************/ +/********************************************************** +Functions to get colors in different (relative) gradients +**********************************************************/ +/********************************************************** +marker-and-polygon-color +create color-classes for bsMarker and bsPolyline +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +**********************************************************/ /***************************************************** APPLICATION-COLOR-MIXIN Mixin for creating specific application-color @@ -34685,99 +35663,156 @@ APPLICATION-COLOR Defines default application-color and adjust different jquery-bootstrap and fcoo-application element-styles -See _application-color-mixin.scss for description of application colors +A number of css-variable are defined. +The are all named +--fcoo-app-TYPE-color[-PERCENT] +and have the value +var(--_fcoo-app-TYPE-color-PERCENT, var(--_fcoo-default-app-TYPE-color-PERCENT) ); (Note the "_" at the beginning of the var-names) + +All the default values --_fcoo-default-app... are defined using DALO standard dark-green + +To change the default colors the css-variables --_fcoo-app-TYPE-color-PERCENT must be assigned a value +This can be done in two ways: +1: In scss by including src/_application-color-mixin.scss in the applications scss-file and adding @include application-color( NEW_APPLICATION_COLOR ); +2: Dynamically via javascript by calling window.fcoo.setApplicationColors( NEW_APPLICATION_COLOR ); (see src/fcoo-application-color.js) *****************************************************/ :root { --_fcoo-default-app-bg-color-0: #3f5b58; + --_fcoo-default-app-hover-bg-color-0: #5c7471; + --_fcoo-default-app-active-bg-color-0: #657c79; --_fcoo-default-app-text-color-0: #fff; + --_fcoo-default-app-hover-text-color-0: white; + --_fcoo-default-app-active-text-color-0: white; --_fcoo-default-app-shadow-color-0: #000; --_fcoo-default-app-bg-color-25: #78a29d; + --_fcoo-default-app-hover-bg-color-25: #8cb0ac; + --_fcoo-default-app-active-bg-color-25: #93b5b1; --_fcoo-default-app-text-color-25: #000; - --_fcoo-default-app-shadow-color-25: #fff; + --_fcoo-default-app-hover-text-color-25: #1a1a1a; + --_fcoo-default-app-active-text-color-25: #1a1a1a; --_fcoo-default-app-bg-color-50: #c3d6d4; + --_fcoo-default-app-hover-bg-color-50: #ccdcda; + --_fcoo-default-app-active-bg-color-50: #cfdedd; --_fcoo-default-app-text-color-50: #000; - --_fcoo-default-app-shadow-color-50: #fff; + --_fcoo-default-app-hover-text-color-50: #1a1a1a; + --_fcoo-default-app-active-text-color-50: #1a1a1a; --_fcoo-default-app-bg-color-63: #eaf1f0; + --_fcoo-default-app-hover-bg-color-63: #edf3f2; + --_fcoo-default-app-active-bg-color-63: #eef4f3; --_fcoo-default-app-text-color-63: #000; - --_fcoo-default-app-shadow-color-63: #fff; } - -.btn-fcoo-app-color .btn-jb.standard { - --bs-btn-color: #fff; - --bs-btn-hover-color: white; - --bs-btn-active-color: white; - --bs-btn-disabled-color: #fff; - --bs-btn-border-color: #fff; - --bs-btn-hover-border-color: white; - --bs-btn-active-border-color: white; - --bs-btn-bg: #3f5b58; - --bs-btn-hover-bg: #5c7471; - --bs-btn-active-bg: #657c79; } - -.btn-fcoo-app-color-25 .btn-jb.standard { - --bs-btn-color: #000; - --bs-btn-hover-color: #1a1a1a; - --bs-btn-active-color: #1a1a1a; - --bs-btn-disabled-color: #000; - --bs-btn-border-color: #000; - --bs-btn-hover-border-color: #1a1a1a; - --bs-btn-active-border-color: #1a1a1a; - --bs-btn-bg: #78a29d; - --bs-btn-hover-bg: #8cb0ac; - --bs-btn-active-bg: #93b4b1; } - -.btn-fcoo-app-color-50 .btn-jb.standard { - --bs-btn-color: #000; - --bs-btn-hover-color: #1a1a1a; - --bs-btn-active-color: #1a1a1a; - --bs-btn-disabled-color: #000; - --bs-btn-border-color: #000; - --bs-btn-hover-border-color: #1a1a1a; - --bs-btn-active-border-color: #1a1a1a; - --bs-btn-bg: #c3d6d4; - --bs-btn-hover-bg: #ccdcda; - --bs-btn-active-bg: #cfdedc; } - -[class*="btn-fcoo-app-color"] .btn-jb.standard { - --bs-btn-disabled-color: var(--bs-btn-color); - --bs-btn-disabled-bg: var(--bs-btn-bg); - --bs-btn-disabled-border-color: var(--bs-btn-border-color); - --bs-btn-disabled-opacity: 0.4; } + --_fcoo-default-app-hover-text-color-63: #1a1a1a; + --_fcoo-default-app-active-text-color-63: #1a1a1a; +} :root { --fcoo-app-bg-color: var(--_fcoo-app-bg-color-0, var(--_fcoo-default-app-bg-color-0)); + --fcoo-app-hover-bg-color: var(--_fcoo-app-hover-bg-color-0, var(--_fcoo-default-app-hover-bg-color-0)); + --fcoo-app-active-bg-color: var(--_fcoo-app-active-bg-color-0, var(--_fcoo-default-app-active-bg-color-0)); --fcoo-app-text-color: var(--_fcoo-app-text-color-0, var(--_fcoo-default-app-text-color-0)); + --fcoo-app-hover-text-color: var(--_fcoo-app-hover-text-color-0, var(--_fcoo-default-app-hover-text-color-0)); + --fcoo-app-active-text-color: var(--_fcoo-app-active-text-color-0, var(--_fcoo-default-app-active-text-color-0)); --fcoo-app-shadow-color: var(--_fcoo-app-shadow-color-0, var(--_fcoo-default-app-shadow-color-0)); - --fcoo-default-app-bg-color: var(--_fcoo-default-app-bg-color-0); - --fcoo-default-app-text-color: var(--_fcoo-default-app-text-color-0); - --fcoo-default-app-shadow-color: var(--_fcoo-default-app-shadow-color-0); --fcoo-app-bg-color-25: var(--_fcoo-app-bg-color-25, var(--_fcoo-default-app-bg-color-25)); + --fcoo-app-hover-bg-color-25: var(--_fcoo-app-hover-bg-color-25, var(--_fcoo-default-app-hover-bg-color-25)); + --fcoo-app-active-bg-color-25: var(--_fcoo-app-active-bg-color-25, var(--_fcoo-default-app-active-bg-color-25)); --fcoo-app-text-color-25: var(--_fcoo-app-text-color-25, var(--_fcoo-default-app-text-color-25)); + --fcoo-app-hover-text-color-25: var(--_fcoo-app-hover-text-color-25, var(--_fcoo-default-app-hover-text-color-25)); + --fcoo-app-active-text-color-25: var(--_fcoo-app-active-text-color-25, var(--_fcoo-default-app-active-text-color-25)); --fcoo-app-bg-color-50: var(--_fcoo-app-bg-color-50, var(--_fcoo-default-app-bg-color-50)); + --fcoo-app-hover-bg-color-50: var(--_fcoo-app-hover-bg-color-50, var(--_fcoo-default-app-hover-bg-color-50)); + --fcoo-app-active-bg-color-50: var(--_fcoo-app-active-bg-color-50, var(--_fcoo-default-app-active-bg-color-50)); --fcoo-app-text-color-50: var(--_fcoo-app-text-color-50, var(--_fcoo-default-app-text-color-50)); + --fcoo-app-hover-text-color-50: var(--_fcoo-app-hover-text-color-50, var(--_fcoo-default-app-hover-text-color-50)); + --fcoo-app-active-text-color-50: var(--_fcoo-app-active-text-color-50, var(--_fcoo-default-app-active-text-color-50)); --fcoo-app-bg-color-63: var(--_fcoo-app-bg-color-63, var(--_fcoo-default-app-bg-color-63)); - --fcoo-app-text-color-63: var(--_fcoo-app-text-color-63, var(--_fcoo-default-app-text-color-63)); } + --fcoo-app-hover-bg-color-63: var(--_fcoo-app-hover-bg-color-63, var(--_fcoo-default-app-hover-bg-color-63)); + --fcoo-app-active-bg-color-63: var(--_fcoo-app-active-bg-color-63, var(--_fcoo-default-app-active-bg-color-63)); + --fcoo-app-text-color-63: var(--_fcoo-app-text-color-63, var(--_fcoo-default-app-text-color-63)); + --fcoo-app-hover-text-color-63: var(--_fcoo-app-hover-text-color-63, var(--_fcoo-default-app-hover-text-color-63)); + --fcoo-app-active-text-color-63: var(--_fcoo-app-active-text-color-63, var(--_fcoo-default-app-active-text-color-63)); +} -.fcoo-default-app-colors { - color: var(--fcoo-default-app-text-color) !important; - background-color: var(--fcoo-default-app-bg-color) !important; } +.fcoo-app-bg-color { + background-color: var(--fcoo-app-bg-color) !important; +} .fcoo-app-text-color { - color: var(--fcoo-app-text-color) !important; } + color: var(--fcoo-app-text-color) !important; +} -.fcoo-app-bg-color { - background-color: var(--fcoo-app-bg-color) !important; } +.fcoo-app-bg-color-25 { + background-color: var(--fcoo-app-bg-color-25) !important; +} .fcoo-app-text-color-25 { - color: var(--fcoo-app-text-color-25) !important; } + color: var(--fcoo-app-text-color-25) !important; +} -.fcoo-app-bg-color-25 { - background-color: var(--fcoo-app-bg-color-25) !important; } +.fcoo-app-bg-color-50 { + background-color: var(--fcoo-app-bg-color-50) !important; +} .fcoo-app-text-color-50 { - color: var(--fcoo-app-text-color-50) !important; } + color: var(--fcoo-app-text-color-50) !important; +} -.fcoo-app-bg-color-50 { - background-color: var(--fcoo-app-bg-color-50) !important; } +.fcoo-app-bg-color-63 { + background-color: var(--fcoo-app-bg-color-63) !important; +} + +.fcoo-app-text-color-63 { + color: var(--fcoo-app-text-color-63) !important; +} + +/***************************************************** +Create css-var for buttons when inside a container with fcoo-application +Text and border color are the same +*****************************************************/ +.btn-fcoo-app-color .btn-jb.standard { + --bs-btn-bg: var(--fcoo-app-bg-color); + --bs-btn-hover-bg: var(--fcoo-app-hover-bg-color); + --bs-btn-active-bg: var(--fcoo-app-active-bg-color); + --bs-btn-color: var(--fcoo-app-text-color); + --bs-btn-hover-color: var(--fcoo-app-hover-text-color); + --bs-btn-active-color: var(--fcoo-app-active-text-color); + --bs-btn-disabled-color: var(--fcoo-app-text-color); + --bs-btn-border-color: var(--fcoo-app-text-color); + --bs-btn-hover-border-color: var(--fcoo-app-hover-text-color); + --bs-btn-active-border-color: var(--fcoo-app-active-text-color); +} + +.btn-fcoo-app-color-25 .btn-jb.standard { + --bs-btn-bg: var(--fcoo-app-bg-color-25); + --bs-btn-hover-bg: var(--fcoo-app-hover-bg-color-25); + --bs-btn-active-bg: var(--fcoo-app-active-bg-color-25); + --bs-btn-color: var(--fcoo-app-text-color-25); + --bs-btn-hover-color: var(--fcoo-app-hover-text-color-25); + --bs-btn-active-color: var(--fcoo-app-active-text-color-25); + --bs-btn-disabled-color: var(--fcoo-app-text-color-25); + --bs-btn-border-color: var(--fcoo-app-text-color-25); + --bs-btn-hover-border-color: var(--fcoo-app-hover-text-color-25); + --bs-btn-active-border-color: var(--fcoo-app-active-text-color-25); +} + +.btn-fcoo-app-color-50 .btn-jb.standard { + --bs-btn-bg: var(--fcoo-app-bg-color-50); + --bs-btn-hover-bg: var(--fcoo-app-hover-bg-color-50); + --bs-btn-active-bg: var(--fcoo-app-active-bg-color-50); + --bs-btn-color: var(--fcoo-app-text-color-50); + --bs-btn-hover-color: var(--fcoo-app-hover-text-color-50); + --bs-btn-active-color: var(--fcoo-app-active-text-color-50); + --bs-btn-disabled-color: var(--fcoo-app-text-color-50); + --bs-btn-border-color: var(--fcoo-app-text-color-50); + --bs-btn-hover-border-color: var(--fcoo-app-hover-text-color-50); + --bs-btn-active-border-color: var(--fcoo-app-active-text-color-50); +} + +[class*=btn-fcoo-app-color] .btn-jb.standard { + --bs-btn-disabled-color: var(--bs-btn-color); + --bs-btn-disabled-bg: var(--bs-btn-bg); + --bs-btn-disabled-border-color: var(--bs-btn-border-color); + --bs-btn-disabled-opacity: 0.4; +} /***************************************************** Adjust different parts in jquery-bootstrap and fcoo-application @@ -34786,28 +35821,37 @@ Adjust different parts in jquery-bootstrap and fcoo-application --jb-header-color: var(--fcoo-app-text-color-25); --jb-header-bg: var(--fcoo-app-bg-color-25); --jb-inner-header-color: var(--fcoo-app-text-color-50); - --jb-inner-header-bg: var(--fcoo-app-bg-color-50); } + --jb-inner-header-bg: var(--fcoo-app-bg-color-50); +} .accordion { --bs-accordion-btn-color: var(--fcoo-app-text-color-63); --bs-accordion-btn-bg: var(--fcoo-app-bg-color-63); --bs-accordion-active-color: var(--fcoo-app-text-color-50); - --bs-accordion-active-bg: var(--fcoo-app-bg-color-50); } + --bs-accordion-active-bg: var(--fcoo-app-bg-color-50); +} .mm-menu { --mm-item-closed-color: var(--fcoo-app-text-color-63); --mm-item-closed-bg: var(--fcoo-app-bg-color-63); --mm-item-opened-color: var(--fcoo-app-text-color-50); - --mm-item-opened-bg: var(--fcoo-app-bg-color-50); } + --mm-item-opened-bg: var(--fcoo-app-bg-color-50); +} +/********** DEMO ****************** +@include application-color(darkred); +//*********************************/ .hide { - display: none !important; } + display: none !important; +} .invisible { - visibility: hidden; } + visibility: hidden; +} .bold { - font-weight: bold; } + font-weight: bold; +} /***************************************************** Global variables @@ -34821,15 +35865,18 @@ WARIABLES Global scss-variables for fcoo-application *****************************************************/ :root { - --fcoo-app-menu-padding: 0.375rem; } + --fcoo-app-menu-padding: 0.375rem; +} .mm-menu { --mm-iconbar-button-dim: 2.375rem; - --mm-iconbar-size: calc( 2 * var(--fcoo-app-menu-padding) + var(--mm-iconbar-button-dim) ); } + --mm-iconbar-size: calc( 2 * var(--fcoo-app-menu-padding) + var(--mm-iconbar-button-dim) ); +} .touch-menu-container-sm, top-menu-container-sm, .mm-menu-sm { --mm-iconbar-button-dim: 1.9375rem; - --fcoo-app-menu-padding: 0.25rem; } + --fcoo-app-menu-padding: 0.25rem; +} /* z-index for different layers: @@ -34837,159 +35884,6 @@ z-index for different layers: $z-index-top-N: Level N below the top-layer */ -/***************************************************** -Style for FCOO logo as font -*****************************************************/ -/***************************************************** -FCOO-LOGO - -Style for FCOO logo as font - -icon-fcoo-logo-default = Default FCOO logo (white) -icon-fcoo-logo-contrast = Logo in contrast color to application color ($fcoo-app-bg-color) = white or black -icon-fcoo-logo-app-color = Logo in the application color - -See src/_application-color.scss for description of application colors -*****************************************************/ -@font-face { - font-family: 'fcoo-logo'; - src: url("fonts/fcoo-logo.woff?ma2cie") format("woff"); - font-weight: normal; - font-style: normal; } - -.icon-fcoo-logo-default, .icon-fcoo-logo-contrast, .icon-fcoo-logo-app-color { - /* use !important to prevent issues with browser extensions that change fonts */ - font-family: 'fcoo-logo' !important; - speak: none; - font-style: normal; - font-weight: normal; - font-variant: normal; - text-transform: none; - line-height: 1; - /* Better Font Rendering =========== */ - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - color: var(--fcoo-logo-color); } - .icon-fcoo-logo-default:before, .icon-fcoo-logo-contrast:before, .icon-fcoo-logo-app-color:before { - content: "\e900"; } - -.icon-fcoo-logo-default { - --fcoo-logo-color: white; } - -.icon-fcoo-logo-contrast { - --fcoo-logo-color: $fcoo-app-text-color; } - -.icon-fcoo-logo-app-color { - --fcoo-logo-color: $fcoo-app-bg-color; } - -/********************************************************** -fcoo-name = the font used for the FCOO name in the logo - TODO -**********************************************************/ -@font-face { - font-family: 'fcoo-name'; - src: url("fonts/svenings.woff") format("woff"); - font-weight: normal; - font-style: normal; - font-variant: normal; - text-transform: none; - speak: none; - line-height: 1; } - -.fcoo-name { - font-family: fcoo-name; } - -/***************************************************** -Style for the
covering the page during loading -*****************************************************/ -/***************************************************** -LOADING -Style for the
covering the page during loading -*****************************************************/ -html.loading .hide-for-loading { - display: none !important; } - -html.no-loading .show-for-loading { - display: none !important; } - -/* Not used -@keyframes flashingLogo { - 0% {opacity: 1; } - 50% {opacity: .5;} - 100% {opacity: 1; } -} -*/ -/* Blinking dots from https://martinwolf.org/before-2018/blog/2015/01/pure-css-savingloading-dots-animation/ */ -@keyframes blink { - 0% { - opacity: .2; } - 20% { - opacity: 1; } - 100% { - opacity: .2; } } - -div.loading { - position: absolute; - left: 0; - top: 0; - z-index: 2147483645; - text-align: center; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; - opacity: 1; - cursor: progress; } - div.loading > div { - position: absolute; - width: 100%; - margin: 0; - padding: 0; - cursor: inherit; - text-align: center; } - div.loading > div.version { - font-family: sans-serif; - font-size: 2rem; - top: 0; - height: 3rem; - margin-bottom: -3rem; - background-color: red; - color: white; } - div.loading > div.version:empty { - visibility: hidden; } - div.loading > div.logo { - height: 100%; - display: flex; - align-items: center; - justify-content: center; } - div.loading > div.logo i[class^="icon-fcoo-logo"] { - font-size: 90vmin; } - div.loading > div.dots { - height: 1em; - bottom: 0; - display: flex; - align-items: end; - justify-content: center; - font-size: 6rem; } - div.loading > div.dots span { - animation-name: blink; - animation-duration: 1.4s; - animation-iteration-count: infinite; - animation-fill-mode: both; - width: .25em; } - div.loading > div.dots span:nth-child(2) { - animation-delay: .2s; } - div.loading > div.dots span:nth-child(3) { - animation-delay: .4s; } - html.no-loading div.loading { - width: 0; - height: 0; - opacity: 0; - transition: opacity 0.4s ease-out 0s, width 0s ease-in-out 0.4s, height 0s ease-in-out 0.4s; } - html.no-loading div.loading:before, html.no-loading div.loading > div { - display: none !important; } - /***************************************************** Style for offline.js *****************************************************/ @@ -34997,13 +35891,16 @@ Style for offline.js OFFLINE-JS *****************************************************/ .offline-ui { - display: none !important; } + display: none !important; +} html.connected .hide-for-connected { - display: none !important; } + display: none !important; +} html.no-connected .show-for-connected { - display: none !important; } + display: none !important; +} .no-connected-shadow { position: absolute; @@ -35012,14 +35909,17 @@ html.no-connected .show-for-connected { right: 0; bottom: 0; z-index: 2147483646; - box-shadow: inset 0px 0px 10px 5px red; + box-shadow: inset 0px 0px 10px 5px rgb(255, 0, 0); pointer-events: none; - opacity: 0; } - .no-connected .no-connected-shadow { - opacity: 1; } + opacity: 0; +} +.no-connected .no-connected-shadow { + opacity: 1; +} .noty-on-top { - z-index: 2147483647; } + z-index: 2147483647; +} /***************************************************** Style for html, body and main structure @@ -35036,20 +35936,23 @@ devices and to fix the size and prevent any scrolling in body html, body { height: 100%; width: 100%; - overflow: hidden; } + overflow: hidden; +} body { padding: 0; margin: 0; width: -webkit-calc(100% - 0px); height: -webkit-calc(100% - 0px); - position: fixed; } - body .outer-container, body .main-container { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; } + position: fixed; +} +body .outer-container, body .main-container { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; +} /***************************************************** Style for top menu @@ -35070,187 +35973,254 @@ confussions another name is used left: 0; z-index: 1030; opacity: 1; - transition: opacity .15s ease-in-out; - cursor: default; } - + transition: opacity 0.15s ease-in-out; + cursor: default; +} .top-menu-container .top-menu { margin-top: 0px; padding: var(--fcoo-app-menu-padding); - font-size: 0.875rem; } - .top-menu-container .top-menu .top-menu-header { - text-shadow: -1px 0 var(--fcoo-app-shadow-color), 0 1px var(--fcoo-app-shadow-color), 1px 0 var(--fcoo-app-shadow-color), 0 -1px var(--fcoo-app-shadow-color); } - .touchevents .top-menu-container .top-menu { - font-size: 1rem; } - .top-menu-container .top-menu .top-menu-element-hide { - display: none; } - .top-menu-container .top-menu > .top-menu-item { - flex-shrink: 0; - flex-grow: 0; } - .top-menu-container .top-menu > .top-menu-item:not(:first-child) { - margin-left: var(--fcoo-app-menu-padding) !important; } - .top-menu-container .top-menu .left-side { - margin-right: auto !important; } - .top-menu-container .top-menu .right-side { - margin-left: auto !important; } - .top-menu-container .top-menu .icon-fcoo-logo-contrast { - padding: 0; - margin: 0; - line-height: .5; - cursor: pointer; - font-size: 4em; - text-decoration-line: none; - text-shadow: -1px 0 var(--fcoo-app-shadow-color), 0 1px var(--fcoo-app-shadow-color), 1px 0 var(--fcoo-app-shadow-color), 0 -1px var(--fcoo-app-shadow-color); - --bs-btn-border-width: 0px; } - .top-menu-container .top-menu .top-menu-header { - flex-shrink: 1; - flex-grow: 1; - text-align: center; - font-family: "Verdana"; - font-size: 1.5em; - line-height: 1.5; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; } - .top-menu-container .top-menu .top-menu-header.top-menu-element-hide { - display: block; - visibility: hidden; } - .top-menu-container .top-menu .form-inline .form-control { - padding: 0.25rem 0.25rem; - border-bottom-right-radius: 0; - border-top-right-radius: 0; - border-right: none; - width: 6rem; } - .small-up .top-menu-container .top-menu .form-inline .form-control { - width: 10rem; } - .top-menu-container .top-menu .form-inline .form-control.top-menu-element-show + .btn { - border-left: none; - border-bottom-left-radius: 0; - border-top-left-radius: 0; } - -a.all-read .hide-for-all-read, -a.no-all-read .show-for-all-read { - opacity: 0 !important; } - -/***************************************************** -TOP-MENU-BTN-SHAKE - -Style for shaking icon in buttons in top menu -*****************************************************/ -/***************************************************** -Created with csshake and modified to have interval between -animations and to apply to button even when no-hover - -*****************************************************/ + font-size: 0.875rem; +} +.top-menu-container .top-menu .top-menu-header { + text-shadow: -1px 0 var(--fcoo-app-shadow-color), 0 1px var(--fcoo-app-shadow-color), 1px 0 var(--fcoo-app-shadow-color), 0 -1px var(--fcoo-app-shadow-color); +} +.touchevents .top-menu-container .top-menu { + font-size: 1rem; +} +.top-menu-container .top-menu .top-menu-element-hide { + display: none; +} +.top-menu-container .top-menu > .top-menu-item { + flex-shrink: 0; + flex-grow: 0; +} +.top-menu-container .top-menu > .top-menu-item:not(:first-child) { + margin-left: var(--fcoo-app-menu-padding) !important; +} +.top-menu-container .top-menu .left-side { + margin-right: auto !important; +} +.top-menu-container .top-menu .right-side { + margin-left: auto !important; +} +.top-menu-container .top-menu .icon-fcoo-logo-contrast { + padding: 0; + margin: 0; + line-height: 0.5; + cursor: pointer; + font-size: 4em; + text-decoration-line: none; + text-shadow: -1px 0 var(--fcoo-app-shadow-color), 0 1px var(--fcoo-app-shadow-color), 1px 0 var(--fcoo-app-shadow-color), 0 -1px var(--fcoo-app-shadow-color); + --bs-btn-border-width: 0px; +} +.top-menu-container .top-menu .top-menu-header { + flex-shrink: 1; + flex-grow: 1; + text-align: center; + font-family: var(--fmn-font-family); + font-size: 1.5em; + line-height: 1.5; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.top-menu-container .top-menu .top-menu-header.top-menu-element-hide { + display: block; + visibility: hidden; +} +.top-menu-container .top-menu .form-inline .form-control { + padding: 0.25rem 0.25rem; + border-bottom-right-radius: 0; + border-top-right-radius: 0; + border-right: none; + width: 6rem; +} +.small-up .top-menu-container .top-menu .form-inline .form-control { + width: 10rem; +} +.top-menu-container .top-menu .form-inline .form-control.top-menu-element-show + .btn { + border-left: none; + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} + +a.all-read .hide-for-all-read, +a.no-all-read .show-for-all-read { + opacity: 0 !important; +} + +/***************************************************** +TOP-MENU-BTN-SHAKE + +Style for shaking icon in buttons in top menu +*****************************************************/ +/***************************************************** +Created with csshake and modified to have interval between +animations and to apply to button even when no-hover + +*****************************************************/ .top-menu .btn.shake-constant i.far, .top-menu .btn.shake-constant i.fas { animation-name: shake-little; animation-duration: 10000ms; animation-timing-function: ease-in-out; - animation-iteration-count: infinite; } + animation-iteration-count: infinite; +} @keyframes shake-little { .2% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } .4% { - transform: translate(0px, 0px) rotate(0.5deg); } + transform: translate(0px, 0px) rotate(0.5deg); + } .6% { - transform: translate(0px, 0px) rotate(0.5deg); } + transform: translate(0px, 0px) rotate(0.5deg); + } .8% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 1.0% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 1.2% { - transform: translate(0px, 0px) rotate(0.5deg); } + transform: translate(0px, 0px) rotate(0.5deg); + } 1.4% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 1.6% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 1.8% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 2.0% { - transform: translate(0px, 0px) rotate(0.5deg); } + transform: translate(0px, 0px) rotate(0.5deg); + } 2.2% { - transform: translate(0px, 0px) rotate(0.5deg); } + transform: translate(0px, 0px) rotate(0.5deg); + } 2.4% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 2.6% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 2.8% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 3.0% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 3.2% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 3.4% { - transform: translate(2px, 0px) rotate(0.5deg); } + transform: translate(2px, 0px) rotate(0.5deg); + } 3.6% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 3.8% { - transform: translate(2px, 0px) rotate(0.5deg); } + transform: translate(2px, 0px) rotate(0.5deg); + } 4.0% { - transform: translate(2px, 0px) rotate(0.5deg); } + transform: translate(2px, 0px) rotate(0.5deg); + } 4.2% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 4.4% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 4.6% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 4.8% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 5.0% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 5.2% { - transform: translate(2px, 0px) rotate(0.5deg); } + transform: translate(2px, 0px) rotate(0.5deg); + } 5.4% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 5.6% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 5.8% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 6.0% { - transform: translate(0px, 0px) rotate(0.5deg); } + transform: translate(0px, 0px) rotate(0.5deg); + } 6.2% { - transform: translate(0px, 0px) rotate(0.5deg); } + transform: translate(0px, 0px) rotate(0.5deg); + } 6.4% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 6.6% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 6.8% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 7.0% { - transform: translate(2px, 0px) rotate(0.5deg); } + transform: translate(2px, 0px) rotate(0.5deg); + } 7.2% { - transform: translate(0px, 0px) rotate(0.5deg); } + transform: translate(0px, 0px) rotate(0.5deg); + } 7.4% { - transform: translate(2px, 0px) rotate(0.5deg); } + transform: translate(2px, 0px) rotate(0.5deg); + } 7.6% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 7.8% { - transform: translate(2px, 0px) rotate(0.5deg); } + transform: translate(2px, 0px) rotate(0.5deg); + } 8.0% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 8.2% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 8.4% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 8.6% { - transform: translate(0px, 0px) rotate(0.5deg); } + transform: translate(0px, 0px) rotate(0.5deg); + } 8.8% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 9.0% { - transform: translate(2px, 0px) rotate(0.5deg); } + transform: translate(2px, 0px) rotate(0.5deg); + } 9.2% { - transform: translate(0px, 0px) rotate(0.5deg); } + transform: translate(0px, 0px) rotate(0.5deg); + } 9.4% { - transform: translate(2px, 2px) rotate(0.5deg); } + transform: translate(2px, 2px) rotate(0.5deg); + } 9.6% { - transform: translate(0px, 2px) rotate(0.5deg); } + transform: translate(0px, 2px) rotate(0.5deg); + } 9.8% { - transform: translate(2px, 0px) rotate(0.5deg); } + transform: translate(2px, 0px) rotate(0.5deg); + } 10% { - transform: translate(0, 0) rotate(0); } + transform: translate(0, 0) rotate(0); + } 0%, 100% { - transform: translate(0, 0) rotate(0); } } - + transform: translate(0, 0) rotate(0); + } +} /* @keyframes shake-rotate { .2% { transform: translate(0, 0) rotate(7.5deg); } @@ -35317,19 +36287,32 @@ Style for 'About FCOO' modal-content .about-owner { text-align: center; font-size: 0.8rem; - font-family: "Verdana"; } - .about-owner .application-header { - margin: 0; - padding: 0.25rem; - text-align: center; - font-size: 1.3125rem; - line-height: 1.3125rem; - text-shadow: -1px 0 var(--fcoo-app-shadow-color), 0 1px var(--fcoo-app-shadow-color), 1px 0 var(--fcoo-app-shadow-color), 0 -1px var(--fcoo-app-shadow-color); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; } - .about-owner img { - margin: 1rem auto; } + font-family: var(--fmn-font-family); +} +.about-owner .application-header { + margin: 0; + padding: 0.25rem; + text-align: center; + font-size: 1.3125rem; + line-height: 1; + text-shadow: -1px 0 var(--fcoo-app-shadow-color), 0 1px var(--fcoo-app-shadow-color), 1px 0 var(--fcoo-app-shadow-color), 0 -1px var(--fcoo-app-shadow-color); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + min-height: calc(1em + 2 * 0.25rem); +} +.about-owner .application-logo-container { + width: 100%; + margin: 20px auto; +} +.about-owner .application-owner { + color: rgb(33, 37, 41); + font-family: var(--fmn-font-family); + font-size: 15.0589px; + font-weight: 600; + letter-spacing: -0.4px; + line-height: 1.5; +} /***************************************************** Style for touch menus @@ -35346,67 +36329,91 @@ Two modes: */ .touch-menu-container { position: absolute; - background-color: #fff; } - .touch-menu-container.left { - border-right: 1px solid var(--fcoo-app-bg-color); } - .touch-menu-container.right { - border-left: 1px solid var(--fcoo-app-bg-color); } - .touch-menu-container.top { - border-bottom: 1px solid var(--fcoo-app-bg-color); } - .touch-menu-container.bottom { - border-top: 1px solid var(--fcoo-app-bg-color); } - .touch-menu-container.mode-over { - z-index: 1054; } - .touch-menu-container.mode-over.closed { - z-index: 1048; } - .touch-menu-container.mode-side { - z-index: 1048; } - .touch-menu-container.opened { - transition-property: transform; - transition-duration: 0.3s; - transition-timing-function: ease-out; } - .touch-menu-container.opened.no-animation { - transition: none !important; } - .touch-menu-container.closed { - transition-property: transform, z-index; - transition-duration: 0.3s; - transition-timing-function: ease-out; - transform: none !important; } - .touch-menu-container.closed.no-animation { - transition: none !important; } - .touch-menu-container .touch-menu { - position: relative; } - .touch-menu-container.vertical-auto-width { - width: auto !important; } - .touch-menu-container.vertical-auto-height { - height: auto !important; } + background-color: var(--bs-body-bg); +} +.touch-menu-container.left { + border-right: 1px solid var(--fcoo-app-bg-color); +} +.touch-menu-container.right { + border-left: 1px solid var(--fcoo-app-bg-color); +} +.touch-menu-container.top { + border-bottom: 1px solid var(--fcoo-app-bg-color); +} +.touch-menu-container.bottom { + border-top: 1px solid var(--fcoo-app-bg-color); +} +.touch-menu-container.mode-over { + z-index: 1054; +} +.touch-menu-container.mode-over.closed { + z-index: 1048; +} +.touch-menu-container.mode-side { + z-index: 1048; +} +.touch-menu-container.opened { + transition-property: all; + transition-duration: 0.3s; + transition-timing-function: ease-out; +} +html.loading .touch-menu-container.opened, .touch-menu-container.opened.no-animation { + transition: none !important; +} +.touch-menu-container.closed { + transition-property: all; + transition-duration: 0.3s; + transition-timing-function: ease-out; + transform: none !important; +} +html.loading .touch-menu-container.closed, .touch-menu-container.closed.no-animation { + transition: none !important; +} +.touch-menu-container .touch-menu { + position: relative; +} +.touch-menu-container.vertical-auto-width { + width: auto !important; +} +.touch-menu-container.horizontal-auto-height { + height: auto !important; +} .touch-menu-handle { - position: absolute; } - .touch-menu-handle.left { - left: 0; } - .touch-menu-handle.right { - right: 0; } - .touch-menu-handle.top { - top: 0; } - .touch-menu-handle.bottom { - bottom: 0; } - .touch-menu-handle.hide-when-open.opened, .touch-menu-handle.hide-when-open.closing { - display: none; } + position: absolute; +} +.touch-menu-handle.left { + left: 0; +} +.touch-menu-handle.right { + right: 0; +} +.touch-menu-handle.top { + top: 0; +} +.touch-menu-handle.bottom { + bottom: 0; +} +.touch-menu-handle.hide-when-open.opened, .touch-menu-handle.hide-when-open.closing { + display: none; +} .touch-menu-mask { position: absolute; - opacity: 0.0; + opacity: 0; z-index: -1; width: 100%; height: 100%; top: 0; left: 0; - background-color: #000; } - .touch-menu-mask.opened, .touch-menu-mask.closed { - transition: opacity 0.3s ease-out; } - .touch-menu-mask.visible { - z-index: 1053; } + background-color: #000; +} +.touch-menu-mask.opened, .touch-menu-mask.closed { + transition: opacity 0.3s ease-out; +} +.touch-menu-mask.visible { + z-index: 1053; +} .horizontal-bar { font-size: 2rem; @@ -35414,19 +36421,55 @@ Two modes: line-height: 0.7; color: #343a40; text-shadow: -1px 0 rgba(255, 255, 255, 0.5), 0 1px rgba(255, 255, 255, 0.5), 1px 0 rgba(255, 255, 255, 0.5), 0 -1px rgba(255, 255, 255, 0.5); - background-color: transparent; } + background-color: transparent; +} .vertical-pre-menu { border-bottom: 1px solid var(--fcoo-app-bg-color); background-color: var(--bs-gray-200); - padding: var(--fcoo-app-menu-padding); } + padding: var(--fcoo-app-menu-padding); +} .neighbour-container { - transition-property: margin-left, margin-right, margin-top, margin-bottom !important; + transition-property: all !important; transition-duration: 0.3s !important; - transition-timing-function: ease-out !important; } - .neighbour-container.no-animation { - transition-duration: 0s 4; } + transition-timing-function: ease-out !important; +} +html.loading .neighbour-container, .neighbour-container.no-animation { + transition-duration: 0s !important; +} + +html.top-menu-open .hide-for-top-menu-open { + display: none !important; +} + +html.no-top-menu-open .show-for-top-menu-open { + display: none !important; +} + +html.bottom-menu-open .hide-for-bottom-menu-open { + display: none !important; +} + +html.no-bottom-menu-open .show-for-bottom-menu-open { + display: none !important; +} + +html.left-menu-open .hide-for-left-menu-open { + display: none !important; +} + +html.no-left-menu-open .show-for-left-menu-open { + display: none !important; +} + +html.right-menu-open .hide-for-right-menu-open { + display: none !important; +} + +html.no-right-menu-open .show-for-right-menu-open { + display: none !important; +} /***************************************************** Style for icons @@ -35450,17 +36493,19 @@ Different versions of sub-icons can be created using different methods in namesp */ .container-stacked-icons.fa-fw.fa-sub-icons-container { position: relative; - left: -0.125em; } + left: -0.125em; +} .btn .fa-MAIN-small-right-bottom { position: relative; right: 0.125em; - bottom: 0.125em; } - + bottom: 0.125em; +} .btn.big-icon .fa-MAIN-small-right-bottom { font-size: 0.85em; right: 0.125em; - bottom: 0.21875em; } + bottom: 0.21875em; +} .fa-circle-small-right-bottom, .fa-square-small-right-bottom { @@ -35469,50 +36514,63 @@ Different versions of sub-icons can be created using different methods in namesp bottom: -0.3125em; font-size: 0.9em; color: var(--bs-modal-bg) !important; - text-shadow: none; } - .btn .fa-circle-small-right-bottom, .btn - .fa-square-small-right-bottom { - color: var(--bs-btn-bg) !important; } - .btn:hover .fa-circle-small-right-bottom, .btn:hover - .fa-square-small-right-bottom { - color: var(--bs-btn-hover-bg) !important; } - .header-content .fa-circle-small-right-bottom, .header-content - .fa-square-small-right-bottom { - color: var(--jb-header-bg) !important; } - .footer-content .fa-circle-small-right-bottom, .footer-content - .fa-square-small-right-bottom { - color: var(--jb-footer-bg) !important; } - .accordion-button.collapsed .fa-circle-small-right-bottom, .accordion-button.collapsed - .fa-square-small-right-bottom { - color: var(--bs-accordion-btn-bg) !important; } - .accordion-button:not(.collapsed) .fa-circle-small-right-bottom, .accordion-button:not(.collapsed) - .fa-square-small-right-bottom { - color: var(--bs-accordion-active-bg) !important; } - .semi-transparent .fa-circle-small-right-bottom, .semi-transparent - .fa-square-small-right-bottom { - color: #e6e6e6 !important; } - .btn .fa-circle-small-right-bottom, .btn - .fa-square-small-right-bottom { - right: -0.1875em; - bottom: -0.1875em; } - .btn.big-icon .fa-circle-small-right-bottom, .btn.big-icon - .fa-square-small-right-bottom { - font-size: 0.765em; - right: -0.1875em; - bottom: -0.09375em; } + text-shadow: none; +} +.btn .fa-circle-small-right-bottom, +.btn .fa-square-small-right-bottom { + color: var(--bs-btn-bg) !important; +} +.btn:hover .fa-circle-small-right-bottom, +.btn:hover .fa-square-small-right-bottom { + color: var(--bs-btn-hover-bg) !important; +} +.header-content .fa-circle-small-right-bottom, +.header-content .fa-square-small-right-bottom { + color: var(--jb-header-bg) !important; +} +.footer-content .fa-circle-small-right-bottom, +.footer-content .fa-square-small-right-bottom { + color: var(--jb-footer-bg) !important; +} +.accordion-button.collapsed .fa-circle-small-right-bottom, +.accordion-button.collapsed .fa-square-small-right-bottom { + color: var(--bs-accordion-btn-bg) !important; +} +.accordion-button:not(.collapsed) .fa-circle-small-right-bottom, +.accordion-button:not(.collapsed) .fa-square-small-right-bottom { + color: var(--bs-accordion-active-bg) !important; +} +.semi-transparent .fa-circle-small-right-bottom, +.semi-transparent .fa-square-small-right-bottom { + color: rgb(230, 230, 230) !important; +} +.btn .fa-circle-small-right-bottom, +.btn .fa-square-small-right-bottom { + right: -0.1875em; + bottom: -0.1875em; +} +.btn.big-icon .fa-circle-small-right-bottom, +.btn.big-icon .fa-square-small-right-bottom { + font-size: 0.765em; + right: -0.1875em; + bottom: -0.09375em; +} .fa-SUB-small-right-bottom { position: relative; right: -0.3125em; bottom: -0.3125em; - font-size: 0.9em; } - .btn .fa-SUB-small-right-bottom { - right: -0.1875em; - bottom: -0.1875em; } - .btn.big-icon .fa-SUB-small-right-bottom { - font-size: 0.765em; - right: -0.1875em; - bottom: -0.09375em; } + font-size: 0.9em; +} +.btn .fa-SUB-small-right-bottom { + right: -0.1875em; + bottom: -0.1875em; +} +.btn.big-icon .fa-SUB-small-right-bottom { + font-size: 0.765em; + right: -0.1875em; + bottom: -0.09375em; +} /***************************************************** Classes to disable transition, transform, or animation @@ -35528,21 +36586,24 @@ html.no-transition * { -moz-transition-property: none !important; -ms-transition-property: none !important; -webkit-transition-property: none !important; - transition-property: none !important; } + transition-property: none !important; +} html.no-transform * { -o-transform: none !important; -moz-transform: none !important; -ms-transform: none !important; -webkit-transform: none !important; - transform: none !important; } + transform: none !important; +} html.no-animation * { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; -ms-animation: none !important; - animation: none !important; } + animation: none !important; +} /***************************************************** Create classes invisible-for-XX a la hide-for-XX using @@ -35558,34 +36619,43 @@ the break-points defined in fcoo-modernizr-mediaquery-device ************************************************/ html.mini-down .invisible-for-mini-down { - visibility: hidden; } + visibility: hidden; +} html.xsmall-port-down .invisible-for-xsmall-port-down { - visibility: hidden; } + visibility: hidden; +} html.xsmall-land-down .invisible-for-xsmall-land-down { - visibility: hidden; } + visibility: hidden; +} html.small-down .invisible-for-small-down { - visibility: hidden; } + visibility: hidden; +} html.medium-down .invisible-for-medium-down { - visibility: hidden; } + visibility: hidden; +} html.large-down .invisible-for-large-down { - visibility: hidden; } + visibility: hidden; +} html.xlarge-down .invisible-for-xlarge-down { - visibility: hidden; } + visibility: hidden; +} /***************************************************** -Special claa for buttons in reset-list +Special class for buttons in reset-list *****************************************************/ .btn-reset { min-height: 4em; - line-height: 3; } - .btn-reset.multi-lines { - line-height: var(--bs-btn-line-height); } + line-height: 3; +} +.btn-reset.multi-lines { + line-height: var(--bs-btn-line-height); +} /***************************************************** Special adjustments and bug fix @@ -35596,8 +36666,8 @@ resulting in font-size = 0.65*0.65 = .4225 This is fixed by overwriting the last size with "inherit" */ .fa-inside-circle.fa-inside-circle { - font-size: inherit; } - + font-size: inherit; +} /*********************************************** leaflet-bootstrap-marker.scss @@ -37395,7 +38465,8 @@ jquery-scroll-container-variables.scss :root { --jsc-scroll-size: 10px; --jsc-scroll-padding: 10px; - --jsc-scroll-auto-padding: 10px; } + --jsc-scroll-auto-padding: 10px; +} /************************************************************ VARIABLES @@ -37414,7 +38485,7 @@ Modal ************************************************/ /*********************************************** Button And Modal -Opacity for semi-transparent and transparent content +Opacity for semi-transparent and transparent content using color-mix ************************************************/ /************************************************************ MIXIN @@ -37445,22 +38516,23 @@ leaflet-bootstrap-fonts.scss Use same font-family as Bootstrap via fcoo/jqury-bootstrap ************************************************/ .leaflet-container { - font: inherit !important; } + font: inherit !important; +} /*********************************************** Font-family for four icons used in leaflet-bootstrap ************************************************/ @font-face { - font-family: 'leaflet-bootstrap'; + font-family: "leaflet-bootstrap"; src: url("fonts/leaflet-bootstrap.eot?jxmi9r"); src: url("fonts/leaflet-bootstrap.eot?jxmi9r#iefix") format("embedded-opentype"), url("fonts/leaflet-bootstrap.ttf?jxmi9r") format("truetype"), url("fonts/leaflet-bootstrap.woff?jxmi9r") format("woff"), url("fonts/leaflet-bootstrap.svg?jxmi9r#icomoon") format("svg"); font-weight: normal; font-style: normal; - font-display: block; } - -[class^="fa-lb-"], [class*=" fa-lb-"] { + font-display: block; +} +[class^=fa-lb-], [class*=" fa-lb-"] { /* use !important to prevent issues with browser extensions that change fonts */ - font-family: 'leaflet-bootstrap' !important; + font-family: "leaflet-bootstrap" !important; speak: none; font-style: normal; font-weight: normal; @@ -37469,161 +38541,191 @@ Font-family for four icons used in leaflet-bootstrap line-height: 1; /* Better Font Rendering =========== */ -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; } + -moz-osx-font-smoothing: grayscale; +} .fa-lb-center-marker:before { - content: "\e900"; } + content: "\e900"; +} .fa-lb-mouse-left:before { - content: "\ea6e"; } + content: "\ea6e"; +} .fa-lb-mouse-right:before { - content: "\ea6f"; } + content: "\ea6f"; +} [class*=" fa-lb-mouse-"] { font-size: 1.2em; line-height: 0.8333333333em !important; - vertical-align: -.0667em; - margin-right: 0 !important; } + vertical-align: -0.0667em; + margin-right: 0 !important; +} .fa-lb-contextmenu:before { - content: "\ead6"; } + content: "\ead6"; +} /*********************************************** Scale icons ************************************************/ .fa-scale-x-08 { - transform: scaleX(0.8); } + transform: scaleX(0.8); +} /*********************************************** leaflet-bootstrap-popup.scss, ************************************************/ .leaflet-popup-content { - width: 100px; } + width: 100px; +} .modal-wrapper.leaflet-popup-content-wrapper { background: transparent; padding: 0; - box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); } - .modal-wrapper.leaflet-popup-content-wrapper .leaflet-popup-content { - margin: 0; - display: flex; } - .modal-wrapper.leaflet-popup-content-wrapper + .leaflet-popup-tip-container { - margin-top: -1px; } - .modal-wrapper.leaflet-popup-content-wrapper + .leaflet-popup-tip-container .leaflet-popup-tip { - box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); - width: 13px; - height: 13px; - margin: -6px auto 0; - border: 2px solid var(--jb-container-border-color); } + box-shadow: var(--bs-box-shadow); +} +.modal-wrapper.leaflet-popup-content-wrapper .leaflet-popup-content { + margin: 0; + display: flex; +} +.modal-wrapper.leaflet-popup-content-wrapper + .leaflet-popup-tip-container { + margin-top: -1px; +} +.modal-wrapper.leaflet-popup-content-wrapper + .leaflet-popup-tip-container .leaflet-popup-tip { + box-shadow: var(--bs-box-shadow); + width: 13px; + height: 13px; + margin: -6px auto 0; + border: 2px solid var(--jb-container-border-color); +} /*********************************************** leaflet-bootstrap-tooltip.scss, ************************************************/ .leaflet-tooltip { padding: 0.125rem 0.125rem; - background-color: #fff; - border: 1px solid var(--jb-container-border-color); - border-radius: 0.375rem; - color: #212529; + background-color: var(--bs-body-bg); + border: var(--bs-border-width) solid var(--jb-container-border-color); + border-radius: var(--bs-border-radius); + color: var(--bs-body-color); white-space: nowrap; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; pointer-events: none; - box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); + box-shadow: var(--bs-box-shadow); font-size: 0.6875rem; - opacity: 0.9; } + opacity: 0.9; +} .leaflet-tooltip-top:before, .leaflet-tooltip-bottom:before, .leaflet-tooltip-left:before, .leaflet-tooltip-right:before { - display: none; } + display: none; +} .leaflet-tooltip-bottom { - margin-top: 10px; } + margin-top: 10px; +} .leaflet-tooltip-top { - margin-top: -10px; } + margin-top: -10px; +} .leaflet-tooltip-left { - margin-left: -10px; } + margin-left: -10px; +} .leaflet-tooltip-right { - margin-left: 10px; } + margin-left: 10px; +} .leaflet-tooltip-icon-0.leaflet-tooltip-bottom { - margin-top: 10px; } - + margin-top: 10px; +} .leaflet-tooltip-icon-0.leaflet-tooltip-top { - margin-top: -10px; } - + margin-top: -10px; +} .leaflet-tooltip-icon-0.leaflet-tooltip-left { - margin-left: -10px; } - + margin-left: -10px; +} .leaflet-tooltip-icon-0.leaflet-tooltip-right { - margin-left: 10px; } + margin-left: 10px; +} .leaflet-tooltip-icon-1.leaflet-tooltip-bottom { - margin-top: 13px; } - + margin-top: 13px; +} .leaflet-tooltip-icon-1.leaflet-tooltip-top { - margin-top: -13px; } - + margin-top: -13px; +} .leaflet-tooltip-icon-1.leaflet-tooltip-left { - margin-left: -13px; } - + margin-left: -13px; +} .leaflet-tooltip-icon-1.leaflet-tooltip-right { - margin-left: 13px; } + margin-left: 13px; +} .leaflet-tooltip-icon-2.leaflet-tooltip-bottom { - margin-top: 15px; } - + margin-top: 15px; +} .leaflet-tooltip-icon-2.leaflet-tooltip-top { - margin-top: -15px; } - + margin-top: -15px; +} .leaflet-tooltip-icon-2.leaflet-tooltip-left { - margin-left: -15px; } - + margin-left: -15px; +} .leaflet-tooltip-icon-2.leaflet-tooltip-right { - margin-left: 15px; } + margin-left: 15px; +} .no-mouse-hover .leaflet-tooltip:not(.leaflet-tooltip-permanent) { - display: none; } + display: none; +} .leaflet-dragging .leaflet-tooltip.leaflet-tooltip-hide-when-dragging:not(.leaflet-tooltip-permanent) { - display: none; } + display: none; +} .leaflet-control-container .leaflet-pane { - z-index: 1000; } + z-index: 1000; +} /*********************************************** leaflet-bootstrap-modal.scss ************************************************/ .leaflet-control .modal-dialog { - margin: 0; } + margin: 0; +} /*********************************************** leaflet-bootstrap-control.scss ************************************************/ .leaflet-container a { - color: var(--bs-btn-color); } + color: var(--bs-btn-color); +} .leaflet-container:not(.has-control-attribution-bs) .leaflet-control-container .leaflet-bottom .leaflet-control { - margin-bottom: 10px; } + margin-bottom: 10px; +} .leaflet-container.has-control-attribution-bs .leaflet-control-container .leaflet-bottom.has-control-attribution-bs .leaflet-control:nth-last-child(2) { - margin-bottom: 2px; } - + margin-bottom: 2px; +} .leaflet-container.has-control-attribution-bs .leaflet-control-container .leaflet-bottom:not(.has-control-attribution-bs) .leaflet-control:last-child { - margin-bottom: 13px; } + margin-bottom: 13px; +} div.leaflet-control.leaflet-control-hidden { - margin-top: 0; } - div.leaflet-control.leaflet-control-hidden * { - display: none !important; } + margin-top: 0; +} +div.leaflet-control.leaflet-control-hidden * { + display: none !important; +} /*********************************************** leaflet-bootstrap-control-attribution.scss @@ -37634,18 +38736,25 @@ leaflet-bootstrap-control-attribution.scss height: 11px; margin: 0 !important; cursor: default; - background: rgba(255, 255, 255, 0.5); } - .mouse-hover .leaflet-control-container .leaflet-control-attribution.leaflet-control-attribution-bs:hover { - background: rgba(255, 255, 255, 0.75); } + background: color-mix(in srgb, var(--bs-body-bg), transparent 50%); +} +.mouse-hover .leaflet-control-container .leaflet-control-attribution.leaflet-control-attribution-bs:hover { + background: color-mix(in srgb, var(--bs-body-bg), transparent 75%); +} +.leaflet-control-container .leaflet-control-attribution.leaflet-control-attribution-bs:empty { + vissibility: hidden; +} /*********************************************** leaflet-bootstrap-control-button.scss ************************************************/ .leaflet-control.leaflet-button-box.extended .hide-for-extended { - display: none !important; } + display: none !important; +} .leaflet-control.leaflet-button-box.no-extended .show-for-extended { - display: none !important; } + display: none !important; +} /*********************************************** leaflet-bootstrap-control-scale.scss @@ -37662,92 +38771,118 @@ leaflet-bootstrap-control-scale.scss */ .leaflet-button-box-scale { - margin-bottom: 0 !important; } + margin-bottom: 0 !important; +} .leaflet-bottom:not(.has-control-attribution-bs) .leaflet-button-box-scale { - min-height: calc(2.375rem + 10px); } - + min-height: calc(2.375rem + 10px); +} .leaflet-bottom:not(.has-control-attribution-bs) .leaflet-button-box-scale-sm { - min-height: calc(1.9375rem + 10px); } + min-height: calc(1.9375rem + 10px); +} .leaflet-bottom.has-control-attribution-bs .leaflet-button-box-scale { - min-height: calc(2.375rem + 13px); } - + min-height: calc(2.375rem + 13px); +} .leaflet-bottom.has-control-attribution-bs .leaflet-button-box-scale-sm { - min-height: calc(1.9375rem + 13px); } + min-height: calc(1.9375rem + 13px); +} .leaflet-bootstrap-control-scale { - overflow: hidden; } - .leaflet-bootstrap-control-scale .modal-body { - padding: 2px !important; } + overflow: hidden; +} +.leaflet-bootstrap-control-scale .modal-body { + padding: 2px !important; +} .leaflet-control-singlescale { position: relative; - z-index: 1; } - .leaflet-control-singlescale.hidden { - display: none; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner { - font-size: 6px; - line-height: 1; - margin-top: 0; - margin-bottom: 0; - margin-left: 5px; - margin-right: 0; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .units { - display: inline-block; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .label { - width: 80px; - text-align: center; - position: absolute; - opacity: 1; - font-size: 10px; - line-height: 1; - transition: opacity .4s linear; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner.labelPlacement-top { - margin-top: 10px; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner.labelPlacement-top .label { - bottom: 6px; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner.labelPlacement-bottom { - margin-bottom: 10px; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .divisionLabel { - right: 0; - margin-right: -40px; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .zeroLabel { - left: 0; - margin-left: -40px; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .division { - display: inline-block; - position: relative; - width: 40px; - transition: width 0.4s ease-in-out; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .division .line, .leaflet-control-singlescale .leaflet-control-singlescale-inner .division .line2 { - border-style: solid; - position: relative; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .division .line2 { - height: 0; - border-width: 0; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .division .line { - height: 6px; - border-width: 1px 1px 1px 0; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .units .division:first-child .line { - border-left-width: 1px; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .fill, .leaflet-control-singlescale .leaflet-control-singlescale-inner .fill2 { - position: absolute; - top: 1px; - left: 1px; - right: 1px; - bottom: 1px; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .fill { - background-color: #000; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .fill2 { - background-color: #fff; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .division.hidden { - width: 0; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .division.hidden .line, .leaflet-control-singlescale .leaflet-control-singlescale-inner .division.hidden .line2 { - height: 0; - border-width: 0; } - .leaflet-control-singlescale .leaflet-control-singlescale-inner .division.hidden .label { - opacity: 0; } + z-index: 1; +} +.leaflet-control-singlescale.hidden { + display: none; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner { + font-size: 8px; + line-height: 1; + margin-top: 0; + margin-bottom: 0; + margin-left: 6px; + margin-right: 0; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .units { + display: inline-block; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .label { + width: 80px; + text-align: center; + position: absolute; + opacity: 1; + font-size: 12px; + line-height: 1; + transition: opacity 0.4s linear; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner.labelPlacement-top { + margin-top: 12px; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner.labelPlacement-top .label { + bottom: 8px; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner.labelPlacement-bottom { + margin-bottom: 12px; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .divisionLabel { + right: 0; + margin-right: -40px; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .zeroLabel { + left: 0; + margin-left: -40px; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .division { + display: inline-block; + position: relative; + width: 40px; + transition: width 0.4s ease-in-out; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .division .line, .leaflet-control-singlescale .leaflet-control-singlescale-inner .division .line2 { + border-style: solid; + position: relative; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .division .line2 { + height: 0; + border-width: 0; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .division .line { + height: 8px; + border-width: 1px 1px 1px 0; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .units .division:first-child .line { + border-left-width: 1px; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .fill, .leaflet-control-singlescale .leaflet-control-singlescale-inner .fill2 { + position: absolute; + top: 1px; + left: 1px; + right: 1px; + bottom: 1px; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .fill { + background-color: #000; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .fill2 { + background-color: #fff; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .division.hidden { + width: 0; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .division.hidden .line, .leaflet-control-singlescale .leaflet-control-singlescale-inner .division.hidden .line2 { + height: 0; + border-width: 0; +} +.leaflet-control-singlescale .leaflet-control-singlescale-inner .division.hidden .label { + opacity: 0; +} /******************************************************************************** L.Control.Reticle @@ -37757,7 +38892,8 @@ Modified version of leaflet-reticle https://github.com/rwev/leaflet-reticle by https://github.com/rwev ********************************************************************************/ .leaflet-zoom-anim .icon-reticle { - display: none !important; } + display: none !important; +} /*********************************************** leaflet-bootstrap-control-zoom.scss @@ -37769,99 +38905,131 @@ Overwrite style for bootstrap-slider width: 100%; height: 120px; margin-top: 10px; - margin-bottom: 10px; } - .slider.slider-vertical .slider-track { - width: 6px; - height: calc(100% + 20px); - top: -10px; - left: calc(50% - 3px); - border-left: 1px solid var(--jb-structure-border-color); - border-right: 1px solid var(--jb-structure-border-color); - border-radius: 0 !important; } - .slider.slider-vertical .slider-track * { - border-radius: 0 !important; } - .slider.slider-vertical .slider-handle { - position: absolute !important; - margin-top: -10px; - width: 100%; - height: 20px !important; } - .slider.slider-vertical .slider-handle hr { - border: none; - border-bottom: 6px double #6c757d; - height: 25%; - width: 50%; } + margin-bottom: 10px; +} +.slider.slider-vertical .slider-track { + width: 6px; + height: calc(100% + 20px); + top: -10px; + left: calc(50% - 3px); + border-left: 1px solid var(--jb-structure-border-color); + border-right: 1px solid var(--jb-structure-border-color); + border-radius: 0 !important; +} +.slider.slider-vertical .slider-track * { + border-radius: 0 !important; +} +.slider.slider-vertical .slider-handle { + position: absolute !important; + margin-top: -10px; + width: 100%; + height: 20px !important; +} +.slider.slider-vertical .slider-handle hr { + border: none; + border-bottom: 6px double #6c757d; + height: 25%; + width: 50%; +} .history .hide-for-history { - display: none !important; } + display: none !important; +} .no-history .show-for-history { - display: none !important; } + display: none !important; +} /*********************************************** leaflet-bootstrap-control-legend.scss ************************************************/ .modal-header.bsl-working .hide-for-bsl-working { - display: none !important; } + display: none !important; +} .modal-header.no-bsl-working .show-for-bsl-working { - display: none !important; } + display: none !important; +} .fa-map-margin-right { - margin-right: 0.4rem; } + margin-right: 0.4rem; +} /*********************************************** leaflet-bootstrap-control-compass.scss ************************************************/ @media screen and (orientation: landscape) { .lb-compass-btn .compass-device-portrait { - visibility: hidden !important; } + visibility: hidden !important; + } .lb-compass-btn .compass-device-landscape { - transform: rotate(90deg) translateX(-0.1em) scale(0.7) !important; } - html.orientation-secondary .lb-compass-btn .compass-device-landscape { - transform: rotate(-90deg) translateX(0.1em) scale(0.7) !important; } + transform: rotate(90deg) translateX(-0.1em) scale(0.7) !important; + } + html.orientation-secondary .lb-compass-btn .compass-device-landscape { + transform: rotate(-90deg) translateX(0.1em) scale(0.7) !important; + } .lb-compass-btn .compass-arrow { - transform: rotate(90deg) translateY(-0.5em) scale(0.7) !important; } - html.orientation-secondary .lb-compass-btn .compass-arrow { - transform: rotate(-90deg) translateY(-0.5em) scale(0.7) !important; } + transform: rotate(90deg) translateY(-0.5em) scale(0.7) !important; + } + html.orientation-secondary .lb-compass-btn .compass-arrow { + transform: rotate(-90deg) translateY(-0.5em) scale(0.7) !important; + } .lb-compass-btn .compass-device { - transform: rotate(0deg); } + transform: rotate(0deg); + } .lb-compass-btn.fixed { - transform: rotate(-90deg) !important; } - html.orientation-secondary .lb-compass-btn.fixed { - transform: rotate(90deg) !important; } + transform: rotate(-90deg) !important; + } + html.orientation-secondary .lb-compass-btn.fixed { + transform: rotate(90deg) !important; + } .rotate-compass .the-compass { - transform: rotate(270deg) !important; } - html.orientation-secondary .rotate-compass .the-compass { - transform: rotate(90deg) !important; } } - + transform: rotate(270deg) !important; + } + html.orientation-secondary .rotate-compass .the-compass { + transform: rotate(90deg) !important; + } +} @media screen and (orientation: portrait) { .lb-compass-btn .compass-device-landscape { - visibility: hidden !important; } + visibility: hidden !important; + } .lb-compass-btn .compass-device-portrait { - transform: rotate(0deg) translateY(0em) scale(0.7) !important; } - html.orientation-secondary .lb-compass-btn .compass-device-portrait { - transform: rotate(180deg) translateY(0.2em) scale(0.7) !important; } + transform: rotate(0deg) translateY(0em) scale(0.7) !important; + } + html.orientation-secondary .lb-compass-btn .compass-device-portrait { + transform: rotate(180deg) translateY(0.2em) scale(0.7) !important; + } .lb-compass-btn .compass-arrow { - transform: rotate(0deg) translateY(-0.6em) scale(0.7) !important; } - html.orientation-secondary .lb-compass-btn .compass-arrow { - transform: rotate(180deg) translateY(-0.6em) scale(0.7) !important; } + transform: rotate(0deg) translateY(-0.6em) scale(0.7) !important; + } + html.orientation-secondary .lb-compass-btn .compass-arrow { + transform: rotate(180deg) translateY(-0.6em) scale(0.7) !important; + } .lb-compass-btn .compass-device { - transform: translateY(0.1em); } - html.orientation-secondary .lb-compass-btn .compass-device { - transform: translateY(-0.1em); } + transform: translateY(0.1em); + } + html.orientation-secondary .lb-compass-btn .compass-device { + transform: translateY(-0.1em); + } html.orientation-secondary .lb-compass-btn.fixed { - transform: rotate(180deg) !important; } + transform: rotate(180deg) !important; + } .rotate-compass .the-compass { - transform: rotate(0deg) !important; } - html.orientation-secondary .rotate-compass .the-compass { - transform: rotate(180deg) !important; } } - + transform: rotate(0deg) !important; + } + html.orientation-secondary .rotate-compass .the-compass { + transform: rotate(180deg) !important; + } +} .no-device-orientation-slash { visibility: hidden; - transform: rotate(0deg); } + transform: rotate(0deg); +} .lb-compass-adjust { - transform: rotate(-45deg); } + transform: rotate(-45deg); +} .lb-conpass-content > div { width: 2.96875rem; @@ -37869,86 +39037,110 @@ leaflet-bootstrap-control-compass.scss display: flex; align-items: center; justify-content: center; - text-align: center; } - .lb-conpass-content > div:nth-child(2), .lb-conpass-content > div:nth-child(5) { - border-left: 1px solid var(--jb-structure-border-color); - border-right: 1px solid var(--jb-structure-border-color); } + text-align: center; +} +.lb-conpass-content > div:nth-child(2), .lb-conpass-content > div:nth-child(5) { + border-left: 1px solid var(--jb-structure-border-color); + border-right: 1px solid var(--jb-structure-border-color); +} .no-device-orientation .lb-compass-btn { - transform: rotate(0deg) !important; } - .no-device-orientation .lb-compass-btn .no-device-orientation-slash { - visibility: inherit; } - .no-device-orientation .lb-compass-btn .compass-device { - transform: none; } - .no-device-orientation .lb-compass-btn .compass-arrow, .no-device-orientation .lb-compass-btn .compass-device-landscape, .no-device-orientation .lb-compass-btn .compass-device-portrait { - visibility: hidden; } - .no-device-orientation .lb-compass-btn * i:not(.no-device-orientation-slash) { - opacity: .5; } - + transform: rotate(0deg) !important; +} +.no-device-orientation .lb-compass-btn .no-device-orientation-slash { + visibility: inherit; +} +.no-device-orientation .lb-compass-btn .compass-device { + transform: none; +} +.no-device-orientation .lb-compass-btn .compass-arrow, .no-device-orientation .lb-compass-btn .compass-device-landscape, .no-device-orientation .lb-compass-btn .compass-device-portrait { + visibility: hidden; +} +.no-device-orientation .lb-compass-btn * i:not(.no-device-orientation-slash) { + opacity: 0.5; +} .no-device-orientation .lb-conpass-content { - display: none !important; } - + display: none !important; +} .no-device-orientation .lb-conpass-content-error { - display: block !important; } + display: block !important; +} /*********************************************** leaflet-bootstrap-contextmenu.scss ************************************************/ .leaflet-popup-contextmenu .modal-content { - padding: 0 !important; } - .leaflet-popup-contextmenu .modal-content .modal-body { - padding: 1px !important; } - .leaflet-popup-contextmenu .modal-content .modal-footer:empty { - display: none !important; } + padding: 0 !important; +} +.leaflet-popup-contextmenu .modal-content .modal-body { + padding: 1px !important; +} +.leaflet-popup-contextmenu .modal-content .modal-footer:empty { + display: none !important; +} -/*********************************************** +.leaflet-popup-content .modal-body > .contextmenu-item-group:not(:first-child) { + margin-top: 4px; +} + +/*********************************************** leaflet-bootstrap-control-position.scss ************************************************/ .leaflet-position-marker { background: url(images/leaflet-position-marker.svg) 50% 50% no-repeat; - content: ''; } - .leaflet-position-marker.inside-other-map { - opacity: .5; } - .leaflet-zoom-anim .leaflet-position-marker, .hide-control-position-map-center .leaflet-position-marker { - display: none !important; } + content: ""; +} +.leaflet-position-marker.inside-other-map { + opacity: 0.5; +} +.leaflet-zoom-anim .leaflet-position-marker, .hide-control-position-map-center .leaflet-position-marker { + display: none !important; +} .leaflet-control-container .input-group div.bsPosition-content { text-align: center; line-height: 1; padding: 0 0.25rem; - padding-top: 1px; } - .leaflet-control-container .input-group div.bsPosition-content > * { - font-size: 13px; } + padding-top: 1px; +} +.leaflet-control-container .input-group div.bsPosition-content > * { + font-size: 13px; +} .control-position-cursor .hide-for-control-position-cursor { - display: none !important; } - + display: none !important; +} .control-position-cursor .show-for-no-control-position-cursor { - display: none !important; } + display: none !important; +} .no-control-position-cursor .show-for-control-position-cursor { - display: none !important; } - + display: none !important; +} .no-control-position-cursor .hide-for-no-control-position-cursor { - display: none !important; } + display: none !important; +} .control-position-map-center .hide-for-control-position-map-center { - display: none !important; } - + display: none !important; +} .control-position-map-center .show-for-no-control-position-map-center { - display: none !important; } + display: none !important; +} .no-control-position-map-center .show-for-control-position-map-center { - display: none !important; } - + display: none !important; +} .no-control-position-map-center .hide-for-no-control-position-map-center { - display: none !important; } + display: none !important; +} .control-position-cursor .no-cursor-on-map .hide-for-no-cursor-on-map { - color: transparent; } - .control-position-cursor .no-cursor-on-map .hide-for-no-cursor-on-map > *:not(.show-for-no-cursor-on-map) { - visibility: hidden !important; } - + color: transparent; +} +.control-position-cursor .no-cursor-on-map .hide-for-no-cursor-on-map > *:not(.show-for-no-cursor-on-map) { + visibility: hidden !important; +} /*********************************************** fcoo-havnelods.scss, @@ -37983,87 +39175,121 @@ to create fa-icon looking like the marker *************************************************************************/ .lbm-type-circle.lbm-color-harbor-dk { background-color: #7CB82F; - color: #000; } - .lbm-type-circle.lbm-color-harbor-dk.lbm-transparent { - background-color: rgba(124, 184, 47, 0.7); } - .lbm-type-circle.lbm-color-harbor-dk.lbm-transparent.lbm-hover:hover { - background-color: rgba(124, 184, 47, 0.9); } - .lbm-type-circle.lbm-color-harbor-dk.lbm-shadow, .lbm-type-circle.lbm-color-harbor-dk.leaflet-drag-target, .lbm-type-circle.lbm-color-harbor-dk.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(124, 184, 47, 0.28); } - .lbm-type-circle.lbm-color-harbor-dk:before { - box-shadow: 0 0 6px 2px #7CB82F; } - + color: #000; +} +.lbm-type-circle.lbm-color-harbor-dk.lbm-transparent { + background-color: rgba(124, 184, 47, 0.7); +} +.lbm-type-circle.lbm-color-harbor-dk.lbm-transparent.lbm-hover:hover { + background-color: rgba(124, 184, 47, 0.9); +} +.lbm-type-circle.lbm-color-harbor-dk.lbm-shadow, .lbm-type-circle.lbm-color-harbor-dk.leaflet-drag-target, .lbm-type-circle.lbm-color-harbor-dk.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(124, 184, 47, 0.28); +} +.lbm-type-circle.lbm-color-harbor-dk:before { + box-shadow: 0 0 6px 2px #7CB82F; +} .lbm-type-circle.lbm-border-color-harbor-dk { - border-color: #7CB82F; } + border-color: #7CB82F; +} .fa-lbm-color-harbor-dk { - color: #7CB82F; } + color: #7CB82F; +} .fa-lbm-border-color-harbor-dk { - color: #7CB82F; } + color: #7CB82F; +} .lbm-type-circle.lbm-color-harbor-gl { background-color: #60AA14; - color: #000; } - .lbm-type-circle.lbm-color-harbor-gl.lbm-transparent { - background-color: rgba(96, 170, 20, 0.7); } - .lbm-type-circle.lbm-color-harbor-gl.lbm-transparent.lbm-hover:hover { - background-color: rgba(96, 170, 20, 0.9); } - .lbm-type-circle.lbm-color-harbor-gl.lbm-shadow, .lbm-type-circle.lbm-color-harbor-gl.leaflet-drag-target, .lbm-type-circle.lbm-color-harbor-gl.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(96, 170, 20, 0.28); } - .lbm-type-circle.lbm-color-harbor-gl:before { - box-shadow: 0 0 6px 2px #60AA14; } - + color: #000; +} +.lbm-type-circle.lbm-color-harbor-gl.lbm-transparent { + background-color: rgba(96, 170, 20, 0.7); +} +.lbm-type-circle.lbm-color-harbor-gl.lbm-transparent.lbm-hover:hover { + background-color: rgba(96, 170, 20, 0.9); +} +.lbm-type-circle.lbm-color-harbor-gl.lbm-shadow, .lbm-type-circle.lbm-color-harbor-gl.leaflet-drag-target, .lbm-type-circle.lbm-color-harbor-gl.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(96, 170, 20, 0.28); +} +.lbm-type-circle.lbm-color-harbor-gl:before { + box-shadow: 0 0 6px 2px #60AA14; +} .lbm-type-circle.lbm-border-color-harbor-gl { - border-color: #60AA14; } + border-color: #60AA14; +} .fa-lbm-color-harbor-gl { - color: #60AA14; } + color: #60AA14; +} .fa-lbm-border-color-harbor-gl { - color: #60AA14; } + color: #60AA14; +} .port_icon_adjust { position: relative; - left: -1px; } + left: -1px; +} .fa-normal-dot { position: relative; - font-size: calc(10em/10); - left: calc(10em/10); - top: calc(10em/10); } + font-size: 1em; + left: 1em; + top: 1em; +} .fa-small-dot { position: relative; - font-size: .4em; - left: -.75em; - top: -.5em; } + font-size: 0.4em; + left: -0.75em; + top: -0.5em; +} .fa-normal-square { position: relative; font-size: 7px; left: -2.5px; - top: -2px; } + top: -2px; +} .fa-small-square { position: relative; font-size: 6px; left: -3px; - top: -2px; } + top: -2px; +} -.hl-annotation { +.hl-annotation-colors { color: var(--bs-alert-color); + background-color: var(--bs-alert-bg); +} + +.hl-annotation { border: 1px solid var(--bs-alert-border-color); - background-color: var(--bs-alert-bg); } - .modal-content.modal-extended .hl-annotation { - margin: 0px var(--jsc-scroll-padding) !important; } +} +.modal-content.modal-extended .hl-annotation { + margin: 0px var(--jsc-scroll-padding) !important; +} -.min-width-8em { - min-width: 8em; } +.location-group { + display: flex; + justify-content: center; + flex-wrap: wrap; +} +.location-group > * { + white-space: normal; + text-align: center; +} +.location-group > *:not(:last-child) { + margin-right: 1em !important; +} -.min-width-10em { - min-width: 10em; } - +td.annotation { + background-color: var(--bs-alert-bg); +} /*********************************************** canvas-utilities.scss, @@ -38077,6 +39303,7 @@ to create fa-icon looking like the marker path:focus { outline: none; } +@charset "UTF-8"; /*********************************************** fcoo-maps-colors.scss, @@ -38122,18 +39349,67 @@ to create fa-icon looking like the marker ************************************************/ /********************************* -FCOO-COLORS +FCOO-COLORS-VARIABLES and FCOO-COLORS-MIXIN *********************************/ -/*********************************************** - fcoo-colors-mixin.scss, +/********************************************************** + fcoo-colors-include.scss, - (c) 2021, FCOO + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO + + + Contain all include for a packages using + the scss-variables and scss-mixins of fcoo-colors + + The scss file must also include + + //COLOR-HELPER + @import "../bower_components/sass-color-helpers/stylesheets/color-helpers"; + + //LEAFLET-BOOTSTRAP-MARKER-MIXIN - mixin to create colors for marker (bsMarker) + @import "../bower_components/leaflet-bootstrap-marker-mixin/dist/leaflet-bootstrap-marker-mixin"; + + //LEAFLET-POLYLINE-MIXIN - mixin to create colors for polyline and polygon + @import "../bower_components/leaflet-polyline-mixin/dist/leaflet-polyline-mixin"; + +**********************************************************/ +/********************************************************** + fcoo-colors-variables.scss, https://github.com/FCOO/fcoo-colors https://github.com/FCOO +**********************************************************/ +/********************************************************** +The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf +**********************************************************/ +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +in src/_fcoo-color-mixin.scss +**********************************************************/ +/********************************************************** + fcoo-colors-mixin.scss + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO -************************************************/ +**********************************************************/ +/********************************************************** +Functions to get colors in different (relative) gradients +**********************************************************/ +/********************************************************** +marker-and-polygon-color +create color-classes for bsMarker and bsPolyline +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +**********************************************************/ /********************************* FCOO-MAPS-COLORS-VARIABLES and FCOO-MAPS-COLORS-MIXIN scss-variable with all colors and mixins @@ -38148,10 +39424,6 @@ Create all scss-variable with colors for different fcoo-maps layers COMMON ****************************************************************************/ /**************************************************************************** -TIME -Color to mark a time, button etc. as past, now or future -****************************************************************************/ -/**************************************************************************** SEARCH RESULT Color for search result ****************************************************************************/ @@ -38189,60 +39461,40 @@ Style for search results in fcoo-maps *********************************/ .lbm-type-circle.lbm-color-search-result { background-color: #EC640C; - color: #000; } - .lbm-type-circle.lbm-color-search-result.lbm-transparent { - background-color: rgba(236, 100, 12, 0.7); } - .lbm-type-circle.lbm-color-search-result.lbm-transparent.lbm-hover:hover { - background-color: rgba(236, 100, 12, 0.9); } - .lbm-type-circle.lbm-color-search-result.lbm-shadow, .lbm-type-circle.lbm-color-search-result.leaflet-drag-target, .lbm-type-circle.lbm-color-search-result.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(236, 100, 12, 0.28); } - .lbm-type-circle.lbm-color-search-result:before { - box-shadow: 0 0 6px 2px #EC640C; } - + color: #000; +} +.lbm-type-circle.lbm-color-search-result.lbm-transparent { + background-color: rgba(236, 100, 12, 0.7); +} +.lbm-type-circle.lbm-color-search-result.lbm-transparent.lbm-hover:hover { + background-color: rgba(236, 100, 12, 0.9); +} +.lbm-type-circle.lbm-color-search-result.lbm-shadow, .lbm-type-circle.lbm-color-search-result.leaflet-drag-target, .lbm-type-circle.lbm-color-search-result.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(236, 100, 12, 0.28); +} +.lbm-type-circle.lbm-color-search-result:before { + box-shadow: 0 0 6px 2px #EC640C; +} .lbm-type-circle.lbm-border-color-search-result { - border-color: #EC640C; } + border-color: #EC640C; +} .fa-lbm-color-search-result { - color: #EC640C; } + color: #EC640C; +} .fa-lbm-border-color-search-result { - color: #EC640C; } + color: #EC640C; +} .lpl-base.lpl-search-result { - fill: #EC640C; } + fill: #EC640C; +} .lpl-base.lpl-border-search-result, .lpl-shadow.lpl-border-search-result { - stroke: #EC640C; } - -/********************************* -Style for time -*********************************/ -:root { - --jbn-time-past-color: #7ABAE1; - --jbn-time-past-bg-color: #7ABAE1; - --jbn-time-now-color: darkgreen; - --jbn-time-now-bg-color: lightgreen; - --jbn-time-future-color: #4D72B8; - --jbn-time-future-bg-color: #4D72B8; } - -.time-past-color { - color: var(--jbn-time-past-color, #7ABAE1); } - -.time-past-bg-color { - background-color: var(--jbn-time-past-bg-color, var(--jbn-time-past-color, #7ABAE1)); } - -.time-now-color { - color: var(--jbn-time-now-color, darkgreen); } - -.time-now-bg-color { - background-color: var(--jbn-time-now-bg-color, var(--jbn-time-now-color, darkgreen)); } - -.time-future-color { - color: var(--jbn-time-future-color, #4D72B8); } - -.time-future-bg-color { - background-color: var(--jbn-time-future-bg-color, var(--jbn-time-future-color, #4D72B8)); } + stroke: #EC640C; +} /********************************* FCOO-MAPS-COLORS-OBSERVATIONS @@ -38256,24 +39508,31 @@ Style for fcoo/fcoo-maps-observations ************************************************/ .lbm-type-circle.lbm-color-observations { background-color: #EFB920; - color: #000; } - .lbm-type-circle.lbm-color-observations.lbm-transparent { - background-color: rgba(239, 185, 32, 0.7); } - .lbm-type-circle.lbm-color-observations.lbm-transparent.lbm-hover:hover { - background-color: rgba(239, 185, 32, 0.9); } - .lbm-type-circle.lbm-color-observations.lbm-shadow, .lbm-type-circle.lbm-color-observations.leaflet-drag-target, .lbm-type-circle.lbm-color-observations.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(239, 185, 32, 0.28); } - .lbm-type-circle.lbm-color-observations:before { - box-shadow: 0 0 6px 2px #EFB920; } - + color: #000; +} +.lbm-type-circle.lbm-color-observations.lbm-transparent { + background-color: rgba(239, 185, 32, 0.7); +} +.lbm-type-circle.lbm-color-observations.lbm-transparent.lbm-hover:hover { + background-color: rgba(239, 185, 32, 0.9); +} +.lbm-type-circle.lbm-color-observations.lbm-shadow, .lbm-type-circle.lbm-color-observations.leaflet-drag-target, .lbm-type-circle.lbm-color-observations.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(239, 185, 32, 0.28); +} +.lbm-type-circle.lbm-color-observations:before { + box-shadow: 0 0 6px 2px #EFB920; +} .lbm-type-circle.lbm-border-color-observations { - border-color: #EFB920; } + border-color: #EFB920; +} .fa-lbm-color-observations { - color: #EFB920; } + color: #EFB920; +} .fa-lbm-border-color-observations { - color: #EFB920; } + color: #EFB920; +} /********************************* FCOO-MAPS-COLORS-NIORD-AND-NAVIGATION @@ -38288,118 +39547,162 @@ Create the style for the four different domains ************************************************/ .lbm-type-circle.lbm-color-niord-fa { background-color: white; - color: #000; } - .lbm-type-circle.lbm-color-niord-fa.lbm-transparent { - background-color: rgba(255, 255, 255, 0.7); } - .lbm-type-circle.lbm-color-niord-fa.lbm-transparent.lbm-hover:hover { - background-color: rgba(255, 255, 255, 0.9); } - .lbm-type-circle.lbm-color-niord-fa.lbm-shadow, .lbm-type-circle.lbm-color-niord-fa.leaflet-drag-target, .lbm-type-circle.lbm-color-niord-fa.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(255, 255, 255, 0.28); } - .lbm-type-circle.lbm-color-niord-fa:before { - box-shadow: 0 0 6px 2px white; } - + color: #000; +} +.lbm-type-circle.lbm-color-niord-fa.lbm-transparent { + background-color: rgba(255, 255, 255, 0.7); +} +.lbm-type-circle.lbm-color-niord-fa.lbm-transparent.lbm-hover:hover { + background-color: rgba(255, 255, 255, 0.9); +} +.lbm-type-circle.lbm-color-niord-fa.lbm-shadow, .lbm-type-circle.lbm-color-niord-fa.leaflet-drag-target, .lbm-type-circle.lbm-color-niord-fa.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(255, 255, 255, 0.28); +} +.lbm-type-circle.lbm-color-niord-fa:before { + box-shadow: 0 0 6px 2px white; +} .lbm-type-circle.lbm-border-color-niord-fa { - border-color: #7c0043; } + border-color: #7c0043; +} .fa-lbm-color-niord-fa { - color: white; } + color: white; +} .fa-lbm-border-color-niord-fa { - color: #7c0043; } + color: #7c0043; +} .lpl-base.lpl-niord-fa { - fill: white; } + fill: white; +} .lpl-base.lpl-border-niord-fa, .lpl-shadow.lpl-border-niord-fa { - stroke: #7c0043; } + stroke: #7c0043; +} .lbm-type-circle.lbm-color-niord-nm { background-color: white; - color: #000; } - .lbm-type-circle.lbm-color-niord-nm.lbm-transparent { - background-color: rgba(255, 255, 255, 0.7); } - .lbm-type-circle.lbm-color-niord-nm.lbm-transparent.lbm-hover:hover { - background-color: rgba(255, 255, 255, 0.9); } - .lbm-type-circle.lbm-color-niord-nm.lbm-shadow, .lbm-type-circle.lbm-color-niord-nm.leaflet-drag-target, .lbm-type-circle.lbm-color-niord-nm.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(255, 255, 255, 0.28); } - .lbm-type-circle.lbm-color-niord-nm:before { - box-shadow: 0 0 6px 2px white; } - + color: #000; +} +.lbm-type-circle.lbm-color-niord-nm.lbm-transparent { + background-color: rgba(255, 255, 255, 0.7); +} +.lbm-type-circle.lbm-color-niord-nm.lbm-transparent.lbm-hover:hover { + background-color: rgba(255, 255, 255, 0.9); +} +.lbm-type-circle.lbm-color-niord-nm.lbm-shadow, .lbm-type-circle.lbm-color-niord-nm.leaflet-drag-target, .lbm-type-circle.lbm-color-niord-nm.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(255, 255, 255, 0.28); +} +.lbm-type-circle.lbm-color-niord-nm:before { + box-shadow: 0 0 6px 2px white; +} .lbm-type-circle.lbm-border-color-niord-nm { - border-color: #7c0043; } + border-color: #7c0043; +} .fa-lbm-color-niord-nm { - color: white; } + color: white; +} .fa-lbm-border-color-niord-nm { - color: #7c0043; } + color: #7c0043; +} .lpl-base.lpl-niord-nm { - fill: white; } + fill: white; +} .lpl-base.lpl-border-niord-nm, .lpl-shadow.lpl-border-niord-nm { - stroke: #7c0043; } + stroke: #7c0043; +} .lbm-type-circle.lbm-color-niord-nw { background-color: #E2007A; - color: #fff; } - .lbm-type-circle.lbm-color-niord-nw.lbm-transparent { - background-color: rgba(226, 0, 122, 0.7); } - .lbm-type-circle.lbm-color-niord-nw.lbm-transparent.lbm-hover:hover { - background-color: rgba(226, 0, 122, 0.9); } - .lbm-type-circle.lbm-color-niord-nw.lbm-shadow, .lbm-type-circle.lbm-color-niord-nw.leaflet-drag-target, .lbm-type-circle.lbm-color-niord-nw.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(226, 0, 122, 0.28); } - .lbm-type-circle.lbm-color-niord-nw:before { - box-shadow: 0 0 6px 2px #E2007A; } - + color: #fff; +} +.lbm-type-circle.lbm-color-niord-nw.lbm-transparent { + background-color: rgba(226, 0, 122, 0.7); +} +.lbm-type-circle.lbm-color-niord-nw.lbm-transparent.lbm-hover:hover { + background-color: rgba(226, 0, 122, 0.9); +} +.lbm-type-circle.lbm-color-niord-nw.lbm-shadow, .lbm-type-circle.lbm-color-niord-nw.leaflet-drag-target, .lbm-type-circle.lbm-color-niord-nw.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(226, 0, 122, 0.28); +} +.lbm-type-circle.lbm-color-niord-nw:before { + box-shadow: 0 0 6px 2px #E2007A; +} .lbm-type-circle.lbm-border-color-niord-nw { - border-color: #7c0043; } + border-color: #7c0043; +} .fa-lbm-color-niord-nw { - color: #E2007A; } + color: #E2007A; +} .fa-lbm-border-color-niord-nw { - color: #7c0043; } + color: #7c0043; +} .lpl-base.lpl-niord-nw { - fill: #E2007A; } + fill: #E2007A; +} .lpl-base.lpl-border-niord-nw, .lpl-shadow.lpl-border-niord-nw { - stroke: #7c0043; } + stroke: #7c0043; +} .lbm-type-circle.lbm-color-niord-fe { background-color: #E2007A; - color: #fff; } - .lbm-type-circle.lbm-color-niord-fe.lbm-transparent { - background-color: rgba(226, 0, 122, 0.7); } - .lbm-type-circle.lbm-color-niord-fe.lbm-transparent.lbm-hover:hover { - background-color: rgba(226, 0, 122, 0.9); } - .lbm-type-circle.lbm-color-niord-fe.lbm-shadow, .lbm-type-circle.lbm-color-niord-fe.leaflet-drag-target, .lbm-type-circle.lbm-color-niord-fe.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(226, 0, 122, 0.28); } - .lbm-type-circle.lbm-color-niord-fe:before { - box-shadow: 0 0 6px 2px #E2007A; } - + color: #fff; +} +.lbm-type-circle.lbm-color-niord-fe.lbm-transparent { + background-color: rgba(226, 0, 122, 0.7); +} +.lbm-type-circle.lbm-color-niord-fe.lbm-transparent.lbm-hover:hover { + background-color: rgba(226, 0, 122, 0.9); +} +.lbm-type-circle.lbm-color-niord-fe.lbm-shadow, .lbm-type-circle.lbm-color-niord-fe.leaflet-drag-target, .lbm-type-circle.lbm-color-niord-fe.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(226, 0, 122, 0.28); +} +.lbm-type-circle.lbm-color-niord-fe:before { + box-shadow: 0 0 6px 2px #E2007A; +} .lbm-type-circle.lbm-border-color-niord-fe { - border-color: #7c0043; } + border-color: #7c0043; +} .fa-lbm-color-niord-fe { - color: #E2007A; } + color: #E2007A; +} .fa-lbm-border-color-niord-fe { - color: #7c0043; } + color: #7c0043; +} .lpl-base.lpl-niord-fe { - fill: #E2007A; } + fill: #E2007A; +} .lpl-base.lpl-border-niord-fe, .lpl-shadow.lpl-border-niord-fe { - stroke: #7c0043; } + stroke: #7c0043; +} .fa-navigation { - color: #E5238C; } + color: #E5238C; +} + +:root { + --jbn-time-past-color: var(--fc-time-past-color); + --jbn-time-now-color: var(--fc-time-now-color); + --jbn-time-now-text-color: var(--fc-time-now-text-color) + --jbn-time-future-color : var(--fc-time-future-color) ; +} /********************************* FCOO-MAPS-COLORS-HAVNELODS @@ -38413,45 +39716,59 @@ Style for fcoo/fcoo-maps-havnelods ************************************************/ .lbm-type-circle.lbm-color-harbor-dk { background-color: #7CB82F; - color: #000; } - .lbm-type-circle.lbm-color-harbor-dk.lbm-transparent { - background-color: rgba(124, 184, 47, 0.7); } - .lbm-type-circle.lbm-color-harbor-dk.lbm-transparent.lbm-hover:hover { - background-color: rgba(124, 184, 47, 0.9); } - .lbm-type-circle.lbm-color-harbor-dk.lbm-shadow, .lbm-type-circle.lbm-color-harbor-dk.leaflet-drag-target, .lbm-type-circle.lbm-color-harbor-dk.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(124, 184, 47, 0.28); } - .lbm-type-circle.lbm-color-harbor-dk:before { - box-shadow: 0 0 6px 2px #7CB82F; } - + color: #000; +} +.lbm-type-circle.lbm-color-harbor-dk.lbm-transparent { + background-color: rgba(124, 184, 47, 0.7); +} +.lbm-type-circle.lbm-color-harbor-dk.lbm-transparent.lbm-hover:hover { + background-color: rgba(124, 184, 47, 0.9); +} +.lbm-type-circle.lbm-color-harbor-dk.lbm-shadow, .lbm-type-circle.lbm-color-harbor-dk.leaflet-drag-target, .lbm-type-circle.lbm-color-harbor-dk.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(124, 184, 47, 0.28); +} +.lbm-type-circle.lbm-color-harbor-dk:before { + box-shadow: 0 0 6px 2px #7CB82F; +} .lbm-type-circle.lbm-border-color-harbor-dk { - border-color: #7CB82F; } + border-color: #7CB82F; +} .fa-lbm-color-harbor-dk { - color: #7CB82F; } + color: #7CB82F; +} .fa-lbm-border-color-harbor-dk { - color: #7CB82F; } + color: #7CB82F; +} .lbm-type-circle.lbm-color-harbor-gl { background-color: #60AA14; - color: #000; } - .lbm-type-circle.lbm-color-harbor-gl.lbm-transparent { - background-color: rgba(96, 170, 20, 0.7); } - .lbm-type-circle.lbm-color-harbor-gl.lbm-transparent.lbm-hover:hover { - background-color: rgba(96, 170, 20, 0.9); } - .lbm-type-circle.lbm-color-harbor-gl.lbm-shadow, .lbm-type-circle.lbm-color-harbor-gl.leaflet-drag-target, .lbm-type-circle.lbm-color-harbor-gl.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(96, 170, 20, 0.28); } - .lbm-type-circle.lbm-color-harbor-gl:before { - box-shadow: 0 0 6px 2px #60AA14; } - + color: #000; +} +.lbm-type-circle.lbm-color-harbor-gl.lbm-transparent { + background-color: rgba(96, 170, 20, 0.7); +} +.lbm-type-circle.lbm-color-harbor-gl.lbm-transparent.lbm-hover:hover { + background-color: rgba(96, 170, 20, 0.9); +} +.lbm-type-circle.lbm-color-harbor-gl.lbm-shadow, .lbm-type-circle.lbm-color-harbor-gl.leaflet-drag-target, .lbm-type-circle.lbm-color-harbor-gl.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(96, 170, 20, 0.28); +} +.lbm-type-circle.lbm-color-harbor-gl:before { + box-shadow: 0 0 6px 2px #60AA14; +} .lbm-type-circle.lbm-border-color-harbor-gl { - border-color: #60AA14; } + border-color: #60AA14; +} .fa-lbm-color-harbor-gl { - color: #60AA14; } + color: #60AA14; +} .fa-lbm-border-color-harbor-gl { - color: #60AA14; } + color: #60AA14; +} /********************************* FCOO-MAPS-COLORS-YOUR-POSITION @@ -38465,46 +39782,59 @@ Style for fcoo/fcoo-maps-your-position ************************************************/ .lbm-type-circle.lbm-color-your-position { background-color: #4285F4; - color: #000; } - .lbm-type-circle.lbm-color-your-position.lbm-transparent { - background-color: rgba(66, 133, 244, 0.7); } - .lbm-type-circle.lbm-color-your-position.lbm-transparent.lbm-hover:hover { - background-color: rgba(66, 133, 244, 0.9); } - .lbm-type-circle.lbm-color-your-position.lbm-shadow, .lbm-type-circle.lbm-color-your-position.leaflet-drag-target, .lbm-type-circle.lbm-color-your-position.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(66, 133, 244, 0.28); } - .lbm-type-circle.lbm-color-your-position:before { - box-shadow: 0 0 6px 2px #4285F4; } - + color: #000; +} +.lbm-type-circle.lbm-color-your-position.lbm-transparent { + background-color: rgba(66, 133, 244, 0.7); +} +.lbm-type-circle.lbm-color-your-position.lbm-transparent.lbm-hover:hover { + background-color: rgba(66, 133, 244, 0.9); +} +.lbm-type-circle.lbm-color-your-position.lbm-shadow, .lbm-type-circle.lbm-color-your-position.leaflet-drag-target, .lbm-type-circle.lbm-color-your-position.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(66, 133, 244, 0.28); +} +.lbm-type-circle.lbm-color-your-position:before { + box-shadow: 0 0 6px 2px #4285F4; +} .lbm-type-circle.lbm-border-color-your-position { - border-color: #4285F4; } + border-color: #4285F4; +} .fa-lbm-color-your-position { - color: #4285F4; } + color: #4285F4; +} .fa-lbm-border-color-your-position { - color: #4285F4; } + color: #4285F4; +} .lbm-type-circle.lbm-color-your-position-follow { background-color: #0b51c5; - color: #fff; } - .lbm-type-circle.lbm-color-your-position-follow.lbm-transparent { - background-color: rgba(11, 81, 197, 0.7); } - .lbm-type-circle.lbm-color-your-position-follow.lbm-transparent.lbm-hover:hover { - background-color: rgba(11, 81, 197, 0.9); } - .lbm-type-circle.lbm-color-your-position-follow.lbm-shadow, .lbm-type-circle.lbm-color-your-position-follow.leaflet-drag-target, .lbm-type-circle.lbm-color-your-position-follow.lbm-hover:hover { - box-shadow: 0px 0px 0px 5px rgba(11, 81, 197, 0.28); } - .lbm-type-circle.lbm-color-your-position-follow:before { - box-shadow: 0 0 6px 2px #0b51c5; } - + color: #fff; +} +.lbm-type-circle.lbm-color-your-position-follow.lbm-transparent { + background-color: rgba(11, 81, 197, 0.7); +} +.lbm-type-circle.lbm-color-your-position-follow.lbm-transparent.lbm-hover:hover { + background-color: rgba(11, 81, 197, 0.9); +} +.lbm-type-circle.lbm-color-your-position-follow.lbm-shadow, .lbm-type-circle.lbm-color-your-position-follow.leaflet-drag-target, .lbm-type-circle.lbm-color-your-position-follow.lbm-hover:hover { + box-shadow: 0px 0px 0px 5px rgba(11, 81, 197, 0.28); +} +.lbm-type-circle.lbm-color-your-position-follow:before { + box-shadow: 0 0 6px 2px #0b51c5; +} .lbm-type-circle.lbm-border-color-your-position-follow { - border-color: #0b51c5; } + border-color: #0b51c5; +} .fa-lbm-color-your-position-follow { - color: #0b51c5; } + color: #0b51c5; +} .fa-lbm-border-color-your-position-follow { - color: #0b51c5; } - + color: #0b51c5; +} /*********************************************** leaflet-marker-vessel.scss, @@ -39780,7 +41110,8 @@ jquery-scroll-container-variables.scss :root { --jsc-scroll-size: 10px; --jsc-scroll-padding: 10px; - --jsc-scroll-auto-padding: 10px; } + --jsc-scroll-auto-padding: 10px; +} /************************************************************ VARIABLES @@ -39799,7 +41130,7 @@ Modal ************************************************/ /*********************************************** Button And Modal -Opacity for semi-transparent and transparent content +Opacity for semi-transparent and transparent content using color-mix ************************************************/ /************************************************************ MIXIN @@ -39833,74 +41164,91 @@ Adjust text-, border-, and background-color for a button LEAFLET MAPS **********************************************************/ html, body { - height: 100%; } + height: 100%; +} body { padding: 0; - margin: 0; } + margin: 0; +} #map { - height: 100%; } + height: 100%; +} body .leaflet-grab { - cursor: default; } - + cursor: default; +} body.leaflet-dragging .leaflet-grab, body.leaflet-dragging .leaflet-grab .leaflet-interactive, body.leaflet-dragging .leaflet-marker-draggable { - cursor: move; } + cursor: move; +} /********************************************************** DIVERSE **********************************************************/ .font-size-1-2rem { - font-size: 1.2rem !important; } + font-size: 1.2rem !important; +} .transform-scale-0-5 { - transform: scale(0.5); } + transform: scale(0.5); +} .transform-scale-0-65 { - transform: scale(0.65); } + transform: scale(0.65); +} .transform-scale-1-2 { - transform: scale(1.2); } + transform: scale(1.2); +} .transform-scale-1-5 { - transform: scale(1.5); } + transform: scale(1.5); +} .icon-active { - color: #0d6efd; } + color: #0d6efd; +} /********************************************************** POPUP **********************************************************/ .popover { --jb-header-color: var(--fcoo-app-text-color-50); - --jb-header-bg: var(--fcoo-app-bg-color-50); } + --jb-header-bg: var(--fcoo-app-bg-color-50); +} /**************************************************************************** Style for edit settings for graticule ****************************************************************************/ .graticule-label .hide-for-graticule-label { - display: none !important; } + display: none !important; +} .no-graticule-label .show-for-graticule-label { - display: none !important; } + display: none !important; +} /********************************************************** HIDE/SHOW WHEN SINGLE OR MULTI-MAPS SELECTED **********************************************************/ .multi-maps-selected .hide-for-multi-maps-selected { - display: none !important; } + display: none !important; +} .no-multi-maps-selected .show-for-multi-maps-selected { - display: none !important; } + display: none !important; +} .single-maps-selected .hide-for-single-maps-selected { - display: none !important; } + display: none !important; +} .no-single-maps-selected .show-for-single-maps-selected { - display: none !important; } + display: none !important; +} /********************************************************** EDIT MULTI MAPS SETTINGS @@ -39912,54 +41260,67 @@ EDIT MULTI MAPS SETTINGS text-align: center; padding: 0; font-size: 137.5px; - height: 115.5px; } - .multi-maps-current i { - position: relative; - width: 100%; - top: -11px; } + height: 115.5px; +} +.multi-maps-current i { + position: relative; + width: 100%; + top: -11px; +} /********************************************************** EDIT SYNC MAPS SETTINGS **********************************************************/ .text-multi-maps-current { - color: #ff7800; } + color: #ff7800; +} .bg-multi-maps-current { - background-color: #ff7800; } + background-color: #ff7800; +} .text-multi-maps-main { - color: #3216B0; } + color: #3216B0; +} .bg-multi-maps-main { - background-color: #3216B0; } + background-color: #3216B0; +} .border-multi-maps-main { - border: 1px solid #3216B0 !important; } + border: 1px solid #3216B0 !important; +} .map-sync-zoom-offset { - margin: auto; } - .map-sync-zoom-offset .multi-map-container .outline { - display: none; } - .map-sync-zoom-offset .multi-map-container.current-map { - display: flex !important; - align-items: center; - justify-content: center; - background-color: #ff7800; } - .map-sync-zoom-offset .multi-map-container.current-map .outline { - display: block; - border: 2px dotted #3216B0; - width: 50%; - height: 50%; } - .map-sync-zoom-offset .multi-map-container.main-map { - display: flex !important; - align-items: center; - justify-content: center; - border: 3px solid #3216B0 !important; } - .map-sync-zoom-offset .multi-map-container.main-map .outline { - display: block; - border: 2px dotted #ff7800; - width: 50%; - height: 50%; } + margin: auto; +} +.map-sync-zoom-offset .multi-map-container .outline { + display: none; +} +.map-sync-zoom-offset .multi-map-container.current-map { + display: flex !important; + align-items: center; + justify-content: center; + background-color: #ff7800; +} +.map-sync-zoom-offset .multi-map-container.current-map .outline { + display: block; + border: 2px dotted #3216B0; + width: 50%; + height: 50%; +} +.map-sync-zoom-offset .multi-map-container.main-map { + display: flex !important; + align-items: center; + justify-content: center; + border: 3px solid #3216B0 !important; +} +.map-sync-zoom-offset .multi-map-container.main-map .outline { + display: block; + border: 2px dotted #ff7800; + width: 50%; + height: 50%; +} /********************************************************** EDIT BACKGROUND MAP SETTINGS @@ -39967,16 +41328,20 @@ EDIT BACKGROUND MAP SETTINGS .background-image-container { margin: auto; width: 220px; - height: 50px; } - .background-image-container img { - width: 220px; - height: 50px; } - .background-image-container img:not(:first-child) { - margin-top: -50px; } - .background-image-container img.coastline { - border: 1px solid black; - position: relative; - z-index: 10; } + height: 50px; +} +.background-image-container img { + width: 220px; + height: 50px; +} +.background-image-container img:not(:first-child) { + margin-top: -50px; +} +.background-image-container img.coastline { + border: 1px solid black; + position: relative; + z-index: 10; +} /********************************************************** STYLE FOR ICONS IN BUTTONS @@ -39985,15 +41350,17 @@ Each of the sub-icons may need a individual class to adjust size and position **********************************************************/ .fa-sync-small-right-bottom { position: relative; - right: calc(-5em / 16); - bottom: calc(-7em / 16); - font-size: .9em; } + right: -0.3125em; + bottom: -0.4375em; + font-size: 0.9em; +} .fa-tally-small-right-bottom { position: relative; - right: calc(-3em / 16); - bottom: calc(-7em / 16); - font-size: .85em; } + right: -0.1875em; + bottom: -0.4375em; + font-size: 0.85em; +} /********************************************************** STYLE FOR SEARCH RESULTS @@ -40001,620 +41368,724 @@ STYLE FOR SEARCH RESULTS .search-result-row { display: flex; flex-direction: row; - align-items: baseline; } - .search-result-row .search-result-type { - font-size: .65625rem; - text-transform: capitalize; } - .search-result-row .search-result-name { - white-space: normal !important; - font-weight: 500; - font-size: 1.1em; } - .search-result-row .search-result-display { - white-space: normal !important; - font-size: .85em; } + align-items: baseline; +} +.search-result-row .search-result-type { + font-size: 0.65625rem; + text-transform: capitalize; +} +.search-result-row .search-result-name { + white-space: normal !important; + font-weight: 500; + font-size: 1.1em; +} +.search-result-row .search-result-display { + white-space: normal !important; + font-size: 0.85em; +} /********************************************************** ZOOM MODERNIZR https://github.com/fcoo/leaflet-zoom-modernizr **********************************************************/ .leaflet-zoom-3 .show-for-leaflet-zoom-3 { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-3 .hide-for-leaflet-zoom-3 { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-3 .hide-for-leaflet-zoom-3 { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-3 .show-for-leaflet-zoom-3 { - display: none !important; } + display: none !important; +} .leaflet-zoom-3-up .show-for-leaflet-zoom-3-up { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-3-up .hide-for-leaflet-zoom-3-up { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-3-up .hide-for-leaflet-zoom-3-up { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-3-up .show-for-leaflet-zoom-3-up { - display: none !important; } + display: none !important; +} .leaflet-zoom-3-down .show-for-leaflet-zoom-3-down { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-3-down .hide-for-leaflet-zoom-3-down { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-3-down .hide-for-leaflet-zoom-3-down { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-3-down .show-for-leaflet-zoom-3-down { - display: none !important; } + display: none !important; +} .leaflet-zoom-4 .show-for-leaflet-zoom-4 { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-4 .hide-for-leaflet-zoom-4 { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-4 .hide-for-leaflet-zoom-4 { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-4 .show-for-leaflet-zoom-4 { - display: none !important; } + display: none !important; +} .leaflet-zoom-4-up .show-for-leaflet-zoom-4-up { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-4-up .hide-for-leaflet-zoom-4-up { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-4-up .hide-for-leaflet-zoom-4-up { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-4-up .show-for-leaflet-zoom-4-up { - display: none !important; } + display: none !important; +} .leaflet-zoom-4-down .show-for-leaflet-zoom-4-down { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-4-down .hide-for-leaflet-zoom-4-down { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-4-down .hide-for-leaflet-zoom-4-down { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-4-down .show-for-leaflet-zoom-4-down { - display: none !important; } + display: none !important; +} .leaflet-zoom-5 .show-for-leaflet-zoom-5 { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-5 .hide-for-leaflet-zoom-5 { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-5 .hide-for-leaflet-zoom-5 { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-5 .show-for-leaflet-zoom-5 { - display: none !important; } + display: none !important; +} .leaflet-zoom-5-up .show-for-leaflet-zoom-5-up { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-5-up .hide-for-leaflet-zoom-5-up { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-5-up .hide-for-leaflet-zoom-5-up { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-5-up .show-for-leaflet-zoom-5-up { - display: none !important; } + display: none !important; +} .leaflet-zoom-5-down .show-for-leaflet-zoom-5-down { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-5-down .hide-for-leaflet-zoom-5-down { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-5-down .hide-for-leaflet-zoom-5-down { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-5-down .show-for-leaflet-zoom-5-down { - display: none !important; } + display: none !important; +} .leaflet-zoom-6 .show-for-leaflet-zoom-6 { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-6 .hide-for-leaflet-zoom-6 { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-6 .hide-for-leaflet-zoom-6 { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-6 .show-for-leaflet-zoom-6 { - display: none !important; } + display: none !important; +} .leaflet-zoom-6-up .show-for-leaflet-zoom-6-up { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-6-up .hide-for-leaflet-zoom-6-up { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-6-up .hide-for-leaflet-zoom-6-up { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-6-up .show-for-leaflet-zoom-6-up { - display: none !important; } + display: none !important; +} .leaflet-zoom-6-down .show-for-leaflet-zoom-6-down { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-6-down .hide-for-leaflet-zoom-6-down { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-6-down .hide-for-leaflet-zoom-6-down { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-6-down .show-for-leaflet-zoom-6-down { - display: none !important; } + display: none !important; +} .leaflet-zoom-7 .show-for-leaflet-zoom-7 { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-7 .hide-for-leaflet-zoom-7 { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-7 .hide-for-leaflet-zoom-7 { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-7 .show-for-leaflet-zoom-7 { - display: none !important; } + display: none !important; +} .leaflet-zoom-7-up .show-for-leaflet-zoom-7-up { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-7-up .hide-for-leaflet-zoom-7-up { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-7-up .hide-for-leaflet-zoom-7-up { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-7-up .show-for-leaflet-zoom-7-up { - display: none !important; } + display: none !important; +} .leaflet-zoom-7-down .show-for-leaflet-zoom-7-down { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-7-down .hide-for-leaflet-zoom-7-down { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-7-down .hide-for-leaflet-zoom-7-down { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-7-down .show-for-leaflet-zoom-7-down { - display: none !important; } + display: none !important; +} .leaflet-zoom-8 .show-for-leaflet-zoom-8 { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-8 .hide-for-leaflet-zoom-8 { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-8 .hide-for-leaflet-zoom-8 { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-8 .show-for-leaflet-zoom-8 { - display: none !important; } + display: none !important; +} .leaflet-zoom-8-up .show-for-leaflet-zoom-8-up { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-8-up .hide-for-leaflet-zoom-8-up { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-8-up .hide-for-leaflet-zoom-8-up { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-8-up .show-for-leaflet-zoom-8-up { - display: none !important; } + display: none !important; +} .leaflet-zoom-8-down .show-for-leaflet-zoom-8-down { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-8-down .hide-for-leaflet-zoom-8-down { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-8-down .hide-for-leaflet-zoom-8-down { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-8-down .show-for-leaflet-zoom-8-down { - display: none !important; } + display: none !important; +} .leaflet-zoom-9 .show-for-leaflet-zoom-9 { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-9 .hide-for-leaflet-zoom-9 { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-9 .hide-for-leaflet-zoom-9 { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-9 .show-for-leaflet-zoom-9 { - display: none !important; } + display: none !important; +} .leaflet-zoom-9-up .show-for-leaflet-zoom-9-up { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-9-up .hide-for-leaflet-zoom-9-up { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-9-up .hide-for-leaflet-zoom-9-up { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-9-up .show-for-leaflet-zoom-9-up { - display: none !important; } + display: none !important; +} .leaflet-zoom-9-down .show-for-leaflet-zoom-9-down { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-9-down .hide-for-leaflet-zoom-9-down { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-9-down .hide-for-leaflet-zoom-9-down { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-9-down .show-for-leaflet-zoom-9-down { - display: none !important; } + display: none !important; +} .leaflet-zoom-10 .show-for-leaflet-zoom-10 { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-10 .hide-for-leaflet-zoom-10 { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-10 .hide-for-leaflet-zoom-10 { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-10 .show-for-leaflet-zoom-10 { - display: none !important; } + display: none !important; +} .leaflet-zoom-10-up .show-for-leaflet-zoom-10-up { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-10-up .hide-for-leaflet-zoom-10-up { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-10-up .hide-for-leaflet-zoom-10-up { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-10-up .show-for-leaflet-zoom-10-up { - display: none !important; } + display: none !important; +} .leaflet-zoom-10-down .show-for-leaflet-zoom-10-down { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-10-down .hide-for-leaflet-zoom-10-down { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-10-down .hide-for-leaflet-zoom-10-down { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-10-down .show-for-leaflet-zoom-10-down { - display: none !important; } + display: none !important; +} .leaflet-zoom-11 .show-for-leaflet-zoom-11 { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-11 .hide-for-leaflet-zoom-11 { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-11 .hide-for-leaflet-zoom-11 { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-11 .show-for-leaflet-zoom-11 { - display: none !important; } + display: none !important; +} .leaflet-zoom-11-up .show-for-leaflet-zoom-11-up { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-11-up .hide-for-leaflet-zoom-11-up { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-11-up .hide-for-leaflet-zoom-11-up { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-11-up .show-for-leaflet-zoom-11-up { - display: none !important; } + display: none !important; +} .leaflet-zoom-11-down .show-for-leaflet-zoom-11-down { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-11-down .hide-for-leaflet-zoom-11-down { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-11-down .hide-for-leaflet-zoom-11-down { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-11-down .show-for-leaflet-zoom-11-down { - display: none !important; } + display: none !important; +} .leaflet-zoom-12 .show-for-leaflet-zoom-12 { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-12 .hide-for-leaflet-zoom-12 { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-12 .hide-for-leaflet-zoom-12 { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-12 .show-for-leaflet-zoom-12 { - display: none !important; } + display: none !important; +} .leaflet-zoom-12-up .show-for-leaflet-zoom-12-up { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-12-up .hide-for-leaflet-zoom-12-up { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-12-up .hide-for-leaflet-zoom-12-up { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-12-up .show-for-leaflet-zoom-12-up { - display: none !important; } + display: none !important; +} .leaflet-zoom-12-down .show-for-leaflet-zoom-12-down { - display: initial !important; } - + display: initial !important; +} .leaflet-zoom-12-down .hide-for-leaflet-zoom-12-down { - display: none !important; } + display: none !important; +} .no-leaflet-zoom-12-down .hide-for-leaflet-zoom-12-down { - display: initial !important; } - + display: initial !important; +} .no-leaflet-zoom-12-down .show-for-leaflet-zoom-12-down { - display: none !important; } + display: none !important; +} .leaflet-zoom-3-up .show-for-leaflet-zoom-3-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-3-up .hide-for-leaflet-zoom-3-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-3-up .hide-for-leaflet-zoom-3-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-3-up .show-for-leaflet-zoom-3-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-3-down .show-for-leaflet-zoom-3-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-3-down .hide-for-leaflet-zoom-3-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-3-down .hide-for-leaflet-zoom-3-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-3-down .show-for-leaflet-zoom-3-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-4-up .show-for-leaflet-zoom-4-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-4-up .hide-for-leaflet-zoom-4-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-4-up .hide-for-leaflet-zoom-4-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-4-up .show-for-leaflet-zoom-4-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-4-down .show-for-leaflet-zoom-4-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-4-down .hide-for-leaflet-zoom-4-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-4-down .hide-for-leaflet-zoom-4-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-4-down .show-for-leaflet-zoom-4-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-5-up .show-for-leaflet-zoom-5-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-5-up .hide-for-leaflet-zoom-5-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-5-up .hide-for-leaflet-zoom-5-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-5-up .show-for-leaflet-zoom-5-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-5-down .show-for-leaflet-zoom-5-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-5-down .hide-for-leaflet-zoom-5-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-5-down .hide-for-leaflet-zoom-5-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-5-down .show-for-leaflet-zoom-5-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-6-up .show-for-leaflet-zoom-6-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-6-up .hide-for-leaflet-zoom-6-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-6-up .hide-for-leaflet-zoom-6-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-6-up .show-for-leaflet-zoom-6-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-6-down .show-for-leaflet-zoom-6-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-6-down .hide-for-leaflet-zoom-6-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-6-down .hide-for-leaflet-zoom-6-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-6-down .show-for-leaflet-zoom-6-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-7-up .show-for-leaflet-zoom-7-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-7-up .hide-for-leaflet-zoom-7-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-7-up .hide-for-leaflet-zoom-7-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-7-up .show-for-leaflet-zoom-7-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-7-down .show-for-leaflet-zoom-7-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-7-down .hide-for-leaflet-zoom-7-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-7-down .hide-for-leaflet-zoom-7-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-7-down .show-for-leaflet-zoom-7-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-8-up .show-for-leaflet-zoom-8-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-8-up .hide-for-leaflet-zoom-8-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-8-up .hide-for-leaflet-zoom-8-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-8-up .show-for-leaflet-zoom-8-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-8-down .show-for-leaflet-zoom-8-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-8-down .hide-for-leaflet-zoom-8-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-8-down .hide-for-leaflet-zoom-8-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-8-down .show-for-leaflet-zoom-8-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-9-up .show-for-leaflet-zoom-9-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-9-up .hide-for-leaflet-zoom-9-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-9-up .hide-for-leaflet-zoom-9-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-9-up .show-for-leaflet-zoom-9-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-9-down .show-for-leaflet-zoom-9-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-9-down .hide-for-leaflet-zoom-9-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-9-down .hide-for-leaflet-zoom-9-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-9-down .show-for-leaflet-zoom-9-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-10-up .show-for-leaflet-zoom-10-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-10-up .hide-for-leaflet-zoom-10-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-10-up .hide-for-leaflet-zoom-10-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-10-up .show-for-leaflet-zoom-10-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-10-down .show-for-leaflet-zoom-10-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-10-down .hide-for-leaflet-zoom-10-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-10-down .hide-for-leaflet-zoom-10-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-10-down .show-for-leaflet-zoom-10-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-11-up .show-for-leaflet-zoom-11-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-11-up .hide-for-leaflet-zoom-11-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-11-up .hide-for-leaflet-zoom-11-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-11-up .show-for-leaflet-zoom-11-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-11-down .show-for-leaflet-zoom-11-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-11-down .hide-for-leaflet-zoom-11-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-11-down .hide-for-leaflet-zoom-11-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-11-down .show-for-leaflet-zoom-11-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-12-up .show-for-leaflet-zoom-12-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-12-up .hide-for-leaflet-zoom-12-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-12-up .hide-for-leaflet-zoom-12-up-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-12-up .show-for-leaflet-zoom-12-up-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .leaflet-zoom-12-down .show-for-leaflet-zoom-12-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .leaflet-zoom-12-down .hide-for-leaflet-zoom-12-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} .no-leaflet-zoom-12-down .hide-for-leaflet-zoom-12-down-visibility { - visibility: initial !important; } - + visibility: initial !important; +} .no-leaflet-zoom-12-down .show-for-leaflet-zoom-12-down-visibility { - visibility: hidden !important; } + visibility: hidden !important; +} /********************************************************** POSITION-CONTROL @@ -40626,60 +42097,73 @@ when loading or not visible **********************************************************/ .no-bsPosition-on-land .show-for-bsPosition-on-land, .no-bsPosition-on-water .show-for-bsPosition-on-water { - display: none !important; } + display: none !important; +} .bsp-color-info-outer { height: 4em; display: flex; - padding: 0; } - .bsp-color-info-outer *.header { - color: initial; } - .bsp-color-info-outer .bsp-color-info-outer-container { - height: 100%; - width: 100%; } - .bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header { - flex-shrink: 0; - flex-grow: 0; - text-align: center; - border: none; } - .bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-sm { - --bs-modal-content-font-size: 0.875rem; - --bs-modal-padding-x: 0.25rem; - --bs-modal-padding-y: 0.25rem; - --bs-modal-padding: 0.25rem; } - .bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-sm .header-content { - --bs-modal-header-padding-x: 0.25rem; - --bs-modal-header-padding-y: 0.25rem; - --bs-modal-header-padding: 0.25rem; } - .bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-sm .footer-content { - --bs-footer-font-size: 0.75rem; - --bs-footer-padding-y: 0.25rem; - --bs-footer-padding-x: 0.25rem; } - .bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-xs { - --bs-modal-content-font-size: 0.75rem; - --bs-modal-padding-x: 0.125rem; - --bs-modal-padding-y: 0.125rem; - --bs-modal-padding: 0.125rem; } - .bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-xs .header-content { - --bs-modal-header-padding-x: 0.125rem; - --bs-modal-header-padding-y: 0.125rem; - --bs-modal-header-padding: 0.125rem; } - .bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-xs .footer-content { - --bs-footer-font-size: 0.6875rem; - --bs-footer-padding-y: 0.125rem; - --bs-footer-padding-x: 0.125rem; } + padding: 0; +} +.bsp-color-info-outer *.header { + color: initial; +} +.bsp-color-info-outer .bsp-color-info-outer-container { + height: 100%; + width: 100%; +} +.bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header { + flex-shrink: 0; + flex-grow: 0; + text-align: center; + border: none; +} +.bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-sm { + --bs-modal-content-font-size: 0.875rem; + --bs-modal-padding-x: 0.25rem; + --bs-modal-padding-y: 0.25rem; + --bs-modal-padding: 0.25rem; +} +.bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-sm .header-content { + --bs-modal-header-padding-x: 0.25rem; + --bs-modal-header-padding-y: 0.25rem; + --bs-modal-header-padding: 0.25rem; +} +.bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-sm .footer-content { + --bs-footer-font-size: 0.75rem; + --bs-footer-padding-y: 0.25rem; + --bs-footer-padding-x: 0.25rem; +} +.bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-xs { + --bs-modal-content-font-size: 0.75rem; + --bs-modal-padding-x: 0.125rem; + --bs-modal-padding-y: 0.125rem; + --bs-modal-padding: 0.125rem; +} +.bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-xs .header-content { + --bs-modal-header-padding-x: 0.125rem; + --bs-modal-header-padding-y: 0.125rem; + --bs-modal-header-padding: 0.125rem; +} +.bsp-color-info-outer .bsp-color-info-outer-container .bsp-color-info-header-xs .footer-content { + --bs-footer-font-size: 0.6875rem; + --bs-footer-padding-y: 0.125rem; + --bs-footer-padding-x: 0.125rem; +} .bsl-working .hide-for-bsl-working { - display: none !important; } - + display: none !important; +} .bsl-working .show-for-no-bsl-working { - display: none !important; } + display: none !important; +} .no-bsl-working .show-for-bsl-working { - display: none !important; } - + display: none !important; +} .no-bsl-working .hide-for-no-bsl-working { - display: none !important; } + display: none !important; +} /********************************************************** COMPASS-CONTROL @@ -40688,26 +42172,35 @@ Adjusted for new icons set in src/leaflet/leaflet.js **********************************************************/ @media screen and (orientation: landscape) { .lb-compass-btn i.compass-device-landscape { - transform: rotate(90deg) translateX(-0.2em) scale(0.4) !important; } - html.orientation-secondary .lb-compass-btn i.compass-device-landscape { - transform: rotate(-90deg) translateX(0.1em) scale(0.4) !important; } + transform: rotate(90deg) translateX(-0.2em) scale(0.4) !important; + } + html.orientation-secondary .lb-compass-btn i.compass-device-landscape { + transform: rotate(-90deg) translateX(0.1em) scale(0.4) !important; + } .lb-compass-btn i.compass-arrow { - transform: rotate(90deg) translateY(-0.45em) scale(0.7) !important; } - html.orientation-secondary .lb-compass-btn i.compass-arrow { - transform: rotate(-90deg) translateY(-0.45em) scale(0.7) !important; } } - + transform: rotate(90deg) translateY(-0.45em) scale(0.7) !important; + } + html.orientation-secondary .lb-compass-btn i.compass-arrow { + transform: rotate(-90deg) translateY(-0.45em) scale(0.7) !important; + } +} @media screen and (orientation: portrait) { .lb-compass-btn i.compass-device-portrait { - transform: rotate(0deg) translateY(-0.05em) scale(0.5) !important; } - html.orientation-secondary .lb-compass-btn i.compass-device-portrait { - transform: rotate(180deg) translateY(0.25em) scale(0.5) !important; } + transform: rotate(0deg) translateY(-0.05em) scale(0.5) !important; + } + html.orientation-secondary .lb-compass-btn i.compass-device-portrait { + transform: rotate(180deg) translateY(0.25em) scale(0.5) !important; + } .lb-compass-btn i.compass-arrow { - transform: rotate(0deg) translateY(-0.5em) scale(0.7) !important; } - html.orientation-secondary .lb-compass-btn i.compass-arrow { - transform: rotate(180deg) translateY(-0.5em) scale(0.7) !important; } } - + transform: rotate(0deg) translateY(-0.5em) scale(0.7) !important; + } + html.orientation-secondary .lb-compass-btn i.compass-arrow { + transform: rotate(180deg) translateY(-0.5em) scale(0.7) !important; + } +} .no-device-orientation .lb-compass-btn .no-device-orientation-slash { - transform: translateX(-0.1em) scaleX(0.75); } + transform: translateX(-0.1em) scaleX(0.75); +} /********************************************************** DATASET-VALUE @@ -40715,13 +42208,15 @@ Style for elements created by Dataset and DatasetValue See src/common/dataset.js **********************************************************/ .show-for-dataset-value-is-null { - display: none !important; } + display: none !important; +} .dataset-value-is-null.hide-for-dataset-value-is-null { - display: none !important; } - + display: none !important; +} .dataset-value-is-null .hide-for-dataset-value-is-null { - display: none !important; } - + display: none !important; +} .dataset-value-is-null .show-for-dataset-value-is-null { - display: block !important; } + display: block !important; +} \ No newline at end of file diff --git a/demo/bower_components.js b/demo/bower_components.js index 79fbe6c..c96f936 100644 --- a/demo/bower_components.js +++ b/demo/bower_components.js @@ -1,12 +1,12 @@ /*! - * jQuery JavaScript Library v3.7.0 + * jQuery JavaScript Library v3.7.1 * https://jquery.com/ * * Copyright OpenJS Foundation and other contributors * Released under the MIT license * https://jquery.org/license * - * Date: 2023-05-11T18:29Z + * Date: 2023-08-28T13:37Z */ ( function( global, factory ) { @@ -147,7 +147,7 @@ function toType( obj ) { -var version = "3.7.0", +var version = "3.7.1", rhtmlSuffix = /HTML$/i, @@ -411,9 +411,14 @@ jQuery.extend( { // Do not traverse comment nodes ret += jQuery.text( node ); } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + } + if ( nodeType === 1 || nodeType === 11 ) { return elem.textContent; - } else if ( nodeType === 3 || nodeType === 4 ) { + } + if ( nodeType === 9 ) { + return elem.documentElement.textContent; + } + if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } @@ -1126,12 +1131,17 @@ function setDocument( node ) { documentElement.msMatchesSelector; // Support: IE 9 - 11+, Edge 12 - 18+ - // Accessing iframe documents after unload throws "permission denied" errors (see trac-13936) - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( preferredDoc != document && + // Accessing iframe documents after unload throws "permission denied" errors + // (see trac-13936). + // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, + // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. + if ( documentElement.msMatchesSelector && + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + preferredDoc != document && ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { // Support: IE 9 - 11+, Edge 12 - 18+ @@ -2694,12 +2704,12 @@ jQuery.find = find; jQuery.expr[ ":" ] = jQuery.expr.pseudos; jQuery.unique = jQuery.uniqueSort; -// These have always been private, but they used to be documented -// as part of Sizzle so let's maintain them in the 3.x line -// for backwards compatibility purposes. +// These have always been private, but they used to be documented as part of +// Sizzle so let's maintain them for now for backwards compatibility purposes. find.compile = compile; find.select = select; find.setDocument = setDocument; +find.tokenize = tokenize; find.escape = jQuery.escapeSelector; find.getText = jQuery.text; @@ -5913,7 +5923,7 @@ function domManip( collection, args, callback, ignored ) { if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; - // Reenable scripts + // Re-enable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion @@ -6370,7 +6380,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); trChild = document.createElement( "div" ); table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; - tr.style.cssText = "border:1px solid"; + tr.style.cssText = "box-sizing:content-box;border:1px solid"; // Support: Chrome 86+ // Height set through cssText does not get applied. @@ -6382,7 +6392,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); // In our bodyBackground.html iframe, // display for all div elements is set to "inline", // which causes a problem only in Android 8 Chrome 86. - // Ensuring the div is display: block + // Ensuring the div is `display: block` // gets around this issue. trChild.style.display = "block"; @@ -10550,7 +10560,9 @@ jQuery.fn.extend( { }, hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + return this + .on( "mouseenter", fnOver ) + .on( "mouseleave", fnOut || fnOver ); } } ); @@ -13085,7 +13097,7 @@ else { }(jQuery, this, document)); ; /*! - * Bootstrap v5.3.0 (https://getbootstrap.com/) + * Bootstrap v5.3.2 (https://getbootstrap.com/) * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -13734,7 +13746,7 @@ else { * Constants */ - const VERSION = '5.3.0'; + const VERSION = '5.3.2'; /** * Class definition @@ -13815,9 +13827,9 @@ else { if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) { hrefAttribute = `#${hrefAttribute.split('#')[1]}`; } - selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null; + selector = hrefAttribute && hrefAttribute !== '#' ? parseSelector(hrefAttribute.trim()) : null; } - return parseSelector(selector); + return selector; }; const SelectorEngine = { find(selector, element = document.documentElement) { @@ -18944,13 +18956,15 @@ else { const ARROW_RIGHT_KEY = 'ArrowRight'; const ARROW_UP_KEY = 'ArrowUp'; const ARROW_DOWN_KEY = 'ArrowDown'; + const HOME_KEY = 'Home'; + const END_KEY = 'End'; const CLASS_NAME_ACTIVE = 'active'; const CLASS_NAME_FADE$1 = 'fade'; const CLASS_NAME_SHOW$1 = 'show'; const CLASS_DROPDOWN = 'dropdown'; const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; const SELECTOR_DROPDOWN_MENU = '.dropdown-menu'; - const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)'; + const NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`; const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'; const SELECTOR_OUTER = '.nav-item, .list-group-item'; const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`; @@ -19050,13 +19064,19 @@ else { this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1)); } _keydown(event) { - if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) { + if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) { return; } event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page event.preventDefault(); - const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key); - const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true); + const children = this._getChildren().filter(element => !isDisabled(element)); + let nextActiveElement; + if ([HOME_KEY, END_KEY].includes(event.key)) { + nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1]; + } else { + const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key); + nextActiveElement = getNextActiveElement(children, event.target, isNext, true); + } if (nextActiveElement) { nextActiveElement.focus({ preventScroll: true @@ -34125,6 +34145,38 @@ L.GeometryUtil = L.extend(L.GeometryUtil || {}, { return map.unproject(closest, maxzoom); }, + /** + Returns the closest point of a {L.LatLng} on a {L.Circle} + + @tutorial closest + + @param {L.LatLng} latlng - The position to search + @param {L.Circle} circle - A Circle defined by a center and a radius + @returns {L.LatLng} Closest geographical point on the circle circumference + */ + closestOnCircle: function (circle, latLng) { + const center = circle.getLatLng(); + const circleRadius = circle.getRadius(); + const radius = typeof circleRadius === 'number' ? circleRadius : circleRadius.radius; + const x = latLng.lng; + const y = latLng.lat; + const cx = center.lng; + const cy = center.lat; + // dx and dy is the vector from the circle's center to latLng + const dx = x - cx; + const dy = y - cy; + + // distance between the point and the circle's center + const distance = Math.sqrt(dx * dx + dy * dy) + + // Calculate the closest point on the circle by adding the normalized vector to the center + const tx = cx + (dx / distance) * radius; + const ty = cy + (dy / distance) * radius; + + return new L.LatLng(ty, tx); + }, + + /** Returns the closest latlng on layer. @@ -34261,6 +34313,10 @@ L.GeometryUtil = L.extend(L.GeometryUtil || {}, { result = subResult; } } else { + if (layer instanceof L.Circle){ + ll = this.closestOnCircle(layer, latlng); + distance = L.GeometryUtil.distance(map, latlng, ll); + } else // Single dimension, snap on points, else snap on closest if (typeof layer.getLatLng == 'function') { ll = layer.getLatLng(); @@ -34305,6 +34361,10 @@ L.GeometryUtil = L.extend(L.GeometryUtil || {}, { var subResult = L.GeometryUtil.closestLayer(map, layer.getLayers(), latlng); results.push(subResult); } else { + if (layer instanceof L.Circle){ + ll = this.closestOnCircle(layer, latlng); + distance = L.GeometryUtil.distance(map, latlng, ll); + } else // Single dimension, snap on points, else snap on closest if (typeof layer.getLatLng == 'function') { ll = layer.getLatLng(); @@ -35290,15119 +35350,25196 @@ L.geodesic = function(latlngs, options) { }; ; -/**************************************************************************** - fcoo-global-events.js, - - (c) 2016, FCOO +/** + * chroma.js - JavaScript library for color conversions + * + * Copyright (c) 2011-2019, Gregor Aisch + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. The name Gregor Aisch may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH 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. + * + * ------------------------------------------------------- + * + * chroma.js includes colors from colorbrewer2.org, which are released under + * the following license: + * + * Copyright (c) 2002 Cynthia Brewer, Mark Harrower, + * and The Pennsylvania State University. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + * + * ------------------------------------------------------ + * + * Named colors are taken from X11 Color Names. + * http://www.w3.org/TR/css3-color/#svg-color + * + * @preserve + */ - https://github.com/FCOO/fcoo-global-events - https://github.com/FCOO +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.chroma = factory()); +})(this, (function () { 'use strict'; -****************************************************************************/ + var limit$2 = function (x, min, max) { + if ( min === void 0 ) min=0; + if ( max === void 0 ) max=1; -(function (window/*, document, undefined*/) { - "use strict"; + return x < min ? min : x > max ? max : x; + }; - //Create fcoo-namespace - var ns = window.fcoo = window.fcoo || {}; + var limit$1 = limit$2; - ns.events = new window.GlobalEvents(); - ns.events.eventNames = ['LANGUAGECHANGED', 'TIMEZONECHANGED', 'DATETIMEFORMATCHANGED', 'NUMBERFORMATCHANGED', 'LATLNGFORMATCHANGED', 'UNITCHANGED']; + var clip_rgb$3 = function (rgb) { + rgb._clipped = false; + rgb._unclipped = rgb.slice(0); + for (var i=0; i<=3; i++) { + if (i < 3) { + if (rgb[i] < 0 || rgb[i] > 255) { rgb._clipped = true; } + rgb[i] = limit$1(rgb[i], 0, 255); + } else if (i === 3) { + rgb[i] = limit$1(rgb[i], 0, 1); + } + } + return rgb; + }; - $.each( ns.events.eventNames, function( index, eventName ){ - ns.events[ eventName ] = eventName; - }); + // ported from jQuery's $.type + var classToType = {}; + for (var i$1 = 0, list$1 = ['Boolean', 'Number', 'String', 'Function', 'Array', 'Date', 'RegExp', 'Undefined', 'Null']; i$1 < list$1.length; i$1 += 1) { + var name = list$1[i$1]; -}(this, document)); -; -/**************************************************************************** - fcoo-data-files.js, + classToType[("[object " + name + "]")] = name.toLowerCase(); + } + var type$p = function(obj) { + return classToType[Object.prototype.toString.call(obj)] || "object"; + }; - (c) 2018, FCOO + var type$o = type$p; - https://github.com/FCOO/fcoo-data-files - https://github.com/FCOO + var unpack$B = function (args, keyOrder) { + if ( keyOrder === void 0 ) keyOrder=null; - fcoo.LOCAL_DATA: {boolean} - fcoo.dataFilePath: - function([mainDir:STRING|BOOLEAN], subDir:STRING, fileName:STRING) OR - function(pathAndFileName:STRING) OR - function(subAndFileName:{mainDirNa= 3) { return Array.prototype.slice.call(args); } + // with less than 3 args we check if first arg is object + // and use the keyOrder string to extract and sort properties + if (type$o(args[0]) == 'object' && keyOrder) { + return keyOrder.split('') + .filter(function (k) { return args[0][k] !== undefined; }) + .map(function (k) { return args[0][k]; }); + } + // otherwise we just return the first argument + // (which we suppose is an array of args) + return args[0]; + }; - mainDir = STRING or BOOLEAN. if true => "dynamic", if false => "static" + var type$n = type$p; - if fcoo.LOCAL_DATA == false: - fcoo.dataFilePath("theSubDir", "fileName.json") returns "https://app.fcoo.dk/static/theSubDir/fileName.json" - fcoo.dataFilePath(false, "theSubDir", "fileName.json") returns "https://app.fcoo.dk/static/theSubDir/fileName.json" - fcoo.dataFilePath(true, "theSubDir", "fileName.json") returns "https://app.fcoo.dk/dynamic/theSubDir/fileName.json" + var last$4 = function (args) { + if (args.length < 2) { return null; } + var l = args.length-1; + if (type$n(args[l]) == 'string') { return args[l].toLowerCase(); } + return null; + }; - if fcoo.LOCAL_DATA == true: - fcoo.dataFilePath("theSubDir", "fileName.json") returns "/src/data/_fileName.json" + var PI$2 = Math.PI; -****************************************************************************/ + var utils = { + clip_rgb: clip_rgb$3, + limit: limit$2, + type: type$p, + unpack: unpack$B, + last: last$4, + PI: PI$2, + TWOPI: PI$2*2, + PITHIRD: PI$2/3, + DEG2RAD: PI$2 / 180, + RAD2DEG: 180 / PI$2 + }; -(function (window/*, document, undefined*/) { - "use strict"; + var input$h = { + format: {}, + autodetect: [] + }; - //Create fcoo-namespace - var ns = window.fcoo = window.fcoo || {}, - nsPath = ns.path = ns.path || {}; + var last$3 = utils.last; + var clip_rgb$2 = utils.clip_rgb; + var type$m = utils.type; + var _input = input$h; - ns.LOCAL_DATA = false; + var Color$D = function Color() { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + var me = this; + if (type$m(args[0]) === 'object' && + args[0].constructor && + args[0].constructor === this.constructor) { + // the argument is already a Color instance + return args[0]; + } - //Set default protocol and host - nsPath.protocol = nsPath.protocol || 'https:'; - nsPath.host = nsPath.host || 'app.fcoo.dk'; + // last argument could be the mode + var mode = last$3(args); + var autodetect = false; - function dataFileName(){ - // Detect mode - var mainDir, subDir, fileName; + if (!mode) { + autodetect = true; + if (!_input.sorted) { + _input.autodetect = _input.autodetect.sort(function (a,b) { return b.p - a.p; }); + _input.sorted = true; + } + // auto-detect format + for (var i = 0, list = _input.autodetect; i < list.length; i += 1) { + var chk = list[i]; - if (arguments.length == 3){ - //(mainDir: STRING|BOOLEAN, subDir:STRING, fileName:STRING) - mainDir = arguments[0]; - subDir = arguments[1]; - fileName = arguments[2]; - } - else - if (arguments.length == 2){ - //(subDir:STRING, fileName:STRING) - mainDir = false, //=> default 'static' - subDir = arguments[0]; - fileName = arguments[1]; - } - else - if (arguments.length == 1){ - if (typeof arguments[0] == 'string') - //(pathAndFileName:STRING) - return arguments[0]; - else { - //({mainDir:STRING|BOOLEAN, subDirName:STRING, fileName:STRING}) - mainDir = arguments[0].mainDir || false; - subDir = arguments[0].subDir; - fileName = arguments[0].fileName; + mode = chk.test.apply(chk, args); + if (mode) { break; } } } - if (ns.LOCAL_DATA === true) - return '/src/data/_' + fileName; - else - return nsPath.protocol + '//' + - nsPath.host + '/' + - (mainDir ? (mainDir === true ? 'dynamic' : mainDir) : 'static') + '/' + - (subDir ? subDir + '/' : '') + - fileName; - } + if (_input.format[mode]) { + var rgb = _input.format[mode].apply(null, autodetect ? args : args.slice(0,-1)); + me._rgb = clip_rgb$2(rgb); + } else { + throw new Error('unknown format: '+args); + } - //Export method - nsPath.dataFileName = dataFileName; + // add alpha channel + if (me._rgb.length === 3) { me._rgb.push(1); } + }; - //Backward compability - ns.dataFilePath = dataFileName; + Color$D.prototype.toString = function toString () { + if (type$m(this.hex) == 'function') { return this.hex(); } + return ("[" + (this._rgb.join(',')) + "]"); + }; -}(this, document)); + var Color_1 = Color$D; + var chroma$k = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; -; -//! moment.js -//! version : 2.29.4 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com + return new (Function.prototype.bind.apply( chroma$k.Color, [ null ].concat( args) )); + }; -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - global.moment = factory() -}(this, (function () { 'use strict'; + chroma$k.Color = Color_1; + chroma$k.version = '2.3.0'; - var hookCallback; + var chroma_1 = chroma$k; - function hooks() { - return hookCallback.apply(null, arguments); - } + var unpack$A = utils.unpack; + var max$2 = Math.max; - // This is done to register the method called with moment() - // without creating circular dependencies. - function setHookCallback(callback) { - hookCallback = callback; - } + var rgb2cmyk$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - function isArray(input) { - return ( - input instanceof Array || - Object.prototype.toString.call(input) === '[object Array]' - ); - } + var ref = unpack$A(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + r = r / 255; + g = g / 255; + b = b / 255; + var k = 1 - max$2(r,max$2(g,b)); + var f = k < 1 ? 1 / (1-k) : 0; + var c = (1-r-k) * f; + var m = (1-g-k) * f; + var y = (1-b-k) * f; + return [c,m,y,k]; + }; - function isObject(input) { - // IE8 will treat undefined and null as object if it wasn't for - // input != null - return ( - input != null && - Object.prototype.toString.call(input) === '[object Object]' - ); - } + var rgb2cmyk_1 = rgb2cmyk$1; - function hasOwnProp(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); - } + var unpack$z = utils.unpack; - function isObjectEmpty(obj) { - if (Object.getOwnPropertyNames) { - return Object.getOwnPropertyNames(obj).length === 0; - } else { - var k; - for (k in obj) { - if (hasOwnProp(obj, k)) { - return false; - } - } - return true; - } - } + var cmyk2rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - function isUndefined(input) { - return input === void 0; - } + args = unpack$z(args, 'cmyk'); + var c = args[0]; + var m = args[1]; + var y = args[2]; + var k = args[3]; + var alpha = args.length > 4 ? args[4] : 1; + if (k === 1) { return [0,0,0,alpha]; } + return [ + c >= 1 ? 0 : 255 * (1-c) * (1-k), // r + m >= 1 ? 0 : 255 * (1-m) * (1-k), // g + y >= 1 ? 0 : 255 * (1-y) * (1-k), // b + alpha + ]; + }; - function isNumber(input) { - return ( - typeof input === 'number' || - Object.prototype.toString.call(input) === '[object Number]' - ); - } + var cmyk2rgb_1 = cmyk2rgb; - function isDate(input) { - return ( - input instanceof Date || - Object.prototype.toString.call(input) === '[object Date]' - ); - } + var chroma$j = chroma_1; + var Color$C = Color_1; + var input$g = input$h; + var unpack$y = utils.unpack; + var type$l = utils.type; - function map(arr, fn) { - var res = [], - i, - arrLen = arr.length; - for (i = 0; i < arrLen; ++i) { - res.push(fn(arr[i], i)); - } - return res; - } + var rgb2cmyk = rgb2cmyk_1; - function extend(a, b) { - for (var i in b) { - if (hasOwnProp(b, i)) { - a[i] = b[i]; - } - } + Color$C.prototype.cmyk = function() { + return rgb2cmyk(this._rgb); + }; - if (hasOwnProp(b, 'toString')) { - a.toString = b.toString; - } + chroma$j.cmyk = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - if (hasOwnProp(b, 'valueOf')) { - a.valueOf = b.valueOf; - } + return new (Function.prototype.bind.apply( Color$C, [ null ].concat( args, ['cmyk']) )); + }; - return a; - } + input$g.format.cmyk = cmyk2rgb_1; - function createUTC(input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, true).utc(); - } + input$g.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - function defaultParsingFlags() { - // We need to deep clone this object. - return { - empty: false, - unusedTokens: [], - unusedInput: [], - overflow: -2, - charsLeftOver: 0, - nullInput: false, - invalidEra: null, - invalidMonth: null, - invalidFormat: false, - userInvalidated: false, - iso: false, - parsedDateParts: [], - era: null, - meridiem: null, - rfc2822: false, - weekdayMismatch: false, - }; - } + args = unpack$y(args, 'cmyk'); + if (type$l(args) === 'array' && args.length === 4) { + return 'cmyk'; + } + } + }); - function getParsingFlags(m) { - if (m._pf == null) { - m._pf = defaultParsingFlags(); + var unpack$x = utils.unpack; + var last$2 = utils.last; + var rnd = function (a) { return Math.round(a*100)/100; }; + + /* + * supported arguments: + * - hsl2css(h,s,l) + * - hsl2css(h,s,l,a) + * - hsl2css([h,s,l], mode) + * - hsl2css([h,s,l,a], mode) + * - hsl2css({h,s,l,a}, mode) + */ + var hsl2css$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var hsla = unpack$x(args, 'hsla'); + var mode = last$2(args) || 'lsa'; + hsla[0] = rnd(hsla[0] || 0); + hsla[1] = rnd(hsla[1]*100) + '%'; + hsla[2] = rnd(hsla[2]*100) + '%'; + if (mode === 'hsla' || (hsla.length > 3 && hsla[3]<1)) { + hsla[3] = hsla.length > 3 ? hsla[3] : 1; + mode = 'hsla'; + } else { + hsla.length = 3; } - return m._pf; - } + return (mode + "(" + (hsla.join(',')) + ")"); + }; - var some; - if (Array.prototype.some) { - some = Array.prototype.some; - } else { - some = function (fun) { - var t = Object(this), - len = t.length >>> 0, - i; + var hsl2css_1 = hsl2css$1; - for (i = 0; i < len; i++) { - if (i in t && fun.call(this, t[i], i, t)) { - return true; - } - } + var unpack$w = utils.unpack; - return false; - }; - } + /* + * supported arguments: + * - rgb2hsl(r,g,b) + * - rgb2hsl(r,g,b,a) + * - rgb2hsl([r,g,b]) + * - rgb2hsl([r,g,b,a]) + * - rgb2hsl({r,g,b,a}) + */ + var rgb2hsl$3 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - function isValid(m) { - if (m._isValid == null) { - var flags = getParsingFlags(m), - parsedParts = some.call(flags.parsedDateParts, function (i) { - return i != null; - }), - isNowValid = - !isNaN(m._d.getTime()) && - flags.overflow < 0 && - !flags.empty && - !flags.invalidEra && - !flags.invalidMonth && - !flags.invalidWeekday && - !flags.weekdayMismatch && - !flags.nullInput && - !flags.invalidFormat && - !flags.userInvalidated && - (!flags.meridiem || (flags.meridiem && parsedParts)); + args = unpack$w(args, 'rgba'); + var r = args[0]; + var g = args[1]; + var b = args[2]; - if (m._strict) { - isNowValid = - isNowValid && - flags.charsLeftOver === 0 && - flags.unusedTokens.length === 0 && - flags.bigHour === undefined; - } + r /= 255; + g /= 255; + b /= 255; - if (Object.isFrozen == null || !Object.isFrozen(m)) { - m._isValid = isNowValid; - } else { - return isNowValid; - } - } - return m._isValid; - } + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); - function createInvalid(flags) { - var m = createUTC(NaN); - if (flags != null) { - extend(getParsingFlags(m), flags); + var l = (max + min) / 2; + var s, h; + + if (max === min){ + s = 0; + h = Number.NaN; } else { - getParsingFlags(m).userInvalidated = true; + s = l < 0.5 ? (max - min) / (max + min) : (max - min) / (2 - max - min); } - return m; - } + if (r == max) { h = (g - b) / (max - min); } + else if (g == max) { h = 2 + (b - r) / (max - min); } + else if (b == max) { h = 4 + (r - g) / (max - min); } - // Plugins that add properties should also add the key here (null value), - // so we can properly clone ourselves. - var momentProperties = (hooks.momentProperties = []), - updateInProgress = false; + h *= 60; + if (h < 0) { h += 360; } + if (args.length>3 && args[3]!==undefined) { return [h,s,l,args[3]]; } + return [h,s,l]; + }; - function copyConfig(to, from) { - var i, - prop, - val, - momentPropertiesLen = momentProperties.length; + var rgb2hsl_1 = rgb2hsl$3; - if (!isUndefined(from._isAMomentObject)) { - to._isAMomentObject = from._isAMomentObject; - } - if (!isUndefined(from._i)) { - to._i = from._i; - } - if (!isUndefined(from._f)) { - to._f = from._f; - } - if (!isUndefined(from._l)) { - to._l = from._l; + var unpack$v = utils.unpack; + var last$1 = utils.last; + var hsl2css = hsl2css_1; + var rgb2hsl$2 = rgb2hsl_1; + var round$6 = Math.round; + + /* + * supported arguments: + * - rgb2css(r,g,b) + * - rgb2css(r,g,b,a) + * - rgb2css([r,g,b], mode) + * - rgb2css([r,g,b,a], mode) + * - rgb2css({r,g,b,a}, mode) + */ + var rgb2css$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var rgba = unpack$v(args, 'rgba'); + var mode = last$1(args) || 'rgb'; + if (mode.substr(0,3) == 'hsl') { + return hsl2css(rgb2hsl$2(rgba), mode); } - if (!isUndefined(from._strict)) { - to._strict = from._strict; + rgba[0] = round$6(rgba[0]); + rgba[1] = round$6(rgba[1]); + rgba[2] = round$6(rgba[2]); + if (mode === 'rgba' || (rgba.length > 3 && rgba[3]<1)) { + rgba[3] = rgba.length > 3 ? rgba[3] : 1; + mode = 'rgba'; } - if (!isUndefined(from._tzm)) { - to._tzm = from._tzm; + return (mode + "(" + (rgba.slice(0,mode==='rgb'?3:4).join(',')) + ")"); + }; + + var rgb2css_1 = rgb2css$1; + + var unpack$u = utils.unpack; + var round$5 = Math.round; + + var hsl2rgb$1 = function () { + var assign; + + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + args = unpack$u(args, 'hsl'); + var h = args[0]; + var s = args[1]; + var l = args[2]; + var r,g,b; + if (s === 0) { + r = g = b = l*255; + } else { + var t3 = [0,0,0]; + var c = [0,0,0]; + var t2 = l < 0.5 ? l * (1+s) : l+s-l*s; + var t1 = 2 * l - t2; + var h_ = h / 360; + t3[0] = h_ + 1/3; + t3[1] = h_; + t3[2] = h_ - 1/3; + for (var i=0; i<3; i++) { + if (t3[i] < 0) { t3[i] += 1; } + if (t3[i] > 1) { t3[i] -= 1; } + if (6 * t3[i] < 1) + { c[i] = t1 + (t2 - t1) * 6 * t3[i]; } + else if (2 * t3[i] < 1) + { c[i] = t2; } + else if (3 * t3[i] < 2) + { c[i] = t1 + (t2 - t1) * ((2 / 3) - t3[i]) * 6; } + else + { c[i] = t1; } + } + (assign = [round$5(c[0]*255),round$5(c[1]*255),round$5(c[2]*255)], r = assign[0], g = assign[1], b = assign[2]); } - if (!isUndefined(from._isUTC)) { - to._isUTC = from._isUTC; + if (args.length > 3) { + // keep alpha channel + return [r,g,b,args[3]]; } - if (!isUndefined(from._offset)) { - to._offset = from._offset; + return [r,g,b,1]; + }; + + var hsl2rgb_1 = hsl2rgb$1; + + var hsl2rgb = hsl2rgb_1; + var input$f = input$h; + + var RE_RGB = /^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/; + var RE_RGBA = /^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/; + var RE_RGB_PCT = /^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/; + var RE_RGBA_PCT = /^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/; + var RE_HSL = /^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/; + var RE_HSLA = /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/; + + var round$4 = Math.round; + + var css2rgb$1 = function (css) { + css = css.toLowerCase().trim(); + var m; + + if (input$f.format.named) { + try { + return input$f.format.named(css); + } catch (e) { + // eslint-disable-next-line + } } - if (!isUndefined(from._pf)) { - to._pf = getParsingFlags(from); + + // rgb(250,20,0) + if ((m = css.match(RE_RGB))) { + var rgb = m.slice(1,4); + for (var i=0; i<3; i++) { + rgb[i] = +rgb[i]; + } + rgb[3] = 1; // default alpha + return rgb; } - if (!isUndefined(from._locale)) { - to._locale = from._locale; + + // rgba(250,20,0,0.4) + if ((m = css.match(RE_RGBA))) { + var rgb$1 = m.slice(1,5); + for (var i$1=0; i$1<4; i$1++) { + rgb$1[i$1] = +rgb$1[i$1]; + } + return rgb$1; } - if (momentPropertiesLen > 0) { - for (i = 0; i < momentPropertiesLen; i++) { - prop = momentProperties[i]; - val = from[prop]; - if (!isUndefined(val)) { - to[prop] = val; - } + // rgb(100%,0%,0%) + if ((m = css.match(RE_RGB_PCT))) { + var rgb$2 = m.slice(1,4); + for (var i$2=0; i$2<3; i$2++) { + rgb$2[i$2] = round$4(rgb$2[i$2] * 2.55); } + rgb$2[3] = 1; // default alpha + return rgb$2; } - return to; - } + // rgba(100%,0%,0%,0.4) + if ((m = css.match(RE_RGBA_PCT))) { + var rgb$3 = m.slice(1,5); + for (var i$3=0; i$3<3; i$3++) { + rgb$3[i$3] = round$4(rgb$3[i$3] * 2.55); + } + rgb$3[3] = +rgb$3[3]; + return rgb$3; + } - // Moment prototype object - function Moment(config) { - copyConfig(this, config); - this._d = new Date(config._d != null ? config._d.getTime() : NaN); - if (!this.isValid()) { - this._d = new Date(NaN); + // hsl(0,100%,50%) + if ((m = css.match(RE_HSL))) { + var hsl = m.slice(1,4); + hsl[1] *= 0.01; + hsl[2] *= 0.01; + var rgb$4 = hsl2rgb(hsl); + rgb$4[3] = 1; + return rgb$4; } - // Prevent infinite loop in case updateOffset creates new moment - // objects. - if (updateInProgress === false) { - updateInProgress = true; - hooks.updateOffset(this); - updateInProgress = false; + + // hsla(0,100%,50%,0.5) + if ((m = css.match(RE_HSLA))) { + var hsl$1 = m.slice(1,4); + hsl$1[1] *= 0.01; + hsl$1[2] *= 0.01; + var rgb$5 = hsl2rgb(hsl$1); + rgb$5[3] = +m[4]; // default alpha = 1 + return rgb$5; } - } + }; - function isMoment(obj) { - return ( - obj instanceof Moment || (obj != null && obj._isAMomentObject != null) - ); - } + css2rgb$1.test = function (s) { + return RE_RGB.test(s) || + RE_RGBA.test(s) || + RE_RGB_PCT.test(s) || + RE_RGBA_PCT.test(s) || + RE_HSL.test(s) || + RE_HSLA.test(s); + }; - function warn(msg) { - if ( - hooks.suppressDeprecationWarnings === false && - typeof console !== 'undefined' && - console.warn - ) { - console.warn('Deprecation warning: ' + msg); - } - } + var css2rgb_1 = css2rgb$1; - function deprecate(msg, fn) { - var firstTime = true; + var chroma$i = chroma_1; + var Color$B = Color_1; + var input$e = input$h; + var type$k = utils.type; - return extend(function () { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(null, msg); - } - if (firstTime) { - var args = [], - arg, - i, - key, - argLen = arguments.length; - for (i = 0; i < argLen; i++) { - arg = ''; - if (typeof arguments[i] === 'object') { - arg += '\n[' + i + '] '; - for (key in arguments[0]) { - if (hasOwnProp(arguments[0], key)) { - arg += key + ': ' + arguments[0][key] + ', '; - } - } - arg = arg.slice(0, -2); // Remove trailing comma and space - } else { - arg = arguments[i]; - } - args.push(arg); - } - warn( - msg + - '\nArguments: ' + - Array.prototype.slice.call(args).join('') + - '\n' + - new Error().stack - ); - firstTime = false; - } - return fn.apply(this, arguments); - }, fn); - } + var rgb2css = rgb2css_1; + var css2rgb = css2rgb_1; - var deprecations = {}; + Color$B.prototype.css = function(mode) { + return rgb2css(this._rgb, mode); + }; - function deprecateSimple(name, msg) { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(name, msg); - } - if (!deprecations[name]) { - warn(msg); - deprecations[name] = true; - } - } + chroma$i.css = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - hooks.suppressDeprecationWarnings = false; - hooks.deprecationHandler = null; + return new (Function.prototype.bind.apply( Color$B, [ null ].concat( args, ['css']) )); + }; - function isFunction(input) { - return ( - (typeof Function !== 'undefined' && input instanceof Function) || - Object.prototype.toString.call(input) === '[object Function]' - ); - } + input$e.format.css = css2rgb; - function set(config) { - var prop, i; - for (i in config) { - if (hasOwnProp(config, i)) { - prop = config[i]; - if (isFunction(prop)) { - this[i] = prop; - } else { - this['_' + i] = prop; - } + input$e.autodetect.push({ + p: 5, + test: function (h) { + var rest = [], len = arguments.length - 1; + while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ]; + + if (!rest.length && type$k(h) === 'string' && css2rgb.test(h)) { + return 'css'; } } - this._config = config; - // Lenient ordinal parsing accepts just a number in addition to - // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. - // TODO: Remove "ordinalParse" fallback in next major release. - this._dayOfMonthOrdinalParseLenient = new RegExp( - (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + - '|' + - /\d{1,2}/.source - ); - } + }); - function mergeConfigs(parentConfig, childConfig) { - var res = extend({}, parentConfig), - prop; - for (prop in childConfig) { - if (hasOwnProp(childConfig, prop)) { - if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { - res[prop] = {}; - extend(res[prop], parentConfig[prop]); - extend(res[prop], childConfig[prop]); - } else if (childConfig[prop] != null) { - res[prop] = childConfig[prop]; - } else { - delete res[prop]; - } - } + var Color$A = Color_1; + var chroma$h = chroma_1; + var input$d = input$h; + var unpack$t = utils.unpack; + + input$d.format.gl = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var rgb = unpack$t(args, 'rgba'); + rgb[0] *= 255; + rgb[1] *= 255; + rgb[2] *= 255; + return rgb; + }; + + chroma$h.gl = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$A, [ null ].concat( args, ['gl']) )); + }; + + Color$A.prototype.gl = function() { + var rgb = this._rgb; + return [rgb[0]/255, rgb[1]/255, rgb[2]/255, rgb[3]]; + }; + + var unpack$s = utils.unpack; + + var rgb2hcg$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ref = unpack$s(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var delta = max - min; + var c = delta * 100 / 255; + var _g = min / (255 - delta) * 100; + var h; + if (delta === 0) { + h = Number.NaN; + } else { + if (r === max) { h = (g - b) / delta; } + if (g === max) { h = 2+(b - r) / delta; } + if (b === max) { h = 4+(r - g) / delta; } + h *= 60; + if (h < 0) { h += 360; } } - for (prop in parentConfig) { - if ( - hasOwnProp(parentConfig, prop) && - !hasOwnProp(childConfig, prop) && - isObject(parentConfig[prop]) - ) { - // make sure changes to properties don't modify parent config - res[prop] = extend({}, res[prop]); + return [h, c, _g]; + }; + + var rgb2hcg_1 = rgb2hcg$1; + + var unpack$r = utils.unpack; + var floor$3 = Math.floor; + + /* + * this is basically just HSV with some minor tweaks + * + * hue.. [0..360] + * chroma .. [0..1] + * grayness .. [0..1] + */ + + var hcg2rgb = function () { + var assign, assign$1, assign$2, assign$3, assign$4, assign$5; + + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + args = unpack$r(args, 'hcg'); + var h = args[0]; + var c = args[1]; + var _g = args[2]; + var r,g,b; + _g = _g * 255; + var _c = c * 255; + if (c === 0) { + r = g = b = _g; + } else { + if (h === 360) { h = 0; } + if (h > 360) { h -= 360; } + if (h < 0) { h += 360; } + h /= 60; + var i = floor$3(h); + var f = h - i; + var p = _g * (1 - c); + var q = p + _c * (1 - f); + var t = p + _c * f; + var v = p + _c; + switch (i) { + case 0: (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]); break + case 1: (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]); break + case 2: (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]); break + case 3: (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]); break + case 4: (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]); break + case 5: (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]); break } } - return res; - } + return [r, g, b, args.length > 3 ? args[3] : 1]; + }; - function Locale(config) { - if (config != null) { - this.set(config); - } - } + var hcg2rgb_1 = hcg2rgb; - var keys; + var unpack$q = utils.unpack; + var type$j = utils.type; + var chroma$g = chroma_1; + var Color$z = Color_1; + var input$c = input$h; - if (Object.keys) { - keys = Object.keys; - } else { - keys = function (obj) { - var i, - res = []; - for (i in obj) { - if (hasOwnProp(obj, i)) { - res.push(i); - } - } - return res; - }; - } + var rgb2hcg = rgb2hcg_1; - var defaultCalendar = { - sameDay: '[Today at] LT', - nextDay: '[Tomorrow at] LT', - nextWeek: 'dddd [at] LT', - lastDay: '[Yesterday at] LT', - lastWeek: '[Last] dddd [at] LT', - sameElse: 'L', + Color$z.prototype.hcg = function() { + return rgb2hcg(this._rgb); }; - function calendar(key, mom, now) { - var output = this._calendar[key] || this._calendar['sameElse']; - return isFunction(output) ? output.call(mom, now) : output; - } + chroma$g.hcg = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - function zeroFill(number, targetLength, forceSign) { - var absNumber = '' + Math.abs(number), - zerosToFill = targetLength - absNumber.length, - sign = number >= 0; - return ( - (sign ? (forceSign ? '+' : '') : '-') + - Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + - absNumber - ); - } + return new (Function.prototype.bind.apply( Color$z, [ null ].concat( args, ['hcg']) )); + }; - var formattingTokens = - /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, - localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, - formatFunctions = {}, - formatTokenFunctions = {}; + input$c.format.hcg = hcg2rgb_1; - // token: 'M' - // padded: ['MM', 2] - // ordinal: 'Mo' - // callback: function () { this.month() + 1 } - function addFormatToken(token, padded, ordinal, callback) { - var func = callback; - if (typeof callback === 'string') { - func = function () { - return this[callback](); - }; - } - if (token) { - formatTokenFunctions[token] = func; + input$c.autodetect.push({ + p: 1, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$q(args, 'hcg'); + if (type$j(args) === 'array' && args.length === 3) { + return 'hcg'; + } } - if (padded) { - formatTokenFunctions[padded[0]] = function () { - return zeroFill(func.apply(this, arguments), padded[1], padded[2]); - }; + }); + + var unpack$p = utils.unpack; + var last = utils.last; + var round$3 = Math.round; + + var rgb2hex$2 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ref = unpack$p(args, 'rgba'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var a = ref[3]; + var mode = last(args) || 'auto'; + if (a === undefined) { a = 1; } + if (mode === 'auto') { + mode = a < 1 ? 'rgba' : 'rgb'; } - if (ordinal) { - formatTokenFunctions[ordinal] = function () { - return this.localeData().ordinal( - func.apply(this, arguments), - token - ); - }; + r = round$3(r); + g = round$3(g); + b = round$3(b); + var u = r << 16 | g << 8 | b; + var str = "000000" + u.toString(16); //#.toUpperCase(); + str = str.substr(str.length - 6); + var hxa = '0' + round$3(a * 255).toString(16); + hxa = hxa.substr(hxa.length - 2); + switch (mode.toLowerCase()) { + case 'rgba': return ("#" + str + hxa); + case 'argb': return ("#" + hxa + str); + default: return ("#" + str); } - } + }; - function removeFormattingTokens(input) { - if (input.match(/\[[\s\S]/)) { - return input.replace(/^\[|\]$/g, ''); - } - return input.replace(/\\/g, ''); - } + var rgb2hex_1 = rgb2hex$2; - function makeFormatFunction(format) { - var array = format.match(formattingTokens), - i, - length; + var RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/; + var RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/; - for (i = 0, length = array.length; i < length; i++) { - if (formatTokenFunctions[array[i]]) { - array[i] = formatTokenFunctions[array[i]]; - } else { - array[i] = removeFormattingTokens(array[i]); + var hex2rgb$1 = function (hex) { + if (hex.match(RE_HEX)) { + // remove optional leading # + if (hex.length === 4 || hex.length === 7) { + hex = hex.substr(1); + } + // expand short-notation to full six-digit + if (hex.length === 3) { + hex = hex.split(''); + hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]; } + var u = parseInt(hex, 16); + var r = u >> 16; + var g = u >> 8 & 0xFF; + var b = u & 0xFF; + return [r,g,b,1]; } - return function (mom) { - var output = '', - i; - for (i = 0; i < length; i++) { - output += isFunction(array[i]) - ? array[i].call(mom, format) - : array[i]; + // match rgba hex format, eg #FF000077 + if (hex.match(RE_HEXA)) { + if (hex.length === 5 || hex.length === 9) { + // remove optional leading # + hex = hex.substr(1); } - return output; - }; - } - - // format date using native date object - function formatMoment(m, format) { - if (!m.isValid()) { - return m.localeData().invalidDate(); + // expand short-notation to full eight-digit + if (hex.length === 4) { + hex = hex.split(''); + hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]+hex[3]+hex[3]; + } + var u$1 = parseInt(hex, 16); + var r$1 = u$1 >> 24 & 0xFF; + var g$1 = u$1 >> 16 & 0xFF; + var b$1 = u$1 >> 8 & 0xFF; + var a = Math.round((u$1 & 0xFF) / 0xFF * 100) / 100; + return [r$1,g$1,b$1,a]; } - format = expandFormat(format, m.localeData()); - formatFunctions[format] = - formatFunctions[format] || makeFormatFunction(format); + // we used to check for css colors here + // if _input.css? and rgb = _input.css hex + // return rgb - return formatFunctions[format](m); - } + throw new Error(("unknown hex color: " + hex)); + }; - function expandFormat(format, locale) { - var i = 5; + var hex2rgb_1 = hex2rgb$1; - function replaceLongDateFormatTokens(input) { - return locale.longDateFormat(input) || input; - } + var chroma$f = chroma_1; + var Color$y = Color_1; + var type$i = utils.type; + var input$b = input$h; - localFormattingTokens.lastIndex = 0; - while (i >= 0 && localFormattingTokens.test(format)) { - format = format.replace( - localFormattingTokens, - replaceLongDateFormatTokens - ); - localFormattingTokens.lastIndex = 0; - i -= 1; - } + var rgb2hex$1 = rgb2hex_1; - return format; - } + Color$y.prototype.hex = function(mode) { + return rgb2hex$1(this._rgb, mode); + }; - var defaultLongDateFormat = { - LTS: 'h:mm:ss A', - LT: 'h:mm A', - L: 'MM/DD/YYYY', - LL: 'MMMM D, YYYY', - LLL: 'MMMM D, YYYY h:mm A', - LLLL: 'dddd, MMMM D, YYYY h:mm A', + chroma$f.hex = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$y, [ null ].concat( args, ['hex']) )); }; - function longDateFormat(key) { - var format = this._longDateFormat[key], - formatUpper = this._longDateFormat[key.toUpperCase()]; + input$b.format.hex = hex2rgb_1; + input$b.autodetect.push({ + p: 4, + test: function (h) { + var rest = [], len = arguments.length - 1; + while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ]; - if (format || !formatUpper) { - return format; + if (!rest.length && type$i(h) === 'string' && [3,4,5,6,7,8,9].indexOf(h.length) >= 0) { + return 'hex'; + } } + }); - this._longDateFormat[key] = formatUpper - .match(formattingTokens) - .map(function (tok) { - if ( - tok === 'MMMM' || - tok === 'MM' || - tok === 'DD' || - tok === 'dddd' - ) { - return tok.slice(1); - } - return tok; - }) - .join(''); + var unpack$o = utils.unpack; + var TWOPI$2 = utils.TWOPI; + var min$2 = Math.min; + var sqrt$4 = Math.sqrt; + var acos = Math.acos; - return this._longDateFormat[key]; - } + var rgb2hsi$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - var defaultInvalidDate = 'Invalid date'; + /* + borrowed from here: + http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/rgb2hsi.cpp + */ + var ref = unpack$o(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + r /= 255; + g /= 255; + b /= 255; + var h; + var min_ = min$2(r,g,b); + var i = (r+g+b) / 3; + var s = i > 0 ? 1 - min_/i : 0; + if (s === 0) { + h = NaN; + } else { + h = ((r-g)+(r-b)) / 2; + h /= sqrt$4((r-g)*(r-g) + (r-b)*(g-b)); + h = acos(h); + if (b > g) { + h = TWOPI$2 - h; + } + h /= TWOPI$2; + } + return [h*360,s,i]; + }; - function invalidDate() { - return this._invalidDate; - } + var rgb2hsi_1 = rgb2hsi$1; - var defaultOrdinal = '%d', - defaultDayOfMonthOrdinalParse = /\d{1,2}/; + var unpack$n = utils.unpack; + var limit = utils.limit; + var TWOPI$1 = utils.TWOPI; + var PITHIRD = utils.PITHIRD; + var cos$4 = Math.cos; - function ordinal(number) { - return this._ordinal.replace('%d', number); - } + /* + * hue [0..360] + * saturation [0..1] + * intensity [0..1] + */ + var hsi2rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - var defaultRelativeTime = { - future: 'in %s', - past: '%s ago', - s: 'a few seconds', - ss: '%d seconds', - m: 'a minute', - mm: '%d minutes', - h: 'an hour', - hh: '%d hours', - d: 'a day', - dd: '%d days', - w: 'a week', - ww: '%d weeks', - M: 'a month', - MM: '%d months', - y: 'a year', - yy: '%d years', + /* + borrowed from here: + http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/hsi2rgb.cpp + */ + args = unpack$n(args, 'hsi'); + var h = args[0]; + var s = args[1]; + var i = args[2]; + var r,g,b; + + if (isNaN(h)) { h = 0; } + if (isNaN(s)) { s = 0; } + // normalize hue + if (h > 360) { h -= 360; } + if (h < 0) { h += 360; } + h /= 360; + if (h < 1/3) { + b = (1-s)/3; + r = (1+s*cos$4(TWOPI$1*h)/cos$4(PITHIRD-TWOPI$1*h))/3; + g = 1 - (b+r); + } else if (h < 2/3) { + h -= 1/3; + r = (1-s)/3; + g = (1+s*cos$4(TWOPI$1*h)/cos$4(PITHIRD-TWOPI$1*h))/3; + b = 1 - (r+g); + } else { + h -= 2/3; + g = (1-s)/3; + b = (1+s*cos$4(TWOPI$1*h)/cos$4(PITHIRD-TWOPI$1*h))/3; + r = 1 - (g+b); + } + r = limit(i*r*3); + g = limit(i*g*3); + b = limit(i*b*3); + return [r*255, g*255, b*255, args.length > 3 ? args[3] : 1]; }; - function relativeTime(number, withoutSuffix, string, isFuture) { - var output = this._relativeTime[string]; - return isFunction(output) - ? output(number, withoutSuffix, string, isFuture) - : output.replace(/%d/i, number); - } + var hsi2rgb_1 = hsi2rgb; - function pastFuture(diff, output) { - var format = this._relativeTime[diff > 0 ? 'future' : 'past']; - return isFunction(format) ? format(output) : format.replace(/%s/i, output); - } + var unpack$m = utils.unpack; + var type$h = utils.type; + var chroma$e = chroma_1; + var Color$x = Color_1; + var input$a = input$h; - var aliases = {}; + var rgb2hsi = rgb2hsi_1; - function addUnitAlias(unit, shorthand) { - var lowerCase = unit.toLowerCase(); - aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; - } + Color$x.prototype.hsi = function() { + return rgb2hsi(this._rgb); + }; - function normalizeUnits(units) { - return typeof units === 'string' - ? aliases[units] || aliases[units.toLowerCase()] - : undefined; - } + chroma$e.hsi = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - function normalizeObjectUnits(inputObject) { - var normalizedInput = {}, - normalizedProp, - prop; + return new (Function.prototype.bind.apply( Color$x, [ null ].concat( args, ['hsi']) )); + }; - for (prop in inputObject) { - if (hasOwnProp(inputObject, prop)) { - normalizedProp = normalizeUnits(prop); - if (normalizedProp) { - normalizedInput[normalizedProp] = inputObject[prop]; - } + input$a.format.hsi = hsi2rgb_1; + + input$a.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$m(args, 'hsi'); + if (type$h(args) === 'array' && args.length === 3) { + return 'hsi'; } } + }); - return normalizedInput; - } + var unpack$l = utils.unpack; + var type$g = utils.type; + var chroma$d = chroma_1; + var Color$w = Color_1; + var input$9 = input$h; - var priorities = {}; + var rgb2hsl$1 = rgb2hsl_1; - function addUnitPriority(unit, priority) { - priorities[unit] = priority; - } + Color$w.prototype.hsl = function() { + return rgb2hsl$1(this._rgb); + }; - function getPrioritizedUnits(unitsObj) { - var units = [], - u; - for (u in unitsObj) { - if (hasOwnProp(unitsObj, u)) { - units.push({ unit: u, priority: priorities[u] }); + chroma$d.hsl = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$w, [ null ].concat( args, ['hsl']) )); + }; + + input$9.format.hsl = hsl2rgb_1; + + input$9.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$l(args, 'hsl'); + if (type$g(args) === 'array' && args.length === 3) { + return 'hsl'; } } - units.sort(function (a, b) { - return a.priority - b.priority; - }); - return units; - } + }); - function isLeapYear(year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; - } + var unpack$k = utils.unpack; + var min$1 = Math.min; + var max$1 = Math.max; - function absFloor(number) { - if (number < 0) { - // -0 -> 0 - return Math.ceil(number) || 0; + /* + * supported arguments: + * - rgb2hsv(r,g,b) + * - rgb2hsv([r,g,b]) + * - rgb2hsv({r,g,b}) + */ + var rgb2hsl = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$k(args, 'rgb'); + var r = args[0]; + var g = args[1]; + var b = args[2]; + var min_ = min$1(r, g, b); + var max_ = max$1(r, g, b); + var delta = max_ - min_; + var h,s,v; + v = max_ / 255.0; + if (max_ === 0) { + h = Number.NaN; + s = 0; } else { - return Math.floor(number); + s = delta / max_; + if (r === max_) { h = (g - b) / delta; } + if (g === max_) { h = 2+(b - r) / delta; } + if (b === max_) { h = 4+(r - g) / delta; } + h *= 60; + if (h < 0) { h += 360; } } - } + return [h, s, v] + }; - function toInt(argumentForCoercion) { - var coercedNumber = +argumentForCoercion, - value = 0; + var rgb2hsv$1 = rgb2hsl; - if (coercedNumber !== 0 && isFinite(coercedNumber)) { - value = absFloor(coercedNumber); - } + var unpack$j = utils.unpack; + var floor$2 = Math.floor; - return value; - } + var hsv2rgb = function () { + var assign, assign$1, assign$2, assign$3, assign$4, assign$5; - function makeGetSet(unit, keepTime) { - return function (value) { - if (value != null) { - set$1(this, unit, value); - hooks.updateOffset(this, keepTime); - return this; - } else { - return get(this, unit); - } - }; - } + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + args = unpack$j(args, 'hsv'); + var h = args[0]; + var s = args[1]; + var v = args[2]; + var r,g,b; + v *= 255; + if (s === 0) { + r = g = b = v; + } else { + if (h === 360) { h = 0; } + if (h > 360) { h -= 360; } + if (h < 0) { h += 360; } + h /= 60; - function get(mom, unit) { - return mom.isValid() - ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() - : NaN; - } + var i = floor$2(h); + var f = h - i; + var p = v * (1 - s); + var q = v * (1 - s * f); + var t = v * (1 - s * (1 - f)); - function set$1(mom, unit, value) { - if (mom.isValid() && !isNaN(value)) { - if ( - unit === 'FullYear' && - isLeapYear(mom.year()) && - mom.month() === 1 && - mom.date() === 29 - ) { - value = toInt(value); - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit]( - value, - mom.month(), - daysInMonth(value, mom.month()) - ); - } else { - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + switch (i) { + case 0: (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]); break + case 1: (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]); break + case 2: (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]); break + case 3: (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]); break + case 4: (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]); break + case 5: (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]); break } } - } + return [r,g,b,args.length > 3?args[3]:1]; + }; - // MOMENTS + var hsv2rgb_1 = hsv2rgb; - function stringGet(units) { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](); - } - return this; - } + var unpack$i = utils.unpack; + var type$f = utils.type; + var chroma$c = chroma_1; + var Color$v = Color_1; + var input$8 = input$h; - function stringSet(units, value) { - if (typeof units === 'object') { - units = normalizeObjectUnits(units); - var prioritized = getPrioritizedUnits(units), - i, - prioritizedLen = prioritized.length; - for (i = 0; i < prioritizedLen; i++) { - this[prioritized[i].unit](units[prioritized[i].unit]); - } - } else { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](value); + var rgb2hsv = rgb2hsv$1; + + Color$v.prototype.hsv = function() { + return rgb2hsv(this._rgb); + }; + + chroma$c.hsv = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$v, [ null ].concat( args, ['hsv']) )); + }; + + input$8.format.hsv = hsv2rgb_1; + + input$8.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$i(args, 'hsv'); + if (type$f(args) === 'array' && args.length === 3) { + return 'hsv'; } } - return this; - } + }); - var match1 = /\d/, // 0 - 9 - match2 = /\d\d/, // 00 - 99 - match3 = /\d{3}/, // 000 - 999 - match4 = /\d{4}/, // 0000 - 9999 - match6 = /[+-]?\d{6}/, // -999999 - 999999 - match1to2 = /\d\d?/, // 0 - 99 - match3to4 = /\d\d\d\d?/, // 999 - 9999 - match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999 - match1to3 = /\d{1,3}/, // 0 - 999 - match1to4 = /\d{1,4}/, // 0 - 9999 - match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999 - matchUnsigned = /\d+/, // 0 - inf - matchSigned = /[+-]?\d+/, // -inf - inf - matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z - matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z - matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 - // any word (or two) characters or numbers including two/three word month in arabic. - // includes scottish gaelic two word and hyphenated months - matchWord = - /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, - regexes; + var labConstants = { + // Corresponds roughly to RGB brighter/darker + Kn: 18, - regexes = {}; + // D65 standard referent + Xn: 0.950470, + Yn: 1, + Zn: 1.088830, - function addRegexToken(token, regex, strictRegex) { - regexes[token] = isFunction(regex) - ? regex - : function (isStrict, localeData) { - return isStrict && strictRegex ? strictRegex : regex; - }; - } + t0: 0.137931034, // 4 / 29 + t1: 0.206896552, // 6 / 29 + t2: 0.12841855, // 3 * t1 * t1 + t3: 0.008856452, // t1 * t1 * t1 + }; - function getParseRegexForToken(token, config) { - if (!hasOwnProp(regexes, token)) { - return new RegExp(unescapeFormat(token)); - } + var LAB_CONSTANTS$3 = labConstants; + var unpack$h = utils.unpack; + var pow$a = Math.pow; - return regexes[token](config._strict, config._locale); - } + var rgb2lab$2 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript - function unescapeFormat(s) { - return regexEscape( - s - .replace('\\', '') - .replace( - /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, - function (matched, p1, p2, p3, p4) { - return p1 || p2 || p3 || p4; - } - ) - ); - } + var ref = unpack$h(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var ref$1 = rgb2xyz(r,g,b); + var x = ref$1[0]; + var y = ref$1[1]; + var z = ref$1[2]; + var l = 116 * y - 16; + return [l < 0 ? 0 : l, 500 * (x - y), 200 * (y - z)]; + }; - function regexEscape(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - } + var rgb_xyz = function (r) { + if ((r /= 255) <= 0.04045) { return r / 12.92; } + return pow$a((r + 0.055) / 1.055, 2.4); + }; - var tokens = {}; + var xyz_lab = function (t) { + if (t > LAB_CONSTANTS$3.t3) { return pow$a(t, 1 / 3); } + return t / LAB_CONSTANTS$3.t2 + LAB_CONSTANTS$3.t0; + }; - function addParseToken(token, callback) { - var i, - func = callback, - tokenLen; - if (typeof token === 'string') { - token = [token]; - } - if (isNumber(callback)) { - func = function (input, array) { - array[callback] = toInt(input); - }; - } - tokenLen = token.length; - for (i = 0; i < tokenLen; i++) { - tokens[token[i]] = func; - } - } + var rgb2xyz = function (r,g,b) { + r = rgb_xyz(r); + g = rgb_xyz(g); + b = rgb_xyz(b); + var x = xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / LAB_CONSTANTS$3.Xn); + var y = xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / LAB_CONSTANTS$3.Yn); + var z = xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / LAB_CONSTANTS$3.Zn); + return [x,y,z]; + }; - function addWeekParseToken(token, callback) { - addParseToken(token, function (input, array, config, token) { - config._w = config._w || {}; - callback(input, config._w, config, token); - }); - } + var rgb2lab_1 = rgb2lab$2; - function addTimeToArrayFromToken(token, input, config) { - if (input != null && hasOwnProp(tokens, token)) { - tokens[token](input, config._a, config, token); - } - } + var LAB_CONSTANTS$2 = labConstants; + var unpack$g = utils.unpack; + var pow$9 = Math.pow; - var YEAR = 0, - MONTH = 1, - DATE = 2, - HOUR = 3, - MINUTE = 4, - SECOND = 5, - MILLISECOND = 6, - WEEK = 7, - WEEKDAY = 8; + /* + * L* [0..100] + * a [-100..100] + * b [-100..100] + */ + var lab2rgb$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - function mod(n, x) { - return ((n % x) + x) % x; - } + args = unpack$g(args, 'lab'); + var l = args[0]; + var a = args[1]; + var b = args[2]; + var x,y,z, r,g,b_; - var indexOf; + y = (l + 16) / 116; + x = isNaN(a) ? y : y + a / 500; + z = isNaN(b) ? y : y - b / 200; - if (Array.prototype.indexOf) { - indexOf = Array.prototype.indexOf; - } else { - indexOf = function (o) { - // I know - var i; - for (i = 0; i < this.length; ++i) { - if (this[i] === o) { - return i; - } - } - return -1; - }; - } + y = LAB_CONSTANTS$2.Yn * lab_xyz(y); + x = LAB_CONSTANTS$2.Xn * lab_xyz(x); + z = LAB_CONSTANTS$2.Zn * lab_xyz(z); - function daysInMonth(year, month) { - if (isNaN(year) || isNaN(month)) { - return NaN; - } - var modMonth = mod(month, 12); - year += (month - modMonth) / 12; - return modMonth === 1 - ? isLeapYear(year) - ? 29 - : 28 - : 31 - ((modMonth % 7) % 2); - } + r = xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z); // D65 -> sRGB + g = xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z); + b_ = xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z); - // FORMATTING + return [r,g,b_,args.length > 3 ? args[3] : 1]; + }; - addFormatToken('M', ['MM', 2], 'Mo', function () { - return this.month() + 1; - }); + var xyz_rgb = function (r) { + return 255 * (r <= 0.00304 ? 12.92 * r : 1.055 * pow$9(r, 1 / 2.4) - 0.055) + }; - addFormatToken('MMM', 0, 0, function (format) { - return this.localeData().monthsShort(this, format); - }); + var lab_xyz = function (t) { + return t > LAB_CONSTANTS$2.t1 ? t * t * t : LAB_CONSTANTS$2.t2 * (t - LAB_CONSTANTS$2.t0) + }; - addFormatToken('MMMM', 0, 0, function (format) { - return this.localeData().months(this, format); - }); + var lab2rgb_1 = lab2rgb$1; - // ALIASES + var unpack$f = utils.unpack; + var type$e = utils.type; + var chroma$b = chroma_1; + var Color$u = Color_1; + var input$7 = input$h; - addUnitAlias('month', 'M'); + var rgb2lab$1 = rgb2lab_1; - // PRIORITY + Color$u.prototype.lab = function() { + return rgb2lab$1(this._rgb); + }; - addUnitPriority('month', 8); + chroma$b.lab = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - // PARSING + return new (Function.prototype.bind.apply( Color$u, [ null ].concat( args, ['lab']) )); + }; - addRegexToken('M', match1to2); - addRegexToken('MM', match1to2, match2); - addRegexToken('MMM', function (isStrict, locale) { - return locale.monthsShortRegex(isStrict); - }); - addRegexToken('MMMM', function (isStrict, locale) { - return locale.monthsRegex(isStrict); - }); + input$7.format.lab = lab2rgb_1; - addParseToken(['M', 'MM'], function (input, array) { - array[MONTH] = toInt(input) - 1; + input$7.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$f(args, 'lab'); + if (type$e(args) === 'array' && args.length === 3) { + return 'lab'; + } + } }); - addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { - var month = config._locale.monthsParse(input, token, config._strict); - // if we didn't find a month name, mark the date as invalid. - if (month != null) { - array[MONTH] = month; - } else { - getParsingFlags(config).invalidMonth = input; - } - }); + var unpack$e = utils.unpack; + var RAD2DEG = utils.RAD2DEG; + var sqrt$3 = Math.sqrt; + var atan2$2 = Math.atan2; + var round$2 = Math.round; - // LOCALES + var lab2lch$2 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - var defaultLocaleMonths = - 'January_February_March_April_May_June_July_August_September_October_November_December'.split( - '_' - ), - defaultLocaleMonthsShort = - 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), - MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, - defaultMonthsShortRegex = matchWord, - defaultMonthsRegex = matchWord; + var ref = unpack$e(args, 'lab'); + var l = ref[0]; + var a = ref[1]; + var b = ref[2]; + var c = sqrt$3(a * a + b * b); + var h = (atan2$2(b, a) * RAD2DEG + 360) % 360; + if (round$2(c*10000) === 0) { h = Number.NaN; } + return [l, c, h]; + }; - function localeMonths(m, format) { - if (!m) { - return isArray(this._months) - ? this._months - : this._months['standalone']; - } - return isArray(this._months) - ? this._months[m.month()] - : this._months[ - (this._months.isFormat || MONTHS_IN_FORMAT).test(format) - ? 'format' - : 'standalone' - ][m.month()]; - } + var lab2lch_1 = lab2lch$2; - function localeMonthsShort(m, format) { - if (!m) { - return isArray(this._monthsShort) - ? this._monthsShort - : this._monthsShort['standalone']; - } - return isArray(this._monthsShort) - ? this._monthsShort[m.month()] - : this._monthsShort[ - MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone' - ][m.month()]; - } + var unpack$d = utils.unpack; + var rgb2lab = rgb2lab_1; + var lab2lch$1 = lab2lch_1; - function handleStrictParse(monthName, format, strict) { - var i, - ii, - mom, - llc = monthName.toLocaleLowerCase(); - if (!this._monthsParse) { - // this is not used - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - for (i = 0; i < 12; ++i) { - mom = createUTC([2000, i]); - this._shortMonthsParse[i] = this.monthsShort( - mom, - '' - ).toLocaleLowerCase(); - this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); + var rgb2lch$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ref = unpack$d(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var ref$1 = rgb2lab(r,g,b); + var l = ref$1[0]; + var a = ref$1[1]; + var b_ = ref$1[2]; + return lab2lch$1(l,a,b_); + }; + + var rgb2lch_1 = rgb2lch$1; + + var unpack$c = utils.unpack; + var DEG2RAD = utils.DEG2RAD; + var sin$3 = Math.sin; + var cos$3 = Math.cos; + + var lch2lab$2 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + /* + Convert from a qualitative parameter h and a quantitative parameter l to a 24-bit pixel. + These formulas were invented by David Dalrymple to obtain maximum contrast without going + out of gamut if the parameters are in the range 0-1. + + A saturation multiplier was added by Gregor Aisch + */ + var ref = unpack$c(args, 'lch'); + var l = ref[0]; + var c = ref[1]; + var h = ref[2]; + if (isNaN(h)) { h = 0; } + h = h * DEG2RAD; + return [l, cos$3(h) * c, sin$3(h) * c] + }; + + var lch2lab_1 = lch2lab$2; + + var unpack$b = utils.unpack; + var lch2lab$1 = lch2lab_1; + var lab2rgb = lab2rgb_1; + + var lch2rgb$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$b(args, 'lch'); + var l = args[0]; + var c = args[1]; + var h = args[2]; + var ref = lch2lab$1 (l,c,h); + var L = ref[0]; + var a = ref[1]; + var b_ = ref[2]; + var ref$1 = lab2rgb (L,a,b_); + var r = ref$1[0]; + var g = ref$1[1]; + var b = ref$1[2]; + return [r, g, b, args.length > 3 ? args[3] : 1]; + }; + + var lch2rgb_1 = lch2rgb$1; + + var unpack$a = utils.unpack; + var lch2rgb = lch2rgb_1; + + var hcl2rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var hcl = unpack$a(args, 'hcl').reverse(); + return lch2rgb.apply(void 0, hcl); + }; + + var hcl2rgb_1 = hcl2rgb; + + var unpack$9 = utils.unpack; + var type$d = utils.type; + var chroma$a = chroma_1; + var Color$t = Color_1; + var input$6 = input$h; + + var rgb2lch = rgb2lch_1; + + Color$t.prototype.lch = function() { return rgb2lch(this._rgb); }; + Color$t.prototype.hcl = function() { return rgb2lch(this._rgb).reverse(); }; + + chroma$a.lch = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$t, [ null ].concat( args, ['lch']) )); + }; + chroma$a.hcl = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$t, [ null ].concat( args, ['hcl']) )); + }; + + input$6.format.lch = lch2rgb_1; + input$6.format.hcl = hcl2rgb_1; + + ['lch','hcl'].forEach(function (m) { return input$6.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$9(args, m); + if (type$d(args) === 'array' && args.length === 3) { + return m; } } + }); }); - if (strict) { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; + /** + X11 color names + + http://www.w3.org/TR/css3-color/#svg-color + */ + + var w3cx11$1 = { + aliceblue: '#f0f8ff', + antiquewhite: '#faebd7', + aqua: '#00ffff', + aquamarine: '#7fffd4', + azure: '#f0ffff', + beige: '#f5f5dc', + bisque: '#ffe4c4', + black: '#000000', + blanchedalmond: '#ffebcd', + blue: '#0000ff', + blueviolet: '#8a2be2', + brown: '#a52a2a', + burlywood: '#deb887', + cadetblue: '#5f9ea0', + chartreuse: '#7fff00', + chocolate: '#d2691e', + coral: '#ff7f50', + cornflower: '#6495ed', + cornflowerblue: '#6495ed', + cornsilk: '#fff8dc', + crimson: '#dc143c', + cyan: '#00ffff', + darkblue: '#00008b', + darkcyan: '#008b8b', + darkgoldenrod: '#b8860b', + darkgray: '#a9a9a9', + darkgreen: '#006400', + darkgrey: '#a9a9a9', + darkkhaki: '#bdb76b', + darkmagenta: '#8b008b', + darkolivegreen: '#556b2f', + darkorange: '#ff8c00', + darkorchid: '#9932cc', + darkred: '#8b0000', + darksalmon: '#e9967a', + darkseagreen: '#8fbc8f', + darkslateblue: '#483d8b', + darkslategray: '#2f4f4f', + darkslategrey: '#2f4f4f', + darkturquoise: '#00ced1', + darkviolet: '#9400d3', + deeppink: '#ff1493', + deepskyblue: '#00bfff', + dimgray: '#696969', + dimgrey: '#696969', + dodgerblue: '#1e90ff', + firebrick: '#b22222', + floralwhite: '#fffaf0', + forestgreen: '#228b22', + fuchsia: '#ff00ff', + gainsboro: '#dcdcdc', + ghostwhite: '#f8f8ff', + gold: '#ffd700', + goldenrod: '#daa520', + gray: '#808080', + green: '#008000', + greenyellow: '#adff2f', + grey: '#808080', + honeydew: '#f0fff0', + hotpink: '#ff69b4', + indianred: '#cd5c5c', + indigo: '#4b0082', + ivory: '#fffff0', + khaki: '#f0e68c', + laserlemon: '#ffff54', + lavender: '#e6e6fa', + lavenderblush: '#fff0f5', + lawngreen: '#7cfc00', + lemonchiffon: '#fffacd', + lightblue: '#add8e6', + lightcoral: '#f08080', + lightcyan: '#e0ffff', + lightgoldenrod: '#fafad2', + lightgoldenrodyellow: '#fafad2', + lightgray: '#d3d3d3', + lightgreen: '#90ee90', + lightgrey: '#d3d3d3', + lightpink: '#ffb6c1', + lightsalmon: '#ffa07a', + lightseagreen: '#20b2aa', + lightskyblue: '#87cefa', + lightslategray: '#778899', + lightslategrey: '#778899', + lightsteelblue: '#b0c4de', + lightyellow: '#ffffe0', + lime: '#00ff00', + limegreen: '#32cd32', + linen: '#faf0e6', + magenta: '#ff00ff', + maroon: '#800000', + maroon2: '#7f0000', + maroon3: '#b03060', + mediumaquamarine: '#66cdaa', + mediumblue: '#0000cd', + mediumorchid: '#ba55d3', + mediumpurple: '#9370db', + mediumseagreen: '#3cb371', + mediumslateblue: '#7b68ee', + mediumspringgreen: '#00fa9a', + mediumturquoise: '#48d1cc', + mediumvioletred: '#c71585', + midnightblue: '#191970', + mintcream: '#f5fffa', + mistyrose: '#ffe4e1', + moccasin: '#ffe4b5', + navajowhite: '#ffdead', + navy: '#000080', + oldlace: '#fdf5e6', + olive: '#808000', + olivedrab: '#6b8e23', + orange: '#ffa500', + orangered: '#ff4500', + orchid: '#da70d6', + palegoldenrod: '#eee8aa', + palegreen: '#98fb98', + paleturquoise: '#afeeee', + palevioletred: '#db7093', + papayawhip: '#ffefd5', + peachpuff: '#ffdab9', + peru: '#cd853f', + pink: '#ffc0cb', + plum: '#dda0dd', + powderblue: '#b0e0e6', + purple: '#800080', + purple2: '#7f007f', + purple3: '#a020f0', + rebeccapurple: '#663399', + red: '#ff0000', + rosybrown: '#bc8f8f', + royalblue: '#4169e1', + saddlebrown: '#8b4513', + salmon: '#fa8072', + sandybrown: '#f4a460', + seagreen: '#2e8b57', + seashell: '#fff5ee', + sienna: '#a0522d', + silver: '#c0c0c0', + skyblue: '#87ceeb', + slateblue: '#6a5acd', + slategray: '#708090', + slategrey: '#708090', + snow: '#fffafa', + springgreen: '#00ff7f', + steelblue: '#4682b4', + tan: '#d2b48c', + teal: '#008080', + thistle: '#d8bfd8', + tomato: '#ff6347', + turquoise: '#40e0d0', + violet: '#ee82ee', + wheat: '#f5deb3', + white: '#ffffff', + whitesmoke: '#f5f5f5', + yellow: '#ffff00', + yellowgreen: '#9acd32' + }; + + var w3cx11_1 = w3cx11$1; + + var Color$s = Color_1; + var input$5 = input$h; + var type$c = utils.type; + + var w3cx11 = w3cx11_1; + var hex2rgb = hex2rgb_1; + var rgb2hex = rgb2hex_1; + + Color$s.prototype.name = function() { + var hex = rgb2hex(this._rgb, 'rgb'); + for (var i = 0, list = Object.keys(w3cx11); i < list.length; i += 1) { + var n = list[i]; + + if (w3cx11[n] === hex) { return n.toLowerCase(); } + } + return hex; + }; + + input$5.format.named = function (name) { + name = name.toLowerCase(); + if (w3cx11[name]) { return hex2rgb(w3cx11[name]); } + throw new Error('unknown color name: '+name); + }; + + input$5.autodetect.push({ + p: 5, + test: function (h) { + var rest = [], len = arguments.length - 1; + while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ]; + + if (!rest.length && type$c(h) === 'string' && w3cx11[h.toLowerCase()]) { + return 'named'; } } - } + }); - function localeMonthsParse(monthName, format, strict) { - var i, mom, regex; + var unpack$8 = utils.unpack; - if (this._monthsParseExact) { - return handleStrictParse.call(this, monthName, format, strict); - } + var rgb2num$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - if (!this._monthsParse) { - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; + var ref = unpack$8(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + return (r << 16) + (g << 8) + b; + }; + + var rgb2num_1 = rgb2num$1; + + var type$b = utils.type; + + var num2rgb = function (num) { + if (type$b(num) == "number" && num >= 0 && num <= 0xFFFFFF) { + var r = num >> 16; + var g = (num >> 8) & 0xFF; + var b = num & 0xFF; + return [r,g,b,1]; } + throw new Error("unknown num color: "+num); + }; - // TODO: add sorting - // Sorting makes sure if one month (or abbr) is a prefix of another - // see sorting in computeMonthsParse - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, i]); - if (strict && !this._longMonthsParse[i]) { - this._longMonthsParse[i] = new RegExp( - '^' + this.months(mom, '').replace('.', '') + '$', - 'i' - ); - this._shortMonthsParse[i] = new RegExp( - '^' + this.monthsShort(mom, '').replace('.', '') + '$', - 'i' - ); - } - if (!strict && !this._monthsParse[i]) { - regex = - '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); - this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if ( - strict && - format === 'MMMM' && - this._longMonthsParse[i].test(monthName) - ) { - return i; - } else if ( - strict && - format === 'MMM' && - this._shortMonthsParse[i].test(monthName) - ) { - return i; - } else if (!strict && this._monthsParse[i].test(monthName)) { - return i; + var num2rgb_1 = num2rgb; + + var chroma$9 = chroma_1; + var Color$r = Color_1; + var input$4 = input$h; + var type$a = utils.type; + + var rgb2num = rgb2num_1; + + Color$r.prototype.num = function() { + return rgb2num(this._rgb); + }; + + chroma$9.num = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$r, [ null ].concat( args, ['num']) )); + }; + + input$4.format.num = num2rgb_1; + + input$4.autodetect.push({ + p: 5, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + if (args.length === 1 && type$a(args[0]) === 'number' && args[0] >= 0 && args[0] <= 0xFFFFFF) { + return 'num'; } } - } + }); - // MOMENTS + var chroma$8 = chroma_1; + var Color$q = Color_1; + var input$3 = input$h; + var unpack$7 = utils.unpack; + var type$9 = utils.type; + var round$1 = Math.round; - function setMonth(mom, value) { - var dayOfMonth; + Color$q.prototype.rgb = function(rnd) { + if ( rnd === void 0 ) rnd=true; - if (!mom.isValid()) { - // No op - return mom; - } + if (rnd === false) { return this._rgb.slice(0,3); } + return this._rgb.slice(0,3).map(round$1); + }; - if (typeof value === 'string') { - if (/^\d+$/.test(value)) { - value = toInt(value); - } else { - value = mom.localeData().monthsParse(value); - // TODO: Another silent failure? - if (!isNumber(value)) { - return mom; - } + Color$q.prototype.rgba = function(rnd) { + if ( rnd === void 0 ) rnd=true; + + return this._rgb.slice(0,4).map(function (v,i) { + return i<3 ? (rnd === false ? v : round$1(v)) : v; + }); + }; + + chroma$8.rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$q, [ null ].concat( args, ['rgb']) )); + }; + + input$3.format.rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var rgba = unpack$7(args, 'rgba'); + if (rgba[3] === undefined) { rgba[3] = 1; } + return rgba; + }; + + input$3.autodetect.push({ + p: 3, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$7(args, 'rgba'); + if (type$9(args) === 'array' && (args.length === 3 || + args.length === 4 && type$9(args[3]) == 'number' && args[3] >= 0 && args[3] <= 1)) { + return 'rgb'; } } + }); - dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); - mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); - return mom; - } + /* + * Based on implementation by Neil Bartlett + * https://github.com/neilbartlett/color-temperature + */ - function getSetMonth(value) { - if (value != null) { - setMonth(this, value); - hooks.updateOffset(this, true); - return this; + var log$1 = Math.log; + + var temperature2rgb$1 = function (kelvin) { + var temp = kelvin / 100; + var r,g,b; + if (temp < 66) { + r = 255; + g = temp < 6 ? 0 : -155.25485562709179 - 0.44596950469579133 * (g = temp-2) + 104.49216199393888 * log$1(g); + b = temp < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (b = temp-10) + 115.67994401066147 * log$1(b); } else { - return get(this, 'Month'); + r = 351.97690566805693 + 0.114206453784165 * (r = temp-55) - 40.25366309332127 * log$1(r); + g = 325.4494125711974 + 0.07943456536662342 * (g = temp-50) - 28.0852963507957 * log$1(g); + b = 255; } - } + return [r,g,b,1]; + }; - function getDaysInMonth() { - return daysInMonth(this.year(), this.month()); - } + var temperature2rgb_1 = temperature2rgb$1; - function monthsShortRegex(isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsShortStrictRegex; + /* + * Based on implementation by Neil Bartlett + * https://github.com/neilbartlett/color-temperature + **/ + + var temperature2rgb = temperature2rgb_1; + var unpack$6 = utils.unpack; + var round = Math.round; + + var rgb2temperature$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var rgb = unpack$6(args, 'rgb'); + var r = rgb[0], b = rgb[2]; + var minTemp = 1000; + var maxTemp = 40000; + var eps = 0.4; + var temp; + while (maxTemp - minTemp > eps) { + temp = (maxTemp + minTemp) * 0.5; + var rgb$1 = temperature2rgb(temp); + if ((rgb$1[2] / rgb$1[0]) >= (b / r)) { + maxTemp = temp; } else { - return this._monthsShortRegex; - } - } else { - if (!hasOwnProp(this, '_monthsShortRegex')) { - this._monthsShortRegex = defaultMonthsShortRegex; + minTemp = temp; } - return this._monthsShortStrictRegex && isStrict - ? this._monthsShortStrictRegex - : this._monthsShortRegex; } - } + return round(temp); + }; - function monthsRegex(isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsStrictRegex; - } else { - return this._monthsRegex; - } - } else { - if (!hasOwnProp(this, '_monthsRegex')) { - this._monthsRegex = defaultMonthsRegex; - } - return this._monthsStrictRegex && isStrict - ? this._monthsStrictRegex - : this._monthsRegex; + var rgb2temperature_1 = rgb2temperature$1; + + var chroma$7 = chroma_1; + var Color$p = Color_1; + var input$2 = input$h; + + var rgb2temperature = rgb2temperature_1; + + Color$p.prototype.temp = + Color$p.prototype.kelvin = + Color$p.prototype.temperature = function() { + return rgb2temperature(this._rgb); + }; + + chroma$7.temp = + chroma$7.kelvin = + chroma$7.temperature = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$p, [ null ].concat( args, ['temp']) )); + }; + + input$2.format.temp = + input$2.format.kelvin = + input$2.format.temperature = temperature2rgb_1; + + var unpack$5 = utils.unpack; + var cbrt = Math.cbrt; + var pow$8 = Math.pow; + var sign$1 = Math.sign; + + var rgb2oklab$2 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + // OKLab color space implementation taken from + // https://bottosson.github.io/posts/oklab/ + var ref = unpack$5(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var ref$1 = [rgb2lrgb(r / 255), rgb2lrgb(g / 255), rgb2lrgb(b / 255)]; + var lr = ref$1[0]; + var lg = ref$1[1]; + var lb = ref$1[2]; + var l = cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb); + var m = cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb); + var s = cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb); + + return [ + 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s, + 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s, + 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s + ]; + }; + + var rgb2oklab_1 = rgb2oklab$2; + + function rgb2lrgb(c) { + var abs = Math.abs(c); + if (abs < 0.04045) { + return c / 12.92; } + return (sign$1(c) || 1) * pow$8((abs + 0.055) / 1.055, 2.4); } - function computeMonthsParse() { - function cmpLenRev(a, b) { - return b.length - a.length; - } + var unpack$4 = utils.unpack; + var pow$7 = Math.pow; + var sign = Math.sign; - var shortPieces = [], - longPieces = [], - mixedPieces = [], - i, - mom; - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, i]); - shortPieces.push(this.monthsShort(mom, '')); - longPieces.push(this.months(mom, '')); - mixedPieces.push(this.months(mom, '')); - mixedPieces.push(this.monthsShort(mom, '')); - } - // Sorting makes sure if one month (or abbr) is a prefix of another it - // will match the longer piece. - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 12; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - } - for (i = 0; i < 24; i++) { - mixedPieces[i] = regexEscape(mixedPieces[i]); - } + /* + * L* [0..100] + * a [-100..100] + * b [-100..100] + */ + var oklab2rgb$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._monthsShortRegex = this._monthsRegex; - this._monthsStrictRegex = new RegExp( - '^(' + longPieces.join('|') + ')', - 'i' - ); - this._monthsShortStrictRegex = new RegExp( - '^(' + shortPieces.join('|') + ')', - 'i' - ); - } + args = unpack$4(args, 'lab'); + var L = args[0]; + var a = args[1]; + var b = args[2]; - // FORMATTING + var l = pow$7(L + 0.3963377774 * a + 0.2158037573 * b, 3); + var m = pow$7(L - 0.1055613458 * a - 0.0638541728 * b, 3); + var s = pow$7(L - 0.0894841775 * a - 1.291485548 * b, 3); - addFormatToken('Y', 0, 0, function () { - var y = this.year(); - return y <= 9999 ? zeroFill(y, 4) : '+' + y; - }); + return [ + 255 * lrgb2rgb(+4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s), + 255 * lrgb2rgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s), + 255 * lrgb2rgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s), + args.length > 3 ? args[3] : 1 + ]; + }; - addFormatToken(0, ['YY', 2], 0, function () { - return this.year() % 100; - }); + var oklab2rgb_1 = oklab2rgb$1; - addFormatToken(0, ['YYYY', 4], 0, 'year'); - addFormatToken(0, ['YYYYY', 5], 0, 'year'); - addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); + function lrgb2rgb(c) { + var abs = Math.abs(c); + if (abs > 0.0031308) { + return (sign(c) || 1) * (1.055 * pow$7(abs, 1 / 2.4) - 0.055); + } + return c * 12.92; + } - // ALIASES + var unpack$3 = utils.unpack; + var type$8 = utils.type; + var chroma$6 = chroma_1; + var Color$o = Color_1; + var input$1 = input$h; - addUnitAlias('year', 'y'); + var rgb2oklab$1 = rgb2oklab_1; - // PRIORITIES + Color$o.prototype.oklab = function () { + return rgb2oklab$1(this._rgb); + }; - addUnitPriority('year', 1); + chroma$6.oklab = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - // PARSING + return new (Function.prototype.bind.apply( Color$o, [ null ].concat( args, ['oklab']) )); + }; - addRegexToken('Y', matchSigned); - addRegexToken('YY', match1to2, match2); - addRegexToken('YYYY', match1to4, match4); - addRegexToken('YYYYY', match1to6, match6); - addRegexToken('YYYYYY', match1to6, match6); + input$1.format.oklab = oklab2rgb_1; - addParseToken(['YYYYY', 'YYYYYY'], YEAR); - addParseToken('YYYY', function (input, array) { - array[YEAR] = - input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); - }); - addParseToken('YY', function (input, array) { - array[YEAR] = hooks.parseTwoDigitYear(input); - }); - addParseToken('Y', function (input, array) { - array[YEAR] = parseInt(input, 10); + input$1.autodetect.push({ + p: 3, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$3(args, 'oklab'); + if (type$8(args) === 'array' && args.length === 3) { + return 'oklab'; + } + } }); - // HELPERS + var unpack$2 = utils.unpack; + var rgb2oklab = rgb2oklab_1; + var lab2lch = lab2lch_1; - function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; - } + var rgb2oklch$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; - // HOOKS + var ref = unpack$2(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var ref$1 = rgb2oklab(r, g, b); + var l = ref$1[0]; + var a = ref$1[1]; + var b_ = ref$1[2]; + return lab2lch(l, a, b_); + }; - hooks.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); + var rgb2oklch_1 = rgb2oklch$1; + + var unpack$1 = utils.unpack; + var lch2lab = lch2lab_1; + var oklab2rgb = oklab2rgb_1; + + var oklch2rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$1(args, 'lch'); + var l = args[0]; + var c = args[1]; + var h = args[2]; + var ref = lch2lab(l, c, h); + var L = ref[0]; + var a = ref[1]; + var b_ = ref[2]; + var ref$1 = oklab2rgb(L, a, b_); + var r = ref$1[0]; + var g = ref$1[1]; + var b = ref$1[2]; + return [r, g, b, args.length > 3 ? args[3] : 1]; }; - // MOMENTS + var oklch2rgb_1 = oklch2rgb; - var getSetYear = makeGetSet('FullYear', true); + var unpack = utils.unpack; + var type$7 = utils.type; + var chroma$5 = chroma_1; + var Color$n = Color_1; + var input = input$h; - function getIsLeapYear() { - return isLeapYear(this.year()); - } + var rgb2oklch = rgb2oklch_1; - function createDate(y, m, d, h, M, s, ms) { - // can't just apply() to create a date: - // https://stackoverflow.com/q/181348 - var date; - // the date constructor remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0) { - // preserve leap years using a full 400 year cycle, then reset - date = new Date(y + 400, m, d, h, M, s, ms); - if (isFinite(date.getFullYear())) { - date.setFullYear(y); + Color$n.prototype.oklch = function () { + return rgb2oklch(this._rgb); + }; + + chroma$5.oklch = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$n, [ null ].concat( args, ['oklch']) )); + }; + + input.format.oklch = oklch2rgb_1; + + input.autodetect.push({ + p: 3, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack(args, 'oklch'); + if (type$7(args) === 'array' && args.length === 3) { + return 'oklch'; } - } else { - date = new Date(y, m, d, h, M, s, ms); } + }); - return date; - } + var Color$m = Color_1; + var type$6 = utils.type; - function createUTCDate(y) { - var date, args; - // the Date.UTC function remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0) { - args = Array.prototype.slice.call(arguments); - // preserve leap years using a full 400 year cycle, then reset - args[0] = y + 400; - date = new Date(Date.UTC.apply(null, args)); - if (isFinite(date.getUTCFullYear())) { - date.setUTCFullYear(y); + Color$m.prototype.alpha = function(a, mutate) { + if ( mutate === void 0 ) mutate=false; + + if (a !== undefined && type$6(a) === 'number') { + if (mutate) { + this._rgb[3] = a; + return this; } - } else { - date = new Date(Date.UTC.apply(null, arguments)); + return new Color$m([this._rgb[0], this._rgb[1], this._rgb[2], a], 'rgb'); } + return this._rgb[3]; + }; - return date; - } + var Color$l = Color_1; - // start-of-first-week - start-of-year - function firstWeekOffset(year, dow, doy) { - var // first-week day -- which january is always in the first week (4 for iso, 1 for other) - fwd = 7 + dow - doy, - // first-week day local weekday -- which local weekday is fwd - fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; + Color$l.prototype.clipped = function() { + return this._rgb._clipped || false; + }; - return -fwdlw + fwd - 1; - } + var Color$k = Color_1; + var LAB_CONSTANTS$1 = labConstants; - // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday - function dayOfYearFromWeeks(year, week, weekday, dow, doy) { - var localWeekday = (7 + weekday - dow) % 7, - weekOffset = firstWeekOffset(year, dow, doy), - dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, - resYear, - resDayOfYear; + Color$k.prototype.darken = function(amount) { + if ( amount === void 0 ) amount=1; - if (dayOfYear <= 0) { - resYear = year - 1; - resDayOfYear = daysInYear(resYear) + dayOfYear; - } else if (dayOfYear > daysInYear(year)) { - resYear = year + 1; - resDayOfYear = dayOfYear - daysInYear(year); - } else { - resYear = year; - resDayOfYear = dayOfYear; - } + var me = this; + var lab = me.lab(); + lab[0] -= LAB_CONSTANTS$1.Kn * amount; + return new Color$k(lab, 'lab').alpha(me.alpha(), true); + }; - return { - year: resYear, - dayOfYear: resDayOfYear, - }; - } + Color$k.prototype.brighten = function(amount) { + if ( amount === void 0 ) amount=1; - function weekOfYear(mom, dow, doy) { - var weekOffset = firstWeekOffset(mom.year(), dow, doy), - week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, - resWeek, - resYear; + return this.darken(-amount); + }; - if (week < 1) { - resYear = mom.year() - 1; - resWeek = week + weeksInYear(resYear, dow, doy); - } else if (week > weeksInYear(mom.year(), dow, doy)) { - resWeek = week - weeksInYear(mom.year(), dow, doy); - resYear = mom.year() + 1; + Color$k.prototype.darker = Color$k.prototype.darken; + Color$k.prototype.brighter = Color$k.prototype.brighten; + + var Color$j = Color_1; + + Color$j.prototype.get = function(mc) { + var ref = mc.split('.'); + var mode = ref[0]; + var channel = ref[1]; + var src = this[mode](); + if (channel) { + var i = mode.indexOf(channel); + if (i > -1) { return src[i]; } + throw new Error(("unknown channel " + channel + " in mode " + mode)); } else { - resYear = mom.year(); - resWeek = week; + return src; } + }; - return { - week: resWeek, - year: resYear, - }; - } + var Color$i = Color_1; + var type$5 = utils.type; + var pow$6 = Math.pow; - function weeksInYear(year, dow, doy) { - var weekOffset = firstWeekOffset(year, dow, doy), - weekOffsetNext = firstWeekOffset(year + 1, dow, doy); - return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; - } + var EPS = 1e-7; + var MAX_ITER = 20; - // FORMATTING + Color$i.prototype.luminance = function(lum) { + if (lum !== undefined && type$5(lum) === 'number') { + if (lum === 0) { + // return pure black + return new Color$i([0,0,0,this._rgb[3]], 'rgb'); + } + if (lum === 1) { + // return pure white + return new Color$i([255,255,255,this._rgb[3]], 'rgb'); + } + // compute new color using... + var cur_lum = this.luminance(); + var mode = 'rgb'; + var max_iter = MAX_ITER; - addFormatToken('w', ['ww', 2], 'wo', 'week'); - addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); + var test = function (low, high) { + var mid = low.interpolate(high, 0.5, mode); + var lm = mid.luminance(); + if (Math.abs(lum - lm) < EPS || !max_iter--) { + // close enough + return mid; + } + return lm > lum ? test(low, mid) : test(mid, high); + }; - // ALIASES + var rgb = (cur_lum > lum ? test(new Color$i([0,0,0]), this) : test(this, new Color$i([255,255,255]))).rgb(); + return new Color$i(rgb.concat( [this._rgb[3]])); + } + return rgb2luminance.apply(void 0, (this._rgb).slice(0,3)); + }; - addUnitAlias('week', 'w'); - addUnitAlias('isoWeek', 'W'); - // PRIORITIES + var rgb2luminance = function (r,g,b) { + // relative luminance + // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef + r = luminance_x(r); + g = luminance_x(g); + b = luminance_x(b); + return 0.2126 * r + 0.7152 * g + 0.0722 * b; + }; - addUnitPriority('week', 5); - addUnitPriority('isoWeek', 5); + var luminance_x = function (x) { + x /= 255; + return x <= 0.03928 ? x/12.92 : pow$6((x+0.055)/1.055, 2.4); + }; - // PARSING + var interpolator$1 = {}; - addRegexToken('w', match1to2); - addRegexToken('ww', match1to2, match2); - addRegexToken('W', match1to2); - addRegexToken('WW', match1to2, match2); + var Color$h = Color_1; + var type$4 = utils.type; + var interpolator = interpolator$1; - addWeekParseToken( - ['w', 'ww', 'W', 'WW'], - function (input, week, config, token) { - week[token.substr(0, 1)] = toInt(input); - } - ); + var mix$1 = function (col1, col2, f) { + if ( f === void 0 ) f=0.5; + var rest = [], len = arguments.length - 3; + while ( len-- > 0 ) rest[ len ] = arguments[ len + 3 ]; - // HELPERS + var mode = rest[0] || 'lrgb'; + if (!interpolator[mode] && !rest.length) { + // fall back to the first supported mode + mode = Object.keys(interpolator)[0]; + } + if (!interpolator[mode]) { + throw new Error(("interpolation mode " + mode + " is not defined")); + } + if (type$4(col1) !== 'object') { col1 = new Color$h(col1); } + if (type$4(col2) !== 'object') { col2 = new Color$h(col2); } + return interpolator[mode](col1, col2, f) + .alpha(col1.alpha() + f * (col2.alpha() - col1.alpha())); + }; - // LOCALES + var Color$g = Color_1; + var mix = mix$1; - function localeWeek(mom) { - return weekOfYear(mom, this._week.dow, this._week.doy).week; - } + Color$g.prototype.mix = + Color$g.prototype.interpolate = function(col2, f) { + if ( f === void 0 ) f=0.5; + var rest = [], len = arguments.length - 2; + while ( len-- > 0 ) rest[ len ] = arguments[ len + 2 ]; - var defaultLocaleWeek = { - dow: 0, // Sunday is the first day of the week. - doy: 6, // The week that contains Jan 6th is the first week of the year. + return mix.apply(void 0, [ this, col2, f ].concat( rest )); }; - function localeFirstDayOfWeek() { - return this._week.dow; - } + var Color$f = Color_1; - function localeFirstDayOfYear() { - return this._week.doy; - } + Color$f.prototype.premultiply = function(mutate) { + if ( mutate === void 0 ) mutate=false; - // MOMENTS + var rgb = this._rgb; + var a = rgb[3]; + if (mutate) { + this._rgb = [rgb[0]*a, rgb[1]*a, rgb[2]*a, a]; + return this; + } else { + return new Color$f([rgb[0]*a, rgb[1]*a, rgb[2]*a, a], 'rgb'); + } + }; - function getSetWeek(input) { - var week = this.localeData().week(this); - return input == null ? week : this.add((input - week) * 7, 'd'); - } + var Color$e = Color_1; + var LAB_CONSTANTS = labConstants; - function getSetISOWeek(input) { - var week = weekOfYear(this, 1, 4).week; - return input == null ? week : this.add((input - week) * 7, 'd'); - } + Color$e.prototype.saturate = function(amount) { + if ( amount === void 0 ) amount=1; - // FORMATTING + var me = this; + var lch = me.lch(); + lch[1] += LAB_CONSTANTS.Kn * amount; + if (lch[1] < 0) { lch[1] = 0; } + return new Color$e(lch, 'lch').alpha(me.alpha(), true); + }; - addFormatToken('d', 0, 'do', 'day'); + Color$e.prototype.desaturate = function(amount) { + if ( amount === void 0 ) amount=1; - addFormatToken('dd', 0, 0, function (format) { - return this.localeData().weekdaysMin(this, format); - }); + return this.saturate(-amount); + }; - addFormatToken('ddd', 0, 0, function (format) { - return this.localeData().weekdaysShort(this, format); - }); + var Color$d = Color_1; + var type$3 = utils.type; - addFormatToken('dddd', 0, 0, function (format) { - return this.localeData().weekdays(this, format); - }); + Color$d.prototype.set = function(mc, value, mutate) { + if ( mutate === void 0 ) mutate=false; - addFormatToken('e', 0, 0, 'weekday'); - addFormatToken('E', 0, 0, 'isoWeekday'); + var ref = mc.split('.'); + var mode = ref[0]; + var channel = ref[1]; + var src = this[mode](); + if (channel) { + var i = mode.indexOf(channel); + if (i > -1) { + if (type$3(value) == 'string') { + switch(value.charAt(0)) { + case '+': src[i] += +value; break; + case '-': src[i] += +value; break; + case '*': src[i] *= +(value.substr(1)); break; + case '/': src[i] /= +(value.substr(1)); break; + default: src[i] = +value; + } + } else if (type$3(value) === 'number') { + src[i] = value; + } else { + throw new Error("unsupported value for Color.set"); + } + var out = new Color$d(src, mode); + if (mutate) { + this._rgb = out._rgb; + return this; + } + return out; + } + throw new Error(("unknown channel " + channel + " in mode " + mode)); + } else { + return src; + } + }; - // ALIASES + var Color$c = Color_1; - addUnitAlias('day', 'd'); - addUnitAlias('weekday', 'e'); - addUnitAlias('isoWeekday', 'E'); + var rgb = function (col1, col2, f) { + var xyz0 = col1._rgb; + var xyz1 = col2._rgb; + return new Color$c( + xyz0[0] + f * (xyz1[0]-xyz0[0]), + xyz0[1] + f * (xyz1[1]-xyz0[1]), + xyz0[2] + f * (xyz1[2]-xyz0[2]), + 'rgb' + ) + }; - // PRIORITY - addUnitPriority('day', 11); - addUnitPriority('weekday', 11); - addUnitPriority('isoWeekday', 11); + // register interpolator + interpolator$1.rgb = rgb; + + var Color$b = Color_1; + var sqrt$2 = Math.sqrt; + var pow$5 = Math.pow; + + var lrgb = function (col1, col2, f) { + var ref = col1._rgb; + var x1 = ref[0]; + var y1 = ref[1]; + var z1 = ref[2]; + var ref$1 = col2._rgb; + var x2 = ref$1[0]; + var y2 = ref$1[1]; + var z2 = ref$1[2]; + return new Color$b( + sqrt$2(pow$5(x1,2) * (1-f) + pow$5(x2,2) * f), + sqrt$2(pow$5(y1,2) * (1-f) + pow$5(y2,2) * f), + sqrt$2(pow$5(z1,2) * (1-f) + pow$5(z2,2) * f), + 'rgb' + ) + }; - // PARSING + // register interpolator + interpolator$1.lrgb = lrgb; - addRegexToken('d', match1to2); - addRegexToken('e', match1to2); - addRegexToken('E', match1to2); - addRegexToken('dd', function (isStrict, locale) { - return locale.weekdaysMinRegex(isStrict); - }); - addRegexToken('ddd', function (isStrict, locale) { - return locale.weekdaysShortRegex(isStrict); - }); - addRegexToken('dddd', function (isStrict, locale) { - return locale.weekdaysRegex(isStrict); - }); + var Color$a = Color_1; - addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { - var weekday = config._locale.weekdaysParse(input, token, config._strict); - // if we didn't get a weekday name, mark the date as invalid - if (weekday != null) { - week.d = weekday; + var lab = function (col1, col2, f) { + var xyz0 = col1.lab(); + var xyz1 = col2.lab(); + return new Color$a( + xyz0[0] + f * (xyz1[0]-xyz0[0]), + xyz0[1] + f * (xyz1[1]-xyz0[1]), + xyz0[2] + f * (xyz1[2]-xyz0[2]), + 'lab' + ) + }; + + // register interpolator + interpolator$1.lab = lab; + + var Color$9 = Color_1; + + var _hsx = function (col1, col2, f, m) { + var assign, assign$1; + + var xyz0, xyz1; + if (m === 'hsl') { + xyz0 = col1.hsl(); + xyz1 = col2.hsl(); + } else if (m === 'hsv') { + xyz0 = col1.hsv(); + xyz1 = col2.hsv(); + } else if (m === 'hcg') { + xyz0 = col1.hcg(); + xyz1 = col2.hcg(); + } else if (m === 'hsi') { + xyz0 = col1.hsi(); + xyz1 = col2.hsi(); + } else if (m === 'lch' || m === 'hcl') { + m = 'hcl'; + xyz0 = col1.hcl(); + xyz1 = col2.hcl(); + } else if (m === 'oklch') { + xyz0 = col1.oklch().reverse(); + xyz1 = col2.oklch().reverse(); + } + + var hue0, hue1, sat0, sat1, lbv0, lbv1; + if (m.substr(0, 1) === 'h' || m === 'oklch') { + (assign = xyz0, hue0 = assign[0], sat0 = assign[1], lbv0 = assign[2]); + (assign$1 = xyz1, hue1 = assign$1[0], sat1 = assign$1[1], lbv1 = assign$1[2]); + } + + var sat, hue, lbv, dh; + + if (!isNaN(hue0) && !isNaN(hue1)) { + // both colors have hue + if (hue1 > hue0 && hue1 - hue0 > 180) { + dh = hue1 - (hue0 + 360); + } else if (hue1 < hue0 && hue0 - hue1 > 180) { + dh = hue1 + 360 - hue0; + } else { + dh = hue1 - hue0; + } + hue = hue0 + f * dh; + } else if (!isNaN(hue0)) { + hue = hue0; + if ((lbv1 == 1 || lbv1 == 0) && m != 'hsv') { sat = sat0; } + } else if (!isNaN(hue1)) { + hue = hue1; + if ((lbv0 == 1 || lbv0 == 0) && m != 'hsv') { sat = sat1; } } else { - getParsingFlags(config).invalidWeekday = input; + hue = Number.NaN; } - }); - addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { - week[token] = toInt(input); - }); + if (sat === undefined) { sat = sat0 + f * (sat1 - sat0); } + lbv = lbv0 + f * (lbv1 - lbv0); + return m === 'oklch' ? new Color$9([lbv, sat, hue], m) : new Color$9([hue, sat, lbv], m); + }; - // HELPERS + var interpolate_hsx$5 = _hsx; - function parseWeekday(input, locale) { - if (typeof input !== 'string') { - return input; - } + var lch = function (col1, col2, f) { + return interpolate_hsx$5(col1, col2, f, 'lch'); + }; - if (!isNaN(input)) { - return parseInt(input, 10); - } + // register interpolator + interpolator$1.lch = lch; + interpolator$1.hcl = lch; - input = locale.weekdaysParse(input); - if (typeof input === 'number') { - return input; - } + var Color$8 = Color_1; - return null; - } + var num = function (col1, col2, f) { + var c1 = col1.num(); + var c2 = col2.num(); + return new Color$8(c1 + f * (c2-c1), 'num') + }; - function parseIsoWeekday(input, locale) { - if (typeof input === 'string') { - return locale.weekdaysParse(input) % 7 || 7; - } - return isNaN(input) ? null : input; - } + // register interpolator + interpolator$1.num = num; - // LOCALES - function shiftWeekdays(ws, n) { - return ws.slice(n, 7).concat(ws.slice(0, n)); - } + var interpolate_hsx$4 = _hsx; - var defaultLocaleWeekdays = - 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), - defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), - defaultWeekdaysRegex = matchWord, - defaultWeekdaysShortRegex = matchWord, - defaultWeekdaysMinRegex = matchWord; + var hcg = function (col1, col2, f) { + return interpolate_hsx$4(col1, col2, f, 'hcg'); + }; - function localeWeekdays(m, format) { - var weekdays = isArray(this._weekdays) - ? this._weekdays - : this._weekdays[ - m && m !== true && this._weekdays.isFormat.test(format) - ? 'format' - : 'standalone' - ]; - return m === true - ? shiftWeekdays(weekdays, this._week.dow) - : m - ? weekdays[m.day()] - : weekdays; - } + // register interpolator + interpolator$1.hcg = hcg; - function localeWeekdaysShort(m) { - return m === true - ? shiftWeekdays(this._weekdaysShort, this._week.dow) - : m - ? this._weekdaysShort[m.day()] - : this._weekdaysShort; - } + var interpolate_hsx$3 = _hsx; - function localeWeekdaysMin(m) { - return m === true - ? shiftWeekdays(this._weekdaysMin, this._week.dow) - : m - ? this._weekdaysMin[m.day()] - : this._weekdaysMin; - } + var hsi = function (col1, col2, f) { + return interpolate_hsx$3(col1, col2, f, 'hsi'); + }; - function handleStrictParse$1(weekdayName, format, strict) { - var i, - ii, - mom, - llc = weekdayName.toLocaleLowerCase(); - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._shortWeekdaysParse = []; - this._minWeekdaysParse = []; + // register interpolator + interpolator$1.hsi = hsi; - for (i = 0; i < 7; ++i) { - mom = createUTC([2000, 1]).day(i); - this._minWeekdaysParse[i] = this.weekdaysMin( - mom, - '' - ).toLocaleLowerCase(); - this._shortWeekdaysParse[i] = this.weekdaysShort( - mom, - '' - ).toLocaleLowerCase(); - this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); + var interpolate_hsx$2 = _hsx; + + var hsl = function (col1, col2, f) { + return interpolate_hsx$2(col1, col2, f, 'hsl'); + }; + + // register interpolator + interpolator$1.hsl = hsl; + + var interpolate_hsx$1 = _hsx; + + var hsv = function (col1, col2, f) { + return interpolate_hsx$1(col1, col2, f, 'hsv'); + }; + + // register interpolator + interpolator$1.hsv = hsv; + + var Color$7 = Color_1; + + var oklab = function (col1, col2, f) { + var xyz0 = col1.oklab(); + var xyz1 = col2.oklab(); + return new Color$7( + xyz0[0] + f * (xyz1[0] - xyz0[0]), + xyz0[1] + f * (xyz1[1] - xyz0[1]), + xyz0[2] + f * (xyz1[2] - xyz0[2]), + 'oklab' + ); + }; + + // register interpolator + interpolator$1.oklab = oklab; + + var interpolate_hsx = _hsx; + + var oklch = function (col1, col2, f) { + return interpolate_hsx(col1, col2, f, 'oklch'); + }; + + // register interpolator + interpolator$1.oklch = oklch; + + var Color$6 = Color_1; + var clip_rgb$1 = utils.clip_rgb; + var pow$4 = Math.pow; + var sqrt$1 = Math.sqrt; + var PI$1 = Math.PI; + var cos$2 = Math.cos; + var sin$2 = Math.sin; + var atan2$1 = Math.atan2; + + var average = function (colors, mode, weights) { + if ( mode === void 0 ) mode='lrgb'; + if ( weights === void 0 ) weights=null; + + var l = colors.length; + if (!weights) { weights = Array.from(new Array(l)).map(function () { return 1; }); } + // normalize weights + var k = l / weights.reduce(function(a, b) { return a + b; }); + weights.forEach(function (w,i) { weights[i] *= k; }); + // convert colors to Color objects + colors = colors.map(function (c) { return new Color$6(c); }); + if (mode === 'lrgb') { + return _average_lrgb(colors, weights) + } + var first = colors.shift(); + var xyz = first.get(mode); + var cnt = []; + var dx = 0; + var dy = 0; + // initial color + for (var i=0; i= 360) { A$1 -= 360; } + xyz[i$1] = A$1; } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; + xyz[i$1] = xyz[i$1]/cnt[i$1]; + } + } + alpha /= l; + return (new Color$6(xyz, mode)).alpha(alpha > 0.99999 ? 1 : alpha, true); + }; + + + var _average_lrgb = function (colors, weights) { + var l = colors.length; + var xyz = [0,0,0,0]; + for (var i=0; i < colors.length; i++) { + var col = colors[i]; + var f = weights[i] / l; + var rgb = col._rgb; + xyz[0] += pow$4(rgb[0],2) * f; + xyz[1] += pow$4(rgb[1],2) * f; + xyz[2] += pow$4(rgb[2],2) * f; + xyz[3] += rgb[3] * f; + } + xyz[0] = sqrt$1(xyz[0]); + xyz[1] = sqrt$1(xyz[1]); + xyz[2] = sqrt$1(xyz[2]); + if (xyz[3] > 0.9999999) { xyz[3] = 1; } + return new Color$6(clip_rgb$1(xyz)); + }; + + // minimal multi-purpose interface + + // @requires utils color analyze + + var chroma$4 = chroma_1; + var type$2 = utils.type; + + var pow$3 = Math.pow; + + var scale$2 = function(colors) { + + // constructor + var _mode = 'rgb'; + var _nacol = chroma$4('#ccc'); + var _spread = 0; + // const _fixed = false; + var _domain = [0, 1]; + var _pos = []; + var _padding = [0,0]; + var _classes = false; + var _colors = []; + var _out = false; + var _min = 0; + var _max = 1; + var _correctLightness = false; + var _colorCache = {}; + var _useCache = true; + var _gamma = 1; + + // private methods + + var setColors = function(colors) { + colors = colors || ['#fff', '#000']; + if (colors && type$2(colors) === 'string' && chroma$4.brewer && + chroma$4.brewer[colors.toLowerCase()]) { + colors = chroma$4.brewer[colors.toLowerCase()]; + } + if (type$2(colors) === 'array') { + // handle single color + if (colors.length === 1) { + colors = [colors[0], colors[0]]; } - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; + // make a copy of the colors + colors = colors.slice(0); + // convert to chroma classes + for (var c=0; c= _classes[i]) { + i++; } - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; + return i-1; + } + return 0; + }; + + var tMapLightness = function (t) { return t; }; + var tMapDomain = function (t) { return t; }; + + // const classifyValue = function(value) { + // let val = value; + // if (_classes.length > 2) { + // const n = _classes.length-1; + // const i = getClass(value); + // const minc = _classes[0] + ((_classes[1]-_classes[0]) * (0 + (_spread * 0.5))); // center of 1st class + // const maxc = _classes[n-1] + ((_classes[n]-_classes[n-1]) * (1 - (_spread * 0.5))); // center of last class + // val = _min + ((((_classes[i] + ((_classes[i+1] - _classes[i]) * 0.5)) - minc) / (maxc-minc)) * (_max - _min)); + // } + // return val; + // }; + + var getColor = function(val, bypassMap) { + var col, t; + if (bypassMap == null) { bypassMap = false; } + if (isNaN(val) || (val === null)) { return _nacol; } + if (!bypassMap) { + if (_classes && (_classes.length > 2)) { + // find the class + var c = getClass(val); + t = c / (_classes.length-2); + } else if (_max !== _min) { + // just interpolate between min/max + t = (val - _min) / (_max - _min); + } else { + t = 1; } - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; + } else { + t = val; } - } - } - function localeWeekdaysParse(weekdayName, format, strict) { - var i, mom, regex; + // domain map + t = tMapDomain(t); - if (this._weekdaysParseExact) { - return handleStrictParse$1.call(this, weekdayName, format, strict); - } + if (!bypassMap) { + t = tMapLightness(t); // lightness correction + } - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._minWeekdaysParse = []; - this._shortWeekdaysParse = []; - this._fullWeekdaysParse = []; - } + if (_gamma !== 1) { t = pow$3(t, _gamma); } - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already + t = _padding[0] + (t * (1 - _padding[0] - _padding[1])); - mom = createUTC([2000, 1]).day(i); - if (strict && !this._fullWeekdaysParse[i]) { - this._fullWeekdaysParse[i] = new RegExp( - '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', - 'i' - ); - this._shortWeekdaysParse[i] = new RegExp( - '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', - 'i' - ); - this._minWeekdaysParse[i] = new RegExp( - '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', - 'i' - ); - } - if (!this._weekdaysParse[i]) { - regex = - '^' + - this.weekdays(mom, '') + - '|^' + - this.weekdaysShort(mom, '') + - '|^' + - this.weekdaysMin(mom, ''); - this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if ( - strict && - format === 'dddd' && - this._fullWeekdaysParse[i].test(weekdayName) - ) { - return i; - } else if ( - strict && - format === 'ddd' && - this._shortWeekdaysParse[i].test(weekdayName) - ) { - return i; - } else if ( - strict && - format === 'dd' && - this._minWeekdaysParse[i].test(weekdayName) - ) { - return i; - } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { - return i; + t = Math.min(1, Math.max(0, t)); + + var k = Math.floor(t * 10000); + + if (_useCache && _colorCache[k]) { + col = _colorCache[k]; + } else { + if (type$2(_colors) === 'array') { + //for i in [0.._pos.length-1] + for (var i=0; i<_pos.length; i++) { + var p = _pos[i]; + if (t <= p) { + col = _colors[i]; + break; + } + if ((t >= p) && (i === (_pos.length-1))) { + col = _colors[i]; + break; + } + if (t > p && t < _pos[i+1]) { + t = (t-p)/(_pos[i+1]-p); + col = chroma$4.interpolate(_colors[i], _colors[i+1], t, _mode); + break; + } + } + } else if (type$2(_colors) === 'function') { + col = _colors(t); + } + if (_useCache) { _colorCache[k] = col; } } - } - } + return col; + }; - // MOMENTS + var resetCache = function () { return _colorCache = {}; }; - function getSetDayOfWeek(input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); - if (input != null) { - input = parseWeekday(input, this.localeData()); - return this.add(input - day, 'd'); - } else { - return day; - } - } + setColors(colors); - function getSetLocaleDayOfWeek(input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; - return input == null ? weekday : this.add(input - weekday, 'd'); - } + // public interface - function getSetISODayOfWeek(input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } + var f = function(v) { + var c = chroma$4(getColor(v)); + if (_out && c[_out]) { return c[_out](); } else { return c; } + }; - // behaves the same as moment#day except - // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) - // as a setter, sunday should belong to the previous week. + f.classes = function(classes) { + if (classes != null) { + if (type$2(classes) === 'array') { + _classes = classes; + _domain = [classes[0], classes[classes.length-1]]; + } else { + var d = chroma$4.analyze(_domain); + if (classes === 0) { + _classes = [d.min, d.max]; + } else { + _classes = chroma$4.limits(d, 'e', classes); + } + } + return f; + } + return _classes; + }; - if (input != null) { - var weekday = parseIsoWeekday(input, this.localeData()); - return this.day(this.day() % 7 ? weekday : weekday - 7); - } else { - return this.day() || 7; - } - } - function weekdaysRegex(isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); + f.domain = function(domain) { + if (!arguments.length) { + return _domain; } - if (isStrict) { - return this._weekdaysStrictRegex; + _min = domain[0]; + _max = domain[domain.length-1]; + _pos = []; + var k = _colors.length; + if ((domain.length === k) && (_min !== _max)) { + // update positions + for (var i = 0, list = Array.from(domain); i < list.length; i += 1) { + var d = list[i]; + + _pos.push((d-_min) / (_max-_min)); + } } else { - return this._weekdaysRegex; + for (var c=0; c 2) { + // set domain map + var tOut = domain.map(function (d,i) { return i/(domain.length-1); }); + var tBreaks = domain.map(function (d) { return (d - _min) / (_max - _min); }); + if (!tBreaks.every(function (val, i) { return tOut[i] === val; })) { + tMapDomain = function (t) { + if (t <= 0 || t >= 1) { return t; } + var i = 0; + while (t >= tBreaks[i+1]) { i++; } + var f = (t - tBreaks[i]) / (tBreaks[i+1] - tBreaks[i]); + var out = tOut[i] + f * (tOut[i+1] - tOut[i]); + return out; + }; + } + + } } - } else { - if (!hasOwnProp(this, '_weekdaysRegex')) { - this._weekdaysRegex = defaultWeekdaysRegex; + _domain = [_min, _max]; + return f; + }; + + f.mode = function(_m) { + if (!arguments.length) { + return _mode; } - return this._weekdaysStrictRegex && isStrict - ? this._weekdaysStrictRegex - : this._weekdaysRegex; - } - } + _mode = _m; + resetCache(); + return f; + }; - function weekdaysShortRegex(isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); + f.range = function(colors, _pos) { + setColors(colors); + return f; + }; + + f.out = function(_o) { + _out = _o; + return f; + }; + + f.spread = function(val) { + if (!arguments.length) { + return _spread; } - if (isStrict) { - return this._weekdaysShortStrictRegex; + _spread = val; + return f; + }; + + f.correctLightness = function(v) { + if (v == null) { v = true; } + _correctLightness = v; + resetCache(); + if (_correctLightness) { + tMapLightness = function(t) { + var L0 = getColor(0, true).lab()[0]; + var L1 = getColor(1, true).lab()[0]; + var pol = L0 > L1; + var L_actual = getColor(t, true).lab()[0]; + var L_ideal = L0 + ((L1 - L0) * t); + var L_diff = L_actual - L_ideal; + var t0 = 0; + var t1 = 1; + var max_iter = 20; + while ((Math.abs(L_diff) > 1e-2) && (max_iter-- > 0)) { + (function() { + if (pol) { L_diff *= -1; } + if (L_diff < 0) { + t0 = t; + t += (t1 - t) * 0.5; + } else { + t1 = t; + t += (t0 - t) * 0.5; + } + L_actual = getColor(t, true).lab()[0]; + return L_diff = L_actual - L_ideal; + })(); + } + return t; + }; } else { - return this._weekdaysShortRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysShortRegex')) { - this._weekdaysShortRegex = defaultWeekdaysShortRegex; + tMapLightness = function (t) { return t; }; } - return this._weekdaysShortStrictRegex && isStrict - ? this._weekdaysShortStrictRegex - : this._weekdaysShortRegex; - } - } + return f; + }; - function weekdaysMinRegex(isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysMinStrictRegex; + f.padding = function(p) { + if (p != null) { + if (type$2(p) === 'number') { + p = [p,p]; + } + _padding = p; + return f; } else { - return this._weekdaysMinRegex; + return _padding; } - } else { - if (!hasOwnProp(this, '_weekdaysMinRegex')) { - this._weekdaysMinRegex = defaultWeekdaysMinRegex; - } - return this._weekdaysMinStrictRegex && isStrict - ? this._weekdaysMinStrictRegex - : this._weekdaysMinRegex; - } - } - - function computeWeekdaysParse() { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var minPieces = [], - shortPieces = [], - longPieces = [], - mixedPieces = [], - i, - mom, - minp, - shortp, - longp; - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, 1]).day(i); - minp = regexEscape(this.weekdaysMin(mom, '')); - shortp = regexEscape(this.weekdaysShort(mom, '')); - longp = regexEscape(this.weekdays(mom, '')); - minPieces.push(minp); - shortPieces.push(shortp); - longPieces.push(longp); - mixedPieces.push(minp); - mixedPieces.push(shortp); - mixedPieces.push(longp); - } - // Sorting makes sure if one weekday (or abbr) is a prefix of another it - // will match the longer piece. - minPieces.sort(cmpLenRev); - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); + }; - this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._weekdaysShortRegex = this._weekdaysRegex; - this._weekdaysMinRegex = this._weekdaysRegex; + f.colors = function(numColors, out) { + // If no arguments are given, return the original colors that were provided + if (arguments.length < 2) { out = 'hex'; } + var result = []; - this._weekdaysStrictRegex = new RegExp( - '^(' + longPieces.join('|') + ')', - 'i' - ); - this._weekdaysShortStrictRegex = new RegExp( - '^(' + shortPieces.join('|') + ')', - 'i' - ); - this._weekdaysMinStrictRegex = new RegExp( - '^(' + minPieces.join('|') + ')', - 'i' - ); - } + if (arguments.length === 0) { + result = _colors.slice(0); - // FORMATTING + } else if (numColors === 1) { + result = [f(0.5)]; - function hFormat() { - return this.hours() % 12 || 12; - } + } else if (numColors > 1) { + var dm = _domain[0]; + var dd = _domain[1] - dm; + result = __range__(0, numColors, false).map(function (i) { return f( dm + ((i/(numColors-1)) * dd) ); }); - function kFormat() { - return this.hours() || 24; - } + } else { // returns all colors based on the defined classes + colors = []; + var samples = []; + if (_classes && (_classes.length > 2)) { + for (var i = 1, end = _classes.length, asc = 1 <= end; asc ? i < end : i > end; asc ? i++ : i--) { + samples.push((_classes[i-1]+_classes[i])*0.5); + } + } else { + samples = _domain; + } + result = samples.map(function (v) { return f(v); }); + } - addFormatToken('H', ['HH', 2], 0, 'hour'); - addFormatToken('h', ['hh', 2], 0, hFormat); - addFormatToken('k', ['kk', 2], 0, kFormat); + if (chroma$4[out]) { + result = result.map(function (c) { return c[out](); }); + } + return result; + }; - addFormatToken('hmm', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); - }); + f.cache = function(c) { + if (c != null) { + _useCache = c; + return f; + } else { + return _useCache; + } + }; - addFormatToken('hmmss', 0, 0, function () { - return ( - '' + - hFormat.apply(this) + - zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2) - ); - }); + f.gamma = function(g) { + if (g != null) { + _gamma = g; + return f; + } else { + return _gamma; + } + }; - addFormatToken('Hmm', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2); - }); + f.nodata = function(d) { + if (d != null) { + _nacol = chroma$4(d); + return f; + } else { + return _nacol; + } + }; - addFormatToken('Hmmss', 0, 0, function () { - return ( - '' + - this.hours() + - zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2) - ); - }); + return f; + }; - function meridiem(token, lowercase) { - addFormatToken(token, 0, 0, function () { - return this.localeData().meridiem( - this.hours(), - this.minutes(), - lowercase - ); - }); + function __range__(left, right, inclusive) { + var range = []; + var ascending = left < right; + var end = !inclusive ? right : ascending ? right + 1 : right - 1; + for (var i = left; ascending ? i < end : i > end; ascending ? i++ : i--) { + range.push(i); + } + return range; } - meridiem('a', true); - meridiem('A', false); + // + // interpolates between a set of colors uzing a bezier spline + // - // ALIASES + // @requires utils lab + var Color$5 = Color_1; - addUnitAlias('hour', 'h'); + var scale$1 = scale$2; - // PRIORITY - addUnitPriority('hour', 13); + // nth row of the pascal triangle + var binom_row = function(n) { + var row = [1, 1]; + for (var i = 1; i < n; i++) { + var newrow = [1]; + for (var j = 1; j <= row.length; j++) { + newrow[j] = (row[j] || 0) + row[j - 1]; + } + row = newrow; + } + return row; + }; - // PARSING + var bezier = function(colors) { + var assign, assign$1, assign$2; - function matchMeridiem(isStrict, locale) { - return locale._meridiemParse; - } - - addRegexToken('a', matchMeridiem); - addRegexToken('A', matchMeridiem); - addRegexToken('H', match1to2); - addRegexToken('h', match1to2); - addRegexToken('k', match1to2); - addRegexToken('HH', match1to2, match2); - addRegexToken('hh', match1to2, match2); - addRegexToken('kk', match1to2, match2); - - addRegexToken('hmm', match3to4); - addRegexToken('hmmss', match5to6); - addRegexToken('Hmm', match3to4); - addRegexToken('Hmmss', match5to6); - - addParseToken(['H', 'HH'], HOUR); - addParseToken(['k', 'kk'], function (input, array, config) { - var kInput = toInt(input); - array[HOUR] = kInput === 24 ? 0 : kInput; - }); - addParseToken(['a', 'A'], function (input, array, config) { - config._isPm = config._locale.isPM(input); - config._meridiem = input; - }); - addParseToken(['h', 'hh'], function (input, array, config) { - array[HOUR] = toInt(input); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmmss', function (input, array, config) { - var pos1 = input.length - 4, - pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('Hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - }); - addParseToken('Hmmss', function (input, array, config) { - var pos1 = input.length - 4, - pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - }); + var I, lab0, lab1, lab2; + colors = colors.map(function (c) { return new Color$5(c); }); + if (colors.length === 2) { + // linear interpolation + (assign = colors.map(function (c) { return c.lab(); }), lab0 = assign[0], lab1 = assign[1]); + I = function(t) { + var lab = ([0, 1, 2].map(function (i) { return lab0[i] + (t * (lab1[i] - lab0[i])); })); + return new Color$5(lab, 'lab'); + }; + } else if (colors.length === 3) { + // quadratic bezier interpolation + (assign$1 = colors.map(function (c) { return c.lab(); }), lab0 = assign$1[0], lab1 = assign$1[1], lab2 = assign$1[2]); + I = function(t) { + var lab = ([0, 1, 2].map(function (i) { return ((1-t)*(1-t) * lab0[i]) + (2 * (1-t) * t * lab1[i]) + (t * t * lab2[i]); })); + return new Color$5(lab, 'lab'); + }; + } else if (colors.length === 4) { + // cubic bezier interpolation + var lab3; + (assign$2 = colors.map(function (c) { return c.lab(); }), lab0 = assign$2[0], lab1 = assign$2[1], lab2 = assign$2[2], lab3 = assign$2[3]); + I = function(t) { + var lab = ([0, 1, 2].map(function (i) { return ((1-t)*(1-t)*(1-t) * lab0[i]) + (3 * (1-t) * (1-t) * t * lab1[i]) + (3 * (1-t) * t * t * lab2[i]) + (t*t*t * lab3[i]); })); + return new Color$5(lab, 'lab'); + }; + } else if (colors.length >= 5) { + // general case (degree n bezier) + var labs, row, n; + labs = colors.map(function (c) { return c.lab(); }); + n = colors.length - 1; + row = binom_row(n); + I = function (t) { + var u = 1 - t; + var lab = ([0, 1, 2].map(function (i) { return labs.reduce(function (sum, el, j) { return (sum + row[j] * Math.pow( u, (n - j) ) * Math.pow( t, j ) * el[i]); }, 0); })); + return new Color$5(lab, 'lab'); + }; + } else { + throw new RangeError("No point in running bezier with only one color.") + } + return I; + }; - // LOCALES + var bezier_1 = function (colors) { + var f = bezier(colors); + f.scale = function () { return scale$1(f); }; + return f; + }; - function localeIsPM(input) { - // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays - // Using charAt should be more compatible. - return (input + '').toLowerCase().charAt(0) === 'p'; - } + /* + * interpolates between a set of colors uzing a bezier spline + * blend mode formulas taken from http://www.venture-ware.com/kevin/coding/lets-learn-math-photoshop-blend-modes/ + */ - var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, - // Setting the hour should keep the time, because the user explicitly - // specified which hour they want. So trying to maintain the same hour (in - // a new timezone) makes sense. Adding/subtracting hours does not follow - // this rule. - getSetHour = makeGetSet('Hours', true); + var chroma$3 = chroma_1; - function localeMeridiem(hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'pm' : 'PM'; - } else { - return isLower ? 'am' : 'AM'; + var blend = function (bottom, top, mode) { + if (!blend[mode]) { + throw new Error('unknown blend mode ' + mode); } - } + return blend[mode](bottom, top); + }; - var baseConfig = { - calendar: defaultCalendar, - longDateFormat: defaultLongDateFormat, - invalidDate: defaultInvalidDate, - ordinal: defaultOrdinal, - dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, - relativeTime: defaultRelativeTime, + var blend_f = function (f) { return function (bottom,top) { + var c0 = chroma$3(top).rgb(); + var c1 = chroma$3(bottom).rgb(); + return chroma$3.rgb(f(c0, c1)); + }; }; - months: defaultLocaleMonths, - monthsShort: defaultLocaleMonthsShort, + var each = function (f) { return function (c0, c1) { + var out = []; + out[0] = f(c0[0], c1[0]); + out[1] = f(c0[1], c1[1]); + out[2] = f(c0[2], c1[2]); + return out; + }; }; + + var normal = function (a) { return a; }; + var multiply = function (a,b) { return a * b / 255; }; + var darken = function (a,b) { return a > b ? b : a; }; + var lighten = function (a,b) { return a > b ? a : b; }; + var screen = function (a,b) { return 255 * (1 - (1-a/255) * (1-b/255)); }; + var overlay = function (a,b) { return b < 128 ? 2 * a * b / 255 : 255 * (1 - 2 * (1 - a / 255 ) * ( 1 - b / 255 )); }; + var burn = function (a,b) { return 255 * (1 - (1 - b / 255) / (a/255)); }; + var dodge = function (a,b) { + if (a === 255) { return 255; } + a = 255 * (b / 255) / (1 - a / 255); + return a > 255 ? 255 : a + }; + + // # add = (a,b) -> + // # if (a + b > 255) then 255 else a + b + + blend.normal = blend_f(each(normal)); + blend.multiply = blend_f(each(multiply)); + blend.screen = blend_f(each(screen)); + blend.overlay = blend_f(each(overlay)); + blend.darken = blend_f(each(darken)); + blend.lighten = blend_f(each(lighten)); + blend.dodge = blend_f(each(dodge)); + blend.burn = blend_f(each(burn)); + // blend.add = blend_f(each(add)); + + var blend_1 = blend; + + // cubehelix interpolation + // based on D.A. Green "A colour scheme for the display of astronomical intensity images" + // http://astron-soc.in/bulletin/11June/289392011.pdf + + var type$1 = utils.type; + var clip_rgb = utils.clip_rgb; + var TWOPI = utils.TWOPI; + var pow$2 = Math.pow; + var sin$1 = Math.sin; + var cos$1 = Math.cos; + var chroma$2 = chroma_1; + + var cubehelix = function(start, rotations, hue, gamma, lightness) { + if ( start === void 0 ) start=300; + if ( rotations === void 0 ) rotations=-1.5; + if ( hue === void 0 ) hue=1; + if ( gamma === void 0 ) gamma=1; + if ( lightness === void 0 ) lightness=[0,1]; + + var dh = 0, dl; + if (type$1(lightness) === 'array') { + dl = lightness[1] - lightness[0]; + } else { + dl = 0; + lightness = [lightness, lightness]; + } + + var f = function(fract) { + var a = TWOPI * (((start+120)/360) + (rotations * fract)); + var l = pow$2(lightness[0] + (dl * fract), gamma); + var h = dh !== 0 ? hue[0] + (fract * dh) : hue; + var amp = (h * l * (1-l)) / 2; + var cos_a = cos$1(a); + var sin_a = sin$1(a); + var r = l + (amp * ((-0.14861 * cos_a) + (1.78277* sin_a))); + var g = l + (amp * ((-0.29227 * cos_a) - (0.90649* sin_a))); + var b = l + (amp * (+1.97294 * cos_a)); + return chroma$2(clip_rgb([r*255,g*255,b*255,1])); + }; - week: defaultLocaleWeek, + f.start = function(s) { + if ((s == null)) { return start; } + start = s; + return f; + }; - weekdays: defaultLocaleWeekdays, - weekdaysMin: defaultLocaleWeekdaysMin, - weekdaysShort: defaultLocaleWeekdaysShort, + f.rotations = function(r) { + if ((r == null)) { return rotations; } + rotations = r; + return f; + }; - meridiemParse: defaultLocaleMeridiemParse, - }; + f.gamma = function(g) { + if ((g == null)) { return gamma; } + gamma = g; + return f; + }; - // internal storage for locale config files - var locales = {}, - localeFamilies = {}, - globalLocale; + f.hue = function(h) { + if ((h == null)) { return hue; } + hue = h; + if (type$1(hue) === 'array') { + dh = hue[1] - hue[0]; + if (dh === 0) { hue = hue[1]; } + } else { + dh = 0; + } + return f; + }; - function commonPrefix(arr1, arr2) { - var i, - minl = Math.min(arr1.length, arr2.length); - for (i = 0; i < minl; i += 1) { - if (arr1[i] !== arr2[i]) { - return i; + f.lightness = function(h) { + if ((h == null)) { return lightness; } + if (type$1(h) === 'array') { + lightness = h; + dl = h[1] - h[0]; + } else { + lightness = [h,h]; + dl = 0; } - } - return minl; - } + return f; + }; - function normalizeLocale(key) { - return key ? key.toLowerCase().replace('_', '-') : key; - } + f.scale = function () { return chroma$2.scale(f); }; - // pick the locale from the array - // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each - // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root - function chooseLocale(names) { - var i = 0, - j, - next, - locale, - split; + f.hue(hue); - while (i < names.length) { - split = normalizeLocale(names[i]).split('-'); - j = split.length; - next = normalizeLocale(names[i + 1]); - next = next ? next.split('-') : null; - while (j > 0) { - locale = loadLocale(split.slice(0, j).join('-')); - if (locale) { - return locale; - } - if ( - next && - next.length >= j && - commonPrefix(split, next) >= j - 1 - ) { - //the next array item is better than a shallower substring of this one - break; - } - j--; - } - i++; - } - return globalLocale; - } + return f; + }; - function isLocaleNameSane(name) { - // Prevent names that look like filesystem paths, i.e contain '/' or '\' - return name.match('^[^/\\\\]*$') != null; - } + var Color$4 = Color_1; + var digits = '0123456789abcdef'; - function loadLocale(name) { - var oldLocale = null, - aliasedRequire; - // TODO: Find a better way to register and load all the locales in Node - if ( - locales[name] === undefined && - typeof module !== 'undefined' && - module && - module.exports && - isLocaleNameSane(name) - ) { - try { - oldLocale = globalLocale._abbr; - aliasedRequire = require; - aliasedRequire('./locale/' + name); - getSetGlobalLocale(oldLocale); - } catch (e) { - // mark as not found to avoid repeating expensive file require call causing high CPU - // when trying to find en-US, en_US, en-us for every format call - locales[name] = null; // null means not found - } + var floor$1 = Math.floor; + var random = Math.random; + + var random_1 = function () { + var code = '#'; + for (var i=0; i<6; i++) { + code += digits.charAt(floor$1(random() * 16)); } - return locales[name]; - } + return new Color$4(code, 'hex'); + }; - // This function will load locale and then set the global locale. If - // no arguments are passed in, it will simply return the current global - // locale key. - function getSetGlobalLocale(key, values) { - var data; - if (key) { - if (isUndefined(values)) { - data = getLocale(key); - } else { - data = defineLocale(key, values); - } + var type = type$p; + var log = Math.log; + var pow$1 = Math.pow; + var floor = Math.floor; + var abs$1 = Math.abs; - if (data) { - // moment.duration._locale = moment._locale = data; - globalLocale = data; - } else { - if (typeof console !== 'undefined' && console.warn) { - //warn user if arguments are passed but the locale could not be set - console.warn( - 'Locale ' + key + ' not found. Did you forget to load it?' - ); - } - } - } - return globalLocale._abbr; - } + var analyze = function (data, key) { + if ( key === void 0 ) key=null; - function defineLocale(name, config) { - if (config !== null) { - var locale, - parentConfig = baseConfig; - config.abbr = name; - if (locales[name] != null) { - deprecateSimple( - 'defineLocaleOverride', - 'use moment.updateLocale(localeName, config) to change ' + - 'an existing locale. moment.defineLocale(localeName, ' + - 'config) should only be used for creating a new locale ' + - 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.' - ); - parentConfig = locales[name]._config; - } else if (config.parentLocale != null) { - if (locales[config.parentLocale] != null) { - parentConfig = locales[config.parentLocale]._config; - } else { - locale = loadLocale(config.parentLocale); - if (locale != null) { - parentConfig = locale._config; - } else { - if (!localeFamilies[config.parentLocale]) { - localeFamilies[config.parentLocale] = []; - } - localeFamilies[config.parentLocale].push({ - name: name, - config: config, - }); - return null; - } - } + var r = { + min: Number.MAX_VALUE, + max: Number.MAX_VALUE*-1, + sum: 0, + values: [], + count: 0 + }; + if (type(data) === 'object') { + data = Object.values(data); + } + data.forEach(function (val) { + if (key && type(val) === 'object') { val = val[key]; } + if (val !== undefined && val !== null && !isNaN(val)) { + r.values.push(val); + r.sum += val; + if (val < r.min) { r.min = val; } + if (val > r.max) { r.max = val; } + r.count += 1; } - locales[name] = new Locale(mergeConfigs(parentConfig, config)); + }); - if (localeFamilies[name]) { - localeFamilies[name].forEach(function (x) { - defineLocale(x.name, x.config); - }); - } + r.domain = [r.min, r.max]; - // backwards compat for now: also set the locale - // make sure we set the locale AFTER all child locales have been - // created, so we won't end up with the child locale set. - getSetGlobalLocale(name); + r.limits = function (mode, num) { return limits(r, mode, num); }; - return locales[name]; - } else { - // useful for testing - delete locales[name]; - return null; - } - } + return r; + }; - function updateLocale(name, config) { - if (config != null) { - var locale, - tmpLocale, - parentConfig = baseConfig; - if (locales[name] != null && locales[name].parentLocale != null) { - // Update existing child locale in-place to avoid memory-leaks - locales[name].set(mergeConfigs(locales[name]._config, config)); - } else { - // MERGE - tmpLocale = loadLocale(name); - if (tmpLocale != null) { - parentConfig = tmpLocale._config; - } - config = mergeConfigs(parentConfig, config); - if (tmpLocale == null) { - // updateLocale is called for creating a new locale - // Set abbr so it will have a name (getters return - // undefined otherwise). - config.abbr = name; - } - locale = new Locale(config); - locale.parentLocale = locales[name]; - locales[name] = locale; - } + var limits = function (data, mode, num) { + if ( mode === void 0 ) mode='equal'; + if ( num === void 0 ) num=7; - // backwards compat for now: also set the locale - getSetGlobalLocale(name); - } else { - // pass null for config to unupdate, useful for tests - if (locales[name] != null) { - if (locales[name].parentLocale != null) { - locales[name] = locales[name].parentLocale; - if (name === getSetGlobalLocale()) { - getSetGlobalLocale(name); - } - } else if (locales[name] != null) { - delete locales[name]; - } - } + if (type(data) == 'array') { + data = analyze(data); } - return locales[name]; - } + var min = data.min; + var max = data.max; + var values = data.values.sort(function (a,b) { return a-b; }); - // returns locale data - function getLocale(key) { - var locale; + if (num === 1) { return [min,max]; } - if (key && key._locale && key._locale._abbr) { - key = key._locale._abbr; - } + var limits = []; - if (!key) { - return globalLocale; + if (mode.substr(0,1) === 'c') { // continuous + limits.push(min); + limits.push(max); } - if (!isArray(key)) { - //short-circuit everything else - locale = loadLocale(key); - if (locale) { - return locale; + if (mode.substr(0,1) === 'e') { // equal interval + limits.push(min); + for (var i=1; i 11 - ? MONTH - : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) - ? DATE - : a[HOUR] < 0 || - a[HOUR] > 24 || - (a[HOUR] === 24 && - (a[MINUTE] !== 0 || - a[SECOND] !== 0 || - a[MILLISECOND] !== 0)) - ? HOUR - : a[MINUTE] < 0 || a[MINUTE] > 59 - ? MINUTE - : a[SECOND] < 0 || a[SECOND] > 59 - ? SECOND - : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 - ? MILLISECOND - : -1; - - if ( - getParsingFlags(m)._overflowDayOfYear && - (overflow < YEAR || overflow > DATE) - ) { - overflow = DATE; - } - if (getParsingFlags(m)._overflowWeeks && overflow === -1) { - overflow = WEEK; + else if (mode.substr(0,1) === 'l') { // log scale + if (min <= 0) { + throw new Error('Logarithmic scales are only possible for values > 0'); } - if (getParsingFlags(m)._overflowWeekday && overflow === -1) { - overflow = WEEKDAY; + var min_log = Math.LOG10E * log(min); + var max_log = Math.LOG10E * log(max); + limits.push(min); + for (var i$1=1; i$1 pb + var pr = p - pb; + limits.push((values[pb]*(1-pr)) + (values[pb+1]*pr)); + } + } + limits.push(max); - // iso 8601 regex - // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) - var extendedIsoRegex = - /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, - basicIsoRegex = - /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, - tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, - isoDates = [ - ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], - ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], - ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], - ['GGGG-[W]WW', /\d{4}-W\d\d/, false], - ['YYYY-DDD', /\d{4}-\d{3}/], - ['YYYY-MM', /\d{4}-\d\d/, false], - ['YYYYYYMMDD', /[+-]\d{10}/], - ['YYYYMMDD', /\d{8}/], - ['GGGG[W]WWE', /\d{4}W\d{3}/], - ['GGGG[W]WW', /\d{4}W\d{2}/, false], - ['YYYYDDD', /\d{7}/], - ['YYYYMM', /\d{6}/, false], - ['YYYY', /\d{4}/, false], - ], - // iso time formats and regexes - isoTimes = [ - ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], - ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], - ['HH:mm:ss', /\d\d:\d\d:\d\d/], - ['HH:mm', /\d\d:\d\d/], - ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], - ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], - ['HHmmss', /\d\d\d\d\d\d/], - ['HHmm', /\d\d\d\d/], - ['HH', /\d\d/], - ], - aspNetJsonRegex = /^\/?Date\((-?\d+)/i, - // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 - 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{4}))$/, - obsOffsets = { - UT: 0, - 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, - }; + } - // date from iso format - function configFromISO(config) { - var i, - l, - string = config._i, - match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), - allowTime, - dateFormat, - timeFormat, - tzFormat, - isoDatesLen = isoDates.length, - isoTimesLen = isoTimes.length; + else if (mode.substr(0,1) === 'k') { // k-means clustering + /* + implementation based on + http://code.google.com/p/figue/source/browse/trunk/figue.js#336 + simplified for 1-d input values + */ + var cluster; + var n = values.length; + var assignments = new Array(n); + var clusterSizes = new Array(num); + var repeat = true; + var nb_iters = 0; + var centroids = null; + + // get seed values + centroids = []; + centroids.push(min); + for (var i$3=1; i$3 200) { + repeat = false; } } - if (!allowTime && timeFormat != null) { - config._isValid = false; - return; + + // finished k-means clustering + // the next part is borrowed from gabrielflor.it + var kClusters = {}; + for (var j$5=0; j$5 l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05); + }; - 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, ' ') - .replace(/^\s\s*/, '') - .replace(/\s\s*$/, ''); - } + var Color$2 = Color_1; + var sqrt = Math.sqrt; + var pow = Math.pow; + var min = Math.min; + var max = Math.max; + var atan2 = Math.atan2; + var abs = Math.abs; + var cos = Math.cos; + var sin = Math.sin; + var exp = Math.exp; + var PI = Math.PI; - function checkWeekday(weekdayStr, parsedInput, config) { - if (weekdayStr) { - // TODO: Replace the vanilla JS Date object with an independent day-of-week check. - var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), - weekdayActual = new Date( - parsedInput[0], - parsedInput[1], - parsedInput[2] - ).getDay(); - if (weekdayProvided !== weekdayActual) { - getParsingFlags(config).weekdayMismatch = true; - config._isValid = false; - return false; - } - } - return true; - } + var deltaE = function(a, b, Kl, Kc, Kh) { + if ( Kl === void 0 ) Kl=1; + if ( Kc === void 0 ) Kc=1; + if ( Kh === void 0 ) Kh=1; - function calculateOffset(obsOffset, militaryOffset, numOffset) { - if (obsOffset) { - return obsOffsets[obsOffset]; - } else if (militaryOffset) { - // the only allowed military tz is Z - return 0; - } else { - var hm = parseInt(numOffset, 10), - m = hm % 100, - h = (hm - m) / 100; - return h * 60 + m; + // Delta E (CIE 2000) + // see http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE2000.html + var rad2deg = function(rad) { + return 360 * rad / (2 * PI); + }; + var deg2rad = function(deg) { + return (2 * PI * deg) / 360; + }; + a = new Color$2(a); + b = new Color$2(b); + var ref = Array.from(a.lab()); + var L1 = ref[0]; + var a1 = ref[1]; + var b1 = ref[2]; + var ref$1 = Array.from(b.lab()); + var L2 = ref$1[0]; + var a2 = ref$1[1]; + var b2 = ref$1[2]; + var avgL = (L1 + L2)/2; + var C1 = sqrt(pow(a1, 2) + pow(b1, 2)); + var C2 = sqrt(pow(a2, 2) + pow(b2, 2)); + var avgC = (C1 + C2)/2; + var G = 0.5*(1-sqrt(pow(avgC, 7)/(pow(avgC, 7) + pow(25, 7)))); + var a1p = a1*(1+G); + var a2p = a2*(1+G); + var C1p = sqrt(pow(a1p, 2) + pow(b1, 2)); + var C2p = sqrt(pow(a2p, 2) + pow(b2, 2)); + var avgCp = (C1p + C2p)/2; + var arctan1 = rad2deg(atan2(b1, a1p)); + var arctan2 = rad2deg(atan2(b2, a2p)); + var h1p = arctan1 >= 0 ? arctan1 : arctan1 + 360; + var h2p = arctan2 >= 0 ? arctan2 : arctan2 + 360; + var avgHp = abs(h1p - h2p) > 180 ? (h1p + h2p + 360)/2 : (h1p + h2p)/2; + var T = 1 - 0.17*cos(deg2rad(avgHp - 30)) + 0.24*cos(deg2rad(2*avgHp)) + 0.32*cos(deg2rad(3*avgHp + 6)) - 0.2*cos(deg2rad(4*avgHp - 63)); + var deltaHp = h2p - h1p; + deltaHp = abs(deltaHp) <= 180 ? deltaHp : h2p <= h1p ? deltaHp + 360 : deltaHp - 360; + deltaHp = 2*sqrt(C1p*C2p)*sin(deg2rad(deltaHp)/2); + var deltaL = L2 - L1; + var deltaCp = C2p - C1p; + var sl = 1 + (0.015*pow(avgL - 50, 2))/sqrt(20 + pow(avgL - 50, 2)); + var sc = 1 + 0.045*avgCp; + var sh = 1 + 0.015*avgCp*T; + var deltaTheta = 30*exp(-pow((avgHp - 275)/25, 2)); + var Rc = 2*sqrt(pow(avgCp, 7)/(pow(avgCp, 7) + pow(25, 7))); + var Rt = -Rc*sin(2*deg2rad(deltaTheta)); + var result = sqrt(pow(deltaL/(Kl*sl), 2) + pow(deltaCp/(Kc*sc), 2) + pow(deltaHp/(Kh*sh), 2) + Rt*(deltaCp/(Kc*sc))*(deltaHp/(Kh*sh))); + return max(0, min(100, result)); + }; + + var Color$1 = Color_1; + + // simple Euclidean distance + var distance = function(a, b, mode) { + if ( mode === void 0 ) mode='lab'; + + // Delta E (CIE 1976) + // see http://www.brucelindbloom.com/index.html?Equations.html + a = new Color$1(a); + b = new Color$1(b); + var l1 = a.get(mode); + var l2 = b.get(mode); + var sum_sq = 0; + for (var i in l1) { + var d = (l1[i] || 0) - (l2[i] || 0); + sum_sq += d*d; + } + return Math.sqrt(sum_sq); + }; + + var Color = Color_1; + + var valid = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + try { + new (Function.prototype.bind.apply( Color, [ null ].concat( args) )); + return true; + } catch (e) { + return false; } - } + }; - // date and time from ref 2822 format - function configFromRFC2822(config) { - var match = rfc2822.exec(preprocessRFC2822(config._i)), - parsedArray; - if (match) { - parsedArray = extractFromRFC2822Strings( - match[4], - match[3], - match[2], - match[5], - match[6], - match[7] - ); - if (!checkWeekday(match[1], parsedArray, config)) { - return; - } + // some pre-defined color scales: + var chroma$1 = chroma_1; - config._a = parsedArray; - config._tzm = calculateOffset(match[8], match[9], match[10]); + var scale = scale$2; - config._d = createUTCDate.apply(null, config._a); - config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + var scales = { + cool: function cool() { return scale([chroma$1.hsl(180,1,.9), chroma$1.hsl(250,.7,.4)]) }, + hot: function hot() { return scale(['#000','#f00','#ff0','#fff']).mode('rgb') } + }; - getParsingFlags(config).rfc2822 = true; - } else { - config._isValid = false; - } - } + /** + ColorBrewer colors for chroma.js - // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict - function configFromString(config) { - var matched = aspNetJsonRegex.exec(config._i); - if (matched !== null) { - config._d = new Date(+matched[1]); - return; - } + Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The + Pennsylvania State University. - configFromISO(config); - if (config._isValid === false) { - delete config._isValid; - } else { - return; - } + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 - configFromRFC2822(config); - if (config._isValid === false) { - delete config._isValid; - } else { - return; - } + Unless required by applicable law or agreed to in writing, software distributed + under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for the + specific language governing permissions and limitations under the License. + */ - if (config._strict) { - config._isValid = false; - } else { - // Final attempt, use Input Fallback - hooks.createFromInputFallback(config); - } - } + var colorbrewer = { + // sequential + OrRd: ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'], + PuBu: ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'], + BuPu: ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'], + Oranges: ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'], + BuGn: ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'], + YlOrBr: ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'], + YlGn: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'], + Reds: ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'], + RdPu: ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'], + Greens: ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'], + YlGnBu: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'], + Purples: ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'], + GnBu: ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'], + Greys: ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'], + YlOrRd: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'], + PuRd: ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'], + Blues: ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'], + PuBuGn: ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'], + Viridis: ['#440154', '#482777', '#3f4a8a', '#31678e', '#26838f', '#1f9d8a', '#6cce5a', '#b6de2b', '#fee825'], - hooks.createFromInputFallback = deprecate( - 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + - 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + - 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.', - function (config) { - config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); - } - ); + // diverging - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } + Spectral: ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'], + RdYlGn: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'], + RdBu: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'], + PiYG: ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'], + PRGn: ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'], + RdYlBu: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'], + BrBG: ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'], + RdGy: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'], + PuOr: ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'], - function currentDateArray(config) { - // hooks is actually the exported moment object - var nowValue = new Date(hooks.now()); - if (config._useUTC) { - return [ - nowValue.getUTCFullYear(), - nowValue.getUTCMonth(), - nowValue.getUTCDate(), - ]; - } - return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; - } + // qualitative - // convert an array to a date. - // the array should mirror the parameters below - // note: all values past the year are optional and will default to the lowest possible value. - // [year, month, day , hour, minute, second, millisecond] - function configFromArray(config) { - var i, - date, - input = [], - currentDate, - expectedWeekday, - yearToUse; + Set2: ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'], + Accent: ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'], + Set1: ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'], + Set3: ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'], + Dark2: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'], + Paired: ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'], + Pastel2: ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'], + Pastel1: ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2'], + }; - if (config._d) { - return; - } + // add lowercase aliases for case-insensitive matches + for (var i = 0, list = Object.keys(colorbrewer); i < list.length; i += 1) { + var key = list[i]; - currentDate = currentDateArray(config); + colorbrewer[key.toLowerCase()] = colorbrewer[key]; + } - //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } + var colorbrewer_1 = colorbrewer; - //if the day of the year is set, figure out what it is - if (config._dayOfYear != null) { - yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); + var chroma = chroma_1; - if ( - config._dayOfYear > daysInYear(yearToUse) || - config._dayOfYear === 0 - ) { - getParsingFlags(config)._overflowDayOfYear = true; - } + // feel free to comment out anything to rollup + // a smaller chroma.js built - date = createUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } + // io --> convert colors - // Default to current date. - // * if no year, month, day of month are given, default to today - // * if day of month is given, default month and year - // * if month is given, default only year - // * if year is given, don't default anything - for (i = 0; i < 3 && config._a[i] == null; ++i) { - config._a[i] = input[i] = currentDate[i]; - } - // Zero out whatever was not defaulted, including time - for (; i < 7; i++) { - config._a[i] = input[i] = - config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i]; - } - // Check for 24:00:00.000 - if ( - config._a[HOUR] === 24 && - config._a[MINUTE] === 0 && - config._a[SECOND] === 0 && - config._a[MILLISECOND] === 0 - ) { - config._nextDay = true; - config._a[HOUR] = 0; - } - config._d = (config._useUTC ? createUTCDate : createDate).apply( - null, - input - ); - expectedWeekday = config._useUTC - ? config._d.getUTCDay() - : config._d.getDay(); - // Apply timezone offset from input. The actual utcOffset can be changed - // with parseZone. - if (config._tzm != null) { - config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); - } - if (config._nextDay) { - config._a[HOUR] = 24; - } - // check for mismatching day of week - if ( - config._w && - typeof config._w.d !== 'undefined' && - config._w.d !== expectedWeekday - ) { - getParsingFlags(config).weekdayMismatch = true; - } - } - function dayOfYearFromWeekInfo(config) { - var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; - w = config._w; - if (w.GG != null || w.W != null || w.E != null) { - dow = 1; - doy = 4; - // TODO: We need to take the current isoWeekYear, but that depends on - // how we interpret now (local, utc, fixed offset). So create - // a now version of current config (take local/utc/offset flags, and - // create now). - weekYear = defaults( - w.GG, - config._a[YEAR], - weekOfYear(createLocal(), 1, 4).year - ); - week = defaults(w.W, 1); - weekday = defaults(w.E, 1); - if (weekday < 1 || weekday > 7) { - weekdayOverflow = true; - } - } else { - dow = config._locale._week.dow; - doy = config._locale._week.doy; - curWeek = weekOfYear(createLocal(), dow, doy); - weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); - // Default to current week. - week = defaults(w.w, curWeek.week); - if (w.d != null) { - // weekday -- low day numbers are considered next week - weekday = w.d; - if (weekday < 0 || weekday > 6) { - weekdayOverflow = true; - } - } else if (w.e != null) { - // local weekday -- counting starts from beginning of week - weekday = w.e + dow; - if (w.e < 0 || w.e > 6) { - weekdayOverflow = true; - } - } else { - // default to beginning of week - weekday = dow; - } - } - if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { - getParsingFlags(config)._overflowWeeks = true; - } else if (weekdayOverflow != null) { - getParsingFlags(config)._overflowWeekday = true; - } else { - temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; - } - } - // constant that refers to the ISO standard - hooks.ISO_8601 = function () {}; - // constant that refers to the RFC 2822 form - hooks.RFC_2822 = function () {}; - // date from string and format string - function configFromStringAndFormat(config) { - // TODO: Move this to another part of the creation flow to prevent circular deps - if (config._f === hooks.ISO_8601) { - configFromISO(config); - return; - } - if (config._f === hooks.RFC_2822) { - configFromRFC2822(config); - return; - } - config._a = []; - getParsingFlags(config).empty = true; + // operators --> modify existing Colors - // This array is used to make a Date, either with `new Date` or `Date.UTC` - var string = '' + config._i, - i, - parsedInput, - tokens, - token, - skipped, - stringLength = string.length, - totalParsedInputLength = 0, - era, - tokenLen; - tokens = - expandFormat(config._f, config._locale).match(formattingTokens) || []; - tokenLen = tokens.length; - for (i = 0; i < tokenLen; i++) { - token = tokens[i]; - parsedInput = (string.match(getParseRegexForToken(token, config)) || - [])[0]; - if (parsedInput) { - skipped = string.substr(0, string.indexOf(parsedInput)); - if (skipped.length > 0) { - getParsingFlags(config).unusedInput.push(skipped); - } - string = string.slice( - string.indexOf(parsedInput) + parsedInput.length - ); - totalParsedInputLength += parsedInput.length; - } - // don't parse if it's not a known token - if (formatTokenFunctions[token]) { - if (parsedInput) { - getParsingFlags(config).empty = false; - } else { - getParsingFlags(config).unusedTokens.push(token); - } - addTimeToArrayFromToken(token, parsedInput, config); - } else if (config._strict && !parsedInput) { - getParsingFlags(config).unusedTokens.push(token); - } - } - // add remaining unparsed input length to the string - getParsingFlags(config).charsLeftOver = - stringLength - totalParsedInputLength; - if (string.length > 0) { - getParsingFlags(config).unusedInput.push(string); - } - // clear _12h flag if hour is <= 12 - if ( - config._a[HOUR] <= 12 && - getParsingFlags(config).bigHour === true && - config._a[HOUR] > 0 - ) { - getParsingFlags(config).bigHour = undefined; - } - getParsingFlags(config).parsedDateParts = config._a.slice(0); - getParsingFlags(config).meridiem = config._meridiem; - // handle meridiem - config._a[HOUR] = meridiemFixWrap( - config._locale, - config._a[HOUR], - config._meridiem - ); - // handle era - era = getParsingFlags(config).era; - if (era !== null) { - config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]); - } - configFromArray(config); - checkOverflow(config); - } - function meridiemFixWrap(locale, hour, meridiem) { - var isPm; - if (meridiem == null) { - // nothing to do - return hour; - } - if (locale.meridiemHour != null) { - return locale.meridiemHour(hour, meridiem); - } else if (locale.isPM != null) { - // Fallback - isPm = locale.isPM(meridiem); - if (isPm && hour < 12) { - hour += 12; - } - if (!isPm && hour === 12) { - hour = 0; - } - return hour; - } else { - // this is not supposed to happen - return hour; - } - } - // date from string and array of format strings - function configFromStringAndArray(config) { - var tempConfig, - bestMoment, - scoreToBeat, - i, - currentScore, - validFormatFound, - bestFormatIsValid = false, - configfLen = config._f.length; + // interpolators - if (configfLen === 0) { - getParsingFlags(config).invalidFormat = true; - config._d = new Date(NaN); - return; - } - for (i = 0; i < configfLen; i++) { - currentScore = 0; - validFormatFound = false; - tempConfig = copyConfig({}, config); - if (config._useUTC != null) { - tempConfig._useUTC = config._useUTC; - } - tempConfig._f = config._f[i]; - configFromStringAndFormat(tempConfig); - if (isValid(tempConfig)) { - validFormatFound = true; - } - // if there is any input that was not parsed add a penalty for that format - currentScore += getParsingFlags(tempConfig).charsLeftOver; - //or tokens - currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; - getParsingFlags(tempConfig).score = currentScore; - if (!bestFormatIsValid) { - if ( - scoreToBeat == null || - currentScore < scoreToBeat || - validFormatFound - ) { - scoreToBeat = currentScore; - bestMoment = tempConfig; - if (validFormatFound) { - bestFormatIsValid = true; - } - } - } else { - if (currentScore < scoreToBeat) { - scoreToBeat = currentScore; - bestMoment = tempConfig; - } - } - } - extend(config, bestMoment || tempConfig); - } - function configFromObject(config) { - if (config._d) { - return; - } - var i = normalizeObjectUnits(config._i), - dayOrDate = i.day === undefined ? i.date : i.day; - config._a = map( - [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], - function (obj) { - return obj && parseInt(obj, 10); - } - ); - configFromArray(config); - } - function createFromConfig(config) { - var res = new Moment(checkOverflow(prepareConfig(config))); - if (res._nextDay) { - // Adding is smart enough around DST - res.add(1, 'd'); - res._nextDay = undefined; - } + // generators -- > create new colors + chroma.average = average; + chroma.bezier = bezier_1; + chroma.blend = blend_1; + chroma.cubehelix = cubehelix; + chroma.mix = chroma.interpolate = mix$1; + chroma.random = random_1; + chroma.scale = scale$2; - return res; - } + // other utility methods + chroma.analyze = analyze_1.analyze; + chroma.contrast = contrast; + chroma.deltaE = deltaE; + chroma.distance = distance; + chroma.limits = analyze_1.limits; + chroma.valid = valid; - function prepareConfig(config) { - var input = config._i, - format = config._f; + // scale + chroma.scales = scales; - config._locale = config._locale || getLocale(config._l); + // colors + chroma.colors = w3cx11_1; + chroma.brewer = colorbrewer_1; - if (input === null || (format === undefined && input === '')) { - return createInvalid({ nullInput: true }); - } + var chroma_js = chroma; - if (typeof input === 'string') { - config._i = input = config._locale.preparse(input); - } + return chroma_js; - if (isMoment(input)) { - return new Moment(checkOverflow(input)); - } else if (isDate(input)) { - config._d = input; - } else if (isArray(format)) { - configFromStringAndArray(config); - } else if (format) { - configFromStringAndFormat(config); - } else { - configFromInput(config); - } +})); - if (!isValid(config)) { - config._d = null; - } +; +/**************************************************************************** + color.js, + Functions to caluclate the brightness of a color + Taken from http://codepen.io/lunelson/pen/jENxwB - return config; - } +****************************************************************************/ - function configFromInput(config) { - var input = config._i; - if (isUndefined(input)) { - config._d = new Date(hooks.now()); - } else if (isDate(input)) { - config._d = new Date(input.valueOf()); - } else if (typeof input === 'string') { - configFromString(config); - } else if (isArray(input)) { - config._a = map(input.slice(0), function (obj) { - return parseInt(obj, 10); - }); - configFromArray(config); - } else if (isObject(input)) { - configFromObject(config); - } else if (isNumber(input)) { - // from milliseconds - config._d = new Date(input); - } else { - hooks.createFromInputFallback(config); - } - } +(function (window/*, document, undefined*/) { + "use strict"; - function createLocalOrUTC(input, format, locale, strict, isUTC) { - var c = {}; + //Create fcoo-namespace + var nsColor = window; - if (format === true || format === false) { - strict = format; - format = undefined; - } - if (locale === true || locale === false) { - strict = locale; - locale = undefined; - } + function lin2log(n) { + if (n <= 0.0031308) + return n * 12.92; + else + return 1.055 * Math.pow(n,1/2.4) - 0.055; + } - if ( - (isObject(input) && isObjectEmpty(input)) || - (isArray(input) && input.length === 0) - ) { - input = undefined; - } - // object construction must be done this way. - // https://github.com/moment/moment/issues/1423 - c._isAMomentObject = true; - c._useUTC = c._isUTC = isUTC; - c._l = locale; - c._i = input; - c._f = format; - c._strict = strict; - - return createFromConfig(c); + function log2lin(n) { + if (n <= 0.04045) + return n / 12.92; + else + return Math.pow(((n + 0.055)/1.055),2.4); } - function createLocal(input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, false); - } + /******************************************** + brightness + ********************************************/ + nsColor.brightness = function brightness(r, g, b) { + r = log2lin(r/255); + g = log2lin(g/255); + b = log2lin(b/255); + return lin2log(0.2126 * r + 0.7152 * g + 0.0722 * b) * 100; + }; - var prototypeMin = deprecate( - 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', - function () { - var other = createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other < this ? this : other; - } else { - return createInvalid(); - } - } - ), - prototypeMax = deprecate( - 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', - function () { - var other = createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other > this ? this : other; - } else { - return createInvalid(); - } - } - ); + /******************************************** + colorContrastHEX + ********************************************/ + nsColor.colorContrastHEX = function colorContrastHEX( color ) { + if (color.length === 3) + color = color.charAt(0) + color.charAt(0) + color.charAt(1) + color.charAt(1) + color.charAt(2) + color.charAt(2); + var rgb = []; + for (var i = 0; i <= 2; i++) + rgb[i] = parseInt(color.substr(1+i*2, 2), 16); + return nsColor.colorContrastRGB(rgb[0], rgb[1], rgb[2]); + }; - // Pick a moment m from moments so that m[fn](other) is true for all - // other. This relies on the function fn to be transitive. - // - // moments should either be an array of moment objects or an array, whose - // first element is an array of moment objects. - function pickBy(fn, moments) { - var res, i; - if (moments.length === 1 && isArray(moments[0])) { - moments = moments[0]; - } - if (!moments.length) { - return createLocal(); + /******************************************** + colorContrastRGB + ********************************************/ + nsColor.colorContrastRGB = function colorContrastRGB(r, g, b) { + var colorBrightness = nsColor.brightness(r, g, b), + whiteBrightness = nsColor.brightness(255, 255, 255), + blackBrightness = nsColor.brightness(0, 0, 0); + return Math.abs(colorBrightness - whiteBrightness) > Math.abs(colorBrightness - blackBrightness) ? '#ffffff' : '#000000'; + }; + + /******************************************** + rgbHex + Convert RGB color to HEX + From https://github.com/sindresorhus/rgb-hex + ********************************************/ + nsColor.rgbHex = function(red, green, blue, alpha){ + var isPercent = (red + (alpha || '')).toString().includes('%'); + + if (typeof red === 'string') { + var res = red.match(/(0?\.?\d{1,3})%?\b/g).map(Number); + red = res[0]; + green = res[1]; + blue = res[2]; + alpha = res[3]; } - res = moments[0]; - for (i = 1; i < moments.length; ++i) { - if (!moments[i].isValid() || moments[i][fn](res)) { - res = moments[i]; + else + if (alpha !== undefined) { + alpha = parseFloat(alpha); } + + if (typeof red !== 'number' || + typeof green !== 'number' || + typeof blue !== 'number' || + red > 255 || + green > 255 || + blue > 255) { + throw new TypeError('Expected three numbers below 256'); } - return res; - } - // TODO: Use [].sort instead? - function min() { - var args = [].slice.call(arguments, 0); + if (typeof alpha === 'number') { + if (!isPercent && alpha >= 0 && alpha <= 1) { + alpha = Math.round(255 * alpha); + } + else + if (isPercent && alpha >= 0 && alpha <= 100) { + alpha = Math.round(255 * alpha / 100); + } + else { + throw new TypeError('Expected alpha value (${alpha}) as a fraction or percentage'); + } + alpha = (alpha | 1 << 8).toString(16).slice(1); + } + else { + alpha = ''; + } - return pickBy('isBefore', args); - } + return ((blue | green << 8 | red << 16) | 1 << 24).toString(16).slice(1) + alpha; + }; - function max() { - var args = [].slice.call(arguments, 0); + /******************************************** + hexRgb + Convert HEX color to RGB + From https://github.com/sindresorhus/hex-rgb + ********************************************/ + var hexChars = 'a-f\\d', + match3or4Hex = '#?[' + hexChars + ']{3}[' + hexChars + ']?', + match6or8Hex = '#?[' + hexChars + ']{6}([' + hexChars + ']{2})?', + nonHexChars = new RegExp('[^#' + hexChars + ']', 'gi'), + validHexSize = new RegExp('^' + match3or4Hex + '$|^' + match6or8Hex + '$', 'i'); - return pickBy('isAfter', args); - } + nsColor.hexRgb = function(hex, options) { + options = options || {}; + if (typeof hex !== 'string' || nonHexChars.test(hex) || !validHexSize.test(hex)) { + throw new TypeError('Expected a valid hex string'); + } - var now = function () { - return Date.now ? Date.now() : +new Date(); - }; + hex = hex.replace(/^#/, ''); + var alpha = 255; - var ordering = [ - 'year', - 'quarter', - 'month', - 'week', - 'day', - 'hour', - 'minute', - 'second', - 'millisecond', - ]; + if (hex.length === 8) { + alpha = parseInt(hex.slice(6, 8), 16) / 255; + hex = hex.substring(0, 6); + } - function isDurationValid(m) { - var key, - unitHasDecimal = false, - i, - orderLen = ordering.length; - for (key in m) { - if ( - hasOwnProp(m, key) && - !( - indexOf.call(ordering, key) !== -1 && - (m[key] == null || !isNaN(m[key])) - ) - ) { - return false; - } + if (hex.length === 4) { + alpha = parseInt(hex.slice(3, 4).repeat(2), 16) / 255; + hex = hex.substring(0, 3); } - for (i = 0; i < orderLen; ++i) { - if (m[ordering[i]]) { - if (unitHasDecimal) { - return false; // only allow non-integers for smallest unit - } - if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { - unitHasDecimal = true; - } - } + if (hex.length === 3) { + hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; } - return true; - } + var num = parseInt(hex, 16), + red = num >> 16, + green = (num >> 8) & 255, + blue = num & 255; - function isValid$1() { - return this._isValid; - } + return options.format === 'array' ? [red, green, blue, alpha] : { red: red, green: green, blue: blue, alpha: alpha }; + }; - function createInvalid$1() { - return createDuration(NaN); - } + /******************************************** + hexSetAlpha + Set the alpha-value in a hex-color + ********************************************/ + nsColor.hexSetAlpha = function(hex, alpha){ + var rgba = nsColor.hexRgb(hex, {format: 'array'}); + rgba[3] = alpha; + return nsColor.rgbHex.apply(this, rgba); + }; - function Duration(duration) { - var normalizedInput = normalizeObjectUnits(duration), - years = normalizedInput.year || 0, - quarters = normalizedInput.quarter || 0, - months = normalizedInput.month || 0, - weeks = normalizedInput.week || normalizedInput.isoWeek || 0, - days = normalizedInput.day || 0, - hours = normalizedInput.hour || 0, - minutes = normalizedInput.minute || 0, - seconds = normalizedInput.second || 0, - milliseconds = normalizedInput.millisecond || 0; +}(this, document)); +; +/**************************************************************************** + json.js, +****************************************************************************/ - this._isValid = isDurationValid(normalizedInput); +(function (window/*, document, undefined*/) { + "use strict"; - // representation for dateAddRemove - this._milliseconds = - +milliseconds + - seconds * 1e3 + // 1000 - minutes * 6e4 + // 1000 * 60 - hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 - // Because of dateAddRemove treats 24 hours as different from a - // day when working around DST, we need to store them separately - this._days = +days + weeks * 7; - // It is impossible to translate months into days without knowing - // which months you are are talking about, so we have to store - // it separately. - this._months = +months + quarters * 3 + years * 12; + //Create fcoo-namespace + var nsJSON = window; - this._data = {}; + /****************************************** + serializeJSON + Converts a json-object a la {id1:'value1', id2:'value2'} + to [ { name: "id1", value: "value1" }, { name: "id2", value: "value2" } ] + *******************************************/ + nsJSON.serializeJSON = function( jsonObj ){ + var result = []; + for (var id in jsonObj) + if (jsonObj.hasOwnProperty(id)) + result.push( {name: id, value: jsonObj[id] }); + return result; + }; - this._locale = getLocale(); - this._bubble(); - } +}(this, document)); +; +/**************************************************************************** + math.js, - function isDuration(obj) { - return obj instanceof Duration; - } +****************************************************************************/ - function absRound(number) { - if (number < 0) { - return Math.round(-1 * number) * -1; - } else { - return Math.round(number); - } - } +(function (window/*, document, undefined*/) { + "use strict"; - // compare two arrays, return the number of differences - function compareArrays(array1, array2, dontConvert) { - var len = Math.min(array1.length, array2.length), - lengthDiff = Math.abs(array1.length - array2.length), - diffs = 0, - i; - for (i = 0; i < len; i++) { - if ( - (dontConvert && array1[i] !== array2[i]) || - (!dontConvert && toInt(array1[i]) !== toInt(array2[i])) - ) { - diffs++; - } - } - return diffs + lengthDiff; - } + var nsMath = window; - // FORMATTING + /******************************************* + significant - return n rounded to significant sf + *******************************************/ + nsMath.significant = function significant(n, sf) { + sf = sf - Math.floor(Math.log(n) / Math.LN10) - 1; + sf = Math.pow(10, sf); + n = Math.round(n * sf); + n = n / sf; + return n; + }; - function offset(token, separator) { - addFormatToken(token, 0, 0, function () { - var offset = this.utcOffset(), - sign = '+'; - if (offset < 0) { - offset = -offset; - sign = '-'; - } - return ( - sign + - zeroFill(~~(offset / 60), 2) + - separator + - zeroFill(~~offset % 60, 2) - ); - }); - } + /******************************************* + precision + *******************************************/ + nsMath.precision = function precision(n, dp) { + dp = Math.pow(10, dp); + n = n * dp; + n = Math.round(n); + n = n / dp; + return n; + }; - offset('Z', ':'); - offset('ZZ', ''); + /******************************************* + nearest + *******************************************/ + nsMath.nearest = function nearest(n, v) { + v = v ? v : 1; + n = n / v; + n = Math.round(n) * v; + return n; + }; - // PARSING + /******************************************* + roundDownTo + *******************************************/ + nsMath.roundDownTo = function roundDownTo(n, v) { + v = v ? v : 1; + n = n / v; + n = Math.floor(n) * v; + return n; + }; - addRegexToken('Z', matchShortOffset); - addRegexToken('ZZ', matchShortOffset); - addParseToken(['Z', 'ZZ'], function (input, array, config) { - config._useUTC = true; - config._tzm = offsetFromString(matchShortOffset, input); - }); + /******************************************* + roundToRange + *******************************************/ + nsMath.roundToRange = function roundToRange(v, min, max) { + return Math.max( Math.min(v, max), min); + }; - // HELPERS + /******************************************* + toDecimal + Convert a integer value v to a decimal + Eq toDecimal(89) = 0.89 + toDecimal(9) = 0.9 + toDecimal(1234) = 0.1234 + *******************************************/ + nsMath.toDecimal = function toDecimal(v) { + var l = v.toString().length; + return v / Math.pow(10, l); + }; - // timezone chunker - // '+10:00' > ['10', '00'] - // '-1530' > ['-15', '30'] - var chunkOffset = /([\+\-]|\d\d)/gi; +}(this, document)); +; +/**************************************************************************** + fcoo-colors.js, - function offsetFromString(matcher, string) { - var matches = (string || '').match(matcher), - chunk, - parts, - minutes; + (c) 2021, FCOO - if (matches === null) { - return null; - } + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO - chunk = matches[matches.length - 1] || []; - parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; - minutes = +(parts[1] * 60) + toInt(parts[2]); + Constants and methods to name, get and modify different colors used by FCOO Web Applications - return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; - } +****************************************************************************/ - // Return a moment from input, that is local/utc/zone equivalent to model. - function cloneWithOffset(input, model) { - var res, diff; - if (model._isUTC) { - res = model.clone(); - diff = - (isMoment(input) || isDate(input) - ? input.valueOf() - : createLocal(input).valueOf()) - res.valueOf(); - // Use low-level api, because this fn is low-level api. - res._d.setTime(res._d.valueOf() + diff); - hooks.updateOffset(res, false); - return res; - } else { - return createLocal(input).local(); - } - } +(function ($, window/*, document, undefined*/) { + "use strict"; - function getDateOffset(m) { - // On Firefox.24 Date#getTimezoneOffset returns a floating point. - // https://github.com/moment/moment/pull/1871 - return -Math.round(m._d.getTimezoneOffset()); - } + //Create fcoo-namespace + var ns = window.fcoo = window.fcoo || {}, + nsColor = ns.color = ns.color || {}; - // HOOKS + //nsColor.colorNames = {id}{da:STRING, en:STRING} + nsColor.colorNames = { + blue : {da: 'blå', en: 'blue' }, + purple : {da: 'lilla', en: 'purple' }, + red : {da: 'rød', en: 'red' }, + orange : {da: 'orange', en: 'orange' }, + cyan : {da: 'cyan', en: 'cyan' }, + yellow : {da: 'Gul', en: 'yellow' }, + pink : {da: 'pink', en: 'pink' }, + green : {da: 'grøn', en: 'green' }, + gray : {da: 'grå', en: 'gray' } + }; - // This function will be called whenever a moment is mutated. - // It is intended to keep the offset in sync with the timezone. - hooks.updateOffset = function () {}; + //nsColor.colorList = []{id, name: {da:STRING, en:STRING}} ordred by nsColor.defaultOrder + nsColor.colorList = []; - // MOMENTS + $.each(nsColor.defaultOrder, function(index, colorId){ + nsColor.colorList.push({ + id : colorId, + name: nsColor.colorNames[colorId] + }); + }); - // keepLocalTime = true means only change the timezone, without - // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> - // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset - // +0200, so we adjust the time as needed, to be valid. - // - // Keeping the time actually adds/subtracts (one hour) - // from the actual represented time. That is why we call updateOffset - // a second time. In case it wants us to change the offset again - // _changeInProgress == true case, then we have to adjust, because - // there is no such time in the given timezone. - function getSetOffset(input, keepLocalTime, keepMinutes) { - var offset = this._offset || 0, - localAdjust; - if (!this.isValid()) { - return input != null ? this : NaN; - } - if (input != null) { - if (typeof input === 'string') { - input = offsetFromString(matchShortOffset, input); - if (input === null) { - return this; - } - } else if (Math.abs(input) < 16 && !keepMinutes) { - input = input * 60; - } - if (!this._isUTC && keepLocalTime) { - localAdjust = getDateOffset(this); - } - this._offset = input; - this._isUTC = true; - if (localAdjust != null) { - this.add(localAdjust, 'm'); - } - if (offset !== input) { - if (!keepLocalTime || this._changeInProgress) { - addSubtract( - this, - createDuration(input - offset, 'm'), - 1, - false - ); - } else if (!this._changeInProgress) { - this._changeInProgress = true; - hooks.updateOffset(this, true); - this._changeInProgress = null; - } - } - return this; - } else { - return this._isUTC ? offset : getDateOffset(this); - } - } - function getSetZone(input, keepLocalTime) { - if (input != null) { - if (typeof input !== 'string') { - input = -input; - } + //The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf + //nsColor.colorArray = The colors defined in linkedin-palette-screen.pdf = [gradiant][color]. Eg. colorArray[3, 4] = gradiant 3 of orange + nsColor.colorArray = [ + //0:Blue 1:Purple 2:Red 3:Orange 4:Cyan 5:Yellow 6:Pink 7:Green 8:Gray + ['#CFEDFB', '#EBE4FF', '#FFE0DA', '#FFE7BB', '#D2ECEB', '#FFF2B6', '#FFDFF2', '#E0F4BE', '#E6E9EC'], + ['#9BDAF3', '#D8CCF4', '#FAC2BB', '#F8CD94', '#9EDDDD', '#FBE491', '#FFC4E4', '#C7E59A', '#D0D3D6'], + ['#68C7EC', '#BFABE6', '#F59890', '#F7B26A', '#69CDCF', '#F7D56B', '#F99ACA', '#AED677', '#B6B9BC'], + ['#34B3E4', '#A589D9', '#F16D64', '#F59640', '#35BEC1', '#F3C746', '#F371AF', '#95C753', '#A0A3A6'], + ['#00A0DC', '#8C68CB', '#EC4339', '#F47B16', '#00AEB3', '#EFB920', '#ED4795', '#7CB82F', '#86898C'], + ['#008CC9', '#7C5BBB', '#DD2E1F', '#EC640C', '#009EA5', '#E6A700', '#E2247F', '#60AA14', '#737679'], + ['#0077B5', '#6A4BA7', '#C11F1D', '#CD5308', '#008891', '#CA9400', '#C9186E', '#4E8F13', '#595C5F'], + ['#005E93', '#573B93', '#A40F1C', '#AF4104', '#00727D', '#AA7D00', '#B10C5C', '#3B7511', '#434649'], + ['#004471', '#452B7F', '#88001A', '#903000', '#005C69', '#8B6700', '#870044', '#295A10', '#303336'] + ]; - this.utcOffset(input, keepLocalTime); + var colorName2Index = ['blue', 'purple', 'red', 'orange', 'cyan', 'yellow', 'pink', 'green', 'gray']; - return this; - } else { - return -this.utcOffset(); - } - } + nsColor.defaultGradient = 4; + nsColor.defaultOrder = ["blue", "red", "green", "yellow", "gray", "purple", "pink", "cyan", "orange"]; - function setOffsetToUTC(keepLocalTime) { - return this.utcOffset(0, keepLocalTime); - } - function setOffsetToLocal(keepLocalTime) { - if (this._isUTC) { - this.utcOffset(0, keepLocalTime); - this._isUTC = false; + //Methods to get the value of different color-names and gradiants. + nsColor.getColor = function(color, gradient, fromSortedList){ + var colorIndex = typeof color == 'string' ? colorName2Index.indexOf(color) : color; + return nsColor.getColorList(fromSortedList, gradient)[colorIndex]; + }; - if (keepLocalTime) { - this.subtract(getDateOffset(this), 'm'); - } - } - return this; - } - function setOffsetToParsedOffset() { - if (this._tzm != null) { - this.utcOffset(this._tzm, false, true); - } else if (typeof this._i === 'string') { - var tZone = offsetFromString(matchOffset, this._i); - if (tZone != null) { - this.utcOffset(tZone); - } else { - this.utcOffset(0, true); - } - } - return this; - } + nsColor.getColorRGB = function(/*color, gradient, fromSortedList*/){ + return window.hexRgb( nsColor.getColor.apply(null, arguments) ); + }; - function hasAlignedHourOffset(input) { - if (!this.isValid()) { - return false; - } - input = input ? createLocal(input).utcOffset() : 0; + nsColor.getColorRGBArray = function(/*color, gradient, fromSortedList*/){ + return window.hexRgb( nsColor.getColor.apply(null, arguments), {format: 'array'} ); + }; - return (this.utcOffset() - input) % 60 === 0; - } - function isDaylightSavingTime() { - return ( - this.utcOffset() > this.clone().month(0).utcOffset() || - this.utcOffset() > this.clone().month(5).utcOffset() - ); - } + nsColor.getDeltaColor = function(color, deltaGradient = 0, fromSortedList){ + return nsColor.getColor(color, nsColor.defaultGradient + deltaGradient, fromSortedList); + }; - function isDaylightSavingTimeShifted() { - if (!isUndefined(this._isDSTShifted)) { - return this._isDSTShifted; - } - var c = {}, - other; + nsColor.getDeltaColorRGB = function(/*color, deltaGradient = 0, fromSortedList*/){ + return window.hexRgb( nsColor.getDeltaColor.apply(null, arguments) ); + }; - copyConfig(c, this); - c = prepareConfig(c); + nsColor.getDeltaColorRGBArray = function(/*color, deltaGradient = 0, fromSortedList*/){ + return window.hexRgb( nsColor.getDeltaColor.apply(null, arguments), {format: 'array'} ); + }; - if (c._a) { - other = c._isUTC ? createUTC(c._a) : createLocal(c._a); - this._isDSTShifted = - this.isValid() && compareArrays(c._a, other.toArray()) > 0; - } else { - this._isDSTShifted = false; + + nsColor.getColorList = function( sorted, gradient = 'DEFAULT' ){ + gradient = gradient == 'DEFAULT' ? nsColor.defaultGradient : gradient; + var result = []; + if (sorted){ + $.each(nsColor.defaultOrder, function(dummy, color){ + result.push( nsColor.getColor( color, gradient ) ); + }); } + else + result = nsColor.colorArray[gradient]; + return result; + }; - return this._isDSTShifted; - } - function isLocal() { - return this.isValid() ? !this._isUTC : false; - } + /**************************************************************************** + Using chroma.js (https://github.com/gka/chroma.js) + Create js-versions of sass functions darken, lighten, tint and shade - function isUtcOffset() { - return this.isValid() ? this._isUTC : false; - } + chromaBestContrast( color, contrastColors = ['#000000', '#ffffff'] ) + returns the color from contrastColors with the best contrast + ****************************************************************************/ - function isUtc() { - return this.isValid() ? this._isUTC && this._offset === 0 : false; - } + //HSL manipulators - from https://github.com/gka/chroma.js/issues/217 + const lighten = (color, hslPercent) => color.set("hsl.l", color.get("hsl.l") + hslPercent); + const darken = (color, hslPercent) => lighten(color, -hslPercent); + const sassLightenDarken = (color, percent, dark) => { + let hslPercent = window.numeral(percent).value(); + if (hslPercent === null) + hslPercent = 1; + color = window.chroma(color); + return dark ? darken(color, hslPercent).hex() : lighten(color, hslPercent).hex(); + }; - // ASP.NET json date format regex - var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, - // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html - // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere - // and further modified to allow for strings containing both week and day - isoRegex = - /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; + nsColor.sassLighten = ( color, percent ) => sassLightenDarken( color, percent ); + nsColor.sassDarken = ( color, percent ) => sassLightenDarken( color, percent, true ); - function createDuration(input, key) { - var duration = input, - // matching against regexp is expensive, do it on demand - match = null, - sign, - ret, - diffRes; + const mix = (color1, color2, percent) => { + let ratio = window.numeral(percent).value(); + if (ratio === null) + ratio = 1; + return window.chroma.mix(color1, color2, ratio); + }; - if (isDuration(input)) { - duration = { - ms: input._milliseconds, - d: input._days, - M: input._months, - }; - } else if (isNumber(input) || !isNaN(+input)) { - duration = {}; - if (key) { - duration[key] = +input; - } else { - duration.milliseconds = +input; + nsColor.sassTintColor = (color, weight) => mix( color, 'white', weight ); + nsColor.sassShadeColor = (color, weight) => mix( color, 'black', weight ); + + //chromaBestContrast( color, contrastColors = ['#000000', '#ffffff'] + nsColor.chromaBestContrast = ( color, contrastColors = ['#000000', '#ffffff']) => { + contrastColors = $.isArray( contrastColors ) ? contrastColors : [contrastColors]; + let bestContrast = 0, result; + contrastColors.forEach( (textColor) => { + const contrast = window.chroma.contrast(color, textColor); + if (contrast > bestContrast){ + bestContrast = contrast; + result = textColor; } - } else if ((match = aspNetRegex.exec(input))) { - sign = match[1] === '-' ? -1 : 1; - duration = { - y: 0, - d: toInt(match[DATE]) * sign, - h: toInt(match[HOUR]) * sign, - m: toInt(match[MINUTE]) * sign, - s: toInt(match[SECOND]) * sign, - ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match - }; - } else if ((match = isoRegex.exec(input))) { - sign = match[1] === '-' ? -1 : 1; - duration = { - y: parseIso(match[2], sign), - M: parseIso(match[3], sign), - w: parseIso(match[4], sign), - d: parseIso(match[5], sign), - h: parseIso(match[6], sign), - m: parseIso(match[7], sign), - s: parseIso(match[8], sign), - }; - } else if (duration == null) { - // checks for null or undefined - duration = {}; - } else if ( - typeof duration === 'object' && - ('from' in duration || 'to' in duration) - ) { - diffRes = momentsDifference( - createLocal(duration.from), - createLocal(duration.to) - ); + }); + return window.chroma(result); + }; - duration = {}; - duration.ms = diffRes.milliseconds; - duration.M = diffRes.months; - } + /**************************************************************************** + setRootVar(id, value) + getRootVar(id) + setApplicationBaseColor(baseColor) + ****************************************************************************/ + const adjustId = (id) => id.slice(0, 2) == '--' ? id : '--'+id; + const root = document.querySelector(':root'); - ret = new Duration(duration); + ns.setRootVar = (id, value) => { + root.style.setProperty(adjustId(id), value); + }; - if (isDuration(input) && hasOwnProp(input, '_locale')) { - ret._locale = input._locale; - } + ns.getRootVar = (id) => { + return getComputedStyle(root).getPropertyValue( adjustId(id) ); + }; - if (isDuration(input) && hasOwnProp(input, '_isValid')) { - ret._isValid = input._isValid; - } + nsColor.setApplicationBaseColor = (baseColor) => { + baseColor = window.chroma(baseColor); + ns.setRootVar('--_fcoo-app-base-color', baseColor.hex() ); + ns.setRootVar('--_fcoo-app-base-text-color', nsColor.chromaBestContrast(baseColor).hex() ); + }; - return ret; - } - createDuration.fn = Duration.prototype; - createDuration.invalid = createInvalid$1; +}(jQuery, this, document)); +; +/**************************************************************************** + fcoo-data-files.js, - function parseIso(inp, sign) { - // We'd normally use ~~inp for this, but unfortunately it also - // converts floats to ints. - // inp may be undefined, so careful calling replace on it. - var res = inp && parseFloat(inp.replace(',', '.')); - // apply sign while we're at it - return (isNaN(res) ? 0 : res) * sign; - } + (c) 2018, FCOO - function positiveMomentsDifference(base, other) { - var res = {}; + https://github.com/FCOO/fcoo-data-files + https://github.com/FCOO - res.months = - other.month() - base.month() + (other.year() - base.year()) * 12; - if (base.clone().add(res.months, 'M').isAfter(other)) { - --res.months; - } + fcoo.LOCAL_DATA: {boolean} + fcoo.dataFilePath: + function([mainDir:STRING|BOOLEAN], subDir:STRING, fileName:STRING) OR + function(pathAndFileName:STRING) OR + function(subAndFileName:{mainDirNa "dynamic", if false => "static" - return res; - } + if fcoo.LOCAL_DATA == false: + fcoo.dataFilePath("theSubDir", "fileName.json") returns "https://app.fcoo.dk/static/theSubDir/fileName.json" + fcoo.dataFilePath(false, "theSubDir", "fileName.json") returns "https://app.fcoo.dk/static/theSubDir/fileName.json" + fcoo.dataFilePath(true, "theSubDir", "fileName.json") returns "https://app.fcoo.dk/dynamic/theSubDir/fileName.json" - function momentsDifference(base, other) { - var res; - if (!(base.isValid() && other.isValid())) { - return { milliseconds: 0, months: 0 }; - } + if fcoo.LOCAL_DATA == false and fcoo.path.relative == true + fcoo.dataFilePath("theSubDir", "fileName.json") returns "/static/theSubDir/fileName.json" + fcoo.dataFilePath(false, "theSubDir", "fileName.json") returns "/static/theSubDir/fileName.json" + fcoo.dataFilePath(true, "theSubDir", "fileName.json") returns "/dynamic/theSubDir/fileName.json" - other = cloneWithOffset(other, base); - if (base.isBefore(other)) { - res = positiveMomentsDifference(base, other); - } else { - res = positiveMomentsDifference(other, base); - res.milliseconds = -res.milliseconds; - res.months = -res.months; - } - return res; - } + if fcoo.LOCAL_DATA == true: + fcoo.dataFilePath("theSubDir", "fileName.json") returns "/src/data/_fileName.json" - // TODO: remove 'name' arg after deprecation is removed - function createAdder(direction, name) { - return function (val, period) { - var dur, tmp; - //invert the arguments, but complain about it - if (period !== null && !isNaN(+period)) { - deprecateSimple( - name, - 'moment().' + - name + - '(period, number) is deprecated. Please use moment().' + - name + - '(number, period). ' + - 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.' - ); - tmp = val; - val = period; - period = tmp; - } +****************************************************************************/ - dur = createDuration(val, period); - addSubtract(this, dur, direction); - return this; - }; - } +(function ($, window/*, document, undefined*/) { + "use strict"; - function addSubtract(mom, duration, isAdding, updateOffset) { - var milliseconds = duration._milliseconds, - days = absRound(duration._days), - months = absRound(duration._months); + //Create fcoo-namespace + var ns = window.fcoo = window.fcoo || {}, + nsPath = ns.path = ns.path || {}; - if (!mom.isValid()) { - // No op - return; - } + ns.LOCAL_DATA = false; - updateOffset = updateOffset == null ? true : updateOffset; - if (months) { - setMonth(mom, get(mom, 'Month') + months * isAdding); - } - if (days) { - set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); + //Set default protocol and host + nsPath.protocol = nsPath.protocol || 'https:'; + nsPath.defaultHost = 'app.fcoo.dk'; + nsPath.host = nsPath.host || nsPath.defaultHost; + nsPath.relative = nsPath.relative || {}; //nsPath.relative = BOOLEAN or {static/dymanic: BOOLEAN}. If true dataFileName return a relative + nsPath.mainDirHost = nsPath.mainDirHost || {}; //{dynamic/static: STRING} Makes it possible to have different host for the two main-dir + + function getTrueMainDir( mainDir ){ + return mainDir ? (mainDir === true ? 'dynamic' : mainDir) : 'static'; + } + + /********************************************************* + nsPath.dataFileName() + *********************************************************/ + nsPath.dataFileName = function(){ + // Detect mode + var host, mainDir, subDir, relative, fileName; + + if (arguments.length == 3){ + //(mainDir: STRING|BOOLEAN, subDir:STRING, fileName:STRING) + mainDir = arguments[0]; + subDir = arguments[1]; + fileName = arguments[2]; } - if (milliseconds) { - mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); + else + if (arguments.length == 2){ + //(subDir:STRING, fileName:STRING) + mainDir = false, //=> default 'static' + subDir = arguments[0]; + fileName = arguments[1]; } - if (updateOffset) { - hooks.updateOffset(mom, days || months); + else + if (arguments.length == 1){ + if (typeof arguments[0] == 'string') + //(pathAndFileName:STRING) + return arguments[0]; + else { + //({mainDir:STRING|BOOLEAN, subDirName:STRING, fileName:STRING}) + mainDir = arguments[0].mainDir || arguments[0].main || false; + subDir = arguments[0].subDir || arguments[0].sub; + fileName = arguments[0].fileName; + } } - } - var add = createAdder(1, 'add'), - subtract = createAdder(-1, 'subtract'); + if (ns.LOCAL_DATA === true) + return '/src/data/_' + fileName; - function isString(input) { - return typeof input === 'string' || input instanceof String; - } + //Find mainDir, host, and relative + mainDir = getTrueMainDir(mainDir); + host = typeof nsPath.host == 'string' ? nsPath.host : nsPath.host[mainDir] || nsPath.defaultHost; + relative = nsPath.relative ? (nsPath.relative === true ? true : !!nsPath.relative[mainDir]) : false; - // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined - function isMomentInput(input) { - return ( - isMoment(input) || - isDate(input) || - isString(input) || - isNumber(input) || - isNumberOrStringArray(input) || - isMomentInputObject(input) || - input === null || - input === undefined - ); - } + return (relative ? '' : nsPath.protocol + '//') + + (relative ? '' : host) + + '/' + + mainDir + '/' + + (subDir ? subDir + '/' : '') + + fileName; + }; - function isMomentInputObject(input) { - var objectTest = isObject(input) && !isObjectEmpty(input), - propertyTest = false, - properties = [ - 'years', - 'year', - 'y', - 'months', - 'month', - 'M', - 'days', - 'day', - 'd', - 'dates', - 'date', - 'D', - 'hours', - 'hour', - 'h', - 'minutes', - 'minute', - 'm', - 'seconds', - 'second', - 's', - 'milliseconds', - 'millisecond', - 'ms', - ], - i, - property, - propertyLen = properties.length; + //Backward compability + ns.dataFilePath = nsPath.dataFileName; - for (i = 0; i < propertyLen; i += 1) { - property = properties[i]; - propertyTest = propertyTest || hasOwnProp(input, property); - } - return objectTest && propertyTest; - } + /********************************************************* + nsPath.staticDataFileName (subDir, fileName) + nsPath.dynamicDataFileName(subDir, fileName) + nsPath.assetsDataFileName (subDir, fileName) + *********************************************************/ + nsPath.staticDataFileName = function(subDir, fileName){ + return this.dataFileName(false, subDir, fileName); + }; - function isNumberOrStringArray(input) { - var arrayTest = isArray(input), - dataTypeTest = false; - if (arrayTest) { - dataTypeTest = - input.filter(function (item) { - return !isNumber(item) && isString(input); - }).length === 0; - } - return arrayTest && dataTypeTest; - } + nsPath.dynamicDataFileName = function(subDir, fileName){ + return this.dataFileName(true, subDir, fileName); + }; - function isCalendarSpec(input) { - var objectTest = isObject(input) && !isObjectEmpty(input), - propertyTest = false, - properties = [ - 'sameDay', - 'nextDay', - 'lastDay', - 'nextWeek', - 'lastWeek', - 'sameElse', - ], - i, - property; + nsPath.assetsDataFileName = function(subDir, fileName){ + return this.dataFileName('assets', subDir, fileName); + }; - for (i = 0; i < properties.length; i += 1) { - property = properties[i]; - propertyTest = propertyTest || hasOwnProp(input, property); - } - return objectTest && propertyTest; - } + /********************************************************* + ********************************************************** + nsPath.setCssVar(varName, mainDir, subDir, fileName) + Create/update css-variabel varName in :root with url( path to fileName ) + ********************************************************** + *********************************************************/ + var dataFileNameAsCssVar = []; + nsPath.setDataFileNameAsCssVar = function(varName, mainDir, subDir, fileName){ + mainDir = getTrueMainDir( mainDir ); + var root = document.querySelector(':root'); - function getCalendarFormat(myMoment, now) { - var diff = myMoment.diff(now, 'days', true); - return diff < -6 - ? 'sameElse' - : diff < -1 - ? 'lastWeek' - : diff < 0 - ? 'lastDay' - : diff < 1 - ? 'sameDay' - : diff < 2 - ? 'nextDay' - : diff < 7 - ? 'nextWeek' - : 'sameElse'; - } + root.style.setProperty('--'+varName, 'url(' + nsPath.dataFileName(mainDir, subDir, fileName) +')'); - function calendar$1(time, formats) { - // Support for single parameter, formats only overload to the calendar function - if (arguments.length === 1) { - if (!arguments[0]) { - time = undefined; - formats = undefined; - } else if (isMomentInput(arguments[0])) { - time = arguments[0]; - formats = undefined; - } else if (isCalendarSpec(arguments[0])) { - formats = arguments[0]; - time = undefined; - } - } - // We want to compare the start of today, vs this. - // Getting start-of-today depends on whether we're local/utc/offset or not. - var now = time || createLocal(), - sod = cloneWithOffset(now, this).startOf('day'), - format = hooks.calendarFormat(this, sod) || 'sameElse', - output = - formats && - (isFunction(formats[format]) - ? formats[format].call(this, now) - : formats[format]); + //If new => Add to dataFileNameAsCssVar + var found = false; + dataFileNameAsCssVar.forEach( (dataFile) => { + if ((dataFile.varName == varName) && (dataFile.mainDir == mainDir) && (dataFile.subDir == subDir) && (dataFile.fileName == fileName)) + found = true; + }); + if (!found) + dataFileNameAsCssVar.push({'varName': varName, 'mainDir': mainDir, 'subDir': subDir, 'fileName': fileName}); + }; - return this.format( - output || this.localeData().calendar(format, this, createLocal(now)) - ); - } + /********************************************************* + nsPath.setStaticDataFileNameAsCssVar (varName, subDir, fileName) + nsPath.setDynamicDataFileNameAsCssVar(varName, subDir, fileName) + nsPath.setAssetsDataFileNameAsCssVar (varName, subDir, fileName) + *********************************************************/ + nsPath.setStaticDataFileNameAsCssVar = function(varName, subDir, fileName){ + return this.setDataFileNameAsCssVar(varName, false, subDir, fileName); + }; - function clone() { - return new Moment(this); - } + nsPath.setDynamicDataFileNameAsCssVar = function(varName, subDir, fileName){ + return this.setDataFileNameAsCssVar(varName, true, subDir, fileName); + }; - function isAfter(input, units) { - var localInput = isMoment(input) ? input : createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(units) || 'millisecond'; - if (units === 'millisecond') { - return this.valueOf() > localInput.valueOf(); - } else { - return localInput.valueOf() < this.clone().startOf(units).valueOf(); - } - } + nsPath.setAssetsDataFileNameAsCssVar = function(varName, subDir, fileName){ + return this.setDataFileNameAsCssVar(varName, 'assets', subDir, fileName); + }; - function isBefore(input, units) { - var localInput = isMoment(input) ? input : createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(units) || 'millisecond'; - if (units === 'millisecond') { - return this.valueOf() < localInput.valueOf(); - } else { - return this.clone().endOf(units).valueOf() < localInput.valueOf(); - } - } + /********************************************************* - function isBetween(from, to, units, inclusivity) { - var localFrom = isMoment(from) ? from : createLocal(from), - localTo = isMoment(to) ? to : createLocal(to); - if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { - return false; - } - inclusivity = inclusivity || '()'; - return ( - (inclusivity[0] === '(' - ? this.isAfter(localFrom, units) - : !this.isBefore(localFrom, units)) && - (inclusivity[1] === ')' - ? this.isBefore(localTo, units) - : !this.isAfter(localTo, units)) - ); - } + *********************************************************/ + nsPath.getCssVar = function(varName){ + var root = document.querySelector(':root'), + rootStyle = getComputedStyle(root); + return rootStyle.getPropertyValue('--'+varName); + }; - function isSame(input, units) { - var localInput = isMoment(input) ? input : createLocal(input), - inputMs; - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(units) || 'millisecond'; - if (units === 'millisecond') { - return this.valueOf() === localInput.valueOf(); - } else { - inputMs = localInput.valueOf(); - return ( - this.clone().startOf(units).valueOf() <= inputMs && - inputMs <= this.clone().endOf(units).valueOf() - ); - } - } - function isSameOrAfter(input, units) { - return this.isSame(input, units) || this.isAfter(input, units); - } + /********************************************************* + ********************************************************** + nsPath.setPath(path) + ********************************************************** + *********************************************************/ + nsPath.setPath = function(path){ + $.extend(true, this, path); - function isSameOrBefore(input, units) { - return this.isSame(input, units) || this.isBefore(input, units); - } + //Update all css-var + dataFileNameAsCssVar.forEach( (dataFile) => { + this.setDataFileNameAsCssVar(dataFile.varName, dataFile.mainDir, dataFile.subDir, dataFile.fileName); + }); + return this; + }; - function diff(input, units, asFloat) { - var that, zoneDelta, output; - if (!this.isValid()) { - return NaN; - } +}(jQuery, this, document)); - that = cloneWithOffset(input, this); - if (!that.isValid()) { - return NaN; - } +; +/**************************************************************************** +fcoo-application-loading.js - zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; +Create and display loading page +****************************************************************************/ +(function ($, window/*, document, undefined*/) { + "use strict"; - units = normalizeUnits(units); + //Create fcoo-namespace + var ns = window.fcoo = window.fcoo || {}; - switch (units) { - case 'year': - output = monthDiff(this, that) / 12; - break; - case 'month': - output = monthDiff(this, that); - break; - case 'quarter': - output = monthDiff(this, that) / 3; - break; - case 'second': - output = (this - that) / 1e3; - break; // 1000 - case 'minute': - output = (this - that) / 6e4; - break; // 1000 * 60 - case 'hour': - output = (this - that) / 36e5; - break; // 1000 * 60 * 60 - case 'day': - output = (this - that - zoneDelta) / 864e5; - break; // 1000 * 60 * 60 * 24, negate dst - case 'week': - output = (this - that - zoneDelta) / 6048e5; - break; // 1000 * 60 * 60 * 24 * 7, negate dst - default: - output = this - that; - } + //Set modernizr-test 'loading' off + $('html').modernizrOff('loading'); - return asFloat ? output : absFloor(output); - } + var loadingCreated = false; - function monthDiff(a, b) { - if (a.date() < b.date()) { - // end-of-month calculations work correct when the start month has more - // days than the end month. - return -monthDiff(b, a); - } - // difference in months - var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), - // b is in (anchor - 1 month, anchor + 1 month) - anchor = a.clone().add(wholeMonthDiff, 'months'), - anchor2, - adjust; + ns.createLoading = function( versionText ){ + loadingCreated = true; - if (b - anchor < 0) { - anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor - anchor2); - } else { - anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor2 - anchor); - } + var $body = $('body'); - //check for negative zero, return zero if negative zero - return -(wholeMonthDiff + adjust) || 0; - } + //Backward compability: Remove ...
+ $body.find('div.loading').remove(); - hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; - hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; + var $loadingDiv = $('
') + .addClass('loading') + .prependTo( $body ); - function toString() { - return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); - } + //Find or create div with branch and version-text (ex. "DEMO 6.2.0") + if (versionText) + $('
') + .addClass('version') + .text( versionText ) + .appendTo( $loadingDiv ); - function toISOString(keepOffset) { - if (!this.isValid()) { - return null; - } - var utc = keepOffset !== true, - m = utc ? this.clone().utc() : this; - if (m.year() < 0 || m.year() > 9999) { - return formatMoment( - m, - utc - ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' - : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ' - ); - } - if (isFunction(Date.prototype.toISOString)) { - // native implementation is ~50x faster, use it when we can - if (utc) { - return this.toDate().toISOString(); - } else { - return new Date(this.valueOf() + this.utcOffset() * 60 * 1000) - .toISOString() - .replace('Z', formatMoment(m, 'Z')); - } - } - return formatMoment( - m, - utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ' - ); - } + //Create div with logo + $('').appendTo($loadingDiv); - /** - * Return a human readable representation of a moment that can - * also be evaluated to get a new moment which is the same - * - * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects - */ - function inspect() { - if (!this.isValid()) { - return 'moment.invalid(/* ' + this._i + ' */)'; - } - var func = 'moment', - zone = '', - prefix, - year, - datetime, - suffix; - if (!this.isLocal()) { - func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; - zone = 'Z'; - } - prefix = '[' + func + '("]'; - year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; - datetime = '-MM-DD[T]HH:mm:ss.SSS'; - suffix = zone + '[")]'; + //Create div with flashing dots + $('
') + .addClass('dots') + .append('...') + .appendTo($loadingDiv); - return this.format(prefix + year + datetime + suffix); - } + $('html').modernizrOn('loading'); - function format(inputString) { - if (!inputString) { - inputString = this.isUtc() - ? hooks.defaultFormatUtc - : hooks.defaultFormat; - } - var output = formatMoment(this, inputString); - return this.localeData().postformat(output); - } + }; - function from(time, withoutSuffix) { - if ( - this.isValid() && - ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) - ) { - return createDuration({ to: this, from: time }) - .locale(this.locale()) - .humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } - } + //On document.ready: Create loading if html has class loading + $(function() { + if ($('html').hasClass('loading') && !loadingCreated) + ns.createLoading(); + }); - function fromNow(withoutSuffix) { - return this.from(createLocal(), withoutSuffix); - } + /****************************************************** + workingOn /workingOff + Show / hide rotating icon when 'working...' + Delay of 1s to prevent flicing when working in short period + ******************************************************/ + var workingCreated = false, + workingTimeoutId; + ns.workingOn = function(){ + $('html').modernizrOff('working'); - function to(time, withoutSuffix) { - if ( - this.isValid() && - ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) - ) { - return createDuration({ from: this, to: time }) - .locale(this.locale()) - .humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); + if (!workingCreated){ + $('
') + .addClass('working show-for-working') + .append($( + ''+ + '' + + '' + + '') + ) + .prependTo( $('body') ); + workingCreated = true; } - } - function toNow(withoutSuffix) { - return this.to(createLocal(), withoutSuffix); + workingTimeoutId = window.setTimeout(() => { $('html').modernizrOn('working') }, 1000); + } - // If passed a locale key, it will set the locale for this - // instance. Otherwise, it will return the locale configuration - // variables for this instance. - function locale(key) { - var newLocaleData; - if (key === undefined) { - return this._locale._abbr; - } else { - newLocaleData = getLocale(key); - if (newLocaleData != null) { - this._locale = newLocaleData; - } - return this; - } + ns.workingOff = function(){ + window.clearTimeout(workingTimeoutId); + $('html').modernizrOff('working'); } - var lang = deprecate( - 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', - function (key) { - if (key === undefined) { - return this.localeData(); - } else { - return this.locale(key); - } - } - ); +}(jQuery, this, document)); - function localeData() { - return this._locale; - } +; +/**************************************************************************** + fcoo-application-logo-and-color.js, - var MS_PER_SECOND = 1000, - MS_PER_MINUTE = 60 * MS_PER_SECOND, - MS_PER_HOUR = 60 * MS_PER_MINUTE, - MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; + (c) 2023, FCOO - // actual modulo - handles negative numbers (for dates before 1970): - function mod$1(dividend, divisor) { - return ((dividend % divisor) + divisor) % divisor; - } + https://github.com/FCOO/fcoo-application-logo-and-color + https://github.com/FCOO - function localStartOfDate(y, m, d) { - // the date constructor remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0) { - // preserve leap years using a full 400 year cycle, then reset - return new Date(y + 400, m, d) - MS_PER_400_YEARS; - } else { - return new Date(y, m, d).valueOf(); - } - } +****************************************************************************/ - function utcStartOfDate(y, m, d) { - // Date.UTC remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0) { - // preserve leap years using a full 400 year cycle, then reset - return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; - } else { - return Date.UTC(y, m, d); - } - } +(function ($, window/*, document, undefined*/) { + "use strict"; - function startOf(units) { - var time, startOfDate; - units = normalizeUnits(units); - if (units === undefined || units === 'millisecond' || !this.isValid()) { - return this; - } + //Create fcoo-namespace + window.fcoo = window.fcoo || {}; - startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; - switch (units) { - case 'year': - time = startOfDate(this.year(), 0, 1); - break; - case 'quarter': - time = startOfDate( - this.year(), - this.month() - (this.month() % 3), - 1 - ); - break; - case 'month': - time = startOfDate(this.year(), this.month(), 1); - break; - case 'week': - time = startOfDate( - this.year(), - this.month(), - this.date() - this.weekday() - ); - break; - case 'isoWeek': - time = startOfDate( - this.year(), - this.month(), - this.date() - (this.isoWeekday() - 1) - ); - break; - case 'day': - case 'date': - time = startOfDate(this.year(), this.month(), this.date()); - break; - case 'hour': - time = this._d.valueOf(); - time -= mod$1( - time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), - MS_PER_HOUR - ); - break; - case 'minute': - time = this._d.valueOf(); - time -= mod$1(time, MS_PER_MINUTE); - break; - case 'second': - time = this._d.valueOf(); - time -= mod$1(time, MS_PER_SECOND); - break; - } - this._d.setTime(time); - hooks.updateOffset(this, true); - return this; - } - function endOf(units) { - var time, startOfDate; - units = normalizeUnits(units); - if (units === undefined || units === 'millisecond' || !this.isValid()) { - return this; - } - startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; + /****************************************** + Initialize/ready + *******************************************/ + $(function() { - switch (units) { - case 'year': - time = startOfDate(this.year() + 1, 0, 1) - 1; - break; - case 'quarter': - time = - startOfDate( - this.year(), - this.month() - (this.month() % 3) + 3, - 1 - ) - 1; - break; - case 'month': - time = startOfDate(this.year(), this.month() + 1, 1) - 1; - break; - case 'week': - time = - startOfDate( - this.year(), - this.month(), - this.date() - this.weekday() + 7 - ) - 1; - break; - case 'isoWeek': - time = - startOfDate( - this.year(), - this.month(), - this.date() - (this.isoWeekday() - 1) + 7 - ) - 1; - break; - case 'day': - case 'date': - time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; - break; - case 'hour': - time = this._d.valueOf(); - time += - MS_PER_HOUR - - mod$1( - time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), - MS_PER_HOUR - ) - - 1; - break; - case 'minute': - time = this._d.valueOf(); - time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; - break; - case 'second': - time = this._d.valueOf(); - time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; - break; - } - this._d.setTime(time); - hooks.updateOffset(this, true); - return this; - } + }); - function valueOf() { - return this._d.valueOf() - (this._offset || 0) * 60000; - } +}(jQuery, this, document)); +; +/**************************************************************************** +fcoo-application-logo.js - function unix() { - return Math.floor(this.valueOf() / 1000); - } +Load logos, sets css-var, and write logo etc. in console +****************************************************************************/ +(function ($, window/*, document, undefined*/) { + "use strict"; - function toDate() { - return new Date(this.valueOf()); - } + //Create fcoo-namespace + var ns = window.fcoo = window.fcoo || {}/*, + nsColor = ns.color = ns.color || {}*/; - function toArray() { - var m = this; - return [ - m.year(), - m.month(), - m.date(), - m.hour(), - m.minute(), - m.second(), - m.millisecond(), - ]; - } + //Set modernizr-test 'logo-portrait' off + $('html').modernizrOff('logo-portrait'); - function toObject() { - var m = this; - return { - years: m.year(), - months: m.month(), - date: m.date(), - hours: m.hours(), - minutes: m.minutes(), - seconds: m.seconds(), - milliseconds: m.milliseconds(), - }; - } + function logoExists( img, fileName, fileNamePostfix){ + ns.path.setAssetsDataFileNameAsCssVar('fcoo-app-logo' + fileNamePostfix + '-url', 'logos', fileName); + $('html').modernizrToggle('logo-portrait', img.height > img.width); - function toJSON() { - // new Date(NaN).toJSON() === null - return this.isValid() ? this.toISOString() : null; + //Set internal css-var _fcoo-app-logo-wh-ratio + ns.setRootVar('--_fcoo-app-logo-wh-ratio', img.width / img.height); } - function isValid$2() { - return isValid(this); - } + /******************************************************** + ns.setApplicationLogo( fileNamePrefix ) + ********************************************************/ + ns.setApplicationLogo = function( fileNamePrefix ){ + //First set fab-text-color-is-white (=fcoo-app-base-text-color-is-white) + var fcooAppBaseTextColor = ns.getRootVar('fcoo-app-base-text-color') || '#ffffff', + textColorIsWhite = fcooAppBaseTextColor.includes("000"); + $('html').modernizrToggle('fab-text-color-is-white', !!textColorIsWhite); + + //Check existens of the three versions of the logo + var img = []; + ['', '_white', '_black'].forEach((fileNamePostfix, index) => { + var fileName = fileNamePrefix + fileNamePostfix + '.svg'; + img[index] = new Image(); + img[index].src = ns.path.assetsDataFileName('logos', fileName); + if (img[index].complete) + logoExists.call( null, img[index], fileName, fileNamePostfix ); + else + img[index].onload = () => {logoExists.call( null, img[index], fileName, fileNamePostfix ); }; + }); + }; - function parsingFlags() { - return extend({}, getParsingFlags(this)); - } - function invalidAt() { - return getParsingFlags(this).overflow; - } - function creationData() { - return { - input: this._i, - format: this._f, - locale: this._locale, - isUTC: this._isUTC, - strict: this._strict, - }; - } + /******************************************************** + ns.consoleApplicationLogo(logoText, textList = [] ) + Write the logo and strings in textList in console + ********************************************************/ + /* eslint-disable no-console, no-constant-condition*/ + ns.consoleApplicationLogo = function(logoText, textList = [] ){ + const allLetters = [ + ' ### ######## ###### ######## ######## ######## ###### ## ## #### ## ## ## ## ## ## ## ## ####### ######## ####### ######## ###### ######## ## ## ## ## ## #### ## ## ## ######## ## ####### ####### ## ######## ####### ######## ####### ####### ##### ', + ' ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ### ### ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ', + ' ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #### #### #### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ', + '## ## ######## ## ## ## ###### ###### ## #### ######### ## ## ##### ## ## ### ## ## ## ## ## ## ######## ## ## ######## ###### ## ## ## ## ## ## ## ## ### ## ## ## ####### ####### ## ## ####### ######## ## ####### ######## ## ## ####### ', + '######### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ######### ## ## ## ## ## ## ## ## ## ', + '## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ', + '## ## ######## ###### ######## ######## ## ###### ## ## #### ###### ## ## ######## ## ## ## ## ####### ## ##### ## ## ## ###### ## ####### ### ### ### ## ## ## ######## ###### ######### ####### ## ###### ####### ## ####### ####### ##### ' + ]; + const allLettersStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-'; - addFormatToken('N', 0, 0, 'eraAbbr'); - addFormatToken('NN', 0, 0, 'eraAbbr'); - addFormatToken('NNN', 0, 0, 'eraAbbr'); - addFormatToken('NNNN', 0, 0, 'eraName'); - addFormatToken('NNNNN', 0, 0, 'eraNarrow'); + var letters = {}; + for (var i=0; i in and adding favicons +****************************************************************************/ - for (i = 0, l = eras.length; i < l; ++i) { - name = eras[i].name.toUpperCase(); - abbr = eras[i].abbr.toUpperCase(); - narrow = eras[i].narrow.toUpperCase(); +(function ($, window, document/*, undefined*/) { + "use strict"; - if (strict) { - switch (format) { - case 'N': - case 'NN': - case 'NNN': - if (abbr === eraName) { - return eras[i]; - } - break; + //Create fcoo-namespace + var ns = window.fcoo = window.fcoo || {}; - case 'NNNN': - if (name === eraName) { - return eras[i]; - } - break; - case 'NNNNN': - if (narrow === eraName) { - return eras[i]; - } - break; - } - } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { - return eras[i]; - } - } - } + //fcoo.viewport_no_scalable: BOOLEAN; If true the viewpoint gets no scalable. Must be set prio to addApplicationMetaAndFavicon is called + ns.viewport_no_scalable = ns.viewport_no_scalable || false; + + ns.addApplicationMetaAndFavicon = function(owner = "fcoo", logo = 'fcoo'){ + var tagList = [ + {'tag': 'meta', 'charset': "utf-8"}, + {'tag': 'meta', 'http-equiv': 'x-dns-prefetch-control', 'content': 'on'}, + + ns.viewport_no_scalable ? + {'tag': 'meta', 'name': 'viewport', 'content': 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'} : + {'tag': 'meta', 'name': 'viewport', 'content': 'width=device-width, initial-scale=1.0'}, + {'tag': 'meta', 'name' : 'copyright', 'content': '{OWNER}'}, + {'tag': 'meta', 'name' : 'google', 'content': 'notranslate'}, + + {'tag': 'link', 'rel' : 'apple-touch-icon', 'sizes': '180x180', 'href' : '{PATH}apple-touch-icon.png{PARAM}'}, + {'tag': 'link', 'rel' : 'icon', 'type' : 'image/png', 'sizes': '32x32', 'href' : '{PATH}favicon-32x32.png{PARAM}'}, + {'tag': 'link', 'rel' : 'icon', 'type' : 'image/png', 'sizes': '230x230', 'href' : '{PATH}favicon-230x230.png{PARAM}'}, + {'tag': 'link', 'rel' : 'icon', 'type' : 'image/png', 'sizes': '192x192', 'href' : '{PATH}android-chrome-192x192.png{PARAM}'}, + {'tag': 'link', 'rel' : 'icon', 'type' : 'image/png', 'sizes': '228x228', 'href' : '{PATH}coast-228x228.png{PARAM}'}, + {'tag': 'link', 'rel' : 'icon', 'type' : 'image/png', 'sizes': '16x16', 'href' : '{PATH}favicon-16x16.png{PARAM}'}, + {'tag': 'link', 'rel' : 'manifest', 'href' : '{PATH}site.webmanifest{PARAM}'}, + {'tag': 'link', 'rel' : 'mask-icon', 'color' : '{COLOR}', 'href' : '{PATH}safari-pinned-tab.svg{PARAM}'}, + {'tag': 'link', 'rel' : 'shortcut icon', 'href' : '{PATH}favicon.ico{PARAM}'}, + {'tag': 'link', 'rel' : 'yandex-tableau-widget', 'href' : '{PATH}yandex-browser-manifest.json{PARAM}'}, + + {'tag': 'meta', 'property' : 'og:image', 'content': '{PATH}open-graph.png{PARAM}'}, + {'tag': 'meta', 'name' : 'apple-mobile-web-app-title', 'content': '{OWNER}'}, + {'tag': 'meta', 'name' : 'application-name', 'content': '{OWNER}'}, + {'tag': 'meta', 'name' : 'msapplication-TileColor', 'content': '{COLOR}'}, + {'tag': 'meta', 'name' : 'msapplication-TileImage', 'content': '{PATH}mstile-144x144.png{PARAM}'}, + {'tag': 'meta', 'name' : 'msapplication-config', 'content': '{PATH}browserconfig.xml{PARAM}'}, + {'tag': 'meta', 'name' : 'theme-color', 'content': '{COLOR}'} + ]; - function localeErasConvertYear(era, year) { - var dir = era.since <= era.until ? +1 : -1; - if (year === undefined) { - return hooks(era.since).year(); - } else { - return hooks(era.since).year() + (year - era.offset) * dir; - } - } + //Create date-str as YYYYMMDD + function pad( nr ){ nr = ''+nr; if (nr.length < 2) nr = '0'+nr; return nr; } + var date = new Date(), + yyymmdd = pad(date.getFullYear()) + pad(date.getMonth()) + pad(date.getDate()), - function getEraName() { - var i, - l, - val, - eras = this.localeData().eras(); - for (i = 0, l = eras.length; i < l; ++i) { - // truncate time - val = this.clone().startOf('day').valueOf(); + //Get color = value of css-var --fcoo-app-base-color + color = ns.getRootVar('--fcoo-app-base-color'); - if (eras[i].since <= val && val <= eras[i].until) { - return eras[i].name; - } - if (eras[i].until <= val && val <= eras[i].since) { - return eras[i].name; + //values = {id:value} replacing id with value in meta and favicon + var values = { + '{PATH}' : ns.path.assetsDataFileName('favicon', logo) + '/', + '{OWNER}': owner.toUpperCase(), + '{COLOR}': color || '#3f5b58', + '{PARAM}': '?v='+ yyymmdd + }; + + //Updates metaList and faviconList + tagList.forEach( (opt, index) => { + for (var id in opt){ + var value = opt[id]; + for (var valuesId in values) + value = value.replace(valuesId, values[valuesId]); + opt[id] = value; } - } + tagList[index] = opt; + }); - return ''; - } - function getEraNarrow() { - var i, - l, - val, - eras = this.localeData().eras(); - for (i = 0, l = eras.length; i < l; ++i) { - // truncate time - val = this.clone().startOf('day').valueOf(); + var head = document.getElementsByTagName('head')[0]; - if (eras[i].since <= val && val <= eras[i].until) { - return eras[i].narrow; - } - if (eras[i].until <= val && val <= eras[i].since) { - return eras[i].narrow; - } - } + //Add meta-tags and favicons + tagList.forEach( (opt) => { + var link = document.createElement(opt.tag); + for (var id in opt) + if (id != 'tag') + link.setAttribute(id, opt[id]); + head.appendChild(link); + }); + }; - return ''; - } +}(jQuery, this, document)); +; +/**************************************************************************** + fcoo-global-events.js, - function getEraAbbr() { - var i, - l, - val, - eras = this.localeData().eras(); - for (i = 0, l = eras.length; i < l; ++i) { - // truncate time - val = this.clone().startOf('day').valueOf(); + (c) 2016, FCOO - if (eras[i].since <= val && val <= eras[i].until) { - return eras[i].abbr; - } - if (eras[i].until <= val && val <= eras[i].since) { - return eras[i].abbr; - } - } + https://github.com/FCOO/fcoo-global-events + https://github.com/FCOO - return ''; - } +****************************************************************************/ - function getEraYear() { - var i, - l, - dir, - val, - eras = this.localeData().eras(); - for (i = 0, l = eras.length; i < l; ++i) { - dir = eras[i].since <= eras[i].until ? +1 : -1; +(function (window/*, document, undefined*/) { + "use strict"; - // truncate time - val = this.clone().startOf('day').valueOf(); + //Create fcoo-namespace + var ns = window.fcoo = window.fcoo || {}; - if ( - (eras[i].since <= val && val <= eras[i].until) || - (eras[i].until <= val && val <= eras[i].since) - ) { - return ( - (this.year() - hooks(eras[i].since).year()) * dir + - eras[i].offset - ); - } - } + ns.events = new window.GlobalEvents(); + ns.events.eventNames = ['LANGUAGECHANGED', 'TIMEZONECHANGED', 'DATETIMEFORMATCHANGED', 'NUMBERFORMATCHANGED', 'LATLNGFORMATCHANGED', 'UNITCHANGED']; - return this.year(); - } + $.each( ns.events.eventNames, function( index, eventName ){ + ns.events[ eventName ] = eventName; + }); - function erasNameRegex(isStrict) { - if (!hasOwnProp(this, '_erasNameRegex')) { - computeErasParse.call(this); - } - return isStrict ? this._erasNameRegex : this._erasRegex; - } +}(this, document)); +; +//! moment.js +//! version : 2.30.1 +//! authors : Tim Wood, Iskren Chernev, Moment.js contributors +//! license : MIT +//! momentjs.com - function erasAbbrRegex(isStrict) { - if (!hasOwnProp(this, '_erasAbbrRegex')) { - computeErasParse.call(this); - } - return isStrict ? this._erasAbbrRegex : this._erasRegex; - } +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + global.moment = factory() +}(this, (function () { 'use strict'; - function erasNarrowRegex(isStrict) { - if (!hasOwnProp(this, '_erasNarrowRegex')) { - computeErasParse.call(this); - } - return isStrict ? this._erasNarrowRegex : this._erasRegex; - } + var hookCallback; - function matchEraAbbr(isStrict, locale) { - return locale.erasAbbrRegex(isStrict); + function hooks() { + return hookCallback.apply(null, arguments); } - function matchEraName(isStrict, locale) { - return locale.erasNameRegex(isStrict); + // This is done to register the method called with moment() + // without creating circular dependencies. + function setHookCallback(callback) { + hookCallback = callback; } - function matchEraNarrow(isStrict, locale) { - return locale.erasNarrowRegex(isStrict); + function isArray(input) { + return ( + input instanceof Array || + Object.prototype.toString.call(input) === '[object Array]' + ); } - function matchEraYearOrdinal(isStrict, locale) { - return locale._eraYearOrdinalRegex || matchUnsigned; + function isObject(input) { + // IE8 will treat undefined and null as object if it wasn't for + // input != null + return ( + input != null && + Object.prototype.toString.call(input) === '[object Object]' + ); } - function computeErasParse() { - var abbrPieces = [], - namePieces = [], - narrowPieces = [], - mixedPieces = [], - i, - l, - eras = this.eras(); - - for (i = 0, l = eras.length; i < l; ++i) { - namePieces.push(regexEscape(eras[i].name)); - abbrPieces.push(regexEscape(eras[i].abbr)); - narrowPieces.push(regexEscape(eras[i].narrow)); + function hasOwnProp(a, b) { + return Object.prototype.hasOwnProperty.call(a, b); + } - mixedPieces.push(regexEscape(eras[i].name)); - mixedPieces.push(regexEscape(eras[i].abbr)); - mixedPieces.push(regexEscape(eras[i].narrow)); + function isObjectEmpty(obj) { + if (Object.getOwnPropertyNames) { + return Object.getOwnPropertyNames(obj).length === 0; + } else { + var k; + for (k in obj) { + if (hasOwnProp(obj, k)) { + return false; + } + } + return true; } - - this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i'); - this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i'); - this._erasNarrowRegex = new RegExp( - '^(' + narrowPieces.join('|') + ')', - 'i' - ); } - // FORMATTING - - addFormatToken(0, ['gg', 2], 0, function () { - return this.weekYear() % 100; - }); - - addFormatToken(0, ['GG', 2], 0, function () { - return this.isoWeekYear() % 100; - }); - - function addWeekYearFormatToken(token, getter) { - addFormatToken(0, [token, token.length], 0, getter); + function isUndefined(input) { + return input === void 0; } - addWeekYearFormatToken('gggg', 'weekYear'); - addWeekYearFormatToken('ggggg', 'weekYear'); - addWeekYearFormatToken('GGGG', 'isoWeekYear'); - addWeekYearFormatToken('GGGGG', 'isoWeekYear'); - - // ALIASES - - addUnitAlias('weekYear', 'gg'); - addUnitAlias('isoWeekYear', 'GG'); - - // PRIORITY - - addUnitPriority('weekYear', 1); - addUnitPriority('isoWeekYear', 1); + function isNumber(input) { + return ( + typeof input === 'number' || + Object.prototype.toString.call(input) === '[object Number]' + ); + } - // PARSING + function isDate(input) { + return ( + input instanceof Date || + Object.prototype.toString.call(input) === '[object Date]' + ); + } - addRegexToken('G', matchSigned); - addRegexToken('g', matchSigned); - addRegexToken('GG', match1to2, match2); - addRegexToken('gg', match1to2, match2); - addRegexToken('GGGG', match1to4, match4); - addRegexToken('gggg', match1to4, match4); - addRegexToken('GGGGG', match1to6, match6); - addRegexToken('ggggg', match1to6, match6); + function map(arr, fn) { + var res = [], + i, + arrLen = arr.length; + for (i = 0; i < arrLen; ++i) { + res.push(fn(arr[i], i)); + } + return res; + } - addWeekParseToken( - ['gggg', 'ggggg', 'GGGG', 'GGGGG'], - function (input, week, config, token) { - week[token.substr(0, 2)] = toInt(input); + function extend(a, b) { + for (var i in b) { + if (hasOwnProp(b, i)) { + a[i] = b[i]; + } } - ); - addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { - week[token] = hooks.parseTwoDigitYear(input); - }); + if (hasOwnProp(b, 'toString')) { + a.toString = b.toString; + } - // MOMENTS + if (hasOwnProp(b, 'valueOf')) { + a.valueOf = b.valueOf; + } - function getSetWeekYear(input) { - return getSetWeekYearHelper.call( - this, - input, - this.week(), - this.weekday(), - this.localeData()._week.dow, - this.localeData()._week.doy - ); + return a; } - function getSetISOWeekYear(input) { - return getSetWeekYearHelper.call( - this, - input, - this.isoWeek(), - this.isoWeekday(), - 1, - 4 - ); + function createUTC(input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, true).utc(); } - function getISOWeeksInYear() { - return weeksInYear(this.year(), 1, 4); + function defaultParsingFlags() { + // We need to deep clone this object. + return { + empty: false, + unusedTokens: [], + unusedInput: [], + overflow: -2, + charsLeftOver: 0, + nullInput: false, + invalidEra: null, + invalidMonth: null, + invalidFormat: false, + userInvalidated: false, + iso: false, + parsedDateParts: [], + era: null, + meridiem: null, + rfc2822: false, + weekdayMismatch: false, + }; } - function getISOWeeksInISOWeekYear() { - return weeksInYear(this.isoWeekYear(), 1, 4); + function getParsingFlags(m) { + if (m._pf == null) { + m._pf = defaultParsingFlags(); + } + return m._pf; } - function getWeeksInYear() { - var weekInfo = this.localeData()._week; - return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); - } + var some; + if (Array.prototype.some) { + some = Array.prototype.some; + } else { + some = function (fun) { + var t = Object(this), + len = t.length >>> 0, + i; - function getWeeksInWeekYear() { - var weekInfo = this.localeData()._week; - return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); + for (i = 0; i < len; i++) { + if (i in t && fun.call(this, t[i], i, t)) { + return true; + } + } + + return false; + }; } - function getSetWeekYearHelper(input, week, weekday, dow, doy) { - var weeksTarget; - if (input == null) { - return weekOfYear(this, dow, doy).year; - } else { - weeksTarget = weeksInYear(input, dow, doy); - if (week > weeksTarget) { - week = weeksTarget; + function isValid(m) { + var flags = null, + parsedParts = false, + isNowValid = m._d && !isNaN(m._d.getTime()); + if (isNowValid) { + flags = getParsingFlags(m); + parsedParts = some.call(flags.parsedDateParts, function (i) { + return i != null; + }); + isNowValid = + flags.overflow < 0 && + !flags.empty && + !flags.invalidEra && + !flags.invalidMonth && + !flags.invalidWeekday && + !flags.weekdayMismatch && + !flags.nullInput && + !flags.invalidFormat && + !flags.userInvalidated && + (!flags.meridiem || (flags.meridiem && parsedParts)); + if (m._strict) { + isNowValid = + isNowValid && + flags.charsLeftOver === 0 && + flags.unusedTokens.length === 0 && + flags.bigHour === undefined; } - return setWeekAll.call(this, input, week, weekday, dow, doy); } + if (Object.isFrozen == null || !Object.isFrozen(m)) { + m._isValid = isNowValid; + } else { + return isNowValid; + } + return m._isValid; } - function setWeekAll(weekYear, week, weekday, dow, doy) { - var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), - date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); + function createInvalid(flags) { + var m = createUTC(NaN); + if (flags != null) { + extend(getParsingFlags(m), flags); + } else { + getParsingFlags(m).userInvalidated = true; + } - this.year(date.getUTCFullYear()); - this.month(date.getUTCMonth()); - this.date(date.getUTCDate()); - return this; + return m; } - // FORMATTING - - addFormatToken('Q', 0, 'Qo', 'quarter'); - - // ALIASES - - addUnitAlias('quarter', 'Q'); + // Plugins that add properties should also add the key here (null value), + // so we can properly clone ourselves. + var momentProperties = (hooks.momentProperties = []), + updateInProgress = false; - // PRIORITY + function copyConfig(to, from) { + var i, + prop, + val, + momentPropertiesLen = momentProperties.length; - addUnitPriority('quarter', 7); + if (!isUndefined(from._isAMomentObject)) { + to._isAMomentObject = from._isAMomentObject; + } + if (!isUndefined(from._i)) { + to._i = from._i; + } + if (!isUndefined(from._f)) { + to._f = from._f; + } + if (!isUndefined(from._l)) { + to._l = from._l; + } + if (!isUndefined(from._strict)) { + to._strict = from._strict; + } + if (!isUndefined(from._tzm)) { + to._tzm = from._tzm; + } + if (!isUndefined(from._isUTC)) { + to._isUTC = from._isUTC; + } + if (!isUndefined(from._offset)) { + to._offset = from._offset; + } + if (!isUndefined(from._pf)) { + to._pf = getParsingFlags(from); + } + if (!isUndefined(from._locale)) { + to._locale = from._locale; + } - // PARSING - - addRegexToken('Q', match1); - addParseToken('Q', function (input, array) { - array[MONTH] = (toInt(input) - 1) * 3; - }); - - // MOMENTS + if (momentPropertiesLen > 0) { + for (i = 0; i < momentPropertiesLen; i++) { + prop = momentProperties[i]; + val = from[prop]; + if (!isUndefined(val)) { + to[prop] = val; + } + } + } - function getSetQuarter(input) { - return input == null - ? Math.ceil((this.month() + 1) / 3) - : this.month((input - 1) * 3 + (this.month() % 3)); + return to; } - // FORMATTING - - addFormatToken('D', ['DD', 2], 'Do', 'date'); - - // ALIASES - - addUnitAlias('date', 'D'); - - // PRIORITY - addUnitPriority('date', 9); - - // PARSING - - addRegexToken('D', match1to2); - addRegexToken('DD', match1to2, match2); - addRegexToken('Do', function (isStrict, locale) { - // TODO: Remove "ordinalParse" fallback in next major release. - return isStrict - ? locale._dayOfMonthOrdinalParse || locale._ordinalParse - : locale._dayOfMonthOrdinalParseLenient; - }); - - addParseToken(['D', 'DD'], DATE); - addParseToken('Do', function (input, array) { - array[DATE] = toInt(input.match(match1to2)[0]); - }); - - // MOMENTS - - var getSetDayOfMonth = makeGetSet('Date', true); - - // FORMATTING + // Moment prototype object + function Moment(config) { + copyConfig(this, config); + this._d = new Date(config._d != null ? config._d.getTime() : NaN); + if (!this.isValid()) { + this._d = new Date(NaN); + } + // Prevent infinite loop in case updateOffset creates new moment + // objects. + if (updateInProgress === false) { + updateInProgress = true; + hooks.updateOffset(this); + updateInProgress = false; + } + } - addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); + function isMoment(obj) { + return ( + obj instanceof Moment || (obj != null && obj._isAMomentObject != null) + ); + } - // ALIASES + function warn(msg) { + if ( + hooks.suppressDeprecationWarnings === false && + typeof console !== 'undefined' && + console.warn + ) { + console.warn('Deprecation warning: ' + msg); + } + } - addUnitAlias('dayOfYear', 'DDD'); + function deprecate(msg, fn) { + var firstTime = true; - // PRIORITY - addUnitPriority('dayOfYear', 4); + return extend(function () { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(null, msg); + } + if (firstTime) { + var args = [], + arg, + i, + key, + argLen = arguments.length; + for (i = 0; i < argLen; i++) { + arg = ''; + if (typeof arguments[i] === 'object') { + arg += '\n[' + i + '] '; + for (key in arguments[0]) { + if (hasOwnProp(arguments[0], key)) { + arg += key + ': ' + arguments[0][key] + ', '; + } + } + arg = arg.slice(0, -2); // Remove trailing comma and space + } else { + arg = arguments[i]; + } + args.push(arg); + } + warn( + msg + + '\nArguments: ' + + Array.prototype.slice.call(args).join('') + + '\n' + + new Error().stack + ); + firstTime = false; + } + return fn.apply(this, arguments); + }, fn); + } - // PARSING + var deprecations = {}; - addRegexToken('DDD', match1to3); - addRegexToken('DDDD', match3); - addParseToken(['DDD', 'DDDD'], function (input, array, config) { - config._dayOfYear = toInt(input); - }); + function deprecateSimple(name, msg) { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(name, msg); + } + if (!deprecations[name]) { + warn(msg); + deprecations[name] = true; + } + } - // HELPERS + hooks.suppressDeprecationWarnings = false; + hooks.deprecationHandler = null; - // MOMENTS + function isFunction(input) { + return ( + (typeof Function !== 'undefined' && input instanceof Function) || + Object.prototype.toString.call(input) === '[object Function]' + ); + } - function getSetDayOfYear(input) { - var dayOfYear = - Math.round( - (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5 - ) + 1; - return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); + function set(config) { + var prop, i; + for (i in config) { + if (hasOwnProp(config, i)) { + prop = config[i]; + if (isFunction(prop)) { + this[i] = prop; + } else { + this['_' + i] = prop; + } + } + } + this._config = config; + // Lenient ordinal parsing accepts just a number in addition to + // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. + // TODO: Remove "ordinalParse" fallback in next major release. + this._dayOfMonthOrdinalParseLenient = new RegExp( + (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + + '|' + + /\d{1,2}/.source + ); } - // FORMATTING + function mergeConfigs(parentConfig, childConfig) { + var res = extend({}, parentConfig), + prop; + for (prop in childConfig) { + if (hasOwnProp(childConfig, prop)) { + if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { + res[prop] = {}; + extend(res[prop], parentConfig[prop]); + extend(res[prop], childConfig[prop]); + } else if (childConfig[prop] != null) { + res[prop] = childConfig[prop]; + } else { + delete res[prop]; + } + } + } + for (prop in parentConfig) { + if ( + hasOwnProp(parentConfig, prop) && + !hasOwnProp(childConfig, prop) && + isObject(parentConfig[prop]) + ) { + // make sure changes to properties don't modify parent config + res[prop] = extend({}, res[prop]); + } + } + return res; + } - addFormatToken('m', ['mm', 2], 0, 'minute'); + function Locale(config) { + if (config != null) { + this.set(config); + } + } - // ALIASES + var keys; - addUnitAlias('minute', 'm'); + if (Object.keys) { + keys = Object.keys; + } else { + keys = function (obj) { + var i, + res = []; + for (i in obj) { + if (hasOwnProp(obj, i)) { + res.push(i); + } + } + return res; + }; + } - // PRIORITY + var defaultCalendar = { + sameDay: '[Today at] LT', + nextDay: '[Tomorrow at] LT', + nextWeek: 'dddd [at] LT', + lastDay: '[Yesterday at] LT', + lastWeek: '[Last] dddd [at] LT', + sameElse: 'L', + }; - addUnitPriority('minute', 14); + function calendar(key, mom, now) { + var output = this._calendar[key] || this._calendar['sameElse']; + return isFunction(output) ? output.call(mom, now) : output; + } - // PARSING + function zeroFill(number, targetLength, forceSign) { + var absNumber = '' + Math.abs(number), + zerosToFill = targetLength - absNumber.length, + sign = number >= 0; + return ( + (sign ? (forceSign ? '+' : '') : '-') + + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + + absNumber + ); + } - addRegexToken('m', match1to2); - addRegexToken('mm', match1to2, match2); - addParseToken(['m', 'mm'], MINUTE); + var formattingTokens = + /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, + localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, + formatFunctions = {}, + formatTokenFunctions = {}; - // MOMENTS + // token: 'M' + // padded: ['MM', 2] + // ordinal: 'Mo' + // callback: function () { this.month() + 1 } + function addFormatToken(token, padded, ordinal, callback) { + var func = callback; + if (typeof callback === 'string') { + func = function () { + return this[callback](); + }; + } + if (token) { + formatTokenFunctions[token] = func; + } + if (padded) { + formatTokenFunctions[padded[0]] = function () { + return zeroFill(func.apply(this, arguments), padded[1], padded[2]); + }; + } + if (ordinal) { + formatTokenFunctions[ordinal] = function () { + return this.localeData().ordinal( + func.apply(this, arguments), + token + ); + }; + } + } - var getSetMinute = makeGetSet('Minutes', false); + function removeFormattingTokens(input) { + if (input.match(/\[[\s\S]/)) { + return input.replace(/^\[|\]$/g, ''); + } + return input.replace(/\\/g, ''); + } - // FORMATTING + function makeFormatFunction(format) { + var array = format.match(formattingTokens), + i, + length; - addFormatToken('s', ['ss', 2], 0, 'second'); + for (i = 0, length = array.length; i < length; i++) { + if (formatTokenFunctions[array[i]]) { + array[i] = formatTokenFunctions[array[i]]; + } else { + array[i] = removeFormattingTokens(array[i]); + } + } - // ALIASES + return function (mom) { + var output = '', + i; + for (i = 0; i < length; i++) { + output += isFunction(array[i]) + ? array[i].call(mom, format) + : array[i]; + } + return output; + }; + } - addUnitAlias('second', 's'); + // format date using native date object + function formatMoment(m, format) { + if (!m.isValid()) { + return m.localeData().invalidDate(); + } - // PRIORITY + format = expandFormat(format, m.localeData()); + formatFunctions[format] = + formatFunctions[format] || makeFormatFunction(format); - addUnitPriority('second', 15); + return formatFunctions[format](m); + } - // PARSING + function expandFormat(format, locale) { + var i = 5; - addRegexToken('s', match1to2); - addRegexToken('ss', match1to2, match2); - addParseToken(['s', 'ss'], SECOND); + function replaceLongDateFormatTokens(input) { + return locale.longDateFormat(input) || input; + } - // MOMENTS + localFormattingTokens.lastIndex = 0; + while (i >= 0 && localFormattingTokens.test(format)) { + format = format.replace( + localFormattingTokens, + replaceLongDateFormatTokens + ); + localFormattingTokens.lastIndex = 0; + i -= 1; + } - var getSetSecond = makeGetSet('Seconds', false); + return format; + } - // FORMATTING + var defaultLongDateFormat = { + LTS: 'h:mm:ss A', + LT: 'h:mm A', + L: 'MM/DD/YYYY', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY h:mm A', + LLLL: 'dddd, MMMM D, YYYY h:mm A', + }; - addFormatToken('S', 0, 0, function () { - return ~~(this.millisecond() / 100); - }); + function longDateFormat(key) { + var format = this._longDateFormat[key], + formatUpper = this._longDateFormat[key.toUpperCase()]; - addFormatToken(0, ['SS', 2], 0, function () { - return ~~(this.millisecond() / 10); - }); + if (format || !formatUpper) { + return format; + } - addFormatToken(0, ['SSS', 3], 0, 'millisecond'); - addFormatToken(0, ['SSSS', 4], 0, function () { - return this.millisecond() * 10; - }); - addFormatToken(0, ['SSSSS', 5], 0, function () { - return this.millisecond() * 100; - }); - addFormatToken(0, ['SSSSSS', 6], 0, function () { - return this.millisecond() * 1000; - }); - addFormatToken(0, ['SSSSSSS', 7], 0, function () { - return this.millisecond() * 10000; - }); - addFormatToken(0, ['SSSSSSSS', 8], 0, function () { - return this.millisecond() * 100000; - }); - addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { - return this.millisecond() * 1000000; - }); + this._longDateFormat[key] = formatUpper + .match(formattingTokens) + .map(function (tok) { + if ( + tok === 'MMMM' || + tok === 'MM' || + tok === 'DD' || + tok === 'dddd' + ) { + return tok.slice(1); + } + return tok; + }) + .join(''); - // ALIASES + return this._longDateFormat[key]; + } - addUnitAlias('millisecond', 'ms'); + var defaultInvalidDate = 'Invalid date'; - // PRIORITY + function invalidDate() { + return this._invalidDate; + } - addUnitPriority('millisecond', 16); + var defaultOrdinal = '%d', + defaultDayOfMonthOrdinalParse = /\d{1,2}/; - // PARSING + function ordinal(number) { + return this._ordinal.replace('%d', number); + } - addRegexToken('S', match1to3, match1); - addRegexToken('SS', match1to3, match2); - addRegexToken('SSS', match1to3, match3); + var defaultRelativeTime = { + future: 'in %s', + past: '%s ago', + s: 'a few seconds', + ss: '%d seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', + d: 'a day', + dd: '%d days', + w: 'a week', + ww: '%d weeks', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years', + }; - var token, getSetMillisecond; - for (token = 'SSSS'; token.length <= 9; token += 'S') { - addRegexToken(token, matchUnsigned); + function relativeTime(number, withoutSuffix, string, isFuture) { + var output = this._relativeTime[string]; + return isFunction(output) + ? output(number, withoutSuffix, string, isFuture) + : output.replace(/%d/i, number); } - function parseMs(input, array) { - array[MILLISECOND] = toInt(('0.' + input) * 1000); + function pastFuture(diff, output) { + var format = this._relativeTime[diff > 0 ? 'future' : 'past']; + return isFunction(format) ? format(output) : format.replace(/%s/i, output); } - for (token = 'S'; token.length <= 9; token += 'S') { - addParseToken(token, parseMs); + var aliases = { + D: 'date', + dates: 'date', + date: 'date', + d: 'day', + days: 'day', + day: 'day', + e: 'weekday', + weekdays: 'weekday', + weekday: 'weekday', + E: 'isoWeekday', + isoweekdays: 'isoWeekday', + isoweekday: 'isoWeekday', + DDD: 'dayOfYear', + dayofyears: 'dayOfYear', + dayofyear: 'dayOfYear', + h: 'hour', + hours: 'hour', + hour: 'hour', + ms: 'millisecond', + milliseconds: 'millisecond', + millisecond: 'millisecond', + m: 'minute', + minutes: 'minute', + minute: 'minute', + M: 'month', + months: 'month', + month: 'month', + Q: 'quarter', + quarters: 'quarter', + quarter: 'quarter', + s: 'second', + seconds: 'second', + second: 'second', + gg: 'weekYear', + weekyears: 'weekYear', + weekyear: 'weekYear', + GG: 'isoWeekYear', + isoweekyears: 'isoWeekYear', + isoweekyear: 'isoWeekYear', + w: 'week', + weeks: 'week', + week: 'week', + W: 'isoWeek', + isoweeks: 'isoWeek', + isoweek: 'isoWeek', + y: 'year', + years: 'year', + year: 'year', + }; + + function normalizeUnits(units) { + return typeof units === 'string' + ? aliases[units] || aliases[units.toLowerCase()] + : undefined; } - getSetMillisecond = makeGetSet('Milliseconds', false); + function normalizeObjectUnits(inputObject) { + var normalizedInput = {}, + normalizedProp, + prop; - // FORMATTING + for (prop in inputObject) { + if (hasOwnProp(inputObject, prop)) { + normalizedProp = normalizeUnits(prop); + if (normalizedProp) { + normalizedInput[normalizedProp] = inputObject[prop]; + } + } + } - addFormatToken('z', 0, 0, 'zoneAbbr'); - addFormatToken('zz', 0, 0, 'zoneName'); + return normalizedInput; + } - // MOMENTS + var priorities = { + date: 9, + day: 11, + weekday: 11, + isoWeekday: 11, + dayOfYear: 4, + hour: 13, + millisecond: 16, + minute: 14, + month: 8, + quarter: 7, + second: 15, + weekYear: 1, + isoWeekYear: 1, + week: 5, + isoWeek: 5, + year: 1, + }; - function getZoneAbbr() { - return this._isUTC ? 'UTC' : ''; + function getPrioritizedUnits(unitsObj) { + var units = [], + u; + for (u in unitsObj) { + if (hasOwnProp(unitsObj, u)) { + units.push({ unit: u, priority: priorities[u] }); + } + } + units.sort(function (a, b) { + return a.priority - b.priority; + }); + return units; } - function getZoneName() { - return this._isUTC ? 'Coordinated Universal Time' : ''; - } + var match1 = /\d/, // 0 - 9 + match2 = /\d\d/, // 00 - 99 + match3 = /\d{3}/, // 000 - 999 + match4 = /\d{4}/, // 0000 - 9999 + match6 = /[+-]?\d{6}/, // -999999 - 999999 + match1to2 = /\d\d?/, // 0 - 99 + match3to4 = /\d\d\d\d?/, // 999 - 9999 + match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999 + match1to3 = /\d{1,3}/, // 0 - 999 + match1to4 = /\d{1,4}/, // 0 - 9999 + match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999 + matchUnsigned = /\d+/, // 0 - inf + matchSigned = /[+-]?\d+/, // -inf - inf + matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z + matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z + matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 + // any word (or two) characters or numbers including two/three word month in arabic. + // includes scottish gaelic two word and hyphenated months + matchWord = + /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, + match1to2NoLeadingZero = /^[1-9]\d?/, // 1-99 + match1to2HasZero = /^([1-9]\d|\d)/, // 0-99 + regexes; - var proto = Moment.prototype; + regexes = {}; - proto.add = add; - proto.calendar = calendar$1; - proto.clone = clone; - proto.diff = diff; - proto.endOf = endOf; - proto.format = format; - proto.from = from; - proto.fromNow = fromNow; - proto.to = to; - proto.toNow = toNow; - proto.get = stringGet; - proto.invalidAt = invalidAt; - proto.isAfter = isAfter; - proto.isBefore = isBefore; - proto.isBetween = isBetween; - proto.isSame = isSame; - proto.isSameOrAfter = isSameOrAfter; - proto.isSameOrBefore = isSameOrBefore; - proto.isValid = isValid$2; - proto.lang = lang; - proto.locale = locale; - proto.localeData = localeData; - proto.max = prototypeMax; - proto.min = prototypeMin; - proto.parsingFlags = parsingFlags; - proto.set = stringSet; - proto.startOf = startOf; - proto.subtract = subtract; - proto.toArray = toArray; - proto.toObject = toObject; - proto.toDate = toDate; - proto.toISOString = toISOString; - proto.inspect = inspect; - if (typeof Symbol !== 'undefined' && Symbol.for != null) { - proto[Symbol.for('nodejs.util.inspect.custom')] = function () { - return 'Moment<' + this.format() + '>'; - }; + function addRegexToken(token, regex, strictRegex) { + regexes[token] = isFunction(regex) + ? regex + : function (isStrict, localeData) { + return isStrict && strictRegex ? strictRegex : regex; + }; } - proto.toJSON = toJSON; - proto.toString = toString; - proto.unix = unix; - proto.valueOf = valueOf; - proto.creationData = creationData; - proto.eraName = getEraName; - proto.eraNarrow = getEraNarrow; - proto.eraAbbr = getEraAbbr; - proto.eraYear = getEraYear; - proto.year = getSetYear; - proto.isLeapYear = getIsLeapYear; - proto.weekYear = getSetWeekYear; - proto.isoWeekYear = getSetISOWeekYear; - proto.quarter = proto.quarters = getSetQuarter; - proto.month = getSetMonth; - proto.daysInMonth = getDaysInMonth; - proto.week = proto.weeks = getSetWeek; - proto.isoWeek = proto.isoWeeks = getSetISOWeek; - proto.weeksInYear = getWeeksInYear; - proto.weeksInWeekYear = getWeeksInWeekYear; - proto.isoWeeksInYear = getISOWeeksInYear; - proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; - proto.date = getSetDayOfMonth; - proto.day = proto.days = getSetDayOfWeek; - proto.weekday = getSetLocaleDayOfWeek; - proto.isoWeekday = getSetISODayOfWeek; - proto.dayOfYear = getSetDayOfYear; - proto.hour = proto.hours = getSetHour; - proto.minute = proto.minutes = getSetMinute; - proto.second = proto.seconds = getSetSecond; - proto.millisecond = proto.milliseconds = getSetMillisecond; - proto.utcOffset = getSetOffset; - proto.utc = setOffsetToUTC; - proto.local = setOffsetToLocal; - proto.parseZone = setOffsetToParsedOffset; - proto.hasAlignedHourOffset = hasAlignedHourOffset; - proto.isDST = isDaylightSavingTime; - proto.isLocal = isLocal; - proto.isUtcOffset = isUtcOffset; - proto.isUtc = isUtc; - proto.isUTC = isUtc; - proto.zoneAbbr = getZoneAbbr; - proto.zoneName = getZoneName; - proto.dates = deprecate( - 'dates accessor is deprecated. Use date instead.', - getSetDayOfMonth - ); - proto.months = deprecate( - 'months accessor is deprecated. Use month instead', - getSetMonth - ); - proto.years = deprecate( - 'years accessor is deprecated. Use year instead', - getSetYear - ); - proto.zone = deprecate( - 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', - getSetZone - ); - proto.isDSTShifted = deprecate( - 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', - isDaylightSavingTimeShifted - ); - function createUnix(input) { - return createLocal(input * 1000); - } + function getParseRegexForToken(token, config) { + if (!hasOwnProp(regexes, token)) { + return new RegExp(unescapeFormat(token)); + } - function createInZone() { - return createLocal.apply(null, arguments).parseZone(); + return regexes[token](config._strict, config._locale); } - function preParsePostFormat(string) { - return string; + // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript + function unescapeFormat(s) { + return regexEscape( + s + .replace('\\', '') + .replace( + /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, + function (matched, p1, p2, p3, p4) { + return p1 || p2 || p3 || p4; + } + ) + ); } - var proto$1 = Locale.prototype; - - proto$1.calendar = calendar; - proto$1.longDateFormat = longDateFormat; - proto$1.invalidDate = invalidDate; - proto$1.ordinal = ordinal; - proto$1.preparse = preParsePostFormat; - proto$1.postformat = preParsePostFormat; - proto$1.relativeTime = relativeTime; - proto$1.pastFuture = pastFuture; - proto$1.set = set; - proto$1.eras = localeEras; - proto$1.erasParse = localeErasParse; - proto$1.erasConvertYear = localeErasConvertYear; - proto$1.erasAbbrRegex = erasAbbrRegex; - proto$1.erasNameRegex = erasNameRegex; - proto$1.erasNarrowRegex = erasNarrowRegex; - - proto$1.months = localeMonths; - proto$1.monthsShort = localeMonthsShort; - proto$1.monthsParse = localeMonthsParse; - proto$1.monthsRegex = monthsRegex; - proto$1.monthsShortRegex = monthsShortRegex; - proto$1.week = localeWeek; - proto$1.firstDayOfYear = localeFirstDayOfYear; - proto$1.firstDayOfWeek = localeFirstDayOfWeek; - - proto$1.weekdays = localeWeekdays; - proto$1.weekdaysMin = localeWeekdaysMin; - proto$1.weekdaysShort = localeWeekdaysShort; - proto$1.weekdaysParse = localeWeekdaysParse; - - proto$1.weekdaysRegex = weekdaysRegex; - proto$1.weekdaysShortRegex = weekdaysShortRegex; - proto$1.weekdaysMinRegex = weekdaysMinRegex; - - proto$1.isPM = localeIsPM; - proto$1.meridiem = localeMeridiem; - - function get$1(format, index, field, setter) { - var locale = getLocale(), - utc = createUTC().set(setter, index); - return locale[field](utc, format); + function regexEscape(s) { + return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); } - function listMonthsImpl(format, index, field) { - if (isNumber(format)) { - index = format; - format = undefined; + function absFloor(number) { + if (number < 0) { + // -0 -> 0 + return Math.ceil(number) || 0; + } else { + return Math.floor(number); } + } - format = format || ''; + function toInt(argumentForCoercion) { + var coercedNumber = +argumentForCoercion, + value = 0; - if (index != null) { - return get$1(format, index, field, 'month'); + if (coercedNumber !== 0 && isFinite(coercedNumber)) { + value = absFloor(coercedNumber); } - var i, - out = []; - for (i = 0; i < 12; i++) { - out[i] = get$1(format, i, field, 'month'); - } - return out; + return value; } - // () - // (5) - // (fmt, 5) - // (fmt) - // (true) - // (true, 5) - // (true, fmt, 5) - // (true, fmt) - function listWeekdaysImpl(localeSorted, format, index, field) { - if (typeof localeSorted === 'boolean') { - if (isNumber(format)) { - index = format; - format = undefined; - } - - format = format || ''; - } else { - format = localeSorted; - index = format; - localeSorted = false; - - if (isNumber(format)) { - index = format; - format = undefined; - } + var tokens = {}; - format = format || ''; + function addParseToken(token, callback) { + var i, + func = callback, + tokenLen; + if (typeof token === 'string') { + token = [token]; } - - var locale = getLocale(), - shift = localeSorted ? locale._week.dow : 0, - i, - out = []; - - if (index != null) { - return get$1(format, (index + shift) % 7, field, 'day'); + if (isNumber(callback)) { + func = function (input, array) { + array[callback] = toInt(input); + }; } - - for (i = 0; i < 7; i++) { - out[i] = get$1(format, (i + shift) % 7, field, 'day'); + tokenLen = token.length; + for (i = 0; i < tokenLen; i++) { + tokens[token[i]] = func; } - return out; } - function listMonths(format, index) { - return listMonthsImpl(format, index, 'months'); + function addWeekParseToken(token, callback) { + addParseToken(token, function (input, array, config, token) { + config._w = config._w || {}; + callback(input, config._w, config, token); + }); } - function listMonthsShort(format, index) { - return listMonthsImpl(format, index, 'monthsShort'); + function addTimeToArrayFromToken(token, input, config) { + if (input != null && hasOwnProp(tokens, token)) { + tokens[token](input, config._a, config, token); + } } - function listWeekdays(localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); + function isLeapYear(year) { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; } - function listWeekdaysShort(localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); - } + var YEAR = 0, + MONTH = 1, + DATE = 2, + HOUR = 3, + MINUTE = 4, + SECOND = 5, + MILLISECOND = 6, + WEEK = 7, + WEEKDAY = 8; - function listWeekdaysMin(localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); - } + // FORMATTING - getSetGlobalLocale('en', { - eras: [ - { - since: '0001-01-01', - until: +Infinity, - offset: 1, - name: 'Anno Domini', - narrow: 'AD', - abbr: 'AD', - }, - { - since: '0000-12-31', - until: -Infinity, - offset: 1, - name: 'Before Christ', - narrow: 'BC', - abbr: 'BC', - }, - ], - dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal: function (number) { - var b = number % 10, - output = - toInt((number % 100) / 10) === 1 - ? 'th' - : b === 1 - ? 'st' - : b === 2 - ? 'nd' - : b === 3 - ? 'rd' - : 'th'; - return number + output; - }, + addFormatToken('Y', 0, 0, function () { + var y = this.year(); + return y <= 9999 ? zeroFill(y, 4) : '+' + y; }); - // Side effect imports + addFormatToken(0, ['YY', 2], 0, function () { + return this.year() % 100; + }); - hooks.lang = deprecate( - 'moment.lang is deprecated. Use moment.locale instead.', - getSetGlobalLocale - ); - hooks.langData = deprecate( - 'moment.langData is deprecated. Use moment.localeData instead.', - getLocale - ); + addFormatToken(0, ['YYYY', 4], 0, 'year'); + addFormatToken(0, ['YYYYY', 5], 0, 'year'); + addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); - var mathAbs = Math.abs; + // PARSING - function abs() { - var data = this._data; + addRegexToken('Y', matchSigned); + addRegexToken('YY', match1to2, match2); + addRegexToken('YYYY', match1to4, match4); + addRegexToken('YYYYY', match1to6, match6); + addRegexToken('YYYYYY', match1to6, match6); - this._milliseconds = mathAbs(this._milliseconds); - this._days = mathAbs(this._days); - this._months = mathAbs(this._months); + addParseToken(['YYYYY', 'YYYYYY'], YEAR); + addParseToken('YYYY', function (input, array) { + array[YEAR] = + input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); + }); + addParseToken('YY', function (input, array) { + array[YEAR] = hooks.parseTwoDigitYear(input); + }); + addParseToken('Y', function (input, array) { + array[YEAR] = parseInt(input, 10); + }); - data.milliseconds = mathAbs(data.milliseconds); - data.seconds = mathAbs(data.seconds); - data.minutes = mathAbs(data.minutes); - data.hours = mathAbs(data.hours); - data.months = mathAbs(data.months); - data.years = mathAbs(data.years); + // HELPERS - return this; + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; } - function addSubtract$1(duration, input, value, direction) { - var other = createDuration(input, value); + // HOOKS - duration._milliseconds += direction * other._milliseconds; - duration._days += direction * other._days; - duration._months += direction * other._months; + hooks.parseTwoDigitYear = function (input) { + return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); + }; - return duration._bubble(); - } + // MOMENTS - // supports only 2.0-style add(1, 's') or add(duration) - function add$1(input, value) { - return addSubtract$1(this, input, value, 1); - } + var getSetYear = makeGetSet('FullYear', true); - // supports only 2.0-style subtract(1, 's') or subtract(duration) - function subtract$1(input, value) { - return addSubtract$1(this, input, value, -1); + function getIsLeapYear() { + return isLeapYear(this.year()); } - function absCeil(number) { - if (number < 0) { - return Math.floor(number); - } else { - return Math.ceil(number); - } + function makeGetSet(unit, keepTime) { + return function (value) { + if (value != null) { + set$1(this, unit, value); + hooks.updateOffset(this, keepTime); + return this; + } else { + return get(this, unit); + } + }; } - function bubble() { - var milliseconds = this._milliseconds, - days = this._days, - months = this._months, - data = this._data, - seconds, - minutes, - hours, - years, - monthsFromDays; - - // if we have a mix of positive and negative values, bubble down first - // check: https://github.com/moment/moment/issues/2166 - if ( - !( - (milliseconds >= 0 && days >= 0 && months >= 0) || - (milliseconds <= 0 && days <= 0 && months <= 0) - ) - ) { - milliseconds += absCeil(monthsToDays(months) + days) * 864e5; - days = 0; - months = 0; + function get(mom, unit) { + if (!mom.isValid()) { + return NaN; } - // The following code bubbles up values, see the tests for - // examples of what that means. - data.milliseconds = milliseconds % 1000; - - seconds = absFloor(milliseconds / 1000); - data.seconds = seconds % 60; + var d = mom._d, + isUTC = mom._isUTC; + + switch (unit) { + case 'Milliseconds': + return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds(); + case 'Seconds': + return isUTC ? d.getUTCSeconds() : d.getSeconds(); + case 'Minutes': + return isUTC ? d.getUTCMinutes() : d.getMinutes(); + case 'Hours': + return isUTC ? d.getUTCHours() : d.getHours(); + case 'Date': + return isUTC ? d.getUTCDate() : d.getDate(); + case 'Day': + return isUTC ? d.getUTCDay() : d.getDay(); + case 'Month': + return isUTC ? d.getUTCMonth() : d.getMonth(); + case 'FullYear': + return isUTC ? d.getUTCFullYear() : d.getFullYear(); + default: + return NaN; // Just in case + } + } - minutes = absFloor(seconds / 60); - data.minutes = minutes % 60; + function set$1(mom, unit, value) { + var d, isUTC, year, month, date; - hours = absFloor(minutes / 60); - data.hours = hours % 24; + if (!mom.isValid() || isNaN(value)) { + return; + } - days += absFloor(hours / 24); + d = mom._d; + isUTC = mom._isUTC; + + switch (unit) { + case 'Milliseconds': + return void (isUTC + ? d.setUTCMilliseconds(value) + : d.setMilliseconds(value)); + case 'Seconds': + return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value)); + case 'Minutes': + return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value)); + case 'Hours': + return void (isUTC ? d.setUTCHours(value) : d.setHours(value)); + case 'Date': + return void (isUTC ? d.setUTCDate(value) : d.setDate(value)); + // case 'Day': // Not real + // return void (isUTC ? d.setUTCDay(value) : d.setDay(value)); + // case 'Month': // Not used because we need to pass two variables + // return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value)); + case 'FullYear': + break; // See below ... + default: + return; // Just in case + } - // convert days to months - monthsFromDays = absFloor(daysToMonths(days)); - months += monthsFromDays; - days -= absCeil(monthsToDays(monthsFromDays)); + year = value; + month = mom.month(); + date = mom.date(); + date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date; + void (isUTC + ? d.setUTCFullYear(year, month, date) + : d.setFullYear(year, month, date)); + } - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; + // MOMENTS - data.days = days; - data.months = months; - data.years = years; + function stringGet(units) { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](); + } + return this; + } + function stringSet(units, value) { + if (typeof units === 'object') { + units = normalizeObjectUnits(units); + var prioritized = getPrioritizedUnits(units), + i, + prioritizedLen = prioritized.length; + for (i = 0; i < prioritizedLen; i++) { + this[prioritized[i].unit](units[prioritized[i].unit]); + } + } else { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](value); + } + } return this; } - function daysToMonths(days) { - // 400 years have 146097 days (taking into account leap year rules) - // 400 years have 12 months === 4800 - return (days * 4800) / 146097; + function mod(n, x) { + return ((n % x) + x) % x; } - function monthsToDays(months) { - // the reverse of daysToMonths - return (months * 146097) / 4800; + var indexOf; + + if (Array.prototype.indexOf) { + indexOf = Array.prototype.indexOf; + } else { + indexOf = function (o) { + // I know + var i; + for (i = 0; i < this.length; ++i) { + if (this[i] === o) { + return i; + } + } + return -1; + }; } - function as(units) { - if (!this.isValid()) { + function daysInMonth(year, month) { + if (isNaN(year) || isNaN(month)) { return NaN; } - var days, - months, - milliseconds = this._milliseconds; + var modMonth = mod(month, 12); + year += (month - modMonth) / 12; + return modMonth === 1 + ? isLeapYear(year) + ? 29 + : 28 + : 31 - ((modMonth % 7) % 2); + } - units = normalizeUnits(units); + // FORMATTING - if (units === 'month' || units === 'quarter' || units === 'year') { - days = this._days + milliseconds / 864e5; - months = this._months + daysToMonths(days); - switch (units) { - case 'month': - return months; - case 'quarter': - return months / 3; - case 'year': - return months / 12; - } + addFormatToken('M', ['MM', 2], 'Mo', function () { + return this.month() + 1; + }); + + addFormatToken('MMM', 0, 0, function (format) { + return this.localeData().monthsShort(this, format); + }); + + addFormatToken('MMMM', 0, 0, function (format) { + return this.localeData().months(this, format); + }); + + // PARSING + + addRegexToken('M', match1to2, match1to2NoLeadingZero); + addRegexToken('MM', match1to2, match2); + addRegexToken('MMM', function (isStrict, locale) { + return locale.monthsShortRegex(isStrict); + }); + addRegexToken('MMMM', function (isStrict, locale) { + return locale.monthsRegex(isStrict); + }); + + addParseToken(['M', 'MM'], function (input, array) { + array[MONTH] = toInt(input) - 1; + }); + + addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { + var month = config._locale.monthsParse(input, token, config._strict); + // if we didn't find a month name, mark the date as invalid. + if (month != null) { + array[MONTH] = month; } else { - // handle milliseconds separately because of floating point math errors (issue #1867) - days = this._days + Math.round(monthsToDays(this._months)); - switch (units) { - case 'week': - return days / 7 + milliseconds / 6048e5; - case 'day': - return days + milliseconds / 864e5; - case 'hour': - return days * 24 + milliseconds / 36e5; - case 'minute': - return days * 1440 + milliseconds / 6e4; - case 'second': - return days * 86400 + milliseconds / 1000; - // Math.floor prevents floating point math errors here - case 'millisecond': - return Math.floor(days * 864e5) + milliseconds; - default: - throw new Error('Unknown unit ' + units); - } + getParsingFlags(config).invalidMonth = input; } - } + }); - // TODO: Use this.as('ms')? - function valueOf$1() { - if (!this.isValid()) { - return NaN; + // LOCALES + + var defaultLocaleMonths = + 'January_February_March_April_May_June_July_August_September_October_November_December'.split( + '_' + ), + defaultLocaleMonthsShort = + 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'), + MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, + defaultMonthsShortRegex = matchWord, + defaultMonthsRegex = matchWord; + + function localeMonths(m, format) { + if (!m) { + return isArray(this._months) + ? this._months + : this._months['standalone']; } - return ( - this._milliseconds + - this._days * 864e5 + - (this._months % 12) * 2592e6 + - toInt(this._months / 12) * 31536e6 - ); + return isArray(this._months) + ? this._months[m.month()] + : this._months[ + (this._months.isFormat || MONTHS_IN_FORMAT).test(format) + ? 'format' + : 'standalone' + ][m.month()]; } - function makeAs(alias) { - return function () { - return this.as(alias); - }; + function localeMonthsShort(m, format) { + if (!m) { + return isArray(this._monthsShort) + ? this._monthsShort + : this._monthsShort['standalone']; + } + return isArray(this._monthsShort) + ? this._monthsShort[m.month()] + : this._monthsShort[ + MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone' + ][m.month()]; } - var asMilliseconds = makeAs('ms'), - asSeconds = makeAs('s'), - asMinutes = makeAs('m'), - asHours = makeAs('h'), - asDays = makeAs('d'), - asWeeks = makeAs('w'), - asMonths = makeAs('M'), - asQuarters = makeAs('Q'), - asYears = makeAs('y'); + function handleStrictParse(monthName, format, strict) { + var i, + ii, + mom, + llc = monthName.toLocaleLowerCase(); + if (!this._monthsParse) { + // this is not used + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + for (i = 0; i < 12; ++i) { + mom = createUTC([2000, i]); + this._shortMonthsParse[i] = this.monthsShort( + mom, + '' + ).toLocaleLowerCase(); + this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); + } + } - function clone$1() { - return createDuration(this); + if (strict) { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } } - function get$2(units) { - units = normalizeUnits(units); - return this.isValid() ? this[units + 's']() : NaN; - } + function localeMonthsParse(monthName, format, strict) { + var i, mom, regex; - function makeGetter(name) { - return function () { - return this.isValid() ? this._data[name] : NaN; - }; - } + if (this._monthsParseExact) { + return handleStrictParse.call(this, monthName, format, strict); + } - var milliseconds = makeGetter('milliseconds'), - seconds = makeGetter('seconds'), - minutes = makeGetter('minutes'), - hours = makeGetter('hours'), - days = makeGetter('days'), - months = makeGetter('months'), - years = makeGetter('years'); + if (!this._monthsParse) { + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + } - function weeks() { - return absFloor(this.days() / 7); + // TODO: add sorting + // Sorting makes sure if one month (or abbr) is a prefix of another + // see sorting in computeMonthsParse + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + if (strict && !this._longMonthsParse[i]) { + this._longMonthsParse[i] = new RegExp( + '^' + this.months(mom, '').replace('.', '') + '$', + 'i' + ); + this._shortMonthsParse[i] = new RegExp( + '^' + this.monthsShort(mom, '').replace('.', '') + '$', + 'i' + ); + } + if (!strict && !this._monthsParse[i]) { + regex = + '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); + this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if ( + strict && + format === 'MMMM' && + this._longMonthsParse[i].test(monthName) + ) { + return i; + } else if ( + strict && + format === 'MMM' && + this._shortMonthsParse[i].test(monthName) + ) { + return i; + } else if (!strict && this._monthsParse[i].test(monthName)) { + return i; + } + } } - var round = Math.round, - thresholds = { - ss: 44, // a few seconds to seconds - s: 45, // seconds to minute - m: 45, // minutes to hour - h: 22, // hours to day - d: 26, // days to month/week - w: null, // weeks to month - M: 11, // months to year - }; - - // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize - function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { - return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); - } + // MOMENTS - function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) { - var duration = createDuration(posNegDuration).abs(), - seconds = round(duration.as('s')), - minutes = round(duration.as('m')), - hours = round(duration.as('h')), - days = round(duration.as('d')), - months = round(duration.as('M')), - weeks = round(duration.as('w')), - years = round(duration.as('y')), - a = - (seconds <= thresholds.ss && ['s', seconds]) || - (seconds < thresholds.s && ['ss', seconds]) || - (minutes <= 1 && ['m']) || - (minutes < thresholds.m && ['mm', minutes]) || - (hours <= 1 && ['h']) || - (hours < thresholds.h && ['hh', hours]) || - (days <= 1 && ['d']) || - (days < thresholds.d && ['dd', days]); + function setMonth(mom, value) { + if (!mom.isValid()) { + // No op + return mom; + } - if (thresholds.w != null) { - a = - a || - (weeks <= 1 && ['w']) || - (weeks < thresholds.w && ['ww', weeks]); + if (typeof value === 'string') { + if (/^\d+$/.test(value)) { + value = toInt(value); + } else { + value = mom.localeData().monthsParse(value); + // TODO: Another silent failure? + if (!isNumber(value)) { + return mom; + } + } } - a = a || - (months <= 1 && ['M']) || - (months < thresholds.M && ['MM', months]) || - (years <= 1 && ['y']) || ['yy', years]; - a[2] = withoutSuffix; - a[3] = +posNegDuration > 0; - a[4] = locale; - return substituteTimeAgo.apply(null, a); + var month = value, + date = mom.date(); + + date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month)); + void (mom._isUTC + ? mom._d.setUTCMonth(month, date) + : mom._d.setMonth(month, date)); + return mom; } - // This function allows you to set the rounding function for relative time strings - function getSetRelativeTimeRounding(roundingFunction) { - if (roundingFunction === undefined) { - return round; - } - if (typeof roundingFunction === 'function') { - round = roundingFunction; - return true; + function getSetMonth(value) { + if (value != null) { + setMonth(this, value); + hooks.updateOffset(this, true); + return this; + } else { + return get(this, 'Month'); } - return false; } - // This function allows you to set a threshold for relative time strings - function getSetRelativeTimeThreshold(threshold, limit) { - if (thresholds[threshold] === undefined) { - return false; - } - if (limit === undefined) { - return thresholds[threshold]; - } - thresholds[threshold] = limit; - if (threshold === 's') { - thresholds.ss = limit - 1; - } - return true; + function getDaysInMonth() { + return daysInMonth(this.year(), this.month()); } - function humanize(argWithSuffix, argThresholds) { - if (!this.isValid()) { - return this.localeData().invalidDate(); + function monthsShortRegex(isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsShortStrictRegex; + } else { + return this._monthsShortRegex; + } + } else { + if (!hasOwnProp(this, '_monthsShortRegex')) { + this._monthsShortRegex = defaultMonthsShortRegex; + } + return this._monthsShortStrictRegex && isStrict + ? this._monthsShortStrictRegex + : this._monthsShortRegex; } + } - var withSuffix = false, - th = thresholds, - locale, - output; - - if (typeof argWithSuffix === 'object') { - argThresholds = argWithSuffix; - argWithSuffix = false; - } - if (typeof argWithSuffix === 'boolean') { - withSuffix = argWithSuffix; - } - if (typeof argThresholds === 'object') { - th = Object.assign({}, thresholds, argThresholds); - if (argThresholds.s != null && argThresholds.ss == null) { - th.ss = argThresholds.s - 1; + function monthsRegex(isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsStrictRegex; + } else { + return this._monthsRegex; + } + } else { + if (!hasOwnProp(this, '_monthsRegex')) { + this._monthsRegex = defaultMonthsRegex; } + return this._monthsStrictRegex && isStrict + ? this._monthsStrictRegex + : this._monthsRegex; } + } - locale = this.localeData(); - output = relativeTime$1(this, !withSuffix, th, locale); + function computeMonthsParse() { + function cmpLenRev(a, b) { + return b.length - a.length; + } - if (withSuffix) { - output = locale.pastFuture(+this, output); + var shortPieces = [], + longPieces = [], + mixedPieces = [], + i, + mom, + shortP, + longP; + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + shortP = regexEscape(this.monthsShort(mom, '')); + longP = regexEscape(this.months(mom, '')); + shortPieces.push(shortP); + longPieces.push(longP); + mixedPieces.push(longP); + mixedPieces.push(shortP); } + // Sorting makes sure if one month (or abbr) is a prefix of another it + // will match the longer piece. + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); - return locale.postformat(output); + this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._monthsShortRegex = this._monthsRegex; + this._monthsStrictRegex = new RegExp( + '^(' + longPieces.join('|') + ')', + 'i' + ); + this._monthsShortStrictRegex = new RegExp( + '^(' + shortPieces.join('|') + ')', + 'i' + ); } - var abs$1 = Math.abs; + function createDate(y, m, d, h, M, s, ms) { + // can't just apply() to create a date: + // https://stackoverflow.com/q/181348 + var date; + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + date = new Date(y + 400, m, d, h, M, s, ms); + if (isFinite(date.getFullYear())) { + date.setFullYear(y); + } + } else { + date = new Date(y, m, d, h, M, s, ms); + } - function sign(x) { - return (x > 0) - (x < 0) || +x; + return date; } - function toISOString$1() { - // for ISO strings we do not use the normal bubbling rules: - // * milliseconds bubble up until they become hours - // * days do not bubble at all - // * months bubble up until they become years - // This is because there is no context-free conversion between hours and days - // (think of clock changes) - // and also not between days and months (28-31 days per month) - if (!this.isValid()) { - return this.localeData().invalidDate(); + function createUTCDate(y) { + var date, args; + // the Date.UTC function remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + args = Array.prototype.slice.call(arguments); + // preserve leap years using a full 400 year cycle, then reset + args[0] = y + 400; + date = new Date(Date.UTC.apply(null, args)); + if (isFinite(date.getUTCFullYear())) { + date.setUTCFullYear(y); + } + } else { + date = new Date(Date.UTC.apply(null, arguments)); } - var seconds = abs$1(this._milliseconds) / 1000, - days = abs$1(this._days), - months = abs$1(this._months), - minutes, - hours, - years, - s, - total = this.asSeconds(), - totalSign, - ymSign, - daysSign, - hmsSign; - - if (!total) { - // this is the same as C#'s (Noda) and python (isodate)... - // but not other JS (goog.date) - return 'P0D'; - } + return date; + } - // 3600 seconds -> 60 minutes -> 1 hour - minutes = absFloor(seconds / 60); - hours = absFloor(minutes / 60); - seconds %= 60; - minutes %= 60; + // start-of-first-week - start-of-year + function firstWeekOffset(year, dow, doy) { + var // first-week day -- which january is always in the first week (4 for iso, 1 for other) + fwd = 7 + dow - doy, + // first-week day local weekday -- which local weekday is fwd + fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; + return -fwdlw + fwd - 1; + } - // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js - s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; + // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday + function dayOfYearFromWeeks(year, week, weekday, dow, doy) { + var localWeekday = (7 + weekday - dow) % 7, + weekOffset = firstWeekOffset(year, dow, doy), + dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, + resYear, + resDayOfYear; - totalSign = total < 0 ? '-' : ''; - ymSign = sign(this._months) !== sign(total) ? '-' : ''; - daysSign = sign(this._days) !== sign(total) ? '-' : ''; - hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; + if (dayOfYear <= 0) { + resYear = year - 1; + resDayOfYear = daysInYear(resYear) + dayOfYear; + } else if (dayOfYear > daysInYear(year)) { + resYear = year + 1; + resDayOfYear = dayOfYear - daysInYear(year); + } else { + resYear = year; + resDayOfYear = dayOfYear; + } - return ( - totalSign + - 'P' + - (years ? ymSign + years + 'Y' : '') + - (months ? ymSign + months + 'M' : '') + - (days ? daysSign + days + 'D' : '') + - (hours || minutes || seconds ? 'T' : '') + - (hours ? hmsSign + hours + 'H' : '') + - (minutes ? hmsSign + minutes + 'M' : '') + - (seconds ? hmsSign + s + 'S' : '') - ); + return { + year: resYear, + dayOfYear: resDayOfYear, + }; } - var proto$2 = Duration.prototype; + function weekOfYear(mom, dow, doy) { + var weekOffset = firstWeekOffset(mom.year(), dow, doy), + week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, + resWeek, + resYear; - proto$2.isValid = isValid$1; - proto$2.abs = abs; - proto$2.add = add$1; - proto$2.subtract = subtract$1; - proto$2.as = as; - proto$2.asMilliseconds = asMilliseconds; - proto$2.asSeconds = asSeconds; - proto$2.asMinutes = asMinutes; - proto$2.asHours = asHours; - proto$2.asDays = asDays; - proto$2.asWeeks = asWeeks; - proto$2.asMonths = asMonths; - proto$2.asQuarters = asQuarters; - proto$2.asYears = asYears; - proto$2.valueOf = valueOf$1; - proto$2._bubble = bubble; - proto$2.clone = clone$1; - proto$2.get = get$2; - proto$2.milliseconds = milliseconds; - proto$2.seconds = seconds; - proto$2.minutes = minutes; - proto$2.hours = hours; - proto$2.days = days; - proto$2.weeks = weeks; - proto$2.months = months; - proto$2.years = years; - proto$2.humanize = humanize; - proto$2.toISOString = toISOString$1; - proto$2.toString = toISOString$1; - proto$2.toJSON = toISOString$1; - proto$2.locale = locale; - proto$2.localeData = localeData; + if (week < 1) { + resYear = mom.year() - 1; + resWeek = week + weeksInYear(resYear, dow, doy); + } else if (week > weeksInYear(mom.year(), dow, doy)) { + resWeek = week - weeksInYear(mom.year(), dow, doy); + resYear = mom.year() + 1; + } else { + resYear = mom.year(); + resWeek = week; + } - proto$2.toIsoString = deprecate( - 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', - toISOString$1 - ); - proto$2.lang = lang; + return { + week: resWeek, + year: resYear, + }; + } + + function weeksInYear(year, dow, doy) { + var weekOffset = firstWeekOffset(year, dow, doy), + weekOffsetNext = firstWeekOffset(year + 1, dow, doy); + return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; + } // FORMATTING - addFormatToken('X', 0, 0, 'unix'); - addFormatToken('x', 0, 0, 'valueOf'); + addFormatToken('w', ['ww', 2], 'wo', 'week'); + addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); // PARSING - addRegexToken('x', matchSigned); - addRegexToken('X', matchTimestamp); - addParseToken('X', function (input, array, config) { - config._d = new Date(parseFloat(input) * 1000); - }); - addParseToken('x', function (input, array, config) { - config._d = new Date(toInt(input)); - }); + addRegexToken('w', match1to2, match1to2NoLeadingZero); + addRegexToken('ww', match1to2, match2); + addRegexToken('W', match1to2, match1to2NoLeadingZero); + addRegexToken('WW', match1to2, match2); - //! moment.js + addWeekParseToken( + ['w', 'ww', 'W', 'WW'], + function (input, week, config, token) { + week[token.substr(0, 1)] = toInt(input); + } + ); - hooks.version = '2.29.4'; + // HELPERS - setHookCallback(createLocal); + // LOCALES - hooks.fn = proto; - hooks.min = min; - hooks.max = max; - hooks.now = now; - hooks.utc = createUTC; - hooks.unix = createUnix; - hooks.months = listMonths; - hooks.isDate = isDate; - hooks.locale = getSetGlobalLocale; - hooks.invalid = createInvalid; - hooks.duration = createDuration; - hooks.isMoment = isMoment; - hooks.weekdays = listWeekdays; - hooks.parseZone = createInZone; - hooks.localeData = getLocale; - hooks.isDuration = isDuration; - hooks.monthsShort = listMonthsShort; - hooks.weekdaysMin = listWeekdaysMin; - hooks.defineLocale = defineLocale; - hooks.updateLocale = updateLocale; - hooks.locales = listLocales; - hooks.weekdaysShort = listWeekdaysShort; - hooks.normalizeUnits = normalizeUnits; - hooks.relativeTimeRounding = getSetRelativeTimeRounding; - hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; - hooks.calendarFormat = getCalendarFormat; - hooks.prototype = proto; + function localeWeek(mom) { + return weekOfYear(mom, this._week.dow, this._week.doy).week; + } - // currently HTML5 input type only supports 24-hour formats - hooks.HTML5_FMT = { - DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // - DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // - DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // - DATE: 'YYYY-MM-DD', // - TIME: 'HH:mm', // - TIME_SECONDS: 'HH:mm:ss', // - TIME_MS: 'HH:mm:ss.SSS', // - WEEK: 'GGGG-[W]WW', // - MONTH: 'YYYY-MM', // + var defaultLocaleWeek = { + dow: 0, // Sunday is the first day of the week. + doy: 6, // The week that contains Jan 6th is the first week of the year. }; - return hooks; + function localeFirstDayOfWeek() { + return this._week.dow; + } -}))); + function localeFirstDayOfYear() { + return this._week.doy; + } -; -//! moment.js locale configuration -//! locale : Danish [da] -//! author : Ulrik Nielsen : https://github.com/mrbase + // MOMENTS -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['../moment'], factory) : - factory(global.moment) -}(this, (function (moment) { 'use strict'; + function getSetWeek(input) { + var week = this.localeData().week(this); + return input == null ? week : this.add((input - week) * 7, 'd'); + } - //! moment.js locale configuration + function getSetISOWeek(input) { + var week = weekOfYear(this, 1, 4).week; + return input == null ? week : this.add((input - week) * 7, 'd'); + } - var da = moment.defineLocale('da', { - months: 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split( - '_' - ), - monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort: 'søn_man_tir_ons_tor_fre_lør'.split('_'), - weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY HH:mm', - LLLL: 'dddd [d.] D. MMMM YYYY [kl.] HH:mm', - }, - calendar: { - sameDay: '[i dag kl.] LT', - nextDay: '[i morgen kl.] LT', - nextWeek: 'på dddd [kl.] LT', - lastDay: '[i går kl.] LT', - lastWeek: '[i] dddd[s kl.] LT', - sameElse: 'L', - }, - relativeTime: { - future: 'om %s', - past: '%s siden', - s: 'få sekunder', - ss: '%d sekunder', - m: 'et minut', - mm: '%d minutter', - h: 'en time', - hh: '%d timer', - d: 'en dag', - dd: '%d dage', - M: 'en måned', - MM: '%d måneder', - y: 'et år', - yy: '%d år', - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal: '%d.', - week: { - dow: 1, // Monday is the first day of the week. - doy: 4, // The week that contains Jan 4th is the first week of the year. - }, + // FORMATTING + + addFormatToken('d', 0, 'do', 'day'); + + addFormatToken('dd', 0, 0, function (format) { + return this.localeData().weekdaysMin(this, format); }); - return da; + addFormatToken('ddd', 0, 0, function (format) { + return this.localeData().weekdaysShort(this, format); + }); -}))); + addFormatToken('dddd', 0, 0, function (format) { + return this.localeData().weekdays(this, format); + }); -; -//! moment.js locale configuration -//! locale : German [de] -//! author : lluchs : https://github.com/lluchs -//! author: Menelion Elensúle: https://github.com/Oire -//! author : Mikolaj Dadela : https://github.com/mik01aj + addFormatToken('e', 0, 0, 'weekday'); + addFormatToken('E', 0, 0, 'isoWeekday'); -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['../moment'], factory) : - factory(global.moment) -}(this, (function (moment) { 'use strict'; + // PARSING - //! moment.js locale configuration + addRegexToken('d', match1to2); + addRegexToken('e', match1to2); + addRegexToken('E', match1to2); + addRegexToken('dd', function (isStrict, locale) { + return locale.weekdaysMinRegex(isStrict); + }); + addRegexToken('ddd', function (isStrict, locale) { + return locale.weekdaysShortRegex(isStrict); + }); + addRegexToken('dddd', function (isStrict, locale) { + return locale.weekdaysRegex(isStrict); + }); - function processRelativeTime(number, withoutSuffix, key, isFuture) { - var format = { - m: ['eine Minute', 'einer Minute'], - h: ['eine Stunde', 'einer Stunde'], - d: ['ein Tag', 'einem Tag'], - dd: [number + ' Tage', number + ' Tagen'], - w: ['eine Woche', 'einer Woche'], - M: ['ein Monat', 'einem Monat'], - MM: [number + ' Monate', number + ' Monaten'], - y: ['ein Jahr', 'einem Jahr'], - yy: [number + ' Jahre', number + ' Jahren'], - }; - return withoutSuffix ? format[key][0] : format[key][1]; - } + addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { + var weekday = config._locale.weekdaysParse(input, token, config._strict); + // if we didn't get a weekday name, mark the date as invalid + if (weekday != null) { + week.d = weekday; + } else { + getParsingFlags(config).invalidWeekday = input; + } + }); - var de = moment.defineLocale('de', { - months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split( - '_' - ), - monthsShort: - 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), - monthsParseExact: true, - weekdays: - 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split( - '_' - ), - weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), - weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), - weekdaysParseExact: true, - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY HH:mm', - LLLL: 'dddd, D. MMMM YYYY HH:mm', - }, - calendar: { - sameDay: '[heute um] LT [Uhr]', - sameElse: 'L', - nextDay: '[morgen um] LT [Uhr]', - nextWeek: 'dddd [um] LT [Uhr]', - lastDay: '[gestern um] LT [Uhr]', - lastWeek: '[letzten] dddd [um] LT [Uhr]', - }, - relativeTime: { - future: 'in %s', - past: 'vor %s', - s: 'ein paar Sekunden', - ss: '%d Sekunden', - m: processRelativeTime, - mm: '%d Minuten', - h: processRelativeTime, - hh: '%d Stunden', - d: processRelativeTime, - dd: processRelativeTime, - w: processRelativeTime, - ww: '%d Wochen', - M: processRelativeTime, - MM: processRelativeTime, - y: processRelativeTime, - yy: processRelativeTime, - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal: '%d.', - week: { - dow: 1, // Monday is the first day of the week. - doy: 4, // The week that contains Jan 4th is the first week of the year. - }, + addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { + week[token] = toInt(input); }); - return de; + // HELPERS -}))); + function parseWeekday(input, locale) { + if (typeof input !== 'string') { + return input; + } -; -//! moment.js locale configuration -//! locale : Swedish [sv] -//! author : Jens Alm : https://github.com/ulmus + if (!isNaN(input)) { + return parseInt(input, 10); + } -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['../moment'], factory) : - factory(global.moment) -}(this, (function (moment) { 'use strict'; + input = locale.weekdaysParse(input); + if (typeof input === 'number') { + return input; + } - //! moment.js locale configuration + return null; + } - var sv = moment.defineLocale('sv', { - months: 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split( - '_' - ), - monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), - weekdays: 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), - weekdaysShort: 'sön_mån_tis_ons_tor_fre_lör'.split('_'), - weekdaysMin: 'sö_må_ti_on_to_fr_lö'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'YYYY-MM-DD', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY [kl.] HH:mm', - LLLL: 'dddd D MMMM YYYY [kl.] HH:mm', - lll: 'D MMM YYYY HH:mm', - llll: 'ddd D MMM YYYY HH:mm', - }, - calendar: { - sameDay: '[Idag] LT', - nextDay: '[Imorgon] LT', - lastDay: '[Igår] LT', - nextWeek: '[På] dddd LT', - lastWeek: '[I] dddd[s] LT', - sameElse: 'L', - }, - relativeTime: { - future: 'om %s', - past: 'för %s sedan', - s: 'några sekunder', - ss: '%d sekunder', - m: 'en minut', - mm: '%d minuter', - h: 'en timme', - hh: '%d timmar', - d: 'en dag', - dd: '%d dagar', - M: 'en månad', - MM: '%d månader', - y: 'ett år', - yy: '%d år', - }, - dayOfMonthOrdinalParse: /\d{1,2}(\:e|\:a)/, - ordinal: function (number) { - var b = number % 10, - output = - ~~((number % 100) / 10) === 1 - ? ':e' - : b === 1 - ? ':a' - : b === 2 - ? ':a' - : b === 3 - ? ':e' - : ':e'; - return number + output; - }, - week: { - dow: 1, // Monday is the first day of the week. - doy: 4, // The week that contains Jan 4th is the first week of the year. - }, - }); + function parseIsoWeekday(input, locale) { + if (typeof input === 'string') { + return locale.weekdaysParse(input) % 7 || 7; + } + return isNaN(input) ? null : input; + } - return sv; + // LOCALES + function shiftWeekdays(ws, n) { + return ws.slice(n, 7).concat(ws.slice(0, n)); + } -}))); + var defaultLocaleWeekdays = + 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), + defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'), + defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'), + defaultWeekdaysRegex = matchWord, + defaultWeekdaysShortRegex = matchWord, + defaultWeekdaysMinRegex = matchWord; -; -//! moment.js locale configuration -//! locale : Norwegian Bokmål [nb] -//! authors : Espen Hovlandsdal : https://github.com/rexxars -//! Sigurd Gartmann : https://github.com/sigurdga -//! Stephen Ramthun : https://github.com/stephenramthun + function localeWeekdays(m, format) { + var weekdays = isArray(this._weekdays) + ? this._weekdays + : this._weekdays[ + m && m !== true && this._weekdays.isFormat.test(format) + ? 'format' + : 'standalone' + ]; + return m === true + ? shiftWeekdays(weekdays, this._week.dow) + : m + ? weekdays[m.day()] + : weekdays; + } -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['../moment'], factory) : - factory(global.moment) -}(this, (function (moment) { 'use strict'; + function localeWeekdaysShort(m) { + return m === true + ? shiftWeekdays(this._weekdaysShort, this._week.dow) + : m + ? this._weekdaysShort[m.day()] + : this._weekdaysShort; + } - //! moment.js locale configuration + function localeWeekdaysMin(m) { + return m === true + ? shiftWeekdays(this._weekdaysMin, this._week.dow) + : m + ? this._weekdaysMin[m.day()] + : this._weekdaysMin; + } - var nb = moment.defineLocale('nb', { - months: 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split( - '_' - ), - monthsShort: - 'jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.'.split('_'), - monthsParseExact: true, - weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), - weekdaysShort: 'sø._ma._ti._on._to._fr._lø.'.split('_'), - weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'), - weekdaysParseExact: true, - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD.MM.YYYY', - LL: 'D. MMMM YYYY', - LLL: 'D. MMMM YYYY [kl.] HH:mm', - LLLL: 'dddd D. MMMM YYYY [kl.] HH:mm', - }, - calendar: { - sameDay: '[i dag kl.] LT', - nextDay: '[i morgen kl.] LT', - nextWeek: 'dddd [kl.] LT', - lastDay: '[i går kl.] LT', - lastWeek: '[forrige] dddd [kl.] LT', - sameElse: 'L', - }, - relativeTime: { - future: 'om %s', - past: '%s siden', - s: 'noen sekunder', - ss: '%d sekunder', - m: 'ett minutt', - mm: '%d minutter', - h: 'en time', - hh: '%d timer', - d: 'en dag', - dd: '%d dager', - w: 'en uke', - ww: '%d uker', - M: 'en måned', - MM: '%d måneder', - y: 'ett år', - yy: '%d år', - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal: '%d.', - week: { - dow: 1, // Monday is the first day of the week. - doy: 4, // The week that contains Jan 4th is the first week of the year. - }, - }); - - return nb; + function handleStrictParse$1(weekdayName, format, strict) { + var i, + ii, + mom, + llc = weekdayName.toLocaleLowerCase(); + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._shortWeekdaysParse = []; + this._minWeekdaysParse = []; -}))); + for (i = 0; i < 7; ++i) { + mom = createUTC([2000, 1]).day(i); + this._minWeekdaysParse[i] = this.weekdaysMin( + mom, + '' + ).toLocaleLowerCase(); + this._shortWeekdaysParse[i] = this.weekdaysShort( + mom, + '' + ).toLocaleLowerCase(); + this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); + } + } -; -//! moment.js locale configuration -//! locale : Faroese [fo] -//! author : Ragnar Johannesen : https://github.com/ragnar123 -//! author : Kristian Sakarisson : https://github.com/sakarisson + if (strict) { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } + } -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' - && typeof require === 'function' ? factory(require('../moment')) : - typeof define === 'function' && define.amd ? define(['../moment'], factory) : - factory(global.moment) -}(this, (function (moment) { 'use strict'; + function localeWeekdaysParse(weekdayName, format, strict) { + var i, mom, regex; - //! moment.js locale configuration + if (this._weekdaysParseExact) { + return handleStrictParse$1.call(this, weekdayName, format, strict); + } - var fo = moment.defineLocale('fo', { - months: 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split( - '_' - ), - monthsShort: 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), - weekdays: - 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split( - '_' - ), - weekdaysShort: 'sun_mán_týs_mik_hós_frí_ley'.split('_'), - weekdaysMin: 'su_má_tý_mi_hó_fr_le'.split('_'), - longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', - LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd D. MMMM, YYYY HH:mm', - }, - calendar: { - sameDay: '[Í dag kl.] LT', - nextDay: '[Í morgin kl.] LT', - nextWeek: 'dddd [kl.] LT', - lastDay: '[Í gjár kl.] LT', - lastWeek: '[síðstu] dddd [kl] LT', - sameElse: 'L', - }, - relativeTime: { - future: 'um %s', - past: '%s síðani', - s: 'fá sekund', - ss: '%d sekundir', - m: 'ein minuttur', - mm: '%d minuttir', - h: 'ein tími', - hh: '%d tímar', - d: 'ein dagur', - dd: '%d dagar', - M: 'ein mánaður', - MM: '%d mánaðir', - y: 'eitt ár', - yy: '%d ár', - }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal: '%d.', - week: { - dow: 1, // Monday is the first day of the week. - doy: 4, // The week that contains Jan 4th is the first week of the year. - }, - }); + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._minWeekdaysParse = []; + this._shortWeekdaysParse = []; + this._fullWeekdaysParse = []; + } - return fo; + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already -}))); + mom = createUTC([2000, 1]).day(i); + if (strict && !this._fullWeekdaysParse[i]) { + this._fullWeekdaysParse[i] = new RegExp( + '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + this._shortWeekdaysParse[i] = new RegExp( + '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + this._minWeekdaysParse[i] = new RegExp( + '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', + 'i' + ); + } + if (!this._weekdaysParse[i]) { + regex = + '^' + + this.weekdays(mom, '') + + '|^' + + this.weekdaysShort(mom, '') + + '|^' + + this.weekdaysMin(mom, ''); + this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); + } + // test the regex + if ( + strict && + format === 'dddd' && + this._fullWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if ( + strict && + format === 'ddd' && + this._shortWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if ( + strict && + format === 'dd' && + this._minWeekdaysParse[i].test(weekdayName) + ) { + return i; + } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { + return i; + } + } + } -; -(function() { + // MOMENTS - var moment = (typeof require !== "undefined" && require !== null) && !require.amd ? require("moment") : this.moment; + function getSetDayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } - moment.fn.round = function(precision, key, direction) { - if(typeof direction === 'undefined') { - direction = 'round'; + var day = get(this, 'Day'); + if (input != null) { + input = parseWeekday(input, this.localeData()); + return this.add(input - day, 'd'); + } else { + return day; + } } - var keys = ['Hours', 'Minutes', 'Seconds', 'Milliseconds']; - var maxValues = [24, 60, 60, 1000]; - - // Capitalize first letter - key = key.charAt(0).toUpperCase() + key.slice(1).toLowerCase(); - - // make sure key is plural - if (key.indexOf('s', key.length - 1) === -1) { - key += 's'; + function getSetLocaleDayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; + return input == null ? weekday : this.add(input - weekday, 'd'); } - var value = 0; - var rounded = false; - var subRatio = 1; - var maxValue ; - for (var i in keys) { - var k = keys[i]; - if (k === key) { - value = this._d['get' + key](); - maxValue = maxValues[i]; - rounded = true; - } else if(rounded) { - subRatio *= maxValues[i]; - value += this._d['get' + k]() / subRatio; - this._d['set' + k](0); - } - }; - - value = Math[direction](value / precision) * precision; - value = Math.min(value, maxValue); - this._d['set' + key](value); - - return this; - } - - moment.fn.ceil = function(precision, key) { - return this.round(precision, key, 'ceil'); - } - moment.fn.floor = function(precision, key) { - return this.round(precision, key, 'floor'); - } + function getSetISODayOfWeek(input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } - if ((typeof module !== "undefined" && module !== null ? module.exports : void 0) != null) { - module.exports = moment; - } -}).call(this); -; -/* @preserve - * The MIT License (MIT) - * - * Copyright (c) 2013-2018 Petka Antonov - * - * 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. - * - */ -/** - * bluebird build version 3.7.2 - * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each -*/ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o 0) { - _drainQueueStep(queue); + function meridiem(token, lowercase) { + addFormatToken(token, 0, 0, function () { + return this.localeData().meridiem( + this.hours(), + this.minutes(), + lowercase + ); + }); } -} -function _drainQueueStep(queue) { - var fn = queue.shift(); - if (typeof fn !== "function") { - fn._settlePromises(); - } else { - var receiver = queue.shift(); - var arg = queue.shift(); - fn.call(receiver, arg); - } -} + meridiem('a', true); + meridiem('A', false); -Async.prototype._drainQueues = function () { - _drainQueue(this._normalQueue); - this._reset(); - this._haveDrainedQueues = true; - _drainQueue(this._lateQueue); -}; + // PARSING -Async.prototype._queueTick = function () { - if (!this._isTickUsed) { - this._isTickUsed = true; - this._schedule(this.drainQueues); + function matchMeridiem(isStrict, locale) { + return locale._meridiemParse; } -}; -Async.prototype._reset = function () { - this._isTickUsed = false; -}; + addRegexToken('a', matchMeridiem); + addRegexToken('A', matchMeridiem); + addRegexToken('H', match1to2, match1to2HasZero); + addRegexToken('h', match1to2, match1to2NoLeadingZero); + addRegexToken('k', match1to2, match1to2NoLeadingZero); + addRegexToken('HH', match1to2, match2); + addRegexToken('hh', match1to2, match2); + addRegexToken('kk', match1to2, match2); -module.exports = Async; -module.exports.firstLineError = firstLineError; + addRegexToken('hmm', match3to4); + addRegexToken('hmmss', match5to6); + addRegexToken('Hmm', match3to4); + addRegexToken('Hmmss', match5to6); -},{"./queue":26,"./schedule":29}],3:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) { -var calledBind = false; -var rejectThis = function(_, e) { - this._reject(e); -}; + addParseToken(['H', 'HH'], HOUR); + addParseToken(['k', 'kk'], function (input, array, config) { + var kInput = toInt(input); + array[HOUR] = kInput === 24 ? 0 : kInput; + }); + addParseToken(['a', 'A'], function (input, array, config) { + config._isPm = config._locale.isPM(input); + config._meridiem = input; + }); + addParseToken(['h', 'hh'], function (input, array, config) { + array[HOUR] = toInt(input); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('hmmss', function (input, array, config) { + var pos1 = input.length - 4, + pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + getParsingFlags(config).bigHour = true; + }); + addParseToken('Hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + }); + addParseToken('Hmmss', function (input, array, config) { + var pos1 = input.length - 4, + pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + }); -var targetRejected = function(e, context) { - context.promiseRejectionQueued = true; - context.bindingPromise._then(rejectThis, rejectThis, null, this, e); -}; + // LOCALES -var bindingResolved = function(thisArg, context) { - if (((this._bitField & 50397184) === 0)) { - this._resolveCallback(context.target); + function localeIsPM(input) { + // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays + // Using charAt should be more compatible. + return (input + '').toLowerCase().charAt(0) === 'p'; } -}; - -var bindingRejected = function(e, context) { - if (!context.promiseRejectionQueued) this._reject(e); -}; -Promise.prototype.bind = function (thisArg) { - if (!calledBind) { - calledBind = true; - Promise.prototype._propagateFrom = debug.propagateFromFunction(); - Promise.prototype._boundValue = debug.boundValueFunction(); - } - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - ret._propagateFrom(this, 1); - var target = this._target(); - ret._setBoundTo(maybePromise); - if (maybePromise instanceof Promise) { - var context = { - promiseRejectionQueued: false, - promise: ret, - target: target, - bindingPromise: maybePromise - }; - target._then(INTERNAL, targetRejected, undefined, ret, context); - maybePromise._then( - bindingResolved, bindingRejected, undefined, ret, context); - ret._setOnCancel(maybePromise); - } else { - ret._resolveCallback(target); - } - return ret; -}; + var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, + // Setting the hour should keep the time, because the user explicitly + // specified which hour they want. So trying to maintain the same hour (in + // a new timezone) makes sense. Adding/subtracting hours does not follow + // this rule. + getSetHour = makeGetSet('Hours', true); -Promise.prototype._setBoundTo = function (obj) { - if (obj !== undefined) { - this._bitField = this._bitField | 2097152; - this._boundTo = obj; - } else { - this._bitField = this._bitField & (~2097152); + function localeMeridiem(hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'pm' : 'PM'; + } else { + return isLower ? 'am' : 'AM'; + } } -}; -Promise.prototype._isBound = function () { - return (this._bitField & 2097152) === 2097152; -}; - -Promise.bind = function (thisArg, value) { - return Promise.resolve(value).bind(thisArg); -}; -}; + var baseConfig = { + calendar: defaultCalendar, + longDateFormat: defaultLongDateFormat, + invalidDate: defaultInvalidDate, + ordinal: defaultOrdinal, + dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, + relativeTime: defaultRelativeTime, -},{}],4:[function(_dereq_,module,exports){ -"use strict"; -var old; -if (typeof Promise !== "undefined") old = Promise; -function noConflict() { - try { if (Promise === bluebird) Promise = old; } - catch (e) {} - return bluebird; -} -var bluebird = _dereq_("./promise")(); -bluebird.noConflict = noConflict; -module.exports = bluebird; + months: defaultLocaleMonths, + monthsShort: defaultLocaleMonthsShort, -},{"./promise":22}],5:[function(_dereq_,module,exports){ -"use strict"; -var cr = Object.create; -if (cr) { - var callerCache = cr(null); - var getterCache = cr(null); - callerCache[" size"] = getterCache[" size"] = 0; -} + week: defaultLocaleWeek, -module.exports = function(Promise) { -var util = _dereq_("./util"); -var canEvaluate = util.canEvaluate; -var isIdentifier = util.isIdentifier; + weekdays: defaultLocaleWeekdays, + weekdaysMin: defaultLocaleWeekdaysMin, + weekdaysShort: defaultLocaleWeekdaysShort, -var getMethodCaller; -var getGetter; -if (!true) { -var makeMethodCaller = function (methodName) { - return new Function("ensureMethod", " \n\ - return function(obj) { \n\ - 'use strict' \n\ - var len = this.length; \n\ - ensureMethod(obj, 'methodName'); \n\ - switch(len) { \n\ - case 1: return obj.methodName(this[0]); \n\ - case 2: return obj.methodName(this[0], this[1]); \n\ - case 3: return obj.methodName(this[0], this[1], this[2]); \n\ - case 0: return obj.methodName(); \n\ - default: \n\ - return obj.methodName.apply(obj, this); \n\ - } \n\ - }; \n\ - ".replace(/methodName/g, methodName))(ensureMethod); -}; + meridiemParse: defaultLocaleMeridiemParse, + }; -var makeGetter = function (propertyName) { - return new Function("obj", " \n\ - 'use strict'; \n\ - return obj.propertyName; \n\ - ".replace("propertyName", propertyName)); -}; + // internal storage for locale config files + var locales = {}, + localeFamilies = {}, + globalLocale; -var getCompiled = function(name, compiler, cache) { - var ret = cache[name]; - if (typeof ret !== "function") { - if (!isIdentifier(name)) { - return null; - } - ret = compiler(name); - cache[name] = ret; - cache[" size"]++; - if (cache[" size"] > 512) { - var keys = Object.keys(cache); - for (var i = 0; i < 256; ++i) delete cache[keys[i]]; - cache[" size"] = keys.length - 256; + function commonPrefix(arr1, arr2) { + var i, + minl = Math.min(arr1.length, arr2.length); + for (i = 0; i < minl; i += 1) { + if (arr1[i] !== arr2[i]) { + return i; + } } + return minl; } - return ret; -}; - -getMethodCaller = function(name) { - return getCompiled(name, makeMethodCaller, callerCache); -}; -getGetter = function(name) { - return getCompiled(name, makeGetter, getterCache); -}; -} - -function ensureMethod(obj, methodName) { - var fn; - if (obj != null) fn = obj[methodName]; - if (typeof fn !== "function") { - var message = "Object " + util.classString(obj) + " has no method '" + - util.toString(methodName) + "'"; - throw new Promise.TypeError(message); + function normalizeLocale(key) { + return key ? key.toLowerCase().replace('_', '-') : key; } - return fn; -} -function caller(obj) { - var methodName = this.pop(); - var fn = ensureMethod(obj, methodName); - return fn.apply(obj, this); -} -Promise.prototype.call = function (methodName) { - var args = [].slice.call(arguments, 1);; - if (!true) { - if (canEvaluate) { - var maybeCaller = getMethodCaller(methodName); - if (maybeCaller !== null) { - return this._then( - maybeCaller, undefined, undefined, args, undefined); + // pick the locale from the array + // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each + // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root + function chooseLocale(names) { + var i = 0, + j, + next, + locale, + split; + + while (i < names.length) { + split = normalizeLocale(names[i]).split('-'); + j = split.length; + next = normalizeLocale(names[i + 1]); + next = next ? next.split('-') : null; + while (j > 0) { + locale = loadLocale(split.slice(0, j).join('-')); + if (locale) { + return locale; + } + if ( + next && + next.length >= j && + commonPrefix(split, next) >= j - 1 + ) { + //the next array item is better than a shallower substring of this one + break; + } + j--; } + i++; } + return globalLocale; } - args.push(methodName); - return this._then(caller, undefined, undefined, args, undefined); -}; -function namedGetter(obj) { - return obj[this]; -} -function indexedGetter(obj) { - var index = +this; - if (index < 0) index = Math.max(0, index + obj.length); - return obj[index]; -} -Promise.prototype.get = function (propertyName) { - var isIndex = (typeof propertyName === "number"); - var getter; - if (!isIndex) { - if (canEvaluate) { - var maybeGetter = getGetter(propertyName); - getter = maybeGetter !== null ? maybeGetter : namedGetter; - } else { - getter = namedGetter; - } - } else { - getter = indexedGetter; + function isLocaleNameSane(name) { + // Prevent names that look like filesystem paths, i.e contain '/' or '\' + // Ensure name is available and function returns boolean + return !!(name && name.match('^[^/\\\\]*$')); } - return this._then(getter, undefined, undefined, propertyName, undefined); -}; -}; -},{"./util":36}],6:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, PromiseArray, apiRejection, debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var async = Promise._async; - -Promise.prototype["break"] = Promise.prototype.cancel = function() { - if (!debug.cancellation()) return this._warn("cancellation is disabled"); - - var promise = this; - var child = promise; - while (promise._isCancellable()) { - if (!promise._cancelBy(child)) { - if (child._isFollowing()) { - child._followee().cancel(); - } else { - child._cancelBranched(); + function loadLocale(name) { + var oldLocale = null, + aliasedRequire; + // TODO: Find a better way to register and load all the locales in Node + if ( + locales[name] === undefined && + typeof module !== 'undefined' && + module && + module.exports && + isLocaleNameSane(name) + ) { + try { + oldLocale = globalLocale._abbr; + aliasedRequire = require; + aliasedRequire('./locale/' + name); + getSetGlobalLocale(oldLocale); + } catch (e) { + // mark as not found to avoid repeating expensive file require call causing high CPU + // when trying to find en-US, en_US, en-us for every format call + locales[name] = null; // null means not found } - break; } + return locales[name]; + } - var parent = promise._cancellationParent; - if (parent == null || !parent._isCancellable()) { - if (promise._isFollowing()) { - promise._followee().cancel(); + // This function will load locale and then set the global locale. If + // no arguments are passed in, it will simply return the current global + // locale key. + function getSetGlobalLocale(key, values) { + var data; + if (key) { + if (isUndefined(values)) { + data = getLocale(key); } else { - promise._cancelBranched(); + data = defineLocale(key, values); } - break; - } else { - if (promise._isFollowing()) promise._followee().cancel(); - promise._setWillBeCancelled(); - child = promise; - promise = parent; - } - } -}; - -Promise.prototype._branchHasCancelled = function() { - this._branchesRemainingToCancel--; -}; - -Promise.prototype._enoughBranchesHaveCancelled = function() { - return this._branchesRemainingToCancel === undefined || - this._branchesRemainingToCancel <= 0; -}; -Promise.prototype._cancelBy = function(canceller) { - if (canceller === this) { - this._branchesRemainingToCancel = 0; - this._invokeOnCancel(); - return true; - } else { - this._branchHasCancelled(); - if (this._enoughBranchesHaveCancelled()) { - this._invokeOnCancel(); - return true; + if (data) { + // moment.duration._locale = moment._locale = data; + globalLocale = data; + } else { + if (typeof console !== 'undefined' && console.warn) { + //warn user if arguments are passed but the locale could not be set + console.warn( + 'Locale ' + key + ' not found. Did you forget to load it?' + ); + } + } } - } - return false; -}; -Promise.prototype._cancelBranched = function() { - if (this._enoughBranchesHaveCancelled()) { - this._cancel(); + return globalLocale._abbr; } -}; - -Promise.prototype._cancel = function() { - if (!this._isCancellable()) return; - this._setCancelled(); - async.invoke(this._cancelPromises, this, undefined); -}; -Promise.prototype._cancelPromises = function() { - if (this._length() > 0) this._settlePromises(); -}; - -Promise.prototype._unsetOnCancel = function() { - this._onCancelField = undefined; -}; + function defineLocale(name, config) { + if (config !== null) { + var locale, + parentConfig = baseConfig; + config.abbr = name; + if (locales[name] != null) { + deprecateSimple( + 'defineLocaleOverride', + 'use moment.updateLocale(localeName, config) to change ' + + 'an existing locale. moment.defineLocale(localeName, ' + + 'config) should only be used for creating a new locale ' + + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.' + ); + parentConfig = locales[name]._config; + } else if (config.parentLocale != null) { + if (locales[config.parentLocale] != null) { + parentConfig = locales[config.parentLocale]._config; + } else { + locale = loadLocale(config.parentLocale); + if (locale != null) { + parentConfig = locale._config; + } else { + if (!localeFamilies[config.parentLocale]) { + localeFamilies[config.parentLocale] = []; + } + localeFamilies[config.parentLocale].push({ + name: name, + config: config, + }); + return null; + } + } + } + locales[name] = new Locale(mergeConfigs(parentConfig, config)); -Promise.prototype._isCancellable = function() { - return this.isPending() && !this._isCancelled(); -}; + if (localeFamilies[name]) { + localeFamilies[name].forEach(function (x) { + defineLocale(x.name, x.config); + }); + } -Promise.prototype.isCancellable = function() { - return this.isPending() && !this.isCancelled(); -}; + // backwards compat for now: also set the locale + // make sure we set the locale AFTER all child locales have been + // created, so we won't end up with the child locale set. + getSetGlobalLocale(name); -Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) { - if (util.isArray(onCancelCallback)) { - for (var i = 0; i < onCancelCallback.length; ++i) { - this._doInvokeOnCancel(onCancelCallback[i], internalOnly); - } - } else if (onCancelCallback !== undefined) { - if (typeof onCancelCallback === "function") { - if (!internalOnly) { - var e = tryCatch(onCancelCallback).call(this._boundValue()); - if (e === errorObj) { - this._attachExtraTrace(e.e); - async.throwLater(e.e); - } - } + return locales[name]; } else { - onCancelCallback._resultCancelled(this); + // useful for testing + delete locales[name]; + return null; } } -}; - -Promise.prototype._invokeOnCancel = function() { - var onCancelCallback = this._onCancel(); - this._unsetOnCancel(); - async.invoke(this._doInvokeOnCancel, this, onCancelCallback); -}; - -Promise.prototype._invokeInternalOnCancel = function() { - if (this._isCancellable()) { - this._doInvokeOnCancel(this._onCancel(), true); - this._unsetOnCancel(); - } -}; - -Promise.prototype._resultCancelled = function() { - this.cancel(); -}; - -}; - -},{"./util":36}],7:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(NEXT_FILTER) { -var util = _dereq_("./util"); -var getKeys = _dereq_("./es5").keys; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -function catchFilter(instances, cb, promise) { - return function(e) { - var boundTo = promise._boundValue(); - predicateLoop: for (var i = 0; i < instances.length; ++i) { - var item = instances[i]; + function updateLocale(name, config) { + if (config != null) { + var locale, + tmpLocale, + parentConfig = baseConfig; - if (item === Error || - (item != null && item.prototype instanceof Error)) { - if (e instanceof item) { - return tryCatch(cb).call(boundTo, e); + if (locales[name] != null && locales[name].parentLocale != null) { + // Update existing child locale in-place to avoid memory-leaks + locales[name].set(mergeConfigs(locales[name]._config, config)); + } else { + // MERGE + tmpLocale = loadLocale(name); + if (tmpLocale != null) { + parentConfig = tmpLocale._config; } - } else if (typeof item === "function") { - var matchesPredicate = tryCatch(item).call(boundTo, e); - if (matchesPredicate === errorObj) { - return matchesPredicate; - } else if (matchesPredicate) { - return tryCatch(cb).call(boundTo, e); + config = mergeConfigs(parentConfig, config); + if (tmpLocale == null) { + // updateLocale is called for creating a new locale + // Set abbr so it will have a name (getters return + // undefined otherwise). + config.abbr = name; } - } else if (util.isObject(e)) { - var keys = getKeys(item); - for (var j = 0; j < keys.length; ++j) { - var key = keys[j]; - if (item[key] != e[key]) { - continue predicateLoop; + locale = new Locale(config); + locale.parentLocale = locales[name]; + locales[name] = locale; + } + + // backwards compat for now: also set the locale + getSetGlobalLocale(name); + } else { + // pass null for config to unupdate, useful for tests + if (locales[name] != null) { + if (locales[name].parentLocale != null) { + locales[name] = locales[name].parentLocale; + if (name === getSetGlobalLocale()) { + getSetGlobalLocale(name); } + } else if (locales[name] != null) { + delete locales[name]; } - return tryCatch(cb).call(boundTo, e); } } - return NEXT_FILTER; - }; -} + return locales[name]; + } -return catchFilter; -}; + // returns locale data + function getLocale(key) { + var locale; -},{"./es5":13,"./util":36}],8:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -var longStackTraces = false; -var contextStack = []; + if (key && key._locale && key._locale._abbr) { + key = key._locale._abbr; + } -Promise.prototype._promiseCreated = function() {}; -Promise.prototype._pushContext = function() {}; -Promise.prototype._popContext = function() {return null;}; -Promise._peekContext = Promise.prototype._peekContext = function() {}; + if (!key) { + return globalLocale; + } -function Context() { - this._trace = new Context.CapturedTrace(peekContext()); -} -Context.prototype._pushContext = function () { - if (this._trace !== undefined) { - this._trace._promiseCreated = null; - contextStack.push(this._trace); - } -}; + if (!isArray(key)) { + //short-circuit everything else + locale = loadLocale(key); + if (locale) { + return locale; + } + key = [key]; + } -Context.prototype._popContext = function () { - if (this._trace !== undefined) { - var trace = contextStack.pop(); - var ret = trace._promiseCreated; - trace._promiseCreated = null; - return ret; + return chooseLocale(key); } - return null; -}; -function createContext() { - if (longStackTraces) return new Context(); -} - -function peekContext() { - var lastIndex = contextStack.length - 1; - if (lastIndex >= 0) { - return contextStack[lastIndex]; + function listLocales() { + return keys(locales); } - return undefined; -} -Context.CapturedTrace = null; -Context.create = createContext; -Context.deactivateLongStackTraces = function() {}; -Context.activateLongStackTraces = function() { - var Promise_pushContext = Promise.prototype._pushContext; - var Promise_popContext = Promise.prototype._popContext; - var Promise_PeekContext = Promise._peekContext; - var Promise_peekContext = Promise.prototype._peekContext; - var Promise_promiseCreated = Promise.prototype._promiseCreated; - Context.deactivateLongStackTraces = function() { - Promise.prototype._pushContext = Promise_pushContext; - Promise.prototype._popContext = Promise_popContext; - Promise._peekContext = Promise_PeekContext; - Promise.prototype._peekContext = Promise_peekContext; - Promise.prototype._promiseCreated = Promise_promiseCreated; - longStackTraces = false; - }; - longStackTraces = true; - Promise.prototype._pushContext = Context.prototype._pushContext; - Promise.prototype._popContext = Context.prototype._popContext; - Promise._peekContext = Promise.prototype._peekContext = peekContext; - Promise.prototype._promiseCreated = function() { - var ctx = this._peekContext(); - if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this; - }; -}; -return Context; -}; - -},{}],9:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, Context, - enableAsyncHooks, disableAsyncHooks) { -var async = Promise._async; -var Warning = _dereq_("./errors").Warning; -var util = _dereq_("./util"); -var es5 = _dereq_("./es5"); -var canAttachTrace = util.canAttachTrace; -var unhandledRejectionHandled; -var possiblyUnhandledRejection; -var bluebirdFramePattern = - /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/; -var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/; -var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/; -var stackFramePattern = null; -var formatStack = null; -var indentStackFrames = false; -var printWarning; -var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && - (true || - util.env("BLUEBIRD_DEBUG") || - util.env("NODE_ENV") === "development")); -var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && - (debugging || util.env("BLUEBIRD_WARNINGS"))); - -var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && - (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES"))); + function checkOverflow(m) { + var overflow, + a = m._a; -var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && - (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); + if (a && getParsingFlags(m).overflow === -2) { + overflow = + a[MONTH] < 0 || a[MONTH] > 11 + ? MONTH + : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) + ? DATE + : a[HOUR] < 0 || + a[HOUR] > 24 || + (a[HOUR] === 24 && + (a[MINUTE] !== 0 || + a[SECOND] !== 0 || + a[MILLISECOND] !== 0)) + ? HOUR + : a[MINUTE] < 0 || a[MINUTE] > 59 + ? MINUTE + : a[SECOND] < 0 || a[SECOND] > 59 + ? SECOND + : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 + ? MILLISECOND + : -1; -var deferUnhandledRejectionCheck; -(function() { - var promises = []; + if ( + getParsingFlags(m)._overflowDayOfYear && + (overflow < YEAR || overflow > DATE) + ) { + overflow = DATE; + } + if (getParsingFlags(m)._overflowWeeks && overflow === -1) { + overflow = WEEK; + } + if (getParsingFlags(m)._overflowWeekday && overflow === -1) { + overflow = WEEKDAY; + } - function unhandledRejectionCheck() { - for (var i = 0; i < promises.length; ++i) { - promises[i]._notifyUnhandledRejection(); + getParsingFlags(m).overflow = overflow; } - unhandledRejectionClear(); - } - function unhandledRejectionClear() { - promises.length = 0; + return m; } - deferUnhandledRejectionCheck = function(promise) { - promises.push(promise); - setTimeout(unhandledRejectionCheck, 1); - }; - - es5.defineProperty(Promise, "_unhandledRejectionCheck", { - value: unhandledRejectionCheck - }); - es5.defineProperty(Promise, "_unhandledRejectionClear", { - value: unhandledRejectionClear - }); -})(); - -Promise.prototype.suppressUnhandledRejections = function() { - var target = this._target(); - target._bitField = ((target._bitField & (~1048576)) | - 524288); -}; - -Promise.prototype._ensurePossibleRejectionHandled = function () { - if ((this._bitField & 524288) !== 0) return; - this._setRejectionIsUnhandled(); - deferUnhandledRejectionCheck(this); -}; - -Promise.prototype._notifyUnhandledRejectionIsHandled = function () { - fireRejectionEvent("rejectionHandled", - unhandledRejectionHandled, undefined, this); -}; - -Promise.prototype._setReturnedNonUndefined = function() { - this._bitField = this._bitField | 268435456; -}; + // iso 8601 regex + // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) + var extendedIsoRegex = + /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + basicIsoRegex = + /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, + tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, + isoDates = [ + ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], + ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], + ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], + ['GGGG-[W]WW', /\d{4}-W\d\d/, false], + ['YYYY-DDD', /\d{4}-\d{3}/], + ['YYYY-MM', /\d{4}-\d\d/, false], + ['YYYYYYMMDD', /[+-]\d{10}/], + ['YYYYMMDD', /\d{8}/], + ['GGGG[W]WWE', /\d{4}W\d{3}/], + ['GGGG[W]WW', /\d{4}W\d{2}/, false], + ['YYYYDDD', /\d{7}/], + ['YYYYMM', /\d{6}/, false], + ['YYYY', /\d{4}/, false], + ], + // iso time formats and regexes + isoTimes = [ + ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], + ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], + ['HH:mm:ss', /\d\d:\d\d:\d\d/], + ['HH:mm', /\d\d:\d\d/], + ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], + ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], + ['HHmmss', /\d\d\d\d\d\d/], + ['HHmm', /\d\d\d\d/], + ['HH', /\d\d/], + ], + aspNetJsonRegex = /^\/?Date\((-?\d+)/i, + // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 + 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{4}))$/, + obsOffsets = { + UT: 0, + 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, + }; -Promise.prototype._returnedNonUndefined = function() { - return (this._bitField & 268435456) !== 0; -}; + // date from iso format + function configFromISO(config) { + var i, + l, + string = config._i, + match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), + allowTime, + dateFormat, + timeFormat, + tzFormat, + isoDatesLen = isoDates.length, + isoTimesLen = isoTimes.length; -Promise.prototype._notifyUnhandledRejection = function () { - if (this._isRejectionUnhandled()) { - var reason = this._settledValue(); - this._setUnhandledRejectionIsNotified(); - fireRejectionEvent("unhandledRejection", - possiblyUnhandledRejection, reason, this); + if (match) { + getParsingFlags(config).iso = true; + for (i = 0, l = isoDatesLen; i < l; i++) { + if (isoDates[i][1].exec(match[1])) { + dateFormat = isoDates[i][0]; + allowTime = isoDates[i][2] !== false; + break; + } + } + if (dateFormat == null) { + config._isValid = false; + return; + } + if (match[3]) { + for (i = 0, l = isoTimesLen; i < l; i++) { + if (isoTimes[i][1].exec(match[3])) { + // match[2] should be 'T' or space + timeFormat = (match[2] || ' ') + isoTimes[i][0]; + break; + } + } + if (timeFormat == null) { + config._isValid = false; + return; + } + } + if (!allowTime && timeFormat != null) { + config._isValid = false; + return; + } + if (match[4]) { + if (tzRegex.exec(match[4])) { + tzFormat = 'Z'; + } else { + config._isValid = false; + return; + } + } + config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); + configFromStringAndFormat(config); + } else { + config._isValid = false; + } } -}; - -Promise.prototype._setUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField | 262144; -}; - -Promise.prototype._unsetUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField & (~262144); -}; -Promise.prototype._isUnhandledRejectionNotified = function () { - return (this._bitField & 262144) > 0; -}; + function extractFromRFC2822Strings( + yearStr, + monthStr, + dayStr, + hourStr, + minuteStr, + secondStr + ) { + var result = [ + untruncateYear(yearStr), + defaultLocaleMonthsShort.indexOf(monthStr), + parseInt(dayStr, 10), + parseInt(hourStr, 10), + parseInt(minuteStr, 10), + ]; -Promise.prototype._setRejectionIsUnhandled = function () { - this._bitField = this._bitField | 1048576; -}; + if (secondStr) { + result.push(parseInt(secondStr, 10)); + } -Promise.prototype._unsetRejectionIsUnhandled = function () { - this._bitField = this._bitField & (~1048576); - if (this._isUnhandledRejectionNotified()) { - this._unsetUnhandledRejectionIsNotified(); - this._notifyUnhandledRejectionIsHandled(); + return result; } -}; - -Promise.prototype._isRejectionUnhandled = function () { - return (this._bitField & 1048576) > 0; -}; -Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { - return warn(message, shouldUseOwnTrace, promise || this); -}; + function untruncateYear(yearStr) { + var year = parseInt(yearStr, 10); + if (year <= 49) { + return 2000 + year; + } else if (year <= 999) { + return 1900 + year; + } + return year; + } -Promise.onPossiblyUnhandledRejection = function (fn) { - var context = Promise._getContext(); - possiblyUnhandledRejection = util.contextBind(context, fn); -}; + 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, ' ') + .replace(/^\s\s*/, '') + .replace(/\s\s*$/, ''); + } -Promise.onUnhandledRejectionHandled = function (fn) { - var context = Promise._getContext(); - unhandledRejectionHandled = util.contextBind(context, fn); -}; + function checkWeekday(weekdayStr, parsedInput, config) { + if (weekdayStr) { + // TODO: Replace the vanilla JS Date object with an independent day-of-week check. + var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), + weekdayActual = new Date( + parsedInput[0], + parsedInput[1], + parsedInput[2] + ).getDay(); + if (weekdayProvided !== weekdayActual) { + getParsingFlags(config).weekdayMismatch = true; + config._isValid = false; + return false; + } + } + return true; + } -var disableLongStackTraces = function() {}; -Promise.longStackTraces = function () { - if (async.haveItemsQueued() && !config.longStackTraces) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + function calculateOffset(obsOffset, militaryOffset, numOffset) { + if (obsOffset) { + return obsOffsets[obsOffset]; + } else if (militaryOffset) { + // the only allowed military tz is Z + return 0; + } else { + var hm = parseInt(numOffset, 10), + m = hm % 100, + h = (hm - m) / 100; + return h * 60 + m; + } } - if (!config.longStackTraces && longStackTracesIsSupported()) { - var Promise_captureStackTrace = Promise.prototype._captureStackTrace; - var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace; - var Promise_dereferenceTrace = Promise.prototype._dereferenceTrace; - config.longStackTraces = true; - disableLongStackTraces = function() { - if (async.haveItemsQueued() && !config.longStackTraces) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + + // date and time from ref 2822 format + function configFromRFC2822(config) { + var match = rfc2822.exec(preprocessRFC2822(config._i)), + parsedArray; + if (match) { + parsedArray = extractFromRFC2822Strings( + match[4], + match[3], + match[2], + match[5], + match[6], + match[7] + ); + if (!checkWeekday(match[1], parsedArray, config)) { + return; } - Promise.prototype._captureStackTrace = Promise_captureStackTrace; - Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; - Promise.prototype._dereferenceTrace = Promise_dereferenceTrace; - Context.deactivateLongStackTraces(); - config.longStackTraces = false; - }; - Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; - Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; - Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace; - Context.activateLongStackTraces(); - } -}; -Promise.hasLongStackTraces = function () { - return config.longStackTraces && longStackTracesIsSupported(); -}; + config._a = parsedArray; + config._tzm = calculateOffset(match[8], match[9], match[10]); + config._d = createUTCDate.apply(null, config._a); + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); -var legacyHandlers = { - unhandledrejection: { - before: function() { - var ret = util.global.onunhandledrejection; - util.global.onunhandledrejection = null; - return ret; - }, - after: function(fn) { - util.global.onunhandledrejection = fn; - } - }, - rejectionhandled: { - before: function() { - var ret = util.global.onrejectionhandled; - util.global.onrejectionhandled = null; - return ret; - }, - after: function(fn) { - util.global.onrejectionhandled = fn; + getParsingFlags(config).rfc2822 = true; + } else { + config._isValid = false; } } -}; -var fireDomEvent = (function() { - var dispatch = function(legacy, e) { - if (legacy) { - var fn; - try { - fn = legacy.before(); - return !util.global.dispatchEvent(e); - } finally { - legacy.after(fn); - } - } else { - return !util.global.dispatchEvent(e); + // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict + function configFromString(config) { + var matched = aspNetJsonRegex.exec(config._i); + if (matched !== null) { + config._d = new Date(+matched[1]); + return; } - }; - try { - if (typeof CustomEvent === "function") { - var event = new CustomEvent("CustomEvent"); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var eventData = { - detail: event, - cancelable: true - }; - var domEvent = new CustomEvent(name, eventData); - es5.defineProperty( - domEvent, "promise", {value: event.promise}); - es5.defineProperty( - domEvent, "reason", {value: event.reason}); - return dispatch(legacyHandlers[name], domEvent); - }; - } else if (typeof Event === "function") { - var event = new Event("CustomEvent"); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var domEvent = new Event(name, { - cancelable: true - }); - domEvent.detail = event; - es5.defineProperty(domEvent, "promise", {value: event.promise}); - es5.defineProperty(domEvent, "reason", {value: event.reason}); - return dispatch(legacyHandlers[name], domEvent); - }; + configFromISO(config); + if (config._isValid === false) { + delete config._isValid; } else { - var event = document.createEvent("CustomEvent"); - event.initCustomEvent("testingtheevent", false, true, {}); - util.global.dispatchEvent(event); - return function(name, event) { - name = name.toLowerCase(); - var domEvent = document.createEvent("CustomEvent"); - domEvent.initCustomEvent(name, false, true, - event); - return dispatch(legacyHandlers[name], domEvent); - }; + return; } - } catch (e) {} - return function() { - return false; - }; -})(); -var fireGlobalEvent = (function() { - if (util.isNode) { - return function() { - return process.emit.apply(process, arguments); - }; - } else { - if (!util.global) { - return function() { - return false; - }; + configFromRFC2822(config); + if (config._isValid === false) { + delete config._isValid; + } else { + return; } - return function(name) { - var methodName = "on" + name.toLowerCase(); - var method = util.global[methodName]; - if (!method) return false; - method.apply(util.global, [].slice.call(arguments, 1)); - return true; - }; - } -})(); - -function generatePromiseLifecycleEventObject(name, promise) { - return {promise: promise}; -} - -var eventToObjectGenerator = { - promiseCreated: generatePromiseLifecycleEventObject, - promiseFulfilled: generatePromiseLifecycleEventObject, - promiseRejected: generatePromiseLifecycleEventObject, - promiseResolved: generatePromiseLifecycleEventObject, - promiseCancelled: generatePromiseLifecycleEventObject, - promiseChained: function(name, promise, child) { - return {promise: promise, child: child}; - }, - warning: function(name, warning) { - return {warning: warning}; - }, - unhandledRejection: function (name, reason, promise) { - return {reason: reason, promise: promise}; - }, - rejectionHandled: generatePromiseLifecycleEventObject -}; - -var activeFireEvent = function (name) { - var globalEventFired = false; - try { - globalEventFired = fireGlobalEvent.apply(null, arguments); - } catch (e) { - async.throwLater(e); - globalEventFired = true; - } - var domEventFired = false; - try { - domEventFired = fireDomEvent(name, - eventToObjectGenerator[name].apply(null, arguments)); - } catch (e) { - async.throwLater(e); - domEventFired = true; + if (config._strict) { + config._isValid = false; + } else { + // Final attempt, use Input Fallback + hooks.createFromInputFallback(config); + } } - return domEventFired || globalEventFired; -}; - -Promise.config = function(opts) { - opts = Object(opts); - if ("longStackTraces" in opts) { - if (opts.longStackTraces) { - Promise.longStackTraces(); - } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) { - disableLongStackTraces(); + hooks.createFromInputFallback = deprecate( + 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + + 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.', + function (config) { + config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); } - } - if ("warnings" in opts) { - var warningsOption = opts.warnings; - config.warnings = !!warningsOption; - wForgottenReturn = config.warnings; + ); - if (util.isObject(warningsOption)) { - if ("wForgottenReturn" in warningsOption) { - wForgottenReturn = !!warningsOption.wForgottenReturn; - } + // Pick the first defined of two or three arguments. + function defaults(a, b, c) { + if (a != null) { + return a; } - } - if ("cancellation" in opts && opts.cancellation && !config.cancellation) { - if (async.haveItemsQueued()) { - throw new Error( - "cannot enable cancellation after promises are in use"); + if (b != null) { + return b; } - Promise.prototype._clearCancellationData = - cancellationClearCancellationData; - Promise.prototype._propagateFrom = cancellationPropagateFrom; - Promise.prototype._onCancel = cancellationOnCancel; - Promise.prototype._setOnCancel = cancellationSetOnCancel; - Promise.prototype._attachCancellationCallback = - cancellationAttachCancellationCallback; - Promise.prototype._execute = cancellationExecute; - propagateFromFunction = cancellationPropagateFrom; - config.cancellation = true; + return c; } - if ("monitoring" in opts) { - if (opts.monitoring && !config.monitoring) { - config.monitoring = true; - Promise.prototype._fireEvent = activeFireEvent; - } else if (!opts.monitoring && config.monitoring) { - config.monitoring = false; - Promise.prototype._fireEvent = defaultFireEvent; + + function currentDateArray(config) { + // hooks is actually the exported moment object + var nowValue = new Date(hooks.now()); + if (config._useUTC) { + return [ + nowValue.getUTCFullYear(), + nowValue.getUTCMonth(), + nowValue.getUTCDate(), + ]; } + return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; } - if ("asyncHooks" in opts && util.nodeSupportsAsyncResource) { - var prev = config.asyncHooks; - var cur = !!opts.asyncHooks; - if (prev !== cur) { - config.asyncHooks = cur; - if (cur) { - enableAsyncHooks(); - } else { - disableAsyncHooks(); - } + + // convert an array to a date. + // the array should mirror the parameters below + // note: all values past the year are optional and will default to the lowest possible value. + // [year, month, day , hour, minute, second, millisecond] + function configFromArray(config) { + var i, + date, + input = [], + currentDate, + expectedWeekday, + yearToUse; + + if (config._d) { + return; } - } - return Promise; -}; -function defaultFireEvent() { return false; } + currentDate = currentDateArray(config); -Promise.prototype._fireEvent = defaultFireEvent; -Promise.prototype._execute = function(executor, resolve, reject) { - try { - executor(resolve, reject); - } catch (e) { - return e; - } -}; -Promise.prototype._onCancel = function () {}; -Promise.prototype._setOnCancel = function (handler) { ; }; -Promise.prototype._attachCancellationCallback = function(onCancel) { - ; -}; -Promise.prototype._captureStackTrace = function () {}; -Promise.prototype._attachExtraTrace = function () {}; -Promise.prototype._dereferenceTrace = function () {}; -Promise.prototype._clearCancellationData = function() {}; -Promise.prototype._propagateFrom = function (parent, flags) { - ; - ; -}; + //compute day of the year from weeks and weekdays + if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { + dayOfYearFromWeekInfo(config); + } -function cancellationExecute(executor, resolve, reject) { - var promise = this; - try { - executor(resolve, reject, function(onCancel) { - if (typeof onCancel !== "function") { - throw new TypeError("onCancel must be a function, got: " + - util.toString(onCancel)); + //if the day of the year is set, figure out what it is + if (config._dayOfYear != null) { + yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); + + if ( + config._dayOfYear > daysInYear(yearToUse) || + config._dayOfYear === 0 + ) { + getParsingFlags(config)._overflowDayOfYear = true; } - promise._attachCancellationCallback(onCancel); - }); - } catch (e) { - return e; - } -} -function cancellationAttachCancellationCallback(onCancel) { - if (!this._isCancellable()) return this; + date = createUTCDate(yearToUse, 0, config._dayOfYear); + config._a[MONTH] = date.getUTCMonth(); + config._a[DATE] = date.getUTCDate(); + } - var previousOnCancel = this._onCancel(); - if (previousOnCancel !== undefined) { - if (util.isArray(previousOnCancel)) { - previousOnCancel.push(onCancel); - } else { - this._setOnCancel([previousOnCancel, onCancel]); + // Default to current date. + // * if no year, month, day of month are given, default to today + // * if day of month is given, default month and year + // * if month is given, default only year + // * if year is given, don't default anything + for (i = 0; i < 3 && config._a[i] == null; ++i) { + config._a[i] = input[i] = currentDate[i]; } - } else { - this._setOnCancel(onCancel); - } -} -function cancellationOnCancel() { - return this._onCancelField; -} + // Zero out whatever was not defaulted, including time + for (; i < 7; i++) { + config._a[i] = input[i] = + config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i]; + } -function cancellationSetOnCancel(onCancel) { - this._onCancelField = onCancel; -} + // Check for 24:00:00.000 + if ( + config._a[HOUR] === 24 && + config._a[MINUTE] === 0 && + config._a[SECOND] === 0 && + config._a[MILLISECOND] === 0 + ) { + config._nextDay = true; + config._a[HOUR] = 0; + } -function cancellationClearCancellationData() { - this._cancellationParent = undefined; - this._onCancelField = undefined; -} + config._d = (config._useUTC ? createUTCDate : createDate).apply( + null, + input + ); + expectedWeekday = config._useUTC + ? config._d.getUTCDay() + : config._d.getDay(); -function cancellationPropagateFrom(parent, flags) { - if ((flags & 1) !== 0) { - this._cancellationParent = parent; - var branchesRemainingToCancel = parent._branchesRemainingToCancel; - if (branchesRemainingToCancel === undefined) { - branchesRemainingToCancel = 0; + // Apply timezone offset from input. The actual utcOffset can be changed + // with parseZone. + if (config._tzm != null) { + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); } - parent._branchesRemainingToCancel = branchesRemainingToCancel + 1; - } - if ((flags & 2) !== 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -} -function bindingPropagateFrom(parent, flags) { - if ((flags & 2) !== 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -} -var propagateFromFunction = bindingPropagateFrom; + if (config._nextDay) { + config._a[HOUR] = 24; + } -function boundValueFunction() { - var ret = this._boundTo; - if (ret !== undefined) { - if (ret instanceof Promise) { - if (ret.isFulfilled()) { - return ret.value(); - } else { - return undefined; - } + // check for mismatching day of week + if ( + config._w && + typeof config._w.d !== 'undefined' && + config._w.d !== expectedWeekday + ) { + getParsingFlags(config).weekdayMismatch = true; } } - return ret; -} -function longStackTracesCaptureStackTrace() { - this._trace = new CapturedTrace(this._peekContext()); -} + function dayOfYearFromWeekInfo(config) { + var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek; -function longStackTracesAttachExtraTrace(error, ignoreSelf) { - if (canAttachTrace(error)) { - var trace = this._trace; - if (trace !== undefined) { - if (ignoreSelf) trace = trace._parent; - } - if (trace !== undefined) { - trace.attachExtraTrace(error); - } else if (!error.__stackCleaned__) { - var parsed = parseStackAndMessage(error); - util.notEnumerableProp(error, "stack", - parsed.message + "\n" + parsed.stack.join("\n")); - util.notEnumerableProp(error, "__stackCleaned__", true); - } - } -} + w = config._w; + if (w.GG != null || w.W != null || w.E != null) { + dow = 1; + doy = 4; -function longStackTracesDereferenceTrace() { - this._trace = undefined; -} + // TODO: We need to take the current isoWeekYear, but that depends on + // how we interpret now (local, utc, fixed offset). So create + // a now version of current config (take local/utc/offset flags, and + // create now). + weekYear = defaults( + w.GG, + config._a[YEAR], + weekOfYear(createLocal(), 1, 4).year + ); + week = defaults(w.W, 1); + weekday = defaults(w.E, 1); + if (weekday < 1 || weekday > 7) { + weekdayOverflow = true; + } + } else { + dow = config._locale._week.dow; + doy = config._locale._week.doy; -function checkForgottenReturns(returnValue, promiseCreated, name, promise, - parent) { - if (returnValue === undefined && promiseCreated !== null && - wForgottenReturn) { - if (parent !== undefined && parent._returnedNonUndefined()) return; - if ((promise._bitField & 65535) === 0) return; + curWeek = weekOfYear(createLocal(), dow, doy); - if (name) name = name + " "; - var handlerLine = ""; - var creatorLine = ""; - if (promiseCreated._trace) { - var traceLines = promiseCreated._trace.stack.split("\n"); - var stack = cleanStack(traceLines); - for (var i = stack.length - 1; i >= 0; --i) { - var line = stack[i]; - if (!nodeFramePattern.test(line)) { - var lineMatches = line.match(parseLinePattern); - if (lineMatches) { - handlerLine = "at " + lineMatches[1] + - ":" + lineMatches[2] + ":" + lineMatches[3] + " "; - } - break; - } - } + weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); - if (stack.length > 0) { - var firstUserLine = stack[0]; - for (var i = 0; i < traceLines.length; ++i) { + // Default to current week. + week = defaults(w.w, curWeek.week); - if (traceLines[i] === firstUserLine) { - if (i > 0) { - creatorLine = "\n" + traceLines[i - 1]; - } - break; - } + if (w.d != null) { + // weekday -- low day numbers are considered next week + weekday = w.d; + if (weekday < 0 || weekday > 6) { + weekdayOverflow = true; } - + } else if (w.e != null) { + // local weekday -- counting starts from beginning of week + weekday = w.e + dow; + if (w.e < 0 || w.e > 6) { + weekdayOverflow = true; + } + } else { + // default to beginning of week + weekday = dow; } } - var msg = "a promise was created in a " + name + - "handler " + handlerLine + "but was not returned from it, " + - "see http://goo.gl/rRqMUw" + - creatorLine; - promise._warn(msg, true, promiseCreated); - } -} - -function deprecated(name, replacement) { - var message = name + - " is deprecated and will be removed in a future version."; - if (replacement) message += " Use " + replacement + " instead."; - return warn(message); -} - -function warn(message, shouldUseOwnTrace, promise) { - if (!config.warnings) return; - var warning = new Warning(message); - var ctx; - if (shouldUseOwnTrace) { - promise._attachExtraTrace(warning); - } else if (config.longStackTraces && (ctx = Promise._peekContext())) { - ctx.attachExtraTrace(warning); - } else { - var parsed = parseStackAndMessage(warning); - warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); + if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { + getParsingFlags(config)._overflowWeeks = true; + } else if (weekdayOverflow != null) { + getParsingFlags(config)._overflowWeekday = true; + } else { + temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); + config._a[YEAR] = temp.year; + config._dayOfYear = temp.dayOfYear; + } } - if (!activeFireEvent("warning", warning)) { - formatAndLogError(warning, "", true); - } -} + // constant that refers to the ISO standard + hooks.ISO_8601 = function () {}; -function reconstructStack(message, stacks) { - for (var i = 0; i < stacks.length - 1; ++i) { - stacks[i].push("From previous event:"); - stacks[i] = stacks[i].join("\n"); - } - if (i < stacks.length) { - stacks[i] = stacks[i].join("\n"); - } - return message + "\n" + stacks.join("\n"); -} + // constant that refers to the RFC 2822 form + hooks.RFC_2822 = function () {}; -function removeDuplicateOrEmptyJumps(stacks) { - for (var i = 0; i < stacks.length; ++i) { - if (stacks[i].length === 0 || - ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { - stacks.splice(i, 1); - i--; + // date from string and format string + function configFromStringAndFormat(config) { + // TODO: Move this to another part of the creation flow to prevent circular deps + if (config._f === hooks.ISO_8601) { + configFromISO(config); + return; } - } -} + if (config._f === hooks.RFC_2822) { + configFromRFC2822(config); + return; + } + config._a = []; + getParsingFlags(config).empty = true; -function removeCommonRoots(stacks) { - var current = stacks[0]; - for (var i = 1; i < stacks.length; ++i) { - var prev = stacks[i]; - var currentLastIndex = current.length - 1; - var currentLastLine = current[currentLastIndex]; - var commonRootMeetPoint = -1; + // This array is used to make a Date, either with `new Date` or `Date.UTC` + var string = '' + config._i, + i, + parsedInput, + tokens, + token, + skipped, + stringLength = string.length, + totalParsedInputLength = 0, + era, + tokenLen; - for (var j = prev.length - 1; j >= 0; --j) { - if (prev[j] === currentLastLine) { - commonRootMeetPoint = j; - break; + tokens = + expandFormat(config._f, config._locale).match(formattingTokens) || []; + tokenLen = tokens.length; + for (i = 0; i < tokenLen; i++) { + token = tokens[i]; + parsedInput = (string.match(getParseRegexForToken(token, config)) || + [])[0]; + if (parsedInput) { + skipped = string.substr(0, string.indexOf(parsedInput)); + if (skipped.length > 0) { + getParsingFlags(config).unusedInput.push(skipped); + } + string = string.slice( + string.indexOf(parsedInput) + parsedInput.length + ); + totalParsedInputLength += parsedInput.length; + } + // don't parse if it's not a known token + if (formatTokenFunctions[token]) { + if (parsedInput) { + getParsingFlags(config).empty = false; + } else { + getParsingFlags(config).unusedTokens.push(token); + } + addTimeToArrayFromToken(token, parsedInput, config); + } else if (config._strict && !parsedInput) { + getParsingFlags(config).unusedTokens.push(token); } } - for (var j = commonRootMeetPoint; j >= 0; --j) { - var line = prev[j]; - if (current[currentLastIndex] === line) { - current.pop(); - currentLastIndex--; - } else { - break; - } + // add remaining unparsed input length to the string + getParsingFlags(config).charsLeftOver = + stringLength - totalParsedInputLength; + if (string.length > 0) { + getParsingFlags(config).unusedInput.push(string); } - current = prev; - } -} -function cleanStack(stack) { - var ret = []; - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - var isTraceLine = " (No stack trace)" === line || - stackFramePattern.test(line); - var isInternalFrame = isTraceLine && shouldIgnore(line); - if (isTraceLine && !isInternalFrame) { - if (indentStackFrames && line.charAt(0) !== " ") { - line = " " + line; - } - ret.push(line); + // clear _12h flag if hour is <= 12 + if ( + config._a[HOUR] <= 12 && + getParsingFlags(config).bigHour === true && + config._a[HOUR] > 0 + ) { + getParsingFlags(config).bigHour = undefined; } - } - return ret; -} -function stackFramesAsArray(error) { - var stack = error.stack.replace(/\s+$/g, "").split("\n"); - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - if (" (No stack trace)" === line || stackFramePattern.test(line)) { - break; + getParsingFlags(config).parsedDateParts = config._a.slice(0); + getParsingFlags(config).meridiem = config._meridiem; + // handle meridiem + config._a[HOUR] = meridiemFixWrap( + config._locale, + config._a[HOUR], + config._meridiem + ); + + // handle era + era = getParsingFlags(config).era; + if (era !== null) { + config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]); } + + configFromArray(config); + checkOverflow(config); } - if (i > 0 && error.name != "SyntaxError") { - stack = stack.slice(i); - } - return stack; -} -function parseStackAndMessage(error) { - var stack = error.stack; - var message = error.toString(); - stack = typeof stack === "string" && stack.length > 0 - ? stackFramesAsArray(error) : [" (No stack trace)"]; - return { - message: message, - stack: error.name == "SyntaxError" ? stack : cleanStack(stack) - }; -} + function meridiemFixWrap(locale, hour, meridiem) { + var isPm; -function formatAndLogError(error, title, isSoft) { - if (typeof console !== "undefined") { - var message; - if (util.isObject(error)) { - var stack = error.stack; - message = title + formatStack(stack, error); - } else { - message = title + String(error); + if (meridiem == null) { + // nothing to do + return hour; } - if (typeof printWarning === "function") { - printWarning(message, isSoft); - } else if (typeof console.log === "function" || - typeof console.log === "object") { - console.log(message); + if (locale.meridiemHour != null) { + return locale.meridiemHour(hour, meridiem); + } else if (locale.isPM != null) { + // Fallback + isPm = locale.isPM(meridiem); + if (isPm && hour < 12) { + hour += 12; + } + if (!isPm && hour === 12) { + hour = 0; + } + return hour; + } else { + // this is not supposed to happen + return hour; } } -} -function fireRejectionEvent(name, localHandler, reason, promise) { - var localEventFired = false; - try { - if (typeof localHandler === "function") { - localEventFired = true; - if (name === "rejectionHandled") { - localHandler(promise); + // date from string and array of format strings + function configFromStringAndArray(config) { + var tempConfig, + bestMoment, + scoreToBeat, + i, + currentScore, + validFormatFound, + bestFormatIsValid = false, + configfLen = config._f.length; + + if (configfLen === 0) { + getParsingFlags(config).invalidFormat = true; + config._d = new Date(NaN); + return; + } + + for (i = 0; i < configfLen; i++) { + currentScore = 0; + validFormatFound = false; + tempConfig = copyConfig({}, config); + if (config._useUTC != null) { + tempConfig._useUTC = config._useUTC; + } + tempConfig._f = config._f[i]; + configFromStringAndFormat(tempConfig); + + if (isValid(tempConfig)) { + validFormatFound = true; + } + + // if there is any input that was not parsed add a penalty for that format + currentScore += getParsingFlags(tempConfig).charsLeftOver; + + //or tokens + currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; + + getParsingFlags(tempConfig).score = currentScore; + + if (!bestFormatIsValid) { + if ( + scoreToBeat == null || + currentScore < scoreToBeat || + validFormatFound + ) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + if (validFormatFound) { + bestFormatIsValid = true; + } + } } else { - localHandler(reason, promise); + if (currentScore < scoreToBeat) { + scoreToBeat = currentScore; + bestMoment = tempConfig; + } } } - } catch (e) { - async.throwLater(e); + + extend(config, bestMoment || tempConfig); } - if (name === "unhandledRejection") { - if (!activeFireEvent(name, reason, promise) && !localEventFired) { - formatAndLogError(reason, "Unhandled rejection "); + function configFromObject(config) { + if (config._d) { + return; } - } else { - activeFireEvent(name, promise); - } -} -function formatNonError(obj) { - var str; - if (typeof obj === "function") { - str = "[function " + - (obj.name || "anonymous") + - "]"; - } else { - str = obj && typeof obj.toString === "function" - ? obj.toString() : util.toString(obj); - var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; - if (ruselessToString.test(str)) { - try { - var newStr = JSON.stringify(obj); - str = newStr; + var i = normalizeObjectUnits(config._i), + dayOrDate = i.day === undefined ? i.date : i.day; + config._a = map( + [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], + function (obj) { + return obj && parseInt(obj, 10); } - catch(e) { + ); - } - } - if (str.length === 0) { - str = "(empty array)"; - } + configFromArray(config); } - return ("(<" + snip(str) + ">, no stack trace)"); -} -function snip(str) { - var maxChars = 41; - if (str.length < maxChars) { - return str; + function createFromConfig(config) { + var res = new Moment(checkOverflow(prepareConfig(config))); + if (res._nextDay) { + // Adding is smart enough around DST + res.add(1, 'd'); + res._nextDay = undefined; + } + + return res; } - return str.substr(0, maxChars - 3) + "..."; -} -function longStackTracesIsSupported() { - return typeof captureStackTrace === "function"; -} + function prepareConfig(config) { + var input = config._i, + format = config._f; -var shouldIgnore = function() { return false; }; -var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; -function parseLineInfo(line) { - var matches = line.match(parseLineInfoRegex); - if (matches) { - return { - fileName: matches[1], - line: parseInt(matches[2], 10) - }; - } -} + config._locale = config._locale || getLocale(config._l); -function setBounds(firstLineError, lastLineError) { - if (!longStackTracesIsSupported()) return; - var firstStackLines = (firstLineError.stack || "").split("\n"); - var lastStackLines = (lastLineError.stack || "").split("\n"); - var firstIndex = -1; - var lastIndex = -1; - var firstFileName; - var lastFileName; - for (var i = 0; i < firstStackLines.length; ++i) { - var result = parseLineInfo(firstStackLines[i]); - if (result) { - firstFileName = result.fileName; - firstIndex = result.line; - break; + if (input === null || (format === undefined && input === '')) { + return createInvalid({ nullInput: true }); } - } - for (var i = 0; i < lastStackLines.length; ++i) { - var result = parseLineInfo(lastStackLines[i]); - if (result) { - lastFileName = result.fileName; - lastIndex = result.line; - break; + + if (typeof input === 'string') { + config._i = input = config._locale.preparse(input); + } + + if (isMoment(input)) { + return new Moment(checkOverflow(input)); + } else if (isDate(input)) { + config._d = input; + } else if (isArray(format)) { + configFromStringAndArray(config); + } else if (format) { + configFromStringAndFormat(config); + } else { + configFromInput(config); + } + + if (!isValid(config)) { + config._d = null; } + + return config; } - if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || - firstFileName !== lastFileName || firstIndex >= lastIndex) { - return; + + function configFromInput(config) { + var input = config._i; + if (isUndefined(input)) { + config._d = new Date(hooks.now()); + } else if (isDate(input)) { + config._d = new Date(input.valueOf()); + } else if (typeof input === 'string') { + configFromString(config); + } else if (isArray(input)) { + config._a = map(input.slice(0), function (obj) { + return parseInt(obj, 10); + }); + configFromArray(config); + } else if (isObject(input)) { + configFromObject(config); + } else if (isNumber(input)) { + // from milliseconds + config._d = new Date(input); + } else { + hooks.createFromInputFallback(config); + } } - shouldIgnore = function(line) { - if (bluebirdFramePattern.test(line)) return true; - var info = parseLineInfo(line); - if (info) { - if (info.fileName === firstFileName && - (firstIndex <= info.line && info.line <= lastIndex)) { - return true; - } + function createLocalOrUTC(input, format, locale, strict, isUTC) { + var c = {}; + + if (format === true || format === false) { + strict = format; + format = undefined; } - return false; - }; -} -function CapturedTrace(parent) { - this._parent = parent; - this._promisesCreated = 0; - var length = this._length = 1 + (parent === undefined ? 0 : parent._length); - captureStackTrace(this, CapturedTrace); - if (length > 32) this.uncycle(); -} -util.inherits(CapturedTrace, Error); -Context.CapturedTrace = CapturedTrace; + if (locale === true || locale === false) { + strict = locale; + locale = undefined; + } -CapturedTrace.prototype.uncycle = function() { - var length = this._length; - if (length < 2) return; - var nodes = []; - var stackToIndex = {}; + if ( + (isObject(input) && isObjectEmpty(input)) || + (isArray(input) && input.length === 0) + ) { + input = undefined; + } + // object construction must be done this way. + // https://github.com/moment/moment/issues/1423 + c._isAMomentObject = true; + c._useUTC = c._isUTC = isUTC; + c._l = locale; + c._i = input; + c._f = format; + c._strict = strict; - for (var i = 0, node = this; node !== undefined; ++i) { - nodes.push(node); - node = node._parent; + return createFromConfig(c); } - length = this._length = i; - for (var i = length - 1; i >= 0; --i) { - var stack = nodes[i].stack; - if (stackToIndex[stack] === undefined) { - stackToIndex[stack] = i; - } + + function createLocal(input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, false); } - for (var i = 0; i < length; ++i) { - var currentStack = nodes[i].stack; - var index = stackToIndex[currentStack]; - if (index !== undefined && index !== i) { - if (index > 0) { - nodes[index - 1]._parent = undefined; - nodes[index - 1]._length = 1; - } - nodes[i]._parent = undefined; - nodes[i]._length = 1; - var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; - if (index < length - 1) { - cycleEdgeNode._parent = nodes[index + 1]; - cycleEdgeNode._parent.uncycle(); - cycleEdgeNode._length = - cycleEdgeNode._parent._length + 1; - } else { - cycleEdgeNode._parent = undefined; - cycleEdgeNode._length = 1; + var prototypeMin = deprecate( + 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other < this ? this : other; + } else { + return createInvalid(); + } } - var currentChildLength = cycleEdgeNode._length + 1; - for (var j = i - 2; j >= 0; --j) { - nodes[j]._length = currentChildLength; - currentChildLength++; + ), + prototypeMax = deprecate( + 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other > this ? this : other; + } else { + return createInvalid(); + } + } + ); + + // Pick a moment m from moments so that m[fn](other) is true for all + // other. This relies on the function fn to be transitive. + // + // moments should either be an array of moment objects or an array, whose + // first element is an array of moment objects. + function pickBy(fn, moments) { + var res, i; + if (moments.length === 1 && isArray(moments[0])) { + moments = moments[0]; + } + if (!moments.length) { + return createLocal(); + } + res = moments[0]; + for (i = 1; i < moments.length; ++i) { + if (!moments[i].isValid() || moments[i][fn](res)) { + res = moments[i]; } - return; } + return res; } -}; -CapturedTrace.prototype.attachExtraTrace = function(error) { - if (error.__stackCleaned__) return; - this.uncycle(); - var parsed = parseStackAndMessage(error); - var message = parsed.message; - var stacks = [parsed.stack]; + // TODO: Use [].sort instead? + function min() { + var args = [].slice.call(arguments, 0); - var trace = this; - while (trace !== undefined) { - stacks.push(cleanStack(trace.stack.split("\n"))); - trace = trace._parent; + return pickBy('isBefore', args); } - removeCommonRoots(stacks); - removeDuplicateOrEmptyJumps(stacks); - util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); - util.notEnumerableProp(error, "__stackCleaned__", true); -}; - -var captureStackTrace = (function stackDetection() { - var v8stackFramePattern = /^\s*at\s*/; - var v8stackFormatter = function(stack, error) { - if (typeof stack === "string") return stack; - - if (error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - if (typeof Error.stackTraceLimit === "number" && - typeof Error.captureStackTrace === "function") { - Error.stackTraceLimit += 6; - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - var captureStackTrace = Error.captureStackTrace; + function max() { + var args = [].slice.call(arguments, 0); - shouldIgnore = function(line) { - return bluebirdFramePattern.test(line); - }; - return function(receiver, ignoreUntil) { - Error.stackTraceLimit += 6; - captureStackTrace(receiver, ignoreUntil); - Error.stackTraceLimit -= 6; - }; + return pickBy('isAfter', args); } - var err = new Error(); - if (typeof err.stack === "string" && - err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { - stackFramePattern = /@/; - formatStack = v8stackFormatter; - indentStackFrames = true; - return function captureStackTrace(o) { - o.stack = new Error().stack; - }; - } + var now = function () { + return Date.now ? Date.now() : +new Date(); + }; - var hasStackAfterThrow; - try { throw new Error(); } - catch(e) { - hasStackAfterThrow = ("stack" in e); - } - if (!("stack" in err) && hasStackAfterThrow && - typeof Error.stackTraceLimit === "number") { - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - return function captureStackTrace(o) { - Error.stackTraceLimit += 6; - try { throw new Error(); } - catch(e) { o.stack = e.stack; } - Error.stackTraceLimit -= 6; - }; - } + var ordering = [ + 'year', + 'quarter', + 'month', + 'week', + 'day', + 'hour', + 'minute', + 'second', + 'millisecond', + ]; - formatStack = function(stack, error) { - if (typeof stack === "string") return stack; + function isDurationValid(m) { + var key, + unitHasDecimal = false, + i, + orderLen = ordering.length; + for (key in m) { + if ( + hasOwnProp(m, key) && + !( + indexOf.call(ordering, key) !== -1 && + (m[key] == null || !isNaN(m[key])) + ) + ) { + return false; + } + } - if ((typeof error === "object" || - typeof error === "function") && - error.name !== undefined && - error.message !== undefined) { - return error.toString(); + for (i = 0; i < orderLen; ++i) { + if (m[ordering[i]]) { + if (unitHasDecimal) { + return false; // only allow non-integers for smallest unit + } + if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { + unitHasDecimal = true; + } + } } - return formatNonError(error); - }; - return null; + return true; + } -})([]); + function isValid$1() { + return this._isValid; + } -if (typeof console !== "undefined" && typeof console.warn !== "undefined") { - printWarning = function (message) { - console.warn(message); - }; - if (util.isNode && process.stderr.isTTY) { - printWarning = function(message, isSoft) { - var color = isSoft ? "\u001b[33m" : "\u001b[31m"; - console.warn(color + message + "\u001b[0m\n"); - }; - } else if (!util.isNode && typeof (new Error().stack) === "string") { - printWarning = function(message, isSoft) { - console.warn("%c" + message, - isSoft ? "color: darkorange" : "color: red"); - }; + function createInvalid$1() { + return createDuration(NaN); } -} -var config = { - warnings: warnings, - longStackTraces: false, - cancellation: false, - monitoring: false, - asyncHooks: false -}; + function Duration(duration) { + var normalizedInput = normalizeObjectUnits(duration), + years = normalizedInput.year || 0, + quarters = normalizedInput.quarter || 0, + months = normalizedInput.month || 0, + weeks = normalizedInput.week || normalizedInput.isoWeek || 0, + days = normalizedInput.day || 0, + hours = normalizedInput.hour || 0, + minutes = normalizedInput.minute || 0, + seconds = normalizedInput.second || 0, + milliseconds = normalizedInput.millisecond || 0; -if (longStackTraces) Promise.longStackTraces(); + this._isValid = isDurationValid(normalizedInput); -return { - asyncHooks: function() { - return config.asyncHooks; - }, - longStackTraces: function() { - return config.longStackTraces; - }, - warnings: function() { - return config.warnings; - }, - cancellation: function() { - return config.cancellation; - }, - monitoring: function() { - return config.monitoring; - }, - propagateFromFunction: function() { - return propagateFromFunction; - }, - boundValueFunction: function() { - return boundValueFunction; - }, - checkForgottenReturns: checkForgottenReturns, - setBounds: setBounds, - warn: warn, - deprecated: deprecated, - CapturedTrace: CapturedTrace, - fireDomEvent: fireDomEvent, - fireGlobalEvent: fireGlobalEvent -}; -}; + // representation for dateAddRemove + this._milliseconds = + +milliseconds + + seconds * 1e3 + // 1000 + minutes * 6e4 + // 1000 * 60 + hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 + // Because of dateAddRemove treats 24 hours as different from a + // day when working around DST, we need to store them separately + this._days = +days + weeks * 7; + // It is impossible to translate months into days without knowing + // which months you are are talking about, so we have to store + // it separately. + this._months = +months + quarters * 3 + years * 12; -},{"./errors":12,"./es5":13,"./util":36}],10:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -function returner() { - return this.value; -} -function thrower() { - throw this.reason; -} + this._data = {}; -Promise.prototype["return"] = -Promise.prototype.thenReturn = function (value) { - if (value instanceof Promise) value.suppressUnhandledRejections(); - return this._then( - returner, undefined, undefined, {value: value}, undefined); -}; + this._locale = getLocale(); -Promise.prototype["throw"] = -Promise.prototype.thenThrow = function (reason) { - return this._then( - thrower, undefined, undefined, {reason: reason}, undefined); -}; + this._bubble(); + } -Promise.prototype.catchThrow = function (reason) { - if (arguments.length <= 1) { - return this._then( - undefined, thrower, undefined, {reason: reason}, undefined); - } else { - var _reason = arguments[1]; - var handler = function() {throw _reason;}; - return this.caught(reason, handler); + function isDuration(obj) { + return obj instanceof Duration; } -}; -Promise.prototype.catchReturn = function (value) { - if (arguments.length <= 1) { - if (value instanceof Promise) value.suppressUnhandledRejections(); - return this._then( - undefined, returner, undefined, {value: value}, undefined); - } else { - var _value = arguments[1]; - if (_value instanceof Promise) _value.suppressUnhandledRejections(); - var handler = function() {return _value;}; - return this.caught(value, handler); + function absRound(number) { + if (number < 0) { + return Math.round(-1 * number) * -1; + } else { + return Math.round(number); + } } -}; -}; -},{}],11:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseReduce = Promise.reduce; -var PromiseAll = Promise.all; + // compare two arrays, return the number of differences + function compareArrays(array1, array2, dontConvert) { + var len = Math.min(array1.length, array2.length), + lengthDiff = Math.abs(array1.length - array2.length), + diffs = 0, + i; + for (i = 0; i < len; i++) { + if ( + (dontConvert && array1[i] !== array2[i]) || + (!dontConvert && toInt(array1[i]) !== toInt(array2[i])) + ) { + diffs++; + } + } + return diffs + lengthDiff; + } -function promiseAllThis() { - return PromiseAll(this); -} + // FORMATTING -function PromiseMapSeries(promises, fn) { - return PromiseReduce(promises, fn, INTERNAL, INTERNAL); -} + function offset(token, separator) { + addFormatToken(token, 0, 0, function () { + var offset = this.utcOffset(), + sign = '+'; + if (offset < 0) { + offset = -offset; + sign = '-'; + } + return ( + sign + + zeroFill(~~(offset / 60), 2) + + separator + + zeroFill(~~offset % 60, 2) + ); + }); + } -Promise.prototype.each = function (fn) { - return PromiseReduce(this, fn, INTERNAL, 0) - ._then(promiseAllThis, undefined, undefined, this, undefined); -}; + offset('Z', ':'); + offset('ZZ', ''); -Promise.prototype.mapSeries = function (fn) { - return PromiseReduce(this, fn, INTERNAL, INTERNAL); -}; + // PARSING -Promise.each = function (promises, fn) { - return PromiseReduce(promises, fn, INTERNAL, 0) - ._then(promiseAllThis, undefined, undefined, promises, undefined); -}; + addRegexToken('Z', matchShortOffset); + addRegexToken('ZZ', matchShortOffset); + addParseToken(['Z', 'ZZ'], function (input, array, config) { + config._useUTC = true; + config._tzm = offsetFromString(matchShortOffset, input); + }); -Promise.mapSeries = PromiseMapSeries; -}; + // HELPERS + // timezone chunker + // '+10:00' > ['10', '00'] + // '-1530' > ['-15', '30'] + var chunkOffset = /([\+\-]|\d\d)/gi; -},{}],12:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5"); -var Objectfreeze = es5.freeze; -var util = _dereq_("./util"); -var inherits = util.inherits; -var notEnumerableProp = util.notEnumerableProp; + function offsetFromString(matcher, string) { + var matches = (string || '').match(matcher), + chunk, + parts, + minutes; -function subError(nameProperty, defaultMessage) { - function SubError(message) { - if (!(this instanceof SubError)) return new SubError(message); - notEnumerableProp(this, "message", - typeof message === "string" ? message : defaultMessage); - notEnumerableProp(this, "name", nameProperty); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } else { - Error.call(this); + if (matches === null) { + return null; } - } - inherits(SubError, Error); - return SubError; -} -var _TypeError, _RangeError; -var Warning = subError("Warning", "warning"); -var CancellationError = subError("CancellationError", "cancellation error"); -var TimeoutError = subError("TimeoutError", "timeout error"); -var AggregateError = subError("AggregateError", "aggregate error"); -try { - _TypeError = TypeError; - _RangeError = RangeError; -} catch(e) { - _TypeError = subError("TypeError", "type error"); - _RangeError = subError("RangeError", "range error"); -} + chunk = matches[matches.length - 1] || []; + parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; + minutes = +(parts[1] * 60) + toInt(parts[2]); -var methods = ("join pop push shift unshift slice filter forEach some " + - "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); - -for (var i = 0; i < methods.length; ++i) { - if (typeof Array.prototype[methods[i]] === "function") { - AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; + return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; } -} -es5.defineProperty(AggregateError.prototype, "length", { - value: 0, - configurable: false, - writable: true, - enumerable: true -}); -AggregateError.prototype["isOperational"] = true; -var level = 0; -AggregateError.prototype.toString = function() { - var indent = Array(level * 4 + 1).join(" "); - var ret = "\n" + indent + "AggregateError of:" + "\n"; - level++; - indent = Array(level * 4 + 1).join(" "); - for (var i = 0; i < this.length; ++i) { - var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; - var lines = str.split("\n"); - for (var j = 0; j < lines.length; ++j) { - lines[j] = indent + lines[j]; + // Return a moment from input, that is local/utc/zone equivalent to model. + function cloneWithOffset(input, model) { + var res, diff; + if (model._isUTC) { + res = model.clone(); + diff = + (isMoment(input) || isDate(input) + ? input.valueOf() + : createLocal(input).valueOf()) - res.valueOf(); + // Use low-level api, because this fn is low-level api. + res._d.setTime(res._d.valueOf() + diff); + hooks.updateOffset(res, false); + return res; + } else { + return createLocal(input).local(); } - str = lines.join("\n"); - ret += str + "\n"; } - level--; - return ret; -}; - -function OperationalError(message) { - if (!(this instanceof OperationalError)) - return new OperationalError(message); - notEnumerableProp(this, "name", "OperationalError"); - notEnumerableProp(this, "message", message); - this.cause = message; - this["isOperational"] = true; - if (message instanceof Error) { - notEnumerableProp(this, "message", message.message); - notEnumerableProp(this, "stack", message.stack); - } else if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); + function getDateOffset(m) { + // On Firefox.24 Date#getTimezoneOffset returns a floating point. + // https://github.com/moment/moment/pull/1871 + return -Math.round(m._d.getTimezoneOffset()); } -} -inherits(OperationalError, Error); - -var errorTypes = Error["__BluebirdErrorTypes__"]; -if (!errorTypes) { - errorTypes = Objectfreeze({ - CancellationError: CancellationError, - TimeoutError: TimeoutError, - OperationalError: OperationalError, - RejectionError: OperationalError, - AggregateError: AggregateError - }); - es5.defineProperty(Error, "__BluebirdErrorTypes__", { - value: errorTypes, - writable: false, - enumerable: false, - configurable: false - }); -} + // HOOKS -module.exports = { - Error: Error, - TypeError: _TypeError, - RangeError: _RangeError, - CancellationError: errorTypes.CancellationError, - OperationalError: errorTypes.OperationalError, - TimeoutError: errorTypes.TimeoutError, - AggregateError: errorTypes.AggregateError, - Warning: Warning -}; + // This function will be called whenever a moment is mutated. + // It is intended to keep the offset in sync with the timezone. + hooks.updateOffset = function () {}; -},{"./es5":13,"./util":36}],13:[function(_dereq_,module,exports){ -var isES5 = (function(){ - "use strict"; - return this === undefined; -})(); + // MOMENTS -if (isES5) { - module.exports = { - freeze: Object.freeze, - defineProperty: Object.defineProperty, - getDescriptor: Object.getOwnPropertyDescriptor, - keys: Object.keys, - names: Object.getOwnPropertyNames, - getPrototypeOf: Object.getPrototypeOf, - isArray: Array.isArray, - isES5: isES5, - propertyIsWritable: function(obj, prop) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop); - return !!(!descriptor || descriptor.writable || descriptor.set); + // keepLocalTime = true means only change the timezone, without + // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> + // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset + // +0200, so we adjust the time as needed, to be valid. + // + // Keeping the time actually adds/subtracts (one hour) + // from the actual represented time. That is why we call updateOffset + // a second time. In case it wants us to change the offset again + // _changeInProgress == true case, then we have to adjust, because + // there is no such time in the given timezone. + function getSetOffset(input, keepLocalTime, keepMinutes) { + var offset = this._offset || 0, + localAdjust; + if (!this.isValid()) { + return input != null ? this : NaN; } - }; -} else { - var has = {}.hasOwnProperty; - var str = {}.toString; - var proto = {}.constructor.prototype; - - var ObjectKeys = function (o) { - var ret = []; - for (var key in o) { - if (has.call(o, key)) { - ret.push(key); + if (input != null) { + if (typeof input === 'string') { + input = offsetFromString(matchShortOffset, input); + if (input === null) { + return this; + } + } else if (Math.abs(input) < 16 && !keepMinutes) { + input = input * 60; + } + if (!this._isUTC && keepLocalTime) { + localAdjust = getDateOffset(this); + } + this._offset = input; + this._isUTC = true; + if (localAdjust != null) { + this.add(localAdjust, 'm'); + } + if (offset !== input) { + if (!keepLocalTime || this._changeInProgress) { + addSubtract( + this, + createDuration(input - offset, 'm'), + 1, + false + ); + } else if (!this._changeInProgress) { + this._changeInProgress = true; + hooks.updateOffset(this, true); + this._changeInProgress = null; + } } + return this; + } else { + return this._isUTC ? offset : getDateOffset(this); } - return ret; - }; - - var ObjectGetDescriptor = function(o, key) { - return {value: o[key]}; - }; + } - var ObjectDefineProperty = function (o, key, desc) { - o[key] = desc.value; - return o; - }; + function getSetZone(input, keepLocalTime) { + if (input != null) { + if (typeof input !== 'string') { + input = -input; + } - var ObjectFreeze = function (obj) { - return obj; - }; + this.utcOffset(input, keepLocalTime); - var ObjectGetPrototypeOf = function (obj) { - try { - return Object(obj).constructor.prototype; + return this; + } else { + return -this.utcOffset(); } - catch (e) { - return proto; + } + + function setOffsetToUTC(keepLocalTime) { + return this.utcOffset(0, keepLocalTime); + } + + function setOffsetToLocal(keepLocalTime) { + if (this._isUTC) { + this.utcOffset(0, keepLocalTime); + this._isUTC = false; + + if (keepLocalTime) { + this.subtract(getDateOffset(this), 'm'); + } } - }; + return this; + } - var ArrayIsArray = function (obj) { - try { - return str.call(obj) === "[object Array]"; + function setOffsetToParsedOffset() { + if (this._tzm != null) { + this.utcOffset(this._tzm, false, true); + } else if (typeof this._i === 'string') { + var tZone = offsetFromString(matchOffset, this._i); + if (tZone != null) { + this.utcOffset(tZone); + } else { + this.utcOffset(0, true); + } } - catch(e) { + return this; + } + + function hasAlignedHourOffset(input) { + if (!this.isValid()) { return false; } - }; + input = input ? createLocal(input).utcOffset() : 0; - module.exports = { - isArray: ArrayIsArray, - keys: ObjectKeys, - names: ObjectKeys, - defineProperty: ObjectDefineProperty, - getDescriptor: ObjectGetDescriptor, - freeze: ObjectFreeze, - getPrototypeOf: ObjectGetPrototypeOf, - isES5: isES5, - propertyIsWritable: function() { - return true; - } - }; -} + return (this.utcOffset() - input) % 60 === 0; + } -},{}],14:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseMap = Promise.map; + function isDaylightSavingTime() { + return ( + this.utcOffset() > this.clone().month(0).utcOffset() || + this.utcOffset() > this.clone().month(5).utcOffset() + ); + } -Promise.prototype.filter = function (fn, options) { - return PromiseMap(this, fn, options, INTERNAL); -}; + function isDaylightSavingTimeShifted() { + if (!isUndefined(this._isDSTShifted)) { + return this._isDSTShifted; + } -Promise.filter = function (promises, fn, options) { - return PromiseMap(promises, fn, options, INTERNAL); -}; -}; + var c = {}, + other; -},{}],15:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) { -var util = _dereq_("./util"); -var CancellationError = Promise.CancellationError; -var errorObj = util.errorObj; -var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); + copyConfig(c, this); + c = prepareConfig(c); -function PassThroughHandlerContext(promise, type, handler) { - this.promise = promise; - this.type = type; - this.handler = handler; - this.called = false; - this.cancelPromise = null; -} + if (c._a) { + other = c._isUTC ? createUTC(c._a) : createLocal(c._a); + this._isDSTShifted = + this.isValid() && compareArrays(c._a, other.toArray()) > 0; + } else { + this._isDSTShifted = false; + } -PassThroughHandlerContext.prototype.isFinallyHandler = function() { - return this.type === 0; -}; + return this._isDSTShifted; + } -function FinallyHandlerCancelReaction(finallyHandler) { - this.finallyHandler = finallyHandler; -} + function isLocal() { + return this.isValid() ? !this._isUTC : false; + } -FinallyHandlerCancelReaction.prototype._resultCancelled = function() { - checkCancel(this.finallyHandler); -}; + function isUtcOffset() { + return this.isValid() ? this._isUTC : false; + } -function checkCancel(ctx, reason) { - if (ctx.cancelPromise != null) { - if (arguments.length > 1) { - ctx.cancelPromise._reject(reason); - } else { - ctx.cancelPromise._cancel(); - } - ctx.cancelPromise = null; - return true; + function isUtc() { + return this.isValid() ? this._isUTC && this._offset === 0 : false; } - return false; -} -function succeed() { - return finallyHandler.call(this, this.promise._target()._settledValue()); -} -function fail(reason) { - if (checkCancel(this, reason)) return; - errorObj.e = reason; - return errorObj; -} -function finallyHandler(reasonOrValue) { - var promise = this.promise; - var handler = this.handler; + // ASP.NET json date format regex + var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, + // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html + // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere + // and further modified to allow for strings containing both week and day + isoRegex = + /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; - if (!this.called) { - this.called = true; - var ret = this.isFinallyHandler() - ? handler.call(promise._boundValue()) - : handler.call(promise._boundValue(), reasonOrValue); - if (ret === NEXT_FILTER) { - return ret; - } else if (ret !== undefined) { - promise._setReturnedNonUndefined(); - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - if (this.cancelPromise != null) { - if (maybePromise._isCancelled()) { - var reason = - new CancellationError("late cancellation observer"); - promise._attachExtraTrace(reason); - errorObj.e = reason; - return errorObj; - } else if (maybePromise.isPending()) { - maybePromise._attachCancellationCallback( - new FinallyHandlerCancelReaction(this)); - } - } - return maybePromise._then( - succeed, fail, undefined, this, undefined); + function createDuration(input, key) { + var duration = input, + // matching against regexp is expensive, do it on demand + match = null, + sign, + ret, + diffRes; + + if (isDuration(input)) { + duration = { + ms: input._milliseconds, + d: input._days, + M: input._months, + }; + } else if (isNumber(input) || !isNaN(+input)) { + duration = {}; + if (key) { + duration[key] = +input; + } else { + duration.milliseconds = +input; } + } else if ((match = aspNetRegex.exec(input))) { + sign = match[1] === '-' ? -1 : 1; + duration = { + y: 0, + d: toInt(match[DATE]) * sign, + h: toInt(match[HOUR]) * sign, + m: toInt(match[MINUTE]) * sign, + s: toInt(match[SECOND]) * sign, + ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match + }; + } else if ((match = isoRegex.exec(input))) { + sign = match[1] === '-' ? -1 : 1; + duration = { + y: parseIso(match[2], sign), + M: parseIso(match[3], sign), + w: parseIso(match[4], sign), + d: parseIso(match[5], sign), + h: parseIso(match[6], sign), + m: parseIso(match[7], sign), + s: parseIso(match[8], sign), + }; + } else if (duration == null) { + // checks for null or undefined + duration = {}; + } else if ( + typeof duration === 'object' && + ('from' in duration || 'to' in duration) + ) { + diffRes = momentsDifference( + createLocal(duration.from), + createLocal(duration.to) + ); + + duration = {}; + duration.ms = diffRes.milliseconds; + duration.M = diffRes.months; + } + + ret = new Duration(duration); + + if (isDuration(input) && hasOwnProp(input, '_locale')) { + ret._locale = input._locale; + } + + if (isDuration(input) && hasOwnProp(input, '_isValid')) { + ret._isValid = input._isValid; } + + return ret; } - if (promise.isRejected()) { - checkCancel(this); - errorObj.e = reasonOrValue; - return errorObj; - } else { - checkCancel(this); - return reasonOrValue; + createDuration.fn = Duration.prototype; + createDuration.invalid = createInvalid$1; + + function parseIso(inp, sign) { + // We'd normally use ~~inp for this, but unfortunately it also + // converts floats to ints. + // inp may be undefined, so careful calling replace on it. + var res = inp && parseFloat(inp.replace(',', '.')); + // apply sign while we're at it + return (isNaN(res) ? 0 : res) * sign; } -} -Promise.prototype._passThrough = function(handler, type, success, fail) { - if (typeof handler !== "function") return this.then(); - return this._then(success, - fail, - undefined, - new PassThroughHandlerContext(this, type, handler), - undefined); -}; + function positiveMomentsDifference(base, other) { + var res = {}; -Promise.prototype.lastly = -Promise.prototype["finally"] = function (handler) { - return this._passThrough(handler, - 0, - finallyHandler, - finallyHandler); -}; + res.months = + other.month() - base.month() + (other.year() - base.year()) * 12; + if (base.clone().add(res.months, 'M').isAfter(other)) { + --res.months; + } + res.milliseconds = +other - +base.clone().add(res.months, 'M'); -Promise.prototype.tap = function (handler) { - return this._passThrough(handler, 1, finallyHandler); -}; + return res; + } -Promise.prototype.tapCatch = function (handlerOrPredicate) { - var len = arguments.length; - if(len === 1) { - return this._passThrough(handlerOrPredicate, - 1, - undefined, - finallyHandler); - } else { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (util.isObject(item)) { - catchInstances[j++] = item; - } else { - return Promise.reject(new TypeError( - "tapCatch statement predicate: " - + "expecting an object but got " + util.classString(item) - )); - } + function momentsDifference(base, other) { + var res; + if (!(base.isValid() && other.isValid())) { + return { milliseconds: 0, months: 0 }; } - catchInstances.length = j; - var handler = arguments[i]; - return this._passThrough(catchFilter(catchInstances, handler, this), - 1, - undefined, - finallyHandler); + + other = cloneWithOffset(other, base); + if (base.isBefore(other)) { + res = positiveMomentsDifference(base, other); + } else { + res = positiveMomentsDifference(other, base); + res.milliseconds = -res.milliseconds; + res.months = -res.months; + } + + return res; } -}; + // TODO: remove 'name' arg after deprecation is removed + function createAdder(direction, name) { + return function (val, period) { + var dur, tmp; + //invert the arguments, but complain about it + if (period !== null && !isNaN(+period)) { + deprecateSimple( + name, + 'moment().' + + name + + '(period, number) is deprecated. Please use moment().' + + name + + '(number, period). ' + + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.' + ); + tmp = val; + val = period; + period = tmp; + } -return PassThroughHandlerContext; -}; + dur = createDuration(val, period); + addSubtract(this, dur, direction); + return this; + }; + } -},{"./catch_filter":7,"./util":36}],16:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - apiRejection, - INTERNAL, - tryConvertToPromise, - Proxyable, - debug) { -var errors = _dereq_("./errors"); -var TypeError = errors.TypeError; -var util = _dereq_("./util"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -var yieldHandlers = []; + function addSubtract(mom, duration, isAdding, updateOffset) { + var milliseconds = duration._milliseconds, + days = absRound(duration._days), + months = absRound(duration._months); -function promiseFromYieldHandler(value, yieldHandlers, traceParent) { - for (var i = 0; i < yieldHandlers.length; ++i) { - traceParent._pushContext(); - var result = tryCatch(yieldHandlers[i])(value); - traceParent._popContext(); - if (result === errorObj) { - traceParent._pushContext(); - var ret = Promise.reject(errorObj.e); - traceParent._popContext(); - return ret; + if (!mom.isValid()) { + // No op + return; } - var maybePromise = tryConvertToPromise(result, traceParent); - if (maybePromise instanceof Promise) return maybePromise; - } - return null; -} -function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { - if (debug.cancellation()) { - var internal = new Promise(INTERNAL); - var _finallyPromise = this._finallyPromise = new Promise(INTERNAL); - this._promise = internal.lastly(function() { - return _finallyPromise; - }); - internal._captureStackTrace(); - internal._setOnCancel(this); - } else { - var promise = this._promise = new Promise(INTERNAL); - promise._captureStackTrace(); + updateOffset = updateOffset == null ? true : updateOffset; + + if (months) { + setMonth(mom, get(mom, 'Month') + months * isAdding); + } + if (days) { + set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); + } + if (milliseconds) { + mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); + } + if (updateOffset) { + hooks.updateOffset(mom, days || months); + } } - this._stack = stack; - this._generatorFunction = generatorFunction; - this._receiver = receiver; - this._generator = undefined; - this._yieldHandlers = typeof yieldHandler === "function" - ? [yieldHandler].concat(yieldHandlers) - : yieldHandlers; - this._yieldedPromise = null; - this._cancellationPhase = false; -} -util.inherits(PromiseSpawn, Proxyable); -PromiseSpawn.prototype._isResolved = function() { - return this._promise === null; -}; + var add = createAdder(1, 'add'), + subtract = createAdder(-1, 'subtract'); -PromiseSpawn.prototype._cleanup = function() { - this._promise = this._generator = null; - if (debug.cancellation() && this._finallyPromise !== null) { - this._finallyPromise._fulfill(); - this._finallyPromise = null; + function isString(input) { + return typeof input === 'string' || input instanceof String; } -}; - -PromiseSpawn.prototype._promiseCancelled = function() { - if (this._isResolved()) return; - var implementsReturn = typeof this._generator["return"] !== "undefined"; - var result; - if (!implementsReturn) { - var reason = new Promise.CancellationError( - "generator .return() sentinel"); - Promise.coroutine.returnSentinel = reason; - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - result = tryCatch(this._generator["throw"]).call(this._generator, - reason); - this._promise._popContext(); - } else { - this._promise._pushContext(); - result = tryCatch(this._generator["return"]).call(this._generator, - undefined); - this._promise._popContext(); + // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined + function isMomentInput(input) { + return ( + isMoment(input) || + isDate(input) || + isString(input) || + isNumber(input) || + isNumberOrStringArray(input) || + isMomentInputObject(input) || + input === null || + input === undefined + ); } - this._cancellationPhase = true; - this._yieldedPromise = null; - this._continue(result); -}; -PromiseSpawn.prototype._promiseFulfilled = function(value) { - this._yieldedPromise = null; - this._promise._pushContext(); - var result = tryCatch(this._generator.next).call(this._generator, value); - this._promise._popContext(); - this._continue(result); -}; + function isMomentInputObject(input) { + var objectTest = isObject(input) && !isObjectEmpty(input), + propertyTest = false, + properties = [ + 'years', + 'year', + 'y', + 'months', + 'month', + 'M', + 'days', + 'day', + 'd', + 'dates', + 'date', + 'D', + 'hours', + 'hour', + 'h', + 'minutes', + 'minute', + 'm', + 'seconds', + 'second', + 's', + 'milliseconds', + 'millisecond', + 'ms', + ], + i, + property, + propertyLen = properties.length; -PromiseSpawn.prototype._promiseRejected = function(reason) { - this._yieldedPromise = null; - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - var result = tryCatch(this._generator["throw"]) - .call(this._generator, reason); - this._promise._popContext(); - this._continue(result); -}; + for (i = 0; i < propertyLen; i += 1) { + property = properties[i]; + propertyTest = propertyTest || hasOwnProp(input, property); + } -PromiseSpawn.prototype._resultCancelled = function() { - if (this._yieldedPromise instanceof Promise) { - var promise = this._yieldedPromise; - this._yieldedPromise = null; - promise.cancel(); + return objectTest && propertyTest; } -}; -PromiseSpawn.prototype.promise = function () { - return this._promise; -}; + function isNumberOrStringArray(input) { + var arrayTest = isArray(input), + dataTypeTest = false; + if (arrayTest) { + dataTypeTest = + input.filter(function (item) { + return !isNumber(item) && isString(input); + }).length === 0; + } + return arrayTest && dataTypeTest; + } -PromiseSpawn.prototype._run = function () { - this._generator = this._generatorFunction.call(this._receiver); - this._receiver = - this._generatorFunction = undefined; - this._promiseFulfilled(undefined); -}; + function isCalendarSpec(input) { + var objectTest = isObject(input) && !isObjectEmpty(input), + propertyTest = false, + properties = [ + 'sameDay', + 'nextDay', + 'lastDay', + 'nextWeek', + 'lastWeek', + 'sameElse', + ], + i, + property; -PromiseSpawn.prototype._continue = function (result) { - var promise = this._promise; - if (result === errorObj) { - this._cleanup(); - if (this._cancellationPhase) { - return promise.cancel(); - } else { - return promise._rejectCallback(result.e, false); + for (i = 0; i < properties.length; i += 1) { + property = properties[i]; + propertyTest = propertyTest || hasOwnProp(input, property); } + + return objectTest && propertyTest; } - var value = result.value; - if (result.done === true) { - this._cleanup(); - if (this._cancellationPhase) { - return promise.cancel(); + function getCalendarFormat(myMoment, now) { + var diff = myMoment.diff(now, 'days', true); + return diff < -6 + ? 'sameElse' + : diff < -1 + ? 'lastWeek' + : diff < 0 + ? 'lastDay' + : diff < 1 + ? 'sameDay' + : diff < 2 + ? 'nextDay' + : diff < 7 + ? 'nextWeek' + : 'sameElse'; + } + + function calendar$1(time, formats) { + // Support for single parameter, formats only overload to the calendar function + if (arguments.length === 1) { + if (!arguments[0]) { + time = undefined; + formats = undefined; + } else if (isMomentInput(arguments[0])) { + time = arguments[0]; + formats = undefined; + } else if (isCalendarSpec(arguments[0])) { + formats = arguments[0]; + time = undefined; + } + } + // We want to compare the start of today, vs this. + // Getting start-of-today depends on whether we're local/utc/offset or not. + var now = time || createLocal(), + sod = cloneWithOffset(now, this).startOf('day'), + format = hooks.calendarFormat(this, sod) || 'sameElse', + output = + formats && + (isFunction(formats[format]) + ? formats[format].call(this, now) + : formats[format]); + + return this.format( + output || this.localeData().calendar(format, this, createLocal(now)) + ); + } + + function clone() { + return new Moment(this); + } + + function isAfter(input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() > localInput.valueOf(); } else { - return promise._resolveCallback(value); + return localInput.valueOf() < this.clone().startOf(units).valueOf(); } - } else { - var maybePromise = tryConvertToPromise(value, this._promise); - if (!(maybePromise instanceof Promise)) { - maybePromise = - promiseFromYieldHandler(maybePromise, - this._yieldHandlers, - this._promise); - if (maybePromise === null) { - this._promiseRejected( - new TypeError( - "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", String(value)) + - "From coroutine:\u000a" + - this._stack.split("\n").slice(1, -7).join("\n") - ) - ); - return; - } + } + + function isBefore(input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; } - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - this._yieldedPromise = maybePromise; - maybePromise._proxy(this, null); - } else if (((bitField & 33554432) !== 0)) { - Promise._async.invoke( - this._promiseFulfilled, this, maybePromise._value() - ); - } else if (((bitField & 16777216) !== 0)) { - Promise._async.invoke( - this._promiseRejected, this, maybePromise._reason() - ); + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() < localInput.valueOf(); } else { - this._promiseCancelled(); + return this.clone().endOf(units).valueOf() < localInput.valueOf(); } } -}; -Promise.coroutine = function (generatorFunction, options) { - if (typeof generatorFunction !== "function") { - throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + function isBetween(from, to, units, inclusivity) { + var localFrom = isMoment(from) ? from : createLocal(from), + localTo = isMoment(to) ? to : createLocal(to); + if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) { + return false; + } + inclusivity = inclusivity || '()'; + return ( + (inclusivity[0] === '(' + ? this.isAfter(localFrom, units) + : !this.isBefore(localFrom, units)) && + (inclusivity[1] === ')' + ? this.isBefore(localTo, units) + : !this.isAfter(localTo, units)) + ); } - var yieldHandler = Object(options).yieldHandler; - var PromiseSpawn$ = PromiseSpawn; - var stack = new Error().stack; - return function () { - var generator = generatorFunction.apply(this, arguments); - var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, - stack); - var ret = spawn.promise(); - spawn._generator = generator; - spawn._promiseFulfilled(undefined); - return ret; - }; -}; -Promise.coroutine.addYieldHandler = function(fn) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); + function isSame(input, units) { + var localInput = isMoment(input) ? input : createLocal(input), + inputMs; + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units) || 'millisecond'; + if (units === 'millisecond') { + return this.valueOf() === localInput.valueOf(); + } else { + inputMs = localInput.valueOf(); + return ( + this.clone().startOf(units).valueOf() <= inputMs && + inputMs <= this.clone().endOf(units).valueOf() + ); + } } - yieldHandlers.push(fn); -}; -Promise.spawn = function (generatorFunction) { - debug.deprecated("Promise.spawn()", "Promise.coroutine()"); - if (typeof generatorFunction !== "function") { - return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + function isSameOrAfter(input, units) { + return this.isSame(input, units) || this.isAfter(input, units); } - var spawn = new PromiseSpawn(generatorFunction, this); - var ret = spawn.promise(); - spawn._run(Promise.spawn); - return ret; -}; -}; -},{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async) { -var util = _dereq_("./util"); -var canEvaluate = util.canEvaluate; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var reject; + function isSameOrBefore(input, units) { + return this.isSame(input, units) || this.isBefore(input, units); + } -if (!true) { -if (canEvaluate) { - var thenCallback = function(i) { - return new Function("value", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = value; \n\ - holder.checkFulfillment(this); \n\ - ".replace(/Index/g, i)); - }; + function diff(input, units, asFloat) { + var that, zoneDelta, output; - var promiseSetter = function(i) { - return new Function("promise", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = promise; \n\ - ".replace(/Index/g, i)); - }; + if (!this.isValid()) { + return NaN; + } - var generateHolderClass = function(total) { - var props = new Array(total); - for (var i = 0; i < props.length; ++i) { - props[i] = "this.p" + (i+1); + that = cloneWithOffset(input, this); + + if (!that.isValid()) { + return NaN; } - var assignment = props.join(" = ") + " = null;"; - var cancellationCode= "var promise;\n" + props.map(function(prop) { - return " \n\ - promise = " + prop + "; \n\ - if (promise instanceof Promise) { \n\ - promise.cancel(); \n\ - } \n\ - "; - }).join("\n"); - var passedArguments = props.join(", "); - var name = "Holder$" + total; + zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; - var code = "return function(tryCatch, errorObj, Promise, async) { \n\ - 'use strict'; \n\ - function [TheName](fn) { \n\ - [TheProperties] \n\ - this.fn = fn; \n\ - this.asyncNeeded = true; \n\ - this.now = 0; \n\ - } \n\ - \n\ - [TheName].prototype._callFunction = function(promise) { \n\ - promise._pushContext(); \n\ - var ret = tryCatch(this.fn)([ThePassedArguments]); \n\ - promise._popContext(); \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(ret.e, false); \n\ - } else { \n\ - promise._resolveCallback(ret); \n\ - } \n\ - }; \n\ - \n\ - [TheName].prototype.checkFulfillment = function(promise) { \n\ - var now = ++this.now; \n\ - if (now === [TheTotal]) { \n\ - if (this.asyncNeeded) { \n\ - async.invoke(this._callFunction, this, promise); \n\ - } else { \n\ - this._callFunction(promise); \n\ - } \n\ - \n\ - } \n\ - }; \n\ - \n\ - [TheName].prototype._resultCancelled = function() { \n\ - [CancellationCode] \n\ - }; \n\ - \n\ - return [TheName]; \n\ - }(tryCatch, errorObj, Promise, async); \n\ - "; - - code = code.replace(/\[TheName\]/g, name) - .replace(/\[TheTotal\]/g, total) - .replace(/\[ThePassedArguments\]/g, passedArguments) - .replace(/\[TheProperties\]/g, assignment) - .replace(/\[CancellationCode\]/g, cancellationCode); - - return new Function("tryCatch", "errorObj", "Promise", "async", code) - (tryCatch, errorObj, Promise, async); - }; + units = normalizeUnits(units); - var holderClasses = []; - var thenCallbacks = []; - var promiseSetters = []; + switch (units) { + case 'year': + output = monthDiff(this, that) / 12; + break; + case 'month': + output = monthDiff(this, that); + break; + case 'quarter': + output = monthDiff(this, that) / 3; + break; + case 'second': + output = (this - that) / 1e3; + break; // 1000 + case 'minute': + output = (this - that) / 6e4; + break; // 1000 * 60 + case 'hour': + output = (this - that) / 36e5; + break; // 1000 * 60 * 60 + case 'day': + output = (this - that - zoneDelta) / 864e5; + break; // 1000 * 60 * 60 * 24, negate dst + case 'week': + output = (this - that - zoneDelta) / 6048e5; + break; // 1000 * 60 * 60 * 24 * 7, negate dst + default: + output = this - that; + } - for (var i = 0; i < 8; ++i) { - holderClasses.push(generateHolderClass(i + 1)); - thenCallbacks.push(thenCallback(i + 1)); - promiseSetters.push(promiseSetter(i + 1)); + return asFloat ? output : absFloor(output); } - reject = function (reason) { - this._reject(reason); - }; -}} - -Promise.join = function () { - var last = arguments.length - 1; - var fn; - if (last > 0 && typeof arguments[last] === "function") { - fn = arguments[last]; - if (!true) { - if (last <= 8 && canEvaluate) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var HolderClass = holderClasses[last - 1]; - var holder = new HolderClass(fn); - var callbacks = thenCallbacks; - - for (var i = 0; i < last; ++i) { - var maybePromise = tryConvertToPromise(arguments[i], ret); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - maybePromise._then(callbacks[i], reject, - undefined, ret, holder); - promiseSetters[i](maybePromise, holder); - holder.asyncNeeded = false; - } else if (((bitField & 33554432) !== 0)) { - callbacks[i].call(ret, - maybePromise._value(), holder); - } else if (((bitField & 16777216) !== 0)) { - ret._reject(maybePromise._reason()); - } else { - ret._cancel(); - } - } else { - callbacks[i].call(ret, maybePromise, holder); - } - } + function monthDiff(a, b) { + if (a.date() < b.date()) { + // end-of-month calculations work correct when the start month has more + // days than the end month. + return -monthDiff(b, a); + } + // difference in months + var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), + // b is in (anchor - 1 month, anchor + 1 month) + anchor = a.clone().add(wholeMonthDiff, 'months'), + anchor2, + adjust; - if (!ret._isFateSealed()) { - if (holder.asyncNeeded) { - var context = Promise._getContext(); - holder.fn = util.contextBind(context, holder.fn); - } - ret._setAsyncGuaranteed(); - ret._setOnCancel(holder); - } - return ret; - } + if (b - anchor < 0) { + anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor - anchor2); + } else { + anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor2 - anchor); } + + //check for negative zero, return zero if negative zero + return -(wholeMonthDiff + adjust) || 0; } - var args = [].slice.call(arguments);; - if (fn) args.pop(); - var ret = new PromiseArray(args).promise(); - return fn !== undefined ? ret.spread(fn) : ret; -}; -}; + hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; + hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; -},{"./util":36}],18:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL, - debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var async = Promise._async; + function toString() { + return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); + } -function MappingPromiseArray(promises, fn, limit, _filter) { - this.constructor$(promises); - this._promise._captureStackTrace(); - var context = Promise._getContext(); - this._callback = util.contextBind(context, fn); - this._preservedValues = _filter === INTERNAL - ? new Array(this.length()) - : null; - this._limit = limit; - this._inFlight = 0; - this._queue = []; - async.invoke(this._asyncInit, this, undefined); - if (util.isArray(promises)) { - for (var i = 0; i < promises.length; ++i) { - var maybePromise = promises[i]; - if (maybePromise instanceof Promise) { - maybePromise.suppressUnhandledRejections(); + function toISOString(keepOffset) { + if (!this.isValid()) { + return null; + } + var utc = keepOffset !== true, + m = utc ? this.clone().utc() : this; + if (m.year() < 0 || m.year() > 9999) { + return formatMoment( + m, + utc + ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' + : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ' + ); + } + if (isFunction(Date.prototype.toISOString)) { + // native implementation is ~50x faster, use it when we can + if (utc) { + return this.toDate().toISOString(); + } else { + return new Date(this.valueOf() + this.utcOffset() * 60 * 1000) + .toISOString() + .replace('Z', formatMoment(m, 'Z')); } } + return formatMoment( + m, + utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ' + ); } -} -util.inherits(MappingPromiseArray, PromiseArray); - -MappingPromiseArray.prototype._asyncInit = function() { - this._init$(undefined, -2); -}; - -MappingPromiseArray.prototype._init = function () {}; - -MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - var length = this.length(); - var preservedValues = this._preservedValues; - var limit = this._limit; - if (index < 0) { - index = (index * -1) - 1; - values[index] = value; - if (limit >= 1) { - this._inFlight--; - this._drainQueue(); - if (this._isResolved()) return true; + /** + * Return a human readable representation of a moment that can + * also be evaluated to get a new moment which is the same + * + * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects + */ + function inspect() { + if (!this.isValid()) { + return 'moment.invalid(/* ' + this._i + ' */)'; } - } else { - if (limit >= 1 && this._inFlight >= limit) { - values[index] = value; - this._queue.push(index); - return false; + var func = 'moment', + zone = '', + prefix, + year, + datetime, + suffix; + if (!this.isLocal()) { + func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; + zone = 'Z'; } - if (preservedValues !== null) preservedValues[index] = value; + prefix = '[' + func + '("]'; + year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; + datetime = '-MM-DD[T]HH:mm:ss.SSS'; + suffix = zone + '[")]'; - var promise = this._promise; - var callback = this._callback; - var receiver = promise._boundValue(); - promise._pushContext(); - var ret = tryCatch(callback).call(receiver, value, index, length); - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, - promiseCreated, - preservedValues !== null ? "Promise.filter" : "Promise.map", - promise - ); - if (ret === errorObj) { - this._reject(ret.e); - return true; - } + return this.format(prefix + year + datetime + suffix); + } - var maybePromise = tryConvertToPromise(ret, this._promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - var bitField = maybePromise._bitField; - ; - if (((bitField & 50397184) === 0)) { - if (limit >= 1) this._inFlight++; - values[index] = maybePromise; - maybePromise._proxy(this, (index + 1) * -1); - return false; - } else if (((bitField & 33554432) !== 0)) { - ret = maybePromise._value(); - } else if (((bitField & 16777216) !== 0)) { - this._reject(maybePromise._reason()); - return true; - } else { - this._cancel(); - return true; - } + function format(inputString) { + if (!inputString) { + inputString = this.isUtc() + ? hooks.defaultFormatUtc + : hooks.defaultFormat; } - values[index] = ret; + var output = formatMoment(this, inputString); + return this.localeData().postformat(output); } - var totalResolved = ++this._totalResolved; - if (totalResolved >= length) { - if (preservedValues !== null) { - this._filter(values, preservedValues); + + function from(time, withoutSuffix) { + if ( + this.isValid() && + ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) + ) { + return createDuration({ to: this, from: time }) + .locale(this.locale()) + .humanize(!withoutSuffix); } else { - this._resolve(values); + return this.localeData().invalidDate(); } - return true; } - return false; -}; -MappingPromiseArray.prototype._drainQueue = function () { - var queue = this._queue; - var limit = this._limit; - var values = this._values; - while (queue.length > 0 && this._inFlight < limit) { - if (this._isResolved()) return; - var index = queue.pop(); - this._promiseFulfilled(values[index], index); + function fromNow(withoutSuffix) { + return this.from(createLocal(), withoutSuffix); } -}; -MappingPromiseArray.prototype._filter = function (booleans, values) { - var len = values.length; - var ret = new Array(len); - var j = 0; - for (var i = 0; i < len; ++i) { - if (booleans[i]) ret[j++] = values[i]; + function to(time, withoutSuffix) { + if ( + this.isValid() && + ((isMoment(time) && time.isValid()) || createLocal(time).isValid()) + ) { + return createDuration({ from: this, to: time }) + .locale(this.locale()) + .humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } } - ret.length = j; - this._resolve(ret); -}; - -MappingPromiseArray.prototype.preservedValues = function () { - return this._preservedValues; -}; -function map(promises, fn, options, _filter) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); + function toNow(withoutSuffix) { + return this.to(createLocal(), withoutSuffix); } - var limit = 0; - if (options !== undefined) { - if (typeof options === "object" && options !== null) { - if (typeof options.concurrency !== "number") { - return Promise.reject( - new TypeError("'concurrency' must be a number but it is " + - util.classString(options.concurrency))); - } - limit = options.concurrency; + // If passed a locale key, it will set the locale for this + // instance. Otherwise, it will return the locale configuration + // variables for this instance. + function locale(key) { + var newLocaleData; + + if (key === undefined) { + return this._locale._abbr; } else { - return Promise.reject(new TypeError( - "options argument must be an object but it is " + - util.classString(options))); + newLocaleData = getLocale(key); + if (newLocaleData != null) { + this._locale = newLocaleData; + } + return this; } } - limit = typeof limit === "number" && - isFinite(limit) && limit >= 1 ? limit : 0; - return new MappingPromiseArray(promises, fn, limit, _filter).promise(); -} - -Promise.prototype.map = function (fn, options) { - return map(this, fn, options, null); -}; - -Promise.map = function (promises, fn, options, _filter) { - return map(promises, fn, options, _filter); -}; + var lang = deprecate( + 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', + function (key) { + if (key === undefined) { + return this.localeData(); + } else { + return this.locale(key); + } + } + ); -}; + function localeData() { + return this._locale; + } -},{"./util":36}],19:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; + var MS_PER_SECOND = 1000, + MS_PER_MINUTE = 60 * MS_PER_SECOND, + MS_PER_HOUR = 60 * MS_PER_MINUTE, + MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR; -Promise.method = function (fn) { - if (typeof fn !== "function") { - throw new Promise.TypeError("expecting a function but got " + util.classString(fn)); + // actual modulo - handles negative numbers (for dates before 1970): + function mod$1(dividend, divisor) { + return ((dividend % divisor) + divisor) % divisor; } - return function () { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = tryCatch(fn).apply(this, arguments); - var promiseCreated = ret._popContext(); - debug.checkForgottenReturns( - value, promiseCreated, "Promise.method", ret); - ret._resolveFromSyncValue(value); - return ret; - }; -}; -Promise.attempt = Promise["try"] = function (fn) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value; - if (arguments.length > 1) { - debug.deprecated("calling Promise.try with more than 1 argument"); - var arg = arguments[1]; - var ctx = arguments[2]; - value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg) - : tryCatch(fn).call(ctx, arg); - } else { - value = tryCatch(fn)(); + function localStartOfDate(y, m, d) { + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return new Date(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return new Date(y, m, d).valueOf(); + } } - var promiseCreated = ret._popContext(); - debug.checkForgottenReturns( - value, promiseCreated, "Promise.try", ret); - ret._resolveFromSyncValue(value); - return ret; -}; -Promise.prototype._resolveFromSyncValue = function (value) { - if (value === util.errorObj) { - this._rejectCallback(value.e, false); - } else { - this._resolveCallback(value, true); + function utcStartOfDate(y, m, d) { + // Date.UTC remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0) { + // preserve leap years using a full 400 year cycle, then reset + return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS; + } else { + return Date.UTC(y, m, d); + } } -}; -}; -},{"./util":36}],20:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util"); -var maybeWrapAsError = util.maybeWrapAsError; -var errors = _dereq_("./errors"); -var OperationalError = errors.OperationalError; -var es5 = _dereq_("./es5"); + function startOf(units) { + var time, startOfDate; + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; + } -function isUntypedError(obj) { - return obj instanceof Error && - es5.getPrototypeOf(obj) === Error.prototype; -} + startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; -var rErrorKey = /^(?:name|message|stack|cause)$/; -function wrapAsOperationalError(obj) { - var ret; - if (isUntypedError(obj)) { - ret = new OperationalError(obj); - ret.name = obj.name; - ret.message = obj.message; - ret.stack = obj.stack; - var keys = es5.keys(obj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!rErrorKey.test(key)) { - ret[key] = obj[key]; - } + switch (units) { + case 'year': + time = startOfDate(this.year(), 0, 1); + break; + case 'quarter': + time = startOfDate( + this.year(), + this.month() - (this.month() % 3), + 1 + ); + break; + case 'month': + time = startOfDate(this.year(), this.month(), 1); + break; + case 'week': + time = startOfDate( + this.year(), + this.month(), + this.date() - this.weekday() + ); + break; + case 'isoWeek': + time = startOfDate( + this.year(), + this.month(), + this.date() - (this.isoWeekday() - 1) + ); + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date()); + break; + case 'hour': + time = this._d.valueOf(); + time -= mod$1( + time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), + MS_PER_HOUR + ); + break; + case 'minute': + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_MINUTE); + break; + case 'second': + time = this._d.valueOf(); + time -= mod$1(time, MS_PER_SECOND); + break; } - return ret; + + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; } - util.markAsOriginatingFromRejection(obj); - return obj; -} -function nodebackForPromise(promise, multiArgs) { - return function(err, value) { - if (promise === null) return; - if (err) { - var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); - promise._attachExtraTrace(wrapped); - promise._reject(wrapped); - } else if (!multiArgs) { - promise._fulfill(value); - } else { - var args = [].slice.call(arguments, 1);; - promise._fulfill(args); + function endOf(units) { + var time, startOfDate; + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond' || !this.isValid()) { + return this; } - promise = null; - }; -} -module.exports = nodebackForPromise; + startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate; -},{"./errors":12,"./es5":13,"./util":36}],21:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -var util = _dereq_("./util"); -var async = Promise._async; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; + switch (units) { + case 'year': + time = startOfDate(this.year() + 1, 0, 1) - 1; + break; + case 'quarter': + time = + startOfDate( + this.year(), + this.month() - (this.month() % 3) + 3, + 1 + ) - 1; + break; + case 'month': + time = startOfDate(this.year(), this.month() + 1, 1) - 1; + break; + case 'week': + time = + startOfDate( + this.year(), + this.month(), + this.date() - this.weekday() + 7 + ) - 1; + break; + case 'isoWeek': + time = + startOfDate( + this.year(), + this.month(), + this.date() - (this.isoWeekday() - 1) + 7 + ) - 1; + break; + case 'day': + case 'date': + time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; + break; + case 'hour': + time = this._d.valueOf(); + time += + MS_PER_HOUR - + mod$1( + time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), + MS_PER_HOUR + ) - + 1; + break; + case 'minute': + time = this._d.valueOf(); + time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1; + break; + case 'second': + time = this._d.valueOf(); + time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1; + break; + } -function spreadAdapter(val, nodeback) { - var promise = this; - if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); - var ret = - tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val)); - if (ret === errorObj) { - async.throwLater(ret.e); + this._d.setTime(time); + hooks.updateOffset(this, true); + return this; } -} -function successAdapter(val, nodeback) { - var promise = this; - var receiver = promise._boundValue(); - var ret = val === undefined - ? tryCatch(nodeback).call(receiver, null) - : tryCatch(nodeback).call(receiver, null, val); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} -function errorAdapter(reason, nodeback) { - var promise = this; - if (!reason) { - var newReason = new Error(reason + ""); - newReason.cause = reason; - reason = newReason; + function valueOf() { + return this._d.valueOf() - (this._offset || 0) * 60000; } - var ret = tryCatch(nodeback).call(promise._boundValue(), reason); - if (ret === errorObj) { - async.throwLater(ret.e); + + function unix() { + return Math.floor(this.valueOf() / 1000); } -} -Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback, - options) { - if (typeof nodeback == "function") { - var adapter = successAdapter; - if (options !== undefined && Object(options).spread) { - adapter = spreadAdapter; - } - this._then( - adapter, - errorAdapter, - undefined, - this, - nodeback - ); + function toDate() { + return new Date(this.valueOf()); } - return this; -}; -}; -},{"./util":36}],22:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function() { -var makeSelfResolutionError = function () { - return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a"); -}; -var reflectHandler = function() { - return new Promise.PromiseInspection(this._target()); -}; -var apiRejection = function(msg) { - return Promise.reject(new TypeError(msg)); -}; -function Proxyable() {} -var UNDEFINED_BINDING = {}; -var util = _dereq_("./util"); -util.setReflectHandler(reflectHandler); + function toArray() { + var m = this; + return [ + m.year(), + m.month(), + m.date(), + m.hour(), + m.minute(), + m.second(), + m.millisecond(), + ]; + } -var getDomain = function() { - var domain = process.domain; - if (domain === undefined) { - return null; + function toObject() { + var m = this; + return { + years: m.year(), + months: m.month(), + date: m.date(), + hours: m.hours(), + minutes: m.minutes(), + seconds: m.seconds(), + milliseconds: m.milliseconds(), + }; } - return domain; -}; -var getContextDefault = function() { - return null; -}; -var getContextDomain = function() { - return { - domain: getDomain(), - async: null - }; -}; -var AsyncResource = util.isNode && util.nodeSupportsAsyncResource ? - _dereq_("async_hooks").AsyncResource : null; -var getContextAsyncHooks = function() { - return { - domain: getDomain(), - async: new AsyncResource("Bluebird::Promise") - }; -}; -var getContext = util.isNode ? getContextDomain : getContextDefault; -util.notEnumerableProp(Promise, "_getContext", getContext); -var enableAsyncHooks = function() { - getContext = getContextAsyncHooks; - util.notEnumerableProp(Promise, "_getContext", getContextAsyncHooks); -}; -var disableAsyncHooks = function() { - getContext = getContextDomain; - util.notEnumerableProp(Promise, "_getContext", getContextDomain); -}; -var es5 = _dereq_("./es5"); -var Async = _dereq_("./async"); -var async = new Async(); -es5.defineProperty(Promise, "_async", {value: async}); -var errors = _dereq_("./errors"); -var TypeError = Promise.TypeError = errors.TypeError; -Promise.RangeError = errors.RangeError; -var CancellationError = Promise.CancellationError = errors.CancellationError; -Promise.TimeoutError = errors.TimeoutError; -Promise.OperationalError = errors.OperationalError; -Promise.RejectionError = errors.OperationalError; -Promise.AggregateError = errors.AggregateError; -var INTERNAL = function(){}; -var APPLY = {}; -var NEXT_FILTER = {}; -var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL); -var PromiseArray = - _dereq_("./promise_array")(Promise, INTERNAL, - tryConvertToPromise, apiRejection, Proxyable); -var Context = _dereq_("./context")(Promise); - /*jshint unused:false*/ -var createContext = Context.create; + function toJSON() { + // new Date(NaN).toJSON() === null + return this.isValid() ? this.toISOString() : null; + } -var debug = _dereq_("./debuggability")(Promise, Context, - enableAsyncHooks, disableAsyncHooks); -var CapturedTrace = debug.CapturedTrace; -var PassThroughHandlerContext = - _dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); -var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); -var nodebackForPromise = _dereq_("./nodeback"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -function check(self, executor) { - if (self == null || self.constructor !== Promise) { - throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + function isValid$2() { + return isValid(this); } - if (typeof executor !== "function") { - throw new TypeError("expecting a function but got " + util.classString(executor)); + + function parsingFlags() { + return extend({}, getParsingFlags(this)); } -} + function invalidAt() { + return getParsingFlags(this).overflow; + } -function Promise(executor) { - if (executor !== INTERNAL) { - check(this, executor); + function creationData() { + return { + input: this._i, + format: this._f, + locale: this._locale, + isUTC: this._isUTC, + strict: this._strict, + }; } - this._bitField = 0; - this._fulfillmentHandler0 = undefined; - this._rejectionHandler0 = undefined; - this._promise0 = undefined; - this._receiver0 = undefined; - this._resolveFromExecutor(executor); - this._promiseCreated(); - this._fireEvent("promiseCreated", this); -} -Promise.prototype.toString = function () { - return "[object Promise]"; -}; + addFormatToken('N', 0, 0, 'eraAbbr'); + addFormatToken('NN', 0, 0, 'eraAbbr'); + addFormatToken('NNN', 0, 0, 'eraAbbr'); + addFormatToken('NNNN', 0, 0, 'eraName'); + addFormatToken('NNNNN', 0, 0, 'eraNarrow'); -Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { - var len = arguments.length; - if (len > 1) { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (util.isObject(item)) { - catchInstances[j++] = item; + addFormatToken('y', ['y', 1], 'yo', 'eraYear'); + addFormatToken('y', ['yy', 2], 0, 'eraYear'); + addFormatToken('y', ['yyy', 3], 0, 'eraYear'); + addFormatToken('y', ['yyyy', 4], 0, 'eraYear'); + + addRegexToken('N', matchEraAbbr); + addRegexToken('NN', matchEraAbbr); + addRegexToken('NNN', matchEraAbbr); + addRegexToken('NNNN', matchEraName); + addRegexToken('NNNNN', matchEraNarrow); + + addParseToken( + ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], + function (input, array, config, token) { + var era = config._locale.erasParse(input, token, config._strict); + if (era) { + getParsingFlags(config).era = era; } else { - return apiRejection("Catch statement predicate: " + - "expecting an object but got " + util.classString(item)); + getParsingFlags(config).invalidEra = input; } } - catchInstances.length = j; - fn = arguments[i]; + ); - if (typeof fn !== "function") { - throw new TypeError("The last argument to .catch() " + - "must be a function, got " + util.toString(fn)); - } - return this.then(undefined, catchFilter(catchInstances, fn, this)); - } - return this.then(undefined, fn); -}; + addRegexToken('y', matchUnsigned); + addRegexToken('yy', matchUnsigned); + addRegexToken('yyy', matchUnsigned); + addRegexToken('yyyy', matchUnsigned); + addRegexToken('yo', matchEraYearOrdinal); -Promise.prototype.reflect = function () { - return this._then(reflectHandler, - reflectHandler, undefined, this, undefined); -}; + addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR); + addParseToken(['yo'], function (input, array, config, token) { + var match; + if (config._locale._eraYearOrdinalRegex) { + match = input.match(config._locale._eraYearOrdinalRegex); + } -Promise.prototype.then = function (didFulfill, didReject) { - if (debug.warnings() && arguments.length > 0 && - typeof didFulfill !== "function" && - typeof didReject !== "function") { - var msg = ".then() only accepts functions but was passed: " + - util.classString(didFulfill); - if (arguments.length > 1) { - msg += ", " + util.classString(didReject); + if (config._locale.eraYearOrdinalParse) { + array[YEAR] = config._locale.eraYearOrdinalParse(input, match); + } else { + array[YEAR] = parseInt(input, 10); } - this._warn(msg); - } - return this._then(didFulfill, didReject, undefined, undefined, undefined); -}; + }); -Promise.prototype.done = function (didFulfill, didReject) { - var promise = - this._then(didFulfill, didReject, undefined, undefined, undefined); - promise._setIsFinal(); -}; + function localeEras(m, format) { + var i, + l, + date, + eras = this._eras || getLocale('en')._eras; + for (i = 0, l = eras.length; i < l; ++i) { + switch (typeof eras[i].since) { + case 'string': + // truncate time + date = hooks(eras[i].since).startOf('day'); + eras[i].since = date.valueOf(); + break; + } -Promise.prototype.spread = function (fn) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); + switch (typeof eras[i].until) { + case 'undefined': + eras[i].until = +Infinity; + break; + case 'string': + // truncate time + date = hooks(eras[i].until).startOf('day').valueOf(); + eras[i].until = date.valueOf(); + break; + } + } + return eras; } - return this.all()._then(fn, undefined, undefined, APPLY, undefined); -}; -Promise.prototype.toJSON = function () { - var ret = { - isFulfilled: false, - isRejected: false, - fulfillmentValue: undefined, - rejectionReason: undefined - }; - if (this.isFulfilled()) { - ret.fulfillmentValue = this.value(); - ret.isFulfilled = true; - } else if (this.isRejected()) { - ret.rejectionReason = this.reason(); - ret.isRejected = true; - } - return ret; -}; + function localeErasParse(eraName, format, strict) { + var i, + l, + eras = this.eras(), + name, + abbr, + narrow; + eraName = eraName.toUpperCase(); -Promise.prototype.all = function () { - if (arguments.length > 0) { - this._warn(".all() was passed arguments but it does not take any"); - } - return new PromiseArray(this).promise(); -}; + for (i = 0, l = eras.length; i < l; ++i) { + name = eras[i].name.toUpperCase(); + abbr = eras[i].abbr.toUpperCase(); + narrow = eras[i].narrow.toUpperCase(); -Promise.prototype.error = function (fn) { - return this.caught(util.originatesFromRejection, fn); -}; + if (strict) { + switch (format) { + case 'N': + case 'NN': + case 'NNN': + if (abbr === eraName) { + return eras[i]; + } + break; -Promise.getNewLibraryCopy = module.exports; + case 'NNNN': + if (name === eraName) { + return eras[i]; + } + break; -Promise.is = function (val) { - return val instanceof Promise; -}; + case 'NNNNN': + if (narrow === eraName) { + return eras[i]; + } + break; + } + } else if ([name, abbr, narrow].indexOf(eraName) >= 0) { + return eras[i]; + } + } + } -Promise.fromNode = Promise.fromCallback = function(fn) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs - : false; - var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs)); - if (result === errorObj) { - ret._rejectCallback(result.e, true); + function localeErasConvertYear(era, year) { + var dir = era.since <= era.until ? +1 : -1; + if (year === undefined) { + return hooks(era.since).year(); + } else { + return hooks(era.since).year() + (year - era.offset) * dir; + } } - if (!ret._isFateSealed()) ret._setAsyncGuaranteed(); - return ret; -}; -Promise.all = function (promises) { - return new PromiseArray(promises).promise(); -}; + function getEraName() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.clone().startOf('day').valueOf(); -Promise.cast = function (obj) { - var ret = tryConvertToPromise(obj); - if (!(ret instanceof Promise)) { - ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._setFulfilled(); - ret._rejectionHandler0 = obj; + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].name; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].name; + } + } + + return ''; } - return ret; -}; -Promise.resolve = Promise.fulfilled = Promise.cast; + function getEraNarrow() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.clone().startOf('day').valueOf(); -Promise.reject = Promise.rejected = function (reason) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._rejectCallback(reason, true); - return ret; -}; + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].narrow; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].narrow; + } + } -Promise.setScheduler = function(fn) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); + return ''; } - return async.setScheduler(fn); -}; -Promise.prototype._then = function ( - didFulfill, - didReject, - _, receiver, - internalData -) { - var haveInternalData = internalData !== undefined; - var promise = haveInternalData ? internalData : new Promise(INTERNAL); - var target = this._target(); - var bitField = target._bitField; + function getEraAbbr() { + var i, + l, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + // truncate time + val = this.clone().startOf('day').valueOf(); - if (!haveInternalData) { - promise._propagateFrom(this, 3); - promise._captureStackTrace(); - if (receiver === undefined && - ((this._bitField & 2097152) !== 0)) { - if (!((bitField & 50397184) === 0)) { - receiver = this._boundValue(); - } else { - receiver = target === this ? undefined : this._boundTo; + if (eras[i].since <= val && val <= eras[i].until) { + return eras[i].abbr; + } + if (eras[i].until <= val && val <= eras[i].since) { + return eras[i].abbr; } } - this._fireEvent("promiseChained", this, promise); + + return ''; } - var context = getContext(); - if (!((bitField & 50397184) === 0)) { - var handler, value, settler = target._settlePromiseCtx; - if (((bitField & 33554432) !== 0)) { - value = target._rejectionHandler0; - handler = didFulfill; - } else if (((bitField & 16777216) !== 0)) { - value = target._fulfillmentHandler0; - handler = didReject; - target._unsetRejectionIsUnhandled(); + function getEraYear() { + var i, + l, + dir, + val, + eras = this.localeData().eras(); + for (i = 0, l = eras.length; i < l; ++i) { + dir = eras[i].since <= eras[i].until ? +1 : -1; + + // truncate time + val = this.clone().startOf('day').valueOf(); + + if ( + (eras[i].since <= val && val <= eras[i].until) || + (eras[i].until <= val && val <= eras[i].since) + ) { + return ( + (this.year() - hooks(eras[i].since).year()) * dir + + eras[i].offset + ); + } + } + + return this.year(); + } + + function erasNameRegex(isStrict) { + if (!hasOwnProp(this, '_erasNameRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasNameRegex : this._erasRegex; + } + + function erasAbbrRegex(isStrict) { + if (!hasOwnProp(this, '_erasAbbrRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasAbbrRegex : this._erasRegex; + } + + function erasNarrowRegex(isStrict) { + if (!hasOwnProp(this, '_erasNarrowRegex')) { + computeErasParse.call(this); + } + return isStrict ? this._erasNarrowRegex : this._erasRegex; + } + + function matchEraAbbr(isStrict, locale) { + return locale.erasAbbrRegex(isStrict); + } + + function matchEraName(isStrict, locale) { + return locale.erasNameRegex(isStrict); + } + + function matchEraNarrow(isStrict, locale) { + return locale.erasNarrowRegex(isStrict); + } + + function matchEraYearOrdinal(isStrict, locale) { + return locale._eraYearOrdinalRegex || matchUnsigned; + } + + function computeErasParse() { + var abbrPieces = [], + namePieces = [], + narrowPieces = [], + mixedPieces = [], + i, + l, + erasName, + erasAbbr, + erasNarrow, + eras = this.eras(); + + for (i = 0, l = eras.length; i < l; ++i) { + erasName = regexEscape(eras[i].name); + erasAbbr = regexEscape(eras[i].abbr); + erasNarrow = regexEscape(eras[i].narrow); + + namePieces.push(erasName); + abbrPieces.push(erasAbbr); + narrowPieces.push(erasNarrow); + mixedPieces.push(erasName); + mixedPieces.push(erasAbbr); + mixedPieces.push(erasNarrow); + } + + this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i'); + this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i'); + this._erasNarrowRegex = new RegExp( + '^(' + narrowPieces.join('|') + ')', + 'i' + ); + } + + // FORMATTING + + addFormatToken(0, ['gg', 2], 0, function () { + return this.weekYear() % 100; + }); + + addFormatToken(0, ['GG', 2], 0, function () { + return this.isoWeekYear() % 100; + }); + + function addWeekYearFormatToken(token, getter) { + addFormatToken(0, [token, token.length], 0, getter); + } + + addWeekYearFormatToken('gggg', 'weekYear'); + addWeekYearFormatToken('ggggg', 'weekYear'); + addWeekYearFormatToken('GGGG', 'isoWeekYear'); + addWeekYearFormatToken('GGGGG', 'isoWeekYear'); + + // ALIASES + + // PARSING + + addRegexToken('G', matchSigned); + addRegexToken('g', matchSigned); + addRegexToken('GG', match1to2, match2); + addRegexToken('gg', match1to2, match2); + addRegexToken('GGGG', match1to4, match4); + addRegexToken('gggg', match1to4, match4); + addRegexToken('GGGGG', match1to6, match6); + addRegexToken('ggggg', match1to6, match6); + + addWeekParseToken( + ['gggg', 'ggggg', 'GGGG', 'GGGGG'], + function (input, week, config, token) { + week[token.substr(0, 2)] = toInt(input); + } + ); + + addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { + week[token] = hooks.parseTwoDigitYear(input); + }); + + // MOMENTS + + function getSetWeekYear(input) { + return getSetWeekYearHelper.call( + this, + input, + this.week(), + this.weekday() + this.localeData()._week.dow, + this.localeData()._week.dow, + this.localeData()._week.doy + ); + } + + function getSetISOWeekYear(input) { + return getSetWeekYearHelper.call( + this, + input, + this.isoWeek(), + this.isoWeekday(), + 1, + 4 + ); + } + + function getISOWeeksInYear() { + return weeksInYear(this.year(), 1, 4); + } + + function getISOWeeksInISOWeekYear() { + return weeksInYear(this.isoWeekYear(), 1, 4); + } + + function getWeeksInYear() { + var weekInfo = this.localeData()._week; + return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); + } + + function getWeeksInWeekYear() { + var weekInfo = this.localeData()._week; + return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy); + } + + function getSetWeekYearHelper(input, week, weekday, dow, doy) { + var weeksTarget; + if (input == null) { + return weekOfYear(this, dow, doy).year; } else { - settler = target._settlePromiseLateCancellationObserver; - value = new CancellationError("late cancellation observer"); - target._attachExtraTrace(value); - handler = didReject; + weeksTarget = weeksInYear(input, dow, doy); + if (week > weeksTarget) { + week = weeksTarget; + } + return setWeekAll.call(this, input, week, weekday, dow, doy); } + } - async.invoke(settler, target, { - handler: util.contextBind(context, handler), - promise: promise, - receiver: receiver, - value: value - }); - } else { - target._addCallbacks(didFulfill, didReject, promise, - receiver, context); + function setWeekAll(weekYear, week, weekday, dow, doy) { + var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), + date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); + + this.year(date.getUTCFullYear()); + this.month(date.getUTCMonth()); + this.date(date.getUTCDate()); + return this; } - return promise; -}; + // FORMATTING -Promise.prototype._length = function () { - return this._bitField & 65535; -}; + addFormatToken('Q', 0, 'Qo', 'quarter'); -Promise.prototype._isFateSealed = function () { - return (this._bitField & 117506048) !== 0; -}; + // PARSING -Promise.prototype._isFollowing = function () { - return (this._bitField & 67108864) === 67108864; -}; + addRegexToken('Q', match1); + addParseToken('Q', function (input, array) { + array[MONTH] = (toInt(input) - 1) * 3; + }); -Promise.prototype._setLength = function (len) { - this._bitField = (this._bitField & -65536) | - (len & 65535); -}; + // MOMENTS -Promise.prototype._setFulfilled = function () { - this._bitField = this._bitField | 33554432; - this._fireEvent("promiseFulfilled", this); -}; + function getSetQuarter(input) { + return input == null + ? Math.ceil((this.month() + 1) / 3) + : this.month((input - 1) * 3 + (this.month() % 3)); + } -Promise.prototype._setRejected = function () { - this._bitField = this._bitField | 16777216; - this._fireEvent("promiseRejected", this); -}; + // FORMATTING -Promise.prototype._setFollowing = function () { - this._bitField = this._bitField | 67108864; - this._fireEvent("promiseResolved", this); -}; + addFormatToken('D', ['DD', 2], 'Do', 'date'); -Promise.prototype._setIsFinal = function () { - this._bitField = this._bitField | 4194304; -}; + // PARSING -Promise.prototype._isFinal = function () { - return (this._bitField & 4194304) > 0; -}; + addRegexToken('D', match1to2, match1to2NoLeadingZero); + addRegexToken('DD', match1to2, match2); + addRegexToken('Do', function (isStrict, locale) { + // TODO: Remove "ordinalParse" fallback in next major release. + return isStrict + ? locale._dayOfMonthOrdinalParse || locale._ordinalParse + : locale._dayOfMonthOrdinalParseLenient; + }); -Promise.prototype._unsetCancelled = function() { - this._bitField = this._bitField & (~65536); -}; + addParseToken(['D', 'DD'], DATE); + addParseToken('Do', function (input, array) { + array[DATE] = toInt(input.match(match1to2)[0]); + }); -Promise.prototype._setCancelled = function() { - this._bitField = this._bitField | 65536; - this._fireEvent("promiseCancelled", this); -}; + // MOMENTS -Promise.prototype._setWillBeCancelled = function() { - this._bitField = this._bitField | 8388608; -}; + var getSetDayOfMonth = makeGetSet('Date', true); -Promise.prototype._setAsyncGuaranteed = function() { - if (async.hasCustomScheduler()) return; - var bitField = this._bitField; - this._bitField = bitField | - (((bitField & 536870912) >> 2) ^ - 134217728); -}; + // FORMATTING -Promise.prototype._setNoAsyncGuarantee = function() { - this._bitField = (this._bitField | 536870912) & - (~134217728); -}; + addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); -Promise.prototype._receiverAt = function (index) { - var ret = index === 0 ? this._receiver0 : this[ - index * 4 - 4 + 3]; - if (ret === UNDEFINED_BINDING) { - return undefined; - } else if (ret === undefined && this._isBound()) { - return this._boundValue(); + // PARSING + + addRegexToken('DDD', match1to3); + addRegexToken('DDDD', match3); + addParseToken(['DDD', 'DDDD'], function (input, array, config) { + config._dayOfYear = toInt(input); + }); + + // HELPERS + + // MOMENTS + + function getSetDayOfYear(input) { + var dayOfYear = + Math.round( + (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5 + ) + 1; + return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); } - return ret; -}; -Promise.prototype._promiseAt = function (index) { - return this[ - index * 4 - 4 + 2]; -}; + // FORMATTING -Promise.prototype._fulfillmentHandlerAt = function (index) { - return this[ - index * 4 - 4 + 0]; -}; + addFormatToken('m', ['mm', 2], 0, 'minute'); -Promise.prototype._rejectionHandlerAt = function (index) { - return this[ - index * 4 - 4 + 1]; -}; + // PARSING -Promise.prototype._boundValue = function() {}; + addRegexToken('m', match1to2, match1to2HasZero); + addRegexToken('mm', match1to2, match2); + addParseToken(['m', 'mm'], MINUTE); -Promise.prototype._migrateCallback0 = function (follower) { - var bitField = follower._bitField; - var fulfill = follower._fulfillmentHandler0; - var reject = follower._rejectionHandler0; - var promise = follower._promise0; - var receiver = follower._receiverAt(0); - if (receiver === undefined) receiver = UNDEFINED_BINDING; - this._addCallbacks(fulfill, reject, promise, receiver, null); -}; + // MOMENTS -Promise.prototype._migrateCallbackAt = function (follower, index) { - var fulfill = follower._fulfillmentHandlerAt(index); - var reject = follower._rejectionHandlerAt(index); - var promise = follower._promiseAt(index); - var receiver = follower._receiverAt(index); - if (receiver === undefined) receiver = UNDEFINED_BINDING; - this._addCallbacks(fulfill, reject, promise, receiver, null); -}; + var getSetMinute = makeGetSet('Minutes', false); -Promise.prototype._addCallbacks = function ( - fulfill, - reject, - promise, - receiver, - context -) { - var index = this._length(); + // FORMATTING - if (index >= 65535 - 4) { - index = 0; - this._setLength(0); + addFormatToken('s', ['ss', 2], 0, 'second'); + + // PARSING + + addRegexToken('s', match1to2, match1to2HasZero); + addRegexToken('ss', match1to2, match2); + addParseToken(['s', 'ss'], SECOND); + + // MOMENTS + + var getSetSecond = makeGetSet('Seconds', false); + + // FORMATTING + + addFormatToken('S', 0, 0, function () { + return ~~(this.millisecond() / 100); + }); + + addFormatToken(0, ['SS', 2], 0, function () { + return ~~(this.millisecond() / 10); + }); + + addFormatToken(0, ['SSS', 3], 0, 'millisecond'); + addFormatToken(0, ['SSSS', 4], 0, function () { + return this.millisecond() * 10; + }); + addFormatToken(0, ['SSSSS', 5], 0, function () { + return this.millisecond() * 100; + }); + addFormatToken(0, ['SSSSSS', 6], 0, function () { + return this.millisecond() * 1000; + }); + addFormatToken(0, ['SSSSSSS', 7], 0, function () { + return this.millisecond() * 10000; + }); + addFormatToken(0, ['SSSSSSSS', 8], 0, function () { + return this.millisecond() * 100000; + }); + addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { + return this.millisecond() * 1000000; + }); + + // PARSING + + addRegexToken('S', match1to3, match1); + addRegexToken('SS', match1to3, match2); + addRegexToken('SSS', match1to3, match3); + + var token, getSetMillisecond; + for (token = 'SSSS'; token.length <= 9; token += 'S') { + addRegexToken(token, matchUnsigned); } - if (index === 0) { - this._promise0 = promise; - this._receiver0 = receiver; - if (typeof fulfill === "function") { - this._fulfillmentHandler0 = util.contextBind(context, fulfill); - } - if (typeof reject === "function") { - this._rejectionHandler0 = util.contextBind(context, reject); - } - } else { - var base = index * 4 - 4; - this[base + 2] = promise; - this[base + 3] = receiver; - if (typeof fulfill === "function") { - this[base + 0] = - util.contextBind(context, fulfill); - } - if (typeof reject === "function") { - this[base + 1] = - util.contextBind(context, reject); - } + function parseMs(input, array) { + array[MILLISECOND] = toInt(('0.' + input) * 1000); } - this._setLength(index + 1); - return index; -}; -Promise.prototype._proxy = function (proxyable, arg) { - this._addCallbacks(undefined, undefined, arg, proxyable, null); -}; + for (token = 'S'; token.length <= 9; token += 'S') { + addParseToken(token, parseMs); + } -Promise.prototype._resolveCallback = function(value, shouldBind) { - if (((this._bitField & 117506048) !== 0)) return; - if (value === this) - return this._rejectCallback(makeSelfResolutionError(), false); - var maybePromise = tryConvertToPromise(value, this); - if (!(maybePromise instanceof Promise)) return this._fulfill(value); + getSetMillisecond = makeGetSet('Milliseconds', false); - if (shouldBind) this._propagateFrom(maybePromise, 2); + // FORMATTING + addFormatToken('z', 0, 0, 'zoneAbbr'); + addFormatToken('zz', 0, 0, 'zoneName'); - var promise = maybePromise._target(); + // MOMENTS - if (promise === this) { - this._reject(makeSelfResolutionError()); - return; + function getZoneAbbr() { + return this._isUTC ? 'UTC' : ''; } - var bitField = promise._bitField; - if (((bitField & 50397184) === 0)) { - var len = this._length(); - if (len > 0) promise._migrateCallback0(this); - for (var i = 1; i < len; ++i) { - promise._migrateCallbackAt(this, i); - } - this._setFollowing(); - this._setLength(0); - this._setFollowee(maybePromise); - } else if (((bitField & 33554432) !== 0)) { - this._fulfill(promise._value()); - } else if (((bitField & 16777216) !== 0)) { - this._reject(promise._reason()); - } else { - var reason = new CancellationError("late cancellation observer"); - promise._attachExtraTrace(reason); - this._reject(reason); + function getZoneName() { + return this._isUTC ? 'Coordinated Universal Time' : ''; } -}; -Promise.prototype._rejectCallback = -function(reason, synchronous, ignoreNonErrorWarnings) { - var trace = util.ensureErrorObject(reason); - var hasStack = trace === reason; - if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) { - var message = "a promise was rejected with a non-error: " + - util.classString(reason); - this._warn(message, true); + var proto = Moment.prototype; + + proto.add = add; + proto.calendar = calendar$1; + proto.clone = clone; + proto.diff = diff; + proto.endOf = endOf; + proto.format = format; + proto.from = from; + proto.fromNow = fromNow; + proto.to = to; + proto.toNow = toNow; + proto.get = stringGet; + proto.invalidAt = invalidAt; + proto.isAfter = isAfter; + proto.isBefore = isBefore; + proto.isBetween = isBetween; + proto.isSame = isSame; + proto.isSameOrAfter = isSameOrAfter; + proto.isSameOrBefore = isSameOrBefore; + proto.isValid = isValid$2; + proto.lang = lang; + proto.locale = locale; + proto.localeData = localeData; + proto.max = prototypeMax; + proto.min = prototypeMin; + proto.parsingFlags = parsingFlags; + proto.set = stringSet; + proto.startOf = startOf; + proto.subtract = subtract; + proto.toArray = toArray; + proto.toObject = toObject; + proto.toDate = toDate; + proto.toISOString = toISOString; + proto.inspect = inspect; + if (typeof Symbol !== 'undefined' && Symbol.for != null) { + proto[Symbol.for('nodejs.util.inspect.custom')] = function () { + return 'Moment<' + this.format() + '>'; + }; } - this._attachExtraTrace(trace, synchronous ? hasStack : false); - this._reject(reason); -}; + proto.toJSON = toJSON; + proto.toString = toString; + proto.unix = unix; + proto.valueOf = valueOf; + proto.creationData = creationData; + proto.eraName = getEraName; + proto.eraNarrow = getEraNarrow; + proto.eraAbbr = getEraAbbr; + proto.eraYear = getEraYear; + proto.year = getSetYear; + proto.isLeapYear = getIsLeapYear; + proto.weekYear = getSetWeekYear; + proto.isoWeekYear = getSetISOWeekYear; + proto.quarter = proto.quarters = getSetQuarter; + proto.month = getSetMonth; + proto.daysInMonth = getDaysInMonth; + proto.week = proto.weeks = getSetWeek; + proto.isoWeek = proto.isoWeeks = getSetISOWeek; + proto.weeksInYear = getWeeksInYear; + proto.weeksInWeekYear = getWeeksInWeekYear; + proto.isoWeeksInYear = getISOWeeksInYear; + proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear; + proto.date = getSetDayOfMonth; + proto.day = proto.days = getSetDayOfWeek; + proto.weekday = getSetLocaleDayOfWeek; + proto.isoWeekday = getSetISODayOfWeek; + proto.dayOfYear = getSetDayOfYear; + proto.hour = proto.hours = getSetHour; + proto.minute = proto.minutes = getSetMinute; + proto.second = proto.seconds = getSetSecond; + proto.millisecond = proto.milliseconds = getSetMillisecond; + proto.utcOffset = getSetOffset; + proto.utc = setOffsetToUTC; + proto.local = setOffsetToLocal; + proto.parseZone = setOffsetToParsedOffset; + proto.hasAlignedHourOffset = hasAlignedHourOffset; + proto.isDST = isDaylightSavingTime; + proto.isLocal = isLocal; + proto.isUtcOffset = isUtcOffset; + proto.isUtc = isUtc; + proto.isUTC = isUtc; + proto.zoneAbbr = getZoneAbbr; + proto.zoneName = getZoneName; + proto.dates = deprecate( + 'dates accessor is deprecated. Use date instead.', + getSetDayOfMonth + ); + proto.months = deprecate( + 'months accessor is deprecated. Use month instead', + getSetMonth + ); + proto.years = deprecate( + 'years accessor is deprecated. Use year instead', + getSetYear + ); + proto.zone = deprecate( + 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', + getSetZone + ); + proto.isDSTShifted = deprecate( + 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', + isDaylightSavingTimeShifted + ); -Promise.prototype._resolveFromExecutor = function (executor) { - if (executor === INTERNAL) return; - var promise = this; - this._captureStackTrace(); - this._pushContext(); - var synchronous = true; - var r = this._execute(executor, function(value) { - promise._resolveCallback(value); - }, function (reason) { - promise._rejectCallback(reason, synchronous); - }); - synchronous = false; - this._popContext(); + function createUnix(input) { + return createLocal(input * 1000); + } - if (r !== undefined) { - promise._rejectCallback(r, true); + function createInZone() { + return createLocal.apply(null, arguments).parseZone(); } -}; -Promise.prototype._settlePromiseFromHandler = function ( - handler, receiver, value, promise -) { - var bitField = promise._bitField; - if (((bitField & 65536) !== 0)) return; - promise._pushContext(); - var x; - if (receiver === APPLY) { - if (!value || typeof value.length !== "number") { - x = errorObj; - x.e = new TypeError("cannot .spread() a non-array: " + - util.classString(value)); - } else { - x = tryCatch(handler).apply(this._boundValue(), value); - } - } else { - x = tryCatch(handler).call(receiver, value); + function preParsePostFormat(string) { + return string; } - var promiseCreated = promise._popContext(); - bitField = promise._bitField; - if (((bitField & 65536) !== 0)) return; - if (x === NEXT_FILTER) { - promise._reject(value); - } else if (x === errorObj) { - promise._rejectCallback(x.e, false); - } else { - debug.checkForgottenReturns(x, promiseCreated, "", promise, this); - promise._resolveCallback(x); + var proto$1 = Locale.prototype; + + proto$1.calendar = calendar; + proto$1.longDateFormat = longDateFormat; + proto$1.invalidDate = invalidDate; + proto$1.ordinal = ordinal; + proto$1.preparse = preParsePostFormat; + proto$1.postformat = preParsePostFormat; + proto$1.relativeTime = relativeTime; + proto$1.pastFuture = pastFuture; + proto$1.set = set; + proto$1.eras = localeEras; + proto$1.erasParse = localeErasParse; + proto$1.erasConvertYear = localeErasConvertYear; + proto$1.erasAbbrRegex = erasAbbrRegex; + proto$1.erasNameRegex = erasNameRegex; + proto$1.erasNarrowRegex = erasNarrowRegex; + + proto$1.months = localeMonths; + proto$1.monthsShort = localeMonthsShort; + proto$1.monthsParse = localeMonthsParse; + proto$1.monthsRegex = monthsRegex; + proto$1.monthsShortRegex = monthsShortRegex; + proto$1.week = localeWeek; + proto$1.firstDayOfYear = localeFirstDayOfYear; + proto$1.firstDayOfWeek = localeFirstDayOfWeek; + + proto$1.weekdays = localeWeekdays; + proto$1.weekdaysMin = localeWeekdaysMin; + proto$1.weekdaysShort = localeWeekdaysShort; + proto$1.weekdaysParse = localeWeekdaysParse; + + proto$1.weekdaysRegex = weekdaysRegex; + proto$1.weekdaysShortRegex = weekdaysShortRegex; + proto$1.weekdaysMinRegex = weekdaysMinRegex; + + proto$1.isPM = localeIsPM; + proto$1.meridiem = localeMeridiem; + + function get$1(format, index, field, setter) { + var locale = getLocale(), + utc = createUTC().set(setter, index); + return locale[field](utc, format); } -}; -Promise.prototype._target = function() { - var ret = this; - while (ret._isFollowing()) ret = ret._followee(); - return ret; -}; + function listMonthsImpl(format, index, field) { + if (isNumber(format)) { + index = format; + format = undefined; + } -Promise.prototype._followee = function() { - return this._rejectionHandler0; -}; + format = format || ''; -Promise.prototype._setFollowee = function(promise) { - this._rejectionHandler0 = promise; -}; + if (index != null) { + return get$1(format, index, field, 'month'); + } -Promise.prototype._settlePromise = function(promise, handler, receiver, value) { - var isPromise = promise instanceof Promise; - var bitField = this._bitField; - var asyncGuaranteed = ((bitField & 134217728) !== 0); - if (((bitField & 65536) !== 0)) { - if (isPromise) promise._invokeInternalOnCancel(); + var i, + out = []; + for (i = 0; i < 12; i++) { + out[i] = get$1(format, i, field, 'month'); + } + return out; + } - if (receiver instanceof PassThroughHandlerContext && - receiver.isFinallyHandler()) { - receiver.cancelPromise = promise; - if (tryCatch(handler).call(receiver, value) === errorObj) { - promise._reject(errorObj.e); + // () + // (5) + // (fmt, 5) + // (fmt) + // (true) + // (true, 5) + // (true, fmt, 5) + // (true, fmt) + function listWeekdaysImpl(localeSorted, format, index, field) { + if (typeof localeSorted === 'boolean') { + if (isNumber(format)) { + index = format; + format = undefined; } - } else if (handler === reflectHandler) { - promise._fulfill(reflectHandler.call(receiver)); - } else if (receiver instanceof Proxyable) { - receiver._promiseCancelled(promise); - } else if (isPromise || promise instanceof PromiseArray) { - promise._cancel(); - } else { - receiver.cancel(); - } - } else if (typeof handler === "function") { - if (!isPromise) { - handler.call(receiver, value, promise); + + format = format || ''; } else { - if (asyncGuaranteed) promise._setAsyncGuaranteed(); - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (receiver instanceof Proxyable) { - if (!receiver._isResolved()) { - if (((bitField & 33554432) !== 0)) { - receiver._promiseFulfilled(value, promise); - } else { - receiver._promiseRejected(value, promise); + format = localeSorted; + index = format; + localeSorted = false; + + if (isNumber(format)) { + index = format; + format = undefined; } + + format = format || ''; } - } else if (isPromise) { - if (asyncGuaranteed) promise._setAsyncGuaranteed(); - if (((bitField & 33554432) !== 0)) { - promise._fulfill(value); - } else { - promise._reject(value); + + var locale = getLocale(), + shift = localeSorted ? locale._week.dow : 0, + i, + out = []; + + if (index != null) { + return get$1(format, (index + shift) % 7, field, 'day'); } - } -}; -Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) { - var handler = ctx.handler; - var promise = ctx.promise; - var receiver = ctx.receiver; - var value = ctx.value; - if (typeof handler === "function") { - if (!(promise instanceof Promise)) { - handler.call(receiver, value, promise); - } else { - this._settlePromiseFromHandler(handler, receiver, value, promise); + for (i = 0; i < 7; i++) { + out[i] = get$1(format, (i + shift) % 7, field, 'day'); } - } else if (promise instanceof Promise) { - promise._reject(value); + return out; } -}; -Promise.prototype._settlePromiseCtx = function(ctx) { - this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value); -}; + function listMonths(format, index) { + return listMonthsImpl(format, index, 'months'); + } -Promise.prototype._settlePromise0 = function(handler, value, bitField) { - var promise = this._promise0; - var receiver = this._receiverAt(0); - this._promise0 = undefined; - this._receiver0 = undefined; - this._settlePromise(promise, handler, receiver, value); -}; + function listMonthsShort(format, index) { + return listMonthsImpl(format, index, 'monthsShort'); + } -Promise.prototype._clearCallbackDataAtIndex = function(index) { - var base = index * 4 - 4; - this[base + 2] = - this[base + 3] = - this[base + 0] = - this[base + 1] = undefined; -}; + function listWeekdays(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); + } -Promise.prototype._fulfill = function (value) { - var bitField = this._bitField; - if (((bitField & 117506048) >>> 16)) return; - if (value === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._reject(err); + function listWeekdaysShort(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); } - this._setFulfilled(); - this._rejectionHandler0 = value; - if ((bitField & 65535) > 0) { - if (((bitField & 134217728) !== 0)) { - this._settlePromises(); - } else { - async.settlePromises(this); - } - this._dereferenceTrace(); + function listWeekdaysMin(localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); } -}; -Promise.prototype._reject = function (reason) { - var bitField = this._bitField; - if (((bitField & 117506048) >>> 16)) return; - this._setRejected(); - this._fulfillmentHandler0 = reason; + getSetGlobalLocale('en', { + eras: [ + { + since: '0001-01-01', + until: +Infinity, + offset: 1, + name: 'Anno Domini', + narrow: 'AD', + abbr: 'AD', + }, + { + since: '0000-12-31', + until: -Infinity, + offset: 1, + name: 'Before Christ', + narrow: 'BC', + abbr: 'BC', + }, + ], + dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal: function (number) { + var b = number % 10, + output = + toInt((number % 100) / 10) === 1 + ? 'th' + : b === 1 + ? 'st' + : b === 2 + ? 'nd' + : b === 3 + ? 'rd' + : 'th'; + return number + output; + }, + }); - if (this._isFinal()) { - return async.fatalError(reason, util.isNode); + // Side effect imports + + hooks.lang = deprecate( + 'moment.lang is deprecated. Use moment.locale instead.', + getSetGlobalLocale + ); + hooks.langData = deprecate( + 'moment.langData is deprecated. Use moment.localeData instead.', + getLocale + ); + + var mathAbs = Math.abs; + + function abs() { + var data = this._data; + + this._milliseconds = mathAbs(this._milliseconds); + this._days = mathAbs(this._days); + this._months = mathAbs(this._months); + + data.milliseconds = mathAbs(data.milliseconds); + data.seconds = mathAbs(data.seconds); + data.minutes = mathAbs(data.minutes); + data.hours = mathAbs(data.hours); + data.months = mathAbs(data.months); + data.years = mathAbs(data.years); + + return this; + } + + function addSubtract$1(duration, input, value, direction) { + var other = createDuration(input, value); + + duration._milliseconds += direction * other._milliseconds; + duration._days += direction * other._days; + duration._months += direction * other._months; + + return duration._bubble(); + } + + // supports only 2.0-style add(1, 's') or add(duration) + function add$1(input, value) { + return addSubtract$1(this, input, value, 1); + } + + // supports only 2.0-style subtract(1, 's') or subtract(duration) + function subtract$1(input, value) { + return addSubtract$1(this, input, value, -1); + } + + function absCeil(number) { + if (number < 0) { + return Math.floor(number); + } else { + return Math.ceil(number); + } + } + + function bubble() { + var milliseconds = this._milliseconds, + days = this._days, + months = this._months, + data = this._data, + seconds, + minutes, + hours, + years, + monthsFromDays; + + // if we have a mix of positive and negative values, bubble down first + // check: https://github.com/moment/moment/issues/2166 + if ( + !( + (milliseconds >= 0 && days >= 0 && months >= 0) || + (milliseconds <= 0 && days <= 0 && months <= 0) + ) + ) { + milliseconds += absCeil(monthsToDays(months) + days) * 864e5; + days = 0; + months = 0; + } + + // The following code bubbles up values, see the tests for + // examples of what that means. + data.milliseconds = milliseconds % 1000; + + seconds = absFloor(milliseconds / 1000); + data.seconds = seconds % 60; + + minutes = absFloor(seconds / 60); + data.minutes = minutes % 60; + + hours = absFloor(minutes / 60); + data.hours = hours % 24; + + days += absFloor(hours / 24); + + // convert days to months + monthsFromDays = absFloor(daysToMonths(days)); + months += monthsFromDays; + days -= absCeil(monthsToDays(monthsFromDays)); + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + data.days = days; + data.months = months; + data.years = years; + + return this; + } + + function daysToMonths(days) { + // 400 years have 146097 days (taking into account leap year rules) + // 400 years have 12 months === 4800 + return (days * 4800) / 146097; + } + + function monthsToDays(months) { + // the reverse of daysToMonths + return (months * 146097) / 4800; + } + + function as(units) { + if (!this.isValid()) { + return NaN; + } + var days, + months, + milliseconds = this._milliseconds; + + units = normalizeUnits(units); + + if (units === 'month' || units === 'quarter' || units === 'year') { + days = this._days + milliseconds / 864e5; + months = this._months + daysToMonths(days); + switch (units) { + case 'month': + return months; + case 'quarter': + return months / 3; + case 'year': + return months / 12; + } + } else { + // handle milliseconds separately because of floating point math errors (issue #1867) + days = this._days + Math.round(monthsToDays(this._months)); + switch (units) { + case 'week': + return days / 7 + milliseconds / 6048e5; + case 'day': + return days + milliseconds / 864e5; + case 'hour': + return days * 24 + milliseconds / 36e5; + case 'minute': + return days * 1440 + milliseconds / 6e4; + case 'second': + return days * 86400 + milliseconds / 1000; + // Math.floor prevents floating point math errors here + case 'millisecond': + return Math.floor(days * 864e5) + milliseconds; + default: + throw new Error('Unknown unit ' + units); + } + } + } + + function makeAs(alias) { + return function () { + return this.as(alias); + }; + } + + var asMilliseconds = makeAs('ms'), + asSeconds = makeAs('s'), + asMinutes = makeAs('m'), + asHours = makeAs('h'), + asDays = makeAs('d'), + asWeeks = makeAs('w'), + asMonths = makeAs('M'), + asQuarters = makeAs('Q'), + asYears = makeAs('y'), + valueOf$1 = asMilliseconds; + + function clone$1() { + return createDuration(this); + } + + function get$2(units) { + units = normalizeUnits(units); + return this.isValid() ? this[units + 's']() : NaN; + } + + function makeGetter(name) { + return function () { + return this.isValid() ? this._data[name] : NaN; + }; + } + + var milliseconds = makeGetter('milliseconds'), + seconds = makeGetter('seconds'), + minutes = makeGetter('minutes'), + hours = makeGetter('hours'), + days = makeGetter('days'), + months = makeGetter('months'), + years = makeGetter('years'); + + function weeks() { + return absFloor(this.days() / 7); + } + + var round = Math.round, + thresholds = { + ss: 44, // a few seconds to seconds + s: 45, // seconds to minute + m: 45, // minutes to hour + h: 22, // hours to day + d: 26, // days to month/week + w: null, // weeks to month + M: 11, // months to year + }; + + // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize + function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { + return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); + } + + function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) { + var duration = createDuration(posNegDuration).abs(), + seconds = round(duration.as('s')), + minutes = round(duration.as('m')), + hours = round(duration.as('h')), + days = round(duration.as('d')), + months = round(duration.as('M')), + weeks = round(duration.as('w')), + years = round(duration.as('y')), + a = + (seconds <= thresholds.ss && ['s', seconds]) || + (seconds < thresholds.s && ['ss', seconds]) || + (minutes <= 1 && ['m']) || + (minutes < thresholds.m && ['mm', minutes]) || + (hours <= 1 && ['h']) || + (hours < thresholds.h && ['hh', hours]) || + (days <= 1 && ['d']) || + (days < thresholds.d && ['dd', days]); + + if (thresholds.w != null) { + a = + a || + (weeks <= 1 && ['w']) || + (weeks < thresholds.w && ['ww', weeks]); + } + a = a || + (months <= 1 && ['M']) || + (months < thresholds.M && ['MM', months]) || + (years <= 1 && ['y']) || ['yy', years]; + + a[2] = withoutSuffix; + a[3] = +posNegDuration > 0; + a[4] = locale; + return substituteTimeAgo.apply(null, a); + } + + // This function allows you to set the rounding function for relative time strings + function getSetRelativeTimeRounding(roundingFunction) { + if (roundingFunction === undefined) { + return round; + } + if (typeof roundingFunction === 'function') { + round = roundingFunction; + return true; + } + return false; + } + + // This function allows you to set a threshold for relative time strings + function getSetRelativeTimeThreshold(threshold, limit) { + if (thresholds[threshold] === undefined) { + return false; + } + if (limit === undefined) { + return thresholds[threshold]; + } + thresholds[threshold] = limit; + if (threshold === 's') { + thresholds.ss = limit - 1; + } + return true; + } + + function humanize(argWithSuffix, argThresholds) { + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var withSuffix = false, + th = thresholds, + locale, + output; + + if (typeof argWithSuffix === 'object') { + argThresholds = argWithSuffix; + argWithSuffix = false; + } + if (typeof argWithSuffix === 'boolean') { + withSuffix = argWithSuffix; + } + if (typeof argThresholds === 'object') { + th = Object.assign({}, thresholds, argThresholds); + if (argThresholds.s != null && argThresholds.ss == null) { + th.ss = argThresholds.s - 1; + } + } + + locale = this.localeData(); + output = relativeTime$1(this, !withSuffix, th, locale); + + if (withSuffix) { + output = locale.pastFuture(+this, output); + } + + return locale.postformat(output); + } + + var abs$1 = Math.abs; + + function sign(x) { + return (x > 0) - (x < 0) || +x; + } + + function toISOString$1() { + // for ISO strings we do not use the normal bubbling rules: + // * milliseconds bubble up until they become hours + // * days do not bubble at all + // * months bubble up until they become years + // This is because there is no context-free conversion between hours and days + // (think of clock changes) + // and also not between days and months (28-31 days per month) + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var seconds = abs$1(this._milliseconds) / 1000, + days = abs$1(this._days), + months = abs$1(this._months), + minutes, + hours, + years, + s, + total = this.asSeconds(), + totalSign, + ymSign, + daysSign, + hmsSign; + + if (!total) { + // this is the same as C#'s (Noda) and python (isodate)... + // but not other JS (goog.date) + return 'P0D'; + } + + // 3600 seconds -> 60 minutes -> 1 hour + minutes = absFloor(seconds / 60); + hours = absFloor(minutes / 60); + seconds %= 60; + minutes %= 60; + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js + s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; + + totalSign = total < 0 ? '-' : ''; + ymSign = sign(this._months) !== sign(total) ? '-' : ''; + daysSign = sign(this._days) !== sign(total) ? '-' : ''; + hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; + + return ( + totalSign + + 'P' + + (years ? ymSign + years + 'Y' : '') + + (months ? ymSign + months + 'M' : '') + + (days ? daysSign + days + 'D' : '') + + (hours || minutes || seconds ? 'T' : '') + + (hours ? hmsSign + hours + 'H' : '') + + (minutes ? hmsSign + minutes + 'M' : '') + + (seconds ? hmsSign + s + 'S' : '') + ); + } + + var proto$2 = Duration.prototype; + + proto$2.isValid = isValid$1; + proto$2.abs = abs; + proto$2.add = add$1; + proto$2.subtract = subtract$1; + proto$2.as = as; + proto$2.asMilliseconds = asMilliseconds; + proto$2.asSeconds = asSeconds; + proto$2.asMinutes = asMinutes; + proto$2.asHours = asHours; + proto$2.asDays = asDays; + proto$2.asWeeks = asWeeks; + proto$2.asMonths = asMonths; + proto$2.asQuarters = asQuarters; + proto$2.asYears = asYears; + proto$2.valueOf = valueOf$1; + proto$2._bubble = bubble; + proto$2.clone = clone$1; + proto$2.get = get$2; + proto$2.milliseconds = milliseconds; + proto$2.seconds = seconds; + proto$2.minutes = minutes; + proto$2.hours = hours; + proto$2.days = days; + proto$2.weeks = weeks; + proto$2.months = months; + proto$2.years = years; + proto$2.humanize = humanize; + proto$2.toISOString = toISOString$1; + proto$2.toString = toISOString$1; + proto$2.toJSON = toISOString$1; + proto$2.locale = locale; + proto$2.localeData = localeData; + + proto$2.toIsoString = deprecate( + 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', + toISOString$1 + ); + proto$2.lang = lang; + + // FORMATTING + + addFormatToken('X', 0, 0, 'unix'); + addFormatToken('x', 0, 0, 'valueOf'); + + // PARSING + + addRegexToken('x', matchSigned); + addRegexToken('X', matchTimestamp); + addParseToken('X', function (input, array, config) { + config._d = new Date(parseFloat(input) * 1000); + }); + addParseToken('x', function (input, array, config) { + config._d = new Date(toInt(input)); + }); + + //! moment.js + + hooks.version = '2.30.1'; + + setHookCallback(createLocal); + + hooks.fn = proto; + hooks.min = min; + hooks.max = max; + hooks.now = now; + hooks.utc = createUTC; + hooks.unix = createUnix; + hooks.months = listMonths; + hooks.isDate = isDate; + hooks.locale = getSetGlobalLocale; + hooks.invalid = createInvalid; + hooks.duration = createDuration; + hooks.isMoment = isMoment; + hooks.weekdays = listWeekdays; + hooks.parseZone = createInZone; + hooks.localeData = getLocale; + hooks.isDuration = isDuration; + hooks.monthsShort = listMonthsShort; + hooks.weekdaysMin = listWeekdaysMin; + hooks.defineLocale = defineLocale; + hooks.updateLocale = updateLocale; + hooks.locales = listLocales; + hooks.weekdaysShort = listWeekdaysShort; + hooks.normalizeUnits = normalizeUnits; + hooks.relativeTimeRounding = getSetRelativeTimeRounding; + hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; + hooks.calendarFormat = getCalendarFormat; + hooks.prototype = proto; + + // currently HTML5 input type only supports 24-hour formats + hooks.HTML5_FMT = { + DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // + DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // + DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // + DATE: 'YYYY-MM-DD', // + TIME: 'HH:mm', // + TIME_SECONDS: 'HH:mm:ss', // + TIME_MS: 'HH:mm:ss.SSS', // + WEEK: 'GGGG-[W]WW', // + MONTH: 'YYYY-MM', // + }; + + return hooks; + +}))); + +; +//! moment.js locale configuration +//! locale : Danish [da] +//! author : Ulrik Nielsen : https://github.com/mrbase + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : + typeof define === 'function' && define.amd ? define(['../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + //! moment.js locale configuration + + var da = moment.defineLocale('da', { + months: 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), + weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), + weekdaysShort: 'søn_man_tir_ons_tor_fre_lør'.split('_'), + weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd [d.] D. MMMM YYYY [kl.] HH:mm', + }, + calendar: { + sameDay: '[i dag kl.] LT', + nextDay: '[i morgen kl.] LT', + nextWeek: 'på dddd [kl.] LT', + lastDay: '[i går kl.] LT', + lastWeek: '[i] dddd[s kl.] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'om %s', + past: '%s siden', + s: 'få sekunder', + ss: '%d sekunder', + m: 'et minut', + mm: '%d minutter', + h: 'en time', + hh: '%d timer', + d: 'en dag', + dd: '%d dage', + M: 'en måned', + MM: '%d måneder', + y: 'et år', + yy: '%d år', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + return da; + +}))); + +; +//! moment.js locale configuration +//! locale : German [de] +//! author : lluchs : https://github.com/lluchs +//! author: Menelion Elensúle: https://github.com/Oire +//! author : Mikolaj Dadela : https://github.com/mik01aj + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : + typeof define === 'function' && define.amd ? define(['../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + //! moment.js locale configuration + + function processRelativeTime(number, withoutSuffix, key, isFuture) { + var format = { + m: ['eine Minute', 'einer Minute'], + h: ['eine Stunde', 'einer Stunde'], + d: ['ein Tag', 'einem Tag'], + dd: [number + ' Tage', number + ' Tagen'], + w: ['eine Woche', 'einer Woche'], + M: ['ein Monat', 'einem Monat'], + MM: [number + ' Monate', number + ' Monaten'], + y: ['ein Jahr', 'einem Jahr'], + yy: [number + ' Jahre', number + ' Jahren'], + }; + return withoutSuffix ? format[key][0] : format[key][1]; + } + + var de = moment.defineLocale('de', { + months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split( + '_' + ), + monthsShort: + 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'), + monthsParseExact: true, + weekdays: + 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split( + '_' + ), + weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'), + weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY HH:mm', + LLLL: 'dddd, D. MMMM YYYY HH:mm', + }, + calendar: { + sameDay: '[heute um] LT [Uhr]', + sameElse: 'L', + nextDay: '[morgen um] LT [Uhr]', + nextWeek: 'dddd [um] LT [Uhr]', + lastDay: '[gestern um] LT [Uhr]', + lastWeek: '[letzten] dddd [um] LT [Uhr]', + }, + relativeTime: { + future: 'in %s', + past: 'vor %s', + s: 'ein paar Sekunden', + ss: '%d Sekunden', + m: processRelativeTime, + mm: '%d Minuten', + h: processRelativeTime, + hh: '%d Stunden', + d: processRelativeTime, + dd: processRelativeTime, + w: processRelativeTime, + ww: '%d Wochen', + M: processRelativeTime, + MM: processRelativeTime, + y: processRelativeTime, + yy: processRelativeTime, + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + return de; + +}))); + +; +//! moment.js locale configuration +//! locale : Swedish [sv] +//! author : Jens Alm : https://github.com/ulmus + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : + typeof define === 'function' && define.amd ? define(['../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + //! moment.js locale configuration + + var sv = moment.defineLocale('sv', { + months: 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'), + weekdays: 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'), + weekdaysShort: 'sön_mån_tis_ons_tor_fre_lör'.split('_'), + weekdaysMin: 'sö_må_ti_on_to_fr_lö'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'YYYY-MM-DD', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY [kl.] HH:mm', + LLLL: 'dddd D MMMM YYYY [kl.] HH:mm', + lll: 'D MMM YYYY HH:mm', + llll: 'ddd D MMM YYYY HH:mm', + }, + calendar: { + sameDay: '[Idag] LT', + nextDay: '[Imorgon] LT', + lastDay: '[Igår] LT', + nextWeek: '[På] dddd LT', + lastWeek: '[I] dddd[s] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'om %s', + past: 'för %s sedan', + s: 'några sekunder', + ss: '%d sekunder', + m: 'en minut', + mm: '%d minuter', + h: 'en timme', + hh: '%d timmar', + d: 'en dag', + dd: '%d dagar', + M: 'en månad', + MM: '%d månader', + y: 'ett år', + yy: '%d år', + }, + dayOfMonthOrdinalParse: /\d{1,2}(\:e|\:a)/, + ordinal: function (number) { + var b = number % 10, + output = + ~~((number % 100) / 10) === 1 + ? ':e' + : b === 1 + ? ':a' + : b === 2 + ? ':a' + : b === 3 + ? ':e' + : ':e'; + return number + output; + }, + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + return sv; + +}))); + +; +//! moment.js locale configuration +//! locale : Norwegian Bokmål [nb] +//! authors : Espen Hovlandsdal : https://github.com/rexxars +//! Sigurd Gartmann : https://github.com/sigurdga +//! Stephen Ramthun : https://github.com/stephenramthun + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : + typeof define === 'function' && define.amd ? define(['../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + //! moment.js locale configuration + + var nb = moment.defineLocale('nb', { + months: 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split( + '_' + ), + monthsShort: + 'jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.'.split('_'), + monthsParseExact: true, + weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'), + weekdaysShort: 'sø._ma._ti._on._to._fr._lø.'.split('_'), + weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'), + weekdaysParseExact: true, + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD.MM.YYYY', + LL: 'D. MMMM YYYY', + LLL: 'D. MMMM YYYY [kl.] HH:mm', + LLLL: 'dddd D. MMMM YYYY [kl.] HH:mm', + }, + calendar: { + sameDay: '[i dag kl.] LT', + nextDay: '[i morgen kl.] LT', + nextWeek: 'dddd [kl.] LT', + lastDay: '[i går kl.] LT', + lastWeek: '[forrige] dddd [kl.] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'om %s', + past: '%s siden', + s: 'noen sekunder', + ss: '%d sekunder', + m: 'ett minutt', + mm: '%d minutter', + h: 'én time', + hh: '%d timer', + d: 'én dag', + dd: '%d dager', + w: 'én uke', + ww: '%d uker', + M: 'én måned', + MM: '%d måneder', + y: 'ett år', + yy: '%d år', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + return nb; + +}))); + +; +//! moment.js locale configuration +//! locale : Faroese [fo] +//! author : Ragnar Johannesen : https://github.com/ragnar123 +//! author : Kristian Sakarisson : https://github.com/sakarisson + +;(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : + typeof define === 'function' && define.amd ? define(['../moment'], factory) : + factory(global.moment) +}(this, (function (moment) { 'use strict'; + + //! moment.js locale configuration + + var fo = moment.defineLocale('fo', { + months: 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split( + '_' + ), + monthsShort: 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'), + weekdays: + 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split( + '_' + ), + weekdaysShort: 'sun_mán_týs_mik_hós_frí_ley'.split('_'), + weekdaysMin: 'su_má_tý_mi_hó_fr_le'.split('_'), + longDateFormat: { + LT: 'HH:mm', + LTS: 'HH:mm:ss', + L: 'DD/MM/YYYY', + LL: 'D MMMM YYYY', + LLL: 'D MMMM YYYY HH:mm', + LLLL: 'dddd D. MMMM, YYYY HH:mm', + }, + calendar: { + sameDay: '[Í dag kl.] LT', + nextDay: '[Í morgin kl.] LT', + nextWeek: 'dddd [kl.] LT', + lastDay: '[Í gjár kl.] LT', + lastWeek: '[síðstu] dddd [kl] LT', + sameElse: 'L', + }, + relativeTime: { + future: 'um %s', + past: '%s síðani', + s: 'fá sekund', + ss: '%d sekundir', + m: 'ein minuttur', + mm: '%d minuttir', + h: 'ein tími', + hh: '%d tímar', + d: 'ein dagur', + dd: '%d dagar', + M: 'ein mánaður', + MM: '%d mánaðir', + y: 'eitt ár', + yy: '%d ár', + }, + dayOfMonthOrdinalParse: /\d{1,2}\./, + ordinal: '%d.', + week: { + dow: 1, // Monday is the first day of the week. + doy: 4, // The week that contains Jan 4th is the first week of the year. + }, + }); + + return fo; + +}))); + +; +(function() { + + var moment = (typeof require !== "undefined" && require !== null) && !require.amd ? require("moment") : this.moment; + + moment.fn.round = function(precision, key, direction) { + if(typeof direction === 'undefined') { + direction = 'round'; + } + + var keys = ['Hours', 'Minutes', 'Seconds', 'Milliseconds']; + var maxValues = [24, 60, 60, 1000]; + + // Capitalize first letter + key = key.charAt(0).toUpperCase() + key.slice(1).toLowerCase(); + + // make sure key is plural + if (key.indexOf('s', key.length - 1) === -1) { + key += 's'; + } + var value = 0; + var rounded = false; + var subRatio = 1; + var maxValue ; + for (var i in keys) { + var k = keys[i]; + if (k === key) { + value = this._d['get' + key](); + maxValue = maxValues[i]; + rounded = true; + } else if(rounded) { + subRatio *= maxValues[i]; + value += this._d['get' + k]() / subRatio; + this._d['set' + k](0); + } + }; + + value = Math[direction](value / precision) * precision; + value = Math.min(value, maxValue); + this._d['set' + key](value); + + return this; + } + + moment.fn.ceil = function(precision, key) { + return this.round(precision, key, 'ceil'); + } + + moment.fn.floor = function(precision, key) { + return this.round(precision, key, 'floor'); + } + + if ((typeof module !== "undefined" && module !== null ? module.exports : void 0) != null) { + module.exports = moment; + } +}).call(this); +; +/* @preserve + * The MIT License (MIT) + * + * Copyright (c) 2013-2018 Petka Antonov + * + * 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. + * + */ +/** + * bluebird build version 3.7.2 + * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each +*/ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o 0) { + _drainQueueStep(queue); + } +} + +function _drainQueueStep(queue) { + var fn = queue.shift(); + if (typeof fn !== "function") { + fn._settlePromises(); + } else { + var receiver = queue.shift(); + var arg = queue.shift(); + fn.call(receiver, arg); + } +} + +Async.prototype._drainQueues = function () { + _drainQueue(this._normalQueue); + this._reset(); + this._haveDrainedQueues = true; + _drainQueue(this._lateQueue); +}; + +Async.prototype._queueTick = function () { + if (!this._isTickUsed) { + this._isTickUsed = true; + this._schedule(this.drainQueues); + } +}; + +Async.prototype._reset = function () { + this._isTickUsed = false; +}; + +module.exports = Async; +module.exports.firstLineError = firstLineError; + +},{"./queue":26,"./schedule":29}],3:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) { +var calledBind = false; +var rejectThis = function(_, e) { + this._reject(e); +}; + +var targetRejected = function(e, context) { + context.promiseRejectionQueued = true; + context.bindingPromise._then(rejectThis, rejectThis, null, this, e); +}; + +var bindingResolved = function(thisArg, context) { + if (((this._bitField & 50397184) === 0)) { + this._resolveCallback(context.target); + } +}; + +var bindingRejected = function(e, context) { + if (!context.promiseRejectionQueued) this._reject(e); +}; + +Promise.prototype.bind = function (thisArg) { + if (!calledBind) { + calledBind = true; + Promise.prototype._propagateFrom = debug.propagateFromFunction(); + Promise.prototype._boundValue = debug.boundValueFunction(); + } + var maybePromise = tryConvertToPromise(thisArg); + var ret = new Promise(INTERNAL); + ret._propagateFrom(this, 1); + var target = this._target(); + ret._setBoundTo(maybePromise); + if (maybePromise instanceof Promise) { + var context = { + promiseRejectionQueued: false, + promise: ret, + target: target, + bindingPromise: maybePromise + }; + target._then(INTERNAL, targetRejected, undefined, ret, context); + maybePromise._then( + bindingResolved, bindingRejected, undefined, ret, context); + ret._setOnCancel(maybePromise); + } else { + ret._resolveCallback(target); + } + return ret; +}; + +Promise.prototype._setBoundTo = function (obj) { + if (obj !== undefined) { + this._bitField = this._bitField | 2097152; + this._boundTo = obj; + } else { + this._bitField = this._bitField & (~2097152); + } +}; + +Promise.prototype._isBound = function () { + return (this._bitField & 2097152) === 2097152; +}; + +Promise.bind = function (thisArg, value) { + return Promise.resolve(value).bind(thisArg); +}; +}; + +},{}],4:[function(_dereq_,module,exports){ +"use strict"; +var old; +if (typeof Promise !== "undefined") old = Promise; +function noConflict() { + try { if (Promise === bluebird) Promise = old; } + catch (e) {} + return bluebird; +} +var bluebird = _dereq_("./promise")(); +bluebird.noConflict = noConflict; +module.exports = bluebird; + +},{"./promise":22}],5:[function(_dereq_,module,exports){ +"use strict"; +var cr = Object.create; +if (cr) { + var callerCache = cr(null); + var getterCache = cr(null); + callerCache[" size"] = getterCache[" size"] = 0; +} + +module.exports = function(Promise) { +var util = _dereq_("./util"); +var canEvaluate = util.canEvaluate; +var isIdentifier = util.isIdentifier; + +var getMethodCaller; +var getGetter; +if (!true) { +var makeMethodCaller = function (methodName) { + return new Function("ensureMethod", " \n\ + return function(obj) { \n\ + 'use strict' \n\ + var len = this.length; \n\ + ensureMethod(obj, 'methodName'); \n\ + switch(len) { \n\ + case 1: return obj.methodName(this[0]); \n\ + case 2: return obj.methodName(this[0], this[1]); \n\ + case 3: return obj.methodName(this[0], this[1], this[2]); \n\ + case 0: return obj.methodName(); \n\ + default: \n\ + return obj.methodName.apply(obj, this); \n\ + } \n\ + }; \n\ + ".replace(/methodName/g, methodName))(ensureMethod); +}; + +var makeGetter = function (propertyName) { + return new Function("obj", " \n\ + 'use strict'; \n\ + return obj.propertyName; \n\ + ".replace("propertyName", propertyName)); +}; + +var getCompiled = function(name, compiler, cache) { + var ret = cache[name]; + if (typeof ret !== "function") { + if (!isIdentifier(name)) { + return null; + } + ret = compiler(name); + cache[name] = ret; + cache[" size"]++; + if (cache[" size"] > 512) { + var keys = Object.keys(cache); + for (var i = 0; i < 256; ++i) delete cache[keys[i]]; + cache[" size"] = keys.length - 256; + } + } + return ret; +}; + +getMethodCaller = function(name) { + return getCompiled(name, makeMethodCaller, callerCache); +}; + +getGetter = function(name) { + return getCompiled(name, makeGetter, getterCache); +}; +} + +function ensureMethod(obj, methodName) { + var fn; + if (obj != null) fn = obj[methodName]; + if (typeof fn !== "function") { + var message = "Object " + util.classString(obj) + " has no method '" + + util.toString(methodName) + "'"; + throw new Promise.TypeError(message); + } + return fn; +} + +function caller(obj) { + var methodName = this.pop(); + var fn = ensureMethod(obj, methodName); + return fn.apply(obj, this); +} +Promise.prototype.call = function (methodName) { + var args = [].slice.call(arguments, 1);; + if (!true) { + if (canEvaluate) { + var maybeCaller = getMethodCaller(methodName); + if (maybeCaller !== null) { + return this._then( + maybeCaller, undefined, undefined, args, undefined); + } + } + } + args.push(methodName); + return this._then(caller, undefined, undefined, args, undefined); +}; + +function namedGetter(obj) { + return obj[this]; +} +function indexedGetter(obj) { + var index = +this; + if (index < 0) index = Math.max(0, index + obj.length); + return obj[index]; +} +Promise.prototype.get = function (propertyName) { + var isIndex = (typeof propertyName === "number"); + var getter; + if (!isIndex) { + if (canEvaluate) { + var maybeGetter = getGetter(propertyName); + getter = maybeGetter !== null ? maybeGetter : namedGetter; + } else { + getter = namedGetter; + } + } else { + getter = indexedGetter; + } + return this._then(getter, undefined, undefined, propertyName, undefined); +}; +}; + +},{"./util":36}],6:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, PromiseArray, apiRejection, debug) { +var util = _dereq_("./util"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var async = Promise._async; + +Promise.prototype["break"] = Promise.prototype.cancel = function() { + if (!debug.cancellation()) return this._warn("cancellation is disabled"); + + var promise = this; + var child = promise; + while (promise._isCancellable()) { + if (!promise._cancelBy(child)) { + if (child._isFollowing()) { + child._followee().cancel(); + } else { + child._cancelBranched(); + } + break; + } + + var parent = promise._cancellationParent; + if (parent == null || !parent._isCancellable()) { + if (promise._isFollowing()) { + promise._followee().cancel(); + } else { + promise._cancelBranched(); + } + break; + } else { + if (promise._isFollowing()) promise._followee().cancel(); + promise._setWillBeCancelled(); + child = promise; + promise = parent; + } + } +}; + +Promise.prototype._branchHasCancelled = function() { + this._branchesRemainingToCancel--; +}; + +Promise.prototype._enoughBranchesHaveCancelled = function() { + return this._branchesRemainingToCancel === undefined || + this._branchesRemainingToCancel <= 0; +}; + +Promise.prototype._cancelBy = function(canceller) { + if (canceller === this) { + this._branchesRemainingToCancel = 0; + this._invokeOnCancel(); + return true; + } else { + this._branchHasCancelled(); + if (this._enoughBranchesHaveCancelled()) { + this._invokeOnCancel(); + return true; + } + } + return false; +}; + +Promise.prototype._cancelBranched = function() { + if (this._enoughBranchesHaveCancelled()) { + this._cancel(); + } +}; + +Promise.prototype._cancel = function() { + if (!this._isCancellable()) return; + this._setCancelled(); + async.invoke(this._cancelPromises, this, undefined); +}; + +Promise.prototype._cancelPromises = function() { + if (this._length() > 0) this._settlePromises(); +}; + +Promise.prototype._unsetOnCancel = function() { + this._onCancelField = undefined; +}; + +Promise.prototype._isCancellable = function() { + return this.isPending() && !this._isCancelled(); +}; + +Promise.prototype.isCancellable = function() { + return this.isPending() && !this.isCancelled(); +}; + +Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) { + if (util.isArray(onCancelCallback)) { + for (var i = 0; i < onCancelCallback.length; ++i) { + this._doInvokeOnCancel(onCancelCallback[i], internalOnly); + } + } else if (onCancelCallback !== undefined) { + if (typeof onCancelCallback === "function") { + if (!internalOnly) { + var e = tryCatch(onCancelCallback).call(this._boundValue()); + if (e === errorObj) { + this._attachExtraTrace(e.e); + async.throwLater(e.e); + } + } + } else { + onCancelCallback._resultCancelled(this); + } + } +}; + +Promise.prototype._invokeOnCancel = function() { + var onCancelCallback = this._onCancel(); + this._unsetOnCancel(); + async.invoke(this._doInvokeOnCancel, this, onCancelCallback); +}; + +Promise.prototype._invokeInternalOnCancel = function() { + if (this._isCancellable()) { + this._doInvokeOnCancel(this._onCancel(), true); + this._unsetOnCancel(); + } +}; + +Promise.prototype._resultCancelled = function() { + this.cancel(); +}; + +}; + +},{"./util":36}],7:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(NEXT_FILTER) { +var util = _dereq_("./util"); +var getKeys = _dereq_("./es5").keys; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; + +function catchFilter(instances, cb, promise) { + return function(e) { + var boundTo = promise._boundValue(); + predicateLoop: for (var i = 0; i < instances.length; ++i) { + var item = instances[i]; + + if (item === Error || + (item != null && item.prototype instanceof Error)) { + if (e instanceof item) { + return tryCatch(cb).call(boundTo, e); + } + } else if (typeof item === "function") { + var matchesPredicate = tryCatch(item).call(boundTo, e); + if (matchesPredicate === errorObj) { + return matchesPredicate; + } else if (matchesPredicate) { + return tryCatch(cb).call(boundTo, e); + } + } else if (util.isObject(e)) { + var keys = getKeys(item); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + if (item[key] != e[key]) { + continue predicateLoop; + } + } + return tryCatch(cb).call(boundTo, e); + } + } + return NEXT_FILTER; + }; +} + +return catchFilter; +}; + +},{"./es5":13,"./util":36}],8:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +var longStackTraces = false; +var contextStack = []; + +Promise.prototype._promiseCreated = function() {}; +Promise.prototype._pushContext = function() {}; +Promise.prototype._popContext = function() {return null;}; +Promise._peekContext = Promise.prototype._peekContext = function() {}; + +function Context() { + this._trace = new Context.CapturedTrace(peekContext()); +} +Context.prototype._pushContext = function () { + if (this._trace !== undefined) { + this._trace._promiseCreated = null; + contextStack.push(this._trace); + } +}; + +Context.prototype._popContext = function () { + if (this._trace !== undefined) { + var trace = contextStack.pop(); + var ret = trace._promiseCreated; + trace._promiseCreated = null; + return ret; + } + return null; +}; + +function createContext() { + if (longStackTraces) return new Context(); +} + +function peekContext() { + var lastIndex = contextStack.length - 1; + if (lastIndex >= 0) { + return contextStack[lastIndex]; + } + return undefined; +} +Context.CapturedTrace = null; +Context.create = createContext; +Context.deactivateLongStackTraces = function() {}; +Context.activateLongStackTraces = function() { + var Promise_pushContext = Promise.prototype._pushContext; + var Promise_popContext = Promise.prototype._popContext; + var Promise_PeekContext = Promise._peekContext; + var Promise_peekContext = Promise.prototype._peekContext; + var Promise_promiseCreated = Promise.prototype._promiseCreated; + Context.deactivateLongStackTraces = function() { + Promise.prototype._pushContext = Promise_pushContext; + Promise.prototype._popContext = Promise_popContext; + Promise._peekContext = Promise_PeekContext; + Promise.prototype._peekContext = Promise_peekContext; + Promise.prototype._promiseCreated = Promise_promiseCreated; + longStackTraces = false; + }; + longStackTraces = true; + Promise.prototype._pushContext = Context.prototype._pushContext; + Promise.prototype._popContext = Context.prototype._popContext; + Promise._peekContext = Promise.prototype._peekContext = peekContext; + Promise.prototype._promiseCreated = function() { + var ctx = this._peekContext(); + if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this; + }; +}; +return Context; +}; + +},{}],9:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, Context, + enableAsyncHooks, disableAsyncHooks) { +var async = Promise._async; +var Warning = _dereq_("./errors").Warning; +var util = _dereq_("./util"); +var es5 = _dereq_("./es5"); +var canAttachTrace = util.canAttachTrace; +var unhandledRejectionHandled; +var possiblyUnhandledRejection; +var bluebirdFramePattern = + /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/; +var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/; +var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/; +var stackFramePattern = null; +var formatStack = null; +var indentStackFrames = false; +var printWarning; +var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && + (true || + util.env("BLUEBIRD_DEBUG") || + util.env("NODE_ENV") === "development")); + +var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && + (debugging || util.env("BLUEBIRD_WARNINGS"))); + +var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && + (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES"))); + +var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && + (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); + +var deferUnhandledRejectionCheck; +(function() { + var promises = []; + + function unhandledRejectionCheck() { + for (var i = 0; i < promises.length; ++i) { + promises[i]._notifyUnhandledRejection(); + } + unhandledRejectionClear(); + } + + function unhandledRejectionClear() { + promises.length = 0; + } + + deferUnhandledRejectionCheck = function(promise) { + promises.push(promise); + setTimeout(unhandledRejectionCheck, 1); + }; + + es5.defineProperty(Promise, "_unhandledRejectionCheck", { + value: unhandledRejectionCheck + }); + es5.defineProperty(Promise, "_unhandledRejectionClear", { + value: unhandledRejectionClear + }); +})(); + +Promise.prototype.suppressUnhandledRejections = function() { + var target = this._target(); + target._bitField = ((target._bitField & (~1048576)) | + 524288); +}; + +Promise.prototype._ensurePossibleRejectionHandled = function () { + if ((this._bitField & 524288) !== 0) return; + this._setRejectionIsUnhandled(); + deferUnhandledRejectionCheck(this); +}; + +Promise.prototype._notifyUnhandledRejectionIsHandled = function () { + fireRejectionEvent("rejectionHandled", + unhandledRejectionHandled, undefined, this); +}; + +Promise.prototype._setReturnedNonUndefined = function() { + this._bitField = this._bitField | 268435456; +}; + +Promise.prototype._returnedNonUndefined = function() { + return (this._bitField & 268435456) !== 0; +}; + +Promise.prototype._notifyUnhandledRejection = function () { + if (this._isRejectionUnhandled()) { + var reason = this._settledValue(); + this._setUnhandledRejectionIsNotified(); + fireRejectionEvent("unhandledRejection", + possiblyUnhandledRejection, reason, this); + } +}; + +Promise.prototype._setUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField | 262144; +}; + +Promise.prototype._unsetUnhandledRejectionIsNotified = function () { + this._bitField = this._bitField & (~262144); +}; + +Promise.prototype._isUnhandledRejectionNotified = function () { + return (this._bitField & 262144) > 0; +}; + +Promise.prototype._setRejectionIsUnhandled = function () { + this._bitField = this._bitField | 1048576; +}; + +Promise.prototype._unsetRejectionIsUnhandled = function () { + this._bitField = this._bitField & (~1048576); + if (this._isUnhandledRejectionNotified()) { + this._unsetUnhandledRejectionIsNotified(); + this._notifyUnhandledRejectionIsHandled(); + } +}; + +Promise.prototype._isRejectionUnhandled = function () { + return (this._bitField & 1048576) > 0; +}; + +Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { + return warn(message, shouldUseOwnTrace, promise || this); +}; + +Promise.onPossiblyUnhandledRejection = function (fn) { + var context = Promise._getContext(); + possiblyUnhandledRejection = util.contextBind(context, fn); +}; + +Promise.onUnhandledRejectionHandled = function (fn) { + var context = Promise._getContext(); + unhandledRejectionHandled = util.contextBind(context, fn); +}; + +var disableLongStackTraces = function() {}; +Promise.longStackTraces = function () { + if (async.haveItemsQueued() && !config.longStackTraces) { + throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + if (!config.longStackTraces && longStackTracesIsSupported()) { + var Promise_captureStackTrace = Promise.prototype._captureStackTrace; + var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace; + var Promise_dereferenceTrace = Promise.prototype._dereferenceTrace; + config.longStackTraces = true; + disableLongStackTraces = function() { + if (async.haveItemsQueued() && !config.longStackTraces) { + throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + Promise.prototype._captureStackTrace = Promise_captureStackTrace; + Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; + Promise.prototype._dereferenceTrace = Promise_dereferenceTrace; + Context.deactivateLongStackTraces(); + config.longStackTraces = false; + }; + Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; + Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; + Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace; + Context.activateLongStackTraces(); + } +}; + +Promise.hasLongStackTraces = function () { + return config.longStackTraces && longStackTracesIsSupported(); +}; + + +var legacyHandlers = { + unhandledrejection: { + before: function() { + var ret = util.global.onunhandledrejection; + util.global.onunhandledrejection = null; + return ret; + }, + after: function(fn) { + util.global.onunhandledrejection = fn; + } + }, + rejectionhandled: { + before: function() { + var ret = util.global.onrejectionhandled; + util.global.onrejectionhandled = null; + return ret; + }, + after: function(fn) { + util.global.onrejectionhandled = fn; + } + } +}; + +var fireDomEvent = (function() { + var dispatch = function(legacy, e) { + if (legacy) { + var fn; + try { + fn = legacy.before(); + return !util.global.dispatchEvent(e); + } finally { + legacy.after(fn); + } + } else { + return !util.global.dispatchEvent(e); + } + }; + try { + if (typeof CustomEvent === "function") { + var event = new CustomEvent("CustomEvent"); + util.global.dispatchEvent(event); + return function(name, event) { + name = name.toLowerCase(); + var eventData = { + detail: event, + cancelable: true + }; + var domEvent = new CustomEvent(name, eventData); + es5.defineProperty( + domEvent, "promise", {value: event.promise}); + es5.defineProperty( + domEvent, "reason", {value: event.reason}); + + return dispatch(legacyHandlers[name], domEvent); + }; + } else if (typeof Event === "function") { + var event = new Event("CustomEvent"); + util.global.dispatchEvent(event); + return function(name, event) { + name = name.toLowerCase(); + var domEvent = new Event(name, { + cancelable: true + }); + domEvent.detail = event; + es5.defineProperty(domEvent, "promise", {value: event.promise}); + es5.defineProperty(domEvent, "reason", {value: event.reason}); + return dispatch(legacyHandlers[name], domEvent); + }; + } else { + var event = document.createEvent("CustomEvent"); + event.initCustomEvent("testingtheevent", false, true, {}); + util.global.dispatchEvent(event); + return function(name, event) { + name = name.toLowerCase(); + var domEvent = document.createEvent("CustomEvent"); + domEvent.initCustomEvent(name, false, true, + event); + return dispatch(legacyHandlers[name], domEvent); + }; + } + } catch (e) {} + return function() { + return false; + }; +})(); + +var fireGlobalEvent = (function() { + if (util.isNode) { + return function() { + return process.emit.apply(process, arguments); + }; + } else { + if (!util.global) { + return function() { + return false; + }; + } + return function(name) { + var methodName = "on" + name.toLowerCase(); + var method = util.global[methodName]; + if (!method) return false; + method.apply(util.global, [].slice.call(arguments, 1)); + return true; + }; + } +})(); + +function generatePromiseLifecycleEventObject(name, promise) { + return {promise: promise}; +} + +var eventToObjectGenerator = { + promiseCreated: generatePromiseLifecycleEventObject, + promiseFulfilled: generatePromiseLifecycleEventObject, + promiseRejected: generatePromiseLifecycleEventObject, + promiseResolved: generatePromiseLifecycleEventObject, + promiseCancelled: generatePromiseLifecycleEventObject, + promiseChained: function(name, promise, child) { + return {promise: promise, child: child}; + }, + warning: function(name, warning) { + return {warning: warning}; + }, + unhandledRejection: function (name, reason, promise) { + return {reason: reason, promise: promise}; + }, + rejectionHandled: generatePromiseLifecycleEventObject +}; + +var activeFireEvent = function (name) { + var globalEventFired = false; + try { + globalEventFired = fireGlobalEvent.apply(null, arguments); + } catch (e) { + async.throwLater(e); + globalEventFired = true; + } + + var domEventFired = false; + try { + domEventFired = fireDomEvent(name, + eventToObjectGenerator[name].apply(null, arguments)); + } catch (e) { + async.throwLater(e); + domEventFired = true; + } + + return domEventFired || globalEventFired; +}; + +Promise.config = function(opts) { + opts = Object(opts); + if ("longStackTraces" in opts) { + if (opts.longStackTraces) { + Promise.longStackTraces(); + } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) { + disableLongStackTraces(); + } + } + if ("warnings" in opts) { + var warningsOption = opts.warnings; + config.warnings = !!warningsOption; + wForgottenReturn = config.warnings; + + if (util.isObject(warningsOption)) { + if ("wForgottenReturn" in warningsOption) { + wForgottenReturn = !!warningsOption.wForgottenReturn; + } + } + } + if ("cancellation" in opts && opts.cancellation && !config.cancellation) { + if (async.haveItemsQueued()) { + throw new Error( + "cannot enable cancellation after promises are in use"); + } + Promise.prototype._clearCancellationData = + cancellationClearCancellationData; + Promise.prototype._propagateFrom = cancellationPropagateFrom; + Promise.prototype._onCancel = cancellationOnCancel; + Promise.prototype._setOnCancel = cancellationSetOnCancel; + Promise.prototype._attachCancellationCallback = + cancellationAttachCancellationCallback; + Promise.prototype._execute = cancellationExecute; + propagateFromFunction = cancellationPropagateFrom; + config.cancellation = true; + } + if ("monitoring" in opts) { + if (opts.monitoring && !config.monitoring) { + config.monitoring = true; + Promise.prototype._fireEvent = activeFireEvent; + } else if (!opts.monitoring && config.monitoring) { + config.monitoring = false; + Promise.prototype._fireEvent = defaultFireEvent; + } + } + if ("asyncHooks" in opts && util.nodeSupportsAsyncResource) { + var prev = config.asyncHooks; + var cur = !!opts.asyncHooks; + if (prev !== cur) { + config.asyncHooks = cur; + if (cur) { + enableAsyncHooks(); + } else { + disableAsyncHooks(); + } + } + } + return Promise; +}; + +function defaultFireEvent() { return false; } + +Promise.prototype._fireEvent = defaultFireEvent; +Promise.prototype._execute = function(executor, resolve, reject) { + try { + executor(resolve, reject); + } catch (e) { + return e; + } +}; +Promise.prototype._onCancel = function () {}; +Promise.prototype._setOnCancel = function (handler) { ; }; +Promise.prototype._attachCancellationCallback = function(onCancel) { + ; +}; +Promise.prototype._captureStackTrace = function () {}; +Promise.prototype._attachExtraTrace = function () {}; +Promise.prototype._dereferenceTrace = function () {}; +Promise.prototype._clearCancellationData = function() {}; +Promise.prototype._propagateFrom = function (parent, flags) { + ; + ; +}; + +function cancellationExecute(executor, resolve, reject) { + var promise = this; + try { + executor(resolve, reject, function(onCancel) { + if (typeof onCancel !== "function") { + throw new TypeError("onCancel must be a function, got: " + + util.toString(onCancel)); + } + promise._attachCancellationCallback(onCancel); + }); + } catch (e) { + return e; + } +} + +function cancellationAttachCancellationCallback(onCancel) { + if (!this._isCancellable()) return this; + + var previousOnCancel = this._onCancel(); + if (previousOnCancel !== undefined) { + if (util.isArray(previousOnCancel)) { + previousOnCancel.push(onCancel); + } else { + this._setOnCancel([previousOnCancel, onCancel]); + } + } else { + this._setOnCancel(onCancel); + } +} + +function cancellationOnCancel() { + return this._onCancelField; +} + +function cancellationSetOnCancel(onCancel) { + this._onCancelField = onCancel; +} + +function cancellationClearCancellationData() { + this._cancellationParent = undefined; + this._onCancelField = undefined; +} + +function cancellationPropagateFrom(parent, flags) { + if ((flags & 1) !== 0) { + this._cancellationParent = parent; + var branchesRemainingToCancel = parent._branchesRemainingToCancel; + if (branchesRemainingToCancel === undefined) { + branchesRemainingToCancel = 0; + } + parent._branchesRemainingToCancel = branchesRemainingToCancel + 1; + } + if ((flags & 2) !== 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } +} + +function bindingPropagateFrom(parent, flags) { + if ((flags & 2) !== 0 && parent._isBound()) { + this._setBoundTo(parent._boundTo); + } +} +var propagateFromFunction = bindingPropagateFrom; + +function boundValueFunction() { + var ret = this._boundTo; + if (ret !== undefined) { + if (ret instanceof Promise) { + if (ret.isFulfilled()) { + return ret.value(); + } else { + return undefined; + } + } + } + return ret; +} + +function longStackTracesCaptureStackTrace() { + this._trace = new CapturedTrace(this._peekContext()); +} + +function longStackTracesAttachExtraTrace(error, ignoreSelf) { + if (canAttachTrace(error)) { + var trace = this._trace; + if (trace !== undefined) { + if (ignoreSelf) trace = trace._parent; + } + if (trace !== undefined) { + trace.attachExtraTrace(error); + } else if (!error.__stackCleaned__) { + var parsed = parseStackAndMessage(error); + util.notEnumerableProp(error, "stack", + parsed.message + "\n" + parsed.stack.join("\n")); + util.notEnumerableProp(error, "__stackCleaned__", true); + } + } +} + +function longStackTracesDereferenceTrace() { + this._trace = undefined; +} + +function checkForgottenReturns(returnValue, promiseCreated, name, promise, + parent) { + if (returnValue === undefined && promiseCreated !== null && + wForgottenReturn) { + if (parent !== undefined && parent._returnedNonUndefined()) return; + if ((promise._bitField & 65535) === 0) return; + + if (name) name = name + " "; + var handlerLine = ""; + var creatorLine = ""; + if (promiseCreated._trace) { + var traceLines = promiseCreated._trace.stack.split("\n"); + var stack = cleanStack(traceLines); + for (var i = stack.length - 1; i >= 0; --i) { + var line = stack[i]; + if (!nodeFramePattern.test(line)) { + var lineMatches = line.match(parseLinePattern); + if (lineMatches) { + handlerLine = "at " + lineMatches[1] + + ":" + lineMatches[2] + ":" + lineMatches[3] + " "; + } + break; + } + } + + if (stack.length > 0) { + var firstUserLine = stack[0]; + for (var i = 0; i < traceLines.length; ++i) { + + if (traceLines[i] === firstUserLine) { + if (i > 0) { + creatorLine = "\n" + traceLines[i - 1]; + } + break; + } + } + + } + } + var msg = "a promise was created in a " + name + + "handler " + handlerLine + "but was not returned from it, " + + "see http://goo.gl/rRqMUw" + + creatorLine; + promise._warn(msg, true, promiseCreated); + } +} + +function deprecated(name, replacement) { + var message = name + + " is deprecated and will be removed in a future version."; + if (replacement) message += " Use " + replacement + " instead."; + return warn(message); +} + +function warn(message, shouldUseOwnTrace, promise) { + if (!config.warnings) return; + var warning = new Warning(message); + var ctx; + if (shouldUseOwnTrace) { + promise._attachExtraTrace(warning); + } else if (config.longStackTraces && (ctx = Promise._peekContext())) { + ctx.attachExtraTrace(warning); + } else { + var parsed = parseStackAndMessage(warning); + warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); + } + + if (!activeFireEvent("warning", warning)) { + formatAndLogError(warning, "", true); + } +} + +function reconstructStack(message, stacks) { + for (var i = 0; i < stacks.length - 1; ++i) { + stacks[i].push("From previous event:"); + stacks[i] = stacks[i].join("\n"); + } + if (i < stacks.length) { + stacks[i] = stacks[i].join("\n"); + } + return message + "\n" + stacks.join("\n"); +} + +function removeDuplicateOrEmptyJumps(stacks) { + for (var i = 0; i < stacks.length; ++i) { + if (stacks[i].length === 0 || + ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { + stacks.splice(i, 1); + i--; + } + } +} + +function removeCommonRoots(stacks) { + var current = stacks[0]; + for (var i = 1; i < stacks.length; ++i) { + var prev = stacks[i]; + var currentLastIndex = current.length - 1; + var currentLastLine = current[currentLastIndex]; + var commonRootMeetPoint = -1; + + for (var j = prev.length - 1; j >= 0; --j) { + if (prev[j] === currentLastLine) { + commonRootMeetPoint = j; + break; + } + } + + for (var j = commonRootMeetPoint; j >= 0; --j) { + var line = prev[j]; + if (current[currentLastIndex] === line) { + current.pop(); + currentLastIndex--; + } else { + break; + } + } + current = prev; + } +} + +function cleanStack(stack) { + var ret = []; + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + var isTraceLine = " (No stack trace)" === line || + stackFramePattern.test(line); + var isInternalFrame = isTraceLine && shouldIgnore(line); + if (isTraceLine && !isInternalFrame) { + if (indentStackFrames && line.charAt(0) !== " ") { + line = " " + line; + } + ret.push(line); + } + } + return ret; +} + +function stackFramesAsArray(error) { + var stack = error.stack.replace(/\s+$/g, "").split("\n"); + for (var i = 0; i < stack.length; ++i) { + var line = stack[i]; + if (" (No stack trace)" === line || stackFramePattern.test(line)) { + break; + } + } + if (i > 0 && error.name != "SyntaxError") { + stack = stack.slice(i); + } + return stack; +} + +function parseStackAndMessage(error) { + var stack = error.stack; + var message = error.toString(); + stack = typeof stack === "string" && stack.length > 0 + ? stackFramesAsArray(error) : [" (No stack trace)"]; + return { + message: message, + stack: error.name == "SyntaxError" ? stack : cleanStack(stack) + }; +} + +function formatAndLogError(error, title, isSoft) { + if (typeof console !== "undefined") { + var message; + if (util.isObject(error)) { + var stack = error.stack; + message = title + formatStack(stack, error); + } else { + message = title + String(error); + } + if (typeof printWarning === "function") { + printWarning(message, isSoft); + } else if (typeof console.log === "function" || + typeof console.log === "object") { + console.log(message); + } + } +} + +function fireRejectionEvent(name, localHandler, reason, promise) { + var localEventFired = false; + try { + if (typeof localHandler === "function") { + localEventFired = true; + if (name === "rejectionHandled") { + localHandler(promise); + } else { + localHandler(reason, promise); + } + } + } catch (e) { + async.throwLater(e); + } + + if (name === "unhandledRejection") { + if (!activeFireEvent(name, reason, promise) && !localEventFired) { + formatAndLogError(reason, "Unhandled rejection "); + } + } else { + activeFireEvent(name, promise); + } +} + +function formatNonError(obj) { + var str; + if (typeof obj === "function") { + str = "[function " + + (obj.name || "anonymous") + + "]"; + } else { + str = obj && typeof obj.toString === "function" + ? obj.toString() : util.toString(obj); + var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; + if (ruselessToString.test(str)) { + try { + var newStr = JSON.stringify(obj); + str = newStr; + } + catch(e) { + + } + } + if (str.length === 0) { + str = "(empty array)"; + } + } + return ("(<" + snip(str) + ">, no stack trace)"); +} + +function snip(str) { + var maxChars = 41; + if (str.length < maxChars) { + return str; + } + return str.substr(0, maxChars - 3) + "..."; +} + +function longStackTracesIsSupported() { + return typeof captureStackTrace === "function"; +} + +var shouldIgnore = function() { return false; }; +var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; +function parseLineInfo(line) { + var matches = line.match(parseLineInfoRegex); + if (matches) { + return { + fileName: matches[1], + line: parseInt(matches[2], 10) + }; + } +} + +function setBounds(firstLineError, lastLineError) { + if (!longStackTracesIsSupported()) return; + var firstStackLines = (firstLineError.stack || "").split("\n"); + var lastStackLines = (lastLineError.stack || "").split("\n"); + var firstIndex = -1; + var lastIndex = -1; + var firstFileName; + var lastFileName; + for (var i = 0; i < firstStackLines.length; ++i) { + var result = parseLineInfo(firstStackLines[i]); + if (result) { + firstFileName = result.fileName; + firstIndex = result.line; + break; + } + } + for (var i = 0; i < lastStackLines.length; ++i) { + var result = parseLineInfo(lastStackLines[i]); + if (result) { + lastFileName = result.fileName; + lastIndex = result.line; + break; + } + } + if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || + firstFileName !== lastFileName || firstIndex >= lastIndex) { + return; + } + + shouldIgnore = function(line) { + if (bluebirdFramePattern.test(line)) return true; + var info = parseLineInfo(line); + if (info) { + if (info.fileName === firstFileName && + (firstIndex <= info.line && info.line <= lastIndex)) { + return true; + } + } + return false; + }; +} + +function CapturedTrace(parent) { + this._parent = parent; + this._promisesCreated = 0; + var length = this._length = 1 + (parent === undefined ? 0 : parent._length); + captureStackTrace(this, CapturedTrace); + if (length > 32) this.uncycle(); +} +util.inherits(CapturedTrace, Error); +Context.CapturedTrace = CapturedTrace; + +CapturedTrace.prototype.uncycle = function() { + var length = this._length; + if (length < 2) return; + var nodes = []; + var stackToIndex = {}; + + for (var i = 0, node = this; node !== undefined; ++i) { + nodes.push(node); + node = node._parent; + } + length = this._length = i; + for (var i = length - 1; i >= 0; --i) { + var stack = nodes[i].stack; + if (stackToIndex[stack] === undefined) { + stackToIndex[stack] = i; + } + } + for (var i = 0; i < length; ++i) { + var currentStack = nodes[i].stack; + var index = stackToIndex[currentStack]; + if (index !== undefined && index !== i) { + if (index > 0) { + nodes[index - 1]._parent = undefined; + nodes[index - 1]._length = 1; + } + nodes[i]._parent = undefined; + nodes[i]._length = 1; + var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; + + if (index < length - 1) { + cycleEdgeNode._parent = nodes[index + 1]; + cycleEdgeNode._parent.uncycle(); + cycleEdgeNode._length = + cycleEdgeNode._parent._length + 1; + } else { + cycleEdgeNode._parent = undefined; + cycleEdgeNode._length = 1; + } + var currentChildLength = cycleEdgeNode._length + 1; + for (var j = i - 2; j >= 0; --j) { + nodes[j]._length = currentChildLength; + currentChildLength++; + } + return; + } + } +}; + +CapturedTrace.prototype.attachExtraTrace = function(error) { + if (error.__stackCleaned__) return; + this.uncycle(); + var parsed = parseStackAndMessage(error); + var message = parsed.message; + var stacks = [parsed.stack]; + + var trace = this; + while (trace !== undefined) { + stacks.push(cleanStack(trace.stack.split("\n"))); + trace = trace._parent; + } + removeCommonRoots(stacks); + removeDuplicateOrEmptyJumps(stacks); + util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); + util.notEnumerableProp(error, "__stackCleaned__", true); +}; + +var captureStackTrace = (function stackDetection() { + var v8stackFramePattern = /^\s*at\s*/; + var v8stackFormatter = function(stack, error) { + if (typeof stack === "string") return stack; + + if (error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + if (typeof Error.stackTraceLimit === "number" && + typeof Error.captureStackTrace === "function") { + Error.stackTraceLimit += 6; + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + var captureStackTrace = Error.captureStackTrace; + + shouldIgnore = function(line) { + return bluebirdFramePattern.test(line); + }; + return function(receiver, ignoreUntil) { + Error.stackTraceLimit += 6; + captureStackTrace(receiver, ignoreUntil); + Error.stackTraceLimit -= 6; + }; + } + var err = new Error(); + + if (typeof err.stack === "string" && + err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { + stackFramePattern = /@/; + formatStack = v8stackFormatter; + indentStackFrames = true; + return function captureStackTrace(o) { + o.stack = new Error().stack; + }; + } + + var hasStackAfterThrow; + try { throw new Error(); } + catch(e) { + hasStackAfterThrow = ("stack" in e); + } + if (!("stack" in err) && hasStackAfterThrow && + typeof Error.stackTraceLimit === "number") { + stackFramePattern = v8stackFramePattern; + formatStack = v8stackFormatter; + return function captureStackTrace(o) { + Error.stackTraceLimit += 6; + try { throw new Error(); } + catch(e) { o.stack = e.stack; } + Error.stackTraceLimit -= 6; + }; + } + + formatStack = function(stack, error) { + if (typeof stack === "string") return stack; + + if ((typeof error === "object" || + typeof error === "function") && + error.name !== undefined && + error.message !== undefined) { + return error.toString(); + } + return formatNonError(error); + }; + + return null; + +})([]); + +if (typeof console !== "undefined" && typeof console.warn !== "undefined") { + printWarning = function (message) { + console.warn(message); + }; + if (util.isNode && process.stderr.isTTY) { + printWarning = function(message, isSoft) { + var color = isSoft ? "\u001b[33m" : "\u001b[31m"; + console.warn(color + message + "\u001b[0m\n"); + }; + } else if (!util.isNode && typeof (new Error().stack) === "string") { + printWarning = function(message, isSoft) { + console.warn("%c" + message, + isSoft ? "color: darkorange" : "color: red"); + }; + } +} + +var config = { + warnings: warnings, + longStackTraces: false, + cancellation: false, + monitoring: false, + asyncHooks: false +}; + +if (longStackTraces) Promise.longStackTraces(); + +return { + asyncHooks: function() { + return config.asyncHooks; + }, + longStackTraces: function() { + return config.longStackTraces; + }, + warnings: function() { + return config.warnings; + }, + cancellation: function() { + return config.cancellation; + }, + monitoring: function() { + return config.monitoring; + }, + propagateFromFunction: function() { + return propagateFromFunction; + }, + boundValueFunction: function() { + return boundValueFunction; + }, + checkForgottenReturns: checkForgottenReturns, + setBounds: setBounds, + warn: warn, + deprecated: deprecated, + CapturedTrace: CapturedTrace, + fireDomEvent: fireDomEvent, + fireGlobalEvent: fireGlobalEvent +}; +}; + +},{"./errors":12,"./es5":13,"./util":36}],10:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +function returner() { + return this.value; +} +function thrower() { + throw this.reason; +} + +Promise.prototype["return"] = +Promise.prototype.thenReturn = function (value) { + if (value instanceof Promise) value.suppressUnhandledRejections(); + return this._then( + returner, undefined, undefined, {value: value}, undefined); +}; + +Promise.prototype["throw"] = +Promise.prototype.thenThrow = function (reason) { + return this._then( + thrower, undefined, undefined, {reason: reason}, undefined); +}; + +Promise.prototype.catchThrow = function (reason) { + if (arguments.length <= 1) { + return this._then( + undefined, thrower, undefined, {reason: reason}, undefined); + } else { + var _reason = arguments[1]; + var handler = function() {throw _reason;}; + return this.caught(reason, handler); + } +}; + +Promise.prototype.catchReturn = function (value) { + if (arguments.length <= 1) { + if (value instanceof Promise) value.suppressUnhandledRejections(); + return this._then( + undefined, returner, undefined, {value: value}, undefined); + } else { + var _value = arguments[1]; + if (_value instanceof Promise) _value.suppressUnhandledRejections(); + var handler = function() {return _value;}; + return this.caught(value, handler); + } +}; +}; + +},{}],11:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var PromiseReduce = Promise.reduce; +var PromiseAll = Promise.all; + +function promiseAllThis() { + return PromiseAll(this); +} + +function PromiseMapSeries(promises, fn) { + return PromiseReduce(promises, fn, INTERNAL, INTERNAL); +} + +Promise.prototype.each = function (fn) { + return PromiseReduce(this, fn, INTERNAL, 0) + ._then(promiseAllThis, undefined, undefined, this, undefined); +}; + +Promise.prototype.mapSeries = function (fn) { + return PromiseReduce(this, fn, INTERNAL, INTERNAL); +}; + +Promise.each = function (promises, fn) { + return PromiseReduce(promises, fn, INTERNAL, 0) + ._then(promiseAllThis, undefined, undefined, promises, undefined); +}; + +Promise.mapSeries = PromiseMapSeries; +}; + + +},{}],12:[function(_dereq_,module,exports){ +"use strict"; +var es5 = _dereq_("./es5"); +var Objectfreeze = es5.freeze; +var util = _dereq_("./util"); +var inherits = util.inherits; +var notEnumerableProp = util.notEnumerableProp; + +function subError(nameProperty, defaultMessage) { + function SubError(message) { + if (!(this instanceof SubError)) return new SubError(message); + notEnumerableProp(this, "message", + typeof message === "string" ? message : defaultMessage); + notEnumerableProp(this, "name", nameProperty); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + Error.call(this); + } + } + inherits(SubError, Error); + return SubError; +} + +var _TypeError, _RangeError; +var Warning = subError("Warning", "warning"); +var CancellationError = subError("CancellationError", "cancellation error"); +var TimeoutError = subError("TimeoutError", "timeout error"); +var AggregateError = subError("AggregateError", "aggregate error"); +try { + _TypeError = TypeError; + _RangeError = RangeError; +} catch(e) { + _TypeError = subError("TypeError", "type error"); + _RangeError = subError("RangeError", "range error"); +} + +var methods = ("join pop push shift unshift slice filter forEach some " + + "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); + +for (var i = 0; i < methods.length; ++i) { + if (typeof Array.prototype[methods[i]] === "function") { + AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; + } +} + +es5.defineProperty(AggregateError.prototype, "length", { + value: 0, + configurable: false, + writable: true, + enumerable: true +}); +AggregateError.prototype["isOperational"] = true; +var level = 0; +AggregateError.prototype.toString = function() { + var indent = Array(level * 4 + 1).join(" "); + var ret = "\n" + indent + "AggregateError of:" + "\n"; + level++; + indent = Array(level * 4 + 1).join(" "); + for (var i = 0; i < this.length; ++i) { + var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; + var lines = str.split("\n"); + for (var j = 0; j < lines.length; ++j) { + lines[j] = indent + lines[j]; + } + str = lines.join("\n"); + ret += str + "\n"; + } + level--; + return ret; +}; + +function OperationalError(message) { + if (!(this instanceof OperationalError)) + return new OperationalError(message); + notEnumerableProp(this, "name", "OperationalError"); + notEnumerableProp(this, "message", message); + this.cause = message; + this["isOperational"] = true; + + if (message instanceof Error) { + notEnumerableProp(this, "message", message.message); + notEnumerableProp(this, "stack", message.stack); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + +} +inherits(OperationalError, Error); + +var errorTypes = Error["__BluebirdErrorTypes__"]; +if (!errorTypes) { + errorTypes = Objectfreeze({ + CancellationError: CancellationError, + TimeoutError: TimeoutError, + OperationalError: OperationalError, + RejectionError: OperationalError, + AggregateError: AggregateError + }); + es5.defineProperty(Error, "__BluebirdErrorTypes__", { + value: errorTypes, + writable: false, + enumerable: false, + configurable: false + }); +} + +module.exports = { + Error: Error, + TypeError: _TypeError, + RangeError: _RangeError, + CancellationError: errorTypes.CancellationError, + OperationalError: errorTypes.OperationalError, + TimeoutError: errorTypes.TimeoutError, + AggregateError: errorTypes.AggregateError, + Warning: Warning +}; + +},{"./es5":13,"./util":36}],13:[function(_dereq_,module,exports){ +var isES5 = (function(){ + "use strict"; + return this === undefined; +})(); + +if (isES5) { + module.exports = { + freeze: Object.freeze, + defineProperty: Object.defineProperty, + getDescriptor: Object.getOwnPropertyDescriptor, + keys: Object.keys, + names: Object.getOwnPropertyNames, + getPrototypeOf: Object.getPrototypeOf, + isArray: Array.isArray, + isES5: isES5, + propertyIsWritable: function(obj, prop) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop); + return !!(!descriptor || descriptor.writable || descriptor.set); + } + }; +} else { + var has = {}.hasOwnProperty; + var str = {}.toString; + var proto = {}.constructor.prototype; + + var ObjectKeys = function (o) { + var ret = []; + for (var key in o) { + if (has.call(o, key)) { + ret.push(key); + } + } + return ret; + }; + + var ObjectGetDescriptor = function(o, key) { + return {value: o[key]}; + }; + + var ObjectDefineProperty = function (o, key, desc) { + o[key] = desc.value; + return o; + }; + + var ObjectFreeze = function (obj) { + return obj; + }; + + var ObjectGetPrototypeOf = function (obj) { + try { + return Object(obj).constructor.prototype; + } + catch (e) { + return proto; + } + }; + + var ArrayIsArray = function (obj) { + try { + return str.call(obj) === "[object Array]"; + } + catch(e) { + return false; + } + }; + + module.exports = { + isArray: ArrayIsArray, + keys: ObjectKeys, + names: ObjectKeys, + defineProperty: ObjectDefineProperty, + getDescriptor: ObjectGetDescriptor, + freeze: ObjectFreeze, + getPrototypeOf: ObjectGetPrototypeOf, + isES5: isES5, + propertyIsWritable: function() { + return true; + } + }; +} + +},{}],14:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var PromiseMap = Promise.map; + +Promise.prototype.filter = function (fn, options) { + return PromiseMap(this, fn, options, INTERNAL); +}; + +Promise.filter = function (promises, fn, options) { + return PromiseMap(promises, fn, options, INTERNAL); +}; +}; + +},{}],15:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) { +var util = _dereq_("./util"); +var CancellationError = Promise.CancellationError; +var errorObj = util.errorObj; +var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); + +function PassThroughHandlerContext(promise, type, handler) { + this.promise = promise; + this.type = type; + this.handler = handler; + this.called = false; + this.cancelPromise = null; +} + +PassThroughHandlerContext.prototype.isFinallyHandler = function() { + return this.type === 0; +}; + +function FinallyHandlerCancelReaction(finallyHandler) { + this.finallyHandler = finallyHandler; +} + +FinallyHandlerCancelReaction.prototype._resultCancelled = function() { + checkCancel(this.finallyHandler); +}; + +function checkCancel(ctx, reason) { + if (ctx.cancelPromise != null) { + if (arguments.length > 1) { + ctx.cancelPromise._reject(reason); + } else { + ctx.cancelPromise._cancel(); + } + ctx.cancelPromise = null; + return true; + } + return false; +} + +function succeed() { + return finallyHandler.call(this, this.promise._target()._settledValue()); +} +function fail(reason) { + if (checkCancel(this, reason)) return; + errorObj.e = reason; + return errorObj; +} +function finallyHandler(reasonOrValue) { + var promise = this.promise; + var handler = this.handler; + + if (!this.called) { + this.called = true; + var ret = this.isFinallyHandler() + ? handler.call(promise._boundValue()) + : handler.call(promise._boundValue(), reasonOrValue); + if (ret === NEXT_FILTER) { + return ret; + } else if (ret !== undefined) { + promise._setReturnedNonUndefined(); + var maybePromise = tryConvertToPromise(ret, promise); + if (maybePromise instanceof Promise) { + if (this.cancelPromise != null) { + if (maybePromise._isCancelled()) { + var reason = + new CancellationError("late cancellation observer"); + promise._attachExtraTrace(reason); + errorObj.e = reason; + return errorObj; + } else if (maybePromise.isPending()) { + maybePromise._attachCancellationCallback( + new FinallyHandlerCancelReaction(this)); + } + } + return maybePromise._then( + succeed, fail, undefined, this, undefined); + } + } + } + + if (promise.isRejected()) { + checkCancel(this); + errorObj.e = reasonOrValue; + return errorObj; + } else { + checkCancel(this); + return reasonOrValue; + } +} + +Promise.prototype._passThrough = function(handler, type, success, fail) { + if (typeof handler !== "function") return this.then(); + return this._then(success, + fail, + undefined, + new PassThroughHandlerContext(this, type, handler), + undefined); +}; + +Promise.prototype.lastly = +Promise.prototype["finally"] = function (handler) { + return this._passThrough(handler, + 0, + finallyHandler, + finallyHandler); +}; + + +Promise.prototype.tap = function (handler) { + return this._passThrough(handler, 1, finallyHandler); +}; + +Promise.prototype.tapCatch = function (handlerOrPredicate) { + var len = arguments.length; + if(len === 1) { + return this._passThrough(handlerOrPredicate, + 1, + undefined, + finallyHandler); + } else { + var catchInstances = new Array(len - 1), + j = 0, i; + for (i = 0; i < len - 1; ++i) { + var item = arguments[i]; + if (util.isObject(item)) { + catchInstances[j++] = item; + } else { + return Promise.reject(new TypeError( + "tapCatch statement predicate: " + + "expecting an object but got " + util.classString(item) + )); + } + } + catchInstances.length = j; + var handler = arguments[i]; + return this._passThrough(catchFilter(catchInstances, handler, this), + 1, + undefined, + finallyHandler); + } + +}; + +return PassThroughHandlerContext; +}; + +},{"./catch_filter":7,"./util":36}],16:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, + apiRejection, + INTERNAL, + tryConvertToPromise, + Proxyable, + debug) { +var errors = _dereq_("./errors"); +var TypeError = errors.TypeError; +var util = _dereq_("./util"); +var errorObj = util.errorObj; +var tryCatch = util.tryCatch; +var yieldHandlers = []; + +function promiseFromYieldHandler(value, yieldHandlers, traceParent) { + for (var i = 0; i < yieldHandlers.length; ++i) { + traceParent._pushContext(); + var result = tryCatch(yieldHandlers[i])(value); + traceParent._popContext(); + if (result === errorObj) { + traceParent._pushContext(); + var ret = Promise.reject(errorObj.e); + traceParent._popContext(); + return ret; + } + var maybePromise = tryConvertToPromise(result, traceParent); + if (maybePromise instanceof Promise) return maybePromise; + } + return null; +} + +function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { + if (debug.cancellation()) { + var internal = new Promise(INTERNAL); + var _finallyPromise = this._finallyPromise = new Promise(INTERNAL); + this._promise = internal.lastly(function() { + return _finallyPromise; + }); + internal._captureStackTrace(); + internal._setOnCancel(this); + } else { + var promise = this._promise = new Promise(INTERNAL); + promise._captureStackTrace(); + } + this._stack = stack; + this._generatorFunction = generatorFunction; + this._receiver = receiver; + this._generator = undefined; + this._yieldHandlers = typeof yieldHandler === "function" + ? [yieldHandler].concat(yieldHandlers) + : yieldHandlers; + this._yieldedPromise = null; + this._cancellationPhase = false; +} +util.inherits(PromiseSpawn, Proxyable); + +PromiseSpawn.prototype._isResolved = function() { + return this._promise === null; +}; + +PromiseSpawn.prototype._cleanup = function() { + this._promise = this._generator = null; + if (debug.cancellation() && this._finallyPromise !== null) { + this._finallyPromise._fulfill(); + this._finallyPromise = null; + } +}; + +PromiseSpawn.prototype._promiseCancelled = function() { + if (this._isResolved()) return; + var implementsReturn = typeof this._generator["return"] !== "undefined"; + + var result; + if (!implementsReturn) { + var reason = new Promise.CancellationError( + "generator .return() sentinel"); + Promise.coroutine.returnSentinel = reason; + this._promise._attachExtraTrace(reason); + this._promise._pushContext(); + result = tryCatch(this._generator["throw"]).call(this._generator, + reason); + this._promise._popContext(); + } else { + this._promise._pushContext(); + result = tryCatch(this._generator["return"]).call(this._generator, + undefined); + this._promise._popContext(); + } + this._cancellationPhase = true; + this._yieldedPromise = null; + this._continue(result); +}; + +PromiseSpawn.prototype._promiseFulfilled = function(value) { + this._yieldedPromise = null; + this._promise._pushContext(); + var result = tryCatch(this._generator.next).call(this._generator, value); + this._promise._popContext(); + this._continue(result); +}; + +PromiseSpawn.prototype._promiseRejected = function(reason) { + this._yieldedPromise = null; + this._promise._attachExtraTrace(reason); + this._promise._pushContext(); + var result = tryCatch(this._generator["throw"]) + .call(this._generator, reason); + this._promise._popContext(); + this._continue(result); +}; + +PromiseSpawn.prototype._resultCancelled = function() { + if (this._yieldedPromise instanceof Promise) { + var promise = this._yieldedPromise; + this._yieldedPromise = null; + promise.cancel(); + } +}; + +PromiseSpawn.prototype.promise = function () { + return this._promise; +}; + +PromiseSpawn.prototype._run = function () { + this._generator = this._generatorFunction.call(this._receiver); + this._receiver = + this._generatorFunction = undefined; + this._promiseFulfilled(undefined); +}; + +PromiseSpawn.prototype._continue = function (result) { + var promise = this._promise; + if (result === errorObj) { + this._cleanup(); + if (this._cancellationPhase) { + return promise.cancel(); + } else { + return promise._rejectCallback(result.e, false); + } + } + + var value = result.value; + if (result.done === true) { + this._cleanup(); + if (this._cancellationPhase) { + return promise.cancel(); + } else { + return promise._resolveCallback(value); + } + } else { + var maybePromise = tryConvertToPromise(value, this._promise); + if (!(maybePromise instanceof Promise)) { + maybePromise = + promiseFromYieldHandler(maybePromise, + this._yieldHandlers, + this._promise); + if (maybePromise === null) { + this._promiseRejected( + new TypeError( + "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", String(value)) + + "From coroutine:\u000a" + + this._stack.split("\n").slice(1, -7).join("\n") + ) + ); + return; + } + } + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if (((bitField & 50397184) === 0)) { + this._yieldedPromise = maybePromise; + maybePromise._proxy(this, null); + } else if (((bitField & 33554432) !== 0)) { + Promise._async.invoke( + this._promiseFulfilled, this, maybePromise._value() + ); + } else if (((bitField & 16777216) !== 0)) { + Promise._async.invoke( + this._promiseRejected, this, maybePromise._reason() + ); + } else { + this._promiseCancelled(); + } + } +}; + +Promise.coroutine = function (generatorFunction, options) { + if (typeof generatorFunction !== "function") { + throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + var yieldHandler = Object(options).yieldHandler; + var PromiseSpawn$ = PromiseSpawn; + var stack = new Error().stack; + return function () { + var generator = generatorFunction.apply(this, arguments); + var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, + stack); + var ret = spawn.promise(); + spawn._generator = generator; + spawn._promiseFulfilled(undefined); + return ret; + }; +}; + +Promise.coroutine.addYieldHandler = function(fn) { + if (typeof fn !== "function") { + throw new TypeError("expecting a function but got " + util.classString(fn)); + } + yieldHandlers.push(fn); +}; + +Promise.spawn = function (generatorFunction) { + debug.deprecated("Promise.spawn()", "Promise.coroutine()"); + if (typeof generatorFunction !== "function") { + return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + var spawn = new PromiseSpawn(generatorFunction, this); + var ret = spawn.promise(); + spawn._run(Promise.spawn); + return ret; +}; +}; + +},{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){ +"use strict"; +module.exports = +function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async) { +var util = _dereq_("./util"); +var canEvaluate = util.canEvaluate; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var reject; + +if (!true) { +if (canEvaluate) { + var thenCallback = function(i) { + return new Function("value", "holder", " \n\ + 'use strict'; \n\ + holder.pIndex = value; \n\ + holder.checkFulfillment(this); \n\ + ".replace(/Index/g, i)); + }; + + var promiseSetter = function(i) { + return new Function("promise", "holder", " \n\ + 'use strict'; \n\ + holder.pIndex = promise; \n\ + ".replace(/Index/g, i)); + }; + + var generateHolderClass = function(total) { + var props = new Array(total); + for (var i = 0; i < props.length; ++i) { + props[i] = "this.p" + (i+1); + } + var assignment = props.join(" = ") + " = null;"; + var cancellationCode= "var promise;\n" + props.map(function(prop) { + return " \n\ + promise = " + prop + "; \n\ + if (promise instanceof Promise) { \n\ + promise.cancel(); \n\ + } \n\ + "; + }).join("\n"); + var passedArguments = props.join(", "); + var name = "Holder$" + total; + + + var code = "return function(tryCatch, errorObj, Promise, async) { \n\ + 'use strict'; \n\ + function [TheName](fn) { \n\ + [TheProperties] \n\ + this.fn = fn; \n\ + this.asyncNeeded = true; \n\ + this.now = 0; \n\ + } \n\ + \n\ + [TheName].prototype._callFunction = function(promise) { \n\ + promise._pushContext(); \n\ + var ret = tryCatch(this.fn)([ThePassedArguments]); \n\ + promise._popContext(); \n\ + if (ret === errorObj) { \n\ + promise._rejectCallback(ret.e, false); \n\ + } else { \n\ + promise._resolveCallback(ret); \n\ + } \n\ + }; \n\ + \n\ + [TheName].prototype.checkFulfillment = function(promise) { \n\ + var now = ++this.now; \n\ + if (now === [TheTotal]) { \n\ + if (this.asyncNeeded) { \n\ + async.invoke(this._callFunction, this, promise); \n\ + } else { \n\ + this._callFunction(promise); \n\ + } \n\ + \n\ + } \n\ + }; \n\ + \n\ + [TheName].prototype._resultCancelled = function() { \n\ + [CancellationCode] \n\ + }; \n\ + \n\ + return [TheName]; \n\ + }(tryCatch, errorObj, Promise, async); \n\ + "; + + code = code.replace(/\[TheName\]/g, name) + .replace(/\[TheTotal\]/g, total) + .replace(/\[ThePassedArguments\]/g, passedArguments) + .replace(/\[TheProperties\]/g, assignment) + .replace(/\[CancellationCode\]/g, cancellationCode); + + return new Function("tryCatch", "errorObj", "Promise", "async", code) + (tryCatch, errorObj, Promise, async); + }; + + var holderClasses = []; + var thenCallbacks = []; + var promiseSetters = []; + + for (var i = 0; i < 8; ++i) { + holderClasses.push(generateHolderClass(i + 1)); + thenCallbacks.push(thenCallback(i + 1)); + promiseSetters.push(promiseSetter(i + 1)); + } + + reject = function (reason) { + this._reject(reason); + }; +}} + +Promise.join = function () { + var last = arguments.length - 1; + var fn; + if (last > 0 && typeof arguments[last] === "function") { + fn = arguments[last]; + if (!true) { + if (last <= 8 && canEvaluate) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + var HolderClass = holderClasses[last - 1]; + var holder = new HolderClass(fn); + var callbacks = thenCallbacks; + + for (var i = 0; i < last; ++i) { + var maybePromise = tryConvertToPromise(arguments[i], ret); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if (((bitField & 50397184) === 0)) { + maybePromise._then(callbacks[i], reject, + undefined, ret, holder); + promiseSetters[i](maybePromise, holder); + holder.asyncNeeded = false; + } else if (((bitField & 33554432) !== 0)) { + callbacks[i].call(ret, + maybePromise._value(), holder); + } else if (((bitField & 16777216) !== 0)) { + ret._reject(maybePromise._reason()); + } else { + ret._cancel(); + } + } else { + callbacks[i].call(ret, maybePromise, holder); + } + } + + if (!ret._isFateSealed()) { + if (holder.asyncNeeded) { + var context = Promise._getContext(); + holder.fn = util.contextBind(context, holder.fn); + } + ret._setAsyncGuaranteed(); + ret._setOnCancel(holder); + } + return ret; + } + } + } + var args = [].slice.call(arguments);; + if (fn) args.pop(); + var ret = new PromiseArray(args).promise(); + return fn !== undefined ? ret.spread(fn) : ret; +}; + +}; + +},{"./util":36}],18:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, + PromiseArray, + apiRejection, + tryConvertToPromise, + INTERNAL, + debug) { +var util = _dereq_("./util"); +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; +var async = Promise._async; + +function MappingPromiseArray(promises, fn, limit, _filter) { + this.constructor$(promises); + this._promise._captureStackTrace(); + var context = Promise._getContext(); + this._callback = util.contextBind(context, fn); + this._preservedValues = _filter === INTERNAL + ? new Array(this.length()) + : null; + this._limit = limit; + this._inFlight = 0; + this._queue = []; + async.invoke(this._asyncInit, this, undefined); + if (util.isArray(promises)) { + for (var i = 0; i < promises.length; ++i) { + var maybePromise = promises[i]; + if (maybePromise instanceof Promise) { + maybePromise.suppressUnhandledRejections(); + } + } + } +} +util.inherits(MappingPromiseArray, PromiseArray); + +MappingPromiseArray.prototype._asyncInit = function() { + this._init$(undefined, -2); +}; + +MappingPromiseArray.prototype._init = function () {}; + +MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { + var values = this._values; + var length = this.length(); + var preservedValues = this._preservedValues; + var limit = this._limit; + + if (index < 0) { + index = (index * -1) - 1; + values[index] = value; + if (limit >= 1) { + this._inFlight--; + this._drainQueue(); + if (this._isResolved()) return true; + } + } else { + if (limit >= 1 && this._inFlight >= limit) { + values[index] = value; + this._queue.push(index); + return false; + } + if (preservedValues !== null) preservedValues[index] = value; + + var promise = this._promise; + var callback = this._callback; + var receiver = promise._boundValue(); + promise._pushContext(); + var ret = tryCatch(callback).call(receiver, value, index, length); + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns( + ret, + promiseCreated, + preservedValues !== null ? "Promise.filter" : "Promise.map", + promise + ); + if (ret === errorObj) { + this._reject(ret.e); + return true; + } + + var maybePromise = tryConvertToPromise(ret, this._promise); + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + var bitField = maybePromise._bitField; + ; + if (((bitField & 50397184) === 0)) { + if (limit >= 1) this._inFlight++; + values[index] = maybePromise; + maybePromise._proxy(this, (index + 1) * -1); + return false; + } else if (((bitField & 33554432) !== 0)) { + ret = maybePromise._value(); + } else if (((bitField & 16777216) !== 0)) { + this._reject(maybePromise._reason()); + return true; + } else { + this._cancel(); + return true; + } + } + values[index] = ret; + } + var totalResolved = ++this._totalResolved; + if (totalResolved >= length) { + if (preservedValues !== null) { + this._filter(values, preservedValues); + } else { + this._resolve(values); + } + return true; + } + return false; +}; + +MappingPromiseArray.prototype._drainQueue = function () { + var queue = this._queue; + var limit = this._limit; + var values = this._values; + while (queue.length > 0 && this._inFlight < limit) { + if (this._isResolved()) return; + var index = queue.pop(); + this._promiseFulfilled(values[index], index); + } +}; + +MappingPromiseArray.prototype._filter = function (booleans, values) { + var len = values.length; + var ret = new Array(len); + var j = 0; + for (var i = 0; i < len; ++i) { + if (booleans[i]) ret[j++] = values[i]; + } + ret.length = j; + this._resolve(ret); +}; + +MappingPromiseArray.prototype.preservedValues = function () { + return this._preservedValues; +}; + +function map(promises, fn, options, _filter) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + + var limit = 0; + if (options !== undefined) { + if (typeof options === "object" && options !== null) { + if (typeof options.concurrency !== "number") { + return Promise.reject( + new TypeError("'concurrency' must be a number but it is " + + util.classString(options.concurrency))); + } + limit = options.concurrency; + } else { + return Promise.reject(new TypeError( + "options argument must be an object but it is " + + util.classString(options))); + } + } + limit = typeof limit === "number" && + isFinite(limit) && limit >= 1 ? limit : 0; + return new MappingPromiseArray(promises, fn, limit, _filter).promise(); +} + +Promise.prototype.map = function (fn, options) { + return map(this, fn, options, null); +}; + +Promise.map = function (promises, fn, options, _filter) { + return map(promises, fn, options, _filter); +}; + + +}; + +},{"./util":36}],19:[function(_dereq_,module,exports){ +"use strict"; +module.exports = +function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) { +var util = _dereq_("./util"); +var tryCatch = util.tryCatch; + +Promise.method = function (fn) { + if (typeof fn !== "function") { + throw new Promise.TypeError("expecting a function but got " + util.classString(fn)); + } + return function () { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value = tryCatch(fn).apply(this, arguments); + var promiseCreated = ret._popContext(); + debug.checkForgottenReturns( + value, promiseCreated, "Promise.method", ret); + ret._resolveFromSyncValue(value); + return ret; + }; +}; + +Promise.attempt = Promise["try"] = function (fn) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._pushContext(); + var value; + if (arguments.length > 1) { + debug.deprecated("calling Promise.try with more than 1 argument"); + var arg = arguments[1]; + var ctx = arguments[2]; + value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg) + : tryCatch(fn).call(ctx, arg); + } else { + value = tryCatch(fn)(); + } + var promiseCreated = ret._popContext(); + debug.checkForgottenReturns( + value, promiseCreated, "Promise.try", ret); + ret._resolveFromSyncValue(value); + return ret; +}; + +Promise.prototype._resolveFromSyncValue = function (value) { + if (value === util.errorObj) { + this._rejectCallback(value.e, false); + } else { + this._resolveCallback(value, true); + } +}; +}; + +},{"./util":36}],20:[function(_dereq_,module,exports){ +"use strict"; +var util = _dereq_("./util"); +var maybeWrapAsError = util.maybeWrapAsError; +var errors = _dereq_("./errors"); +var OperationalError = errors.OperationalError; +var es5 = _dereq_("./es5"); + +function isUntypedError(obj) { + return obj instanceof Error && + es5.getPrototypeOf(obj) === Error.prototype; +} + +var rErrorKey = /^(?:name|message|stack|cause)$/; +function wrapAsOperationalError(obj) { + var ret; + if (isUntypedError(obj)) { + ret = new OperationalError(obj); + ret.name = obj.name; + ret.message = obj.message; + ret.stack = obj.stack; + var keys = es5.keys(obj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!rErrorKey.test(key)) { + ret[key] = obj[key]; + } + } + return ret; + } + util.markAsOriginatingFromRejection(obj); + return obj; +} + +function nodebackForPromise(promise, multiArgs) { + return function(err, value) { + if (promise === null) return; + if (err) { + var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); + promise._attachExtraTrace(wrapped); + promise._reject(wrapped); + } else if (!multiArgs) { + promise._fulfill(value); + } else { + var args = [].slice.call(arguments, 1);; + promise._fulfill(args); + } + promise = null; + }; +} + +module.exports = nodebackForPromise; + +},{"./errors":12,"./es5":13,"./util":36}],21:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +var util = _dereq_("./util"); +var async = Promise._async; +var tryCatch = util.tryCatch; +var errorObj = util.errorObj; + +function spreadAdapter(val, nodeback) { + var promise = this; + if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); + var ret = + tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val)); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} + +function successAdapter(val, nodeback) { + var promise = this; + var receiver = promise._boundValue(); + var ret = val === undefined + ? tryCatch(nodeback).call(receiver, null) + : tryCatch(nodeback).call(receiver, null, val); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} +function errorAdapter(reason, nodeback) { + var promise = this; + if (!reason) { + var newReason = new Error(reason + ""); + newReason.cause = reason; + reason = newReason; + } + var ret = tryCatch(nodeback).call(promise._boundValue(), reason); + if (ret === errorObj) { + async.throwLater(ret.e); + } +} + +Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback, + options) { + if (typeof nodeback == "function") { + var adapter = successAdapter; + if (options !== undefined && Object(options).spread) { + adapter = spreadAdapter; + } + this._then( + adapter, + errorAdapter, + undefined, + this, + nodeback + ); + } + return this; +}; +}; + +},{"./util":36}],22:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function() { +var makeSelfResolutionError = function () { + return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a"); +}; +var reflectHandler = function() { + return new Promise.PromiseInspection(this._target()); +}; +var apiRejection = function(msg) { + return Promise.reject(new TypeError(msg)); +}; +function Proxyable() {} +var UNDEFINED_BINDING = {}; +var util = _dereq_("./util"); +util.setReflectHandler(reflectHandler); + +var getDomain = function() { + var domain = process.domain; + if (domain === undefined) { + return null; + } + return domain; +}; +var getContextDefault = function() { + return null; +}; +var getContextDomain = function() { + return { + domain: getDomain(), + async: null + }; +}; +var AsyncResource = util.isNode && util.nodeSupportsAsyncResource ? + _dereq_("async_hooks").AsyncResource : null; +var getContextAsyncHooks = function() { + return { + domain: getDomain(), + async: new AsyncResource("Bluebird::Promise") + }; +}; +var getContext = util.isNode ? getContextDomain : getContextDefault; +util.notEnumerableProp(Promise, "_getContext", getContext); +var enableAsyncHooks = function() { + getContext = getContextAsyncHooks; + util.notEnumerableProp(Promise, "_getContext", getContextAsyncHooks); +}; +var disableAsyncHooks = function() { + getContext = getContextDomain; + util.notEnumerableProp(Promise, "_getContext", getContextDomain); +}; + +var es5 = _dereq_("./es5"); +var Async = _dereq_("./async"); +var async = new Async(); +es5.defineProperty(Promise, "_async", {value: async}); +var errors = _dereq_("./errors"); +var TypeError = Promise.TypeError = errors.TypeError; +Promise.RangeError = errors.RangeError; +var CancellationError = Promise.CancellationError = errors.CancellationError; +Promise.TimeoutError = errors.TimeoutError; +Promise.OperationalError = errors.OperationalError; +Promise.RejectionError = errors.OperationalError; +Promise.AggregateError = errors.AggregateError; +var INTERNAL = function(){}; +var APPLY = {}; +var NEXT_FILTER = {}; +var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL); +var PromiseArray = + _dereq_("./promise_array")(Promise, INTERNAL, + tryConvertToPromise, apiRejection, Proxyable); +var Context = _dereq_("./context")(Promise); + /*jshint unused:false*/ +var createContext = Context.create; + +var debug = _dereq_("./debuggability")(Promise, Context, + enableAsyncHooks, disableAsyncHooks); +var CapturedTrace = debug.CapturedTrace; +var PassThroughHandlerContext = + _dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); +var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER); +var nodebackForPromise = _dereq_("./nodeback"); +var errorObj = util.errorObj; +var tryCatch = util.tryCatch; +function check(self, executor) { + if (self == null || self.constructor !== Promise) { + throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + if (typeof executor !== "function") { + throw new TypeError("expecting a function but got " + util.classString(executor)); + } + +} + +function Promise(executor) { + if (executor !== INTERNAL) { + check(this, executor); + } + this._bitField = 0; + this._fulfillmentHandler0 = undefined; + this._rejectionHandler0 = undefined; + this._promise0 = undefined; + this._receiver0 = undefined; + this._resolveFromExecutor(executor); + this._promiseCreated(); + this._fireEvent("promiseCreated", this); +} + +Promise.prototype.toString = function () { + return "[object Promise]"; +}; + +Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { + var len = arguments.length; + if (len > 1) { + var catchInstances = new Array(len - 1), + j = 0, i; + for (i = 0; i < len - 1; ++i) { + var item = arguments[i]; + if (util.isObject(item)) { + catchInstances[j++] = item; + } else { + return apiRejection("Catch statement predicate: " + + "expecting an object but got " + util.classString(item)); + } + } + catchInstances.length = j; + fn = arguments[i]; + + if (typeof fn !== "function") { + throw new TypeError("The last argument to .catch() " + + "must be a function, got " + util.toString(fn)); + } + return this.then(undefined, catchFilter(catchInstances, fn, this)); + } + return this.then(undefined, fn); +}; + +Promise.prototype.reflect = function () { + return this._then(reflectHandler, + reflectHandler, undefined, this, undefined); +}; + +Promise.prototype.then = function (didFulfill, didReject) { + if (debug.warnings() && arguments.length > 0 && + typeof didFulfill !== "function" && + typeof didReject !== "function") { + var msg = ".then() only accepts functions but was passed: " + + util.classString(didFulfill); + if (arguments.length > 1) { + msg += ", " + util.classString(didReject); + } + this._warn(msg); + } + return this._then(didFulfill, didReject, undefined, undefined, undefined); +}; + +Promise.prototype.done = function (didFulfill, didReject) { + var promise = + this._then(didFulfill, didReject, undefined, undefined, undefined); + promise._setIsFinal(); +}; + +Promise.prototype.spread = function (fn) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + return this.all()._then(fn, undefined, undefined, APPLY, undefined); +}; + +Promise.prototype.toJSON = function () { + var ret = { + isFulfilled: false, + isRejected: false, + fulfillmentValue: undefined, + rejectionReason: undefined + }; + if (this.isFulfilled()) { + ret.fulfillmentValue = this.value(); + ret.isFulfilled = true; + } else if (this.isRejected()) { + ret.rejectionReason = this.reason(); + ret.isRejected = true; + } + return ret; +}; + +Promise.prototype.all = function () { + if (arguments.length > 0) { + this._warn(".all() was passed arguments but it does not take any"); + } + return new PromiseArray(this).promise(); +}; + +Promise.prototype.error = function (fn) { + return this.caught(util.originatesFromRejection, fn); +}; + +Promise.getNewLibraryCopy = module.exports; + +Promise.is = function (val) { + return val instanceof Promise; +}; + +Promise.fromNode = Promise.fromCallback = function(fn) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs + : false; + var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs)); + if (result === errorObj) { + ret._rejectCallback(result.e, true); + } + if (!ret._isFateSealed()) ret._setAsyncGuaranteed(); + return ret; +}; + +Promise.all = function (promises) { + return new PromiseArray(promises).promise(); +}; + +Promise.cast = function (obj) { + var ret = tryConvertToPromise(obj); + if (!(ret instanceof Promise)) { + ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._setFulfilled(); + ret._rejectionHandler0 = obj; + } + return ret; +}; + +Promise.resolve = Promise.fulfilled = Promise.cast; + +Promise.reject = Promise.rejected = function (reason) { + var ret = new Promise(INTERNAL); + ret._captureStackTrace(); + ret._rejectCallback(reason, true); + return ret; +}; + +Promise.setScheduler = function(fn) { + if (typeof fn !== "function") { + throw new TypeError("expecting a function but got " + util.classString(fn)); + } + return async.setScheduler(fn); +}; + +Promise.prototype._then = function ( + didFulfill, + didReject, + _, receiver, + internalData +) { + var haveInternalData = internalData !== undefined; + var promise = haveInternalData ? internalData : new Promise(INTERNAL); + var target = this._target(); + var bitField = target._bitField; + + if (!haveInternalData) { + promise._propagateFrom(this, 3); + promise._captureStackTrace(); + if (receiver === undefined && + ((this._bitField & 2097152) !== 0)) { + if (!((bitField & 50397184) === 0)) { + receiver = this._boundValue(); + } else { + receiver = target === this ? undefined : this._boundTo; + } + } + this._fireEvent("promiseChained", this, promise); + } + + var context = getContext(); + if (!((bitField & 50397184) === 0)) { + var handler, value, settler = target._settlePromiseCtx; + if (((bitField & 33554432) !== 0)) { + value = target._rejectionHandler0; + handler = didFulfill; + } else if (((bitField & 16777216) !== 0)) { + value = target._fulfillmentHandler0; + handler = didReject; + target._unsetRejectionIsUnhandled(); + } else { + settler = target._settlePromiseLateCancellationObserver; + value = new CancellationError("late cancellation observer"); + target._attachExtraTrace(value); + handler = didReject; + } + + async.invoke(settler, target, { + handler: util.contextBind(context, handler), + promise: promise, + receiver: receiver, + value: value + }); + } else { + target._addCallbacks(didFulfill, didReject, promise, + receiver, context); + } + + return promise; +}; + +Promise.prototype._length = function () { + return this._bitField & 65535; +}; + +Promise.prototype._isFateSealed = function () { + return (this._bitField & 117506048) !== 0; +}; + +Promise.prototype._isFollowing = function () { + return (this._bitField & 67108864) === 67108864; +}; + +Promise.prototype._setLength = function (len) { + this._bitField = (this._bitField & -65536) | + (len & 65535); +}; + +Promise.prototype._setFulfilled = function () { + this._bitField = this._bitField | 33554432; + this._fireEvent("promiseFulfilled", this); +}; + +Promise.prototype._setRejected = function () { + this._bitField = this._bitField | 16777216; + this._fireEvent("promiseRejected", this); +}; + +Promise.prototype._setFollowing = function () { + this._bitField = this._bitField | 67108864; + this._fireEvent("promiseResolved", this); +}; + +Promise.prototype._setIsFinal = function () { + this._bitField = this._bitField | 4194304; +}; + +Promise.prototype._isFinal = function () { + return (this._bitField & 4194304) > 0; +}; + +Promise.prototype._unsetCancelled = function() { + this._bitField = this._bitField & (~65536); +}; + +Promise.prototype._setCancelled = function() { + this._bitField = this._bitField | 65536; + this._fireEvent("promiseCancelled", this); +}; + +Promise.prototype._setWillBeCancelled = function() { + this._bitField = this._bitField | 8388608; +}; + +Promise.prototype._setAsyncGuaranteed = function() { + if (async.hasCustomScheduler()) return; + var bitField = this._bitField; + this._bitField = bitField | + (((bitField & 536870912) >> 2) ^ + 134217728); +}; + +Promise.prototype._setNoAsyncGuarantee = function() { + this._bitField = (this._bitField | 536870912) & + (~134217728); +}; + +Promise.prototype._receiverAt = function (index) { + var ret = index === 0 ? this._receiver0 : this[ + index * 4 - 4 + 3]; + if (ret === UNDEFINED_BINDING) { + return undefined; + } else if (ret === undefined && this._isBound()) { + return this._boundValue(); + } + return ret; +}; + +Promise.prototype._promiseAt = function (index) { + return this[ + index * 4 - 4 + 2]; +}; + +Promise.prototype._fulfillmentHandlerAt = function (index) { + return this[ + index * 4 - 4 + 0]; +}; + +Promise.prototype._rejectionHandlerAt = function (index) { + return this[ + index * 4 - 4 + 1]; +}; + +Promise.prototype._boundValue = function() {}; + +Promise.prototype._migrateCallback0 = function (follower) { + var bitField = follower._bitField; + var fulfill = follower._fulfillmentHandler0; + var reject = follower._rejectionHandler0; + var promise = follower._promise0; + var receiver = follower._receiverAt(0); + if (receiver === undefined) receiver = UNDEFINED_BINDING; + this._addCallbacks(fulfill, reject, promise, receiver, null); +}; + +Promise.prototype._migrateCallbackAt = function (follower, index) { + var fulfill = follower._fulfillmentHandlerAt(index); + var reject = follower._rejectionHandlerAt(index); + var promise = follower._promiseAt(index); + var receiver = follower._receiverAt(index); + if (receiver === undefined) receiver = UNDEFINED_BINDING; + this._addCallbacks(fulfill, reject, promise, receiver, null); +}; + +Promise.prototype._addCallbacks = function ( + fulfill, + reject, + promise, + receiver, + context +) { + var index = this._length(); + + if (index >= 65535 - 4) { + index = 0; + this._setLength(0); + } + + if (index === 0) { + this._promise0 = promise; + this._receiver0 = receiver; + if (typeof fulfill === "function") { + this._fulfillmentHandler0 = util.contextBind(context, fulfill); + } + if (typeof reject === "function") { + this._rejectionHandler0 = util.contextBind(context, reject); + } + } else { + var base = index * 4 - 4; + this[base + 2] = promise; + this[base + 3] = receiver; + if (typeof fulfill === "function") { + this[base + 0] = + util.contextBind(context, fulfill); + } + if (typeof reject === "function") { + this[base + 1] = + util.contextBind(context, reject); + } + } + this._setLength(index + 1); + return index; +}; + +Promise.prototype._proxy = function (proxyable, arg) { + this._addCallbacks(undefined, undefined, arg, proxyable, null); +}; + +Promise.prototype._resolveCallback = function(value, shouldBind) { + if (((this._bitField & 117506048) !== 0)) return; + if (value === this) + return this._rejectCallback(makeSelfResolutionError(), false); + var maybePromise = tryConvertToPromise(value, this); + if (!(maybePromise instanceof Promise)) return this._fulfill(value); + + if (shouldBind) this._propagateFrom(maybePromise, 2); + + + var promise = maybePromise._target(); + + if (promise === this) { + this._reject(makeSelfResolutionError()); + return; + } + + var bitField = promise._bitField; + if (((bitField & 50397184) === 0)) { + var len = this._length(); + if (len > 0) promise._migrateCallback0(this); + for (var i = 1; i < len; ++i) { + promise._migrateCallbackAt(this, i); + } + this._setFollowing(); + this._setLength(0); + this._setFollowee(maybePromise); + } else if (((bitField & 33554432) !== 0)) { + this._fulfill(promise._value()); + } else if (((bitField & 16777216) !== 0)) { + this._reject(promise._reason()); + } else { + var reason = new CancellationError("late cancellation observer"); + promise._attachExtraTrace(reason); + this._reject(reason); + } +}; + +Promise.prototype._rejectCallback = +function(reason, synchronous, ignoreNonErrorWarnings) { + var trace = util.ensureErrorObject(reason); + var hasStack = trace === reason; + if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) { + var message = "a promise was rejected with a non-error: " + + util.classString(reason); + this._warn(message, true); + } + this._attachExtraTrace(trace, synchronous ? hasStack : false); + this._reject(reason); +}; + +Promise.prototype._resolveFromExecutor = function (executor) { + if (executor === INTERNAL) return; + var promise = this; + this._captureStackTrace(); + this._pushContext(); + var synchronous = true; + var r = this._execute(executor, function(value) { + promise._resolveCallback(value); + }, function (reason) { + promise._rejectCallback(reason, synchronous); + }); + synchronous = false; + this._popContext(); + + if (r !== undefined) { + promise._rejectCallback(r, true); + } +}; + +Promise.prototype._settlePromiseFromHandler = function ( + handler, receiver, value, promise +) { + var bitField = promise._bitField; + if (((bitField & 65536) !== 0)) return; + promise._pushContext(); + var x; + if (receiver === APPLY) { + if (!value || typeof value.length !== "number") { + x = errorObj; + x.e = new TypeError("cannot .spread() a non-array: " + + util.classString(value)); + } else { + x = tryCatch(handler).apply(this._boundValue(), value); + } + } else { + x = tryCatch(handler).call(receiver, value); + } + var promiseCreated = promise._popContext(); + bitField = promise._bitField; + if (((bitField & 65536) !== 0)) return; + + if (x === NEXT_FILTER) { + promise._reject(value); + } else if (x === errorObj) { + promise._rejectCallback(x.e, false); + } else { + debug.checkForgottenReturns(x, promiseCreated, "", promise, this); + promise._resolveCallback(x); + } +}; + +Promise.prototype._target = function() { + var ret = this; + while (ret._isFollowing()) ret = ret._followee(); + return ret; +}; + +Promise.prototype._followee = function() { + return this._rejectionHandler0; +}; + +Promise.prototype._setFollowee = function(promise) { + this._rejectionHandler0 = promise; +}; + +Promise.prototype._settlePromise = function(promise, handler, receiver, value) { + var isPromise = promise instanceof Promise; + var bitField = this._bitField; + var asyncGuaranteed = ((bitField & 134217728) !== 0); + if (((bitField & 65536) !== 0)) { + if (isPromise) promise._invokeInternalOnCancel(); + + if (receiver instanceof PassThroughHandlerContext && + receiver.isFinallyHandler()) { + receiver.cancelPromise = promise; + if (tryCatch(handler).call(receiver, value) === errorObj) { + promise._reject(errorObj.e); + } + } else if (handler === reflectHandler) { + promise._fulfill(reflectHandler.call(receiver)); + } else if (receiver instanceof Proxyable) { + receiver._promiseCancelled(promise); + } else if (isPromise || promise instanceof PromiseArray) { + promise._cancel(); + } else { + receiver.cancel(); + } + } else if (typeof handler === "function") { + if (!isPromise) { + handler.call(receiver, value, promise); + } else { + if (asyncGuaranteed) promise._setAsyncGuaranteed(); + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (receiver instanceof Proxyable) { + if (!receiver._isResolved()) { + if (((bitField & 33554432) !== 0)) { + receiver._promiseFulfilled(value, promise); + } else { + receiver._promiseRejected(value, promise); + } + } + } else if (isPromise) { + if (asyncGuaranteed) promise._setAsyncGuaranteed(); + if (((bitField & 33554432) !== 0)) { + promise._fulfill(value); + } else { + promise._reject(value); + } + } +}; + +Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) { + var handler = ctx.handler; + var promise = ctx.promise; + var receiver = ctx.receiver; + var value = ctx.value; + if (typeof handler === "function") { + if (!(promise instanceof Promise)) { + handler.call(receiver, value, promise); + } else { + this._settlePromiseFromHandler(handler, receiver, value, promise); + } + } else if (promise instanceof Promise) { + promise._reject(value); + } +}; + +Promise.prototype._settlePromiseCtx = function(ctx) { + this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value); +}; + +Promise.prototype._settlePromise0 = function(handler, value, bitField) { + var promise = this._promise0; + var receiver = this._receiverAt(0); + this._promise0 = undefined; + this._receiver0 = undefined; + this._settlePromise(promise, handler, receiver, value); +}; + +Promise.prototype._clearCallbackDataAtIndex = function(index) { + var base = index * 4 - 4; + this[base + 2] = + this[base + 3] = + this[base + 0] = + this[base + 1] = undefined; +}; + +Promise.prototype._fulfill = function (value) { + var bitField = this._bitField; + if (((bitField & 117506048) >>> 16)) return; + if (value === this) { + var err = makeSelfResolutionError(); + this._attachExtraTrace(err); + return this._reject(err); + } + this._setFulfilled(); + this._rejectionHandler0 = value; + + if ((bitField & 65535) > 0) { + if (((bitField & 134217728) !== 0)) { + this._settlePromises(); + } else { + async.settlePromises(this); + } + this._dereferenceTrace(); + } +}; + +Promise.prototype._reject = function (reason) { + var bitField = this._bitField; + if (((bitField & 117506048) >>> 16)) return; + this._setRejected(); + this._fulfillmentHandler0 = reason; + + if (this._isFinal()) { + return async.fatalError(reason, util.isNode); + } + + if ((bitField & 65535) > 0) { + async.settlePromises(this); + } else { + this._ensurePossibleRejectionHandled(); + } +}; + +Promise.prototype._fulfillPromises = function (len, value) { + for (var i = 1; i < len; i++) { + var handler = this._fulfillmentHandlerAt(i); + var promise = this._promiseAt(i); + var receiver = this._receiverAt(i); + this._clearCallbackDataAtIndex(i); + this._settlePromise(promise, handler, receiver, value); + } +}; + +Promise.prototype._rejectPromises = function (len, reason) { + for (var i = 1; i < len; i++) { + var handler = this._rejectionHandlerAt(i); + var promise = this._promiseAt(i); + var receiver = this._receiverAt(i); + this._clearCallbackDataAtIndex(i); + this._settlePromise(promise, handler, receiver, reason); + } +}; + +Promise.prototype._settlePromises = function () { + var bitField = this._bitField; + var len = (bitField & 65535); + + if (len > 0) { + if (((bitField & 16842752) !== 0)) { + var reason = this._fulfillmentHandler0; + this._settlePromise0(this._rejectionHandler0, reason, bitField); + this._rejectPromises(len, reason); + } else { + var value = this._rejectionHandler0; + this._settlePromise0(this._fulfillmentHandler0, value, bitField); + this._fulfillPromises(len, value); + } + this._setLength(0); + } + this._clearCancellationData(); +}; + +Promise.prototype._settledValue = function() { + var bitField = this._bitField; + if (((bitField & 33554432) !== 0)) { + return this._rejectionHandler0; + } else if (((bitField & 16777216) !== 0)) { + return this._fulfillmentHandler0; + } +}; + +if (typeof Symbol !== "undefined" && Symbol.toStringTag) { + es5.defineProperty(Promise.prototype, Symbol.toStringTag, { + get: function () { + return "Object"; + } + }); +} + +function deferResolve(v) {this.promise._resolveCallback(v);} +function deferReject(v) {this.promise._rejectCallback(v, false);} + +Promise.defer = Promise.pending = function() { + debug.deprecated("Promise.defer", "new Promise"); + var promise = new Promise(INTERNAL); + return { + promise: promise, + resolve: deferResolve, + reject: deferReject + }; +}; + +util.notEnumerableProp(Promise, + "_makeSelfResolutionError", + makeSelfResolutionError); + +_dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection, + debug); +_dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug); +_dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug); +_dereq_("./direct_resolve")(Promise); +_dereq_("./synchronous_inspection")(Promise); +_dereq_("./join")( + Promise, PromiseArray, tryConvertToPromise, INTERNAL, async); +Promise.Promise = Promise; +Promise.version = "3.7.2"; +_dereq_('./call_get.js')(Promise); +_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug); +_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); +_dereq_('./nodeify.js')(Promise); +_dereq_('./promisify.js')(Promise, INTERNAL); +_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); +_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); +_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); +_dereq_('./settle.js')(Promise, PromiseArray, debug); +_dereq_('./some.js')(Promise, PromiseArray, apiRejection); +_dereq_('./timers.js')(Promise, INTERNAL, debug); +_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); +_dereq_('./any.js')(Promise); +_dereq_('./each.js')(Promise, INTERNAL); +_dereq_('./filter.js')(Promise, INTERNAL); + + util.toFastProperties(Promise); + util.toFastProperties(Promise.prototype); + function fillTypes(value) { + var p = new Promise(INTERNAL); + p._fulfillmentHandler0 = value; + p._rejectionHandler0 = value; + p._promise0 = value; + p._receiver0 = value; + } + // Complete slack tracking, opt out of field-type tracking and + // stabilize map + fillTypes({a: 1}); + fillTypes({b: 2}); + fillTypes({c: 3}); + fillTypes(1); + fillTypes(function(){}); + fillTypes(undefined); + fillTypes(false); + fillTypes(new Promise(INTERNAL)); + debug.setBounds(Async.firstLineError, util.lastLineError); + return Promise; + +}; + +},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36,"async_hooks":undefined}],23:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL, tryConvertToPromise, + apiRejection, Proxyable) { +var util = _dereq_("./util"); +var isArray = util.isArray; + +function toResolutionValue(val) { + switch(val) { + case -2: return []; + case -3: return {}; + case -6: return new Map(); + } +} + +function PromiseArray(values) { + var promise = this._promise = new Promise(INTERNAL); + if (values instanceof Promise) { + promise._propagateFrom(values, 3); + values.suppressUnhandledRejections(); + } + promise._setOnCancel(this); + this._values = values; + this._length = 0; + this._totalResolved = 0; + this._init(undefined, -2); +} +util.inherits(PromiseArray, Proxyable); + +PromiseArray.prototype.length = function () { + return this._length; +}; + +PromiseArray.prototype.promise = function () { + return this._promise; +}; + +PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { + var values = tryConvertToPromise(this._values, this._promise); + if (values instanceof Promise) { + values = values._target(); + var bitField = values._bitField; + ; + this._values = values; + + if (((bitField & 50397184) === 0)) { + this._promise._setAsyncGuaranteed(); + return values._then( + init, + this._reject, + undefined, + this, + resolveValueIfEmpty + ); + } else if (((bitField & 33554432) !== 0)) { + values = values._value(); + } else if (((bitField & 16777216) !== 0)) { + return this._reject(values._reason()); + } else { + return this._cancel(); + } + } + values = util.asArray(values); + if (values === null) { + var err = apiRejection( + "expecting an array or an iterable object but got " + util.classString(values)).reason(); + this._promise._rejectCallback(err, false); + return; + } + + if (values.length === 0) { + if (resolveValueIfEmpty === -5) { + this._resolveEmptyArray(); + } + else { + this._resolve(toResolutionValue(resolveValueIfEmpty)); + } + return; + } + this._iterate(values); +}; + +PromiseArray.prototype._iterate = function(values) { + var len = this.getActualLength(values.length); + this._length = len; + this._values = this.shouldCopyValues() ? new Array(len) : this._values; + var result = this._promise; + var isResolved = false; + var bitField = null; + for (var i = 0; i < len; ++i) { + var maybePromise = tryConvertToPromise(values[i], result); + + if (maybePromise instanceof Promise) { + maybePromise = maybePromise._target(); + bitField = maybePromise._bitField; + } else { + bitField = null; + } + + if (isResolved) { + if (bitField !== null) { + maybePromise.suppressUnhandledRejections(); + } + } else if (bitField !== null) { + if (((bitField & 50397184) === 0)) { + maybePromise._proxy(this, i); + this._values[i] = maybePromise; + } else if (((bitField & 33554432) !== 0)) { + isResolved = this._promiseFulfilled(maybePromise._value(), i); + } else if (((bitField & 16777216) !== 0)) { + isResolved = this._promiseRejected(maybePromise._reason(), i); + } else { + isResolved = this._promiseCancelled(i); + } + } else { + isResolved = this._promiseFulfilled(maybePromise, i); + } + } + if (!isResolved) result._setAsyncGuaranteed(); +}; + +PromiseArray.prototype._isResolved = function () { + return this._values === null; +}; + +PromiseArray.prototype._resolve = function (value) { + this._values = null; + this._promise._fulfill(value); +}; + +PromiseArray.prototype._cancel = function() { + if (this._isResolved() || !this._promise._isCancellable()) return; + this._values = null; + this._promise._cancel(); +}; + +PromiseArray.prototype._reject = function (reason) { + this._values = null; + this._promise._rejectCallback(reason, false); +}; + +PromiseArray.prototype._promiseFulfilled = function (value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + this._resolve(this._values); + return true; + } + return false; +}; + +PromiseArray.prototype._promiseCancelled = function() { + this._cancel(); + return true; +}; + +PromiseArray.prototype._promiseRejected = function (reason) { + this._totalResolved++; + this._reject(reason); + return true; +}; + +PromiseArray.prototype._resultCancelled = function() { + if (this._isResolved()) return; + var values = this._values; + this._cancel(); + if (values instanceof Promise) { + values.cancel(); + } else { + for (var i = 0; i < values.length; ++i) { + if (values[i] instanceof Promise) { + values[i].cancel(); + } + } + } +}; + +PromiseArray.prototype.shouldCopyValues = function () { + return true; +}; + +PromiseArray.prototype.getActualLength = function (len) { + return len; +}; + +return PromiseArray; +}; + +},{"./util":36}],24:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var THIS = {}; +var util = _dereq_("./util"); +var nodebackForPromise = _dereq_("./nodeback"); +var withAppended = util.withAppended; +var maybeWrapAsError = util.maybeWrapAsError; +var canEvaluate = util.canEvaluate; +var TypeError = _dereq_("./errors").TypeError; +var defaultSuffix = "Async"; +var defaultPromisified = {__isPromisified__: true}; +var noCopyProps = [ + "arity", "length", + "name", + "arguments", + "caller", + "callee", + "prototype", + "__isPromisified__" +]; +var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$"); + +var defaultFilter = function(name) { + return util.isIdentifier(name) && + name.charAt(0) !== "_" && + name !== "constructor"; +}; + +function propsFilter(key) { + return !noCopyPropsPattern.test(key); +} + +function isPromisified(fn) { + try { + return fn.__isPromisified__ === true; + } + catch (e) { + return false; + } +} + +function hasPromisified(obj, key, suffix) { + var val = util.getDataPropertyOrDefault(obj, key + suffix, + defaultPromisified); + return val ? isPromisified(val) : false; +} +function checkValid(ret, suffix, suffixRegexp) { + for (var i = 0; i < ret.length; i += 2) { + var key = ret[i]; + if (suffixRegexp.test(key)) { + var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); + for (var j = 0; j < ret.length; j += 2) { + if (ret[j] === keyWithoutAsyncSuffix) { + throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a" + .replace("%s", suffix)); + } + } + } + } +} + +function promisifiableMethods(obj, suffix, suffixRegexp, filter) { + var keys = util.inheritedDataKeys(obj); + var ret = []; + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var value = obj[key]; + var passesDefaultFilter = filter === defaultFilter + ? true : defaultFilter(key, value, obj); + if (typeof value === "function" && + !isPromisified(value) && + !hasPromisified(obj, key, suffix) && + filter(key, value, obj, passesDefaultFilter)) { + ret.push(key, value); + } + } + checkValid(ret, suffix, suffixRegexp); + return ret; +} + +var escapeIdentRegex = function(str) { + return str.replace(/([$])/, "\\$"); +}; + +var makeNodePromisifiedEval; +if (!true) { +var switchCaseArgumentOrder = function(likelyArgumentCount) { + var ret = [likelyArgumentCount]; + var min = Math.max(0, likelyArgumentCount - 1 - 3); + for(var i = likelyArgumentCount - 1; i >= min; --i) { + ret.push(i); + } + for(var i = likelyArgumentCount + 1; i <= 3; ++i) { + ret.push(i); + } + return ret; +}; + +var argumentSequence = function(argumentCount) { + return util.filledRange(argumentCount, "_arg", ""); +}; + +var parameterDeclaration = function(parameterCount) { + return util.filledRange( + Math.max(parameterCount, 3), "_arg", ""); +}; + +var parameterCount = function(fn) { + if (typeof fn.length === "number") { + return Math.max(Math.min(fn.length, 1023 + 1), 0); + } + return 0; +}; + +makeNodePromisifiedEval = +function(callback, receiver, originalName, fn, _, multiArgs) { + var newParameterCount = Math.max(0, parameterCount(fn) - 1); + var argumentOrder = switchCaseArgumentOrder(newParameterCount); + var shouldProxyThis = typeof callback === "string" || receiver === THIS; + + function generateCallForArgumentCount(count) { + var args = argumentSequence(count).join(", "); + var comma = count > 0 ? ", " : ""; + var ret; + if (shouldProxyThis) { + ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; + } else { + ret = receiver === undefined + ? "ret = callback({{args}}, nodeback); break;\n" + : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; + } + return ret.replace("{{args}}", args).replace(", ", comma); + } + + function generateArgumentSwitchCase() { + var ret = ""; + for (var i = 0; i < argumentOrder.length; ++i) { + ret += "case " + argumentOrder[i] +":" + + generateCallForArgumentCount(argumentOrder[i]); + } + + ret += " \n\ + default: \n\ + var args = new Array(len + 1); \n\ + var i = 0; \n\ + for (var i = 0; i < len; ++i) { \n\ + args[i] = arguments[i]; \n\ + } \n\ + args[i] = nodeback; \n\ + [CodeForCall] \n\ + break; \n\ + ".replace("[CodeForCall]", (shouldProxyThis + ? "ret = callback.apply(this, args);\n" + : "ret = callback.apply(receiver, args);\n")); + return ret; + } + + var getFunctionCode = typeof callback === "string" + ? ("this != null ? this['"+callback+"'] : fn") + : "fn"; + var body = "'use strict'; \n\ + var ret = function (Parameters) { \n\ + 'use strict'; \n\ + var len = arguments.length; \n\ + var promise = new Promise(INTERNAL); \n\ + promise._captureStackTrace(); \n\ + var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\ + var ret; \n\ + var callback = tryCatch([GetFunctionCode]); \n\ + switch(len) { \n\ + [CodeForSwitchCase] \n\ + } \n\ + if (ret === errorObj) { \n\ + promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ + } \n\ + if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\ + return promise; \n\ + }; \n\ + notEnumerableProp(ret, '__isPromisified__', true); \n\ + return ret; \n\ + ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) + .replace("[GetFunctionCode]", getFunctionCode); + body = body.replace("Parameters", parameterDeclaration(newParameterCount)); + return new Function("Promise", + "fn", + "receiver", + "withAppended", + "maybeWrapAsError", + "nodebackForPromise", + "tryCatch", + "errorObj", + "notEnumerableProp", + "INTERNAL", + body)( + Promise, + fn, + receiver, + withAppended, + maybeWrapAsError, + nodebackForPromise, + util.tryCatch, + util.errorObj, + util.notEnumerableProp, + INTERNAL); +}; +} + +function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) { + var defaultThis = (function() {return this;})(); + var method = callback; + if (typeof method === "string") { + callback = fn; + } + function promisified() { + var _receiver = receiver; + if (receiver === THIS) _receiver = this; + var promise = new Promise(INTERNAL); + promise._captureStackTrace(); + var cb = typeof method === "string" && this !== defaultThis + ? this[method] : callback; + var fn = nodebackForPromise(promise, multiArgs); + try { + cb.apply(_receiver, withAppended(arguments, fn)); + } catch(e) { + promise._rejectCallback(maybeWrapAsError(e), true, true); + } + if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); + return promise; + } + util.notEnumerableProp(promisified, "__isPromisified__", true); + return promisified; +} + +var makeNodePromisified = canEvaluate + ? makeNodePromisifiedEval + : makeNodePromisifiedClosure; + +function promisifyAll(obj, suffix, filter, promisifier, multiArgs) { + var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); + var methods = + promisifiableMethods(obj, suffix, suffixRegexp, filter); + + for (var i = 0, len = methods.length; i < len; i+= 2) { + var key = methods[i]; + var fn = methods[i+1]; + var promisifiedKey = key + suffix; + if (promisifier === makeNodePromisified) { + obj[promisifiedKey] = + makeNodePromisified(key, THIS, key, fn, suffix, multiArgs); + } else { + var promisified = promisifier(fn, function() { + return makeNodePromisified(key, THIS, key, + fn, suffix, multiArgs); + }); + util.notEnumerableProp(promisified, "__isPromisified__", true); + obj[promisifiedKey] = promisified; + } + } + util.toFastProperties(obj); + return obj; +} + +function promisify(callback, receiver, multiArgs) { + return makeNodePromisified(callback, receiver, undefined, + callback, null, multiArgs); +} + +Promise.promisify = function (fn, options) { + if (typeof fn !== "function") { + throw new TypeError("expecting a function but got " + util.classString(fn)); + } + if (isPromisified(fn)) { + return fn; + } + options = Object(options); + var receiver = options.context === undefined ? THIS : options.context; + var multiArgs = !!options.multiArgs; + var ret = promisify(fn, receiver, multiArgs); + util.copyDescriptors(fn, ret, propsFilter); + return ret; +}; + +Promise.promisifyAll = function (target, options) { + if (typeof target !== "function" && typeof target !== "object") { + throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + options = Object(options); + var multiArgs = !!options.multiArgs; + var suffix = options.suffix; + if (typeof suffix !== "string") suffix = defaultSuffix; + var filter = options.filter; + if (typeof filter !== "function") filter = defaultFilter; + var promisifier = options.promisifier; + if (typeof promisifier !== "function") promisifier = makeNodePromisified; + + if (!util.isIdentifier(suffix)) { + throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + + var keys = util.inheritedDataKeys(target); + for (var i = 0; i < keys.length; ++i) { + var value = target[keys[i]]; + if (keys[i] !== "constructor" && + util.isClass(value)) { + promisifyAll(value.prototype, suffix, filter, promisifier, + multiArgs); + promisifyAll(value, suffix, filter, promisifier, multiArgs); + } + } + + return promisifyAll(target, suffix, filter, promisifier, multiArgs); +}; +}; + + +},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function( + Promise, PromiseArray, tryConvertToPromise, apiRejection) { +var util = _dereq_("./util"); +var isObject = util.isObject; +var es5 = _dereq_("./es5"); +var Es6Map; +if (typeof Map === "function") Es6Map = Map; + +var mapToEntries = (function() { + var index = 0; + var size = 0; + + function extractEntry(value, key) { + this[index] = value; + this[index + size] = key; + index++; + } + + return function mapToEntries(map) { + size = map.size; + index = 0; + var ret = new Array(map.size * 2); + map.forEach(extractEntry, ret); + return ret; + }; +})(); + +var entriesToMap = function(entries) { + var ret = new Es6Map(); + var length = entries.length / 2 | 0; + for (var i = 0; i < length; ++i) { + var key = entries[length + i]; + var value = entries[i]; + ret.set(key, value); + } + return ret; +}; + +function PropertiesPromiseArray(obj) { + var isMap = false; + var entries; + if (Es6Map !== undefined && obj instanceof Es6Map) { + entries = mapToEntries(obj); + isMap = true; + } else { + var keys = es5.keys(obj); + var len = keys.length; + entries = new Array(len * 2); + for (var i = 0; i < len; ++i) { + var key = keys[i]; + entries[i] = obj[key]; + entries[i + len] = key; + } + } + this.constructor$(entries); + this._isMap = isMap; + this._init$(undefined, isMap ? -6 : -3); +} +util.inherits(PropertiesPromiseArray, PromiseArray); + +PropertiesPromiseArray.prototype._init = function () {}; + +PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { + this._values[index] = value; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + var val; + if (this._isMap) { + val = entriesToMap(this._values); + } else { + val = {}; + var keyOffset = this.length(); + for (var i = 0, len = this.length(); i < len; ++i) { + val[this._values[i + keyOffset]] = this._values[i]; + } + } + this._resolve(val); + return true; + } + return false; +}; + +PropertiesPromiseArray.prototype.shouldCopyValues = function () { + return false; +}; + +PropertiesPromiseArray.prototype.getActualLength = function (len) { + return len >> 1; +}; + +function props(promises) { + var ret; + var castValue = tryConvertToPromise(promises); + + if (!isObject(castValue)) { + return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } else if (castValue instanceof Promise) { + ret = castValue._then( + Promise.props, undefined, undefined, undefined, undefined); + } else { + ret = new PropertiesPromiseArray(castValue).promise(); + } + + if (castValue instanceof Promise) { + ret._propagateFrom(castValue, 2); + } + return ret; +} + +Promise.prototype.props = function () { + return props(this); +}; + +Promise.props = function (promises) { + return props(promises); +}; +}; + +},{"./es5":13,"./util":36}],26:[function(_dereq_,module,exports){ +"use strict"; +function arrayMove(src, srcIndex, dst, dstIndex, len) { + for (var j = 0; j < len; ++j) { + dst[j + dstIndex] = src[j + srcIndex]; + src[j + srcIndex] = void 0; + } +} + +function Queue(capacity) { + this._capacity = capacity; + this._length = 0; + this._front = 0; +} + +Queue.prototype._willBeOverCapacity = function (size) { + return this._capacity < size; +}; + +Queue.prototype._pushOne = function (arg) { + var length = this.length(); + this._checkCapacity(length + 1); + var i = (this._front + length) & (this._capacity - 1); + this[i] = arg; + this._length = length + 1; +}; + +Queue.prototype.push = function (fn, receiver, arg) { + var length = this.length() + 3; + if (this._willBeOverCapacity(length)) { + this._pushOne(fn); + this._pushOne(receiver); + this._pushOne(arg); + return; + } + var j = this._front + length - 3; + this._checkCapacity(length); + var wrapMask = this._capacity - 1; + this[(j + 0) & wrapMask] = fn; + this[(j + 1) & wrapMask] = receiver; + this[(j + 2) & wrapMask] = arg; + this._length = length; +}; + +Queue.prototype.shift = function () { + var front = this._front, + ret = this[front]; + + this[front] = undefined; + this._front = (front + 1) & (this._capacity - 1); + this._length--; + return ret; +}; + +Queue.prototype.length = function () { + return this._length; +}; + +Queue.prototype._checkCapacity = function (size) { + if (this._capacity < size) { + this._resizeTo(this._capacity << 1); + } +}; + +Queue.prototype._resizeTo = function (capacity) { + var oldCapacity = this._capacity; + this._capacity = capacity; + var front = this._front; + var length = this._length; + var moveItemsCount = (front + length) & (oldCapacity - 1); + arrayMove(this, 0, this, oldCapacity, moveItemsCount); +}; + +module.exports = Queue; + +},{}],27:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function( + Promise, INTERNAL, tryConvertToPromise, apiRejection) { +var util = _dereq_("./util"); + +var raceLater = function (promise) { + return promise.then(function(array) { + return race(array, promise); + }); +}; + +function race(promises, parent) { + var maybePromise = tryConvertToPromise(promises); + + if (maybePromise instanceof Promise) { + return raceLater(maybePromise); + } else { + promises = util.asArray(promises); + if (promises === null) + return apiRejection("expecting an array or an iterable object but got " + util.classString(promises)); + } + + var ret = new Promise(INTERNAL); + if (parent !== undefined) { + ret._propagateFrom(parent, 3); + } + var fulfill = ret._fulfill; + var reject = ret._reject; + for (var i = 0, len = promises.length; i < len; ++i) { + var val = promises[i]; + + if (val === undefined && !(i in promises)) { + continue; + } + + Promise.cast(val)._then(fulfill, reject, undefined, ret, null); + } + return ret; +} + +Promise.race = function (promises) { + return race(promises, undefined); +}; + +Promise.prototype.race = function () { + return race(this, undefined); +}; + +}; + +},{"./util":36}],28:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, + PromiseArray, + apiRejection, + tryConvertToPromise, + INTERNAL, + debug) { +var util = _dereq_("./util"); +var tryCatch = util.tryCatch; + +function ReductionPromiseArray(promises, fn, initialValue, _each) { + this.constructor$(promises); + var context = Promise._getContext(); + this._fn = util.contextBind(context, fn); + if (initialValue !== undefined) { + initialValue = Promise.resolve(initialValue); + initialValue._attachCancellationCallback(this); + } + this._initialValue = initialValue; + this._currentCancellable = null; + if(_each === INTERNAL) { + this._eachValues = Array(this._length); + } else if (_each === 0) { + this._eachValues = null; + } else { + this._eachValues = undefined; + } + this._promise._captureStackTrace(); + this._init$(undefined, -5); +} +util.inherits(ReductionPromiseArray, PromiseArray); + +ReductionPromiseArray.prototype._gotAccum = function(accum) { + if (this._eachValues !== undefined && + this._eachValues !== null && + accum !== INTERNAL) { + this._eachValues.push(accum); + } +}; + +ReductionPromiseArray.prototype._eachComplete = function(value) { + if (this._eachValues !== null) { + this._eachValues.push(value); + } + return this._eachValues; +}; + +ReductionPromiseArray.prototype._init = function() {}; + +ReductionPromiseArray.prototype._resolveEmptyArray = function() { + this._resolve(this._eachValues !== undefined ? this._eachValues + : this._initialValue); +}; + +ReductionPromiseArray.prototype.shouldCopyValues = function () { + return false; +}; + +ReductionPromiseArray.prototype._resolve = function(value) { + this._promise._resolveCallback(value); + this._values = null; +}; + +ReductionPromiseArray.prototype._resultCancelled = function(sender) { + if (sender === this._initialValue) return this._cancel(); + if (this._isResolved()) return; + this._resultCancelled$(); + if (this._currentCancellable instanceof Promise) { + this._currentCancellable.cancel(); + } + if (this._initialValue instanceof Promise) { + this._initialValue.cancel(); + } +}; + +ReductionPromiseArray.prototype._iterate = function (values) { + this._values = values; + var value; + var i; + var length = values.length; + if (this._initialValue !== undefined) { + value = this._initialValue; + i = 0; + } else { + value = Promise.resolve(values[0]); + i = 1; + } + + this._currentCancellable = value; + + for (var j = i; j < length; ++j) { + var maybePromise = values[j]; + if (maybePromise instanceof Promise) { + maybePromise.suppressUnhandledRejections(); + } + } + + if (!value.isRejected()) { + for (; i < length; ++i) { + var ctx = { + accum: null, + value: values[i], + index: i, + length: length, + array: this + }; + + value = value._then(gotAccum, undefined, undefined, ctx, undefined); + + if ((i & 127) === 0) { + value._setNoAsyncGuarantee(); + } + } + } + + if (this._eachValues !== undefined) { + value = value + ._then(this._eachComplete, undefined, undefined, this, undefined); + } + value._then(completed, completed, undefined, value, this); +}; + +Promise.prototype.reduce = function (fn, initialValue) { + return reduce(this, fn, initialValue, null); +}; + +Promise.reduce = function (promises, fn, initialValue, _each) { + return reduce(promises, fn, initialValue, _each); +}; + +function completed(valueOrReason, array) { + if (this.isFulfilled()) { + array._resolve(valueOrReason); + } else { + array._reject(valueOrReason); + } +} + +function reduce(promises, fn, initialValue, _each) { + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var array = new ReductionPromiseArray(promises, fn, initialValue, _each); + return array.promise(); +} + +function gotAccum(accum) { + this.accum = accum; + this.array._gotAccum(accum); + var value = tryConvertToPromise(this.value, this.array._promise); + if (value instanceof Promise) { + this.array._currentCancellable = value; + return value._then(gotValue, undefined, undefined, this, undefined); + } else { + return gotValue.call(this, value); + } +} + +function gotValue(value) { + var array = this.array; + var promise = array._promise; + var fn = tryCatch(array._fn); + promise._pushContext(); + var ret; + if (array._eachValues !== undefined) { + ret = fn.call(promise._boundValue(), value, this.index, this.length); + } else { + ret = fn.call(promise._boundValue(), + this.accum, value, this.index, this.length); + } + if (ret instanceof Promise) { + array._currentCancellable = ret; + } + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns( + ret, + promiseCreated, + array._eachValues !== undefined ? "Promise.each" : "Promise.reduce", + promise + ); + return ret; +} +}; + +},{"./util":36}],29:[function(_dereq_,module,exports){ +"use strict"; +var util = _dereq_("./util"); +var schedule; +var noAsyncScheduler = function() { + throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a"); +}; +var NativePromise = util.getNativePromise(); +if (util.isNode && typeof MutationObserver === "undefined") { + var GlobalSetImmediate = global.setImmediate; + var ProcessNextTick = process.nextTick; + schedule = util.isRecentNode + ? function(fn) { GlobalSetImmediate.call(global, fn); } + : function(fn) { ProcessNextTick.call(process, fn); }; +} else if (typeof NativePromise === "function" && + typeof NativePromise.resolve === "function") { + var nativePromise = NativePromise.resolve(); + schedule = function(fn) { + nativePromise.then(fn); + }; +} else if ((typeof MutationObserver !== "undefined") && + !(typeof window !== "undefined" && + window.navigator && + (window.navigator.standalone || window.cordova)) && + ("classList" in document.documentElement)) { + schedule = (function() { + var div = document.createElement("div"); + var opts = {attributes: true}; + var toggleScheduled = false; + var div2 = document.createElement("div"); + var o2 = new MutationObserver(function() { + div.classList.toggle("foo"); + toggleScheduled = false; + }); + o2.observe(div2, opts); + + var scheduleToggle = function() { + if (toggleScheduled) return; + toggleScheduled = true; + div2.classList.toggle("foo"); + }; + + return function schedule(fn) { + var o = new MutationObserver(function() { + o.disconnect(); + fn(); + }); + o.observe(div, opts); + scheduleToggle(); + }; + })(); +} else if (typeof setImmediate !== "undefined") { + schedule = function (fn) { + setImmediate(fn); + }; +} else if (typeof setTimeout !== "undefined") { + schedule = function (fn) { + setTimeout(fn, 0); + }; +} else { + schedule = noAsyncScheduler; +} +module.exports = schedule; + +},{"./util":36}],30:[function(_dereq_,module,exports){ +"use strict"; +module.exports = + function(Promise, PromiseArray, debug) { +var PromiseInspection = Promise.PromiseInspection; +var util = _dereq_("./util"); + +function SettledPromiseArray(values) { + this.constructor$(values); +} +util.inherits(SettledPromiseArray, PromiseArray); + +SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { + this._values[index] = inspection; + var totalResolved = ++this._totalResolved; + if (totalResolved >= this._length) { + this._resolve(this._values); + return true; + } + return false; +}; + +SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { + var ret = new PromiseInspection(); + ret._bitField = 33554432; + ret._settledValueField = value; + return this._promiseResolved(index, ret); +}; +SettledPromiseArray.prototype._promiseRejected = function (reason, index) { + var ret = new PromiseInspection(); + ret._bitField = 16777216; + ret._settledValueField = reason; + return this._promiseResolved(index, ret); +}; + +Promise.settle = function (promises) { + debug.deprecated(".settle()", ".reflect()"); + return new SettledPromiseArray(promises).promise(); +}; + +Promise.allSettled = function (promises) { + return new SettledPromiseArray(promises).promise(); +}; + +Promise.prototype.settle = function () { + return Promise.settle(this); +}; +}; + +},{"./util":36}],31:[function(_dereq_,module,exports){ +"use strict"; +module.exports = +function(Promise, PromiseArray, apiRejection) { +var util = _dereq_("./util"); +var RangeError = _dereq_("./errors").RangeError; +var AggregateError = _dereq_("./errors").AggregateError; +var isArray = util.isArray; +var CANCELLATION = {}; + + +function SomePromiseArray(values) { + this.constructor$(values); + this._howMany = 0; + this._unwrap = false; + this._initialized = false; +} +util.inherits(SomePromiseArray, PromiseArray); + +SomePromiseArray.prototype._init = function () { + if (!this._initialized) { + return; + } + if (this._howMany === 0) { + this._resolve([]); + return; + } + this._init$(undefined, -5); + var isArrayResolved = isArray(this._values); + if (!this._isResolved() && + isArrayResolved && + this._howMany > this._canPossiblyFulfill()) { + this._reject(this._getRangeError(this.length())); + } +}; + +SomePromiseArray.prototype.init = function () { + this._initialized = true; + this._init(); +}; + +SomePromiseArray.prototype.setUnwrap = function () { + this._unwrap = true; +}; + +SomePromiseArray.prototype.howMany = function () { + return this._howMany; +}; + +SomePromiseArray.prototype.setHowMany = function (count) { + this._howMany = count; +}; + +SomePromiseArray.prototype._promiseFulfilled = function (value) { + this._addFulfilled(value); + if (this._fulfilled() === this.howMany()) { + this._values.length = this.howMany(); + if (this.howMany() === 1 && this._unwrap) { + this._resolve(this._values[0]); + } else { + this._resolve(this._values); + } + return true; + } + return false; + +}; +SomePromiseArray.prototype._promiseRejected = function (reason) { + this._addRejected(reason); + return this._checkOutcome(); +}; + +SomePromiseArray.prototype._promiseCancelled = function () { + if (this._values instanceof Promise || this._values == null) { + return this._cancel(); + } + this._addRejected(CANCELLATION); + return this._checkOutcome(); +}; + +SomePromiseArray.prototype._checkOutcome = function() { + if (this.howMany() > this._canPossiblyFulfill()) { + var e = new AggregateError(); + for (var i = this.length(); i < this._values.length; ++i) { + if (this._values[i] !== CANCELLATION) { + e.push(this._values[i]); + } + } + if (e.length > 0) { + this._reject(e); + } else { + this._cancel(); + } + return true; + } + return false; +}; + +SomePromiseArray.prototype._fulfilled = function () { + return this._totalResolved; +}; + +SomePromiseArray.prototype._rejected = function () { + return this._values.length - this.length(); +}; + +SomePromiseArray.prototype._addRejected = function (reason) { + this._values.push(reason); +}; + +SomePromiseArray.prototype._addFulfilled = function (value) { + this._values[this._totalResolved++] = value; +}; + +SomePromiseArray.prototype._canPossiblyFulfill = function () { + return this.length() - this._rejected(); +}; + +SomePromiseArray.prototype._getRangeError = function (count) { + var message = "Input array must contain at least " + + this._howMany + " items but contains only " + count + " items"; + return new RangeError(message); +}; + +SomePromiseArray.prototype._resolveEmptyArray = function () { + this._reject(this._getRangeError(0)); +}; + +function some(promises, howMany) { + if ((howMany | 0) !== howMany || howMany < 0) { + return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + var ret = new SomePromiseArray(promises); + var promise = ret.promise(); + ret.setHowMany(howMany); + ret.init(); + return promise; +} + +Promise.some = function (promises, howMany) { + return some(promises, howMany); +}; + +Promise.prototype.some = function (howMany) { + return some(this, howMany); +}; + +Promise._SomePromiseArray = SomePromiseArray; +}; + +},{"./errors":12,"./util":36}],32:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise) { +function PromiseInspection(promise) { + if (promise !== undefined) { + promise = promise._target(); + this._bitField = promise._bitField; + this._settledValueField = promise._isFateSealed() + ? promise._settledValue() : undefined; + } + else { + this._bitField = 0; + this._settledValueField = undefined; + } +} + +PromiseInspection.prototype._settledValue = function() { + return this._settledValueField; +}; + +var value = PromiseInspection.prototype.value = function () { + if (!this.isFulfilled()) { + throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + return this._settledValue(); +}; + +var reason = PromiseInspection.prototype.error = +PromiseInspection.prototype.reason = function () { + if (!this.isRejected()) { + throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + } + return this._settledValue(); +}; + +var isFulfilled = PromiseInspection.prototype.isFulfilled = function() { + return (this._bitField & 33554432) !== 0; +}; + +var isRejected = PromiseInspection.prototype.isRejected = function () { + return (this._bitField & 16777216) !== 0; +}; + +var isPending = PromiseInspection.prototype.isPending = function () { + return (this._bitField & 50397184) === 0; +}; + +var isResolved = PromiseInspection.prototype.isResolved = function () { + return (this._bitField & 50331648) !== 0; +}; + +PromiseInspection.prototype.isCancelled = function() { + return (this._bitField & 8454144) !== 0; +}; + +Promise.prototype.__isCancelled = function() { + return (this._bitField & 65536) === 65536; +}; + +Promise.prototype._isCancelled = function() { + return this._target().__isCancelled(); +}; + +Promise.prototype.isCancelled = function() { + return (this._target()._bitField & 8454144) !== 0; +}; + +Promise.prototype.isPending = function() { + return isPending.call(this._target()); +}; + +Promise.prototype.isRejected = function() { + return isRejected.call(this._target()); +}; + +Promise.prototype.isFulfilled = function() { + return isFulfilled.call(this._target()); +}; + +Promise.prototype.isResolved = function() { + return isResolved.call(this._target()); +}; + +Promise.prototype.value = function() { + return value.call(this._target()); +}; + +Promise.prototype.reason = function() { + var target = this._target(); + target._unsetRejectionIsUnhandled(); + return reason.call(target); +}; + +Promise.prototype._value = function() { + return this._settledValue(); +}; + +Promise.prototype._reason = function() { + this._unsetRejectionIsUnhandled(); + return this._settledValue(); +}; + +Promise.PromiseInspection = PromiseInspection; +}; + +},{}],33:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL) { +var util = _dereq_("./util"); +var errorObj = util.errorObj; +var isObject = util.isObject; + +function tryConvertToPromise(obj, context) { + if (isObject(obj)) { + if (obj instanceof Promise) return obj; + var then = getThen(obj); + if (then === errorObj) { + if (context) context._pushContext(); + var ret = Promise.reject(then.e); + if (context) context._popContext(); + return ret; + } else if (typeof then === "function") { + if (isAnyBluebirdPromise(obj)) { + var ret = new Promise(INTERNAL); + obj._then( + ret._fulfill, + ret._reject, + undefined, + ret, + null + ); + return ret; + } + return doThenable(obj, then, context); + } + } + return obj; +} + +function doGetThen(obj) { + return obj.then; +} + +function getThen(obj) { + try { + return doGetThen(obj); + } catch (e) { + errorObj.e = e; + return errorObj; + } +} + +var hasProp = {}.hasOwnProperty; +function isAnyBluebirdPromise(obj) { + try { + return hasProp.call(obj, "_promise0"); + } catch (e) { + return false; + } +} + +function doThenable(x, then, context) { + var promise = new Promise(INTERNAL); + var ret = promise; + if (context) context._pushContext(); + promise._captureStackTrace(); + if (context) context._popContext(); + var synchronous = true; + var result = util.tryCatch(then).call(x, resolve, reject); + synchronous = false; + + if (promise && result === errorObj) { + promise._rejectCallback(result.e, true, true); + promise = null; + } + + function resolve(value) { + if (!promise) return; + promise._resolveCallback(value); + promise = null; + } + + function reject(reason) { + if (!promise) return; + promise._rejectCallback(reason, synchronous, true); + promise = null; + } + return ret; +} + +return tryConvertToPromise; +}; + +},{"./util":36}],34:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function(Promise, INTERNAL, debug) { +var util = _dereq_("./util"); +var TimeoutError = Promise.TimeoutError; + +function HandleWrapper(handle) { + this.handle = handle; +} + +HandleWrapper.prototype._resultCancelled = function() { + clearTimeout(this.handle); +}; + +var afterValue = function(value) { return delay(+this).thenReturn(value); }; +var delay = Promise.delay = function (ms, value) { + var ret; + var handle; + if (value !== undefined) { + ret = Promise.resolve(value) + ._then(afterValue, null, null, ms, undefined); + if (debug.cancellation() && value instanceof Promise) { + ret._setOnCancel(value); + } + } else { + ret = new Promise(INTERNAL); + handle = setTimeout(function() { ret._fulfill(); }, +ms); + if (debug.cancellation()) { + ret._setOnCancel(new HandleWrapper(handle)); + } + ret._captureStackTrace(); + } + ret._setAsyncGuaranteed(); + return ret; +}; + +Promise.prototype.delay = function (ms) { + return delay(ms, this); +}; + +var afterTimeout = function (promise, message, parent) { + var err; + if (typeof message !== "string") { + if (message instanceof Error) { + err = message; + } else { + err = new TimeoutError("operation timed out"); + } + } else { + err = new TimeoutError(message); + } + util.markAsOriginatingFromRejection(err); + promise._attachExtraTrace(err); + promise._reject(err); + + if (parent != null) { + parent.cancel(); + } +}; + +function successClear(value) { + clearTimeout(this.handle); + return value; +} + +function failureClear(reason) { + clearTimeout(this.handle); + throw reason; +} + +Promise.prototype.timeout = function (ms, message) { + ms = +ms; + var ret, parent; + + var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() { + if (ret.isPending()) { + afterTimeout(ret, message, parent); + } + }, ms)); + + if (debug.cancellation()) { + parent = this.then(); + ret = parent._then(successClear, failureClear, + undefined, handleWrapper, undefined); + ret._setOnCancel(handleWrapper); + } else { + ret = this._then(successClear, failureClear, + undefined, handleWrapper, undefined); + } + + return ret; +}; + +}; + +},{"./util":36}],35:[function(_dereq_,module,exports){ +"use strict"; +module.exports = function (Promise, apiRejection, tryConvertToPromise, + createContext, INTERNAL, debug) { + var util = _dereq_("./util"); + var TypeError = _dereq_("./errors").TypeError; + var inherits = _dereq_("./util").inherits; + var errorObj = util.errorObj; + var tryCatch = util.tryCatch; + var NULL = {}; + + function thrower(e) { + setTimeout(function(){throw e;}, 0); + } + + function castPreservingDisposable(thenable) { + var maybePromise = tryConvertToPromise(thenable); + if (maybePromise !== thenable && + typeof thenable._isDisposable === "function" && + typeof thenable._getDisposer === "function" && + thenable._isDisposable()) { + maybePromise._setDisposable(thenable._getDisposer()); + } + return maybePromise; + } + function dispose(resources, inspection) { + var i = 0; + var len = resources.length; + var ret = new Promise(INTERNAL); + function iterator() { + if (i >= len) return ret._fulfill(); + var maybePromise = castPreservingDisposable(resources[i++]); + if (maybePromise instanceof Promise && + maybePromise._isDisposable()) { + try { + maybePromise = tryConvertToPromise( + maybePromise._getDisposer().tryDispose(inspection), + resources.promise); + } catch (e) { + return thrower(e); + } + if (maybePromise instanceof Promise) { + return maybePromise._then(iterator, thrower, + null, null, null); + } + } + iterator(); + } + iterator(); + return ret; + } + + function Disposer(data, promise, context) { + this._data = data; + this._promise = promise; + this._context = context; + } + + Disposer.prototype.data = function () { + return this._data; + }; + + Disposer.prototype.promise = function () { + return this._promise; + }; + + Disposer.prototype.resource = function () { + if (this.promise().isFulfilled()) { + return this.promise().value(); + } + return NULL; + }; + + Disposer.prototype.tryDispose = function(inspection) { + var resource = this.resource(); + var context = this._context; + if (context !== undefined) context._pushContext(); + var ret = resource !== NULL + ? this.doDispose(resource, inspection) : null; + if (context !== undefined) context._popContext(); + this._promise._unsetDisposable(); + this._data = null; + return ret; + }; + + Disposer.isDisposer = function (d) { + return (d != null && + typeof d.resource === "function" && + typeof d.tryDispose === "function"); + }; + + function FunctionDisposer(fn, promise, context) { + this.constructor$(fn, promise, context); + } + inherits(FunctionDisposer, Disposer); + + FunctionDisposer.prototype.doDispose = function (resource, inspection) { + var fn = this.data(); + return fn.call(resource, resource, inspection); + }; + + function maybeUnwrapDisposer(value) { + if (Disposer.isDisposer(value)) { + this.resources[this.index]._setDisposable(value); + return value.promise(); + } + return value; + } + + function ResourceList(length) { + this.length = length; + this.promise = null; + this[length-1] = null; + } + + ResourceList.prototype._resultCancelled = function() { + var len = this.length; + for (var i = 0; i < len; ++i) { + var item = this[i]; + if (item instanceof Promise) { + item.cancel(); + } + } + }; + + Promise.using = function () { + var len = arguments.length; + if (len < 2) return apiRejection( + "you must pass at least 2 arguments to Promise.using"); + var fn = arguments[len - 1]; + if (typeof fn !== "function") { + return apiRejection("expecting a function but got " + util.classString(fn)); + } + var input; + var spreadArgs = true; + if (len === 2 && Array.isArray(arguments[0])) { + input = arguments[0]; + len = input.length; + spreadArgs = false; + } else { + input = arguments; + len--; + } + var resources = new ResourceList(len); + for (var i = 0; i < len; ++i) { + var resource = input[i]; + if (Disposer.isDisposer(resource)) { + var disposer = resource; + resource = resource.promise(); + resource._setDisposable(disposer); + } else { + var maybePromise = tryConvertToPromise(resource); + if (maybePromise instanceof Promise) { + resource = + maybePromise._then(maybeUnwrapDisposer, null, null, { + resources: resources, + index: i + }, undefined); + } + } + resources[i] = resource; + } + + var reflectedResources = new Array(resources.length); + for (var i = 0; i < reflectedResources.length; ++i) { + reflectedResources[i] = Promise.resolve(resources[i]).reflect(); + } + + var resultPromise = Promise.all(reflectedResources) + .then(function(inspections) { + for (var i = 0; i < inspections.length; ++i) { + var inspection = inspections[i]; + if (inspection.isRejected()) { + errorObj.e = inspection.error(); + return errorObj; + } else if (!inspection.isFulfilled()) { + resultPromise.cancel(); + return; + } + inspections[i] = inspection.value(); + } + promise._pushContext(); + + fn = tryCatch(fn); + var ret = spreadArgs + ? fn.apply(undefined, inspections) : fn(inspections); + var promiseCreated = promise._popContext(); + debug.checkForgottenReturns( + ret, promiseCreated, "Promise.using", promise); + return ret; + }); + + var promise = resultPromise.lastly(function() { + var inspection = new Promise.PromiseInspection(resultPromise); + return dispose(resources, inspection); + }); + resources.promise = promise; + promise._setOnCancel(resources); + return promise; + }; + + Promise.prototype._setDisposable = function (disposer) { + this._bitField = this._bitField | 131072; + this._disposer = disposer; + }; + + Promise.prototype._isDisposable = function () { + return (this._bitField & 131072) > 0; + }; + + Promise.prototype._getDisposer = function () { + return this._disposer; + }; + + Promise.prototype._unsetDisposable = function () { + this._bitField = this._bitField & (~131072); + this._disposer = undefined; + }; + + Promise.prototype.disposer = function (fn) { + if (typeof fn === "function") { + return new FunctionDisposer(fn, this, createContext()); + } + throw new TypeError(); + }; + +}; + +},{"./errors":12,"./util":36}],36:[function(_dereq_,module,exports){ +"use strict"; +var es5 = _dereq_("./es5"); +var canEvaluate = typeof navigator == "undefined"; + +var errorObj = {e: {}}; +var tryCatchTarget; +var globalObject = typeof self !== "undefined" ? self : + typeof window !== "undefined" ? window : + typeof global !== "undefined" ? global : + this !== undefined ? this : null; + +function tryCatcher() { + try { + var target = tryCatchTarget; + tryCatchTarget = null; + return target.apply(this, arguments); + } catch (e) { + errorObj.e = e; + return errorObj; + } +} +function tryCatch(fn) { + tryCatchTarget = fn; + return tryCatcher; +} + +var inherits = function(Child, Parent) { + var hasProp = {}.hasOwnProperty; + + function T() { + this.constructor = Child; + this.constructor$ = Parent; + for (var propertyName in Parent.prototype) { + if (hasProp.call(Parent.prototype, propertyName) && + propertyName.charAt(propertyName.length-1) !== "$" + ) { + this[propertyName + "$"] = Parent.prototype[propertyName]; + } + } + } + T.prototype = Parent.prototype; + Child.prototype = new T(); + return Child.prototype; +}; + + +function isPrimitive(val) { + return val == null || val === true || val === false || + typeof val === "string" || typeof val === "number"; + +} + +function isObject(value) { + return typeof value === "function" || + typeof value === "object" && value !== null; +} + +function maybeWrapAsError(maybeError) { + if (!isPrimitive(maybeError)) return maybeError; + + return new Error(safeToString(maybeError)); +} + +function withAppended(target, appendee) { + var len = target.length; + var ret = new Array(len + 1); + var i; + for (i = 0; i < len; ++i) { + ret[i] = target[i]; + } + ret[i] = appendee; + return ret; +} + +function getDataPropertyOrDefault(obj, key, defaultValue) { + if (es5.isES5) { + var desc = Object.getOwnPropertyDescriptor(obj, key); + + if (desc != null) { + return desc.get == null && desc.set == null + ? desc.value + : defaultValue; + } + } else { + return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; + } +} + +function notEnumerableProp(obj, name, value) { + if (isPrimitive(obj)) return obj; + var descriptor = { + value: value, + configurable: true, + enumerable: false, + writable: true + }; + es5.defineProperty(obj, name, descriptor); + return obj; +} + +function thrower(r) { + throw r; +} + +var inheritedDataKeys = (function() { + var excludedPrototypes = [ + Array.prototype, + Object.prototype, + Function.prototype + ]; + + var isExcludedProto = function(val) { + for (var i = 0; i < excludedPrototypes.length; ++i) { + if (excludedPrototypes[i] === val) { + return true; + } + } + return false; + }; + + if (es5.isES5) { + var getKeys = Object.getOwnPropertyNames; + return function(obj) { + var ret = []; + var visitedKeys = Object.create(null); + while (obj != null && !isExcludedProto(obj)) { + var keys; + try { + keys = getKeys(obj); + } catch (e) { + return ret; + } + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (visitedKeys[key]) continue; + visitedKeys[key] = true; + var desc = Object.getOwnPropertyDescriptor(obj, key); + if (desc != null && desc.get == null && desc.set == null) { + ret.push(key); + } + } + obj = es5.getPrototypeOf(obj); + } + return ret; + }; + } else { + var hasProp = {}.hasOwnProperty; + return function(obj) { + if (isExcludedProto(obj)) return []; + var ret = []; + + /*jshint forin:false */ + enumeration: for (var key in obj) { + if (hasProp.call(obj, key)) { + ret.push(key); + } else { + for (var i = 0; i < excludedPrototypes.length; ++i) { + if (hasProp.call(excludedPrototypes[i], key)) { + continue enumeration; + } + } + ret.push(key); + } + } + return ret; + }; + } + +})(); + +var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/; +function isClass(fn) { + try { + if (typeof fn === "function") { + var keys = es5.names(fn.prototype); + + var hasMethods = es5.isES5 && keys.length > 1; + var hasMethodsOtherThanConstructor = keys.length > 0 && + !(keys.length === 1 && keys[0] === "constructor"); + var hasThisAssignmentAndStaticMethods = + thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; + + if (hasMethods || hasMethodsOtherThanConstructor || + hasThisAssignmentAndStaticMethods) { + return true; + } + } + return false; + } catch (e) { + return false; + } +} + +function toFastProperties(obj) { + /*jshint -W027,-W055,-W031*/ + function FakeConstructor() {} + FakeConstructor.prototype = obj; + var receiver = new FakeConstructor(); + function ic() { + return typeof receiver.foo; + } + ic(); + ic(); + return obj; + eval(obj); +} + +var rident = /^[a-z$_][a-z$_0-9]*$/i; +function isIdentifier(str) { + return rident.test(str); +} + +function filledRange(count, prefix, suffix) { + var ret = new Array(count); + for(var i = 0; i < count; ++i) { + ret[i] = prefix + i + suffix; + } + return ret; +} + +function safeToString(obj) { + try { + return obj + ""; + } catch (e) { + return "[no string representation]"; + } +} + +function isError(obj) { + return obj instanceof Error || + (obj !== null && + typeof obj === "object" && + typeof obj.message === "string" && + typeof obj.name === "string"); +} + +function markAsOriginatingFromRejection(e) { + try { + notEnumerableProp(e, "isOperational", true); + } + catch(ignore) {} +} + +function originatesFromRejection(e) { + if (e == null) return false; + return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || + e["isOperational"] === true); +} + +function canAttachTrace(obj) { + return isError(obj) && es5.propertyIsWritable(obj, "stack"); +} + +var ensureErrorObject = (function() { + if (!("stack" in new Error())) { + return function(value) { + if (canAttachTrace(value)) return value; + try {throw new Error(safeToString(value));} + catch(err) {return err;} + }; + } else { + return function(value) { + if (canAttachTrace(value)) return value; + return new Error(safeToString(value)); + }; + } +})(); + +function classString(obj) { + return {}.toString.call(obj); +} + +function copyDescriptors(from, to, filter) { + var keys = es5.names(from); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (filter(key)) { + try { + es5.defineProperty(to, key, es5.getDescriptor(from, key)); + } catch (ignore) {} + } + } +} + +var asArray = function(v) { + if (es5.isArray(v)) { + return v; + } + return null; +}; + +if (typeof Symbol !== "undefined" && Symbol.iterator) { + var ArrayFrom = typeof Array.from === "function" ? function(v) { + return Array.from(v); + } : function(v) { + var ret = []; + var it = v[Symbol.iterator](); + var itResult; + while (!((itResult = it.next()).done)) { + ret.push(itResult.value); + } + return ret; + }; + + asArray = function(v) { + if (es5.isArray(v)) { + return v; + } else if (v != null && typeof v[Symbol.iterator] === "function") { + return ArrayFrom(v); + } + return null; + }; +} + +var isNode = typeof process !== "undefined" && + classString(process).toLowerCase() === "[object process]"; + +var hasEnvVariables = typeof process !== "undefined" && + typeof process.env !== "undefined"; + +function env(key) { + return hasEnvVariables ? process.env[key] : undefined; +} + +function getNativePromise() { + if (typeof Promise === "function") { + try { + var promise = new Promise(function(){}); + if (classString(promise) === "[object Promise]") { + return Promise; + } + } catch (e) {} + } +} + +var reflectHandler; +function contextBind(ctx, cb) { + if (ctx === null || + typeof cb !== "function" || + cb === reflectHandler) { + return cb; + } + + if (ctx.domain !== null) { + cb = ctx.domain.bind(cb); + } + + var async = ctx.async; + if (async !== null) { + var old = cb; + cb = function() { + var args = (new Array(2)).concat([].slice.call(arguments));; + args[0] = old; + args[1] = this; + return async.runInAsyncScope.apply(async, args); + }; + } + return cb; +} + +var ret = { + setReflectHandler: function(fn) { + reflectHandler = fn; + }, + isClass: isClass, + isIdentifier: isIdentifier, + inheritedDataKeys: inheritedDataKeys, + getDataPropertyOrDefault: getDataPropertyOrDefault, + thrower: thrower, + isArray: es5.isArray, + asArray: asArray, + notEnumerableProp: notEnumerableProp, + isPrimitive: isPrimitive, + isObject: isObject, + isError: isError, + canEvaluate: canEvaluate, + errorObj: errorObj, + tryCatch: tryCatch, + inherits: inherits, + withAppended: withAppended, + maybeWrapAsError: maybeWrapAsError, + toFastProperties: toFastProperties, + filledRange: filledRange, + toString: safeToString, + canAttachTrace: canAttachTrace, + ensureErrorObject: ensureErrorObject, + originatesFromRejection: originatesFromRejection, + markAsOriginatingFromRejection: markAsOriginatingFromRejection, + classString: classString, + copyDescriptors: copyDescriptors, + isNode: isNode, + hasEnvVariables: hasEnvVariables, + env: env, + global: globalObject, + getNativePromise: getNativePromise, + contextBind: contextBind +}; +ret.isRecentNode = ret.isNode && (function() { + var version; + if (process.versions && process.versions.node) { + version = process.versions.node.split(".").map(Number); + } else if (process.version) { + version = process.version.split(".").map(Number); + } + return (version[0] === 0 && version[1] > 10) || (version[0] > 0); +})(); +ret.nodeSupportsAsyncResource = ret.isNode && (function() { + var supportsAsync = false; + try { + var res = _dereq_("async_hooks").AsyncResource; + supportsAsync = typeof res.prototype.runInAsyncScope === "function"; + } catch (e) { + supportsAsync = false; + } + return supportsAsync; +})(); + +if (ret.isNode) ret.toFastProperties(process); + +try {throw new Error(); } catch (e) {ret.lastLineError = e;} +module.exports = ret; + +},{"./es5":13,"async_hooks":undefined}]},{},[4])(4) +}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } +; +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory() : + typeof define === 'function' && define.amd ? define(factory) : + (factory()); +}(this, (function () { 'use strict'; + +/** + * @this {Promise} + */ +function finallyConstructor(callback) { + var constructor = this.constructor; + return this.then( + function(value) { + // @ts-ignore + return constructor.resolve(callback()).then(function() { + return value; + }); + }, + function(reason) { + // @ts-ignore + return constructor.resolve(callback()).then(function() { + // @ts-ignore + return constructor.reject(reason); + }); + } + ); +} + +function allSettled(arr) { + var P = this; + return new P(function(resolve, reject) { + if (!(arr && typeof arr.length !== 'undefined')) { + return reject( + new TypeError( + typeof arr + + ' ' + + arr + + ' is not iterable(cannot read property Symbol(Symbol.iterator))' + ) + ); + } + var args = Array.prototype.slice.call(arr); + if (args.length === 0) return resolve([]); + var remaining = args.length; + + function res(i, val) { + if (val && (typeof val === 'object' || typeof val === 'function')) { + var then = val.then; + if (typeof then === 'function') { + then.call( + val, + function(val) { + res(i, val); + }, + function(e) { + args[i] = { status: 'rejected', reason: e }; + if (--remaining === 0) { + resolve(args); + } + } + ); + return; + } + } + args[i] = { status: 'fulfilled', value: val }; + if (--remaining === 0) { + resolve(args); + } + } + + for (var i = 0; i < args.length; i++) { + res(i, args[i]); + } + }); +} + +// Store setTimeout reference so promise-polyfill will be unaffected by +// other code modifying setTimeout (like sinon.useFakeTimers()) +var setTimeoutFunc = setTimeout; + +function isArray(x) { + return Boolean(x && typeof x.length !== 'undefined'); +} + +function noop() {} + +// Polyfill for Function.prototype.bind +function bind(fn, thisArg) { + return function() { + fn.apply(thisArg, arguments); + }; +} + +/** + * @constructor + * @param {Function} fn + */ +function Promise(fn) { + if (!(this instanceof Promise)) + throw new TypeError('Promises must be constructed via new'); + if (typeof fn !== 'function') throw new TypeError('not a function'); + /** @type {!number} */ + this._state = 0; + /** @type {!boolean} */ + this._handled = false; + /** @type {Promise|undefined} */ + this._value = undefined; + /** @type {!Array} */ + this._deferreds = []; + + doResolve(fn, this); +} + +function handle(self, deferred) { + while (self._state === 3) { + self = self._value; + } + if (self._state === 0) { + self._deferreds.push(deferred); + return; + } + self._handled = true; + Promise._immediateFn(function() { + var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; + if (cb === null) { + (self._state === 1 ? resolve : reject)(deferred.promise, self._value); + return; + } + var ret; + try { + ret = cb(self._value); + } catch (e) { + reject(deferred.promise, e); + return; + } + resolve(deferred.promise, ret); + }); +} + +function resolve(self, newValue) { + try { + // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure + if (newValue === self) + throw new TypeError('A promise cannot be resolved with itself.'); + if ( + newValue && + (typeof newValue === 'object' || typeof newValue === 'function') + ) { + var then = newValue.then; + if (newValue instanceof Promise) { + self._state = 3; + self._value = newValue; + finale(self); + return; + } else if (typeof then === 'function') { + doResolve(bind(then, newValue), self); + return; + } + } + self._state = 1; + self._value = newValue; + finale(self); + } catch (e) { + reject(self, e); + } +} + +function reject(self, newValue) { + self._state = 2; + self._value = newValue; + finale(self); +} + +function finale(self) { + if (self._state === 2 && self._deferreds.length === 0) { + Promise._immediateFn(function() { + if (!self._handled) { + Promise._unhandledRejectionFn(self._value); + } + }); + } + + for (var i = 0, len = self._deferreds.length; i < len; i++) { + handle(self, self._deferreds[i]); + } + self._deferreds = null; +} + +/** + * @constructor + */ +function Handler(onFulfilled, onRejected, promise) { + this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; + this.onRejected = typeof onRejected === 'function' ? onRejected : null; + this.promise = promise; +} + +/** + * Take a potentially misbehaving resolver function and make sure + * onFulfilled and onRejected are only called once. + * + * Makes no guarantees about asynchrony. + */ +function doResolve(fn, self) { + var done = false; + try { + fn( + function(value) { + if (done) return; + done = true; + resolve(self, value); + }, + function(reason) { + if (done) return; + done = true; + reject(self, reason); + } + ); + } catch (ex) { + if (done) return; + done = true; + reject(self, ex); + } +} + +Promise.prototype['catch'] = function(onRejected) { + return this.then(null, onRejected); +}; + +Promise.prototype.then = function(onFulfilled, onRejected) { + // @ts-ignore + var prom = new this.constructor(noop); + + handle(this, new Handler(onFulfilled, onRejected, prom)); + return prom; +}; + +Promise.prototype['finally'] = finallyConstructor; + +Promise.all = function(arr) { + return new Promise(function(resolve, reject) { + if (!isArray(arr)) { + return reject(new TypeError('Promise.all accepts an array')); + } + + var args = Array.prototype.slice.call(arr); + if (args.length === 0) return resolve([]); + var remaining = args.length; + + function res(i, val) { + try { + if (val && (typeof val === 'object' || typeof val === 'function')) { + var then = val.then; + if (typeof then === 'function') { + then.call( + val, + function(val) { + res(i, val); + }, + reject + ); + return; + } + } + args[i] = val; + if (--remaining === 0) { + resolve(args); + } + } catch (ex) { + reject(ex); + } + } + + for (var i = 0; i < args.length; i++) { + res(i, args[i]); + } + }); +}; + +Promise.allSettled = allSettled; + +Promise.resolve = function(value) { + if (value && typeof value === 'object' && value.constructor === Promise) { + return value; + } + + return new Promise(function(resolve) { + resolve(value); + }); +}; + +Promise.reject = function(value) { + return new Promise(function(resolve, reject) { + reject(value); + }); +}; + +Promise.race = function(arr) { + return new Promise(function(resolve, reject) { + if (!isArray(arr)) { + return reject(new TypeError('Promise.race accepts an array')); + } + + for (var i = 0, len = arr.length; i < len; i++) { + Promise.resolve(arr[i]).then(resolve, reject); + } + }); +}; + +// Use polyfill for setImmediate for performance gains +Promise._immediateFn = + // @ts-ignore + (typeof setImmediate === 'function' && + function(fn) { + // @ts-ignore + setImmediate(fn); + }) || + function(fn) { + setTimeoutFunc(fn, 0); + }; + +Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { + if (typeof console !== 'undefined' && console) { + console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console + } +}; + +/** @suppress {undefinedVars} */ +var globalNS = (function() { + // the only reliable means to get the global object is + // `Function('return this')()` + // However, this causes CSP violations in Chrome apps. + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + throw new Error('unable to locate global object'); +})(); + +// Expose the polyfill if Promise is undefined or set to a +// non-function value. The latter can be due to a named HTMLElement +// being exposed by browsers for legacy reasons. +// https://github.com/taylorhakes/promise-polyfill/issues/114 +if (typeof globalNS['Promise'] !== 'function') { + globalNS['Promise'] = Promise; +} else if (!globalNS.Promise.prototype['finally']) { + globalNS.Promise.prototype['finally'] = finallyConstructor; +} else if (!globalNS.Promise.allSettled) { + globalNS.Promise.allSettled = allSettled; +} + +}))); + +; +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o ref; i = 0 <= ref ? ++j : --j) { + mapping[Escaper.LIST_ESCAPEES[i]] = Escaper.LIST_ESCAPED[i]; + } + return mapping; + })(); + + Escaper.PATTERN_CHARACTERS_TO_ESCAPE = new Pattern('[\\x00-\\x1f]|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9'); + + Escaper.PATTERN_MAPPING_ESCAPEES = new Pattern(Escaper.LIST_ESCAPEES.join('|').split('\\').join('\\\\')); + + Escaper.PATTERN_SINGLE_QUOTING = new Pattern('[\\s\'":{}[\\],&*#?]|^[-?|<>=!%@`]'); + + Escaper.requiresDoubleQuoting = function(value) { + return this.PATTERN_CHARACTERS_TO_ESCAPE.test(value); + }; + + Escaper.escapeWithDoubleQuotes = function(value) { + var result; + result = this.PATTERN_MAPPING_ESCAPEES.replace(value, (function(_this) { + return function(str) { + return _this.MAPPING_ESCAPEES_TO_ESCAPED[str]; + }; + })(this)); + return '"' + result + '"'; + }; + + Escaper.requiresSingleQuoting = function(value) { + return this.PATTERN_SINGLE_QUOTING.test(value); + }; + + Escaper.escapeWithSingleQuotes = function(value) { + return "'" + value.replace(/'/g, "''") + "'"; + }; + + return Escaper; + +})(); + +module.exports = Escaper; + + +},{"./Pattern":8}],3:[function(require,module,exports){ +var DumpException, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +DumpException = (function(superClass) { + extend(DumpException, superClass); + + function DumpException(message, parsedLine, snippet) { + this.message = message; + this.parsedLine = parsedLine; + this.snippet = snippet; + } + + DumpException.prototype.toString = function() { + if ((this.parsedLine != null) && (this.snippet != null)) { + return ' ' + this.message + ' (line ' + this.parsedLine + ': \'' + this.snippet + '\')'; + } else { + return ' ' + this.message; + } + }; + + return DumpException; + +})(Error); + +module.exports = DumpException; + + +},{}],4:[function(require,module,exports){ +var ParseException, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +ParseException = (function(superClass) { + extend(ParseException, superClass); + + function ParseException(message, parsedLine, snippet) { + this.message = message; + this.parsedLine = parsedLine; + this.snippet = snippet; + } + + ParseException.prototype.toString = function() { + if ((this.parsedLine != null) && (this.snippet != null)) { + return ' ' + this.message + ' (line ' + this.parsedLine + ': \'' + this.snippet + '\')'; + } else { + return ' ' + this.message; + } + }; + + return ParseException; + +})(Error); + +module.exports = ParseException; + + +},{}],5:[function(require,module,exports){ +var ParseMore, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +ParseMore = (function(superClass) { + extend(ParseMore, superClass); + + function ParseMore(message, parsedLine, snippet) { + this.message = message; + this.parsedLine = parsedLine; + this.snippet = snippet; + } + + ParseMore.prototype.toString = function() { + if ((this.parsedLine != null) && (this.snippet != null)) { + return ' ' + this.message + ' (line ' + this.parsedLine + ': \'' + this.snippet + '\')'; + } else { + return ' ' + this.message; + } + }; + + return ParseMore; + +})(Error); + +module.exports = ParseMore; + + +},{}],6:[function(require,module,exports){ +var DumpException, Escaper, Inline, ParseException, ParseMore, Pattern, Unescaper, Utils, + indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + +Pattern = require('./Pattern'); + +Unescaper = require('./Unescaper'); + +Escaper = require('./Escaper'); + +Utils = require('./Utils'); + +ParseException = require('./Exception/ParseException'); + +ParseMore = require('./Exception/ParseMore'); + +DumpException = require('./Exception/DumpException'); + +Inline = (function() { + function Inline() {} + + Inline.REGEX_QUOTED_STRING = '(?:"(?:[^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'(?:[^\']*(?:\'\'[^\']*)*)\')'; + + Inline.PATTERN_TRAILING_COMMENTS = new Pattern('^\\s*#.*$'); + + Inline.PATTERN_QUOTED_SCALAR = new Pattern('^' + Inline.REGEX_QUOTED_STRING); + + Inline.PATTERN_THOUSAND_NUMERIC_SCALAR = new Pattern('^(-|\\+)?[0-9,]+(\\.[0-9]+)?$'); + + Inline.PATTERN_SCALAR_BY_DELIMITERS = {}; + + Inline.settings = {}; + + Inline.configure = function(exceptionOnInvalidType, objectDecoder) { + if (exceptionOnInvalidType == null) { + exceptionOnInvalidType = null; + } + if (objectDecoder == null) { + objectDecoder = null; + } + this.settings.exceptionOnInvalidType = exceptionOnInvalidType; + this.settings.objectDecoder = objectDecoder; + }; + + Inline.parse = function(value, exceptionOnInvalidType, objectDecoder) { + var context, result; + if (exceptionOnInvalidType == null) { + exceptionOnInvalidType = false; + } + if (objectDecoder == null) { + objectDecoder = null; + } + this.settings.exceptionOnInvalidType = exceptionOnInvalidType; + this.settings.objectDecoder = objectDecoder; + if (value == null) { + return ''; + } + value = Utils.trim(value); + if (0 === value.length) { + return ''; + } + context = { + exceptionOnInvalidType: exceptionOnInvalidType, + objectDecoder: objectDecoder, + i: 0 + }; + switch (value.charAt(0)) { + case '[': + result = this.parseSequence(value, context); + ++context.i; + break; + case '{': + result = this.parseMapping(value, context); + ++context.i; + break; + default: + result = this.parseScalar(value, null, ['"', "'"], context); + } + if (this.PATTERN_TRAILING_COMMENTS.replace(value.slice(context.i), '') !== '') { + throw new ParseException('Unexpected characters near "' + value.slice(context.i) + '".'); + } + return result; + }; + + Inline.dump = function(value, exceptionOnInvalidType, objectEncoder) { + var ref, result, type; + if (exceptionOnInvalidType == null) { + exceptionOnInvalidType = false; + } + if (objectEncoder == null) { + objectEncoder = null; + } + if (value == null) { + return 'null'; + } + type = typeof value; + if (type === 'object') { + if (value instanceof Date) { + return value.toISOString(); + } else if (objectEncoder != null) { + result = objectEncoder(value); + if (typeof result === 'string' || (result != null)) { + return result; + } + } + return this.dumpObject(value); + } + if (type === 'boolean') { + return (value ? 'true' : 'false'); + } + if (Utils.isDigits(value)) { + return (type === 'string' ? "'" + value + "'" : String(parseInt(value))); + } + if (Utils.isNumeric(value)) { + return (type === 'string' ? "'" + value + "'" : String(parseFloat(value))); + } + if (type === 'number') { + return (value === Infinity ? '.Inf' : (value === -Infinity ? '-.Inf' : (isNaN(value) ? '.NaN' : value))); + } + if (Escaper.requiresDoubleQuoting(value)) { + return Escaper.escapeWithDoubleQuotes(value); + } + if (Escaper.requiresSingleQuoting(value)) { + return Escaper.escapeWithSingleQuotes(value); + } + if ('' === value) { + return '""'; + } + if (Utils.PATTERN_DATE.test(value)) { + return "'" + value + "'"; + } + if ((ref = value.toLowerCase()) === 'null' || ref === '~' || ref === 'true' || ref === 'false') { + return "'" + value + "'"; + } + return value; + }; + + Inline.dumpObject = function(value, exceptionOnInvalidType, objectSupport) { + var j, key, len1, output, val; + if (objectSupport == null) { + objectSupport = null; + } + if (value instanceof Array) { + output = []; + for (j = 0, len1 = value.length; j < len1; j++) { + val = value[j]; + output.push(this.dump(val)); + } + return '[' + output.join(', ') + ']'; + } else { + output = []; + for (key in value) { + val = value[key]; + output.push(this.dump(key) + ': ' + this.dump(val)); + } + return '{' + output.join(', ') + '}'; + } + }; + + Inline.parseScalar = function(scalar, delimiters, stringDelimiters, context, evaluate) { + var i, joinedDelimiters, match, output, pattern, ref, ref1, strpos, tmp; + if (delimiters == null) { + delimiters = null; + } + if (stringDelimiters == null) { + stringDelimiters = ['"', "'"]; + } + if (context == null) { + context = null; + } + if (evaluate == null) { + evaluate = true; + } + if (context == null) { + context = { + exceptionOnInvalidType: this.settings.exceptionOnInvalidType, + objectDecoder: this.settings.objectDecoder, + i: 0 + }; + } + i = context.i; + if (ref = scalar.charAt(i), indexOf.call(stringDelimiters, ref) >= 0) { + output = this.parseQuotedScalar(scalar, context); + i = context.i; + if (delimiters != null) { + tmp = Utils.ltrim(scalar.slice(i), ' '); + if (!(ref1 = tmp.charAt(0), indexOf.call(delimiters, ref1) >= 0)) { + throw new ParseException('Unexpected characters (' + scalar.slice(i) + ').'); + } + } + } else { + if (!delimiters) { + output = scalar.slice(i); + i += output.length; + strpos = output.indexOf(' #'); + if (strpos !== -1) { + output = Utils.rtrim(output.slice(0, strpos)); + } + } else { + joinedDelimiters = delimiters.join('|'); + pattern = this.PATTERN_SCALAR_BY_DELIMITERS[joinedDelimiters]; + if (pattern == null) { + pattern = new Pattern('^(.+?)(' + joinedDelimiters + ')'); + this.PATTERN_SCALAR_BY_DELIMITERS[joinedDelimiters] = pattern; + } + if (match = pattern.exec(scalar.slice(i))) { + output = match[1]; + i += output.length; + } else { + throw new ParseException('Malformed inline YAML string (' + scalar + ').'); + } + } + if (evaluate) { + output = this.evaluateScalar(output, context); + } + } + context.i = i; + return output; + }; + + Inline.parseQuotedScalar = function(scalar, context) { + var i, match, output; + i = context.i; + if (!(match = this.PATTERN_QUOTED_SCALAR.exec(scalar.slice(i)))) { + throw new ParseMore('Malformed inline YAML string (' + scalar.slice(i) + ').'); + } + output = match[0].substr(1, match[0].length - 2); + if ('"' === scalar.charAt(i)) { + output = Unescaper.unescapeDoubleQuotedString(output); + } else { + output = Unescaper.unescapeSingleQuotedString(output); + } + i += match[0].length; + context.i = i; + return output; + }; + + Inline.parseSequence = function(sequence, context) { + var e, error, i, isQuoted, len, output, ref, value; + output = []; + len = sequence.length; + i = context.i; + i += 1; + while (i < len) { + context.i = i; + switch (sequence.charAt(i)) { + case '[': + output.push(this.parseSequence(sequence, context)); + i = context.i; + break; + case '{': + output.push(this.parseMapping(sequence, context)); + i = context.i; + break; + case ']': + return output; + case ',': + case ' ': + case "\n": + break; + default: + isQuoted = ((ref = sequence.charAt(i)) === '"' || ref === "'"); + value = this.parseScalar(sequence, [',', ']'], ['"', "'"], context); + i = context.i; + if (!isQuoted && typeof value === 'string' && (value.indexOf(': ') !== -1 || value.indexOf(":\n") !== -1)) { + try { + value = this.parseMapping('{' + value + '}'); + } catch (error) { + e = error; + } + } + output.push(value); + --i; + } + ++i; + } + throw new ParseMore('Malformed inline YAML string ' + sequence); + }; + + Inline.parseMapping = function(mapping, context) { + var done, i, key, len, output, shouldContinueWhileLoop, value; + output = {}; + len = mapping.length; + i = context.i; + i += 1; + shouldContinueWhileLoop = false; + while (i < len) { + context.i = i; + switch (mapping.charAt(i)) { + case ' ': + case ',': + case "\n": + ++i; + context.i = i; + shouldContinueWhileLoop = true; + break; + case '}': + return output; + } + if (shouldContinueWhileLoop) { + shouldContinueWhileLoop = false; + continue; + } + key = this.parseScalar(mapping, [':', ' ', "\n"], ['"', "'"], context, false); + i = context.i; + done = false; + while (i < len) { + context.i = i; + switch (mapping.charAt(i)) { + case '[': + value = this.parseSequence(mapping, context); + i = context.i; + if (output[key] === void 0) { + output[key] = value; + } + done = true; + break; + case '{': + value = this.parseMapping(mapping, context); + i = context.i; + if (output[key] === void 0) { + output[key] = value; + } + done = true; + break; + case ':': + case ' ': + case "\n": + break; + default: + value = this.parseScalar(mapping, [',', '}'], ['"', "'"], context); + i = context.i; + if (output[key] === void 0) { + output[key] = value; + } + done = true; + --i; + } + ++i; + if (done) { + break; + } + } + } + throw new ParseMore('Malformed inline YAML string ' + mapping); + }; + + Inline.evaluateScalar = function(scalar, context) { + var cast, date, exceptionOnInvalidType, firstChar, firstSpace, firstWord, objectDecoder, raw, scalarLower, subValue, trimmedScalar; + scalar = Utils.trim(scalar); + scalarLower = scalar.toLowerCase(); + switch (scalarLower) { + case 'null': + case '': + case '~': + return null; + case 'true': + return true; + case 'false': + return false; + case '.inf': + return Infinity; + case '.nan': + return NaN; + case '-.inf': + return Infinity; + default: + firstChar = scalarLower.charAt(0); + switch (firstChar) { + case '!': + firstSpace = scalar.indexOf(' '); + if (firstSpace === -1) { + firstWord = scalarLower; + } else { + firstWord = scalarLower.slice(0, firstSpace); + } + switch (firstWord) { + case '!': + if (firstSpace !== -1) { + return parseInt(this.parseScalar(scalar.slice(2))); + } + return null; + case '!str': + return Utils.ltrim(scalar.slice(4)); + case '!!str': + return Utils.ltrim(scalar.slice(5)); + case '!!int': + return parseInt(this.parseScalar(scalar.slice(5))); + case '!!bool': + return Utils.parseBoolean(this.parseScalar(scalar.slice(6)), false); + case '!!float': + return parseFloat(this.parseScalar(scalar.slice(7))); + case '!!timestamp': + return Utils.stringToDate(Utils.ltrim(scalar.slice(11))); + default: + if (context == null) { + context = { + exceptionOnInvalidType: this.settings.exceptionOnInvalidType, + objectDecoder: this.settings.objectDecoder, + i: 0 + }; + } + objectDecoder = context.objectDecoder, exceptionOnInvalidType = context.exceptionOnInvalidType; + if (objectDecoder) { + trimmedScalar = Utils.rtrim(scalar); + firstSpace = trimmedScalar.indexOf(' '); + if (firstSpace === -1) { + return objectDecoder(trimmedScalar, null); + } else { + subValue = Utils.ltrim(trimmedScalar.slice(firstSpace + 1)); + if (!(subValue.length > 0)) { + subValue = null; + } + return objectDecoder(trimmedScalar.slice(0, firstSpace), subValue); + } + } + if (exceptionOnInvalidType) { + throw new ParseException('Custom object support when parsing a YAML file has been disabled.'); + } + return null; + } + break; + case '0': + if ('0x' === scalar.slice(0, 2)) { + return Utils.hexDec(scalar); + } else if (Utils.isDigits(scalar)) { + return Utils.octDec(scalar); + } else if (Utils.isNumeric(scalar)) { + return parseFloat(scalar); + } else { + return scalar; + } + break; + case '+': + if (Utils.isDigits(scalar)) { + raw = scalar; + cast = parseInt(raw); + if (raw === String(cast)) { + return cast; + } else { + return raw; + } + } else if (Utils.isNumeric(scalar)) { + return parseFloat(scalar); + } else if (this.PATTERN_THOUSAND_NUMERIC_SCALAR.test(scalar)) { + return parseFloat(scalar.replace(',', '')); + } + return scalar; + case '-': + if (Utils.isDigits(scalar.slice(1))) { + if ('0' === scalar.charAt(1)) { + return -Utils.octDec(scalar.slice(1)); + } else { + raw = scalar.slice(1); + cast = parseInt(raw); + if (raw === String(cast)) { + return -cast; + } else { + return -raw; + } + } + } else if (Utils.isNumeric(scalar)) { + return parseFloat(scalar); + } else if (this.PATTERN_THOUSAND_NUMERIC_SCALAR.test(scalar)) { + return parseFloat(scalar.replace(',', '')); + } + return scalar; + default: + if (date = Utils.stringToDate(scalar)) { + return date; + } else if (Utils.isNumeric(scalar)) { + return parseFloat(scalar); + } else if (this.PATTERN_THOUSAND_NUMERIC_SCALAR.test(scalar)) { + return parseFloat(scalar.replace(',', '')); + } + return scalar; + } + } + }; + + return Inline; + +})(); + +module.exports = Inline; + + +},{"./Escaper":2,"./Exception/DumpException":3,"./Exception/ParseException":4,"./Exception/ParseMore":5,"./Pattern":8,"./Unescaper":9,"./Utils":10}],7:[function(require,module,exports){ +var Inline, ParseException, ParseMore, Parser, Pattern, Utils; + +Inline = require('./Inline'); + +Pattern = require('./Pattern'); + +Utils = require('./Utils'); + +ParseException = require('./Exception/ParseException'); + +ParseMore = require('./Exception/ParseMore'); + +Parser = (function() { + Parser.prototype.PATTERN_FOLDED_SCALAR_ALL = new Pattern('^(?:(?![^\\|>]*)\\s+)?(?\\||>)(?\\+|\\-|\\d+|\\+\\d+|\\-\\d+|\\d+\\+|\\d+\\-)?(? +#.*)?$'); + + Parser.prototype.PATTERN_FOLDED_SCALAR_END = new Pattern('(?\\||>)(?\\+|\\-|\\d+|\\+\\d+|\\-\\d+|\\d+\\+|\\d+\\-)?(? +#.*)?$'); + + Parser.prototype.PATTERN_SEQUENCE_ITEM = new Pattern('^\\-((?\\s+)(?.+?))?\\s*$'); + + Parser.prototype.PATTERN_ANCHOR_VALUE = new Pattern('^&(?[^ ]+) *(?.*)'); + + Parser.prototype.PATTERN_COMPACT_NOTATION = new Pattern('^(?' + Inline.REGEX_QUOTED_STRING + '|[^ \'"\\{\\[].*?) *\\:(\\s+(?.+?))?\\s*$'); + + Parser.prototype.PATTERN_MAPPING_ITEM = new Pattern('^(?' + Inline.REGEX_QUOTED_STRING + '|[^ \'"\\[\\{].*?) *\\:(\\s+(?.+?))?\\s*$'); + + Parser.prototype.PATTERN_DECIMAL = new Pattern('\\d+'); + + Parser.prototype.PATTERN_INDENT_SPACES = new Pattern('^ +'); + + Parser.prototype.PATTERN_TRAILING_LINES = new Pattern('(\n*)$'); + + Parser.prototype.PATTERN_YAML_HEADER = new Pattern('^\\%YAML[: ][\\d\\.]+.*\n', 'm'); + + Parser.prototype.PATTERN_LEADING_COMMENTS = new Pattern('^(\\#.*?\n)+', 'm'); + + Parser.prototype.PATTERN_DOCUMENT_MARKER_START = new Pattern('^\\-\\-\\-.*?\n', 'm'); + + Parser.prototype.PATTERN_DOCUMENT_MARKER_END = new Pattern('^\\.\\.\\.\\s*$', 'm'); + + Parser.prototype.PATTERN_FOLDED_SCALAR_BY_INDENTATION = {}; + + Parser.prototype.CONTEXT_NONE = 0; + + Parser.prototype.CONTEXT_SEQUENCE = 1; + + Parser.prototype.CONTEXT_MAPPING = 2; + + function Parser(offset) { + this.offset = offset != null ? offset : 0; + this.lines = []; + this.currentLineNb = -1; + this.currentLine = ''; + this.refs = {}; + } + + Parser.prototype.parse = function(value, exceptionOnInvalidType, objectDecoder) { + var alias, allowOverwrite, block, c, context, data, e, error, error1, error2, first, i, indent, isRef, j, k, key, l, lastKey, len, len1, len2, len3, lineCount, m, matches, mergeNode, n, name, parsed, parsedItem, parser, ref, ref1, ref2, refName, refValue, val, values; + if (exceptionOnInvalidType == null) { + exceptionOnInvalidType = false; + } + if (objectDecoder == null) { + objectDecoder = null; + } + this.currentLineNb = -1; + this.currentLine = ''; + this.lines = this.cleanup(value).split("\n"); + data = null; + context = this.CONTEXT_NONE; + allowOverwrite = false; + while (this.moveToNextLine()) { + if (this.isCurrentLineEmpty()) { + continue; + } + if ("\t" === this.currentLine[0]) { + throw new ParseException('A YAML file cannot contain tabs as indentation.', this.getRealCurrentLineNb() + 1, this.currentLine); + } + isRef = mergeNode = false; + if (values = this.PATTERN_SEQUENCE_ITEM.exec(this.currentLine)) { + if (this.CONTEXT_MAPPING === context) { + throw new ParseException('You cannot define a sequence item when in a mapping'); + } + context = this.CONTEXT_SEQUENCE; + if (data == null) { + data = []; + } + if ((values.value != null) && (matches = this.PATTERN_ANCHOR_VALUE.exec(values.value))) { + isRef = matches.ref; + values.value = matches.value; + } + if (!(values.value != null) || '' === Utils.trim(values.value, ' ') || Utils.ltrim(values.value, ' ').indexOf('#') === 0) { + if (this.currentLineNb < this.lines.length - 1 && !this.isNextLineUnIndentedCollection()) { + c = this.getRealCurrentLineNb() + 1; + parser = new Parser(c); + parser.refs = this.refs; + data.push(parser.parse(this.getNextEmbedBlock(null, true), exceptionOnInvalidType, objectDecoder)); + } else { + data.push(null); + } + } else { + if (((ref = values.leadspaces) != null ? ref.length : void 0) && (matches = this.PATTERN_COMPACT_NOTATION.exec(values.value))) { + c = this.getRealCurrentLineNb(); + parser = new Parser(c); + parser.refs = this.refs; + block = values.value; + indent = this.getCurrentLineIndentation(); + if (this.isNextLineIndented(false)) { + block += "\n" + this.getNextEmbedBlock(indent + values.leadspaces.length + 1, true); + } + data.push(parser.parse(block, exceptionOnInvalidType, objectDecoder)); + } else { + data.push(this.parseValue(values.value, exceptionOnInvalidType, objectDecoder)); + } + } + } else if ((values = this.PATTERN_MAPPING_ITEM.exec(this.currentLine)) && values.key.indexOf(' #') === -1) { + if (this.CONTEXT_SEQUENCE === context) { + throw new ParseException('You cannot define a mapping item when in a sequence'); + } + context = this.CONTEXT_MAPPING; + if (data == null) { + data = {}; + } + Inline.configure(exceptionOnInvalidType, objectDecoder); + try { + key = Inline.parseScalar(values.key); + } catch (error) { + e = error; + e.parsedLine = this.getRealCurrentLineNb() + 1; + e.snippet = this.currentLine; + throw e; + } + if ('<<' === key) { + mergeNode = true; + allowOverwrite = true; + if (((ref1 = values.value) != null ? ref1.indexOf('*') : void 0) === 0) { + refName = values.value.slice(1); + if (this.refs[refName] == null) { + throw new ParseException('Reference "' + refName + '" does not exist.', this.getRealCurrentLineNb() + 1, this.currentLine); + } + refValue = this.refs[refName]; + if (typeof refValue !== 'object') { + throw new ParseException('YAML merge keys used with a scalar value instead of an object.', this.getRealCurrentLineNb() + 1, this.currentLine); + } + if (refValue instanceof Array) { + for (i = j = 0, len = refValue.length; j < len; i = ++j) { + value = refValue[i]; + if (data[name = String(i)] == null) { + data[name] = value; + } + } + } else { + for (key in refValue) { + value = refValue[key]; + if (data[key] == null) { + data[key] = value; + } + } + } + } else { + if ((values.value != null) && values.value !== '') { + value = values.value; + } else { + value = this.getNextEmbedBlock(); + } + c = this.getRealCurrentLineNb() + 1; + parser = new Parser(c); + parser.refs = this.refs; + parsed = parser.parse(value, exceptionOnInvalidType); + if (typeof parsed !== 'object') { + throw new ParseException('YAML merge keys used with a scalar value instead of an object.', this.getRealCurrentLineNb() + 1, this.currentLine); + } + if (parsed instanceof Array) { + for (l = 0, len1 = parsed.length; l < len1; l++) { + parsedItem = parsed[l]; + if (typeof parsedItem !== 'object') { + throw new ParseException('Merge items must be objects.', this.getRealCurrentLineNb() + 1, parsedItem); + } + if (parsedItem instanceof Array) { + for (i = m = 0, len2 = parsedItem.length; m < len2; i = ++m) { + value = parsedItem[i]; + k = String(i); + if (!data.hasOwnProperty(k)) { + data[k] = value; + } + } + } else { + for (key in parsedItem) { + value = parsedItem[key]; + if (!data.hasOwnProperty(key)) { + data[key] = value; + } + } + } + } + } else { + for (key in parsed) { + value = parsed[key]; + if (!data.hasOwnProperty(key)) { + data[key] = value; + } + } + } + } + } else if ((values.value != null) && (matches = this.PATTERN_ANCHOR_VALUE.exec(values.value))) { + isRef = matches.ref; + values.value = matches.value; + } + if (mergeNode) { + + } else if (!(values.value != null) || '' === Utils.trim(values.value, ' ') || Utils.ltrim(values.value, ' ').indexOf('#') === 0) { + if (!(this.isNextLineIndented()) && !(this.isNextLineUnIndentedCollection())) { + if (allowOverwrite || data[key] === void 0) { + data[key] = null; + } + } else { + c = this.getRealCurrentLineNb() + 1; + parser = new Parser(c); + parser.refs = this.refs; + val = parser.parse(this.getNextEmbedBlock(), exceptionOnInvalidType, objectDecoder); + if (allowOverwrite || data[key] === void 0) { + data[key] = val; + } + } + } else { + val = this.parseValue(values.value, exceptionOnInvalidType, objectDecoder); + if (allowOverwrite || data[key] === void 0) { + data[key] = val; + } + } + } else { + lineCount = this.lines.length; + if (1 === lineCount || (2 === lineCount && Utils.isEmpty(this.lines[1]))) { + try { + value = Inline.parse(this.lines[0], exceptionOnInvalidType, objectDecoder); + } catch (error1) { + e = error1; + e.parsedLine = this.getRealCurrentLineNb() + 1; + e.snippet = this.currentLine; + throw e; + } + if (typeof value === 'object') { + if (value instanceof Array) { + first = value[0]; + } else { + for (key in value) { + first = value[key]; + break; + } + } + if (typeof first === 'string' && first.indexOf('*') === 0) { + data = []; + for (n = 0, len3 = value.length; n < len3; n++) { + alias = value[n]; + data.push(this.refs[alias.slice(1)]); + } + value = data; + } + } + return value; + } else if ((ref2 = Utils.ltrim(value).charAt(0)) === '[' || ref2 === '{') { + try { + return Inline.parse(value, exceptionOnInvalidType, objectDecoder); + } catch (error2) { + e = error2; + e.parsedLine = this.getRealCurrentLineNb() + 1; + e.snippet = this.currentLine; + throw e; + } + } + throw new ParseException('Unable to parse.', this.getRealCurrentLineNb() + 1, this.currentLine); + } + if (isRef) { + if (data instanceof Array) { + this.refs[isRef] = data[data.length - 1]; + } else { + lastKey = null; + for (key in data) { + lastKey = key; + } + this.refs[isRef] = data[lastKey]; + } + } + } + if (Utils.isEmpty(data)) { + return null; + } else { + return data; + } + }; + + Parser.prototype.getRealCurrentLineNb = function() { + return this.currentLineNb + this.offset; + }; + + Parser.prototype.getCurrentLineIndentation = function() { + return this.currentLine.length - Utils.ltrim(this.currentLine, ' ').length; + }; + + Parser.prototype.getNextEmbedBlock = function(indentation, includeUnindentedCollection) { + var data, indent, isItUnindentedCollection, newIndent, removeComments, removeCommentsPattern, unindentedEmbedBlock; + if (indentation == null) { + indentation = null; + } + if (includeUnindentedCollection == null) { + includeUnindentedCollection = false; + } + this.moveToNextLine(); + if (indentation == null) { + newIndent = this.getCurrentLineIndentation(); + unindentedEmbedBlock = this.isStringUnIndentedCollectionItem(this.currentLine); + if (!(this.isCurrentLineEmpty()) && 0 === newIndent && !unindentedEmbedBlock) { + throw new ParseException('Indentation problem.', this.getRealCurrentLineNb() + 1, this.currentLine); + } + } else { + newIndent = indentation; + } + data = [this.currentLine.slice(newIndent)]; + if (!includeUnindentedCollection) { + isItUnindentedCollection = this.isStringUnIndentedCollectionItem(this.currentLine); + } + removeCommentsPattern = this.PATTERN_FOLDED_SCALAR_END; + removeComments = !removeCommentsPattern.test(this.currentLine); + while (this.moveToNextLine()) { + indent = this.getCurrentLineIndentation(); + if (indent === newIndent) { + removeComments = !removeCommentsPattern.test(this.currentLine); + } + if (removeComments && this.isCurrentLineComment()) { + continue; + } + if (this.isCurrentLineBlank()) { + data.push(this.currentLine.slice(newIndent)); + continue; + } + if (isItUnindentedCollection && !this.isStringUnIndentedCollectionItem(this.currentLine) && indent === newIndent) { + this.moveToPreviousLine(); + break; + } + if (indent >= newIndent) { + data.push(this.currentLine.slice(newIndent)); + } else if (Utils.ltrim(this.currentLine).charAt(0) === '#') { + + } else if (0 === indent) { + this.moveToPreviousLine(); + break; + } else { + throw new ParseException('Indentation problem.', this.getRealCurrentLineNb() + 1, this.currentLine); + } + } + return data.join("\n"); + }; + + Parser.prototype.moveToNextLine = function() { + if (this.currentLineNb >= this.lines.length - 1) { + return false; + } + this.currentLine = this.lines[++this.currentLineNb]; + return true; + }; + + Parser.prototype.moveToPreviousLine = function() { + this.currentLine = this.lines[--this.currentLineNb]; + }; + + Parser.prototype.parseValue = function(value, exceptionOnInvalidType, objectDecoder) { + var e, error, foldedIndent, matches, modifiers, pos, ref, ref1, val; + if (0 === value.indexOf('*')) { + pos = value.indexOf('#'); + if (pos !== -1) { + value = value.substr(1, pos - 2); + } else { + value = value.slice(1); + } + if (this.refs[value] === void 0) { + throw new ParseException('Reference "' + value + '" does not exist.', this.currentLine); + } + return this.refs[value]; + } + if (matches = this.PATTERN_FOLDED_SCALAR_ALL.exec(value)) { + modifiers = (ref = matches.modifiers) != null ? ref : ''; + foldedIndent = Math.abs(parseInt(modifiers)); + if (isNaN(foldedIndent)) { + foldedIndent = 0; + } + val = this.parseFoldedScalar(matches.separator, this.PATTERN_DECIMAL.replace(modifiers, ''), foldedIndent); + if (matches.type != null) { + Inline.configure(exceptionOnInvalidType, objectDecoder); + return Inline.parseScalar(matches.type + ' ' + val); + } else { + return val; + } + } + if ((ref1 = value.charAt(0)) === '[' || ref1 === '{' || ref1 === '"' || ref1 === "'") { + while (true) { + try { + return Inline.parse(value, exceptionOnInvalidType, objectDecoder); + } catch (error) { + e = error; + if (e instanceof ParseMore && this.moveToNextLine()) { + value += "\n" + Utils.trim(this.currentLine, ' '); + } else { + e.parsedLine = this.getRealCurrentLineNb() + 1; + e.snippet = this.currentLine; + throw e; + } + } + } + } else { + if (this.isNextLineIndented()) { + value += "\n" + this.getNextEmbedBlock(); + } + return Inline.parse(value, exceptionOnInvalidType, objectDecoder); + } + }; + + Parser.prototype.parseFoldedScalar = function(separator, indicator, indentation) { + var isCurrentLineBlank, j, len, line, matches, newText, notEOF, pattern, ref, text; + if (indicator == null) { + indicator = ''; + } + if (indentation == null) { + indentation = 0; + } + notEOF = this.moveToNextLine(); + if (!notEOF) { + return ''; + } + isCurrentLineBlank = this.isCurrentLineBlank(); + text = ''; + while (notEOF && isCurrentLineBlank) { + if (notEOF = this.moveToNextLine()) { + text += "\n"; + isCurrentLineBlank = this.isCurrentLineBlank(); + } + } + if (0 === indentation) { + if (matches = this.PATTERN_INDENT_SPACES.exec(this.currentLine)) { + indentation = matches[0].length; + } + } + if (indentation > 0) { + pattern = this.PATTERN_FOLDED_SCALAR_BY_INDENTATION[indentation]; + if (pattern == null) { + pattern = new Pattern('^ {' + indentation + '}(.*)$'); + Parser.prototype.PATTERN_FOLDED_SCALAR_BY_INDENTATION[indentation] = pattern; + } + while (notEOF && (isCurrentLineBlank || (matches = pattern.exec(this.currentLine)))) { + if (isCurrentLineBlank) { + text += this.currentLine.slice(indentation); + } else { + text += matches[1]; + } + if (notEOF = this.moveToNextLine()) { + text += "\n"; + isCurrentLineBlank = this.isCurrentLineBlank(); + } + } + } else if (notEOF) { + text += "\n"; + } + if (notEOF) { + this.moveToPreviousLine(); + } + if ('>' === separator) { + newText = ''; + ref = text.split("\n"); + for (j = 0, len = ref.length; j < len; j++) { + line = ref[j]; + if (line.length === 0 || line.charAt(0) === ' ') { + newText = Utils.rtrim(newText, ' ') + line + "\n"; + } else { + newText += line + ' '; + } + } + text = newText; + } + if ('+' !== indicator) { + text = Utils.rtrim(text); + } + if ('' === indicator) { + text = this.PATTERN_TRAILING_LINES.replace(text, "\n"); + } else if ('-' === indicator) { + text = this.PATTERN_TRAILING_LINES.replace(text, ''); + } + return text; + }; + + Parser.prototype.isNextLineIndented = function(ignoreComments) { + var EOF, currentIndentation, ret; + if (ignoreComments == null) { + ignoreComments = true; + } + currentIndentation = this.getCurrentLineIndentation(); + EOF = !this.moveToNextLine(); + if (ignoreComments) { + while (!EOF && this.isCurrentLineEmpty()) { + EOF = !this.moveToNextLine(); + } + } else { + while (!EOF && this.isCurrentLineBlank()) { + EOF = !this.moveToNextLine(); + } + } + if (EOF) { + return false; + } + ret = false; + if (this.getCurrentLineIndentation() > currentIndentation) { + ret = true; + } + this.moveToPreviousLine(); + return ret; + }; + + Parser.prototype.isCurrentLineEmpty = function() { + var trimmedLine; + trimmedLine = Utils.trim(this.currentLine, ' '); + return trimmedLine.length === 0 || trimmedLine.charAt(0) === '#'; + }; + + Parser.prototype.isCurrentLineBlank = function() { + return '' === Utils.trim(this.currentLine, ' '); + }; + + Parser.prototype.isCurrentLineComment = function() { + var ltrimmedLine; + ltrimmedLine = Utils.ltrim(this.currentLine, ' '); + return ltrimmedLine.charAt(0) === '#'; + }; + + Parser.prototype.cleanup = function(value) { + var count, i, indent, j, l, len, len1, line, lines, ref, ref1, ref2, smallestIndent, trimmedValue; + if (value.indexOf("\r") !== -1) { + value = value.split("\r\n").join("\n").split("\r").join("\n"); + } + count = 0; + ref = this.PATTERN_YAML_HEADER.replaceAll(value, ''), value = ref[0], count = ref[1]; + this.offset += count; + ref1 = this.PATTERN_LEADING_COMMENTS.replaceAll(value, '', 1), trimmedValue = ref1[0], count = ref1[1]; + if (count === 1) { + this.offset += Utils.subStrCount(value, "\n") - Utils.subStrCount(trimmedValue, "\n"); + value = trimmedValue; + } + ref2 = this.PATTERN_DOCUMENT_MARKER_START.replaceAll(value, '', 1), trimmedValue = ref2[0], count = ref2[1]; + if (count === 1) { + this.offset += Utils.subStrCount(value, "\n") - Utils.subStrCount(trimmedValue, "\n"); + value = trimmedValue; + value = this.PATTERN_DOCUMENT_MARKER_END.replace(value, ''); + } + lines = value.split("\n"); + smallestIndent = -1; + for (j = 0, len = lines.length; j < len; j++) { + line = lines[j]; + if (Utils.trim(line, ' ').length === 0) { + continue; + } + indent = line.length - Utils.ltrim(line).length; + if (smallestIndent === -1 || indent < smallestIndent) { + smallestIndent = indent; + } + } + if (smallestIndent > 0) { + for (i = l = 0, len1 = lines.length; l < len1; i = ++l) { + line = lines[i]; + lines[i] = line.slice(smallestIndent); + } + value = lines.join("\n"); + } + return value; + }; + + Parser.prototype.isNextLineUnIndentedCollection = function(currentIndentation) { + var notEOF, ret; + if (currentIndentation == null) { + currentIndentation = null; + } + if (currentIndentation == null) { + currentIndentation = this.getCurrentLineIndentation(); } - - if ((bitField & 65535) > 0) { - async.settlePromises(this); - } else { - this._ensurePossibleRejectionHandled(); + notEOF = this.moveToNextLine(); + while (notEOF && this.isCurrentLineEmpty()) { + notEOF = this.moveToNextLine(); } -}; - -Promise.prototype._fulfillPromises = function (len, value) { - for (var i = 1; i < len; i++) { - var handler = this._fulfillmentHandlerAt(i); - var promise = this._promiseAt(i); - var receiver = this._receiverAt(i); - this._clearCallbackDataAtIndex(i); - this._settlePromise(promise, handler, receiver, value); + if (false === notEOF) { + return false; } -}; - -Promise.prototype._rejectPromises = function (len, reason) { - for (var i = 1; i < len; i++) { - var handler = this._rejectionHandlerAt(i); - var promise = this._promiseAt(i); - var receiver = this._receiverAt(i); - this._clearCallbackDataAtIndex(i); - this._settlePromise(promise, handler, receiver, reason); + ret = false; + if (this.getCurrentLineIndentation() === currentIndentation && this.isStringUnIndentedCollectionItem(this.currentLine)) { + ret = true; } -}; + this.moveToPreviousLine(); + return ret; + }; -Promise.prototype._settlePromises = function () { - var bitField = this._bitField; - var len = (bitField & 65535); + Parser.prototype.isStringUnIndentedCollectionItem = function() { + return this.currentLine === '-' || this.currentLine.slice(0, 2) === '- '; + }; - if (len > 0) { - if (((bitField & 16842752) !== 0)) { - var reason = this._fulfillmentHandler0; - this._settlePromise0(this._rejectionHandler0, reason, bitField); - this._rejectPromises(len, reason); - } else { - var value = this._rejectionHandler0; - this._settlePromise0(this._fulfillmentHandler0, value, bitField); - this._fulfillPromises(len, value); - } - this._setLength(0); - } - this._clearCancellationData(); -}; + return Parser; -Promise.prototype._settledValue = function() { - var bitField = this._bitField; - if (((bitField & 33554432) !== 0)) { - return this._rejectionHandler0; - } else if (((bitField & 16777216) !== 0)) { - return this._fulfillmentHandler0; - } -}; +})(); -if (typeof Symbol !== "undefined" && Symbol.toStringTag) { - es5.defineProperty(Promise.prototype, Symbol.toStringTag, { - get: function () { - return "Object"; - } - }); -} +module.exports = Parser; -function deferResolve(v) {this.promise._resolveCallback(v);} -function deferReject(v) {this.promise._rejectCallback(v, false);} -Promise.defer = Promise.pending = function() { - debug.deprecated("Promise.defer", "new Promise"); - var promise = new Promise(INTERNAL); - return { - promise: promise, - resolve: deferResolve, - reject: deferReject - }; -}; +},{"./Exception/ParseException":4,"./Exception/ParseMore":5,"./Inline":6,"./Pattern":8,"./Utils":10}],8:[function(require,module,exports){ +var Pattern; -util.notEnumerableProp(Promise, - "_makeSelfResolutionError", - makeSelfResolutionError); +Pattern = (function() { + Pattern.prototype.regex = null; -_dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection, - debug); -_dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug); -_dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug); -_dereq_("./direct_resolve")(Promise); -_dereq_("./synchronous_inspection")(Promise); -_dereq_("./join")( - Promise, PromiseArray, tryConvertToPromise, INTERNAL, async); -Promise.Promise = Promise; -Promise.version = "3.7.2"; -_dereq_('./call_get.js')(Promise); -_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug); -_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); -_dereq_('./nodeify.js')(Promise); -_dereq_('./promisify.js')(Promise, INTERNAL); -_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); -_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); -_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); -_dereq_('./settle.js')(Promise, PromiseArray, debug); -_dereq_('./some.js')(Promise, PromiseArray, apiRejection); -_dereq_('./timers.js')(Promise, INTERNAL, debug); -_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug); -_dereq_('./any.js')(Promise); -_dereq_('./each.js')(Promise, INTERNAL); -_dereq_('./filter.js')(Promise, INTERNAL); - - util.toFastProperties(Promise); - util.toFastProperties(Promise.prototype); - function fillTypes(value) { - var p = new Promise(INTERNAL); - p._fulfillmentHandler0 = value; - p._rejectionHandler0 = value; - p._promise0 = value; - p._receiver0 = value; - } - // Complete slack tracking, opt out of field-type tracking and - // stabilize map - fillTypes({a: 1}); - fillTypes({b: 2}); - fillTypes({c: 3}); - fillTypes(1); - fillTypes(function(){}); - fillTypes(undefined); - fillTypes(false); - fillTypes(new Promise(INTERNAL)); - debug.setBounds(Async.firstLineError, util.lastLineError); - return Promise; + Pattern.prototype.rawRegex = null; -}; + Pattern.prototype.cleanedRegex = null; -},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36,"async_hooks":undefined}],23:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, - apiRejection, Proxyable) { -var util = _dereq_("./util"); -var isArray = util.isArray; + Pattern.prototype.mapping = null; -function toResolutionValue(val) { - switch(val) { - case -2: return []; - case -3: return {}; - case -6: return new Map(); + function Pattern(rawRegex, modifiers) { + var _char, capturingBracketNumber, cleanedRegex, i, len, mapping, name, part, subChar; + if (modifiers == null) { + modifiers = ''; } -} - -function PromiseArray(values) { - var promise = this._promise = new Promise(INTERNAL); - if (values instanceof Promise) { - promise._propagateFrom(values, 3); - values.suppressUnhandledRejections(); + cleanedRegex = ''; + len = rawRegex.length; + mapping = null; + capturingBracketNumber = 0; + i = 0; + while (i < len) { + _char = rawRegex.charAt(i); + if (_char === '\\') { + cleanedRegex += rawRegex.slice(i, +(i + 1) + 1 || 9e9); + i++; + } else if (_char === '(') { + if (i < len - 2) { + part = rawRegex.slice(i, +(i + 2) + 1 || 9e9); + if (part === '(?:') { + i += 2; + cleanedRegex += part; + } else if (part === '(?<') { + capturingBracketNumber++; + i += 2; + name = ''; + while (i + 1 < len) { + subChar = rawRegex.charAt(i + 1); + if (subChar === '>') { + cleanedRegex += '('; + i++; + if (name.length > 0) { + if (mapping == null) { + mapping = {}; + } + mapping[name] = capturingBracketNumber; + } + break; + } else { + name += subChar; + } + i++; + } + } else { + cleanedRegex += _char; + capturingBracketNumber++; + } + } else { + cleanedRegex += _char; + } + } else { + cleanedRegex += _char; + } + i++; } - promise._setOnCancel(this); - this._values = values; - this._length = 0; - this._totalResolved = 0; - this._init(undefined, -2); -} -util.inherits(PromiseArray, Proxyable); + this.rawRegex = rawRegex; + this.cleanedRegex = cleanedRegex; + this.regex = new RegExp(this.cleanedRegex, 'g' + modifiers.replace('g', '')); + this.mapping = mapping; + } -PromiseArray.prototype.length = function () { - return this._length; -}; + Pattern.prototype.exec = function(str) { + var index, matches, name, ref; + this.regex.lastIndex = 0; + matches = this.regex.exec(str); + if (matches == null) { + return null; + } + if (this.mapping != null) { + ref = this.mapping; + for (name in ref) { + index = ref[name]; + matches[name] = matches[index]; + } + } + return matches; + }; -PromiseArray.prototype.promise = function () { - return this._promise; -}; + Pattern.prototype.test = function(str) { + this.regex.lastIndex = 0; + return this.regex.test(str); + }; -PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { - var values = tryConvertToPromise(this._values, this._promise); - if (values instanceof Promise) { - values = values._target(); - var bitField = values._bitField; - ; - this._values = values; + Pattern.prototype.replace = function(str, replacement) { + this.regex.lastIndex = 0; + return str.replace(this.regex, replacement); + }; - if (((bitField & 50397184) === 0)) { - this._promise._setAsyncGuaranteed(); - return values._then( - init, - this._reject, - undefined, - this, - resolveValueIfEmpty - ); - } else if (((bitField & 33554432) !== 0)) { - values = values._value(); - } else if (((bitField & 16777216) !== 0)) { - return this._reject(values._reason()); - } else { - return this._cancel(); - } + Pattern.prototype.replaceAll = function(str, replacement, limit) { + var count; + if (limit == null) { + limit = 0; } - values = util.asArray(values); - if (values === null) { - var err = apiRejection( - "expecting an array or an iterable object but got " + util.classString(values)).reason(); - this._promise._rejectCallback(err, false); - return; + this.regex.lastIndex = 0; + count = 0; + while (this.regex.test(str) && (limit === 0 || count < limit)) { + this.regex.lastIndex = 0; + str = str.replace(this.regex, replacement); + count++; } + return [str, count]; + }; - if (values.length === 0) { - if (resolveValueIfEmpty === -5) { - this._resolveEmptyArray(); - } - else { - this._resolve(toResolutionValue(resolveValueIfEmpty)); - } - return; - } - this._iterate(values); -}; + return Pattern; -PromiseArray.prototype._iterate = function(values) { - var len = this.getActualLength(values.length); - this._length = len; - this._values = this.shouldCopyValues() ? new Array(len) : this._values; - var result = this._promise; - var isResolved = false; - var bitField = null; - for (var i = 0; i < len; ++i) { - var maybePromise = tryConvertToPromise(values[i], result); +})(); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - bitField = maybePromise._bitField; - } else { - bitField = null; - } +module.exports = Pattern; - if (isResolved) { - if (bitField !== null) { - maybePromise.suppressUnhandledRejections(); - } - } else if (bitField !== null) { - if (((bitField & 50397184) === 0)) { - maybePromise._proxy(this, i); - this._values[i] = maybePromise; - } else if (((bitField & 33554432) !== 0)) { - isResolved = this._promiseFulfilled(maybePromise._value(), i); - } else if (((bitField & 16777216) !== 0)) { - isResolved = this._promiseRejected(maybePromise._reason(), i); - } else { - isResolved = this._promiseCancelled(i); - } - } else { - isResolved = this._promiseFulfilled(maybePromise, i); - } - } - if (!isResolved) result._setAsyncGuaranteed(); -}; -PromiseArray.prototype._isResolved = function () { - return this._values === null; -}; +},{}],9:[function(require,module,exports){ +var Pattern, Unescaper, Utils; -PromiseArray.prototype._resolve = function (value) { - this._values = null; - this._promise._fulfill(value); -}; +Utils = require('./Utils'); -PromiseArray.prototype._cancel = function() { - if (this._isResolved() || !this._promise._isCancellable()) return; - this._values = null; - this._promise._cancel(); -}; +Pattern = require('./Pattern'); -PromiseArray.prototype._reject = function (reason) { - this._values = null; - this._promise._rejectCallback(reason, false); -}; +Unescaper = (function() { + function Unescaper() {} -PromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - return true; - } - return false; -}; + Unescaper.PATTERN_ESCAPED_CHARACTER = new Pattern('\\\\([0abt\tnvfre "\\/\\\\N_LP]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})'); -PromiseArray.prototype._promiseCancelled = function() { - this._cancel(); - return true; -}; + Unescaper.unescapeSingleQuotedString = function(value) { + return value.replace(/\'\'/g, '\''); + }; -PromiseArray.prototype._promiseRejected = function (reason) { - this._totalResolved++; - this._reject(reason); - return true; -}; + Unescaper.unescapeDoubleQuotedString = function(value) { + if (this._unescapeCallback == null) { + this._unescapeCallback = (function(_this) { + return function(str) { + return _this.unescapeCharacter(str); + }; + })(this); + } + return this.PATTERN_ESCAPED_CHARACTER.replace(value, this._unescapeCallback); + }; -PromiseArray.prototype._resultCancelled = function() { - if (this._isResolved()) return; - var values = this._values; - this._cancel(); - if (values instanceof Promise) { - values.cancel(); - } else { - for (var i = 0; i < values.length; ++i) { - if (values[i] instanceof Promise) { - values[i].cancel(); - } - } + Unescaper.unescapeCharacter = function(value) { + var ch; + ch = String.fromCharCode; + switch (value.charAt(1)) { + case '0': + return ch(0); + case 'a': + return ch(7); + case 'b': + return ch(8); + case 't': + return "\t"; + case "\t": + return "\t"; + case 'n': + return "\n"; + case 'v': + return ch(11); + case 'f': + return ch(12); + case 'r': + return ch(13); + case 'e': + return ch(27); + case ' ': + return ' '; + case '"': + return '"'; + case '/': + return '/'; + case '\\': + return '\\'; + case 'N': + return ch(0x0085); + case '_': + return ch(0x00A0); + case 'L': + return ch(0x2028); + case 'P': + return ch(0x2029); + case 'x': + return Utils.utf8chr(Utils.hexDec(value.substr(2, 2))); + case 'u': + return Utils.utf8chr(Utils.hexDec(value.substr(2, 4))); + case 'U': + return Utils.utf8chr(Utils.hexDec(value.substr(2, 8))); + default: + return ''; } -}; + }; -PromiseArray.prototype.shouldCopyValues = function () { - return true; -}; + return Unescaper; -PromiseArray.prototype.getActualLength = function (len) { - return len; -}; +})(); -return PromiseArray; -}; +module.exports = Unescaper; -},{"./util":36}],24:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var THIS = {}; -var util = _dereq_("./util"); -var nodebackForPromise = _dereq_("./nodeback"); -var withAppended = util.withAppended; -var maybeWrapAsError = util.maybeWrapAsError; -var canEvaluate = util.canEvaluate; -var TypeError = _dereq_("./errors").TypeError; -var defaultSuffix = "Async"; -var defaultPromisified = {__isPromisified__: true}; -var noCopyProps = [ - "arity", "length", - "name", - "arguments", - "caller", - "callee", - "prototype", - "__isPromisified__" -]; -var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$"); -var defaultFilter = function(name) { - return util.isIdentifier(name) && - name.charAt(0) !== "_" && - name !== "constructor"; -}; +},{"./Pattern":8,"./Utils":10}],10:[function(require,module,exports){ +var Pattern, Utils, + hasProp = {}.hasOwnProperty; -function propsFilter(key) { - return !noCopyPropsPattern.test(key); -} +Pattern = require('./Pattern'); -function isPromisified(fn) { - try { - return fn.__isPromisified__ === true; - } - catch (e) { - return false; - } -} +Utils = (function() { + function Utils() {} -function hasPromisified(obj, key, suffix) { - var val = util.getDataPropertyOrDefault(obj, key + suffix, - defaultPromisified); - return val ? isPromisified(val) : false; -} -function checkValid(ret, suffix, suffixRegexp) { - for (var i = 0; i < ret.length; i += 2) { - var key = ret[i]; - if (suffixRegexp.test(key)) { - var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); - for (var j = 0; j < ret.length; j += 2) { - if (ret[j] === keyWithoutAsyncSuffix) { - throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a" - .replace("%s", suffix)); - } - } - } - } -} + Utils.REGEX_LEFT_TRIM_BY_CHAR = {}; -function promisifiableMethods(obj, suffix, suffixRegexp, filter) { - var keys = util.inheritedDataKeys(obj); - var ret = []; - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var value = obj[key]; - var passesDefaultFilter = filter === defaultFilter - ? true : defaultFilter(key, value, obj); - if (typeof value === "function" && - !isPromisified(value) && - !hasPromisified(obj, key, suffix) && - filter(key, value, obj, passesDefaultFilter)) { - ret.push(key, value); - } - } - checkValid(ret, suffix, suffixRegexp); - return ret; -} + Utils.REGEX_RIGHT_TRIM_BY_CHAR = {}; -var escapeIdentRegex = function(str) { - return str.replace(/([$])/, "\\$"); -}; + Utils.REGEX_SPACES = /\s+/g; -var makeNodePromisifiedEval; -if (!true) { -var switchCaseArgumentOrder = function(likelyArgumentCount) { - var ret = [likelyArgumentCount]; - var min = Math.max(0, likelyArgumentCount - 1 - 3); - for(var i = likelyArgumentCount - 1; i >= min; --i) { - ret.push(i); - } - for(var i = likelyArgumentCount + 1; i <= 3; ++i) { - ret.push(i); - } - return ret; -}; + Utils.REGEX_DIGITS = /^\d+$/; -var argumentSequence = function(argumentCount) { - return util.filledRange(argumentCount, "_arg", ""); -}; + Utils.REGEX_OCTAL = /[^0-7]/gi; -var parameterDeclaration = function(parameterCount) { - return util.filledRange( - Math.max(parameterCount, 3), "_arg", ""); -}; + Utils.REGEX_HEXADECIMAL = /[^a-f0-9]/gi; -var parameterCount = function(fn) { - if (typeof fn.length === "number") { - return Math.max(Math.min(fn.length, 1023 + 1), 0); - } - return 0; -}; + Utils.PATTERN_DATE = new Pattern('^' + '(?[0-9][0-9][0-9][0-9])' + '-(?[0-9][0-9]?)' + '-(?[0-9][0-9]?)' + '(?:(?:[Tt]|[ \t]+)' + '(?[0-9][0-9]?)' + ':(?[0-9][0-9])' + ':(?[0-9][0-9])' + '(?:\.(?[0-9]*))?' + '(?:[ \t]*(?Z|(?[-+])(?[0-9][0-9]?)' + '(?::(?[0-9][0-9]))?))?)?' + '$', 'i'); -makeNodePromisifiedEval = -function(callback, receiver, originalName, fn, _, multiArgs) { - var newParameterCount = Math.max(0, parameterCount(fn) - 1); - var argumentOrder = switchCaseArgumentOrder(newParameterCount); - var shouldProxyThis = typeof callback === "string" || receiver === THIS; + Utils.LOCAL_TIMEZONE_OFFSET = new Date().getTimezoneOffset() * 60 * 1000; - function generateCallForArgumentCount(count) { - var args = argumentSequence(count).join(", "); - var comma = count > 0 ? ", " : ""; - var ret; - if (shouldProxyThis) { - ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; - } else { - ret = receiver === undefined - ? "ret = callback({{args}}, nodeback); break;\n" - : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; - } - return ret.replace("{{args}}", args).replace(", ", comma); + Utils.trim = function(str, _char) { + var regexLeft, regexRight; + if (_char == null) { + _char = '\\s'; + } + regexLeft = this.REGEX_LEFT_TRIM_BY_CHAR[_char]; + if (regexLeft == null) { + this.REGEX_LEFT_TRIM_BY_CHAR[_char] = regexLeft = new RegExp('^' + _char + '' + _char + '*'); + } + regexLeft.lastIndex = 0; + regexRight = this.REGEX_RIGHT_TRIM_BY_CHAR[_char]; + if (regexRight == null) { + this.REGEX_RIGHT_TRIM_BY_CHAR[_char] = regexRight = new RegExp(_char + '' + _char + '*$'); } + regexRight.lastIndex = 0; + return str.replace(regexLeft, '').replace(regexRight, ''); + }; - function generateArgumentSwitchCase() { - var ret = ""; - for (var i = 0; i < argumentOrder.length; ++i) { - ret += "case " + argumentOrder[i] +":" + - generateCallForArgumentCount(argumentOrder[i]); - } + Utils.ltrim = function(str, _char) { + var regexLeft; + if (_char == null) { + _char = '\\s'; + } + regexLeft = this.REGEX_LEFT_TRIM_BY_CHAR[_char]; + if (regexLeft == null) { + this.REGEX_LEFT_TRIM_BY_CHAR[_char] = regexLeft = new RegExp('^' + _char + '' + _char + '*'); + } + regexLeft.lastIndex = 0; + return str.replace(regexLeft, ''); + }; - ret += " \n\ - default: \n\ - var args = new Array(len + 1); \n\ - var i = 0; \n\ - for (var i = 0; i < len; ++i) { \n\ - args[i] = arguments[i]; \n\ - } \n\ - args[i] = nodeback; \n\ - [CodeForCall] \n\ - break; \n\ - ".replace("[CodeForCall]", (shouldProxyThis - ? "ret = callback.apply(this, args);\n" - : "ret = callback.apply(receiver, args);\n")); - return ret; + Utils.rtrim = function(str, _char) { + var regexRight; + if (_char == null) { + _char = '\\s'; + } + regexRight = this.REGEX_RIGHT_TRIM_BY_CHAR[_char]; + if (regexRight == null) { + this.REGEX_RIGHT_TRIM_BY_CHAR[_char] = regexRight = new RegExp(_char + '' + _char + '*$'); } + regexRight.lastIndex = 0; + return str.replace(regexRight, ''); + }; - var getFunctionCode = typeof callback === "string" - ? ("this != null ? this['"+callback+"'] : fn") - : "fn"; - var body = "'use strict'; \n\ - var ret = function (Parameters) { \n\ - 'use strict'; \n\ - var len = arguments.length; \n\ - var promise = new Promise(INTERNAL); \n\ - promise._captureStackTrace(); \n\ - var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\ - var ret; \n\ - var callback = tryCatch([GetFunctionCode]); \n\ - switch(len) { \n\ - [CodeForSwitchCase] \n\ - } \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ - } \n\ - if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\ - return promise; \n\ - }; \n\ - notEnumerableProp(ret, '__isPromisified__', true); \n\ - return ret; \n\ - ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) - .replace("[GetFunctionCode]", getFunctionCode); - body = body.replace("Parameters", parameterDeclaration(newParameterCount)); - return new Function("Promise", - "fn", - "receiver", - "withAppended", - "maybeWrapAsError", - "nodebackForPromise", - "tryCatch", - "errorObj", - "notEnumerableProp", - "INTERNAL", - body)( - Promise, - fn, - receiver, - withAppended, - maybeWrapAsError, - nodebackForPromise, - util.tryCatch, - util.errorObj, - util.notEnumerableProp, - INTERNAL); -}; -} + Utils.isEmpty = function(value) { + return !value || value === '' || value === '0' || (value instanceof Array && value.length === 0) || this.isEmptyObject(value); + }; -function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) { - var defaultThis = (function() {return this;})(); - var method = callback; - if (typeof method === "string") { - callback = fn; + Utils.isEmptyObject = function(value) { + var k; + return value instanceof Object && ((function() { + var results; + results = []; + for (k in value) { + if (!hasProp.call(value, k)) continue; + results.push(k); + } + return results; + })()).length === 0; + }; + + Utils.subStrCount = function(string, subString, start, length) { + var c, i, j, len, ref, sublen; + c = 0; + string = '' + string; + subString = '' + subString; + if (start != null) { + string = string.slice(start); } - function promisified() { - var _receiver = receiver; - if (receiver === THIS) _receiver = this; - var promise = new Promise(INTERNAL); - promise._captureStackTrace(); - var cb = typeof method === "string" && this !== defaultThis - ? this[method] : callback; - var fn = nodebackForPromise(promise, multiArgs); - try { - cb.apply(_receiver, withAppended(arguments, fn)); - } catch(e) { - promise._rejectCallback(maybeWrapAsError(e), true, true); - } - if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); - return promise; + if (length != null) { + string = string.slice(0, length); } - util.notEnumerableProp(promisified, "__isPromisified__", true); - return promisified; -} + len = string.length; + sublen = subString.length; + for (i = j = 0, ref = len; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) { + if (subString === string.slice(i, sublen)) { + c++; + i += sublen - 1; + } + } + return c; + }; -var makeNodePromisified = canEvaluate - ? makeNodePromisifiedEval - : makeNodePromisifiedClosure; + Utils.isDigits = function(input) { + this.REGEX_DIGITS.lastIndex = 0; + return this.REGEX_DIGITS.test(input); + }; -function promisifyAll(obj, suffix, filter, promisifier, multiArgs) { - var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); - var methods = - promisifiableMethods(obj, suffix, suffixRegexp, filter); + Utils.octDec = function(input) { + this.REGEX_OCTAL.lastIndex = 0; + return parseInt((input + '').replace(this.REGEX_OCTAL, ''), 8); + }; - for (var i = 0, len = methods.length; i < len; i+= 2) { - var key = methods[i]; - var fn = methods[i+1]; - var promisifiedKey = key + suffix; - if (promisifier === makeNodePromisified) { - obj[promisifiedKey] = - makeNodePromisified(key, THIS, key, fn, suffix, multiArgs); - } else { - var promisified = promisifier(fn, function() { - return makeNodePromisified(key, THIS, key, - fn, suffix, multiArgs); - }); - util.notEnumerableProp(promisified, "__isPromisified__", true); - obj[promisifiedKey] = promisified; - } + Utils.hexDec = function(input) { + this.REGEX_HEXADECIMAL.lastIndex = 0; + input = this.trim(input); + if ((input + '').slice(0, 2) === '0x') { + input = (input + '').slice(2); } - util.toFastProperties(obj); - return obj; -} - -function promisify(callback, receiver, multiArgs) { - return makeNodePromisified(callback, receiver, undefined, - callback, null, multiArgs); -} + return parseInt((input + '').replace(this.REGEX_HEXADECIMAL, ''), 16); + }; -Promise.promisify = function (fn, options) { - if (typeof fn !== "function") { - throw new TypeError("expecting a function but got " + util.classString(fn)); + Utils.utf8chr = function(c) { + var ch; + ch = String.fromCharCode; + if (0x80 > (c %= 0x200000)) { + return ch(c); } - if (isPromisified(fn)) { - return fn; + if (0x800 > c) { + return ch(0xC0 | c >> 6) + ch(0x80 | c & 0x3F); } - options = Object(options); - var receiver = options.context === undefined ? THIS : options.context; - var multiArgs = !!options.multiArgs; - var ret = promisify(fn, receiver, multiArgs); - util.copyDescriptors(fn, ret, propsFilter); - return ret; -}; - -Promise.promisifyAll = function (target, options) { - if (typeof target !== "function" && typeof target !== "object") { - throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + if (0x10000 > c) { + return ch(0xE0 | c >> 12) + ch(0x80 | c >> 6 & 0x3F) + ch(0x80 | c & 0x3F); } - options = Object(options); - var multiArgs = !!options.multiArgs; - var suffix = options.suffix; - if (typeof suffix !== "string") suffix = defaultSuffix; - var filter = options.filter; - if (typeof filter !== "function") filter = defaultFilter; - var promisifier = options.promisifier; - if (typeof promisifier !== "function") promisifier = makeNodePromisified; + return ch(0xF0 | c >> 18) + ch(0x80 | c >> 12 & 0x3F) + ch(0x80 | c >> 6 & 0x3F) + ch(0x80 | c & 0x3F); + }; - if (!util.isIdentifier(suffix)) { - throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a"); + Utils.parseBoolean = function(input, strict) { + var lowerInput; + if (strict == null) { + strict = true; } - - var keys = util.inheritedDataKeys(target); - for (var i = 0; i < keys.length; ++i) { - var value = target[keys[i]]; - if (keys[i] !== "constructor" && - util.isClass(value)) { - promisifyAll(value.prototype, suffix, filter, promisifier, - multiArgs); - promisifyAll(value, suffix, filter, promisifier, multiArgs); + if (typeof input === 'string') { + lowerInput = input.toLowerCase(); + if (!strict) { + if (lowerInput === 'no') { + return false; } + } + if (lowerInput === '0') { + return false; + } + if (lowerInput === 'false') { + return false; + } + if (lowerInput === '') { + return false; + } + return true; } + return !!input; + }; - return promisifyAll(target, suffix, filter, promisifier, multiArgs); -}; -}; - - -},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function( - Promise, PromiseArray, tryConvertToPromise, apiRejection) { -var util = _dereq_("./util"); -var isObject = util.isObject; -var es5 = _dereq_("./es5"); -var Es6Map; -if (typeof Map === "function") Es6Map = Map; - -var mapToEntries = (function() { - var index = 0; - var size = 0; + Utils.isNumeric = function(input) { + this.REGEX_SPACES.lastIndex = 0; + return typeof input === 'number' || typeof input === 'string' && !isNaN(input) && input.replace(this.REGEX_SPACES, '') !== ''; + }; - function extractEntry(value, key) { - this[index] = value; - this[index + size] = key; - index++; + Utils.stringToDate = function(str) { + var date, day, fraction, hour, info, minute, month, second, tz_hour, tz_minute, tz_offset, year; + if (!(str != null ? str.length : void 0)) { + return null; } + info = this.PATTERN_DATE.exec(str); + if (!info) { + return null; + } + year = parseInt(info.year, 10); + month = parseInt(info.month, 10) - 1; + day = parseInt(info.day, 10); + if (info.hour == null) { + date = new Date(Date.UTC(year, month, day)); + return date; + } + hour = parseInt(info.hour, 10); + minute = parseInt(info.minute, 10); + second = parseInt(info.second, 10); + if (info.fraction != null) { + fraction = info.fraction.slice(0, 3); + while (fraction.length < 3) { + fraction += '0'; + } + fraction = parseInt(fraction, 10); + } else { + fraction = 0; + } + if (info.tz != null) { + tz_hour = parseInt(info.tz_hour, 10); + if (info.tz_minute != null) { + tz_minute = parseInt(info.tz_minute, 10); + } else { + tz_minute = 0; + } + tz_offset = (tz_hour * 60 + tz_minute) * 60000; + if ('-' === info.tz_sign) { + tz_offset *= -1; + } + } + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + if (tz_offset) { + date.setTime(date.getTime() - tz_offset); + } + return date; + }; - return function mapToEntries(map) { - size = map.size; - index = 0; - var ret = new Array(map.size * 2); - map.forEach(extractEntry, ret); - return ret; - }; -})(); - -var entriesToMap = function(entries) { - var ret = new Es6Map(); - var length = entries.length / 2 | 0; - for (var i = 0; i < length; ++i) { - var key = entries[length + i]; - var value = entries[i]; - ret.set(key, value); + Utils.strRepeat = function(str, number) { + var i, res; + res = ''; + i = 0; + while (i < number) { + res += str; + i++; } - return ret; -}; + return res; + }; -function PropertiesPromiseArray(obj) { - var isMap = false; - var entries; - if (Es6Map !== undefined && obj instanceof Es6Map) { - entries = mapToEntries(obj); - isMap = true; + Utils.getStringFromFile = function(path, callback) { + var data, fs, j, len1, name, ref, req, xhr; + if (callback == null) { + callback = null; + } + xhr = null; + if (typeof window !== "undefined" && window !== null) { + if (window.XMLHttpRequest) { + xhr = new XMLHttpRequest(); + } else if (window.ActiveXObject) { + ref = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; + for (j = 0, len1 = ref.length; j < len1; j++) { + name = ref[j]; + try { + xhr = new ActiveXObject(name); + } catch (undefined) {} + } + } + } + if (xhr != null) { + if (callback != null) { + xhr.onreadystatechange = function() { + if (xhr.readyState === 4) { + if (xhr.status === 200 || xhr.status === 0) { + return callback(xhr.responseText); + } else { + return callback(null); + } + } + }; + xhr.open('GET', path, true); + return xhr.send(null); + } else { + xhr.open('GET', path, false); + xhr.send(null); + if (xhr.status === 200 || xhr.status === 0) { + return xhr.responseText; + } + return null; + } } else { - var keys = es5.keys(obj); - var len = keys.length; - entries = new Array(len * 2); - for (var i = 0; i < len; ++i) { - var key = keys[i]; - entries[i] = obj[key]; - entries[i + len] = key; + req = require; + fs = req('fs'); + if (callback != null) { + return fs.readFile(path, function(err, data) { + if (err) { + return callback(null); + } else { + return callback(String(data)); + } + }); + } else { + data = fs.readFileSync(path); + if (data != null) { + return String(data); } + return null; + } } - this.constructor$(entries); - this._isMap = isMap; - this._init$(undefined, isMap ? -6 : -3); -} -util.inherits(PropertiesPromiseArray, PromiseArray); + }; -PropertiesPromiseArray.prototype._init = function () {}; + return Utils; -PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - var val; - if (this._isMap) { - val = entriesToMap(this._values); - } else { - val = {}; - var keyOffset = this.length(); - for (var i = 0, len = this.length(); i < len; ++i) { - val[this._values[i + keyOffset]] = this._values[i]; - } - } - this._resolve(val); - return true; - } - return false; -}; +})(); -PropertiesPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; +module.exports = Utils; -PropertiesPromiseArray.prototype.getActualLength = function (len) { - return len >> 1; -}; -function props(promises) { - var ret; - var castValue = tryConvertToPromise(promises); +},{"./Pattern":8}],11:[function(require,module,exports){ +var Dumper, Parser, Utils, Yaml; - if (!isObject(castValue)) { - return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } else if (castValue instanceof Promise) { - ret = castValue._then( - Promise.props, undefined, undefined, undefined, undefined); - } else { - ret = new PropertiesPromiseArray(castValue).promise(); - } +Parser = require('./Parser'); - if (castValue instanceof Promise) { - ret._propagateFrom(castValue, 2); - } - return ret; -} +Dumper = require('./Dumper'); -Promise.prototype.props = function () { - return props(this); -}; +Utils = require('./Utils'); -Promise.props = function (promises) { - return props(promises); -}; -}; +Yaml = (function() { + function Yaml() {} -},{"./es5":13,"./util":36}],26:[function(_dereq_,module,exports){ -"use strict"; -function arrayMove(src, srcIndex, dst, dstIndex, len) { - for (var j = 0; j < len; ++j) { - dst[j + dstIndex] = src[j + srcIndex]; - src[j + srcIndex] = void 0; + Yaml.parse = function(input, exceptionOnInvalidType, objectDecoder) { + if (exceptionOnInvalidType == null) { + exceptionOnInvalidType = false; } -} + if (objectDecoder == null) { + objectDecoder = null; + } + return new Parser().parse(input, exceptionOnInvalidType, objectDecoder); + }; -function Queue(capacity) { - this._capacity = capacity; - this._length = 0; - this._front = 0; -} + Yaml.parseFile = function(path, callback, exceptionOnInvalidType, objectDecoder) { + var input; + if (callback == null) { + callback = null; + } + if (exceptionOnInvalidType == null) { + exceptionOnInvalidType = false; + } + if (objectDecoder == null) { + objectDecoder = null; + } + if (callback != null) { + return Utils.getStringFromFile(path, (function(_this) { + return function(input) { + var result; + result = null; + if (input != null) { + result = _this.parse(input, exceptionOnInvalidType, objectDecoder); + } + callback(result); + }; + })(this)); + } else { + input = Utils.getStringFromFile(path); + if (input != null) { + return this.parse(input, exceptionOnInvalidType, objectDecoder); + } + return null; + } + }; -Queue.prototype._willBeOverCapacity = function (size) { - return this._capacity < size; -}; + Yaml.dump = function(input, inline, indent, exceptionOnInvalidType, objectEncoder) { + var yaml; + if (inline == null) { + inline = 2; + } + if (indent == null) { + indent = 4; + } + if (exceptionOnInvalidType == null) { + exceptionOnInvalidType = false; + } + if (objectEncoder == null) { + objectEncoder = null; + } + yaml = new Dumper(); + yaml.indentation = indent; + return yaml.dump(input, inline, 0, exceptionOnInvalidType, objectEncoder); + }; -Queue.prototype._pushOne = function (arg) { - var length = this.length(); - this._checkCapacity(length + 1); - var i = (this._front + length) & (this._capacity - 1); - this[i] = arg; - this._length = length + 1; -}; + Yaml.stringify = function(input, inline, indent, exceptionOnInvalidType, objectEncoder) { + return this.dump(input, inline, indent, exceptionOnInvalidType, objectEncoder); + }; -Queue.prototype.push = function (fn, receiver, arg) { - var length = this.length() + 3; - if (this._willBeOverCapacity(length)) { - this._pushOne(fn); - this._pushOne(receiver); - this._pushOne(arg); - return; - } - var j = this._front + length - 3; - this._checkCapacity(length); - var wrapMask = this._capacity - 1; - this[(j + 0) & wrapMask] = fn; - this[(j + 1) & wrapMask] = receiver; - this[(j + 2) & wrapMask] = arg; - this._length = length; -}; + Yaml.load = function(path, callback, exceptionOnInvalidType, objectDecoder) { + return this.parseFile(path, callback, exceptionOnInvalidType, objectDecoder); + }; -Queue.prototype.shift = function () { - var front = this._front, - ret = this[front]; + return Yaml; - this[front] = undefined; - this._front = (front + 1) & (this._capacity - 1); - this._length--; - return ret; -}; +})(); -Queue.prototype.length = function () { - return this._length; -}; +if (typeof window !== "undefined" && window !== null) { + window.YAML = Yaml; +} -Queue.prototype._checkCapacity = function (size) { - if (this._capacity < size) { - this._resizeTo(this._capacity << 1); - } -}; +if (typeof window === "undefined" || window === null) { + this.YAML = Yaml; +} -Queue.prototype._resizeTo = function (capacity) { - var oldCapacity = this._capacity; - this._capacity = capacity; - var front = this._front; - var length = this._length; - var moveItemsCount = (front + length) & (oldCapacity - 1); - arrayMove(this, 0, this, oldCapacity, moveItemsCount); -}; +module.exports = Yaml; -module.exports = Queue; -},{}],27:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function( - Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var util = _dereq_("./util"); +},{"./Dumper":1,"./Parser":7,"./Utils":10}]},{},[11]); -var raceLater = function (promise) { - return promise.then(function(array) { - return race(array, promise); - }); -}; +; +/**************************************************************************** + promise-get.js, -function race(promises, parent) { - var maybePromise = tryConvertToPromise(promises); + (c) 2017, FCOO - if (maybePromise instanceof Promise) { - return raceLater(maybePromise); - } else { - promises = util.asArray(promises); - if (promises === null) - return apiRejection("expecting an array or an iterable object but got " + util.classString(promises)); - } + https://github.com/FCOO/promise-get + https://github.com/FCOO - var ret = new Promise(INTERNAL); - if (parent !== undefined) { - ret._propagateFrom(parent, 3); - } - var fulfill = ret._fulfill; - var reject = ret._reject; - for (var i = 0, len = promises.length; i < len; ++i) { - var val = promises[i]; +****************************************************************************/ - if (val === undefined && !(i in promises)) { - continue; - } +(function ($, window, Promise/*, document, undefined*/) { + "use strict"; - Promise.cast(val)._then(fulfill, reject, undefined, ret, null); - } - return ret; -} + //Create a default error-handle. Can be overwritten + Promise.defaultErrorHandler = Promise.defaultErrorHandler || function( /* error: {name, status, message, text, statusText} */ ){}; -Promise.race = function (promises) { - return race(promises, undefined); -}; + function createErrorObject( reason, url ){ + var response = reason.response, + text = response ? response.statusText : + reason.message ? reason.message : + reason; + return { + name : 'Error', + status : response ? response.status : null, + url : url, + message : text, + text : text, + statusText: text + }; + } -Promise.prototype.race = function () { - return race(this, undefined); -}; + //Set event handler for unhandled rejections + window.onunhandledrejection = function(e, promise){ + if (e && e.preventDefault) + e.preventDefault(); -}; + //Unknown why, but in some browwsers onunhandledrejection is called twice - one time with e.detail + if (e && e.detail) + return false; -},{"./util":36}],28:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL, - debug) { -var util = _dereq_("./util"); -var tryCatch = util.tryCatch; + var url = promise && promise.promiseOptions ? promise.promiseOptions.url : null; -function ReductionPromiseArray(promises, fn, initialValue, _each) { - this.constructor$(promises); - var context = Promise._getContext(); - this._fn = util.contextBind(context, fn); - if (initialValue !== undefined) { - initialValue = Promise.resolve(initialValue); - initialValue._attachCancellationCallback(this); - } - this._initialValue = initialValue; - this._currentCancellable = null; - if(_each === INTERNAL) { - this._eachValues = Array(this._length); - } else if (_each === 0) { - this._eachValues = null; - } else { - this._eachValues = undefined; - } - this._promise._captureStackTrace(); - this._init$(undefined, -5); -} -util.inherits(ReductionPromiseArray, PromiseArray); + Promise.defaultErrorHandler( createErrorObject( e, url ) ); + }; -ReductionPromiseArray.prototype._gotAccum = function(accum) { - if (this._eachValues !== undefined && - this._eachValues !== null && - accum !== INTERNAL) { - this._eachValues.push(accum); + function callDefaultErrorHandle(reason, url){ + return Promise.defaultErrorHandler( createErrorObject( reason, url ) ); } -}; -ReductionPromiseArray.prototype._eachComplete = function(value) { - if (this._eachValues !== null) { - this._eachValues.push(value); - } - return this._eachValues; -}; + //Promise.defaultPrefetch = function(url, options): To be called before ALL fetch + Promise.defaultPrefetch = null; -ReductionPromiseArray.prototype._init = function() {}; + //Promise.defaultFinally = function(): To be called as finally for ALL Promise.get + Promise.defaultFinally = null; -ReductionPromiseArray.prototype._resolveEmptyArray = function() { - this._resolve(this._eachValues !== undefined ? this._eachValues - : this._initialValue); -}; + /************************************************************** + Promise.fetch( url, options ) + Fetch the url. + Retries up to options.retries times with delay between of options.retryDeday ms + **************************************************************/ + Promise.fetch = function(url, options) { + options = $.extend( {}, { + retries : 3, + retryDelay: 1000, + noCache : false, + // cache : 'reload', //TODO: Check if it works +/*REMOVE FOR NOW. NEED TO FIND A WAY TO FORCE NO-CACHE + headers : { + "Cache-Control": 'no-cache' //TODO: Check if this works + } +*/ + }, options || {}); -ReductionPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; + //Adding parame dummy=12345678 if options.noCache: true to force no-cache. TODO: Replaced with correct header + if (options.noCache) + url = url + (url.indexOf('?') > 0 ? '&' : '?') + 'dummy='+Math.random().toString(36).substr(2, 9); -ReductionPromiseArray.prototype._resolve = function(value) { - this._promise._resolveCallback(value); - this._values = null; -}; + if (Promise.defaultPrefetch) + Promise.defaultPrefetch(url, options); -ReductionPromiseArray.prototype._resultCancelled = function(sender) { - if (sender === this._initialValue) return this._cancel(); - if (this._isResolved()) return; - this._resultCancelled$(); - if (this._currentCancellable instanceof Promise) { - this._currentCancellable.cancel(); - } - if (this._initialValue instanceof Promise) { - this._initialValue.cancel(); - } -}; + return new Promise(function(resolve, reject) { + var wrappedFetch = function(n) { + fetch(url, options) + .then(function(response) { + resolve(response); + }) + .catch(function(error) { + if (n > 0) { + setTimeout(function() { + wrappedFetch(--n); + }, options.retryDelay); + } + else { + reject(error); + } + }); + }; + wrappedFetch(options.retries); + }); + }; -ReductionPromiseArray.prototype._iterate = function (values) { - this._values = values; - var value; - var i; - var length = values.length; - if (this._initialValue !== undefined) { - value = this._initialValue; - i = 0; - } else { - value = Promise.resolve(values[0]); - i = 1; - } - this._currentCancellable = value; - for (var j = i; j < length; ++j) { - var maybePromise = values[j]; - if (maybePromise instanceof Promise) { - maybePromise.suppressUnhandledRejections(); - } - } + /************************************************************** + Promise.get( url, options[, resolve[, reject[, finally]]] ) + Get the file at url. - if (!value.isRejected()) { - for (; i < length; ++i) { - var ctx = { - accum: null, - value: values[i], - index: i, - length: length, - array: this - }; + resolve || options.resolve || options.done = function( response ) + reject || options.reject || options.fail = function( error ) + finally || options.finally || options.always = function( ?? ) - value = value._then(gotAccum, undefined, undefined, ctx, undefined); + options + retries: 0 + context: null + format: null (text,json, xml) + useDefaultErrorHandler: true => use defaultErrorHandler even if a reject-function is given - if ((i & 127) === 0) { - value._setNoAsyncGuarantee(); - } + **************************************************************/ + function checkStatus(response) { + if (response.status >= 200 && response.status < 300) { + return response; + } + else { + var error = new Error(response.statusText); + error.response = response; + throw error; } } - if (this._eachValues !== undefined) { - value = value - ._then(this._eachComplete, undefined, undefined, this, undefined); - } - value._then(completed, completed, undefined, value, this); -}; - -Promise.prototype.reduce = function (fn, initialValue) { - return reduce(this, fn, initialValue, null); -}; -Promise.reduce = function (promises, fn, initialValue, _each) { - return reduce(promises, fn, initialValue, _each); -}; + function parseYAML( response ){ + var json; -function completed(valueOrReason, array) { - if (this.isFulfilled()) { - array._resolve(valueOrReason); - } else { - array._reject(valueOrReason); + try{ + json = window.YAML.parse(response); + } + catch (e){ + json = undefined; + var error = new Error("Invalid YAML"); + throw error; + } + return json; } -} -function reduce(promises, fn, initialValue, _each) { - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var array = new ReductionPromiseArray(promises, fn, initialValue, _each); - return array.promise(); -} + function parseXML( response ){ + //Adjusted xml-parser from jQuery.jQuery.parseXML + var xml; -function gotAccum(accum) { - this.accum = accum; - this.array._gotAccum(accum); - var value = tryConvertToPromise(this.value, this.array._promise); - if (value instanceof Promise) { - this.array._currentCancellable = value; - return value._then(gotValue, undefined, undefined, this, undefined); - } else { - return gotValue.call(this, value); - } -} + // Support: IE 9 - 11 only + // IE throws on parseFromString with invalid input. + try { + xml = ( new window.DOMParser() ).parseFromString( response, "text/xml" ); + } + catch ( e ) { + xml = undefined; + } -function gotValue(value) { - var array = this.array; - var promise = array._promise; - var fn = tryCatch(array._fn); - promise._pushContext(); - var ret; - if (array._eachValues !== undefined) { - ret = fn.call(promise._boundValue(), value, this.index, this.length); - } else { - ret = fn.call(promise._boundValue(), - this.accum, value, this.index, this.length); - } - if (ret instanceof Promise) { - array._currentCancellable = ret; + if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { + var error = new Error("Invalid XML"); + throw error; + } + return xml; } - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, - promiseCreated, - array._eachValues !== undefined ? "Promise.each" : "Promise.reduce", - promise - ); - return ret; -} -}; - -},{"./util":36}],29:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util"); -var schedule; -var noAsyncScheduler = function() { - throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a"); -}; -var NativePromise = util.getNativePromise(); -if (util.isNode && typeof MutationObserver === "undefined") { - var GlobalSetImmediate = global.setImmediate; - var ProcessNextTick = process.nextTick; - schedule = util.isRecentNode - ? function(fn) { GlobalSetImmediate.call(global, fn); } - : function(fn) { ProcessNextTick.call(process, fn); }; -} else if (typeof NativePromise === "function" && - typeof NativePromise.resolve === "function") { - var nativePromise = NativePromise.resolve(); - schedule = function(fn) { - nativePromise.then(fn); - }; -} else if ((typeof MutationObserver !== "undefined") && - !(typeof window !== "undefined" && - window.navigator && - (window.navigator.standalone || window.cordova)) && - ("classList" in document.documentElement)) { - schedule = (function() { - var div = document.createElement("div"); - var opts = {attributes: true}; - var toggleScheduled = false; - var div2 = document.createElement("div"); - var o2 = new MutationObserver(function() { - div.classList.toggle("foo"); - toggleScheduled = false; - }); - o2.observe(div2, opts); - var scheduleToggle = function() { - if (toggleScheduled) return; - toggleScheduled = true; - div2.classList.toggle("foo"); - }; - return function schedule(fn) { - var o = new MutationObserver(function() { - o.disconnect(); - fn(); - }); - o.observe(div, opts); - scheduleToggle(); - }; - })(); -} else if (typeof setImmediate !== "undefined") { - schedule = function (fn) { - setImmediate(fn); - }; -} else if (typeof setTimeout !== "undefined") { - schedule = function (fn) { - setTimeout(fn, 0); - }; -} else { - schedule = noAsyncScheduler; -} -module.exports = schedule; + Promise.get = function(url, options, resolve, reject, fin) { + options = $.extend({}, { + //Default options + url : url, + useDefaultErrorHandler: true, + retries : 0 + }, options || {} ); -},{"./util":36}],30:[function(_dereq_,module,exports){ -"use strict"; -module.exports = - function(Promise, PromiseArray, debug) { -var PromiseInspection = Promise.PromiseInspection; -var util = _dereq_("./util"); + resolve = resolve || options.resolve || options.done; + reject = reject || options.reject || options.fail; + fin = fin || options.finally || options.always; -function SettledPromiseArray(values) { - this.constructor$(values); -} -util.inherits(SettledPromiseArray, PromiseArray); + if (options.context){ + resolve = resolve ? $.proxy( resolve, options.context ) : null; + reject = reject ? $.proxy( reject, options.context ) : null; + fin = fin ? $.proxy( fin, options.context ) : null; + } -SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { - this._values[index] = inspection; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - return true; - } - return false; -}; + var result = + Promise.fetch(url, options) //Get the file + .then(checkStatus); //Check for status of the response -SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { - var ret = new PromiseInspection(); - ret._bitField = 33554432; - ret._settledValueField = value; - return this._promiseResolved(index, ret); -}; -SettledPromiseArray.prototype._promiseRejected = function (reason, index) { - var ret = new PromiseInspection(); - ret._bitField = 16777216; - ret._settledValueField = reason; - return this._promiseResolved(index, ret); -}; + switch (options.format){ + case 'text': + result = + result + .then( function(response) { return response.text(); }); + break; + case 'json': + result = + result + .then( function(response) { return response.text(); }) + .then( JSON.parse ); + break; + case 'yaml': + result = + result + .then( function(response) { return response.text(); }) + .then( parseYAML ); + break; + case 'xml' : + result = + result + .then( function(response) { return response.text(); }) + .then( parseXML ); + break; + } -Promise.settle = function (promises) { - debug.deprecated(".settle()", ".reflect()"); - return new SettledPromiseArray(promises).promise(); -}; + if (resolve) + result = result.then( resolve ); -Promise.allSettled = function (promises) { - return new SettledPromiseArray(promises).promise(); -}; + //Adding error/reject promise + var defaultReject = function(reason){ + return callDefaultErrorHandle(reason, options.url); + }; -Promise.prototype.settle = function () { - return Promise.settle(this); -}; -}; + if (reject){ + //If options.useDefaultErrorHandler => also needs to call => Promise.defaultErrorHandler + if (options.useDefaultErrorHandler) + result = result.catch( function( reason ){ + reject( createErrorObject( reason, options.url ) ); + return defaultReject.call( null, reason ); + }); + else + //Just use reject as catch + result = result.catch( function( reason ){ + return reject( createErrorObject( reason, options.url ) ); + }); + } + else + if (!options.useDefaultErrorHandler) + //Prevent the use of Promise.defaultErrorHandler + result = result.catch( function(){} ); -},{"./util":36}],31:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, PromiseArray, apiRejection) { -var util = _dereq_("./util"); -var RangeError = _dereq_("./errors").RangeError; -var AggregateError = _dereq_("./errors").AggregateError; -var isArray = util.isArray; -var CANCELLATION = {}; + //Adding finally (if any) + if (fin || Promise.defaultFinally){ + var finFunc = fin && Promise.defaultFinally ? + function(){ + fin.apply(null, arguments); + Promise.defaultFinally.apply(null, arguments); + } : fin || Promise.defaultFinally; + result = result.finally( finFunc ); + } -function SomePromiseArray(values) { - this.constructor$(values); - this._howMany = 0; - this._unwrap = false; - this._initialized = false; -} -util.inherits(SomePromiseArray, PromiseArray); + result.promiseOptions = options; + return result; + }; -SomePromiseArray.prototype._init = function () { - if (!this._initialized) { - return; - } - if (this._howMany === 0) { - this._resolve([]); - return; - } - this._init$(undefined, -5); - var isArrayResolved = isArray(this._values); - if (!this._isResolved() && - isArrayResolved && - this._howMany > this._canPossiblyFulfill()) { - this._reject(this._getRangeError(this.length())); - } -}; + /************************************************************** + Promise.getText( url, options[, resolve[, reject[, finally]]] ) + Same as Promise.get with format = 'text' + **************************************************************/ + Promise.getText = function(url, options, resolve, reject, fin) { + return Promise.get( url, + $.extend( {}, options , { format: 'text' }), + resolve, reject, fin ); + }; -SomePromiseArray.prototype.init = function () { - this._initialized = true; - this._init(); -}; + /************************************************************** + Promise.getJSON( url, options[, resolve[, reject[, finally]]] ) + Same as Promise.get with format = 'json' + **************************************************************/ + Promise.getJSON = function(url, options, resolve, reject, fin) { + return Promise.get( url, + $.extend( {}, options , { format: 'json' }), + resolve, reject, fin ); + }; -SomePromiseArray.prototype.setUnwrap = function () { - this._unwrap = true; -}; + /************************************************************** + Promise.getXML( url, options[, resolve[, reject[, finally]]] ) + Same as Promise.get with format = 'xml' + **************************************************************/ + Promise.getXML = function(url, options, resolve, reject, fin) { + return Promise.get( url, + $.extend( {}, options , { format: 'xml' }), + resolve, reject, fin ); + }; -SomePromiseArray.prototype.howMany = function () { - return this._howMany; -}; + /************************************************************** + Promise.getYAML( url, options[, resolve[, reject[, finally]]] ) + Same as Promise.get with format = 'yaml'. + Data are converted to json + **************************************************************/ + Promise.getYAML = function(url, options, resolve, reject, fin) { + return Promise.get( url, + $.extend( {}, options , { format: 'yaml' }), + resolve, reject, fin ); + }; -SomePromiseArray.prototype.setHowMany = function (count) { - this._howMany = count; -}; +}(jQuery, this, Promise, document)); -SomePromiseArray.prototype._promiseFulfilled = function (value) { - this._addFulfilled(value); - if (this._fulfilled() === this.howMany()) { - this._values.length = this.howMany(); - if (this.howMany() === 1 && this._unwrap) { - this._resolve(this._values[0]); - } else { - this._resolve(this._values); - } - return true; - } - return false; -}; -SomePromiseArray.prototype._promiseRejected = function (reason) { - this._addRejected(reason); - return this._checkOutcome(); -}; +; +/**************************************************************************** + intervals.js, -SomePromiseArray.prototype._promiseCancelled = function () { - if (this._values instanceof Promise || this._values == null) { - return this._cancel(); - } - this._addRejected(CANCELLATION); - return this._checkOutcome(); -}; + (c) 2020, FCOO -SomePromiseArray.prototype._checkOutcome = function() { - if (this.howMany() > this._canPossiblyFulfill()) { - var e = new AggregateError(); - for (var i = this.length(); i < this._values.length; ++i) { - if (this._values[i] !== CANCELLATION) { - e.push(this._values[i]); - } - } - if (e.length > 0) { - this._reject(e); - } else { - this._cancel(); - } - return true; - } - return false; -}; + https://github.com/FCOO/intervals + https://github.com/FCOO -SomePromiseArray.prototype._fulfilled = function () { - return this._totalResolved; -}; +****************************************************************************/ -SomePromiseArray.prototype._rejected = function () { - return this._values.length - this.length(); -}; +(function ($, window, document, undefined) { + "use strict"; -SomePromiseArray.prototype._addRejected = function (reason) { - this._values.push(reason); -}; + function Intervals(options) { + this.options = $.extend({ + format : 'JSON', + durationUnit: 'minutes', + promiseOptions: { + noCache: true, + } + }, options || {} ); -SomePromiseArray.prototype._addFulfilled = function (value) { - this._values[this._totalResolved++] = value; -}; + this.durationList = []; //[]{lastFloorMoment: MOMENT, list: []{fileNameOrData, resolve} -SomePromiseArray.prototype._canPossiblyFulfill = function () { - return this.length() - this._rejected(); -}; -SomePromiseArray.prototype._getRangeError = function (count) { - var message = "Input array must contain at least " + - this._howMany + " items but contains only " + count + " items"; - return new RangeError(message); -}; + } -SomePromiseArray.prototype._resolveEmptyArray = function () { - this._reject(this._getRangeError(0)); -}; + Intervals.prototype = { + isFileName: function(fileNameOrData){ + return $.type(fileNameOrData) == 'string'; + }, + getFileName: function(fileName){ + return fileName; + }, -function some(promises, howMany) { - if ((howMany | 0) !== howMany || howMany < 0) { - return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - var ret = new SomePromiseArray(promises); - var promise = ret.promise(); - ret.setHowMany(howMany); - ret.init(); - return promise; -} + /************************************************************************* + addInterval(options) + options: {duration, fileNameOrData, resolve, context, wait, format, promiseOptions} + Add a reload of fileNameOrData with resolve-function + Will reload every rounded duration. Eq duration = "10 minutes" => called HH:00, HH:10, HH:20,... + If wait == false => also call the resolve on creation + *************************************************************************/ + addInterval: function( options ){ + options = $.extend({}, this.options, options ); + return this.addIntervalObject( new Interval(options, this) ); + }, -Promise.some = function (promises, howMany) { - return some(promises, howMany); -}; + addIntervalObject: function( interval, neverWait ){ + var options = interval.options, + intervalGroup = this.durationList[options.duration] = this.durationList[options.duration] || {}; -Promise.prototype.some = function (howMany) { - return some(this, howMany); -}; + intervalGroup.list = intervalGroup.list || {}; + intervalGroup.list[interval.id] = interval; -Promise._SomePromiseArray = SomePromiseArray; -}; + if (!options.wait && !neverWait) + interval.exec(); -},{"./errors":12,"./util":36}],32:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -function PromiseInspection(promise) { - if (promise !== undefined) { - promise = promise._target(); - this._bitField = promise._bitField; - this._settledValueField = promise._isFateSealed() - ? promise._settledValue() : undefined; - } - else { - this._bitField = 0; - this._settledValueField = undefined; - } -} + if (!intervalGroup.timeoutId) + intervalGroup.timeoutId = this.intervalTimeout(options.duration, true); -PromiseInspection.prototype._settledValue = function() { - return this._settledValueField; -}; + return interval; + }, -var value = PromiseInspection.prototype.value = function () { - if (!this.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - return this._settledValue(); -}; + /************************************************************************* + intervalTimeout(durationMinutes, dontResolve) + *************************************************************************/ + intervalTimeout: function(duration, dontResolve){ + var _this = this, + intervalGroup = this.durationList[duration], + nowFloorMoment = moment().floor(duration, this.options.durationUnit), + nextFloorMoment = moment(nowFloorMoment).add(duration, this.options.durationUnit); -var reason = PromiseInspection.prototype.error = -PromiseInspection.prototype.reason = function () { - if (!this.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a"); - } - return this._settledValue(); -}; + if (intervalGroup.timeoutId){ + window.clearTimeout(intervalGroup.timeoutId); + intervalGroup.timeoutId = null; + } -var isFulfilled = PromiseInspection.prototype.isFulfilled = function() { - return (this._bitField & 33554432) !== 0; -}; + if (!$.isEmptyObject(intervalGroup.list)) + intervalGroup.timeoutId = window.setTimeout( function(){_this.intervalTimeout(duration);}, nextFloorMoment.diff(moment()) ); -var isRejected = PromiseInspection.prototype.isRejected = function () { - return (this._bitField & 16777216) !== 0; -}; + //Check if we need to call resolves + if (!intervalGroup.lastFloorMoment || !nowFloorMoment.isSame(intervalGroup.lastFloorMoment)){ + intervalGroup.lastFloorMoment = nowFloorMoment; + if (!dontResolve) + $.each(intervalGroup.list, function(id, intervalRec){ intervalRec.exec(); }); + } + }, + }; -var isPending = PromiseInspection.prototype.isPending = function () { - return (this._bitField & 50397184) === 0; -}; + // expose access to the constructor + window.Intervals = Intervals; -var isResolved = PromiseInspection.prototype.isResolved = function () { - return (this._bitField & 50331648) !== 0; -}; -PromiseInspection.prototype.isCancelled = function() { - return (this._bitField & 8454144) !== 0; -}; + /************************************************************************* + Interval - Represent one loading of file or data + *************************************************************************/ + var intervalId = 0; + function Interval(options, intervals) { + this.id = 'interval' + intervalId++; + this.options = $.extend({ + }, options || {} ); -Promise.prototype.__isCancelled = function() { - return (this._bitField & 65536) === 65536; -}; -Promise.prototype._isCancelled = function() { - return this._target().__isCancelled(); -}; + this.options.fileNameOrData = this.options.fileNameOrData || this.options.fileName || this.options.data; + this.intervals = intervals; -Promise.prototype.isCancelled = function() { - return (this._target()._bitField & 8454144) !== 0; -}; + if (this.options.context){ + this.options.resolve = this.options.resolve ? $.proxy(this.options.resolve, this.options.context) : null; + this.options.reject = this.options.reject ? $.proxy(this.options.reject, this.options.context) : null; + } -Promise.prototype.isPending = function() { - return isPending.call(this._target()); -}; + } -Promise.prototype.isRejected = function() { - return isRejected.call(this._target()); -}; + Interval.prototype = { + //setDuration(duration) + setDuration: function(duration){ + if (duration != this.options.duration){ + if (this.options.duration) + //Remove this from the current duration-list + this.remove(); -Promise.prototype.isFulfilled = function() { - return isFulfilled.call(this._target()); -}; + //Add this to new durationList + this.options.duration = duration; + this.intervals.addIntervalObject(this, true); + } + }, -Promise.prototype.isResolved = function() { - return isResolved.call(this._target()); -}; + //remove - Remove this from the current duration-list + remove: function(){ + delete this.intervals.durationList[this.options.duration].list[this.id]; + return this; + }, -Promise.prototype.value = function() { - return value.call(this._target()); -}; + //paus(period, wait) + paus: function(period, wait){ + var _this = this; + this.options.wait = wait !== undefined ? wait : this.options.wait; + this.remove(); + this.onHold = true; + window.setTimeout( $.proxy(_this._restart, _this), moment.duration(period, this.intervals.options.durationUnit).asMilliseconds() ); + }, -Promise.prototype.reason = function() { - var target = this._target(); - target._unsetRejectionIsUnhandled(); - return reason.call(target); -}; + _restart: function(){ + this.onHold = false; + this.intervals.addIntervalObject(this); + }, -Promise.prototype._value = function() { - return this._settledValue(); -}; + //exec - "Run" the promise for the interval + exec: function(){ + if (this.onHold) return; -Promise.prototype._reason = function() { - this._unsetRejectionIsUnhandled(); - return this._settledValue(); -}; + var _this = this; + if (this.intervals.isFileName(this.options.fileNameOrData)){ + //File-name is given => load file + var promiseOptions = + $.extend({ + resolve: this.options.resolve ? $.proxy(this._resolve, this) : null, + reject : this.options.reject ? function(error){ _this.options.reject (error, _this); } : null + }, this.options.promiseOptions); -Promise.PromiseInspection = PromiseInspection; -}; -},{}],33:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = _dereq_("./util"); -var errorObj = util.errorObj; -var isObject = util.isObject; + var fileName = this.intervals.getFileName(this.options.fileNameOrData); -function tryConvertToPromise(obj, context) { - if (isObject(obj)) { - if (obj instanceof Promise) return obj; - var then = getThen(obj); - if (then === errorObj) { - if (context) context._pushContext(); - var ret = Promise.reject(then.e); - if (context) context._popContext(); - return ret; - } else if (typeof then === "function") { - if (isAnyBluebirdPromise(obj)) { - var ret = new Promise(INTERNAL); - obj._then( - ret._fulfill, - ret._reject, - undefined, - ret, - null - ); - return ret; + switch (this.options.format.toUpperCase()){ + case 'JSON' : window.Promise.getJSON(fileName, promiseOptions ); break; + case 'XML' : window.Promise.getXML (fileName, promiseOptions ); break; + default : window.Promise.getText(fileName, promiseOptions ); break; + } } - return doThenable(obj, then, context); + else + //Data is given => resolve them + this.options.resolve(this.options.fileNameOrData); + }, + _resolve: function(data){ + var arg = [data]; + if (this.options.resolveArguments) + arg = arg.concat(this.options.resolveArguments); + else + arg = arg.concat([this]); + this.options.resolve.apply(null, arg); } - } - return obj; -} - -function doGetThen(obj) { - return obj.then; -} -function getThen(obj) { - try { - return doGetThen(obj); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} -var hasProp = {}.hasOwnProperty; -function isAnyBluebirdPromise(obj) { - try { - return hasProp.call(obj, "_promise0"); - } catch (e) { - return false; - } -} -function doThenable(x, then, context) { - var promise = new Promise(INTERNAL); - var ret = promise; - if (context) context._pushContext(); - promise._captureStackTrace(); - if (context) context._popContext(); - var synchronous = true; - var result = util.tryCatch(then).call(x, resolve, reject); - synchronous = false; + }; - if (promise && result === errorObj) { - promise._rejectCallback(result.e, true, true); - promise = null; - } + //Create default intervals + window.intervals = new Intervals(); - function resolve(value) { - if (!promise) return; - promise._resolveCallback(value); - promise = null; - } +}(jQuery, this, document)); +; +/**************************************************************************** + promise-list.js, - function reject(reason) { - if (!promise) return; - promise._rejectCallback(reason, synchronous, true); - promise = null; - } - return ret; -} + (c) 2020, FCOO -return tryConvertToPromise; -}; + https://github.com/FCOO/promise-list + https://github.com/FCOO -},{"./util":36}],34:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, debug) { -var util = _dereq_("./util"); -var TimeoutError = Promise.TimeoutError; +****************************************************************************/ -function HandleWrapper(handle) { - this.handle = handle; -} +(function ($, window/*, document, undefined*/) { + "use strict"; -HandleWrapper.prototype._resultCancelled = function() { - clearTimeout(this.handle); -}; -var afterValue = function(value) { return delay(+this).thenReturn(value); }; -var delay = Promise.delay = function (ms, value) { - var ret; - var handle; - if (value !== undefined) { - ret = Promise.resolve(value) - ._then(afterValue, null, null, ms, undefined); - if (debug.cancellation() && value instanceof Promise) { - ret._setOnCancel(value); - } - } else { - ret = new Promise(INTERNAL); - handle = setTimeout(function() { ret._fulfill(); }, +ms); - if (debug.cancellation()) { - ret._setOnCancel(new HandleWrapper(handle)); - } - ret._captureStackTrace(); - } - ret._setAsyncGuaranteed(); - return ret; -}; + function PromiseList( options) { + this.options = $.extend({ + //Default options + }, options || {} ); -Promise.prototype.delay = function (ms) { - return delay(ms, this); -}; + this.firstList = []; + this.list = []; + this.lastList = []; -var afterTimeout = function (promise, message, parent) { - var err; - if (typeof message !== "string") { - if (message instanceof Error) { - err = message; - } else { - err = new TimeoutError("operation timed out"); - } - } else { - err = new TimeoutError(message); } - util.markAsOriginatingFromRejection(err); - promise._attachExtraTrace(err); - promise._reject(err); + window.PromiseList = PromiseList; - if (parent != null) { - parent.cancel(); + //asArray(options) - convert options into []OPTIONS + function asArray(options){ + return options ? ($.isArray(options) ? options : [options]) : []; } -}; -function successClear(value) { - clearTimeout(this.handle); - return value; -} -function failureClear(reason) { - clearTimeout(this.handle); - throw reason; -} + //Extend the prototype + window.PromiseList.prototype = { -Promise.prototype.timeout = function (ms, message) { - ms = +ms; - var ret, parent; + //append( options ) + append: function( options, listId ){ + listId = listId || 'list'; + this[listId] = this[listId].concat( asArray(options) ); + return this; + }, + appendFirst: function( options ){ + return this.append( options, 'firstList'); + }, + appendLast: function( options ){ + return this.append( options, 'lastList'); + }, - var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() { - if (ret.isPending()) { - afterTimeout(ret, message, parent); - } - }, ms)); + //prepend( options ) + prepend: function( options, listId ){ + listId = listId || 'list'; + this[listId] = asArray(options).concat( this[listId] ); + return this; + }, + prependFirst: function( options ){ + return this.prepend( options, 'firstList'); + }, + prependLast: function( options ){ + return this.prepend( options, 'lastList'); + }, - if (debug.cancellation()) { - parent = this.then(); - ret = parent._then(successClear, failureClear, - undefined, handleWrapper, undefined); - ret._setOnCancel(handleWrapper); - } else { - ret = this._then(successClear, failureClear, - undefined, handleWrapper, undefined); - } + _createAllList: function(){ + var _this = this; + this.allList = []; + $.each([this.firstList, this.list, this.lastList], function(index, list){ + $.each(list, function(index, item){ + _this.allList.push(item); + }); + }); + }, - return ret; -}; + //promiseAll = same as getAll + promiseAll: function(){ + return this.getAll.apply(this, arguments); + }, -}; + //getAll( reject ) - get all added promises + getAll: function( reject ){ + var _this = this; -},{"./util":36}],35:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function (Promise, apiRejection, tryConvertToPromise, - createContext, INTERNAL, debug) { - var util = _dereq_("./util"); - var TypeError = _dereq_("./errors").TypeError; - var inherits = _dereq_("./util").inherits; - var errorObj = util.errorObj; - var tryCatch = util.tryCatch; - var NULL = {}; + //Create this.allList as this.firstList, this.list, this.lastlist + this._createAllList(); - function thrower(e) { - setTimeout(function(){throw e;}, 0); - } + if (this.options.prePromiseAll){ +// this.allList = this.options.prePromiseAll(this.allList, this) || this.allList; + var prePromiseAllList = $.isArray(this.options.prePromiseAll) ? this.options.prePromiseAll : [this.options.prePromiseAll]; + prePromiseAllList.forEach( function( prePromise ){ + _this.allList = prePromise(_this.allList, _this) || _this.allList; + }); + } - function castPreservingDisposable(thenable) { - var maybePromise = tryConvertToPromise(thenable); - if (maybePromise !== thenable && - typeof thenable._isDisposable === "function" && - typeof thenable._getDisposer === "function" && - thenable._isDisposable()) { - maybePromise._setDisposable(thenable._getDisposer()); - } - return maybePromise; - } - function dispose(resources, inspection) { - var i = 0; - var len = resources.length; - var ret = new Promise(INTERNAL); - function iterator() { - if (i >= len) return ret._fulfill(); - var maybePromise = castPreservingDisposable(resources[i++]); - if (maybePromise instanceof Promise && - maybePromise._isDisposable()) { - try { - maybePromise = tryConvertToPromise( - maybePromise._getDisposer().tryDispose(inspection), - resources.promise); - } catch (e) { - return thrower(e); - } - if (maybePromise instanceof Promise) { - return maybePromise._then(iterator, thrower, - null, null, null); + //Create list of all remaining promises and options + this.promiseList = []; + this.optionsList = []; + + $.each(this.allList, function(index, options){ + //Skip allready resolved promise + if (options.isResolved) + return true; + + var promise; + if (options.fileName){ + var get; + options.format = options.format ? options.format.toUpperCase() : 'JSON'; + switch (options.format){ + case 'JSON' : get = window.Promise.getJSON; break; + case 'XML' : get = window.Promise.getXML; break; + default : get = window.Promise.getText; break; + } + + if ($.isArray(options.fileName)) + promise = Promise.all( + options.fileName.map( function(fName){ + return get( window.intervals.getFileName(fName), options.promiseOptions); + }) + ); + else + //File-name is given => use intervals.getFileName to convert filename and load it + promise = get( window.intervals.getFileName(options.fileName), options.promiseOptions ); } - } - iterator(); - } - iterator(); - return ret; - } + else + if (options.data) + //Data is given => resolve them + promise = new Promise(function(resolve/*, reject*/) { + resolve(options.data); + }); + else + return; - function Disposer(data, promise, context) { - this._data = data; - this._promise = promise; - this._context = context; - } + _this.promiseList.push(promise); + _this.optionsList.push(options); - Disposer.prototype.data = function () { - return this._data; - }; + //Set as resolved to prevent loop if reject + options.isResolved = true; - Disposer.prototype.promise = function () { - return this._promise; - }; + //If the promise must wait before loading the rest => exit + if (options.wait) + return false; + }); - Disposer.prototype.resource = function () { - if (this.promise().isFulfilled()) { - return this.promise().value(); - } - return NULL; - }; + Promise.all( this.promiseList ) + .then ( $.proxy(this._then, this) ) + .catch ( reject || this.options.reject || function(){} ) + .finally( $.proxy(this._finally, this) ); + }, - Disposer.prototype.tryDispose = function(inspection) { - var resource = this.resource(); - var context = this._context; - if (context !== undefined) context._pushContext(); - var ret = resource !== NULL - ? this.doDispose(resource, inspection) : null; - if (context !== undefined) context._popContext(); - this._promise._unsetDisposable(); - this._data = null; - return ret; - }; + _then: function( dataList ){ + var _this = this; + $.each(dataList, function(index, data){ + var opt = _this.optionsList[index]; - Disposer.isDisposer = function (d) { - return (d != null && - typeof d.resource === "function" && - typeof d.tryDispose === "function"); - }; + //Call the resolve-function + opt.resolve(data, opt, _this); - function FunctionDisposer(fn, promise, context) { - this.constructor$(fn, promise, context); - } - inherits(FunctionDisposer, Disposer); + opt.isResolved = true; - FunctionDisposer.prototype.doDispose = function (resource, inspection) { - var fn = this.data(); - return fn.call(resource, resource, inspection); - }; + //If the file/data needs to reload with some interval => adds the resolve to windows.intervals.addInterval after the first load + if (opt.reload) + window.intervals.addInterval({ + duration : opt.reload === true ? 60 : opt.reload, + fileName : opt.fileName, + data : opt.data, + resolve : opt.resolve, + resolveArguments: [opt, _this], + reject : null, + wait : true + }); + }); + return true; + }, - function maybeUnwrapDisposer(value) { - if (Disposer.isDisposer(value)) { - this.resources[this.index]._setDisposable(value); - return value.promise(); - } - return value; - } + _finally: function(){ + //Check if there are still promise(s) not resolved + var notResolvedFound = false; + this._createAllList(); + $.each(this.allList, function(index, options){ + notResolvedFound = notResolvedFound || !options.isResolved; + }); - function ResourceList(length) { - this.length = length; - this.promise = null; - this[length-1] = null; - } + //Check if there are more promises in the list + if (notResolvedFound) + this.getAll(); + else { + this._callFuncList('finally'); + this._callFuncList('finish'); + } + }, - ResourceList.prototype._resultCancelled = function() { - var len = this.length; - for (var i = 0; i < len; ++i) { - var item = this[i]; - if (item instanceof Promise) { - item.cancel(); + _callFuncList: function( optionsName ){ + var _this = this, + funcList = this.options[optionsName]; + if (funcList){ + funcList = $.isArray(funcList) ? funcList : [funcList]; + funcList.forEach( function( func ){ + func(_this); + }); } } }; - Promise.using = function () { - var len = arguments.length; - if (len < 2) return apiRejection( - "you must pass at least 2 arguments to Promise.using"); - var fn = arguments[len - 1]; - if (typeof fn !== "function") { - return apiRejection("expecting a function but got " + util.classString(fn)); - } - var input; - var spreadArgs = true; - if (len === 2 && Array.isArray(arguments[0])) { - input = arguments[0]; - len = input.length; - spreadArgs = false; - } else { - input = arguments; - len--; - } - var resources = new ResourceList(len); - for (var i = 0; i < len; ++i) { - var resource = input[i]; - if (Disposer.isDisposer(resource)) { - var disposer = resource; - resource = resource.promise(); - resource._setDisposable(disposer); - } else { - var maybePromise = tryConvertToPromise(resource); - if (maybePromise instanceof Promise) { - resource = - maybePromise._then(maybeUnwrapDisposer, null, null, { - resources: resources, - index: i - }, undefined); - } - } - resources[i] = resource; - } +}(jQuery, this, document)); +; +/**************************************************************************** + fcoo-promise-list.js, - var reflectedResources = new Array(resources.length); - for (var i = 0; i < reflectedResources.length; ++i) { - reflectedResources[i] = Promise.resolve(resources[i]).reflect(); - } + (c) 2020, FCOO - var resultPromise = Promise.all(reflectedResources) - .then(function(inspections) { - for (var i = 0; i < inspections.length; ++i) { - var inspection = inspections[i]; - if (inspection.isRejected()) { - errorObj.e = inspection.error(); - return errorObj; - } else if (!inspection.isFulfilled()) { - resultPromise.cancel(); - return; - } - inspections[i] = inspection.value(); - } - promise._pushContext(); + https://github.com/FCOO/fcoo-promise-list + https://github.com/FCOO - fn = tryCatch(fn); - var ret = spreadArgs - ? fn.apply(undefined, inspections) : fn(inspections); - var promiseCreated = promise._popContext(); - debug.checkForgottenReturns( - ret, promiseCreated, "Promise.using", promise); - return ret; - }); +****************************************************************************/ - var promise = resultPromise.lastly(function() { - var inspection = new Promise.PromiseInspection(resultPromise); - return dispose(resources, inspection); - }); - resources.promise = promise; - promise._setOnCancel(resources); - return promise; - }; +(function (window/*, document, undefined*/) { + "use strict"; - Promise.prototype._setDisposable = function (disposer) { - this._bitField = this._bitField | 131072; - this._disposer = disposer; - }; + //Create fcoo-namespace + var ns = window.fcoo = window.fcoo || {}; - Promise.prototype._isDisposable = function () { - return (this._bitField & 131072) > 0; + //Overwrite intervals.isFileName and window.intervals.getFileName to use FCOO filename conventions + window.intervals.isFileName = function(fileNameOrData){ + return (($.type(fileNameOrData) == 'string') || (fileNameOrData.subDir && fileNameOrData.fileName)); }; - Promise.prototype._getDisposer = function () { - return this._disposer; + window.intervals.getFileName = function(fileName){ + return ns.dataFilePath(fileName); }; - Promise.prototype._unsetDisposable = function () { - this._bitField = this._bitField & (~131072); - this._disposer = undefined; - }; + //Create common FCOO PromiseList + ns.promiseList = new window.PromiseList({ - Promise.prototype.disposer = function (fn) { - if (typeof fn === "function") { - return new FunctionDisposer(fn, this, createContext()); - } - throw new TypeError(); - }; + }); -}; +}(this, document)); +; +/* + * jQuery.bind-first library v0.2.3 + * Copyright (c) 2013 Vladimir Zhuravlev + * + * Released under MIT License + * @license + * + * Date: Thu Feb 6 10:13:59 ICT 2014 + **/ -},{"./errors":12,"./util":36}],36:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5"); -var canEvaluate = typeof navigator == "undefined"; +(function($) { + var splitVersion = $.fn.jquery.split("."); + var major = parseInt(splitVersion[0]); + var minor = parseInt(splitVersion[1]); -var errorObj = {e: {}}; -var tryCatchTarget; -var globalObject = typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : - typeof global !== "undefined" ? global : - this !== undefined ? this : null; + var JQ_LT_17 = (major < 1) || (major == 1 && minor < 7); + + function eventsData($el) { + return JQ_LT_17 ? $el.data('events') : $._data($el[0]).events; + } + + function moveHandlerToTop($el, eventName, isDelegated) { + var data = eventsData($el); + var events = data[eventName]; -function tryCatcher() { - try { - var target = tryCatchTarget; - tryCatchTarget = null; - return target.apply(this, arguments); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} -function tryCatch(fn) { - tryCatchTarget = fn; - return tryCatcher; -} + if (!JQ_LT_17) { + var handler = isDelegated ? events.splice(events.delegateCount - 1, 1)[0] : events.pop(); + events.splice(isDelegated ? 0 : (events.delegateCount || 0), 0, handler); -var inherits = function(Child, Parent) { - var hasProp = {}.hasOwnProperty; + return; + } - function T() { - this.constructor = Child; - this.constructor$ = Parent; - for (var propertyName in Parent.prototype) { - if (hasProp.call(Parent.prototype, propertyName) && - propertyName.charAt(propertyName.length-1) !== "$" - ) { - this[propertyName + "$"] = Parent.prototype[propertyName]; - } - } - } - T.prototype = Parent.prototype; - Child.prototype = new T(); - return Child.prototype; -}; + if (isDelegated) { + data.live.unshift(data.live.pop()); + } else { + events.unshift(events.pop()); + } + } + + function moveEventHandlers($elems, eventsString, isDelegate) { + var events = eventsString.split(/\s+/); + $elems.each(function() { + for (var i = 0; i < events.length; ++i) { + var pureEventName = $.trim(events[i]).match(/[^\.]+/i)[0]; + moveHandlerToTop($(this), pureEventName, isDelegate); + } + }); + } + + function makeMethod(methodName) { + $.fn[methodName + 'First'] = function() { + var args = $.makeArray(arguments); + var eventsString = args.shift(); + if (eventsString) { + $.fn[methodName].apply(this, arguments); + moveEventHandlers(this, eventsString); + } -function isPrimitive(val) { - return val == null || val === true || val === false || - typeof val === "string" || typeof val === "number"; + return this; + } + } -} + // bind + makeMethod('bind'); -function isObject(value) { - return typeof value === "function" || - typeof value === "object" && value !== null; -} + // one + makeMethod('one'); -function maybeWrapAsError(maybeError) { - if (!isPrimitive(maybeError)) return maybeError; + // delegate + $.fn.delegateFirst = function() { + var args = $.makeArray(arguments); + var eventsString = args[1]; + + if (eventsString) { + args.splice(0, 2); + $.fn.delegate.apply(this, arguments); + moveEventHandlers(this, eventsString, true); + } - return new Error(safeToString(maybeError)); -} + return this; + }; -function withAppended(target, appendee) { - var len = target.length; - var ret = new Array(len + 1); - var i; - for (i = 0; i < len; ++i) { - ret[i] = target[i]; - } - ret[i] = appendee; - return ret; -} + // live + $.fn.liveFirst = function() { + var args = $.makeArray(arguments); -function getDataPropertyOrDefault(obj, key, defaultValue) { - if (es5.isES5) { - var desc = Object.getOwnPropertyDescriptor(obj, key); + // live = delegate to the document + args.unshift(this.selector); + $.fn.delegateFirst.apply($(document), args); - if (desc != null) { - return desc.get == null && desc.set == null - ? desc.value - : defaultValue; - } - } else { - return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; - } -} + return this; + }; + + // on (jquery >= 1.7) + if (!JQ_LT_17) { + $.fn.onFirst = function(types, selector) { + var $el = $(this); + var isDelegated = typeof selector === 'string'; -function notEnumerableProp(obj, name, value) { - if (isPrimitive(obj)) return obj; - var descriptor = { - value: value, - configurable: true, - enumerable: false, - writable: true - }; - es5.defineProperty(obj, name, descriptor); - return obj; -} + $.fn.on.apply($el, arguments); -function thrower(r) { - throw r; -} + // events map + if (typeof types === 'object') { + for (type in types) + if (types.hasOwnProperty(type)) { + moveEventHandlers($el, type, isDelegated); + } + } else if (typeof types === 'string') { + moveEventHandlers($el, types, isDelegated); + } -var inheritedDataKeys = (function() { - var excludedPrototypes = [ - Array.prototype, - Object.prototype, - Function.prototype - ]; + return $el; + }; + } - var isExcludedProto = function(val) { - for (var i = 0; i < excludedPrototypes.length; ++i) { - if (excludedPrototypes[i] === val) { - return true; - } - } - return false; - }; +})(jQuery); - if (es5.isES5) { - var getKeys = Object.getOwnPropertyNames; - return function(obj) { - var ret = []; - var visitedKeys = Object.create(null); - while (obj != null && !isExcludedProto(obj)) { - var keys; - try { - keys = getKeys(obj); - } catch (e) { - return ret; - } - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (visitedKeys[key]) continue; - visitedKeys[key] = true; - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null && desc.get == null && desc.set == null) { - ret.push(key); - } - } - obj = es5.getPrototypeOf(obj); - } - return ret; - }; - } else { - var hasProp = {}.hasOwnProperty; - return function(obj) { - if (isExcludedProto(obj)) return []; - var ret = []; +; +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.window = global.window || {})); +}(this, (function (exports) { 'use strict'; - /*jshint forin:false */ - enumeration: for (var key in obj) { - if (hasProp.call(obj, key)) { - ret.push(key); - } else { - for (var i = 0; i < excludedPrototypes.length; ++i) { - if (hasProp.call(excludedPrototypes[i], key)) { - continue enumeration; - } - } - ret.push(key); - } - } - return ret; - }; + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } -})(); + return self; + } -var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/; -function isClass(fn) { - try { - if (typeof fn === "function") { - var keys = es5.names(fn.prototype); + /*! + * GSAP 3.12.5 + * https://gsap.com + * + * @license Copyright 2008-2024, GreenSock. All rights reserved. + * Subject to the terms at https://gsap.com/standard-license or for + * Club GSAP members, the agreement issued with that membership. + * @author: Jack Doyle, jack@greensock.com + */ + var _config = { + autoSleep: 120, + force3D: "auto", + nullTargetWarn: 1, + units: { + lineHeight: "" + } + }, + _defaults = { + duration: .5, + overwrite: false, + delay: 0 + }, + _suppressOverwrites, + _reverting, + _context, + _bigNum = 1e8, + _tinyNum = 1 / _bigNum, + _2PI = Math.PI * 2, + _HALF_PI = _2PI / 4, + _gsID = 0, + _sqrt = Math.sqrt, + _cos = Math.cos, + _sin = Math.sin, + _isString = function _isString(value) { + return typeof value === "string"; + }, + _isFunction = function _isFunction(value) { + return typeof value === "function"; + }, + _isNumber = function _isNumber(value) { + return typeof value === "number"; + }, + _isUndefined = function _isUndefined(value) { + return typeof value === "undefined"; + }, + _isObject = function _isObject(value) { + return typeof value === "object"; + }, + _isNotFalse = function _isNotFalse(value) { + return value !== false; + }, + _windowExists = function _windowExists() { + return typeof window !== "undefined"; + }, + _isFuncOrString = function _isFuncOrString(value) { + return _isFunction(value) || _isString(value); + }, + _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function () {}, + _isArray = Array.isArray, + _strictNumExp = /(?:-?\.?\d|\.)+/gi, + _numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g, + _numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g, + _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi, + _relExp = /[+-]=-?[.\d]+/, + _delimitedValueExp = /[^,'"\[\]\s]+/gi, + _unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i, + _globalTimeline, + _win, + _coreInitted, + _doc, + _globals = {}, + _installScope = {}, + _coreReady, + _install = function _install(scope) { + return (_installScope = _merge(scope, _globals)) && gsap; + }, + _missingPlugin = function _missingPlugin(property, value) { + return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()"); + }, + _warn = function _warn(message, suppress) { + return !suppress && console.warn(message); + }, + _addGlobal = function _addGlobal(name, obj) { + return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals; + }, + _emptyFunc = function _emptyFunc() { + return 0; + }, + _startAtRevertConfig = { + suppressEvents: true, + isStart: true, + kill: false + }, + _revertConfigNoKill = { + suppressEvents: true, + kill: false + }, + _revertConfig = { + suppressEvents: true + }, + _reservedProps = {}, + _lazyTweens = [], + _lazyLookup = {}, + _lastRenderedFrame, + _plugins = {}, + _effects = {}, + _nextGCFrame = 30, + _harnessPlugins = [], + _callbackNames = "", + _harness = function _harness(targets) { + var target = targets[0], + harnessPlugin, + i; + _isObject(target) || _isFunction(target) || (targets = [targets]); - var hasMethods = es5.isES5 && keys.length > 1; - var hasMethodsOtherThanConstructor = keys.length > 0 && - !(keys.length === 1 && keys[0] === "constructor"); - var hasThisAssignmentAndStaticMethods = - thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0; + if (!(harnessPlugin = (target._gsap || {}).harness)) { + i = _harnessPlugins.length; - if (hasMethods || hasMethodsOtherThanConstructor || - hasThisAssignmentAndStaticMethods) { - return true; - } - } - return false; - } catch (e) { - return false; - } -} + while (i-- && !_harnessPlugins[i].targetTest(target)) {} -function toFastProperties(obj) { - /*jshint -W027,-W055,-W031*/ - function FakeConstructor() {} - FakeConstructor.prototype = obj; - var receiver = new FakeConstructor(); - function ic() { - return typeof receiver.foo; + harnessPlugin = _harnessPlugins[i]; } - ic(); - ic(); - return obj; - eval(obj); -} -var rident = /^[a-z$_][a-z$_0-9]*$/i; -function isIdentifier(str) { - return rident.test(str); -} + i = targets.length; -function filledRange(count, prefix, suffix) { - var ret = new Array(count); - for(var i = 0; i < count; ++i) { - ret[i] = prefix + i + suffix; + while (i--) { + targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1); } - return ret; -} -function safeToString(obj) { - try { - return obj + ""; - } catch (e) { - return "[no string representation]"; + return targets; + }, + _getCache = function _getCache(target) { + return target._gsap || _harness(toArray(target))[0]._gsap; + }, + _getProperty = function _getProperty(target, property, v) { + return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v; + }, + _forEachName = function _forEachName(names, func) { + return (names = names.split(",")).forEach(func) || names; + }, + _round = function _round(value) { + return Math.round(value * 100000) / 100000 || 0; + }, + _roundPrecise = function _roundPrecise(value) { + return Math.round(value * 10000000) / 10000000 || 0; + }, + _parseRelative = function _parseRelative(start, value) { + var operator = value.charAt(0), + end = parseFloat(value.substr(2)); + start = parseFloat(start); + return operator === "+" ? start + end : operator === "-" ? start - end : operator === "*" ? start * end : start / end; + }, + _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) { + var l = toFind.length, + i = 0; + + for (; toSearch.indexOf(toFind[i]) < 0 && ++i < l;) {} + + return i < l; + }, + _lazyRender = function _lazyRender() { + var l = _lazyTweens.length, + a = _lazyTweens.slice(0), + i, + tween; + + _lazyLookup = {}; + _lazyTweens.length = 0; + + for (i = 0; i < l; i++) { + tween = a[i]; + tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0); + } + }, + _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) { + _lazyTweens.length && !_reverting && _lazyRender(); + animation.render(time, suppressEvents, force || _reverting && time < 0 && (animation._initted || animation._startAt)); + _lazyTweens.length && !_reverting && _lazyRender(); + }, + _numericIfPossible = function _numericIfPossible(value) { + var n = parseFloat(value); + return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value; + }, + _passThrough = function _passThrough(p) { + return p; + }, + _setDefaults = function _setDefaults(obj, defaults) { + for (var p in defaults) { + p in obj || (obj[p] = defaults[p]); } -} -function isError(obj) { - return obj instanceof Error || - (obj !== null && - typeof obj === "object" && - typeof obj.message === "string" && - typeof obj.name === "string"); -} + return obj; + }, + _setKeyframeDefaults = function _setKeyframeDefaults(excludeDuration) { + return function (obj, defaults) { + for (var p in defaults) { + p in obj || p === "duration" && excludeDuration || p === "ease" || (obj[p] = defaults[p]); + } + }; + }, + _merge = function _merge(base, toMerge) { + for (var p in toMerge) { + base[p] = toMerge[p]; + } -function markAsOriginatingFromRejection(e) { - try { - notEnumerableProp(e, "isOperational", true); + return base; + }, + _mergeDeep = function _mergeDeep(base, toMerge) { + for (var p in toMerge) { + p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]); } - catch(ignore) {} -} -function originatesFromRejection(e) { - if (e == null) return false; - return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || - e["isOperational"] === true); -} + return base; + }, + _copyExcluding = function _copyExcluding(obj, excluding) { + var copy = {}, + p; + + for (p in obj) { + p in excluding || (copy[p] = obj[p]); + } -function canAttachTrace(obj) { - return isError(obj) && es5.propertyIsWritable(obj, "stack"); -} + return copy; + }, + _inheritDefaults = function _inheritDefaults(vars) { + var parent = vars.parent || _globalTimeline, + func = vars.keyframes ? _setKeyframeDefaults(_isArray(vars.keyframes)) : _setDefaults; -var ensureErrorObject = (function() { - if (!("stack" in new Error())) { - return function(value) { - if (canAttachTrace(value)) return value; - try {throw new Error(safeToString(value));} - catch(err) {return err;} - }; - } else { - return function(value) { - if (canAttachTrace(value)) return value; - return new Error(safeToString(value)); - }; + if (_isNotFalse(vars.inherit)) { + while (parent) { + func(vars, parent.vars.defaults); + parent = parent.parent || parent._dp; + } } -})(); -function classString(obj) { - return {}.toString.call(obj); -} + return vars; + }, + _arraysMatch = function _arraysMatch(a1, a2) { + var i = a1.length, + match = i === a2.length; -function copyDescriptors(from, to, filter) { - var keys = es5.names(from); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (filter(key)) { - try { - es5.defineProperty(to, key, es5.getDescriptor(from, key)); - } catch (ignore) {} - } + while (match && i-- && a1[i] === a2[i]) {} + + return i < 0; + }, + _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) { + if (firstProp === void 0) { + firstProp = "_first"; } -} -var asArray = function(v) { - if (es5.isArray(v)) { - return v; + if (lastProp === void 0) { + lastProp = "_last"; } - return null; -}; -if (typeof Symbol !== "undefined" && Symbol.iterator) { - var ArrayFrom = typeof Array.from === "function" ? function(v) { - return Array.from(v); - } : function(v) { - var ret = []; - var it = v[Symbol.iterator](); - var itResult; - while (!((itResult = it.next()).done)) { - ret.push(itResult.value); - } - return ret; - }; + var prev = parent[lastProp], + t; - asArray = function(v) { - if (es5.isArray(v)) { - return v; - } else if (v != null && typeof v[Symbol.iterator] === "function") { - return ArrayFrom(v); - } - return null; - }; -} + if (sortBy) { + t = child[sortBy]; -var isNode = typeof process !== "undefined" && - classString(process).toLowerCase() === "[object process]"; + while (prev && prev[sortBy] > t) { + prev = prev._prev; + } + } -var hasEnvVariables = typeof process !== "undefined" && - typeof process.env !== "undefined"; + if (prev) { + child._next = prev._next; + prev._next = child; + } else { + child._next = parent[firstProp]; + parent[firstProp] = child; + } -function env(key) { - return hasEnvVariables ? process.env[key] : undefined; -} + if (child._next) { + child._next._prev = child; + } else { + parent[lastProp] = child; + } -function getNativePromise() { - if (typeof Promise === "function") { - try { - var promise = new Promise(function(){}); - if (classString(promise) === "[object Promise]") { - return Promise; - } - } catch (e) {} + child._prev = prev; + child.parent = child._dp = parent; + return child; + }, + _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) { + if (firstProp === void 0) { + firstProp = "_first"; } -} -var reflectHandler; -function contextBind(ctx, cb) { - if (ctx === null || - typeof cb !== "function" || - cb === reflectHandler) { - return cb; + if (lastProp === void 0) { + lastProp = "_last"; } - if (ctx.domain !== null) { - cb = ctx.domain.bind(cb); + var prev = child._prev, + next = child._next; + + if (prev) { + prev._next = next; + } else if (parent[firstProp] === child) { + parent[firstProp] = next; } - var async = ctx.async; - if (async !== null) { - var old = cb; - cb = function() { - var args = (new Array(2)).concat([].slice.call(arguments));; - args[0] = old; - args[1] = this; - return async.runInAsyncScope.apply(async, args); - }; + if (next) { + next._prev = prev; + } else if (parent[lastProp] === child) { + parent[lastProp] = prev; } - return cb; -} -var ret = { - setReflectHandler: function(fn) { - reflectHandler = fn; - }, - isClass: isClass, - isIdentifier: isIdentifier, - inheritedDataKeys: inheritedDataKeys, - getDataPropertyOrDefault: getDataPropertyOrDefault, - thrower: thrower, - isArray: es5.isArray, - asArray: asArray, - notEnumerableProp: notEnumerableProp, - isPrimitive: isPrimitive, - isObject: isObject, - isError: isError, - canEvaluate: canEvaluate, - errorObj: errorObj, - tryCatch: tryCatch, - inherits: inherits, - withAppended: withAppended, - maybeWrapAsError: maybeWrapAsError, - toFastProperties: toFastProperties, - filledRange: filledRange, - toString: safeToString, - canAttachTrace: canAttachTrace, - ensureErrorObject: ensureErrorObject, - originatesFromRejection: originatesFromRejection, - markAsOriginatingFromRejection: markAsOriginatingFromRejection, - classString: classString, - copyDescriptors: copyDescriptors, - isNode: isNode, - hasEnvVariables: hasEnvVariables, - env: env, - global: globalObject, - getNativePromise: getNativePromise, - contextBind: contextBind -}; -ret.isRecentNode = ret.isNode && (function() { - var version; - if (process.versions && process.versions.node) { - version = process.versions.node.split(".").map(Number); - } else if (process.version) { - version = process.version.split(".").map(Number); + child._next = child._prev = child.parent = null; + }, + _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) { + child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove && child.parent.remove(child); + child._act = 0; + }, + _uncache = function _uncache(animation, child) { + if (animation && (!child || child._end > animation._dur || child._start < 0)) { + var a = animation; + + while (a) { + a._dirty = 1; + a = a.parent; + } } - return (version[0] === 0 && version[1] > 10) || (version[0] > 0); -})(); -ret.nodeSupportsAsyncResource = ret.isNode && (function() { - var supportsAsync = false; - try { - var res = _dereq_("async_hooks").AsyncResource; - supportsAsync = typeof res.prototype.runInAsyncScope === "function"; - } catch (e) { - supportsAsync = false; + + return animation; + }, + _recacheAncestors = function _recacheAncestors(animation) { + var parent = animation.parent; + + while (parent && parent.parent) { + parent._dirty = 1; + parent.totalDuration(); + parent = parent.parent; } - return supportsAsync; -})(); -if (ret.isNode) ret.toFastProperties(process); + return animation; + }, + _rewindStartAt = function _rewindStartAt(tween, totalTime, suppressEvents, force) { + return tween._startAt && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween.vars.immediateRender && !tween.vars.autoRevert || tween._startAt.render(totalTime, true, force)); + }, + _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) { + return !animation || animation._ts && _hasNoPausedAncestors(animation.parent); + }, + _elapsedCycleDuration = function _elapsedCycleDuration(animation) { + return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0; + }, + _animationCycle = function _animationCycle(tTime, cycleDuration) { + var whole = Math.floor(tTime /= cycleDuration); + return tTime && whole === tTime ? whole - 1 : whole; + }, + _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) { + return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur); + }, + _setEnd = function _setEnd(animation) { + return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0)); + }, + _alignPlayhead = function _alignPlayhead(animation, totalTime) { + var parent = animation._dp; -try {throw new Error(); } catch (e) {ret.lastLineError = e;} -module.exports = ret; + if (parent && parent.smoothChildTiming && animation._ts) { + animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts)); -},{"./es5":13,"async_hooks":undefined}]},{},[4])(4) -}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } -; -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory() : - typeof define === 'function' && define.amd ? define(factory) : - (factory()); -}(this, (function () { 'use strict'; + _setEnd(animation); -/** - * @this {Promise} - */ -function finallyConstructor(callback) { - var constructor = this.constructor; - return this.then( - function(value) { - // @ts-ignore - return constructor.resolve(callback()).then(function() { - return value; - }); - }, - function(reason) { - // @ts-ignore - return constructor.resolve(callback()).then(function() { - // @ts-ignore - return constructor.reject(reason); - }); + parent._dirty || _uncache(parent, animation); } - ); -} -function allSettled(arr) { - var P = this; - return new P(function(resolve, reject) { - if (!(arr && typeof arr.length !== 'undefined')) { - return reject( - new TypeError( - typeof arr + - ' ' + - arr + - ' is not iterable(cannot read property Symbol(Symbol.iterator))' - ) - ); + return animation; + }, + _postAddChecks = function _postAddChecks(timeline, child) { + var t; + + if (child._time || !child._dur && child._initted || child._start < timeline._time && (child._dur || !child.add)) { + t = _parentToChildTotalTime(timeline.rawTime(), child); + + if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) { + child.render(t, true); + } } - var args = Array.prototype.slice.call(arr); - if (args.length === 0) return resolve([]); - var remaining = args.length; - function res(i, val) { - if (val && (typeof val === 'object' || typeof val === 'function')) { - var then = val.then; - if (typeof then === 'function') { - then.call( - val, - function(val) { - res(i, val); - }, - function(e) { - args[i] = { status: 'rejected', reason: e }; - if (--remaining === 0) { - resolve(args); - } - } - ); - return; + if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) { + if (timeline._dur < timeline.duration()) { + t = timeline; + + while (t._dp) { + t.rawTime() >= 0 && t.totalTime(t._tTime); + t = t._dp; } } - args[i] = { status: 'fulfilled', value: val }; - if (--remaining === 0) { - resolve(args); - } - } - for (var i = 0; i < args.length; i++) { - res(i, args[i]); + timeline._zTime = -_tinyNum; } - }); -} + }, + _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) { + child.parent && _removeFromParent(child); + child._start = _roundPrecise((_isNumber(position) ? position : position || timeline !== _globalTimeline ? _parsePosition(timeline, position, child) : timeline._time) + child._delay); + child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0)); -// Store setTimeout reference so promise-polyfill will be unaffected by -// other code modifying setTimeout (like sinon.useFakeTimers()) -var setTimeoutFunc = setTimeout; + _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0); -function isArray(x) { - return Boolean(x && typeof x.length !== 'undefined'); -} + _isFromOrFromStart(child) || (timeline._recent = child); + skipChecks || _postAddChecks(timeline, child); + timeline._ts < 0 && _alignPlayhead(timeline, timeline._tTime); + return timeline; + }, + _scrollTrigger = function _scrollTrigger(animation, trigger) { + return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation); + }, + _attemptInitTween = function _attemptInitTween(tween, time, force, suppressEvents, tTime) { + _initTween(tween, time, tTime); -function noop() {} + if (!tween._initted) { + return 1; + } -// Polyfill for Function.prototype.bind -function bind(fn, thisArg) { - return function() { - fn.apply(thisArg, arguments); - }; -} + if (!force && tween._pt && !_reverting && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) { + _lazyTweens.push(tween); -/** - * @constructor - * @param {Function} fn - */ -function Promise(fn) { - if (!(this instanceof Promise)) - throw new TypeError('Promises must be constructed via new'); - if (typeof fn !== 'function') throw new TypeError('not a function'); - /** @type {!number} */ - this._state = 0; - /** @type {!boolean} */ - this._handled = false; - /** @type {Promise|undefined} */ - this._value = undefined; - /** @type {!Array} */ - this._deferreds = []; + tween._lazy = [tTime, suppressEvents]; + return 1; + } + }, + _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart(_ref) { + var parent = _ref.parent; + return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart(parent)); + }, + _isFromOrFromStart = function _isFromOrFromStart(_ref2) { + var data = _ref2.data; + return data === "isFromStart" || data === "isStart"; + }, + _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) { + var prevRatio = tween.ratio, + ratio = totalTime < 0 || !totalTime && (!tween._start && _parentPlayheadIsBeforeStart(tween) && !(!tween._initted && _isFromOrFromStart(tween)) || (tween._ts < 0 || tween._dp._ts < 0) && !_isFromOrFromStart(tween)) ? 0 : 1, + repeatDelay = tween._rDelay, + tTime = 0, + pt, + iteration, + prevIteration; - doResolve(fn, this); -} + if (repeatDelay && tween._repeat) { + tTime = _clamp(0, tween._tDur, totalTime); + iteration = _animationCycle(tTime, repeatDelay); + tween._yoyo && iteration & 1 && (ratio = 1 - ratio); -function handle(self, deferred) { - while (self._state === 3) { - self = self._value; - } - if (self._state === 0) { - self._deferreds.push(deferred); - return; - } - self._handled = true; - Promise._immediateFn(function() { - var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; - if (cb === null) { - (self._state === 1 ? resolve : reject)(deferred.promise, self._value); - return; - } - var ret; - try { - ret = cb(self._value); - } catch (e) { - reject(deferred.promise, e); - return; + if (iteration !== _animationCycle(tween._tTime, repeatDelay)) { + prevRatio = 1 - ratio; + tween.vars.repeatRefresh && tween._initted && tween.invalidate(); + } } - resolve(deferred.promise, ret); - }); -} -function resolve(self, newValue) { - try { - // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure - if (newValue === self) - throw new TypeError('A promise cannot be resolved with itself.'); - if ( - newValue && - (typeof newValue === 'object' || typeof newValue === 'function') - ) { - var then = newValue.then; - if (newValue instanceof Promise) { - self._state = 3; - self._value = newValue; - finale(self); - return; - } else if (typeof then === 'function') { - doResolve(bind(then, newValue), self); + if (ratio !== prevRatio || _reverting || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) { + if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents, tTime)) { return; } - } - self._state = 1; - self._value = newValue; - finale(self); - } catch (e) { - reject(self, e); - } -} -function reject(self, newValue) { - self._state = 2; - self._value = newValue; - finale(self); -} + prevIteration = tween._zTime; + tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0); + suppressEvents || (suppressEvents = totalTime && !prevIteration); + tween.ratio = ratio; + tween._from && (ratio = 1 - ratio); + tween._time = 0; + tween._tTime = tTime; + pt = tween._pt; -function finale(self) { - if (self._state === 2 && self._deferreds.length === 0) { - Promise._immediateFn(function() { - if (!self._handled) { - Promise._unhandledRejectionFn(self._value); + while (pt) { + pt.r(ratio, pt.d); + pt = pt._next; } - }); - } - for (var i = 0, len = self._deferreds.length; i < len; i++) { - handle(self, self._deferreds[i]); - } - self._deferreds = null; -} + totalTime < 0 && _rewindStartAt(tween, totalTime, suppressEvents, true); + tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate"); + tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat"); -/** - * @constructor - */ -function Handler(onFulfilled, onRejected, promise) { - this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; - this.onRejected = typeof onRejected === 'function' ? onRejected : null; - this.promise = promise; -} + if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) { + ratio && _removeFromParent(tween, 1); -/** - * Take a potentially misbehaving resolver function and make sure - * onFulfilled and onRejected are only called once. - * - * Makes no guarantees about asynchrony. - */ -function doResolve(fn, self) { - var done = false; - try { - fn( - function(value) { - if (done) return; - done = true; - resolve(self, value); - }, - function(reason) { - if (done) return; - done = true; - reject(self, reason); + if (!suppressEvents && !_reverting) { + _callback(tween, ratio ? "onComplete" : "onReverseComplete", true); + + tween._prom && tween._prom(); + } } - ); - } catch (ex) { - if (done) return; - done = true; - reject(self, ex); - } -} + } else if (!tween._zTime) { + tween._zTime = totalTime; + } + }, + _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) { + var child; -Promise.prototype['catch'] = function(onRejected) { - return this.then(null, onRejected); -}; + if (time > prevTime) { + child = animation._first; -Promise.prototype.then = function(onFulfilled, onRejected) { - // @ts-ignore - var prom = new this.constructor(noop); + while (child && child._start <= time) { + if (child.data === "isPause" && child._start > prevTime) { + return child; + } - handle(this, new Handler(onFulfilled, onRejected, prom)); - return prom; -}; + child = child._next; + } + } else { + child = animation._last; -Promise.prototype['finally'] = finallyConstructor; + while (child && child._start >= time) { + if (child.data === "isPause" && child._start < prevTime) { + return child; + } -Promise.all = function(arr) { - return new Promise(function(resolve, reject) { - if (!isArray(arr)) { - return reject(new TypeError('Promise.all accepts an array')); + child = child._prev; + } } + }, + _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) { + var repeat = animation._repeat, + dur = _roundPrecise(duration) || 0, + totalProgress = animation._tTime / animation._tDur; + totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur); + animation._dur = dur; + animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _roundPrecise(dur * (repeat + 1) + animation._rDelay * repeat); + totalProgress > 0 && !leavePlayhead && _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress); + animation.parent && _setEnd(animation); + skipUncache || _uncache(animation.parent, animation); + return animation; + }, + _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) { + return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur); + }, + _zeroPosition = { + _start: 0, + endTime: _emptyFunc, + totalDuration: _emptyFunc + }, + _parsePosition = function _parsePosition(animation, position, percentAnimation) { + var labels = animation.labels, + recent = animation._recent || _zeroPosition, + clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur, + i, + offset, + isPercent; - var args = Array.prototype.slice.call(arr); - if (args.length === 0) return resolve([]); - var remaining = args.length; + if (_isString(position) && (isNaN(position) || position in labels)) { + offset = position.charAt(0); + isPercent = position.substr(-1) === "%"; + i = position.indexOf("="); - function res(i, val) { - try { - if (val && (typeof val === 'object' || typeof val === 'function')) { - var then = val.then; - if (typeof then === 'function') { - then.call( - val, - function(val) { - res(i, val); - }, - reject - ); - return; - } - } - args[i] = val; - if (--remaining === 0) { - resolve(args); - } - } catch (ex) { - reject(ex); + if (offset === "<" || offset === ">") { + i >= 0 && (position = position.replace(/=/, "")); + return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1); } - } - for (var i = 0; i < args.length; i++) { - res(i, args[i]); + if (i < 0) { + position in labels || (labels[position] = clippedDuration); + return labels[position]; + } + + offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1)); + + if (isPercent && percentAnimation) { + offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration(); + } + + return i > 1 ? _parsePosition(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset; } - }); -}; -Promise.allSettled = allSettled; + return position == null ? clippedDuration : +position; + }, + _createTweenType = function _createTweenType(type, params, timeline) { + var isLegacy = _isNumber(params[1]), + varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1), + vars = params[varsIndex], + irVars, + parent; -Promise.resolve = function(value) { - if (value && typeof value === 'object' && value.constructor === Promise) { - return value; - } + isLegacy && (vars.duration = params[1]); + vars.parent = timeline; - return new Promise(function(resolve) { - resolve(value); - }); -}; + if (type) { + irVars = vars; + parent = timeline; -Promise.reject = function(value) { - return new Promise(function(resolve, reject) { - reject(value); - }); -}; + while (parent && !("immediateRender" in irVars)) { + irVars = parent.vars.defaults || {}; + parent = _isNotFalse(parent.vars.inherit) && parent.parent; + } -Promise.race = function(arr) { - return new Promise(function(resolve, reject) { - if (!isArray(arr)) { - return reject(new TypeError('Promise.race accepts an array')); + vars.immediateRender = _isNotFalse(irVars.immediateRender); + type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1]; } - for (var i = 0, len = arr.length; i < len; i++) { - Promise.resolve(arr[i]).then(resolve, reject); + return new Tween(params[0], vars, params[varsIndex + 1]); + }, + _conditionalReturn = function _conditionalReturn(value, func) { + return value || value === 0 ? func(value) : func; + }, + _clamp = function _clamp(min, max, value) { + return value < min ? min : value > max ? max : value; + }, + getUnit = function getUnit(value, v) { + return !_isString(value) || !(v = _unitExp.exec(value)) ? "" : v[1]; + }, + clamp = function clamp(min, max, value) { + return _conditionalReturn(value, function (v) { + return _clamp(min, max, v); + }); + }, + _slice = [].slice, + _isArrayLike = function _isArrayLike(value, nonEmpty) { + return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win; + }, + _flatten = function _flatten(ar, leaveStrings, accumulator) { + if (accumulator === void 0) { + accumulator = []; } - }); -}; -// Use polyfill for setImmediate for performance gains -Promise._immediateFn = - // @ts-ignore - (typeof setImmediate === 'function' && - function(fn) { - // @ts-ignore - setImmediate(fn); - }) || - function(fn) { - setTimeoutFunc(fn, 0); - }; + return ar.forEach(function (value) { + var _accumulator; -Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { - if (typeof console !== 'undefined' && console) { - console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console - } -}; + return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value); + }) || accumulator; + }, + toArray = function toArray(value, scope, leaveStrings) { + return _context && !scope && _context.selector ? _context.selector(value) : _isString(value) && !leaveStrings && (_coreInitted || !_wake()) ? _slice.call((scope || _doc).querySelectorAll(value), 0) : _isArray(value) ? _flatten(value, leaveStrings) : _isArrayLike(value) ? _slice.call(value, 0) : value ? [value] : []; + }, + selector = function selector(value) { + value = toArray(value)[0] || _warn("Invalid scope") || {}; + return function (v) { + var el = value.current || value.nativeElement || value; + return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value); + }; + }, + shuffle = function shuffle(a) { + return a.sort(function () { + return .5 - Math.random(); + }); + }, + distribute = function distribute(v) { + if (_isFunction(v)) { + return v; + } -/** @suppress {undefinedVars} */ -var globalNS = (function() { - // the only reliable means to get the global object is - // `Function('return this')()` - // However, this causes CSP violations in Chrome apps. - if (typeof self !== 'undefined') { - return self; - } - if (typeof window !== 'undefined') { - return window; - } - if (typeof global !== 'undefined') { - return global; - } - throw new Error('unable to locate global object'); -})(); + var vars = _isObject(v) ? v : { + each: v + }, + ease = _parseEase(vars.ease), + from = vars.from || 0, + base = parseFloat(vars.base) || 0, + cache = {}, + isDecimal = from > 0 && from < 1, + ratios = isNaN(from) || isDecimal, + axis = vars.axis, + ratioX = from, + ratioY = from; + + if (_isString(from)) { + ratioX = ratioY = { + center: .5, + edges: .5, + end: 1 + }[from] || 0; + } else if (!isDecimal && ratios) { + ratioX = from[0]; + ratioY = from[1]; + } + + return function (i, target, a) { + var l = (a || vars).length, + distances = cache[l], + originX, + originY, + x, + y, + d, + j, + max, + min, + wrapAt; -// Expose the polyfill if Promise is undefined or set to a -// non-function value. The latter can be due to a named HTMLElement -// being exposed by browsers for legacy reasons. -// https://github.com/taylorhakes/promise-polyfill/issues/114 -if (typeof globalNS['Promise'] !== 'function') { - globalNS['Promise'] = Promise; -} else if (!globalNS.Promise.prototype['finally']) { - globalNS.Promise.prototype['finally'] = finallyConstructor; -} else if (!globalNS.Promise.allSettled) { - globalNS.Promise.allSettled = allSettled; -} + if (!distances) { + wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum])[1]; -}))); + if (!wrapAt) { + max = -_bigNum; -; -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o max && (max = d); + d < min && (min = d); + } - Dumper.indentation = 4; + from === "random" && shuffle(distances); + distances.max = max - min; + distances.min = min; + distances.v = l = (parseFloat(vars.amount) || parseFloat(vars.each) * (wrapAt > l ? l - 1 : !axis ? Math.max(wrapAt, l / wrapAt) : axis === "y" ? l / wrapAt : wrapAt) || 0) * (from === "edges" ? -1 : 1); + distances.b = l < 0 ? base - l : base; + distances.u = getUnit(vars.amount || vars.each) || 0; + ease = ease && l < 0 ? _invertEase(ease) : ease; + } - Dumper.prototype.dump = function(input, inline, indent, exceptionOnInvalidType, objectEncoder) { - var i, key, len, output, prefix, value, willBeInlined; - if (inline == null) { - inline = 0; - } - if (indent == null) { - indent = 0; - } - if (exceptionOnInvalidType == null) { - exceptionOnInvalidType = false; - } - if (objectEncoder == null) { - objectEncoder = null; - } - output = ''; - prefix = (indent ? Utils.strRepeat(' ', indent) : ''); - if (inline <= 0 || typeof input !== 'object' || input instanceof Date || Utils.isEmpty(input)) { - output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder); - } else { - if (input instanceof Array) { - for (i = 0, len = input.length; i < len; i++) { - value = input[i]; - willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value); - output += prefix + '-' + (willBeInlined ? ' ' : "\n") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? "\n" : ''); + l = (distances[i] - distances.min) / distances.max || 0; + return _roundPrecise(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u; + }; + }, + _roundModifier = function _roundModifier(v) { + var p = Math.pow(10, ((v + "").split(".")[1] || "").length); + return function (raw) { + var n = _roundPrecise(Math.round(parseFloat(raw) / v) * v * p); + + return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw)); + }; + }, + snap = function snap(snapTo, value) { + var isArray = _isArray(snapTo), + radius, + is2D; + + if (!isArray && _isObject(snapTo)) { + radius = isArray = snapTo.radius || _bigNum; + + if (snapTo.values) { + snapTo = toArray(snapTo.values); + + if (is2D = !_isNumber(snapTo[0])) { + radius *= radius; } } else { - for (key in input) { - value = input[key]; - willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value); - output += prefix + Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' + (willBeInlined ? ' ' : "\n") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? "\n" : ''); - } + snapTo = _roundModifier(snapTo.increment); } } - return output; - }; - return Dumper; + return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function (raw) { + is2D = snapTo(raw); + return Math.abs(is2D - raw) <= radius ? is2D : raw; + } : function (raw) { + var x = parseFloat(is2D ? raw.x : raw), + y = parseFloat(is2D ? raw.y : 0), + min = _bigNum, + closest = 0, + i = snapTo.length, + dx, + dy; -})(); + while (i--) { + if (is2D) { + dx = snapTo[i].x - x; + dy = snapTo[i].y - y; + dx = dx * dx + dy * dy; + } else { + dx = Math.abs(snapTo[i] - x); + } -module.exports = Dumper; + if (dx < min) { + min = dx; + closest = i; + } + } + closest = !radius || min <= radius ? snapTo[closest] : raw; + return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw); + }); + }, + random = function random(min, max, roundingIncrement, returnFunction) { + return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function () { + return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 1e-5) && (returnFunction = roundingIncrement < 1 ? Math.pow(10, (roundingIncrement + "").length - 2) : 1) && Math.floor(Math.round((min - roundingIncrement / 2 + Math.random() * (max - min + roundingIncrement * .99)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction; + }); + }, + pipe = function pipe() { + for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) { + functions[_key] = arguments[_key]; + } -},{"./Inline":6,"./Utils":10}],2:[function(require,module,exports){ -var Escaper, Pattern; + return function (value) { + return functions.reduce(function (v, f) { + return f(v); + }, value); + }; + }, + unitize = function unitize(func, unit) { + return function (value) { + return func(parseFloat(value)) + (unit || getUnit(value)); + }; + }, + normalize = function normalize(min, max, value) { + return mapRange(min, max, 0, 1, value); + }, + _wrapArray = function _wrapArray(a, wrapper, value) { + return _conditionalReturn(value, function (index) { + return a[~~wrapper(index)]; + }); + }, + wrap = function wrap(min, max, value) { + var range = max - min; + return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function (value) { + return (range + (value - min) % range) % range + min; + }); + }, + wrapYoyo = function wrapYoyo(min, max, value) { + var range = max - min, + total = range * 2; + return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function (value) { + value = (total + (value - min) % total) % total || 0; + return min + (value > range ? total - value : value); + }); + }, + _replaceRandom = function _replaceRandom(value) { + var prev = 0, + s = "", + i, + nums, + end, + isArray; + + while (~(i = value.indexOf("random(", prev))) { + end = value.indexOf(")", i); + isArray = value.charAt(i + 7) === "["; + nums = value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp : _strictNumExp); + s += value.substr(prev, i - prev) + random(isArray ? nums : +nums[0], isArray ? 0 : +nums[1], +nums[2] || 1e-5); + prev = end + 1; + } + + return s + value.substr(prev, value.length - prev); + }, + mapRange = function mapRange(inMin, inMax, outMin, outMax, value) { + var inRange = inMax - inMin, + outRange = outMax - outMin; + return _conditionalReturn(value, function (value) { + return outMin + ((value - inMin) / inRange * outRange || 0); + }); + }, + interpolate = function interpolate(start, end, progress, mutate) { + var func = isNaN(start + end) ? 0 : function (p) { + return (1 - p) * start + p * end; + }; -Pattern = require('./Pattern'); + if (!func) { + var isString = _isString(start), + master = {}, + p, + i, + interpolators, + l, + il; -Escaper = (function() { - var ch; + progress === true && (mutate = 1) && (progress = null); - function Escaper() {} + if (isString) { + start = { + p: start + }; + end = { + p: end + }; + } else if (_isArray(start) && !_isArray(end)) { + interpolators = []; + l = start.length; + il = l - 2; - Escaper.LIST_ESCAPEES = ['\\', '\\\\', '\\"', '"', "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", (ch = String.fromCharCode)(0x0085), ch(0x00A0), ch(0x2028), ch(0x2029)]; + for (i = 1; i < l; i++) { + interpolators.push(interpolate(start[i - 1], start[i])); + } - Escaper.LIST_ESCAPED = ['\\\\', '\\"', '\\"', '\\"', "\\0", "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", "\\x06", "\\a", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r", "\\x0e", "\\x0f", "\\x10", "\\x11", "\\x12", "\\x13", "\\x14", "\\x15", "\\x16", "\\x17", "\\x18", "\\x19", "\\x1a", "\\e", "\\x1c", "\\x1d", "\\x1e", "\\x1f", "\\N", "\\_", "\\L", "\\P"]; + l--; - Escaper.MAPPING_ESCAPEES_TO_ESCAPED = (function() { - var i, j, mapping, ref; - mapping = {}; - for (i = j = 0, ref = Escaper.LIST_ESCAPEES.length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) { - mapping[Escaper.LIST_ESCAPEES[i]] = Escaper.LIST_ESCAPED[i]; + func = function func(p) { + p *= l; + var i = Math.min(il, ~~p); + return interpolators[i](p - i); + }; + + progress = end; + } else if (!mutate) { + start = _merge(_isArray(start) ? [] : {}, start); + } + + if (!interpolators) { + for (p in end) { + _addPropTween.call(master, start, p, "get", end[p]); + } + + func = function func(p) { + return _renderPropTweens(p, master) || (isString ? start.p : start); + }; + } } - return mapping; - })(); - Escaper.PATTERN_CHARACTERS_TO_ESCAPE = new Pattern('[\\x00-\\x1f]|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9'); + return _conditionalReturn(progress, func); + }, + _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) { + var labels = timeline.labels, + min = _bigNum, + p, + distance, + label; - Escaper.PATTERN_MAPPING_ESCAPEES = new Pattern(Escaper.LIST_ESCAPEES.join('|').split('\\').join('\\\\')); + for (p in labels) { + distance = labels[p] - fromTime; - Escaper.PATTERN_SINGLE_QUOTING = new Pattern('[\\s\'":{}[\\],&*#?]|^[-?|<>=!%@`]'); + if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) { + label = p; + min = distance; + } + } - Escaper.requiresDoubleQuoting = function(value) { - return this.PATTERN_CHARACTERS_TO_ESCAPE.test(value); - }; + return label; + }, + _callback = function _callback(animation, type, executeLazyFirst) { + var v = animation.vars, + callback = v[type], + prevContext = _context, + context = animation._ctx, + params, + scope, + result; + + if (!callback) { + return; + } - Escaper.escapeWithDoubleQuotes = function(value) { - var result; - result = this.PATTERN_MAPPING_ESCAPEES.replace(value, (function(_this) { - return function(str) { - return _this.MAPPING_ESCAPEES_TO_ESCAPED[str]; + params = v[type + "Params"]; + scope = v.callbackScope || animation; + executeLazyFirst && _lazyTweens.length && _lazyRender(); + context && (_context = context); + result = params ? callback.apply(scope, params) : callback.call(scope); + _context = prevContext; + return result; + }, + _interrupt = function _interrupt(animation) { + _removeFromParent(animation); + + animation.scrollTrigger && animation.scrollTrigger.kill(!!_reverting); + animation.progress() < 1 && _callback(animation, "onInterrupt"); + return animation; + }, + _quickTween, + _registerPluginQueue = [], + _createPlugin = function _createPlugin(config) { + if (!config) return; + config = !config.name && config["default"] || config; + + if (_windowExists() || config.headless) { + var name = config.name, + isFunc = _isFunction(config), + Plugin = name && !isFunc && config.init ? function () { + this._props = []; + } : config, + instanceDefaults = { + init: _emptyFunc, + render: _renderPropTweens, + add: _addPropTween, + kill: _killPropTweensOf, + modifier: _addPluginModifier, + rawVars: 0 + }, + statics = { + targetTest: 0, + get: 0, + getSetter: _getSetter, + aliases: {}, + register: 0 }; - })(this)); - return '"' + result + '"'; - }; - Escaper.requiresSingleQuoting = function(value) { - return this.PATTERN_SINGLE_QUOTING.test(value); - }; + _wake(); - Escaper.escapeWithSingleQuotes = function(value) { - return "'" + value.replace(/'/g, "''") + "'"; - }; + if (config !== Plugin) { + if (_plugins[name]) { + return; + } - return Escaper; + _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics)); -})(); + _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics))); -module.exports = Escaper; + _plugins[Plugin.prop = name] = Plugin; + if (config.targetTest) { + _harnessPlugins.push(Plugin); -},{"./Pattern":8}],3:[function(require,module,exports){ -var DumpException, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + _reservedProps[name] = 1; + } -DumpException = (function(superClass) { - extend(DumpException, superClass); + name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin"; + } - function DumpException(message, parsedLine, snippet) { - this.message = message; - this.parsedLine = parsedLine; - this.snippet = snippet; - } + _addGlobal(name, Plugin); - DumpException.prototype.toString = function() { - if ((this.parsedLine != null) && (this.snippet != null)) { - return ' ' + this.message + ' (line ' + this.parsedLine + ': \'' + this.snippet + '\')'; + config.register && config.register(gsap, Plugin, PropTween); } else { - return ' ' + this.message; + _registerPluginQueue.push(config); } - }; - - return DumpException; - -})(Error); + }, + _255 = 255, + _colorLookup = { + aqua: [0, _255, _255], + lime: [0, _255, 0], + silver: [192, 192, 192], + black: [0, 0, 0], + maroon: [128, 0, 0], + teal: [0, 128, 128], + blue: [0, 0, _255], + navy: [0, 0, 128], + white: [_255, _255, _255], + olive: [128, 128, 0], + yellow: [_255, _255, 0], + orange: [_255, 165, 0], + gray: [128, 128, 128], + purple: [128, 0, 128], + green: [0, 128, 0], + red: [_255, 0, 0], + pink: [_255, 192, 203], + cyan: [0, _255, _255], + transparent: [_255, _255, _255, 0] + }, + _hue = function _hue(h, m1, m2) { + h += h < 0 ? 1 : h > 1 ? -1 : 0; + return (h * 6 < 1 ? m1 + (m2 - m1) * h * 6 : h < .5 ? m2 : h * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * _255 + .5 | 0; + }, + splitColor = function splitColor(v, toHSL, forceAlpha) { + var a = !v ? _colorLookup.black : _isNumber(v) ? [v >> 16, v >> 8 & _255, v & _255] : 0, + r, + g, + b, + h, + s, + l, + max, + min, + d, + wasHSL; + + if (!a) { + if (v.substr(-1) === ",") { + v = v.substr(0, v.length - 1); + } + + if (_colorLookup[v]) { + a = _colorLookup[v]; + } else if (v.charAt(0) === "#") { + if (v.length < 6) { + r = v.charAt(1); + g = v.charAt(2); + b = v.charAt(3); + v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : ""); + } + + if (v.length === 9) { + a = parseInt(v.substr(1, 6), 16); + return [a >> 16, a >> 8 & _255, a & _255, parseInt(v.substr(7), 16) / 255]; + } + + v = parseInt(v.substr(1), 16); + a = [v >> 16, v >> 8 & _255, v & _255]; + } else if (v.substr(0, 3) === "hsl") { + a = wasHSL = v.match(_strictNumExp); + + if (!toHSL) { + h = +a[0] % 360 / 360; + s = +a[1] / 100; + l = +a[2] / 100; + g = l <= .5 ? l * (s + 1) : l + s - l * s; + r = l * 2 - g; + a.length > 3 && (a[3] *= 1); + a[0] = _hue(h + 1 / 3, r, g); + a[1] = _hue(h, r, g); + a[2] = _hue(h - 1 / 3, r, g); + } else if (~v.indexOf("=")) { + a = v.match(_numExp); + forceAlpha && a.length < 4 && (a[3] = 1); + return a; + } + } else { + a = v.match(_strictNumExp) || _colorLookup.transparent; + } -module.exports = DumpException; + a = a.map(Number); + } + if (toHSL && !wasHSL) { + r = a[0] / _255; + g = a[1] / _255; + b = a[2] / _255; + max = Math.max(r, g, b); + min = Math.min(r, g, b); + l = (max + min) / 2; -},{}],4:[function(require,module,exports){ -var ParseException, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + if (max === min) { + h = s = 0; + } else { + d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4; + h *= 60; + } -ParseException = (function(superClass) { - extend(ParseException, superClass); + a[0] = ~~(h + .5); + a[1] = ~~(s * 100 + .5); + a[2] = ~~(l * 100 + .5); + } - function ParseException(message, parsedLine, snippet) { - this.message = message; - this.parsedLine = parsedLine; - this.snippet = snippet; - } + forceAlpha && a.length < 4 && (a[3] = 1); + return a; + }, + _colorOrderData = function _colorOrderData(v) { + var values = [], + c = [], + i = -1; + v.split(_colorExp).forEach(function (v) { + var a = v.match(_numWithUnitExp) || []; + values.push.apply(values, a); + c.push(i += a.length + 1); + }); + values.c = c; + return values; + }, + _formatColors = function _formatColors(s, toHSL, orderMatchData) { + var result = "", + colors = (s + result).match(_colorExp), + type = toHSL ? "hsla(" : "rgba(", + i = 0, + c, + shell, + d, + l; - ParseException.prototype.toString = function() { - if ((this.parsedLine != null) && (this.snippet != null)) { - return ' ' + this.message + ' (line ' + this.parsedLine + ': \'' + this.snippet + '\')'; - } else { - return ' ' + this.message; + if (!colors) { + return s; } - }; - - return ParseException; -})(Error); + colors = colors.map(function (color) { + return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")"; + }); -module.exports = ParseException; + if (orderMatchData) { + d = _colorOrderData(s); + c = orderMatchData.c; + if (c.join(result) !== d.c.join(result)) { + shell = s.replace(_colorExp, "1").split(_numWithUnitExp); + l = shell.length - 1; -},{}],5:[function(require,module,exports){ -var ParseMore, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + for (; i < l; i++) { + result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift()); + } + } + } -ParseMore = (function(superClass) { - extend(ParseMore, superClass); + if (!shell) { + shell = s.split(_colorExp); + l = shell.length - 1; - function ParseMore(message, parsedLine, snippet) { - this.message = message; - this.parsedLine = parsedLine; - this.snippet = snippet; - } + for (; i < l; i++) { + result += shell[i] + colors[i]; + } + } - ParseMore.prototype.toString = function() { - if ((this.parsedLine != null) && (this.snippet != null)) { - return ' ' + this.message + ' (line ' + this.parsedLine + ': \'' + this.snippet + '\')'; - } else { - return ' ' + this.message; + return result + shell[l]; + }, + _colorExp = function () { + var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b", + p; + + for (p in _colorLookup) { + s += "|" + p + "\\b"; + } + + return new RegExp(s + ")", "gi"); + }(), + _hslExp = /hsl[a]?\(/, + _colorStringFilter = function _colorStringFilter(a) { + var combined = a.join(" "), + toHSL; + _colorExp.lastIndex = 0; + + if (_colorExp.test(combined)) { + toHSL = _hslExp.test(combined); + a[1] = _formatColors(a[1], toHSL); + a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1])); + return true; } - }; + }, + _tickerActive, + _ticker = function () { + var _getTime = Date.now, + _lagThreshold = 500, + _adjustedLag = 33, + _startTime = _getTime(), + _lastUpdate = _startTime, + _gap = 1000 / 240, + _nextTime = _gap, + _listeners = [], + _id, + _req, + _raf, + _self, + _delta, + _i, + _tick = function _tick(v) { + var elapsed = _getTime() - _lastUpdate, + manual = v === true, + overlap, + dispatch, + time, + frame; + + (elapsed > _lagThreshold || elapsed < 0) && (_startTime += elapsed - _adjustedLag); + _lastUpdate += elapsed; + time = _lastUpdate - _startTime; + overlap = time - _nextTime; + + if (overlap > 0 || manual) { + frame = ++_self.frame; + _delta = time - _self.time * 1000; + _self.time = time = time / 1000; + _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap); + dispatch = 1; + } + + manual || (_id = _req(_tick)); + + if (dispatch) { + for (_i = 0; _i < _listeners.length; _i++) { + _listeners[_i](time, _delta, frame, v); + } + } + }; + + _self = { + time: 0, + frame: 0, + tick: function tick() { + _tick(true); + }, + deltaRatio: function deltaRatio(fps) { + return _delta / (1000 / (fps || 60)); + }, + wake: function wake() { + if (_coreReady) { + if (!_coreInitted && _windowExists()) { + _win = _coreInitted = window; + _doc = _win.document || {}; + _globals.gsap = gsap; + (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version); - return ParseMore; + _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {}); -})(Error); + _registerPluginQueue.forEach(_createPlugin); + } -module.exports = ParseMore; + _raf = typeof requestAnimationFrame !== "undefined" && requestAnimationFrame; + _id && _self.sleep(); + _req = _raf || function (f) { + return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0); + }; -},{}],6:[function(require,module,exports){ -var DumpException, Escaper, Inline, ParseException, ParseMore, Pattern, Unescaper, Utils, - indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + _tickerActive = 1; -Pattern = require('./Pattern'); + _tick(2); + } + }, + sleep: function sleep() { + (_raf ? cancelAnimationFrame : clearTimeout)(_id); + _tickerActive = 0; + _req = _emptyFunc; + }, + lagSmoothing: function lagSmoothing(threshold, adjustedLag) { + _lagThreshold = threshold || Infinity; + _adjustedLag = Math.min(adjustedLag || 33, _lagThreshold); + }, + fps: function fps(_fps) { + _gap = 1000 / (_fps || 240); + _nextTime = _self.time * 1000 + _gap; + }, + add: function add(callback, once, prioritize) { + var func = once ? function (t, d, f, v) { + callback(t, d, f, v); -Unescaper = require('./Unescaper'); + _self.remove(func); + } : callback; -Escaper = require('./Escaper'); + _self.remove(callback); -Utils = require('./Utils'); + _listeners[prioritize ? "unshift" : "push"](func); -ParseException = require('./Exception/ParseException'); + _wake(); -ParseMore = require('./Exception/ParseMore'); + return func; + }, + remove: function remove(callback, i) { + ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--; + }, + _listeners: _listeners + }; + return _self; + }(), + _wake = function _wake() { + return !_tickerActive && _ticker.wake(); + }, + _easeMap = {}, + _customEaseExp = /^[\d.\-M][\d.\-,\s]/, + _quotesExp = /["']/g, + _parseObjectInString = function _parseObjectInString(value) { + var obj = {}, + split = value.substr(1, value.length - 3).split(":"), + key = split[0], + i = 1, + l = split.length, + index, + val, + parsedVal; + + for (; i < l; i++) { + val = split[i]; + index = i !== l - 1 ? val.lastIndexOf(",") : val.length; + parsedVal = val.substr(0, index); + obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal; + key = val.substr(index + 1).trim(); + } -DumpException = require('./Exception/DumpException'); + return obj; + }, + _valueInParentheses = function _valueInParentheses(value) { + var open = value.indexOf("(") + 1, + close = value.indexOf(")"), + nested = value.indexOf("(", open); + return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close); + }, + _configEaseFromString = function _configEaseFromString(name) { + var split = (name + "").split("("), + ease = _easeMap[split[0]]; + return ease && split.length > 1 && ease.config ? ease.config.apply(null, ~name.indexOf("{") ? [_parseObjectInString(split[1])] : _valueInParentheses(name).split(",").map(_numericIfPossible)) : _easeMap._CE && _customEaseExp.test(name) ? _easeMap._CE("", name) : ease; + }, + _invertEase = function _invertEase(ease) { + return function (p) { + return 1 - ease(1 - p); + }; + }, + _propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) { + var child = timeline._first, + ease; + + while (child) { + if (child instanceof Timeline) { + _propagateYoyoEase(child, isYoyo); + } else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) { + if (child.timeline) { + _propagateYoyoEase(child.timeline, isYoyo); + } else { + ease = child._ease; + child._ease = child._yEase; + child._yEase = ease; + child._yoyo = isYoyo; + } + } -Inline = (function() { - function Inline() {} + child = child._next; + } + }, + _parseEase = function _parseEase(ease, defaultEase) { + return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase; + }, + _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) { + if (easeOut === void 0) { + easeOut = function easeOut(p) { + return 1 - easeIn(1 - p); + }; + } - Inline.REGEX_QUOTED_STRING = '(?:"(?:[^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'(?:[^\']*(?:\'\'[^\']*)*)\')'; + if (easeInOut === void 0) { + easeInOut = function easeInOut(p) { + return p < .5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2; + }; + } - Inline.PATTERN_TRAILING_COMMENTS = new Pattern('^\\s*#.*$'); + var ease = { + easeIn: easeIn, + easeOut: easeOut, + easeInOut: easeInOut + }, + lowercaseName; - Inline.PATTERN_QUOTED_SCALAR = new Pattern('^' + Inline.REGEX_QUOTED_STRING); + _forEachName(names, function (name) { + _easeMap[name] = _globals[name] = ease; + _easeMap[lowercaseName = name.toLowerCase()] = easeOut; - Inline.PATTERN_THOUSAND_NUMERIC_SCALAR = new Pattern('^(-|\\+)?[0-9,]+(\\.[0-9]+)?$'); + for (var p in ease) { + _easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p]; + } + }); - Inline.PATTERN_SCALAR_BY_DELIMITERS = {}; + return ease; + }, + _easeInOutFromOut = function _easeInOutFromOut(easeOut) { + return function (p) { + return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2; + }; + }, + _configElastic = function _configElastic(type, amplitude, period) { + var p1 = amplitude >= 1 ? amplitude : 1, + p2 = (period || (type ? .3 : .45)) / (amplitude < 1 ? amplitude : 1), + p3 = p2 / _2PI * (Math.asin(1 / p1) || 0), + easeOut = function easeOut(p) { + return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1; + }, + ease = type === "out" ? easeOut : type === "in" ? function (p) { + return 1 - easeOut(1 - p); + } : _easeInOutFromOut(easeOut); - Inline.settings = {}; + p2 = _2PI / p2; - Inline.configure = function(exceptionOnInvalidType, objectDecoder) { - if (exceptionOnInvalidType == null) { - exceptionOnInvalidType = null; - } - if (objectDecoder == null) { - objectDecoder = null; - } - this.settings.exceptionOnInvalidType = exceptionOnInvalidType; - this.settings.objectDecoder = objectDecoder; - }; + ease.config = function (amplitude, period) { + return _configElastic(type, amplitude, period); + }; - Inline.parse = function(value, exceptionOnInvalidType, objectDecoder) { - var context, result; - if (exceptionOnInvalidType == null) { - exceptionOnInvalidType = false; - } - if (objectDecoder == null) { - objectDecoder = null; - } - this.settings.exceptionOnInvalidType = exceptionOnInvalidType; - this.settings.objectDecoder = objectDecoder; - if (value == null) { - return ''; - } - value = Utils.trim(value); - if (0 === value.length) { - return ''; + return ease; + }, + _configBack = function _configBack(type, overshoot) { + if (overshoot === void 0) { + overshoot = 1.70158; } - context = { - exceptionOnInvalidType: exceptionOnInvalidType, - objectDecoder: objectDecoder, - i: 0 + + var easeOut = function easeOut(p) { + return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0; + }, + ease = type === "out" ? easeOut : type === "in" ? function (p) { + return 1 - easeOut(1 - p); + } : _easeInOutFromOut(easeOut); + + ease.config = function (overshoot) { + return _configBack(type, overshoot); }; - switch (value.charAt(0)) { - case '[': - result = this.parseSequence(value, context); - ++context.i; - break; - case '{': - result = this.parseMapping(value, context); - ++context.i; - break; - default: - result = this.parseScalar(value, null, ['"', "'"], context); - } - if (this.PATTERN_TRAILING_COMMENTS.replace(value.slice(context.i), '') !== '') { - throw new ParseException('Unexpected characters near "' + value.slice(context.i) + '".'); - } - return result; - }; - Inline.dump = function(value, exceptionOnInvalidType, objectEncoder) { - var ref, result, type; - if (exceptionOnInvalidType == null) { - exceptionOnInvalidType = false; - } - if (objectEncoder == null) { - objectEncoder = null; - } - if (value == null) { - return 'null'; - } - type = typeof value; - if (type === 'object') { - if (value instanceof Date) { - return value.toISOString(); - } else if (objectEncoder != null) { - result = objectEncoder(value); - if (typeof result === 'string' || (result != null)) { - return result; - } - } - return this.dumpObject(value); - } - if (type === 'boolean') { - return (value ? 'true' : 'false'); - } - if (Utils.isDigits(value)) { - return (type === 'string' ? "'" + value + "'" : String(parseInt(value))); - } - if (Utils.isNumeric(value)) { - return (type === 'string' ? "'" + value + "'" : String(parseFloat(value))); - } - if (type === 'number') { - return (value === Infinity ? '.Inf' : (value === -Infinity ? '-.Inf' : (isNaN(value) ? '.NaN' : value))); - } - if (Escaper.requiresDoubleQuoting(value)) { - return Escaper.escapeWithDoubleQuotes(value); - } - if (Escaper.requiresSingleQuoting(value)) { - return Escaper.escapeWithSingleQuotes(value); - } - if ('' === value) { - return '""'; - } - if (Utils.PATTERN_DATE.test(value)) { - return "'" + value + "'"; - } - if ((ref = value.toLowerCase()) === 'null' || ref === '~' || ref === 'true' || ref === 'false') { - return "'" + value + "'"; - } - return value; + return ease; }; - Inline.dumpObject = function(value, exceptionOnInvalidType, objectSupport) { - var j, key, len1, output, val; - if (objectSupport == null) { - objectSupport = null; - } - if (value instanceof Array) { - output = []; - for (j = 0, len1 = value.length; j < len1; j++) { - val = value[j]; - output.push(this.dump(val)); - } - return '[' + output.join(', ') + ']'; - } else { - output = []; - for (key in value) { - val = value[key]; - output.push(this.dump(key) + ': ' + this.dump(val)); - } - return '{' + output.join(', ') + '}'; - } - }; + _forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function (name, i) { + var power = i < 5 ? i + 1 : i; + + _insertEase(name + ",Power" + (power - 1), i ? function (p) { + return Math.pow(p, power); + } : function (p) { + return p; + }, function (p) { + return 1 - Math.pow(1 - p, power); + }, function (p) { + return p < .5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2; + }); + }); - Inline.parseScalar = function(scalar, delimiters, stringDelimiters, context, evaluate) { - var i, joinedDelimiters, match, output, pattern, ref, ref1, strpos, tmp; - if (delimiters == null) { - delimiters = null; - } - if (stringDelimiters == null) { - stringDelimiters = ['"', "'"]; - } - if (context == null) { - context = null; - } - if (evaluate == null) { - evaluate = true; - } - if (context == null) { - context = { - exceptionOnInvalidType: this.settings.exceptionOnInvalidType, - objectDecoder: this.settings.objectDecoder, - i: 0 - }; - } - i = context.i; - if (ref = scalar.charAt(i), indexOf.call(stringDelimiters, ref) >= 0) { - output = this.parseQuotedScalar(scalar, context); - i = context.i; - if (delimiters != null) { - tmp = Utils.ltrim(scalar.slice(i), ' '); - if (!(ref1 = tmp.charAt(0), indexOf.call(delimiters, ref1) >= 0)) { - throw new ParseException('Unexpected characters (' + scalar.slice(i) + ').'); - } - } - } else { - if (!delimiters) { - output = scalar.slice(i); - i += output.length; - strpos = output.indexOf(' #'); - if (strpos !== -1) { - output = Utils.rtrim(output.slice(0, strpos)); - } - } else { - joinedDelimiters = delimiters.join('|'); - pattern = this.PATTERN_SCALAR_BY_DELIMITERS[joinedDelimiters]; - if (pattern == null) { - pattern = new Pattern('^(.+?)(' + joinedDelimiters + ')'); - this.PATTERN_SCALAR_BY_DELIMITERS[joinedDelimiters] = pattern; - } - if (match = pattern.exec(scalar.slice(i))) { - output = match[1]; - i += output.length; - } else { - throw new ParseException('Malformed inline YAML string (' + scalar + ').'); - } - } - if (evaluate) { - output = this.evaluateScalar(output, context); + _easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn; + + _insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic()); + + (function (n, c) { + var n1 = 1 / c, + n2 = 2 * n1, + n3 = 2.5 * n1, + easeOut = function easeOut(p) { + return p < n1 ? n * p * p : p < n2 ? n * Math.pow(p - 1.5 / c, 2) + .75 : p < n3 ? n * (p -= 2.25 / c) * p + .9375 : n * Math.pow(p - 2.625 / c, 2) + .984375; + }; + + _insertEase("Bounce", function (p) { + return 1 - easeOut(1 - p); + }, easeOut); + })(7.5625, 2.75); + + _insertEase("Expo", function (p) { + return p ? Math.pow(2, 10 * (p - 1)) : 0; + }); + + _insertEase("Circ", function (p) { + return -(_sqrt(1 - p * p) - 1); + }); + + _insertEase("Sine", function (p) { + return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1; + }); + + _insertEase("Back", _configBack("in"), _configBack("out"), _configBack()); + + _easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = { + config: function config(steps, immediateStart) { + if (steps === void 0) { + steps = 1; } + + var p1 = 1 / steps, + p2 = steps + (immediateStart ? 0 : 1), + p3 = immediateStart ? 1 : 0, + max = 1 - _tinyNum; + return function (p) { + return ((p2 * _clamp(0, max, p) | 0) + p3) * p1; + }; } - context.i = i; - return output; }; + _defaults.ease = _easeMap["quad.out"]; - Inline.parseQuotedScalar = function(scalar, context) { - var i, match, output; - i = context.i; - if (!(match = this.PATTERN_QUOTED_SCALAR.exec(scalar.slice(i)))) { - throw new ParseMore('Malformed inline YAML string (' + scalar.slice(i) + ').'); - } - output = match[0].substr(1, match[0].length - 2); - if ('"' === scalar.charAt(i)) { - output = Unescaper.unescapeDoubleQuotedString(output); - } else { - output = Unescaper.unescapeSingleQuotedString(output); - } - i += match[0].length; - context.i = i; - return output; + _forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function (name) { + return _callbackNames += name + "," + name + "Params,"; + }); + + var GSCache = function GSCache(target, harness) { + this.id = _gsID++; + target._gsap = this; + this.target = target; + this.harness = harness; + this.get = harness ? harness.get : _getProperty; + this.set = harness ? harness.getSetter : _getSetter; }; + var Animation = function () { + function Animation(vars) { + this.vars = vars; + this._delay = +vars.delay || 0; - Inline.parseSequence = function(sequence, context) { - var e, error, i, isQuoted, len, output, ref, value; - output = []; - len = sequence.length; - i = context.i; - i += 1; - while (i < len) { - context.i = i; - switch (sequence.charAt(i)) { - case '[': - output.push(this.parseSequence(sequence, context)); - i = context.i; - break; - case '{': - output.push(this.parseMapping(sequence, context)); - i = context.i; - break; - case ']': - return output; - case ',': - case ' ': - case "\n": - break; - default: - isQuoted = ((ref = sequence.charAt(i)) === '"' || ref === "'"); - value = this.parseScalar(sequence, [',', ']'], ['"', "'"], context); - i = context.i; - if (!isQuoted && typeof value === 'string' && (value.indexOf(': ') !== -1 || value.indexOf(":\n") !== -1)) { - try { - value = this.parseMapping('{' + value + '}'); - } catch (error) { - e = error; - } - } - output.push(value); - --i; + if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) { + this._rDelay = vars.repeatDelay || 0; + this._yoyo = !!vars.yoyo || !!vars.yoyoEase; } - ++i; + + this._ts = 1; + + _setDuration(this, +vars.duration, 1, 1); + + this.data = vars.data; + + if (_context) { + this._ctx = _context; + + _context.data.push(this); + } + + _tickerActive || _ticker.wake(); } - throw new ParseMore('Malformed inline YAML string ' + sequence); - }; - Inline.parseMapping = function(mapping, context) { - var done, i, key, len, output, shouldContinueWhileLoop, value; - output = {}; - len = mapping.length; - i = context.i; - i += 1; - shouldContinueWhileLoop = false; - while (i < len) { - context.i = i; - switch (mapping.charAt(i)) { - case ' ': - case ',': - case "\n": - ++i; - context.i = i; - shouldContinueWhileLoop = true; - break; - case '}': - return output; + var _proto = Animation.prototype; + + _proto.delay = function delay(value) { + if (value || value === 0) { + this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay); + this._delay = value; + return this; } - if (shouldContinueWhileLoop) { - shouldContinueWhileLoop = false; - continue; + + return this._delay; + }; + + _proto.duration = function duration(value) { + return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur; + }; + + _proto.totalDuration = function totalDuration(value) { + if (!arguments.length) { + return this._tDur; } - key = this.parseScalar(mapping, [':', ' ', "\n"], ['"', "'"], context, false); - i = context.i; - done = false; - while (i < len) { - context.i = i; - switch (mapping.charAt(i)) { - case '[': - value = this.parseSequence(mapping, context); - i = context.i; - if (output[key] === void 0) { - output[key] = value; - } - done = true; - break; - case '{': - value = this.parseMapping(mapping, context); - i = context.i; - if (output[key] === void 0) { - output[key] = value; - } - done = true; - break; - case ':': - case ' ': - case "\n": - break; - default: - value = this.parseScalar(mapping, [',', '}'], ['"', "'"], context); - i = context.i; - if (output[key] === void 0) { - output[key] = value; - } - done = true; - --i; + + this._dirty = 0; + return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1)); + }; + + _proto.totalTime = function totalTime(_totalTime, suppressEvents) { + _wake(); + + if (!arguments.length) { + return this._tTime; + } + + var parent = this._dp; + + if (parent && parent.smoothChildTiming && this._ts) { + _alignPlayhead(this, _totalTime); + + !parent._dp || parent.parent || _postAddChecks(parent, this); + + while (parent && parent.parent) { + if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) { + parent.totalTime(parent._tTime, true); + } + + parent = parent.parent; } - ++i; - if (done) { - break; + + if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) { + _addToTimeline(this._dp, this, this._start - this._delay); } } - } - throw new ParseMore('Malformed inline YAML string ' + mapping); - }; - Inline.evaluateScalar = function(scalar, context) { - var cast, date, exceptionOnInvalidType, firstChar, firstSpace, firstWord, objectDecoder, raw, scalarLower, subValue, trimmedScalar; - scalar = Utils.trim(scalar); - scalarLower = scalar.toLowerCase(); - switch (scalarLower) { - case 'null': - case '': - case '~': - return null; - case 'true': - return true; - case 'false': - return false; - case '.inf': - return Infinity; - case '.nan': - return NaN; - case '-.inf': - return Infinity; - default: - firstChar = scalarLower.charAt(0); - switch (firstChar) { - case '!': - firstSpace = scalar.indexOf(' '); - if (firstSpace === -1) { - firstWord = scalarLower; - } else { - firstWord = scalarLower.slice(0, firstSpace); - } - switch (firstWord) { - case '!': - if (firstSpace !== -1) { - return parseInt(this.parseScalar(scalar.slice(2))); - } - return null; - case '!str': - return Utils.ltrim(scalar.slice(4)); - case '!!str': - return Utils.ltrim(scalar.slice(5)); - case '!!int': - return parseInt(this.parseScalar(scalar.slice(5))); - case '!!bool': - return Utils.parseBoolean(this.parseScalar(scalar.slice(6)), false); - case '!!float': - return parseFloat(this.parseScalar(scalar.slice(7))); - case '!!timestamp': - return Utils.stringToDate(Utils.ltrim(scalar.slice(11))); - default: - if (context == null) { - context = { - exceptionOnInvalidType: this.settings.exceptionOnInvalidType, - objectDecoder: this.settings.objectDecoder, - i: 0 - }; - } - objectDecoder = context.objectDecoder, exceptionOnInvalidType = context.exceptionOnInvalidType; - if (objectDecoder) { - trimmedScalar = Utils.rtrim(scalar); - firstSpace = trimmedScalar.indexOf(' '); - if (firstSpace === -1) { - return objectDecoder(trimmedScalar, null); - } else { - subValue = Utils.ltrim(trimmedScalar.slice(firstSpace + 1)); - if (!(subValue.length > 0)) { - subValue = null; - } - return objectDecoder(trimmedScalar.slice(0, firstSpace), subValue); - } - } - if (exceptionOnInvalidType) { - throw new ParseException('Custom object support when parsing a YAML file has been disabled.'); - } - return null; - } - break; - case '0': - if ('0x' === scalar.slice(0, 2)) { - return Utils.hexDec(scalar); - } else if (Utils.isDigits(scalar)) { - return Utils.octDec(scalar); - } else if (Utils.isNumeric(scalar)) { - return parseFloat(scalar); - } else { - return scalar; - } - break; - case '+': - if (Utils.isDigits(scalar)) { - raw = scalar; - cast = parseInt(raw); - if (raw === String(cast)) { - return cast; - } else { - return raw; - } - } else if (Utils.isNumeric(scalar)) { - return parseFloat(scalar); - } else if (this.PATTERN_THOUSAND_NUMERIC_SCALAR.test(scalar)) { - return parseFloat(scalar.replace(',', '')); - } - return scalar; - case '-': - if (Utils.isDigits(scalar.slice(1))) { - if ('0' === scalar.charAt(1)) { - return -Utils.octDec(scalar.slice(1)); - } else { - raw = scalar.slice(1); - cast = parseInt(raw); - if (raw === String(cast)) { - return -cast; - } else { - return -raw; - } - } - } else if (Utils.isNumeric(scalar)) { - return parseFloat(scalar); - } else if (this.PATTERN_THOUSAND_NUMERIC_SCALAR.test(scalar)) { - return parseFloat(scalar.replace(',', '')); - } - return scalar; - default: - if (date = Utils.stringToDate(scalar)) { - return date; - } else if (Utils.isNumeric(scalar)) { - return parseFloat(scalar); - } else if (this.PATTERN_THOUSAND_NUMERIC_SCALAR.test(scalar)) { - return parseFloat(scalar.replace(',', '')); - } - return scalar; - } - } - }; + if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) { + this._ts || (this._pTime = _totalTime); - return Inline; + _lazySafeRender(this, _totalTime, suppressEvents); + } -})(); + return this; + }; -module.exports = Inline; + _proto.time = function time(value, suppressEvents) { + return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time; + }; + _proto.totalProgress = function totalProgress(value, suppressEvents) { + return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.rawTime() > 0 ? 1 : 0; + }; -},{"./Escaper":2,"./Exception/DumpException":3,"./Exception/ParseException":4,"./Exception/ParseMore":5,"./Pattern":8,"./Unescaper":9,"./Utils":10}],7:[function(require,module,exports){ -var Inline, ParseException, ParseMore, Parser, Pattern, Utils; + _proto.progress = function progress(value, suppressEvents) { + return arguments.length ? this.totalTime(this.duration() * (this._yoyo && !(this.iteration() & 1) ? 1 - value : value) + _elapsedCycleDuration(this), suppressEvents) : this.duration() ? Math.min(1, this._time / this._dur) : this.rawTime() > 0 ? 1 : 0; + }; -Inline = require('./Inline'); + _proto.iteration = function iteration(value, suppressEvents) { + var cycleDuration = this.duration() + this._rDelay; -Pattern = require('./Pattern'); + return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1; + }; -Utils = require('./Utils'); + _proto.timeScale = function timeScale(value, suppressEvents) { + if (!arguments.length) { + return this._rts === -_tinyNum ? 0 : this._rts; + } -ParseException = require('./Exception/ParseException'); + if (this._rts === value) { + return this; + } -ParseMore = require('./Exception/ParseMore'); + var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime; + this._rts = +value || 0; + this._ts = this._ps || value === -_tinyNum ? 0 : this._rts; + this.totalTime(_clamp(-Math.abs(this._delay), this._tDur, tTime), suppressEvents !== false); -Parser = (function() { - Parser.prototype.PATTERN_FOLDED_SCALAR_ALL = new Pattern('^(?:(?![^\\|>]*)\\s+)?(?\\||>)(?\\+|\\-|\\d+|\\+\\d+|\\-\\d+|\\d+\\+|\\d+\\-)?(? +#.*)?$'); + _setEnd(this); - Parser.prototype.PATTERN_FOLDED_SCALAR_END = new Pattern('(?\\||>)(?\\+|\\-|\\d+|\\+\\d+|\\-\\d+|\\d+\\+|\\d+\\-)?(? +#.*)?$'); + return _recacheAncestors(this); + }; - Parser.prototype.PATTERN_SEQUENCE_ITEM = new Pattern('^\\-((?\\s+)(?.+?))?\\s*$'); + _proto.paused = function paused(value) { + if (!arguments.length) { + return this._ps; + } - Parser.prototype.PATTERN_ANCHOR_VALUE = new Pattern('^&(?[^ ]+) *(?.*)'); + if (this._ps !== value) { + this._ps = value; - Parser.prototype.PATTERN_COMPACT_NOTATION = new Pattern('^(?' + Inline.REGEX_QUOTED_STRING + '|[^ \'"\\{\\[].*?) *\\:(\\s+(?.+?))?\\s*$'); + if (value) { + this._pTime = this._tTime || Math.max(-this._delay, this.rawTime()); + this._ts = this._act = 0; + } else { + _wake(); - Parser.prototype.PATTERN_MAPPING_ITEM = new Pattern('^(?' + Inline.REGEX_QUOTED_STRING + '|[^ \'"\\[\\{].*?) *\\:(\\s+(?.+?))?\\s*$'); + this._ts = this._rts; + this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum)); + } + } - Parser.prototype.PATTERN_DECIMAL = new Pattern('\\d+'); + return this; + }; - Parser.prototype.PATTERN_INDENT_SPACES = new Pattern('^ +'); + _proto.startTime = function startTime(value) { + if (arguments.length) { + this._start = value; + var parent = this.parent || this._dp; + parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, value - this._delay); + return this; + } - Parser.prototype.PATTERN_TRAILING_LINES = new Pattern('(\n*)$'); + return this._start; + }; - Parser.prototype.PATTERN_YAML_HEADER = new Pattern('^\\%YAML[: ][\\d\\.]+.*\n', 'm'); + _proto.endTime = function endTime(includeRepeats) { + return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1); + }; - Parser.prototype.PATTERN_LEADING_COMMENTS = new Pattern('^(\\#.*?\n)+', 'm'); + _proto.rawTime = function rawTime(wrapRepeats) { + var parent = this.parent || this._dp; + return !parent ? this._tTime : wrapRepeats && (!this._ts || this._repeat && this._time && this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay) : !this._ts ? this._tTime : _parentToChildTotalTime(parent.rawTime(wrapRepeats), this); + }; - Parser.prototype.PATTERN_DOCUMENT_MARKER_START = new Pattern('^\\-\\-\\-.*?\n', 'm'); + _proto.revert = function revert(config) { + if (config === void 0) { + config = _revertConfig; + } - Parser.prototype.PATTERN_DOCUMENT_MARKER_END = new Pattern('^\\.\\.\\.\\s*$', 'm'); + var prevIsReverting = _reverting; + _reverting = config; - Parser.prototype.PATTERN_FOLDED_SCALAR_BY_INDENTATION = {}; + if (this._initted || this._startAt) { + this.timeline && this.timeline.revert(config); + this.totalTime(-0.01, config.suppressEvents); + } - Parser.prototype.CONTEXT_NONE = 0; + this.data !== "nested" && config.kill !== false && this.kill(); + _reverting = prevIsReverting; + return this; + }; - Parser.prototype.CONTEXT_SEQUENCE = 1; + _proto.globalTime = function globalTime(rawTime) { + var animation = this, + time = arguments.length ? rawTime : animation.rawTime(); - Parser.prototype.CONTEXT_MAPPING = 2; + while (animation) { + time = animation._start + time / (Math.abs(animation._ts) || 1); + animation = animation._dp; + } - function Parser(offset) { - this.offset = offset != null ? offset : 0; - this.lines = []; - this.currentLineNb = -1; - this.currentLine = ''; - this.refs = {}; - } + return !this.parent && this._sat ? this._sat.globalTime(rawTime) : time; + }; - Parser.prototype.parse = function(value, exceptionOnInvalidType, objectDecoder) { - var alias, allowOverwrite, block, c, context, data, e, error, error1, error2, first, i, indent, isRef, j, k, key, l, lastKey, len, len1, len2, len3, lineCount, m, matches, mergeNode, n, name, parsed, parsedItem, parser, ref, ref1, ref2, refName, refValue, val, values; - if (exceptionOnInvalidType == null) { - exceptionOnInvalidType = false; - } - if (objectDecoder == null) { - objectDecoder = null; - } - this.currentLineNb = -1; - this.currentLine = ''; - this.lines = this.cleanup(value).split("\n"); - data = null; - context = this.CONTEXT_NONE; - allowOverwrite = false; - while (this.moveToNextLine()) { - if (this.isCurrentLineEmpty()) { - continue; + _proto.repeat = function repeat(value) { + if (arguments.length) { + this._repeat = value === Infinity ? -2 : value; + return _onUpdateTotalDuration(this); } - if ("\t" === this.currentLine[0]) { - throw new ParseException('A YAML file cannot contain tabs as indentation.', this.getRealCurrentLineNb() + 1, this.currentLine); + + return this._repeat === -2 ? Infinity : this._repeat; + }; + + _proto.repeatDelay = function repeatDelay(value) { + if (arguments.length) { + var time = this._time; + this._rDelay = value; + + _onUpdateTotalDuration(this); + + return time ? this.time(time) : this; } - isRef = mergeNode = false; - if (values = this.PATTERN_SEQUENCE_ITEM.exec(this.currentLine)) { - if (this.CONTEXT_MAPPING === context) { - throw new ParseException('You cannot define a sequence item when in a mapping'); - } - context = this.CONTEXT_SEQUENCE; - if (data == null) { - data = []; + + return this._rDelay; + }; + + _proto.yoyo = function yoyo(value) { + if (arguments.length) { + this._yoyo = value; + return this; + } + + return this._yoyo; + }; + + _proto.seek = function seek(position, suppressEvents) { + return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents)); + }; + + _proto.restart = function restart(includeDelay, suppressEvents) { + return this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents)); + }; + + _proto.play = function play(from, suppressEvents) { + from != null && this.seek(from, suppressEvents); + return this.reversed(false).paused(false); + }; + + _proto.reverse = function reverse(from, suppressEvents) { + from != null && this.seek(from || this.totalDuration(), suppressEvents); + return this.reversed(true).paused(false); + }; + + _proto.pause = function pause(atTime, suppressEvents) { + atTime != null && this.seek(atTime, suppressEvents); + return this.paused(true); + }; + + _proto.resume = function resume() { + return this.paused(false); + }; + + _proto.reversed = function reversed(value) { + if (arguments.length) { + !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0)); + return this; + } + + return this._rts < 0; + }; + + _proto.invalidate = function invalidate() { + this._initted = this._act = 0; + this._zTime = -_tinyNum; + return this; + }; + + _proto.isActive = function isActive() { + var parent = this.parent || this._dp, + start = this._start, + rawTime; + return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum); + }; + + _proto.eventCallback = function eventCallback(type, callback, params) { + var vars = this.vars; + + if (arguments.length > 1) { + if (!callback) { + delete vars[type]; + } else { + vars[type] = callback; + params && (vars[type + "Params"] = params); + type === "onUpdate" && (this._onUpdate = callback); } - if ((values.value != null) && (matches = this.PATTERN_ANCHOR_VALUE.exec(values.value))) { - isRef = matches.ref; - values.value = matches.value; + + return this; + } + + return vars[type]; + }; + + _proto.then = function then(onFulfilled) { + var self = this; + return new Promise(function (resolve) { + var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough, + _resolve = function _resolve() { + var _then = self.then; + self.then = null; + _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then); + resolve(f); + self.then = _then; + }; + + if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) { + _resolve(); + } else { + self._prom = _resolve; } - if (!(values.value != null) || '' === Utils.trim(values.value, ' ') || Utils.ltrim(values.value, ' ').indexOf('#') === 0) { - if (this.currentLineNb < this.lines.length - 1 && !this.isNextLineUnIndentedCollection()) { - c = this.getRealCurrentLineNb() + 1; - parser = new Parser(c); - parser.refs = this.refs; - data.push(parser.parse(this.getNextEmbedBlock(null, true), exceptionOnInvalidType, objectDecoder)); + }); + }; + + _proto.kill = function kill() { + _interrupt(this); + }; + + return Animation; + }(); + + _setDefaults(Animation.prototype, { + _time: 0, + _start: 0, + _end: 0, + _tTime: 0, + _tDur: 0, + _dirty: 0, + _repeat: 0, + _yoyo: false, + parent: null, + _initted: false, + _rDelay: 0, + _ts: 1, + _dp: 0, + ratio: 0, + _zTime: -_tinyNum, + _prom: 0, + _ps: false, + _rts: 1 + }); + + var Timeline = function (_Animation) { + _inheritsLoose(Timeline, _Animation); + + function Timeline(vars, position) { + var _this; + + if (vars === void 0) { + vars = {}; + } + + _this = _Animation.call(this, vars) || this; + _this.labels = {}; + _this.smoothChildTiming = !!vars.smoothChildTiming; + _this.autoRemoveChildren = !!vars.autoRemoveChildren; + _this._sort = _isNotFalse(vars.sortChildren); + _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position); + vars.reversed && _this.reverse(); + vars.paused && _this.paused(true); + vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger); + return _this; + } + + var _proto2 = Timeline.prototype; + + _proto2.to = function to(targets, vars, position) { + _createTweenType(0, arguments, this); + + return this; + }; + + _proto2.from = function from(targets, vars, position) { + _createTweenType(1, arguments, this); + + return this; + }; + + _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) { + _createTweenType(2, arguments, this); + + return this; + }; + + _proto2.set = function set(targets, vars, position) { + vars.duration = 0; + vars.parent = this; + _inheritDefaults(vars).repeatDelay || (vars.repeat = 0); + vars.immediateRender = !!vars.immediateRender; + new Tween(targets, vars, _parsePosition(this, position), 1); + return this; + }; + + _proto2.call = function call(callback, params, position) { + return _addToTimeline(this, Tween.delayedCall(0, callback, params), position); + }; + + _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { + vars.duration = duration; + vars.stagger = vars.stagger || stagger; + vars.onComplete = onCompleteAll; + vars.onCompleteParams = onCompleteAllParams; + vars.parent = this; + new Tween(targets, vars, _parsePosition(this, position)); + return this; + }; + + _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { + vars.runBackwards = 1; + _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender); + return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams); + }; + + _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) { + toVars.startAt = fromVars; + _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender); + return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams); + }; + + _proto2.render = function render(totalTime, suppressEvents, force) { + var prevTime = this._time, + tDur = this._dirty ? this.totalDuration() : this._tDur, + dur = this._dur, + tTime = totalTime <= 0 ? 0 : _roundPrecise(totalTime), + crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur), + time, + child, + next, + iteration, + cycleDuration, + prevPaused, + pauseTween, + timeScale, + prevStart, + prevIteration, + yoyo, + isYoyo; + this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur); + + if (tTime !== this._tTime || force || crossingStart) { + if (prevTime !== this._time && dur) { + tTime += this._time - prevTime; + totalTime += this._time - prevTime; + } + + time = tTime; + prevStart = this._start; + timeScale = this._ts; + prevPaused = !timeScale; + + if (crossingStart) { + dur || (prevTime = this._zTime); + (totalTime || !suppressEvents) && (this._zTime = totalTime); + } + + if (this._repeat) { + yoyo = this._yoyo; + cycleDuration = dur + this._rDelay; + + if (this._repeat < -1 && totalTime < 0) { + return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); + } + + time = _roundPrecise(tTime % cycleDuration); + + if (tTime === tDur) { + iteration = this._repeat; + time = dur; } else { - data.push(null); + iteration = ~~(tTime / cycleDuration); + + if (iteration && iteration === tTime / cycleDuration) { + time = dur; + iteration--; + } + + time > dur && (time = dur); } - } else { - if (((ref = values.leadspaces) != null ? ref.length : void 0) && (matches = this.PATTERN_COMPACT_NOTATION.exec(values.value))) { - c = this.getRealCurrentLineNb(); - parser = new Parser(c); - parser.refs = this.refs; - block = values.value; - indent = this.getCurrentLineIndentation(); - if (this.isNextLineIndented(false)) { - block += "\n" + this.getNextEmbedBlock(indent + values.leadspaces.length + 1, true); + + prevIteration = _animationCycle(this._tTime, cycleDuration); + !prevTime && this._tTime && prevIteration !== iteration && this._tTime - prevIteration * cycleDuration - this._dur <= 0 && (prevIteration = iteration); + + if (yoyo && iteration & 1) { + time = dur - time; + isYoyo = 1; + } + + if (iteration !== prevIteration && !this._lock) { + var rewinding = yoyo && prevIteration & 1, + doesWrap = rewinding === (yoyo && iteration & 1); + iteration < prevIteration && (rewinding = !rewinding); + prevTime = rewinding ? 0 : tTime % dur ? dur : tTime; + this._lock = 1; + this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0; + this._tTime = tTime; + !suppressEvents && this.parent && _callback(this, "onRepeat"); + this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1); + + if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) { + return this; } - data.push(parser.parse(block, exceptionOnInvalidType, objectDecoder)); - } else { - data.push(this.parseValue(values.value, exceptionOnInvalidType, objectDecoder)); + + dur = this._dur; + tDur = this._tDur; + + if (doesWrap) { + this._lock = 2; + prevTime = rewinding ? dur : -0.0001; + this.render(prevTime, true); + this.vars.repeatRefresh && !isYoyo && this.invalidate(); + } + + this._lock = 0; + + if (!this._ts && !prevPaused) { + return this; + } + + _propagateYoyoEase(this, isYoyo); } } - } else if ((values = this.PATTERN_MAPPING_ITEM.exec(this.currentLine)) && values.key.indexOf(' #') === -1) { - if (this.CONTEXT_SEQUENCE === context) { - throw new ParseException('You cannot define a mapping item when in a sequence'); + + if (this._hasPause && !this._forcing && this._lock < 2) { + pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time)); + + if (pauseTween) { + tTime -= time - (time = pauseTween._start); + } } - context = this.CONTEXT_MAPPING; - if (data == null) { - data = {}; + + this._tTime = tTime; + this._time = time; + this._act = !timeScale; + + if (!this._initted) { + this._onUpdate = this.vars.onUpdate; + this._initted = 1; + this._zTime = totalTime; + prevTime = 0; } - Inline.configure(exceptionOnInvalidType, objectDecoder); - try { - key = Inline.parseScalar(values.key); - } catch (error) { - e = error; - e.parsedLine = this.getRealCurrentLineNb() + 1; - e.snippet = this.currentLine; - throw e; + + if (!prevTime && time && !suppressEvents && !iteration) { + _callback(this, "onStart"); + + if (this._tTime !== tTime) { + return this; + } } - if ('<<' === key) { - mergeNode = true; - allowOverwrite = true; - if (((ref1 = values.value) != null ? ref1.indexOf('*') : void 0) === 0) { - refName = values.value.slice(1); - if (this.refs[refName] == null) { - throw new ParseException('Reference "' + refName + '" does not exist.', this.getRealCurrentLineNb() + 1, this.currentLine); - } - refValue = this.refs[refName]; - if (typeof refValue !== 'object') { - throw new ParseException('YAML merge keys used with a scalar value instead of an object.', this.getRealCurrentLineNb() + 1, this.currentLine); - } - if (refValue instanceof Array) { - for (i = j = 0, len = refValue.length; j < len; i = ++j) { - value = refValue[i]; - if (data[name = String(i)] == null) { - data[name] = value; - } + + if (time >= prevTime && totalTime >= 0) { + child = this._first; + + while (child) { + next = child._next; + + if ((child._act || time >= child._start) && child._ts && pauseTween !== child) { + if (child.parent !== this) { + return this.render(totalTime, suppressEvents, force); } - } else { - for (key in refValue) { - value = refValue[key]; - if (data[key] == null) { - data[key] = value; - } + + child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force); + + if (time !== this._time || !this._ts && !prevPaused) { + pauseTween = 0; + next && (tTime += this._zTime = -_tinyNum); + break; } } - } else { - if ((values.value != null) && values.value !== '') { - value = values.value; - } else { - value = this.getNextEmbedBlock(); - } - c = this.getRealCurrentLineNb() + 1; - parser = new Parser(c); - parser.refs = this.refs; - parsed = parser.parse(value, exceptionOnInvalidType); - if (typeof parsed !== 'object') { - throw new ParseException('YAML merge keys used with a scalar value instead of an object.', this.getRealCurrentLineNb() + 1, this.currentLine); - } - if (parsed instanceof Array) { - for (l = 0, len1 = parsed.length; l < len1; l++) { - parsedItem = parsed[l]; - if (typeof parsedItem !== 'object') { - throw new ParseException('Merge items must be objects.', this.getRealCurrentLineNb() + 1, parsedItem); - } - if (parsedItem instanceof Array) { - for (i = m = 0, len2 = parsedItem.length; m < len2; i = ++m) { - value = parsedItem[i]; - k = String(i); - if (!data.hasOwnProperty(k)) { - data[k] = value; - } - } - } else { - for (key in parsedItem) { - value = parsedItem[key]; - if (!data.hasOwnProperty(key)) { - data[key] = value; - } - } - } + + child = next; + } + } else { + child = this._last; + var adjustedTime = totalTime < 0 ? totalTime : time; + + while (child) { + next = child._prev; + + if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) { + if (child.parent !== this) { + return this.render(totalTime, suppressEvents, force); } - } else { - for (key in parsed) { - value = parsed[key]; - if (!data.hasOwnProperty(key)) { - data[key] = value; - } + + child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force || _reverting && (child._initted || child._startAt)); + + if (time !== this._time || !this._ts && !prevPaused) { + pauseTween = 0; + next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum); + break; } } + + child = next; } - } else if ((values.value != null) && (matches = this.PATTERN_ANCHOR_VALUE.exec(values.value))) { - isRef = matches.ref; - values.value = matches.value; } - if (mergeNode) { - } else if (!(values.value != null) || '' === Utils.trim(values.value, ' ') || Utils.ltrim(values.value, ' ').indexOf('#') === 0) { - if (!(this.isNextLineIndented()) && !(this.isNextLineUnIndentedCollection())) { - if (allowOverwrite || data[key] === void 0) { - data[key] = null; - } - } else { - c = this.getRealCurrentLineNb() + 1; - parser = new Parser(c); - parser.refs = this.refs; - val = parser.parse(this.getNextEmbedBlock(), exceptionOnInvalidType, objectDecoder); - if (allowOverwrite || data[key] === void 0) { - data[key] = val; - } - } - } else { - val = this.parseValue(values.value, exceptionOnInvalidType, objectDecoder); - if (allowOverwrite || data[key] === void 0) { - data[key] = val; + if (pauseTween && !suppressEvents) { + this.pause(); + pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1; + + if (this._ts) { + this._start = prevStart; + + _setEnd(this); + + return this.render(totalTime, suppressEvents, force); } } - } else { - lineCount = this.lines.length; - if (1 === lineCount || (2 === lineCount && Utils.isEmpty(this.lines[1]))) { - try { - value = Inline.parse(this.lines[0], exceptionOnInvalidType, objectDecoder); - } catch (error1) { - e = error1; - e.parsedLine = this.getRealCurrentLineNb() + 1; - e.snippet = this.currentLine; - throw e; - } - if (typeof value === 'object') { - if (value instanceof Array) { - first = value[0]; - } else { - for (key in value) { - first = value[key]; - break; - } - } - if (typeof first === 'string' && first.indexOf('*') === 0) { - data = []; - for (n = 0, len3 = value.length; n < len3; n++) { - alias = value[n]; - data.push(this.refs[alias.slice(1)]); - } - value = data; - } - } - return value; - } else if ((ref2 = Utils.ltrim(value).charAt(0)) === '[' || ref2 === '{') { - try { - return Inline.parse(value, exceptionOnInvalidType, objectDecoder); - } catch (error2) { - e = error2; - e.parsedLine = this.getRealCurrentLineNb() + 1; - e.snippet = this.currentLine; - throw e; + + this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true); + if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) if (!this._lock) { + (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); + + if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) { + _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true); + + this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); } } - throw new ParseException('Unable to parse.', this.getRealCurrentLineNb() + 1, this.currentLine); } - if (isRef) { - if (data instanceof Array) { - this.refs[isRef] = data[data.length - 1]; + + return this; + }; + + _proto2.add = function add(child, position) { + var _this2 = this; + + _isNumber(position) || (position = _parsePosition(this, position, child)); + + if (!(child instanceof Animation)) { + if (_isArray(child)) { + child.forEach(function (obj) { + return _this2.add(obj, position); + }); + return this; + } + + if (_isString(child)) { + return this.addLabel(child, position); + } + + if (_isFunction(child)) { + child = Tween.delayedCall(0, child); } else { - lastKey = null; - for (key in data) { - lastKey = key; - } - this.refs[isRef] = data[lastKey]; + return this; } } - } - if (Utils.isEmpty(data)) { - return null; - } else { - return data; - } - }; - Parser.prototype.getRealCurrentLineNb = function() { - return this.currentLineNb + this.offset; - }; + return this !== child ? _addToTimeline(this, child, position) : this; + }; - Parser.prototype.getCurrentLineIndentation = function() { - return this.currentLine.length - Utils.ltrim(this.currentLine, ' ').length; - }; + _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) { + if (nested === void 0) { + nested = true; + } - Parser.prototype.getNextEmbedBlock = function(indentation, includeUnindentedCollection) { - var data, indent, isItUnindentedCollection, newIndent, removeComments, removeCommentsPattern, unindentedEmbedBlock; - if (indentation == null) { - indentation = null; - } - if (includeUnindentedCollection == null) { - includeUnindentedCollection = false; - } - this.moveToNextLine(); - if (indentation == null) { - newIndent = this.getCurrentLineIndentation(); - unindentedEmbedBlock = this.isStringUnIndentedCollectionItem(this.currentLine); - if (!(this.isCurrentLineEmpty()) && 0 === newIndent && !unindentedEmbedBlock) { - throw new ParseException('Indentation problem.', this.getRealCurrentLineNb() + 1, this.currentLine); + if (tweens === void 0) { + tweens = true; } - } else { - newIndent = indentation; - } - data = [this.currentLine.slice(newIndent)]; - if (!includeUnindentedCollection) { - isItUnindentedCollection = this.isStringUnIndentedCollectionItem(this.currentLine); - } - removeCommentsPattern = this.PATTERN_FOLDED_SCALAR_END; - removeComments = !removeCommentsPattern.test(this.currentLine); - while (this.moveToNextLine()) { - indent = this.getCurrentLineIndentation(); - if (indent === newIndent) { - removeComments = !removeCommentsPattern.test(this.currentLine); + + if (timelines === void 0) { + timelines = true; } - if (removeComments && this.isCurrentLineComment()) { - continue; + + if (ignoreBeforeTime === void 0) { + ignoreBeforeTime = -_bigNum; } - if (this.isCurrentLineBlank()) { - data.push(this.currentLine.slice(newIndent)); - continue; + + var a = [], + child = this._first; + + while (child) { + if (child._start >= ignoreBeforeTime) { + if (child instanceof Tween) { + tweens && a.push(child); + } else { + timelines && a.push(child); + nested && a.push.apply(a, child.getChildren(true, tweens, timelines)); + } + } + + child = child._next; } - if (isItUnindentedCollection && !this.isStringUnIndentedCollectionItem(this.currentLine) && indent === newIndent) { - this.moveToPreviousLine(); - break; + + return a; + }; + + _proto2.getById = function getById(id) { + var animations = this.getChildren(1, 1, 1), + i = animations.length; + + while (i--) { + if (animations[i].vars.id === id) { + return animations[i]; + } } - if (indent >= newIndent) { - data.push(this.currentLine.slice(newIndent)); - } else if (Utils.ltrim(this.currentLine).charAt(0) === '#') { + }; - } else if (0 === indent) { - this.moveToPreviousLine(); - break; - } else { - throw new ParseException('Indentation problem.', this.getRealCurrentLineNb() + 1, this.currentLine); + _proto2.remove = function remove(child) { + if (_isString(child)) { + return this.removeLabel(child); } - } - return data.join("\n"); - }; - Parser.prototype.moveToNextLine = function() { - if (this.currentLineNb >= this.lines.length - 1) { - return false; - } - this.currentLine = this.lines[++this.currentLineNb]; - return true; - }; + if (_isFunction(child)) { + return this.killTweensOf(child); + } - Parser.prototype.moveToPreviousLine = function() { - this.currentLine = this.lines[--this.currentLineNb]; - }; + _removeLinkedListItem(this, child); - Parser.prototype.parseValue = function(value, exceptionOnInvalidType, objectDecoder) { - var e, error, foldedIndent, matches, modifiers, pos, ref, ref1, val; - if (0 === value.indexOf('*')) { - pos = value.indexOf('#'); - if (pos !== -1) { - value = value.substr(1, pos - 2); - } else { - value = value.slice(1); + if (child === this._recent) { + this._recent = this._last; } - if (this.refs[value] === void 0) { - throw new ParseException('Reference "' + value + '" does not exist.', this.currentLine); + + return _uncache(this); + }; + + _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) { + if (!arguments.length) { + return this._tTime; } - return this.refs[value]; - } - if (matches = this.PATTERN_FOLDED_SCALAR_ALL.exec(value)) { - modifiers = (ref = matches.modifiers) != null ? ref : ''; - foldedIndent = Math.abs(parseInt(modifiers)); - if (isNaN(foldedIndent)) { - foldedIndent = 0; + + this._forcing = 1; + + if (!this._dp && this._ts) { + this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts)); } - val = this.parseFoldedScalar(matches.separator, this.PATTERN_DECIMAL.replace(modifiers, ''), foldedIndent); - if (matches.type != null) { - Inline.configure(exceptionOnInvalidType, objectDecoder); - return Inline.parseScalar(matches.type + ' ' + val); - } else { - return val; + + _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents); + + this._forcing = 0; + return this; + }; + + _proto2.addLabel = function addLabel(label, position) { + this.labels[label] = _parsePosition(this, position); + return this; + }; + + _proto2.removeLabel = function removeLabel(label) { + delete this.labels[label]; + return this; + }; + + _proto2.addPause = function addPause(position, callback, params) { + var t = Tween.delayedCall(0, callback || _emptyFunc, params); + t.data = "isPause"; + this._hasPause = 1; + return _addToTimeline(this, t, _parsePosition(this, position)); + }; + + _proto2.removePause = function removePause(position) { + var child = this._first; + position = _parsePosition(this, position); + + while (child) { + if (child._start === position && child.data === "isPause") { + _removeFromParent(child); + } + + child = child._next; } - } - if ((ref1 = value.charAt(0)) === '[' || ref1 === '{' || ref1 === '"' || ref1 === "'") { - while (true) { - try { - return Inline.parse(value, exceptionOnInvalidType, objectDecoder); - } catch (error) { - e = error; - if (e instanceof ParseMore && this.moveToNextLine()) { - value += "\n" + Utils.trim(this.currentLine, ' '); - } else { - e.parsedLine = this.getRealCurrentLineNb() + 1; - e.snippet = this.currentLine; - throw e; + }; + + _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) { + var tweens = this.getTweensOf(targets, onlyActive), + i = tweens.length; + + while (i--) { + _overwritingTween !== tweens[i] && tweens[i].kill(targets, props); + } + + return this; + }; + + _proto2.getTweensOf = function getTweensOf(targets, onlyActive) { + var a = [], + parsedTargets = toArray(targets), + child = this._first, + isGlobalTime = _isNumber(onlyActive), + children; + + while (child) { + if (child instanceof Tween) { + if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) { + a.push(child); } + } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) { + a.push.apply(a, children); } + + child = child._next; } - } else { - if (this.isNextLineIndented()) { - value += "\n" + this.getNextEmbedBlock(); + + return a; + }; + + _proto2.tweenTo = function tweenTo(position, vars) { + vars = vars || {}; + + var tl = this, + endTime = _parsePosition(tl, position), + _vars = vars, + startAt = _vars.startAt, + _onStart = _vars.onStart, + onStartParams = _vars.onStartParams, + immediateRender = _vars.immediateRender, + initted, + tween = Tween.to(tl, _setDefaults({ + ease: vars.ease || "none", + lazy: false, + immediateRender: false, + time: endTime, + overwrite: "auto", + duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum, + onStart: function onStart() { + tl.pause(); + + if (!initted) { + var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()); + tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true); + initted = 1; + } + + _onStart && _onStart.apply(tween, onStartParams || []); + } + }, vars)); + + return immediateRender ? tween.render(0) : tween; + }; + + _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) { + return this.tweenTo(toPosition, _setDefaults({ + startAt: { + time: _parsePosition(this, fromPosition) + } + }, vars)); + }; + + _proto2.recent = function recent() { + return this._recent; + }; + + _proto2.nextLabel = function nextLabel(afterTime) { + if (afterTime === void 0) { + afterTime = this._time; } - return Inline.parse(value, exceptionOnInvalidType, objectDecoder); - } - }; - Parser.prototype.parseFoldedScalar = function(separator, indicator, indentation) { - var isCurrentLineBlank, j, len, line, matches, newText, notEOF, pattern, ref, text; - if (indicator == null) { - indicator = ''; - } - if (indentation == null) { - indentation = 0; - } - notEOF = this.moveToNextLine(); - if (!notEOF) { - return ''; - } - isCurrentLineBlank = this.isCurrentLineBlank(); - text = ''; - while (notEOF && isCurrentLineBlank) { - if (notEOF = this.moveToNextLine()) { - text += "\n"; - isCurrentLineBlank = this.isCurrentLineBlank(); + return _getLabelInDirection(this, _parsePosition(this, afterTime)); + }; + + _proto2.previousLabel = function previousLabel(beforeTime) { + if (beforeTime === void 0) { + beforeTime = this._time; } - } - if (0 === indentation) { - if (matches = this.PATTERN_INDENT_SPACES.exec(this.currentLine)) { - indentation = matches[0].length; + + return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1); + }; + + _proto2.currentLabel = function currentLabel(value) { + return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum); + }; + + _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) { + if (ignoreBeforeTime === void 0) { + ignoreBeforeTime = 0; } - } - if (indentation > 0) { - pattern = this.PATTERN_FOLDED_SCALAR_BY_INDENTATION[indentation]; - if (pattern == null) { - pattern = new Pattern('^ {' + indentation + '}(.*)$'); - Parser.prototype.PATTERN_FOLDED_SCALAR_BY_INDENTATION[indentation] = pattern; + + var child = this._first, + labels = this.labels, + p; + + while (child) { + if (child._start >= ignoreBeforeTime) { + child._start += amount; + child._end += amount; + } + + child = child._next; } - while (notEOF && (isCurrentLineBlank || (matches = pattern.exec(this.currentLine)))) { - if (isCurrentLineBlank) { - text += this.currentLine.slice(indentation); - } else { - text += matches[1]; + + if (adjustLabels) { + for (p in labels) { + if (labels[p] >= ignoreBeforeTime) { + labels[p] += amount; + } } - if (notEOF = this.moveToNextLine()) { - text += "\n"; - isCurrentLineBlank = this.isCurrentLineBlank(); + } + + return _uncache(this); + }; + + _proto2.invalidate = function invalidate(soft) { + var child = this._first; + this._lock = 0; + + while (child) { + child.invalidate(soft); + child = child._next; + } + + return _Animation.prototype.invalidate.call(this, soft); + }; + + _proto2.clear = function clear(includeLabels) { + if (includeLabels === void 0) { + includeLabels = true; + } + + var child = this._first, + next; + + while (child) { + next = child._next; + this.remove(child); + child = next; + } + + this._dp && (this._time = this._tTime = this._pTime = 0); + includeLabels && (this.labels = {}); + return _uncache(this); + }; + + _proto2.totalDuration = function totalDuration(value) { + var max = 0, + self = this, + child = self._last, + prevStart = _bigNum, + prev, + start, + parent; + + if (arguments.length) { + return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value)); + } + + if (self._dirty) { + parent = self.parent; + + while (child) { + prev = child._prev; + child._dirty && child.totalDuration(); + start = child._start; + + if (start > prevStart && self._sort && child._ts && !self._lock) { + self._lock = 1; + _addToTimeline(self, child, start - child._delay, 1)._lock = 0; + } else { + prevStart = start; + } + + if (start < 0 && child._ts) { + max -= start; + + if (!parent && !self._dp || parent && parent.smoothChildTiming) { + self._start += start / self._ts; + self._time -= start; + self._tTime -= start; + } + + self.shiftChildren(-start, false, -1e999); + prevStart = 0; + } + + child._end > max && child._ts && (max = child._end); + child = prev; } + + _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1); + + self._dirty = 0; } - } else if (notEOF) { - text += "\n"; - } - if (notEOF) { - this.moveToPreviousLine(); - } - if ('>' === separator) { - newText = ''; - ref = text.split("\n"); - for (j = 0, len = ref.length; j < len; j++) { - line = ref[j]; - if (line.length === 0 || line.charAt(0) === ' ') { - newText = Utils.rtrim(newText, ' ') + line + "\n"; - } else { - newText += line + ' '; + + return self._tDur; + }; + + Timeline.updateRoot = function updateRoot(time) { + if (_globalTimeline._ts) { + _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline)); + + _lastRenderedFrame = _ticker.frame; + } + + if (_ticker.frame >= _nextGCFrame) { + _nextGCFrame += _config.autoSleep || 120; + var child = _globalTimeline._first; + if (!child || !child._ts) if (_config.autoSleep && _ticker._listeners.length < 2) { + while (child && !child._ts) { + child = child._next; + } + + child || _ticker.sleep(); } } - text = newText; - } - if ('+' !== indicator) { - text = Utils.rtrim(text); - } - if ('' === indicator) { - text = this.PATTERN_TRAILING_LINES.replace(text, "\n"); - } else if ('-' === indicator) { - text = this.PATTERN_TRAILING_LINES.replace(text, ''); + }; + + return Timeline; + }(Animation); + + _setDefaults(Timeline.prototype, { + _lock: 0, + _hasPause: 0, + _forcing: 0 + }); + + var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) { + var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter), + index = 0, + matchIndex = 0, + result, + startNums, + color, + endNum, + chunk, + startNum, + hasRandom, + a; + pt.b = start; + pt.e = end; + start += ""; + end += ""; + + if (hasRandom = ~end.indexOf("random(")) { + end = _replaceRandom(end); + } + + if (stringFilter) { + a = [start, end]; + stringFilter(a, target, prop); + start = a[0]; + end = a[1]; + } + + startNums = start.match(_complexStringNumExp) || []; + + while (result = _complexStringNumExp.exec(end)) { + endNum = result[0]; + chunk = end.substring(index, result.index); + + if (color) { + color = (color + 1) % 5; + } else if (chunk.substr(-5) === "rgba(") { + color = 1; + } + + if (endNum !== startNums[matchIndex++]) { + startNum = parseFloat(startNums[matchIndex - 1]) || 0; + pt._pt = { + _next: pt._pt, + p: chunk || matchIndex === 1 ? chunk : ",", + s: startNum, + c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum, + m: color && color < 4 ? Math.round : 0 + }; + index = _complexStringNumExp.lastIndex; + } } - return text; - }; - Parser.prototype.isNextLineIndented = function(ignoreComments) { - var EOF, currentIndentation, ret; - if (ignoreComments == null) { - ignoreComments = true; + pt.c = index < end.length ? end.substring(index, end.length) : ""; + pt.fp = funcParam; + + if (_relExp.test(end) || hasRandom) { + pt.e = 0; } - currentIndentation = this.getCurrentLineIndentation(); - EOF = !this.moveToNextLine(); - if (ignoreComments) { - while (!EOF && this.isCurrentLineEmpty()) { - EOF = !this.moveToNextLine(); + + this._pt = pt; + return pt; + }, + _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam, optional) { + _isFunction(end) && (end = end(index || 0, target, targets)); + var currentValue = target[prop], + parsedStart = start !== "get" ? start : !_isFunction(currentValue) ? currentValue : funcParam ? target[prop.indexOf("set") || !_isFunction(target["get" + prop.substr(3)]) ? prop : "get" + prop.substr(3)](funcParam) : target[prop](), + setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc, + pt; + + if (_isString(end)) { + if (~end.indexOf("random(")) { + end = _replaceRandom(end); } - } else { - while (!EOF && this.isCurrentLineBlank()) { - EOF = !this.moveToNextLine(); + + if (end.charAt(1) === "=") { + pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0); + + if (pt || pt === 0) { + end = pt; + } } } - if (EOF) { - return false; - } - ret = false; - if (this.getCurrentLineIndentation() > currentIndentation) { - ret = true; - } - this.moveToPreviousLine(); - return ret; - }; - - Parser.prototype.isCurrentLineEmpty = function() { - var trimmedLine; - trimmedLine = Utils.trim(this.currentLine, ' '); - return trimmedLine.length === 0 || trimmedLine.charAt(0) === '#'; - }; - Parser.prototype.isCurrentLineBlank = function() { - return '' === Utils.trim(this.currentLine, ' '); - }; + if (!optional || parsedStart !== end || _forceAllPropTweens) { + if (!isNaN(parsedStart * end) && end !== "") { + pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter); + funcParam && (pt.fp = funcParam); + modifier && pt.modifier(modifier, this, target); + return this._pt = pt; + } - Parser.prototype.isCurrentLineComment = function() { - var ltrimmedLine; - ltrimmedLine = Utils.ltrim(this.currentLine, ' '); - return ltrimmedLine.charAt(0) === '#'; - }; + !currentValue && !(prop in target) && _missingPlugin(prop, end); + return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam); + } + }, + _processVars = function _processVars(vars, index, target, targets, tween) { + _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets)); - Parser.prototype.cleanup = function(value) { - var count, i, indent, j, l, len, len1, line, lines, ref, ref1, ref2, smallestIndent, trimmedValue; - if (value.indexOf("\r") !== -1) { - value = value.split("\r\n").join("\n").split("\r").join("\n"); + if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) { + return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars; } - count = 0; - ref = this.PATTERN_YAML_HEADER.replaceAll(value, ''), value = ref[0], count = ref[1]; - this.offset += count; - ref1 = this.PATTERN_LEADING_COMMENTS.replaceAll(value, '', 1), trimmedValue = ref1[0], count = ref1[1]; - if (count === 1) { - this.offset += Utils.subStrCount(value, "\n") - Utils.subStrCount(trimmedValue, "\n"); - value = trimmedValue; + + var copy = {}, + p; + + for (p in vars) { + copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets); } - ref2 = this.PATTERN_DOCUMENT_MARKER_START.replaceAll(value, '', 1), trimmedValue = ref2[0], count = ref2[1]; - if (count === 1) { - this.offset += Utils.subStrCount(value, "\n") - Utils.subStrCount(trimmedValue, "\n"); - value = trimmedValue; - value = this.PATTERN_DOCUMENT_MARKER_END.replace(value, ''); + + return copy; + }, + _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) { + var plugin, pt, ptLookup, i; + + if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) { + tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority); + + if (tween !== _quickTween) { + ptLookup = tween._ptLookup[tween._targets.indexOf(target)]; + i = plugin._props.length; + + while (i--) { + ptLookup[plugin._props[i]] = pt; + } + } } - lines = value.split("\n"); - smallestIndent = -1; - for (j = 0, len = lines.length; j < len; j++) { - line = lines[j]; - if (Utils.trim(line, ' ').length === 0) { - continue; + + return plugin; + }, + _overwritingTween, + _forceAllPropTweens, + _initTween = function _initTween(tween, time, tTime) { + var vars = tween.vars, + ease = vars.ease, + startAt = vars.startAt, + immediateRender = vars.immediateRender, + lazy = vars.lazy, + onUpdate = vars.onUpdate, + runBackwards = vars.runBackwards, + yoyoEase = vars.yoyoEase, + keyframes = vars.keyframes, + autoRevert = vars.autoRevert, + dur = tween._dur, + prevStartAt = tween._startAt, + targets = tween._targets, + parent = tween.parent, + fullTargets = parent && parent.data === "nested" ? parent.vars.targets : targets, + autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites, + tl = tween.timeline, + cleanVars, + i, + p, + pt, + target, + hasPriority, + gsData, + harness, + plugin, + ptLookup, + index, + harnessVars, + overwritten; + tl && (!keyframes || !ease) && (ease = "none"); + tween._ease = _parseEase(ease, _defaults.ease); + tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0; + + if (yoyoEase && tween._yoyo && !tween._repeat) { + yoyoEase = tween._yEase; + tween._yEase = tween._ease; + tween._ease = yoyoEase; + } + + tween._from = !tl && !!vars.runBackwards; + + if (!tl || keyframes && !vars.stagger) { + harness = targets[0] ? _getCache(targets[0]).harness : 0; + harnessVars = harness && vars[harness.prop]; + cleanVars = _copyExcluding(vars, _reservedProps); + + if (prevStartAt) { + prevStartAt._zTime < 0 && prevStartAt.progress(1); + time < 0 && runBackwards && immediateRender && !autoRevert ? prevStartAt.render(-1, true) : prevStartAt.revert(runBackwards && dur ? _revertConfigNoKill : _startAtRevertConfig); + prevStartAt._lazy = 0; + } + + if (startAt) { + _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({ + data: "isStart", + overwrite: false, + parent: parent, + immediateRender: true, + lazy: !prevStartAt && _isNotFalse(lazy), + startAt: null, + delay: 0, + onUpdate: onUpdate && function () { + return _callback(tween, "onUpdate"); + }, + stagger: 0 + }, startAt))); + + tween._startAt._dp = 0; + tween._startAt._sat = tween; + time < 0 && (_reverting || !immediateRender && !autoRevert) && tween._startAt.revert(_revertConfigNoKill); + + if (immediateRender) { + if (dur && time <= 0 && tTime <= 0) { + time && (tween._zTime = time); + return; + } + } + } else if (runBackwards && dur) { + if (!prevStartAt) { + time && (immediateRender = false); + p = _setDefaults({ + overwrite: false, + data: "isFromStart", + lazy: immediateRender && !prevStartAt && _isNotFalse(lazy), + immediateRender: immediateRender, + stagger: 0, + parent: parent + }, cleanVars); + harnessVars && (p[harness.prop] = harnessVars); + + _removeFromParent(tween._startAt = Tween.set(targets, p)); + + tween._startAt._dp = 0; + tween._startAt._sat = tween; + time < 0 && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween._startAt.render(-1, true)); + tween._zTime = time; + + if (!immediateRender) { + _initTween(tween._startAt, _tinyNum, _tinyNum); + } else if (!time) { + return; + } + } } - indent = line.length - Utils.ltrim(line).length; - if (smallestIndent === -1 || indent < smallestIndent) { - smallestIndent = indent; + + tween._pt = tween._ptCache = 0; + lazy = dur && _isNotFalse(lazy) || lazy && !dur; + + for (i = 0; i < targets.length; i++) { + target = targets[i]; + gsData = target._gsap || _harness(targets)[i]._gsap; + tween._ptLookup[i] = ptLookup = {}; + _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender(); + index = fullTargets === targets ? i : fullTargets.indexOf(target); + + if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) { + tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority); + + plugin._props.forEach(function (name) { + ptLookup[name] = pt; + }); + + plugin.priority && (hasPriority = 1); + } + + if (!harness || harnessVars) { + for (p in cleanVars) { + if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) { + plugin.priority && (hasPriority = 1); + } else { + ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter); + } + } + } + + tween._op && tween._op[i] && tween.kill(target, tween._op[i]); + + if (autoOverwrite && tween._pt) { + _overwritingTween = tween; + + _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time)); + + overwritten = !tween.parent; + _overwritingTween = 0; + } + + tween._pt && lazy && (_lazyLookup[gsData.id] = 1); } + + hasPriority && _sortPropTweensByPriority(tween); + tween._onInit && tween._onInit(tween); } - if (smallestIndent > 0) { - for (i = l = 0, len1 = lines.length; l < len1; i = ++l) { - line = lines[i]; - lines[i] = line.slice(smallestIndent); + + tween._onUpdate = onUpdate; + tween._initted = (!tween._op || tween._pt) && !overwritten; + keyframes && time <= 0 && tl.render(_bigNum, true, true); + }, + _updatePropTweens = function _updatePropTweens(tween, property, value, start, startIsRelative, ratio, time, skipRecursion) { + var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property], + pt, + rootPT, + lookup, + i; + + if (!ptCache) { + ptCache = tween._ptCache[property] = []; + lookup = tween._ptLookup; + i = tween._targets.length; + + while (i--) { + pt = lookup[i][property]; + + if (pt && pt.d && pt.d._pt) { + pt = pt.d._pt; + + while (pt && pt.p !== property && pt.fp !== property) { + pt = pt._next; + } + } + + if (!pt) { + _forceAllPropTweens = 1; + tween.vars[property] = "+=0"; + + _initTween(tween, time); + + _forceAllPropTweens = 0; + return skipRecursion ? _warn(property + " not eligible for reset") : 1; + } + + ptCache.push(pt); } - value = lines.join("\n"); } - return value; - }; - Parser.prototype.isNextLineUnIndentedCollection = function(currentIndentation) { - var notEOF, ret; - if (currentIndentation == null) { - currentIndentation = null; - } - if (currentIndentation == null) { - currentIndentation = this.getCurrentLineIndentation(); + i = ptCache.length; + + while (i--) { + rootPT = ptCache[i]; + pt = rootPT._pt || rootPT; + pt.s = (start || start === 0) && !startIsRelative ? start : pt.s + (start || 0) + ratio * pt.c; + pt.c = value - pt.s; + rootPT.e && (rootPT.e = _round(value) + getUnit(rootPT.e)); + rootPT.b && (rootPT.b = pt.s + getUnit(rootPT.b)); } - notEOF = this.moveToNextLine(); - while (notEOF && this.isCurrentLineEmpty()) { - notEOF = this.moveToNextLine(); + }, + _addAliasesToVars = function _addAliasesToVars(targets, vars) { + var harness = targets[0] ? _getCache(targets[0]).harness : 0, + propertyAliases = harness && harness.aliases, + copy, + p, + i, + aliases; + + if (!propertyAliases) { + return vars; } - if (false === notEOF) { - return false; + + copy = _merge({}, vars); + + for (p in propertyAliases) { + if (p in copy) { + aliases = propertyAliases[p].split(","); + i = aliases.length; + + while (i--) { + copy[aliases[i]] = copy[p]; + } + } } - ret = false; - if (this.getCurrentLineIndentation() === currentIndentation && this.isStringUnIndentedCollectionItem(this.currentLine)) { - ret = true; + + return copy; + }, + _parseKeyframe = function _parseKeyframe(prop, obj, allProps, easeEach) { + var ease = obj.ease || easeEach || "power1.inOut", + p, + a; + + if (_isArray(obj)) { + a = allProps[prop] || (allProps[prop] = []); + obj.forEach(function (value, i) { + return a.push({ + t: i / (obj.length - 1) * 100, + v: value, + e: ease + }); + }); + } else { + for (p in obj) { + a = allProps[p] || (allProps[p] = []); + p === "ease" || a.push({ + t: parseFloat(prop), + v: obj[p], + e: ease + }); + } } - this.moveToPreviousLine(); - return ret; - }; + }, + _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) { + return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value; + }, + _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert", + _staggerPropsToSkip = {}; - Parser.prototype.isStringUnIndentedCollectionItem = function() { - return this.currentLine === '-' || this.currentLine.slice(0, 2) === '- '; - }; + _forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function (name) { + return _staggerPropsToSkip[name] = 1; + }); - return Parser; + var Tween = function (_Animation2) { + _inheritsLoose(Tween, _Animation2); + + function Tween(targets, vars, position, skipInherit) { + var _this3; + + if (typeof vars === "number") { + position.duration = vars; + vars = position; + position = null; + } + + _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this; + var _this3$vars = _this3.vars, + duration = _this3$vars.duration, + delay = _this3$vars.delay, + immediateRender = _this3$vars.immediateRender, + stagger = _this3$vars.stagger, + overwrite = _this3$vars.overwrite, + keyframes = _this3$vars.keyframes, + defaults = _this3$vars.defaults, + scrollTrigger = _this3$vars.scrollTrigger, + yoyoEase = _this3$vars.yoyoEase, + parent = vars.parent || _globalTimeline, + parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : "length" in vars) ? [targets] : toArray(targets), + tl, + i, + copy, + l, + p, + curTarget, + staggerFunc, + staggerVarsToMerge; + _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://gsap.com", !_config.nullTargetWarn) || []; + _this3._ptLookup = []; + _this3._overwrite = overwrite; + + if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { + vars = _this3.vars; + tl = _this3.timeline = new Timeline({ + data: "nested", + defaults: defaults || {}, + targets: parent && parent.data === "nested" ? parent.vars.targets : parsedTargets + }); + tl.kill(); + tl.parent = tl._dp = _assertThisInitialized(_this3); + tl._start = 0; + + if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { + l = parsedTargets.length; + staggerFunc = stagger && distribute(stagger); + + if (_isObject(stagger)) { + for (p in stagger) { + if (~_staggerTweenProps.indexOf(p)) { + staggerVarsToMerge || (staggerVarsToMerge = {}); + staggerVarsToMerge[p] = stagger[p]; + } + } + } -})(); + for (i = 0; i < l; i++) { + copy = _copyExcluding(vars, _staggerPropsToSkip); + copy.stagger = 0; + yoyoEase && (copy.yoyoEase = yoyoEase); + staggerVarsToMerge && _merge(copy, staggerVarsToMerge); + curTarget = parsedTargets[i]; + copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets); + copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay; -module.exports = Parser; + if (!stagger && l === 1 && copy.delay) { + _this3._delay = delay = copy.delay; + _this3._start += delay; + copy.delay = 0; + } + tl.to(curTarget, copy, staggerFunc ? staggerFunc(i, curTarget, parsedTargets) : 0); + tl._ease = _easeMap.none; + } -},{"./Exception/ParseException":4,"./Exception/ParseMore":5,"./Inline":6,"./Pattern":8,"./Utils":10}],8:[function(require,module,exports){ -var Pattern; + tl.duration() ? duration = delay = 0 : _this3.timeline = 0; + } else if (keyframes) { + _inheritDefaults(_setDefaults(tl.vars.defaults, { + ease: "none" + })); -Pattern = (function() { - Pattern.prototype.regex = null; + tl._ease = _parseEase(keyframes.ease || vars.ease || "none"); + var time = 0, + a, + kf, + v; - Pattern.prototype.rawRegex = null; + if (_isArray(keyframes)) { + keyframes.forEach(function (frame) { + return tl.to(parsedTargets, frame, ">"); + }); + tl.duration(); + } else { + copy = {}; - Pattern.prototype.cleanedRegex = null; + for (p in keyframes) { + p === "ease" || p === "easeEach" || _parseKeyframe(p, keyframes[p], copy, keyframes.easeEach); + } - Pattern.prototype.mapping = null; + for (p in copy) { + a = copy[p].sort(function (a, b) { + return a.t - b.t; + }); + time = 0; - function Pattern(rawRegex, modifiers) { - var _char, capturingBracketNumber, cleanedRegex, i, len, mapping, name, part, subChar; - if (modifiers == null) { - modifiers = ''; - } - cleanedRegex = ''; - len = rawRegex.length; - mapping = null; - capturingBracketNumber = 0; - i = 0; - while (i < len) { - _char = rawRegex.charAt(i); - if (_char === '\\') { - cleanedRegex += rawRegex.slice(i, +(i + 1) + 1 || 9e9); - i++; - } else if (_char === '(') { - if (i < len - 2) { - part = rawRegex.slice(i, +(i + 2) + 1 || 9e9); - if (part === '(?:') { - i += 2; - cleanedRegex += part; - } else if (part === '(?<') { - capturingBracketNumber++; - i += 2; - name = ''; - while (i + 1 < len) { - subChar = rawRegex.charAt(i + 1); - if (subChar === '>') { - cleanedRegex += '('; - i++; - if (name.length > 0) { - if (mapping == null) { - mapping = {}; - } - mapping[name] = capturingBracketNumber; - } - break; - } else { - name += subChar; + for (i = 0; i < a.length; i++) { + kf = a[i]; + v = { + ease: kf.e, + duration: (kf.t - (i ? a[i - 1].t : 0)) / 100 * duration + }; + v[p] = kf.v; + tl.to(parsedTargets, v, time); + time += v.duration; } - i++; } - } else { - cleanedRegex += _char; - capturingBracketNumber++; + + tl.duration() < duration && tl.to({}, { + duration: duration - tl.duration() + }); } - } else { - cleanedRegex += _char; } + + duration || _this3.duration(duration = tl.duration()); } else { - cleanedRegex += _char; + _this3.timeline = 0; } - i++; - } - this.rawRegex = rawRegex; - this.cleanedRegex = cleanedRegex; - this.regex = new RegExp(this.cleanedRegex, 'g' + modifiers.replace('g', '')); - this.mapping = mapping; - } - Pattern.prototype.exec = function(str) { - var index, matches, name, ref; - this.regex.lastIndex = 0; - matches = this.regex.exec(str); - if (matches == null) { - return null; - } - if (this.mapping != null) { - ref = this.mapping; - for (name in ref) { - index = ref[name]; - matches[name] = matches[index]; + if (overwrite === true && !_suppressOverwrites) { + _overwritingTween = _assertThisInitialized(_this3); + + _globalTimeline.killTweensOf(parsedTargets); + + _overwritingTween = 0; } - } - return matches; - }; - Pattern.prototype.test = function(str) { - this.regex.lastIndex = 0; - return this.regex.test(str); - }; + _addToTimeline(parent, _assertThisInitialized(_this3), position); - Pattern.prototype.replace = function(str, replacement) { - this.regex.lastIndex = 0; - return str.replace(this.regex, replacement); - }; + vars.reversed && _this3.reverse(); + vars.paused && _this3.paused(true); - Pattern.prototype.replaceAll = function(str, replacement, limit) { - var count; - if (limit == null) { - limit = 0; - } - this.regex.lastIndex = 0; - count = 0; - while (this.regex.test(str) && (limit === 0 || count < limit)) { - this.regex.lastIndex = 0; - str = str.replace(this.regex, replacement); - count++; + if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") { + _this3._tTime = -_tinyNum; + + _this3.render(Math.max(0, -delay) || 0); + } + + scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger); + return _this3; } - return [str, count]; - }; - return Pattern; + var _proto3 = Tween.prototype; -})(); + _proto3.render = function render(totalTime, suppressEvents, force) { + var prevTime = this._time, + tDur = this._tDur, + dur = this._dur, + isNegative = totalTime < 0, + tTime = totalTime > tDur - _tinyNum && !isNegative ? tDur : totalTime < _tinyNum ? 0 : totalTime, + time, + pt, + iteration, + cycleDuration, + prevIteration, + isYoyo, + ratio, + timeline, + yoyoEase; -module.exports = Pattern; + if (!dur) { + _renderZeroDurationTween(this, totalTime, suppressEvents, force); + } else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== isNegative) { + time = tTime; + timeline = this.timeline; + if (this._repeat) { + cycleDuration = dur + this._rDelay; -},{}],9:[function(require,module,exports){ -var Pattern, Unescaper, Utils; + if (this._repeat < -1 && isNegative) { + return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); + } -Utils = require('./Utils'); + time = _roundPrecise(tTime % cycleDuration); -Pattern = require('./Pattern'); + if (tTime === tDur) { + iteration = this._repeat; + time = dur; + } else { + iteration = ~~(tTime / cycleDuration); -Unescaper = (function() { - function Unescaper() {} + if (iteration && iteration === _roundPrecise(tTime / cycleDuration)) { + time = dur; + iteration--; + } - Unescaper.PATTERN_ESCAPED_CHARACTER = new Pattern('\\\\([0abt\tnvfre "\\/\\\\N_LP]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})'); + time > dur && (time = dur); + } - Unescaper.unescapeSingleQuotedString = function(value) { - return value.replace(/\'\'/g, '\''); - }; + isYoyo = this._yoyo && iteration & 1; - Unescaper.unescapeDoubleQuotedString = function(value) { - if (this._unescapeCallback == null) { - this._unescapeCallback = (function(_this) { - return function(str) { - return _this.unescapeCharacter(str); - }; - })(this); - } - return this.PATTERN_ESCAPED_CHARACTER.replace(value, this._unescapeCallback); - }; + if (isYoyo) { + yoyoEase = this._yEase; + time = dur - time; + } - Unescaper.unescapeCharacter = function(value) { - var ch; - ch = String.fromCharCode; - switch (value.charAt(1)) { - case '0': - return ch(0); - case 'a': - return ch(7); - case 'b': - return ch(8); - case 't': - return "\t"; - case "\t": - return "\t"; - case 'n': - return "\n"; - case 'v': - return ch(11); - case 'f': - return ch(12); - case 'r': - return ch(13); - case 'e': - return ch(27); - case ' ': - return ' '; - case '"': - return '"'; - case '/': - return '/'; - case '\\': - return '\\'; - case 'N': - return ch(0x0085); - case '_': - return ch(0x00A0); - case 'L': - return ch(0x2028); - case 'P': - return ch(0x2029); - case 'x': - return Utils.utf8chr(Utils.hexDec(value.substr(2, 2))); - case 'u': - return Utils.utf8chr(Utils.hexDec(value.substr(2, 4))); - case 'U': - return Utils.utf8chr(Utils.hexDec(value.substr(2, 8))); - default: - return ''; - } - }; + prevIteration = _animationCycle(this._tTime, cycleDuration); - return Unescaper; + if (time === prevTime && !force && this._initted && iteration === prevIteration) { + this._tTime = tTime; + return this; + } -})(); + if (iteration !== prevIteration) { + timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo); -module.exports = Unescaper; + if (this.vars.repeatRefresh && !isYoyo && !this._lock && this._time !== cycleDuration && this._initted) { + this._lock = force = 1; + this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0; + } + } + } + if (!this._initted) { + if (_attemptInitTween(this, isNegative ? totalTime : time, force, suppressEvents, tTime)) { + this._tTime = 0; + return this; + } -},{"./Pattern":8,"./Utils":10}],10:[function(require,module,exports){ -var Pattern, Utils, - hasProp = {}.hasOwnProperty; + if (prevTime !== this._time && !(force && this.vars.repeatRefresh && iteration !== prevIteration)) { + return this; + } -Pattern = require('./Pattern'); + if (dur !== this._dur) { + return this.render(totalTime, suppressEvents, force); + } + } -Utils = (function() { - function Utils() {} + this._tTime = tTime; + this._time = time; - Utils.REGEX_LEFT_TRIM_BY_CHAR = {}; + if (!this._act && this._ts) { + this._act = 1; + this._lazy = 0; + } - Utils.REGEX_RIGHT_TRIM_BY_CHAR = {}; + this.ratio = ratio = (yoyoEase || this._ease)(time / dur); - Utils.REGEX_SPACES = /\s+/g; + if (this._from) { + this.ratio = ratio = 1 - ratio; + } - Utils.REGEX_DIGITS = /^\d+$/; + if (time && !prevTime && !suppressEvents && !iteration) { + _callback(this, "onStart"); - Utils.REGEX_OCTAL = /[^0-7]/gi; + if (this._tTime !== tTime) { + return this; + } + } - Utils.REGEX_HEXADECIMAL = /[^a-f0-9]/gi; + pt = this._pt; - Utils.PATTERN_DATE = new Pattern('^' + '(?[0-9][0-9][0-9][0-9])' + '-(?[0-9][0-9]?)' + '-(?[0-9][0-9]?)' + '(?:(?:[Tt]|[ \t]+)' + '(?[0-9][0-9]?)' + ':(?[0-9][0-9])' + ':(?[0-9][0-9])' + '(?:\.(?[0-9]*))?' + '(?:[ \t]*(?Z|(?[-+])(?[0-9][0-9]?)' + '(?::(?[0-9][0-9]))?))?)?' + '$', 'i'); + while (pt) { + pt.r(ratio, pt.d); + pt = pt._next; + } - Utils.LOCAL_TIMEZONE_OFFSET = new Date().getTimezoneOffset() * 60 * 1000; + timeline && timeline.render(totalTime < 0 ? totalTime : timeline._dur * timeline._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime); - Utils.trim = function(str, _char) { - var regexLeft, regexRight; - if (_char == null) { - _char = '\\s'; - } - regexLeft = this.REGEX_LEFT_TRIM_BY_CHAR[_char]; - if (regexLeft == null) { - this.REGEX_LEFT_TRIM_BY_CHAR[_char] = regexLeft = new RegExp('^' + _char + '' + _char + '*'); - } - regexLeft.lastIndex = 0; - regexRight = this.REGEX_RIGHT_TRIM_BY_CHAR[_char]; - if (regexRight == null) { - this.REGEX_RIGHT_TRIM_BY_CHAR[_char] = regexRight = new RegExp(_char + '' + _char + '*$'); - } - regexRight.lastIndex = 0; - return str.replace(regexLeft, '').replace(regexRight, ''); - }; + if (this._onUpdate && !suppressEvents) { + isNegative && _rewindStartAt(this, totalTime, suppressEvents, force); - Utils.ltrim = function(str, _char) { - var regexLeft; - if (_char == null) { - _char = '\\s'; - } - regexLeft = this.REGEX_LEFT_TRIM_BY_CHAR[_char]; - if (regexLeft == null) { - this.REGEX_LEFT_TRIM_BY_CHAR[_char] = regexLeft = new RegExp('^' + _char + '' + _char + '*'); - } - regexLeft.lastIndex = 0; - return str.replace(regexLeft, ''); - }; + _callback(this, "onUpdate"); + } - Utils.rtrim = function(str, _char) { - var regexRight; - if (_char == null) { - _char = '\\s'; - } - regexRight = this.REGEX_RIGHT_TRIM_BY_CHAR[_char]; - if (regexRight == null) { - this.REGEX_RIGHT_TRIM_BY_CHAR[_char] = regexRight = new RegExp(_char + '' + _char + '*$'); - } - regexRight.lastIndex = 0; - return str.replace(regexRight, ''); - }; + this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat"); - Utils.isEmpty = function(value) { - return !value || value === '' || value === '0' || (value instanceof Array && value.length === 0) || this.isEmptyObject(value); - }; + if ((tTime === this._tDur || !tTime) && this._tTime === tTime) { + isNegative && !this._onUpdate && _rewindStartAt(this, totalTime, true, true); + (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); - Utils.isEmptyObject = function(value) { - var k; - return value instanceof Object && ((function() { - var results; - results = []; - for (k in value) { - if (!hasProp.call(value, k)) continue; - results.push(k); + if (!suppressEvents && !(isNegative && !prevTime) && (tTime || prevTime || isYoyo)) { + _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true); + + this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); + } + } } - return results; - })()).length === 0; - }; - Utils.subStrCount = function(string, subString, start, length) { - var c, i, j, len, ref, sublen; - c = 0; - string = '' + string; - subString = '' + subString; - if (start != null) { - string = string.slice(start); - } - if (length != null) { - string = string.slice(0, length); - } - len = string.length; - sublen = subString.length; - for (i = j = 0, ref = len; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) { - if (subString === string.slice(i, sublen)) { - c++; - i += sublen - 1; + return this; + }; + + _proto3.targets = function targets() { + return this._targets; + }; + + _proto3.invalidate = function invalidate(soft) { + (!soft || !this.vars.runBackwards) && (this._startAt = 0); + this._pt = this._op = this._onUpdate = this._lazy = this.ratio = 0; + this._ptLookup = []; + this.timeline && this.timeline.invalidate(soft); + return _Animation2.prototype.invalidate.call(this, soft); + }; + + _proto3.resetTo = function resetTo(property, value, start, startIsRelative, skipRecursion) { + _tickerActive || _ticker.wake(); + this._ts || this.play(); + var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts), + ratio; + this._initted || _initTween(this, time); + ratio = this._ease(time / this._dur); + + if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time, skipRecursion)) { + return this.resetTo(property, value, start, startIsRelative, 1); } - } - return c; - }; - Utils.isDigits = function(input) { - this.REGEX_DIGITS.lastIndex = 0; - return this.REGEX_DIGITS.test(input); - }; + _alignPlayhead(this, 0); - Utils.octDec = function(input) { - this.REGEX_OCTAL.lastIndex = 0; - return parseInt((input + '').replace(this.REGEX_OCTAL, ''), 8); - }; + this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0); + return this.render(0); + }; - Utils.hexDec = function(input) { - this.REGEX_HEXADECIMAL.lastIndex = 0; - input = this.trim(input); - if ((input + '').slice(0, 2) === '0x') { - input = (input + '').slice(2); - } - return parseInt((input + '').replace(this.REGEX_HEXADECIMAL, ''), 16); - }; + _proto3.kill = function kill(targets, vars) { + if (vars === void 0) { + vars = "all"; + } - Utils.utf8chr = function(c) { - var ch; - ch = String.fromCharCode; - if (0x80 > (c %= 0x200000)) { - return ch(c); - } - if (0x800 > c) { - return ch(0xC0 | c >> 6) + ch(0x80 | c & 0x3F); - } - if (0x10000 > c) { - return ch(0xE0 | c >> 12) + ch(0x80 | c >> 6 & 0x3F) + ch(0x80 | c & 0x3F); - } - return ch(0xF0 | c >> 18) + ch(0x80 | c >> 12 & 0x3F) + ch(0x80 | c >> 6 & 0x3F) + ch(0x80 | c & 0x3F); - }; + if (!targets && (!vars || vars === "all")) { + this._lazy = this._pt = 0; + return this.parent ? _interrupt(this) : this; + } - Utils.parseBoolean = function(input, strict) { - var lowerInput; - if (strict == null) { - strict = true; - } - if (typeof input === 'string') { - lowerInput = input.toLowerCase(); - if (!strict) { - if (lowerInput === 'no') { - return false; - } + if (this.timeline) { + var tDur = this.timeline.totalDuration(); + this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this); + this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1); + return this; } - if (lowerInput === '0') { - return false; + + var parsedTargets = this._targets, + killingTargets = targets ? toArray(targets) : parsedTargets, + propTweenLookup = this._ptLookup, + firstPT = this._pt, + overwrittenProps, + curLookup, + curOverwriteProps, + props, + p, + pt, + i; + + if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) { + vars === "all" && (this._pt = 0); + return _interrupt(this); } - if (lowerInput === 'false') { - return false; + + overwrittenProps = this._op = this._op || []; + + if (vars !== "all") { + if (_isString(vars)) { + p = {}; + + _forEachName(vars, function (name) { + return p[name] = 1; + }); + + vars = p; + } + + vars = _addAliasesToVars(parsedTargets, vars); } - if (lowerInput === '') { - return false; + + i = parsedTargets.length; + + while (i--) { + if (~killingTargets.indexOf(parsedTargets[i])) { + curLookup = propTweenLookup[i]; + + if (vars === "all") { + overwrittenProps[i] = vars; + props = curLookup; + curOverwriteProps = {}; + } else { + curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {}; + props = vars; + } + + for (p in props) { + pt = curLookup && curLookup[p]; + + if (pt) { + if (!("kill" in pt.d) || pt.d.kill(p) === true) { + _removeLinkedListItem(this, pt, "_pt"); + } + + delete curLookup[p]; + } + + if (curOverwriteProps !== "all") { + curOverwriteProps[p] = 1; + } + } + } } - return true; - } - return !!input; - }; - Utils.isNumeric = function(input) { - this.REGEX_SPACES.lastIndex = 0; - return typeof input === 'number' || typeof input === 'string' && !isNaN(input) && input.replace(this.REGEX_SPACES, '') !== ''; - }; + this._initted && !this._pt && firstPT && _interrupt(this); + return this; + }; - Utils.stringToDate = function(str) { - var date, day, fraction, hour, info, minute, month, second, tz_hour, tz_minute, tz_offset, year; - if (!(str != null ? str.length : void 0)) { - return null; + Tween.to = function to(targets, vars) { + return new Tween(targets, vars, arguments[2]); + }; + + Tween.from = function from(targets, vars) { + return _createTweenType(1, arguments); + }; + + Tween.delayedCall = function delayedCall(delay, callback, params, scope) { + return new Tween(callback, 0, { + immediateRender: false, + lazy: false, + overwrite: false, + delay: delay, + onComplete: callback, + onReverseComplete: callback, + onCompleteParams: params, + onReverseCompleteParams: params, + callbackScope: scope + }); + }; + + Tween.fromTo = function fromTo(targets, fromVars, toVars) { + return _createTweenType(2, arguments); + }; + + Tween.set = function set(targets, vars) { + vars.duration = 0; + vars.repeatDelay || (vars.repeat = 0); + return new Tween(targets, vars); + }; + + Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) { + return _globalTimeline.killTweensOf(targets, props, onlyActive); + }; + + return Tween; + }(Animation); + + _setDefaults(Tween.prototype, { + _targets: [], + _lazy: 0, + _startAt: 0, + _op: 0, + _onInit: 0 + }); + + _forEachName("staggerTo,staggerFrom,staggerFromTo", function (name) { + Tween[name] = function () { + var tl = new Timeline(), + params = _slice.call(arguments, 0); + + params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0); + return tl[name].apply(tl, params); + }; + }); + + var _setterPlain = function _setterPlain(target, property, value) { + return target[property] = value; + }, + _setterFunc = function _setterFunc(target, property, value) { + return target[property](value); + }, + _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) { + return target[property](data.fp, value); + }, + _setterAttribute = function _setterAttribute(target, property, value) { + return target.setAttribute(property, value); + }, + _getSetter = function _getSetter(target, property) { + return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain; + }, + _renderPlain = function _renderPlain(ratio, data) { + return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1000000) / 1000000, data); + }, + _renderBoolean = function _renderBoolean(ratio, data) { + return data.set(data.t, data.p, !!(data.s + data.c * ratio), data); + }, + _renderComplexString = function _renderComplexString(ratio, data) { + var pt = data._pt, + s = ""; + + if (!ratio && data.b) { + s = data.b; + } else if (ratio === 1 && data.e) { + s = data.e; + } else { + while (pt) { + s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 10000) / 10000) + s; + pt = pt._next; + } + + s += data.c; } - info = this.PATTERN_DATE.exec(str); - if (!info) { - return null; + + data.set(data.t, data.p, s, data); + }, + _renderPropTweens = function _renderPropTweens(ratio, data) { + var pt = data._pt; + + while (pt) { + pt.r(ratio, pt.d); + pt = pt._next; } - year = parseInt(info.year, 10); - month = parseInt(info.month, 10) - 1; - day = parseInt(info.day, 10); - if (info.hour == null) { - date = new Date(Date.UTC(year, month, day)); - return date; + }, + _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) { + var pt = this._pt, + next; + + while (pt) { + next = pt._next; + pt.p === property && pt.modifier(modifier, tween, target); + pt = next; } - hour = parseInt(info.hour, 10); - minute = parseInt(info.minute, 10); - second = parseInt(info.second, 10); - if (info.fraction != null) { - fraction = info.fraction.slice(0, 3); - while (fraction.length < 3) { - fraction += '0'; + }, + _killPropTweensOf = function _killPropTweensOf(property) { + var pt = this._pt, + hasNonDependentRemaining, + next; + + while (pt) { + next = pt._next; + + if (pt.p === property && !pt.op || pt.op === property) { + _removeLinkedListItem(this, pt, "_pt"); + } else if (!pt.dep) { + hasNonDependentRemaining = 1; } - fraction = parseInt(fraction, 10); - } else { - fraction = 0; + + pt = next; } - if (info.tz != null) { - tz_hour = parseInt(info.tz_hour, 10); - if (info.tz_minute != null) { - tz_minute = parseInt(info.tz_minute, 10); + + return !hasNonDependentRemaining; + }, + _setterWithModifier = function _setterWithModifier(target, property, value, data) { + data.mSet(target, property, data.m.call(data.tween, value, data.mt), data); + }, + _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) { + var pt = parent._pt, + next, + pt2, + first, + last; + + while (pt) { + next = pt._next; + pt2 = first; + + while (pt2 && pt2.pr > pt.pr) { + pt2 = pt2._next; + } + + if (pt._prev = pt2 ? pt2._prev : last) { + pt._prev._next = pt; } else { - tz_minute = 0; + first = pt; } - tz_offset = (tz_hour * 60 + tz_minute) * 60000; - if ('-' === info.tz_sign) { - tz_offset *= -1; + + if (pt._next = pt2) { + pt2._prev = pt; + } else { + last = pt; } + + pt = next; } - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - if (tz_offset) { - date.setTime(date.getTime() - tz_offset); - } - return date; + + parent._pt = first; }; - Utils.strRepeat = function(str, number) { - var i, res; - res = ''; - i = 0; - while (i < number) { - res += str; - i++; + var PropTween = function () { + function PropTween(next, target, prop, start, change, renderer, data, setter, priority) { + this.t = target; + this.s = start; + this.c = change; + this.p = prop; + this.r = renderer || _renderPlain; + this.d = data || this; + this.set = setter || _setterPlain; + this.pr = priority || 0; + this._next = next; + + if (next) { + next._prev = this; + } + } + + var _proto4 = PropTween.prototype; + + _proto4.modifier = function modifier(func, tween, target) { + this.mSet = this.mSet || this.set; + this.set = _setterWithModifier; + this.m = func; + this.mt = target; + this.tween = tween; + }; + + return PropTween; + }(); + + _forEachName(_callbackNames + "parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger", function (name) { + return _reservedProps[name] = 1; + }); + + _globals.TweenMax = _globals.TweenLite = Tween; + _globals.TimelineLite = _globals.TimelineMax = Timeline; + _globalTimeline = new Timeline({ + sortChildren: false, + defaults: _defaults, + autoRemoveChildren: true, + id: "root", + smoothChildTiming: true + }); + _config.stringFilter = _colorStringFilter; + + var _media = [], + _listeners = {}, + _emptyArray = [], + _lastMediaTime = 0, + _contextID = 0, + _dispatch = function _dispatch(type) { + return (_listeners[type] || _emptyArray).map(function (f) { + return f(); + }); + }, + _onMediaChange = function _onMediaChange() { + var time = Date.now(), + matches = []; + + if (time - _lastMediaTime > 2) { + _dispatch("matchMediaInit"); + + _media.forEach(function (c) { + var queries = c.queries, + conditions = c.conditions, + match, + p, + anyMatch, + toggled; + + for (p in queries) { + match = _win.matchMedia(queries[p]).matches; + match && (anyMatch = 1); + + if (match !== conditions[p]) { + conditions[p] = match; + toggled = 1; + } + } + + if (toggled) { + c.revert(); + anyMatch && matches.push(c); + } + }); + + _dispatch("matchMediaRevert"); + + matches.forEach(function (c) { + return c.onMatch(c, function (func) { + return c.add(null, func); + }); + }); + _lastMediaTime = time; + + _dispatch("matchMedia"); } - return res; }; - Utils.getStringFromFile = function(path, callback) { - var data, fs, j, len1, name, ref, req, xhr; - if (callback == null) { - callback = null; + var Context = function () { + function Context(func, scope) { + this.selector = scope && selector(scope); + this.data = []; + this._r = []; + this.isReverted = false; + this.id = _contextID++; + func && this.add(func); } - xhr = null; - if (typeof window !== "undefined" && window !== null) { - if (window.XMLHttpRequest) { - xhr = new XMLHttpRequest(); - } else if (window.ActiveXObject) { - ref = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; - for (j = 0, len1 = ref.length; j < len1; j++) { - name = ref[j]; - try { - xhr = new ActiveXObject(name); - } catch (undefined) {} - } + + var _proto5 = Context.prototype; + + _proto5.add = function add(name, func, scope) { + if (_isFunction(name)) { + scope = func; + func = name; + name = _isFunction; } - } - if (xhr != null) { - if (callback != null) { - xhr.onreadystatechange = function() { - if (xhr.readyState === 4) { - if (xhr.status === 200 || xhr.status === 0) { - return callback(xhr.responseText); + + var self = this, + f = function f() { + var prev = _context, + prevSelector = self.selector, + result; + prev && prev !== self && prev.data.push(self); + scope && (self.selector = selector(scope)); + _context = self; + result = func.apply(self, arguments); + _isFunction(result) && self._r.push(result); + _context = prev; + self.selector = prevSelector; + self.isReverted = false; + return result; + }; + + self.last = f; + return name === _isFunction ? f(self, function (func) { + return self.add(null, func); + }) : name ? self[name] = f : f; + }; + + _proto5.ignore = function ignore(func) { + var prev = _context; + _context = null; + func(this); + _context = prev; + }; + + _proto5.getTweens = function getTweens() { + var a = []; + this.data.forEach(function (e) { + return e instanceof Context ? a.push.apply(a, e.getTweens()) : e instanceof Tween && !(e.parent && e.parent.data === "nested") && a.push(e); + }); + return a; + }; + + _proto5.clear = function clear() { + this._r.length = this.data.length = 0; + }; + + _proto5.kill = function kill(revert, matchMedia) { + var _this4 = this; + + if (revert) { + (function () { + var tweens = _this4.getTweens(), + i = _this4.data.length, + t; + + while (i--) { + t = _this4.data[i]; + + if (t.data === "isFlip") { + t.revert(); + t.getChildren(true, true, false).forEach(function (tween) { + return tweens.splice(tweens.indexOf(tween), 1); + }); + } + } + + tweens.map(function (t) { + return { + g: t._dur || t._delay || t._sat && !t._sat.vars.immediateRender ? t.globalTime(0) : -Infinity, + t: t + }; + }).sort(function (a, b) { + return b.g - a.g || -Infinity; + }).forEach(function (o) { + return o.t.revert(revert); + }); + i = _this4.data.length; + + while (i--) { + t = _this4.data[i]; + + if (t instanceof Timeline) { + if (t.data !== "nested") { + t.scrollTrigger && t.scrollTrigger.revert(); + t.kill(); + } } else { - return callback(null); + !(t instanceof Tween) && t.revert && t.revert(revert); } } - }; - xhr.open('GET', path, true); - return xhr.send(null); + + _this4._r.forEach(function (f) { + return f(revert, _this4); + }); + + _this4.isReverted = true; + })(); } else { - xhr.open('GET', path, false); - xhr.send(null); - if (xhr.status === 200 || xhr.status === 0) { - return xhr.responseText; - } - return null; - } - } else { - req = require; - fs = req('fs'); - if (callback != null) { - return fs.readFile(path, function(err, data) { - if (err) { - return callback(null); - } else { - return callback(String(data)); - } + this.data.forEach(function (e) { + return e.kill && e.kill(); }); - } else { - data = fs.readFileSync(path); - if (data != null) { - return String(data); + } + + this.clear(); + + if (matchMedia) { + var i = _media.length; + + while (i--) { + _media[i].id === this.id && _media.splice(i, 1); } - return null; } + }; + + _proto5.revert = function revert(config) { + this.kill(config || {}); + }; + + return Context; + }(); + + var MatchMedia = function () { + function MatchMedia(scope) { + this.contexts = []; + this.scope = scope; + _context && _context.data.push(this); } - }; - return Utils; + var _proto6 = MatchMedia.prototype; -})(); + _proto6.add = function add(conditions, func, scope) { + _isObject(conditions) || (conditions = { + matches: conditions + }); + var context = new Context(0, scope || this.scope), + cond = context.conditions = {}, + mq, + p, + active; + _context && !context.selector && (context.selector = _context.selector); + this.contexts.push(context); + func = context.add("onMatch", func); + context.queries = conditions; + + for (p in conditions) { + if (p === "all") { + active = 1; + } else { + mq = _win.matchMedia(conditions[p]); -module.exports = Utils; + if (mq) { + _media.indexOf(context) < 0 && _media.push(context); + (cond[p] = mq.matches) && (active = 1); + mq.addListener ? mq.addListener(_onMediaChange) : mq.addEventListener("change", _onMediaChange); + } + } + } + active && func(context, function (f) { + return context.add(null, f); + }); + return this; + }; -},{"./Pattern":8}],11:[function(require,module,exports){ -var Dumper, Parser, Utils, Yaml; + _proto6.revert = function revert(config) { + this.kill(config || {}); + }; -Parser = require('./Parser'); + _proto6.kill = function kill(revert) { + this.contexts.forEach(function (c) { + return c.kill(revert, true); + }); + }; -Dumper = require('./Dumper'); + return MatchMedia; + }(); -Utils = require('./Utils'); + var _gsap = { + registerPlugin: function registerPlugin() { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } -Yaml = (function() { - function Yaml() {} + args.forEach(function (config) { + return _createPlugin(config); + }); + }, + timeline: function timeline(vars) { + return new Timeline(vars); + }, + getTweensOf: function getTweensOf(targets, onlyActive) { + return _globalTimeline.getTweensOf(targets, onlyActive); + }, + getProperty: function getProperty(target, property, unit, uncache) { + _isString(target) && (target = toArray(target)[0]); - Yaml.parse = function(input, exceptionOnInvalidType, objectDecoder) { - if (exceptionOnInvalidType == null) { - exceptionOnInvalidType = false; - } - if (objectDecoder == null) { - objectDecoder = null; - } - return new Parser().parse(input, exceptionOnInvalidType, objectDecoder); - }; + var getter = _getCache(target || {}).get, + format = unit ? _passThrough : _numericIfPossible; - Yaml.parseFile = function(path, callback, exceptionOnInvalidType, objectDecoder) { - var input; - if (callback == null) { - callback = null; - } - if (exceptionOnInvalidType == null) { - exceptionOnInvalidType = false; - } - if (objectDecoder == null) { - objectDecoder = null; - } - if (callback != null) { - return Utils.getStringFromFile(path, (function(_this) { - return function(input) { - var result; - result = null; - if (input != null) { - result = _this.parse(input, exceptionOnInvalidType, objectDecoder); + unit === "native" && (unit = ""); + return !target ? target : !property ? function (property, unit, uncache) { + return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); + } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); + }, + quickSetter: function quickSetter(target, property, unit) { + target = toArray(target); + + if (target.length > 1) { + var setters = target.map(function (t) { + return gsap.quickSetter(t, property, unit); + }), + l = setters.length; + return function (value) { + var i = l; + + while (i--) { + setters[i](value); } - callback(result); }; - })(this)); - } else { - input = Utils.getStringFromFile(path); - if (input != null) { - return this.parse(input, exceptionOnInvalidType, objectDecoder); } - return null; - } - }; - Yaml.dump = function(input, inline, indent, exceptionOnInvalidType, objectEncoder) { - var yaml; - if (inline == null) { - inline = 2; - } - if (indent == null) { - indent = 4; - } - if (exceptionOnInvalidType == null) { - exceptionOnInvalidType = false; - } - if (objectEncoder == null) { - objectEncoder = null; - } - yaml = new Dumper(); - yaml.indentation = indent; - return yaml.dump(input, inline, 0, exceptionOnInvalidType, objectEncoder); - }; + target = target[0] || {}; - Yaml.stringify = function(input, inline, indent, exceptionOnInvalidType, objectEncoder) { - return this.dump(input, inline, indent, exceptionOnInvalidType, objectEncoder); - }; + var Plugin = _plugins[property], + cache = _getCache(target), + p = cache.harness && (cache.harness.aliases || {})[property] || property, + setter = Plugin ? function (value) { + var p = new Plugin(); + _quickTween._pt = 0; + p.init(target, unit ? value + unit : value, _quickTween, 0, [target]); + p.render(1, p); + _quickTween._pt && _renderPropTweens(1, _quickTween); + } : cache.set(target, p); - Yaml.load = function(path, callback, exceptionOnInvalidType, objectDecoder) { - return this.parseFile(path, callback, exceptionOnInvalidType, objectDecoder); - }; + return Plugin ? setter : function (value) { + return setter(target, p, unit ? value + unit : value, cache, 1); + }; + }, + quickTo: function quickTo(target, property, vars) { + var _merge2; - return Yaml; + var tween = gsap.to(target, _merge((_merge2 = {}, _merge2[property] = "+=0.1", _merge2.paused = true, _merge2), vars || {})), + func = function func(value, start, startIsRelative) { + return tween.resetTo(property, value, start, startIsRelative); + }; -})(); + func.tween = tween; + return func; + }, + isTweening: function isTweening(targets) { + return _globalTimeline.getTweensOf(targets, true).length > 0; + }, + defaults: function defaults(value) { + value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease)); + return _mergeDeep(_defaults, value || {}); + }, + config: function config(value) { + return _mergeDeep(_config, value || {}); + }, + registerEffect: function registerEffect(_ref3) { + var name = _ref3.name, + effect = _ref3.effect, + plugins = _ref3.plugins, + defaults = _ref3.defaults, + extendTimeline = _ref3.extendTimeline; + (plugins || "").split(",").forEach(function (pluginName) { + return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin."); + }); -if (typeof window !== "undefined" && window !== null) { - window.YAML = Yaml; -} + _effects[name] = function (targets, vars, tl) { + return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl); + }; -if (typeof window === "undefined" || window === null) { - this.YAML = Yaml; -} + if (extendTimeline) { + Timeline.prototype[name] = function (targets, vars, position) { + return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position); + }; + } + }, + registerEase: function registerEase(name, ease) { + _easeMap[name] = _parseEase(ease); + }, + parseEase: function parseEase(ease, defaultEase) { + return arguments.length ? _parseEase(ease, defaultEase) : _easeMap; + }, + getById: function getById(id) { + return _globalTimeline.getById(id); + }, + exportRoot: function exportRoot(vars, includeDelayedCalls) { + if (vars === void 0) { + vars = {}; + } -module.exports = Yaml; + var tl = new Timeline(vars), + child, + next; + tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming); + _globalTimeline.remove(tl); -},{"./Dumper":1,"./Parser":7,"./Utils":10}]},{},[11]); + tl._dp = 0; + tl._time = tl._tTime = _globalTimeline._time; + child = _globalTimeline._first; -; -/**************************************************************************** - promise-get.js, + while (child) { + next = child._next; - (c) 2017, FCOO + if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) { + _addToTimeline(tl, child, child._start - child._delay); + } - https://github.com/FCOO/promise-get - https://github.com/FCOO + child = next; + } -****************************************************************************/ + _addToTimeline(_globalTimeline, tl, 0); -(function ($, window, Promise/*, document, undefined*/) { - "use strict"; + return tl; + }, + context: function context(func, scope) { + return func ? new Context(func, scope) : _context; + }, + matchMedia: function matchMedia(scope) { + return new MatchMedia(scope); + }, + matchMediaRefresh: function matchMediaRefresh() { + return _media.forEach(function (c) { + var cond = c.conditions, + found, + p; + + for (p in cond) { + if (cond[p]) { + cond[p] = false; + found = 1; + } + } - //Create a default error-handle. Can be overwritten - Promise.defaultErrorHandler = Promise.defaultErrorHandler || function( /* error: {name, status, message, text, statusText} */ ){}; + found && c.revert(); + }) || _onMediaChange(); + }, + addEventListener: function addEventListener(type, callback) { + var a = _listeners[type] || (_listeners[type] = []); + ~a.indexOf(callback) || a.push(callback); + }, + removeEventListener: function removeEventListener(type, callback) { + var a = _listeners[type], + i = a && a.indexOf(callback); + i >= 0 && a.splice(i, 1); + }, + utils: { + wrap: wrap, + wrapYoyo: wrapYoyo, + distribute: distribute, + random: random, + snap: snap, + normalize: normalize, + getUnit: getUnit, + clamp: clamp, + splitColor: splitColor, + toArray: toArray, + selector: selector, + mapRange: mapRange, + pipe: pipe, + unitize: unitize, + interpolate: interpolate, + shuffle: shuffle + }, + install: _install, + effects: _effects, + ticker: _ticker, + updateRoot: Timeline.updateRoot, + plugins: _plugins, + globalTimeline: _globalTimeline, + core: { + PropTween: PropTween, + globals: _addGlobal, + Tween: Tween, + Timeline: Timeline, + Animation: Animation, + getCache: _getCache, + _removeLinkedListItem: _removeLinkedListItem, + reverting: function reverting() { + return _reverting; + }, + context: function context(toAdd) { + if (toAdd && _context) { + _context.data.push(toAdd); - function createErrorObject( reason, url ){ - var response = reason.response, - text = response ? response.statusText : - reason.message ? reason.message : - reason; - return { - name : 'Error', - status : response ? response.status : null, - url : url, - message : text, - text : text, - statusText: text - }; + toAdd._ctx = _context; + } + + return _context; + }, + suppressOverwrites: function suppressOverwrites(value) { + return _suppressOverwrites = value; + } } + }; - //Set event handler for unhandled rejections - window.onunhandledrejection = function(e, promise){ - if (e && e.preventDefault) - e.preventDefault(); + _forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function (name) { + return _gsap[name] = Tween[name]; + }); - //Unknown why, but in some browwsers onunhandledrejection is called twice - one time with e.detail - if (e && e.detail) - return false; + _ticker.add(Timeline.updateRoot); - var url = promise && promise.promiseOptions ? promise.promiseOptions.url : null; + _quickTween = _gsap.to({}, { + duration: 0 + }); - Promise.defaultErrorHandler( createErrorObject( e, url ) ); - }; + var _getPluginPropTween = function _getPluginPropTween(plugin, prop) { + var pt = plugin._pt; - function callDefaultErrorHandle(reason, url){ - return Promise.defaultErrorHandler( createErrorObject( reason, url ) ); + while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) { + pt = pt._next; } - //Promise.defaultPrefetch = function(url, options): To be called before ALL fetch - Promise.defaultPrefetch = null; + return pt; + }, + _addModifiers = function _addModifiers(tween, modifiers) { + var targets = tween._targets, + p, + i, + pt; - //Promise.defaultFinally = function(): To be called as finally for ALL Promise.get - Promise.defaultFinally = null; + for (p in modifiers) { + i = targets.length; - /************************************************************** - Promise.fetch( url, options ) - Fetch the url. - Retries up to options.retries times with delay between of options.retryDeday ms - **************************************************************/ - Promise.fetch = function(url, options) { - options = $.extend( {}, { - retries : 3, - retryDelay: 1000, - noCache : false, - // cache : 'reload', //TODO: Check if it works -/*REMOVE FOR NOW. NEED TO FIND A WAY TO FORCE NO-CACHE - headers : { - "Cache-Control": 'no-cache' //TODO: Check if this works + while (i--) { + pt = tween._ptLookup[i][p]; + + if (pt && (pt = pt.d)) { + if (pt._pt) { + pt = _getPluginPropTween(pt, p); + } + + pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p); + } + } + } + }, + _buildModifierPlugin = function _buildModifierPlugin(name, modifier) { + return { + name: name, + rawVars: 1, + init: function init(target, vars, tween) { + tween._onInit = function (tween) { + var temp, p; + + if (_isString(vars)) { + temp = {}; + + _forEachName(vars, function (name) { + return temp[name] = 1; + }); + + vars = temp; + } + + if (modifier) { + temp = {}; + + for (p in vars) { + temp[p] = modifier(vars[p]); } -*/ - }, options || {}); - //Adding parame dummy=12345678 if options.noCache: true to force no-cache. TODO: Replaced with correct header - if (options.noCache) - url = url + (url.indexOf('?') > 0 ? '&' : '?') + 'dummy='+Math.random().toString(36).substr(2, 9); + vars = temp; + } - if (Promise.defaultPrefetch) - Promise.defaultPrefetch(url, options); + _addModifiers(tween, vars); + }; + } + }; + }; - return new Promise(function(resolve, reject) { - var wrappedFetch = function(n) { - fetch(url, options) - .then(function(response) { - resolve(response); - }) - .catch(function(error) { - if (n > 0) { - setTimeout(function() { - wrappedFetch(--n); - }, options.retryDelay); - } - else { - reject(error); - } - }); - }; - wrappedFetch(options.retries); + var gsap = _gsap.registerPlugin({ + name: "attr", + init: function init(target, vars, tween, index, targets) { + var p, pt, v; + this.tween = tween; + + for (p in vars) { + v = target.getAttribute(p) || ""; + pt = this.add(target, "setAttribute", (v || 0) + "", vars[p], index, targets, 0, 0, p); + pt.op = p; + pt.b = v; + + this._props.push(p); + } + }, + render: function render(ratio, data) { + var pt = data._pt; + + while (pt) { + _reverting ? pt.set(pt.t, pt.p, pt.b, pt) : pt.r(ratio, pt.d); + pt = pt._next; + } + } + }, { + name: "endArray", + init: function init(target, value) { + var i = value.length; + + while (i--) { + this.add(target, i, target[i] || 0, value[i], 0, 0, 0, 0, 0, 1); + } + } + }, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap; + Tween.version = Timeline.version = gsap.version = "3.12.5"; + _coreReady = 1; + _windowExists() && _wake(); + var Power0 = _easeMap.Power0, + Power1 = _easeMap.Power1, + Power2 = _easeMap.Power2, + Power3 = _easeMap.Power3, + Power4 = _easeMap.Power4, + Linear = _easeMap.Linear, + Quad = _easeMap.Quad, + Cubic = _easeMap.Cubic, + Quart = _easeMap.Quart, + Quint = _easeMap.Quint, + Strong = _easeMap.Strong, + Elastic = _easeMap.Elastic, + Back = _easeMap.Back, + SteppedEase = _easeMap.SteppedEase, + Bounce = _easeMap.Bounce, + Sine = _easeMap.Sine, + Expo = _easeMap.Expo, + Circ = _easeMap.Circ; + + var _win$1, + _doc$1, + _docElement, + _pluginInitted, + _tempDiv, + _tempDivStyler, + _recentSetterPlugin, + _reverting$1, + _windowExists$1 = function _windowExists() { + return typeof window !== "undefined"; + }, + _transformProps = {}, + _RAD2DEG = 180 / Math.PI, + _DEG2RAD = Math.PI / 180, + _atan2 = Math.atan2, + _bigNum$1 = 1e8, + _capsExp = /([A-Z])/g, + _horizontalExp = /(left|right|width|margin|padding|x)/i, + _complexExp = /[\s,\(]\S/, + _propertyAliases = { + autoAlpha: "opacity,visibility", + scale: "scaleX,scaleY", + alpha: "opacity" + }, + _renderCSSProp = function _renderCSSProp(ratio, data) { + return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); + }, + _renderPropWithEnd = function _renderPropWithEnd(ratio, data) { + return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); + }, + _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning(ratio, data) { + return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u : data.b, data); + }, + _renderRoundedCSSProp = function _renderRoundedCSSProp(ratio, data) { + var value = data.s + data.c * ratio; + data.set(data.t, data.p, ~~(value + (value < 0 ? -.5 : .5)) + data.u, data); + }, + _renderNonTweeningValue = function _renderNonTweeningValue(ratio, data) { + return data.set(data.t, data.p, ratio ? data.e : data.b, data); + }, + _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd(ratio, data) { + return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data); + }, + _setterCSSStyle = function _setterCSSStyle(target, property, value) { + return target.style[property] = value; + }, + _setterCSSProp = function _setterCSSProp(target, property, value) { + return target.style.setProperty(property, value); + }, + _setterTransform = function _setterTransform(target, property, value) { + return target._gsap[property] = value; + }, + _setterScale = function _setterScale(target, property, value) { + return target._gsap.scaleX = target._gsap.scaleY = value; + }, + _setterScaleWithRender = function _setterScaleWithRender(target, property, value, data, ratio) { + var cache = target._gsap; + cache.scaleX = cache.scaleY = value; + cache.renderTransform(ratio, cache); + }, + _setterTransformWithRender = function _setterTransformWithRender(target, property, value, data, ratio) { + var cache = target._gsap; + cache[property] = value; + cache.renderTransform(ratio, cache); + }, + _transformProp = "transform", + _transformOriginProp = _transformProp + "Origin", + _saveStyle = function _saveStyle(property, isNotCSS) { + var _this = this; + + var target = this.target, + style = target.style, + cache = target._gsap; + + if (property in _transformProps && style) { + this.tfm = this.tfm || {}; + + if (property !== "transform") { + property = _propertyAliases[property] || property; + ~property.indexOf(",") ? property.split(",").forEach(function (a) { + return _this.tfm[a] = _get(target, a); + }) : this.tfm[property] = cache.x ? cache[property] : _get(target, property); + property === _transformOriginProp && (this.tfm.zOrigin = cache.zOrigin); + } else { + return _propertyAliases.transform.split(",").forEach(function (p) { + return _saveStyle.call(_this, p, isNotCSS); }); - }; + } + + if (this.props.indexOf(_transformProp) >= 0) { + return; + } + + if (cache.svg) { + this.svgo = target.getAttribute("data-svg-origin"); + this.props.push(_transformOriginProp, isNotCSS, ""); + } + + property = _transformProp; + } + (style || isNotCSS) && this.props.push(property, isNotCSS, style[property]); + }, + _removeIndependentTransforms = function _removeIndependentTransforms(style) { + if (style.translate) { + style.removeProperty("translate"); + style.removeProperty("scale"); + style.removeProperty("rotate"); + } + }, + _revertStyle = function _revertStyle() { + var props = this.props, + target = this.target, + style = target.style, + cache = target._gsap, + i, + p; + for (i = 0; i < props.length; i += 3) { + props[i + 1] ? target[props[i]] = props[i + 2] : props[i + 2] ? style[props[i]] = props[i + 2] : style.removeProperty(props[i].substr(0, 2) === "--" ? props[i] : props[i].replace(_capsExp, "-$1").toLowerCase()); + } - /************************************************************** - Promise.get( url, options[, resolve[, reject[, finally]]] ) - Get the file at url. + if (this.tfm) { + for (p in this.tfm) { + cache[p] = this.tfm[p]; + } - resolve || options.resolve || options.done = function( response ) - reject || options.reject || options.fail = function( error ) - finally || options.finally || options.always = function( ?? ) + if (cache.svg) { + cache.renderTransform(); + target.setAttribute("data-svg-origin", this.svgo || ""); + } - options - retries: 0 - context: null - format: null (text,json, xml) - useDefaultErrorHandler: true => use defaultErrorHandler even if a reject-function is given + i = _reverting$1(); - **************************************************************/ - function checkStatus(response) { - if (response.status >= 200 && response.status < 300) { - return response; - } - else { - var error = new Error(response.statusText); - error.response = response; - throw error; + if ((!i || !i.isStart) && !style[_transformProp]) { + _removeIndependentTransforms(style); + + if (cache.zOrigin && style[_transformOriginProp]) { + style[_transformOriginProp] += " " + cache.zOrigin + "px"; + cache.zOrigin = 0; + cache.renderTransform(); } + + cache.uncache = 1; + } + } + }, + _getStyleSaver = function _getStyleSaver(target, properties) { + var saver = { + target: target, + props: [], + revert: _revertStyle, + save: _saveStyle + }; + target._gsap || gsap.core.getCache(target); + properties && properties.split(",").forEach(function (p) { + return saver.save(p); + }); + return saver; + }, + _supports3D, + _createElement = function _createElement(type, ns) { + var e = _doc$1.createElementNS ? _doc$1.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc$1.createElement(type); + return e && e.style ? e : _doc$1.createElement(type); + }, + _getComputedProperty = function _getComputedProperty(target, property, skipPrefixFallback) { + var cs = getComputedStyle(target); + return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty(target, _checkPropPrefix(property) || property, 1) || ""; + }, + _prefixes = "O,Moz,ms,Ms,Webkit".split(","), + _checkPropPrefix = function _checkPropPrefix(property, element, preferPrefix) { + var e = element || _tempDiv, + s = e.style, + i = 5; + + if (property in s && !preferPrefix) { + return property; } + property = property.charAt(0).toUpperCase() + property.substr(1); - function parseYAML( response ){ - var json; + while (i-- && !(_prefixes[i] + property in s)) {} - try{ - json = window.YAML.parse(response); - } - catch (e){ - json = undefined; - var error = new Error("Invalid YAML"); - throw error; - } - return json; + return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property; + }, + _initCore = function _initCore() { + if (_windowExists$1() && window.document) { + _win$1 = window; + _doc$1 = _win$1.document; + _docElement = _doc$1.documentElement; + _tempDiv = _createElement("div") || { + style: {} + }; + _tempDivStyler = _createElement("div"); + _transformProp = _checkPropPrefix(_transformProp); + _transformOriginProp = _transformProp + "Origin"; + _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0"; + _supports3D = !!_checkPropPrefix("perspective"); + _reverting$1 = gsap.core.reverting; + _pluginInitted = 1; } + }, + _getBBoxHack = function _getBBoxHack(swapIfPossible) { + var svg = _createElement("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"), + oldParent = this.parentNode, + oldSibling = this.nextSibling, + oldCSS = this.style.cssText, + bbox; - function parseXML( response ){ - //Adjusted xml-parser from jQuery.jQuery.parseXML - var xml; + _docElement.appendChild(svg); - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( response, "text/xml" ); - } - catch ( e ) { - xml = undefined; - } + svg.appendChild(this); + this.style.display = "block"; - if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { - var error = new Error("Invalid XML"); - throw error; - } - return xml; + if (swapIfPossible) { + try { + bbox = this.getBBox(); + this._gsapBBox = this.getBBox; + this.getBBox = _getBBoxHack; + } catch (e) {} + } else if (this._gsapBBox) { + bbox = this._gsapBBox(); } + if (oldParent) { + if (oldSibling) { + oldParent.insertBefore(this, oldSibling); + } else { + oldParent.appendChild(this); + } + } - Promise.get = function(url, options, resolve, reject, fin) { - options = $.extend({}, { - //Default options - url : url, - useDefaultErrorHandler: true, - retries : 0 - }, options || {} ); + _docElement.removeChild(svg); - resolve = resolve || options.resolve || options.done; - reject = reject || options.reject || options.fail; - fin = fin || options.finally || options.always; + this.style.cssText = oldCSS; + return bbox; + }, + _getAttributeFallbacks = function _getAttributeFallbacks(target, attributesArray) { + var i = attributesArray.length; - if (options.context){ - resolve = resolve ? $.proxy( resolve, options.context ) : null; - reject = reject ? $.proxy( reject, options.context ) : null; - fin = fin ? $.proxy( fin, options.context ) : null; - } + while (i--) { + if (target.hasAttribute(attributesArray[i])) { + return target.getAttribute(attributesArray[i]); + } + } + }, + _getBBox = function _getBBox(target) { + var bounds; - var result = - Promise.fetch(url, options) //Get the file - .then(checkStatus); //Check for status of the response + try { + bounds = target.getBBox(); + } catch (error) { + bounds = _getBBoxHack.call(target, true); + } + + bounds && (bounds.width || bounds.height) || target.getBBox === _getBBoxHack || (bounds = _getBBoxHack.call(target, true)); + return bounds && !bounds.width && !bounds.x && !bounds.y ? { + x: +_getAttributeFallbacks(target, ["x", "cx", "x1"]) || 0, + y: +_getAttributeFallbacks(target, ["y", "cy", "y1"]) || 0, + width: 0, + height: 0 + } : bounds; + }, + _isSVG = function _isSVG(e) { + return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e)); + }, + _removeProperty = function _removeProperty(target, property) { + if (property) { + var style = target.style, + first2Chars; - switch (options.format){ - case 'text': - result = - result - .then( function(response) { return response.text(); }); - break; - case 'json': - result = - result - .then( function(response) { return response.text(); }) - .then( JSON.parse ); - break; - case 'yaml': - result = - result - .then( function(response) { return response.text(); }) - .then( parseYAML ); - break; - case 'xml' : - result = - result - .then( function(response) { return response.text(); }) - .then( parseXML ); - break; + if (property in _transformProps && property !== _transformOriginProp) { + property = _transformProp; + } + + if (style.removeProperty) { + first2Chars = property.substr(0, 2); + + if (first2Chars === "ms" || property.substr(0, 6) === "webkit") { + property = "-" + property; } - if (resolve) - result = result.then( resolve ); + style.removeProperty(first2Chars === "--" ? property : property.replace(_capsExp, "-$1").toLowerCase()); + } else { + style.removeAttribute(property); + } + } + }, + _addNonTweeningPT = function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd) { + var pt = new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue); + plugin._pt = pt; + pt.b = beginning; + pt.e = end; - //Adding error/reject promise - var defaultReject = function(reason){ - return callDefaultErrorHandle(reason, options.url); - }; + plugin._props.push(property); - if (reject){ - //If options.useDefaultErrorHandler => also needs to call => Promise.defaultErrorHandler - if (options.useDefaultErrorHandler) - result = result.catch( function( reason ){ - reject( createErrorObject( reason, options.url ) ); - return defaultReject.call( null, reason ); - }); - else - //Just use reject as catch - result = result.catch( function( reason ){ - return reject( createErrorObject( reason, options.url ) ); - }); - } - else - if (!options.useDefaultErrorHandler) - //Prevent the use of Promise.defaultErrorHandler - result = result.catch( function(){} ); + return pt; + }, + _nonConvertibleUnits = { + deg: 1, + rad: 1, + turn: 1 + }, + _nonStandardLayouts = { + grid: 1, + flex: 1 + }, + _convertToUnit = function _convertToUnit(target, property, value, unit) { + var curValue = parseFloat(value) || 0, + curUnit = (value + "").trim().substr((curValue + "").length) || "px", + style = _tempDiv.style, + horizontal = _horizontalExp.test(property), + isRootSVG = target.tagName.toLowerCase() === "svg", + measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"), + amount = 100, + toPixels = unit === "px", + toPercent = unit === "%", + px, + parent, + cache, + isSVG; - //Adding finally (if any) - if (fin || Promise.defaultFinally){ - var finFunc = fin && Promise.defaultFinally ? - function(){ - fin.apply(null, arguments); - Promise.defaultFinally.apply(null, arguments); - } : fin || Promise.defaultFinally; + if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) { + return curValue; + } - result = result.finally( finFunc ); - } + curUnit !== "px" && !toPixels && (curValue = _convertToUnit(target, property, value, "px")); + isSVG = target.getCTM && _isSVG(target); - result.promiseOptions = options; - return result; - }; + if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) { + px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty]; + return _round(toPercent ? curValue / px * amount : curValue / 100 * px); + } - /************************************************************** - Promise.getText( url, options[, resolve[, reject[, finally]]] ) - Same as Promise.get with format = 'text' - **************************************************************/ - Promise.getText = function(url, options, resolve, reject, fin) { - return Promise.get( url, - $.extend( {}, options , { format: 'text' }), - resolve, reject, fin ); - }; + style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit); + parent = ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode; - /************************************************************** - Promise.getJSON( url, options[, resolve[, reject[, finally]]] ) - Same as Promise.get with format = 'json' - **************************************************************/ - Promise.getJSON = function(url, options, resolve, reject, fin) { - return Promise.get( url, - $.extend( {}, options , { format: 'json' }), - resolve, reject, fin ); - }; + if (isSVG) { + parent = (target.ownerSVGElement || {}).parentNode; + } - /************************************************************** - Promise.getXML( url, options[, resolve[, reject[, finally]]] ) - Same as Promise.get with format = 'xml' - **************************************************************/ - Promise.getXML = function(url, options, resolve, reject, fin) { - return Promise.get( url, - $.extend( {}, options , { format: 'xml' }), - resolve, reject, fin ); - }; + if (!parent || parent === _doc$1 || !parent.appendChild) { + parent = _doc$1.body; + } - /************************************************************** - Promise.getYAML( url, options[, resolve[, reject[, finally]]] ) - Same as Promise.get with format = 'yaml'. - Data are converted to json - **************************************************************/ - Promise.getYAML = function(url, options, resolve, reject, fin) { - return Promise.get( url, - $.extend( {}, options , { format: 'yaml' }), - resolve, reject, fin ); - }; + cache = parent._gsap; -}(jQuery, this, Promise, document)); + if (cache && toPercent && cache.width && horizontal && cache.time === _ticker.time && !cache.uncache) { + return _round(curValue / cache.width * amount); + } else { + if (toPercent && (property === "height" || property === "width")) { + var v = target.style[property]; + target.style[property] = amount + unit; + px = target[measureProperty]; + v ? target.style[property] = v : _removeProperty(target, property); + } else { + (toPercent || curUnit === "%") && !_nonStandardLayouts[_getComputedProperty(parent, "display")] && (style.position = _getComputedProperty(target, "position")); + parent === target && (style.position = "static"); + parent.appendChild(_tempDiv); + px = _tempDiv[measureProperty]; + parent.removeChild(_tempDiv); + style.position = "absolute"; + } + if (horizontal && toPercent) { + cache = _getCache(parent); + cache.time = _ticker.time; + cache.width = parent[measureProperty]; + } + } -; -/**************************************************************************** - intervals.js, + return _round(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0); + }, + _get = function _get(target, property, unit, uncache) { + var value; + _pluginInitted || _initCore(); - (c) 2020, FCOO + if (property in _propertyAliases && property !== "transform") { + property = _propertyAliases[property]; - https://github.com/FCOO/intervals - https://github.com/FCOO + if (~property.indexOf(",")) { + property = property.split(",")[0]; + } + } -****************************************************************************/ + if (_transformProps[property] && property !== "transform") { + value = _parseTransform(target, uncache); + value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px"; + } else { + value = target.style[property]; -(function ($, window, document, undefined) { - "use strict"; + if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) { + value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || _getProperty(target, property) || (property === "opacity" ? 1 : 0); + } + } - function Intervals(options) { - this.options = $.extend({ - format : 'JSON', - durationUnit: 'minutes', - promiseOptions: { - noCache: true, + return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value; + }, + _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) { + if (!start || start === "none") { + var p = _checkPropPrefix(prop, target, 1), + s = p && _getComputedProperty(target, p, 1); + + if (s && s !== start) { + prop = p; + start = s; + } else if (prop === "borderColor") { + start = _getComputedProperty(target, "borderTopColor"); + } + } + + var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString), + index = 0, + matchIndex = 0, + a, + result, + startValues, + startNum, + color, + startValue, + endValue, + endNum, + chunk, + endUnit, + startUnit, + endValues; + pt.b = start; + pt.e = end; + start += ""; + end += ""; + + if (end === "auto") { + startValue = target.style[prop]; + target.style[prop] = end; + end = _getComputedProperty(target, prop) || end; + startValue ? target.style[prop] = startValue : _removeProperty(target, prop); + } + + a = [start, end]; + + _colorStringFilter(a); + + start = a[0]; + end = a[1]; + startValues = start.match(_numWithUnitExp) || []; + endValues = end.match(_numWithUnitExp) || []; + + if (endValues.length) { + while (result = _numWithUnitExp.exec(end)) { + endValue = result[0]; + chunk = end.substring(index, result.index); + + if (color) { + color = (color + 1) % 5; + } else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") { + color = 1; + } + + if (endValue !== (startValue = startValues[matchIndex++] || "")) { + startNum = parseFloat(startValue) || 0; + startUnit = startValue.substr((startNum + "").length); + endValue.charAt(1) === "=" && (endValue = _parseRelative(startNum, endValue) + startUnit); + endNum = parseFloat(endValue); + endUnit = endValue.substr((endNum + "").length); + index = _numWithUnitExp.lastIndex - endUnit.length; + + if (!endUnit) { + endUnit = endUnit || _config.units[prop] || startUnit; + + if (index === end.length) { + end += endUnit; + pt.e += endUnit; } - }, options || {} ); + } - this.durationList = []; //[]{lastFloorMoment: MOMENT, list: []{fileNameOrData, resolve} + if (startUnit !== endUnit) { + startNum = _convertToUnit(target, prop, startValue, endUnit) || 0; + } + pt._pt = { + _next: pt._pt, + p: chunk || matchIndex === 1 ? chunk : ",", + s: startNum, + c: endNum - startNum, + m: color && color < 4 || prop === "zIndex" ? Math.round : 0 + }; + } + } + pt.c = index < end.length ? end.substring(index, end.length) : ""; + } else { + pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue; } - Intervals.prototype = { - isFileName: function(fileNameOrData){ - return $.type(fileNameOrData) == 'string'; - }, - getFileName: function(fileName){ - return fileName; - }, + _relExp.test(end) && (pt.e = 0); + this._pt = pt; + return pt; + }, + _keywordToPercent = { + top: "0%", + bottom: "100%", + left: "0%", + right: "100%", + center: "50%" + }, + _convertKeywordsToPercentages = function _convertKeywordsToPercentages(value) { + var split = value.split(" "), + x = split[0], + y = split[1] || "50%"; - /************************************************************************* - addInterval(options) - options: {duration, fileNameOrData, resolve, context, wait, format, promiseOptions} - Add a reload of fileNameOrData with resolve-function - Will reload every rounded duration. Eq duration = "10 minutes" => called HH:00, HH:10, HH:20,... - If wait == false => also call the resolve on creation - *************************************************************************/ - addInterval: function( options ){ - options = $.extend({}, this.options, options ); - return this.addIntervalObject( new Interval(options, this) ); - }, + if (x === "top" || x === "bottom" || y === "left" || y === "right") { + value = x; + x = y; + y = value; + } - addIntervalObject: function( interval, neverWait ){ - var options = interval.options, - intervalGroup = this.durationList[options.duration] = this.durationList[options.duration] || {}; + split[0] = _keywordToPercent[x] || x; + split[1] = _keywordToPercent[y] || y; + return split.join(" "); + }, + _renderClearProps = function _renderClearProps(ratio, data) { + if (data.tween && data.tween._time === data.tween._dur) { + var target = data.t, + style = target.style, + props = data.u, + cache = target._gsap, + prop, + clearTransforms, + i; + + if (props === "all" || props === true) { + style.cssText = ""; + clearTransforms = 1; + } else { + props = props.split(","); + i = props.length; - intervalGroup.list = intervalGroup.list || {}; - intervalGroup.list[interval.id] = interval; + while (--i > -1) { + prop = props[i]; - if (!options.wait && !neverWait) - interval.exec(); + if (_transformProps[prop]) { + clearTransforms = 1; + prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp; + } - if (!intervalGroup.timeoutId) - intervalGroup.timeoutId = this.intervalTimeout(options.duration, true); + _removeProperty(target, prop); + } + } - return interval; - }, + if (clearTransforms) { + _removeProperty(target, _transformProp); - /************************************************************************* - intervalTimeout(durationMinutes, dontResolve) - *************************************************************************/ - intervalTimeout: function(duration, dontResolve){ - var _this = this, - intervalGroup = this.durationList[duration], - nowFloorMoment = moment().floor(duration, this.options.durationUnit), - nextFloorMoment = moment(nowFloorMoment).add(duration, this.options.durationUnit); + if (cache) { + cache.svg && target.removeAttribute("transform"); - if (intervalGroup.timeoutId){ - window.clearTimeout(intervalGroup.timeoutId); - intervalGroup.timeoutId = null; - } + _parseTransform(target, 1); - if (!$.isEmptyObject(intervalGroup.list)) - intervalGroup.timeoutId = window.setTimeout( function(){_this.intervalTimeout(duration);}, nextFloorMoment.diff(moment()) ); + cache.uncache = 1; - //Check if we need to call resolves - if (!intervalGroup.lastFloorMoment || !nowFloorMoment.isSame(intervalGroup.lastFloorMoment)){ - intervalGroup.lastFloorMoment = nowFloorMoment; - if (!dontResolve) - $.each(intervalGroup.list, function(id, intervalRec){ intervalRec.exec(); }); - } - }, - }; + _removeIndependentTransforms(style); + } + } + } + }, + _specialProps = { + clearProps: function clearProps(plugin, target, property, endValue, tween) { + if (tween.data !== "isFromStart") { + var pt = plugin._pt = new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps); + pt.u = endValue; + pt.pr = -10; + pt.tween = tween; - // expose access to the constructor - window.Intervals = Intervals; + plugin._props.push(property); + + return 1; + } + } + }, + _identity2DMatrix = [1, 0, 0, 1, 0, 0], + _rotationalProperties = {}, + _isNullTransform = function _isNullTransform(value) { + return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value; + }, + _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray(target) { + var matrixString = _getComputedProperty(target, _transformProp); + return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match(_numExp).map(_round); + }, + _getMatrix = function _getMatrix(target, force2D) { + var cache = target._gsap || _getCache(target), + style = target.style, + matrix = _getComputedTransformMatrixAsArray(target), + parent, + nextSibling, + temp, + addedToDOM; - /************************************************************************* - Interval - Represent one loading of file or data - *************************************************************************/ - var intervalId = 0; - function Interval(options, intervals) { - this.id = 'interval' + intervalId++; - this.options = $.extend({ - }, options || {} ); + if (cache.svg && target.getAttribute("transform")) { + temp = target.transform.baseVal.consolidate().matrix; + matrix = [temp.a, temp.b, temp.c, temp.d, temp.e, temp.f]; + return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix; + } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) { + temp = style.display; + style.display = "block"; + parent = target.parentNode; + if (!parent || !target.offsetParent) { + addedToDOM = 1; + nextSibling = target.nextElementSibling; - this.options.fileNameOrData = this.options.fileNameOrData || this.options.fileName || this.options.data; - this.intervals = intervals; + _docElement.appendChild(target); + } - if (this.options.context){ - this.options.resolve = this.options.resolve ? $.proxy(this.options.resolve, this.options.context) : null; - this.options.reject = this.options.reject ? $.proxy(this.options.reject, this.options.context) : null; - } + matrix = _getComputedTransformMatrixAsArray(target); + temp ? style.display = temp : _removeProperty(target, "display"); + if (addedToDOM) { + nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target); + } } - Interval.prototype = { - //setDuration(duration) - setDuration: function(duration){ - if (duration != this.options.duration){ - if (this.options.duration) - //Remove this from the current duration-list - this.remove(); + return force2D && matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]] : matrix; + }, + _applySVGOrigin = function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) { + var cache = target._gsap, + matrix = matrixArray || _getMatrix(target, true), + xOriginOld = cache.xOrigin || 0, + yOriginOld = cache.yOrigin || 0, + xOffsetOld = cache.xOffset || 0, + yOffsetOld = cache.yOffset || 0, + a = matrix[0], + b = matrix[1], + c = matrix[2], + d = matrix[3], + tx = matrix[4], + ty = matrix[5], + originSplit = origin.split(" "), + xOrigin = parseFloat(originSplit[0]) || 0, + yOrigin = parseFloat(originSplit[1]) || 0, + bounds, + determinant, + x, + y; + + if (!originIsAbsolute) { + bounds = _getBBox(target); + xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * bounds.width : xOrigin); + yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin); + } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) { + x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant; + y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant; + xOrigin = x; + yOrigin = y; + } + + if (smooth || smooth !== false && cache.smooth) { + tx = xOrigin - xOriginOld; + ty = yOrigin - yOriginOld; + cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx; + cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty; + } else { + cache.xOffset = cache.yOffset = 0; + } - //Add this to new durationList - this.options.duration = duration; - this.intervals.addIntervalObject(this, true); - } - }, + cache.xOrigin = xOrigin; + cache.yOrigin = yOrigin; + cache.smooth = !!smooth; + cache.origin = origin; + cache.originIsAbsolute = !!originIsAbsolute; + target.style[_transformOriginProp] = "0px 0px"; - //remove - Remove this from the current duration-list - remove: function(){ - delete this.intervals.durationList[this.options.duration].list[this.id]; - return this; - }, + if (pluginToAddPropTweensTo) { + _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin); - //paus(period, wait) - paus: function(period, wait){ - var _this = this; - this.options.wait = wait !== undefined ? wait : this.options.wait; - this.remove(); - this.onHold = true; - window.setTimeout( $.proxy(_this._restart, _this), moment.duration(period, this.intervals.options.durationUnit).asMilliseconds() ); - }, + _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin); - _restart: function(){ - this.onHold = false; - this.intervals.addIntervalObject(this); - }, + _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset); - //exec - "Run" the promise for the interval - exec: function(){ - if (this.onHold) return; + _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset); + } - var _this = this; - if (this.intervals.isFileName(this.options.fileNameOrData)){ - //File-name is given => load file - var promiseOptions = - $.extend({ - resolve: this.options.resolve ? $.proxy(this._resolve, this) : null, - reject : this.options.reject ? function(error){ _this.options.reject (error, _this); } : null - }, this.options.promiseOptions); + target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin); + }, + _parseTransform = function _parseTransform(target, uncache) { + var cache = target._gsap || new GSCache(target); + if ("x" in cache && !uncache && !cache.uncache) { + return cache; + } - var fileName = this.intervals.getFileName(this.options.fileNameOrData); + var style = target.style, + invertedScaleX = cache.scaleX < 0, + px = "px", + deg = "deg", + cs = getComputedStyle(target), + origin = _getComputedProperty(target, _transformOriginProp) || "0", + x, + y, + z, + scaleX, + scaleY, + rotation, + rotationX, + rotationY, + skewX, + skewY, + perspective, + xOrigin, + yOrigin, + matrix, + angle, + cos, + sin, + a, + b, + c, + d, + a12, + a22, + t1, + t2, + t3, + a13, + a23, + a33, + a42, + a43, + a32; + x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0; + scaleX = scaleY = 1; + cache.svg = !!(target.getCTM && _isSVG(target)); + + if (cs.translate) { + if (cs.translate !== "none" || cs.scale !== "none" || cs.rotate !== "none") { + style[_transformProp] = (cs.translate !== "none" ? "translate3d(" + (cs.translate + " 0 0").split(" ").slice(0, 3).join(", ") + ") " : "") + (cs.rotate !== "none" ? "rotate(" + cs.rotate + ") " : "") + (cs.scale !== "none" ? "scale(" + cs.scale.split(" ").join(",") + ") " : "") + (cs[_transformProp] !== "none" ? cs[_transformProp] : ""); + } + + style.scale = style.rotate = style.translate = "none"; + } + + matrix = _getMatrix(target, cache.svg); + + if (cache.svg) { + if (cache.uncache) { + t2 = target.getBBox(); + origin = cache.xOrigin - t2.x + "px " + (cache.yOrigin - t2.y) + "px"; + t1 = ""; + } else { + t1 = !uncache && target.getAttribute("data-svg-origin"); + } - switch (this.options.format.toUpperCase()){ - case 'JSON' : window.Promise.getJSON(fileName, promiseOptions ); break; - case 'XML' : window.Promise.getXML (fileName, promiseOptions ); break; - default : window.Promise.getText(fileName, promiseOptions ); break; - } - } - else - //Data is given => resolve them - this.options.resolve(this.options.fileNameOrData); - }, - _resolve: function(data){ - var arg = [data]; - if (this.options.resolveArguments) - arg = arg.concat(this.options.resolveArguments); - else - arg = arg.concat([this]); - this.options.resolve.apply(null, arg); + _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix); + } + + xOrigin = cache.xOrigin || 0; + yOrigin = cache.yOrigin || 0; + + if (matrix !== _identity2DMatrix) { + a = matrix[0]; + b = matrix[1]; + c = matrix[2]; + d = matrix[3]; + x = a12 = matrix[4]; + y = a22 = matrix[5]; + + if (matrix.length === 6) { + scaleX = Math.sqrt(a * a + b * b); + scaleY = Math.sqrt(d * d + c * c); + rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0; + skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0; + skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD))); + + if (cache.svg) { + x -= xOrigin - (xOrigin * a + yOrigin * c); + y -= yOrigin - (xOrigin * b + yOrigin * d); } + } else { + a32 = matrix[6]; + a42 = matrix[7]; + a13 = matrix[8]; + a23 = matrix[9]; + a33 = matrix[10]; + a43 = matrix[11]; + x = matrix[12]; + y = matrix[13]; + z = matrix[14]; + angle = _atan2(a32, a33); + rotationX = angle * _RAD2DEG; + + if (angle) { + cos = Math.cos(-angle); + sin = Math.sin(-angle); + t1 = a12 * cos + a13 * sin; + t2 = a22 * cos + a23 * sin; + t3 = a32 * cos + a33 * sin; + a13 = a12 * -sin + a13 * cos; + a23 = a22 * -sin + a23 * cos; + a33 = a32 * -sin + a33 * cos; + a43 = a42 * -sin + a43 * cos; + a12 = t1; + a22 = t2; + a32 = t3; + } + + angle = _atan2(-c, a33); + rotationY = angle * _RAD2DEG; + + if (angle) { + cos = Math.cos(-angle); + sin = Math.sin(-angle); + t1 = a * cos - a13 * sin; + t2 = b * cos - a23 * sin; + t3 = c * cos - a33 * sin; + a43 = d * sin + a43 * cos; + a = t1; + b = t2; + c = t3; + } + + angle = _atan2(b, a); + rotation = angle * _RAD2DEG; + + if (angle) { + cos = Math.cos(angle); + sin = Math.sin(angle); + t1 = a * cos + b * sin; + t2 = a12 * cos + a22 * sin; + b = b * cos - a * sin; + a22 = a22 * cos - a12 * sin; + a = t1; + a12 = t2; + } + + if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) { + rotationX = rotation = 0; + rotationY = 180 - rotationY; + } + + scaleX = _round(Math.sqrt(a * a + b * b + c * c)); + scaleY = _round(Math.sqrt(a22 * a22 + a32 * a32)); + angle = _atan2(a12, a22); + skewX = Math.abs(angle) > 0.0002 ? angle * _RAD2DEG : 0; + perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0; + } + + if (cache.svg) { + t1 = target.getAttribute("transform"); + cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp)); + t1 && target.setAttribute("transform", t1); + } + } + + if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) { + if (invertedScaleX) { + scaleX *= -1; + skewX += rotation <= 0 ? 180 : -180; + rotation += rotation <= 0 ? 180 : -180; + } else { + scaleY *= -1; + skewX += skewX <= 0 ? 180 : -180; + } + } + uncache = uncache || cache.uncache; + cache.x = x - ((cache.xPercent = x && (!uncache && cache.xPercent || (Math.round(target.offsetWidth / 2) === Math.round(-x) ? -50 : 0))) ? target.offsetWidth * cache.xPercent / 100 : 0) + px; + cache.y = y - ((cache.yPercent = y && (!uncache && cache.yPercent || (Math.round(target.offsetHeight / 2) === Math.round(-y) ? -50 : 0))) ? target.offsetHeight * cache.yPercent / 100 : 0) + px; + cache.z = z + px; + cache.scaleX = _round(scaleX); + cache.scaleY = _round(scaleY); + cache.rotation = _round(rotation) + deg; + cache.rotationX = _round(rotationX) + deg; + cache.rotationY = _round(rotationY) + deg; + cache.skewX = skewX + deg; + cache.skewY = skewY + deg; + cache.transformPerspective = perspective + px; + if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || !uncache && cache.zOrigin || 0) { + style[_transformOriginProp] = _firstTwoOnly(origin); + } - }; + cache.xOffset = cache.yOffset = 0; + cache.force3D = _config.force3D; + cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms; + cache.uncache = 0; + return cache; + }, + _firstTwoOnly = function _firstTwoOnly(value) { + return (value = value.split(" "))[0] + " " + value[1]; + }, + _addPxTranslate = function _addPxTranslate(target, start, value) { + var unit = getUnit(start); + return _round(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit; + }, + _renderNon3DTransforms = function _renderNon3DTransforms(ratio, cache) { + cache.z = "0px"; + cache.rotationY = cache.rotationX = "0deg"; + cache.force3D = 0; - //Create default intervals - window.intervals = new Intervals(); + _renderCSSTransforms(ratio, cache); + }, + _zeroDeg = "0deg", + _zeroPx = "0px", + _endParenthesis = ") ", + _renderCSSTransforms = function _renderCSSTransforms(ratio, cache) { + var _ref = cache || this, + xPercent = _ref.xPercent, + yPercent = _ref.yPercent, + x = _ref.x, + y = _ref.y, + z = _ref.z, + rotation = _ref.rotation, + rotationY = _ref.rotationY, + rotationX = _ref.rotationX, + skewX = _ref.skewX, + skewY = _ref.skewY, + scaleX = _ref.scaleX, + scaleY = _ref.scaleY, + transformPerspective = _ref.transformPerspective, + force3D = _ref.force3D, + target = _ref.target, + zOrigin = _ref.zOrigin, + transforms = "", + use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true; -}(jQuery, this, document)); -; -/**************************************************************************** - promise-list.js, + if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) { + var angle = parseFloat(rotationY) * _DEG2RAD, + a13 = Math.sin(angle), + a33 = Math.cos(angle), + cos; - (c) 2020, FCOO + angle = parseFloat(rotationX) * _DEG2RAD; + cos = Math.cos(angle); + x = _addPxTranslate(target, x, a13 * cos * -zOrigin); + y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin); + z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin); + } - https://github.com/FCOO/promise-list - https://github.com/FCOO + if (transformPerspective !== _zeroPx) { + transforms += "perspective(" + transformPerspective + _endParenthesis; + } -****************************************************************************/ + if (xPercent || yPercent) { + transforms += "translate(" + xPercent + "%, " + yPercent + "%) "; + } -(function ($, window/*, document, undefined*/) { - "use strict"; + if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) { + transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis; + } + if (rotation !== _zeroDeg) { + transforms += "rotate(" + rotation + _endParenthesis; + } - function PromiseList( options) { - this.options = $.extend({ - //Default options - }, options || {} ); + if (rotationY !== _zeroDeg) { + transforms += "rotateY(" + rotationY + _endParenthesis; + } - this.firstList = []; - this.list = []; - this.lastList = []; + if (rotationX !== _zeroDeg) { + transforms += "rotateX(" + rotationX + _endParenthesis; + } + if (skewX !== _zeroDeg || skewY !== _zeroDeg) { + transforms += "skew(" + skewX + ", " + skewY + _endParenthesis; } - window.PromiseList = PromiseList; - //asArray(options) - convert options into []OPTIONS - function asArray(options){ - return options ? ($.isArray(options) ? options : [options]) : []; + if (scaleX !== 1 || scaleY !== 1) { + transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis; } + target.style[_transformProp] = transforms || "translate(0, 0)"; + }, + _renderSVGTransforms = function _renderSVGTransforms(ratio, cache) { + var _ref2 = cache || this, + xPercent = _ref2.xPercent, + yPercent = _ref2.yPercent, + x = _ref2.x, + y = _ref2.y, + rotation = _ref2.rotation, + skewX = _ref2.skewX, + skewY = _ref2.skewY, + scaleX = _ref2.scaleX, + scaleY = _ref2.scaleY, + target = _ref2.target, + xOrigin = _ref2.xOrigin, + yOrigin = _ref2.yOrigin, + xOffset = _ref2.xOffset, + yOffset = _ref2.yOffset, + forceCSS = _ref2.forceCSS, + tx = parseFloat(x), + ty = parseFloat(y), + a11, + a21, + a12, + a22, + temp; + + rotation = parseFloat(rotation); + skewX = parseFloat(skewX); + skewY = parseFloat(skewY); + + if (skewY) { + skewY = parseFloat(skewY); + skewX += skewY; + rotation += skewY; + } + + if (rotation || skewX) { + rotation *= _DEG2RAD; + skewX *= _DEG2RAD; + a11 = Math.cos(rotation) * scaleX; + a21 = Math.sin(rotation) * scaleX; + a12 = Math.sin(rotation - skewX) * -scaleY; + a22 = Math.cos(rotation - skewX) * scaleY; + + if (skewX) { + skewY *= _DEG2RAD; + temp = Math.tan(skewX - skewY); + temp = Math.sqrt(1 + temp * temp); + a12 *= temp; + a22 *= temp; + + if (skewY) { + temp = Math.tan(skewY); + temp = Math.sqrt(1 + temp * temp); + a11 *= temp; + a21 *= temp; + } + } + + a11 = _round(a11); + a21 = _round(a21); + a12 = _round(a12); + a22 = _round(a22); + } else { + a11 = scaleX; + a22 = scaleY; + a21 = a12 = 0; + } - //Extend the prototype - window.PromiseList.prototype = { + if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) { + tx = _convertToUnit(target, "x", x, "px"); + ty = _convertToUnit(target, "y", y, "px"); + } - //append( options ) - append: function( options, listId ){ - listId = listId || 'list'; - this[listId] = this[listId].concat( asArray(options) ); - return this; - }, - appendFirst: function( options ){ - return this.append( options, 'firstList'); - }, - appendLast: function( options ){ - return this.append( options, 'lastList'); - }, + if (xOrigin || yOrigin || xOffset || yOffset) { + tx = _round(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset); + ty = _round(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset); + } - //prepend( options ) - prepend: function( options, listId ){ - listId = listId || 'list'; - this[listId] = asArray(options).concat( this[listId] ); - return this; - }, - prependFirst: function( options ){ - return this.prepend( options, 'firstList'); - }, - prependLast: function( options ){ - return this.prepend( options, 'lastList'); - }, + if (xPercent || yPercent) { + temp = target.getBBox(); + tx = _round(tx + xPercent / 100 * temp.width); + ty = _round(ty + yPercent / 100 * temp.height); + } - _createAllList: function(){ - var _this = this; - this.allList = []; - $.each([this.firstList, this.list, this.lastList], function(index, list){ - $.each(list, function(index, item){ - _this.allList.push(item); - }); - }); - }, + temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")"; + target.setAttribute("transform", temp); + forceCSS && (target.style[_transformProp] = temp); + }, + _addRotationalPropTween = function _addRotationalPropTween(plugin, target, property, startNum, endValue) { + var cap = 360, + isString = _isString(endValue), + endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1), + change = endNum - startNum, + finalValue = startNum + change + "deg", + direction, + pt; - //promiseAll = same as getAll - promiseAll: function(){ - return this.getAll.apply(this, arguments); - }, + if (isString) { + direction = endValue.split("_")[1]; - //getAll( reject ) - get all added promises - getAll: function( reject ){ - var _this = this; + if (direction === "short") { + change %= cap; - //Create this.allList as this.firstList, this.list, this.lastlist - this._createAllList(); + if (change !== change % (cap / 2)) { + change += change < 0 ? cap : -cap; + } + } - if (this.options.prePromiseAll){ -// this.allList = this.options.prePromiseAll(this.allList, this) || this.allList; - var prePromiseAllList = $.isArray(this.options.prePromiseAll) ? this.options.prePromiseAll : [this.options.prePromiseAll]; - prePromiseAllList.forEach( function( prePromise ){ - _this.allList = prePromise(_this.allList, _this) || _this.allList; - }); - } + if (direction === "cw" && change < 0) { + change = (change + cap * _bigNum$1) % cap - ~~(change / cap) * cap; + } else if (direction === "ccw" && change > 0) { + change = (change - cap * _bigNum$1) % cap - ~~(change / cap) * cap; + } + } - //Create list of all remaining promises and options - this.promiseList = []; - this.optionsList = []; + plugin._pt = pt = new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd); + pt.e = finalValue; + pt.u = "deg"; - $.each(this.allList, function(index, options){ - //Skip allready resolved promise - if (options.isResolved) - return true; + plugin._props.push(property); - var promise; - if (options.fileName){ - var get; - options.format = options.format ? options.format.toUpperCase() : 'JSON'; - switch (options.format){ - case 'JSON' : get = window.Promise.getJSON; break; - case 'XML' : get = window.Promise.getXML; break; - default : get = window.Promise.getText; break; - } + return pt; + }, + _assign = function _assign(target, source) { + for (var p in source) { + target[p] = source[p]; + } - if ($.isArray(options.fileName)) - promise = Promise.all( - options.fileName.map( function(fName){ - return get( window.intervals.getFileName(fName), options.promiseOptions); - }) - ); - else - //File-name is given => use intervals.getFileName to convert filename and load it - promise = get( window.intervals.getFileName(options.fileName), options.promiseOptions ); - } - else - if (options.data) - //Data is given => resolve them - promise = new Promise(function(resolve/*, reject*/) { - resolve(options.data); - }); - else - return; + return target; + }, + _addRawTransformPTs = function _addRawTransformPTs(plugin, transforms, target) { + var startCache = _assign({}, target._gsap), + exclude = "perspective,force3D,transformOrigin,svgOrigin", + style = target.style, + endCache, + p, + startValue, + endValue, + startNum, + endNum, + startUnit, + endUnit; + + if (startCache.svg) { + startValue = target.getAttribute("transform"); + target.setAttribute("transform", ""); + style[_transformProp] = transforms; + endCache = _parseTransform(target, 1); + + _removeProperty(target, _transformProp); + + target.setAttribute("transform", startValue); + } else { + startValue = getComputedStyle(target)[_transformProp]; + style[_transformProp] = transforms; + endCache = _parseTransform(target, 1); + style[_transformProp] = startValue; + } - _this.promiseList.push(promise); - _this.optionsList.push(options); + for (p in _transformProps) { + startValue = startCache[p]; + endValue = endCache[p]; - //Set as resolved to prevent loop if reject - options.isResolved = true; + if (startValue !== endValue && exclude.indexOf(p) < 0) { + startUnit = getUnit(startValue); + endUnit = getUnit(endValue); + startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue); + endNum = parseFloat(endValue); + plugin._pt = new PropTween(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp); + plugin._pt.u = endUnit || 0; - //If the promise must wait before loading the rest => exit - if (options.wait) - return false; - }); + plugin._props.push(p); + } + } - Promise.all( this.promiseList ) - .then ( $.proxy(this._then, this) ) - .catch ( reject || this.options.reject || function(){} ) - .finally( $.proxy(this._finally, this) ); - }, + _assign(endCache, startCache); + }; - _then: function( dataList ){ - var _this = this; - $.each(dataList, function(index, data){ - var opt = _this.optionsList[index]; + _forEachName("padding,margin,Width,Radius", function (name, index) { + var t = "Top", + r = "Right", + b = "Bottom", + l = "Left", + props = (index < 3 ? [t, r, b, l] : [t + l, t + r, b + r, b + l]).map(function (side) { + return index < 2 ? name + side : "border" + side + name; + }); - //Call the resolve-function - opt.resolve(data, opt, _this); + _specialProps[index > 1 ? "border" + name : name] = function (plugin, target, property, endValue, tween) { + var a, vars; - opt.isResolved = true; + if (arguments.length < 4) { + a = props.map(function (prop) { + return _get(plugin, prop, property); + }); + vars = a.join(" "); + return vars.split(a[0]).length === 5 ? a[0] : vars; + } - //If the file/data needs to reload with some interval => adds the resolve to windows.intervals.addInterval after the first load - if (opt.reload) - window.intervals.addInterval({ - duration : opt.reload === true ? 60 : opt.reload, - fileName : opt.fileName, - data : opt.data, - resolve : opt.resolve, - resolveArguments: [opt, _this], - reject : null, - wait : true - }); - }); - return true; - }, + a = (endValue + "").split(" "); + vars = {}; + props.forEach(function (prop, i) { + return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0]; + }); + plugin.init(target, vars, tween); + }; + }); - _finally: function(){ - //Check if there are still promise(s) not resolved - var notResolvedFound = false; - this._createAllList(); - $.each(this.allList, function(index, options){ - notResolvedFound = notResolvedFound || !options.isResolved; - }); + var CSSPlugin = { + name: "css", + register: _initCore, + targetTest: function targetTest(target) { + return target.style && target.nodeType; + }, + init: function init(target, vars, tween, index, targets) { + var props = this._props, + style = target.style, + startAt = tween.vars.startAt, + startValue, + endValue, + endNum, + startNum, + type, + specialProp, + p, + startUnit, + endUnit, + relative, + isTransformRelated, + transformPropTween, + cache, + smooth, + hasPriority, + inlineProps; + _pluginInitted || _initCore(); + this.styles = this.styles || _getStyleSaver(target); + inlineProps = this.styles.props; + this.tween = tween; + + for (p in vars) { + if (p === "autoRound") { + continue; + } - //Check if there are more promises in the list - if (notResolvedFound) - this.getAll(); - else { - this._callFuncList('finally'); - this._callFuncList('finish'); - } - }, + endValue = vars[p]; - _callFuncList: function( optionsName ){ - var _this = this, - funcList = this.options[optionsName]; - if (funcList){ - funcList = $.isArray(funcList) ? funcList : [funcList]; - funcList.forEach( function( func ){ - func(_this); - }); - } + if (_plugins[p] && _checkPlugin(p, vars, tween, index, target, targets)) { + continue; } - }; -}(jQuery, this, document)); -; -/**************************************************************************** - fcoo-promise-list.js, + type = typeof endValue; + specialProp = _specialProps[p]; - (c) 2020, FCOO + if (type === "function") { + endValue = endValue.call(tween, index, target, targets); + type = typeof endValue; + } - https://github.com/FCOO/fcoo-promise-list - https://github.com/FCOO + if (type === "string" && ~endValue.indexOf("random(")) { + endValue = _replaceRandom(endValue); + } -****************************************************************************/ + if (specialProp) { + specialProp(this, target, p, endValue, tween) && (hasPriority = 1); + } else if (p.substr(0, 2) === "--") { + startValue = (getComputedStyle(target).getPropertyValue(p) + "").trim(); + endValue += ""; + _colorExp.lastIndex = 0; -(function (window/*, document, undefined*/) { - "use strict"; + if (!_colorExp.test(startValue)) { + startUnit = getUnit(startValue); + endUnit = getUnit(endValue); + } - //Create fcoo-namespace - var ns = window.fcoo = window.fcoo || {}; + endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit); + this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p); + props.push(p); + inlineProps.push(p, 0, style[p]); + } else if (type !== "undefined") { + if (startAt && p in startAt) { + startValue = typeof startAt[p] === "function" ? startAt[p].call(tween, index, target, targets) : startAt[p]; + _isString(startValue) && ~startValue.indexOf("random(") && (startValue = _replaceRandom(startValue)); + getUnit(startValue + "") || startValue === "auto" || (startValue += _config.units[p] || getUnit(_get(target, p)) || ""); + (startValue + "").charAt(1) === "=" && (startValue = _get(target, p)); + } else { + startValue = _get(target, p); + } - //Overwrite intervals.isFileName and window.intervals.getFileName to use FCOO filename conventions - window.intervals.isFileName = function(fileNameOrData){ - return (($.type(fileNameOrData) == 'string') || (fileNameOrData.subDir && fileNameOrData.fileName)); - }; + startNum = parseFloat(startValue); + relative = type === "string" && endValue.charAt(1) === "=" && endValue.substr(0, 2); + relative && (endValue = endValue.substr(2)); + endNum = parseFloat(endValue); - window.intervals.getFileName = function(fileName){ - return ns.dataFilePath(fileName); - }; + if (p in _propertyAliases) { + if (p === "autoAlpha") { + if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) { + startNum = 0; + } - //Create common FCOO PromiseList - ns.promiseList = new window.PromiseList({ + inlineProps.push("visibility", 0, style.visibility); - }); + _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum); + } -}(this, document)); -; -/* - * jQuery.bind-first library v0.2.3 - * Copyright (c) 2013 Vladimir Zhuravlev - * - * Released under MIT License - * @license - * - * Date: Thu Feb 6 10:13:59 ICT 2014 - **/ + if (p !== "scale" && p !== "transform") { + p = _propertyAliases[p]; + ~p.indexOf(",") && (p = p.split(",")[0]); + } + } -(function($) { - var splitVersion = $.fn.jquery.split("."); - var major = parseInt(splitVersion[0]); - var minor = parseInt(splitVersion[1]); + isTransformRelated = p in _transformProps; - var JQ_LT_17 = (major < 1) || (major == 1 && minor < 7); - - function eventsData($el) { - return JQ_LT_17 ? $el.data('events') : $._data($el[0]).events; - } - - function moveHandlerToTop($el, eventName, isDelegated) { - var data = eventsData($el); - var events = data[eventName]; + if (isTransformRelated) { + this.styles.save(p); - if (!JQ_LT_17) { - var handler = isDelegated ? events.splice(events.delegateCount - 1, 1)[0] : events.pop(); - events.splice(isDelegated ? 0 : (events.delegateCount || 0), 0, handler); + if (!transformPropTween) { + cache = target._gsap; + cache.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform); + smooth = vars.smoothOrigin !== false && cache.smooth; + transformPropTween = this._pt = new PropTween(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1); + transformPropTween.dep = 1; + } - return; - } + if (p === "scale") { + this._pt = new PropTween(this._pt, cache, "scaleY", cache.scaleY, (relative ? _parseRelative(cache.scaleY, relative + endNum) : endNum) - cache.scaleY || 0, _renderCSSProp); + this._pt.u = 0; + props.push("scaleY", p); + p += "X"; + } else if (p === "transformOrigin") { + inlineProps.push(_transformOriginProp, 0, style[_transformOriginProp]); + endValue = _convertKeywordsToPercentages(endValue); - if (isDelegated) { - data.live.unshift(data.live.pop()); - } else { - events.unshift(events.pop()); - } - } - - function moveEventHandlers($elems, eventsString, isDelegate) { - var events = eventsString.split(/\s+/); - $elems.each(function() { - for (var i = 0; i < events.length; ++i) { - var pureEventName = $.trim(events[i]).match(/[^\.]+/i)[0]; - moveHandlerToTop($(this), pureEventName, isDelegate); - } - }); - } - - function makeMethod(methodName) { - $.fn[methodName + 'First'] = function() { - var args = $.makeArray(arguments); - var eventsString = args.shift(); + if (cache.svg) { + _applySVGOrigin(target, endValue, 0, smooth, 0, this); + } else { + endUnit = parseFloat(endValue.split(" ")[2]) || 0; + endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit); - if (eventsString) { - $.fn[methodName].apply(this, arguments); - moveEventHandlers(this, eventsString); - } + _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue)); + } - return this; - } - } + continue; + } else if (p === "svgOrigin") { + _applySVGOrigin(target, endValue, 1, smooth, 0, this); - // bind - makeMethod('bind'); + continue; + } else if (p in _rotationalProperties) { + _addRotationalPropTween(this, cache, p, startNum, relative ? _parseRelative(startNum, relative + endValue) : endValue); - // one - makeMethod('one'); + continue; + } else if (p === "smoothOrigin") { + _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue); - // delegate - $.fn.delegateFirst = function() { - var args = $.makeArray(arguments); - var eventsString = args[1]; - - if (eventsString) { - args.splice(0, 2); - $.fn.delegate.apply(this, arguments); - moveEventHandlers(this, eventsString, true); - } + continue; + } else if (p === "force3D") { + cache[p] = endValue; + continue; + } else if (p === "transform") { + _addRawTransformPTs(this, endValue, target); - return this; - }; + continue; + } + } else if (!(p in style)) { + p = _checkPropPrefix(p) || p; + } - // live - $.fn.liveFirst = function() { - var args = $.makeArray(arguments); + if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) { + startUnit = (startValue + "").substr((startNum + "").length); + endNum || (endNum = 0); + endUnit = getUnit(endValue) || (p in _config.units ? _config.units[p] : startUnit); + startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit)); + this._pt = new PropTween(this._pt, isTransformRelated ? cache : style, p, startNum, (relative ? _parseRelative(startNum, relative + endNum) : endNum) - startNum, !isTransformRelated && (endUnit === "px" || p === "zIndex") && vars.autoRound !== false ? _renderRoundedCSSProp : _renderCSSProp); + this._pt.u = endUnit || 0; - // live = delegate to the document - args.unshift(this.selector); - $.fn.delegateFirst.apply($(document), args); + if (startUnit !== endUnit && endUnit !== "%") { + this._pt.b = startValue; + this._pt.r = _renderCSSPropWithBeginning; + } + } else if (!(p in style)) { + if (p in target) { + this.add(target, p, startValue || target[p], relative ? relative + endValue : endValue, index, targets); + } else if (p !== "parseTransform") { + _missingPlugin(p, endValue); - return this; - }; - - // on (jquery >= 1.7) - if (!JQ_LT_17) { - $.fn.onFirst = function(types, selector) { - var $el = $(this); - var isDelegated = typeof selector === 'string'; + continue; + } + } else { + _tweenComplexCSSString.call(this, target, p, startValue, relative ? relative + endValue : endValue); + } - $.fn.on.apply($el, arguments); + isTransformRelated || (p in style ? inlineProps.push(p, 0, style[p]) : inlineProps.push(p, 1, startValue || target[p])); + props.push(p); + } + } - // events map - if (typeof types === 'object') { - for (type in types) - if (types.hasOwnProperty(type)) { - moveEventHandlers($el, type, isDelegated); - } - } else if (typeof types === 'string') { - moveEventHandlers($el, types, isDelegated); - } + hasPriority && _sortPropTweensByPriority(this); + }, + render: function render(ratio, data) { + if (data.tween._time || !_reverting$1()) { + var pt = data._pt; - return $el; - }; - } + while (pt) { + pt.r(ratio, pt.d); + pt = pt._next; + } + } else { + data.styles.revert(); + } + }, + get: _get, + aliases: _propertyAliases, + getSetter: function getSetter(target, property, plugin) { + var p = _propertyAliases[property]; + p && p.indexOf(",") < 0 && (property = p); + return property in _transformProps && property !== _transformOriginProp && (target._gsap.x || _get(target, "x")) ? plugin && _recentSetterPlugin === plugin ? property === "scale" ? _setterScale : _setterTransform : (_recentSetterPlugin = plugin || {}) && (property === "scale" ? _setterScaleWithRender : _setterTransformWithRender) : target.style && !_isUndefined(target.style[property]) ? _setterCSSStyle : ~property.indexOf("-") ? _setterCSSProp : _getSetter(target, property); + }, + core: { + _removeProperty: _removeProperty, + _getMatrix: _getMatrix + } + }; + gsap.utils.checkPrefix = _checkPropPrefix; + gsap.core.getStyleSaver = _getStyleSaver; -})(jQuery); + (function (positionAndScale, rotation, others, aliases) { + var all = _forEachName(positionAndScale + "," + rotation + "," + others, function (name) { + _transformProps[name] = 1; + }); + + _forEachName(rotation, function (name) { + _config.units[name] = "deg"; + _rotationalProperties[name] = 1; + }); + + _propertyAliases[all[13]] = positionAndScale + "," + rotation; + + _forEachName(aliases, function (name) { + var split = name.split(":"); + _propertyAliases[split[1]] = all[split[0]]; + }); + })("x,y,z,scale,scaleX,scaleY,xPercent,yPercent", "rotation,rotationX,rotationY,skewX,skewY", "transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective", "0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"); + + _forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function (name) { + _config.units[name] = "px"; + }); + + gsap.registerPlugin(CSSPlugin); + + var gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap, + TweenMaxWithCSS = gsapWithCSS.core.Tween; + + exports.Back = Back; + exports.Bounce = Bounce; + exports.CSSPlugin = CSSPlugin; + exports.Circ = Circ; + exports.Cubic = Cubic; + exports.Elastic = Elastic; + exports.Expo = Expo; + exports.Linear = Linear; + exports.Power0 = Power0; + exports.Power1 = Power1; + exports.Power2 = Power2; + exports.Power3 = Power3; + exports.Power4 = Power4; + exports.Quad = Quad; + exports.Quart = Quart; + exports.Quint = Quint; + exports.Sine = Sine; + exports.SteppedEase = SteppedEase; + exports.Strong = Strong; + exports.TimelineLite = Timeline; + exports.TimelineMax = Timeline; + exports.TweenLite = Tween; + exports.TweenMax = TweenMaxWithCSS; + exports.default = gsapWithCSS; + exports.gsap = gsapWithCSS; + + if (typeof(window) === 'undefined' || window !== exports) {Object.defineProperty(exports, '__esModule', { value: true });} else {delete window.default;} + +}))); ; /**************************************************************************** @@ -60309,8 +70446,9 @@ if (typeof define === 'function' && define.amd) { resizable : false, //If true the container of the slider can be resized and the grid will automatic redraw to adjust number of ticks and labels to the new width //Dimensions (only for options.handleFixed: true) - width : 0, // The total width of the slider (px) - valueDistances: 3, // The distance between each value on the slider (px). Width will be valueDistances*( max - min ) + width : 0, // The total width of the slider (px) + valueDistances: 3, // The distance between each value on the slider (px). Width will be valueDistances*( max - min ) + useParentWidth: false, //If true the slider try using the width of the parent of the container. Useful if the container is hidden when the slider is created //Ranges and value min : 0, // Set slider minimum value @@ -60349,22 +70487,30 @@ if (typeof define === 'function' && define.amd) { keyboardPageStepFactor : 20, //Step-factor when pressing pgUp or PgDn //Slide-line - lineBackgroundColor: '#d1d6e0', //The bakground color of the line - + showLine : true, //If false the line with the handle is hidden showLineColor : true, lineColor : '#428BCA', //The color of the line left of the handle (single) or between the two handles (double) + lineBackgroundColor: '#d1d6e0', //The bakground color of the line + lineColors : null, //[][{from, to, color}] Static colors for the line showImpactLineColor : false, // The line on a double slider is coloured as green-[handle]-yellow-[handle]-red impactLineColors : {green: "green", yellow: "yellow", red: "red"}, //The line colors used when showImpactLineColor: true reverseImpactLineColor: false, // The line on a double slider is colored as red-[handle]-yellow-[handle]-green. Must have showImpactLineColor: true + //Extention of line-color and/or grid-color when the handle is fixed (handleFixed: true) + extendLine : true, //If true and showLine: true => show light gray line before and after the line + extendGridColors : true, //If true and grid-colors are given => show light gray line before and after the grid + //Size sizeFactor: 1, //Factor to re-size default sizes fixedSize: { borderWidth: 1, }, size: { - fontSize : 10, + fontSize : 10, + fontFamily: 'Arial', + fontWeight: '', + majorTickLength : 9, minorTickLength : 6, @@ -60372,13 +70518,13 @@ if (typeof define === 'function' && define.amd) { lineBorderRadius: 2, - textPadding : 2, + textPadding : 2 - labelInnerHeight: 10, }, //Grid (ticks and label) grid : false, // Enables grid of values. + noTicks : false, //If true no ticks are added, but the space are (used internally) majorTicks : null, // Nummber of step between major ticks. Default=null=> Calculated automatic majorTicksOffset: 0, // Offset for the values where a major ticks is placed. Eq. Min=0, max=100 => major ticks on values=0,10,20,..,90,100. With majorTicksOffset:4 the major ticks would be placed on values=4,14,24,...,84,94 showMinorTicks : true, // Show minor ticks. @@ -60890,12 +71036,12 @@ if (typeof define === 'function' && define.amd) { build: function () { var _this = this; //************************************** - function $span( className, $parent ){ + function $span( className, $parent, prepend ){ var result = $(''); if (className) result.addClass( className ); if ($parent) - result.appendTo( $parent ); + prepend ? result.prependTo( $parent ) : result.appendTo( $parent ); return result; } //************************************** @@ -60918,44 +71064,54 @@ if (typeof define === 'function' && define.amd) { //this.cache.$leftColorLine, this.cache.$centerColorLine, this.cache.$rightColorLine function appendLineColor( left, center, right ){ var result; + if (left) result = _this.cache.$leftLineColor = $span('line-color', _this.cache.$line); if (center) result = _this.cache.$centerLineColor = $span('line-color', _this.cache.$line); if (right) result = _this.cache.$rightLineColor = $span('line-color', _this.cache.$line); return result; //Only last added } - //1. double-handle with impact- or reverse-impact-colors - if (this.options.isDouble && this.options.showImpactLineColor){ - appendLineColor( true, true, true ); - this.setImpactLineColors(); - } - else - //2. Add static colors given by options.lineColors - if (this.options.lineColors){ - var from = this.options.min, - to = from, - fromPercent, - toPercent, - sliderValue = ns.sliderValue({slider: this}); - $.each(this.options.lineColors, function( index, fromToColor ){ - from = fromToColor.from === undefined ? to : fromToColor.from; - to = fromToColor.to === undefined ? _this.options.max : fromToColor.to; - fromPercent = sliderValue.setValue( from ).getPercent(); - toPercent = sliderValue.setValue( to ).getPercent(); - $span('line-color', _this.cache.$line) - .css({ - 'left' : fromPercent + '%', - 'width' : (toPercent-fromPercent) + '%', - 'background-color' : fromToColor.color - }); - }); + if (this.options.showLine){ + //1. double-handle with impact- or reverse-impact-colors + if (this.options.isDouble && this.options.showImpactLineColor){ + appendLineColor( true, true, true ); + this.setImpactLineColors(); } else - //3. Normal line-color to the left of handle (single) or between handles (double) - if (this.options.showLineColor) - appendLineColor( this.options.isSingle, this.options.isDouble, false ) - .css('background-color', this.options.lineColor); - + //2. Add static colors given by options.lineColors + if (this.options.lineColors){ + var from = this.options.min, + to = from, + fromPercent, + toPercent, + sliderValue = ns.sliderValue({slider: this}); + $.each(this.options.lineColors, function( index, fromToColor ){ + from = fromToColor.from === undefined ? to : fromToColor.from; + to = fromToColor.to === undefined ? _this.options.max : fromToColor.to; + fromPercent = sliderValue.setValue( from ).getPercent(); + toPercent = sliderValue.setValue( to ).getPercent(); + $span('line-color', _this.cache.$line) + .css({ + 'left' : fromPercent + '%', + 'width' : (toPercent-fromPercent) + '%', + 'background-color' : fromToColor.color + }); + }); + } + else + //3. Normal line-color to the left of handle (single) or between handles (double) + if (this.options.showLineColor) + appendLineColor( this.options.isSingle, this.options.isDouble, false ) + .css('background-color', this.options.lineColor); + + //For fixed slider: Add dim line before and after to have line in hole container + if (this.options.handleFixed && this.options.extendLine){ + $span('line-color pre' , _this.cache.$line, true); + $span('line-color post', _this.cache.$line); + } + } + else + this.cache.$line.css("visibility", "hidden"); //Update the height of the slider this.cache.$container.css('height', this.cache.$lineBackground.height()+'px' ); @@ -61173,6 +71329,8 @@ if (typeof define === 'function' && define.amd) { Math.max(size.majorTickLength, size.fontSize) : size.majorTickLength + size.labelHeight; + $newGrid.height(canvasHeight); + $newCanvas .css('left', '-'+canvasMargin+'px') .attr('width', canvasWidth) @@ -61185,7 +71343,7 @@ if (typeof define === 'function' && define.amd) { ctx.textBaseline = "top"; //"bottom" or "middle" or "alphabetic" or "hanging" ctx.strokeStyle = this.options.majorColor; - ctx.font = size.fontSize + 'px Arial'; + ctx.font = size.fontWeight + (size.fontWeight ? ' ' : '') + size.fontSize+'px ' + size.fontFamily; if (this.options.labelClickable && !this.options.disable && !this.options.readOnly){ this.canvasId = this.canvasId || 0; @@ -61218,9 +71376,9 @@ if (typeof define === 'function' && define.amd) { appendTick *******************************************************************/ appendTick: function( leftPercent, options ){ - if (!this.$currentGrid) return; + if (!this.$currentGrid || this.options.noTicks) return; - options = $.extend( {minor: false, color: ''}, options ); + options = $.extend( {minor: false/*, color: ''*/}, options ); var left = this.cache.canvasMargin + (this.dimentions.containerWidth * leftPercent / 100), ctx = this.cache.ctx, @@ -61353,6 +71511,9 @@ if (typeof define === 'function' && define.amd) { }, postAppendGrid: function(){ + if (this.options.handleFixed && this.options.gridColors && this.options.extendGridColors) + this.appendPreAndPostGridColors(); + //Update the height of the slider this.cache.$container.css('height', (this.nextGridTop + this.$currentGrid.height())+'px' ); }, @@ -61427,8 +71588,8 @@ if (typeof define === 'function' && define.amd) { /******************************************************************* _appendStandardGrid *******************************************************************/ - _appendStandardGrid: function ( textOptions, tickOptions ) { - this.preAppendGrid(); + _appendStandardGrid: function ( textOptions, tickOptions, gridContainerOptions ) { + this.preAppendGrid( gridContainerOptions ); textOptions = $.extend( {labelClickable: this.options.labelClickable}, textOptions || {} ); tickOptions = tickOptions || {}; @@ -61510,6 +71671,20 @@ if (typeof define === 'function' && define.amd) { } } }, + + appendPreAndPostGridColors: function(){ + $('') + .addClass( 'grid-color pre') + .prependTo( this.$currentGrid ); + $('') + .addClass( 'grid-color post') + .appendTo( this.$currentGrid ); + } + + + + + }; //end of BaseSlider.prototype @@ -61667,9 +71842,22 @@ jquery-base-slider-events getDimentions Get width and left-position of different slider elements *******************************************************************/ + _getAnyWidth: function( $elem ){ + var width = 0; + while ($elem && $elem.length){ + width = $elem.innerWidth(); + if (width || !this.options.useParentWidth) + $elem = null; + else + $elem = $elem.parent(); + } + return Math.max(0, width); + }, + getDimentions: function(){ var result = {}; - result.containerWidth = Math.max(0, this.cache.$container.innerWidth()) || this.dimentions.containerWidth; + result.containerWidth = this._getAnyWidth(this.cache.$container) || this.dimentions.containerWidth; + if (this.options.isFixed) result.outerContainerWidth = this.cache.$outerContainer.innerWidth(); return result; @@ -65724,7 +75912,7 @@ return index; ; //! moment-timezone.js -//! version : 0.5.43 +//! version : 0.5.45 //! Copyright (c) JS Foundation and other contributors //! license : MIT //! github.com/moment/moment-timezone @@ -65754,7 +75942,7 @@ return index; // return moment; // } - var VERSION = "0.5.43", + var VERSION = "0.5.45", zones = {}, links = {}, countries = {}, @@ -65875,6 +76063,30 @@ return index; } } + function closest (num, arr) { + var len = arr.length; + if (num < arr[0]) { + return 0; + } else if (len > 1 && arr[len - 1] === Infinity && num >= arr[len - 2]) { + return len - 1; + } else if (num >= arr[len - 1]) { + return -1; + } + + var mid; + var lo = 0; + var hi = len - 1; + while (hi - lo > 1) { + mid = Math.floor((lo + hi) / 2); + if (arr[mid] <= num) { + lo = mid; + } else { + hi = mid; + } + } + return hi; + } + Zone.prototype = { _set : function (unpacked) { this.name = unpacked.name; @@ -65889,10 +76101,9 @@ return index; untils = this.untils, i; - for (i = 0; i < untils.length; i++) { - if (target < untils[i]) { - return i; - } + i = closest(target, untils); + if (i >= 0) { + return i; } }, @@ -66011,17 +76222,21 @@ return index; function userOffsets() { var startYear = new Date().getFullYear() - 2, last = new OffsetAt(new Date(startYear, 0, 1)), + lastOffset = last.offset, offsets = [last], - change, next, i; + change, next, nextOffset, i; for (i = 1; i < 48; i++) { - next = new OffsetAt(new Date(startYear, i, 1)); - if (next.offset !== last.offset) { + nextOffset = new Date(startYear, i, 1).getTimezoneOffset(); + if (nextOffset !== lastOffset) { + // Create OffsetAt here to avoid unnecessary abbr parsing before checking offsets + next = new OffsetAt(new Date(startYear, i, 1)); change = findChange(last, next); offsets.push(change); offsets.push(new OffsetAt(new Date(change.at + 6e4))); + last = next; + lastOffset = nextOffset; } - last = next; } for (i = 0; i < 4; i++) { @@ -66059,15 +76274,21 @@ return index; var offsetsLength = offsets.length, filteredGuesses = {}, out = [], - i, j, guessesOffset; + checkedOffsets = {}, + i, j, offset, guessesOffset; for (i = 0; i < offsetsLength; i++) { - guessesOffset = guesses[offsets[i].offset] || {}; + offset = offsets[i].offset; + if (checkedOffsets.hasOwnProperty(offset)) { + continue; + } + guessesOffset = guesses[offset] || {}; for (j in guessesOffset) { if (guessesOffset.hasOwnProperty(j)) { filteredGuesses[j] = true; } } + checkedOffsets[offset] = true; } for (i in filteredGuesses) { @@ -66283,10 +76504,10 @@ return index; function tz (input) { var args = Array.prototype.slice.call(arguments, 0, -1), name = arguments[arguments.length - 1], - zone = getZone(name), - out = moment.utc.apply(null, args); + out = moment.utc.apply(null, args), + zone; - if (zone && !moment.isMoment(input) && needsOffset(out)) { + if (!moment.isMoment(input) && needsOffset(out) && (zone = getZone(name))) { out.add(zone.parse(out), 'minutes'); } @@ -66332,7 +76553,7 @@ return index; offset; if (mom._z === undefined) { - if (zone && needsOffset(mom) && !mom._isUTC) { + if (zone && needsOffset(mom) && !mom._isUTC && mom.isValid()) { mom._d = moment.utc(mom._a)._d; mom.utc().add(zone.parse(mom), 'minutes'); } @@ -66416,99 +76637,99 @@ return index; } loadData({ - "version": "2023c", + "version": "2024a", "zones": [ "Africa/Abidjan|GMT|0|0||48e5", "Africa/Nairobi|EAT|-30|0||47e5", "Africa/Algiers|CET|-10|0||26e5", "Africa/Lagos|WAT|-10|0||17e6", "Africa/Khartoum|CAT|-20|0||51e5", - "Africa/Cairo|EET EEST|-20 -30|0101010101010|29NW0 1cL0 1cN0 1fz0 1a10 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0|15e6", - "Africa/Casablanca|+00 +01|0 -10|010101010101010101010101|1Vq20 jA0 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0|32e5", - "Europe/Paris|CET CEST|-10 -20|01010101010101010101010|1Vq10 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|11e6", + "Africa/Cairo|EET EEST|-20 -30|010101010101010|29NW0 1cL0 1cN0 1fz0 1a10 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0|15e6", + "Africa/Casablanca|+01 +00|-10 0|010101010101010101010101|208q0 e00 2600 gM0 2600 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0 2600 e00 2600|32e5", + "Europe/Paris|CET CEST|-10 -20|01010101010101010101010|1XSp0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0|11e6", "Africa/Johannesburg|SAST|-20|0||84e5", "Africa/Juba|EAT CAT|-30 -20|01|24nx0|", - "Africa/Sao_Tome|GMT WAT|0 -10|010|1UQN0 2q00|", + "Africa/Sao_Tome|WAT GMT|-10 0|01|1XiN0|", "Africa/Tripoli|EET|-20|0||11e5", - "America/Adak|HST HDT|a0 90|01010101010101010101010|1VkA0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|326", - "America/Anchorage|AKST AKDT|90 80|01010101010101010101010|1Vkz0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|30e4", + "America/Adak|HST HDT|a0 90|01010101010101010101010|1XKc0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|326", + "America/Anchorage|AKST AKDT|90 80|01010101010101010101010|1XKb0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|30e4", "America/Santo_Domingo|AST|40|0||29e5", "America/Fortaleza|-03|30|0||34e5", - "America/Asuncion|-03 -04|30 40|01010101010101010101010|1Vq30 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0|28e5", + "America/Asuncion|-03 -04|30 40|01010101010101010101010|1XPD0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1ip0|28e5", "America/Panama|EST|50|0||15e5", - "America/Mexico_City|CST CDT|60 50|01010101010|1VsU0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0|20e6", + "America/Mexico_City|CST CDT|60 50|010101010|1XVk0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0|20e6", "America/Managua|CST|60|0||22e5", "America/Caracas|-04|40|0||29e5", "America/Lima|-05|50|0||11e6", - "America/Denver|MST MDT|70 60|01010101010101010101010|1Vkx0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|26e5", - "America/Campo_Grande|-03 -04|30 40|0101|1Vc30 1HB0 FX0|77e4", - "America/Chicago|CST CDT|60 50|01010101010101010101010|1Vkw0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|92e5", - "America/Chihuahua|MST MDT CST|70 60 60|01010101012|1VsV0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0|81e4", - "America/Ciudad_Juarez|MST MDT CST|70 60 60|010101010120101010101010|1Vkx0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1wn0 cm0 EP0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|", + "America/Denver|MST MDT|70 60|01010101010101010101010|1XK90 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|26e5", + "America/Campo_Grande|-03 -04|30 40|01|1XBD0|77e4", + "America/Chicago|CST CDT|60 50|01010101010101010101010|1XK80 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|92e5", + "America/Chihuahua|MST MDT CST|70 60 60|010101012|1XVl0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0|81e4", + "America/Ciudad_Juarez|MST MDT CST|70 60 60|010101012010101010101010|1XK90 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1wn0 cm0 EP0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|", "America/Phoenix|MST|70|0||42e5", - "America/Whitehorse|PST PDT MST|80 70 70|0101012|1Vky0 1zb0 Op0 1zb0 Op0 1z90|23e3", - "America/New_York|EST EDT|50 40|01010101010101010101010|1Vkv0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|21e6", - "America/Los_Angeles|PST PDT|80 70|01010101010101010101010|1Vky0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|15e6", - "America/Halifax|AST ADT|40 30|01010101010101010101010|1Vku0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|39e4", - "America/Godthab|-03 -02 -01|30 20 10|0101010101012121212121|1Vq10 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 2so0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|17e3", - "America/Grand_Turk|AST EDT EST|40 40 50|01212121212121212121212|1Vkv0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|37e2", - "America/Havana|CST CDT|50 40|01010101010101010101010|1Vkt0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0|21e5", - "America/Mazatlan|MST MDT|70 60|01010101010|1VsV0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0|44e4", - "America/Metlakatla|AKST AKDT PST|90 80 80|012010101010101010101010|1Vkz0 1zb0 uM0 jB0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|14e2", - "America/Miquelon|-03 -02|30 20|01010101010101010101010|1Vkt0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|61e2", + "America/Whitehorse|PST PDT MST|80 70 70|01012|1XKa0 1zb0 Op0 1z90|23e3", + "America/New_York|EST EDT|50 40|01010101010101010101010|1XK70 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|21e6", + "America/Los_Angeles|PST PDT|80 70|01010101010101010101010|1XKa0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|15e6", + "America/Halifax|AST ADT|40 30|01010101010101010101010|1XK60 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|39e4", + "America/Godthab|-03 -02 -01|30 20 10|0101010101212121212121|1XSp0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 2so0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0|17e3", + "America/Havana|CST CDT|50 40|01010101010101010101010|1XK50 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0|21e5", + "America/Mazatlan|MST MDT|70 60|010101010|1XVl0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0|44e4", + "America/Metlakatla|PST AKST AKDT|80 90 80|012121212121212121212121|1Xqy0 jB0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|14e2", + "America/Miquelon|-03 -02|30 20|01010101010101010101010|1XK50 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|61e2", "America/Noronha|-02|20|0||30e2", - "America/Ojinaga|MST MDT CST CDT|70 60 60 50|01010101012323232323232|1Vkx0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1wn0 Rc0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|23e3", - "America/Santiago|-03 -04|30 40|01010101010101010101010|1VJD0 Ap0 1zb0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 11B0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0|62e5", - "America/Sao_Paulo|-02 -03|20 30|0101|1Vc20 1HB0 FX0|20e6", - "Atlantic/Azores|-01 +00|10 0|01010101010101010101010|1Vq10 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|25e4", - "America/St_Johns|NST NDT|3u 2u|01010101010101010101010|1Vktu 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0|11e4", - "Antarctica/Casey|+11 +08|-b0 -80|0101010|1Vkh0 1o30 14k0 1kr0 12l0 1o01|10", + "America/Ojinaga|MST MDT CST CDT|70 60 60 50|01010101232323232323232|1XK90 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1wn0 Rc0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|23e3", + "America/Santiago|-03 -04|30 40|01010101010101010101010|1XVf0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 11B0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0|62e5", + "America/Sao_Paulo|-02 -03|20 30|01|1XBC0|20e6", + "America/Scoresbysund|-01 +00 -02|10 0 20|0101010101020202020202|1XSp0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 2pA0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0|452", + "America/St_Johns|NST NDT|3u 2u|01010101010101010101010|1XK5u 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0|11e4", + "Antarctica/Casey|+11 +08|-b0 -80|0101010101|1XME0 1kr0 12l0 1o01 14kX 1lf1 14kX 1lf1 13bX|10", "Asia/Bangkok|+07|-70|0||15e6", "Asia/Vladivostok|+10|-a0|0||60e4", - "Australia/Sydney|AEDT AEST|-b0 -a0|01010101010101010101010|1VsE0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0|40e5", + "Australia/Sydney|AEDT AEST|-b0 -a0|01010101010101010101010|1XV40 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0|40e5", "Asia/Tashkent|+05|-50|0||23e5", - "Pacific/Auckland|NZDT NZST|-d0 -c0|01010101010101010101010|1VsC0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00|14e5", + "Pacific/Auckland|NZDT NZST|-d0 -c0|01010101010101010101010|1XV20 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0|14e5", "Europe/Istanbul|+03|-30|0||13e6", - "Antarctica/Troll|+00 +02|0 -20|01010101010101010101010|1Vq10 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|40", - "Asia/Dhaka|+06|-60|0||16e6", - "Asia/Amman|EET EEST +03|-20 -30 -30|01010101012|1VrW0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 LA0 1C00|25e5", + "Antarctica/Troll|+00 +02|0 -20|01010101010101010101010|1XSp0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0|40", + "Antarctica/Vostok|+07 +05|-70 -50|01|2bnv0|25", + "Asia/Almaty|+06 +05|-60 -50|01|2bR60|15e5", + "Asia/Amman|EET EEST +03|-20 -30 -30|010101012|1XRy0 1o00 11A0 1qM0 WM0 1qM0 LA0 1C00|25e5", "Asia/Kamchatka|+12|-c0|0||18e4", "Asia/Dubai|+04|-40|0||39e5", - "Asia/Beirut|EET EEST|-20 -30|01010101010101010101010|1VpW0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0|22e5", + "Asia/Beirut|EET EEST|-20 -30|01010101010101010101010|1XSm0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0|22e5", + "Asia/Dhaka|+06|-60|0||16e6", "Asia/Kuala_Lumpur|+08|-80|0||71e5", "Asia/Kolkata|IST|-5u|0||15e6", "Asia/Chita|+09|-90|0||33e4", "Asia/Shanghai|CST|-80|0||23e6", "Asia/Colombo|+0530|-5u|0||22e5", - "Asia/Damascus|EET EEST +03|-20 -30 -30|01010101012|1VrW0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0|26e5", - "Europe/Athens|EET EEST|-20 -30|01010101010101010101010|1Vq10 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|35e5", - "Asia/Gaza|EET EEST|-20 -30|01010101010101010101010|1Vpz0 1qL0 11c0 1on0 11B0 1o00 11A0 1qo0 XA0 1qp0 1cN0 1cL0 17d0 1in0 14p0 1lb0 11B0 1nX0 11B0 1qL0 WN0 1qL0|18e5", + "Asia/Damascus|EET EEST +03|-20 -30 -30|010101012|1XRy0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0|26e5", + "Europe/Athens|EET EEST|-20 -30|01010101010101010101010|1XSp0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0|35e5", + "Asia/Gaza|EET EEST|-20 -30|01010101010101010101010|1XRy0 1on0 11B0 1o00 11A0 1qo0 XA0 1qp0 1cN0 1cL0 1a10 1fz0 17d0 1in0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0|18e5", "Asia/Hong_Kong|HKT|-80|0||73e5", "Asia/Jakarta|WIB|-70|0||31e6", "Asia/Jayapura|WIT|-90|0||26e4", - "Asia/Jerusalem|IST IDT|-20 -30|01010101010101010101010|1Vpc0 1rz0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0|81e4", + "Asia/Jerusalem|IST IDT|-20 -30|01010101010101010101010|1XRA0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0|81e4", "Asia/Kabul|+0430|-4u|0||46e5", "Asia/Karachi|PKT|-50|0||24e6", "Asia/Kathmandu|+0545|-5J|0||12e5", "Asia/Sakhalin|+11|-b0|0||58e4", "Asia/Makassar|WITA|-80|0||15e5", "Asia/Manila|PST|-80|0||24e6", - "Asia/Pyongyang|KST KST|-8u -90|01|1VGf0|29e5", - "Asia/Qyzylorda|+06 +05|-60 -50|01|1Xei0|73e4", - "Asia/Rangoon|+0630|-6u|0||48e5", "Asia/Seoul|KST|-90|0||23e6", - "Asia/Tehran|+0330 +0430|-3u -4u|01010101010|1VoIu 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0|14e6", + "Asia/Rangoon|+0630|-6u|0||48e5", + "Asia/Tehran|+0330 +0430|-3u -4u|010101010|1XOIu 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0|14e6", "Asia/Tokyo|JST|-90|0||38e6", - "Europe/Lisbon|WET WEST|0 -10|01010101010101010101010|1Vq10 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|27e5", + "Atlantic/Azores|-01 +00|10 0|01010101010101010101010|1XSp0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0|25e4", + "Europe/Lisbon|WET WEST|0 -10|01010101010101010101010|1XSp0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0|27e5", "Atlantic/Cape_Verde|-01|10|0||50e4", - "Australia/Adelaide|ACDT ACST|-au -9u|01010101010101010101010|1VsEu 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0|11e5", + "Australia/Adelaide|ACDT ACST|-au -9u|01010101010101010101010|1XV4u 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0|11e5", "Australia/Brisbane|AEST|-a0|0||20e5", "Australia/Darwin|ACST|-9u|0||12e4", "Australia/Eucla|+0845|-8J|0||368", - "Australia/Lord_Howe|+11 +1030|-b0 -au|01010101010101010101010|1VsD0 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1fzu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu|347", + "Australia/Lord_Howe|+11 +1030|-b0 -au|01010101010101010101010|1XV30 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1fzu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu|347", "Australia/Perth|AWST|-80|0||18e5", - "Pacific/Easter|-05 -06|50 60|01010101010101010101010|1VJD0 Ap0 1zb0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 11B0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0|30e2", - "Europe/Dublin|GMT IST|0 -10|01010101010101010101010|1Vq10 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|12e5", + "Pacific/Easter|-05 -06|50 60|01010101010101010101010|1XVf0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 11B0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0|30e2", + "Europe/Dublin|GMT IST|0 -10|01010101010101010101010|1XSp0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0|12e5", "Etc/GMT-1|+01|-10|0||", "Pacific/Tongatapu|+13|-d0|0||75e3", "Pacific/Kiritimati|+14|-e0|0||51e2", @@ -66521,19 +76742,19 @@ return index; "Pacific/Pitcairn|-08|80|0||56", "Pacific/Gambier|-09|90|0||125", "Etc/UTC|UTC|0|0||", - "Europe/London|GMT BST|0 -10|01010101010101010101010|1Vq10 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|10e6", - "Europe/Chisinau|EET EEST|-20 -30|01010101010101010101010|1Vq00 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|67e4", + "Europe/London|GMT BST|0 -10|01010101010101010101010|1XSp0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0|10e6", + "Europe/Chisinau|EET EEST|-20 -30|01010101010101010101010|1XSo0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0|67e4", "Europe/Moscow|MSK|-30|0||16e6", - "Europe/Volgograd|MSK +04|-30 -40|010|1WQL0 5gn0|10e5", + "Europe/Volgograd|+04 MSK|-40 -30|01|249a0|10e5", "Pacific/Honolulu|HST|a0|0||37e4", - "MET|MET MEST|-10 -20|01010101010101010101010|1Vq10 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|", - "Pacific/Chatham|+1345 +1245|-dJ -cJ|01010101010101010101010|1VsC0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00|600", - "Pacific/Apia|+14 +13|-e0 -d0|01010101|1VsC0 1cM0 1fA0 1a00 1fA0 1a00 1fA0|37e3", - "Pacific/Fiji|+13 +12|-d0 -c0|01010101|1UVO0 1VA0 s00 20o0 pc0 2hc0 bc0|88e4", + "MET|MET MEST|-10 -20|01010101010101010101010|1XSp0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0|", + "Pacific/Chatham|+1345 +1245|-dJ -cJ|01010101010101010101010|1XV20 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0|600", + "Pacific/Apia|+14 +13|-e0 -d0|010101|1XV20 1a00 1fA0 1a00 1fA0|37e3", + "Pacific/Fiji|+13 +12|-d0 -c0|010101|1Xnq0 20o0 pc0 2hc0 bc0|88e4", "Pacific/Guam|ChST|-a0|0||17e4", "Pacific/Marquesas|-0930|9u|0||86e2", "Pacific/Pago_Pago|SST|b0|0||37e2", - "Pacific/Norfolk|+11 +12|-b0 -c0|01010101010101010101|219P0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0|25e4" + "Pacific/Norfolk|+11 +12|-b0 -c0|0101010101010101010101|219P0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0|25e4" ], "links": [ "Africa/Abidjan|Africa/Accra", @@ -66710,6 +76931,7 @@ return index; "America/Mexico_City|Mexico/General", "America/New_York|America/Detroit", "America/New_York|America/Fort_Wayne", + "America/New_York|America/Grand_Turk", "America/New_York|America/Indiana/Indianapolis", "America/New_York|America/Indiana/Marengo", "America/New_York|America/Indiana/Petersburg", @@ -66777,6 +76999,7 @@ return index; "America/St_Johns|Canada/Newfoundland", "America/Whitehorse|America/Dawson", "America/Whitehorse|Canada/Yukon", + "Asia/Almaty|Asia/Qostanay", "Asia/Bangkok|Antarctica/Davis", "Asia/Bangkok|Asia/Barnaul", "Asia/Bangkok|Asia/Ho_Chi_Minh", @@ -66795,13 +77018,10 @@ return index; "Asia/Chita|Asia/Yakutsk", "Asia/Chita|Etc/GMT-9", "Asia/Chita|Pacific/Palau", - "Asia/Dhaka|Antarctica/Vostok", - "Asia/Dhaka|Asia/Almaty", "Asia/Dhaka|Asia/Bishkek", "Asia/Dhaka|Asia/Dacca", "Asia/Dhaka|Asia/Kashgar", "Asia/Dhaka|Asia/Omsk", - "Asia/Dhaka|Asia/Qostanay", "Asia/Dhaka|Asia/Thimbu", "Asia/Dhaka|Asia/Thimphu", "Asia/Dhaka|Asia/Urumqi", @@ -66858,6 +77078,7 @@ return index; "Asia/Sakhalin|Pacific/Noumea", "Asia/Sakhalin|Pacific/Pohnpei", "Asia/Sakhalin|Pacific/Ponape", + "Asia/Seoul|Asia/Pyongyang", "Asia/Seoul|ROK", "Asia/Shanghai|Asia/Chongqing", "Asia/Shanghai|Asia/Chungking", @@ -66875,6 +77096,7 @@ return index; "Asia/Tashkent|Asia/Atyrau", "Asia/Tashkent|Asia/Dushanbe", "Asia/Tashkent|Asia/Oral", + "Asia/Tashkent|Asia/Qyzylorda", "Asia/Tashkent|Asia/Samarkand", "Asia/Tashkent|Asia/Yekaterinburg", "Asia/Tashkent|Etc/GMT-5", @@ -66889,7 +77111,6 @@ return index; "Asia/Vladivostok|Pacific/Port_Moresby", "Asia/Vladivostok|Pacific/Truk", "Asia/Vladivostok|Pacific/Yap", - "Atlantic/Azores|America/Scoresbysund", "Atlantic/Cape_Verde|Etc/GMT+1", "Australia/Adelaide|Australia/Broken_Hill", "Australia/Adelaide|Australia/South", @@ -67026,7 +77247,7 @@ return index; "AL|Europe/Tirane", "AM|Asia/Yerevan", "AO|Africa/Lagos Africa/Luanda", - "AQ|Antarctica/Casey Antarctica/Davis Antarctica/Mawson Antarctica/Palmer Antarctica/Rothera Antarctica/Troll Asia/Urumqi Pacific/Auckland Pacific/Port_Moresby Asia/Riyadh Antarctica/McMurdo Antarctica/DumontDUrville Antarctica/Syowa Antarctica/Vostok", + "AQ|Antarctica/Casey Antarctica/Davis Antarctica/Mawson Antarctica/Palmer Antarctica/Rothera Antarctica/Troll Antarctica/Vostok Pacific/Auckland Pacific/Port_Moresby Asia/Riyadh Antarctica/McMurdo Antarctica/DumontDUrville Antarctica/Syowa", "AR|America/Argentina/Buenos_Aires America/Argentina/Cordoba America/Argentina/Salta America/Argentina/Jujuy America/Argentina/Tucuman America/Argentina/Catamarca America/Argentina/La_Rioja America/Argentina/San_Juan America/Argentina/Mendoza America/Argentina/San_Luis America/Argentina/Rio_Gallegos America/Argentina/Ushuaia", "AS|Pacific/Pago_Pago", "AT|Europe/Vienna", @@ -67697,12 +77918,50 @@ options: ** SAME AS IN JQUERY-BASE-SLIDER PLUS ** - noDateLabels : boolean; If true no labels with the date are shown; - dateAtMidnight : boolean; If true the time-LABEL for midnight is replaced with a short date-label. Normally used together noDateLabels: true - format: - showRelative : boolean; If true the grid etc show the relative time ('Now + 2h') Default = false - showUTC : boolean; When true a scale for utc is also shown. Default = false. Only if showRelative == false + noDateLabels : BOOLEAN; If true no labels with the date are shown; + dateAtMidnight : BOOLEAN; If true the time-LABEL for midnight is replaced with a short date-label. Normally used together noDateLabels: true + + minMoment, + maxMoment, + fromMoment + toMoment : MOMENT; Same as min, max, from, to in jquery-base-slider but as moment-object + format: + date : STRING; Date format. "DMY" or "MDY" or "YMD" If none is given the format is set by [moment-simple-format](https://github.com/FCOO/moment-simple-format) + showYear : BOOLEAN; If true the date-time info in handler includes the year + time : STRING; Time format. "12" or "24" + timezone : STRING; "local"` or `"utc"` or abbreviation of time zone. Only if showRelative: false + text : {hourAbbr:"h", minAbbr:"m", now:"now", to:"to"}; Text used to format the date + + showRelative: BOOLEAN; If true the grid etc show the relative time ('Now + 2h') Default = false + + showUTC : BOOLEAN; When true a scale for utc is also shown, but only if the time-zone isn't utc or forceUTC is set. Default = false. Only if showRelative == false + forceUTC : BOOLEAN; If true and showUTC: true the utc-scale is included + noGridColorsOnUTC : BOOLEAN; If true the UTC-grid will not get any grid colors + noExtendedGridColorsOnUTC: BOOLEAN; If true the UTC-grid will not get any extended grid colors + noLabelColorsOnUTC : BOOLEAN; If true the UTC-grid will not get any labels with colors + UTCGridClassName : STRING; Class-name(s) for the grids use for UTC time-lime + + showExtraRelative : BOOLEAN; If true and showRelative = false => A relative scale is included + noGridColorsOnExtraRelative : BOOLEAN; If true the extra relative-grid will not get any grid colors + noExtendedGridColorsOnExtraRelative: BOOLEAN; If true the extra relative-grid will not get any extended grid colors + noLabelColorsOnExtraRelative : BOOLEAN; If true the extra relative-grid will not get any labels with colors + extraRelativeGridClassName : STRING; Class-name(s) for the grids use for the extra relative grid + + + showRelative : as format.showRelative + showUTC : as format.showUTC + forceUTC : as format.forceUTC + noGridColorsOnUTC : as format.noGridColorsOnUTC + noExtendedGridColorsOnUTC : as format.noExtendedGridColorsOnUTC + noLabelColorsOnUTC : as format.noLabelColorsOnUTC + UTCGridClassName : as format.UTCGridClassName + + showExtraRelative : as format.showExtraRelative + noGridColorsOnExtraRelative : as format.noGridColorsOnExtraRelative + noExtendedGridColorsOnExtraRelative : as format.noExtendedGridColorsOnExtraRelative + noLabelColorsOnExtraRelative : as format.noLabelColorsOnExtraRelative + extraRelativeGridClassName : as format.extraRelativeGridClassName NB: Using moment-simple-format to set and get text and format for date and time @@ -67715,17 +77974,22 @@ options: //roundMoment( m ) function roundMoment( m ){ return m.startOf('hour');} + //__jbs_getNowMoment = function to get current now as moment. Can be overwritten for under test + window.__jbs_getNowMoment = function(){ + return roundMoment(moment()); + }; + //valueToMoment function valueToMoment ( value ){ - var result = roundMoment(moment()); + var result = window.__jbs_getNowMoment(); result.add( value, 'hours' ); return result; } //setValueAndMoment( value, moment ) function setValueAndMoment( value, m ){ - var nowMoment = roundMoment(moment()); + var nowMoment = window.__jbs_getNowMoment(); if (value === undefined){ roundMoment( m ); value = m.diff(nowMoment, 'hours'); @@ -67755,7 +78019,7 @@ options: }; window.TimeSlider = function (input, options, pluginCount) { - this.VERSION = "7.1.0"; + this.VERSION = "7.7.3"; //Setting default options this.options = $.extend( true, {}, defaultOptions, options ); @@ -67841,7 +78105,15 @@ options: }, _prettifyRelative : function( value ){ return this._valueToFormat( value ); }, - _prettifyLabelRelative: function( value ){ return value; }, + _prettifyLabelRelative: function( value ){ return value; }, + + + //_prettifyLabelRelative_full used for labels on extra relative grid + _prettifyLabelRelative_full: function( value ){ + return value ? moment().add( value, 'hours' ).relativeFormat({ relativeFormat:{now:false, days:true, minutes:false} }) : this.options.format.text.nowUC; + }, + + _prettifyAbsolute: function( value ){ return this._valueToFormat( value, this.options.format.timezone ); @@ -67998,13 +78270,57 @@ options: o.labelColorRec = labelColorRec; } + //date grid never has extendedGridColors + var save = o.extendGridColors; + o.extendGridColors = false; this.postAppendGrid(); + o.extendGridColors = save; }, /************************************************************** appendStandardGrid ***************************************************************/ appendStandardGrid: function(){ + var _this = this, + opt = this.options, + textOptions = {italic:true, minor:true}; //Text and tick options for secondary grids (relative and utc for absolute scale) + + //***************************************************** + function appendSpecialGrid( gridOpt ){ + var noGridColors = opt.format[gridOpt.noGridColorId] || opt[gridOpt.noGridColorId], + noLabelColors = opt.format[gridOpt.noLabelColorsId] || opt[gridOpt.noLabelColorsId], + gridClassName = opt.format[gridOpt.gridClassNameId] || opt[gridOpt.gridClassNameId] || '', + noExtendGridColors = opt.format[gridOpt.noExtendGridColorsId] || opt[gridOpt.noExtendGridColorsId], + + saveOptions = $.extend(true, {}, _this.options); + + opt.size.majorTickLength = 3; //Normal = 9 + opt.size.minorTickLength = 2; //Normal = 6 + opt.showMinorTicks = false; + + //If noGridColors is set => remove grid-colors + if (noGridColors) + opt.gridColors = null; + else + if (noExtendGridColors) + opt.extendGridColors = false; + + //If noLabelColors is set => remove label-colors + if (noLabelColors) + opt.labelColors = null; + + if (gridOpt.newLabels) + opt.maxLabelWidth = null; //Force recalculating label-space + + _this._appendStandardGrid(textOptions); + + _this.$currentGrid.addClass(gridClassName); + + //Restore options + opt = _this.options = saveOptions; + } + //***************************************************** + //First remove all grid-container except the first one this.cache.$grid = this.cache.$container.find(".grid").first(); this.cache.$grid.siblings('.grid').remove(); @@ -68012,35 +78328,66 @@ options: this.$currentGridContainer = null; //Create all grid - if (this.options.format.showRelative){ + if (opt.format.showRelative || opt.showRelative){ //Relative time: Set the prettify-functions and create the grid needed this._prettify = this._prettifyRelative; this._prettifyLabel = this._prettifyLabelRelative; - this.options.majorTicksOffset = 0; + opt.majorTicksOffset = 0; this._appendStandardGrid(); } else { //Absolute time: Set the prettify-functions - var now = this._getNow(); //moment(); + var now = this._getNow(); //Create the hour-grid and the date-grid for selected timezone this._prettify = this._prettifyAbsolute; this._prettifyLabel = this._prettifyLabelAbsolute; - this.options.majorTicksOffset = -1*now.tzMoment( this.options.format.timezone ).hours(); + opt.majorTicksOffset = -1*now.tzMoment( opt.format.timezone ).hours(); this._appendStandardGrid(); this.appendDateGrid(); - if ((this.options.format.timezone != 'utc') && this.options.format.showUTC){ + //If opt.showExtraRelative => add extra grid with relative labels and no ticks + if (opt.showExtraRelative){ + this._prettify = this._prettifyRelative; + this._prettifyLabel = this._prettifyLabelRelative_full; + + var saveMajorTicksOffset = opt.majorTicksOffset; + opt.majorTicksOffset = 0; + + appendSpecialGrid({ + noGridColorId : 'noGridColorsOnExtraRelative', + noLabelColorsId : 'noLabelColorsOnExtraRelative', + gridClassNameId : 'extraRelativeGridClassName', + noExtendGridColorsId: 'noExtendedGridColorsOnExtraRelative', + newLabels : true + }); + + opt.majorTicksOffset = saveMajorTicksOffset; + } + + + if ( + ( (opt.format.timezone != 'utc') || opt.format.forceUTC || opt.forceUTC) && + (opt.format.showUTC || opt.showUTC) + ){ //Create the hour-grid and the date-grid for utc - this.options.majorTicksOffset = -1*now.tzMoment( 'utc' ).hours(); - var saveTimezone = this.options.format.timezone; - this.options.format.timezone = 'utc'; - var textOptions = {italic:true, minor:true}, - tickOptions = {color:'#555555'}; + opt.majorTicksOffset = -1*now.tzMoment( 'utc' ).hours(); + var saveTimezone = opt.format.timezone; + opt.format.timezone = 'utc'; this._prettify = this._prettifyAbsolute; this._prettifyLabel = this._prettifyLabelAbsolute; - this._appendStandardGrid( textOptions, tickOptions ); - this.appendDateGrid( textOptions, tickOptions ); - this.options.format.timezone = saveTimezone; + + appendSpecialGrid({ + noGridColorId : 'noGridColorsOnUTC', + noLabelColorsId : 'noLabelColorsOnUTC', + gridClassNameId : 'UTCGridClassName', + noExtendGridColorsId: 'noExtendedGridColorsOnUTC', + newLabels : false + }); + + this.appendDateGrid( textOptions); + this.$currentGrid.addClass(opt.format.UTCGridClassName || opt.UTCGridClassName || ''); + + opt.format.timezone = saveTimezone; } } }, @@ -71785,6 +82132,7 @@ module.exports = g; var myTable = $.bsTable({...}); //Add 'BSTABLE' to class-name for result myTable.asModal({...}); */ + $.BSASMODAL = $.BSASMODAL || {}; $.fn.asModal = function(options){ var _this = this, @@ -71799,6 +82147,7 @@ module.exports = g; return asModal ? $.proxy(asModal, this)( options ) : null; }; + //Allow test-pages to set bsIsTouch to fixed value ns.bsIsTouch = typeof ns.bsIsTouch == "boolean" ? ns.bsIsTouch : true; @@ -71997,9 +82346,11 @@ module.exports = g; $._bsCreateIcon( opt, $icon, null, 'stacked-icon' ); }); - //If any of the stacked icons have class fa-no-margin => set if on the container - if ($icon.find('.fa-no-margin').length) - $icon.addClass('fa-no-margin'); + //If any of the stacked icons have class fa-no-margin, width-1-Xem => set if on the container + ['fa-no-margin', 'width-1-1em', 'width-1-2em', 'width-1-3em', 'width-1-4em', 'width-1-5em'].forEach( (className) => { + if ($icon.find('.'+className).length) + $icon.addClass(className); + }); } else { var allClassNames = options.icon || options.class || ''; @@ -72725,7 +83076,6 @@ module.exports = g; $._bsAdjustOptions( options, {}, { baseClass : 'accordion', styleClass : '', - class : '', content : '' }); @@ -72812,6 +83162,8 @@ module.exports = g; .addClass('accordion-body') .toggleClass('no-vertical-padding', !!opt.noVerticalPadding) .toggleClass('no-horizontal-padding', !!opt.noHorizontalPadding) + .addClass(opt.class || '') + .addClass(opt.className || '') .appendTo( $outer ); //Add footer @@ -72908,10 +83260,12 @@ module.exports = g; bigIcon : 'big-icon', extraLargeIcon : 'extra-large-icon', selected : 'selected', + checkboxAtLeft : 'checkbox-at-left', noBorder : 'no-border', focus : 'init_focus', truncate : 'text-truncate', - fullWidth : 'w-100' + fullWidth : 'w-100', + fullHeight : 'h-100', }; //Use standard color if not primary or transparent (any kind) @@ -72971,12 +83325,20 @@ module.exports = g; if (!options.radioGroup) result._bsAddIdAndName( options ); + if (options._width) + result.width( options._width ); + if (options.buttonWidth) + result.width( options.buttonWidth ); + if (options.attr) result.attr( options.attr ); if (options.prop) result.prop( options.prop ); + if (options.css) + result.css( options.css ); + result.data('bsButton_options', options ); if (options.addOnClick && options.onClick) @@ -73354,7 +83716,8 @@ module.exports = g; center : true, useTouchSize: true, buttonOptions: { - _class: 'flex-shrink-1 text-truncate' + css: {'flex': options.buttonFullWidth ? '1 1 0' : '0 1 auto'}, + _class: 'text-truncate' } } ); @@ -73431,7 +83794,7 @@ options function defaultOnClick(url, options){ - $.bsModalFile(url, {header: options.text}).show(); + $.bsModalImage(url, options).show(); } function item_onClick(e){ @@ -73710,29 +84073,6 @@ options var fileViewHeaderClasses = 'modal-header header-content header-content-smaller header-content-inner'; - //fileViewModalList = list of {fileNames, bsModal} where bsModal is the $.bsModalFile showing the file - var fileViewModalList = []; - function showFileInModal( fileName, header ){ - var fileViewModal = null, - fileNames = fileName.da + fileName.en; - $.each( fileViewModalList, function( index, fileView ){ - if (fileView.fileNames == fileNames){ - fileViewModal = fileView; - return false; - } - }); - - if (!fileViewModal){ - fileViewModal = { - fileNames: fileNames, - bsModal : $.bsModalFile( fileName, {header: header, show: false}) - }; - fileViewModalList.push(fileViewModal); - } - fileViewModal.bsModal.show(); - } - - /********************************************************** **********************************************************/ $.bsFileView = $.bsFileview = function( options = {}){ @@ -73804,7 +84144,13 @@ options .addClass('modal-footer') .css('justify-content', 'center') ._bsAppendContent([ - $.bsButton( {icon: $.FONTAWESOME_PREFIX + ' fa-window-maximize', text: {da:'Vis', en:'Show'}, onClick: function(){ showFileInModal( fileName, options.header ); } } ), + $.bsButton( + {icon: $.FONTAWESOME_PREFIX + ' fa-window-maximize', + text: {da:'Vis', en:'Show'}, + onClick: function(){ + $.bsModalFile( fileName, {header: options.header} ); + } + }), $.bsButton( {icon: $.bsExternalLinkIcon, text: {da: 'Åbne', en: 'Open'}, link: fileName } ) ]) .appendTo($result); @@ -75512,7 +85858,6 @@ options noVerticalPadding : noPadding, noHorizontalPadding: noPadding, alwaysMaxHeight : alwaysMaxHeight, - buttons : [{ icon: $.bsExternalLinkIcon, text: {da: 'Åbne', en: 'Open'}, @@ -75520,11 +85865,197 @@ options }], content : $content, - footer : footer + footer : footer, + + remove : options.remove, + removeOnClose: options.removeOnClose, + defaultRemove: true }); }; +}(jQuery, this.i18next, this, document)); +; +/**************************************************************************** + jquery-bootstrap-modal-image.js + + (c) 2017, FCOO + + https://github.com/fcoo/jquery-bootstrap + https://github.com/fcoo + + $.bsModalImage = function( fileName, options = {} ) + Displays one image in a full screen modal window + + +****************************************************************************/ + +(function ($, i18next, window /*, document, undefined*/) { + "use strict"; + + var pinchZoomId = 0; + + $.bsModalImage = function( fileName, options ){ + var id = 'pinchZoom'+ pinchZoomId++, + theFileName = i18next.sentence( $._bsAdjustText(fileName) ), + + $imgContainer = $('
').addClass('zoomHolder w-100 h-100'), + $img = $('') + .appendTo($imgContainer), + + footer = [], + footerTextClass = 'd-block w-100 text-center caption'; + if (options.icon || options.text) + footer.push( + $('
') + .addClass(footerTextClass) + ._bsAddHtml({icon: options.icon, text: options.text}) + ); + if (options.subIcon || options.subText) + footer.push( + $('
') + .addClass(footerTextClass + ' font-size-0-9em') + ._bsAddHtml({icon: options.subIcon, text: options.subText}) + ); + + + //Create the bsModal + var $result = $.bsModal({ + fullScreen: true, + header : options.header, + noHeader : !options.header, + + scroll : false, + + noVerticalPadding : true, + noHorizontalPadding: true, + + buttons : [{ + id : 'auto-zoom', + icon : 'fa-expand', + type : 'checkboxbutton', + square : true, + selected: true, + onChange: function(id, selected){ $result.autoZoomToggle(selected); } + },{ + id : 'one-to-one', + text : '1:1', + square : true, + onClick: function(){ $result.originalSize(); } + },{ + icon : 'fa-magnifying-glass-plus', + square : true, + onClick: function(){ $result.pz.zoomIn(); } + },{ + icon : 'fa-magnifying-glass-minus', + square : true, + onClick: function(){ $result.pz.zoomOut(); } + }], + smallButtons: true, + + content : $imgContainer, + className:'overflow-hidden', + + footer : footer, + footerClass: 'flex-column', + + remove : options.remove, + removeOnClose: options.removeOnClose, + defaultRemove: true + }); + + + $result.extend( bsModalImage_prototype ); + $result.$img = $img; + $result.$imgContainer = $imgContainer; + + $img.on('load', $result.onLoad.bind($result) ); + + return $result; + + }; //End of BsModalImage( fileName, options = {} ){ + + /******************************************************* + Extend the prototype of BsModalImage + *******************************************************/ + + var bsModalImage_prototype = { + onLoad: function(){ + var $content = this.bsModal.$content, + $img = this.$img; + + this.viewportWidth = $content.outerWidth(); + this.viewportHeight = $content.outerHeight(); + + this.autoZoomScaleMode = 'proportionalInside'; + this.autoZoomOn = true; + + //minZoom set to ensure smallest image = 100px + var minDim = Math.min($img.width(), $img.height()), + minZoom = window.nearest(100/minDim, .1); + + $img.data('elem', 'pinchzoomer'); + $img.pinchzoomer({ + preloaderUrl: $img.attr('src'), + minZoom : minZoom, + maxZoom : 10, + scaleMode : this.autoZoomScaleMode, + adjustHolderSize: false, + }, false); + + this.pz = this.pinchZoomer = window.PinchZoomer.get($img.attr('id')); + this.pinchZoomer.on(window.PinchZoomer.ZOOM, this.autoZoomOff.bind( this ) ); + + //Zoom in and out using mouse-wheel plus resize + $content + .on('mousewheel', this._on_mousewheel.bind(this) ) + .resize( this._on_resize.bind(this) ); + + //Find the auto-zoom button + this.$autoZoomButton = this.bsModal.$buttonContainer.find('#auto-zoom'); + }, + + _on_resize : function(){ + this.viewportWidth = this.bsModal.$content.outerWidth(); + this.viewportHeight = this.bsModal.$content.outerHeight(); + }, + + _on_mousewheel: function(e){ + //If mouse outside image => zoom in or out + if (e.target === this.$img.get(0)) return; + if (e.deltaY == 1) + this.pz.zoomIn(); + if (e.deltaY == -1) + this.pz.zoomOut(); + }, + + + originalSize: function(){ + this.autoZoomToggle(false); + this.pz.zoom(1); + }, + + autoZoomOff: function(){ + if (!this.dontCall_autoZoomToggle) + this.autoZoomToggle(false); + }, + + autoZoomToggle: function(on){ + if (this.autoZoomOn == on) return; + + this.autoZoomOn = on; + this.$autoZoomButton._cbxSet(on, true); + + this.pz.vars({ scaleMode: on ? this.autoZoomScaleMode : 'none' }); + + if (on){ + this.dontCall_autoZoomToggle = true; + this.pz.zoom(1, 0); + this.dontCall_autoZoomToggle = false; + } + }, + }; + }(jQuery, this.i18next, this, document)); ; /**************************************************************************** @@ -75692,6 +86223,7 @@ jquery-bootstrap-modal-promise.js flexWidth extraWidth megaWidth + fullScreen noVerticalPadding noHorizontalPadding noShadow @@ -75744,6 +86276,25 @@ jquery-bootstrap-modal-promise.js + /********************************************************** + CHANGE MODAL OPTIONS + In some cases an application need to adjust the default modal-options + given by an external packages. Eg. on mobil devices - it is better to have + modal width = max-width or full screen + To allow this a global function and variable are defined and called/checked to + allow modifications of the modal-options + + $.MODAL_ADJUST_OPTIONS = function(modalOptions, modal) return modal-options + + $.MODAL_NO_VERTICAL_MARGIN = false If true all modal have vertical margin = 0 + + By default it return the original options but they can be overwriten by applications/packages + **********************************************************/ + $.MODAL_ADJUST_OPTIONS = function(modalOptions/*, modal*/){ + return modalOptions; + }; + $.MODAL_NO_VERTICAL_MARGIN = false; + /********************************************************** MAX-HEIGHT ISSUES ON SAFARI (AND OTHER BROWSER ON IOS) Due to an intended design in Safari it is not possible to @@ -75756,6 +86307,7 @@ jquery-bootstrap-modal-promise.js function adjustModalMaxHeight( $modalContent ){ var $modalContents = $modalContent || $('.modal-content.modal-flex-height'); + //For each $modalContent: Get the current data with options on relative size and set the height and max-height $modalContents.each(function(index, elem){ var $modalContent = $(elem); @@ -75795,9 +86347,13 @@ jquery-bootstrap-modal-promise.js 3: fixed height. options.height The width of a modal is by default 300px. - options.flexWidth : If true the width of the modal will adjust to the width of the browser up to 500px - options.extraWidth: Only when flexWidth is set: If true the width of the modal will adjust to the width of the browser up to 800px - options.megaWidth : Only when flexWidth is set: If true the width of the modal will adjust to the width of the browser up to 1200px + options.flexWidth : If true the width of the modal will adjust to the width of the browser up to 500px + options.extraWidth: Only when flexWidth is set: If true the width of the modal will adjust to the width of the browser up to 800px + options.megaWidth : Only when flexWidth is set: If true the width of the modal will adjust to the width of the browser up to 1200px + options.maxWidth : If true the width of the modal will always be 100% minus some margin + options.fullWidth : If true the width of the modal will always be 100% + options.fullScreen: If true the modal will fill the hole screen without border. width = height = 100% + options.fullScreenWithBorder: As fullScreen but with borders options.width : Set if different from 300 ******************************************************/ @@ -75809,12 +86365,16 @@ jquery-bootstrap-modal-promise.js function getWidthFromOptions( options ){ return { - flexWidth : !!options.flexWidth, - extraWidth: !!options.extraWidth, - megaWidth : !!options.megaWidth, - width : options.width ? - ( (typeof options.width == 'number') ? options.width+'px' : options.width) - : null + flexWidth : !!options.flexWidth, + extraWidth : !!options.extraWidth, + megaWidth : !!options.megaWidth, + maxWidth : !!options.maxWidth, + fullWidth : !!options.fullWidth, + fullScreen : !!options.fullScreen, + fullScreenWithBorder: !!options.fullScreenWithBorder, + width : options.width ? + ( (typeof options.width == 'number') ? options.width+'px' : options.width) + : null }; } @@ -75901,6 +86461,10 @@ jquery-bootstrap-modal-promise.js //Remove all noty added on the modal and move down global backdrop $._bsNotyRemoveLayer(); + + //Remove the modal from DOM + if (this.removeOnClose) + this.get(0).remove(); } //****************************************************** @@ -76148,6 +86712,8 @@ jquery-bootstrap-modal-promise.js parts.$footer = $('
') .addClass('footer-content ' + className) + .addClass(options.footerClass) + .addClass(options.footerClassName) .appendTo( this ) ._bsAddHtml( options.footer ); @@ -76159,6 +86725,7 @@ jquery-bootstrap-modal-promise.js $modalContent.on('click', options.onClick); } + return this; }; @@ -76188,7 +86755,7 @@ jquery-bootstrap-modal-promise.js function setRelativeHeightOptions(size, options){ var relativeOptions = null; if (!getHeightFromOptions(options)){ - //Save only options differnet from default + //Save only options different from default $.each(['relativeHeight', 'relativeHeightOffset', 'parentContainerHeight'], function(index, id){ var value = options[id]; if (value || (value === 0)){ @@ -76239,6 +86806,10 @@ jquery-bootstrap-modal-promise.js ( (options.extended.flexWidth == undefined) && (options.extended.extraWidth == undefined) && (options.extended.megaWidth == undefined) && + (options.extended.maxWidth == undefined) && + (options.extended.fullWidth == undefined) && + (options.extended.fullScreen == undefined) && + (options.extended.fullScreenWithBorder == undefined) && (options.extended.width == undefined) ) ) @@ -76544,9 +87115,13 @@ jquery-bootstrap-modal-promise.js //Set width $modalDialog - .toggleClass('modal-flex-width', cssWidth.flexWidth ) - .toggleClass('modal-extra-width', cssWidth.extraWidth ) - .toggleClass('modal-mega-width', cssWidth.megaWidth ) + .toggleClass('modal-flex-width' , cssWidth.flexWidth ) + .toggleClass('modal-extra-width' , cssWidth.extraWidth ) + .toggleClass('modal-mega-width' , cssWidth.megaWidth ) + .toggleClass('modal-max-width' , cssWidth.maxWidth ) + .toggleClass('modal-full-width' , cssWidth.fullWidth ) + .toggleClass('modal-full-screen' , cssWidth.fullScreen ) + .toggleClass('modal-full-screen-with-border', cssWidth.fullScreenWithBorder ) .css('width', cssWidth.width ? cssWidth.width : '' ); //Call onChange (if any) @@ -76680,6 +87255,34 @@ jquery-bootstrap-modal-promise.js show : true }); + //Adjust options by MODEL_ADJUST_OPTIONS + options = $.MODAL_ADJUST_OPTIONS(options, this); + + //Set default removeOnClose + if ( (options.defaultRemoveOnClose || options.defaultRemove) && + (options.remove === undefined) && + (options.removeOnClose === undefined) ) + options.remove = !!options.defaultRemoveOnClose || !!options.defaultRemove; + + //Set options for full screen with border + if (options.fullScreenWithBorder) + options.fullScreen = true; + + //Set options for full screen + if (options.fullScreen){ + options.maxWidth = true; + options.alwaysMaxHeight = true; + options.relativeHeightOffset = 0; + } + + //Check $.MODAL_NO_VERTICAL_MARGIN + if ($.MODAL_NO_VERTICAL_MARGIN){ + options.relativeHeightOffset = 0; + if (options.extended) + options.extended.relativeHeightOffset = 0; + } + + //Create the modal $result = $('
') @@ -76729,6 +87332,8 @@ jquery-bootstrap-modal-promise.js }); $result.bsModal = $modalDialog.bsModal; + $result.removeOnClose = options.remove || options.removeOnClose; + if (options.historyList){ //Hide back- and forward-icons $result.getHeaderIcon('back').css('visibility', 'hidden'); @@ -76739,7 +87344,7 @@ jquery-bootstrap-modal-promise.js 'show.bs.modal' : $.proxy(show_bs_modal, $result),//show_bs_modal, 'shown.bs.modal' : shown_bs_modal, 'hide.bs.modal' : $.proxy(hide_bs_modal, $result), - 'hidden.bs.modal': hidden_bs_modal, + 'hidden.bs.modal': hidden_bs_modal }); $result.appendTo( $('body') ); @@ -77462,8 +88067,11 @@ jquery-bootstrap-modal-promise.js this._$popover_element = popoverId ? $('#' + popoverId) : null; if (this._$popover_element){ - //Translate content + //Translate content and update if width changes + var width = this._$popover_element.width(); this._$popover_element.localize(); + if (width != this._$popover_element.width()) + $this.popover('update'); //On click: Check if the popover needs to close. this._$popover_element.on('click.jbs.popover', function(event){ @@ -77874,9 +88482,6 @@ options item.selected = item.id ? item.id == selectedId : false; }); - if ($selectButton_Modal) - $selectButton_Modal.remove(); - $selectButton_Modal = $.bsModal({ noHeader : true, closeButton : false, @@ -77891,7 +88496,8 @@ options context : this, truncate : true }, - show: true + show: true, + removeOnClose: true }); }; @@ -77983,7 +88589,6 @@ options // Create $.BSASMODAL - See src/jquery-bootstrap.js for details $.BSASMODAL = $.BSASMODAL || {}; - /****************************************************************** bsTable( options ) options @@ -78114,13 +88719,15 @@ TODO: truncate : false. If true the column will be truncated. Normally onl }, defaultColunmOptions = { - align : 'left', - verticalAlign: 'middle', - noWrap : false, - truncate : false, - fixedWidth : false, - sortBy : 'string', - sortable : false + align : 'left', + verticalAlign : 'middle', + noWrap : false, + truncate : false, + fixedWidth : false, + sortBy : 'string', + sortable : false, + noHorizontalPadding : false, + noVerticalPadding : false }, dataTableId = 'bsTable_options'; @@ -78133,7 +88740,8 @@ TODO: truncate : false. If true the column will be truncated. Normally onl ._bsAddStyleClasses( columnOptions.align ) .toggleClass('text-nowrap', !!columnOptions.noWrap ) //TODO .toggleClass('text-truncate', !!columnOptions.truncate ) - .toggleClass('px-0', !!columnOptions.noHorizontalPadding ); + .toggleClass('px-0', !!columnOptions.noHorizontalPadding ) + .toggleClass('py-0', !!columnOptions.noVerticalPadding ); if (addWidth && columnOptions.width) $element.css({ @@ -78558,7 +89166,7 @@ TODO: truncate : false. If true the column will be truncated. Normally onl (options.hoverRow ? 'table-hover ' : '' ) + (options.noPadding ? 'table-no-padding ' : '' ) + (options.notFullWidth ? 'table-not-full-width ' : '' ) + - (options.centerInContainer ? 'my-auto mx-0 ' : '' ) + + (options.centerInContainer ? 'mx-auto my-0 ' : '' ) + (options.selectable ? 'table-selectable ' : '' ) + (options.allowZeroSelected ? 'allow-zero-selected ' : '' ); @@ -78746,6 +89354,7 @@ TODO: truncate : false. If true the column will be truncated. Normally onl return $result; }; + /****************************************************** bsTabs