diff --git a/.gitignore b/.gitignore index 58447c64..59056c9a 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,6 @@ example/css/chart.css .nyc_output *.lcov + +# dist +dist diff --git a/dist/charting.css b/dist/charting.css deleted file mode 100644 index 152d6c7c..00000000 --- a/dist/charting.css +++ /dev/null @@ -1,2143 +0,0 @@ -art { - float: left; -} - -.dc-chart rect.bar { - stroke: none; - cursor: pointer; -} - -.dc-chart rect.bar.accented { - fill: #E637A8; -} - -.dc-chart rect.bar:hover { - fill-opacity: .5; -} - -.dc-chart rect.stack1 { - stroke: none; - fill: red; -} - -.dc-chart rect.stack2 { - stroke: none; - fill: green; -} - -.dc-chart rect.deselected { - stroke: none; - fill: #ccc; -} - -.dc-chart text.deselected { - fill: #ccc !important; /*why do we need to override?*/ -} - -.dc-chart .empty-chart .pie-slice path { - fill: #FFEEEE; - cursor: default; -} - -.dc-chart .empty-chart .pie-slice { - cursor: default; -} - -.dc-chart .pie-slice { - fill: white; - font-size: 12px; -} - -.dc-chart .pie-slice:not(.all-others) { - cursor: pointer; -} - -.dc-chart .pie-slice.external{ - fill: black; -} - -.dc-chart .pie-slice:not(.all-others) :hover { - fill-opacity: .8; -} - -.dc-chart .pie-slice.accented { - fill-opacity: .8; - stroke-width: 3; - //stroke: white; - stroke: #E637A8; - //stroke: rgb(188,71,71); -} - -.dc-chart line.accented { - stroke-width: 2; - stroke: #E637A8; - //stroke: rgb(188,71,71); -} - -.dc-chart thead { - position: relative; - top: 38px; -} - -.dc-chart .selected path { - stroke-width: 1; - stroke: #ccc; - fill-opacity: 1; -} - -.dc-chart .deselected path { - stroke: none; - fill-opacity: .5; - fill: #ccc; -} - -.dc-chart .axis path, .axis line { - fill: none; - stroke: #000; - shape-rendering: crispEdges; -} - -.dc-chart .axis text { - font: 10px sans-serif; -} - -.dc-chart .grid-line { - fill: none; - stroke: #ccc; - opacity: .5; - shape-rendering: crispEdges; -} - -.dc-chart .grid-line line { - fill: none; - stroke: #ccc; - opacity: .5; - shape-rendering: crispEdges; -} - -.dc-chart .brush rect.background { - z-index: -999; -} - -.dc-chart .brush rect.extent { - fill: steelblue; - fill-opacity: .125; -} - -.dc-chart .brush .resize path { - fill: #eee; - stroke: #666; -} - -.dc-chart path.line { - fill: none; - stroke-width: 1.5px; -} - -.dc-chart circle.dot { - stroke: none; -} - -.dc-chart g.dc-tooltip path { - fill: none; - stroke: grey; - stroke-opacity: .8; -} - -.dc-chart path.area { - fill-opacity: .3; - stroke: none; -} - -.dc-chart .node { - font-size: 0.7em; - cursor: pointer; -} - -.dc-chart .node :hover { - fill-opacity: .8; -} -/* -.dc-chart .outlined { - fill-opacity: .8; -} -*/ - -.dc-chart .accented circle { - fill-opacity: .8; - stroke-width: 3; - stroke: #E637A8; - //stroke: rgb(188,71,71); -} - -.dc-chart .selected circle { - stroke-width: 1; - stroke: #ccc; - fill-opacity: 1; -} - -.dc-chart .deselected circle { - stroke: none; - fill-opacity: .5; - fill: #ccc; -} - -.dc-chart .bubble { - stroke: none; - fill-opacity: 0.6; -} - -.dc-data-count { - //float: right; - margin-top: 15px; - margin-right: 15px; -} - -.dc-data-count .filter-count { - color: #3182bd; - font-weight: bold; -} - -.dc-data-count .total-count { - color: #3182bd; - font-weight: bold; -} - -.dc-chart g.state { - cursor: pointer; -} - -.dc-chart g.state :hover { - fill-opacity: .8; -} - -.dc-chart g.state path { - stroke: white; -} - -.dc-chart g.selected path { -} - -.dc-chart g.deselected path { - fill: grey; -} - -.dc-chart g.selected text { -} - -.dc-chart g.deselected text { - display: none; -} - -.dc-chart g.county path { - stroke: white; - //fill: none; -} - -.dc-chart g.county :hover { - fill-opacity: .8; -} - -.dc-chart g.debug rect { - fill: blue; - fill-opacity: .2; -} - -.dc-chart g.row rect { - fill-opacity: 0.8; - cursor: pointer; -} - -.dc-chart g.row rect:hover { - fill-opacity: 0.6; -} - -.dc-chart g.row.accented rect { - fill-opacity: 0.6; - stroke-width: 3; - stroke: #E637A8; - //stroke: rgb(188,71,71); - //stroke: white; -} - -.dc-chart g.row text { - fill: white; - font-size: 12px; - cursor: pointer; -} - -.dc-legend { - font-size: 11px; -} - -.dc-legend-item { - cursor: pointer; -} - -.dc-chart g.axis text { - /* Makes it so the user can't accidentally click and select text that is meant as a label only */ - -webkit-user-select: none; /* Chrome/Safari */ - -moz-user-select: none; /* Firefox */ - -ms-user-select: none; /* IE10 */ - -o-user-select: none; - user-select: none; - pointer-events: none; -} - -.dc-chart .accented path { - fill-opacity: .8; - stroke-width: 3; - stroke: #E637A8 !important; - //stroke: rgb(188,71,71) !important; -} - -.dc-chart .highlight { - fill-opacity: 1; - stroke-opacity: 1; -} - -.dc-chart .fadeout { - fill-opacity: 0.2; - stroke-opacity: 0.2; -} - -.dc-chart path.dc-symbol, g.dc-legend-item.fadeout { - fill-opacity: 0.5; - stroke-opacity: 0.5; -} - -.dc-hard .number-display { - float: none; -} - -.dc-chart .box text { - font: 10px sans-serif; - -webkit-user-select: none; /* Chrome/Safari */ - -moz-user-select: none; /* Firefox */ - -ms-user-select: none; /* IE10 */ - -o-user-select: none; - user-select: none; - pointer-events: none; -} - -.dc-chart .box line, -.dc-chart .box circle { - fill: #fff; - stroke: #000; - stroke-width: 1.5px; -} - -.dc-chart .box rect { - stroke: #000; - stroke-width: 1.5px; -} - -.dc-chart .box .center { - stroke-dasharray: 3,3; -} - -.dc-chart .box .outlier { - fill: none; - stroke: #ccc; -} - -.dc-chart .box.deselected .box { - fill: #ccc; -} - -.dc-chart .box.deselected { - opacity: .5; -} - -.dc-chart .symbol{ - stroke: none; -} - -.dc-chart .heatmap .box-group.deselected rect { - stroke: none; - fill-opacity: .5; - fill: #ccc; -} - -.dc-chart .heatmap g.axis text { - pointer-events: all; - cursor: pointer; -} - -.dc-chart .heat-box { - cursor: pointer; -} - -.dc-chart .heat-box:hover{ - fill-opacity:0.8; -} -/*--------Variables-------*/ -body { - font-family: "Roboto", Sans-Serif; } - -.lock-measure { - left: 100%; - top: 0; - transform: translate(-20px, -52px); } - -.color-legend-restore { - display: none !important; } - -.mapboxgl-canvas-container { - position: absolute; - top: 0; } - -.panel-default { - overflow: visible; } - -.data-count, #data-count { - height: auto !important; } - -.open-toggle { - cursor: pointer; } - -.legendables.nominal-legend { - border: 1px solid #e2e2e2 !important; } - -.legendables .header { - font-weight: normal; } - -.anim-button-play, .anim-button-stop { - z-index: 2; - opacity: 1 !important; - border: 1px solid #e2e2e2; - width: 24px; - height: 24px; - cursor: pointer; - bottom: 124px; - background: white; } - .anim-button-play:hover, .anim-button-stop:hover { - background: white !important; } - .anim-button-play .fa, .anim-button-stop .fa { - font-size: 13px !important; - color: #868686 !important; - position: relative; - top: -1px; } - -.mapboxgl-ctrl-attrib { - position: absolute; - right: 20px; - bottom: 4px; - font-size: 11px; - background: rgba(255, 255, 255, 0.4); } - -.mapboxgl-ctrl-attrib a, .mapboxgl-ctrl-attrib a:visited { - color: #868686; - padding: 0 4px; - text-decoration: none; } - -.basemap-satellite .gradient-legend .block .text, .basemap-dark .gradient-legend .block .text, .basemap-odyssey .gradient-legend .block .text, .basemap-decimal .gradient-legend .block .text { - color: #eeeeee; - text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; - background: transparent; } - -.basemap-satellite .gradient-legend .block input, .basemap-dark .gradient-legend .block input, .basemap-odyssey .gradient-legend .block input, .basemap-decimal .gradient-legend .block input { - color: black; } - -.basemap-satellite .mapboxgl-ctrl-attrib, .basemap-dark .mapboxgl-ctrl-attrib, .basemap-odyssey .mapboxgl-ctrl-attrib, .basemap-decimal .mapboxgl-ctrl-attrib { - background: rgba(0, 0, 0, 0.4); } - -.basemap-satellite .mapboxgl-ctrl-attrib a, .basemap-satellite .mapboxgl-ctrl-attrib a:visited, .basemap-dark .mapboxgl-ctrl-attrib a, .basemap-dark .mapboxgl-ctrl-attrib a:visited, .basemap-odyssey .mapboxgl-ctrl-attrib a, .basemap-odyssey .mapboxgl-ctrl-attrib a:visited, .basemap-decimal .mapboxgl-ctrl-attrib a, .basemap-decimal .mapboxgl-ctrl-attrib a:visited { - color: #c7c7c7; } - .basemap-satellite .mapboxgl-ctrl-attrib a:hover, .basemap-satellite .mapboxgl-ctrl-attrib a:visited:hover, .basemap-dark .mapboxgl-ctrl-attrib a:hover, .basemap-dark .mapboxgl-ctrl-attrib a:visited:hover, .basemap-odyssey .mapboxgl-ctrl-attrib a:hover, .basemap-odyssey .mapboxgl-ctrl-attrib a:visited:hover, .basemap-decimal .mapboxgl-ctrl-attrib a:hover, .basemap-decimal .mapboxgl-ctrl-attrib a:visited:hover { - color: #22A7F0; } - -.basemap-satellite .legend-cont .legend-label, .basemap-dark .legend-cont .legend-label, .basemap-odyssey .legend-cont .legend-label, .basemap-decimal .legend-cont .legend-label { - color: white; - background: rgba(0, 0, 0, 0.4); } - -.react-resizable-handle { - padding: 0 !important; - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDggNDg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGUgdHlwZT0idGV4dC9jc3MiPi5zdDB7ZGlzcGxheTpub25lO30uc3Qxe2ZpbGw6I0E3QTdBNzt9LnN0MntmaWxsOiNGRkZGRkY7fTwvc3R5bGU+PGcgaWQ9IkxheWVyXzEiIGNsYXNzPSJzdDAiPjwvZz48ZyBpZD0iTGF5ZXJfMiI+PGc+PHBvbHlnb24gY2xhc3M9InN0MSIgcG9pbnRzPSIxNSwzMyAxNSwyNS43IDI1LjcsMjUuNyAyNS43LDE1IDMzLDE1IDMzLDMzICIvPjxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik0zMiwxNnYxMC43VjMyaC01LjNIMTZ2LTUuM2gxMC43VjE2SDMyIE0zNCwxNGgtMmgtNS4zaC0ydjJ2OC43SDE2aC0ydjJWMzJ2MmgyaDEwLjdIMzJoMnYtMnYtNS4zVjE2VjE0TDM0LDE0eiIvPjwvZz48L2c+PC9zdmc+) !important; } - -.anim-button-play { - bottom: 152px; } - .anim-button-play:hover .fa { - color: #00E676 !important; } - .anim-button-play.pause-button:hover .fa { - color: #FFAB40 !important; } - -.anim-button-stop:hover .fa { - color: #FF5252 !important; } - -.dc-chart { - position: relative; - font-family: "Roboto", Sans-Serif; } - .dc-chart .svg-wrapper:hover .brush .resize path { - opacity: .5; } - .dc-chart .stack-list path.line { - stroke-linecap: round; - stroke-linejoin: round; } - .dc-chart .number-chart-wrapper { - position: relative; - top: 50%; - transform: translateY(-50%); - text-align: center; } - .dc-chart .number-chart-wrapper .number-chart-number { - display: inline-block; - position: relative; - font-weight: normal; } - .dc-chart .node { - font-size: 11px; - font-weight: bold; } - .dc-chart .node text { - pointer-events: none; } - .dc-chart .node:hover circle, .dc-chart .node.node-hover circle { - fill-opacity: .8; } - .dc-chart .node.hide-label text { - opacity: 0; - pointer-events: none; } - .dc-chart .node.hide-label.deselected text { - opacity: 0; } - .dc-chart .node.hide-label.selected text { - opacity: .9; } - .dc-chart .node.selected circle { - stroke: none !important; } - .dc-chart .node.deselected text { - display: block !important; - opacity: .5; } - .dc-chart .mouse-out-detect { - fill: white; - fill-opacity: 0; } - .dc-chart .bin-row { - position: absolute; - left: 0; - top: 5px; - z-index: 5; - display: flex; - font-size: 11px; - transform: translateX(16px); - color: #868686; } - .dc-chart .bin-row span { - margin-right: 4px; } - .dc-chart .bin-row-item { - padding: 0 4px; - cursor: pointer; } - .dc-chart .bin-row-item:hover { - color: #22A7F0; } - .dc-chart .bin-row-item.inactive { - pointer-events: none; - color: #e2e2e2; - display: none; } - .dc-chart .bin-row-item.underline { - border-bottom: #22A7F0 2px solid; } - .dc-chart .bin-row-item.active { - color: #22A7F0; - font-weight: bold; } - .dc-chart .bin-row-item.active:not(:nth-child(2)) { - border-bottom: #22A7F0 2px solid; } - .dc-chart .range-display { - position: absolute; - right: 0; - top: 4px; - font-size: 11px; - color: #868686; - z-index: 6; - display: flex; } - .dc-chart .range-display span { - margin: 0 2px; } - .dc-chart .range-display input { - display: inline-block; - border: 1px solid transparent; - text-align: center; } - .dc-chart .range-display input.active { - border: 1px solid #c7c7c7; } - .dc-chart .range-display input.range-day { - width: 70px; } - .dc-chart .range-display input.range-time { - width: 48px; - border-left: 0; } - .dc-chart .range-display input.range-time.disable { - border-color: transparent; - pointer-events: none; - display: none; } - .dc-chart .range-display:hover input { - border: 1px solid #c7c7c7; } - .dc-chart .axis { - fill: #868686; } - .dc-chart .axis text { - font-family: "Roboto"; } - .dc-chart .axis path, .dc-chart .axis line { - stroke: #c7c7c7 !important; } - .dc-chart .brush .resize path { - stroke: #868686; - fill: #868686; - opacity: 0; - transition: opacity .25s; } - .dc-chart .brush .resize:hover path { - opacity: 1; } - .dc-chart .brush rect.extent { - fill: #22A7F0; - fill-opacity: .2; } - .dc-chart .geocoder-input { - top: 8px !important; - right: 8px !important; - font-size: 13px; - padding: 0 0 0 8px; - border: 1px solid #e2e2e2; - height: 28px; - border-radius: 0; - z-index: 10; - outline: none; } - .dc-chart .latLonCoordinate { - width: 110px; - height: 36px; - padding: 2px 4px; - font-size: 10px; - line-height: 14px; - position: absolute; - z-index: 10; - border: 1px solid #868686; - outline: none; - border-radius: 0; - bottom: 36px; - right: 125px; - color: #888; - background: #ffffff; - display: none; } - .dc-chart .latLonCoordinate.visible { - display: block; } - .dc-chart .mapboxgl-canvas-container { - position: relative; - top: auto; } - .dc-chart .heat-box { - stroke: white; } - .dc-chart .heatmap .box-group.deselected rect { - stroke: white; } - .dc-chart .pie-slice path { - stroke: white; - stroke-width: 1px; } - .dc-chart .pie-slice.stroke-thick path { - stroke-width: 2px; } - .dc-chart .pie-label { - fill: #404040; - pointer-events: none; } - .dc-chart .pie-label text { - text-anchor: middle; } - .dc-chart .value-dim { - font-weight: bold; } - .dc-chart .row text { - fill: #404040 !important; } - .dc-chart g.deselected:not(.pie-slice.all-others) path { - fill: #c7c7c7; } - .dc-chart g.deselected:not(.pie-slice.all-others) path:hover { - fill: #e2e2e2; } - .dc-chart g.deselected:not(.pie-slice.all-others) path text { - fill-opacity: #868686; } - .dc-chart text.deselected-label { - fill: #868686 !important; } - .dc-chart div.x-axis-label, .dc-chart div.y-axis-label, .dc-chart div.y2-axis-label, .dc-chart div.axis-label-edit { - position: absolute; - font-size: 13px !important; - color: #868686; - z-index: 2; - pointer-events: none; - height: 18px; - max-width: 100%; } - .dc-chart div.y-axis-label, .dc-chart div.axis-label-edit.type-y, .dc-chart div.y2-axis-label, .dc-chart div.axis-label-edit.type-y2 { - transform-origin: 50% 0; - transform: translateX(-50%) rotate(270deg); - left: 4px; } - .dc-chart div.y-axis-label input, .dc-chart div.axis-label-edit.type-y input, .dc-chart div.y2-axis-label input, .dc-chart div.axis-label-edit.type-y2 input { - cursor: vertical-text; - top: -1px; } - .dc-chart div.x-axis-label, .dc-chart div.axis-label-edit.type-x { - transform: translateX(-50%); - bottom: 4px; } - .dc-chart div.axis-label-edit { - pointer-events: none; - text-align: center; - display: flex; - justify-content: center; - width: 100%; } - .dc-chart div.axis-label-edit .input-wrapper { - position: relative; - display: block; } - .dc-chart div.axis-label-edit span { - white-space: nowrap; - padding: 0 4px; - display: block; - max-width: 100%; - overflow: hidden; - text-overflow: ellipsis; - position: relative; - min-width: 64px; - pointer-events: auto; } - .dc-chart div.axis-label-edit input { - pointer-events: auto; - position: absolute; - top: -2px; - left: 0; - cursor: text; - width: 100%; - color: #868686; - outline: none; - text-align: center; - opacity: 0; - height: auto; } - .dc-chart div.axis-label-edit input:focus { - opacity: 1; } - .dc-chart div.axis-label-edit input:placeholder { - font-weight: normal; - font-style: italic; } - .dc-chart div.axis-label-edit input::-ms-clear { - display: none; - width: 0; - height: 0; } - .dc-chart div.axis-label-edit input::-webkit-input-placeholder { - /* Chrome/Opera/Safari */ - font-weight: normal; - font-style: italic; } - .dc-chart div.axis-label-edit input::-moz-placeholder { - /* Firefox 19+ */ - font-weight: normal; - font-style: italic; } - .dc-chart div.axis-label-edit input:-ms-input-placeholder { - /* IE 10+ */ - font-weight: normal; - font-style: italic; } - .dc-chart div.axis-label-edit input:-moz-placeholder { - /* Firefox 18- */ - font-weight: normal; - font-style: italic; } - .dc-chart div.axis-label-edit:hover { - z-index: 3; } - .dc-chart div.axis-label-edit:hover input { - opacity: 1; } - .dc-chart div.axis-label-edit + .x-axis-label { - display: none; } - .dc-chart div.axis-label-edit.has-legend:before, .dc-chart div.axis-label-edit.has-legend:after { - content: ""; - display: block; - flex-grow: 1; - pointer-events: none; - width: 120px; } - .dc-chart div.axis-label-edit.has-legend:before { - flex-shrink: 0; } - .dc-chart .external-axis { - position: absolute; - width: 100%; - height: 52px; - bottom: 0; } - .dc-chart .external-axis .axis path, .dc-chart .external-axis .axis line { - stroke: #c7c7c7 !important; } - .dc-chart .external-axis .axis text { - fill: #868686 !important; } - .dc-chart .md-table-wrapper { - padding: 0; - overflow: hidden; - position: relative; - width: 100%; - height: 100%; - display: flex; - flex-direction: column; } - .dc-chart .md-table-wrapper table { - width: 100%; - margin-top: -27px; - margin-bottom: 8px; } - .dc-chart .md-table-wrapper td { - border-bottom: 1px solid #f5f5f5; - font-size: 13px; - padding: 4px 6px; } - .dc-chart .md-table-wrapper td:hover { - color: #22A7F0 !important; - cursor: pointer !important; } - .dc-chart .md-table-wrapper td.filtered { - color: #22A7F0; } - .dc-chart .md-table-wrapper td.disabled { - pointer-events: none; } - .dc-chart .md-table-wrapper td.cell-align-left { - text-align: left; } - .dc-chart .md-table-wrapper td.cell-align-right { - text-align: right; } - .dc-chart .md-table-wrapper td.cell-align-center { - text-align: center; } - .dc-chart .md-table-wrapper th { - border-bottom: 1px solid #e2e2e2; - color: #868686; - font-size: 13px; - padding: 4px 24px 4px 20px; - white-space: nowrap; } - .dc-chart .md-table-wrapper tr.deselected { - background: #f5f5f5; } - .dc-chart .md-table-wrapper tr.deselected td { - color: #868686; } - .dc-chart .md-table-wrapper tr.grouped-data:hover td { - color: #22A7F0; } - .dc-chart .md-header-spacer { - width: 100%; - height: 27px; - flex-shrink: 0; } - .dc-chart .md-table-scroll { - overflow: auto; - padding: 0 12px; - width: 100%; - flex-grow: 1; } - .dc-chart .md-table-header { - position: absolute; - top: 0; - left: 0; - width: 100%; - padding: 0 12px; - overflow: hidden; } - .dc-chart .docked-table-header { - display: flex; - position: relative; } - .dc-chart .table-header-item { - position: relative; - white-space: nowrap; } - .dc-chart .table-header-item .left-align-btn, .dc-chart .table-header-item .center-align-btn, .dc-chart .table-header-item .right-align-btn { - width: 18px; - height: 24px; - position: absolute; - right: 0; - top: 1px; - padding: 4px 0px; - cursor: pointer; - display: none; } - .dc-chart .table-header-item .left-align-btn.active .svg-icon, .dc-chart .table-header-item .center-align-btn.active .svg-icon, .dc-chart .table-header-item .right-align-btn.active .svg-icon { - fill: #22A7F0; } - .dc-chart .table-header-item .left-align-btn:hover .svg-icon, .dc-chart .table-header-item .center-align-btn:hover .svg-icon, .dc-chart .table-header-item .right-align-btn:hover .svg-icon { - fill: #22A7F0; } - .dc-chart .table-header-item:hover .left-align-btn, .dc-chart .table-header-item:hover .center-align-btn, .dc-chart .table-header-item:hover .right-align-btn { - display: block; } - .dc-chart .table-header-item.isFiltered .unfilter-btn { - display: block; } - .dc-chart .table-header-item .unfilter-btn { - width: 24px; - height: 24px; - position: absolute; - right: 0; - top: 0; - padding: 4px; - display: none; - cursor: pointer; } - .dc-chart .table-header-item .unfilter-btn .svg-icon { - fill: #22A7F0; } - .dc-chart .table-header-item .unfilter-btn:hover .svg-icon { - fill: #ff0000; } - .dc-chart .null-value { - font-style: italic; } - .dc-chart .table-sort { - border-bottom: 1px solid #e2e2e2; - color: #868686; - font-size: 13px; - padding: 4px 24px 4px 20px; - background: white; - position: relative; - cursor: text; } - .dc-chart .table-sort.active { - color: #22A7F0; } - .dc-chart .table-sort.active:after { - content: ''; - position: absolute; - width: 100%; - height: 2px; - bottom: -1px; - background: #22A7F0; - left: 0; } - .dc-chart .table-sort.active .sort-btn .svg-icon { - fill: #22A7F0; } - .dc-chart .table-sort.active .svg-icon.icon-sort-arrow { - display: block; } - .dc-chart .table-sort.active .svg-icon.icon-sort { - display: none; } - .dc-chart .table-sort.active.asc .icon-sort-arrow { - transform: rotate(0); } - .dc-chart .table-sort .sort-btn { - width: 24px; - height: 24px; - position: absolute; - left: 0; - top: 1px; - padding: 4px; - cursor: pointer; } - .dc-chart .table-sort .svg-icon { - width: 100%; - height: 100%; } - .dc-chart .table-sort .svg-icon:hover { - fill: #22A7F0; } - .dc-chart .table-sort .svg-icon.icon-sort-arrow { - display: none; - transform: rotate(180deg); } - .dc-chart .table-sort.disabled { - padding-left: 8px; } - .dc-chart .table-sort.disabled .sort-btn { - display: none; } - .dc-chart .table-sort.disabled + .unfilter-btn { - transform: translateX(-12px); } - .dc-chart.mapboxgl-map { - overflow: visible; } - .dc-chart .mapboxgl-canvas { - outline: none; } - .dc-chart .map-point { - position: absolute; - transform-origin: 0 0; - animation: showMapPoint .5s; } - .dc-chart .map-point.removePoint { - animation: hideMapPoint .25s; } - .dc-chart .map-point.removePoint .map-point-gfx { - border-width: 0; } - .dc-chart .map-point-new { - position: absolute; - transform-origin: 0 0; } - .dc-chart .map-point-new.popupPoint { - animation: showMapPoint .5s; } - .dc-chart .map-point-new.removePoint { - animation: hideMapPoint .25s; } - .dc-chart .map-point-new.removePoint .map-point-gfx { - border-width: 0; } - .dc-chart .map-point-new.fadeInPoint { - animation: fadeInMapPoint .5s; } - .dc-chart .map-point-new.fadeOutPoint { - animation: fadeOutMapPoint .25s; } - .dc-chart .map-point-gfx { - width: 16px; - height: 16px; - background: #22A7F0; - border-radius: 50%; - transform: translate(-50%, -50%); - border: 3px solid white; - transition: border .25s; - box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.4); - pointer-events: none; } - .dc-chart .map-polygon-shape { - pointer-events: none; } - .dc-chart .map-popup, .dc-chart .map-point-wrap { - width: 100%; - height: 100%; - position: absolute; - top: 0; - left: 0; - pointer-events: none; } - .dc-chart .map-point-wrap { - overflow: hidden; } - .dc-chart .map-popup-wrap { - position: absolute; - z-index: 11; - width: 0; - display: flex; - animation: showMapPopup .25s; } - .dc-chart .map-popup-wrap.removePopup { - opacity: 0; - animation: hideMapPopup .25s; } - .dc-chart .map-popup-wrap-new { - position: absolute; - width: 0; - display: flex; } - .dc-chart .map-popup-wrap-new.showPopup { - animation: showMapPopup .25s; } - .dc-chart .map-popup-wrap-new.removePopup { - opacity: 0; - animation: hideMapPopup .25s; } - .dc-chart .map-popup-box { - flex-shrink: 0; - min-width: 120px; - max-width: 240px; - padding: 8px 8px 4px 8px; - background: white; - border-radius: 4px; - border: 1px solid #c7c7c7; - position: relative; - word-wrap: break-word; - transform: translate(-50%, -100%); - top: -12px; - pointer-events: auto; } - .dc-chart .map-popup-box.pop-down { - transform: translate(-50%, 0); - top: 12px; } - .dc-chart .map-popup-box.pop-down .map-popup-bridge { - top: 0; - bottom: auto; - transform: translate(-50%, -24px); } - .dc-chart .map-popup-box .map-popup-bridge { - position: absolute; - height: 24px; - width: 24px; - bottom: 0; - left: 50%; - transform: translate(-50%, 24px); } - .dc-chart .map-popup-box .map-popup-item { - font-size: 12px; - line-height: 1.2; - margin-bottom: 4px; } - .dc-chart .map-popup-box .popup-item-key { - font-weight: bold; } - .dc-chart .map-popup-box-new { - flex-shrink: 0; - min-width: 120px; - max-width: 240px; - padding: 8px 12px 4px 8px; - background: white; - border-radius: 4px; - border: 1px solid #c7c7c7; - position: relative; - word-wrap: break-word; - transform: translate(-50%, -50%); - pointer-events: auto; } - .dc-chart .map-popup-box-new:hover .popup-item-copy { - visibility: visible; } - .dc-chart .map-popup-box-new .map-popup-item { - font-size: 12px; - line-height: 1.2; - margin-bottom: 4px; } - .dc-chart .map-popup-box-new .map-popup-item .popup-item-val { - display: inline-block; - word-break: break-all; } - .dc-chart .map-popup-box-new .map-popup-item .popup-item-val a { - text-decoration: none; } - .dc-chart .map-popup-box-new .map-popup-item .popup-item-val a:hover { - border-bottom: 1px solid; - color: #22A7F0; } - .dc-chart .map-popup-box-new .map-popup-item .map-popup-image { - width: 95%; - height: 200px; - object-fit: contain; } - .dc-chart .map-popup-box-new .popup-item-copy { - display: inline-block; - position: absolute; - top: 4px; - right: 4px; - cursor: pointer; - justify-content: flex-end; - visibility: hidden; } - .dc-chart .map-popup-box-new .popup-item-key { - font-weight: bold; } - .dc-chart .map-poly { - fill: #22A7F0; - stroke: #ffffff; - stroke-width: 2; - pointer-events: none; } - .dc-chart .map-poly.popupPoly { - animation: showMapPoint .5s; } - .dc-chart .map-poly.removePoly { - animation: hideMapPoint .25s; } - .dc-chart .map-poly.fadeInPoly { - animation: fadeInMapPoint .5s; } - .dc-chart .map-poly.fadeOutPoly { - animation: fadeOutMapPoint .25s; } - .dc-chart .map-polyline g { - fill: none; - stroke: #ffffff; - stroke-width: 4; - pointer-events: none; } - .dc-chart .map-polyline g.popupPoly { - animation: showMapPoint .5s; } - .dc-chart .map-polyline g.removePoly { - animation: hideMapPoint .25s; } - .dc-chart .map-polyline g.fadeInPoly { - animation: fadeInMapPoint .5s; } - .dc-chart .map-polyline g.fadeOutPoly { - animation: fadeOutMapPoint .25s; } - -@keyframes showMapPopup { - 0% { - opacity: 0; - transform: translateY(6px); } - 100% { - opacity: 1; - transform: translateY(0); } } - -@keyframes hideMapPopup { - 0% { - opacity: 1; - transform: translateY(0); } - 100% { - opacity: 0; - transform: translateY(6px); } } - -@keyframes fadeInMapPoint { - 0% { - opacity: 0; - transform: scale(1); } - 50% { - transform: scale(1.2); } - 100% { - opacity: 1; - transform: scale(1); } } - -@keyframes fadeOutMapPoint { - 0% { - opacity: 1; } - 100% { - opacity: 0; } } - -@keyframes showMapPoint { - 0% { - transform: scale(0); } - 50% { - transform: scale(1.2); } - 100% { - transform: scale(1); } } - -@keyframes hideMapPoint { - 0% { - transform: scale(1); } - 100% { - transform: scale(0); } } - -.chart-popup { - position: absolute; - top: 0; - left: 0; - opacity: 0; - pointer-events: none; - z-index: 1003; } - .chart-popup.hide-delay { - transition: opacity 0; - transition-delay: .1s; } - .chart-popup.hide-delay .chart-popup-box { - transition-delay: 1s; } - .chart-popup.scatter-plot-popup .chart-popup-box { - transition: top .15s, opacity .2s; } - .chart-popup.js-showPopup { - opacity: 1; - transition: none; } - .chart-popup.js-showPopup .chart-popup-box { - pointer-events: auto; - opacity: 1; - top: -24px; - transition-delay: 0s; } - .chart-popup.js-showPopup .chart-popup-box.popdown { - top: 24px; } - .chart-popup.js-showPopup .chart-popup-box.align-left-center { - top: 0; } - .chart-popup.popup-scrollable.js-showPopup { - pointer-events: auto; } - .chart-popup.popup-scrollable.js-showPopup.delay-pointer { - pointer-events: none; } - .chart-popup.popup-scrollable .chart-popup-box { - max-height: 160px; } - .chart-popup .popup-bridge { - width: 32px; - height: 48px; - position: absolute; - top: 100%; - left: 50%; - transform: translate(-50%, 0); } - .chart-popup .bridge-hitbox { - cursor: pointer; - position: absolute; - bottom: 0; - width: 100%; - padding-bottom: 100%; - border-radius: 50%; } - .chart-popup th { - border-bottom: 1px solid #e2e2e2; - color: #868686; - font-size: 0.84em; - font-weight: normal; - background: white; } - .chart-popup .popup-table { - margin: 0 8px; - font-size: 1em; - white-space: nowrap; } - .chart-popup .popup-table tr:hover { - background: #f5f5f5; } - .chart-popup .popup-table tr.deselected { - opacity: .5; } - .chart-popup .popup-table tr.deselected .table-legend { - background: #c7c7c7 !important; } - .chart-popup .popup-table td, .chart-popup .popup-table th { - padding: 4px; - text-align: center; } - .chart-popup .popup-table td:first-child, .chart-popup .popup-table th:first-child { - text-align: left; } - .chart-popup .popup-table td { - cursor: pointer; } - .chart-popup .popup-table th { - position: relative; } - .chart-popup .popup-table th .ellipse-text { - max-width: 64px; - text-overflow: ellipsis; - overflow: hidden; - position: relative; } - .chart-popup .popup-table th:first-child .ellipse-text { - max-width: 160px; } - .chart-popup .popup-table th .full-text { - position: absolute; - background: white; - top: 0; - opacity: 0; - transition: none; } - .chart-popup .popup-table th .full-text:hover.scroll-text { - opacity: 1; - transition: transform 1s linear; } - .chart-popup .popup-table .table-dim { - display: flex; } - .chart-popup .popup-table .table-dim-val { - min-width: 80px; - max-width: 160px; - font-weight: bold; - line-height: 1.2; - white-space: normal; } - .chart-popup .table-legend { - height: 12px; - width: 12px; - margin-right: 6px; - flex-shrink: 0; - align-self: center; } - .chart-popup .chart-popup-content { - display: flex; } - .chart-popup .chart-popup-content.popup-list { - flex-direction: column; - padding: 0 8px 2px 8px; } - .chart-popup .chart-popup-box { - pointer-events: none; - min-height: 32px; - min-width: 120px; - background: white; - position: absolute; - left: 0; - border: 1px solid #e2e2e2; - border-radius: 4px; - transform: translate(0, -100%); - opacity: 0; - top: 0; - transition: top .35s, opacity .25s; - font-size: 13px; } - .chart-popup .chart-popup-box.align-left-center { - left: 32px; - transform: translate(0, -50%); } - .chart-popup .chart-popup-box.align-right-center { - left: -32px; - transform: translate(-100%, -50%); } - .chart-popup .chart-popup-box.align-center { - transform: translate(-50%, -100%); } - .chart-popup .chart-popup-box.align-right { - transform: translate(-100%, -100%); } - .chart-popup .chart-popup-box.popdown { - transform: translate(-50%, 0); } - .chart-popup .chart-popup-box.popdown .popup-bridge { - bottom: 100%; - top: auto; } - .chart-popup .chart-popup-box.popdown .bridge-hitbox { - top: 0; - bottom: auto; } - .chart-popup .popup-table-wrap { - flex-direction: column; - position: relative; - max-height: 158px; } - .chart-popup .popup-legend { - width: 12px; - height: 12px; - float: left; - margin: 8px; - flex-shrink: 0; } - .chart-popup .popup-value { - font-size: 1em; - line-height: 1.2; - white-space: nowrap; - flex-shrink: 0; - padding: 7px 8px 4px 0; } - .chart-popup .popup-value-dim { - font-weight: bold; } - .chart-popup .popup-header { - border-bottom: 1px solid #e2e2e2; - color: #868686; - font-size: 0.77em; - white-space: nowrap; - padding: 4px 4px 2px 4px; } - .chart-popup .popup-item { - display: flex; - align-items: center; } - .chart-popup .popup-item .popup-legend { - flex-shrink: 0; - flex-grow: 0; - padding: 0; - margin: 6px 8px 8px 4px; } - .chart-popup .popup-item-key { - font-size: 0.92em; - font-weight: bold; - flex-grow: 1; - line-height: 1; - padding-right: 8px; - white-space: nowrap; - max-width: 120px; - overflow: hidden; - text-overflow: ellipsis; } - .chart-popup .popup-item-value { - font-size: 1em; - flex-grow: 1; } - .chart-popup .popup-item-value.text-align-right { - text-align: right; } - -.legend-cont { - position: absolute; - z-index: 2; - min-height: 32px; - bottom: 0px; - left: 16px; - padding-right: 24px; } - .legend-cont:hover .legend-lock, .legend-cont:hover .legend-title { - opacity: 1; - pointer-events: auto; } - .legend-cont .legend-lock, .legend-cont .legend-title { - opacity: 0; - pointer-events: none; } - .legend-cont .legend-group:hover .legend-label { - display: none; } - .legend-cont .legend-group:hover .legend-item:not(:hover) .legend-swatch { - opacity: .4; } - .legend-cont .legend-item { - float: left; - position: relative; - height: 32px; } - .legend-cont .legend-item:not(:first-child):not(:last-child) .legend-label { - display: none; } - .legend-cont .legend-item:hover .legend-label { - display: block !important; } - .legend-cont .legend-item:first-child .legend-label, .legend-cont .legend-item:last-child .legend-label { - pointer-events: auto; } - .legend-cont .legend-item:first-child .legend-label.active span, .legend-cont .legend-item:last-child .legend-label.active span { - font-size: 12px; } - .legend-cont .legend-item:first-child:hover .legend-label, .legend-cont .legend-item:first-child .legend-label.active, .legend-cont .legend-item:last-child:hover .legend-label, .legend-cont .legend-item:last-child .legend-label.active { - background: none; } - .legend-cont .legend-item:first-child:hover .legend-label span, .legend-cont .legend-item:first-child .legend-label.active span, .legend-cont .legend-item:last-child:hover .legend-label span, .legend-cont .legend-item:last-child .legend-label.active span { - opacity: 0; - pointer-events: none; - position: absolute; } - .legend-cont .legend-item:first-child:hover .legend-label .legend-input, .legend-cont .legend-item:first-child .legend-label.active .legend-input, .legend-cont .legend-item:last-child:hover .legend-label .legend-input, .legend-cont .legend-item:last-child .legend-label.active .legend-input { - position: relative; - display: inline-block; - margin: 0 16px 0 16px; - color: #868686; } - .legend-cont .legend-label { - position: absolute; - text-align: center; - transform: translateX(-50%); - left: 6px; - color: #868686; - font-size: 10px; - padding: 2px 2px 0 2px; - background: rgba(255, 255, 255, 0.4); } - .legend-cont .legend-label:hover { - z-index: 2; } - .legend-cont .legend-swatch { - height: 12px; - width: 12px; - background: red; - border: 1px solid white; } - .legend-cont .legend-input { - display: none; - pointer-events: auto; } - .legend-cont .legend-input input { - height: auto; - width: 32px; - min-width: 32px; - border: 1px solid #c7c7c7; - text-align: center; - float: left; - overflow: visible; - outline: none; } - .legend-cont .legend-input input:focus { - height: 24px; - width: 48px; - min-width: 48px; - font-size: 12px; } - .legend-cont .legend-title { - font-size: 12px; - color: #868686; - font-weight: bold; - text-align: center; - position: absolute; - top: -16px; - width: 100%; - padding-right: 24px; - white-space: nowrap; } - .legend-cont .legend-title span { - background: white; - padding: 2px 4px; } - .legend-cont .legend-lock { - width: 24px; - height: 24px; - padding: 4px; - position: absolute; - right: 0; - bottom: 14px; } - .legend-cont .legend-lock:hover { - cursor: pointer; } - .legend-cont .legend-lock:hover .svg-icon { - fill: #22A7F0; } - .legend-cont .legend-lock svg { - vector-effect: non-scaling-stroke; } - .legend-cont .legend-lock .icon-lock { - display: none; } - .legend-cont .legend-lock.js-isLocked { - opacity: 1; } - .legend-cont .legend-lock.js-isLocked .icon-lock { - display: block; } - .legend-cont .legend-lock.js-isLocked .icon-unlock { - display: none; } - -.svg-icon { - fill: #868686; } - -.map-svg { - left: 0; - position: absolute; } - -.dc-legend { - position: absolute; - z-index: 1; - background: rgba(255, 255, 255, 0.9); - bottom: 8px; - left: 8px; - max-width: 160px; - border: 1px solid #e2e2e2; - border-radius: 2px; - font-size: 13px; - min-width: 100px; } - .dc-legend:hover { - background: white; } - .dc-legend:hover .toggle-btn { - opacity: 1; } - .dc-legend:hover .dc-legend-body::-webkit-scrollbar-thumb { - background-color: rgba(0, 0, 0, 0.4); } - .dc-legend .dc-legend-header { - border-bottom: 1px solid #e2e2e2; - color: #868686; - font-size: 0.84em; - margin: 4px 4px 0 4px; - position: relative; - padding-right: 20px; - padding-bottom: 2px; - word-break: break-word; } - .dc-legend .toggle-btn { - width: 24px; - height: 24px; - position: absolute; - top: -6px; - right: -6px; - cursor: pointer; - transform: scale(0.4); - transition: opacity .25s; - opacity: 0; } - .dc-legend .toggle-btn:after, .dc-legend .toggle-btn:before { - content: ''; - position: absolute; } - .dc-legend .toggle-btn:after { - transform: translate(-50%, -50%) rotate(45deg); - top: 50%; - left: 50%; - width: 4px; - height: 24px; - background: #868686; } - .dc-legend .toggle-btn:before { - width: 16px; - height: 16px; - bottom: 0; - left: 0; - border: 8px solid transparent; - border-left-color: #868686; - border-bottom-color: #868686; } - .dc-legend .toggle-btn:hover:after { - background: #22A7F0; } - .dc-legend .toggle-btn:hover:before { - border-left-color: #22A7F0; - border-bottom-color: #22A7F0; } - .dc-legend .dc-legend-body { - max-height: 120px; - overflow-y: auto; - padding: 0 4px 4px 4px; - font-size: 1em; } - .dc-legend .dc-legend-body::-webkit-scrollbar { - -webkit-appearance: none; } - .dc-legend .dc-legend-body::-webkit-scrollbar:vertical { - width: 10px; } - .dc-legend .dc-legend-body::-webkit-scrollbar:horizontal { - height: 10px; } - .dc-legend .dc-legend-body::-webkit-scrollbar-thumb { - border-radius: 8px; - border: 2px solid white; - /* should match background, can't be transparent */ - background-color: rgba(0, 0, 0, 0.2); - transition: background .25s; } - .dc-legend .dc-legend-body::-webkit-scrollbar-track { - border-radius: 8px; } - .dc-legend .legend-item-color { - width: 8px; - height: 8px; - flex-shrink: 0; } - .dc-legend .legend-item-text { - flex-grow: 1; - padding: 4px; - line-height: 1; - word-break: break-word; } - .dc-legend .dc-legend-item { - display: flex; - align-items: center; - cursor: default; - min-height: 16px; } - .dc-legend.collapsed { - min-width: 0; } - .dc-legend.collapsed .dc-legend-header { - border: 0; - padding: 4px 8px 4px 8px; - margin: 0; } - .dc-legend.collapsed .dc-legend-header:hover { - cursor: pointer; - color: #22A7F0; } - -.chart-type-row .dc-legend { - left: auto; - right: 16px !important; } - .chart-type-row .dc-legend .toggle-btn { - right: -4px; } - .chart-type-row .dc-legend .toggle-btn:after { - transform: translate(-50%, -50%) rotate(-45deg); } - .chart-type-row .dc-legend .toggle-btn:before { - transform: scaleX(-1); - left: auto; - right: 0; } - -.heatmap-scroll .axes-mask { - position: absolute; - pointer-events: none; - bottom: 0; - left: 0; - width: 48px; - height: 56px; - z-index: 3; - overflow: hidden; } - .heatmap-scroll .axes-mask:after { - content: ""; - position: absolute; - background: white; - width: 100%; - height: 100%; - top: 8px; - left: -8px; - box-shadow: 0 0 8px 8px white; } - -.heatmap-scroll .svg-wrapper { - position: relative; - overflow: auto; - left: 48px; } - -.heatmap-scroll .docked-x-axis { - position: absolute; - bottom: 0; - left: 0; - height: 56px; - z-index: 2; } - .heatmap-scroll .docked-x-axis .center { - transform: translateX(-50%); } - .heatmap-scroll .docked-x-axis .rotate-up { - transform-origin: 0 0; - transform: rotate(-90deg) translateY(-50%); - color: #323232; - font-weight: bold; - font-size: 12px; - text-shadow: 0 0 4px white; - pointer-events: none; } - .heatmap-scroll .docked-x-axis .rotate-up:before { - content: ""; - position: absolute; - width: 16px; - height: 100%; - pointer-events: auto; - left: -16px; } - .heatmap-scroll .docked-x-axis .rotate-up:after { - border: 6px solid transparent; - border-left-color: #868686; - position: absolute; - content: ""; - left: -8px; - top: 4px; - opacity: 0; } - .heatmap-scroll .docked-x-axis .rotate-up:hover:after { - opacity: 1; } - .heatmap-scroll .docked-x-axis .rotate-up:active:after { - border-left-color: #22A7F0; } - .heatmap-scroll .docked-x-axis .rotate-down { - transform-origin: 0 0; - transform: rotate(-90deg) translate(-100%, -50%); } - -.heatmap-scroll .docked-y-axis { - position: absolute; - top: 0; - left: 48px; - width: 48px; - z-index: 3; } - .heatmap-scroll .docked-y-axis .text { - transform: translate(-100%, -50%); } - -.heatmap-scroll .text { - position: absolute; - line-height: 1; - font-size: 10px; - color: #868686; - white-space: nowrap; - padding: 4px; - pointer-events: auto; - cursor: pointer; - max-width: 72px; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; } - .heatmap-scroll .text:active { - color: #22A7F0; } - -.heatmap-scroll .docked-axis-wrapper { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - pointer-events: none; - overflow: hidden; - z-index: 1; } - -.coordinate-chart .dc-legend, .chart-type-backendScatter .dc-legend { - top: 24px !important; - bottom: auto !important; - left: auto !important; - right: 24px !important; } - .coordinate-chart .dc-legend .toggle-btn, .chart-type-backendScatter .dc-legend .toggle-btn { - right: -6px; - top: -4px; - transform: scale(-0.4, 0.4) !important; } - .coordinate-chart .dc-legend .toggle-btn:after, .chart-type-backendScatter .dc-legend .toggle-btn:after { - transform: translate(-50%, -50%) rotate(-45deg); } - .coordinate-chart .dc-legend .toggle-btn:before, .chart-type-backendScatter .dc-legend .toggle-btn:before { - transform: scaleY(-1); - left: 0; - top: 0; } - -.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl.mapboxgl-ctrl-attrib { - margin: 0 !important; - position: absolute; - white-space: nowrap; - right: 100px; - bottom: 7px; - font-size: 11px; } - .mapboxgl-ctrl-bottom-right .mapboxgl-ctrl.mapboxgl-ctrl-attrib.mapboxgl-compact { - bottom: 5px; } - .mapboxgl-ctrl-bottom-right .mapboxgl-ctrl.mapboxgl-ctrl-attrib.mapboxgl-compact::after { - opacity: 0.5; } - -.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl.mapboxgl-ctrl-group { - margin: 0 10px 10px 0 !important; } - -.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl.mapboxgl-ctrl-scale { - border-color: #868686; - border-width: thin; - color: #888; - position: relative; - right: 35px; - top: 3px; } - -.mapboxgl-ctrl-top-left .mapboxgl-ctrl { - margin: 8px 0 0 8px !important; } - -.mapboxgl-ctrl-top-left .mapboxgl-ctrl-group { - border-radius: 2px; - box-shadow: none !important; - border: 1px solid #e2e2e2; } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group > button { - border-bottom: none; - width: 32px; - height: 32px; } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group > button:last-child { - position: relative; } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group > button:last-child:after { - width: calc(100% - 8px); - height: 1px; - background: #e2e2e2; - position: absolute; - top: 0; - left: 4px; - content: ""; } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group > button:hover { - background-color: white !important; } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group > button.active { - background-color: #22A7F0 !important; } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group .mapbox-gl-draw_trash { - background-size: 20px 20px; - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6I0E3QTdBNzt9PC9zdHlsZT48Zz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNMzYsMTJoLTYuNXYtMmMwLTEuOS0xLjYtMy41LTMuNS0zLjVoLTRjLTEuOSwwLTMuNSwxLjYtMy41LDMuNXYySDEyaC0ydjRoMnYyNmMwLDEuMSwwLjksMiwyLDJoMjBjMS4xLDAsMi0wLjksMi0yVjE2aDJ2LTRIMzZ6IE0yMS41LDEwYzAtMC4zLDAuMi0wLjUsMC41LTAuNWg0YzAuMywwLDAuNSwwLjIsMC41LDAuNXYyaC01VjEweiBNMzIsNDBIMTZWMTZoMTZWNDB6Ii8+PHJlY3QgeD0iMjAiIHk9IjIwIiBjbGFzcz0ic3QwIiB3aWR0aD0iMiIgaGVpZ2h0PSIxNiIvPjxyZWN0IHg9IjI2IiB5PSIyMCIgY2xhc3M9InN0MCIgd2lkdGg9IjIiIGhlaWdodD0iMTYiLz48L2c+PC9zdmc+); } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group .mapbox-gl-draw_trash:hover { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6IzIyQTdGMDt9PC9zdHlsZT48Zz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNMzYsMTJoLTYuNXYtMmMwLTEuOS0xLjYtMy41LTMuNS0zLjVoLTRjLTEuOSwwLTMuNSwxLjYtMy41LDMuNXYySDEyaC0ydjRoMnYyNmMwLDEuMSwwLjksMiwyLDJoMjBjMS4xLDAsMi0wLjksMi0yVjE2aDJ2LTRIMzZ6IE0yMS41LDEwYzAtMC4zLDAuMi0wLjUsMC41LTAuNWg0YzAuMywwLDAuNSwwLjIsMC41LDAuNXYyaC01VjEweiBNMzIsNDBIMTZWMTZoMTZWNDB6Ii8+PHJlY3QgeD0iMjAiIHk9IjIwIiBjbGFzcz0ic3QwIiB3aWR0aD0iMiIgaGVpZ2h0PSIxNiIvPjxyZWN0IHg9IjI2IiB5PSIyMCIgY2xhc3M9InN0MCIgd2lkdGg9IjIiIGhlaWdodD0iMTYiLz48L2c+PC9zdmc+); } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group .mapbox-gl-draw_polygon { - background-size: 20px 20px; - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6I0E3QTdBNzt9PC9zdHlsZT48Zz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjEzLjksMzkuOCA4LjYsMzguNiA4LjIsMzMuMSAxMi4yLDMyLjggMTIuNCwzNS4zIDE0LjksMzUuOSAiLz48L2c+PGc+PHJlY3QgeD0iNy42IiB5PSIyMi45IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjk5NjYgLTguMjQwOTg3ZS0wMiA4LjI0MDk4N2UtMDIgMC45OTY2IC0yLjE1NzggMC44ODUzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjQiIGhlaWdodD0iNy4zIi8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNy4xLDIwLjQgNi43LDE0LjkgMTEuNywxMi44IDEzLjIsMTYuNSAxMC45LDE3LjUgMTEuMSwyMCAiLz48L2c+PGc+PHJlY3QgeD0iMTQuNyIgeT0iMTAuMiIgdHJhbnNmb3JtPSJtYXRyaXgoMC45MjI0IC0wLjM4NjIgMC4zODYyIDAuOTIyNCAtMy4yODc0IDguMDQ1NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI3LjMiIGhlaWdodD0iNCIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjI5LjEsMTIuNSAyNy40LDEwLjYgMjUuMSwxMS42IDIzLjUsNy45IDI4LjUsNS44IDMyLjEsOS45ICIvPjwvZz48Zz48cmVjdCB4PSIzMi44IiB5PSIxMi40IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjc1NzggLTAuNjUyNSAwLjY1MjUgMC43NTc4IC0yLjA2NjMgMjYuNTY2NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI0IiBoZWlnaHQ9IjcuMyIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjQxLjIsMjguNCAzNy44LDI2LjMgMzkuMSwyNC4xIDM3LjQsMjIuMiA0MC40LDE5LjYgNDQsMjMuNyAiLz48L2c+PGc+PHJlY3QgeD0iMzIuNSIgeT0iMzAuOCIgdHJhbnNmb3JtPSJtYXRyaXgoMC41MTkyIC0wLjg1NDcgMC44NTQ3IDAuNTE5MiAtMTAuNjg0MiA0Ni42NzQzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjcuMyIgaGVpZ2h0PSI0Ii8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMzEuNyw0NCAyNi40LDQyLjcgMjcuMywzOC45IDI5LjgsMzkuNCAzMS4xLDM3LjMgMzQuNSwzOS4zICIvPjwvZz48Zz48cmVjdCB4PSIxOC42IiB5PSIzNS43IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjIyOTcgLTAuOTczMyAwLjk3MzMgMC4yMjk3IC0yMi4zOTYyIDUwLjM2NTcpIiBjbGFzcz0ic3QwIiB3aWR0aD0iNCIgaGVpZ2h0PSI3LjMiLz48L2c+PC9nPjwvc3ZnPg==); } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group .mapbox-gl-draw_polygon:hover { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6IzIyQTdGMDt9PC9zdHlsZT48Zz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjEzLjksMzkuOCA4LjYsMzguNiA4LjIsMzMuMSAxMi4yLDMyLjggMTIuNCwzNS4zIDE0LjksMzUuOSAiLz48L2c+PGc+PHJlY3QgeD0iNy42IiB5PSIyMi45IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjk5NjYgLTguMjQwOTg3ZS0wMiA4LjI0MDk4N2UtMDIgMC45OTY2IC0yLjE1NzggMC44ODUzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjQiIGhlaWdodD0iNy4zIi8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNy4xLDIwLjQgNi43LDE0LjkgMTEuNywxMi44IDEzLjIsMTYuNSAxMC45LDE3LjUgMTEuMSwyMCAiLz48L2c+PGc+PHJlY3QgeD0iMTQuNyIgeT0iMTAuMiIgdHJhbnNmb3JtPSJtYXRyaXgoMC45MjI0IC0wLjM4NjIgMC4zODYyIDAuOTIyNCAtMy4yODc0IDguMDQ1NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI3LjMiIGhlaWdodD0iNCIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjI5LjEsMTIuNSAyNy40LDEwLjYgMjUuMSwxMS42IDIzLjUsNy45IDI4LjUsNS44IDMyLjEsOS45ICIvPjwvZz48Zz48cmVjdCB4PSIzMi44IiB5PSIxMi40IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjc1NzggLTAuNjUyNSAwLjY1MjUgMC43NTc4IC0yLjA2NjMgMjYuNTY2NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI0IiBoZWlnaHQ9IjcuMyIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjQxLjIsMjguNCAzNy44LDI2LjMgMzkuMSwyNC4xIDM3LjQsMjIuMiA0MC40LDE5LjYgNDQsMjMuNyAiLz48L2c+PGc+PHJlY3QgeD0iMzIuNSIgeT0iMzAuOCIgdHJhbnNmb3JtPSJtYXRyaXgoMC41MTkyIC0wLjg1NDcgMC44NTQ3IDAuNTE5MiAtMTAuNjg0MiA0Ni42NzQzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjcuMyIgaGVpZ2h0PSI0Ii8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMzEuNyw0NCAyNi40LDQyLjcgMjcuMywzOC45IDI5LjgsMzkuNCAzMS4xLDM3LjMgMzQuNSwzOS4zICIvPjwvZz48Zz48cmVjdCB4PSIxOC42IiB5PSIzNS43IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjIyOTcgLTAuOTczMyAwLjk3MzMgMC4yMjk3IC0yMi4zOTYyIDUwLjM2NTcpIiBjbGFzcz0ic3QwIiB3aWR0aD0iNCIgaGVpZ2h0PSI3LjMiLz48L2c+PC9nPjwvc3ZnPg==); } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group .mapbox-gl-draw_polygon.active { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6I0ZGRkZGRjt9PC9zdHlsZT48Zz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjEzLjksMzkuOCA4LjYsMzguNiA4LjIsMzMuMSAxMi4yLDMyLjggMTIuNCwzNS4zIDE0LjksMzUuOSAiLz48L2c+PGc+PHJlY3QgeD0iNy42IiB5PSIyMi45IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjk5NjYgLTguMjQwOTg3ZS0wMiA4LjI0MDk4N2UtMDIgMC45OTY2IC0yLjE1NzggMC44ODUzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjQiIGhlaWdodD0iNy4zIi8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNy4xLDIwLjQgNi43LDE0LjkgMTEuNywxMi44IDEzLjIsMTYuNSAxMC45LDE3LjUgMTEuMSwyMCAiLz48L2c+PGc+PHJlY3QgeD0iMTQuNyIgeT0iMTAuMiIgdHJhbnNmb3JtPSJtYXRyaXgoMC45MjI0IC0wLjM4NjIgMC4zODYyIDAuOTIyNCAtMy4yODc0IDguMDQ1NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI3LjMiIGhlaWdodD0iNCIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjI5LjEsMTIuNSAyNy40LDEwLjYgMjUuMSwxMS42IDIzLjUsNy45IDI4LjUsNS44IDMyLjEsOS45ICIvPjwvZz48Zz48cmVjdCB4PSIzMi44IiB5PSIxMi40IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjc1NzggLTAuNjUyNSAwLjY1MjUgMC43NTc4IC0yLjA2NjMgMjYuNTY2NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI0IiBoZWlnaHQ9IjcuMyIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjQxLjIsMjguNCAzNy44LDI2LjMgMzkuMSwyNC4xIDM3LjQsMjIuMiA0MC40LDE5LjYgNDQsMjMuNyAiLz48L2c+PGc+PHJlY3QgeD0iMzIuNSIgeT0iMzAuOCIgdHJhbnNmb3JtPSJtYXRyaXgoMC41MTkyIC0wLjg1NDcgMC44NTQ3IDAuNTE5MiAtMTAuNjg0MiA0Ni42NzQzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjcuMyIgaGVpZ2h0PSI0Ii8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMzEuNyw0NCAyNi40LDQyLjcgMjcuMywzOC45IDI5LjgsMzkuNCAzMS4xLDM3LjMgMzQuNSwzOS4zICIvPjwvZz48Zz48cmVjdCB4PSIxOC42IiB5PSIzNS43IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjIyOTcgLTAuOTczMyAwLjk3MzMgMC4yMjk3IC0yMi4zOTYyIDUwLjM2NTcpIiBjbGFzcz0ic3QwIiB3aWR0aD0iNCIgaGVpZ2h0PSI3LjMiLz48L2c+PC9nPjwvc3ZnPg==); } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group .mapbox-gl-draw_circle { - background-size: 20px 20px; - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6bm9uZTtzdHJva2U6I0E3QTdBNztzdHJva2Utd2lkdGg6NDtzdHJva2UtbWl0ZXJsaW1pdDoxMDtzdHJva2UtZGFzaGFycmF5OjgsMzt9PC9zdHlsZT48Y2lyY2xlIGNsYXNzPSJzdDAiIGN4PSIyNCIgY3k9IjI0IiByPSIxNiIvPjwvc3ZnPg==); } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group .mapbox-gl-draw_circle:after { - display: none; } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group .mapbox-gl-draw_circle:hover { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6bm9uZTtzdHJva2U6IzIyQTdGMDtzdHJva2Utd2lkdGg6NDtzdHJva2UtbWl0ZXJsaW1pdDoxMDtzdHJva2UtZGFzaGFycmF5OjgsMzt9PC9zdHlsZT48Y2lyY2xlIGNsYXNzPSJzdDAiIGN4PSIyNCIgY3k9IjI0IiByPSIxNiIvPjwvc3ZnPg==); } - .mapboxgl-ctrl-top-left .mapboxgl-ctrl-group .mapbox-gl-draw_circle.active { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6bm9uZTtzdHJva2U6I0ZGRkZGRjtzdHJva2Utd2lkdGg6NDtzdHJva2UtbWl0ZXJsaW1pdDoxMDtzdHJva2UtZGFzaGFycmF5OjgsMzt9PC9zdHlsZT48Y2lyY2xlIGNsYXNzPSJzdDAiIGN4PSIyNCIgY3k9IjI0IiByPSIxNiIvPjwvc3ZnPg==); } - -.mapboxgl-ctrl-top-right .mapboxgl-ctrl { - border-radius: 2px; } - .mapboxgl-ctrl-top-right .mapboxgl-ctrl button:nth-child(2) { - border: none; } - -.heavyai-draw-button-control-group { - margin: 8px 0 0 8px; - float: left; - position: absolute; - border-radius: 2px; - box-shadow: none !important; - border: 1px solid #e2e2e2; - clear: both; } - -.heavyai-draw-button-control-group > button { - border-bottom: none; - width: 32px; - height: 32px; - display: block; - padding: 0; - outline: none; - border: none; - box-sizing: border-box; - background-color: white; - cursor: pointer; } - -.heavyai-draw-active-button { - background-color: #22a7f0 !important; } - -.heavyai-draw-button { - background-repeat: no-repeat; - background-position: 50%; - position: relative; - background-size: 20px 20px; } - -.mapboxgl-ctrl-group { - position: absolute; - display: block; - right: 0; - bottom: 24px; - z-index: 99999; - overflow: hidden; - box-shadow: none !important; - border: 1px solid #e2e2e2; } - -.mapboxgl-ctrl-compass { - display: none !important; } - -.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon, -.mapboxgl-ctrl-zoom-in.mapboxgl-ctrl-icon, -.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon, -.mapboxgl-ctrl-zoom-out.mapboxgl-ctrl-icon { - opacity: 0.5; } - -.heavyai-draw-button-circle { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6bm9uZTtzdHJva2U6I0E3QTdBNztzdHJva2Utd2lkdGg6NDtzdHJva2UtbWl0ZXJsaW1pdDoxMDtzdHJva2UtZGFzaGFycmF5OjgsMzt9PC9zdHlsZT48Y2lyY2xlIGNsYXNzPSJzdDAiIGN4PSIyNCIgY3k9IjI0IiByPSIxNiIvPjwvc3ZnPg==); } - .heavyai-draw-button-circle:hover { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6bm9uZTtzdHJva2U6IzIyQTdGMDtzdHJva2Utd2lkdGg6NDtzdHJva2UtbWl0ZXJsaW1pdDoxMDtzdHJva2UtZGFzaGFycmF5OjgsMzt9PC9zdHlsZT48Y2lyY2xlIGNsYXNzPSJzdDAiIGN4PSIyNCIgY3k9IjI0IiByPSIxNiIvPjwvc3ZnPg==); } - .heavyai-draw-button-circle.heavyai-draw-active-button { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6bm9uZTtzdHJva2U6I0ZGRkZGRjtzdHJva2Utd2lkdGg6NDtzdHJva2UtbWl0ZXJsaW1pdDoxMDtzdHJva2UtZGFzaGFycmF5OjgsMzt9PC9zdHlsZT48Y2lyY2xlIGNsYXNzPSJzdDAiIGN4PSIyNCIgY3k9IjI0IiByPSIxNiIvPjwvc3ZnPg==); } - -.heavyai-draw-button-polyline { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6I0E3QTdBNzt9PC9zdHlsZT48Zz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjEzLjksMzkuOCA4LjYsMzguNiA4LjIsMzMuMSAxMi4yLDMyLjggMTIuNCwzNS4zIDE0LjksMzUuOSAiLz48L2c+PGc+PHJlY3QgeD0iNy42IiB5PSIyMi45IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjk5NjYgLTguMjQwOTg3ZS0wMiA4LjI0MDk4N2UtMDIgMC45OTY2IC0yLjE1NzggMC44ODUzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjQiIGhlaWdodD0iNy4zIi8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNy4xLDIwLjQgNi43LDE0LjkgMTEuNywxMi44IDEzLjIsMTYuNSAxMC45LDE3LjUgMTEuMSwyMCAiLz48L2c+PGc+PHJlY3QgeD0iMTQuNyIgeT0iMTAuMiIgdHJhbnNmb3JtPSJtYXRyaXgoMC45MjI0IC0wLjM4NjIgMC4zODYyIDAuOTIyNCAtMy4yODc0IDguMDQ1NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI3LjMiIGhlaWdodD0iNCIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjI5LjEsMTIuNSAyNy40LDEwLjYgMjUuMSwxMS42IDIzLjUsNy45IDI4LjUsNS44IDMyLjEsOS45ICIvPjwvZz48Zz48cmVjdCB4PSIzMi44IiB5PSIxMi40IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjc1NzggLTAuNjUyNSAwLjY1MjUgMC43NTc4IC0yLjA2NjMgMjYuNTY2NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI0IiBoZWlnaHQ9IjcuMyIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjQxLjIsMjguNCAzNy44LDI2LjMgMzkuMSwyNC4xIDM3LjQsMjIuMiA0MC40LDE5LjYgNDQsMjMuNyAiLz48L2c+PGc+PHJlY3QgeD0iMzIuNSIgeT0iMzAuOCIgdHJhbnNmb3JtPSJtYXRyaXgoMC41MTkyIC0wLjg1NDcgMC44NTQ3IDAuNTE5MiAtMTAuNjg0MiA0Ni42NzQzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjcuMyIgaGVpZ2h0PSI0Ii8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMzEuNyw0NCAyNi40LDQyLjcgMjcuMywzOC45IDI5LjgsMzkuNCAzMS4xLDM3LjMgMzQuNSwzOS4zICIvPjwvZz48Zz48cmVjdCB4PSIxOC42IiB5PSIzNS43IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjIyOTcgLTAuOTczMyAwLjk3MzMgMC4yMjk3IC0yMi4zOTYyIDUwLjM2NTcpIiBjbGFzcz0ic3QwIiB3aWR0aD0iNCIgaGVpZ2h0PSI3LjMiLz48L2c+PC9nPjwvc3ZnPg==); } - .heavyai-draw-button-polyline:hover { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6IzIyQTdGMDt9PC9zdHlsZT48Zz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjEzLjksMzkuOCA4LjYsMzguNiA4LjIsMzMuMSAxMi4yLDMyLjggMTIuNCwzNS4zIDE0LjksMzUuOSAiLz48L2c+PGc+PHJlY3QgeD0iNy42IiB5PSIyMi45IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjk5NjYgLTguMjQwOTg3ZS0wMiA4LjI0MDk4N2UtMDIgMC45OTY2IC0yLjE1NzggMC44ODUzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjQiIGhlaWdodD0iNy4zIi8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNy4xLDIwLjQgNi43LDE0LjkgMTEuNywxMi44IDEzLjIsMTYuNSAxMC45LDE3LjUgMTEuMSwyMCAiLz48L2c+PGc+PHJlY3QgeD0iMTQuNyIgeT0iMTAuMiIgdHJhbnNmb3JtPSJtYXRyaXgoMC45MjI0IC0wLjM4NjIgMC4zODYyIDAuOTIyNCAtMy4yODc0IDguMDQ1NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI3LjMiIGhlaWdodD0iNCIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjI5LjEsMTIuNSAyNy40LDEwLjYgMjUuMSwxMS42IDIzLjUsNy45IDI4LjUsNS44IDMyLjEsOS45ICIvPjwvZz48Zz48cmVjdCB4PSIzMi44IiB5PSIxMi40IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjc1NzggLTAuNjUyNSAwLjY1MjUgMC43NTc4IC0yLjA2NjMgMjYuNTY2NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI0IiBoZWlnaHQ9IjcuMyIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjQxLjIsMjguNCAzNy44LDI2LjMgMzkuMSwyNC4xIDM3LjQsMjIuMiA0MC40LDE5LjYgNDQsMjMuNyAiLz48L2c+PGc+PHJlY3QgeD0iMzIuNSIgeT0iMzAuOCIgdHJhbnNmb3JtPSJtYXRyaXgoMC41MTkyIC0wLjg1NDcgMC44NTQ3IDAuNTE5MiAtMTAuNjg0MiA0Ni42NzQzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjcuMyIgaGVpZ2h0PSI0Ii8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMzEuNyw0NCAyNi40LDQyLjcgMjcuMywzOC45IDI5LjgsMzkuNCAzMS4xLDM3LjMgMzQuNSwzOS4zICIvPjwvZz48Zz48cmVjdCB4PSIxOC42IiB5PSIzNS43IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjIyOTcgLTAuOTczMyAwLjk3MzMgMC4yMjk3IC0yMi4zOTYyIDUwLjM2NTcpIiBjbGFzcz0ic3QwIiB3aWR0aD0iNCIgaGVpZ2h0PSI3LjMiLz48L2c+PC9nPjwvc3ZnPg==); } - .heavyai-draw-button-polyline.heavyai-draw-active-button { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6I0ZGRkZGRjt9PC9zdHlsZT48Zz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjEzLjksMzkuOCA4LjYsMzguNiA4LjIsMzMuMSAxMi4yLDMyLjggMTIuNCwzNS4zIDE0LjksMzUuOSAiLz48L2c+PGc+PHJlY3QgeD0iNy42IiB5PSIyMi45IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjk5NjYgLTguMjQwOTg3ZS0wMiA4LjI0MDk4N2UtMDIgMC45OTY2IC0yLjE1NzggMC44ODUzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjQiIGhlaWdodD0iNy4zIi8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iNy4xLDIwLjQgNi43LDE0LjkgMTEuNywxMi44IDEzLjIsMTYuNSAxMC45LDE3LjUgMTEuMSwyMCAiLz48L2c+PGc+PHJlY3QgeD0iMTQuNyIgeT0iMTAuMiIgdHJhbnNmb3JtPSJtYXRyaXgoMC45MjI0IC0wLjM4NjIgMC4zODYyIDAuOTIyNCAtMy4yODc0IDguMDQ1NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI3LjMiIGhlaWdodD0iNCIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjI5LjEsMTIuNSAyNy40LDEwLjYgMjUuMSwxMS42IDIzLjUsNy45IDI4LjUsNS44IDMyLjEsOS45ICIvPjwvZz48Zz48cmVjdCB4PSIzMi44IiB5PSIxMi40IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjc1NzggLTAuNjUyNSAwLjY1MjUgMC43NTc4IC0yLjA2NjMgMjYuNTY2NykiIGNsYXNzPSJzdDAiIHdpZHRoPSI0IiBoZWlnaHQ9IjcuMyIvPjwvZz48Zz48cG9seWdvbiBjbGFzcz0ic3QwIiBwb2ludHM9IjQxLjIsMjguNCAzNy44LDI2LjMgMzkuMSwyNC4xIDM3LjQsMjIuMiA0MC40LDE5LjYgNDQsMjMuNyAiLz48L2c+PGc+PHJlY3QgeD0iMzIuNSIgeT0iMzAuOCIgdHJhbnNmb3JtPSJtYXRyaXgoMC41MTkyIC0wLjg1NDcgMC44NTQ3IDAuNTE5MiAtMTAuNjg0MiA0Ni42NzQzKSIgY2xhc3M9InN0MCIgd2lkdGg9IjcuMyIgaGVpZ2h0PSI0Ii8+PC9nPjxnPjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMzEuNyw0NCAyNi40LDQyLjcgMjcuMywzOC45IDI5LjgsMzkuNCAzMS4xLDM3LjMgMzQuNSwzOS4zICIvPjwvZz48Zz48cmVjdCB4PSIxOC42IiB5PSIzNS43IiB0cmFuc2Zvcm09Im1hdHJpeCgwLjIyOTcgLTAuOTczMyAwLjk3MzMgMC4yMjk3IC0yMi4zOTYyIDUwLjM2NTcpIiBjbGFzcz0ic3QwIiB3aWR0aD0iNCIgaGVpZ2h0PSI3LjMiLz48L2c+PC9nPjwvc3ZnPg==); } - -.heavyai-draw-button-lasso { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6I0E3QTdBNzt9PC9zdHlsZT48Zz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNMTIsNDUuNWwwLTNjMC42LDAsMi41LTAuMiwyLjUtMi41YzAtMi4xLTQuMi01LjItNy4yLTYuN2MtMC4xLDAtMC4yLTAuMS0wLjMtMC4yQzUsMzEuNSwzLjYsMjkuMywzLDI3QzAuOCwxOC44LDguMyw5LjYsMTkuNyw2LjVjMTEuNC0zLjEsMjIuNSwxLjEsMjQuNyw5LjNjMi4yLDguMi01LjMsMTcuNC0xNi43LDIwLjRjLTIuNiwwLjctNS4xLDEtNy43LDFsMC0zYzIuMiwwLDQuNi0wLjMsNi45LTAuOWM5LjgtMi42LDE2LjQtMTAuMSwxNC42LTE2LjhjLTEuOC02LjYtMTEuMi05LjgtMjEtNy4yQzEwLjYsMTIuMSw0LjEsMTkuNiw1LjksMjYuMmMwLjUsMS43LDEuNSwzLjMsMyw0LjZjMS44LDAuOSw4LjcsNC44LDguNyw5LjNDMTcuNSw0NCwxNC4yLDQ1LjUsMTIsNDUuNXoiLz48L2c+PGc+PHBhdGggY2xhc3M9InN0MCIgZD0iTTExLjksMzkuNWMtMi4zLDAtNC4yLTEuMi00LjctMy4yYy0wLjctMi40LDEuMi01LDQuMS01LjhjMy0wLjgsNS44LDAuNSw2LjUsMi45YzAuMywxLjIsMCwyLjYtMC45LDMuN2MtMC44LDEtMiwxLjctMy4zLDIuMUMxMy4xLDM5LjQsMTIuNSwzOS41LDExLjksMzkuNXogTTEzLjEsMzMuNGMtMC4zLDAtMC42LDAtMC45LDAuMWMtMS40LDAuNC0yLjIsMS40LTIsMi4xYzAuMiwwLjcsMS40LDEuMiwyLjgsMC44YzAuNy0wLjIsMS4zLTAuNiwxLjctMS4xYzAuMi0wLjIsMC40LTAuNiwwLjMtMXYwQzE0LjgsMzMuOCwxNCwzMy40LDEzLjEsMzMuNHoiLz48L2c+PC9zdmc+); } - .heavyai-draw-button-lasso:hover { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6IzIyQTdGMDt9PC9zdHlsZT48Zz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNMTIsNDUuNWwwLTNjMC42LDAsMi41LTAuMiwyLjUtMi41YzAtMi4xLTQuMi01LjItNy4yLTYuN2MtMC4xLDAtMC4yLTAuMS0wLjMtMC4yQzUsMzEuNSwzLjYsMjkuMywzLDI3QzAuOCwxOC44LDguMyw5LjYsMTkuNyw2LjVjMTEuNC0zLjEsMjIuNSwxLjEsMjQuNyw5LjNjMi4yLDguMi01LjMsMTcuNC0xNi43LDIwLjRjLTIuNiwwLjctNS4xLDEtNy43LDFsMC0zYzIuMiwwLDQuNi0wLjMsNi45LTAuOWM5LjgtMi42LDE2LjQtMTAuMSwxNC42LTE2LjhjLTEuOC02LjYtMTEuMi05LjgtMjEtNy4yQzEwLjYsMTIuMSw0LjEsMTkuNiw1LjksMjYuMmMwLjUsMS43LDEuNSwzLjMsMyw0LjZjMS44LDAuOSw4LjcsNC44LDguNyw5LjNDMTcuNSw0NCwxNC4yLDQ1LjUsMTIsNDUuNXoiLz48L2c+PGc+PHBhdGggY2xhc3M9InN0MCIgZD0iTTExLjksMzkuNWMtMi4zLDAtNC4yLTEuMi00LjctMy4yYy0wLjctMi40LDEuMi01LDQuMS01LjhjMy0wLjgsNS44LDAuNSw2LjUsMi45YzAuMywxLjIsMCwyLjYtMC45LDMuN2MtMC44LDEtMiwxLjctMy4zLDIuMUMxMy4xLDM5LjQsMTIuNSwzOS41LDExLjksMzkuNXogTTEzLjEsMzMuNGMtMC4zLDAtMC42LDAtMC45LDAuMWMtMS40LDAuNC0yLjIsMS40LTIsMi4xYzAuMiwwLjcsMS40LDEuMiwyLjgsMC44YzAuNy0wLjIsMS4zLTAuNiwxLjctMS4xYzAuMi0wLjIsMC40LTAuNiwwLjMtMXYwQzE0LjgsMzMuOCwxNCwzMy40LDEzLjEsMzMuNHoiLz48L2c+PC9zdmc+); } - .heavyai-draw-button-lasso.heavyai-draw-active-button { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6I0ZGRkZGRjt9PC9zdHlsZT48Zz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNMTIsNDUuNWwwLTNjMC42LDAsMi41LTAuMiwyLjUtMi41YzAtMi4xLTQuMi01LjItNy4yLTYuN2MtMC4xLDAtMC4yLTAuMS0wLjMtMC4yQzUsMzEuNSwzLjYsMjkuMywzLDI3QzAuOCwxOC44LDguMyw5LjYsMTkuNyw2LjVjMTEuNC0zLjEsMjIuNSwxLjEsMjQuNyw5LjNjMi4yLDguMi01LjMsMTcuNC0xNi43LDIwLjRjLTIuNiwwLjctNS4xLDEtNy43LDFsMC0zYzIuMiwwLDQuNi0wLjMsNi45LTAuOWM5LjgtMi42LDE2LjQtMTAuMSwxNC42LTE2LjhjLTEuOC02LjYtMTEuMi05LjgtMjEtNy4yQzEwLjYsMTIuMSw0LjEsMTkuNiw1LjksMjYuMmMwLjUsMS43LDEuNSwzLjMsMyw0LjZjMS44LDAuOSw4LjcsNC44LDguNyw5LjNDMTcuNSw0NCwxNC4yLDQ1LjUsMTIsNDUuNXoiLz48L2c+PGc+PHBhdGggY2xhc3M9InN0MCIgZD0iTTExLjksMzkuNWMtMi4zLDAtNC4yLTEuMi00LjctMy4yYy0wLjctMi40LDEuMi01LDQuMS01LjhjMy0wLjgsNS44LDAuNSw2LjUsMi45YzAuMywxLjIsMCwyLjYtMC45LDMuN2MtMC44LDEtMiwxLjctMy4zLDIuMUMxMy4xLDM5LjQsMTIuNSwzOS41LDExLjksMzkuNXogTTEzLjEsMzMuNGMtMC4zLDAtMC42LDAtMC45LDAuMWMtMS40LDAuNC0yLjIsMS40LTIsMi4xYzAuMiwwLjcsMS40LDEuMiwyLjgsMC44YzAuNy0wLjIsMS4zLTAuNiwxLjctMS4xYzAuMi0wLjIsMC40LTAuNiwwLjMtMXYwQzE0LjgsMzMuOCwxNCwzMy40LDEzLjEsMzMuNHoiLz48L2c+PC9zdmc+); } - -.heavyai-draw-button-CrossSection { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0OCA0ODsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgogIDxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+CiAgICAuc3Qwe2ZpbGw6I0E3QTdBNzsgc3Ryb2tlOiNBN0E3QTc7IHN0cm9rZS13aWR0aDogMDt9CiAgICAubGluZS1kYXNoe3g6MTkuNTsgeToyMjt9CiAgICAubGluZS1lbmR7ZmlsbDp0cmFuc3BhcmVudDsgc3Ryb2tlLXdpZHRoOiAxLjU7fQogIDwvc3R5bGU+CiAgPGcgdHJhbnNmb3JtPSJyb3RhdGUoLTQ1LDI0LDI0KSI+CiAgICA8cmVjdCBjbGFzcz0ic3QwIGxpbmUtZGFzaCIgd2lkdGg9IjkiIGhlaWdodD0iNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNS41LDApIi8+CiAgICA8cmVjdCBjbGFzcz0ic3QwIGxpbmUtZGFzaCIgd2lkdGg9IjkiIGhlaWdodD0iNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTYuNSwwKSIvPgogICAgPHJlY3QgY2xhc3M9InN0MCBsaW5lLWRhc2giIHdpZHRoPSI5IiBoZWlnaHQ9IjQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01LjUsMCkiLz4KICAgIDxyZWN0IGNsYXNzPSJzdDAgbGluZS1kYXNoIiB3aWR0aD0iOSIgaGVpZ2h0PSI0IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTYuNSwwKSIvPgogICAgPGNpcmNsZSBjeD0iMjQiIGN5PSIyNCIgcj0iNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjcsMCkiIGNsYXNzPSJzdDAgbGluZS1lbmQiLz4KICAgIDxjaXJjbGUgY3g9IjI0IiBjeT0iMjQiIHI9IjQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNywwKSIgY2xhc3M9InN0MCBsaW5lLWVuZCIvPgogIDwvZz4KPC9zdmc+); } - .heavyai-draw-button-CrossSection:hover { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0OCA0ODsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgogIDxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+CiAgICAuc3Qwe2ZpbGw6I0E3QTdBNzsgc3Ryb2tlOiNBN0E3QTc7IHN0cm9rZS13aWR0aDogMDt9CiAgICAubGluZS1kYXNoe3g6MTkuNTsgeToyMjt9CiAgICAubGluZS1lbmR7ZmlsbDp0cmFuc3BhcmVudDsgc3Ryb2tlLXdpZHRoOiAxLjU7fQogIDwvc3R5bGU+CiAgPGcgdHJhbnNmb3JtPSJyb3RhdGUoLTQ1LDI0LDI0KSI+CiAgICA8cmVjdCBjbGFzcz0ic3QwIGxpbmUtZGFzaCIgd2lkdGg9IjkiIGhlaWdodD0iNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNS41LDApIi8+CiAgICA8cmVjdCBjbGFzcz0ic3QwIGxpbmUtZGFzaCIgd2lkdGg9IjkiIGhlaWdodD0iNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTYuNSwwKSIvPgogICAgPHJlY3QgY2xhc3M9InN0MCBsaW5lLWRhc2giIHdpZHRoPSI5IiBoZWlnaHQ9IjQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01LjUsMCkiLz4KICAgIDxyZWN0IGNsYXNzPSJzdDAgbGluZS1kYXNoIiB3aWR0aD0iOSIgaGVpZ2h0PSI0IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTYuNSwwKSIvPgogICAgPGNpcmNsZSBjeD0iMjQiIGN5PSIyNCIgcj0iNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjcsMCkiIGNsYXNzPSJzdDAgbGluZS1lbmQiLz4KICAgIDxjaXJjbGUgY3g9IjI0IiBjeT0iMjQiIHI9IjQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNywwKSIgY2xhc3M9InN0MCBsaW5lLWVuZCIvPgogIDwvZz4KPC9zdmc+); } - .heavyai-draw-button-CrossSection.heavyai-draw-active-button { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0OCA0ODsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgogIDxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+CiAgICAuc3Qwe2ZpbGw6I0E3QTdBNzsgc3Ryb2tlOiNBN0E3QTc7IHN0cm9rZS13aWR0aDogMDt9CiAgICAubGluZS1kYXNoe3g6MTkuNTsgeToyMjt9CiAgICAubGluZS1lbmR7ZmlsbDp0cmFuc3BhcmVudDsgc3Ryb2tlLXdpZHRoOiAxLjU7fQogIDwvc3R5bGU+CiAgPGcgdHJhbnNmb3JtPSJyb3RhdGUoLTQ1LDI0LDI0KSI+CiAgICA8cmVjdCBjbGFzcz0ic3QwIGxpbmUtZGFzaCIgd2lkdGg9IjkiIGhlaWdodD0iNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNS41LDApIi8+CiAgICA8cmVjdCBjbGFzcz0ic3QwIGxpbmUtZGFzaCIgd2lkdGg9IjkiIGhlaWdodD0iNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTYuNSwwKSIvPgogICAgPHJlY3QgY2xhc3M9InN0MCBsaW5lLWRhc2giIHdpZHRoPSI5IiBoZWlnaHQ9IjQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01LjUsMCkiLz4KICAgIDxyZWN0IGNsYXNzPSJzdDAgbGluZS1kYXNoIiB3aWR0aD0iOSIgaGVpZ2h0PSI0IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTYuNSwwKSIvPgogICAgPGNpcmNsZSBjeD0iMjQiIGN5PSIyNCIgcj0iNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjcsMCkiIGNsYXNzPSJzdDAgbGluZS1lbmQiLz4KICAgIDxjaXJjbGUgY3g9IjI0IiBjeT0iMjQiIHI9IjQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNywwKSIgY2xhc3M9InN0MCBsaW5lLWVuZCIvPgogIDwvZz4KPC9zdmc+); } - -.heavyai-draw-canvas { - outline: none; } - -.axis-lock { - position: absolute; - top: 0; - left: 0; } - .axis-lock .lock-toggle:not(.disabled) { - z-index: 1; - opacity: 0; - transition: opacity .25s; - cursor: pointer; - position: absolute; - width: 24px; - height: 24px; - background-size: 14px 14px; - background-repeat: no-repeat; - background-position: center 6px; - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6I0E3QTdBNzt9LnN0MXtmaWxsOiNGRkZGRkY7fTwvc3R5bGU+PGc+PHBhdGggY2xhc3M9InN0MCIgZD0iTTcsNDFWMTloNnYtN2MwLTYuMSw0LjktMTEsMTEtMTFzMTEsNC45LDExLDExdjNoLTZ2LTNjMC0yLjgtMi4yLTUtNS01cy01LDIuMi01LDV2N2gyMnYyMkg3eiIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0yNCwyYzUuNSwwLDEwLDQuNSwxMCwxMHYyaC00di0yYzAtMy4zLTIuNy02LTYtNnMtNiwyLjctNiw2djhoMjJ2MjBIOFYyMGg2di04QzE0LDYuNSwxOC41LDIsMjQsMiBNMjQsMGMtNi42LDAtMTIsNS40LTEyLDEydjZIOEg2djJ2MjB2MmgyaDMyaDJ2LTJWMjB2LTJoLTJIMjB2LTZjMC0yLjIsMS44LTQsNC00czQsMS44LDQsNHYydjJoMmg0aDJ2LTJ2LTJDMzYsNS40LDMwLjYsMCwyNCwwTDI0LDB6Ii8+PC9nPjwvc3ZnPg==); } - .axis-lock .lock-toggle:not(.disabled):hover { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6IzIyQTdGMDt9LnN0MXtmaWxsOiNGRkZGRkY7fTwvc3R5bGU+PGc+PHBhdGggY2xhc3M9InN0MCIgZD0iTTcsNDFWMTloNnYtN2MwLTYuMSw0LjktMTEsMTEtMTFzMTEsNC45LDExLDExdjNoLTZ2LTNjMC0yLjgtMi4yLTUtNS01cy01LDIuMi01LDV2N2gyMnYyMkg3eiIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0yNCwyYzUuNSwwLDEwLDQuNSwxMCwxMHYyaC00di0yYzAtMy4zLTIuNy02LTYtNnMtNiwyLjctNiw2djhoMjJ2MjBIOFYyMGg2di04QzE0LDYuNSwxOC41LDIsMjQsMiBNMjQsMGMtNi42LDAtMTIsNS40LTEyLDEydjZIOEg2djJ2MjB2MmgyaDMyaDJ2LTJWMjB2LTJoLTJIMjB2LTZjMC0yLjIsMS44LTQsNC00czQsMS44LDQsNHYydjJoMmg0aDJ2LTJ2LTJDMzYsNS40LDMwLjYsMCwyNCwwTDI0LDB6Ii8+PC9nPjwvc3ZnPg==); } - .axis-lock .lock-toggle:not(.disabled).is-locked { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6I0E3QTdBNzt9LnN0MXtmaWxsOiNGRkZGRkY7fTwvc3R5bGU+PGc+PHBhdGggY2xhc3M9InN0MCIgZD0iTTcsNDFWMTloNnYtM2MwLTYuMSw0LjktMTEsMTEtMTFzMTEsNC45LDExLDExdjNoNnYyMkg3eiBNMjksMTl2LTNjMC0yLjgtMi4yLTUtNS01cy01LDIuMi01LDV2M0gyOXoiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNMjQsNmM1LjUsMCwxMCw0LjUsMTAsMTB2NGg2djIwSDhWMjBoNnYtNEMxNCwxMC41LDE4LjUsNiwyNCw2IE0xOCwyMGgxMnYtNGMwLTMuMy0yLjctNi02LTZzLTYsMi43LTYsNlYyMCBNMjQsNGMtNi42LDAtMTIsNS40LTEyLDEydjJIOEg2djJ2MjB2MmgyaDMyaDJ2LTJWMjB2LTJoLTJoLTR2LTJDMzYsOS40LDMwLjYsNCwyNCw0TDI0LDR6IE0yMCwxOHYtMmMwLTIuMiwxLjgtNCw0LTRzNCwxLjgsNCw0djJIMjBMMjAsMTh6Ii8+PC9nPjwvc3ZnPg==); - opacity: 1; } - .axis-lock .lock-toggle:not(.disabled).is-locked:hover { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ4IDQ4OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6IzIyQTdGMDt9LnN0MXtmaWxsOiNGRkZGRkY7fTwvc3R5bGU+PGc+PHBhdGggY2xhc3M9InN0MCIgZD0iTTcsNDFWMTloNnYtM2MwLTYuMSw0LjktMTEsMTEtMTFzMTEsNC45LDExLDExdjNoNnYyMkg3eiBNMjksMTl2LTNjMC0yLjgtMi4yLTUtNS01cy01LDIuMi01LDV2M0gyOXoiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNMjQsNmM1LjUsMCwxMCw0LjUsMTAsMTB2NGg2djIwSDhWMjBoNnYtNEMxNCwxMC41LDE4LjUsNiwyNCw2IE0xOCwyMGgxMnYtNGMwLTMuMy0yLjctNi02LTZzLTYsMi43LTYsNlYyMCBNMjQsNGMtNi42LDAtMTIsNS40LTEyLDEydjJIOEg2djJ2MjB2MmgyaDMyaDJ2LTJWMjB2LTJoLTJoLTR2LTJDMzYsOS40LDMwLjYsNCwyNCw0TDI0LDR6IE0yMCwxOHYtMmMwLTIuMiwxLjgtNCw0LTRzNCwxLjgsNCw0djJIMjBMMjAsMTh6Ii8+PC9nPjwvc3ZnPg==); } - .chart-container:hover .axis-lock .lock-toggle:not(.disabled) { - opacity: 1; } - .axis-lock.type-y .lock-toggle { - transform: translate(-1px, 2px); } - .axis-lock.type-x .lock-toggle { - transform: translateY(-50%); } - .axis-lock input { - display: block; - height: auto; - font-size: 10px; - padding: 0; - position: absolute; - top: 0; - left: 0; - width: 100%; - z-index: 1; - outline: none; } - .axis-lock input:focus { - height: auto; - font-size: 12px; } - .axis-lock input:focus + div { - font-size: 12px; - height: 24px; - min-width: 52px; } - .axis-lock input:focus + div:before { - position: absolute; - width: calc(100% + 32px); - left: -16px; - content: ""; - height: calc(100% + 24px); } - .axis-lock .axis-input { - position: absolute; - z-index: 5; - opacity: 0; - transition: opacity .25s; - font-size: 10px; - white-space: nowrap; } - .axis-lock .axis-input > div { - padding: 0 4px; - position: relative; - min-width: 32px; } - .axis-lock:hover .axis-input { - opacity: 1; } - .axis-lock.type-x .axis-input { - transform: translate(-50%, 8px); } - .axis-lock.type-x .axis-input input { - text-align: center; } - .axis-lock.type-y .axis-input { - transform: translate(calc(-100% - 8px), -50%); } - .axis-lock.type-y .axis-input input { - text-align: right; } - .axis-lock.type-y2 .axis-input { - transform: translate(calc(-100% - 8px), -50%); } - .axis-lock.type-y2 .axis-input input { - text-align: right; } - .axis-lock .hit-box { - position: absolute; } - -/* loading */ -/* spinner */ -.chart-loading-overlay { - opacity: 0.5; - pointer-events: none; } - -.loading-widget-dc { - font-size: 12px; - position: absolute; - top: calc(50% - 24px); - left: calc(50% - 24px); - transform: translate(-50%, -50%); - color: #22A7F0; - text-transform: uppercase; - text-align: center; - font-weight: bold; } - -.loading-widget-dc .loading-msg { - margin-top: 24px; } - -.waiting, .waiting * { - cursor: wait !important; } - -.main-loading-icon { - position: absolute; - width: 48px; - height: 48px; - border: 4px solid transparent; - border-top-color: #22A7F0; - border-radius: 50%; - animation: mainLoadIconAnimation .6s infinite linear; } - -.main-loading-icon:before, .main-loading-icon:after { - z-index: -1; - position: absolute; - content: ""; - width: calc(100% + 8px); - height: calc(100% + 8px); - border-radius: 50%; - border: 4px solid transparent; - border-top-color: #22A7F0; - top: -4px; - left: -4px; - animation: beforeGrow .3s infinite linear alternate; } - -.main-loading-icon:after { - animation: afterGrow .3s infinite linear alternate; } - -@keyframes beforeGrow { - 0% { - transform: rotate(0); } - 100% { - transform: rotate(180deg); } } - -@keyframes afterGrow { - 0% { - transform: rotate(0); } - 100% { - transform: rotate(90deg); } } - -@keyframes mainLoadIconAnimation { - 0% { - transform: rotate(0); } - 50% { - transform: rotate(90deg); } - 100% { - transform: rotate(360deg); } } -.mapboxgl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mapboxgl-canvas{position:absolute;left:0;top:0}.mapboxgl-map:-webkit-full-screen{width:100%;height:100%}.mapboxgl-canary{background-color:salmon}.mapboxgl-canvas-container.mapboxgl-interactive,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer{cursor:pointer}.mapboxgl-canvas-container.mapboxgl-interactive:active,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas{touch-action:pan-x pan-y}.mapboxgl-canvas-container.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:pinch-zoom}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:none}.mapboxgl-ctrl-bottom-left,.mapboxgl-ctrl-bottom-right,.mapboxgl-ctrl-top-left,.mapboxgl-ctrl-top-right{position:absolute;pointer-events:none;z-index:2}.mapboxgl-ctrl-top-left{top:0;left:0}.mapboxgl-ctrl-top-right{top:0;right:0}.mapboxgl-ctrl-bottom-left{bottom:0;left:0}.mapboxgl-ctrl-bottom-right{right:0;bottom:0}.mapboxgl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.mapboxgl-ctrl-top-left .mapboxgl-ctrl{margin:10px 0 0 10px;float:left}.mapboxgl-ctrl-top-right .mapboxgl-ctrl{margin:10px 10px 0 0;float:right}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl{margin:0 0 10px 10px;float:left}.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl{margin:0 10px 10px 0;float:right}.mapboxgl-ctrl-group{border-radius:4px;background:#fff}.mapboxgl-ctrl-group:not(:empty){-moz-box-shadow:0 0 2px rgba(0,0,0,.1);-webkit-box-shadow:0 0 2px rgba(0,0,0,.1);box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (-ms-high-contrast:active){.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.mapboxgl-ctrl-group button{width:29px;height:29px;display:block;padding:0;outline:none;border:0;box-sizing:border-box;background-color:transparent;cursor:pointer}.mapboxgl-ctrl-group button+button{border-top:1px solid #ddd}.mapboxgl-ctrl button .mapboxgl-ctrl-icon{display:block;width:100%;height:100%;background-repeat:no-repeat;background-position:50%}@media (-ms-high-contrast:active){.mapboxgl-ctrl-icon{background-color:transparent}.mapboxgl-ctrl-group button+button{border-top:1px solid ButtonText}}.mapboxgl-ctrl button::-moz-focus-inner{border:0;padding:0}.mapboxgl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl button:disabled{cursor:not-allowed}.mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon{opacity:.25}.mapboxgl-ctrl button:not(:disabled):hover{background-color:rgba(0,0,0,.05)}.mapboxgl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.mapboxgl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.mapboxgl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.mapboxgl-ctrl-group button:focus:only-child{border-radius:inherit}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath d='M10.5 16l4 8 4-8h-8z' fill='%23999'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 29 29' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E")}}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='M14 5l1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-waiting .mapboxgl-ctrl-icon{-webkit-animation:mapboxgl-spin 2s linear infinite;-moz-animation:mapboxgl-spin 2s infinite linear;-o-animation:mapboxgl-spin 2s infinite linear;-ms-animation:mapboxgl-spin 2s infinite linear;animation:mapboxgl-spin 2s linear infinite}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23999'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='M14 5l1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='29' height='29' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23666'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 005.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 009 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 003.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0011 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 110 7 3.5 3.5 0 110-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath d='M14 5l1 1-9 9-1-1 9-9z' fill='red'/%3E%3C/svg%3E")}}@-webkit-keyframes mapboxgl-spin{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@-moz-keyframes mapboxgl-spin{0%{-moz-transform:rotate(0deg)}to{-moz-transform:rotate(1turn)}}@-o-keyframes mapboxgl-spin{0%{-o-transform:rotate(0deg)}to{-o-transform:rotate(1turn)}}@-ms-keyframes mapboxgl-spin{0%{-ms-transform:rotate(0deg)}to{-ms-transform:rotate(1turn)}}@keyframes mapboxgl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.mapboxgl-ctrl-logo{width:88px;height:23px;margin:0 0 -4px -4px;display:block;background-repeat:no-repeat;cursor:pointer;overflow:hidden;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='88' height='23' viewBox='0 0 88 23' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd'%3E%3Cdefs%3E%3Cpath id='a' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='b' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='c'%3E%3Crect width='100%25' height='100%25' fill='%23fff'/%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/mask%3E%3Cg opacity='.3' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23c)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23b' mask='url(%23c)'/%3E%3C/g%3E%3Cg opacity='.9' fill='%23fff'%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/g%3E%3C/svg%3E")}a.mapboxgl-ctrl-logo.mapboxgl-compact{width:23px}@media (-ms-high-contrast:active){a.mapboxgl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='88' height='23' viewBox='0 0 88 23' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd'%3E%3Cdefs%3E%3Cpath id='a' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='b' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='c'%3E%3Crect width='100%25' height='100%25' fill='%23fff'/%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/mask%3E%3Cg stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23c)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23b' mask='url(%23c)'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/g%3E%3C/svg%3E")}}@media (-ms-high-contrast:black-on-white){a.mapboxgl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='88' height='23' viewBox='0 0 88 23' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd'%3E%3Cdefs%3E%3Cpath id='a' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='b' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='c'%3E%3Crect width='100%25' height='100%25' fill='%23fff'/%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/mask%3E%3Cg stroke='%23fff' stroke-width='3' fill='%23fff'%3E%3Ccircle mask='url(%23c)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23b' mask='url(%23c)'/%3E%3C/g%3E%3Cuse xlink:href='%23a'/%3E%3Cuse xlink:href='%23b'/%3E%3C/svg%3E")}}.mapboxgl-ctrl.mapboxgl-ctrl-attrib{padding:0 5px;background-color:hsla(0,0%,100%,.5);margin:0}@media screen{.mapboxgl-ctrl-attrib.mapboxgl-compact{min-height:20px;padding:0;margin:10px;position:relative;background-color:#fff;border-radius:3px 12px 12px 3px}.mapboxgl-ctrl-attrib.mapboxgl-compact:hover{padding:2px 24px 2px 4px;visibility:visible;margin-top:6px}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:hover,.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:hover{padding:2px 4px 2px 24px;border-radius:12px 3px 3px 12px}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner{display:none}.mapboxgl-ctrl-attrib.mapboxgl-compact:hover .mapboxgl-ctrl-attrib-inner{display:block}.mapboxgl-ctrl-attrib.mapboxgl-compact:after{content:"";cursor:pointer;position:absolute;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1012 0 6 6 0 10-12 0m5-3a1 1 0 102 0 1 1 0 10-2 0m0 3a1 1 0 112 0v3a1 1 0 11-2 0'/%3E%3C/svg%3E");background-color:hsla(0,0%,100%,.5);width:24px;height:24px;box-sizing:border-box;border-radius:12px}.mapboxgl-ctrl-bottom-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;right:0}.mapboxgl-ctrl-top-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{top:0;right:0}.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{top:0;left:0}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1012 0 6 6 0 10-12 0m5-3a1 1 0 102 0 1 1 0 10-2 0m0 3a1 1 0 112 0v3a1 1 0 11-2 0'/%3E%3C/svg%3E")}}@media screen and (-ms-high-contrast:black-on-white){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1012 0 6 6 0 10-12 0m5-3a1 1 0 102 0 1 1 0 10-2 0m0 3a1 1 0 112 0v3a1 1 0 11-2 0'/%3E%3C/svg%3E")}}.mapboxgl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.mapboxgl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.mapboxgl-ctrl-attrib .mapbox-improve-map{font-weight:700;margin-left:2px}.mapboxgl-attrib-empty{display:none}.mapboxgl-ctrl-scale{background-color:hsla(0,0%,100%,.75);font-size:10px;border:2px solid #333;border-top:#333;padding:0 5px;color:#333;box-sizing:border-box}.mapboxgl-popup{position:absolute;top:0;left:0;display:-webkit-flex;display:flex;will-change:transform;pointer-events:none}.mapboxgl-popup-anchor-top,.mapboxgl-popup-anchor-top-left,.mapboxgl-popup-anchor-top-right{-webkit-flex-direction:column;flex-direction:column}.mapboxgl-popup-anchor-bottom,.mapboxgl-popup-anchor-bottom-left,.mapboxgl-popup-anchor-bottom-right{-webkit-flex-direction:column-reverse;flex-direction:column-reverse}.mapboxgl-popup-anchor-left{-webkit-flex-direction:row;flex-direction:row}.mapboxgl-popup-anchor-right{-webkit-flex-direction:row-reverse;flex-direction:row-reverse}.mapboxgl-popup-tip{width:0;height:0;border:10px solid transparent;z-index:1}.mapboxgl-popup-anchor-top .mapboxgl-popup-tip{-webkit-align-self:center;align-self:center;border-top:none;border-bottom-color:#fff}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip{-webkit-align-self:flex-start;align-self:flex-start;border-top:none;border-left:none;border-bottom-color:#fff}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip{-webkit-align-self:flex-end;align-self:flex-end;border-top:none;border-right:none;border-bottom-color:#fff}.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip{-webkit-align-self:center;align-self:center;border-bottom:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip{-webkit-align-self:flex-start;align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip{-webkit-align-self:flex-end;align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.mapboxgl-popup-anchor-left .mapboxgl-popup-tip{-webkit-align-self:center;align-self:center;border-left:none;border-right-color:#fff}.mapboxgl-popup-anchor-right .mapboxgl-popup-tip{-webkit-align-self:center;align-self:center;border-right:none;border-left-color:#fff}.mapboxgl-popup-close-button{position:absolute;right:0;top:0;border:0;border-radius:0 3px 0 0;cursor:pointer;background-color:transparent}.mapboxgl-popup-close-button:hover{background-color:rgba(0,0,0,.05)}.mapboxgl-popup-content{position:relative;background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:10px 10px 15px;pointer-events:auto}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content{border-top-left-radius:0}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content{border-top-right-radius:0}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content{border-bottom-left-radius:0}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content{border-bottom-right-radius:0}.mapboxgl-popup-track-pointer{display:none}.mapboxgl-popup-track-pointer *{pointer-events:none;user-select:none}.mapboxgl-map:hover .mapboxgl-popup-track-pointer{display:flex}.mapboxgl-map:active .mapboxgl-popup-track-pointer{display:none}.mapboxgl-marker{position:absolute;top:0;left:0;will-change:transform}.mapboxgl-user-location-dot,.mapboxgl-user-location-dot:before{background-color:#1da1f2;width:15px;height:15px;border-radius:50%}.mapboxgl-user-location-dot:before{content:"";position:absolute;-webkit-animation:mapboxgl-user-location-dot-pulse 2s infinite;-moz-animation:mapboxgl-user-location-dot-pulse 2s infinite;-ms-animation:mapboxgl-user-location-dot-pulse 2s infinite;animation:mapboxgl-user-location-dot-pulse 2s infinite}.mapboxgl-user-location-dot:after{border-radius:50%;border:2px solid #fff;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px;box-sizing:border-box;box-shadow:0 0 3px rgba(0,0,0,.35)}@-webkit-keyframes mapboxgl-user-location-dot-pulse{0%{-webkit-transform:scale(1);opacity:1}70%{-webkit-transform:scale(3);opacity:0}to{-webkit-transform:scale(1);opacity:0}}@-ms-keyframes mapboxgl-user-location-dot-pulse{0%{-ms-transform:scale(1);opacity:1}70%{-ms-transform:scale(3);opacity:0}to{-ms-transform:scale(1);opacity:0}}@keyframes mapboxgl-user-location-dot-pulse{0%{transform:scale(1);opacity:1}70%{transform:scale(3);opacity:0}to{transform:scale(1);opacity:0}}.mapboxgl-user-location-dot-stale{background-color:#aaa}.mapboxgl-user-location-dot-stale:after{display:none}.mapboxgl-user-location-accuracy-circle{background-color:rgba(29,161,242,.2);width:1px;height:1px;border-radius:100%}.mapboxgl-crosshair,.mapboxgl-crosshair .mapboxgl-interactive,.mapboxgl-crosshair .mapboxgl-interactive:active{cursor:crosshair}.mapboxgl-boxzoom{position:absolute;top:0;left:0;width:0;height:0;background:#fff;border:2px dotted #202020;opacity:.5}@media print{.mapbox-improve-map{display:none}}.legendables { - z-index: 1; - position: absolute; - left: 8px; - bottom: 8px; - background: rgba(255, 255, 255, 0.9); - border-radius: 2px; - border: solid 1px #e2e2e2; - overflow: auto; - font-size: 11px; } - .legendables.top-right { - right: 16px; - top: 8px; - bottom: auto; - left: auto; } - .legendables:hover { - background: white; } - .legendables.collapsed { - min-width: 0 !important; } - .legendables.collapsed .legend { - display: none; } - .legendables.collapsed .header { - display: none; } - .legendables.collapsed .open-toggle { - position: relative; - background: url("data:image/svg+xml;utf8, "); - background-size: cover; } - .legendables.collapsed .open-toggle:before, .legendables.collapsed .open-toggle:after { - display: none; } - .legendables .open-toggle { - width: 24px; - height: 24px; - top: 0; - right: 0; - position: absolute; - z-index: 5; } - .legendables .open-toggle:before, .legendables .open-toggle:after { - position: absolute; - width: 2px; - height: 16px; - background: #a7a7a7; - content: ""; - left: 11px; - top: 4px; } - .legendables .open-toggle:before { - transform: rotate(-45deg) scale(0.6); } - .legendables .open-toggle:after { - transform: rotate(45deg) scale(0.6); } - .legendables .open-toggle:hover:before, .legendables .open-toggle:hover:after { - background: #22A7F0; } - .legendables.show-ticks .tick { - display: block; } - .legendables .tick { - display: none; - cursor: pointer; - width: 24px; - height: 24px; - position: absolute; - right: -4px; - top: 0; } - .legendables .tick:after { - width: 10px; - height: 10px; - border: 2px solid #a7a7a7; - content: ""; - transform: translate(-2px, -2px) scale(0.6) rotate(45deg); - border-left: 0; - border-top: 0; - position: absolute; - top: 8px; - left: 8px; } - .legendables .tick:hover:after { - border-color: #22A7F0; } - .legendables .header { - color: #a7a7a7; - font-weight: bold; - margin: 0 4px 0 4px; - position: relative; - height: 24px; - padding-right: 24px; - border-bottom: 1px solid #e2e2e2; } - .legendables .title-text { - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - line-height: 24px; } - .legendables .legend.open .tick:after { - transform: translate(-1px, 0) scale(0.6) rotate(-135deg); } - .legendables .legend:not(.open):last-child .header { - border: none; } - .legendables .legend:nth-child(2) .tick { - right: 16px; } - .legendables .legend:nth-child(2) .header { - padding-right: 36px; } - .legendables.nominal-legend { - max-height: 50%; } - .legendables.gradient-legend { - background: none; - overflow: visible; - border: none; - left: 0; - bottom: 0; } - .legendables .gradient-legend { - position: relative !important; } - -.nominal-legend { - max-width: 160px; - min-width: 100px; } - -.nominal-legend.legendables { - border: 1px solid white; } - -.nominal-legend .body { - overflow-y: auto; - padding: 0 4px 4px 4px; } - -.nominal-legend .legend-row { - display: flex; - align-items: center; - cursor: default; - min-height: 16px; } - -.nominal-legend .legend-row .color { - width: 8px; - height: 8px; - flex-shrink: 0; } - -.nominal-legend .legend-row .text { - flex-grow: 1; - padding: 4px; - word-break: break-word; - line-height: 1; } - -.gradient-legend .range { - display: flex; - justify-content: center; - margin-top: 4px; - padding-left: 8px; - padding-right: 8px; } - -.gradient-legend .block { - float: left; - position: relative; - height: 32px; } - -.gradient-legend .block .color { - height: 12px; - width: 12px; - border: 1px solid white; } - -.gradient-legend .block .text { - white-space: nowrap; - position: absolute; - text-align: center; - transform: translateX(-50%); - left: 6px; - color: #868686; - font-size: 10px; - padding: 2px 2px 0 2px; - background: rgba(255, 255, 255, 0.4); } - -.gradient-legend .block .step { - display: none; } - -.gradient-legend .block:hover .step { - display: block; } - -.gradient-legend .block:hover .extent span { - opacity: 0; - pointer-events: none; - position: absolute; } - -.gradient-legend .block input { - height: 16px; - width: 32px; - min-width: 32px; - border: 1px solid #c7c7c7; - text-align: center; - float: left; - overflow: visible; - outline: none; } - -.gradient-legend .lock { - width: 15px; - height: 15px; } - -.gradient-legend .lock svg { - fill: #a7a7a7; } - -.gradient-legend .lock:hover { - cursor: pointer; } - -.gradient-legend .lock:hover svg { - fill: #22a7f0; } - -.horizontal-lasso-tools .mapd-draw-button-control-group { - display: flex; } - .horizontal-lasso-tools .mapd-draw-button-control-group button { - flex-grow: 1; } - -.gradient-legend { - display: flex; - flex-direction: column; - z-index: 2; - max-width: 160px; } - .gradient-legend .lock { - position: absolute; - right: 4px; - bottom: 18px; } - .gradient-legend .lock:not(.locked) { - opacity: 0; } - .gradient-legend:hover .lock { - opacity: 1; } - .gradient-legend .range { - padding: 4px 0 0 0; - margin: 0 20px 0 12px; } - .gradient-legend .range:hover .block:not(:hover) .extent { - display: none; } - .gradient-legend .range:hover .block:not(:hover) .color { - opacity: .4; } - .gradient-legend .block input { - display: none; } - .gradient-legend .block:hover .extent { - background: none; } - .gradient-legend .block:hover .extent input { - display: inline-block !important; } - .gradient-legend .block:hover .extent span { - display: none; } diff --git a/dist/charting.js b/dist/charting.js deleted file mode 100644 index 7070dc38..00000000 --- a/dist/charting.js +++ /dev/null @@ -1,103218 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(require("d3")); - else if(typeof define === 'function' && define.amd) - define(["d3"], factory); - else if(typeof exports === 'object') - exports["charting"] = factory(require("d3")); - else - root["charting"] = factory(root["d3"]); -})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__) { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 263); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(module) {var require;//! moment.js -//! version : 2.29.4 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com - -;(function (global, factory) { - true ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - global.moment = factory() -}(this, (function () { 'use strict'; - - var hookCallback; - - function hooks() { - return hookCallback.apply(null, arguments); - } - - // This is done to register the method called with moment() - // without creating circular dependencies. - function setHookCallback(callback) { - hookCallback = callback; - } - - function isArray(input) { - return ( - input instanceof Array || - Object.prototype.toString.call(input) === '[object Array]' - ); - } - - 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 hasOwnProp(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); - } - - 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; - } - } - - function isUndefined(input) { - return input === void 0; - } - - function isNumber(input) { - return ( - typeof input === 'number' || - Object.prototype.toString.call(input) === '[object Number]' - ); - } - - function isDate(input) { - return ( - input instanceof Date || - Object.prototype.toString.call(input) === '[object Date]' - ); - } - - function map(arr, fn) { - var res = [], - i, - arrLen = arr.length; - for (i = 0; i < arrLen; ++i) { - res.push(fn(arr[i], i)); - } - return res; - } - - function extend(a, b) { - for (var i in b) { - if (hasOwnProp(b, i)) { - a[i] = b[i]; - } - } - - if (hasOwnProp(b, 'toString')) { - a.toString = b.toString; - } - - if (hasOwnProp(b, 'valueOf')) { - a.valueOf = b.valueOf; - } - - return a; - } - - function createUTC(input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, true).utc(); - } - - 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 getParsingFlags(m) { - if (m._pf == null) { - m._pf = defaultParsingFlags(); - } - return m._pf; - } - - var some; - if (Array.prototype.some) { - some = Array.prototype.some; - } else { - some = function (fun) { - var t = Object(this), - len = t.length >>> 0, - i; - - for (i = 0; i < len; i++) { - if (i in t && fun.call(this, t[i], i, t)) { - return true; - } - } - - return false; - }; - } - - 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)); - - if (m._strict) { - isNowValid = - isNowValid && - flags.charsLeftOver === 0 && - flags.unusedTokens.length === 0 && - flags.bigHour === undefined; - } - - if (Object.isFrozen == null || !Object.isFrozen(m)) { - m._isValid = isNowValid; - } else { - return isNowValid; - } - } - return m._isValid; - } - - function createInvalid(flags) { - var m = createUTC(NaN); - if (flags != null) { - extend(getParsingFlags(m), flags); - } else { - getParsingFlags(m).userInvalidated = true; - } - - return m; - } - - // Plugins that add properties should also add the key here (null value), - // so we can properly clone ourselves. - var momentProperties = (hooks.momentProperties = []), - updateInProgress = false; - - function copyConfig(to, from) { - var i, - prop, - val, - momentPropertiesLen = momentProperties.length; - - 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; - } - - if (momentPropertiesLen > 0) { - for (i = 0; i < momentPropertiesLen; i++) { - prop = momentProperties[i]; - val = from[prop]; - if (!isUndefined(val)) { - to[prop] = val; - } - } - } - - return to; - } - - // 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; - } - } - - function isMoment(obj) { - return ( - obj instanceof Moment || (obj != null && obj._isAMomentObject != null) - ); - } - - function warn(msg) { - if ( - hooks.suppressDeprecationWarnings === false && - typeof console !== 'undefined' && - console.warn - ) { - console.warn('Deprecation warning: ' + msg); - } - } - - function deprecate(msg, fn) { - var firstTime = true; - - 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 deprecations = {}; - - function deprecateSimple(name, msg) { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(name, msg); - } - if (!deprecations[name]) { - warn(msg); - deprecations[name] = true; - } - } - - hooks.suppressDeprecationWarnings = false; - hooks.deprecationHandler = null; - - function isFunction(input) { - return ( - (typeof Function !== 'undefined' && input instanceof Function) || - Object.prototype.toString.call(input) === '[object Function]' - ); - } - - 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 - ); - } - - 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; - } - - function Locale(config) { - if (config != null) { - this.set(config); - } - } - - var keys; - - 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 defaultCalendar = { - sameDay: '[Today at] LT', - nextDay: '[Tomorrow at] LT', - nextWeek: 'dddd [at] LT', - lastDay: '[Yesterday at] LT', - lastWeek: '[Last] dddd [at] LT', - sameElse: 'L', - }; - - function calendar(key, mom, now) { - var output = this._calendar[key] || this._calendar['sameElse']; - return isFunction(output) ? output.call(mom, now) : output; - } - - 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 - ); - } - - 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 = {}; - - // 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 - ); - }; - } - } - - function removeFormattingTokens(input) { - if (input.match(/\[[\s\S]/)) { - return input.replace(/^\[|\]$/g, ''); - } - return input.replace(/\\/g, ''); - } - - function makeFormatFunction(format) { - var array = format.match(formattingTokens), - i, - length; - - for (i = 0, length = array.length; i < length; i++) { - if (formatTokenFunctions[array[i]]) { - array[i] = formatTokenFunctions[array[i]]; - } else { - array[i] = removeFormattingTokens(array[i]); - } - } - - 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; - }; - } - - // format date using native date object - function formatMoment(m, format) { - if (!m.isValid()) { - return m.localeData().invalidDate(); - } - - format = expandFormat(format, m.localeData()); - formatFunctions[format] = - formatFunctions[format] || makeFormatFunction(format); - - return formatFunctions[format](m); - } - - function expandFormat(format, locale) { - var i = 5; - - function replaceLongDateFormatTokens(input) { - return locale.longDateFormat(input) || input; - } - - localFormattingTokens.lastIndex = 0; - while (i >= 0 && localFormattingTokens.test(format)) { - format = format.replace( - localFormattingTokens, - replaceLongDateFormatTokens - ); - localFormattingTokens.lastIndex = 0; - i -= 1; - } - - return format; - } - - 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', - }; - - function longDateFormat(key) { - var format = this._longDateFormat[key], - formatUpper = this._longDateFormat[key.toUpperCase()]; - - if (format || !formatUpper) { - return format; - } - - 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(''); - - return this._longDateFormat[key]; - } - - var defaultInvalidDate = 'Invalid date'; - - function invalidDate() { - return this._invalidDate; - } - - var defaultOrdinal = '%d', - defaultDayOfMonthOrdinalParse = /\d{1,2}/; - - function ordinal(number) { - return this._ordinal.replace('%d', number); - } - - 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', - }; - - 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 pastFuture(diff, output) { - var format = this._relativeTime[diff > 0 ? 'future' : 'past']; - return isFunction(format) ? format(output) : format.replace(/%s/i, output); - } - - var aliases = {}; - - function addUnitAlias(unit, shorthand) { - var lowerCase = unit.toLowerCase(); - aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; - } - - function normalizeUnits(units) { - return typeof units === 'string' - ? aliases[units] || aliases[units.toLowerCase()] - : undefined; - } - - function normalizeObjectUnits(inputObject) { - var normalizedInput = {}, - normalizedProp, - prop; - - for (prop in inputObject) { - if (hasOwnProp(inputObject, prop)) { - normalizedProp = normalizeUnits(prop); - if (normalizedProp) { - normalizedInput[normalizedProp] = inputObject[prop]; - } - } - } - - return normalizedInput; - } - - var priorities = {}; - - function addUnitPriority(unit, priority) { - priorities[unit] = priority; - } - - 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 isLeapYear(year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; - } - - function absFloor(number) { - if (number < 0) { - // -0 -> 0 - return Math.ceil(number) || 0; - } else { - return Math.floor(number); - } - } - - function toInt(argumentForCoercion) { - var coercedNumber = +argumentForCoercion, - value = 0; - - if (coercedNumber !== 0 && isFinite(coercedNumber)) { - value = absFloor(coercedNumber); - } - - return value; - } - - 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 get(mom, unit) { - return mom.isValid() - ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() - : NaN; - } - - 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); - } - } - } - - // MOMENTS - - 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; - } - - 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; - - regexes = {}; - - function addRegexToken(token, regex, strictRegex) { - regexes[token] = isFunction(regex) - ? regex - : function (isStrict, localeData) { - return isStrict && strictRegex ? strictRegex : regex; - }; - } - - function getParseRegexForToken(token, config) { - if (!hasOwnProp(regexes, token)) { - return new RegExp(unescapeFormat(token)); - } - - return regexes[token](config._strict, config._locale); - } - - // 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; - } - ) - ); - } - - function regexEscape(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - } - - var tokens = {}; - - 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; - } - } - - function addWeekParseToken(token, callback) { - addParseToken(token, function (input, array, config, token) { - config._w = config._w || {}; - callback(input, config._w, config, token); - }); - } - - function addTimeToArrayFromToken(token, input, config) { - if (input != null && hasOwnProp(tokens, token)) { - tokens[token](input, config._a, config, token); - } - } - - var YEAR = 0, - MONTH = 1, - DATE = 2, - HOUR = 3, - MINUTE = 4, - SECOND = 5, - MILLISECOND = 6, - WEEK = 7, - WEEKDAY = 8; - - function mod(n, x) { - return ((n % x) + x) % x; - } - - 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 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); - } - - // FORMATTING - - 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); - }); - - // ALIASES - - addUnitAlias('month', 'M'); - - // PRIORITY - - addUnitPriority('month', 8); - - // PARSING - - 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); - }); - - 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 { - getParsingFlags(config).invalidMonth = input; - } - }); - - // 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 isArray(this._months) - ? this._months[m.month()] - : this._months[ - (this._months.isFormat || MONTHS_IN_FORMAT).test(format) - ? 'format' - : 'standalone' - ][m.month()]; - } - - 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()]; - } - - 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(); - } - } - - 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 localeMonthsParse(monthName, format, strict) { - var i, mom, regex; - - if (this._monthsParseExact) { - return handleStrictParse.call(this, monthName, format, strict); - } - - if (!this._monthsParse) { - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - } - - // 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; - } - } - } - - // MOMENTS - - function setMonth(mom, value) { - var dayOfMonth; - - if (!mom.isValid()) { - // No op - return mom; - } - - 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; - } - } - } - - dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); - mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); - return mom; - } - - function getSetMonth(value) { - if (value != null) { - setMonth(this, value); - hooks.updateOffset(this, true); - return this; - } else { - return get(this, 'Month'); - } - } - - function getDaysInMonth() { - return daysInMonth(this.year(), this.month()); - } - - 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; - } - } - - 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; - } - } - - function computeMonthsParse() { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - 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]); - } - - 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' - ); - } - - // FORMATTING - - addFormatToken('Y', 0, 0, function () { - var y = this.year(); - return y <= 9999 ? zeroFill(y, 4) : '+' + y; - }); - - addFormatToken(0, ['YY', 2], 0, function () { - return this.year() % 100; - }); - - addFormatToken(0, ['YYYY', 4], 0, 'year'); - addFormatToken(0, ['YYYYY', 5], 0, 'year'); - addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); - - // ALIASES - - addUnitAlias('year', 'y'); - - // PRIORITIES - - addUnitPriority('year', 1); - - // PARSING - - addRegexToken('Y', matchSigned); - addRegexToken('YY', match1to2, match2); - addRegexToken('YYYY', match1to4, match4); - addRegexToken('YYYYY', match1to6, match6); - addRegexToken('YYYYYY', match1to6, match6); - - 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); - }); - - // HELPERS - - function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; - } - - // HOOKS - - hooks.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); - }; - - // MOMENTS - - var getSetYear = makeGetSet('FullYear', true); - - function getIsLeapYear() { - return isLeapYear(this.year()); - } - - 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); - } - - return date; - } - - 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)); - } - - return date; - } - - // 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; - - return -fwdlw + fwd - 1; - } - - // 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; - - 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 { - year: resYear, - dayOfYear: resDayOfYear, - }; - } - - function weekOfYear(mom, dow, doy) { - var weekOffset = firstWeekOffset(mom.year(), dow, doy), - week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, - resWeek, - resYear; - - 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; - } - - 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('w', ['ww', 2], 'wo', 'week'); - addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); - - // ALIASES - - addUnitAlias('week', 'w'); - addUnitAlias('isoWeek', 'W'); - - // PRIORITIES - - addUnitPriority('week', 5); - addUnitPriority('isoWeek', 5); - - // PARSING - - addRegexToken('w', match1to2); - addRegexToken('ww', match1to2, match2); - addRegexToken('W', match1to2); - addRegexToken('WW', match1to2, match2); - - addWeekParseToken( - ['w', 'ww', 'W', 'WW'], - function (input, week, config, token) { - week[token.substr(0, 1)] = toInt(input); - } - ); - - // HELPERS - - // LOCALES - - function localeWeek(mom) { - return weekOfYear(mom, this._week.dow, this._week.doy).week; - } - - 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. - }; - - function localeFirstDayOfWeek() { - return this._week.dow; - } - - function localeFirstDayOfYear() { - return this._week.doy; - } - - // MOMENTS - - function getSetWeek(input) { - var week = this.localeData().week(this); - return input == null ? week : this.add((input - week) * 7, 'd'); - } - - function getSetISOWeek(input) { - var week = weekOfYear(this, 1, 4).week; - return input == null ? week : this.add((input - week) * 7, 'd'); - } - - // FORMATTING - - addFormatToken('d', 0, 'do', 'day'); - - addFormatToken('dd', 0, 0, function (format) { - return this.localeData().weekdaysMin(this, format); - }); - - addFormatToken('ddd', 0, 0, function (format) { - return this.localeData().weekdaysShort(this, format); - }); - - addFormatToken('dddd', 0, 0, function (format) { - return this.localeData().weekdays(this, format); - }); - - addFormatToken('e', 0, 0, 'weekday'); - addFormatToken('E', 0, 0, 'isoWeekday'); - - // ALIASES - - addUnitAlias('day', 'd'); - addUnitAlias('weekday', 'e'); - addUnitAlias('isoWeekday', 'E'); - - // PRIORITY - addUnitPriority('day', 11); - addUnitPriority('weekday', 11); - addUnitPriority('isoWeekday', 11); - - // PARSING - - 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); - }); - - 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; - } - }); - - addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { - week[token] = toInt(input); - }); - - // HELPERS - - function parseWeekday(input, locale) { - if (typeof input !== 'string') { - return input; - } - - if (!isNaN(input)) { - return parseInt(input, 10); - } - - input = locale.weekdaysParse(input); - if (typeof input === 'number') { - return input; - } - - return null; - } - - function parseIsoWeekday(input, locale) { - if (typeof input === 'string') { - return locale.weekdaysParse(input) % 7 || 7; - } - return isNaN(input) ? null : input; - } - - // 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; - - 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 localeWeekdaysShort(m) { - return m === true - ? shiftWeekdays(this._weekdaysShort, this._week.dow) - : m - ? this._weekdaysShort[m.day()] - : this._weekdaysShort; - } - - function localeWeekdaysMin(m) { - return m === true - ? shiftWeekdays(this._weekdaysMin, this._week.dow) - : m - ? this._weekdaysMin[m.day()] - : this._weekdaysMin; - } - - 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(); - } - } - - 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 localeWeekdaysParse(weekdayName, format, strict) { - var i, mom, regex; - - if (this._weekdaysParseExact) { - return handleStrictParse$1.call(this, weekdayName, format, strict); - } - - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._minWeekdaysParse = []; - this._shortWeekdaysParse = []; - this._fullWeekdaysParse = []; - } - - 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; - } - } - } - - // MOMENTS - - 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; - } - } - - 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'); - } - - function getSetISODayOfWeek(input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - - // 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. - - 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); - } - if (isStrict) { - return this._weekdaysStrictRegex; - } else { - return this._weekdaysRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysRegex')) { - this._weekdaysRegex = defaultWeekdaysRegex; - } - return this._weekdaysStrictRegex && isStrict - ? this._weekdaysStrictRegex - : this._weekdaysRegex; - } - } - - function weekdaysShortRegex(isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysShortStrictRegex; - } else { - return this._weekdaysShortRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysShortRegex')) { - this._weekdaysShortRegex = defaultWeekdaysShortRegex; - } - return this._weekdaysShortStrictRegex && isStrict - ? this._weekdaysShortStrictRegex - : this._weekdaysShortRegex; - } - } - - function weekdaysMinRegex(isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysMinStrictRegex; - } else { - return this._weekdaysMinRegex; - } - } 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; - - this._weekdaysStrictRegex = new RegExp( - '^(' + longPieces.join('|') + ')', - 'i' - ); - this._weekdaysShortStrictRegex = new RegExp( - '^(' + shortPieces.join('|') + ')', - 'i' - ); - this._weekdaysMinStrictRegex = new RegExp( - '^(' + minPieces.join('|') + ')', - 'i' - ); - } - - // FORMATTING - - function hFormat() { - return this.hours() % 12 || 12; - } - - function kFormat() { - return this.hours() || 24; - } - - addFormatToken('H', ['HH', 2], 0, 'hour'); - addFormatToken('h', ['hh', 2], 0, hFormat); - addFormatToken('k', ['kk', 2], 0, kFormat); - - addFormatToken('hmm', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); - }); - - addFormatToken('hmmss', 0, 0, function () { - return ( - '' + - hFormat.apply(this) + - zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2) - ); - }); - - addFormatToken('Hmm', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2); - }); - - addFormatToken('Hmmss', 0, 0, function () { - return ( - '' + - this.hours() + - zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2) - ); - }); - - function meridiem(token, lowercase) { - addFormatToken(token, 0, 0, function () { - return this.localeData().meridiem( - this.hours(), - this.minutes(), - lowercase - ); - }); - } - - meridiem('a', true); - meridiem('A', false); - - // ALIASES - - addUnitAlias('hour', 'h'); - - // PRIORITY - addUnitPriority('hour', 13); - - // PARSING - - 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)); - }); - - // LOCALES - - 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 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); - - function localeMeridiem(hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'pm' : 'PM'; - } else { - return isLower ? 'am' : 'AM'; - } - } - - var baseConfig = { - calendar: defaultCalendar, - longDateFormat: defaultLongDateFormat, - invalidDate: defaultInvalidDate, - ordinal: defaultOrdinal, - dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, - relativeTime: defaultRelativeTime, - - months: defaultLocaleMonths, - monthsShort: defaultLocaleMonthsShort, - - week: defaultLocaleWeek, - - weekdays: defaultLocaleWeekdays, - weekdaysMin: defaultLocaleWeekdaysMin, - weekdaysShort: defaultLocaleWeekdaysShort, - - meridiemParse: defaultLocaleMeridiemParse, - }; - - // internal storage for locale config files - var locales = {}, - localeFamilies = {}, - globalLocale; - - 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; - } - - function normalizeLocale(key) { - return key ? key.toLowerCase().replace('_', '-') : key; - } - - // 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; - } - - function isLocaleNameSane(name) { - // Prevent names that look like filesystem paths, i.e contain '/' or '\' - return name.match('^[^/\\\\]*$') != null; - } - - 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; - __webpack_require__(291)("./" + 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 - } - } - return locales[name]; - } - - // 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); - } - - 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; - } - - 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)); - - if (localeFamilies[name]) { - localeFamilies[name].forEach(function (x) { - defineLocale(x.name, x.config); - }); - } - - // 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); - - return locales[name]; - } else { - // useful for testing - delete locales[name]; - return null; - } - } - - 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; - } - - // 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 locales[name]; - } - - // returns locale data - function getLocale(key) { - var locale; - - if (key && key._locale && key._locale._abbr) { - key = key._locale._abbr; - } - - if (!key) { - return globalLocale; - } - - if (!isArray(key)) { - //short-circuit everything else - locale = loadLocale(key); - if (locale) { - return locale; - } - key = [key]; - } - - return chooseLocale(key); - } - - function listLocales() { - return keys(locales); - } - - function checkOverflow(m) { - var overflow, - a = m._a; - - 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; - - 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; - } - - getParsingFlags(m).overflow = overflow; - } - - return m; - } - - // 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; - - 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; - } - } - - function extractFromRFC2822Strings( - yearStr, - monthStr, - dayStr, - hourStr, - minuteStr, - secondStr - ) { - var result = [ - untruncateYear(yearStr), - defaultLocaleMonthsShort.indexOf(monthStr), - parseInt(dayStr, 10), - parseInt(hourStr, 10), - parseInt(minuteStr, 10), - ]; - - if (secondStr) { - result.push(parseInt(secondStr, 10)); - } - - return result; - } - - function untruncateYear(yearStr) { - var year = parseInt(yearStr, 10); - if (year <= 49) { - return 2000 + year; - } else if (year <= 999) { - return 1900 + year; - } - return year; - } - - 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*$/, ''); - } - - 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; - } - - 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; - } - } - - // 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; - } - - 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); - - getParsingFlags(config).rfc2822 = true; - } else { - config._isValid = false; - } - } - - // 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; - } - - configFromISO(config); - if (config._isValid === false) { - delete config._isValid; - } else { - return; - } - - configFromRFC2822(config); - if (config._isValid === false) { - delete config._isValid; - } else { - return; - } - - if (config._strict) { - config._isValid = false; - } else { - // Final attempt, use Input Fallback - hooks.createFromInputFallback(config); - } - } - - 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' : '')); - } - ); - - // 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; - } - - 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()]; - } - - // 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; - } - - currentDate = currentDateArray(config); - - //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } - - //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; - } - - date = createUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } - - // 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; - - // 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; - - 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; - } - - return res; - } - - function prepareConfig(config) { - var input = config._i, - format = config._f; - - config._locale = config._locale || getLocale(config._l); - - if (input === null || (format === undefined && input === '')) { - return createInvalid({ nullInput: true }); - } - - 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; - } - - 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 createLocalOrUTC(input, format, locale, strict, isUTC) { - var c = {}; - - if (format === true || format === false) { - strict = format; - format = undefined; - } - - if (locale === true || locale === false) { - strict = locale; - locale = undefined; - } - - 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 createLocal(input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, false); - } - - 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(); - } - } - ); - - // 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 res; - } - - // TODO: Use [].sort instead? - function min() { - var args = [].slice.call(arguments, 0); - - return pickBy('isBefore', args); - } - - function max() { - var args = [].slice.call(arguments, 0); - - return pickBy('isAfter', args); - } - - var now = function () { - return Date.now ? Date.now() : +new Date(); - }; - - var ordering = [ - 'year', - 'quarter', - 'month', - 'week', - 'day', - 'hour', - 'minute', - 'second', - 'millisecond', - ]; - - 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; - } - } - - 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 true; - } - - function isValid$1() { - return this._isValid; - } - - function createInvalid$1() { - return createDuration(NaN); - } - - 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._isValid = isDurationValid(normalizedInput); - - // 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; - - this._data = {}; - - this._locale = getLocale(); - - this._bubble(); - } - - function isDuration(obj) { - return obj instanceof Duration; - } - - function absRound(number) { - if (number < 0) { - return Math.round(-1 * number) * -1; - } else { - return Math.round(number); - } - } - - // 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; - } - - // FORMATTING - - 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) - ); - }); - } - - offset('Z', ':'); - offset('ZZ', ''); - - // PARSING - - addRegexToken('Z', matchShortOffset); - addRegexToken('ZZ', matchShortOffset); - addParseToken(['Z', 'ZZ'], function (input, array, config) { - config._useUTC = true; - config._tzm = offsetFromString(matchShortOffset, input); - }); - - // HELPERS - - // timezone chunker - // '+10:00' > ['10', '00'] - // '-1530' > ['-15', '30'] - var chunkOffset = /([\+\-]|\d\d)/gi; - - function offsetFromString(matcher, string) { - var matches = (string || '').match(matcher), - chunk, - parts, - minutes; - - if (matches === null) { - return null; - } - - chunk = matches[matches.length - 1] || []; - parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; - minutes = +(parts[1] * 60) + toInt(parts[2]); - - 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 getDateOffset(m) { - // On Firefox.24 Date#getTimezoneOffset returns a floating point. - // https://github.com/moment/moment/pull/1871 - return -Math.round(m._d.getTimezoneOffset()); - } - - // HOOKS - - // 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 () {}; - - // MOMENTS - - // 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; - } - - this.utcOffset(input, keepLocalTime); - - return this; - } else { - return -this.utcOffset(); - } - } - - 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; - } - - 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; - } - - function hasAlignedHourOffset(input) { - if (!this.isValid()) { - return false; - } - input = input ? createLocal(input).utcOffset() : 0; - - return (this.utcOffset() - input) % 60 === 0; - } - - function isDaylightSavingTime() { - return ( - this.utcOffset() > this.clone().month(0).utcOffset() || - this.utcOffset() > this.clone().month(5).utcOffset() - ); - } - - function isDaylightSavingTimeShifted() { - if (!isUndefined(this._isDSTShifted)) { - return this._isDSTShifted; - } - - var c = {}, - other; - - copyConfig(c, this); - c = prepareConfig(c); - - 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; - } - - return this._isDSTShifted; - } - - function isLocal() { - return this.isValid() ? !this._isUTC : false; - } - - function isUtcOffset() { - return this.isValid() ? this._isUTC : false; - } - - function isUtc() { - return this.isValid() ? this._isUTC && this._offset === 0 : false; - } - - // 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)?)?$/; - - 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; - } - - 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; - } - - function positiveMomentsDifference(base, other) { - var res = {}; - - 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'); - - return res; - } - - function momentsDifference(base, other) { - var res; - if (!(base.isValid() && other.isValid())) { - return { milliseconds: 0, months: 0 }; - } - - 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; - } - - dur = createDuration(val, period); - addSubtract(this, dur, direction); - return this; - }; - } - - function addSubtract(mom, duration, isAdding, updateOffset) { - var milliseconds = duration._milliseconds, - days = absRound(duration._days), - months = absRound(duration._months); - - if (!mom.isValid()) { - // No op - return; - } - - 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); - } - } - - var add = createAdder(1, 'add'), - subtract = createAdder(-1, 'subtract'); - - function isString(input) { - return typeof input === 'string' || input instanceof String; - } - - // 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 - ); - } - - 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; - - for (i = 0; i < propertyLen; i += 1) { - property = properties[i]; - propertyTest = propertyTest || hasOwnProp(input, property); - } - - return objectTest && propertyTest; - } - - 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; - } - - function isCalendarSpec(input) { - var objectTest = isObject(input) && !isObjectEmpty(input), - propertyTest = false, - properties = [ - 'sameDay', - 'nextDay', - 'lastDay', - 'nextWeek', - 'lastWeek', - 'sameElse', - ], - i, - property; - - for (i = 0; i < properties.length; i += 1) { - property = properties[i]; - propertyTest = propertyTest || hasOwnProp(input, property); - } - - return objectTest && propertyTest; - } - - 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 localInput.valueOf() < this.clone().startOf(units).valueOf(); - } - } - - 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)) - ); - } - - 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); - } - - function isSameOrBefore(input, units) { - return this.isSame(input, units) || this.isBefore(input, units); - } - - function diff(input, units, asFloat) { - var that, zoneDelta, output; - - if (!this.isValid()) { - return NaN; - } - - that = cloneWithOffset(input, this); - - if (!that.isValid()) { - return NaN; - } - - zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; - - units = normalizeUnits(units); - - 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; - } - - return asFloat ? output : absFloor(output); - } - - 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 (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; - } - - hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; - hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; - - function toString() { - return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); - } - - 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' - ); - } - - /** - * 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 + '[")]'; - - return this.format(prefix + year + datetime + suffix); - } - - 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(); - } - } - - function fromNow(withoutSuffix) { - return this.from(createLocal(), withoutSuffix); - } - - 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(); - } - } - - function toNow(withoutSuffix) { - return this.to(createLocal(), withoutSuffix); - } - - // 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; - } - } - - 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; - } - - 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; - - // actual modulo - handles negative numbers (for dates before 1970): - function mod$1(dividend, divisor) { - return ((dividend % divisor) + divisor) % divisor; - } - - 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 startOf(units) { - var time, startOfDate; - units = normalizeUnits(units); - if (units === undefined || units === 'millisecond' || !this.isValid()) { - return this; - } - - 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; - - 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; - } - - function unix() { - return Math.floor(this.valueOf() / 1000); - } - - function toDate() { - return new Date(this.valueOf()); - } - - function toArray() { - var m = this; - return [ - m.year(), - m.month(), - m.date(), - m.hour(), - m.minute(), - m.second(), - m.millisecond(), - ]; - } - - 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 toJSON() { - // new Date(NaN).toJSON() === null - return this.isValid() ? this.toISOString() : null; - } - - function isValid$2() { - return isValid(this); - } - - 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, - }; - } - - 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'); - - 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 { - getParsingFlags(config).invalidEra = input; - } - } - ); - - addRegexToken('y', matchUnsigned); - addRegexToken('yy', matchUnsigned); - addRegexToken('yyy', matchUnsigned); - addRegexToken('yyyy', matchUnsigned); - addRegexToken('yo', matchEraYearOrdinal); - - 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); - } - - if (config._locale.eraYearOrdinalParse) { - array[YEAR] = config._locale.eraYearOrdinalParse(input, match); - } else { - array[YEAR] = parseInt(input, 10); - } - }); - - 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; - } - - 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; - } - - function localeErasParse(eraName, format, strict) { - var i, - l, - eras = this.eras(), - name, - abbr, - narrow; - eraName = eraName.toUpperCase(); - - for (i = 0, l = eras.length; i < l; ++i) { - name = eras[i].name.toUpperCase(); - abbr = eras[i].abbr.toUpperCase(); - narrow = eras[i].narrow.toUpperCase(); - - if (strict) { - switch (format) { - case 'N': - case 'NN': - case 'NNN': - if (abbr === eraName) { - return eras[i]; - } - break; - - 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]; - } - } - } - - 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; - } - } - - 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(); - - 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 ''; - } - - 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(); - - 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; - } - } - - return ''; - } - - 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 (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; - } - } - - 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; - - // 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, - 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)); - - mixedPieces.push(regexEscape(eras[i].name)); - mixedPieces.push(regexEscape(eras[i].abbr)); - mixedPieces.push(regexEscape(eras[i].narrow)); - } - - 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 - - addUnitAlias('weekYear', 'gg'); - addUnitAlias('isoWeekYear', 'GG'); - - // PRIORITY - - addUnitPriority('weekYear', 1); - addUnitPriority('isoWeekYear', 1); - - // 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.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 { - weeksTarget = weeksInYear(input, dow, doy); - if (week > weeksTarget) { - week = weeksTarget; - } - return setWeekAll.call(this, input, week, weekday, dow, doy); - } - } - - 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; - } - - // FORMATTING - - addFormatToken('Q', 0, 'Qo', 'quarter'); - - // ALIASES - - addUnitAlias('quarter', 'Q'); - - // PRIORITY - - addUnitPriority('quarter', 7); - - // PARSING - - addRegexToken('Q', match1); - addParseToken('Q', function (input, array) { - array[MONTH] = (toInt(input) - 1) * 3; - }); - - // MOMENTS - - function getSetQuarter(input) { - return input == null - ? Math.ceil((this.month() + 1) / 3) - : this.month((input - 1) * 3 + (this.month() % 3)); - } - - // 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 - - addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); - - // ALIASES - - addUnitAlias('dayOfYear', 'DDD'); - - // PRIORITY - addUnitPriority('dayOfYear', 4); - - // 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'); - } - - // FORMATTING - - addFormatToken('m', ['mm', 2], 0, 'minute'); - - // ALIASES - - addUnitAlias('minute', 'm'); - - // PRIORITY - - addUnitPriority('minute', 14); - - // PARSING - - addRegexToken('m', match1to2); - addRegexToken('mm', match1to2, match2); - addParseToken(['m', 'mm'], MINUTE); - - // MOMENTS - - var getSetMinute = makeGetSet('Minutes', false); - - // FORMATTING - - addFormatToken('s', ['ss', 2], 0, 'second'); - - // ALIASES - - addUnitAlias('second', 's'); - - // PRIORITY - - addUnitPriority('second', 15); - - // PARSING - - addRegexToken('s', match1to2); - 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; - }); - - // ALIASES - - addUnitAlias('millisecond', 'ms'); - - // PRIORITY - - addUnitPriority('millisecond', 16); - - // 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); - } - - function parseMs(input, array) { - array[MILLISECOND] = toInt(('0.' + input) * 1000); - } - - for (token = 'S'; token.length <= 9; token += 'S') { - addParseToken(token, parseMs); - } - - getSetMillisecond = makeGetSet('Milliseconds', false); - - // FORMATTING - - addFormatToken('z', 0, 0, 'zoneAbbr'); - addFormatToken('zz', 0, 0, 'zoneName'); - - // MOMENTS - - function getZoneAbbr() { - return this._isUTC ? 'UTC' : ''; - } - - function getZoneName() { - return this._isUTC ? 'Coordinated Universal Time' : ''; - } - - 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() + '>'; - }; - } - 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 createInZone() { - return createLocal.apply(null, arguments).parseZone(); - } - - function preParsePostFormat(string) { - return string; - } - - 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 listMonthsImpl(format, index, field) { - if (isNumber(format)) { - index = format; - format = undefined; - } - - format = format || ''; - - if (index != null) { - return get$1(format, index, field, 'month'); - } - - var i, - out = []; - for (i = 0; i < 12; i++) { - out[i] = get$1(format, i, field, 'month'); - } - return out; - } - - // () - // (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; - } - - format = format || ''; - } - - var locale = getLocale(), - shift = localeSorted ? locale._week.dow : 0, - i, - out = []; - - if (index != null) { - return get$1(format, (index + shift) % 7, field, 'day'); - } - - for (i = 0; i < 7; i++) { - out[i] = get$1(format, (i + shift) % 7, field, 'day'); - } - return out; - } - - function listMonths(format, index) { - return listMonthsImpl(format, index, 'months'); - } - - function listMonthsShort(format, index) { - return listMonthsImpl(format, index, 'monthsShort'); - } - - function listWeekdays(localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); - } - - function listWeekdaysShort(localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); - } - - function listWeekdaysMin(localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); - } - - 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; - }, - }); - - // 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); - } - } - } - - // TODO: Use this.as('ms')? - function valueOf$1() { - if (!this.isValid()) { - return NaN; - } - return ( - this._milliseconds + - this._days * 864e5 + - (this._months % 12) * 2592e6 + - toInt(this._months / 12) * 31536e6 - ); - } - - 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'); - - 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.29.4'; - - 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; - -}))); - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(73)(module))) - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_1__; - -/***/ }), -/* 2 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["A"] = isEmpty; -/* harmony export (immutable) */ __webpack_exports__["G"] = keys; -/* harmony export (immutable) */ __webpack_exports__["U"] = values; -/* harmony export (immutable) */ __webpack_exports__["J"] = mapValues; -/* harmony export (immutable) */ __webpack_exports__["I"] = map; -/* harmony export (immutable) */ __webpack_exports__["t"] = flatten; -/* harmony export (immutable) */ __webpack_exports__["s"] = first; -/* harmony export (immutable) */ __webpack_exports__["H"] = last; -/* harmony export (immutable) */ __webpack_exports__["u"] = forEach; -/* harmony export (immutable) */ __webpack_exports__["E"] = isString; -/* harmony export (immutable) */ __webpack_exports__["F"] = isUndefined; -/* harmony export (immutable) */ __webpack_exports__["B"] = isFunction; -/* harmony export (immutable) */ __webpack_exports__["m"] = drop; -/* harmony export (immutable) */ __webpack_exports__["n"] = dropRight; -/* harmony export (immutable) */ __webpack_exports__["p"] = filter; -/* harmony export (immutable) */ __webpack_exports__["P"] = reject; -/* harmony export (immutable) */ __webpack_exports__["N"] = pick; -/* harmony export (immutable) */ __webpack_exports__["w"] = has; -/* harmony export (immutable) */ __webpack_exports__["j"] = contains; -/* harmony export (immutable) */ __webpack_exports__["g"] = cloneArr; -/* harmony export (immutable) */ __webpack_exports__["h"] = cloneObj; -/* harmony export (immutable) */ __webpack_exports__["q"] = find; -/* harmony export (immutable) */ __webpack_exports__["r"] = findAll; -/* harmony export (immutable) */ __webpack_exports__["O"] = reduce; -/* harmony export (immutable) */ __webpack_exports__["i"] = compact; -/* harmony export (immutable) */ __webpack_exports__["T"] = uniq; -/* unused harmony export partial */ -/* harmony export (immutable) */ __webpack_exports__["y"] = isArray; -/* harmony export (immutable) */ __webpack_exports__["D"] = isRegExp; -/* harmony export (immutable) */ __webpack_exports__["C"] = isObject; -/* harmony export (immutable) */ __webpack_exports__["o"] = every; -/* harmony export (immutable) */ __webpack_exports__["l"] = difference; -/* harmony export (immutable) */ __webpack_exports__["Q"] = some; -/* harmony export (immutable) */ __webpack_exports__["x"] = indexOf; -/* unused harmony export sortBy */ -/* unused harmony export zipObject */ -/* harmony export (immutable) */ __webpack_exports__["f"] = assign; -/* unused harmony export assignNoOverwrite */ -/* harmony export (immutable) */ __webpack_exports__["k"] = defaults; -/* harmony export (immutable) */ __webpack_exports__["v"] = groupBy; -/* harmony export (immutable) */ __webpack_exports__["K"] = merge; -/* harmony export (immutable) */ __webpack_exports__["b"] = NOOP; -/* harmony export (immutable) */ __webpack_exports__["a"] = IDENTITY; -/* harmony export (immutable) */ __webpack_exports__["L"] = packArray; -/* harmony export (immutable) */ __webpack_exports__["c"] = PRINT_ERROR; -/* harmony export (immutable) */ __webpack_exports__["d"] = PRINT_WARNING; -/* harmony export (immutable) */ __webpack_exports__["z"] = isES2015MapSupported; -/* harmony export (immutable) */ __webpack_exports__["e"] = applyMixins; -/* harmony export (immutable) */ __webpack_exports__["S"] = toFastProperties; -/* harmony export (immutable) */ __webpack_exports__["M"] = peek; -/* harmony export (immutable) */ __webpack_exports__["R"] = timer; -/* - Utils using lodash style API. (not necessarily 100% compliant) for functional and other utils. - These utils should replace usage of lodash in the production code base. not because they are any better... - but for the purpose of being a dependency free library. - - The hotspots in the code are already written in imperative style for performance reasons. - so writing several dozen utils which may be slower than the original lodash, does not matter as much - considering they will not be invoked in hotspots... - */ -function isEmpty(arr) { - return arr && arr.length === 0; -} -function keys(obj) { - if (obj === undefined || obj === null) { - return []; - } - return Object.keys(obj); -} -function values(obj) { - var vals = []; - var keys = Object.keys(obj); - for (var i = 0; i < keys.length; i++) { - vals.push(obj[keys[i]]); - } - return vals; -} -function mapValues(obj, callback) { - var result = []; - var objKeys = keys(obj); - for (var idx = 0; idx < objKeys.length; idx++) { - var currKey = objKeys[idx]; - result.push(callback.call(null, obj[currKey], currKey)); - } - return result; -} -function map(arr, callback) { - var result = []; - for (var idx = 0; idx < arr.length; idx++) { - result.push(callback.call(null, arr[idx], idx)); - } - return result; -} -function flatten(arr) { - var result = []; - for (var idx = 0; idx < arr.length; idx++) { - var currItem = arr[idx]; - if (Array.isArray(currItem)) { - result = result.concat(flatten(currItem)); - } - else { - result.push(currItem); - } - } - return result; -} -function first(arr) { - return isEmpty(arr) ? undefined : arr[0]; -} -function last(arr) { - var len = arr && arr.length; - return len ? arr[len - 1] : undefined; -} -function forEach(collection, iteratorCallback) { - /* istanbul ignore else */ - if (Array.isArray(collection)) { - for (var i = 0; i < collection.length; i++) { - iteratorCallback.call(null, collection[i], i); - } - } - else if (isObject(collection)) { - var colKeys = keys(collection); - for (var i = 0; i < colKeys.length; i++) { - var key = colKeys[i]; - var value = collection[key]; - iteratorCallback.call(null, value, key); - } - } - else { - throw Error("non exhaustive match"); - } -} -function isString(item) { - return typeof item === "string"; -} -function isUndefined(item) { - return item === undefined; -} -function isFunction(item) { - return item instanceof Function; -} -function drop(arr, howMuch) { - if (howMuch === void 0) { howMuch = 1; } - return arr.slice(howMuch, arr.length); -} -function dropRight(arr, howMuch) { - if (howMuch === void 0) { howMuch = 1; } - return arr.slice(0, arr.length - howMuch); -} -function filter(arr, predicate) { - var result = []; - if (Array.isArray(arr)) { - for (var i = 0; i < arr.length; i++) { - var item = arr[i]; - if (predicate.call(null, item)) { - result.push(item); - } - } - } - return result; -} -function reject(arr, predicate) { - return filter(arr, function (item) { return !predicate(item); }); -} -function pick(obj, predicate) { - var keys = Object.keys(obj); - var result = {}; - for (var i = 0; i < keys.length; i++) { - var currKey = keys[i]; - var currItem = obj[currKey]; - if (predicate(currItem)) { - result[currKey] = currItem; - } - } - return result; -} -function has(obj, prop) { - if (isObject(obj)) { - return obj.hasOwnProperty(prop); - } - return false; -} -function contains(arr, item) { - return find(arr, function (currItem) { return currItem === item; }) !== undefined ? true : false; -} -/** - * shallow clone - */ -function cloneArr(arr) { - var newArr = []; - for (var i = 0; i < arr.length; i++) { - newArr.push(arr[i]); - } - return newArr; -} -/** - * shallow clone - */ -function cloneObj(obj) { - var clonedObj = {}; - for (var key in obj) { - /* istanbul ignore else */ - if (Object.prototype.hasOwnProperty.call(obj, key)) { - clonedObj[key] = obj[key]; - } - } - return clonedObj; -} -function find(arr, predicate) { - for (var i = 0; i < arr.length; i++) { - var item = arr[i]; - if (predicate.call(null, item)) { - return item; - } - } - return undefined; -} -function findAll(arr, predicate) { - var found = []; - for (var i = 0; i < arr.length; i++) { - var item = arr[i]; - if (predicate.call(null, item)) { - found.push(item); - } - } - return found; -} -function reduce(arrOrObj, iterator, initial) { - var isArr = Array.isArray(arrOrObj); - var vals = isArr ? arrOrObj : values(arrOrObj); - var objKeys = isArr ? [] : keys(arrOrObj); - var accumulator = initial; - for (var i = 0; i < vals.length; i++) { - accumulator = iterator.call(null, accumulator, vals[i], isArr ? i : objKeys[i]); - } - return accumulator; -} -function compact(arr) { - return reject(arr, function (item) { return item === null || item === undefined; }); -} -function uniq(arr, identity) { - if (identity === void 0) { identity = function (item) { return item; }; } - var identities = []; - return reduce(arr, function (result, currItem) { - var currIdentity = identity(currItem); - if (contains(identities, currIdentity)) { - return result; - } - else { - identities.push(currIdentity); - return result.concat(currItem); - } - }, []); -} -function partial(func) { - var restArgs = []; - for (var _i = 1; _i < arguments.length; _i++) { - restArgs[_i - 1] = arguments[_i]; - } - var firstArg = [null]; - var allArgs = firstArg.concat(restArgs); - return Function.bind.apply(func, allArgs); -} -function isArray(obj) { - return Array.isArray(obj); -} -function isRegExp(obj) { - return obj instanceof RegExp; -} -function isObject(obj) { - return obj instanceof Object; -} -function every(arr, predicate) { - for (var i = 0; i < arr.length; i++) { - if (!predicate(arr[i], i)) { - return false; - } - } - return true; -} -function difference(arr, values) { - return reject(arr, function (item) { return contains(values, item); }); -} -function some(arr, predicate) { - for (var i = 0; i < arr.length; i++) { - if (predicate(arr[i])) { - return true; - } - } - return false; -} -function indexOf(arr, value) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] === value) { - return i; - } - } - return -1; -} -function sortBy(arr, orderFunc) { - var result = cloneArr(arr); - result.sort(function (a, b) { return orderFunc(a) - orderFunc(b); }); - return result; -} -function zipObject(keys, values) { - if (keys.length !== values.length) { - throw Error("can't zipObject with different number of keys and values!"); - } - var result = {}; - for (var i = 0; i < keys.length; i++) { - result[keys[i]] = values[i]; - } - return result; -} -/** - * mutates! (and returns) target - */ -function assign(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - for (var i = 0; i < sources.length; i++) { - var curSource = sources[i]; - var currSourceKeys = keys(curSource); - for (var j = 0; j < currSourceKeys.length; j++) { - var currKey = currSourceKeys[j]; - target[currKey] = curSource[currKey]; - } - } - return target; -} -/** - * mutates! (and returns) target - */ -function assignNoOverwrite(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - for (var i = 0; i < sources.length; i++) { - var curSource = sources[i]; - if (isUndefined(curSource)) { - continue; - } - var currSourceKeys = keys(curSource); - for (var j = 0; j < currSourceKeys.length; j++) { - var currKey = currSourceKeys[j]; - if (!has(target, currKey)) { - target[currKey] = curSource[currKey]; - } - } - } - return target; -} -function defaults() { - var sources = []; - for (var _i = 0; _i < arguments.length; _i++) { - sources[_i] = arguments[_i]; - } - return assignNoOverwrite.apply(null, [{}].concat(sources)); -} -function groupBy(arr, groupKeyFunc) { - var result = {}; - forEach(arr, function (item) { - var currGroupKey = groupKeyFunc(item); - var currGroupArr = result[currGroupKey]; - if (currGroupArr) { - currGroupArr.push(item); - } - else { - result[currGroupKey] = [item]; - } - }); - return result; -} -/** - * Merge obj2 into obj1. - * Will overwrite existing properties with the same name - */ -function merge(obj1, obj2) { - var result = cloneObj(obj1); - var keys2 = keys(obj2); - for (var i = 0; i < keys2.length; i++) { - var key = keys2[i]; - var value = obj2[key]; - result[key] = value; - } - return result; -} -function NOOP() { } -function IDENTITY(item) { - return item; -} -/** - * Will return a new packed array with same values. - */ -function packArray(holeyArr) { - var result = []; - for (var i = 0; i < holeyArr.length; i++) { - var orgValue = holeyArr[i]; - result.push(orgValue !== undefined ? orgValue : undefined); - } - return result; -} -function PRINT_ERROR(msg) { - /* istanbul ignore else - can't override global.console in node.js */ - if (console && console.error) { - console.error("Error: " + msg); - } -} -function PRINT_WARNING(msg) { - /* istanbul ignore else - can't override global.console in node.js*/ - if (console && console.warn) { - // TODO: modify docs accordingly - console.warn("Warning: " + msg); - } -} -function isES2015MapSupported() { - return typeof Map === "function"; -} -function applyMixins(derivedCtor, baseCtors) { - baseCtors.forEach(function (baseCtor) { - var baseProto = baseCtor.prototype; - Object.getOwnPropertyNames(baseProto).forEach(function (propName) { - if (propName === "constructor") { - return; - } - var basePropDescriptor = Object.getOwnPropertyDescriptor(baseProto, propName); - // Handle Accessors - if (basePropDescriptor && - (basePropDescriptor.get || basePropDescriptor.set)) { - Object.defineProperty(derivedCtor.prototype, propName, basePropDescriptor); - } - else { - derivedCtor.prototype[propName] = baseCtor.prototype[propName]; - } - }); - }); -} -// base on: https://github.com/petkaantonov/bluebird/blob/b97c0d2d487e8c5076e8bd897e0dcd4622d31846/src/util.js#L201-L216 -function toFastProperties(toBecomeFast) { - function FakeConstructor() { } - // If our object is used as a constructor it would receive - FakeConstructor.prototype = toBecomeFast; - var fakeInstance = new FakeConstructor(); - function fakeAccess() { - return typeof fakeInstance.bar; - } - // help V8 understand this is a "real" prototype by actually using - // the fake instance. - fakeAccess(); - fakeAccess(); - return toBecomeFast; - // Eval prevents optimization of this method (even though this is dead code) - /* istanbul ignore next */ - // tslint:disable-next-line - eval(toBecomeFast); -} -function peek(arr) { - return arr[arr.length - 1]; -} -/* istanbul ignore next - for performance tracing*/ -function timer(func) { - var start = new Date().getTime(); - var val = func(); - var end = new Date().getTime(); - var total = end - start; - return { time: total, value: val }; -} -//# sourceMappingURL=utils.js.map - -/***/ }), -/* 3 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return constants; }); -/* harmony export (immutable) */ __webpack_exports__["p"] = logging; -/* harmony export (immutable) */ __webpack_exports__["x"] = sampledCount; -/* harmony export (immutable) */ __webpack_exports__["n"] = incrementSampledCount; -/* harmony export (immutable) */ __webpack_exports__["d"] = decrementSampledCount; -/* harmony export (immutable) */ __webpack_exports__["t"] = refreshDisabled; -/* harmony export (immutable) */ __webpack_exports__["g"] = disableRefresh; -/* harmony export (immutable) */ __webpack_exports__["i"] = enableRefresh; -/* harmony export (immutable) */ __webpack_exports__["l"] = globalTransitionDuration; -/* harmony export (immutable) */ __webpack_exports__["h"] = disableTransitions; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return chartRegistry; }); -/* harmony export (immutable) */ __webpack_exports__["u"] = registerChart; -/* harmony export (immutable) */ __webpack_exports__["k"] = getChart; -/* harmony export (immutable) */ __webpack_exports__["f"] = deregisterChart; -/* harmony export (immutable) */ __webpack_exports__["m"] = hasChart; -/* harmony export (immutable) */ __webpack_exports__["e"] = deregisterAllCharts; -/* harmony export (immutable) */ __webpack_exports__["j"] = filterAll; -/* harmony export (immutable) */ __webpack_exports__["s"] = refocusAll; -/* harmony export (immutable) */ __webpack_exports__["y"] = transition; -/* harmony export (immutable) */ __webpack_exports__["q"] = optionalTransition; -/* harmony export (immutable) */ __webpack_exports__["a"] = afterTransition; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return units; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return round; }); -/* harmony export (immutable) */ __webpack_exports__["r"] = override; -/* harmony export (immutable) */ __webpack_exports__["v"] = renderlet; -/* harmony export (immutable) */ __webpack_exports__["o"] = instanceOfChart; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_utils__ = __webpack_require__(4); -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -var _logging = false; -var _sampledCount = 0; -var _refreshDisabled = false; -var _globalTransitionDuration = null; -var _renderlet = null; -var _disableTransitions = false; -var constants = { - CHART_CLASS: "dc-chart", - DEBUG_GROUP_CLASS: "debug", - STACK_CLASS: "stack", - DESELECTED_CLASS: "deselected", - SELECTED_CLASS: "selected", - NODE_INDEX_NAME: "__index__", - GROUP_INDEX_NAME: "__group_index__", - DEFAULT_CHART_GROUP: "__default_chart_group__", - NEGLIGIBLE_NUMBER: 1e-10, - ACCENT_CLASS: "accented", - EVENT_DELAY: 0 -}; -function logging(_) { - if (!arguments.length) { - return _logging; - } - _logging = _; -} -function sampledCount(_) { - if (!arguments.length) { - return _sampledCount; - } - _sampledCount = _; -} -function incrementSampledCount() { - return _sampledCount++; -} -function decrementSampledCount() { - return _sampledCount--; -} -function refreshDisabled(_) { - if (!arguments.length) { - return _refreshDisabled; - } - _refreshDisabled = _; -} -function disableRefresh() { - _refreshDisabled = true; -} -function enableRefresh() { - _refreshDisabled = false; -} -function globalTransitionDuration(_) { - if (!arguments.length) { - return _globalTransitionDuration; - } - _globalTransitionDuration = _; -} -function disableTransitions(_) { - if (!arguments.length) { - return _disableTransitions; - } - _disableTransitions = _; -} -var chartRegistry = function () { - // chartGroup:string => charts:array - var _chartMap = {}; - function initializeChartGroup(group) { - if (!group) { - group = constants.DEFAULT_CHART_GROUP; - } - if (!_chartMap[group]) { - _chartMap[group] = []; - } - return group; - } - return { - has: function has(chart) { - for (var e in _chartMap) { - if (_chartMap[e].indexOf(chart) >= 0) { - return true; - } - } - return false; - }, - register: function register(chart, group) { - if (Array.isArray(group)) { - group.forEach(function (g) { - return _chartMap[initializeChartGroup(g)].push(chart); - }); - } else { - _chartMap[initializeChartGroup(group)].push(chart); - } - }, - deregister: function deregister(chart, group) { - if (Array.isArray(group)) { - group.forEach(function (g) { - group = initializeChartGroup(g); - for (var i = 0; i < _chartMap[group].length; i++) { - if (_chartMap[group][i].anchorName() === chart.anchorName()) { - _chartMap[group].splice(i, 1); - break; - } - } - }); - } else { - group = initializeChartGroup(group); - for (var i = 0; i < _chartMap[group].length; i++) { - if (_chartMap[group][i].anchorName() === chart.anchorName()) { - _chartMap[group].splice(i, 1); - break; - } - } - } - }, - clear: function clear(group) { - if (Array.isArray(group)) { - group.forEach(function (g) { - return delete _chartMap[g]; - }); - } else if (group) { - delete _chartMap[group]; - } else { - _chartMap = {}; - } - }, - list: function list(group) { - if (Array.isArray(group)) { - return group.reduce(function (accum, g) { - return [].concat(_toConsumableArray(accum), _toConsumableArray(_chartMap[initializeChartGroup(g)])); - }, []).filter(function (item, i, self) { - return self.indexOf(item) === i; - }); - } else { - group = initializeChartGroup(group); - return _chartMap[group]; - } - }, - listAll: function listAll() { - return Object.keys(_chartMap).reduce(function (accum, key) { - return accum.concat(_chartMap[key]); - }, []).filter(function (item, i, self) { - return self.indexOf(item) === i; - }); - } - }; -}(); -function registerChart(chart, group) { - chartRegistry.register(chart, group); -} -function getChart(dcFlag) { - return chartRegistry.listAll().reduce(function (accum, chrt) { - return chrt.__dcFlag__ === dcFlag ? chrt : accum; - }, null); -} -function deregisterChart(chart, group) { - chartRegistry.deregister(chart, group); -} -function hasChart(chart) { - return chartRegistry.has(chart); -} -function deregisterAllCharts(group) { - chartRegistry.clear(group); -} - -/** - * Clear all filters on all charts within the given chart group. If the chart group is not given then - * only charts that belong to the default chart group will be reset. - * @memberof dc - * @name filterAll - * @param {String} [group] - */ -function filterAll(group) { - var charts = chartRegistry.list(group); - for (var i = 0; i < charts.length; ++i) { - charts[i].filterAll(); - } -} - -/** - * Reset zoom level / focus on all charts that belong to the given chart group. If the chart group is - * not given then only charts that belong to the default chart group will be reset. - * @memberof dc - * @name refocusAll - * @param {String} [group] - */ -function refocusAll(group) { - var charts = chartRegistry.list(group); - for (var i = 0; i < charts.length; ++i) { - if (charts[i].focus) { - charts[i].focus(); - } - } -} -function transition(selections, duration, callback, name) { - if (duration <= 0 || duration === undefined || _disableTransitions) { - return selections; - } - var s = selections.transition(name).duration(duration); - if (typeof callback === "function") { - callback(s); - } - return s; -} - -/* somewhat silly, but to avoid duplicating logic */ -function optionalTransition(enable, duration, callback, name) { - if (enable) { - return function (selection) { - return transition(selection, duration, callback, name); - }; - } else { - return function (selection) { - return selection; - }; - } -} - -// See http://stackoverflow.com/a/20773846 -function afterTransition(_transition, callback) { - if (_transition.empty() || !_transition.duration) { - callback.call(_transition); - } else { - var n = 0; - _transition.each(function () { - ++n; - }).each("end", function () { - if (! --n) { - callback.call(_transition); - } - }); - } -} - -/** - * @name units - * @memberof dc - * @type {{}} - */ -var units = {}; - -/** - * The default value for {@link #dc.coordinateGridMixin+xUnits .xUnits} for the - * {@link #dc.coordinateGridMixin Coordinate Grid Chart} and should - * be used when the x values are a sequence of integers. - * It is a function that counts the number of integers in the range supplied in its start and end parameters. - * @name integers - * @memberof units - * @see {@link #dc.coordinateGridMixin+xUnits coordinateGridMixin.xUnits} - * @example - * chart.xUnits(units.integers) // already the default - * @param {Number} start - * @param {Number} end - * @return {Number} - */ -units.integers = function (start, end) { - return Math.abs(end - start); -}; - -/** - * This argument can be passed to the {@link #dc.coordinateGridMixin+xUnits .xUnits} function of the to - * specify ordinal units for the x axis. Usually this parameter is used in combination with passing - * {@link https://github.com/mbostock/d3/wiki/Ordinal-Scales d3.scale.ordinal} to - * {@link #dc.coordinateGridMixin+x .x}. - * It just returns the domain passed to it, which for ordinal charts is an array of all values. - * @name ordinal - * @memberof units - * @see {@link https://github.com/mbostock/d3/wiki/Ordinal-Scales d3.scale.ordinal} - * @see {@link #dc.coordinateGridMixin+xUnits coordinateGridMixin.xUnits} - * @see {@link #dc.coordinateGridMixin+x coordinateGridMixin.x} - * @example - * chart.xUnits(dc.units.ordinal) - * .x(d3.scale.ordinal()) - * @param {*} start - * @param {*} end - * @param {Array} domain - * @return {Array} - */ -units.ordinal = function (start, end, domain) { - return domain; -}; - -/** - * @name fp - * @memberof units - * @type {{}} - */ -units.fp = {}; -/** - * This function generates an argument for the {@link #dc.coordinateGridMixin Coordinate Grid Chart} - * {@link #dc.coordinateGridMixin+xUnits .xUnits} function specifying that the x values are floating-point - * numbers with the given precision. - * The returned function determines how many values at the given precision will fit into the range - * supplied in its start and end parameters. - * @name precision - * @memberof units.fp - * @see {@link #dc.coordinateGridMixin+xUnits coordinateGridMixin.xUnits} - * @example - * // specify values (and ticks) every 0.1 units - * chart.xUnits(units.fp.precision(0.1) - * // there are 500 units between 0.5 and 1 if the precision is 0.001 - * var thousandths = units.fp.precision(0.001); - * thousandths(0.5, 1.0) // returns 500 - * @param {Number} precision - * @return {Function} start-end unit function - */ -units.fp.precision = function (precision) { - var _f = function _f(s, e) { - var d = Math.abs((e - s) / _f.resolution); - if (__WEBPACK_IMPORTED_MODULE_0__utils_utils__["l" /* utils */].isNegligible(d - Math.floor(d))) { - return Math.floor(d); - } else { - return Math.ceil(d); - } - }; - _f.resolution = precision; - return _f; -}; -var round = {}; -round.floor = function (n) { - return Math.floor(n); -}; -round.ceil = function (n) { - return Math.ceil(n); -}; -round.round = function (n) { - return Math.round(n); -}; -function override(obj, functionName, newFunction) { - var existingFunction = obj[functionName]; - obj["_" + functionName] = existingFunction; - obj[functionName] = newFunction; -} -function renderlet(_) { - if (!arguments.length) { - return _renderlet; - } - _renderlet = _; -} -function instanceOfChart(o) { - return o instanceof Object && o.__dcFlag__ && true; -} - -/***/ }), -/* 4 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return parser; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return dateFormat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return deepEquals; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return deepClone; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TIME_UNITS; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return customTimeFormat; }); -/* harmony export (immutable) */ __webpack_exports__["f"] = extractTickFormat; -/* harmony export (immutable) */ __webpack_exports__["n"] = xDomain; -/* harmony export (immutable) */ __webpack_exports__["o"] = xScale; -/* harmony export (immutable) */ __webpack_exports__["m"] = xAxisTickFormat; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return printers; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return minVal; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return maxVal; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return pluck; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return utils; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__heavyai_data_layer__ = __webpack_require__(272); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__formatting_helpers__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants_dates_and_times__ = __webpack_require__(40); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_fast_deep_equal__ = __webpack_require__(209); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_fast_deep_equal___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_fast_deep_equal__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_moment__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_moment__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_d3__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__core_core__ = __webpack_require__(3); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - - - - - - - -var parser = Object(__WEBPACK_IMPORTED_MODULE_0__heavyai_data_layer__["a" /* createParser */])(); -function hexBinSQL(sql, _ref, parser) { - var width = _ref.width, - height = _ref.height, - mark = _ref.mark, - x = _ref.x, - y = _ref.y, - aggregate = _ref.aggregate; - var hexoffsetx = 0; - var hexoffsety = 0; - var heximgwidth = width; - var heximgheight = height; - var hexminmercx = x.domain[0]; - var hexmaxmercx = x.domain[1]; - var hexminmercy = y.domain[0]; - var hexmaxmercy = y.domain[1]; - if (hexoffsetx) { - var mercxdiff = hexoffsetx * (hexmaxmercx - hexminmercx) / heximgwidth; - hexminmercx = hexminmercx - mercxdiff; - hexmaxmercx = hexmaxmercx - mercxdiff; - } - if (hexoffsety) { - var mercydiff = hexoffsety * (hexmaxmercy - hexminmercy) / heximgheight; - hexminmercy = hexminmercy - mercydiff; - hexmaxmercy = hexmaxmercy - mercydiff; - } - var args = "".concat(parser.parseExpression(x.field), ",") + "".concat(hexminmercx, ",") + "".concat(hexmaxmercx, ",") + "".concat(parser.parseExpression(y.field), ",") + "".concat(hexminmercy, ",") + "".concat(hexmaxmercy, ",") + "".concat(mark.width, ",") + "".concat(mark.height, ",") + "".concat(hexoffsetx, ",") + "".concat(hexoffsety, ",") + "".concat(width, ",") + "".concat(height); - sql.select.push("reg_".concat(mark.shape, "_horiz_pixel_bin_packed(").concat(args, ") AS xy")); - sql.select.push("".concat(parser.parseExpression(aggregate), " AS color")); - sql.groupby.push("xy"); - return sql; -} -function rectBinSQL(sql, _ref2, parser) { - var width = _ref2.width, - height = _ref2.height, - mark = _ref2.mark, - x = _ref2.x, - y = _ref2.y, - aggregate = _ref2.aggregate; - sql.select.push("rect_pixel_bin_packed(".concat(parser.parseExpression(x.field), ", ").concat(x.domain[0], ", ").concat(x.domain[1], ", ").concat(parser.parseExpression(y.field), ", ").concat(y.domain[0], ", ").concat(y.domain[1], ", ").concat(mark.width, ", ").concat(mark.height, ", 0, 0, ").concat(width, ", ").concat(height, ") AS xy")); - sql.select.push("".concat(parser.parseExpression(aggregate), " AS color")); - sql.groupby.push("xy"); - return sql; -} -parser.registerParser({ - meta: "transform", - type: "pixel_bin" -}, function (sql, transform, parser) { - switch (transform.mark.shape) { - case "hex": - return hexBinSQL(sql, transform, parser); - case "square": - return rectBinSQL(sql, transform, parser); - default: - return sql; - } -}); -parser.registerParser({ - meta: "transform", - type: "rowid" -}, function (sql, transform) { - var rowid = transform.table + ".rowid"; - sql.select.push(rowid); - sql.groupby.push(rowid); - return sql; -}); -var dateFormat = __WEBPACK_IMPORTED_MODULE_5_d3___default.a.time.format.utc("%m/%d/%Y"); -var deepEquals = __webpack_require__(209); // eslint-disable-line global-require - -var deepClone = function deepClone(obj) { - return JSON.parse(JSON.stringify(obj)); -}; -var TIME_UNITS = { - DATE: true, - TIMESTAMP: true, - date: true, - datetime: true, - timestamp: true, - "timestamp without timezone": true, - TIME: true -}; - -/* istanbul ignore next */ -var customTimeFormat = __WEBPACK_IMPORTED_MODULE_5_d3___default.a.time.format.utc.multi([[".%L", function (d) { - return d.getUTCMilliseconds(); -}], [":%S", function (d) { - return d.getUTCSeconds(); -}], ["%I:%M", function (d) { - return d.getUTCMinutes(); -}], ["%I %p", function (d) { - return d.getUTCHours(); -}], ["%a %d", function (d) { - return d.getUTCDay() && d.getUTCDate() != 1; -}], -// eslint-disable-line eqeqeq -["%b %d", function (d) { - return d.getUTCDate() != 1; -}], -// eslint-disable-line eqeqeq -["%b", function (d) { - return d.getUTCMonth(); -}], ["%Y", function () { - return true; -}]]); -function extractTickFormat(timeBin) { - return function (tick) { - switch (timeBin) { - case "year": - return Math.ceil(tick); - case "isodow": - return __WEBPACK_IMPORTED_MODULE_2__constants_dates_and_times__["b" /* DAYS */][tick - 1]; - case "month": - return __WEBPACK_IMPORTED_MODULE_2__constants_dates_and_times__["h" /* MONTHS */][tick - 1]; - case "quarter": - return __WEBPACK_IMPORTED_MODULE_2__constants_dates_and_times__["k" /* QUARTERS */][tick - 1]; - case "hour": - case "minute": - return tick + 1; - default: - return tick; - } - }; -} -function xDomain(extract, currentLowValue, currentHighValue, timeBin) { - if (extract) { - switch (timeBin) { - case "year": - return [currentLowValue.getFullYear(), currentHighValue.getFullYear()]; - case "quarter": - return [1, 4]; - // eslint-disable-line no-magic-numbers - case "isodow": - return [1, 7]; - // eslint-disable-line no-magic-numbers - case "month": - return [1, 12]; - // eslint-disable-line no-magic-numbers - case "day": - return [1, 31]; - // eslint-disable-line no-magic-numbers - case "hour": - return [0, 23]; - // eslint-disable-line no-magic-numbers - case "minute": - return [0, 59]; - // eslint-disable-line no-magic-numbers - default: - return [1, 7]; - // eslint-disable-line no-magic-numbers - } - } else { - return [currentLowValue, currentHighValue]; - } -} -function xScale(extract, isChartDate) { - if (extract || !isChartDate) { - return __WEBPACK_IMPORTED_MODULE_5_d3___default.a.scale.linear(); - } else { - return __WEBPACK_IMPORTED_MODULE_5_d3___default.a.time.scale.utc(); - } -} -function xAxisTickFormat(_ref3, isChartDate) { - var extract = _ref3.extract, - timeBin = _ref3.timeBin; - if (extract) { - return utils.extractTickFormat(timeBin); - } else if (isChartDate) { - return customTimeFormat; - } else { - return __WEBPACK_IMPORTED_MODULE_5_d3___default.a.format(".2s"); - } -} -var printers = {}; -printers.filters = function (filters) { - var s = ""; - for (var i = 0; i < filters.length; ++i) { - if (i > 0) { - s = s + ", "; - } - s = s + printers.filter(filters[i]); - } - return s; -}; -printers.filter = function (filter) { - var s = ""; - if (typeof filter !== "undefined" && filter !== null) { - if (filter instanceof Array) { - if (filter.length >= 2) { - s = "[" + utils.printSingleValue(filter[0]) + " -> " + utils.printSingleValue(filter[1]) + "]"; - } else if (filter.length >= 1) { - s = utils.printSingleValue(filter[0]); - } - } else { - s = utils.printSingleValue(filter); - } - } - return s; -}; -var getKeyValues = function getKeyValues(data) { - var keys = Object.keys(data).filter(function (k) { - return k.indexOf("key") === 0; - }); - return keys.reduce(function (aggregate, k) { - return aggregate.concat(Array.isArray(data[k]) ? data[k].map(function (v) { - return typeof v === "number" ? v : v.value; - }) : [data[k]]); - }, []); -}; -var minVal = function minVal(_ref4) { - var data = _ref4.data; - return __WEBPACK_IMPORTED_MODULE_5_d3___default.a.min(getKeyValues(data)); -}; -var maxVal = function maxVal(_ref5) { - var data = _ref5.data; - return __WEBPACK_IMPORTED_MODULE_5_d3___default.a.max(getKeyValues(data)); -}; -var pluck = function pluck(n, f) { - if (!f) { - return function (d) { - return d[n]; - }; - } - return function (d, i) { - return f.call(d, d[n], i); - }; -}; -var utils = {}; -utils.printSingleValue = function (filter) { - var s = String(filter); - if (filter instanceof Date) { - s = dateFormat(filter); - } else if (typeof filter === "string") { - s = filter; - } else if (utils.isFloat(filter)) { - s = utils.printSingleValue.fformat(filter); - } else if (utils.isInteger(filter)) { - s = Math.round(filter); - } - return s; -}; -utils.printSingleValue.fformat = __WEBPACK_IMPORTED_MODULE_5_d3___default.a.format(".2f"); - -// FIXME: these assume than any string r is a percentage (whether or not it -// includes %). -utils.add = function (l, r, c) { - if (typeof r === "string") { - r = r.replace("%", ""); - } - if (l instanceof Date) { - if (typeof r === "string") { - r = Number(r); - } - var d = new Date(); - d.setTime(l.getTime()); - d.setDate(l.getDate() + r); - return d; - } else if (typeof r === "string") { - var percentage = Number(r) / 100; - return l + c * percentage; - } else { - return l + r; - } -}; -utils.subtract = function (l, r, c) { - if (typeof r === "string") { - r = r.replace("%", ""); - } - if (l instanceof Date) { - if (typeof r === "string") { - r = Number(r); - } - var d = new Date(); - d.setTime(l.getTime()); - d.setDate(l.getDate() - r); - return d; - } else if (typeof r === "string") { - var percentage = Number(r) / 100; - return l - c * percentage; - } else { - return l - r; - } -}; -utils.isNumber = function (n) { - return n === Number(n); -}; -utils.isFloat = function (n) { - return n === Number(n) && n !== (n | 0); -}; -utils.isInteger = function (n) { - return n === Number(n) && n === (n | 0); -}; -utils.isNegligible = function (n) { - return !utils.isNumber(n) || n < __WEBPACK_IMPORTED_MODULE_6__core_core__["c" /* constants */].NEGLIGIBLE_NUMBER && n > -__WEBPACK_IMPORTED_MODULE_6__core_core__["c" /* constants */].NEGLIGIBLE_NUMBER; -}; -utils.clamp = function (val, min, max) { - return val < min ? min : val > max ? max : val; -}; -utils.uniqueId = function () { - return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER); -}; -utils.nameToId = function (name) { - if (parseFloat(name)) { - return name; - } else { - return name.toLowerCase().replace(/[\s]/g, "_").replace(/[\.']/g, ""); - } -}; -utils.appendOrSelect = function (parent, selector, tag) { - tag = tag || selector; - var element = parent.select(selector); - if (element.empty()) { - element = parent.append(tag); - } - return element; -}; -utils.safeNumber = function (n) { - return utils.isNumber(Number(n)) ? Number(n) : 0; -}; -utils.b64toBlob = function (b64Data, contentType, sliceSize) { - contentType = contentType || ""; - sliceSize = sliceSize || 512; - var byteCharacters = atob(b64Data); - var byteArrays = []; - for (var offset = 0; offset < byteCharacters.length; offset = offset + sliceSize) { - var slice = byteCharacters.slice(offset, offset + sliceSize); - var byteNumbers = new Array(slice.length); - for (var i = 0; i < slice.length; i++) { - byteNumbers[i] = slice.charCodeAt(i); - } - var byteArray = new Uint8Array(byteNumbers); - byteArrays.push(byteArray); - } - var blob = new Blob(byteArrays, { - type: contentType - }); - return blob; -}; -utils.getFontSizeFromWidth = function (text, chartWidth, chartHeight) { - var BASE_FONT_SIZE = 12; - var MIN_FONT_SIZE = 4; - var tmpText = __WEBPACK_IMPORTED_MODULE_5_d3___default.a.select("body").append("span").attr("class", "tmp-text").style("font-size", BASE_FONT_SIZE + "px").style("position", "absolute").style("opacity", 0).style("margin-right", 10000).html(text); - var node = tmpText.node(); - var textWidth = null; - var textHeight = null; - if (node.getBoundingClientRect) { - var bbox = node.getBoundingClientRect(); - textWidth = bbox.width; - textHeight = bbox.height; - } - tmpText.remove(); - var fontSizeWidth = BASE_FONT_SIZE * chartWidth / textWidth; - var fontSizeHeight = BASE_FONT_SIZE * chartHeight / textHeight; - return Math.max(Math.min(fontSizeWidth, fontSizeHeight), MIN_FONT_SIZE); -}; -utils.isOrdinal = function (type) { - var BOOL_TYPES = { - BOOL: true - }; - var TEXT_TYPES = { - varchar: true, - text: true, - STR: true - }; - var TEXT_AND_BOOL_TYPES = Object.assign({}, TEXT_TYPES, BOOL_TYPES); - return type in TEXT_AND_BOOL_TYPES; -}; -utils.isQuantitative = function (type) { - var NUMERICAL_INTEGER_TYPES = { - int2: true, - int4: true, - int8: true, - SMALLINT: true, - INT: true, - BIGINT: true - }; - var NUMERICAL_REAL_TYPES = { - FLOAT: true, - DOUBLE: true, - DECIMAL: true - }; - var NONCUSTOM_NUMERICAL_TYPES = Object.assign({}, NUMERICAL_INTEGER_TYPES, NUMERICAL_REAL_TYPES); - return type in NONCUSTOM_NUMERICAL_TYPES; -}; -utils.deepEquals = __WEBPACK_IMPORTED_MODULE_3_fast_deep_equal___default.a; -utils.customTimeFormat = customTimeFormat; -utils.extractTickFormat = extractTickFormat; -utils.formatValue = __WEBPACK_IMPORTED_MODULE_1__formatting_helpers__["b" /* formatDataValue */]; -utils.maybeFormatInfinity = __WEBPACK_IMPORTED_MODULE_1__formatting_helpers__["e" /* maybeFormatInfinity */]; -utils.nullsFirst = function (sorting) { - return function (a, b) { - if (a === null) { - return -1; - } else if (b === null) { - return 1; - } - return sorting(a, b); - }; -}; -utils.nullsLast = function (sorting) { - return function (a, b) { - if (a === null) { - return 1; - } else if (b === null) { - return -1; - } - return sorting(a, b); - }; -}; -utils.compareDates = function (sorting) { - return function (a, b) { - var defaultDateFormat = "mm, dd, YYYY hh:mm:ss"; - var compareA = __WEBPACK_IMPORTED_MODULE_4_moment___default()(a, defaultDateFormat, true).toDate(); - var compareB = __WEBPACK_IMPORTED_MODULE_4_moment___default()(b, defaultDateFormat, true).toDate(); - if (compareA !== "Invalid date" && compareB !== "Invalid date") { - return sorting(compareA.getTime(), compareB.getTime()); - } - return sorting(a, b); - }; -}; - -/** - * Uses a HEAD request to get headers and check the content size - * - * @param {string} url - Url to check the response size of - * @returns Number of bytes returned in the header or 0 if not present - */ -utils.getImageSize = function (url) { - return fetch(url, { - method: "HEAD" - }).then(function (resp) { - var _resp$headers$get, _resp$headers; - return (_resp$headers$get = resp === null || resp === void 0 ? void 0 : (_resp$headers = resp.headers) === null || _resp$headers === void 0 ? void 0 : _resp$headers.get("Content-Length")) !== null && _resp$headers$get !== void 0 ? _resp$headers$get : 0; - }); -}; - -/** - * An async wrapper around string replace method - * Ripped from: https://stackoverflow.com/questions/33631041/javascript-async-await-in-replace - * - * @param {string} str - String to call replace on - * @param {RegExp} regex - Regular expression to match for replace - * @param {Function} asyncFn - Function to run for each match - * @returns Promise returning a string with replacements made - */ -utils.replaceAsync = /*#__PURE__*/function () { - var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(str, regex, asyncFn) { - var promises, data; - return _regeneratorRuntime().wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - promises = []; - str.replace(regex, function (match) { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - var promise = asyncFn.apply(void 0, [match].concat(args)); - promises.push(promise); - }); - _context.next = 4; - return Promise.all(promises); - case 4: - data = _context.sent; - return _context.abrupt("return", str.replace(regex, function () { - return data.shift(); - })); - case 6: - case "end": - return _context.stop(); - } - } - }, _callee); - })); - return function (_x, _x2, _x3) { - return _ref6.apply(this, arguments); - }; -}(); - -/** - * Parses the major url parts from a string based on - * https://www.rfc-editor.org/rfc/rfc3986#appendix-B - * - * eg. - * "https://localhost:8002/things/image.png?with=query&string=params#plusoneofthese" - * [ - * 'https://localhost:8002/things/image.png?with=query&string=params#plusoneofthese', [0] Full url param - * 'https:', [1] protocol raw - * 'https', [2] protocol - * '//localhost:8002', [3] host+port raw - * 'localhost:8002', [4] host + port - * '/things/image.png', [5] path - * '?with=query&string=params', [6] query string params raw - * 'with=query&string=params', [7] query string params - * '#plusoneofthese', [8] anchor link raw - * 'plusoneofthese' [8] anchor link - * ] - * - * @param {*} url - * @returns Array of url parts (regex groups), see above - */ -utils.parseUrlParts = function (url) { - var urlParser = /^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; - return url.match(urlParser); -}; - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) { - -var objectAssign = __webpack_require__(307); - -// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js -// original notice: - -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -function compare(a, b) { - if (a === b) { - return 0; - } - - var x = a.length; - var y = b.length; - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - - if (x < y) { - return -1; - } - if (y < x) { - return 1; - } - return 0; -} -function isBuffer(b) { - if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { - return global.Buffer.isBuffer(b); - } - return !!(b != null && b._isBuffer); -} - -// based on node assert, original notice: -// NB: The URL to the CommonJS spec is kept just for tradition. -// node-assert has evolved a lot since then, both in API and behavior. - -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// 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 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. - -var util = __webpack_require__(308); -var hasOwn = Object.prototype.hasOwnProperty; -var pSlice = Array.prototype.slice; -var functionsHaveNames = (function () { - return function foo() {}.name === 'foo'; -}()); -function pToString (obj) { - return Object.prototype.toString.call(obj); -} -function isView(arrbuf) { - if (isBuffer(arrbuf)) { - return false; - } - if (typeof global.ArrayBuffer !== 'function') { - return false; - } - if (typeof ArrayBuffer.isView === 'function') { - return ArrayBuffer.isView(arrbuf); - } - if (!arrbuf) { - return false; - } - if (arrbuf instanceof DataView) { - return true; - } - if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { - return true; - } - return false; -} -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -var regex = /\s*function\s+([^\(\s]*)\s*/; -// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js -function getName(func) { - if (!util.isFunction(func)) { - return; - } - if (functionsHaveNames) { - return func.name; - } - var str = func.toString(); - var match = str.match(regex); - return match && match[1]; -} -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = getName(stackStartFunction); - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function truncate(s, n) { - if (typeof s === 'string') { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} -function inspect(something) { - if (functionsHaveNames || !util.isFunction(something)) { - return util.inspect(something); - } - var rawname = getName(something); - var name = rawname ? ': ' + rawname : ''; - return '[Function' + name + ']'; -} -function getMessage(self) { - return truncate(inspect(self.actual), 128) + ' ' + - self.operator + ' ' + - truncate(inspect(self.expected), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); - } -}; - -function _deepEqual(actual, expected, strict, memos) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - } else if (isBuffer(actual) && isBuffer(expected)) { - return compare(actual, expected) === 0; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if ((actual === null || typeof actual !== 'object') && - (expected === null || typeof expected !== 'object')) { - return strict ? actual === expected : actual == expected; - - // If both values are instances of typed arrays, wrap their underlying - // ArrayBuffers in a Buffer each to increase performance - // This optimization requires the arrays to have the same type as checked by - // Object.prototype.toString (aka pToString). Never perform binary - // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their - // bit patterns are not identical. - } else if (isView(actual) && isView(expected) && - pToString(actual) === pToString(expected) && - !(actual instanceof Float32Array || - actual instanceof Float64Array)) { - return compare(new Uint8Array(actual.buffer), - new Uint8Array(expected.buffer)) === 0; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else if (isBuffer(actual) !== isBuffer(expected)) { - return false; - } else { - memos = memos || {actual: [], expected: []}; - - var actualIndex = memos.actual.indexOf(actual); - if (actualIndex !== -1) { - if (actualIndex === memos.expected.indexOf(expected)) { - return true; - } - } - - memos.actual.push(actual); - memos.expected.push(expected); - - return objEquiv(actual, expected, strict, memos); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b, strict, actualVisitedObjects) { - if (a === null || a === undefined || b === null || b === undefined) - return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) - return a === b; - if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) - return false; - var aIsArgs = isArguments(a); - var bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b, strict); - } - var ka = objectKeys(a); - var kb = objectKeys(b); - var key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length !== kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] !== kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) - return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -assert.notDeepStrictEqual = notDeepStrictEqual; -function notDeepStrictEqual(actual, expected, message) { - if (_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); - } -} - - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } - - try { - if (actual instanceof expected) { - return true; - } - } catch (e) { - // Ignore. The instanceof check doesn't work for arrow functions. - } - - if (Error.isPrototypeOf(expected)) { - return false; - } - - return expected.call({}, actual) === true; -} - -function _tryBlock(block) { - var error; - try { - block(); - } catch (e) { - error = e; - } - return error; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (typeof block !== 'function') { - throw new TypeError('"block" argument must be a function'); - } - - if (typeof expected === 'string') { - message = expected; - expected = null; - } - - actual = _tryBlock(block); - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - var userProvidedMessage = typeof message === 'string'; - var isUnwantedException = !shouldThrow && util.isError(actual); - var isUnexpectedException = !shouldThrow && actual && !expected; - - if ((isUnwantedException && - userProvidedMessage && - expectedException(actual, expected)) || - isUnexpectedException) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws(true, block, error, message); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws(false, block, error, message); -}; - -assert.ifError = function(err) { if (err) throw err; }; - -// Expose a strict only variant of assert -function strict(value, message) { - if (!value) fail(value, true, message, '==', strict); -} -assert.strict = objectAssign(strict, assert, { - equal: assert.strictEqual, - deepEqual: assert.deepStrictEqual, - notEqual: assert.notStrictEqual, - notDeepEqual: assert.notDeepStrictEqual -}); -assert.strict.strict = assert.strict; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(52))) - -/***/ }), -/* 6 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LockTracker; }); -/* harmony export (immutable) */ __webpack_exports__["q"] = startRenderTime; -/* harmony export (immutable) */ __webpack_exports__["p"] = startRedrawTime; -/* harmony export (immutable) */ __webpack_exports__["l"] = resetRedrawStack; -/* harmony export (immutable) */ __webpack_exports__["i"] = redrawStackEmpty; -/* harmony export (immutable) */ __webpack_exports__["k"] = renderStackEmpty; -/* harmony export (immutable) */ __webpack_exports__["e"] = isEqualToRedrawCount; -/* harmony export (immutable) */ __webpack_exports__["d"] = incrementRenderStack; -/* harmony export (immutable) */ __webpack_exports__["m"] = resetRenderStack; -/* harmony export (immutable) */ __webpack_exports__["f"] = isEqualToRenderCount; -/* harmony export (immutable) */ __webpack_exports__["h"] = redrawAllAsync; -/* harmony export (immutable) */ __webpack_exports__["j"] = renderAllAsync; -/* harmony export (immutable) */ __webpack_exports__["c"] = groupAll; -/* harmony export (immutable) */ __webpack_exports__["b"] = getLastFilteredSizeAsync; -/* harmony export (immutable) */ __webpack_exports__["g"] = lastFilteredSize; -/* harmony export (immutable) */ __webpack_exports__["o"] = setLastFilteredSize; -/* harmony export (immutable) */ __webpack_exports__["n"] = resetState; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core__ = __webpack_require__(3); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } - -var _renderId = 0; -var _redrawId = 0; -var _renderCount = 0; -var _redrawCount = 0; -var _startRenderTime = null; -var _startRedrawTime = null; -var _groupAll = {}; -var _lastFilteredSize = {}; - -// NOTE: a "group" of null is valid! -var LockTracker = /*#__PURE__*/function () { - function LockTracker() { - _classCallCheck(this, LockTracker); - _defineProperty(this, "all", null); - _defineProperty(this, "groups", {}); - _defineProperty(this, "pendingAll", null); - _defineProperty(this, "pendingGroups", {}); - } - _createClass(LockTracker, [{ - key: "shouldStart", - value: - // Utility function to check if a render/redraw should start for the given - // group or "all". - function shouldStart(group, all) { - // Conditions are checked in this order: - // 1. If currently rendering/redrawing all, return false. - // 2. If we're requesting a render/redraw all and *anything* is currently - // rendering/redrawing, return false. - // 3. If the requested group is rendering/redrawing, return false. - // 4. Otherwise, return true. - return !this.all && (all ? Object.keys(this.groups).length === 0 : !this.groups[group]); - } - - // Returns true if nothing is currently rendering. If a "group" is given, - // returns true if neither "all" nor the group is rendering. - }, { - key: "isEmpty", - value: function isEmpty(group) { - if (typeof group !== "undefined") { - return this.shouldStart(group, false); - } - return this.shouldStart(null, true); - } - }, { - key: "start", - value: function start(group, all, runner) { - var _this = this; - // if we can safely start this group/all, go for it! - if (this.shouldStart(group, all)) { - return this._run(group, all, runner); - } - - // otherwise, if we already have a pending promise, return it - if (this.pendingAll) { - return this.pendingAll; - } else if (this.pendingGroups[group]) { - return this.pendingGroups[group]; - } - - // Ok, we can't start running now, and we don't already have a pending - // promise. We need to create a new pending promise to run after the - // currently running promise is finished. If we got this far, one of the - // following states must be true, otherwise shouldStart would have returned - // true and we would have started running already: - // 1. this.all is not-null, which means we can wait on that promise - // 2. "all" is truthy, which means we need to wait on all of the groups - // that are currently running to finish - // 3. "all" is not set, so we only need to wait on the group to finish - var promise = this.all || (all ? - // Promise.all returns immediately if any of the promises reject - we - // want to wait on them all regardless if any reject, so we - // explicitly catch and return an empty array so that if the promise - // rejects, it'll end up resolving in this context - Promise.all(Object.values(this.groups).map(function (p) { - return p["catch"](function () { - return []; - }); - })) : this.groups[group]); - - // Whether or not the running promise is resolved or rejected, we want to - // run the next promise. Maybe if the current promise failed, re-running it - // will succeed. We use then(nextRunner, nextRunner) in both blocks below - // instead of finally() because we need nextRunner to return a new promise. - // The return value from finally() is ignored. Not to mention, the - // es6/es2015 polyfill doesn't include finally() anyway =) - if (all) { - var nextRunner = function nextRunner() { - _this.pendingAll = null; - return _this._run(group, all, runner); - }; - promise = promise.then(nextRunner, nextRunner); - this.pendingAll = promise; - } else { - var _nextRunner = function _nextRunner() { - delete _this.pendingGroups[group]; - if (_this.pendingAll) { - // Group was queued before "all", so, we just return the pendingAll - // promise. When pendingAll is done, this group will technically - // have been run along with all the other groups, so there's no - // reason to handle the group individually. - return _this.pendingAll; - } - return _this._run(group, all, runner); - }; - promise = promise.then(_nextRunner, _nextRunner); - this.pendingGroups[group] = promise; - } - return promise; - } - - // private method to start a runner and save the promise - }, { - key: "_run", - value: function _run(group, all, runner) { - var _this2 = this; - var cleanup = function cleanup() { - if (all) { - _this2.all = null; - } else { - delete _this2.groups[group]; - } - }; - - // Start the runner - whether it succeeds or not, cleanup. - // The es6/es2015 polyfill doesn't include .finally(), so we use .then() - // and make sure to pass the resolved/rejected state up the stack. If we - // ever upgrade to the es7 polyfill, this can be rewritten as: - // runner().finally(clean) - var promise = null; - try { - promise = runner(); - } catch (err) { - promise = Promise.reject(err); - } - promise = promise.then(function (val) { - cleanup(); - return val; - }, function (err) { - cleanup(); - console.error(err); - throw err; - }); - - // store a reference to the promise - if (all) { - this.all = promise; - } else { - this.groups[group] = promise; - } - return promise; - } - }]); - return LockTracker; -}(); -var renderAllTracker = new LockTracker(); -var redrawAllTracker = new LockTracker(); -function startRenderTime() { - return _startRenderTime; -} -function startRedrawTime() { - return _startRedrawTime; -} -function resetRedrawStack() { - _redrawCount = 0; -} -function redrawStackEmpty(group) { - return redrawAllTracker.isEmpty(group); -} -function renderStackEmpty(group) { - return renderAllTracker.isEmpty(group); -} -function isEqualToRedrawCount(queryCount) { - return ++_redrawCount === queryCount; -} -function incrementRenderStack() { - var queryGroupId = _renderId++; - return queryGroupId; -} -function resetRenderStack() { - _renderCount = 0; -} -function isEqualToRenderCount(queryCount) { - return ++_renderCount === queryCount; -} -function redrawAllAsync(group, allCharts, excludeChart) { - if (Object(__WEBPACK_IMPORTED_MODULE_0__core__["t" /* refreshDisabled */])()) { - var charts = allCharts ? __WEBPACK_IMPORTED_MODULE_0__core__["b" /* chartRegistry */].listAll() : __WEBPACK_IMPORTED_MODULE_0__core__["b" /* chartRegistry */].list(group); - return Promise.resolve(charts); - } - if (!startRenderTime()) { - return Promise.reject("redrawAllAsync() is called before renderAllAsync(), please call renderAllAsync() first."); - } - return redrawAllTracker.start(group, allCharts, function () { - var queryGroupId = _redrawId++; - _startRedrawTime = new Date(); - var createRedrawPromises = function createRedrawPromises() { - var charts = allCharts ? __WEBPACK_IMPORTED_MODULE_0__core__["b" /* chartRegistry */].listAll() : __WEBPACK_IMPORTED_MODULE_0__core__["b" /* chartRegistry */].list(group); - if (excludeChart) { - charts = charts.filter(function (c) { - return c.__dcFlag__ !== excludeChart.__dcFlag__; - }); - } - return charts.map(function (chart) { - chart.expireCache(); - chart._invokeDataFetchListener(); - // We have to force a render for HEATMAP, not redraw for crossfilters to - // work properly. Mea culpa, mea culpa. - return chart.isHeatMap ? chart.renderAsync(queryGroupId, charts.length)["catch"](function (e) { - chart._invokeDataErrorListener(e); - throw e; - }) : chart.redrawAsync(queryGroupId, charts.length)["catch"](function (e) { - chart._invokeDataErrorListener(e); - throw e; - }); - }); - }; - if (Object(__WEBPACK_IMPORTED_MODULE_0__core__["v" /* renderlet */])() !== null) { - Object(__WEBPACK_IMPORTED_MODULE_0__core__["v" /* renderlet */])(group); - } - if (groupAll()) { - return getLastFilteredSizeAsync().then(function () { - return Promise.all(createRedrawPromises()); - })["catch"](function (err) { - console.log(err); - resetRedrawStack(); - throw err; - }); - } else { - return Promise.all(createRedrawPromises())["catch"](function (err) { - console.log(err); - resetRedrawStack(); - throw err; - }); - } - }); -} -function renderAllAsync(group, allCharts) { - if (Object(__WEBPACK_IMPORTED_MODULE_0__core__["t" /* refreshDisabled */])()) { - var charts = allCharts ? __WEBPACK_IMPORTED_MODULE_0__core__["b" /* chartRegistry */].listAll() : __WEBPACK_IMPORTED_MODULE_0__core__["b" /* chartRegistry */].list(group); - return Promise.resolve(charts); - } - return renderAllTracker.start(group, allCharts, function () { - var queryGroupId = _renderId++; - _startRenderTime = new Date(); - var createRenderPromises = function createRenderPromises() { - var charts = allCharts ? __WEBPACK_IMPORTED_MODULE_0__core__["b" /* chartRegistry */].listAll() : __WEBPACK_IMPORTED_MODULE_0__core__["b" /* chartRegistry */].list(group); - return charts.map(function (chart) { - chart.expireCache(); - return chart.renderAsync(queryGroupId, charts.length); - }); - }; - if (Object(__WEBPACK_IMPORTED_MODULE_0__core__["v" /* renderlet */])() !== null) { - Object(__WEBPACK_IMPORTED_MODULE_0__core__["v" /* renderlet */])(group); - } - if (groupAll()) { - return getLastFilteredSizeAsync().then(function () { - return Promise.all(createRenderPromises()); - }); - } else { - return Promise.all(createRenderPromises()); - } - }); -} -function groupAll(group) { - if (!arguments.length) { - for (var key in _groupAll) { - if (_groupAll.hasOwnProperty(key)) { - return _groupAll; - } - } - return null; - } - _groupAll[group.getCrossfilterId()] = group; - return _groupAll; -} -function getLastFilteredSizeAsync(arg) { - var keyArray = []; - var crossfilterId = null; - if (typeof arg === "number") { - crossfilterId = arg; - } else if (_typeof(arg) === "object" && typeof arg.getCrossfilterId === "function") { - crossfilterId = arg.getCrossfilterId(); - } - if (crossfilterId !== null) { - var group = _groupAll[crossfilterId]; - if (group) { - return group.valueAsync().then(function (value) { - _lastFilteredSize[crossfilterId] = value; - return value; - }); - } else { - return new Promise(function (reject) { - return reject("The group with crossfilterId " + crossfilterId + " is not an active groupAll() group"); - }); - } - } else if (arg) { - return new Promise(function (reject) { - return reject("The argument to getLastFilteredSizeAsync must be a crossfilterId or a group/groupAll object, or call getLastFilteredSizeAsync without an argument to calculate all groupAlls"); - }); - } - return Promise.all(Object.keys(_groupAll).map(function (key) { - keyArray.push(key); - return _groupAll[key].valueAsync(); - })).then(function (values) { - for (var i = 0; i < values.length; ++i) { - _lastFilteredSize[keyArray[i]] = values[i]; - } - }); -} -function lastFilteredSize(crossfilterId) { - return _lastFilteredSize[crossfilterId]; -} -function setLastFilteredSize(crossfilterId, value) { - _lastFilteredSize[crossfilterId] = value; -} -function resetState() { - _groupAll = {}; - _lastFilteredSize = {}; -} - -/***/ }), -/* 7 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AbstractProduction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NonTerminal; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return Rule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Flat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return Option; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return RepetitionMandatory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return RepetitionMandatoryWithSeparator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return Repetition; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return RepetitionWithSeparator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Alternation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return Terminal; }); -/* harmony export (immutable) */ __webpack_exports__["l"] = serializeGrammar; -/* harmony export (immutable) */ __webpack_exports__["m"] = serializeProduction; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_utils__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scan_tokens_public__ = __webpack_require__(25); -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); - - -var AbstractProduction = /** @class */ (function () { - function AbstractProduction(definition) { - this.definition = definition; - } - AbstractProduction.prototype.accept = function (visitor) { - visitor.visit(this); - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["u" /* forEach */])(this.definition, function (prod) { - prod.accept(visitor); - }); - }; - return AbstractProduction; -}()); - -var NonTerminal = /** @class */ (function (_super) { - __extends(NonTerminal, _super); - function NonTerminal(options) { - var _this = _super.call(this, []) || this; - _this.idx = 1; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["f" /* assign */])(_this, Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["N" /* pick */])(options, function (v) { return v !== undefined; })); - return _this; - } - Object.defineProperty(NonTerminal.prototype, "definition", { - get: function () { - if (this.referencedRule !== undefined) { - return this.referencedRule.definition; - } - return []; - }, - set: function (definition) { - // immutable - }, - enumerable: true, - configurable: true - }); - NonTerminal.prototype.accept = function (visitor) { - visitor.visit(this); - // don't visit children of a reference, we will get cyclic infinite loops if we do so - }; - return NonTerminal; -}(AbstractProduction)); - -var Rule = /** @class */ (function (_super) { - __extends(Rule, _super); - function Rule(options) { - var _this = _super.call(this, options.definition) || this; - _this.orgText = ""; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["f" /* assign */])(_this, Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["N" /* pick */])(options, function (v) { return v !== undefined; })); - return _this; - } - return Rule; -}(AbstractProduction)); - -// TODO: is this only used in an Alternation? -// Perhaps `Flat` should be renamed to `Alternative`? -var Flat = /** @class */ (function (_super) { - __extends(Flat, _super); - // A named Flat production is used to indicate a Nested Rule in an alternation - function Flat(options) { - var _this = _super.call(this, options.definition) || this; - _this.ignoreAmbiguities = false; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["f" /* assign */])(_this, Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["N" /* pick */])(options, function (v) { return v !== undefined; })); - return _this; - } - return Flat; -}(AbstractProduction)); - -var Option = /** @class */ (function (_super) { - __extends(Option, _super); - function Option(options) { - var _this = _super.call(this, options.definition) || this; - _this.idx = 1; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["f" /* assign */])(_this, Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["N" /* pick */])(options, function (v) { return v !== undefined; })); - return _this; - } - return Option; -}(AbstractProduction)); - -var RepetitionMandatory = /** @class */ (function (_super) { - __extends(RepetitionMandatory, _super); - function RepetitionMandatory(options) { - var _this = _super.call(this, options.definition) || this; - _this.idx = 1; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["f" /* assign */])(_this, Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["N" /* pick */])(options, function (v) { return v !== undefined; })); - return _this; - } - return RepetitionMandatory; -}(AbstractProduction)); - -var RepetitionMandatoryWithSeparator = /** @class */ (function (_super) { - __extends(RepetitionMandatoryWithSeparator, _super); - function RepetitionMandatoryWithSeparator(options) { - var _this = _super.call(this, options.definition) || this; - _this.idx = 1; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["f" /* assign */])(_this, Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["N" /* pick */])(options, function (v) { return v !== undefined; })); - return _this; - } - return RepetitionMandatoryWithSeparator; -}(AbstractProduction)); - -var Repetition = /** @class */ (function (_super) { - __extends(Repetition, _super); - function Repetition(options) { - var _this = _super.call(this, options.definition) || this; - _this.idx = 1; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["f" /* assign */])(_this, Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["N" /* pick */])(options, function (v) { return v !== undefined; })); - return _this; - } - return Repetition; -}(AbstractProduction)); - -var RepetitionWithSeparator = /** @class */ (function (_super) { - __extends(RepetitionWithSeparator, _super); - function RepetitionWithSeparator(options) { - var _this = _super.call(this, options.definition) || this; - _this.idx = 1; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["f" /* assign */])(_this, Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["N" /* pick */])(options, function (v) { return v !== undefined; })); - return _this; - } - return RepetitionWithSeparator; -}(AbstractProduction)); - -var Alternation = /** @class */ (function (_super) { - __extends(Alternation, _super); - function Alternation(options) { - var _this = _super.call(this, options.definition) || this; - _this.idx = 1; - _this.ignoreAmbiguities = false; - _this.hasPredicates = false; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["f" /* assign */])(_this, Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["N" /* pick */])(options, function (v) { return v !== undefined; })); - return _this; - } - return Alternation; -}(AbstractProduction)); - -var Terminal = /** @class */ (function () { - function Terminal(options) { - this.idx = 1; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["f" /* assign */])(this, Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["N" /* pick */])(options, function (v) { return v !== undefined; })); - } - Terminal.prototype.accept = function (visitor) { - visitor.visit(this); - }; - return Terminal; -}()); - -function serializeGrammar(topRules) { - return Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["I" /* map */])(topRules, serializeProduction); -} -function serializeProduction(node) { - function convertDefinition(definition) { - return Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["I" /* map */])(definition, serializeProduction); - } - /* istanbul ignore else */ - if (node instanceof NonTerminal) { - return { - type: "NonTerminal", - name: node.nonTerminalName, - idx: node.idx - }; - } - else if (node instanceof Flat) { - return { - type: "Flat", - definition: convertDefinition(node.definition) - }; - } - else if (node instanceof Option) { - return { - type: "Option", - idx: node.idx, - definition: convertDefinition(node.definition) - }; - } - else if (node instanceof RepetitionMandatory) { - return { - type: "RepetitionMandatory", - name: node.name, - idx: node.idx, - definition: convertDefinition(node.definition) - }; - } - else if (node instanceof RepetitionMandatoryWithSeparator) { - return { - type: "RepetitionMandatoryWithSeparator", - name: node.name, - idx: node.idx, - separator: (serializeProduction(new Terminal({ terminalType: node.separator }))), - definition: convertDefinition(node.definition) - }; - } - else if (node instanceof RepetitionWithSeparator) { - return { - type: "RepetitionWithSeparator", - name: node.name, - idx: node.idx, - separator: (serializeProduction(new Terminal({ terminalType: node.separator }))), - definition: convertDefinition(node.definition) - }; - } - else if (node instanceof Repetition) { - return { - type: "Repetition", - name: node.name, - idx: node.idx, - definition: convertDefinition(node.definition) - }; - } - else if (node instanceof Alternation) { - return { - type: "Alternation", - name: node.name, - idx: node.idx, - definition: convertDefinition(node.definition) - }; - } - else if (node instanceof Terminal) { - var serializedTerminal = { - type: "Terminal", - name: node.terminalType.name, - label: Object(__WEBPACK_IMPORTED_MODULE_1__scan_tokens_public__["e" /* tokenLabel */])(node.terminalType), - idx: node.idx - }; - var pattern = node.terminalType.PATTERN; - if (node.terminalType.PATTERN) { - serializedTerminal.pattern = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["D" /* isRegExp */])(pattern) - ? pattern.source - : pattern; - } - return serializedTerminal; - } - else if (node instanceof Rule) { - return { - type: "Rule", - name: node.name, - orgText: node.orgText, - definition: convertDefinition(node.definition) - }; - } - else { - throw Error("non exhaustive match"); - } -} -//# sourceMappingURL=gast_public.js.map - -/***/ }), -/* 8 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = baseMixin; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_utils__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_core__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_core_async__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__mixins_async_mixin__ = __webpack_require__(210); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__mixins_legend_mixin__ = __webpack_require__(293); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_binning_helpers__ = __webpack_require__(30); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_d3__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__core_errors__ = __webpack_require__(53); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__mixins_filter_mixin__ = __webpack_require__(294); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__mixins_label_mixin__ = __webpack_require__(295); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_logger__ = __webpack_require__(41); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_multiple_key_accessors__ = __webpack_require__(211); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__mixins_multiple_key_label_mixin__ = __webpack_require__(212); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__mixins_spinner_mixin__ = __webpack_require__(213); - - - - - - - - - - - - - - - -/** - * `dc.baseMixin` is an abstract functional object representing a basic `dc` chart object - * for all chart and widget implementations. Methods from the {@link #dc.baseMixin dc.baseMixin} are inherited - * and available on all chart implementations in the `dc` library. - * @name baseMixin - * @memberof dc - * @mixin - * @param {Object} _chart - * @return {dc.baseMixin} - */ -function baseMixin(_chart) { - // This is intended to be random every time a chart is created, but then to - // stay that same random number for as long as the chart exists in memory. - // - // The main reason for this is to support the raster chart and mixins, where - // the renderVega and getResultRowForPixel methods to connector-js (.con()) - // expect to get a integer id unique to a given active rendered chart, and - // the same for that chart across its active lifetime. - _chart.__dcFlag__ = __WEBPACK_IMPORTED_MODULE_0__utils_utils__["l" /* utils */].uniqueId(); - var _dimension; - var _group; - var _anchor; - var _root; - var _svg; - var _isChild; - var _popup; - var _popupIsEnabled = true; - var _redrawBrushFlag = false; - var _isTargeting = false; - var _colorByExpr = null; - var _legendLock = null; - var _legendUnlock = null; - var _legendInputChange = null; - var _minWidth = 200; - var _defaultWidth = function _defaultWidth(element) { - var width = element && element.getBoundingClientRect && element.getBoundingClientRect().width; - return width && width > _minWidth ? width : _minWidth; - }; - var _width = _defaultWidth; - var _minHeight = 200; - var _defaultHeight = function _defaultHeight(element) { - var height = element && element.getBoundingClientRect && element.getBoundingClientRect().height; - return height && height > _minHeight ? height : _minHeight; - }; - var _height = _defaultHeight; - var _keyAccessor = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["j" /* pluck */])("key"); - var _label = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["j" /* pluck */])("key"); - var _valueAccessor = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["j" /* pluck */])("val"); - var _orderSort; - var _renderLabel = false; - var _title = function _title(d) { - var key = _chart.keyAccessor()(d); - var value = _chart.valueAccessor()(d); - return "".concat(key instanceof Date ? key.toISOString() : key, ": ").concat(value instanceof Date ? value.toISOString() : value); - }; - var _renderTitle = true; - var _controlsUseVisibility = true; - var _transitionDuration = 500; - var _filterPrinter = __WEBPACK_IMPORTED_MODULE_0__utils_utils__["k" /* printers */].filters; - var _mandatoryAttributes = ["dimension", "group"]; - var _chartGroup = __WEBPACK_IMPORTED_MODULE_1__core_core__["c" /* constants */].DEFAULT_CHART_GROUP; - var _listeners = __WEBPACK_IMPORTED_MODULE_6_d3___default.a.dispatch("preRender", "postRender", "preRedraw", "postRedraw", "filtered", "zoomed", "renderlet", "pretransition", "bboxFiltered"); - var _legend; - var _commitHandler; - var _valueFormatter; - var _dateFormatter; - - /* OVERRIDE ---------------------------------------------------------------- */ - var _legendContinuous; - var _topQueryCallback = null; - var _registerQuery = function _registerQuery(callback) { - var stackEmpty = _topQueryCallback == null; - // need to check if max query? - _topQueryCallback = callback; - if (stackEmpty) { - _topQueryCallback.func(); - } - }; - var _popQueryStack = function _popQueryStack(id) { - if (_topQueryCallback != null && id == _topQueryCallback.id) { - _topQueryCallback = null; - } else { - _topQueryCallback.func(); - } - }; - var _startNextQuery = function _startNextQuery() { - _topQueryCallback.func(); - // var callback = _firstQueryCallback; - // callback(); - }; - - // override for count chart - _chart.isCountChart = function () { - return false; - }; - /* ------------------------------------------------------------------------- */ - - var _filters = []; - var _filterHandler = function _filterHandler(dimension, filters) { - if (filters.length === 0) { - return filters; - } - }; - var _data = function _data(group) { - return group.all(); - }; - /** - * Set or get the height attribute of a chart. The height is applied to the SVGElement generated by - * the chart when rendered (or re-rendered). If a value is given, then it will be used to calculate - * the new height and the chart returned for method chaining. The value can either be a numeric, a - * function, or falsy. If no value is specified then the value of the current height attribute will - * be returned. - * - * By default, without an explicit height being given, the chart will select the width of its - * anchor element. If that isn't possible it defaults to 200 (provided by the - * {@link #dc.baseMixin+minHeight minHeight} property). Setting the value falsy will return - * the chart to the default behavior. - * @name height - * @memberof dc.baseMixin - * @instance - * @see {@link #dc.baseMixin+minHeight minHeight} - * @example - * // Default height - * chart.height(function (element) { - * var height = element && element.getBoundingClientRect && element.getBoundingClientRect().height; - * return (height && height > chart.minHeight()) ? height : chart.minHeight(); - * }); - * - * chart.height(250); // Set the chart's height to 250px; - * chart.height(function(anchor) { return doSomethingWith(anchor); }); // set the chart's height with a function - * chart.height(null); // reset the height to the default auto calculation - * @param {Number|Function} [height] - * @return {Number} - * @return {dc.baseMixin} - */ - _chart.height = function (height) { - if (!arguments.length) { - return _height(_root.node()); - } - _height = __WEBPACK_IMPORTED_MODULE_6_d3___default.a.functor(height || _defaultHeight); - return _chart; - }; - - /** - * Set or get the width attribute of a chart. - * @name width - * @memberof dc.baseMixin - * @instance - * @see {@link #dc.baseMixin+height height} - * @see {@link #dc.baseMixin+minWidth minWidth} - * @example - * // Default width - * chart.width(function (element) { - * var width = element && element.getBoundingClientRect && element.getBoundingClientRect().width; - * return (width && width > chart.minWidth()) ? width : chart.minWidth(); - * }); - * @param {Number|Function} [width] - * @return {Number} - * @return {dc.baseMixin} - */ - _chart.width = function (width) { - if (!arguments.length) { - return _width(_root.node()); - } - _width = __WEBPACK_IMPORTED_MODULE_6_d3___default.a.functor(width || _defaultWidth); - return _chart; - }; - - /* OVERRIDE ---------------------------------------------------------------- */ - _chart.accent = function () {}; // no-op - _chart.unAccent = function () {}; // no-op - /* ------------------------------------------------------------------------- */ - - /** - * Set or get the minimum width attribute of a chart. This only has effect when used with the default - * {@link #dc.baseMixin+width width} function. - * @name minWidth - * @memberof dc.baseMixin - * @instance - * @see {@link #dc.baseMixin+width width} - * @param {Number} [minWidth=200] - * @return {Number} - * @return {dc.baseMixin} - */ - _chart.minWidth = function (minWidth) { - if (!arguments.length) { - return _minWidth; - } - _minWidth = minWidth; - return _chart; - }; - - /** - * Set or get the minimum height attribute of a chart. This only has effect when used with the default - * {@link #dc.baseMixin+height height} function. - * @name minHeight - * @memberof dc.baseMixin - * @instance - * @see {@link #dc.baseMixin+height height} - * @param {Number} [minHeight=200] - * @return {Number} - * @return {dc.baseMixin} - */ - _chart.minHeight = function (minHeight) { - if (!arguments.length) { - return _minHeight; - } - _minHeight = minHeight; - return _chart; - }; - - /** - * **mandatory** - * - * Set or get the dimension attribute of a chart. In `dc`, a dimension can be any valid [crossfilter - * dimension](https://github.com/square/crossfilter/wiki/API-Reference#wiki-dimension). - * - * If a value is given, then it will be used as the new dimension. If no value is specified then - * the current dimension will be returned. - * @name dimension - * @memberof dc.baseMixin - * @instance - * @see {@link https://github.com/square/crossfilter/wiki/API-Reference#dimension crossfilter.dimension} - * @example - * var index = crossfilter([]); - * var dimension = index.dimension(dc.pluck('key')); - * chart.dimension(dimension); - * @param {crossfilter.dimension} [dimension] - * @return {crossfilter.dimension} - * @return {dc.baseMixin} - */ - _chart.dimension = function (dimension) { - if (!arguments.length) { - return _dimension; - } - _dimension = dimension; - _chart.expireCache(); - return _chart; - }; - - /** - * Set the data callback or retrieve the chart's data set. The data callback is passed the chart's - * group and by default will return - * {@link https://github.com/square/crossfilter/wiki/API-Reference#group_all group.all}. - * This behavior may be modified to, for instance, return only the top 5 groups. - * @name data - * @memberof dc.baseMixin - * @instance - * @example - * // Default data function - * chart.data(function (group) { return group.all(); }); - * - * chart.data(function (group) { return group.top(5); }); - * @param {Function} [callback] - * @return {*} - * @return {dc.baseMixin} - */ - _chart.data = function (callback) { - if (!arguments.length) { - return _data.call(_chart, _group); - } - _data = __WEBPACK_IMPORTED_MODULE_6_d3___default.a.functor(callback); - _chart.expireCache(); - return _chart; - }; - - /** - * **mandatory** - * - * Set or get the group attribute of a chart. In `dc` a group is a - * {@link https://github.com/square/crossfilter/wiki/API-Reference#group-map-reduce crossfilter group}. - * Usually the group should be created from the particular dimension associated with the same chart. If a value is - * given, then it will be used as the new group. - * - * If no value specified then the current group will be returned. - * If `name` is specified then it will be used to generate legend label. - * @name group - * @memberof dc.baseMixin - * @instance - * @see {@link https://github.com/square/crossfilter/wiki/API-Reference#group-map-reduce crossfilter.group} - * @example - * var index = crossfilter([]); - * var dimension = index.dimension(dc.pluck('key')); - * chart.dimension(dimension); - * chart.group(dimension.group(crossfilter.reduceSum())); - * @param {crossfilter.group} [group] - * @param {String} [name] - * @return {crossfilter.group} - * @return {dc.baseMixin} - */ - _chart.group = function (group, name) { - if (!arguments.length) { - return _group; - } - _group = group; - _chart._groupName = name; - _chart.expireCache(); - return _chart; - }; - - /** - * Wrapper for binParams in Crossfilter. - */ - _chart.binParams = function (binParams) { - if (!arguments.length) { - return _chart.group().binParams(); - } - return Object(__WEBPACK_IMPORTED_MODULE_5__utils_binning_helpers__["d" /* createBinParams */])(_chart, binParams); - }; - - /** - * Get or set an accessor to order ordinal dimensions. This uses - * {@link https://github.com/square/crossfilter/wiki/API-Reference#quicksort_by crossfilter.quicksort.by} as the - * sort. - * @name ordering - * @memberof dc.baseMixin - * @instance - * @see {@link https://github.com/square/crossfilter/wiki/API-Reference#quicksort_by crossfilter.quicksort.by} - * @example - * // Default ordering accessor - * _chart.ordering(dc.pluck('key')); - * @param {Function} [orderFunction] - * @return {Function} - * @return {dc.baseMixin} - */ - - _chart.ordering = function (orderFunction) { - if (!arguments.length) { - return _ordering; - } - _ordering = orderFunction; - _orderSort = crossfilter.quicksort.by(_ordering); - _chart.expireCache(); - return _chart; - }; - _chart._computeOrderedGroups = function (data) { - var dataCopy = data.slice(0); - - /* OVERRIDE ---------------------------------------------------------------- */ - // if (dataCopy.length <= 1) { - // return dataCopy; - // } - // - // if (!_orderSort) { - // _orderSort = crossfilter.quicksort.by(_ordering); - // } - // - // return _orderSort(dataCopy, 0, dataCopy.length); - /* ------------------------------------------------------------------------- */ - return dataCopy; - }; - - /** - * Execute d3 single selection in the chart's scope using the given selector and return the d3 - * selection. - * - * This function is **not chainable** since it does not return a chart instance; however the d3 - * selection result can be chained to d3 function calls. - * @name select - * @memberof dc.baseMixin - * @instance - * @see {@link https://github.com/mbostock/d3/wiki/Selections d3.selection} - * @example - * // Similar to: - * d3.select('#chart-id').select(selector); - * @return {d3.selection} - */ - _chart.select = function (s) { - return _root.select(s); - }; - - /** - * Execute in scope d3 selectAll using the given selector and return d3 selection result. - * - * This function is **not chainable** since it does not return a chart instance; however the d3 - * selection result can be chained to d3 function calls. - * @name selectAll - * @memberof dc.baseMixin - * @instance - * @see {@link https://github.com/mbostock/d3/wiki/Selections d3.selection} - * @example - * // Similar to: - * d3.select('#chart-id').selectAll(selector); - * @return {d3.selection} - */ - _chart.selectAll = function (s) { - return _root ? _root.selectAll(s) : null; - }; - - /** - * Set the root SVGElement to either be an existing chart's root; or any valid [d3 single - * selector](https://github.com/mbostock/d3/wiki/Selections#selecting-elements) specifying a dom - * block element such as a div; or a dom element or d3 selection. Optionally registers the chart - * within the chartGroup. This class is called internally on chart initialization, but be called - * again to relocate the chart. However, it will orphan any previously created SVGElements. - * @name anchor - * @memberof dc.baseMixin - * @instance - * @param {anchorChart|anchorSelector|anchorNode} [parent] - * @param {String} [chartGroup] - * @return {String|node|d3.selection} - * @return {dc.baseMixin} - */ - _chart.anchor = function (parent, chartGroup) { - if (!arguments.length) { - return _anchor; - } - if (Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["o" /* instanceOfChart */])(parent)) { - _anchor = parent.anchor(); - _root = parent.root(); - _isChild = true; - } else if (parent) { - if (parent.select && parent.classed) { - // detect d3 selection - _anchor = parent.node(); - } else { - _anchor = parent; - } - _root = __WEBPACK_IMPORTED_MODULE_6_d3___default.a.select(_anchor); - _root.classed(__WEBPACK_IMPORTED_MODULE_1__core_core__["c" /* constants */].CHART_CLASS, true); - Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["f" /* deregisterChart */])(_chart, chartGroup); - Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["u" /* registerChart */])(_chart, chartGroup); - _isChild = false; - } else { - throw new __WEBPACK_IMPORTED_MODULE_7__core_errors__["a" /* BadArgumentException */]("parent must be defined"); - } - _chartGroup = chartGroup; - return _chart; - }; - - /** - * Returns the DOM id for the chart's anchored location. - * @name anchorName - * @memberof dc.baseMixin - * @instance - * @return {String} - */ - _chart.anchorName = function () { - var a = _chart.anchor(); - if (a && a.id) { - return a.id; - } - if (a && a.replace) { - return a.replace("#", ""); - } - return "dc-chart" + _chart.chartID(); - }; - - /** - * Returns the root element where a chart resides. Usually it will be the parent div element where - * the SVGElement was created. You can also pass in a new root element however this is usually handled by - * dc internally. Resetting the root element on a chart outside of dc internals may have - * unexpected consequences. - * @name root - * @memberof dc.baseMixin - * @instance - * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement HTMLElement} - * @param {HTMLElement} [rootElement] - * @return {HTMLElement} - * @return {dc.baseMixin} - */ - _chart.root = function (rootElement) { - if (!arguments.length) { - return _root; - } - _root = rootElement; - return _chart; - }; - - /** - * Returns the top SVGElement for this specific chart. You can also pass in a new SVGElement, - * however this is usually handled by dc internally. Resetting the SVGElement on a chart outside - * of dc internals may have unexpected consequences. - * @name svg - * @memberof dc.baseMixin - * @instance - * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/SVGElement SVGElement} - * @param {SVGElement|d3.selection} [svgElement] - * @return {SVGElement|d3.selection} - * @return {dc.baseMixin} - */ - _chart.svg = function (svgElement) { - if (!arguments.length) { - return _svg; - } - _svg = svgElement; - return _chart; - }; - - /** - * Remove the chart's SVGElements from the dom and recreate the container SVGElement. - * @name resetSvg - * @memberof dc.baseMixin - * @instance - * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/SVGElement SVGElement} - * @return {SVGElement} - */ - _chart.resetSvg = function () { - /* OVERRIDE ---------------------------------------------------------------- */ - _chart.root().html(""); - /* ------------------------------------------------------------------------- */ - - return _chart.generateSvg(); - }; - function sizeSvg() { - if (_svg) { - _svg.attr("width", _chart.width()).attr("height", _chart.height()); - } - } - _chart.generateSvg = function () { - /* OVERRIDE ---------------------------------------------------------------- */ - _svg = _chart.root().append("div").attr("class", "svg-wrapper").append("svg"); - /* ------------------------------------------------------------------------- */ - - sizeSvg(); - return _svg; - }; - - /* OVERRIDE ---------------------------------------------------------------- */ - function sizeRoot() { - if (_root) { - _root.style("height", _chart.height() + "px").style("width", _chart.width() + "px"); - } - } - _chart.popup = function (popupElement) { - if (!arguments.length) { - return _popup; - } - _popup = popupElement; - return _chart; - }; - _chart.enablePopup = function (popupIsEnabled) { - _popupIsEnabled = popupIsEnabled; - return _chart; - }; - _chart.popupIsEnabled = function () { - return _popupIsEnabled; - }; - _chart.generatePopup = function () { - _chart.select(".chart-popup").remove(); - _popup = _chart.root().append("div").attr("class", "chart-popup"); - _popup.append("div").attr("class", "chart-popup-box").append("div").attr("class", "chart-popup-content"); - return _popup; - }; - _chart.popupCoordinates = function (coords) { - var isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") > -1; - if (!isFirefox || __WEBPACK_IMPORTED_MODULE_6_d3___default.a.selectAll(".react-grid-item.cssTransforms").empty() || !__WEBPACK_IMPORTED_MODULE_6_d3___default.a.selectAll(".react-grid-layout.chart-edit-mode").empty()) { - return coords; - } - var rootRect = _chart.root().node().getBoundingClientRect(); - var gridTop = __WEBPACK_IMPORTED_MODULE_6_d3___default.a.select(".react-grid-layout").node().getBoundingClientRect().top; - return [coords[0] - rootRect.x, coords[1] - Math.abs(gridTop - rootRect.y) + 40]; - }; - _chart.isTargeting = function (isTargeting) { - if (!arguments.length) { - return _isTargeting; - } - _isTargeting = isTargeting; - return _chart; - }; - _chart.colorByExpr = function (colorByExpr) { - if (!arguments.length) { - return _colorByExpr; - } - _colorByExpr = colorByExpr; - return _chart; - }; - /* ------------------------------------------------------------------------- */ - - /** - * Set or get the filter printer function. The filter printer function is used to generate human - * friendly text for filter value(s) associated with the chart instance. By default dc charts use a - * default filter printer `printers.filter` that provides simple printing support for both - * single value and ranged filters. - * @name filterPrinter - * @memberof dc.baseMixin - * @instance - * @param {Function} [filterPrinterFunction=printers.filter] - * @return {Function} - * @return {dc.baseMixin} - */ - _chart.filterPrinter = function (filterPrinterFunction) { - if (!arguments.length) { - return _filterPrinter; - } - _filterPrinter = filterPrinterFunction; - return _chart; - }; - - /** - * If set, use the `visibility` attribute instead of the `display` attribute for showing/hiding - * chart reset and filter controls, for less disruption to the layout. - * @name controlsUseVisibility - * @memberof dc.baseMixin - * @instance - * @param {Boolean} [controlsUseVisibility=false] - * @return {Boolean} - * @return {dc.baseMixin} - **/ - _chart.controlsUseVisibility = function (_) { - if (!arguments.length) { - return _controlsUseVisibility; - } - _controlsUseVisibility = _; - return _chart; - }; - - /** - * Turn on optional control elements within the root element. dc currently supports the - * following html control elements. - * * root.selectAll('.reset') - elements are turned on if the chart has an active filter. This type - * of control element is usually used to store a reset link to allow user to reset filter on a - * certain chart. This element will be turned off automatically if the filter is cleared. - * * root.selectAll('.filter') elements are turned on if the chart has an active filter. The text - * content of this element is then replaced with the current filter value using the filter printer - * function. This type of element will be turned off automatically if the filter is cleared. - * @name turnOnControls - * @memberof dc.baseMixin - * @instance - * @return {dc.baseMixin} - */ - _chart.turnOnControls = function () { - if (_root) { - var attribute = _chart.controlsUseVisibility() ? "visibility" : "display"; - _chart.selectAll(".reset").style(attribute, null); - _chart.selectAll(".filter").text(_filterPrinter(_chart.filters())).style(attribute, null); - } - return _chart; - }; - - /** - * Turn off optional control elements within the root element. - * @name turnOffControls - * @memberof dc.baseMixin - * @see {@link #dc.baseMixin+turnOnControls turnOnControls} - * @instance - * @return {dc.baseMixin} - */ - _chart.turnOffControls = function () { - if (_root) { - var attribute = _chart.controlsUseVisibility() ? "visibility" : "display"; - var value = _chart.controlsUseVisibility() ? "hidden" : "none"; - _chart.selectAll(".reset").style(attribute, value); - _chart.selectAll(".filter").style(attribute, value).text(_chart.filter()); - } - return _chart; - }; - - /** - * Set or get the animation transition duration (in milliseconds) for this chart instance. - * @name transitionDuration - * @memberof dc.baseMixin - * @instance - * @param {Number} [duration=750] - * @return {Number} - * @return {dc.baseMixin} - */ - _chart.transitionDuration = function (duration) { - if (!arguments.length) { - /* OVERRIDE ---------------------------------------------------------------- */ - return Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["l" /* globalTransitionDuration */])() != null ? Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["l" /* globalTransitionDuration */])() : _transitionDuration; - /* ------------------------------------------------------------------------- */ - } - - _transitionDuration = duration; - return _chart; - }; - _chart._mandatoryAttributes = function (_) { - if (!arguments.length) { - return _mandatoryAttributes; - } - _mandatoryAttributes = _; - return _chart; - }; - function checkForMandatoryAttributes(a) { - if (!_chart[a] || !_chart[a]()) { - throw new __WEBPACK_IMPORTED_MODULE_7__core_errors__["d" /* InvalidStateException */]("Mandatory attribute chart." + a + " is missing on chart[#" + _chart.anchorName() + "]"); - } - } - function maybeUpdateColorDomain(data) { - var isFEQuantitativeColored = Array.isArray(data) && _chart.colorDomain && _legend && _legend.legendType() === "quantitative"; - if (isFEQuantitativeColored) { - var isLegendLocked = _legend.isLocked && _legend.isLocked(); - if (!isLegendLocked) { - var newColorDomain = __WEBPACK_IMPORTED_MODULE_6_d3___default.a.extent(data, _chart.colorAccessor()); - _chart.colorDomain(newColorDomain); - } - } - } - - /** - * Invoking this method will force the chart to re-render everything from scratch. Generally it - * should only be used to render the chart for the first time on the page or if you want to make - * sure everything is redrawn from scratch instead of relying on the default incremental redrawing - * behaviour. - * @name render - * @memberof dc.baseMixin - * @instance - * @param {Number} [id] - * @param {Number} [queryGroupId] - * @param {Number} [queryCount] - * @param {Function} [callback] - * @param {Any} [data] - * @return {dc.baseMixin} - */ - _chart.render = function (id, queryGroupId, queryCount, data, callback) { - if (Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["t" /* refreshDisabled */])()) { - return; - } - _chart.dataCache = typeof data !== "undefined" && data !== null ? data : null; - sizeRoot(); - _listeners.preRender(_chart, data); - if (_mandatoryAttributes) { - _mandatoryAttributes.forEach(checkForMandatoryAttributes); - } - maybeUpdateColorDomain(data); - var result = _chart._doRender(data); - if (_legend && _chart.colorDomain) { - _legend.render(); - } - _chart.generatePopup(); - _chart._activateRenderlets("postRender", data); - if (typeof queryGroupId !== "undefined" && queryGroupId !== null) { - if (Object(__WEBPACK_IMPORTED_MODULE_2__core_core_async__["f" /* isEqualToRenderCount */])(queryCount)) { - if (Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["p" /* logging */])()) { - var endTime = new Date(); - var elapsed = endTime - dc._startRenderTime; - console.log("Render elapsed: " + elapsed + " ms"); - } - Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["l" /* globalTransitionDuration */])(null); - Object(__WEBPACK_IMPORTED_MODULE_2__core_core_async__["m" /* resetRenderStack */])(); - if (Object(__WEBPACK_IMPORTED_MODULE_2__core_core_async__["k" /* renderStackEmpty */])(null)) { - return Object(__WEBPACK_IMPORTED_MODULE_2__core_core_async__["j" /* renderAllAsync */])(null).then(function (result) { - callback(null, result); - })["catch"](function (error) { - callback(error); - }); - } - } - } - callback && callback(null, result || _chart); - return result; - }; - _chart._activateRenderlets = function (event, data) { - _listeners.pretransition(_chart, data); - if (_chart.transitionDuration() > 0 && _svg) { - _svg.transition().duration(_chart.transitionDuration()).each("end", function () { - _listeners.renderlet(_chart, data); - if (event) { - _listeners[event](_chart, data); - } - }); - } else { - _listeners.renderlet(_chart, data); - if (event) { - _listeners[event](_chart, data); - } - } - }; - - /** - * Calling redraw will cause the chart to re-render data changes incrementally. If there is no - * change in the underlying data dimension then calling this method will have no effect on the - * chart. Most chart interaction in dc will automatically trigger this method through internal - * events (in particular {@link #dc.redrawAll dc.redrawAll}; therefore, you only need to - * manually invoke this function if data is manipulated outside of dc's control (for example if - * data is loaded in the background using - * {@link https://github.com/square/crossfilter/wiki/API-Reference#crossfilter_add crossfilter.add}. - * @name redraw - * @memberof dc.baseMixin - * @instance - * @param {Number} [id] - * @param {Number} [queryGroupId] - * @param {Number} [queryCount] - * @param {Function} [callback] - * @param {Any} [data] - * @return {dc.baseMixin} - */ - _chart.redraw = function (id, queryGroupId, queryCount, data, callback) { - if (Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["t" /* refreshDisabled */])()) { - return; - } - _chart.dataCache = typeof data !== "undefined" && data !== null ? data : null; - sizeSvg(); - _listeners.preRedraw(_chart, data); - maybeUpdateColorDomain(data); - var result = _chart._doRedraw(data); - if (_legend && _chart.colorDomain) { - _legend.render(); - } - _chart._activateRenderlets("postRedraw", data); - if (typeof queryGroupId !== "undefined" && queryGroupId !== null) { - if (Object(__WEBPACK_IMPORTED_MODULE_2__core_core_async__["e" /* isEqualToRedrawCount */])(queryCount)) { - if (Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["p" /* logging */])()) { - var endTime = new Date(); - var elapsed = endTime - dc._startRedrawTime; - console.log("Redraw elapsed: " + elapsed + " ms"); - } - Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["l" /* globalTransitionDuration */])(null); // reset to null if was brush - Object(__WEBPACK_IMPORTED_MODULE_2__core_core_async__["l" /* resetRedrawStack */])(); - var group = _chart.chartGroup(); - if (Object(__WEBPACK_IMPORTED_MODULE_2__core_core_async__["i" /* redrawStackEmpty */])(group)) { - return Object(__WEBPACK_IMPORTED_MODULE_2__core_core_async__["h" /* redrawAllAsync */])(group).then(function (result) { - callback(null, result); - })["catch"](function (error) { - callback(error); - }); - } - } - } - callback && callback(null, result || _chart); - return result; - }; - - /** - * Gets/sets the commit handler. If the chart has a commit handler, the handler will be called when - * the chart's filters have changed, in order to send the filter data asynchronously to a server. - * - * Unlike other functions in dc.js, the commit handler is asynchronous. It takes two arguments: - * a flag indicating whether this is a render (true) or a redraw (false), and a callback to be - * triggered once the commit is filtered. The callback has the standard node.js continuation signature - * with error first and result second. - * @name commitHandler - * @memberof dc.baseMixin - * @instance - * @return {dc.baseMixin} - */ - _chart.commitHandler = function (commitHandler) { - if (!arguments.length) { - return _commitHandler; - } - _commitHandler = commitHandler; - return _chart; - }; - - /** - * Redraws all charts in the same group as this chart, typically in reaction to a filter - * change. If the chart has a {@link dc.baseMixin.commitFilter commitHandler}, it will - * be executed and waited for. - * @name redrawGroup - * @memberof dc.baseMixin - * @instance - * @return {dc.baseMixin} - */ - _chart.redrawGroup = function (callback) { - if (_commitHandler) { - _commitHandler(false, function (error, result) { - if (error) { - console.log(error); - callback && callback(error); - } else { - dc.redrawAll(_chart.chartGroup(), callback); - } - }); - } else { - dc.redrawAll(_chart.chartGroup(), callback); - } - return _chart; - }; - - /** - * Renders all charts in the same group as this chart. If the chart has a - * {@link dc.baseMixin.commitFilter commitHandler}, it will be executed and waited for - * @name renderGroup - * @memberof dc.baseMixin - * @instance - * @return {dc.baseMixin} - */ - _chart.renderGroup = function (callback) { - if (_commitHandler) { - _commitHandler(false, function (error, result) { - if (error) { - console.log(error); - callback && callback(error); - } else { - dc.renderAll(_chart.chartGroup(), callback); - } - }); - } else { - dc.renderAll(_chart.chartGroup(), callback); - } - return _chart; - }; - _chart._invokeFilteredListener = function (f, i) { - if (f !== undefined) { - _listeners.filtered(_chart, f, i); - } - }; - _chart._invokeZoomedListener = function () { - _listeners.zoomed(_chart); - }; - - /** - * listener used for immerse to decide if bbox from originating raster chart can be applied to others - * if the other raster charts have linked-zoom enabled - * @private - */ - _chart._invokeBboxFilteredListener = function () { - return _listeners.bboxFiltered(_chart); - }; - var _hasFilterHandler = function _hasFilterHandler(filters, filter) { - if (typeof filter === "undefined") { - return filters.length > 0; - } - return filters.some(function (f) { - return filter <= f && filter >= f; - }); - }; - - /** - * Set or get the has filter handler. The has filter handler is a function that checks to see if - * the chart's current filters include a specific filter. Using a custom has filter handler allows - * you to change the way filters are checked for and replaced. - * @name hasFilterHandler - * @memberof dc.baseMixin - * @instance - * @example - * // default has filter handler - * chart.hasFilterHandler(function (filters, filter) { - * if (filter === null || typeof(filter) === 'undefined') { - * return filters.length > 0; - * } - * return filters.some(function (f) { - * return filter <= f && filter >= f; - * }); - * }); - * - * // custom filter handler (no-op) - * chart.hasFilterHandler(function(filters, filter) { - * return false; - * }); - * @param {Function} [hasFilterHandler] - * @return {Function} - * @return {dc.baseMixin} - */ - _chart.hasFilterHandler = function (hasFilterHandler) { - if (!arguments.length) { - return _hasFilterHandler; - } - _hasFilterHandler = hasFilterHandler; - return _chart; - }; - - /** - * Check whether any active filter or a specific filter is associated with particular chart instance. - * This function is **not chainable**. - * @name hasFilter - * @memberof dc.baseMixin - * @instance - * @see {@link #dc.baseMixin+hasFilterHandler hasFilterHandler} - * @param {*} [filter] - * @return {Boolean} - */ - _chart.hasFilter = function (filter) { - return _hasFilterHandler(_filters, filter); - }; - var _removeFilterHandler = function _removeFilterHandler(filters, filter) { - for (var i = 0; i < filters.length; i++) { - if (__WEBPACK_IMPORTED_MODULE_0__utils_utils__["l" /* utils */].deepEquals(filters[i], filter)) { - filters.splice(i, 1); - break; - } - if (filters[i] <= filter && filters[i] >= filter) { - filters.splice(i, 1); - break; - } - } - return filters; - }; - - /** - * Set or get the remove filter handler. The remove filter handler is a function that removes a - * filter from the chart's current filters. Using a custom remove filter handler allows you to - * change how filters are removed or perform additional work when removing a filter, e.g. when - * using a filter server other than crossfilter. - * - * Any changes should modify the `filters` array argument and return that array. - * @name removeFilterHandler - * @memberof dc.baseMixin - * @instance - * @example - * // default remove filter handler - * chart.removeFilterHandler(function (filters, filter) { - * for (var i = 0; i < filters.length; i++) { - * if (filters[i] <= filter && filters[i] >= filter) { - * filters.splice(i, 1); - * break; - * } - * } - * return filters; - * }); - * - * // custom filter handler (no-op) - * chart.removeFilterHandler(function(filters, filter) { - * return filters; - * }); - * @param {Function} [removeFilterHandler] - * @return {Function} - * @return {dc.baseMixin} - */ - _chart.removeFilterHandler = function (removeFilterHandler) { - if (!arguments.length) { - return _removeFilterHandler; - } - _removeFilterHandler = removeFilterHandler; - return _chart; - }; - var _addFilterHandler = function _addFilterHandler(filters, filter) { - filters.push(filter); - return filters; - }; - - /** - * Set or get the add filter handler. The add filter handler is a function that adds a filter to - * the chart's filter list. Using a custom add filter handler allows you to change the way filters - * are added or perform additional work when adding a filter, e.g. when using a filter server other - * than crossfilter. - * - * Any changes should modify the `filters` array argument and return that array. - * @name addFilterHandler - * @memberof dc.baseMixin - * @instance - * @example - * // default add filter handler - * chart.addFilterHandler(function (filters, filter) { - * filters.push(filter); - * return filters; - * }); - * - * // custom filter handler (no-op) - * chart.addFilterHandler(function(filters, filter) { - * return filters; - * }); - * @param {Function} [addFilterHandler] - * @return {Function} - * @return {dc.baseMixin} - */ - _chart.addFilterHandler = function (addFilterHandler) { - if (!arguments.length) { - return _addFilterHandler; - } - _addFilterHandler = addFilterHandler; - return _chart; - }; - var _resetFilterHandler = function _resetFilterHandler(filters) { - return []; - }; - - /** - * Set or get the reset filter handler. The reset filter handler is a function that resets the - * chart's filter list by returning a new list. Using a custom reset filter handler allows you to - * change the way filters are reset, or perform additional work when resetting the filters, - * e.g. when using a filter server other than crossfilter. - * - * This function should return an array. - * @name resetFilterHandler - * @memberof dc.baseMixin - * @instance - * @example - * // default remove filter handler - * function (filters) { - * return []; - * } - * - * // custom filter handler (no-op) - * chart.resetFilterHandler(function(filters) { - * return filters; - * }); - * @param {Function} [resetFilterHandler] - * @return {dc.baseMixin} - */ - _chart.resetFilterHandler = function (resetFilterHandler) { - if (!arguments.length) { - return _resetFilterHandler; - } - _resetFilterHandler = resetFilterHandler; - return _chart; - }; - function applyFilters() { - if (_chart.dimension() && _chart.dimension().filter) { - var fs = _filterHandler(_chart.dimension(), _filters); - _filters = fs ? fs : _filters; - } - } - _chart.replaceFilter = function (_) { - _filters = []; - _chart.filter(_); - }; - - /** - * Filter the chart by the given value or return the current filter if the input parameter is missing. - * If the passed filter is not currently in the chart's filters, it is added to the filters by the - * {@link #dc.baseMixin+addFilterHandler addFilterHandler}. If a filter exists already within the chart's - * filters, it will be removed by the {@link #dc.baseMixin+removeFilterHandler removeFilterHandler}. If - * a `null` value was passed at the filter, this denotes that the filters should be reset, and is performed - * by the {@link #dc.baseMixin+resetFilterHandler resetFilterHandler}. - * - * Once the filters array has been updated, the filters are applied to the crossfilter.dimension, using the - * {@link #dc.baseMixin+filterHandler filterHandler}. - * @name filter - * @memberof dc.baseMixin - * @instance - * @see {@link #dc.baseMixin+addFilterHandler addFilterHandler} - * @see {@link #dc.baseMixin+removeFilterHandler removeFilterHandler} - * @see {@link #dc.baseMixin+resetFilterHandler resetFilterHandler} - * @see {@link #dc.baseMixin+filterHandler filterHandler} - * @example - * // filter by a single string - * chart.filter('Sunday'); - * // filter by a single age - * chart.filter(18); - * @param {*} [filter] - * @return {dc.baseMixin} - */ - _chart.filter = function (filter, isFilterInverse) { - if (!arguments.length) { - return _filters.length > 0 ? _filters[0] : null; - } - isFilterInverse = typeof isFilterInverse === "undefined" ? false : isFilterInverse; - if (isFilterInverse !== _chart.filtersInverse()) { - _filters = _resetFilterHandler(_filters); - _chart.filtersInverse(isFilterInverse); - } - if (filter instanceof Array && filter[0] instanceof Array && !filter.isFiltered) { - filter[0].forEach(function (d) { - if (_chart.hasFilter(d)) { - _removeFilterHandler(_filters, d); - } else { - _addFilterHandler(_filters, d); - } - }); - } else if (filter === Symbol["for"]("clear")) { - filters = _resetFilterHandler(_filters); - } else if (_chart.hasFilter(filter)) { - _removeFilterHandler(_filters, filter); - } else { - _addFilterHandler(_filters, filter); - } - applyFilters(); - _chart._invokeFilteredListener(filter, isFilterInverse); - if (_root !== null && _chart.hasFilter()) { - _chart.turnOnControls(); - } else { - _chart.turnOffControls(); - } - return _chart; - }; - - /** - * Returns all current filters. This method does not perform defensive cloning of the internal - * filter array before returning, therefore any modification of the returned array will effect the - * chart's internal filter storage. - * @name filters - * @memberof dc.baseMixin - * @instance - * @return {Array<*>} - */ - _chart.filters = function () { - return _filters; - }; - - /* OVERRIDE ---------------------------------------------------------------- */ - _chart.accentSelected = function (e) { - __WEBPACK_IMPORTED_MODULE_6_d3___default.a.select(e).classed(__WEBPACK_IMPORTED_MODULE_1__core_core__["c" /* constants */].ACCENT_CLASS, true); - }; - _chart.unAccentSelected = function (e) { - __WEBPACK_IMPORTED_MODULE_6_d3___default.a.select(e).classed(__WEBPACK_IMPORTED_MODULE_1__core_core__["c" /* constants */].ACCENT_CLASS, false); - }; - /* ------------------------------------------------------------------------- */ - - _chart.highlightSelected = function (e) { - __WEBPACK_IMPORTED_MODULE_6_d3___default.a.select(e).classed(__WEBPACK_IMPORTED_MODULE_1__core_core__["c" /* constants */].SELECTED_CLASS, true); - __WEBPACK_IMPORTED_MODULE_6_d3___default.a.select(e).classed(__WEBPACK_IMPORTED_MODULE_1__core_core__["c" /* constants */].DESELECTED_CLASS, false); - }; - _chart.fadeDeselected = function (e) { - __WEBPACK_IMPORTED_MODULE_6_d3___default.a.select(e).classed(__WEBPACK_IMPORTED_MODULE_1__core_core__["c" /* constants */].SELECTED_CLASS, false); - __WEBPACK_IMPORTED_MODULE_6_d3___default.a.select(e).classed(__WEBPACK_IMPORTED_MODULE_1__core_core__["c" /* constants */].DESELECTED_CLASS, true); - }; - _chart.resetHighlight = function (e) { - __WEBPACK_IMPORTED_MODULE_6_d3___default.a.select(e).classed(__WEBPACK_IMPORTED_MODULE_1__core_core__["c" /* constants */].SELECTED_CLASS, false); - __WEBPACK_IMPORTED_MODULE_6_d3___default.a.select(e).classed(__WEBPACK_IMPORTED_MODULE_1__core_core__["c" /* constants */].DESELECTED_CLASS, false); - }; - - /** - * This function is passed to d3 as the onClick handler for each chart. The default behavior is to - * filter on the clicked datum (passed to the callback) and redraw the chart group. - * @name onClick - * @memberof dc.baseMixin - * @instance - * @param {*} datum - */ - _chart.onClick = function (datum) { - // filtering on dimension will have key, but for filtering on measures which is on column doesn't. Thus, the filter is the column value only - var values = _chart.keyAccessor()(datum); - var filter = null; - if (Array.isArray(values) && values.length || !Array.isArray(values) && values !== undefined) { - filter = values; - } else { - filter = datum; - } - _chart.handleFilterClick(__WEBPACK_IMPORTED_MODULE_6_d3___default.a.event, filter); - }; - - /** - * Set or get the filter handler. The filter handler is a function that performs the filter action - * on a specific dimension. Using a custom filter handler allows you to perform additional logic - * before or after filtering. - * @name filterHandler - * @memberof dc.baseMixin - * @instance - * @see {@link https://github.com/square/crossfilter/wiki/API-Reference#dimension_filter crossfilter.dimension.filter} - * @example - * // default filter handler - * chart.filterHandler(function (dimension, filters) { - * dimension.filter(Symbol.for("clear")); - * if (filters.length === 0) { - * dimension.filter(Symbol.for("clear")); - * } else { - * dimension.filterFunction(function (d) { - * for (var i = 0; i < filters.length; i++) { - * var filter = filters[i]; - * if (filter.isFiltered && filter.isFiltered(d)) { - * return true; - * } else if (filter <= d && filter >= d) { - * return true; - * } - * } - * return false; - * }); - * } - * return filters; - * }); - * - * // custom filter handler - * chart.filterHandler(function(dimension, filter){ - * var newFilter = filter + 10; - * dimension.filter(newFilter); - * return newFilter; // set the actual filter value to the new value - * }); - * @param {Function} [filterHandler] - * @return {Function} - * @return {dc.baseMixin} - */ - _chart.filterHandler = function (filterHandler) { - if (!arguments.length) { - return _filterHandler; - } - _filterHandler = filterHandler; - return _chart; - }; - - // abstract function stub - _chart._doRender = function () { - // do nothing in base, should be overridden by sub-function - return _chart; - }; - _chart._doRedraw = function () { - // do nothing in base, should be overridden by sub-function - return _chart; - }; - _chart.legendables = function () { - // do nothing in base, should be overridden by sub-function - return []; - }; - - /* OVERRIDE -----------------------------------------------------------------*/ - - _chart.legendLock = function (_) { - if (!arguments.length) { - return _legendLock; - } - _legendLock = _; - return _chart; - }; - _chart.legendUnlock = function (_) { - if (!arguments.length) { - return _legendUnlock; - } - _legendUnlock = _; - return _chart; - }; - _chart.legendInputChange = function (_) { - if (!arguments.length) { - return _legendInputChange; - } - _legendInputChange = _; - return _chart; - }; - - /* ------------------------------------------------------------------------- */ - - _chart.legendHighlight = function () { - // do nothing in base, should be overridden by sub-function - }; - _chart.legendReset = function () { - // do nothing in base, should be overridden by sub-function - }; - _chart.legendToggle = function () { - // do nothing in base, should be overriden by sub-function - }; - _chart.isLegendableHidden = function () { - // do nothing in base, should be overridden by sub-function - return false; - }; - - /** - * Set or get the key accessor function. The key accessor function is used to retrieve the key - * value from the crossfilter group. Key values are used differently in different charts, for - * example keys correspond to slices in a pie chart and x axis positions in a grid coordinate chart. - * @name keyAccessor - * @memberof dc.baseMixin - * @instance - * @example - * // default key accessor - * chart.keyAccessor(function(d) { return d.key; }); - * // custom key accessor for a multi-value crossfilter reduction - * chart.keyAccessor(function(p) { return p.value.absGain; }); - * @param {Function} [keyAccessor] - * @return {Function} - * @return {dc.baseMixin} - */ - _chart.keyAccessor = function (keyAccessor) { - if (!arguments.length) { - return _keyAccessor; - } - _keyAccessor = keyAccessor; - return _chart; - }; - - /** - * Set or get the value accessor function. The value accessor function is used to retrieve the - * value from the crossfilter group. Group values are used differently in different charts, for - * example values correspond to slice sizes in a pie chart and y axis positions in a grid - * coordinate chart. - * @name valueAccessor - * @memberof dc.baseMixin - * @instance - * @example - * // default value accessor - * chart.valueAccessor(function(d) { return d.value; }); - * // custom value accessor for a multi-value crossfilter reduction - * chart.valueAccessor(function(p) { return p.value.percentageGain; }); - * @param {Function} [valueAccessor] - * @return {Function} - * @return {dc.baseMixin} - */ - _chart.valueAccessor = function (valueAccessor) { - if (!arguments.length) { - return _valueAccessor; - } - _valueAccessor = valueAccessor; - return _chart; - }; - - /** - * Set or get the label function. The chart class will use this function to render labels for each - * child element in the chart, e.g. slices in a pie chart or bubbles in a bubble chart. Not every - * chart supports the label function, for example line chart does not use this function - * at all. By default, enables labels; pass false for the second parameter if this is not desired. - * @name label - * @memberof dc.baseMixin - * @instance - * @example - * // default label function just return the key - * chart.label(function(d) { return d.key; }); - * // label function has access to the standard d3 data binding and can get quite complicated - * chart.label(function(d) { return d.data.key + '(' + Math.floor(d.data.value / all.value() * 100) + '%)'; }); - * @param {Function} [labelFunction] - * @param {Boolean} [enableLabels=true] - * @return {Function} - * @return {dc.baseMixin} - */ - _chart.label = function (labelFunction, enableLabels) { - if (!arguments.length) { - return _label; - } - _label = labelFunction; - if (enableLabels === undefined || enableLabels) { - _renderLabel = true; - } - return _chart; - }; - - /** - * Turn on/off label rendering - * @name renderLabel - * @memberof dc.baseMixin - * @instance - * @param {Boolean} [renderLabel=false] - * @return {Boolean} - * @return {dc.baseMixin} - */ - _chart.renderLabel = function (renderLabel) { - if (!arguments.length) { - return _renderLabel; - } - _renderLabel = renderLabel; - return _chart; - }; - - /** - * Set or get the title function. The chart class will use this function to render the SVGElement title - * (usually interpreted by browser as tooltips) for each child element in the chart, e.g. a slice - * in a pie chart or a bubble in a bubble chart. Almost every chart supports the title function; - * however in grid coordinate charts you need to turn off the brush in order to see titles, because - * otherwise the brush layer will block tooltip triggering. - * @name title - * @memberof dc.baseMixin - * @instance - * @example - * // default title function just return the key - * chart.title(function(d) { return d.key + ': ' + d.value; }); - * // title function has access to the standard d3 data binding and can get quite complicated - * chart.title(function(p) { - * return p.key.getFullYear() - * + '\n' - * + 'Index Gain: ' + numberFormat(p.value.absGain) + '\n' - * + 'Index Gain in Percentage: ' + numberFormat(p.value.percentageGain) + '%\n' - * + 'Fluctuation / Index Ratio: ' + numberFormat(p.value.fluctuationPercentage) + '%'; - * }); - * @param {Function} [titleFunction] - * @return {Function} - * @return {dc.baseMixin} - */ - _chart.title = function (titleFunction) { - if (!arguments.length) { - return _title; - } - _title = titleFunction; - return _chart; - }; - - /** - * Turn on/off title rendering, or return the state of the render title flag if no arguments are - * given. - * @name renderTitle - * @memberof dc.baseMixin - * @instance - * @param {Boolean} [renderTitle=true] - * @return {Boolean} - * @return {dc.baseMixin} - */ - _chart.renderTitle = function (renderTitle) { - if (!arguments.length) { - return _renderTitle; - } - _renderTitle = renderTitle; - return _chart; - }; - - /** - * A renderlet is similar to an event listener on rendering event. Multiple renderlets can be added - * to an individual chart. Each time a chart is rerendered or redrawn the renderlets are invoked - * right after the chart finishes its transitions, giving you a way to modify the SVGElements. - * Renderlet functions take the chart instance as the only input parameter and you can - * use the dc API or use raw d3 to achieve pretty much any effect. - * - * Use {@link #dc.baseMixin+on on} with a 'renderlet' prefix. - * Generates a random key for the renderlet, which makes it hard to remove. - * @name renderlet - * @memberof dc.baseMixin - * @instance - * @deprecated - * @example - * // do this instead of .renderlet(function(chart) { ... }) - * chart.on("renderlet", function(chart){ - * // mix of dc API and d3 manipulation - * chart.select('g.y').style('display', 'none'); - * // its a closure so you can also access other chart variable available in the closure scope - * moveChart.filter(chart.filter()); - * }); - * @param {Function} renderletFunction - * @return {dc.baseMixin} - */ - _chart.renderlet = __WEBPACK_IMPORTED_MODULE_10__utils_logger__["a" /* logger */].deprecate(function (renderletFunction) { - _chart.on("renderlet." + __WEBPACK_IMPORTED_MODULE_0__utils_utils__["l" /* utils */].uniqueId(), renderletFunction); - return _chart; - }, 'chart.renderlet has been deprecated. Please use chart.on("renderlet.", renderletFunction)'); - - /** - * Get or set the chart group to which this chart belongs. Chart groups are rendered or redrawn - * together since it is expected they share the same underlying crossfilter data set. - * @name chartGroup - * @memberof dc.baseMixin - * @instance - * @param {String} [chartGroup] - * @return {String} - * @return {dc.baseMixin} - */ - _chart.chartGroup = function (chartGroup) { - if (!arguments.length) { - return _chartGroup; - } - if (!_isChild) { - Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["f" /* deregisterChart */])(_chart, _chartGroup); - } - _chartGroup = chartGroup; - if (!_isChild) { - Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["u" /* registerChart */])(_chart, _chartGroup); - } - return _chart; - }; - - /** - * Expire the internal chart cache. dc charts cache some data internally on a per chart basis to - * speed up rendering and avoid unnecessary calculation; however it might be useful to clear the - * cache if you have changed state which will affect rendering. For example if you invoke the - * {@link https://github.com/square/crossfilter/wiki/API-Reference#crossfilter_add crossfilter.add} - * function or reset group or dimension after rendering it is a good idea to - * clear the cache to make sure charts are rendered properly. - * @name expireCache - * @memberof dc.baseMixin - * @instance - * @return {dc.baseMixin} - */ - _chart.expireCache = function () { - // do nothing in base, should be overridden by sub-function - return _chart; - }; - - /** - * charting-extension function - * Destroy all leftover parts of the chart. - * @name destroyChart - * @memberof dc.baseMixin - * @instance - * @return {dc.baseMixin} - */ - _chart.destroyChart = function () { - // do nothing in base, should be overridden by sub-function - return _chart; - }; - - /** - * Attach a dc.legend widget to this chart. The legend widget will automatically draw legend labels - * based on the color setting and names associated with each group. - * @name legend - * @memberof dc.baseMixin - * @instance - * @example - * chart.legend(dc.legend().x(400).y(10).itemHeight(13).gap(5)) - * @param {dc.legend} [legend] - * @return {dc.legend} - * @return {dc.baseMixin} - */ - _chart.legend = function (legend) { - if (!arguments.length) { - return _legend; - } - _legend = legend; - if (_legend) { - _legend.parent(_chart); - } - return _chart; - }; - - /* OVERRIDE -----------------------------------------------------------------*/ - _chart.legendContinuous = function (legendContinuous) { - if (!arguments.length) { - return _legendContinuous; - } - _legendContinuous = legendContinuous; - _legendContinuous.parent(_chart); - return _chart; - }; - /* --------------------------------------------------------------------------*/ - - /** - * Returns the internal numeric ID of the chart. - * @name chartID - * @memberof dc.baseMixin - * @instance - * @return {String} - */ - _chart.chartID = function () { - return _chart.__dcFlag__; - }; - - /** - * Set chart options using a configuration object. Each key in the object will cause the method of - * the same name to be called with the value to set that attribute for the chart. - * @name options - * @memberof dc.baseMixin - * @instance - * @example - * chart.options({dimension: myDimension, group: myGroup}); - * @param {{}} opts - * @return {dc.baseMixin} - */ - _chart.options = function (opts) { - var applyOptions = ["anchor", "group", "xAxisLabel", "yAxisLabel", "y2AxisLabel", "stack", "title", "point", "getColor", "overlayGeoJson"]; - for (var o in opts) { - if (typeof _chart[o] === "function") { - if (opts[o] instanceof Array && applyOptions.indexOf(o) !== -1) { - _chart[o].apply(_chart, opts[o]); - } else { - _chart[o].call(_chart, opts[o]); - } - } else { - dc.logger.debug("Not a valid option setter name: " + o); - } - } - return _chart; - }; - - /** - * All dc chart instance supports the following listeners. - * Supports the following events: - * * `renderlet` - This listener function will be invoked after transitions after redraw and render. Replaces the - * deprecated {@link #dc.baseMixin+renderlet renderlet} method. - * * `pretransition` - Like `.on('renderlet', ...)` but the event is fired before transitions start. - * * `preRender` - This listener function will be invoked before chart rendering. - * * `postRender` - This listener function will be invoked after chart finish rendering including - * all renderlets' logic. - * * `preRedraw` - This listener function will be invoked before chart redrawing. - * * `postRedraw` - This listener function will be invoked after chart finish redrawing - * including all renderlets' logic. - * * `filtered` - This listener function will be invoked after a filter is applied, added or removed. - * * `zoomed` - This listener function will be invoked after a zoom is triggered. - * @name on - * @memberof dc.baseMixin - * @instance - * @see {@link https://github.com/mbostock/d3/wiki/Internals#dispatch_on d3.dispatch.on} - * @example - * .on('renderlet', function(chart, filter){...}) - * .on('pretransition', function(chart, filter){...}) - * .on('preRender', function(chart){...}) - * .on('postRender', function(chart){...}) - * .on('preRedraw', function(chart){...}) - * .on('postRedraw', function(chart){...}) - * .on('filtered', function(chart, filter){...}) - * .on('zoomed', function(chart, filter){...}) - * @param {String} event - * @param {Function} listener - * @return {dc.baseMixin} - */ - _chart.on = function (event, listener) { - _listeners.on(event, listener); - return _chart; - }; - _chart.debounce = function (func, wait, immediate) { - var timeout; - return function () { - var context = this, - args = arguments; - var later = function later() { - timeout = null; - if (!immediate) { - func.apply(context, args); - } - }; - var callNow = immediate && !timeout; - clearTimeout(timeout); - timeout = setTimeout(later, wait); - if (callNow) { - func.apply(context, args); - } - }; - }; - _chart.showNullDimensions = function (showNulls) { - if (!arguments.length) { - return !_chart.dimension().getEliminateNull(); - } - _chart.expireCache(); - _chart.dimension().setEliminateNull(!showNulls); - return _chart; - }; - _chart.keyAccessor(__WEBPACK_IMPORTED_MODULE_11__utils_multiple_key_accessors__["a" /* multipleKeysAccessorForCap */]); - _chart.ordering = function () {}; - _chart.rangeChartEnabled = function () { - return false; - }; - _chart.isTime = function () { - return null; - }; - _chart.isMulti = function () { - return false; - }; - _chart.valueFormatter = function (formatter) { - if (!arguments.length) { - return _valueFormatter; - } - _valueFormatter = formatter; - return _chart; - }; - _chart.dateFormatter = function (formatter) { - if (!arguments.length) { - return _dateFormatter; - } - _dateFormatter = formatter; - return _chart; - }; - _chart.getMeasureName = function () { - var measure = _chart.group().reduce(); - return measure && measure[0] ? measure[0].measureName : null; - }; - _chart = Object(__WEBPACK_IMPORTED_MODULE_4__mixins_legend_mixin__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_8__mixins_filter_mixin__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_9__mixins_label_mixin__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_12__mixins_multiple_key_label_mixin__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_13__mixins_spinner_mixin__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_3__mixins_async_mixin__["a" /* default */])(_chart)))))); - return _chart; -} - -/***/ }), -/* 9 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PropertiesDefinitionInterface; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_assert__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__PropertyDefinition__ = __webpack_require__(379); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } - - - -/** - * @typedef ParentInfo - * @property {PropertiesDefinitionInterface} parent - * @property {string} prop_name - */ -var PropertiesDefinitionInterface = /*#__PURE__*/function () { - /** - * @param {Object} definition_object - * @param {ParentInfo} [parent_info=null] - * @param {RasterLayerContext} [root_context = null] - */ - function PropertiesDefinitionInterface(definition_object) { - var parent_info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - var root_context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - _classCallCheck(this, PropertiesDefinitionInterface); - __WEBPACK_IMPORTED_MODULE_0_assert___default()(_typeof(definition_object) === "object"); - __WEBPACK_IMPORTED_MODULE_0_assert___default()(parent_info === null || root_context === null); - this.parent_info_ = parent_info; - this.root_context_ = root_context; - this.definition_object_ = definition_object; - this.error_msg_ = ""; - } - - /** - * @type {string} - */ - _createClass(PropertiesDefinitionInterface, [{ - key: "error_message", - get: function get() { - return this.error_msg_; - }, - set: function set(error_msg) { - this.error_msg_ = error_msg; - } - - /** - * @returns {boolean} - */ - }, { - key: "hasError", - value: function hasError() { - return this.error_message.length > 0; - } - - /** - * @returns {PropertiesDefinitionInterface} - */ - }, { - key: "parent", - get: function get() { - return this.parent_info_ ? this.parent_info_.parent : null; - } - - /** - * @type {RasterLayerContext} - */ - }, { - key: "root_context", - get: function get() { - if (this.root_context_) { - return this.root_context_; - } - __WEBPACK_IMPORTED_MODULE_0_assert___default()(this.parent_info_); - return this.parent_info_.parent.root_context; - } - - /** - * - * @param {string} prop_name - * @returns boolean - */ - }, { - key: "hasProperty", - value: function hasProperty(prop_name) { - return Object.hasOwn(this.definition_object_, prop_name); - } - - /** - * @returns {PropertyDefinition} - */ - }, { - key: "getPropertyDefinition", - value: function getPropertyDefinition(prop_name) { - if (!this.hasProperty(prop_name)) { - return null; - } - return new __WEBPACK_IMPORTED_MODULE_1__PropertyDefinition__["a" /* default */](prop_name, this.definition_object_[prop_name]); - } - - /** - * @param {VegaPropertyOutputState} vega_property_output_state - */ - // eslint-disable-next-line no-unused-vars - }, { - key: "materialize", - value: function materialize(vega_property_output_state) { - __WEBPACK_IMPORTED_MODULE_0_assert___default()(false, "Needs to be overwritten by a derived class"); - } - - /** - * @param {PropDescriptor} prop_descriptor - * @param {VegaPropertyOutputState} vega_property_output_state - */ - // eslint-disable-next-line no-unused-vars - }, { - key: "materializeProperty", - value: function materializeProperty(prop_descriptor, vega_property_output_state) { - __WEBPACK_IMPORTED_MODULE_0_assert___default()(false, "Needs to be overwritten by a derived class"); - } - - /** - * After all the vega properties/state have been materialized, there is one last pass/opportunity - * for definition objects to realign with the prebuilt state for whatever purpose. Note: - * realignment is done in a FIFO queue. - * @param {Map} prop_descriptors - * @param {VegaPropertyOutputState} vega_property_output_state - */ - // eslint-disable-next-line no-unused-vars - }, { - key: "realign", - value: function realign(prop_descriptors, vega_property_output_state) {} - }]); - return PropertiesDefinitionInterface; -}(); - - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - -!function(t,e){ true?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Draw=e():t.Draw=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=25)}([function(t,e,r){"use strict";function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t[g]=e,t[w]=r,t}function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return n(new b.a.ARRAY_TYPE(2),t,e)}function o(t){var e=new b.a.ARRAY_TYPE(2);return e[g]=t[g],e[w]=t[w],e}function a(t,e){return t[g]=e[g],t[w]=e[w],t}function s(t,e){return i(t,e)}function c(t,e,r){return m.a.add(t,e,r)}function u(t,e,r){return m.a.sub(t,e,r)}function l(t,e,r){return m.a.transformMat2(t,e,r)}function f(t,e,r){return m.a.transformMat2d(t,e,r)}function h(t){return"point2d(".concat(t[0]," , ").concat(t[1],")")}function p(t,e){return m.a.distance(t,e)}function d(t,e){return m.a.squaredDistance(t,e)}function _(t,e,r,n){return m.a.lerp(t,e,r,n)}function v(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return m.a.equals(t,e,r)}function y(t,e){return m.a.exactEquals(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.set=n,e.create=i,e.clone=o,e.copy=a,e.initFromValues=s,e.addVec2=c,e.sub=u,e.transformMat2=l,e.transformMat2d=f,e.str=h,e.distance=p,r.d(e,"dist",function(){return x}),e.squaredDistance=d,r.d(e,"sqrDist",function(){return O}),e.lerp=_,e.equals=v,e.exactEquals=y;var b=r(6),m=r(3),g=0,w=1,x=p,O=d},function(t,e,r){"use strict";function n(t){s=t}function i(t){return t*u}function o(t,e){return Math.abs(t-e)<=a*Math.max(1,Math.abs(t),Math.abs(e))}Object.defineProperty(e,"__esModule",{value:!0}),r.d(e,"EPSILON",function(){return a}),r.d(e,"ARRAY_TYPE",function(){return s}),r.d(e,"RANDOM",function(){return c}),e.setMatrixArrayType=n,e.toRadian=i,e.equals=o;var a=1e-6,s="undefined"!=typeof Float32Array?Float32Array:Array,c=Math.random,u=Math.PI/180},function(t,e,r){"use strict";var n=r(6),i=r(5);n.c.equals=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=t[0],o=t[1],a=t[2],s=t[3],c=t[4],u=t[5],l=e[0],f=e[1],h=e[2],p=e[3],d=e[4],_=e[5],v=null!==r?r:i.EPSILON;return Math.abs(n-l)<=v*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-f)<=v*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(a-h)<=v*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(s-p)<=v*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(c-d)<=v*Math.max(1,Math.abs(c),Math.abs(d))&&Math.abs(u-_)<=v*Math.max(1,Math.abs(u),Math.abs(_))},n.c.svd=function(t,e,r,n){if(t&&(t[0]=n[4],t[1]=n[5]),e||r){var i=(n[0]+n[3])/2,o=(n[0]-n[3])/2,a=(n[1]+n[2])/2,s=(n[1]-n[2])/2;if(e){var c=Math.sqrt(i*i+s*s),u=Math.sqrt(o*o+a*a);e[0]=c+u,e[1]=c-u}if(r){var l=Math.atan2(a,o),f=Math.atan2(s,i);r[0]=(f-l)/2,r[1]=(f+l)/2}}},e.a=n.c},function(t,e,r){"use strict";var n=r(6),i=r(5);n.d.equals=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=t[0],o=t[1],a=e[0],s=e[1],c=null!==r?r:i.EPSILON;return Math.abs(n-a)<=c*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(o-s)<=c*Math.max(1,Math.abs(o),Math.abs(s))},n.d.cross2d=function(t,e){return t[0]*e[1]-t[1]*e[0]},n.d.angleFast=function(t,e){return Math.acos(n.d.dot(t,e))},n.d.angle=function(t,e){var r=n.d.dot(t,e),i=n.d.cross2d(t,e);return Math.atan2(i,r)},n.d.anglePosX=function(t){var e=Math.atan2(t[1],t[0]);return e<0&&(e*=-1),e},e.a=n.d},function(t,e,r){"use strict";function n(t,e,r,n,i){return t[I]="number"==typeof e?e:1/0,t[T]="number"==typeof r?r:1/0,t[F]="number"==typeof n?n:-1/0,t[R]="number"==typeof i?i:-1/0,t}function i(t,e,r,i){return n(new j.a.ARRAY_TYPE(B.BOX_SIDES),t,e,r,i)}function o(t){var e=new j.a.ARRAY_TYPE(B.BOX_SIDES);return e[I]=t[I],e[T]=t[T],e[F]=t[F],e[R]=t[R],e}function a(t,e){return t[I]=e[I],t[T]=e[T],t[F]=e[F],t[R]=e[R],t}function s(t){return t[I]=1/0,t[T]=1/0,t[F]=-1/0,t[R]=-1/0,t}function c(t){return t[I]=-1/0,t[T]=-1/0,t[F]=1/0,t[R]=1/0,t}function u(t,e){return e[0]<0?(t[I]=-e[0],t[F]=0):(t[I]=0,t[F]=e[0]),e[1]<0?(t[T]=-e[1],t[R]=0):(t[T]=0,t[R]=e[1]),t}function l(t,e,r){for(var n=0;n<2;n+=1)r[n]<0?(t[n]=e[n]-r[n],t[n+2]=e[n]):(t[n]=e[n],t[n+2]=e[n]+r[n]);return t}function f(t,e,r){for(var n=0;n<2;n+=1)r[n]<0?(t[n]=e[n]+r[n],t[n+2]=e[n]-r[n]):(t[n]=e[n]-r[n],t[n+2]=e[n]+r[n]);return t}function h(t){return t[I]>t[F]||t[T]>t[R]}function p(t){return!(isFinite(t[I])&&isFinite(t[T])&&isFinite(t[F])&&isFinite(t[R]))}function d(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=t[0],i=t[1],o=t[2],a=t[3],s=e[0],c=e[1],u=e[2],l=e[3],f=null!==r?r:D.EPSILON;return Math.abs(n-s)<=f&&Math.abs(i-c)<=f&&Math.abs(o-u)<=f&&Math.abs(a-l)<=f}function _(t,e){return A.a.set(t,e[F]-e[I],e[R]-e[T])}function v(t,e){return _(t,e),A.a.scale(t,t,.5)}function y(t,e){return v(t,e),t[I]+=e[I],t[T]+=e[T],t}function b(t,e,r){t[I]=e[I]-r[0],t[F]=e[F]+r[0],t[T]=e[T]-r[1],t[R]=e[R]+r[1]}function m(t){return(t[F]-t[I])*(t[R]-t[T])}function g(t,e,r){return i(Math.min(e[I],r[I]),Math.min(e[T],r[T]),Math.max(e[F],r[F]),Math.max(e[R],r[R]))}function w(t,e,r){var n=t;t===e&&(n=i());for(var o=I,c=F;o<=T&&!(e[c]r[c]);o+=1,c+=1)n[o]=Math.max(e[o],r[o]),n[c]=Math.min(e[c],r[c]);return o!==T+1&&s(n),t===e&&a(t,n),t}function x(t,e){return!(t[F]<=e[I]||t[I]>=e[F]||t[R]<=e[T]||t[T]>=e[R])}function O(t,e){return!(e[I]t[F]||e[T]t[R])}function k(t,e){return e[I]>=t[I]&&e[I]<=t[F]&&e[T]>=t[T]&&e[T]<=t[R]}function S(t,e,r){return t!==e&&a(t,e),h(e)?(t[I]=r[I],t[F]=r[I],t[T]=r[T],t[R]=r[T]):(r[I]t[F]&&(t[F]=r[I]),r[T]t[R]&&(t[R]=r[T])),t}function E(t,e,r){t[I]=e[I]+r[0],t[T]=e[T]+r[1],t[F]=e[F]+r[0],t[R]=e[R]+r[1]}function M(t,e,r,n){var o=t;t===e&&(o=i()),s(o);var c=A.a.set(A.a.create(),e[I],e[T]),u=A.a.create();return n(u,c,r),S(o,o,u),c[I]=e[F],n(u,c,r),S(o,o,u),c[T]=e[R],n(u,c,r),S(o,o,u),c[I]=e[I],n(u,c,r),S(o,o,u),t===e&&a(t,o),t}function P(t,e,r){return M(t,e,r,A.a.transformMat2)}function C(t,e,r){return M(t,e,r,A.a.transformMat2d)}Object.defineProperty(e,"__esModule",{value:!0}),r.d(e,"MINX",function(){return I}),r.d(e,"MINY",function(){return T}),r.d(e,"MAXX",function(){return F}),r.d(e,"MAXY",function(){return R}),e.set=n,e.create=i,e.clone=o,e.copy=a,e.initEmpty=s,e.initInfinity=c,e.initSizeFromOrigin=u,e.initSizeFromLocation=l,e.initCenterExtents=f,e.isEmpty=h,e.isInfinite=p,e.equals=d,e.getSize=_,e.getExtents=v,e.getCenter=y,e.expand=b,e.area=m,e.hull=g,e.intersection=w,e.overlaps=x,e.contains=O,e.containsPt=k,e.encapsulatePt=S,e.translate=E,e.transformMat2=P,e.transformMat2d=C;var j=r(6),D=r(5),A=r(3),I=0,T=1,F=2,R=3,B={BOX_SIDES:4}},function(t,e,r){"use strict";function n(t){return o.a.setMatrixArrayType(t)}function i(t){a=t}Object.defineProperty(e,"__esModule",{value:!0}),r.d(e,"EPSILON",function(){return a}),e.setMatrixArrayType=n,e.setEpsilon=i;var o=r(6),a=o.a.EPSILON},function(t,e,r){"use strict";var n=r(1),i=r(27),o=r(28),a=(r(14),r(15),r(16),r(29),r(30));r(17),r(18);r.d(e,"a",function(){return n}),r.d(e,"b",function(){return i}),r.d(e,"c",function(){return o}),r.d(e,"d",function(){return a})},function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r1?e-1:0),n=1;nr?r:t}function i(t){return t<0?0:t>1?1:t}function o(t,e,r){return t*(1-r)+e*r}var a=r(5);Math.QUATER_PI=.25*Math.PI,Math.HALF_PI=.5*Math.PI,Math.HALF_NPI=-.5*Math.PI,Math.TWO_PI=2*Math.PI,Math.NPI=-Math.PI,Math.NQUATER_PI=.25*Math.NPI,Math.NHALF_PI=.5*Math.NPI,Math.NTWO_PI=2*Math.NPI,Math.INV_PI=1/Math.PI,Math.RAD_TO_DEG=180/Math.PI,Math.DEG_TO_RAD=Math.PI/180,Math.clamp=n,Math.clamp01=i,Math.lerp=o,Math.floatingPtEquals=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=null!==r?r:a.EPSILON;return Math.abs(t-e)<=n*Math.max(1,Math.abs(t),Math.abs(e))},e.a=Math},function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;y.a.multiply(this._fullXform,e,this.globalXform),t.beginPath();var o=this._draw(t);(o||void 0===o)&&(this.isFillVisible()&&(null===n||Boolean(n))&&(r.setFillStyle(t,this),t.fill()),this.isStrokeVisible()&&(null===i||Boolean(i))&&(r.setStrokeStyle(t,this),t.setTransform(1,0,0,1,0,0),t.stroke()),this._doDebugDraw&&this._drawDebug(t))}},{key:"setStyle",value:function(t){return x.a.copyBasicStyle(t,this),this}},{key:"toJSON",value:function(){var t=this;return this._stateStack&&this._stateStack.length&&(t=this._stateStack[0]),Object.assign({visible:this.visible,zIndex:t.zIndex},x.a.toJSON(t),g.c.toJSON(this))}}],[{key:"shapeCompare",value:function(t,e){var r=t.zIndex,n=e.zIndex;if(rn)return 1;var i=b.b.compareFillStyle(t,e);return i||(i=m.b.compareStrokeStyle(t,e)),i}}]),e}(Object(w.a)(k,Object(g.b)("changed:xform"),Object(b.a)("changed:style"),Object(m.a)("changed:style")))},function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r=e.length)return 0;var o=0,s=null;return s=t.get(e[r]),s&&(o=a(s[0],e,r+1,n),s[1].forEach(function(t){return t.call(i,n)}),o+=s[1].length),o}function s(t,e){var r=-1,n=t[0],i=t[1];i.length&&e.forEach(function(t){(r=i.indexOf(t))>=0&&i.splice(r,1)}),n.forEach(function(t){s(t,e)})}function c(t){var e=t;if("string"==typeof t)e=[t];else if(!Array.isArray(t))throw new Error("Input must be an array of strings");return e}r.d(e,"a",function(){return u});var u=function(){function t(e){n(this,t),this.initializer(e)}return o(t,[{key:"initializer",value:function(t){this._listeners=new Map,this.registerEvents(t)}},{key:"registerEvents",value:function(t){var e=this;if(t){var r=c(t);if("string"==typeof t)r=[t];else if(!Array.isArray(t))throw new Error("Events must be an array of strings");r.forEach(function(t){for(var r=t.split(":"),n=e._listeners,i=0;it[2]&&(t[2]=e[0],n[2]=r),e[1]t[3]&&(t[3]=e[1],n[3]=r))}function y(t,e,r){var n=e[0]*r[1]-r[0]*e[1];return t[0]+=(e[0]+r[0])*n,t[1]+=(e[1]+r[1])*n,n}function b(t){return Array.isArray(t)||ArrayBuffer&&ArrayBuffer.isView(t)}r.d(e,"a",function(){return E});var m=r(4),g=r(0),w=r(2),x=r(9),O=r(8),k=r(23),S=w.a.create(),E=function(t){function e(t){var n;i(this,e);var o=t.verts||[];if(n=r.call(this,t),!b(o)||0===o.length||b(o[0])&&o.length<1||!b(o[0])&&(o.length<2||o.length%2!=0))throw new Error("PolyLine shapes must be initialized with an array of 2d points and contain at least 1 points");n._extentIndices=[-1,-1,-1,-1],n._localaabox=m.create(),n._verts=[],n._centroid=g.create(),m.initEmpty(n._aabox);var a=0,s=0;if(b(o[0])){for(s=0;s=this._verts.length)throw new Error("Cannot translate vertex at index ".concat(t,". There are only ").concat(this._verts.length," vertices in the polygon."));if(e[0]||e[1]){var r=g.clone(this._verts[t]),n=g.clone(this._verts[t]);g.addVec2(n,n,e),this._collapseVerts(),this._resetAABox=!0,this._geomDirty=!0,g.copy(n),this.fire("changed:geom",{attr:"verts[".concat(t,"]"),prevVal:r,currVal:n})}return this}},{key:"setVertPosition",value:function(t,e){if(t>=this._verts.length)throw new Error("Cannot translate vertex at index ".concat(t,". There are only ").concat(this._verts.length," vertices in the polygon."));if(!g.equals(e,this._verts[t])){var r=g.clone(this._verts[t]);this._collapseVerts(),g.copy(this._verts[t],e),this._resetAABox=!0,this._geomDirty=!0,this.fire("changed:geom",{attr:"verts[".concat(t,"]"),prevVal:r,currVal:e})}}},{key:"insertVert",value:function(t,e){var r=O.a.min(O.a.max(t,0),this._verts.length);return this._collapseVerts(),t>=this._verts.length?(this._verts.push(g.clone(e)),r=this._verts.length-1):this._verts.splice(t,0,g.clone(e)),this._resetAABox=!0,this._geomDirty=!0,this.fire("changed:geom:addvert",{attr:"verts[".concat(r,"]"),currVal:e}),r}},{key:"appendVert",value:function(t){return this.insertVert(this._verts.length,t)}},{key:"removeVert",value:function(t){if(t>=this._verts.length||t<0)throw new Error("Cannot remove vertex ".concat(t,". Invalid index. There are only ").concat(this._verts.length," vertices in the shape."));var e=this._verts[t];return this._verts.splice(t,1),this._collapseVerts(),this._resetAABox=!0,this._geomDirty=!0,this.fire("changed:geom:removevert",{attr:"verts[".concat(t,"]"),currVal:e}),t}},{key:"_rebuildAABox",value:function(){var t=this;m.initEmpty(this._aabox),this._verts.length<3?this._convexHull=this._verts.map(function(t,e){return e}):this._convexHull=Object(k.a)(this._verts),this._convexHull.forEach(function(e){v(t._aabox,t._verts[e],e,t._extentIndices)});var e=g.create(0,0);m.getCenter(e,this._aabox),this.pivot=e}},{key:"_updateAABox",value:function(){var t=this;if(this._resetAABox&&(this._rebuildAABox(),this._resetAABox=!1),this._boundsOutOfDate||this._geomDirty){m.initEmpty(this._aabox);var e=g.create(),r=this.globalXform;if(this._convexHull.forEach(function(n){m.encapsulatePt(t._aabox,t._aabox,g.transformMat2d(e,t._verts[n],r))}),this._boundsOutOfDate=!1,this._geomDirty){var n=g.create();n[0]=this._verts[this._extentIndices[0]][0]+.5*(this._verts[this._extentIndices[2]][0]-this._verts[this._extentIndices[0]][0]),n[1]=this._verts[this._extentIndices[1]][1]+.5*(this._verts[this._extentIndices[3]][1]-this._verts[this._extentIndices[1]][1]),this.pivot=n,this._geomDirty=!1}}}},{key:"_draw",value:function(t){var e=!1;if(this._verts.length>=2){t.setTransform(1,0,0,1,0,0);var r=g.create();g.transformMat2d(r,this._verts[0],this._fullXform),t.moveTo(r[0],r[1]);for(var n=1;n0?(n=2*Math.sqrt(r+1),t[3]=.25*n,t[0]=(e[6]-e[9])/n,t[1]=(e[8]-e[2])/n,t[2]=(e[1]-e[4])/n):e[0]>e[5]&&e[0]>e[10]?(n=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/n,t[0]=.25*n,t[1]=(e[1]+e[4])/n,t[2]=(e[8]+e[2])/n):e[5]>e[10]?(n=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/n,t[0]=(e[1]+e[4])/n,t[1]=.25*n,t[2]=(e[6]+e[9])/n):(n=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/n,t[0]=(e[8]+e[2])/n,t[1]=(e[6]+e[9])/n,t[2]=.25*n),t}e.b=n,e.a=i;r(1)},function(t,e,r){"use strict";function n(){var t=new l.ARRAY_TYPE(4);return l.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function i(t,e,r){r*=.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function o(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),c=Math.cos(r);return t[0]=n*c+a*s,t[1]=i*c+o*s,t[2]=o*c-i*s,t[3]=a*c-n*s,t}function a(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),c=Math.cos(r);return t[0]=n*c-o*s,t[1]=i*c+a*s,t[2]=o*c+n*s,t[3]=a*c-i*s,t}function s(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),c=Math.cos(r);return t[0]=n*c+i*s,t[1]=i*c-n*s,t[2]=o*c+a*s,t[3]=a*c-o*s,t}function c(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3],c=r[0],u=r[1],f=r[2],h=r[3],p=void 0,d=void 0,_=void 0,v=void 0,y=void 0;return d=i*c+o*u+a*f+s*h,d<0&&(d=-d,c=-c,u=-u,f=-f,h=-h),1-d>l.EPSILON?(p=Math.acos(d),_=Math.sin(p),v=Math.sin((1-n)*p)/_,y=Math.sin(n*p)/_):(v=1-n,y=n),t[0]=v*i+y*c,t[1]=v*o+y*u,t[2]=v*a+y*f,t[3]=v*s+y*h,t}function u(t,e){var r=e[0]+e[4]+e[8],n=void 0;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,a=(i+2)%3;n=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*a+a]+1),t[i]=.5*n,n=.5/n,t[3]=(e[3*o+a]-e[3*a+o])*n,t[o]=(e[3*o+i]+e[3*i+o])*n,t[a]=(e[3*a+i]+e[3*i+a])*n}return t}e.b=n,e.e=o,e.f=a,e.g=s,r.d(e,"a",function(){return d}),r.d(e,"c",function(){return _}),r.d(e,"d",function(){return v}),r.d(e,"h",function(){return y});var l=r(1),f=r(14),h=r(17),p=r(18),d=(p.b,p.g,p.c),_=(p.l,p.a,p.k,p.d),v=(p.i,p.h),y=p.m,b=p.j;p.f,p.e,function(){var t=h.a(),e=h.d(1,0,0),r=h.d(0,1,0)}(),function(){var t=n(),e=n()}(),function(){var t=f.a()}()},function(t,e,r){"use strict";function n(){var t=new u.ARRAY_TYPE(3);return u.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function i(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function o(t,e,r){var n=new u.ARRAY_TYPE(3);return n[0]=t,n[1]=e,n[2]=r,n}function a(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t}function s(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function c(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],c=r[2];return t[0]=i*c-o*s,t[1]=o*a-n*c,t[2]=n*s-i*a,t}e.a=n,e.d=o,e.f=a,e.c=s,e.b=c,r.d(e,"e",function(){return l});var u=r(1),l=i;!function(){var t=n()}()},function(t,e,r){"use strict";function n(){var t=new y.ARRAY_TYPE(4);return y.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function i(t){var e=new y.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function o(t,e,r,n){var i=new y.ARRAY_TYPE(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function s(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function c(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function u(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function l(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)}function f(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function h(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a),t}function p(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function d(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t}function _(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function v(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],c=e[2],u=e[3];return Math.abs(r-a)<=y.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=y.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-c)<=y.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(o-u)<=y.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))}e.b=i,e.g=o,e.c=a,e.l=s,e.a=c,e.k=u,e.h=l,e.m=f,e.j=h,e.d=p,e.i=d,e.f=_,e.e=v;var y=r(1);!function(){var t=n()}()},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r0}},{key:"isTransparent",value:function(){return this._fillColor.isTransparent()}},{key:"setFillCtx",value:function(t){t.fillStyle=this.fillColor}}],[{key:"copyFillStyle",value:function(t,e){void 0===t.packedFillColor?(void 0!==t.fillColor&&(e.fillColor=t.fillColor),void 0!==t.fillOpacity&&(e.fillOpacity=t.fillOpacity)):e.packedFillColor=t.packedFillColor}},{key:"compareFillStyle",value:function(t,e){var r=t.isFillVisible(),n=e.isFillVisible();return r!==n?r-n:t.packedFillColor-e.packedFillColor}},{key:"toJSON",value:function(t){return{fillColor:t.fillColor}}}]),t}()},function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(){return i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=o(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},i.apply(this,arguments)}function o(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){var e=f();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d(t,e){for(var r=0;r>>24,", ").concat((16711680&t)>>16,", ").concat((65280&t)>>8,", ").concat(v(t),")")}function m(t){if("string"!=typeof t)throw new Error("".concat(t," is not a valid color string"));var e=0,r=null;if(r=t.match(O))e=255,e|=w.a.clamp(Number.parseInt(r[3],10),0,255)<<8,e|=w.a.clamp(Number.parseInt(r[2],10),0,255)<<16,e|=w.a.clamp(Number.parseInt(r[1],10),0,255)<<24;else if(r=t.match(k))e=y(Number.parseFloat(r[4],10)),e|=w.a.clamp(Number.parseInt(r[3],10),0,255)<<8,e|=w.a.clamp(Number.parseInt(r[2],10),0,255)<<16,e|=w.a.clamp(Number.parseInt(r[1],10),0,255)<<24;else if(r=t.match(S))e=255,e|=w.a.clamp(Number.parseInt(r[3],16),0,255)<<8,e|=w.a.clamp(Number.parseInt(r[2],16),0,255)<<16,e|=w.a.clamp(Number.parseInt(r[1],16),0,255)<<24;else{if(!x.has(t))throw new Error("".concat(t," is not a valid color string"));r=x.get(t).match(S),e=255,e|=w.a.clamp(Number.parseInt(r[3],16),0,255)<<8,e|=w.a.clamp(Number.parseInt(r[2],16),0,255)<<16,e|=w.a.clamp(Number.parseInt(r[1],16),0,255)<<24}return e}function g(t,e){return function(r){function n(){return p(this,n),o.apply(this,arguments)}a(n,r);var o=c(n);return _(n,[{key:"initializer",value:function(t,e){this._eventHandler=e,i(h(n.prototype),"initializer",this).call(this,t)}},{key:"_checkPackedColorChanged",value:function(r){if(r!==this._color){var n=this._color,i=v(n),o=v(r);this._color=r,this._eventHandler.fire(t,{attr:e,prevVal:b(n),currVal:b(this._color)}),o!==i&&this._eventHandler.fire(t,{attr:"opacity",prevVal:i,currVal:o})}}},{key:"value",get:function(){return b(this._color)},set:function(t){var e=m(t);return this._checkPackedColorChanged(e),this}},{key:"packedValue",get:function(){return this._color},set:function(t){var e=0;return e|=t,this._checkPackedColorChanged(e),this}},{key:"opacity",get:function(){return v(this._color)},set:function(e){if("number"!=typeof e)throw new Error("Opacity must be a number between 0-1");var r=255&this._color,n=y(e);return n!==r&&(this._color&=4294967040,this._color|=n,this._eventHandler.fire(t,{attr:"opacity",prevVal:r/255,currVal:n/255})),this}}]),n}(E)}r.d(e,"b",function(){return E}),e.a=g;var w=r(8),x=new Map([["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"],["cornflowerblue","#6495ED"],["cornsilk","#FFF8DC"],["crimson","#DC143C"],["cyan","#00FFFF"],["darkblue","#00008B"],["darkcyan","#008B8B"],["darkgoldenrod","#B8860B"],["darkgray","#A9A9A9"],["darkgreen","#006400"],["darkkhaki","#BDB76B"],["darkmagenta","#8B008B"],["darkolivegreen","#556B2F"],["darkorange","#FF8C00"],["darkorchid","#9932CC"],["darkred","#8B0000"],["darksalmon","#E9967A"],["darkseagreen","#8FBC8F"],["darkslateblue","#483D8B"],["darkslategray","#2F4F4F"],["darkturquoise","#00CED1"],["darkviolet","#9400D3"],["deeppink","#FF1493"],["deepskyblue","#00BFFF"],["dimgray","#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"],["honeydew","#F0FFF0"],["hotpink","#FF69B4"],["indianred","#CD5C5C"],["indigo","#4B0082"],["ivory","#FFFFF0"],["khaki","#F0E68C"],["lavender","#E6E6FA"],["lavenderblush","#FFF0F5"],["lawngreen","#7CFC00"],["lemonchiffon","#FFFACD"],["lightblue","#ADD8E6"],["lightcoral","#F08080"],["lightcyan","#E0FFFF"],["lightgoldenrodyellow","#FAFAD2"],["lightgray","#D3D3D3"],["lightgreen","#90EE90"],["lightpink","#FFB6C1"],["lightsalmon","#FFA07A"],["lightseagreen","#20B2AA"],["lightskyblue","#87CEFA"],["lightslategray","#778899"],["lightsteelblue","#B0C4DE"],["lightyellow","#FFFFE0"],["lime","#00FF00"],["limegreen","#32CD32"],["linen","#FAF0E6"],["magenta","#FF00FF"],["maroon","#800000"],["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"],["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"],["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"]]),O=/^rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)\s*$/i,k=/^rgba\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([0,1](?:\.\d*)?)\s*\)\s*$/i,S=/^#([0-9,a-f,A-F]{2})([0-9,a-f,A-F]{2})([0-9,a-f,A-F]{2})\s*$/i,E=function(){function t(e){p(this,t);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i0&&this._strokeWidth>0}},{key:"isTransparent",value:function(){return this._strokeColor.isTransparent()}},{key:"setStrokeCtx",value:function(t){t.strokeStyle=this.strokeColor,t.lineWidth=this._strokeWidth,t.lineJoin=this._lineJoin,t.lineCap=this._lineCap,t.setLineDash(this._dashPattern),t.lineDashOffset=this._dashOffset}}],[{key:"copyStrokeStyle",value:function(t,e){void 0===t.packedStrokeColor?(void 0!==t.strokeColor&&(e.strokeColor=t.strokeColor),void 0!==t.strokeOpacity&&(e.strokeOpacity=t.strokeOpacity)):e.packedStrokeColor=t.packedStrokeColor,void 0!==t.strokeWidth&&(e.strokeWidth=t.strokeWidth),void 0!==t.lineJoin&&(e.lineJoin=t.lineJoin),void 0!==t.lineCap&&(e.lineCap=t.lineCap),void 0!==t.dashPattern&&(e.dashPattern=t.dashPattern),void 0!==t.dashOffset&&(e.dashOffset=t.dashOffset)}},{key:"compareStrokeStyle",value:function(t,e){var r=t.isStrokeVisible(),n=e.isStrokeVisible();if(r!==n)return r-n;if(r=t.packedStrokeColor,n=e.packedStrokeColor,r!==n)return r-n;if(r=t.strokeWidth,n=e.strokeWidth,r!==n)return r-n;if(r=t._lineJoin,n=e._lineJoin,r!==n)return r-n;if(r=t._lineCap,n=e._lineCap,r!==n)return r-n;if(r=t._dashPattern,n=e._dashPattern,r.length===n.length&&r.length>0){for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:null;this._margins=e&&e.margins?Object.assign({},e.margins):{},P.forEach(function(t){"number"!=typeof r._margins[t]&&(r._margins[t]=0)});var i=_(t),o=i.canvasContainer,a=i.canvas,s=i.canvasContext,c=i.ratio;this._container=o,this._drawCanvas=a,this._drawCtx=s,this._pixelRatio=c,this._parent=t,Object(x.a)(["_resize"],this),this._resize(e),this._resizeSensor=new E.a(t,this._resize),(n||null===n&&e&&e.enableEvents)&&this._enableEvents()}},{key:"_destroyCanvas",value:function(){this._drawCanvas&&this._disableEvents(),this._parent&&(this._parent.removeChild(this._drawCanvas),this._resizeSensor&&this._resizeSensor.detach(this._parent,this._resize)),this._drawCanvas=null,this._drawCtx=null,this._parent=null}},{key:"_init",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.registerEvents([C.SHAPE_ADD,C.SHAPE_DELETE]),Object(x.a)(["_reorderCb","_rerenderCb"],this),Object(x.a)(["_mousedownCB","_mouseupCB","_mousemoveCB","_clickCB","_dblclickCB","_mouseoverCB","_mouseoutCB"],this),this._renderFrameCb=this.renderAll.bind(this),this._renderRequestTime=0,this._ids={shapeId:1},this._objects=new Map,this._sortedObjs=[],this._reorderedObjIdxs=new Set,this._initCanvas(t,e,r),this._styleState=new j({fillColor:"red"})}},{key:"getContainer",value:function(){return this._parent}},{key:"getCanvasContainer",value:function(){return this._container}},{key:"getCanvas",value:function(){return this._drawCanvas}},{key:"sortedShapes",get:function(){return this._reorderedObjIdxs.size&&(console.assert(this._sortedObjs.length===this._objects.size,"Size mismatch when rendering objets. Something got out of sync - sorted objs length: ".concat(this._sortedObjs.length,", objects length: ").concat(this._objects.size)),this._sortedObjs.sort(g.a.shapeCompare),this._reorderedObjIdxs.clear()),this._sortedObjs}},{key:"margins",get:function(){var t=this,e={};return P.forEach(function(r){e[r]=t._margins[r]}),e},set:function(t){var e=this;P.forEach(function(r){"number"==typeof t[r]&&t[r]!==e._margins[r]&&(e._margins[r]=t.prop)}),this._resize()}},{key:"camera",get:function(){return this._camera}},{key:"viewport",get:function(){return this._camera.viewport},set:function(t){this._camera.viewport=t}},{key:"projectionDimensions",get:function(){return this._camera.projectionDimensions},set:function(t){return this._camera.projectionDimensions=t,this}},{key:"cameraPosition",get:function(){return this._camera.getPosition()},set:function(t){return this._camera.setPosition(t),this}},{key:"project",value:function(t,e){var r=this._camera.screenToWorldMatrix;return m.transformMat2d(t,e,r)}},{key:"unproject",value:function(t,e){var r=this._camera.worldToScreenMatrix;return m.transformMat2d(t,e,r)}},{key:"hasShape",value:function(t){return this._objects.has(t)}},{key:"addShape",value:function(t){var e=t;Array.isArray(e)||(e=[t]),v(e,this._objects,this._ids,this._reorderCb,this._rerenderCb),this.fire("shape:add",{shape:e});var r={target:e};return this._reorderCb(r),this}},{key:"deleteShape",value:function(t){var e=t;Array.isArray(e)||(e=[t]);for(var r=y(e,this._objects,this._reorderCb,this._rerenderCb),n=-1,i=0;i=0&&this._sortedObjs.splice(n,1),this._reorderedObjIdxs.add(r[i]);return this._rerenderCb(),this.fire("shape:delete",{shape:e}),this}},{key:"deleteAllShapes",value:function(){return this.deleteShape(this.sortedShapes.slice()),this}},{key:"moveShapeToTop",value:function(t){if(this._objects.has(t)){var e=this.sortedShapes,r=e[e.length-1].zIndex;t.zIndex=r+1}}},{key:"moveShapeToBack",value:function(t){if(this._objects.has(t)){var e=this.sortedShapes,r=e[0].zIndex;t.zIndex=r}}},{key:"getShapesAsJSON",value:function(){return this.sortedShapes.map(function(t){return t.toJSON()})}},{key:"_rerenderCb",value:function(){window.requestAnimationFrame(this._renderFrameCb)}},{key:"_reorderCb",value:function(t){var e=this,r=t.target;Array.isArray(r)||(r=[t.target]),r.forEach(function(t){console.assert(t,"A changed event doesn't have an object");var r=e._objects.get(t);console.assert(r,"A changed event target isn't in the list of shapes ".concat(t)),r.shapeIdx<0&&(r.shapeIdx=e._sortedObjs.push(t)-1),e._reorderedObjIdxs.add(r.shapeIdx)}),this._rerenderCb()}},{key:"_renderShapes",value:function(t,e,r){var n=this,i=r.worldToScreenMatrix;e.forEach(function(e){e.visible&&e.render(t,i,n._styleState)})}},{key:"renderAll",value:function(t){if(t){if(t<=this._renderRequestTime)return;this._renderRequestTime=t}else this._renderRequestTime=performance.now();var e=this._drawCtx;if(e.clearRect(0,0,this._drawCanvas.offsetWidth,this._drawCanvas.offsetHeight),this._objects.size){e.save();var r=this.sortedShapes;this._styleState.applyDefaults(e),this._renderShapes(e,r,this._camera),e.restore()}}}]),e}(k.a);D.EventConstants=C},function(t,e,r){"use strict";function n(t,e,r){return(e[o]-t[o])*(r[a]-t[a])-(r[o]-t[o])*(e[a]-t[a])}function i(t){var e=[],r=t.length;if(r<3){for(var i=0;i0?(o[a+1]=0,o[a+2]=1):(o[a+1]=1,o[a+2]=0);for(var c=3;c=0&&o[a+1]>=0&&n(t[o[a]],t[o[a+1]],t[c])<=0;)a+=1;for(a-=1,o[a]=c;o[s]>=0&&o[s+1]>=0&&n(t[o[s-1]],t[o[s]],t[c])<=0;)s-=1;s+=1,o[s]=c}var u=0;for(u=0;u<=s-a-1;u+=1)e[u]=o[a+u];return o[a+u]!==e[0]&&(e[u]=o[a+u]),e}e.a=i;var o=0,a=1},function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r=4.0.0"},repository:{type:"git",url:"git+https://github.com/omnisci/mapd-draw.git"},dependencies:{"css-element-queries":"^0.4.0","gl-matrix":"^2.3.2"},devDependencies:{"@babel/core":"^7.0.0","@babel/plugin-proposal-class-properties":"^7.0.0","@babel/plugin-proposal-decorators":"^7.0.0","@babel/plugin-proposal-do-expressions":"^7.0.0","@babel/plugin-proposal-export-default-from":"^7.0.0","@babel/plugin-proposal-export-namespace-from":"^7.0.0","@babel/plugin-proposal-function-bind":"^7.0.0","@babel/plugin-proposal-function-sent":"^7.0.0","@babel/plugin-proposal-json-strings":"^7.0.0","@babel/plugin-proposal-logical-assignment-operators":"^7.0.0","@babel/plugin-proposal-nullish-coalescing-operator":"^7.0.0","@babel/plugin-proposal-numeric-separator":"^7.0.0","@babel/plugin-proposal-optional-chaining":"^7.0.0","@babel/plugin-proposal-pipeline-operator":"^7.0.0","@babel/plugin-proposal-throw-expressions":"^7.0.0","@babel/plugin-syntax-dynamic-import":"^7.0.0","@babel/plugin-syntax-import-meta":"^7.0.0","@babel/preset-env":"^7.0.0","@babel/register":"^7.0.0","babel-eslint":"^10.0.1","babel-loader":"^8.0.0",chai:"^3.5.0",eslint:"^6.0.0","eslint-config-prettier":"^6.5.0","eslint-plugin-prettier":"^3.1.1","json-loader":"0.5.4",mocha:"^6.2.1","pre-commit":"^1.2.2",prettier:"1.18.2",webpack:"^3.12.0","webpack-dev-server":"^2.11.3"},scripts:{build:"npm run build:prod; npm run build:dev","build:prod":"npm run webpack","build:dev":"npm run webpack:dev",clean:"bash scripts/clean.sh","lint:fix":"eslint --rule 'prettier/prettier: 0' --fix $(find src -name \"*.js\" ! -name '*.spec.js'); prettier --write $(find src -name \"*.js\" ! -name '*.spec.js')",lint:"eslint $(find src -name \"*.js\" ! -name '*.spec.js')",start:"webpack-dev-server --config webpack.dev.config.js --content-base ./example --watch -d --open","watch:dev":"node node_modules/webpack/bin/webpack.js --progress --colors --watch --config webpack.dev.config.js",webpack:"node node_modules/webpack/bin/webpack.js","webpack:dev":"node node_modules/webpack/bin/webpack.js --config webpack.dev.config.js",test:"mocha --recursive --require @babel/register"},"pre-commit":["lint","test"]}},function(t,e,r){"use strict";function n(){var t=new M.ARRAY_TYPE(4);return M.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function i(t){var e=new M.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function o(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function a(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function s(t,e,r,n){var i=new M.ARRAY_TYPE(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function c(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function u(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function l(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*o-i*n;return a?(a=1/a,t[0]=o*a,t[1]=-n*a,t[2]=-i*a,t[3]=r*a,t):null}function f(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t}function h(t){return t[0]*t[3]-t[2]*t[1]}function p(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],c=r[1],u=r[2],l=r[3];return t[0]=n*s+o*c,t[1]=i*s+a*c,t[2]=n*u+o*l,t[3]=i*u+a*l,t}function d(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),c=Math.cos(r);return t[0]=n*c+o*s,t[1]=i*c+a*s,t[2]=n*-s+o*c,t[3]=i*-s+a*c,t}function _(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],c=r[1];return t[0]=n*s,t[1]=i*s,t[2]=o*c,t[3]=a*c,t}function v(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t}function y(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function b(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function m(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))}function g(t,e,r,n){return t[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-t[2]*r[1],[t,e,r]}function w(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function x(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function O(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function k(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],c=e[2],u=e[3];return Math.abs(r-a)<=M.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=M.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-c)<=M.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(o-u)<=M.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))}function S(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function E(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}Object.defineProperty(e,"__esModule",{value:!0}),e.create=n,e.clone=i,e.copy=o,e.identity=a,e.fromValues=s,e.set=c,e.transpose=u,e.invert=l,e.adjoint=f,e.determinant=h,e.multiply=p,e.rotate=d,e.scale=_,e.fromRotation=v,e.fromScaling=y,e.str=b,e.frob=m,e.LDU=g,e.add=w,e.subtract=x,e.exactEquals=O,e.equals=k,e.multiplyScalar=S,e.multiplyScalarAndAdd=E,r.d(e,"mul",function(){return P}),r.d(e,"sub",function(){return C});var M=r(1),P=p,C=x},function(t,e,r){"use strict";function n(){var t=new E.ARRAY_TYPE(6);return E.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function i(t){var e=new E.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function o(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function a(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function s(t,e,r,n,i,o){var a=new E.ARRAY_TYPE(6);return a[0]=t,a[1]=e,a[2]=r,a[3]=n,a[4]=i,a[5]=o,a}function c(t,e,r,n,i,o,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t}function u(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=r*o-n*i;return c?(c=1/c,t[0]=o*c,t[1]=-n*c,t[2]=-i*c,t[3]=r*c,t[4]=(i*s-o*a)*c,t[5]=(n*a-r*s)*c,t):null}function l(t){return t[0]*t[3]-t[1]*t[2]}function f(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],u=r[0],l=r[1],f=r[2],h=r[3],p=r[4],d=r[5];return t[0]=n*u+o*l,t[1]=i*u+a*l,t[2]=n*f+o*h,t[3]=i*f+a*h,t[4]=n*p+o*d+s,t[5]=i*p+a*d+c,t}function h(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],u=Math.sin(r),l=Math.cos(r);return t[0]=n*l+o*u,t[1]=i*l+a*u,t[2]=n*-u+o*l,t[3]=i*-u+a*l,t[4]=s,t[5]=c,t}function p(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],u=r[0],l=r[1];return t[0]=n*u,t[1]=i*u,t[2]=o*l,t[3]=a*l,t[4]=s,t[5]=c,t}function d(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],u=r[0],l=r[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=n*u+o*l+s,t[5]=i*u+a*l+c,t}function _(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=0,t[5]=0,t}function v(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t}function y(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function b(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function m(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)}function g(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t}function w(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t}function x(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t}function O(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t}function k(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]}function S(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],c=e[0],u=e[1],l=e[2],f=e[3],h=e[4],p=e[5];return Math.abs(r-c)<=E.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(n-u)<=E.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(i-l)<=E.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-f)<=E.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(a-h)<=E.EPSILON*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(s-p)<=E.EPSILON*Math.max(1,Math.abs(s),Math.abs(p))}Object.defineProperty(e,"__esModule",{value:!0}),e.create=n,e.clone=i,e.copy=o,e.identity=a,e.fromValues=s,e.set=c,e.invert=u,e.determinant=l,e.multiply=f,e.rotate=h,e.scale=p,e.translate=d,e.fromRotation=_,e.fromScaling=v,e.fromTranslation=y,e.str=b,e.frob=m,e.add=g,e.subtract=w,e.multiplyScalar=x,e.multiplyScalarAndAdd=O,e.exactEquals=k,e.equals=S,r.d(e,"mul",function(){return M}),r.d(e,"sub",function(){return P});var E=r(1),M=f,P=w},function(t,e,r){"use strict";var n=(r(1),r(16));r(15),n.a,n.a,n.c,n.d,n.h},function(t,e,r){"use strict";function n(){var t=new z.ARRAY_TYPE(2);return z.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function i(t){var e=new z.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e}function o(t,e){var r=new z.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r}function a(t,e){return t[0]=e[0],t[1]=e[1],t}function s(t,e,r){return t[0]=e,t[1]=r,t}function c(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function u(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function l(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function f(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function h(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function p(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function d(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function _(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}function v(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function y(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function b(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t}function m(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)}function g(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n}function w(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)}function x(t){var e=t[0],r=t[1];return e*e+r*r}function O(t,e){return t[0]=-e[0],t[1]=-e[1],t}function k(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function S(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t}function E(t,e){return t[0]*e[0]+t[1]*e[1]}function M(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t}function P(t,e,r,n){var i=e[0],o=e[1];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t}function C(t,e){e=e||1;var r=2*z.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t}function j(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t}function D(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t}function A(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t}function I(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t}function T(t,e,r,n){var i=e[0]-r[0],o=e[1]-r[1],a=Math.sin(n),s=Math.cos(n);return t[0]=i*s-o*a+r[0],t[1]=i*a+o*s+r[1],t}function F(t,e){var r=t[0],n=t[1],i=e[0],o=e[1],a=r*r+n*n;a>0&&(a=1/Math.sqrt(a));var s=i*i+o*o;s>0&&(s=1/Math.sqrt(s));var c=(r*i+n*o)*a*s;return c>1?0:c<-1?Math.PI:Math.acos(c)}function R(t){return"vec2("+t[0]+", "+t[1]+")"}function B(t,e){return t[0]===e[0]&&t[1]===e[1]}function V(t,e){var r=t[0],n=t[1],i=e[0],o=e[1];return Math.abs(r-i)<=z.EPSILON*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-o)<=z.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))}Object.defineProperty(e,"__esModule",{value:!0}),e.create=n,e.clone=i,e.fromValues=o,e.copy=a,e.set=s,e.add=c,e.subtract=u,e.multiply=l,e.divide=f,e.ceil=h,e.floor=p,e.min=d,e.max=_,e.round=v,e.scale=y,e.scaleAndAdd=b,e.distance=m,e.squaredDistance=g,e.length=w,e.squaredLength=x,e.negate=O,e.inverse=k,e.normalize=S,e.dot=E,e.cross=M,e.lerp=P,e.random=C,e.transformMat2=j,e.transformMat2d=D,e.transformMat3=A,e.transformMat4=I,e.rotate=T,e.angle=F,e.str=R,e.exactEquals=B,e.equals=V,r.d(e,"len",function(){return N}),r.d(e,"sub",function(){return L}),r.d(e,"mul",function(){return X}),r.d(e,"div",function(){return W}),r.d(e,"dist",function(){return q}),r.d(e,"sqrDist",function(){return Y}),r.d(e,"sqrLen",function(){return H}),r.d(e,"forEach",function(){return J});var z=r(1),N=w,L=u,X=l,W=f,q=m,Y=g,H=x,J=function(){var t=n();return function(e,r,n,i,o,a){var s=void 0,c=void 0;for(r||(r=2),n||(n=0),c=i?Math.min(i*r+n,e.length):e.length,s=n;s=0&&i<=t.clientWidth&&(o=r-n.top-t.clientTop)>=0&&o<=t.clientHeight}function y(t,e,r){var n=e.getBoundingClientRect();t[0]=r.clientX-n.left-e.clientLeft,t[1]=r.clientY-n.top-e.clientTop}function b(t,e,r,n,i,o){y(t,r,n),j.transformMat2d(e,t,o.screenToWorldMatrix);var a=i.shape;a instanceof R.a?C.a(a,i,t,e,o):a instanceof F.a?C.c(a,i,t,e,o):C.b(a,i,t,e,o)}function m(t,e){e.keys={altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey}}function g(t){var e=[];return t.forEach(function(t,r){e.push(r)}),e}function w(t,e,r,n,i,o){var a={unselectedShapes:g(r)};x(r),t.save();var s=e[e.length-1].zIndex;t.zIndex=s+1,D.a.copyBasicStyle(n,t),t.selected=!0;var c=null;return(o.scalable||o.rotatable)&&(c=new R.a(i||L,o),t.addChildXform(c)),r.set(t,c),a.selectedShapes=[t],a}function x(t){t.forEach(function(t,e){e.restore(),e.selected=!1,e.removeChildXform(t)}),t.clear()}function O(t,e){var r=[];return e.forEach(function(e){var n=t.get(e);e.restore(),e.selected=!1,e.removeChildXform(n),t.delete(e),r.push(e)}),r}function k(t,e){var r=document.querySelector("".concat("#".concat(e.id," canvas")));return{x:t.offsetX+r.offsetLeft,y:t.offsetY+r.offsetTop}}function S(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:N.SVG_OFFSET,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:N.SVG_OFFSET,o=document.getElementById("cursor"),a=k(t,e);if(null===o){var s=document.createElement("span");s.setAttribute("id","cursor"),s.setAttribute("style","position: absolute; top: ".concat("".concat(a.y,"px"),"; left: ","".concat(a.x,"px"),"; width: 28px; height: 28px; background: ",r,"; cursor: none; z-index: 10; pointer-events: none; transform: translate(").concat(n,"px, ").concat(i,"px)")),e.appendChild(s)}else o.style.background===r?P(t,e):(o.style.background=r,P(t,e))}function E(){var t=document.getElementById("cursor");null!==t&&t.parentNode.removeChild(t)}function M(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t.style.cursor=e;for(var i=0;i=0;n-=1){var a=this._objects.get(r[n]);if(r[n].selected){i=this._selectedShapes.get(r[n]),o=a;var s=null;if(i&&(s=i.containsPoint(this._tmp_pt1,this._tmp_pt2,e,this._drawCtx)).hit){if(i instanceof F.a&&t.altKey&&s.controlIndex canvas")));null===f?(this._parent.addEventListener("mouseout",X),this._parent.addEventListener("mouseover",W)):(f.addEventListener("mouseout",q),f.addEventListener("mouseover",Y)),!this._dragInfo&&o.movable&&(this._dragInfo={startLocalPos:i.getPosition()}),this._dragInfo&&(this._dragInfo.shape=i,this._dragInfo.startPos=j.clone(this._tmp_pt1),this._dragInfo.startWorldPos=j.clone(this._tmp_pt2),this._dragInfo.objectToWorldMatrix=I.a.clone(i.globalXform),m(t,this._dragInfo),t.stopImmediatePropagation(),this.fire(z.DRAG_BEGIN,{dragInfo:{currentPos:j.clone(this._tmp_pt1),currentWorldPos:j.clone(this._tmp_pt2)},shapes:g(this._selectedShapes)})),t.preventDefault()}}}},{key:"_mouseupCB",value:function(t){if(j.set(this._tmp_pt1,t.offsetX,t.offsetY),j.transformMat2d(this._tmp_pt2,this._tmp_pt1,this._camera.screenToWorldMatrix),this._dragInfo&&this._dragInfo.shape){t.stopImmediatePropagation(),t.preventDefault();var e=document.querySelector("".concat("#".concat(this._parent.id," > canvas")));null===e?(this._parent.removeEventListener("mouseout",X),this._parent.removeEventListener("mouseover",W)):(e.removeEventListener("mouseout",q),e.removeEventListener("mouseover",Y)),this._dragInfo=null,this.fire(z.DRAG_END,{dragInfo:{currentPos:j.clone(this._tmp_pt1),currentWorldPos:j.clone(this._tmp_pt2)},shapes:g(this._selectedShapes)})}else if(performance.now()-this.timer=0;a-=1)if(o=this._objects.get(n[a]),o.selectable&&n[a].containsPoint(this._tmp_pt1,this._tmp_pt2,r,this._drawCtx)){i=n[a];break}if(i&&!i.selected){var s=w(i,n,this._selectedShapes,this._selectStyle,this._xformStyle,o);this.fire(z.SELECTION_CHANGED,s)}}}},{key:"_mousemoveCB",value:function(t){if(v(this._drawCanvas,t.clientX,t.clientY)||this._dragInfo)if(this._dragInfo&&this._dragInfo.shape)P(t,this._parent),m(t,this._dragInfo),b(this._tmp_pt1,this._tmp_pt2,this._drawCanvas,t,this._dragInfo,this._camera),t.stopImmediatePropagation(),t.preventDefault();else if(!t.buttons&&this._selectedShapes.size){j.set(this._tmp_pt1,t.offsetX,t.offsetY),j.transformMat2d(this._tmp_pt2,this._tmp_pt1,this._camera.screenToWorldMatrix);var e=this._camera.worldToScreenMatrix,r=this.sortedShapes,n=0,i=this._camera.isYFlipped();for(n=r.length-1;n>=0;n-=1)if(r[n].selected){var o=this._objects.get(r[n]),a=this._selectedShapes.get(r[n]),s=null;if(M(this._parent,"none","none",!1),a&&(s=a.containsPoint(this._tmp_pt1,this._tmp_pt2,e,this._drawCtx)).hit){if(a instanceof R.a)if(s.rotate){var c=r[n].getRotation();i?(c*=-1,1===s.controlIndex?c-=N.RIGHT_ANGLE:0===s.controlIndex?c+=N.STRAIGHT_ANGLE:2===s.controlIndex&&(c+=N.RIGHT_ANGLE)):0===s.controlIndex?c-=N.RIGHT_ANGLE:1===s.controlIndex?c+=N.STRAIGHT_ANGLE:3===s.controlIndex&&(c+=N.RIGHT_ANGLE),S(t,this._parent,"".concat(V.replace(//g,"".concat(c))))}else s.controlIndex<4?0===s.controlIndex||3===s.controlIndex?S(t,this._parent,"".concat(B.replace(//g,"".concat(-r[n].getRotation()-N.FORTY_FIVE_ANGLE)))):1!==s.controlIndex&&2!==s.controlIndex||S(t,this._parent,"".concat(B.replace(//g,"".concat(-r[n].getRotation()+N.FORTY_FIVE_ANGLE)))):s.controlIndex%2==0?S(t,this._parent,"".concat(B.replace(//g,"".concat(-r[n].getRotation())))):S(t,this._parent,"".concat(B.replace(//g,"".concat(-r[n].getRotation()+N.RIGHT_ANGLE))));else a instanceof F.a&&(M(this._parent,"none","none",!1),s.controlIndex>=r[n].numVerts?S(t,this._parent,"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpolygon style='fill:%23ffffff;' points='31.2,28 24.8,28 24.8,32.8 20,32.8 20,39.2 24.8,39.2 24.8,44 31.2,44 31.2,39.2 36,39.2 36,32.8 31.2,32.8 '/%3E %3Cpolygon style='fill:%23ffffff' points='12,32 12,4 32.3,24.3 20,24.3 19.7,24.6 '/%3E%3Cpolygon points='13.8,8.2 13.8,27.8 19,22.8 19.2,22.5 28,22.5 '/%3E%3Cpolyline points='29.6,29.6 29.6,34.4 34.4,34.4 34.4,37.6 29.6,37.6 29.6,42.4 26.4,42.4 26.4,37.6 21.6,37.6 21.6,34.4 26.4,34.4 26.4,29.6 29.6,29.6 '/%3E%3C/svg%3E\") no-repeat",-8,-6):t.altKey?S(t,this._parent,"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect style='fill:%23ffffff;' x='20' y='32.8' width='16' height='6.4'/%3E%3Cpolygon style='fill:%23ffffff;' points='12,32 12,4 32.3,24.3 20,24.3 19.7,24.6 '/%3E%3Cpolygon points='13.8,8.2 13.8,27.8 19,22.8 19.2,22.5 28,22.5 '/%3E%3Cpolyline points='34.4,34.4 34.4,37.6 21.6,37.6 21.6,34.4 '/%3E%3C/svg%3E\") no-repeat",-8,-6):S(t,this._parent,"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath style='fill:%23ffffff;' d='M24,17.5c-3.6,0-6.5,2.9-6.5,6.5s2.9,6.5,6.5,6.5s6.5-2.9,6.5-6.5S27.6,17.5,24,17.5L24,17.5z'/%3E%3Cpath style='fill:%23ffffff;' d='M24,4L4,24l20,20l20-20L24,4z M31.5,31.5h-15v-15h15V31.5z'/%3E%3Cpolygon points='17,34 24,40.5 31,34 '/%3E%3Cpolygon points='31,14 24,7.5 17,14 '/%3E%3Cpolygon points='14,17 7.5,24 14,31 '/%3E%3Cpolygon points='34,31 40.5,24 34,17 '/%3E%3Cpath d='M24,20c2.2,0,4,1.8,4,4s-1.8,4-4,4s-4-1.8-4-4S21.8,20,24,20'/%3E%3C/svg%3E\") no-repeat",N.SVG_OFFSET,N.SVG_OFFSET));t.stopImmediatePropagation(),t.preventDefault();break}if(r[n].containsPoint(this._tmp_pt1,this._tmp_pt2,e,this._drawCtx)){if(o&&o.movable){var u=document.getElementById("cursor");null!==u&&u.parentNode.removeChild(u),M(this._parent,"move",null),t.stopImmediatePropagation(),t.preventDefault()}break}}n<0&&(E(),M(this._parent,"default","auto",!1))}}},{key:"_clickCB",value:function(){}},{key:"_dblclickCB",value:function(t){if(v(this._drawCanvas,t.clientX,t.clientY)){j.set(this._tmp_pt1,t.offsetX,t.offsetY),j.transformMat2d(this._tmp_pt2,this._tmp_pt1,this._camera.screenToWorldMatrix);var e=this._camera.worldToScreenMatrix,r=this.sortedShapes,n=-1;for(n=r.length-1;n>=0;n-=1){var i=this._objects.get(r[n]);if(i.selectable&&r[n].containsPoint(this._tmp_pt1,this._tmp_pt2,e,this._drawCtx)){if(i.editable&&r[n]instanceof T.a){var o=r[n],a=!1;if(r[n].selected){var s=this._selectedShapes.get(r[n]);s&&(o.restore(),o.removeChildXform(s),a=!(s instanceof R.a))}o.selected=!0,o.save();var c=r[r.length-1].zIndex;o.zIndex=c+1,D.a.copyBasicStyle(this._selectStyle,o);var u=null;a?(i.rotatable||i.scalable)&&(u=new R.a(this._xformStyle||L,i),o.addChildXform(u)):(u=new F.a(o,this._xformStyle),o.addChildXform(u)),this._selectedShapes.set(o,u)}else if(!r[n].selected){var l=w(r[n],r,this._selectedShapes,this._selectStyle,this._xformStyle,i);this.fire(z.SELECTION_CHANGED,l)}break}}n<0&&this._selectedShapes.size?(this._selectedShapes.size&&this.fire(z.SELECTION_CHANGED,{unselectedShapes:g(this._selectedShapes),selectedShapes:[]}),this._dragInfo=null,x(this._selectedShapes),E(),M(this._parent,"default","auto",!1)):t.stopImmediatePropagation(),t.preventDefault()}}},{key:"_mouseoverCB",value:function(){}},{key:"_mouseoutCB",value:function(){}},{key:"_init",value:function(t,r){this._activated=r&&r.enableInteractions,s(_(e.prototype),"_init",this).call(this,t,r,this._activated);var n=Object.getOwnPropertyNames(z).map(function(t){return z[t]});this.registerEvents(n),this._dragInfo=null,this._selectedShapes=new Map,this._selectStyle=new D.a(r&&r.selectStyle?r.selectStyle:{fillColor:"orange"}),this._xformStyle=new D.a(r&&r.xformStyle?r.xformStyle:{fillColor:"white",strokeColor:"black",strokeWidth:2}),this.timer=0}},{key:"_renderShapes",value:function(t,e,r){var n=this,i=r.worldToScreenMatrix;e.forEach(function(e){if(e.visible&&(e.render(t,i,n._styleState),e.selected)){var r=n._selectedShapes.get(e);r&&r.render(t,i,n._styleState)}})}},{key:"selectStyle",get:function(){return this._selectStyle},set:function(t){D.a.copyBasicStyle(t,this._selectStyle)}},{key:"selectedShapes",get:function(){return g(this._selectedShapes)}},{key:"selectShape",value:function(t){var e=this._objects.get(t);if(e&&e.selectable){var r=w(t,this.sortedShapes,this._selectedShapes,this._selectStyle,this._xformStyle,e);this.fire(z.SELECTION_CHANGED,r)}}},{key:"clearSelection",value:function(){if(this._selectedShapes.size){var t=g(this._selectedShapes);x(this._selectedShapes),this.fire(z.SELECTION_CHANGED,{unselectedShapes:t,selectedShapes:[]}),this._rerenderCb()}}},{key:"addShape",value:function(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=t;if(Array.isArray(o)||(o=[t]),s(_(e.prototype),"addShape",this).call(this,o),o.forEach(function(t){var e=r._objects.get(t);e&&(e.selectable=!n||void 0===n.selectable||Boolean(n.selectable),e.movable=!n||void 0===n.movable||Boolean(n.movable),e.rotatable=!n||void 0===n.rotatable||Boolean(n.rotatable),e.scalable=!n||void 0===n.scalable||Boolean(n.scalable),e.uniformScaleOnly=!(!n||void 0===n.uniformScaleOnly)&&Boolean(n.uniformScaleOnly),e.centerScaleOnly=!(!n||void 0===n.centerScaleOnly)&&Boolean(n.centerScaleOnly),e.editable=!n||void 0===n.editable||Boolean(n.editable))}),i){var a={unselectedShapes:g(this._selectedShapes)},c=[];o.forEach(function(t){var e=r._objects.get(t);e.selectable&&(w(t,r.sortedShapes,r._selectedShapes,r._selectStyle,r._xformStyle,e),c.push(t))}),c.length&&(a.selectedShapes=c,this.fire(z.SELECTION_CHANGED,a))}return this}},{key:"deleteShape",value:function(t){var r=t;Array.isArray(r)||(r=[t]);var n=O(this._selectedShapes,r);return this.fire(z.SELECTION_CHANGED,{unselectedShapes:n,selectedShapes:g(this._selectedShapes)}),E(),M(this._parent,"default","auto",!0),s(_(e.prototype),"deleteShape",this).call(this,r)}},{key:"deleteSelectedShapes",value:function(){var t=g(this._selectedShapes);return x(this._selectedShapes),this.fire(z.SELECTION_CHANGED,{unselectedShapes:t,selectedShapes:[]}),E(),M(this._parent,"default","auto",!0),s(_(e.prototype),"deleteShape",this).call(this,t)}},{key:"interactionsEnabled",get:function(){return this._activated}},{key:"enableInteractions",value:function(){return this._enableEvents(),this._activated=!0,this}},{key:"disableInteractions",value:function(){return(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&this.clearSelection(),this._disableEvents(),this._activated=!1,this}}]),e}(A.a);Object.assign(z,A.a.EventConstants),H.EventConstants=z},function(t,e,r){"use strict";function n(t,e,r,n,i){var o=s.create(),a=u.a.create();c.a.svd(o,a,null,r.objectToWorldMatrix);var l=u.a.create();s.sub(l,r.startWorldPos,o),u.a.normalize(l,l);var f=o;s.sub(f,i,o),u.a.normalize(f,f);var h=u.a.angle(l,f);r.keys.shiftKey&&(h=Math.round(h/Math.QUATER_PI)*Math.QUATER_PI),e.setRotation(r.startLocalRot+Math.RAD_TO_DEG*h)}function i(t,e,r,i,o){var a=t.parent,l=s.create(),f=s.create(),h=s.create();if(e.rotate)return void n(t,a,e,r,i,o);var p=e.keys.shiftKey||e.uniformScaleOnly,d=e.keys.altKey||e.centerScaleOnly,_=s.create();if(c.a.svd(_,null,null,e.objectToWorldMatrix),u.a.sub(f,i,e.startWorldPos),p&&e.controlIndex<4){var v=[e.objectToWorldMatrix[0],e.objectToWorldMatrix[1]],y=[e.objectToWorldMatrix[2],e.objectToWorldMatrix[3]],b=u.a.create();e.controlIndex<2&&u.a.negate(v,v),e.controlIndex%2==0&&u.a.negate(y,y),u.a.normalize(v,v),u.a.normalize(y,y),u.a.add(b,v,y),u.a.normalize(b,b);var m=u.a.cross2d(f,b),g=null;0===e.controlIndex||3===e.controlIndex?(g=y,m<0&&(g=v)):(g=v,m<0&&(g=y));var w=u.a.dot(f,g);w=Math.sign(w)*Math.sqrt(2*w*w),u.a.scale(f,b,w),s.addVec2(i,e.startWorldPos,f)}s.copy(l,i),s.transformMat2d(l,l,e.worldToObjectMatrix),u.a.sub(h,l,e.startObjectPos),s.copy(_,e.startLocalPos);var x=0,O=0;if(e.controlIndex<4)x=e.controlIndex<2?-1:1,O=e.controlIndex%2==0?-1:1,d||s.addVec2(_,_,u.a.scale(f,f,.5)),a.setPosition(_);else{var k=e.controlIndex-4,S=u.a.create();k%2==0?(u.a.set(S,e.objectToWorldMatrix[0],e.objectToWorldMatrix[1]),O=0,x=k<2?-1:1,p&&(O=x,h[1]=h[0])):(u.a.set(S,e.objectToWorldMatrix[2],e.objectToWorldMatrix[3]),x=0,O=k<2?-1:1,p&&(x=O,h[0]=h[1])),d||(u.a.normalize(S,S),u.a.scale(S,S,u.a.dot(f,S)),s.addVec2(_,_,u.a.scale(S,S,.5))),a.setPosition(_)}d&&(x*=2,O*=2),a.setScale([e.startLocalScale[0]*(1+x*h[0]/e.shapeWidth),e.startLocalScale[1]*(1+O*h[1]/e.shapeHeight)])}function o(t,e,r,n,i){var o=u.a.create(),a=s.create();if(c.a.svd(a,null,null,e.objectToWorldMatrix),e.keys.shiftKey){s.sub(o,r,e.startPos);var l=Math.atan2(o[1],o[0]);l=Math.round(l/Math.QUATER_PI)*Math.QUATER_PI;var f=[Math.cos(l),Math.sin(l)];u.a.scale(o,f,u.a.dot(o,f)),u.a.transformMat2(o,o,i.screenToWorldMatrix)}else u.a.sub(o,n,e.startWorldPos);s.addVec2(a,e.startLocalPos,o),t.setPosition(a)}function a(t,e,r,n){var i=t.parent,o=i.numVerts;if(e.controlIndex>=o){var a=Math.min(e.controlIndex-o,o-1),c=a===o-1?0:a+1,l=s.create(),f=s.create(),h=s.create(),p=u.a.create(),d=i.vertsRef,_=i.globalXform;s.transformMat2d(f,d[a],_),s.transformMat2d(h,d[c],_),s.sub(p,h,f),u.a.scale(p,p,.5),s.addVec2(l,f,p),e.controlIndex=i.insertVert(a+1,l)}else i.setVertPosition(e.controlIndex,n)}e.a=i,e.b=o,e.c=a;var s=r(0),c=r(2),u=r(3)},function(t,e,r){"use strict";function n(t){var e=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/e}function i(t){var e=n(t);if(1===e)return 1;["fillRect","clearRect","strokeRect","isPointInPath","isPointInStroke"].forEach(function(r){t[r]=function(t){return function(){for(var r=arguments.length,n=new Array(r),i=0;i2&&void 0!==arguments[2]&&arguments[2];return i(this,e),o=r.call(this,["changed","changed:xform"]),o._viewport=d.clone(t),o._projectionDimensions=v.a.clone(n),o._yflip=a,o._screenMatrix=y.a.create(),o._screenDirty=!0,o}s(e,t);var r=u(e);return a(e,[{key:"isYFlipped",value:function(){return this._yflip}},{key:"viewport",get:function(){return d.clone(this._viewport)},set:function(t){if(!d.equals(t,this._viewport)){var e=d.clone(this._viewport);d.copy(this._viewport,t),this._screenDirty=!0,this._worldToScreenOutdated=!0,this.fire("changed",{attr:"viewport",prevVal:e,currVal:t})}return this}},{key:"viewportRef",get:function(){return this._viewport}},{key:"screenMatrix",get:function(){if(this._screenDirty){var t=_.create(),e=v.a.create();d.getCenter(t,this._viewport),d.getExtents(e,this._viewport),y.a.set(this._screenMatrix,e[0],0,0,e[1],t[0],t[1]),this._worldToScreenOutdated=!0,this._screenDirty=!1}return this._screenMatrix}}]),e}(g.a),x=function(t){function e(t,n,o){var a;return i(this,e),a=r.call(this,t,n,o),a._viewMatrix=y.a.create(),a._viewDirty=!0,a._projMatrix=y.a.create(),a._projDirty=!0,a}s(e,t);var r=u(e);return a(e,[{key:"projectionDimensions",get:function(){return v.a.clone(this._projectionDimensions)},set:function(t){if(!v.a.equals(t,this._projectionDimensions)){var e=v.a.clone(this._projectionDimensions);d.copy(this._projectionDimensions,t),this._viewDirty=!0,this._projDirty=!0,this.fire("changed",{attr:"projectionDimensions",prevVal:e,currVal:t})}return this}},{key:"projectionDimensionsRef",get:function(){return this._projectionDimensions}},{key:"_localXformUpdated",value:function(){this._boundsOutOfDate=!0}},{key:"_globalXformUpdated",value:function(){this._boundsOutOfDate=!0}},{key:"viewMatrix",get:function(){if(this._viewDirty||this._boundsOutOfDate||this._xformDirty||this._lxformDirty){var t=_.create(),e=v.a.create(),r=v.a.create(),n=this.globalXform;y.a.svd(t,e,r,n),y.a.fromTranslation(this._viewMatrix,v.a.negate(t,t)),y.a.rotate(this._viewMatrix,this._viewMatrix,-r[0]),y.a.scale(this._viewMatrix,this._viewMatrix,e),y.a.rotate(this._viewMatrix,this._viewMatrix,-r[1]),this._worldToScreenOutdated=!0,this._viewDirty=!1}return this._viewMatrix}},{key:"projMatrix",get:function(){if(this._projDirty){var t=this._yflip?-1:1;y.a.set(this._projMatrix,2/this._projectionDimensions[0],0,0,2*t/this._projectionDimensions[1],0,0),this._worldToScreenOutdated=!0,this._projDirty=!1}return this._projMatrix}},{key:"_matricesDirty",value:function(){return this._boundsOutOfDate||this._lxformDirty||this._xformDirty||this._viewDirty||this._projDirty||this._screenDirty}},{key:"worldToScreenMatrix",get:function(){return(!this._worldToScreenMatrix||this._worldToScreenOutdated||this._matricesDirty())&&(this._worldToScreenMatrix||(this._worldToScreenMatrix=y.a.create()),y.a.copy(this._worldToScreenMatrix,this.viewMatrix),y.a.multiply(this._worldToScreenMatrix,this.projMatrix,this._worldToScreenMatrix),y.a.multiply(this._worldToScreenMatrix,this.screenMatrix,this._worldToScreenMatrix),this._worldToScreenOutdated=!1,this._screenToWorldOutdated=!0),this._worldToScreenMatrix}},{key:"screenToWorldMatrix",get:function(){return(!this._screenToWorld||this._screenToWorldOutdated||this._matricesDirty())&&(this._screenToWorld||(this._screenToWorld=y.a.create()),y.a.copy(this._screenToWorld,this.worldToScreenMatrix),y.a.invert(this._screenToWorld,this._screenToWorld),this._screenToWorldOutdated=!1),this._screenToWorld}},{key:"worldViewBounds",get:function(){var t=this.viewport;return d.transformMat2d(t,t,this.screenToWorldMatrix),t}}]),e}(Object(b.a)(w,Object(m.b)("changed:xform")))},function(t,e,r){var n,i;!function(o,a){n=a,void 0!==(i="function"==typeof n?n.call(e,r,e,t):n)&&(t.exports=i)}(0,function(){function t(t,e){var r=Object.prototype.toString.call(t),n="[object Array]"===r||"[object NodeList]"===r||"[object HTMLCollection]"===r||"[object Object]"===r||"undefined"!=typeof jQuery&&t instanceof jQuery||"undefined"!=typeof Elements&&t instanceof Elements,i=0,o=t.length;if(n)for(;i
',t.appendChild(t.resizeSensor),"static"==a(t,"position")&&(t.style.position="relative");var s,c,u,l,f=t.resizeSensor.childNodes[0],h=f.childNodes[0],p=t.resizeSensor.childNodes[1],d=t.offsetWidth,_=t.offsetHeight,v=function(){h.style.width="100000px",h.style.height="100000px",f.scrollLeft=1e5,f.scrollTop=1e5,p.scrollLeft=1e5,p.scrollTop=1e5};v();var y=function(){c=0,s&&(d=u,_=l,t.resizedAttached&&t.resizedAttached.call())},b=function(){u=t.offsetWidth,l=t.offsetHeight,s=u!=d||l!=_,s&&!c&&(c=e(y)),v()},m=function(t,e,r){t.attachEvent?t.attachEvent("on"+e,r):t.addEventListener(e,r)};m(f,"scroll",b),m(p,"scroll",b)}t(n,function(t){s(t,i)}),this.detach=function(t){r.detach(n,t)}};return r.detach=function(e,r){t(e,function(t){t.resizedAttached&&"function"==typeof r&&(t.resizedAttached.remove(r),t.resizedAttached.length())||t.resizeSensor&&(t.contains(t.resizeSensor)&&t.removeChild(t.resizeSensor),delete t.resizeSensor,delete t.resizedAttached)})},r})},function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r0&&c===this._transformedVerts.length-1&&(_.sub(l,this._transformedVerts[0],this._transformedVerts[c]),y.a.scale(l,l,.5),_.addVec2(u,this._transformedVerts[c],l),d.initCenterExtents(o,u,s),d.containsPt(o,t)&&(i.hit=!0,i.controlIndex=this._transformedVerts.length+c))}}return i}},{key:"renderBounds",value:function(t,e,r){this._updateAABox(e),t.save(),t.setTransform(1,0,0,1,0,0),r.setStrokeCtx(t);var n=_.create(),i=y.a.create();d.getCenter(n,this._aabox),d.getExtents(i,this._aabox),t.beginPath(),t.rect(n[0]-i[0],n[1]-i[1],2*i[0],2*i[1]),t.stroke(),t.restore()}},{key:"render",value:function(t){var e=this;t.save(),t.setTransform(1,0,0,1,0,0);var r=this._baseVertShape._fullXform,n=this._baseVertShape.vertsRef;this._transformedVerts=new Array(n.length);var i=_.create(),o=y.a.create();t.beginPath();var a=0;this._transformedVerts[a]=_.create(),_.transformMat2d(this._transformedVerts[a],n[a],r);var s=Math.max(1.5*t.lineWidth,2.5);for(a=0;a0&&(_.sub(o,this._transformedVerts[0],this._transformedVerts[a]),y.a.scale(o,o,.5),_.addVec2(i,this._transformedVerts[a],o),t.moveTo(i[0]+s,i[1]),t.arc(i[0],i[1],s,0,Math.TWO_PI),t.fillStyle=t.strokeStyle,t.fill()),t.beginPath(),this._transformedVerts.forEach(function(r){t.moveTo(r[0]+e._vertRadius,r[1]),t.arc(r[0],r[1],e._vertRadius,0,Math.TWO_PI)}),this.isFillVisible()&&(this.setFillCtx(t),t.fill()),this.isStrokeVisible()&&(this.setStrokeCtx(t),t.stroke()),t.restore()}}]),e}(b.a)},function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r-i&&h<=a&&(p=u*e[1])>-i&&p<=a))&&(l=!0)}return{hit:l,rotate:f}}r.d(e,"a",function(){return S});var b=r(4),m=r(0),g=r(11),w=r(2),x=r(24),O=r(3),k={SIDES:4},S=function(t){function e(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{scalable:!0,rotatable:!0};return i(this,e),n=r.call(this,t),n._interactiveBoxSize=8,n._interactiveBoxPadding=10,t&&void 0!==t.vertexSize&&(n._interactiveBoxSize=t.vertexSize),n._scalable=!0,n._rotatable=!0,o&&(void 0!==o.scalable&&(n._scalable=Boolean(o.scalable)),void 0!==o.rotatable&&(n._rotatable=Boolean(o.rotatable))),n}u(e,t);var r=f(e);return a(e,[{key:"containsPoint",value:function(t){var e={hit:!1,rotate:!1,controlIndex:-1},r=this.aabox;if((this._rotatable||this._scalable)&&this.visible&&b.containsPt(r,t)){var n=O.a.create(),i=O.a.create();w.a.svd(null,n,i,this._fullXform);var o=w.a.create();n[0]=n[0]<0?-1:1,n[1]=n[1]<0?-1:1,n[0]*n[1]>0&&O.a.negate(i,i),w.a.rotate(o,o,i[1]),w.a.scale(o,o,n),w.a.rotate(o,o,i[0]);for(var a=this._rotatable?this._interactiveBoxPadding:0,s=this._interactiveBoxSize/2,c=this.width/2,u=this.height/2,l=m.create(),f=s+a,h=Math.sqrt(2*f*f),p=0,d=0,_=0;_0&&void 0!==arguments[0]&&arguments[0]||this._geomDirty||this._boundsOutOfDate){var t=this._rotatable?this._interactiveBoxPadding:0,e=t+this._interactiveBoxSize/2;b.initCenterExtents(this._aabox,m.create(0,0),[this.width/2,this.height/2]),b.transformMat2d(this._aabox,this._aabox,this._fullXform),b.expand(this._aabox,this._aabox,[e,e]),this._aaboxUpdated=!0,this._geomDirty=this._boundsOutOfDate=!1}}},{key:"width",get:function(){return this.parent&&"undefined"!==this.parent.width?this.parent.width:0}},{key:"height",get:function(){return this.parent&&"undefined"!==this.parent.height?this.parent.height:0}},{key:"renderBounds",value:function(t,e,r){var n=this.aabox;t.save(),t.setTransform(1,0,0,1,0,0),r.setStrokeCtx(t);var i=m.create(),o=O.a.create();b.getCenter(i,n),b.getExtents(o,n),t.beginPath(),t.rect(i[0]-o[0],i[1]-o[1],2*o[0],2*o[1]),t.stroke(),t.restore()}},{key:"render",value:function(t,r,n){if(this.parent&&void 0!==this.parent.width&&"undefined"!==this.parent.height){this._aaboxUpdated=!1,s(_(e.prototype),"render",this).call(this,t,r,n,!1),this._aaboxUpdated||this._updateAABox(!0);var i=O.a.create(),o=O.a.create();w.a.svd(null,i,o,this._fullXform),i[0]=i[0]<0?-1:1,i[1]=i[1]<0?-1:1;var a=this._interactiveBoxSize/2,c=this.width/2,u=this.height/2,l=[c,u];t.save(),t.beginPath(),v(t,l,this._fullXform,this._interactiveBoxSize,a,o,i),m.set(l,c,-u),v(t,l,this._fullXform,this._interactiveBoxSize,a,o,i),m.set(l,-c,-u),v(t,l,this._fullXform,this._interactiveBoxSize,a,o,i),m.set(l,-c,u),v(t,l,this._fullXform,this._interactiveBoxSize,a,o,i),this._scalable&&(m.set(l,0,u),v(t,l,this._fullXform,this._interactiveBoxSize,a,o,i),m.set(l,0,-u),v(t,l,this._fullXform,this._interactiveBoxSize,a,o,i),m.set(l,c,0),v(t,l,this._fullXform,this._interactiveBoxSize,a,o,i),m.set(l,-c,0),v(t,l,this._fullXform,this._interactiveBoxSize,a,o,i)),this.isFillVisible()&&(n.setFillStyle(t,this),t.fill()),this.isStrokeVisible()&&(n.setStrokeStyle(t,this),t.setTransform(1,0,0,1,0,0),t.stroke()),t.restore()}}}]),e}(x.a)},function(t,e,r){"use strict";var n=r(6),i=r(5);n.b.equals=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=t[0],o=t[1],a=t[2],s=t[3],c=e[0],u=e[1],l=e[2],f=e[3],h=null!==r?r:i.EPSILON;return Math.abs(n-c)<=h*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(o-u)<=h*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(a-l)<=h*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(s-f)<=h*Math.max(1,Math.abs(s),Math.abs(f))},e.a=n.b},function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r=b.MINIMUM_POINTS){t.setTransform(1,0,0,1,0,0);var r=y.create();y.transformMat2d(r,this._verts[0],this._fullXform),t.moveTo(r[0],r[1]);for(var n=1;n undefined - * typeof document -> undefined - * - * react-native: - * navigator.product -> 'ReactNative' - * nativescript - * navigator.product -> 'NativeScript' or 'NS' - */ -function isStandardBrowserEnv() { - if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || - navigator.product === 'NativeScript' || - navigator.product === 'NS')) { - return false; - } - return ( - typeof window !== 'undefined' && - typeof document !== 'undefined' - ); -} - -/** - * Iterate over an Array or an Object invoking a function for each item. - * - * If `obj` is an Array callback will be called passing - * the value, index, and complete array for each item. - * - * If 'obj' is an Object callback will be called passing - * the value, key, and complete object for each property. - * - * @param {Object|Array} obj The object to iterate - * @param {Function} fn The callback to invoke for each item - */ -function forEach(obj, fn) { - // Don't bother if no value provided - if (obj === null || typeof obj === 'undefined') { - return; - } - - // Force an array if not already something iterable - if (typeof obj !== 'object') { - /*eslint no-param-reassign:0*/ - obj = [obj]; - } - - if (isArray(obj)) { - // Iterate over array values - for (var i = 0, l = obj.length; i < l; i++) { - fn.call(null, obj[i], i, obj); - } - } else { - // Iterate over object keys - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - fn.call(null, obj[key], key, obj); - } - } - } -} - -/** - * Accepts varargs expecting each argument to be an object, then - * immutably merges the properties of each object and returns result. - * - * When multiple objects contain the same key the later object in - * the arguments list will take precedence. - * - * Example: - * - * ```js - * var result = merge({foo: 123}, {foo: 456}); - * console.log(result.foo); // outputs 456 - * ``` - * - * @param {Object} obj1 Object to merge - * @returns {Object} Result of all merge properties - */ -function merge(/* obj1, obj2, obj3, ... */) { - var result = {}; - function assignValue(val, key) { - if (typeof result[key] === 'object' && typeof val === 'object') { - result[key] = merge(result[key], val); - } else { - result[key] = val; - } - } - - for (var i = 0, l = arguments.length; i < l; i++) { - forEach(arguments[i], assignValue); - } - return result; -} - -/** - * Function equal to merge with the difference being that no reference - * to original objects is kept. - * - * @see merge - * @param {Object} obj1 Object to merge - * @returns {Object} Result of all merge properties - */ -function deepMerge(/* obj1, obj2, obj3, ... */) { - var result = {}; - function assignValue(val, key) { - if (typeof result[key] === 'object' && typeof val === 'object') { - result[key] = deepMerge(result[key], val); - } else if (typeof val === 'object') { - result[key] = deepMerge({}, val); - } else { - result[key] = val; - } - } - - for (var i = 0, l = arguments.length; i < l; i++) { - forEach(arguments[i], assignValue); - } - return result; -} - -/** - * Extends object a by mutably adding to it the properties of object b. - * - * @param {Object} a The object to be extended - * @param {Object} b The object to copy properties from - * @param {Object} thisArg The object to bind function to - * @return {Object} The resulting value of object a - */ -function extend(a, b, thisArg) { - forEach(b, function assignValue(val, key) { - if (thisArg && typeof val === 'function') { - a[key] = bind(val, thisArg); - } else { - a[key] = val; - } - }); - return a; -} - -module.exports = { - isArray: isArray, - isArrayBuffer: isArrayBuffer, - isBuffer: isBuffer, - isFormData: isFormData, - isArrayBufferView: isArrayBufferView, - isString: isString, - isNumber: isNumber, - isObject: isObject, - isUndefined: isUndefined, - isDate: isDate, - isFile: isFile, - isBlob: isBlob, - isFunction: isFunction, - isStream: isStream, - isURLSearchParams: isURLSearchParams, - isStandardBrowserEnv: isStandardBrowserEnv, - forEach: forEach, - merge: merge, - deepMerge: deepMerge, - extend: extend, - trim: trim -}; - - -/***/ }), -/* 12 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ScaleType; }); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -/* eslint-disable no-undef */ -var ScaleType = /*#__PURE__*/function () { - function ScaleType(value) { - _classCallCheck(this, ScaleType); - this.value = value; - ScaleType.val_to_enum_map_[this.value] = this; - } - _createClass(ScaleType, [{ - key: "valueOf", - value: function valueOf() { - return this.value; - } - }, { - key: "toString", - value: function toString() { - return this.value; - } - }], [{ - key: "getScaleTypeFromString", - value: - /** - * @private - */ - - /** - * @private - */ - - /** - * @param {string} scale_type - */ - function getScaleTypeFromString(scale_type) { - var rtn_obj = ScaleType.val_to_enum_map_[scale_type.toLowerCase()]; - if (typeof rtn_obj === "undefined") { - throw new Error("Invalid scale type '".concat(scale_type, "'. It must be one of ").concat(Object.keys(ScaleType.val_to_enum_map_))); - } - return rtn_obj; - } - }]); - return ScaleType; -}(); -_defineProperty(ScaleType, "val_to_enum_map_", {}); -_defineProperty(ScaleType, "kLinear", new ScaleType("linear")); -_defineProperty(ScaleType, "kPow", new ScaleType("pow")); -_defineProperty(ScaleType, "kSqrt", new ScaleType("sqrt")); -_defineProperty(ScaleType, "kLog", new ScaleType("log")); -_defineProperty(ScaleType, "kOrdinal", new ScaleType("ordinal")); -_defineProperty(ScaleType, "kQuantize", new ScaleType("quantize")); -_defineProperty(ScaleType, "kThreshold", new ScaleType("threshold")); -_defineProperty(ScaleType, "kInternalPassthru_", new ScaleType("internal-passthru")); - - -/***/ }), -/* 13 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return END_OF_FILE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DEFAULT_PARSER_CONFIG; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return DEFAULT_RULE_CONFIG; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return ParserDefinitionErrorType; }); -/* harmony export (immutable) */ __webpack_exports__["d"] = EMPTY_ALT; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return Parser; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CstParser; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return EmbeddedActionsParser; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_utils__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__grammar_follow__ = __webpack_require__(402); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__scan_tokens_public__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__cst_cst__ = __webpack_require__(68); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__errors_public__ = __webpack_require__(48); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__grammar_gast_gast_resolver_public__ = __webpack_require__(259); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__traits_recoverable__ = __webpack_require__(260); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__traits_looksahead__ = __webpack_require__(405); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__traits_tree_builder__ = __webpack_require__(406); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__traits_lexer_adapter__ = __webpack_require__(408); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__traits_recognizer_api__ = __webpack_require__(409); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__traits_recognizer_engine__ = __webpack_require__(410); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__traits_error_handler__ = __webpack_require__(411); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__traits_context_assist__ = __webpack_require__(412); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__traits_gast_recorder__ = __webpack_require__(413); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__traits_perf_tracer__ = __webpack_require__(414); -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); - - - - - - - - - - - - - - - - -var END_OF_FILE = Object(__WEBPACK_IMPORTED_MODULE_2__scan_tokens_public__["c" /* createTokenInstance */])(__WEBPACK_IMPORTED_MODULE_2__scan_tokens_public__["a" /* EOF */], "", NaN, NaN, NaN, NaN, NaN, NaN); -Object.freeze(END_OF_FILE); -var DEFAULT_PARSER_CONFIG = Object.freeze({ - recoveryEnabled: false, - maxLookahead: 4, - ignoredIssues: {}, - dynamicTokensEnabled: false, - outputCst: true, - errorMessageProvider: __WEBPACK_IMPORTED_MODULE_4__errors_public__["c" /* defaultParserErrorProvider */], - nodeLocationTracking: "none", - traceInitPerf: false, - skipValidations: false -}); -var DEFAULT_RULE_CONFIG = Object.freeze({ - recoveryValueFunc: function () { return undefined; }, - resyncEnabled: true -}); -var ParserDefinitionErrorType; -(function (ParserDefinitionErrorType) { - ParserDefinitionErrorType[ParserDefinitionErrorType["INVALID_RULE_NAME"] = 0] = "INVALID_RULE_NAME"; - ParserDefinitionErrorType[ParserDefinitionErrorType["DUPLICATE_RULE_NAME"] = 1] = "DUPLICATE_RULE_NAME"; - ParserDefinitionErrorType[ParserDefinitionErrorType["INVALID_RULE_OVERRIDE"] = 2] = "INVALID_RULE_OVERRIDE"; - ParserDefinitionErrorType[ParserDefinitionErrorType["DUPLICATE_PRODUCTIONS"] = 3] = "DUPLICATE_PRODUCTIONS"; - ParserDefinitionErrorType[ParserDefinitionErrorType["UNRESOLVED_SUBRULE_REF"] = 4] = "UNRESOLVED_SUBRULE_REF"; - ParserDefinitionErrorType[ParserDefinitionErrorType["LEFT_RECURSION"] = 5] = "LEFT_RECURSION"; - ParserDefinitionErrorType[ParserDefinitionErrorType["NONE_LAST_EMPTY_ALT"] = 6] = "NONE_LAST_EMPTY_ALT"; - ParserDefinitionErrorType[ParserDefinitionErrorType["AMBIGUOUS_ALTS"] = 7] = "AMBIGUOUS_ALTS"; - ParserDefinitionErrorType[ParserDefinitionErrorType["CONFLICT_TOKENS_RULES_NAMESPACE"] = 8] = "CONFLICT_TOKENS_RULES_NAMESPACE"; - ParserDefinitionErrorType[ParserDefinitionErrorType["INVALID_TOKEN_NAME"] = 9] = "INVALID_TOKEN_NAME"; - ParserDefinitionErrorType[ParserDefinitionErrorType["INVALID_NESTED_RULE_NAME"] = 10] = "INVALID_NESTED_RULE_NAME"; - ParserDefinitionErrorType[ParserDefinitionErrorType["DUPLICATE_NESTED_NAME"] = 11] = "DUPLICATE_NESTED_NAME"; - ParserDefinitionErrorType[ParserDefinitionErrorType["NO_NON_EMPTY_LOOKAHEAD"] = 12] = "NO_NON_EMPTY_LOOKAHEAD"; - ParserDefinitionErrorType[ParserDefinitionErrorType["AMBIGUOUS_PREFIX_ALTS"] = 13] = "AMBIGUOUS_PREFIX_ALTS"; - ParserDefinitionErrorType[ParserDefinitionErrorType["TOO_MANY_ALTS"] = 14] = "TOO_MANY_ALTS"; -})(ParserDefinitionErrorType || (ParserDefinitionErrorType = {})); -function EMPTY_ALT(value) { - if (value === void 0) { value = undefined; } - return function () { - return value; - }; -} -var Parser = /** @class */ (function () { - function Parser(tokenVocabulary, config) { - if (config === void 0) { config = DEFAULT_PARSER_CONFIG; } - this.ignoredIssues = DEFAULT_PARSER_CONFIG.ignoredIssues; - this.definitionErrors = []; - this.selfAnalysisDone = false; - var that = this; - that.initErrorHandler(config); - that.initLexerAdapter(); - that.initLooksAhead(config); - that.initRecognizerEngine(tokenVocabulary, config); - that.initRecoverable(config); - that.initTreeBuilder(config); - that.initContentAssist(); - that.initGastRecorder(config); - that.initPerformanceTracer(config); - /* istanbul ignore if - complete over-kill to test this, we should only add a test when we actually hard deprecate it and throw an error... */ - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, "ignoredIssues") && - config.ignoredIssues !== DEFAULT_PARSER_CONFIG.ignoredIssues) { - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["d" /* PRINT_WARNING */])("The IParserConfig property is soft-deprecated and will be removed in future versions.\n\t" + - "Please use the flag on the relevant DSL method instead."); - } - this.ignoredIssues = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, "ignoredIssues") - ? config.ignoredIssues - : DEFAULT_PARSER_CONFIG.ignoredIssues; - this.skipValidations = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, "skipValidations") - ? config.skipValidations - : DEFAULT_PARSER_CONFIG.skipValidations; - } - /** - * @deprecated use the **instance** method with the same name instead - */ - Parser.performSelfAnalysis = function (parserInstance) { - ; - parserInstance.performSelfAnalysis(); - }; - Parser.prototype.performSelfAnalysis = function () { - var _this = this; - this.TRACE_INIT("performSelfAnalysis", function () { - var defErrorsMsgs; - _this.selfAnalysisDone = true; - var className = _this.className; - _this.TRACE_INIT("toFastProps", function () { - // Without this voodoo magic the parser would be x3-x4 slower - // It seems it is better to invoke `toFastProperties` **before** - // Any manipulations of the `this` object done during the recording phase. - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["S" /* toFastProperties */])(_this); - }); - _this.TRACE_INIT("Grammar Recording", function () { - try { - _this.enableRecording(); - // Building the GAST - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["u" /* forEach */])(_this.definedRulesNames, function (currRuleName) { - var wrappedRule = _this[currRuleName]; - var originalGrammarAction = wrappedRule["originalGrammarAction"]; - var recordedRuleGast = undefined; - _this.TRACE_INIT(currRuleName + " Rule", function () { - recordedRuleGast = _this.topLevelRuleRecord(currRuleName, originalGrammarAction); - }); - _this.gastProductionsCache[currRuleName] = recordedRuleGast; - }); - } - finally { - _this.disableRecording(); - } - }); - var resolverErrors = []; - _this.TRACE_INIT("Grammar Resolving", function () { - resolverErrors = Object(__WEBPACK_IMPORTED_MODULE_5__grammar_gast_gast_resolver_public__["b" /* resolveGrammar */])({ - rules: Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["U" /* values */])(_this.gastProductionsCache) - }); - _this.definitionErrors.push.apply(_this.definitionErrors, resolverErrors); // mutability for the win? - }); - _this.TRACE_INIT("Grammar Validations", function () { - // only perform additional grammar validations IFF no resolving errors have occurred. - // as unresolved grammar may lead to unhandled runtime exceptions in the follow up validations. - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["A" /* isEmpty */])(resolverErrors) && _this.skipValidations === false) { - var validationErrors = Object(__WEBPACK_IMPORTED_MODULE_5__grammar_gast_gast_resolver_public__["c" /* validateGrammar */])({ - rules: Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["U" /* values */])(_this.gastProductionsCache), - maxLookahead: _this.maxLookahead, - tokenTypes: Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["U" /* values */])(_this.tokensMap), - ignoredIssues: _this.ignoredIssues, - errMsgProvider: __WEBPACK_IMPORTED_MODULE_4__errors_public__["b" /* defaultGrammarValidatorErrorProvider */], - grammarName: className - }); - _this.definitionErrors.push.apply(_this.definitionErrors, validationErrors); // mutability for the win? - } - }); - // this analysis may fail if the grammar is not perfectly valid - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["A" /* isEmpty */])(_this.definitionErrors)) { - // The results of these computations are not needed unless error recovery is enabled. - if (_this.recoveryEnabled) { - _this.TRACE_INIT("computeAllProdsFollows", function () { - var allFollows = Object(__WEBPACK_IMPORTED_MODULE_1__grammar_follow__["a" /* computeAllProdsFollows */])(Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["U" /* values */])(_this.gastProductionsCache)); - _this.resyncFollows = allFollows; - }); - } - _this.TRACE_INIT("ComputeLookaheadFunctions", function () { - _this.preComputeLookaheadFunctions(Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["U" /* values */])(_this.gastProductionsCache)); - }); - } - _this.TRACE_INIT("expandAllNestedRuleNames", function () { - // TODO: is this needed for EmbeddedActionsParser? - var cstAnalysisResult = Object(__WEBPACK_IMPORTED_MODULE_3__cst_cst__["d" /* expandAllNestedRuleNames */])(Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["U" /* values */])(_this.gastProductionsCache), _this.fullRuleNameToShort); - _this.allRuleNames = cstAnalysisResult.allRuleNames; - }); - if (!Parser.DEFER_DEFINITION_ERRORS_HANDLING && - !Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["A" /* isEmpty */])(_this.definitionErrors)) { - defErrorsMsgs = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["I" /* map */])(_this.definitionErrors, function (defError) { return defError.message; }); - throw new Error("Parser Definition Errors detected:\n " + defErrorsMsgs.join("\n-------------------------------\n")); - } - }); - }; - // Set this flag to true if you don't want the Parser to throw error when problems in it's definition are detected. - // (normally during the parser's constructor). - // This is a design time flag, it will not affect the runtime error handling of the parser, just design time errors, - // for example: duplicate rule names, referencing an unresolved subrule, ect... - // This flag should not be enabled during normal usage, it is used in special situations, for example when - // needing to display the parser definition errors in some GUI(online playground). - Parser.DEFER_DEFINITION_ERRORS_HANDLING = false; - return Parser; -}()); - -Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["e" /* applyMixins */])(Parser, [ - __WEBPACK_IMPORTED_MODULE_6__traits_recoverable__["b" /* Recoverable */], - __WEBPACK_IMPORTED_MODULE_7__traits_looksahead__["a" /* LooksAhead */], - __WEBPACK_IMPORTED_MODULE_8__traits_tree_builder__["a" /* TreeBuilder */], - __WEBPACK_IMPORTED_MODULE_9__traits_lexer_adapter__["a" /* LexerAdapter */], - __WEBPACK_IMPORTED_MODULE_11__traits_recognizer_engine__["a" /* RecognizerEngine */], - __WEBPACK_IMPORTED_MODULE_10__traits_recognizer_api__["a" /* RecognizerApi */], - __WEBPACK_IMPORTED_MODULE_12__traits_error_handler__["a" /* ErrorHandler */], - __WEBPACK_IMPORTED_MODULE_13__traits_context_assist__["a" /* ContentAssist */], - __WEBPACK_IMPORTED_MODULE_14__traits_gast_recorder__["a" /* GastRecorder */], - __WEBPACK_IMPORTED_MODULE_15__traits_perf_tracer__["a" /* PerformanceTracer */] -]); -var CstParser = /** @class */ (function (_super) { - __extends(CstParser, _super); - function CstParser(tokenVocabulary, config) { - if (config === void 0) { config = DEFAULT_PARSER_CONFIG; } - var _this = this; - var configClone = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["h" /* cloneObj */])(config); - configClone.outputCst = true; - _this = _super.call(this, tokenVocabulary, configClone) || this; - return _this; - } - return CstParser; -}(Parser)); - -var EmbeddedActionsParser = /** @class */ (function (_super) { - __extends(EmbeddedActionsParser, _super); - function EmbeddedActionsParser(tokenVocabulary, config) { - if (config === void 0) { config = DEFAULT_PARSER_CONFIG; } - var _this = this; - var configClone = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["h" /* cloneObj */])(config); - configClone.outputCst = false; - _this = _super.call(this, tokenVocabulary, configClone) || this; - return _this; - } - return EmbeddedActionsParser; -}(Parser)); - -//# sourceMappingURL=parser.js.map - -/***/ }), -/* 14 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export notNull */ -/* harmony export (immutable) */ __webpack_exports__["j"] = shallowCopyVega; -/* harmony export (immutable) */ __webpack_exports__["b"] = adjustOpacity; -/* unused harmony export adjustRGBAOpacity */ -/* unused harmony export parseColorRamps */ -/* harmony export (immutable) */ __webpack_exports__["d"] = createVegaAttrMixin; -/* harmony export (immutable) */ __webpack_exports__["c"] = createRasterLayerGetterSetter; -/* unused harmony export GeoSvgFormatter */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return renderAttributes; }); -/* harmony export (immutable) */ __webpack_exports__["a"] = __displayPopup; -/* harmony export (immutable) */ __webpack_exports__["h"] = getSizeScaleName; -/* harmony export (immutable) */ __webpack_exports__["e"] = getColorScaleName; -/* harmony export (immutable) */ __webpack_exports__["g"] = getScales; -/* harmony export (immutable) */ __webpack_exports__["f"] = getRealLayers; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_wellknown__ = __webpack_require__(321); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_wellknown___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_wellknown__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } - - - -function notNull(value) { - return value != null; /* double-equals also catches undefined */ -} - -/** - * Shallow copies a vega json object. - * In this context, a shallow copy copies the top-level arrays in the vega json, - * namely the 'data', 'scales', 'projections', and 'marks' arrays. All other - * components are not copied. - * @param {Object} vega - * @returns {Object} - */ -function shallowCopyVega(vega) { - return _objectSpread(_objectSpread({}, vega), {}, { - data: _toConsumableArray(vega.data), - scales: _toConsumableArray(vega.scales), - projections: _toConsumableArray(vega.projections), - marks: _toConsumableArray(vega.marks) - }); -} -function adjustOpacity(color) { - var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; - if (!/#/.test(color)) { - return color; - } - var hex = color.replace("#", ""); - var r = parseInt(hex.substring(0, 2), 16); - var g = parseInt(hex.substring(2, 4), 16); - var b = parseInt(hex.substring(4, 6), 16); - return "rgba(".concat(r, ",").concat(g, ",").concat(b, ",").concat(opacity, ")"); -} -function adjustRGBAOpacity(rgba, opacity) { - var _rgba$split$1$split$ = rgba.split("(")[1].split(")")[0].split(","), - _rgba$split$1$split$2 = _slicedToArray(_rgba$split$1$split$, 4), - r = _rgba$split$1$split$2[0], - g = _rgba$split$1$split$2[1], - b = _rgba$split$1$split$2[2], - a = _rgba$split$1$split$2[3]; - if (a) { - var relativeOpacity = parseFloat(a) - (1 - opacity); - a = "".concat(relativeOpacity > 0 ? relativeOpacity : 0.01); - } else { - a = opacity; - } - return "rgba(".concat(r, ",").concat(g, ",").concat(b, ",").concat(a, ")"); -} -function parseColorRamps(cr) { - if (cr && cr.length > 0 && Array.isArray(cr)) { - var cr_arr = cr.map(function (a) { - return a.filter(function (b) { - return b !== "min" && b !== "max" && b !== ""; - }); - }).flat(1).map(function (a) { - return parseFloat(a); - }); - return cr_arr.filter(function (a, i) { - return cr_arr.indexOf(a) === i; - }); - } else { - return []; - } -} -var ordScale = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.scale.ordinal(); -var quantScale = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.scale.quantize(); -var linearScale = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.scale.linear(); -var capAttrMap = { - FillColor: "color", - Size: "size", - StrokeColor: "color", - StrokeWidth: "strokeWidth" -}; -function createVegaAttrMixin(layerObj, attrName, defaultVal, nullVal, useScale, prePostFuncs) { - var scaleFunc = "", - fieldAttrFunc = ""; - var capAttrName = attrName.charAt(0).toUpperCase() + attrName.slice(1); - var defaultFunc = "default" + capAttrName; - var nullFunc = "null" + capAttrName; - layerObj[defaultFunc] = createRasterLayerGetterSetter(layerObj, defaultVal, prePostFuncs ? prePostFuncs.preDefault : null, prePostFuncs ? prePostFuncs.postDefault : null); - layerObj[nullFunc] = createRasterLayerGetterSetter(layerObj, nullVal, prePostFuncs ? prePostFuncs.preNull : null, prePostFuncs ? prePostFuncs.postNull : null); - if (useScale) { - scaleFunc = attrName + "Scale"; - fieldAttrFunc = attrName + "Attr"; - layerObj[scaleFunc] = createRasterLayerGetterSetter(layerObj, null, prePostFuncs ? prePostFuncs.preScale : null, prePostFuncs ? prePostFuncs.postScale : null); - layerObj[fieldAttrFunc] = createRasterLayerGetterSetter(layerObj, null, prePostFuncs ? prePostFuncs.preField : null, prePostFuncs ? prePostFuncs.postField : null); - layerObj["_build" + capAttrName + "Scale"] = function (chart, layerName) { - var scale = layerObj[scaleFunc](); - if (scale && scale.domain && scale.domain().length && scale.range().length && scaleFunc === "fillColorScale") { - var colorScaleName = layerName + "_" + attrName; - var rtnObj = { - name: colorScaleName, - type: chart._determineScaleType(scale), - domain: scale.domain().filter(notNull), - range: scale.range(), - "default": layerObj[defaultFunc](), - nullValue: layerObj[nullFunc]() - }; - if (scale.clamp) { - rtnObj.clamp = scale.clamp(); - } - return rtnObj; - } else if (layerObj.densityAccumulatorEnabled()) { - var _colorScaleName = layerName + "_" + attrName, - colorsToUse = layerObj.defaultFillColor(), - domainInterval = 100 / (colorsToUse.length - 1), - linearColorScale = colorsToUse.map(function (color, i) { - return i * domainInterval / 100; - }), - range = colorsToUse.map(function (color, i, colorArray) { - var normVal = i / (colorArray.length - 1); - var interp = Math.min(normVal / 0.65, 1.0); - interp = interp * 0.375 + 0.625; - return convertHexToRGBA(color, interp * 100); - }); - var _rtnObj = { - name: _colorScaleName, - type: "linear", - domain: linearColorScale, - range: range, - accumulator: "density", - minDensityCnt: "-2ndStdDev", - maxDensityCnt: "2ndStdDev", - clamp: true - }; - return _rtnObj; - } - }; - } - var getValFunc = "get" + capAttrName + "Val"; - layerObj[getValFunc] = function (input) { - var rtnVal = layerObj[defaultFunc](); - if (input === null) { - rtnVal = layerObj[nullFunc](); - } else if (input !== undefined && useScale) { - var _capAttrObj, _capAttrObj2, _capAttrObj2$domain, _capAttrObj3, _capAttrObj3$range, _capAttrObj4; - var encodingAttrName = capAttrMap[capAttrName]; - var capAttrObj = layerObj.getState().encoding[encodingAttrName]; - if ((_capAttrObj = capAttrObj) !== null && _capAttrObj !== void 0 && _capAttrObj.scale) { - capAttrObj = capAttrObj.scale; - } - if (!((_capAttrObj2 = capAttrObj) !== null && _capAttrObj2 !== void 0 && (_capAttrObj2$domain = _capAttrObj2.domain) !== null && _capAttrObj2$domain !== void 0 && _capAttrObj2$domain.length) || !((_capAttrObj3 = capAttrObj) !== null && _capAttrObj3 !== void 0 && (_capAttrObj3$range = _capAttrObj3.range) !== null && _capAttrObj3$range !== void 0 && _capAttrObj3$range.length)) { - return rtnVal; - } - var scaleType = (_capAttrObj4 = capAttrObj) === null || _capAttrObj4 === void 0 ? void 0 : _capAttrObj4.type; - var domainVals = capAttrObj.domain; - if (domainVals === "auto") { - var domainGetterFunc = encodingAttrName + "Domain"; - if (typeof layerObj[domainGetterFunc] !== "function") { - throw new Error("Looking for a ".concat(domainGetterFunc, " function on for attr ").concat(attrName)); - } - domainVals = layerObj[domainGetterFunc](); - } - if (scaleType === "ordinal") { - ordScale.domain(domainVals).range(capAttrObj.range); - rtnVal = domainVals.indexOf(input) === -1 ? ordScale("Other") : ordScale(input); - } else if (scaleType === "nominal") { - ordScale.domain(domainVals).range(capAttrObj.range); - var formattedInput = input; - // Newer versions of d3 will work with boolean domain and 0/1 values - // but ours is too old. Manually convert 0/1s to false/true here - if (domainVals.every(function (v) { - return typeof v === "boolean"; - })) { - formattedInput = Boolean(input); - } - rtnVal = ordScale(formattedInput); - } else if (Array.isArray(domainVals) && domainVals[0] === domainVals[1]) { - // handling case where domain min/max are the same (FE-7408) - linearScale.domain(domainVals).range(capAttrObj.range); - rtnVal = Math.round(linearScale(input)); - } else { - quantScale.domain(domainVals).range(capAttrObj.range); - rtnVal = quantScale(input); - } - } - return rtnVal; - }; -} -function createRasterLayerGetterSetter(layerObj, attrVal, preSetFunc, postSetFunc) { - return function (newVal) { - if (!arguments.length) { - return attrVal; - } - if (preSetFunc) { - var rtnVal = preSetFunc(newVal, attrVal); - if (rtnVal !== undefined) { - newVal = rtnVal; - } - } - attrVal = newVal; - if (postSetFunc) { - var rtnVal = postSetFunc(attrVal); - if (rtnVal !== undefined) { - attrVal = rtnVal; - } - } - return layerObj; - }; -} - -// Polygon and line svg on hovering - -// NOTE: Reqd until ST_Transform supported on projection columns -function conv4326To900913(x, y) { - var transCoord = [0.0, 0.0]; - transCoord[0] = x * 111319.49077777777778; - transCoord[1] = Math.log(Math.tan((90.0 + y) * 0.00872664625997)) * 6378136.99911215736947; - return transCoord; -} -var SvgFormatter = /*#__PURE__*/function () { - function SvgFormatter() { - _classCallCheck(this, SvgFormatter); - } - _createClass(SvgFormatter, [{ - key: "getBounds", - value: - /** - * Builds the bounds from the incoming poly data - * @param {AABox2d} out AABox2d to return - * @param {object} data Object with return data from getResultRowForPixel() - * @param {Number} width Width of the visualization div - * @param {Number} height Height of the visualization div - * @param {object} margin Margins of the visualization div - * @param {Function} xscale d3 scale in x dimension from world space to pixel space (i.e. mercatorx-to-pixel) - * @param {Function} yscale d3 scale in y dimension from world space to pixel space (i.e. mercatory-to-pixel) - */ - function getBounds(data, width, height, margins, xscale, yscale) { - throw new Error("This must be overridden"); - } - - /** - * Builds the svg path string to use with the d svg attr: - * https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d - * This function should be called after the getBounds(). - * The t/s arguments are the transformations to properly place the points underneath - * a parent SVG group node. That node is what ultimately handles animations and such - * so we need to transform all the points into local space. t is the translation - * and s is the scale to transform the points from pixel space to model/object space. - * @param {string} out Returns the svg path string - * @param {Point2d} t Translation from world to object space. - * @param {Number} s Scale from world to object space. - */ - }, { - key: "getSvgPath", - value: function getSvgPath(t, s) { - throw new Error("This must be overridden"); - } - }]); - return SvgFormatter; -}(); -var LegacyPolySvgFormatter = /*#__PURE__*/function (_SvgFormatter) { - _inherits(LegacyPolySvgFormatter, _SvgFormatter); - var _super = _createSuper(LegacyPolySvgFormatter); - function LegacyPolySvgFormatter() { - var _this; - _classCallCheck(this, LegacyPolySvgFormatter); - _this = _super.call(this); - _this._polys = []; - return _this; - } - _createClass(LegacyPolySvgFormatter, [{ - key: "getBounds", - value: function getBounds(data, width, height, margins, xscale, yscale) { - // NOTE: this is handling legacy poly storage for backwards compatibility. - // Once we've put everything post 4.0 behind us, this can be fully deprecated. - // - // verts and drawinfo should be valid as the _resultsAreValidForPopup() - // method should've been called beforehand - var verts = data[polyTableGeomColumns.verts_LEGACY]; - var drawinfo = data[polyTableGeomColumns.linedrawinfo_LEGACY]; - var startIdxDiff = drawinfo.length ? drawinfo[2] : 0; - var FLT_MAX = 1e37; - var bounds = __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].create(); - var screenPt = __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["Point2d"].create(); - for (var i = 0; i < drawinfo.length; i = i + 4) { - // Draw info struct: - // 0: count, // number of verts in loop -- might include 3 duplicate verts at end for closure - // 1: instanceCount, // should always be 1 - // 2: firstIndex, // the start index (includes x & y) where the verts for the loop start - // 3: baseInstance // irrelevant for our purposes -- should always be 0 - var polypts = []; - var count = (drawinfo[i] - 3) * 2; // include x&y, and drop 3 duplicated pts at the end - var startIdx = (drawinfo[i + 2] - startIdxDiff) * 2; // include x&y - var endIdx = startIdx + count; // remove the 3 duplicate pts at the end - for (var idx = startIdx; idx < endIdx; idx = idx + 2) { - if (verts[idx] <= -FLT_MAX) { - // -FLT_MAX is a separator for multi-polygons (like Hawaii, - // where there would be a polygon per island), so when we hit a separator, - // remove the 3 duplicate points that would end the polygon prior to the separator - // and start a new polygon - polypts.pop(); - polypts.pop(); - polypts.pop(); - this._polys.push(polypts); - polypts = []; - } else { - __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["Point2d"].set(screenPt, xscale(verts[idx]) + margins.left, height - yscale(verts[idx + 1]) - 1 + margins.top); - if (screenPt[0] >= 0 && screenPt[0] <= width && screenPt[1] >= 0 && screenPt[1] <= height) { - __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].encapsulatePt(bounds, bounds, screenPt); - } - polypts.push(screenPt[0]); - polypts.push(screenPt[1]); - } - } - this._polys.push(polypts); - } - return bounds; - } - }, { - key: "getSvgPath", - value: function getSvgPath(t, s) { - var rtnPointStr = ""; - this._polys.forEach(function (pts) { - if (!pts) { - return; - } - var pointStr = ""; - for (var i = 0; i < pts.length; i = i + 2) { - if (!isNaN(pts[i]) && !isNaN(pts[i + 1])) { - pointStr += (pointStr.length ? "L" : "M") + s * (pts[i] - t[0]) + "," + s * (pts[i + 1] - t[1]); - } - } - if (pointStr.length) { - pointStr += "Z"; - } - rtnPointStr += pointStr; - }); - return rtnPointStr; - } - }]); - return LegacyPolySvgFormatter; -}(SvgFormatter); -function buildGeoProjection(width, height, margins, xscale, yscale) { - var clamp = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true; - var t = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [0, 0]; - var s = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1; - var _translation = t, - _scale = s, - _clamp = clamp; - var project = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.geo.transform({ - point: function point(lon, lat) { - var projectedCoord = conv4326To900913(lon, lat); - var pt = [_scale * (xscale(projectedCoord[0]) + margins.left - _translation[0]), _scale * (height - yscale(projectedCoord[1]) - 1 + margins.top - _translation[1])]; - if (_clamp) { - if (pt[0] >= 0 && pt[0] < width && pt[1] >= 0 && pt[1] < height) { - return this.stream.point(pt[0], pt[1]); - } - } else { - return this.stream.point(pt[0], pt[1]); - } - } - }); - project.setTransforms = function (t, s) { - _translation = t; - _scale = s; - }; - project.setClamp = function (clamp) { - _clamp = Boolean(clamp); - }; - return project; -} -var GeoSvgFormatter = /*#__PURE__*/function (_SvgFormatter2) { - _inherits(GeoSvgFormatter, _SvgFormatter2); - var _super2 = _createSuper(GeoSvgFormatter); - function GeoSvgFormatter(geocol) { - var _this2; - _classCallCheck(this, GeoSvgFormatter); - _this2 = _super2.call(this); - _this2._geojson = null; - _this2._projector = null; - _this2._d3projector = null; - _this2._geocol = geocol; - return _this2; - } - _createClass(GeoSvgFormatter, [{ - key: "getBounds", - value: function getBounds(data, width, height, margins, xscale, yscale) { - var wkt = data[this._geocol]; - if (typeof wkt !== "string") { - throw new Error("Cannot create SVG from geo polygon column \"".concat(this._geocol, "\". The data returned is not a WKT string. It is of type: ").concat(_typeof(wkt))); - } - this._geojson = __WEBPACK_IMPORTED_MODULE_1_wellknown___default.a.parse(wkt); - this._projector = buildGeoProjection(width, height, margins, xscale, yscale, true); - - // NOTE: d3.geo.path() streaming requires polygons to duplicate the first vertex in the last slot - // to complete a full loop. If the first vertex is not duplicated, the last vertex can be dropped. - // This is currently a requirement for the incoming WKT string, but is not error checked by d3. - this._d3projector = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.geo.path().projection(this._projector); - var d3bounds = this._d3projector.bounds(this._geojson); - return __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].create(d3bounds[0][0], d3bounds[0][1], d3bounds[1][0], d3bounds[1][1]); - } - }, { - key: "getSvgPath", - value: function getSvgPath(t, s) { - this._projector.setTransforms(t, s); - this._projector.setClamp(false); - return this._d3projector(this._geojson); - } - }]); - return GeoSvgFormatter; -}(SvgFormatter); -var renderAttributes = ["x", "y", "fillColor", "strokeColor", "strokeWidth", "lineJoin", "miterLimit", "opacity"]; -var _scaledPopups = {}; -function __displayPopup(svgProps) { - var chart = svgProps.chart, - parentElem = svgProps.parentElem, - data = svgProps.data, - width = svgProps.width, - height = svgProps.height, - margins = svgProps.margins, - xscale = svgProps.xscale, - yscale = svgProps.yscale, - minPopupArea = svgProps.minPopupArea, - animate = svgProps.animate, - _vega = svgProps._vega, - _layer = svgProps._layer, - state = svgProps.state; - var layerType = _layer.layerType(); - var geoPathFormatter = null; - if (chart.useGeoTypes()) { - if (!state.encoding.geocol) { - throw new Error("No poly/multipolygon column specified. Cannot build poly outline popup."); - } - // For linemap dimension selection, we are using alias "sampled_geo" - var geoCol = state.transform.groupby && state.transform.groupby.length && state.mark.type === "lines" ? "sampled_geo" : state.encoding.geocol; - geoPathFormatter = new GeoSvgFormatter(geoCol); - } else if (!chart.useGeoTypes() && layerType === "polys") { - geoPathFormatter = new LegacyPolySvgFormatter(); - } else { - throw new Error("Cannot build outline popup."); - } - var bounds = geoPathFormatter.getBounds(data, width, height, margins, xscale, yscale); - - // Check for 2 special cases: - // 1) zoomed in so far in that the poly encompasses the entire view, so all points are - // outside the view - // 2) the poly only has 1 point in view. - // Both cases can be handled by checking whether the bounds is empty (infinite) in - // either x/y or the bounds size is 0 in x/y. - var boundsSz = __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].getSize(__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["Point2d"].create(), bounds); - if (!isFinite(boundsSz[0]) || boundsSz[0] === 0) { - bounds[__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].MINX] = 0; - bounds[__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].MAXX] = width; - boundsSz[0] = width; - } - if (!isFinite(boundsSz[1]) || boundsSz[1] === 0) { - bounds[__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].MINY] = 0; - bounds[__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].MAXY] = height; - boundsSz[1] = height; - } - - // Get the data from the hit-test object used to drive render properties - // These will be used to properly style the svg popup object - var rndrProps = {}; - if (_vega && Array.isArray(_vega.marks) && _vega.marks.length > 0 && _vega.marks[0].properties) { - var propObj = _vega.marks[0].properties; - renderAttributes.forEach(function (prop) { - if (_typeof(propObj[prop]) === "object" && propObj[prop].field && typeof propObj[prop].field === "string") { - rndrProps[prop] = propObj[prop].field; - } - }); - } - - // If the poly we hit-test is small, we'll scale it so that it - // can be seen. The minPopupArea is the minimum area of the popup - // poly, so if the poly's bounds is < minPopupArea, we'll scale it - // up to that size. - var scale = 1; - var scaleRatio = minPopupArea / __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].area(bounds); - var isScaled = scaleRatio > 1; - if (isScaled) { - scale = Math.sqrt(scaleRatio); - } - - // Now grab the style properties for the svg calculated from the vega - var popupStyle = _layer.popupStyle(); - var fillColor = _layer.getFillColorVal(data[rndrProps.fillColor]); - var strokeColor = _layer.getStrokeColorVal(data[rndrProps.strokeColor]); - var strokeWidth = _layer.getStrokeWidthVal(data[rndrProps.strokeWidth]); - if (_typeof(popupStyle) === "object" && !isScaled) { - fillColor = popupStyle.fillColor || fillColor; - strokeColor = popupStyle.strokeColor || strokeColor; - strokeWidth = popupStyle.strokeWidth || strokeWidth; - } - - // build out the svg - var svg = parentElem.append("svg").attr("width", width).attr("height", height); - - // transform svg node. This node will position the svg appropriately. Need - // to offset according to the scale above (scale >= 1) - var boundsCtr = __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].getCenter(__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["Point2d"].create(), bounds); - var xform = svg.append("g").attr("class", layerType === "polys" ? "map-poly-xform" : "map-polyline").attr("transform", "translate(" + (scale * bounds[__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].MINX] - (scale - 1) * boundsCtr[0]) + ", " + (scale * (bounds[__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].MINY] + 1) - (scale - 1) * (boundsCtr[1] + 1)) + ")"); - - // now add a transform node that will be used to apply animated scales to - // We want the animation to happen from the center of the bounds, so we - // place the transform origin there. - var group = xform.append("g").attr("class", layerType === "polys" ? "map-poly" : "map-polyline").attr("transform-origin", "".concat(boundsSz[0] / 2, " ").concat(boundsSz[1] / 2)); - - // inherited animation classes from css - if (animate) { - if (isScaled) { - group.classed("popupPoly", true); - } else { - group.classed("fadeInPoly", true); - } - } - - // now apply the styles - if (typeof strokeWidth === "number") { - group.style("stroke-width", strokeWidth); - } - if (layerType === "lines") { - // applying shadow - var defs = group.append("defs"); - var filter = defs.append("filter").attr("id", "drop-shadow").attr("width", "200%").attr("height", "200%"); - filter.append("feOffset").attr("in", "SourceAlpha").attr("result", "offOut").attr("dx", "2").attr("dy", "2"); - filter.append("feGaussianBlur").attr("in", "offOut").attr("stdDeviation", 2).attr("result", "blurOut"); - filter.append("feBlend").attr("in", "SourceGraphic").attr("in2", "blurOut").attr("mode", "normal"); - } - group.append("path").attr("d", geoPathFormatter.getSvgPath(__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["Point2d"].create(bounds[__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].MINX], bounds[__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].MINY]), scale)).attr("class", layerType === "polys" ? "map-polygon-shape" : "map-polyline").attr("fill", layerType === "polys" ? fillColor : "none").attr("fill-rule", "evenodd").attr("stroke-width", strokeWidth).attr("stroke", strokeColor).style("filter", layerType === "polys" ? "none" : "url(#drop-shadow)").on("click", function () { - if (layerType === "polys") { - return _layer.onClick(chart, data, __WEBPACK_IMPORTED_MODULE_0_d3___default.a.event); - } else { - return null; - } - }); - _scaledPopups[chart] = isScaled; - return bounds; -} -function getSizeScaleName(layerName) { - if (layerName === "linemap") { - return "".concat(layerName, "_strokeWidth"); - } else { - return "".concat(layerName, "_size"); - } -} -function getColorScaleName(layerName) { - if (layerName === "linemap") { - return "".concat(layerName, "_strokeColor"); - } else { - return "".concat(layerName, "_fillColor"); - } -} -function getScales(_ref, layerName, scaleDomainFields, xformDataSource) { - var size = _ref.size, - color = _ref.color, - orientation = _ref.orientation, - colorRamps = _ref.colorRamps; - var scales = []; - if (_typeof(size) === "object" && (size.type === "quantitative" || size.type === "custom")) { - scales.push({ - name: getSizeScaleName(layerName), - type: "linear", - domain: size.domain === "auto" ? { - data: xformDataSource, - fields: scaleDomainFields.size - } : size.domain, - range: size.range, - clamp: true - }); - } - if (_typeof(color) === "object" && color.type === "density") { - var parsedColorRamps = parseColorRamps(colorRamps); - scales.push({ - name: getColorScaleName(layerName), - type: "linear", - domain: parsedColorRamps.length === color.range.length - 1 ? parsedColorRamps : color.range.map(function (c, i) { - return i * 100 / (color.range.length - 1) / 100; - }), - range: color.range.map(function (c) { - return adjustOpacity(c, color.opacity); - }).map(function (c, i, colorArray) { - var normVal = i / (colorArray.length - 1); - var interp = Math.min(normVal / 0.65, 1.0); - interp = interp * 0.375 + 0.625; - return adjustRGBAOpacity(c, interp); - }), - accumulator: "density", - minDensityCnt: "-2ndStdDev", - maxDensityCnt: "2ndStdDev", - clamp: true - }); - } - if (_typeof(color) === "object" && color.type === "ordinal") { - scales.push({ - name: getColorScaleName(layerName), - type: "ordinal", - domain: color.domain === "auto" ? { - data: xformDataSource, - fields: scaleDomainFields.color - } : color.domain, - range: color.range.map(function (c) { - return adjustOpacity(c, color.opacity); - }), - "default": adjustOpacity(color.defaultOtherRange, - // color passed from immerse color palette for 'Other' category - color.hasOwnProperty("showOther") && !color.showOther ? 0 // When Other is toggled OFF, we make the Other category transparent - : color.opacity), - nullValue: adjustOpacity("#CACACA", color.opacity) - }); - } - if (_typeof(color) === "object" && color.type === "quantitative") { - scales.push({ - name: getColorScaleName(layerName), - type: "quantize", - domain: color.domain === "auto" ? { - data: xformDataSource, - fields: scaleDomainFields.color - } : color.domain, - range: color.range.map(function (c) { - return adjustOpacity(c, color.opacity); - }) - }); - } - if (_typeof(orientation) === "object" && orientation.type === "quantitative") { - scales.push({ - name: "".concat(layerName, "_symbolAngle"), - type: "linear", - domain: orientation.domain, - range: orientation.range, - clamp: false - }); - } - return scales; -} - -/** - * Filters z-indexed layers and returns non duplicate layer. Z-indexed layers is for temporary hack FE-13136 - * For z-indexed layer (layer that has top color category applied), only returns the first z-index, z_0 - * @param layers - * @returns {[]} - */ -function getRealLayers(layers) { - var filteredLayers = []; - var visited = {}; - layers.forEach(function (layerName) { - if (layerName.includes("_z")) { - var idx = layerName.indexOf("_z"); - var realLayerName = layerName.substring(0, idx); // real layer name is substring up to _z... - if (!visited[realLayerName]) { - visited[realLayerName] = layerName; // can use only the first z-index layerName - filteredLayers.push(layerName); - } - } else { - filteredLayers.push(layerName); - } - }); - return filteredLayers; -} - -/***/ }), -/* 15 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return nullLabelHtml; }); -/* unused harmony export momentUTCFormat */ -/* unused harmony export genericDateTimeFormat */ -/* unused harmony export isPlainObject */ -/* unused harmony export hasAllObjects */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isArrayOfObjects; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return normalizeArrayByValue; }); -/* harmony export (immutable) */ __webpack_exports__["b"] = formatDataValue; -/* harmony export (immutable) */ __webpack_exports__["e"] = maybeFormatInfinity; -/* unused harmony export formatNumber */ -/* harmony export (immutable) */ __webpack_exports__["c"] = formatPercentage; -/* unused harmony export formatArrayValue */ -/* unused harmony export formatTimeBinValue */ -/* unused harmony export formatExtractValue */ -/* harmony export (immutable) */ __webpack_exports__["g"] = normalizeFiltersArray; -/* harmony export (immutable) */ __webpack_exports__["a"] = formatCache; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__ = __webpack_require__(40); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_d3__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_moment__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_moment__); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - - - -var commafy = __WEBPACK_IMPORTED_MODULE_1_d3___default.a.format(","); -var nullLabelHtml = ' NULL '; -var momentUTCFormat = function momentUTCFormat(d, f) { - return __WEBPACK_IMPORTED_MODULE_2_moment___default.a.utc(d).locale("en").format(f); -}; -var genericDateTimeFormat = function genericDateTimeFormat(d) { - if (d.getMilliseconds() === 0) { - return "".concat(momentUTCFormat(d, "MMM D, YYYY"), " \u205F").concat(momentUTCFormat(d, "HH:mm:ss")); - } - return "".concat(momentUTCFormat(d, "MMM D, YYYY"), " \u205F").concat(momentUTCFormat(d, "HH:mm:ss.SSS")); -}; -var isPlainObject = function isPlainObject(value) { - return !Array.isArray(value) && _typeof(value) === "object" && !(value instanceof Date); -}; -var hasAllObjects = function hasAllObjects(collection) { - return collection.reduce(function (accum, value) { - return isPlainObject(value) && accum; - }, true); -}; -var isArrayOfObjects = function isArrayOfObjects(value) { - return Array.isArray(value) && hasAllObjects(value); -}; -var normalizeArrayByValue = function normalizeArrayByValue(collection) { - return isArrayOfObjects(collection) ? collection.map(function (data) { - return data.value; - }) : collection; -}; -function formatDataValue(data) { - if (typeof data === "number") { - return formatNumber(data); - } else if (Array.isArray(data)) { - return formatArrayValue(data); - } else if (data instanceof Date) { - return genericDateTimeFormat(data); - } else if (data === null) { - return nullLabelHtml; - } - return data; -} -function maybeFormatInfinity(data) { - return data.map(function (d) { - if (d.val === "-Infinity" || d.val === "Infinity") { - d.label = d.val; - d.val = 0; - } - return d; - }); -} -function formatNumber(d) { - if (typeof d !== "number") { - return d; - } - if (d.toString().match(/e/)) { - return d.toPrecision(2); - } else { - return commafy(parseFloat(d.toFixed(2))); - } -} -var percentify = __WEBPACK_IMPORTED_MODULE_1_d3___default.a.format(".0%"); -var percentifyLow = __WEBPACK_IMPORTED_MODULE_1_d3___default.a.format(".1%"); -function formatPercentage(d, total) { - var percentage = d / total; - if (percentage < 0.01) { - return percentifyLow(percentage); - } else { - return percentify(percentage); - } -} -function formatArrayValue(data) { - if (_typeof(data[0]) === "object" && !(data[0] instanceof Date)) { - return data[0].isExtract ? formatExtractValue(data[0].value, data[0].extractUnit) : formatTimeBinValue(data); - } else { - return data.map(function (d) { - return formatDataValue(d); - }).join(" \u2013 "); - } -} -function formatTimeBinValue(data) { - var startTime = data[0]; - var endTime = data[1]; - switch (startTime.timeBin) { - case "decade": - return "".concat(momentUTCFormat(startTime.value, "YYYY"), " \u2013 ").concat(momentUTCFormat(endTime.value, "YYYY")); - case "year": - return momentUTCFormat(startTime.value, "YYYY"); - case "quarter": - return "".concat(__WEBPACK_IMPORTED_MODULE_2_moment___default.a.utc(startTime.value).locale("en").quarter(), "Q ").concat(momentUTCFormat(startTime.value, "YYYY")); - case "month": - return momentUTCFormat(startTime.value, "MMM YYYY"); - case "week": - return "".concat(momentUTCFormat(startTime.value, "MMM D"), " \u2013 ").concat(momentUTCFormat(endTime.value, "MMM D, YYYY")); - case "day": - return momentUTCFormat(startTime.value, "MMM D, YYYY"); - case "hour": - case "minute": - return "".concat(momentUTCFormat(startTime.value, "MMM D, YYYY"), " \u205F").concat(momentUTCFormat(startTime.value, "HH:mm")); - case "second": - return "".concat(momentUTCFormat(startTime.value, "HH:mm:ss")); - case "millisecond": - return "".concat(momentUTCFormat(startTime.value, "HH:mm:ss.SSS")); - default: - return genericDateTimeFormat(startTime.value); - } -} -function formatExtractValue(number, label) { - switch (label) { - case "isodow": - return __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["b" /* DAYS */][number - 1]; - case "month": - return __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["h" /* MONTHS */][number - 1]; - case "quarter": - return __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["k" /* QUARTERS */][number - 1]; - case "hour": - return __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["e" /* HOURS */][number]; - case "minute": - return number + 1; - default: - return number; - } -} -function normalizeFiltersArray(filters) { - return filters.map(function (f) { - if (isArrayOfObjects(f)) { - return normalizeArrayByValue(f); - } else { - return f; - } - }); -} -function formatCache(_axis) { - var axis = _axis; - var cachedTickFormat = false; - function setTickFormat(tickFormat, fromCache) { - if (tickFormat === false) { - return null; - } - if (!fromCache && cachedTickFormat === false) { - cachedTickFormat = axis.tickFormat(); - } - axis.tickFormat(tickFormat); - if (fromCache) { - cachedTickFormat = false; - } - } - function setTickFormatFromCache() { - var FROM_CACHE = true; - setTickFormat(cachedTickFormat, FROM_CACHE); - } - return { - setTickFormat: setTickFormat, - setTickFormatFromCache: setTickFormatFromCache - }; -} - -/***/ }), -/* 16 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = createParser; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__parse_expression__ = __webpack_require__(273); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__parse_datastate__ = __webpack_require__(274); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__parse_transform__ = __webpack_require__(275); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__parse_source__ = __webpack_require__(71); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__write_sql__ = __webpack_require__(286); - - - - - - -/** - * Creates a parser than can parse expressions, transforms, and intermediary - * SQL representations. This parser is used internally by the data graph. - * @see {@link Parser} for further information. - * @memberof API - */ -function createParser() { - var transformParsers = {}; - var expressionParsers = {}; - - /** - * A collection of functions used for parsing expressions, transforms, and - * intermediary SQL representations - * @namespace Parser - */ - var parser = { - parseExpression: parseExpression, - parseTransform: parseTransform, - parseDataState: parseDataState, - parseSource: parseSource, - writeSQL: writeSQL, - write: __WEBPACK_IMPORTED_MODULE_4__write_sql__["b" /* write */], - registerParser: registerParser - }; - - /** - * Returns all child data node instances of the graph. - * @memberof Parser - * @inner - */ - function registerParser(definition, typeParser) { - if (definition.meta === "expression") { - expressionParsers[definition.type] = typeParser; - } else if (definition.meta === "transform") { - transformParsers[definition.type] = typeParser; - } - } - - /** - * Parses expressions and returns a valid SQL expression string - * @memberof Parser - * @inner - * @see {@link Expression} for further information. - */ - function parseExpression(expression) { - if (expressionParsers[expression.type]) { - return expressionParsers[expression.type](expression, parser); - } - return Object(__WEBPACK_IMPORTED_MODULE_0__parse_expression__["a" /* default */])(expression, parser); - } - - /** - * Parses transforms and returns an intermediary SQL representation - * @memberof Parser - * @inner - * @see {@link Transform} for further information. - */ - function parseTransform(sql, transform) { - if (transformParsers[transform.type]) { - return transformParsers[transform.type](sql, transform, parser); - } - return Object(__WEBPACK_IMPORTED_MODULE_2__parse_transform__["a" /* default */])(sql, transform, parser); - } - - /** - * Parses a data node state and returns an intermediary SQL representation - * @memberof Parser - * @inner - */ - function parseDataState(data, sql) { - return Object(__WEBPACK_IMPORTED_MODULE_1__parse_datastate__["a" /* default */])(data, parser, sql); - } - - /** - * Parses a source transform and returns a valid SQL FROM clause - * @memberof Parser - * @inner - */ - function parseSource(sourceTransforms) { - return Object(__WEBPACK_IMPORTED_MODULE_3__parse_source__["a" /* default */])(sourceTransforms, parser); - } - - /** - * Parses a data node state and returns a valid SQL string - * @memberof Parser - * @inner - */ - function writeSQL(state) { - return Object(__WEBPACK_IMPORTED_MODULE_4__write_sql__["a" /* default */])(state, parser); - } - - return parser; -} - -/* harmony default export */ __webpack_exports__["b"] = (createParser()); - -/***/ }), -/* 17 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = colorMixin; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3__); - - -/** - * The Color Mixin is an abstract chart functional class providing universal coloring support - * as a mix-in for any concrete chart implementation. - * @name colorMixin - * @memberof dc - * @mixin - * @param {Object} _chart - * @return {dc.colorMixin} - */ -function colorMixin(_chart) { - var _colors = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.scale.category20c(); - var _defaultAccessor = true; - var _colorAccessor = function _colorAccessor(d) { - return _chart.keyAccessor()(d); - }; - - /** - * Retrieve current color scale or set a new color scale. This methods accepts any function that - * operates like a d3 scale. - * @name colors - * @memberof dc.colorMixin - * @instance - * @see {@link http://github.com/mbostock/d3/wiki/Scales d3.scale} - * @example - * // alternate categorical scale - * chart.colors(d3.scale.category20b()); - * // ordinal scale - * chart.colors(d3.scale.ordinal().range(['red','green','blue'])); - * // convenience method, the same as above - * chart.ordinalColors(['red','green','blue']); - * // set a linear scale - * chart.linearColors(["#4575b4", "#ffffbf", "#a50026"]); - * @param {d3.scale} [colorScale=d3.scale.category20c()] - * @return {d3.scale} - * @return {dc.colorMixin} - */ - _chart.colors = function (colorScale) { - if (!arguments.length) { - return _colors; - } - if (colorScale instanceof Array) { - _colors = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.scale.quantize().range(colorScale); // deprecated legacy support, note: this fails for ordinal domains - } else { - _colors = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.functor(colorScale); - } - return _chart; - }; - - /** - * Convenience method to set the color scale to - * {@link https://github.com/mbostock/d3/wiki/Ordinal-Scales#ordinal d3.scale.ordinal} with - * range `r`. - * @name ordinalColors - * @memberof dc.colorMixin - * @instance - * @param {Array} r - * @return {dc.colorMixin} - */ - _chart.ordinalColors = function (r) { - return _chart.colors(__WEBPACK_IMPORTED_MODULE_0_d3___default.a.scale.ordinal().range(r)); - }; - - /** - * Convenience method to set the color scale to an Hcl interpolated linear scale with range `r`. - * @name linearColors - * @memberof dc.colorMixin - * @instance - * @param {Array} r - * @return {dc.colorMixin} - */ - _chart.linearColors = function (r) { - return _chart.colors(__WEBPACK_IMPORTED_MODULE_0_d3___default.a.scale.linear().range(r).interpolate(__WEBPACK_IMPORTED_MODULE_0_d3___default.a.interpolateHcl)); - }; - - /** - * Set or the get color accessor function. This function will be used to map a data point in a - * crossfilter group to a color value on the color scale. The default function uses the key - * accessor. - * @name colorAccessor - * @memberof dc.colorMixin - * @instance - * @example - * // default index based color accessor - * .colorAccessor(function (d, i){return i;}) - * // color accessor for a multi-value crossfilter reduction - * .colorAccessor(function (d){return d.value.absGain;}) - * @param {Function} [colorAccessor] - * @return {Function} - * @return {dc.colorMixin} - */ - _chart.colorAccessor = function (colorAccessor) { - if (!arguments.length) { - return _colorAccessor; - } - _colorAccessor = colorAccessor; - _defaultAccessor = false; - return _chart; - }; - - // what is this? - _chart.defaultColorAccessor = function () { - return _defaultAccessor; - }; - - /** - * Set or get the current domain for the color mapping function. The domain must be supplied as an - * array. - * - * Note: previously this method accepted a callback function. Instead you may use a custom scale - * set by {@link #dc.colorMixin+colors .colors}. - * @name colorDomain - * @memberof dc.colorMixin - * @instance - * @param {Array} [domain] - * @return {Array} - * @return {dc.colorMixin} - */ - _chart.colorDomain = function (domain) { - if (!arguments.length) { - return _colors.domain(); - } - _colors.domain(domain); - return _chart; - }; - - /** - * Set the domain by determining the min and max values as retrieved by - * {@link #dc.colorMixin+colorAccessor .colorAccessor} over the chart's dataset. - * @name calculateColorDomain - * @memberof dc.colorMixin - * @instance - * @return {dc.colorMixin} - */ - _chart.calculateColorDomain = function () { - var newDomain = [__WEBPACK_IMPORTED_MODULE_0_d3___default.a.min(_chart.data(), _chart.colorAccessor()), __WEBPACK_IMPORTED_MODULE_0_d3___default.a.max(_chart.data(), _chart.colorAccessor())]; - _colors.domain(newDomain); - return _chart; - }; - - /** - * Get the color for the datum d and counter i. This is used internally by charts to retrieve a color. - * @name getColor - * @memberof dc.colorMixin - * @instance - * @param {*} d - * @param {Number} [i] - * @return {String} - */ - _chart.getColor = function (data, index) { - if (typeof data === "undefined") { - var GREY = "#e2e2e2"; - return GREY; - } - var range = _chart.colors().range(); - var middleColor = range[Math.floor(range.length / 2)]; - return _colors(_colorAccessor.call(this, data, index)) || middleColor; - }; - - /** - * Get the color for the datum d and counter i. This is used internally by charts to retrieve a color. - * @name colorCalculator - * @memberof dc.colorMixin - * @instance - * @param {*} [colorCalculator] - * @return {*} - */ - _chart.colorCalculator = function (colorCalculator) { - if (!arguments.length) { - return _chart.getColor; - } - _chart.getColor = colorCalculator; - return _chart; - }; - return _chart; -} - -/***/ }), -/* 18 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = coordinateGridMixin; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_core__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__base_mixin__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__mixins_binning_mixin__ = __webpack_require__(298); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__color_mixin__ = __webpack_require__(17); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_d3__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__core_events__ = __webpack_require__(20); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__core_filters__ = __webpack_require__(29); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__lock_axis_mixin__ = __webpack_require__(56); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__margin_mixin__ = __webpack_require__(26); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_utils__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__core_core_async__ = __webpack_require__(6); - - - - - - - - - - - - -/** - * Coordinate Grid is an abstract base chart designed to support a number of coordinate grid based - * concrete chart types, e.g. bar chart, line chart, and bubble chart. - * @name coordinateGridMixin - * @memberof dc - * @mixin - * @mixes dc.colorMixin - * @mixes dc.marginMixin - * @mixes dc.baseMixin - * @param {Object} _chart - * @return {dc.coordinateGridMixin} - */ - -var DEFAULT_NUM_TICKS = 10; -var MAX_TICK_WIDTH = 64; -var DEFAULT_TIME_DIMENSION_INDEX = 0; -var ENTER_KEY = 13; -var ONE_SECOND_IN_MS = 1000; -function coordinateGridMixin(_chart) { - var GRID_LINE_CLASS = "grid-line"; - var HORIZONTAL_CLASS = "horizontal"; - var VERTICAL_CLASS = "vertical"; - var Y_AXIS_LABEL_CLASS = "y-axis-label"; - var X_AXIS_LABEL_CLASS = "x-axis-label"; - var DEFAULT_AXIS_LABEL_PADDING = 12; - - /* OVERRIDE EXTEND ----------------------------------------------------------*/ - var _hasBeenRendered = false; - /* --------------------------------------------------------------------------*/ - - _chart = Object(__WEBPACK_IMPORTED_MODULE_7__lock_axis_mixin__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_3__color_mixin__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_8__margin_mixin__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_1__base_mixin__["a" /* default */])(_chart)))); - _chart.colors(__WEBPACK_IMPORTED_MODULE_4_d3___default.a.scale.category10()); - _chart._mandatoryAttributes().push("x"); - _chart._rangeFocused = false; - _chart._rangeInput = false; - _chart._binInput = false; - _chart._binSnap = false; - var NO_CACHE = false; - var cachedXTickFormat = NO_CACHE; - var cachedYTickFormat = NO_CACHE; - function zoomHandler() { - _refocused = true; - if (_zoomOutRestrict) { - _chart.x().domain(constrainRange(_chart.x().domain(), _xOriginalDomain)); - if (_rangeChart) { - _chart.x().domain(constrainRange(_chart.x().domain(), _rangeChart.x().domain())); - } - } - var domain = _chart.x().domain(); - var domFilter = __WEBPACK_IMPORTED_MODULE_6__core_filters__["a" /* filters */].RangedFilter(domain[0], domain[1]); - _chart.replaceFilter(domFilter); - _chart.rescale(); - Object(__WEBPACK_IMPORTED_MODULE_10__core_core_async__["h" /* redrawAllAsync */])(_chart.chartGroup()); - } - var _parent; - var _g; - var _chartBodyG; - var _x; - var _xOriginalDomain; - var _xAxis = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.svg.axis().orient("bottom"); - var _xUnits = __WEBPACK_IMPORTED_MODULE_0__core_core__["z" /* units */].integers; - var _xAxisPadding = 0; - var _xElasticity = false; - var _xAxisLabel; - var _xAxisLabelPadding = 0; - var _lastXDomain; - var _y; - var _yAxis = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.svg.axis().orient("left"); - var _yAxisPadding = 0; - var _yElasticity = false; - var _yAxisLabel; - var _yAxisLabelPadding = 0; - var _brush = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.svg.brush(); - var _brushOn = true; - var _isBrushing = false; - var _round; - var _renderHorizontalGridLine = false; - var _renderVerticalGridLine = false; - var _refocused = false, - _resizing = false; - var _unitCount; - var _zoomScale = [1, Infinity]; - var _zoomOutRestrict = true; - var _zoom = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.behavior.zoom().on("zoom", zoomHandler); - var _nullZoom = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.behavior.zoom().on("zoom", null); - var _hasBeenMouseZoomable = false; - var _rangeChart; - var _focusChart; - var _mouseZoomable = false; - var _clipPadding = 0; - var _outerRangeBandPadding = 0.5; - var _rangeBandPadding = 0; - var _useRightYAxis = false; - - /** - * When changing the domain of the x or y scale, it is necessary to tell the chart to recalculate - * and redraw the axes. (`.rescale()` is called automatically when the x or y scale is replaced - * with {@link #dc.coordinateGridMixin+x .x()} or {@link #dc.coordinateGridMixin+y .y()}, and has - * no effect on elastic scales.) - * @name rescale - * @memberof dc.coordinateGridMixin - * @instance - * @return {dc.coordinateGridMixin} - */ - _chart.rescale = function () { - _unitCount = undefined; - _resizing = true; - return _chart; - }; - _chart.resizing = function () { - return _resizing; - }; - - /** - * Get or set the range selection chart associated with this instance. Setting the range selection - * chart using this function will automatically update its selection brush when the current chart - * zooms in. In return the given range chart will also automatically attach this chart as its focus - * chart hence zoom in when range brush updates. - * @name rangeChart - * @memberof dc.coordinateGridMixin - * @instance - * @param {dc.coordinateGridMixin} [rangeChart] - * @return {dc.coordinateGridMixin} - */ - _chart.rangeChart = function (rangeChart) { - if (!arguments.length) { - return _rangeChart; - } - _rangeChart = rangeChart; - if (_rangeChart) { - _rangeChart.focusChart(_chart); - } - return _chart; - }; - - /** - * Get or set the scale extent for mouse zooms. - * @name zoomScale - * @memberof dc.coordinateGridMixin - * @instance - * @param {Array} [extent=[1, Infinity]] - * @return {Array} - * @return {dc.coordinateGridMixin} - */ - _chart.zoomScale = function (extent) { - if (!arguments.length) { - return _zoomScale; - } - _zoomScale = extent; - return _chart; - }; - - /** - * Get or set the zoom restriction for the chart. If true limits the zoom to origional domain of the chart. - * @name zoomOutRestrict - * @memberof dc.coordinateGridMixin - * @instance - * @param {Boolean} [zoomOutRestrict=true] - * @return {Boolean} - * @return {dc.coordinateGridMixin} - */ - _chart.zoomOutRestrict = function (zoomOutRestrict) { - if (!arguments.length) { - return _zoomOutRestrict; - } - _zoomScale[0] = zoomOutRestrict ? 1 : 0; - _zoomOutRestrict = zoomOutRestrict; - return _chart; - }; - _chart._generateG = function (parent, g, chartBodyG) { - if (g) { - _g = g; - _chartBodyG = chartBodyG; - return _g; - } - if (parent === undefined) { - _parent = _chart.svg(); - } else { - _parent = parent; - } - _g = _parent.append("g"); - _chartBodyG = _g.append("g").attr("class", "chart-body").attr("transform", "translate(" + _chart.margins().left + ", " + _chart.margins().top + ")").attr("clip-path", "url(#" + getClipPathId() + ")"); - return _g; - }; - - /** - * Get or set the root g element. This method is usually used to retrieve the g element in order to - * overlay custom svg drawing programatically. **Caution**: The root g element is usually generated - * by dc.js internals, and resetting it might produce unpredictable result. - * @name g - * @memberof dc.coordinateGridMixin - * @instance - * @param {SVGElement} [gElement] - * @return {SVGElement} - * @return {dc.coordinateGridMixin} - */ - _chart.g = function (gElement) { - if (!arguments.length) { - return _g; - } - _g = gElement; - return _chart; - }; - - /** - * Set or get mouse zoom capability flag (default: false). When turned on the chart will be - * zoomable using the mouse wheel. If the range selector chart is attached zooming will also update - * the range selection brush on the associated range selector chart. - * @name mouseZoomable - * @memberof dc.coordinateGridMixin - * @instance - * @param {Boolean} [mouseZoomable=false] - * @return {Boolean} - * @return {dc.coordinateGridMixin} - */ - _chart.mouseZoomable = function (mouseZoomable) { - if (!arguments.length) { - return _mouseZoomable; - } - _mouseZoomable = mouseZoomable; - return _chart; - }; - - /** - * Retrieve the svg group for the chart body. - * @name chartBodyG - * @memberof dc.coordinateGridMixin - * @instance - * @param {SVGElement} [chartBodyG] - * @return {SVGElement} - */ - _chart.chartBodyG = function (chartBodyG) { - if (!arguments.length) { - return _chartBodyG; - } - _chartBodyG = chartBodyG; - return _chart; - }; - - /** - * **mandatory** - * - * Get or set the x scale. The x scale can be any d3 - * {@link https://github.com/mbostock/d3/wiki/Quantitative-Scales quantitive scale} or - * {@link https://github.com/mbostock/d3/wiki/Ordinal-Scales ordinal scale}. - * @name x - * @memberof dc.coordinateGridMixin - * @instance - * @see {@link http://github.com/mbostock/d3/wiki/Scales d3.scale} - * @example - * // set x to a linear scale - * chart.x(d3.scale.linear().domain([-2500, 2500])) - * // set x to a time scale to generate histogram - * chart.x(d3.time.scale().domain([new Date(1985, 0, 1), new Date(2012, 11, 31)])) - * @param {d3.scale} [xScale] - * @return {d3.scale} - * @return {dc.coordinateGridMixin} - */ - _chart.x = function (xScale) { - if (!arguments.length) { - return _x; - } - _x = xScale; - _xOriginalDomain = _x.domain(); - _chart.rescale(); - return _chart; - }; - _chart.xOriginalDomain = function (domain) { - if (!arguments.length) { - return _xOriginalDomain; - } - _xOriginalDomain = domain; - return _chart; - }; - - /** - * Set or get the xUnits function. The coordinate grid chart uses the xUnits function to calculate - * the number of data projections on x axis such as the number of bars for a bar chart or the - * number of dots for a line chart. This function is expected to return a Javascript array of all - * data points on x axis, or the number of points on the axis. [d3 time range functions - * d3.time.days, d3.time.months, and - * d3.time.years](https://github.com/mbostock/d3/wiki/Time-Intervals#aliases) are all valid xUnits - * function. dc.js also provides a few units function, see the {@link #utilities Utilities} section for - * a list of built-in units functions. The default xUnits function is dc.units.integers. - * @name xUnits - * @memberof dc.coordinateGridMixin - * @instance - * @todo Add docs for utilities - * @example - * // set x units to count days - * chart.xUnits(d3.time.days); - * // set x units to count months - * chart.xUnits(d3.time.months); - * - * // A custom xUnits function can be used as long as it follows the following interface: - * // units in integer - * function(start, end, xDomain) { - * // simply calculates how many integers in the domain - * return Math.abs(end - start); - * }; - * - * // fixed units - * function(start, end, xDomain) { - * // be aware using fixed units will disable the focus/zoom ability on the chart - * return 1000; - * @param {Function} [xUnits] - * @return {Function} - * @return {dc.coordinateGridMixin} - */ - _chart.xUnits = function (xUnits) { - if (!arguments.length) { - return _xUnits; - } - _xUnits = xUnits; - return _chart; - }; - - /** - * Set or get the x axis used by a particular coordinate grid chart instance. This function is most - * useful when x axis customization is required. The x axis in dc.js is an instance of a [d3 - * axis object](https://github.com/mbostock/d3/wiki/SVG-Axes#wiki-axis); therefore it supports any - * valid d3 axis manipulation. **Caution**: The x axis is usually generated internally by dc; - * resetting it may cause unexpected results. - * @name xAxis - * @memberof dc.coordinateGridMixin - * @instance - * @see {@link http://github.com/mbostock/d3/wiki/SVG-Axes d3.svg.axis} - * @example - * // customize x axis tick format - * chart.xAxis().tickFormat(function(v) {return v + '%';}); - * // customize x axis tick values - * chart.xAxis().tickValues([0, 100, 200, 300]); - * @param {d3.svg.axis} [xAxis=d3.svg.axis().orient('bottom')] - * @return {d3.svg.axis} - * @return {dc.coordinateGridMixin} - */ - _chart.xAxis = function (xAxis) { - if (!arguments.length) { - return _xAxis; - } - _xAxis = xAxis; - return _chart; - }; - - /** - * Turn on/off elastic x axis behavior. If x axis elasticity is turned on, then the grid chart will - * attempt to recalculate the x axis range whenever a redraw event is triggered. - * @name elasticX - * @memberof dc.coordinateGridMixin - * @instance - * @param {Boolean} [elasticX=false] - * @return {Boolean} - * @return {dc.coordinateGridMixin} - */ - _chart.elasticX = function (elasticX) { - if (!arguments.length) { - return _xElasticity; - } - _xElasticity = elasticX; - return _chart; - }; - - /** - * Set or get x axis padding for the elastic x axis. The padding will be added to both end of the x - * axis if elasticX is turned on; otherwise it is ignored. - * - * padding can be an integer or percentage in string (e.g. '10%'). Padding can be applied to - * number or date x axes. When padding a date axis, an integer represents number of days being padded - * and a percentage string will be treated the same as an integer. - * @name xAxisPadding - * @memberof dc.coordinateGridMixin - * @instance - * @param {Number|String} [padding=0] - * @return {Number|String} - * @return {dc.coordinateGridMixin} - */ - _chart.xAxisPadding = function (padding) { - if (!arguments.length) { - return _xAxisPadding; - } - _xAxisPadding = padding; - return _chart; - }; - - /** - * Returns the number of units displayed on the x axis using the unit measure configured by - * .xUnits. - * @name xUnitCount - * @memberof dc.coordinateGridMixin - * @instance - * @return {Number} - */ - _chart.xUnitCount = function () { - if (_unitCount === undefined) { - var _units = _chart.xUnits()(_chart.x().domain()[0], _chart.x().domain()[1], _chart.x().domain()); - if (_units instanceof Array) { - _unitCount = _units.length; - } else { - _unitCount = _units; - } - } - return _unitCount; - }; - - /** - * Gets or sets whether the chart should be drawn with a right axis instead of a left axis. When - * used with a chart in a composite chart, allows both left and right Y axes to be shown on a - * chart. - * @name useRightYAxis - * @memberof dc.coordinateGridMixin - * @instance - * @param {Boolean} [useRightYAxis=false] - * @return {Boolean} - * @return {dc.coordinateGridMixin} - */ - _chart.useRightYAxis = function (useRightYAxis) { - if (!arguments.length) { - return _useRightYAxis; - } - _useRightYAxis = useRightYAxis; - return _chart; - }; - - /** - * Returns true if the chart is using ordinal xUnits ({@link #dc.units.ordinal dc.units.ordinal}, or false - * otherwise. Most charts behave differently with ordinal data and use the result of this method to - * trigger the appropriate logic. - * @name isOrdinal - * @memberof dc.coordinateGridMixin - * @instance - * @return {Boolean} - */ - _chart.isOrdinal = function () { - return _chart.xUnits() === __WEBPACK_IMPORTED_MODULE_0__core_core__["z" /* units */].ordinal; - }; - _chart._useOuterPadding = function () { - return true; - }; - _chart._ordinalXDomain = function () { - var groups = _chart._computeOrderedGroups(_chart.data()); - return groups.map(_chart.keyAccessor()); - }; - function compareDomains(d1, d2) { - return !d1 || !d2 || d1.length !== d2.length || d1.some(function (elem, i) { - // The date objects here may be invalid for some reason. We detect that by ensuring - // getTime() doesn't return NaN. If invalid, we use toString() instead of toISOString, - // since the former doesn't throw an exception with invalid dates. - var elemString = elem instanceof Date && !isNaN(elem.getTime()) ? elem.toISOString() : elem.toString(); - var d2String = d2[i] instanceof Date && !isNaN(d2[i].getTime()) ? d2[i].toISOString() : d2[i].toString(); - return elem && d2[i] ? elemString !== d2String : elem === d2[i]; - }); - } - function prepareXAxis(g, render) { - if (!_chart.isOrdinal() && _chart.elasticX() && (!_chart.rangeChart() || _chart.rangeChart() && !_chart.rangeChart().filters().length)) { - _x.domain([_chart.xAxisMin(), _chart.xAxisMax()]); - } else if (_chart.elasticX() || _x.domain().length === 0) { - _x.domain(_chart._ordinalXDomain()); - } - var xdom = _x ? _x.domain() : []; - if (render || compareDomains(_lastXDomain, xdom)) { - _chart.rescale(); - } - _lastXDomain = xdom; - if (_chart.isOrdinal()) { - _x.rangeBands([0, _chart.xAxisLength()], _rangeBandPadding, _chart._useOuterPadding() ? _outerRangeBandPadding : 0); - } else { - _x.range([0, _chart.xAxisLength()]); - } - _chart.xAxis().ticks(_chart.getNumTicksForXAxis()); - renderVerticalGridLines(g); - _chart.prepareLabelEdit("x"); - _chart.prepareLockAxis("x"); - } - - /* istanbul ignore next */ - _chart.renderXAxis = function (g) { - var axisXG = g.selectAll("g.x"); - setXAxisFormat(); - if (axisXG.empty()) { - axisXG = g.append("g").attr("class", "axis x").attr("transform", "translate(" + _chart.margins().left + "," + _chart._xAxisY() + ")"); - } - - /* OVERRIDE -----------------------------------------------------------------*/ - var root = _chart.root(); - if (_chart.rangeInput()) { - var rangeDisplay = root.selectAll(".range-display"); - if (rangeDisplay.empty()) { - rangeDisplay = root.append("div").attr("class", "range-display").style("right", _chart.margins().right + "px"); - var group1 = rangeDisplay.append("div"); - rangeDisplay.append("span").html(" — "); - var group2 = rangeDisplay.append("div"); - group1.append("input").attr("class", "range-start-day range-day"); - group1.append("input").attr("class", "range-start-time range-time"); - group2.append("input").attr("class", "range-end-day range-day"); - group2.append("input").attr("class", "range-end-time range-time"); - rangeDisplay.selectAll("input").each(function () { - bindRangeInputEvents(this); - }); - if (_chart.group().binParams()[0] && _chart.group().binParams()[0].timeBin) { - _chart.updateRangeInput(); - } - _chart.root().select("div > .svg-wrapper").on("mouseover", function () { - rangeDisplay.selectAll("input").classed("active", true); - }).on("mouseleave", function () { - rangeDisplay.selectAll("input").classed("active", false); - }); - } - } - var xLabel = root.selectAll(".x-axis-label"); - var shouldAppendLabel = _chart.rangeChart() ? false : xLabel.empty(); - if (shouldAppendLabel) { - xLabel = root.append("div").attr("class", "x-axis-label"); - } - if (!_chart.rangeChart()) { - xLabel.style("left", _chart.effectiveWidth() / 2 + _chart.margins().left + "px").text(_chart.xAxisLabel()); - } - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["y" /* transition */])(axisXG, _chart.transitionDuration()).attr("transform", "translate(" + _chart.margins().left + "," + _chart._xAxisY() + ")").call(_chart.xAxis()); - _chart.updateBinInput(); - }; - function renderVerticalGridLines(g) { - var gridLineG = g.selectAll("g." + VERTICAL_CLASS); - if (_renderVerticalGridLine) { - if (gridLineG.empty()) { - gridLineG = g.insert("g", ":first-child").attr("class", GRID_LINE_CLASS + " " + VERTICAL_CLASS).attr("transform", "translate(" + _chart.margins().left + "," + _chart.margins().top + ")"); - } - var ticks = _xAxis.tickValues() ? _xAxis.tickValues() : typeof _x.ticks === "function" ? _x.ticks(_xAxis.ticks()[0]) : _x.domain(); - var lines = gridLineG.selectAll("line").data(ticks); - var linesGEnter = lines.enter().append("line").attr("x1", function (d) { - return _x(d); - }).attr("y1", _chart._xAxisY() - _chart.margins().top).attr("x2", function (d) { - return _x(d); - }).attr("y2", 0).attr("opacity", 0); - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["y" /* transition */])(linesGEnter, _chart.transitionDuration()).attr("opacity", 1); - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["y" /* transition */])(lines, _chart.transitionDuration()).attr("x1", function (d) { - return _x(d); - }).attr("y1", _chart._xAxisY() - _chart.margins().top).attr("x2", function (d) { - return _x(d); - }).attr("y2", 0); - lines.exit().remove(); - } else { - gridLineG.selectAll("line").remove(); - } - } - _chart._xAxisY = function () { - return _chart.height() - _chart.margins().bottom; - }; - _chart.xAxisLength = function () { - return _chart.effectiveWidth(); - }; - - /** - * Set or get the x axis label. If setting the label, you may optionally include additional padding to - * the margin to make room for the label. By default the padded is set to 12 to accomodate the text height. - * @name xAxisLabel - * @memberof dc.coordinateGridMixin - * @instance - * @param {String} [labelText] - * @param {Number} [padding=12] - * @return {String} - */ - _chart.xAxisLabel = function (labelText, padding) { - if (!arguments.length) { - return _xAxisLabel; - } - _xAxisLabel = labelText; - _chart.margins().bottom -= _xAxisLabelPadding; - _xAxisLabelPadding = padding === undefined ? DEFAULT_AXIS_LABEL_PADDING : padding; - _chart.margins().bottom += _xAxisLabelPadding; - return _chart; - }; - _chart._prepareXAxis = prepareXAxis; - _chart._prepareYAxis = function (g) { - if (_y === undefined || _chart.elasticY()) { - if (_y === undefined) { - _y = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.scale.linear(); - } - var min = _chart.yAxisMin() || 0, - max = _chart.yAxisMax() || 0; - _y.domain([min, max]).rangeRound([_chart.yAxisHeight(), 0]); - } - _y.range([_chart.yAxisHeight(), 0]); - _yAxis = _yAxis.scale(_y); - _yAxis.ticks(_chart.effectiveHeight() / _yAxis.scale().ticks().length < 16 ? Math.ceil(_chart.effectiveHeight() / 16) : 10); - if (_useRightYAxis) { - _yAxis.orient("right"); - } - _chart._renderHorizontalGridLinesForAxis(g, _y, _yAxis); - _chart.prepareLockAxis("y"); - }; - function setYTickFormat(tickFormat, options) { - if (options.toCache && cachedYTickFormat === NO_CACHE) { - cachedYTickFormat = _yAxis.tickFormat(); - } - _yAxis.tickFormat(tickFormat); - if (options.fromCache) { - cachedYTickFormat = NO_CACHE; - } - } - function setYAxisFormat() { - var numberFormatter = _chart.valueFormatter(); - var formatExistsForThisKey = numberFormatter && numberFormatter(null, _chart.yAxisLabel()); - if (formatExistsForThisKey) { - setYTickFormat(function (d) { - return numberFormatter(d, _chart.yAxisLabel()); - }, { - toCache: true - }); - } else if (cachedYTickFormat !== NO_CACHE) { - setYTickFormat(cachedYTickFormat, { - fromCache: true - }); - } - } - function setXTickFormat(tickFormat, options) { - if (options.toCache && cachedXTickFormat === NO_CACHE) { - cachedXTickFormat = _xAxis.tickFormat(); - } - _xAxis.tickFormat(tickFormat); - if (options.fromCache) { - cachedXTickFormat = NO_CACHE; - } - } - function setXAxisFormat() { - var timeBinParam = _chart.group().binParams()[DEFAULT_TIME_DIMENSION_INDEX] || {}; - var domain = _chart.x().domain(); - var dateFormatter = _chart.dateFormatter(); - var numberFormatter = _chart.valueFormatter(); - var dateFormatExistsForThisKey = Boolean(dateFormatter && dateFormatter(new Date(), _chart.xAxisLabel())); - var numberFormatExistsForThisKey = Boolean(numberFormatter && numberFormatter(null, _chart.xAxisLabel())); - if (domain && domain[0] && domain[0] instanceof Date && !timeBinParam.extract && dateFormatExistsForThisKey) { - setXTickFormat(function (d) { - return dateFormatter(d, _chart.xAxisLabel()); - }, { - toCache: true - }); - } else if (!timeBinParam.extract && numberFormatExistsForThisKey) { - setXTickFormat(function (d) { - return numberFormatter(d, _chart.xAxisLabel()); - }, { - toCache: true - }); - } else if (cachedXTickFormat !== NO_CACHE) { - setXTickFormat(cachedXTickFormat, { - fromCache: true - }); - } - } - _chart.renderYAxisAt = function (axisClass, axis, position) { - var axisYG = _chart.g().selectAll("g." + axisClass); - if (axisYG.empty()) { - axisYG = _chart.g().append("g").attr("class", "axis " + axisClass).attr("transform", "translate(" + position + "," + _chart.margins().top + ")"); - } - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["y" /* transition */])(axisYG, _chart.transitionDuration()).attr("transform", "translate(" + position + "," + _chart.margins().top + ")").call(axis); - }; - _chart.renderYAxis = function () { - var axisPosition = _useRightYAxis ? _chart.width() - _chart.margins().right : _chart._yAxisX(); - setYAxisFormat(); - _chart.renderYAxisAt("y", _yAxis, axisPosition); - var labelPosition = _useRightYAxis ? _chart.width() - _yAxisLabelPadding : _yAxisLabelPadding; - var rotation = _useRightYAxis ? 90 : -90; - _chart.renderYAxisLabel("y", _chart.yAxisLabel(), rotation, labelPosition); - }; - _chart._renderHorizontalGridLinesForAxis = function (g, scale, axis) { - var gridLineG = g.selectAll("g." + HORIZONTAL_CLASS); - if (_renderHorizontalGridLine) { - var ticks = axis.tickValues() ? axis.tickValues() : scale.ticks(axis.ticks()[0]); - if (gridLineG.empty()) { - gridLineG = g.insert("g", ":first-child").attr("class", GRID_LINE_CLASS + " " + HORIZONTAL_CLASS).attr("transform", "translate(" + _chart.margins().left + "," + _chart.margins().top + ")"); - } - var lines = gridLineG.selectAll("line").data(ticks); - var linesGEnter = lines.enter().append("line").attr("x1", 1).attr("y1", function (d) { - return scale(d); - }).attr("x2", _chart.xAxisLength()).attr("y2", function (d) { - return scale(d); - }).attr("opacity", 0); - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["y" /* transition */])(linesGEnter, _chart.transitionDuration()).attr("opacity", 1); - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["y" /* transition */])(lines, _chart.transitionDuration()).attr("x1", 1).attr("y1", function (d) { - return scale(d); - }).attr("x2", _chart.xAxisLength()).attr("y2", function (d) { - return scale(d); - }); - lines.exit().remove(); - } else { - gridLineG.selectAll("line").remove(); - } - }; - _chart._yAxisX = function () { - return _chart.useRightYAxis() ? _chart.width() - _chart.margins().right : _chart.margins().left; - }; - - /** - * Set or get the y axis label. If setting the label, you may optionally include additional padding - * to the margin to make room for the label. By default the padded is set to 12 to accomodate the - * text height. - * @name yAxisLabel - * @memberof dc.coordinateGridMixin - * @instance - * @param {String} [labelText] - * @param {Number} [padding=12] - * @return {String} - * @return {dc.coordinateGridMixin} - */ - _chart.yAxisLabel = function (labelText, padding) { - if (!arguments.length) { - return _yAxisLabel; - } - _yAxisLabel = labelText; - _chart.margins().left -= _yAxisLabelPadding; - _yAxisLabelPadding = padding === undefined ? DEFAULT_AXIS_LABEL_PADDING : padding; - _chart.margins().left += _yAxisLabelPadding; - return _chart; - }; - - /** - * Get or set the y scale. The y scale is typically automatically determined by the chart implementation. - * @name y - * @memberof dc.coordinateGridMixin - * @instance - * @see {@link http://github.com/mbostock/d3/wiki/Scales d3.scale} - * @param {d3.scale} [yScale] - * @return {d3.scale} - * @return {dc.coordinateGridMixin} - */ - _chart.y = function (yScale) { - if (!arguments.length) { - return _y; - } - _y = yScale; - _chart.rescale(); - return _chart; - }; - - /** - * Set or get the y axis used by the coordinate grid chart instance. This function is most useful - * when y axis customization is required. The y axis in dc.js is simply an instance of a [d3 axis - * object](https://github.com/mbostock/d3/wiki/SVG-Axes#wiki-_axis); therefore it supports any - * valid d3 axis manipulation. **Caution**: The y axis is usually generated internally by dc; - * resetting it may cause unexpected results. - * @name yAxis - * @memberof dc.coordinateGridMixin - * @instance - * @see {@link http://github.com/mbostock/d3/wiki/SVG-Axes d3.svg.axis} - * @example - * // customize y axis tick format - * chart.yAxis().tickFormat(function(v) {return v + '%';}); - * // customize y axis tick values - * chart.yAxis().tickValues([0, 100, 200, 300]); - * @param {d3.svg.axis} [yAxis=d3.svg.axis().orient('left')] - * @return {d3.svg.axis} - * @return {dc.coordinateGridMixin} - */ - _chart.yAxis = function (yAxis) { - if (!arguments.length) { - return _yAxis; - } - _yAxis = yAxis; - return _chart; - }; - - /** - * Turn on/off elastic y axis behavior. If y axis elasticity is turned on, then the grid chart will - * attempt to recalculate the y axis range whenever a redraw event is triggered. - * @name elasticY - * @memberof dc.coordinateGridMixin - * @instance - * @param {Boolean} [elasticY=false] - * @return {Boolean} - * @return {dc.coordinateGridMixin} - */ - _chart.elasticY = function (elasticY) { - if (!arguments.length) { - return _yElasticity; - } - _yElasticity = elasticY; - return _chart; - }; - - /** - * Turn on/off horizontal grid lines. - * @name renderHorizontalGridLines - * @memberof dc.coordinateGridMixin - * @instance - * @param {Boolean} [renderHorizontalGridLines=false] - * @return {Boolean} - * @return {dc.coordinateGridMixin} - */ - _chart.renderHorizontalGridLines = function (renderHorizontalGridLines) { - if (!arguments.length) { - return _renderHorizontalGridLine; - } - _renderHorizontalGridLine = renderHorizontalGridLines; - return _chart; - }; - - /** - * Turn on/off vertical grid lines. - * @name renderVerticalGridLines - * @memberof dc.coordinateGridMixin - * @instance - * @param {Boolean} [renderVerticalGridLines=false] - * @return {Boolean} - * @return {dc.coordinateGridMixin} - */ - _chart.renderVerticalGridLines = function (renderVerticalGridLines) { - if (!arguments.length) { - return _renderVerticalGridLine; - } - _renderVerticalGridLine = renderVerticalGridLines; - return _chart; - }; - var chooseKeyAccessor = function chooseKeyAccessor(forceMax) { - return function (dataPoint) { - return _chart.isHeatMap ? _chart.keyAccessorNoFormat(forceMax)(dataPoint) : _chart.keyAccessor()(dataPoint); - }; - }; - var chooseValueAccessor = function chooseValueAccessor(forceMax) { - return function (dataPoint) { - return _chart.isHeatMap ? _chart.valueAccessorNoFormat(forceMax)(dataPoint) : _chart.valueAccessor()(dataPoint); - }; - }; - - /** - * Calculates the minimum x value to display in the chart. Includes xAxisPadding if set. - * @name xAxisMin - * @memberof dc.coordinateGridMixin - * @instance - * @return {*} - */ - _chart.xAxisMin = function () { - var min = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.min(_chart.data(), chooseKeyAccessor()); - var max = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.max(_chart.data(), chooseKeyAccessor(true)); - var result = __WEBPACK_IMPORTED_MODULE_9__utils_utils__["l" /* utils */].subtract(min, _xAxisPadding, max - min); - return min instanceof Date ? new Date(result) : result; - }; - - /** - * Calculates the maximum x value to display in the chart. Includes xAxisPadding if set. - * @name xAxisMax - * @memberof dc.coordinateGridMixin - * @instance - * @return {*} - */ - _chart.xAxisMax = function () { - var max = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.max(_chart.data(), chooseKeyAccessor(true)); - var min = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.min(_chart.data(), chooseKeyAccessor()); - var result = __WEBPACK_IMPORTED_MODULE_9__utils_utils__["l" /* utils */].add(max, _xAxisPadding, max - min); - return max instanceof Date ? new Date(result) : result; - }; - - /** - * Calculates the minimum y value to display in the chart. Includes yAxisPadding if set. - * @name yAxisMin - * @memberof dc.coordinateGridMixin - * @instance - * @return {*} - */ - _chart.yAxisMin = function () { - var min = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.min(_chart.data(), chooseValueAccessor()); - var max = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.max(_chart.data(), chooseValueAccessor(true)); - var result = __WEBPACK_IMPORTED_MODULE_9__utils_utils__["l" /* utils */].subtract(min, _yAxisPadding, max - min); - return min instanceof Date ? new Date(result) : result; - }; - - /** - * Calculates the maximum y value to display in the chart. Includes yAxisPadding if set. - * @name yAxisMax - * @memberof dc.coordinateGridMixin - * @instance - * @return {*} - */ - _chart.yAxisMax = function () { - var max = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.max(_chart.data(), chooseValueAccessor(true)); - var min = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.min(_chart.data(), chooseValueAccessor()); - var result = __WEBPACK_IMPORTED_MODULE_9__utils_utils__["l" /* utils */].add(max, _yAxisPadding, max - min); - return max instanceof Date ? new Date(result) : result; - }; - - /** - * Set or get y axis padding for the elastic y axis. The padding will be added to the top of the y - * axis if elasticY is turned on; otherwise it is ignored. - * - * padding can be an integer or percentage in string (e.g. '10%'). Padding can be applied to - * number or date axes. When padding a date axis, an integer represents number of days being padded - * and a percentage string will be treated the same as an integer. - * @name yAxisPadding - * @memberof dc.coordinateGridMixin - * @instance - * @param {Number|String} [padding=0] - * @return {Number} - * @return {dc.coordinateGridMixin} - */ - _chart.yAxisPadding = function (padding) { - if (!arguments.length) { - return _yAxisPadding; - } - _yAxisPadding = padding; - return _chart; - }; - _chart.yAxisHeight = function () { - var height = _chart.effectiveHeight(); - return height < 0 ? 0 : height; - }; - - /** - * Set or get the rounding function used to quantize the selection when brushing is enabled. - * @name round - * @memberof dc.coordinateGridMixin - * @instance - * @example - * // set x unit round to by month, this will make sure range selection brush will - * // select whole months - * chart.round(d3.time.month.round); - * @param {Function} [round] - * @return {Function} - * @return {dc.coordinateGridMixin} - */ - _chart.round = function (round) { - if (!arguments.length) { - return _round; - } - _round = round; - return _chart; - }; - _chart._rangeBandPadding = function (_) { - if (!arguments.length) { - return _rangeBandPadding; - } - _rangeBandPadding = _; - return _chart; - }; - _chart._outerRangeBandPadding = function (_) { - if (!arguments.length) { - return _outerRangeBandPadding; - } - _outerRangeBandPadding = _; - return _chart; - }; - function updateBinParamsForChart(_chart, filter) { - var extract = _chart.binParams()[0] ? _chart.binParams()[0].extract : false; - if (_chart.focusChart() && filter.length && !extract) { - var FocusChart = _chart.focusChart(); - var currentBinParams = FocusChart.binParams(); - if (currentBinParams[0]) { - currentBinParams[0].binBounds = filter; - FocusChart.binParams(currentBinParams); - } - _chart.brush().extent(filter); - } - } - function resetBinParamsForChart(_chart) { - if (_chart.binParams()[0]) { - var extract = _chart.binParams()[0].extract; - var isRangeAndIsNotFiltered = _chart.focusChart() && !_chart.filters().length && !extract; - if (isRangeAndIsNotFiltered) { - var chartBinParams = _chart.focusChart().binParams().map(function (p) { - return p; - }); - chartBinParams[0].binBounds = _chart.binParams()[0].binBounds; - _chart.focusChart().binParams(chartBinParams); - _chart.focusChart().x().domain(_chart.x().domain().slice(0)); - } - } - } - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["r" /* override */])(_chart, "filter", function (filter, isInverseFilter) { - if (!arguments.length) { - return _chart._filter(); - } - _chart._filter(filter, isInverseFilter); - if (filter.length) { - updateBinParamsForChart(_chart, filter); - _chart.brush().extent(filter); - } else { - resetBinParamsForChart(_chart); - _chart.brush().clear(); - } - if (_chart.rangeInput()) { - _chart.updateRangeInput(); - } - return _chart; - }); - _chart.brush = function (_) { - if (!arguments.length) { - return _brush; - } - _brush = _; - return _chart; - }; - _chart.isBrushing = function (_) { - if (!arguments.length) { - return _isBrushing; - } - _isBrushing = _; - return _chart; - }; - function brushHeight() { - var height = _chart._xAxisY() - _chart.margins().top; - return height < 0 ? 0 : height; - } - _chart.renderBrush = function (g) { - if (_brushOn) { - var gBrush = g.select("g.brush").empty() ? g.append("g") : g.select("g.brush"); - gBrush.attr("class", "brush").attr("transform", "translate(" + _chart.margins().left + "," + _chart.margins().top + ")").call(_brush.x(_chart.x()).clamp(false)); - gBrush.select("rect.extent").attr("clip-path", "url(#" + getClipPathId() + ")"); - _chart.setBrushY(gBrush, false); - _chart.setHandlePaths(gBrush); - _brush.on("brush", _chart._brushing); - _brush.on("brushstart", function () { - _isBrushing = true; - _chart._disableMouseZoom(); - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["h" /* disableTransitions */])(true); - }); - _brush.on("brushend", function () { - _isBrushing = false; - configureMouseZoom(); - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["h" /* disableTransitions */])(false); - }); - if (_chart.hasFilter()) { - _chart.redrawBrush(g, false); - } - } - }; - _chart.brushSnap = function () { - if (!__WEBPACK_IMPORTED_MODULE_4_d3___default.a.event.sourceEvent) { - return; - } // only transition after input - _chart.binBrush(); - }; - _chart.triggerReplaceFilter = function (shouldSetSizingFalse) { - _resizing = false; - }; - _chart.setHandlePaths = function (gBrush) { - gBrush.selectAll(".resize").append("path").attr("d", _chart.resizeHandlePath); - }; - _chart.setBrushY = function (gBrush) { - gBrush.selectAll(".brush rect").attr("height", brushHeight()); - gBrush.selectAll(".resize path").attr("d", _chart.resizeHandlePath); - }; - _chart.extendBrush = function () { - var extent = _brush.extent(); - if (_chart.round()) { - extent[0] = extent.map(_chart.round())[0]; - extent[1] = extent.map(_chart.round())[1]; - _g.select(".brush").call(_brush.extent(extent)); - } - return extent; - }; - _chart.brushIsEmpty = function (extent) { - return _brush.empty() || !extent || extent[1] <= extent[0]; - }; - _chart._clampBrush = function () { - if (!__WEBPACK_IMPORTED_MODULE_4_d3___default.a.event.mode) { - return; - } - - // We need to "bin" the domain because that affects the actual brushable - // min/max. - var domain = _chart._binBrushExtent(_brush.x().domain()); - var extent = _brush.extent(); - if (extent[0] < domain[0] || extent[1] > domain[1]) { - if (__WEBPACK_IMPORTED_MODULE_4_d3___default.a.event.mode === "move") { - var offset = extent[0] < domain[0] ? domain[0] - extent[0] : domain[1] - extent[1]; - if (extent[0].getTime) { - extent = extent.map(function (e) { - return new Date(e.getTime() + offset); - }); - } else { - extent = extent.map(function (e) { - return e + offset; - }); - } - } else if (extent[0].getTime) { - extent = extent.map(function (e) { - return new Date(Math.max(domain[0], Math.min(domain[1], e.getTime()))); - }); - } else { - extent = extent.map(function (e) { - return Math.max(domain[0], Math.min(domain[1], e)); - }); - } - _g.select(".brush").call(_brush.extent(extent)); - } - }; - _chart._brushing = function () { - _chart._clampBrush(); - _chart.brushSnap(); - var extent = _chart.extendBrush(); - _chart.redrawBrush(_g, false); - if (_chart.brushIsEmpty(extent)) { - __WEBPACK_IMPORTED_MODULE_5__core_events__["a" /* events */].trigger(function () { - if (_chart.focusChart()) { - _chart.focusChart().filterAll(); - } - _chart.filterAll(); - _chart.redrawGroup(); - }, __WEBPACK_IMPORTED_MODULE_0__core_core__["c" /* constants */].EVENT_DELAY); - } else { - var rangedFilter = __WEBPACK_IMPORTED_MODULE_6__core_filters__["a" /* filters */].RangedFilter(extent[0], extent[1]); - __WEBPACK_IMPORTED_MODULE_5__core_events__["a" /* events */].trigger(function () { - /* OVERRIDE ---------------------------------------------------------------- */ - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["l" /* globalTransitionDuration */])(10); - /* ------------------------------------------------------------------------- */ - _chart.replaceFilter(rangedFilter); - _chart.redrawGroup(); - }, __WEBPACK_IMPORTED_MODULE_0__core_core__["c" /* constants */].EVENT_DELAY); - } - if (_chart.rangeInput()) { - _chart.updateRangeInput(); - } else if (_chart.focusChart() && _chart.focusChart().rangeInput()) { - _chart.focusChart().updateRangeInput(); - } - }; - _chart.redrawBrush = function (g, doTransition) { - if (_brushOn) { - /* OVERRIDE ---------------------------------------------------------------- */ - if (_chart.filter() && (_chart.brush().empty() || _chart._redrawBrushFlag)) { - _chart._redrawBrushFlag = false; - /* ------------------------------------------------------------------------- */ - - _chart.brush().extent(_chart.filter()); - } - var gBrush = Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["q" /* optionalTransition */])(doTransition, _chart.transitionDuration())(g.select("g.brush")); - _chart.setBrushY(gBrush); - gBrush.call(_chart.brush().x(_chart.x()).extent(_chart.brush().extent())); - } - _chart.fadeDeselectedArea(); - }; - _chart.fadeDeselectedArea = function () { - // do nothing, sub-chart should override this function - }; - - // borrowed from Crossfilter example - _chart.resizeHandlePath = function (d) { - var e = Number(d === "e"), - x = e ? 1 : -1, - y = brushHeight() / 3; - return "M" + 0.5 * x + "," + y + "A6,6 0 0 " + e + " " + 6.5 * x + "," + (y + 6) + "V" + (2 * y - 6) + "A6,6 0 0 " + e + " " + 0.5 * x + "," + 2 * y + "Z" + "M" + 2.5 * x + "," + (y + 8) + "V" + (2 * y - 8) + "M" + 4.5 * x + "," + (y + 8) + "V" + (2 * y - 8); - }; - function getClipPathId() { - return _chart.anchorName().replace(/[ .#=\[\]]/g, "-") + "-clip"; - } - - /** - * Get or set the padding in pixels for the clip path. Once set padding will be applied evenly to - * the top, left, right, and bottom when the clip path is generated. If set to zero, the clip area - * will be exactly the chart body area minus the margins. - * @name clipPadding - * @memberof dc.coordinateGridMixin - * @instance - * @param {Number} [padding=5] - * @return {Number} - * @return {dc.coordinateGridMixin} - */ - _chart.clipPadding = function (padding) { - if (!arguments.length) { - return _clipPadding; - } - _clipPadding = padding; - return _chart; - }; - function generateClipPath() { - var defs = __WEBPACK_IMPORTED_MODULE_9__utils_utils__["l" /* utils */].appendOrSelect(_parent, "defs"); - // cannot select elements; bug in WebKit, must select by id - // https://groups.google.com/forum/#!topic/d3-js/6EpAzQ2gU9I - var id = getClipPathId(); - var chartBodyClip = __WEBPACK_IMPORTED_MODULE_9__utils_utils__["l" /* utils */].appendOrSelect(defs, "#" + id, "clipPath").attr("id", id); - var padding = _clipPadding * 2; - __WEBPACK_IMPORTED_MODULE_9__utils_utils__["l" /* utils */].appendOrSelect(chartBodyClip, "rect").attr("width", _chart.xAxisLength() + padding).attr("height", _chart.yAxisHeight() + padding).attr("transform", "translate(-" + _clipPadding + ", -" + _clipPadding + ")"); - } - _chart._preprocessData = function (data) {}; - _chart._doRender = function () { - _chart._redrawBrushFlag = true; - _chart.resetSvg(); - _chart._preprocessData(); - _chart._generateG(); - _chart.root().classed("coordinate-chart", true); - generateClipPath(); - drawChart(true); - configureMouseZoom(); - - /* OVERRIDE ---------------------------------------------------------------- */ - _hasBeenRendered = true; - /* ------------------------------------------------------------------------- */ - return _chart; - }; - _chart._doRedraw = function () { - /* OVERRIDE ---------------------------------------------------------------- */ - if (!_hasBeenRendered) { - // guard to prevent a redraw before a render - return _chart._doRender(); - } - /* ------------------------------------------------------------------------- */ - _chart._preprocessData(); - drawChart(false); - generateClipPath(); - return _chart; - }; - function drawChart(render) { - if (_chart.isOrdinal()) { - _brushOn = false; - } - prepareXAxis(_chart.g(), render); - _chart._prepareYAxis(_chart.g()); - _chart.plotData(); - if (_chart.elasticX() || _resizing || render) { - _chart.renderXAxis(_chart.g()); - } - if (_chart.elasticY() || _resizing || render) { - _chart.renderYAxis(_chart.g()); - } - if (render) { - _chart.renderBrush(_chart.g(), false); - } else { - _chart.redrawBrush(_chart.g(), _resizing); - } - _chart.fadeDeselectedArea(); - _resizing = false; - } - function configureMouseZoom() { - if (_mouseZoomable) { - _chart._enableMouseZoom(); - } else if (_hasBeenMouseZoomable) { - _chart._disableMouseZoom(); - } - } - _chart._enableMouseZoom = function () { - _hasBeenMouseZoomable = true; - _zoom.x(_chart.x()).scaleExtent(_zoomScale).size([_chart.width(), _chart.height()]).duration(_chart.transitionDuration()); - _chart.root().call(_zoom); - }; - _chart._disableMouseZoom = function () { - _chart.root().call(_nullZoom); - }; - function constrainRange(range, constraint) { - var constrainedRange = []; - constrainedRange[0] = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.max([range[0], constraint[0]]); - constrainedRange[1] = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.min([range[1], constraint[1]]); - return constrainedRange; - } - - /** - * Zoom this chart to focus on the given range. The given range should be an array containing only - * 2 elements (`[start, end]`) defining a range in the x domain. If the range is not given or set - * to null, then the zoom will be reset. _For focus to work elasticX has to be turned off; - * otherwise focus will be ignored. - * @name focus - * @memberof dc.coordinateGridMixin - * @instance - * @example - * chart.on('renderlet', function(chart) { - * // smooth the rendering through event throttling - * events.trigger(function(){ - * // focus some other chart to the range selected by user on this chart - * someOtherChart.focus(chart.filter()); - * }); - * }) - * @param {Array} [range] - */ - _chart.focus = function (range) { - if (hasRangeSelected(range)) { - _chart.x().domain(range); - } else { - _chart.x().domain(_xOriginalDomain); - } - _zoom.x(_chart.x()); - zoomHandler(); - }; - _chart.refocused = function () { - return _refocused; - }; - _chart.focusChart = function (c) { - if (!arguments.length) { - return _focusChart; - } - _focusChart = c; - _chart.on("filtered", function (chart) { - /* OVERRIDE ---------------------------------------------------------------- */ - _focusChart.rangeFocused(true); - /* ------------------------------------------------------------------------- */ - - if (!chart.filter()) { - __WEBPACK_IMPORTED_MODULE_5__core_events__["a" /* events */].trigger(function () { - _focusChart.x().domain(_focusChart.xOriginalDomain()); - }); - } else if (!rangesEqual(chart.filter(), _focusChart.filter())) { - __WEBPACK_IMPORTED_MODULE_5__core_events__["a" /* events */].trigger(function () { - _focusChart.focus(chart.filter()); - }); - } - - /* OVERRIDE ---------------------------------------------------------------- */ - _focusChart.rangeFocused(false); - /* ------------------------------------------------------------------------- */ - }); - - return _chart; - }; - function rangesEqual(range1, range2) { - if (!range1 && !range2) { - return true; - } else if (!range1 || !range2) { - return false; - } else if (range1.length === 0 && range2.length === 0) { - return true; - } else if (range1[0].valueOf() === range2[0].valueOf() && range1[1].valueOf() === range2[1].valueOf()) { - return true; - } - return false; - } - - /** - * Turn on/off the brush-based range filter. When brushing is on then user can drag the mouse - * across a chart with a quantitative scale to perform range filtering based on the extent of the - * brush, or click on the bars of an ordinal bar chart or slices of a pie chart to filter and - * un-filter them. However turning on the brush filter will disable other interactive elements on - * the chart such as highlighting, tool tips, and reference lines. Zooming will still be possible - * if enabled, but only via scrolling (panning will be disabled.) - * @name brushOn - * @memberof dc.coordinateGridMixin - * @instance - * @param {Boolean} [brushOn=true] - * @return {Boolean} - * @return {dc.coordinateGridMixin} - */ - _chart.brushOn = function (brushOn) { - if (!arguments.length) { - return _brushOn; - } - _brushOn = brushOn; - return _chart; - }; - function hasRangeSelected(range) { - return range instanceof Array && range.length > 1; - } - _chart.popupTextAccessor = function (arr) { - return function () { - var dateFormatter = _chart.dateFormatter(); - var customFormatter = null; - var value = arr[0].datum.data.key0; - if (Array.isArray(value) && value[0]) { - value = typeof value[0].value !== "undefined" ? value[0].value : value[0]; - } - if (dateFormatter && value instanceof Date) { - customFormatter = dateFormatter; - } - return customFormatter && customFormatter(value) || __WEBPACK_IMPORTED_MODULE_9__utils_utils__["l" /* utils */].formatValue(value); - }; - }; - _chart.getNumTicksForXAxis = function () { - var xDomain = _chart.x().domain(); - var timeBinParam = _chart.group().binParams()[DEFAULT_TIME_DIMENSION_INDEX]; - var effectiveWidth = _chart.effectiveWidth(); - if (timeBinParam && timeBinParam.extract) { - var numTicks = xDomain[xDomain.length - 1] - xDomain[0]; - return effectiveWidth / numTicks < MAX_TICK_WIDTH ? Math.ceil(effectiveWidth / MAX_TICK_WIDTH) : numTicks; - } else { - var _numTicks = _chart.xAxis().scale().ticks().length; - return effectiveWidth / _numTicks < MAX_TICK_WIDTH ? Math.ceil(effectiveWidth / MAX_TICK_WIDTH) : DEFAULT_NUM_TICKS; - } - }; - _chart.rangeFocused = function (_) { - if (!arguments.length) { - return _chart._rangeFocused; - } - _chart._rangeFocused = _; - return _chart; - }; - _chart.rangeInput = function (_) { - if (!arguments.length) { - return _chart._rangeInput; - } - _chart._rangeInput = _; - return _chart; - }; - _chart.binInput = function (_) { - if (!arguments.length) { - return _chart._binInput; - } - _chart._binInput = _; - return _chart; - }; - - /* istanbul ignore next */ - _chart.updateRangeInput = function () { - var dateFormat = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.time.format.utc("%b %d, %Y"); - var timeFormat = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.time.format.utc("%I:%M%p"); - var extent = _chart.filter() || _chart.x().domain(); - var rangeDisplay = _chart.root().selectAll(".range-display"); - var binNumSecs = _chart.binInputOptions().filter(function (d) { - return _chart.group().binParams()[0].timeBin === d.val; - })[0].numSeconds; - rangeDisplay.select(".range-start-day").property("value", dateFormat(extent[0])).attr("value", dateFormat(extent[0])); - rangeDisplay.select(".range-start-time").classed("disable", binNumSecs > 3600).property("value", timeFormat(extent[0])).attr("value", timeFormat(extent[0])); - rangeDisplay.select(".range-end-day").property("value", dateFormat(extent[1])).attr("value", dateFormat(extent[1])); - rangeDisplay.select(".range-end-time").classed("disable", binNumSecs > 3600).property("value", timeFormat(extent[1])).attr("value", timeFormat(extent[1])); - }; - - /* istanbul ignore next */ - function rangeInputOnFocus() { - this.select(); - var dateInputFormat = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.time.format.utc("%m-%d-%Y"); - var timeInputFormat = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.time.format.utc("%I:%M%p"); - var currentInput = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.select(this); - var extent = _chart.filter() || _chart.x().domain(); - var index = currentInput.attr("class").indexOf("start") >= 0 ? 0 : 1; - currentInput.property("value", currentInput.classed("range-day") ? dateInputFormat(extent[index]) : timeInputFormat(extent[index])); - } - - /* istanbul ignore next */ - function rangeInputChange(input) { - var thisInput = this || input; - var currentInput = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.select(thisInput); - var currentValue = currentInput.attr("value"); - var newValue = currentInput.property("value"); - var currentExtent = _chart.filter() || _chart.x().domain(); - var binNumSecs = _chart.binInputOptions().filter(function (d) { - return _chart.group().binParams()[0].timeBin === d.val; - })[0].numSeconds; - var inputFormat = binNumSecs > 3600 ? __WEBPACK_IMPORTED_MODULE_4_d3___default.a.time.format.utc("%m-%d-%Y") : currentInput.attr("class").indexOf("day") >= 0 ? __WEBPACK_IMPORTED_MODULE_4_d3___default.a.time.format.utc("%m-%d-%Y %I:%M%p") : __WEBPACK_IMPORTED_MODULE_4_d3___default.a.time.format.utc("%b %d, %Y %I:%M%p"); - var inputStr = binNumSecs > 3600 ? newValue : __WEBPACK_IMPORTED_MODULE_4_d3___default.a.select(thisInput.parentNode).selectAll(".range-day").property("value") + " " + __WEBPACK_IMPORTED_MODULE_4_d3___default.a.select(thisInput.parentNode).selectAll(".range-time").property("value"); - var date = inputFormat.parse(inputStr); - if (!date) { - currentInput.property("value", currentValue); - thisInput.blur(); - return; - } - var extentChart = _chart.rangeChart() ? _chart.rangeChart() : _chart; - var extent = extentChart.filter() || extentChart.x().domain(); - var index = currentInput.attr("class").indexOf("start") >= 0 ? 0 : 1; - var other = index === 0 ? 1 : 0; - extent[index] = date < extentChart.xAxisMin() ? extentChart.xAxisMin() : date > extentChart.xAxisMax() ? extentChart.xAxisMax() : date; - if (binNumSecs > 3600) { - extent[other] = __WEBPACK_IMPORTED_MODULE_4_d3___default.a.time.day.utc.round(extent[other]); - } - extent.sort(function (a, b) { - return a - b; - }); - if (extent[0].getTime() === extent[1].getTime()) { - extent[1] = new Date(extent[1].getTime() + binNumSecs * ONE_SECOND_IN_MS); - } - if (_chart._binInput) { - extent[1] = new Date(extent[1].getTime()); - } - var domFilter = __WEBPACK_IMPORTED_MODULE_6__core_filters__["a" /* filters */].RangedFilter(extent[0], extent[1]); - extentChart.replaceFilter(domFilter); - extentChart.rescale(); - extentChart.redrawAsync().then(function () { - if (_chart.rangeChart()) { - _chart._binSnap = _chart._binInput; - _chart.focus(domFilter); - _chart.replaceFilter(domFilter); - } - thisInput.blur(); - _chart.updateRangeInput(); - _chart.redrawGroup(); - }); - } - - /* istanbul ignore next */ - _chart.renderYAxisLabel = function (axisClass, text, rotation) { - var root = _chart.root(); - var yLabel = root.selectAll(".y-axis-label"); - if (yLabel.empty()) { - yLabel = root.append("div").attr("class", "y-axis-label"); - } - if (text !== "") { - var yOffset = _chart.rangeChart() ? _chart.rangeChart().height() - _chart.rangeChart().margins().bottom + _chart.margins().bottom : _chart.margins().bottom; - yLabel.style("top", (_chart.effectiveHeight() + yOffset) / 2 + _chart.margins().top + "px").text(text); - } - _chart.prepareLabelEdit("y"); - }; - - /* istanbul ignore next */ - _chart.updateBinInput = function () { - if (_chart.binInput() && _chart.group().binParams()[0]) { - var root = _chart.root(); - var binRow = root.selectAll(".bin-row"); - if (binRow.empty()) { - binRow = root.append("div").attr("class", "bin-row").style("left", _chart.margins().left + "px"); - } - binRow.html("").append("span").text("BIN:"); - var binRowItems = binRow.selectAll(".bin-row-item").data(_chart.binInputOptions()).enter(); - var rangeInSeconds = Math.abs((_chart.x().domain()[0].getTime() - _chart.x().domain()[1].getTime()) / ONE_SECOND_IN_MS); - var _chart$group$binParam = _chart.group().binParams()[0], - auto = _chart$group$binParam.auto, - timeBin = _chart$group$binParam.timeBin, - numBins = _chart$group$binParam.numBins; - var shouldShowTimeBinOption = function shouldShowTimeBinOption(d) { - return d.numSeconds && rangeInSeconds / d.numSeconds > numBins || d.numSeconds && rangeInSeconds / d.numSeconds < 2; - }; - binRowItems.append("div").attr("class", "bin-row-item").classed("inactive", function (d) { - return shouldShowTimeBinOption(d); - }).classed("active", function (d) { - if (d.val === "auto" && auto) { - return true; - } else if (!auto) { - return d.val === timeBin; - } - }).classed("underline", function (d) { - return auto && d.val === timeBin; - }).text(function (d) { - return d.label; - }).on("click", function (d) { - return _chart.changeBinVal(d.val); - }); - } - }; - - /* istanbul ignore next */ - function bindRangeInputEvents(input) { - __WEBPACK_IMPORTED_MODULE_4_d3___default.a.select(input).on("focus", rangeInputOnFocus).on("keydown", function () { - if (__WEBPACK_IMPORTED_MODULE_4_d3___default.a.event.keyCode === ENTER_KEY) { - rangeInputChange(this); - } - }); - } - _chart = Object(__WEBPACK_IMPORTED_MODULE_2__mixins_binning_mixin__["a" /* default */])(_chart); - return _chart; -} - -/***/ }), -/* 19 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return PropDescriptor; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Enums_PropLocation__ = __webpack_require__(244); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Enums_MeasurementType__ = __webpack_require__(33); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__RasterLayerContext__ = __webpack_require__(27); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__Enums_PropLocation__["a"]; }); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_1__Enums_MeasurementType__["a"]; }); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } - - - -// jsdoc import only -// eslint-disable-next-line no-unused-vars - - -var PropDescriptor = /*#__PURE__*/function () { - /** - * @param {string} prop_name - * @param {string} [vega_prop_name=null] - * @param {PropLocation} [prop_location=PropLocation.kEncodingPlusMarkDef] - * @param {PropDescriptor} [fallback_prop=null] - * @param {boolean} [can_have_scale_definition=true] - */ - function PropDescriptor(prop_name) { - var vega_prop_name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - var prop_location = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : __WEBPACK_IMPORTED_MODULE_0__Enums_PropLocation__["a" /* default */].kEncodingPlusMarkDef; - var fallback_prop = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; - var can_have_scale_definition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; - _classCallCheck(this, PropDescriptor); - this.prop_name_ = prop_name; - /** - * @type {string[]} - */ - this.vega_prop_names_ = []; - if (vega_prop_name === null) { - this.vega_prop_names_.push(prop_name); - } else if (vega_prop_name.length > 0) { - this.vega_prop_names_.push(vega_prop_name); - } - this.fallback_prop_ = fallback_prop; - if (this.fallback_prop_) { - var context = this; - this.vega_mark_prop_names.forEach(function (vega_prop_name) { - if (!context.fallback_prop_.vega_prop_names_.includes(vega_prop_name)) { - context.fallback_prop_.vega_prop_names_.push(vega_prop_name); - } - }); - } - this.prop_location_ = prop_location; - this.can_have_scale_definition_ = can_have_scale_definition; - } - - /** - * @returns {string} - */ - _createClass(PropDescriptor, [{ - key: "prop_name", - get: function get() { - return this.prop_name_; - } - - /** - * @returns {PropLocation} - */ - }, { - key: "prop_location", - get: function get() { - return this.prop_location_; - } - - /** - * @returns {PropDescriptor} - */ - }, { - key: "fallback_prop", - get: function get() { - return this.fallback_prop_; - } - - /** - * @type {string[]} - */ - }, { - key: "vega_mark_prop_names", - get: function get() { - return this.vega_prop_names_; - } - - /** - * @returns {boolean} - */ - }, { - key: "can_have_scale_definition", - get: function get() { - return this.can_have_scale_definition_; - } - - /** - * Validates the property descriptor with the active context - * Should throw an error if validation fails - * @param {RasterLayerContext} raster_layer_context - */ - // eslint-disable-next-line no-unused-vars - }, { - key: "validateContext", - value: function validateContext(raster_layer_context) {} - - /** - * @param {(string|number|boolean)} prop_definition - */ - }, { - key: "isValidMarkDefinition", - value: function isValidMarkDefinition(prop_definition) { - var is_valid = typeof prop_definition === "number" || typeof prop_definition === "string" || typeof prop_definition === "boolean"; - if (!is_valid) { - prop_definition.error_message = "Invalid value ".concat(prop_definition, ". It must be a number, string, or boolean"); - } - return is_valid; - } - - /** - * @param {(Object|string|number|boolean)} prop_definition - * @returns {(Object|string|numbr|boolean)} - */ - }, { - key: "materializeMarkDefinitionForVega", - value: function materializeMarkDefinitionForVega(prop_definition) { - // pass thru, as long as everything validated - return prop_definition; - } - - /** - * @param {ValueDefinitionObject} value_definition_object - */ - }, { - key: "isValidValueDefinition", - value: function isValidValueDefinition(value_definition_object) { - if (!this.isValidMarkDefinition(value_definition_object.value)) { - value_definition_object.error_message = value_definition_object.value.error_message; - return false; - } - return true; - } - - /** - * @param {(Object|string|number|boolean)} prop_definition - * @returns {(Object|string|numbr|boolean)} - */ - }, { - key: "materiailzeEncodingValueDefinitionForVega", - value: function materiailzeEncodingValueDefinitionForVega(prop_definition) { - return this.materializeMarkDefinitionForVega(prop_definition); - } - - /** - * @param {MeasurementType} measurement_type - */ - // eslint-disable-next-line no-unused-vars - }, { - key: "validateMeasurementType", - value: function validateMeasurementType(measurement_type) { - // no-op. Can be overwritten by derived classes that need - // specialization - } - - /** - * @returns {MeasurementType} - */ - }, { - key: "getDefaultMeasurementType", - value: function getDefaultMeasurementType() { - return __WEBPACK_IMPORTED_MODULE_1__Enums_MeasurementType__["a" /* default */].kNominal; - } - - /** - * @param {ParentInfo} parent_info - * @returns {Object} - */ - // eslint-disable-next-line no-unused-vars - }, { - key: "buildDefaultScaleDefinition", - value: function buildDefaultScaleDefinition(parent_info) { - // eslint-disable-next-line no-warning-comments - // TODO(croot): move this into a scale-enabled descriptor mixin - return {}; - } - }]); - return PropDescriptor; -}(); - - -/***/ }), -/* 20 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return events; }); -var events = { - current: null -}; - -/** - * This function triggers a throttled event function with a specified delay (in milli-seconds). Events - * that are triggered repetitively due to user interaction such brush dragging might flood the library - * and invoke more renders than can be executed in time. Using this function to wrap your event - * function allows the library to smooth out the rendering by throttling events and only responding to - * the most recent event. - * @name events.trigger - * @memberof dc - * @example - * chart.on('renderlet', function(chart) { - * // smooth the rendering through event throttling - * dc.events.trigger(function(){ - * // focus some other chart to the range selected by user on this chart - * someOtherChart.focus(chart.filter()); - * }); - * }) - * @param {Function} closure - * @param {Number} [delay] - */ -events.trigger = function (closure, delay) { - if (!delay) { - closure(); - return; - } - events.current = closure; - setTimeout(function () { - if (closure === events.current) { - closure(); - } - }, delay); -}; - -/***/ }), -/* 21 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = capMixin; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_core__ = __webpack_require__(3); - - -/** - * Cap is a mixin that groups small data elements below a _cap_ into an *others* grouping for both the - * Row and Pie Charts. - * - * The top ordered elements in the group up to the cap amount will be kept in the chart, and the rest - * will be replaced with an *others* element, with value equal to the sum of the replaced values. The - * keys of the elements below the cap limit are recorded in order to filter by those keys when the - * others* element is clicked. - * @name capMixin - * @memberof dc - * @mixin - * @param {Object} _chart - * @return {dc.capMixin} - */ -function capMixin(_chart) { - var _cap; - var _ordering = "desc"; - var _othersLabel = "Others"; - var _othersGrouper = function _othersGrouper(topRows) { - var topRowsSum = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.sum(topRows, _chart.valueAccessor()), - allRows = _chart.group().all(), - allRowsSum = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.sum(allRows, _chart.valueAccessor()), - topKeys = topRows.map(_chart.keyAccessor()), - allKeys = allRows.map(_chart.keyAccessor()), - topSet = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.set(topKeys), - others = allKeys.filter(function (d) { - return !topSet.has(d); - }); - if (allRowsSum > topRowsSum) { - return topRows.concat([{ - others: others, - key: _othersLabel, - value: allRowsSum - topRowsSum - }]); - } - return topRows; - }; - _chart._mandatoryAttributes().push("cap"); - _chart.cappedKeyAccessor = function (d, i) { - if (d.others) { - /* OVERRIDE ---------------------------------------------------------------- */ - return d.key; - /* ------------------------------------------------------------------------- */ - } - - return _chart.keyAccessor()(d, i); - }; - _chart.cappedValueAccessor = function (d, i) { - if (d.others) { - return d.value; - } - return _chart.valueAccessor()(d, i); - }; - _chart.cappedLabel = function (d) { - if (d.others) { - return _chart.othersLabel(); - } - return _chart.label()(d); - }; - - /* OVERRIDE EXTEND --------------------------------------------------------- */ - _chart.ordering = function (order) { - _chart.expireCache(); - if (!order) { - return _ordering; - } - _ordering = order; - return _chart; - }; - _chart.setDataAsync(function (group, callback) { - function resultCallback(error, result) { - if (error) { - callback(error); - return; - } - var rows = _chart._computeOrderedGroups(result); - if (_othersGrouper) { - callback(null, _othersGrouper(rows)); - } else { - callback(null, rows); - } - } - if (_cap === undefined) { - if (_chart.dataCache != null) { - callback(null, _chart._computeOrderedGroups(_chart.dataCache)); - } else { - group.allAsync(function (error, result) { - if (error) { - callback(error); - return; - } - callback(null, _chart._computeOrderedGroups(result)); - }); - } - } else if (_chart.dataCache != null) { - resultCallback(null, _chart.dataCache); - } else if (_ordering === "desc") { - return group.topAsync(_cap).then(function (result) { - resultCallback(null, result); - })["catch"](function (error) { - resultCallback(error); - }); - } else if (_ordering === "asc") { - group.bottomAsync(_cap, undefined, undefined, resultCallback); // ordered by crossfilter group order (default value) - } - }); - - _chart.expireCache = function () { - _chart.dataCache = null; - }; - _chart.data(function (group) { - if (!_chart.dataCache) { - console.warn("Empty dataCache. Please fetch new data"); - } - if (_cap === undefined) { - return _chart._computeOrderedGroups(_chart.dataCache); - } else { - var rows = _chart.dataCache; - if (_othersGrouper) { - return _othersGrouper(rows); - } - return rows; - } - }); - - /* ------------------------------------------------------------------------- */ - - /** - * Get or set the count of elements to that will be included in the cap. - * @name cap - * @memberof dc.capMixin - * @instance - * @param {Number} [count=Infinity] - * @return {Number} - * @return {dc.capMixin} - */ - _chart.cap = function (count) { - if (!arguments.length) { - return _cap; - } - _cap = count; - _chart.expireCache(); - return _chart; - }; - - /** - * Get or set the label for *Others* slice when slices cap is specified - * @name othersLabel - * @memberof dc.capMixin - * @instance - * @param {String} [label="Others"] - * @return {String} - * @return {dc.capMixin} - */ - _chart.othersLabel = function (label) { - if (!arguments.length) { - return _othersLabel; - } - _othersLabel = label; - return _chart; - }; - - /** - * Get or set the grouper function that will perform the insertion of data for the *Others* slice - * if the slices cap is specified. If set to a falsy value, no others will be added. By default the - * grouper function computes the sum of all values below the cap. - * @name othersGrouper - * @memberof dc.capMixin - * @instance - * @example - * // Default others grouper - * chart.othersGrouper(function (topRows) { - * var topRowsSum = d3.sum(topRows, _chart.valueAccessor()), - * allRows = _chart.group().all(), - * allRowsSum = d3.sum(allRows, _chart.valueAccessor()), - * topKeys = topRows.map(_chart.keyAccessor()), - * allKeys = allRows.map(_chart.keyAccessor()), - * topSet = d3.set(topKeys), - * others = allKeys.filter(function (d) {return !topSet.has(d);}); - * if (allRowsSum > topRowsSum) { - * return topRows.concat([{'others': others, 'key': _othersLabel, 'value': allRowsSum - topRowsSum}]); - * } - * return topRows; - * }); - * // Custom others grouper - * chart.othersGrouper(function (data) { - * // compute the value for others, presumably the sum of all values below the cap - * var othersSum = yourComputeOthersValueLogic(data) - * - * // the keys are needed to properly filter when the others element is clicked - * var othersKeys = yourComputeOthersKeysArrayLogic(data); - * - * // add the others row to the dataset - * data.push({'key': 'Others', 'value': othersSum, 'others': othersKeys }); - * - * return data; - * }); - * @param {Function} [grouperFunction] - * @return {Function} - * @return {dc.capMixin} - */ - _chart.othersGrouper = function (grouperFunction) { - if (!arguments.length) { - return _othersGrouper; - } - _othersGrouper = grouperFunction; - return _chart; - }; - Object(__WEBPACK_IMPORTED_MODULE_1__core_core__["r" /* override */])(_chart, "onClick", function (d) { - if (d.others) { - _chart.filter([d.others]); - } - if (_chart._onClick) { - _chart._onClick(d); - } - }); - return _chart; -} - -/***/ }), -/* 22 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CommonChannels_ColorChannelDescriptor__ = __webpack_require__(243); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__CommonChannels_ColorChannelDescriptor__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CommonChannels_GeographicChannelDescriptor__ = __webpack_require__(374); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_1__CommonChannels_GeographicChannelDescriptor__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__CommonChannels_OpacityChannelDescriptor__ = __webpack_require__(375); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_2__CommonChannels_OpacityChannelDescriptor__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__CommonChannels_PositionChannelDescriptor__ = __webpack_require__(376); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_3__CommonChannels_PositionChannelDescriptor__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__CommonChannels_SizeChannelDescriptor__ = __webpack_require__(377); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_4__CommonChannels_SizeChannelDescriptor__["a"]; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__PropDescriptor__ = __webpack_require__(19); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_5__PropDescriptor__["c"]; }); -/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_5__PropDescriptor__["b"]; }); -/* unused harmony reexport MeasurementType */ - - - - - - - -/***/ }), -/* 23 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return VegaPropertyOutputState; }); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } -function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -/** - * @typedef {Object} VegaStateMaps - * @property {Map} sql_parser_transforms - * @property {Map} vega_data_formats - * @property {Map} vega_transforms - * @property {Map} vega_scales - * @property {Map} mark_properties - * @property {Map} legend_properties - */ -/** - * @typedef {Object} VegaStateArrays - * @property {Object[]} sql_parser_transforms - * @property {Object[]} vega_data_formats - * @property {Object[]} vega_transforms - * @property {Object[]} vega_scales - * @property {Object[]} mark_properties - */ -var VegaPropertyOutputState = /*#__PURE__*/function () { - function VegaPropertyOutputState() { - _classCallCheck(this, VegaPropertyOutputState); - /** - * @type {VegaStateMaps} - */ - this.vega_state_maps_ = { - sql_parser_transforms: new Map(), - vega_data_formats: new Map(), - vega_transforms: new Map(), - vega_scales: new Map(), - mark_properties: new Map(), - legend_properties: new Map() - }; - this.realignment_definitions = []; - } - _createClass(VegaPropertyOutputState, [{ - key: "sql_parser_transforms", - get: function get() { - return this.vega_state_maps_.sql_parser_transforms; - } - }, { - key: "vega_data_formats", - get: function get() { - return this.vega_state_maps_.vega_data_formats; - } - }, { - key: "vega_transforms", - get: function get() { - return this.vega_state_maps_.vega_transforms; - } - }, { - key: "vega_scales", - get: function get() { - return this.vega_state_maps_.vega_scales; - } - }, { - key: "mark_properties", - get: function get() { - return this.vega_state_maps_.mark_properties; - } - }, { - key: "legend_properties", - get: function get() { - return this.vega_state_maps_.legend_properties; - } - - /** - * @param {string} prop_name - * @returns {boolean} - */ - }, { - key: "has", - value: function has(prop_name) { - for (var _i = 0, _Object$values = Object.values(this.vega_state_maps_); _i < _Object$values.length; _i++) { - var map_instance = _Object$values[_i]; - if (map_instance.has(prop_name)) { - return true; - } - } - return false; - } - - /** - * @returns {VegaStateArrays} - */ - }, { - key: "flatten", - value: function flatten() { - var output_object = {}; - for (var _i2 = 0, _Object$entries = Object.entries(this.vega_state_maps_); _i2 < _Object$entries.length; _i2++) { - var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2), - key = _Object$entries$_i[0], - map_instance = _Object$entries$_i[1]; - output_object[key] = Array.from(map_instance.values()); - } - return output_object; - } - - /** - * @param {string} prop_name - * @param {Object} transform_obj - */ - }, { - key: "addSqlParserTransform", - value: function addSqlParserTransform(prop_name, transform_obj) { - this.vega_state_maps_.sql_parser_transforms.set(prop_name, transform_obj); - } - - /** - * @param {string} prop_name - * @param {Object} vega_data_format_obj - */ - }, { - key: "addVegaDataFormat", - value: function addVegaDataFormat(prop_name, vega_data_format_obj) { - if (this.vega_state_maps_.vega_data_formats.size > 0) { - throw new Error("Cannot add new vega data format with prop name '".concat(prop_name, "'. A vega data format objet is already defined for '").concat(this.vega_state_maps_.vega_data_formats.keys()[0], "'. Only 1 data format object at a time is supported.")); - } - this.vega_state_maps_.vega_data_formats.set(prop_name, vega_data_format_obj); - } - - /** - * @param {string} prop_name - * @param {Object} vega_transform_obj - */ - }, { - key: "addVegaTransform", - value: function addVegaTransform(prop_name, vega_transform_obj) { - this.vega_state_maps_.vega_transforms.set(prop_name, vega_transform_obj); - } - - /** - * @param {string} prop_name - * @param {Object} vega_scale_obj - */ - }, { - key: "addVegaScale", - value: function addVegaScale(prop_name, vega_scale_obj) { - this.vega_state_maps_.vega_scales.set(prop_name, vega_scale_obj); - } - - /** - * - * @param {PropDescriptor} prop_descriptor - */ - }, { - key: "getScaleForProp", - value: function getScaleForProp(prop_descriptor) { - var scale_obj = this.vega_state_maps_.vega_scales.get(prop_descriptor.prop_name); - if (!scale_obj) { - var fallback_prop_descriptor = prop_descriptor.fallback_prop; - if (fallback_prop_descriptor) { - scale_obj = this.getScaleForProp(fallback_prop_descriptor); - } else { - scale_obj = null; - } - } - return scale_obj; - } - - /** - * @param {string} prop_name - * @param {Object} property_obj - */ - }, { - key: "addMarkProperty", - value: function addMarkProperty(prop_name, property_obj) { - this.vega_state_maps_.mark_properties.set(prop_name, property_obj); - } - - /** - * @param {string} prop_name - * @param {Object} legend_obj - */ - }, { - key: "addLegendForProperty", - value: function addLegendForProperty(prop_name, legend_obj) { - this.vega_state_maps_.legend_properties.set(prop_name, legend_obj); - } - - /** - * @param {PropDescriptor} prop_descriptor - */ - }, { - key: "getLegendForProperty", - value: function getLegendForProperty(prop_descriptor) { - var legend_obj = this.vega_state_maps_.legend_properties.get(prop_descriptor.prop_name); - if (!legend_obj) { - var fallback_prop_descriptor = prop_descriptor.fallback_prop; - if (fallback_prop_descriptor) { - legend_obj = this.getLegendForProperty(fallback_prop_descriptor); - } else { - legend_obj = null; - } - } - return legend_obj; - } - }, { - key: "addRealignmentDefinition", - value: function addRealignmentDefinition(property_definition) { - this.realignment_definitions.push(property_definition); - } - }, { - key: "clearRealignments", - value: function clearRealignments() { - this.realignment_definitions = []; - } - }]); - return VegaPropertyOutputState; -}(); - - -/***/ }), -/* 24 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ContinuousScale; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_assert__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ScaleDefinitionObject__ = __webpack_require__(35); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__FieldDefinitionObject__ = __webpack_require__(34); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__PropDescriptor_Enums_MeasurementType__ = __webpack_require__(33); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Enums_ScaleType__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Enums_InterpolateType__ = __webpack_require__(389); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Enums_ExtentFlags__ = __webpack_require__(63); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Enums_AccumulatorType__ = __webpack_require__(390); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__PropDescriptor_CommonChannels_ColorChannelDescriptor__ = __webpack_require__(243); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } - - - - - - - - - -var ContinuousScale = /*#__PURE__*/function (_ScaleDefinitionObjec) { - _inherits(ContinuousScale, _ScaleDefinitionObjec); - var _super = _createSuper(ContinuousScale); - /** - * @param {Object} scale_definition_object - * @param {ScaleType} scale_type - * @param {ParentInfo} parent_info - */ - function ContinuousScale(scale_definition_object, scale_type, parent_info) { - var _this; - _classCallCheck(this, ContinuousScale); - __WEBPACK_IMPORTED_MODULE_0_assert___default()(ContinuousScale.isContinuousScale(scale_type), "Invalid ".concat(ContinuousScale.name, " scale type ").concat(scale_type)); - _this = _super.call(this, scale_definition_object, scale_type, parent_info); - _this.clamp_ = true; - if (Object.hasOwn(scale_definition_object, "clamp")) { - if (typeof scale_definition_object.clamp !== "boolean") { - _this.error_message = "Invalid 'clamp' property. The 'clamp' property must be a boolean for continuous scales"; - return _possibleConstructorReturn(_this); - } - _this.clamp_ = scale_definition_object.clamp; - } - _this.interpolate_type_ = __WEBPACK_IMPORTED_MODULE_5__Enums_InterpolateType__["a" /* default */].kAuto; - if (Object.hasOwn(scale_definition_object, "interpolate")) { - if (typeof scale_definition_object.interpolate !== "string") { - _this.error_message = "Invalid ".concat(scale_definition_object.interpolate, " value for the 'interpolate' property of a continuous scale. It must be a string and must be one of ").concat(Object.keys(__WEBPACK_IMPORTED_MODULE_5__Enums_InterpolateType__["a" /* default */].val_to_enum_map_)); - } - _this.interpolate_type_ = __WEBPACK_IMPORTED_MODULE_5__Enums_InterpolateType__["a" /* default */].getInterpolateTypeFromString(scale_definition_object.interpolate); - } - return _this; - } - - // eslint-disable-next-line no-undef - _createClass(ContinuousScale, [{ - key: "_materializeDomainFromKeyword", - value: - /** - * @param {string} domain_keyword - * @param {PropDescriptor} prop_descriptor - * @param {VegaPropertyOutputState} vega_property_output_state - */ - function _materializeDomainFromKeyword(domain_keyword, prop_descriptor, vega_property_output_state) { - if (this.domain_ === "auto") { - /** - * @type {FieldDefinitionObject} - */ - var parent = this.parent; - __WEBPACK_IMPORTED_MODULE_0_assert___default()(parent instanceof __WEBPACK_IMPORTED_MODULE_2__FieldDefinitionObject__["a" /* default */]); - var num_subdivisions = this.range_.length - 2; - if (num_subdivisions > ContinuousScale.max_subdivisions) { - throw new Error("There are too many ranges (".concat(this.range_.length, ") to auto-fill a domain. The max number of ranges is ").concat(ContinuousScale.max_subdivisions + 2)); - } - var _ContinuousScale$buil = ContinuousScale.buildExtentsVegaTransform(parent.output, this.root_context.layer_name, prop_descriptor.prop_name, - // should equate to: [max(min, avg - 2*stddev), min(max, avg + 2*stddev)] - __WEBPACK_IMPORTED_MODULE_6__Enums_ExtentFlags__["a" /* default */].kMin | __WEBPACK_IMPORTED_MODULE_6__Enums_ExtentFlags__["a" /* default */].kMax | __WEBPACK_IMPORTED_MODULE_6__Enums_ExtentFlags__["a" /* default */].kTwoSigma, this.range_.length - 2), - vega_xform_obj = _ContinuousScale$buil.vega_xform_obj, - scale_domain_ref = _ContinuousScale$buil.scale_domain_ref; - vega_property_output_state.addVegaTransform(prop_descriptor.prop_name, vega_xform_obj); - return scale_domain_ref; - } else if (this.domain_ === __WEBPACK_IMPORTED_MODULE_7__Enums_AccumulatorType__["a" /* default */].kDensity.toString()) { - this.accumulator_ = __WEBPACK_IMPORTED_MODULE_7__Enums_AccumulatorType__["a" /* default */].kDensity; - // NOTE: going to the domain out later in _materializeExtraVegaScaleProps - // after the ranges have been materialized/validated - return []; - } - throw new Error("'".concat(domain_keyword, "' is not a valid domain keyword for continuous scale type ").concat(this.type)); - } - - /** - * @param {string} range_keyword - * @param {PropDescriptor} prop_descriptor - * @param {VegaPropertyOutputState} vega_property_output_state - */ - }, { - key: "_materializeRangeFromKeyword", - value: function _materializeRangeFromKeyword(range_keyword, prop_descriptor, - // eslint-disable-next-line no-unused-vars - vega_property_output_state) { - throw new Error("'".concat(range_keyword, "' is not a valid range keyword for continuous scale type ").concat(this.type)); - } - - /** - * - * @param {PropDescriptor} prop_descriptor - * @param {Object} vega_scale_object - */ - }, { - key: "_materializeExtraVegaScaleProps", - value: function _materializeExtraVegaScaleProps(prop_descriptor, vega_scale_object) { - vega_scale_object.clamp = this.clamp_; - if (this.interpolate_type_ !== __WEBPACK_IMPORTED_MODULE_5__Enums_InterpolateType__["a" /* default */].kAuto && prop_descriptor instanceof __WEBPACK_IMPORTED_MODULE_8__PropDescriptor_CommonChannels_ColorChannelDescriptor__["a" /* default */]) { - vega_scale_object.interpolator = "".concat(this.interpolate_type_); - } - if (this.accumulator_ !== null) { - __WEBPACK_IMPORTED_MODULE_0_assert___default()(this.accumulator_ === __WEBPACK_IMPORTED_MODULE_7__Enums_AccumulatorType__["a" /* default */].kDensity); - __WEBPACK_IMPORTED_MODULE_0_assert___default()(Array.isArray(vega_scale_object.domain)); - __WEBPACK_IMPORTED_MODULE_0_assert___default()(vega_scale_object.domain.length === 0); - if (!(prop_descriptor instanceof __WEBPACK_IMPORTED_MODULE_8__PropDescriptor_CommonChannels_ColorChannelDescriptor__["a" /* default */])) { - throw new Error("Density accumulation scales can only be applied to color properties"); - } - __WEBPACK_IMPORTED_MODULE_0_assert___default()(Array.isArray(vega_scale_object.range)); - __WEBPACK_IMPORTED_MODULE_0_assert___default()(vega_scale_object.range.length > 1); - var density_diff = 1.0 / (vega_scale_object.range.length - 1); - for (var density_val = 0.0; density_val <= 1.0; density_val += density_diff) { - vega_scale_object.domain.push(density_val); - } - vega_scale_object.accumulator = this.accumulator_.toString(); - vega_scale_object.minDensityCnt = "-2ndStdDev"; - vega_scale_object.maxDensityCnt = "2ndStdDev"; - - // density accumulation will force on clamp - - // eslint-disable-next-line no-warning-comments - // TODO(croot): is this too heavy handed? - vega_scale_object.clamp = true; - } - } - }], [{ - key: "isContinuousScale", - value: - /** - * - * @param {ScaleType} scale_type - * @returns {boolean} - */ - function isContinuousScale(scale_type) { - return scale_type === __WEBPACK_IMPORTED_MODULE_4__Enums_ScaleType__["a" /* default */].kLinear || scale_type === __WEBPACK_IMPORTED_MODULE_4__Enums_ScaleType__["a" /* default */].kLog || scale_type === __WEBPACK_IMPORTED_MODULE_4__Enums_ScaleType__["a" /* default */].kSqrt || scale_type === __WEBPACK_IMPORTED_MODULE_4__Enums_ScaleType__["a" /* default */].kPow; - } - - /** - * @param {ScaleType} scale_type - * @param {MeasurementType} measurement_type - * @returns {boolean} - */ - }, { - key: "validateScaleMeasurement", - value: function validateScaleMeasurement(scale_type, measurement_type) { - __WEBPACK_IMPORTED_MODULE_0_assert___default()(ContinuousScale.isContinuousScale(scale_type)); - if (measurement_type !== __WEBPACK_IMPORTED_MODULE_3__PropDescriptor_Enums_MeasurementType__["a" /* default */].kQuantitative) { - throw new Error("Continuous scales can only be used with continuous '".concat(__WEBPACK_IMPORTED_MODULE_3__PropDescriptor_Enums_MeasurementType__["a" /* default */].kQuantitative, "' field type encodings")); - } - } - }, { - key: "buildExtentsVegaTransform", - value: - /** - * @param {string} field_output - * @param {string} layer_name - * @param {string} prop_name - * @param {ExtentFlags} extent_flags - * @param {number} [num_subdivisions=0] Number of subdivisions between the computed extents. - * This could be used, for example, to fill out a linear - * stop for a certain number of ranges - */ - function buildExtentsVegaTransform(field_output, layer_name, prop_name, extent_flags) { - var num_subdivisions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; - __WEBPACK_IMPORTED_MODULE_0_assert___default()(num_subdivisions <= ContinuousScale.max_subdivisions); - return __WEBPACK_IMPORTED_MODULE_6__Enums_ExtentFlags__["a" /* default */].buildVegaTransformFromExtentFlags(field_output, layer_name, prop_name, extent_flags, function (extent_flag, agg_xform_output, formula_xform_outputs, _ref) { - var formula_xform_objs = _ref.formula_xform_objs, - vega_xform_outputs = _ref.vega_xform_outputs; - if (extent_flag === __WEBPACK_IMPORTED_MODULE_6__Enums_ExtentFlags__["a" /* default */].kMin || extent_flag === __WEBPACK_IMPORTED_MODULE_6__Enums_ExtentFlags__["a" /* default */].kMax) { - // these need to be processed after the sigmas/stddevs, so they should be last, or at least - // after them in the map. - if (formula_xform_objs.length === 0) { - vega_xform_outputs.push(agg_xform_output); - } else { - formula_xform_objs.push({ - type: "formula", - expr: "".concat(__WEBPACK_IMPORTED_MODULE_6__Enums_ExtentFlags__["a" /* default */].opposite(extent_flag).op_name, "(").concat(agg_xform_output, ", ").concat(formula_xform_objs[formula_xform_objs.length - 2].as, ")"), - as: "".concat(field_output, "_extents_").concat(extent_flag.extent_name) - }); - } - } else if (formula_xform_objs.length === 0 && (extent_flag < __WEBPACK_IMPORTED_MODULE_6__Enums_ExtentFlags__["a" /* default */].kOneSigma || extent_flag > __WEBPACK_IMPORTED_MODULE_6__Enums_ExtentFlags__["a" /* default */].kSixSigma)) { - vega_xform_outputs.push(agg_xform_output); - } - }, function (_ref2) { - var formula_xform_objs = _ref2.formula_xform_objs, - vega_xform_outputs = _ref2.vega_xform_outputs; - if (vega_xform_outputs.length === 0) { - __WEBPACK_IMPORTED_MODULE_0_assert___default()(formula_xform_objs.length >= 2); - var start_range_formula = formula_xform_objs[formula_xform_objs.length - 2]; - var end_range_formula = formula_xform_objs[formula_xform_objs.length - 1]; - vega_xform_outputs.push(start_range_formula.as); - if (num_subdivisions > 0) { - var diff_var_name = "".concat(field_output, "_extents_diff"); - formula_xform_objs.push({ - type: "formula", - expr: "(".concat(end_range_formula.as, " - ").concat(start_range_formula.as, ") / ").concat(num_subdivisions + 1, ".0"), - as: diff_var_name - }); - for (var i = 1; i <= num_subdivisions; ++i) { - var var_name = "".concat(field_output, "_extents_stop_").concat(i); - formula_xform_objs.push({ - type: "formula", - expr: "".concat(start_range_formula.as, " + ").concat(i, "*").concat(diff_var_name), - as: var_name - }); - vega_xform_outputs.push(var_name); - } - } - vega_xform_outputs.push(end_range_formula.as); - } - __WEBPACK_IMPORTED_MODULE_0_assert___default()(vega_xform_outputs.length >= 2); - }); - } - }]); - return ContinuousScale; -}(__WEBPACK_IMPORTED_MODULE_1__ScaleDefinitionObject__["a" /* default */]); -_defineProperty(ContinuousScale, "max_subdivisions", 25); - - -/***/ }), -/* 25 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["e"] = tokenLabel; -/* harmony export (immutable) */ __webpack_exports__["g"] = tokenName; -/* harmony export (immutable) */ __webpack_exports__["d"] = hasTokenLabel; -/* harmony export (immutable) */ __webpack_exports__["b"] = createToken; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EOF; }); -/* harmony export (immutable) */ __webpack_exports__["c"] = createTokenInstance; -/* harmony export (immutable) */ __webpack_exports__["f"] = tokenMatcher; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_utils__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__lexer_public__ = __webpack_require__(47); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tokens__ = __webpack_require__(36); - - - -function tokenLabel(tokType) { - if (hasTokenLabel(tokType)) { - return tokType.LABEL; - } - else { - return tokType.name; - } -} -function tokenName(tokType) { - return tokType.name; -} -function hasTokenLabel(obj) { - return Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["E" /* isString */])(obj.LABEL) && obj.LABEL !== ""; -} -var PARENT = "parent"; -var CATEGORIES = "categories"; -var LABEL = "label"; -var GROUP = "group"; -var PUSH_MODE = "push_mode"; -var POP_MODE = "pop_mode"; -var LONGER_ALT = "longer_alt"; -var LINE_BREAKS = "line_breaks"; -var START_CHARS_HINT = "start_chars_hint"; -function createToken(config) { - return createTokenInternal(config); -} -function createTokenInternal(config) { - var pattern = config.pattern; - var tokenType = {}; - tokenType.name = config.name; - if (!Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["F" /* isUndefined */])(pattern)) { - tokenType.PATTERN = pattern; - } - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, PARENT)) { - throw "The parent property is no longer supported.\n" + - "See: https://github.com/SAP/chevrotain/issues/564#issuecomment-349062346 for details."; - } - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, CATEGORIES)) { - // casting to ANY as this will be fixed inside `augmentTokenTypes`` - tokenType.CATEGORIES = config[CATEGORIES]; - } - Object(__WEBPACK_IMPORTED_MODULE_2__tokens__["a" /* augmentTokenTypes */])([tokenType]); - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, LABEL)) { - tokenType.LABEL = config[LABEL]; - } - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, GROUP)) { - tokenType.GROUP = config[GROUP]; - } - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, POP_MODE)) { - tokenType.POP_MODE = config[POP_MODE]; - } - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, PUSH_MODE)) { - tokenType.PUSH_MODE = config[PUSH_MODE]; - } - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, LONGER_ALT)) { - tokenType.LONGER_ALT = config[LONGER_ALT]; - } - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, LINE_BREAKS)) { - tokenType.LINE_BREAKS = config[LINE_BREAKS]; - } - if (Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["w" /* has */])(config, START_CHARS_HINT)) { - tokenType.START_CHARS_HINT = config[START_CHARS_HINT]; - } - return tokenType; -} -var EOF = createToken({ name: "EOF", pattern: __WEBPACK_IMPORTED_MODULE_1__lexer_public__["a" /* Lexer */].NA }); -Object(__WEBPACK_IMPORTED_MODULE_2__tokens__["a" /* augmentTokenTypes */])([EOF]); -function createTokenInstance(tokType, image, startOffset, endOffset, startLine, endLine, startColumn, endColumn) { - return { - image: image, - startOffset: startOffset, - endOffset: endOffset, - startLine: startLine, - endLine: endLine, - startColumn: startColumn, - endColumn: endColumn, - tokenTypeIdx: tokType.tokenTypeIdx, - tokenType: tokType - }; -} -function tokenMatcher(token, tokType) { - return Object(__WEBPACK_IMPORTED_MODULE_2__tokens__["d" /* tokenStructuredMatcher */])(token, tokType); -} -//# sourceMappingURL=tokens_public.js.map - -/***/ }), -/* 26 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = marginMixin; -/** - * Margin is a mixin that provides margin utility functions for both the Row Chart and Coordinate Grid - * Charts. - * @name marginMixin - * @memberof dc - * @mixin - * @param {Object} _chart - * @return {dc.marginMixin} - */ -function marginMixin(_chart) { - /* OVERRIDE ---------------------------------------------------------------- */ - var _margin = { - top: 10, - right: 50, - bottom: 48, - left: 60 - }; - /* ------------------------------------------------------------------------- */ - - /** - * Get or set the margins for a particular coordinate grid chart instance. The margins is stored as - * an associative Javascript array. - * @name margins - * @memberof dc.marginMixin - * @instance - * @example - * var leftMargin = chart.margins().left; // 30 by default - * chart.margins().left = 50; - * leftMargin = chart.margins().left; // now 50 - * @param {{top: Number, right: Number, left: Number, bottom: Number}} [margins={top: 10, right: 50, bottom: 30, left: 30}] - * @return {{top: Number, right: Number, left: Number, bottom: Number}} - * @return {dc.marginMixin} - */ - _chart.margins = function (margins) { - if (!arguments.length) { - return _margin; - } - _margin = margins; - return _chart; - }; - _chart.effectiveWidth = function () { - return _chart.width() - _chart.margins().left - _chart.margins().right; - }; - _chart.effectiveHeight = function () { - return _chart.height() - _chart.margins().top - _chart.margins().bottom; - }; - return _chart; -} - -/***/ }), -/* 27 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RasterLayerContext; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_assert__); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } - -var RasterLayerContext = /*#__PURE__*/function () { - /** - * @param {Object} chart - * @param {string} table_name - * @param {string} layer_type - * @param {Object} layer - * @param {string} layer_name - * @param {(number|null)} [last_filtered_size=null] - */ - function RasterLayerContext(chart, table_name, layer_type, layer, layer_name) { - var last_filtered_size = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null; - _classCallCheck(this, RasterLayerContext); - __WEBPACK_IMPORTED_MODULE_0_assert___default()(Boolean(chart)); - __WEBPACK_IMPORTED_MODULE_0_assert___default()(_typeof(chart) === "object"); - - /** - * @type {Object} - */ - this.chart_ = chart; - __WEBPACK_IMPORTED_MODULE_0_assert___default()(typeof table_name === "string"); - /** - * @type {string} - */ - this.table_name_ = table_name; - __WEBPACK_IMPORTED_MODULE_0_assert___default()(typeof layer_type === "string"); - /** - * @type {string} - */ - this.layer_type_ = layer_type; - __WEBPACK_IMPORTED_MODULE_0_assert___default()(Boolean(layer)); - __WEBPACK_IMPORTED_MODULE_0_assert___default()(_typeof(layer) === "object"); - /** - * @type {Object} - */ - this.layer_ = layer; - __WEBPACK_IMPORTED_MODULE_0_assert___default()(typeof layer_name === "string"); - /** - * @type {string} - */ - this.layer_name_ = layer_name; - this.last_filtered_size_ = last_filtered_size; - } - - /** - * @type {Object} - */ - _createClass(RasterLayerContext, [{ - key: "chart", - get: function get() { - return this.chart_; - } - - /** - * @type {string} - */ - }, { - key: "table_name", - get: function get() { - return this.table_name_; - } - - /** - * @type {string} - */ - }, { - key: "layer_type", - get: function get() { - return this.layer_type_; - } - - /** - * @type {Object} - */ - }, { - key: "layer", - get: function get() { - return this.layer_; - } - - /** - * @type {string} - */ - }, { - key: "layer_name", - get: function get() { - return this.layer_name_; - } - - /** - * @type {(number|null)} - */ - }, { - key: "last_filtered_size", - get: function get() { - return this.last_filtered_size_; - } - }]); - return RasterLayerContext; -}(); - - -/***/ }), -/* 28 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return GAstVisitor; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gast_public__ = __webpack_require__(7); - -var GAstVisitor = /** @class */ (function () { - function GAstVisitor() { - } - GAstVisitor.prototype.visit = function (node) { - var nodeAny = node; - switch (nodeAny.constructor) { - case __WEBPACK_IMPORTED_MODULE_0__gast_public__["d" /* NonTerminal */]: - return this.visitNonTerminal(nodeAny); - case __WEBPACK_IMPORTED_MODULE_0__gast_public__["c" /* Flat */]: - return this.visitFlat(nodeAny); - case __WEBPACK_IMPORTED_MODULE_0__gast_public__["e" /* Option */]: - return this.visitOption(nodeAny); - case __WEBPACK_IMPORTED_MODULE_0__gast_public__["g" /* RepetitionMandatory */]: - return this.visitRepetitionMandatory(nodeAny); - case __WEBPACK_IMPORTED_MODULE_0__gast_public__["h" /* RepetitionMandatoryWithSeparator */]: - return this.visitRepetitionMandatoryWithSeparator(nodeAny); - case __WEBPACK_IMPORTED_MODULE_0__gast_public__["i" /* RepetitionWithSeparator */]: - return this.visitRepetitionWithSeparator(nodeAny); - case __WEBPACK_IMPORTED_MODULE_0__gast_public__["f" /* Repetition */]: - return this.visitRepetition(nodeAny); - case __WEBPACK_IMPORTED_MODULE_0__gast_public__["b" /* Alternation */]: - return this.visitAlternation(nodeAny); - case __WEBPACK_IMPORTED_MODULE_0__gast_public__["k" /* Terminal */]: - return this.visitTerminal(nodeAny); - case __WEBPACK_IMPORTED_MODULE_0__gast_public__["j" /* Rule */]: - return this.visitRule(nodeAny); - /* istanbul ignore next */ - default: - throw Error("non exhaustive match"); - } - }; - GAstVisitor.prototype.visitNonTerminal = function (node) { }; - GAstVisitor.prototype.visitFlat = function (node) { }; - GAstVisitor.prototype.visitOption = function (node) { }; - GAstVisitor.prototype.visitRepetition = function (node) { }; - GAstVisitor.prototype.visitRepetitionMandatory = function (node) { }; - GAstVisitor.prototype.visitRepetitionMandatoryWithSeparator = function (node) { }; - GAstVisitor.prototype.visitRepetitionWithSeparator = function (node) { }; - GAstVisitor.prototype.visitAlternation = function (node) { }; - GAstVisitor.prototype.visitTerminal = function (node) { }; - GAstVisitor.prototype.visitRule = function (node) { }; - return GAstVisitor; -}()); - -//# sourceMappingURL=gast_visitor_public.js.map - -/***/ }), -/* 29 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return filters; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_formatting_helpers__ = __webpack_require__(15); - - -/** - * The dc.js filters are functions which are passed into crossfilter to chose which records will be - * accumulated to produce values for the charts. In the crossfilter model, any filters applied on one - * dimension will affect all the other dimensions but not that one. dc always applies a filter - * function to the dimension; the function combines multiple filters and if any of them accept a - * record, it is filtered in. - * - * These filter constructors are used as appropriate by the various charts to implement brushing. We - * mention below which chart uses which filter. In some cases, many instances of a filter will be added. - * - * Each of the dc.js filters is an object with the following properties: - * * `isFiltered` - a function that returns true if a value is within the filter - * * `filterType` - a string identifying the filter, here the name of the constructor - * - * Currently these filter objects are also arrays, but this is not a requirement. Custom filters - * can be used as long as they have the properties above. - * @name filters - * @memberof dc - * @type {{}} - */ -var filters = {}; - -/** - * RangedFilter is a filter which accepts keys between `low` and `high`. It is used to implement X - * axis brushing for the {@link #dc.coordinateGridMixin coordinate grid charts}. - * - * Its `filterType` is 'RangedFilter' - * @name RangedFilter - * @memberof dc.filters - * @param {Number} low - * @param {Number} high - * @return {Array} - * @constructor - */ -filters.RangedFilter = function (low, high) { - var range = new Array(low, high); - range.isFiltered = function (value) { - return value >= this[0] && value <= this[1]; - }; - range.filterType = "RangedFilter"; - return range; -}; - -/** - * TwoDimensionalFilter is a filter which accepts a single two-dimensional value. It is used by the - * {@link #dc.heatMap heat map chart} to include particular cells as they are clicked. (Rows and columns are - * filtered by filtering all the cells in the row or column.) - * - * Its `filterType` is 'TwoDimensionalFilter' - * @name TwoDimensionalFilter - * @memberof filters - * @param {Array} filter - * @return {Array} - * @constructor - */ -filters.TwoDimensionalFilter = function () { - var filter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - if (filter === null) { - return null; - } - if (filter === Symbol["for"]("clear")) { - return filter; - } - var f = Object(__WEBPACK_IMPORTED_MODULE_0__utils_formatting_helpers__["g" /* normalizeFiltersArray */])(filter); - f.isFiltered = function (value) { - return value.length && value.length === f.length && value[0] === f[0] && value[1] === f[1]; - }; - f.filterType = "TwoDimensionalFilter"; - return f; -}; - -/** - * The RangedTwoDimensionalFilter allows filtering all values which fit within a rectangular - * region. It is used by the {@link #dc.scatterPlot scatter plot} to implement rectangular brushing. - * - * It takes two two-dimensional points in the form `[[x1,y1],[x2,y2]]`, and normalizes them so that - * `x1 <= x2` and `y1 <- y2`. It then returns a filter which accepts any points which are in the - * rectangular range including the lower values but excluding the higher values. - * - * If an array of two values are given to the RangedTwoDimensionalFilter, it interprets the values as - * two x coordinates `x1` and `x2` and returns a filter which accepts any points for which `x1 <= x < - * x2`. - * - * Its `filterType` is 'RangedTwoDimensionalFilter' - * @name RangedTwoDimensionalFilter - * @memberof filters - * @param {Array>} filter - * @return {Array>} - * @constructor - */ -filters.RangedTwoDimensionalFilter = function (filter) { - if (filter === null) { - return null; - } - if (filter === Symbol["for"]("clear")) { - return filter; - } - var f = filter; - var fromBottomLeft; - if (f[0] instanceof Array) { - fromBottomLeft = [[Math.min(filter[0][0], filter[1][0]), Math.min(filter[0][1], filter[1][1])], [Math.max(filter[0][0], filter[1][0]), Math.max(filter[0][1], filter[1][1])]]; - } else { - fromBottomLeft = [[filter[0], -Infinity], [filter[1], Infinity]]; - } - f.isFiltered = function (value) { - var x, y; - if (value instanceof Array) { - if (value.length !== 2) { - return false; - } - x = value[0]; - y = value[1]; - } else { - x = value; - y = fromBottomLeft[0][1]; - } - return x >= fromBottomLeft[0][0] && x < fromBottomLeft[1][0] && y >= fromBottomLeft[0][1] && y < fromBottomLeft[1][1]; - }; - f.filterType = "RangedTwoDimensionalFilter"; - return f; -}; - -/***/ }), -/* 30 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export DEFAULT_EXTRACT_INTERVAL */ -/* unused harmony export TIME_SPANS */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BIN_INPUT_OPTIONS; }); -/* harmony export (immutable) */ __webpack_exports__["b"] = autoBinParams; -/* harmony export (immutable) */ __webpack_exports__["c"] = checkIfTimeBinInRange; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return createBinParams; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getFirstNonNullDatumForAxis; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__ = __webpack_require__(40); - -var DEFAULT_EXTRACT_INTERVAL = "isodow"; -var DEFAULT_NULL_TIME_RANGE = "day"; -var TIME_SPANS = __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["n" /* TIME_LABELS */].map(function (label) { - return { - label: label, - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["o" /* TIME_LABEL_TO_SECONDS */][label] - }; -}); -var BIN_INPUT_OPTIONS = [{ - val: "auto", - label: "auto", - numSeconds: null -}, { - val: "century", - label: "1c", - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["a" /* CENTURY_IN_SECONDS */] -}, { - val: "decade", - label: "10y", - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["d" /* DECADE_IN_SECONDS */] -}, { - val: "year", - label: "1y", - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["q" /* YEAR_IN_SECONDS */] -}, { - val: "quarter", - label: "1q", - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["l" /* QUARTER_IN_SECONDS */] -}, { - val: "month", - label: "1mo", - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["i" /* MONTH_IN_SECONDS */] -}, { - val: "week", - label: "1w", - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["p" /* WEEK_IN_SECONDS */] -}, { - val: "day", - label: "1d", - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["c" /* DAY_IN_SECONDS */] -}, { - val: "hour", - label: "1h", - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["f" /* HOUR_IN_SECONDS */] -}, { - val: "minute", - label: "1m", - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["g" /* MIN_IN_SECONDS */] -}, { - val: "second", - label: "1s", - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["m" /* SECOND */] -}, { - val: "millisecond", - label: "1ms", - numSeconds: __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["j" /* MS_IN_SECONDS */] -}]; -function autoBinParams(timeBounds, maxNumBins, reverse) { - var epochTimeBounds = [timeBounds[0] * 0.001, timeBounds[1] * 0.001]; - var timeRange = epochTimeBounds[1] - epochTimeBounds[0]; // in seconds - if (timeRange === 0) { - return DEFAULT_NULL_TIME_RANGE; - } - var timeSpans = reverse ? TIME_SPANS.slice().reverse() : TIME_SPANS; - for (var s = 0; s < timeSpans.length; s++) { - if (timeRange / timeSpans[s].numSeconds < maxNumBins) { - return timeSpans[s].label; - } - } - return "century"; // default -} - -function checkIfTimeBinInRange(timeBounds, timeBin, maxNumBins) { - var epochTimeBounds = [timeBounds[0] * 0.001, timeBounds[1] * 0.001]; - var timeRange = epochTimeBounds[1] - epochTimeBounds[0]; // in seconds - var timeLabelToSecs = __WEBPACK_IMPORTED_MODULE_0__constants_dates_and_times__["o" /* TIME_LABEL_TO_SECONDS */]; - if (timeRange / timeLabelToSecs[timeBin] > maxNumBins) { - return autoBinParams(timeBounds, maxNumBins); - } else if (timeRange / timeLabelToSecs[timeBin] < 2) { - return autoBinParams(timeBounds, maxNumBins, true); - } else { - return timeBin; - } -} -var createBinParams = function createBinParams(chart, binParams) { - if (!chart.group() || !chart.group().binParams) { - return; - } - binParams = Array.isArray(binParams) ? binParams : [binParams]; - var parsedBinParams = binParams.map(function (param) { - if (param) { - var _param$timeBin = param.timeBin, - timeBin = _param$timeBin === void 0 ? "auto" : _param$timeBin, - binBounds = param.binBounds, - numBins = param.numBins; - var extract = param.extract || false; - var isDate = binBounds[0] instanceof Date; - if (isDate && timeBin === "auto") { - var bounds = binBounds.map(function (date) { - return date.getTime(); - }); - return Object.assign({}, param, { - extract: extract, - timeBin: extract ? DEFAULT_EXTRACT_INTERVAL : autoBinParams(bounds, numBins), - binBounds: binBounds.slice(), - auto: true // hightlights the "auto" UI button - }); - } else { - return Object.assign({}, param, { - extract: extract, - timeBin: timeBin, - binBounds: binBounds.slice() - }); - } - } - return param; - }); - chart.group().binParams(parsedBinParams); - return chart; -}; -var getFirstNonNullDatumForAxis = function getFirstNonNullDatumForAxis(data, axisType) { - return data && Array.isArray(data) && data.find(function () { - var datum = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var keyVal = datum["key".concat(axisType === "x" ? "0" : "1")]; - var value = Array.isArray(keyVal) ? keyVal[0] : keyVal; - return value !== null; - }); -}; - -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/** - * @license - * Lodash - * Copyright OpenJS Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ -;(function() { - - /** Used as a safe reference for `undefined` in pre-ES5 environments. */ - var undefined; - - /** Used as the semantic version number. */ - var VERSION = '4.17.21'; - - /** Used as the size to enable large array optimizations. */ - var LARGE_ARRAY_SIZE = 200; - - /** Error message constants. */ - var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.', - FUNC_ERROR_TEXT = 'Expected a function', - INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`'; - - /** Used to stand-in for `undefined` hash values. */ - var HASH_UNDEFINED = '__lodash_hash_undefined__'; - - /** Used as the maximum memoize cache size. */ - var MAX_MEMOIZE_SIZE = 500; - - /** Used as the internal argument placeholder. */ - var PLACEHOLDER = '__lodash_placeholder__'; - - /** Used to compose bitmasks for cloning. */ - var CLONE_DEEP_FLAG = 1, - CLONE_FLAT_FLAG = 2, - CLONE_SYMBOLS_FLAG = 4; - - /** Used to compose bitmasks for value comparisons. */ - var COMPARE_PARTIAL_FLAG = 1, - COMPARE_UNORDERED_FLAG = 2; - - /** Used to compose bitmasks for function metadata. */ - var WRAP_BIND_FLAG = 1, - WRAP_BIND_KEY_FLAG = 2, - WRAP_CURRY_BOUND_FLAG = 4, - WRAP_CURRY_FLAG = 8, - WRAP_CURRY_RIGHT_FLAG = 16, - WRAP_PARTIAL_FLAG = 32, - WRAP_PARTIAL_RIGHT_FLAG = 64, - WRAP_ARY_FLAG = 128, - WRAP_REARG_FLAG = 256, - WRAP_FLIP_FLAG = 512; - - /** Used as default options for `_.truncate`. */ - var DEFAULT_TRUNC_LENGTH = 30, - DEFAULT_TRUNC_OMISSION = '...'; - - /** Used to detect hot functions by number of calls within a span of milliseconds. */ - var HOT_COUNT = 800, - HOT_SPAN = 16; - - /** Used to indicate the type of lazy iteratees. */ - var LAZY_FILTER_FLAG = 1, - LAZY_MAP_FLAG = 2, - LAZY_WHILE_FLAG = 3; - - /** Used as references for various `Number` constants. */ - var INFINITY = 1 / 0, - MAX_SAFE_INTEGER = 9007199254740991, - MAX_INTEGER = 1.7976931348623157e+308, - NAN = 0 / 0; - - /** Used as references for the maximum length and index of an array. */ - var MAX_ARRAY_LENGTH = 4294967295, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, - HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - - /** Used to associate wrap methods with their bit flags. */ - var wrapFlags = [ - ['ary', WRAP_ARY_FLAG], - ['bind', WRAP_BIND_FLAG], - ['bindKey', WRAP_BIND_KEY_FLAG], - ['curry', WRAP_CURRY_FLAG], - ['curryRight', WRAP_CURRY_RIGHT_FLAG], - ['flip', WRAP_FLIP_FLAG], - ['partial', WRAP_PARTIAL_FLAG], - ['partialRight', WRAP_PARTIAL_RIGHT_FLAG], - ['rearg', WRAP_REARG_FLAG] - ]; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - asyncTag = '[object AsyncFunction]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - domExcTag = '[object DOMException]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - nullTag = '[object Null]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - proxyTag = '[object Proxy]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - undefinedTag = '[object Undefined]', - weakMapTag = '[object WeakMap]', - weakSetTag = '[object WeakSet]'; - - var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - - /** Used to match empty string literals in compiled template source. */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - - /** Used to match HTML entities and HTML characters. */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, - reUnescapedHtml = /[&<>"']/g, - reHasEscapedHtml = RegExp(reEscapedHtml.source), - reHasUnescapedHtml = RegExp(reUnescapedHtml.source); - - /** Used to match template delimiters. */ - var reEscape = /<%-([\s\S]+?)%>/g, - reEvaluate = /<%([\s\S]+?)%>/g, - reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match property names within property paths. */ - var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - - /** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ - var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, - reHasRegExpChar = RegExp(reRegExpChar.source); - - /** Used to match leading whitespace. */ - var reTrimStart = /^\s+/; - - /** Used to match a single whitespace character. */ - var reWhitespace = /\s/; - - /** Used to match wrap detail comments. */ - var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, - reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, - reSplitDetails = /,? & /; - - /** Used to match words composed of alphanumeric characters. */ - var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; - - /** - * Used to validate the `validate` option in `_.template` variable. - * - * Forbids characters which could potentially change the meaning of the function argument definition: - * - "()," (modification of function parameters) - * - "=" (default value) - * - "[]{}" (destructuring of function parameters) - * - "/" (beginning of a comment) - * - whitespace - */ - var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; - - /** Used to match backslashes in property paths. */ - var reEscapeChar = /\\(\\)?/g; - - /** - * Used to match - * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components). - */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - - /** Used to match `RegExp` flags from their coerced string values. */ - var reFlags = /\w*$/; - - /** Used to detect bad signed hexadecimal string values. */ - var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; - - /** Used to detect binary string values. */ - var reIsBinary = /^0b[01]+$/i; - - /** Used to detect host constructors (Safari). */ - var reIsHostCtor = /^\[object .+?Constructor\]$/; - - /** Used to detect octal string values. */ - var reIsOctal = /^0o[0-7]+$/i; - - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - - /** Used to match Latin Unicode letters (excluding mathematical operators). */ - var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - - /** Used to ensure capturing order of template delimiters. */ - var reNoMatch = /($^)/; - - /** Used to match unescaped characters in compiled string literals. */ - var reUnescapedString = /['\n\r\u2028\u2029\\]/g; - - /** Used to compose unicode character classes. */ - var rsAstralRange = '\\ud800-\\udfff', - rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, - rsDingbatRange = '\\u2700-\\u27bf', - rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', - rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', - rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', - rsPunctuationRange = '\\u2000-\\u206f', - rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', - rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', - rsVarRange = '\\ufe0e\\ufe0f', - rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; - - /** Used to compose unicode capture groups. */ - var rsApos = "['\u2019]", - rsAstral = '[' + rsAstralRange + ']', - rsBreak = '[' + rsBreakRange + ']', - rsCombo = '[' + rsComboRange + ']', - rsDigits = '\\d+', - rsDingbat = '[' + rsDingbatRange + ']', - rsLower = '[' + rsLowerRange + ']', - rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', - rsFitz = '\\ud83c[\\udffb-\\udfff]', - rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', - rsNonAstral = '[^' + rsAstralRange + ']', - rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', - rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', - rsUpper = '[' + rsUpperRange + ']', - rsZWJ = '\\u200d'; - - /** Used to compose unicode regexes. */ - var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', - rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', - rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', - rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', - reOptMod = rsModifier + '?', - rsOptVar = '[' + rsVarRange + ']?', - rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', - rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', - rsSeq = rsOptVar + reOptMod + rsOptJoin, - rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, - rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; - - /** Used to match apostrophes. */ - var reApos = RegExp(rsApos, 'g'); - - /** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and - * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). - */ - var reComboMark = RegExp(rsCombo, 'g'); - - /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ - var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); - - /** Used to match complex or compound words. */ - var reUnicodeWord = RegExp([ - rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', - rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', - rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, - rsUpper + '+' + rsOptContrUpper, - rsOrdUpper, - rsOrdLower, - rsDigits, - rsEmoji - ].join('|'), 'g'); - - /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ - var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); - - /** Used to detect strings that need a more robust regexp to match words. */ - var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; - - /** Used to assign default `context` object properties. */ - var contextProps = [ - 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array', - 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', - 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', - 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', - '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' - ]; - - /** Used to make template sourceURLs easier to identify. */ - var templateCounter = -1; - - /** Used to identify `toStringTag` values of typed arrays. */ - var typedArrayTags = {}; - typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; - typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; - - /** Used to identify `toStringTag` values supported by `_.clone`. */ - var cloneableTags = {}; - cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; - cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; - - /** Used to map Latin Unicode letters to basic Latin letters. */ - var deburredLetters = { - // Latin-1 Supplement block. - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss', - // Latin Extended-A block. - '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', - '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', - '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', - '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', - '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', - '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', - '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', - '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', - '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', - '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', - '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', - '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', - '\u0134': 'J', '\u0135': 'j', - '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', - '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', - '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', - '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', - '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', - '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', - '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', - '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', - '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', - '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', - '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', - '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', - '\u0163': 't', '\u0165': 't', '\u0167': 't', - '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', - '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', - '\u0174': 'W', '\u0175': 'w', - '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', - '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', - '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', - '\u0132': 'IJ', '\u0133': 'ij', - '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 's' - }; - - /** Used to map characters to HTML entities. */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - /** Used to map HTML entities to characters. */ - var htmlUnescapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - ''': "'" - }; - - /** Used to escape characters for inclusion in compiled string literals. */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - /** Built-in method references without a dependency on `root`. */ - var freeParseFloat = parseFloat, - freeParseInt = parseInt; - - /** Detect free variable `global` from Node.js. */ - var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - - /** Detect free variable `self`. */ - var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - - /** Used as a reference to the global object. */ - var root = freeGlobal || freeSelf || Function('return this')(); - - /** Detect free variable `exports`. */ - var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - - /** Detect free variable `module`. */ - var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = freeModule && freeModule.exports === freeExports; - - /** Detect free variable `process` from Node.js. */ - var freeProcess = moduleExports && freeGlobal.process; - - /** Used to access faster Node.js helpers. */ - var nodeUtil = (function() { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule && freeModule.require && freeModule.require('util').types; - - if (types) { - return types; - } - - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} - }()); - - /* Node.js helper references. */ - var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, - nodeIsDate = nodeUtil && nodeUtil.isDate, - nodeIsMap = nodeUtil && nodeUtil.isMap, - nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, - nodeIsSet = nodeUtil && nodeUtil.isSet, - nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - - /*--------------------------------------------------------------------------*/ - - /** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ - function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); - } - - /** - * A specialized version of `baseAggregator` for arrays. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ - function arrayAggregator(array, setter, iteratee, accumulator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - var value = array[index]; - setter(accumulator, value, iteratee(value), array); - } - return accumulator; - } - - /** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEach(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.forEachRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ - function arrayEachRight(array, iteratee) { - var length = array == null ? 0 : array.length; - - while (length--) { - if (iteratee(array[length], length, array) === false) { - break; - } - } - return array; - } - - /** - * A specialized version of `_.every` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - */ - function arrayEvery(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (!predicate(array[index], index, array)) { - return false; - } - } - return true; - } - - /** - * A specialized version of `_.filter` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * A specialized version of `_.includes` for arrays without support for - * specifying an index to search from. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludes(array, value) { - var length = array == null ? 0 : array.length; - return !!length && baseIndexOf(array, value, 0) > -1; - } - - /** - * This function is like `arrayIncludes` except that it accepts a comparator. - * - * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @param {Function} comparator The comparator invoked per element. - * @returns {boolean} Returns `true` if `target` is found, else `false`. - */ - function arrayIncludesWith(array, value, comparator) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (comparator(value, array[index])) { - return true; - } - } - return false; - } - - /** - * A specialized version of `_.map` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function arrayMap(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length, - result = Array(length); - - while (++index < length) { - result[index] = iteratee(array[index], index, array); - } - return result; - } - - /** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ - function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; - } - - /** - * A specialized version of `_.reduce` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array == null ? 0 : array.length; - - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; - } - - /** - * A specialized version of `_.reduceRight` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the last element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ - function arrayReduceRight(array, iteratee, accumulator, initAccum) { - var length = array == null ? 0 : array.length; - if (initAccum && length) { - accumulator = array[--length]; - } - while (length--) { - accumulator = iteratee(accumulator, array[length], length, array); - } - return accumulator; - } - - /** - * A specialized version of `_.some` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function arraySome(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; - } - - /** - * Gets the size of an ASCII `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ - var asciiSize = baseProperty('length'); - - /** - * Converts an ASCII `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function asciiToArray(string) { - return string.split(''); - } - - /** - * Splits an ASCII `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ - function asciiWords(string) { - return string.match(reAsciiWord) || []; - } - - /** - * The base implementation of methods like `_.findKey` and `_.findLastKey`, - * without support for iteratee shorthands, which iterates over `collection` - * using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the found element or its key, else `undefined`. - */ - function baseFindKey(collection, predicate, eachFunc) { - var result; - eachFunc(collection, function(value, key, collection) { - if (predicate(value, key, collection)) { - result = key; - return false; - } - }); - return result; - } - - /** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); - - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.indexOf` without `fromIndex` bounds checks. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOf(array, value, fromIndex) { - return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); - } - - /** - * This function is like `baseIndexOf` except that it accepts a comparator. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @param {Function} comparator The comparator invoked per element. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function baseIndexOfWith(array, value, fromIndex, comparator) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (comparator(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * The base implementation of `_.isNaN` without support for number objects. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - */ - function baseIsNaN(value) { - return value !== value; - } - - /** - * The base implementation of `_.mean` and `_.meanBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the mean. - */ - function baseMean(array, iteratee) { - var length = array == null ? 0 : array.length; - return length ? (baseSum(array, iteratee) / length) : NAN; - } - - /** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ - function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; - } - - /** - * The base implementation of `_.propertyOf` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @returns {Function} Returns the new accessor function. - */ - function basePropertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; - }; - } - - /** - * The base implementation of `_.reduce` and `_.reduceRight`, without support - * for iteratee shorthands, which iterates over `collection` using `eachFunc`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} accumulator The initial value. - * @param {boolean} initAccum Specify using the first or last element of - * `collection` as the initial value. - * @param {Function} eachFunc The function to iterate over `collection`. - * @returns {*} Returns the accumulated value. - */ - function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { - eachFunc(collection, function(value, index, collection) { - accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); - }); - return accumulator; - } - - /** - * The base implementation of `_.sortBy` which uses `comparer` to define the - * sort order of `array` and replaces criteria objects with their corresponding - * values. - * - * @private - * @param {Array} array The array to sort. - * @param {Function} comparer The function to define sort order. - * @returns {Array} Returns `array`. - */ - function baseSortBy(array, comparer) { - var length = array.length; - - array.sort(comparer); - while (length--) { - array[length] = array[length].value; - } - return array; - } - - /** - * The base implementation of `_.sum` and `_.sumBy` without support for - * iteratee shorthands. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {number} Returns the sum. - */ - function baseSum(array, iteratee) { - var result, - index = -1, - length = array.length; - - while (++index < length) { - var current = iteratee(array[index]); - if (current !== undefined) { - result = result === undefined ? current : (result + current); - } - } - return result; - } - - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - - /** - * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array - * of key-value pairs for `object` corresponding to the property names of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the key-value pairs. - */ - function baseToPairs(object, props) { - return arrayMap(props, function(key) { - return [key, object[key]]; - }); - } - - /** - * The base implementation of `_.trim`. - * - * @private - * @param {string} string The string to trim. - * @returns {string} Returns the trimmed string. - */ - function baseTrim(string) { - return string - ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') - : string; - } - - /** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ - function baseUnary(func) { - return function(value) { - return func(value); - }; - } - - /** - * The base implementation of `_.values` and `_.valuesIn` which creates an - * array of `object` property values corresponding to the property names - * of `props`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} props The property names to get values for. - * @returns {Object} Returns the array of property values. - */ - function baseValues(object, props) { - return arrayMap(props, function(key) { - return object[key]; - }); - } - - /** - * Checks if a `cache` value for `key` exists. - * - * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function cacheHas(cache, key) { - return cache.has(key); - } - - /** - * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the first unmatched string symbol. - */ - function charsStartIndex(strSymbols, chrSymbols) { - var index = -1, - length = strSymbols.length; - - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the last unmatched string symbol. - */ - function charsEndIndex(strSymbols, chrSymbols) { - var index = strSymbols.length; - - while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; - } - - /** - * Gets the number of `placeholder` occurrences in `array`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} placeholder The placeholder to search for. - * @returns {number} Returns the placeholder count. - */ - function countHolders(array, placeholder) { - var length = array.length, - result = 0; - - while (length--) { - if (array[length] === placeholder) { - ++result; - } - } - return result; - } - - /** - * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A - * letters to basic Latin letters. - * - * @private - * @param {string} letter The matched letter to deburr. - * @returns {string} Returns the deburred letter. - */ - var deburrLetter = basePropertyOf(deburredLetters); - - /** - * Used by `_.escape` to convert characters to HTML entities. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - var escapeHtmlChar = basePropertyOf(htmlEscapes); - - /** - * Used by `_.template` to escape characters for inclusion in compiled string literals. - * - * @private - * @param {string} chr The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeStringChar(chr) { - return '\\' + stringEscapes[chr]; - } - - /** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function getValue(object, key) { - return object == null ? undefined : object[key]; - } - - /** - * Checks if `string` contains Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a symbol is found, else `false`. - */ - function hasUnicode(string) { - return reHasUnicode.test(string); - } - - /** - * Checks if `string` contains a word composed of Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a word is found, else `false`. - */ - function hasUnicodeWord(string) { - return reHasUnicodeWord.test(string); - } - - /** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ - function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; - } - - /** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ - function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; - } - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; - } - - /** - * Replaces all `placeholder` elements in `array` with an internal placeholder - * and returns an array of their indexes. - * - * @private - * @param {Array} array The array to modify. - * @param {*} placeholder The placeholder to replace. - * @returns {Array} Returns the new array of placeholder indexes. - */ - function replaceHolders(array, placeholder) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value === placeholder || value === PLACEHOLDER) { - array[index] = PLACEHOLDER; - result[resIndex++] = index; - } - } - return result; - } - - /** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ - function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; - } - - /** - * Converts `set` to its value-value pairs. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the value-value pairs. - */ - function setToPairs(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = [value, value]; - }); - return result; - } - - /** - * A specialized version of `_.indexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function strictIndexOf(array, value, fromIndex) { - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * A specialized version of `_.lastIndexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function strictLastIndexOf(array, value, fromIndex) { - var index = fromIndex + 1; - while (index--) { - if (array[index] === value) { - return index; - } - } - return index; - } - - /** - * Gets the number of symbols in `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the string size. - */ - function stringSize(string) { - return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); - } - - /** - * Converts `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function stringToArray(string) { - return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); - } - - /** - * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace - * character of `string`. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the index of the last non-whitespace character. - */ - function trimmedEndIndex(string) { - var index = string.length; - - while (index-- && reWhitespace.test(string.charAt(index))) {} - return index; - } - - /** - * Used by `_.unescape` to convert HTML entities to characters. - * - * @private - * @param {string} chr The matched character to unescape. - * @returns {string} Returns the unescaped character. - */ - var unescapeHtmlChar = basePropertyOf(htmlUnescapes); - - /** - * Gets the size of a Unicode `string`. - * - * @private - * @param {string} string The string inspect. - * @returns {number} Returns the string size. - */ - function unicodeSize(string) { - var result = reUnicode.lastIndex = 0; - while (reUnicode.test(string)) { - ++result; - } - return result; - } - - /** - * Converts a Unicode `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ - function unicodeToArray(string) { - return string.match(reUnicode) || []; - } - - /** - * Splits a Unicode `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ - function unicodeWords(string) { - return string.match(reUnicodeWord) || []; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Create a new pristine `lodash` function using the `context` object. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Util - * @param {Object} [context=root] The context object. - * @returns {Function} Returns a new `lodash` function. - * @example - * - * _.mixin({ 'foo': _.constant('foo') }); - * - * var lodash = _.runInContext(); - * lodash.mixin({ 'bar': lodash.constant('bar') }); - * - * _.isFunction(_.foo); - * // => true - * _.isFunction(_.bar); - * // => false - * - * lodash.isFunction(lodash.foo); - * // => false - * lodash.isFunction(lodash.bar); - * // => true - * - * // Create a suped-up `defer` in Node.js. - * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; - */ - var runInContext = (function runInContext(context) { - context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); - - /** Built-in constructor references. */ - var Array = context.Array, - Date = context.Date, - Error = context.Error, - Function = context.Function, - Math = context.Math, - Object = context.Object, - RegExp = context.RegExp, - String = context.String, - TypeError = context.TypeError; - - /** Used for built-in method references. */ - var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; - - /** Used to detect overreaching core-js shims. */ - var coreJsData = context['__core-js_shared__']; - - /** Used to resolve the decompiled source of functions. */ - var funcToString = funcProto.toString; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** Used to generate unique IDs. */ - var idCounter = 0; - - /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; - }()); - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var nativeObjectToString = objectProto.toString; - - /** Used to infer the `Object` constructor. */ - var objectCtorString = funcToString.call(Object); - - /** Used to restore the original `_` reference in `_.noConflict`. */ - var oldDash = root._; - - /** Used to detect if a method is native. */ - var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' - ); - - /** Built-in value references. */ - var Buffer = moduleExports ? context.Buffer : undefined, - Symbol = context.Symbol, - Uint8Array = context.Uint8Array, - allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, - getPrototype = overArg(Object.getPrototypeOf, Object), - objectCreate = Object.create, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayProto.splice, - spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, - symIterator = Symbol ? Symbol.iterator : undefined, - symToStringTag = Symbol ? Symbol.toStringTag : undefined; - - var defineProperty = (function() { - try { - var func = getNative(Object, 'defineProperty'); - func({}, '', {}); - return func; - } catch (e) {} - }()); - - /** Mocked built-ins. */ - var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, - ctxNow = Date && Date.now !== root.Date.now && Date.now, - ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeCeil = Math.ceil, - nativeFloor = Math.floor, - nativeGetSymbols = Object.getOwnPropertySymbols, - nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, - nativeIsFinite = context.isFinite, - nativeJoin = arrayProto.join, - nativeKeys = overArg(Object.keys, Object), - nativeMax = Math.max, - nativeMin = Math.min, - nativeNow = Date.now, - nativeParseInt = context.parseInt, - nativeRandom = Math.random, - nativeReverse = arrayProto.reverse; - - /* Built-in method references that are verified to be native. */ - var DataView = getNative(context, 'DataView'), - Map = getNative(context, 'Map'), - Promise = getNative(context, 'Promise'), - Set = getNative(context, 'Set'), - WeakMap = getNative(context, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); - - /** Used to store function metadata. */ - var metaMap = WeakMap && new WeakMap; - - /** Used to lookup unminified function names. */ - var realNames = {}; - - /** Used to detect maps, sets, and weakmaps. */ - var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - - /** Used to convert symbols to primitives and strings. */ - var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object which wraps `value` to enable implicit method - * chain sequences. Methods that operate on and return arrays, collections, - * and functions can be chained together. Methods that retrieve a single value - * or may return a primitive value will automatically end the chain sequence - * and return the unwrapped value. Otherwise, the value must be unwrapped - * with `_#value`. - * - * Explicit chain sequences, which must be unwrapped with `_#value`, may be - * enabled using `_.chain`. - * - * The execution of chained methods is lazy, that is, it's deferred until - * `_#value` is implicitly or explicitly called. - * - * Lazy evaluation allows several methods to support shortcut fusion. - * Shortcut fusion is an optimization to merge iteratee calls; this avoids - * the creation of intermediate arrays and can greatly reduce the number of - * iteratee executions. Sections of a chain sequence qualify for shortcut - * fusion if the section is applied to an array and iteratees accept only - * one argument. The heuristic for whether a section qualifies for shortcut - * fusion is subject to change. - * - * Chaining is supported in custom builds as long as the `_#value` method is - * directly or indirectly included in the build. - * - * In addition to lodash methods, wrappers have `Array` and `String` methods. - * - * The wrapper `Array` methods are: - * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift` - * - * The wrapper `String` methods are: - * `replace` and `split` - * - * The wrapper methods that support shortcut fusion are: - * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, - * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, - * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray` - * - * The chainable wrapper methods are: - * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`, - * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`, - * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, - * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, - * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`, - * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, - * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`, - * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`, - * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`, - * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`, - * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, - * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`, - * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`, - * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`, - * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, - * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`, - * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`, - * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`, - * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`, - * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`, - * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`, - * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`, - * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, - * `zipObject`, `zipObjectDeep`, and `zipWith` - * - * The wrapper methods that are **not** chainable by default are: - * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`, - * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`, - * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`, - * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`, - * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`, - * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, - * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, - * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, - * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, - * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, - * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, - * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, - * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, - * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, - * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, - * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, - * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, - * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, - * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, - * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, - * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, - * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, - * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, - * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, - * `upperFirst`, `value`, and `words` - * - * @name _ - * @constructor - * @category Seq - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2, 3]); - * - * // Returns an unwrapped value. - * wrapped.reduce(_.add); - * // => 6 - * - * // Returns a wrapped value. - * var squares = wrapped.map(square); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - function lodash(value) { - if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { - if (value instanceof LodashWrapper) { - return value; - } - if (hasOwnProperty.call(value, '__wrapped__')) { - return wrapperClone(value); - } - } - return new LodashWrapper(value); - } - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} proto The object to inherit from. - * @returns {Object} Returns the new object. - */ - var baseCreate = (function() { - function object() {} - return function(proto) { - if (!isObject(proto)) { - return {}; - } - if (objectCreate) { - return objectCreate(proto); - } - object.prototype = proto; - var result = new object; - object.prototype = undefined; - return result; - }; - }()); - - /** - * The function whose prototype chain sequence wrappers inherit from. - * - * @private - */ - function baseLodash() { - // No operation performed. - } - - /** - * The base constructor for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap. - * @param {boolean} [chainAll] Enable explicit method chain sequences. - */ - function LodashWrapper(value, chainAll) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__chain__ = !!chainAll; - this.__index__ = 0; - this.__values__ = undefined; - } - - /** - * By default, the template delimiters used by lodash are like those in - * embedded Ruby (ERB) as well as ES2015 template strings. Change the - * following template settings to use alternative delimiters. - * - * @static - * @memberOf _ - * @type {Object} - */ - lodash.templateSettings = { - - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'escape': reEscape, - - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'evaluate': reEvaluate, - - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type {RegExp} - */ - 'interpolate': reInterpolate, - - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type {string} - */ - 'variable': '', - - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type {Object} - */ - 'imports': { - - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type {Function} - */ - '_': lodash - } - }; - - // Ensure wrappers are instances of `baseLodash`. - lodash.prototype = baseLodash.prototype; - lodash.prototype.constructor = lodash; - - LodashWrapper.prototype = baseCreate(baseLodash.prototype); - LodashWrapper.prototype.constructor = LodashWrapper; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. - * - * @private - * @constructor - * @param {*} value The value to wrap. - */ - function LazyWrapper(value) { - this.__wrapped__ = value; - this.__actions__ = []; - this.__dir__ = 1; - this.__filtered__ = false; - this.__iteratees__ = []; - this.__takeCount__ = MAX_ARRAY_LENGTH; - this.__views__ = []; - } - - /** - * Creates a clone of the lazy wrapper object. - * - * @private - * @name clone - * @memberOf LazyWrapper - * @returns {Object} Returns the cloned `LazyWrapper` object. - */ - function lazyClone() { - var result = new LazyWrapper(this.__wrapped__); - result.__actions__ = copyArray(this.__actions__); - result.__dir__ = this.__dir__; - result.__filtered__ = this.__filtered__; - result.__iteratees__ = copyArray(this.__iteratees__); - result.__takeCount__ = this.__takeCount__; - result.__views__ = copyArray(this.__views__); - return result; - } - - /** - * Reverses the direction of lazy iteration. - * - * @private - * @name reverse - * @memberOf LazyWrapper - * @returns {Object} Returns the new reversed `LazyWrapper` object. - */ - function lazyReverse() { - if (this.__filtered__) { - var result = new LazyWrapper(this); - result.__dir__ = -1; - result.__filtered__ = true; - } else { - result = this.clone(); - result.__dir__ *= -1; - } - return result; - } - - /** - * Extracts the unwrapped value from its lazy wrapper. - * - * @private - * @name value - * @memberOf LazyWrapper - * @returns {*} Returns the unwrapped value. - */ - function lazyValue() { - var array = this.__wrapped__.value(), - dir = this.__dir__, - isArr = isArray(array), - isRight = dir < 0, - arrLength = isArr ? array.length : 0, - view = getView(0, arrLength, this.__views__), - start = view.start, - end = view.end, - length = end - start, - index = isRight ? end : (start - 1), - iteratees = this.__iteratees__, - iterLength = iteratees.length, - resIndex = 0, - takeCount = nativeMin(length, this.__takeCount__); - - if (!isArr || (!isRight && arrLength == length && takeCount == length)) { - return baseWrapperValue(array, this.__actions__); - } - var result = []; - - outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } - } - result[resIndex++] = value; - } - return result; - } - - // Ensure `LazyWrapper` is an instance of `baseLodash`. - LazyWrapper.prototype = baseCreate(baseLodash.prototype); - LazyWrapper.prototype.constructor = LazyWrapper; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Hash(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ - function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; - this.size = 0; - } - - /** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; - } - - /** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function hashHas(key) { - var data = this.__data__; - return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); - } - - /** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ - function hashSet(key, value) { - var data = this.__data__; - this.size += this.has(key) ? 0 : 1; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; - } - - // Add methods to `Hash`. - Hash.prototype.clear = hashClear; - Hash.prototype['delete'] = hashDelete; - Hash.prototype.get = hashGet; - Hash.prototype.has = hashHas; - Hash.prototype.set = hashSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function ListCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ - function listCacheClear() { - this.__data__ = []; - this.size = 0; - } - - /** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - --this.size; - return true; - } - - /** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; - } - - /** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; - } - - /** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ - function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - ++this.size; - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; - } - - // Add methods to `ListCache`. - ListCache.prototype.clear = listCacheClear; - ListCache.prototype['delete'] = listCacheDelete; - ListCache.prototype.get = listCacheGet; - ListCache.prototype.has = listCacheHas; - ListCache.prototype.set = listCacheSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function MapCache(entries) { - var index = -1, - length = entries == null ? 0 : entries.length; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } - } - - /** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ - function mapCacheClear() { - this.size = 0; - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; - } - - /** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function mapCacheDelete(key) { - var result = getMapData(this, key)['delete'](key); - this.size -= result ? 1 : 0; - return result; - } - - /** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function mapCacheGet(key) { - return getMapData(this, key).get(key); - } - - /** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function mapCacheHas(key) { - return getMapData(this, key).has(key); - } - - /** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ - function mapCacheSet(key, value) { - var data = getMapData(this, key), - size = data.size; - - data.set(key, value); - this.size += data.size == size ? 0 : 1; - return this; - } - - // Add methods to `MapCache`. - MapCache.prototype.clear = mapCacheClear; - MapCache.prototype['delete'] = mapCacheDelete; - MapCache.prototype.get = mapCacheGet; - MapCache.prototype.has = mapCacheHas; - MapCache.prototype.set = mapCacheSet; - - /*------------------------------------------------------------------------*/ - - /** - * - * Creates an array cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ - function SetCache(values) { - var index = -1, - length = values == null ? 0 : values.length; - - this.__data__ = new MapCache; - while (++index < length) { - this.add(values[index]); - } - } - - /** - * Adds `value` to the array cache. - * - * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. - */ - function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; - } - - /** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. - */ - function setCacheHas(value) { - return this.__data__.has(value); - } - - // Add methods to `SetCache`. - SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; - SetCache.prototype.has = setCacheHas; - - /*------------------------------------------------------------------------*/ - - /** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ - function Stack(entries) { - var data = this.__data__ = new ListCache(entries); - this.size = data.size; - } - - /** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ - function stackClear() { - this.__data__ = new ListCache; - this.size = 0; - } - - /** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ - function stackDelete(key) { - var data = this.__data__, - result = data['delete'](key); - - this.size = data.size; - return result; - } - - /** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ - function stackGet(key) { - return this.__data__.get(key); - } - - /** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ - function stackHas(key) { - return this.__data__.has(key); - } - - /** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ - function stackSet(key, value) { - var data = this.__data__; - if (data instanceof ListCache) { - var pairs = data.__data__; - if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - this.size = ++data.size; - return this; - } - data = this.__data__ = new MapCache(pairs); - } - data.set(key, value); - this.size = data.size; - return this; - } - - // Add methods to `Stack`. - Stack.prototype.clear = stackClear; - Stack.prototype['delete'] = stackDelete; - Stack.prototype.get = stackGet; - Stack.prototype.has = stackHas; - Stack.prototype.set = stackSet; - - /*------------------------------------------------------------------------*/ - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) - ))) { - result.push(key); - } - } - return result; - } - - /** - * A specialized version of `_.sample` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @returns {*} Returns the random element. - */ - function arraySample(array) { - var length = array.length; - return length ? array[baseRandom(0, length - 1)] : undefined; - } - - /** - * A specialized version of `_.sampleSize` for arrays. - * - * @private - * @param {Array} array The array to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ - function arraySampleSize(array, n) { - return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); - } - - /** - * A specialized version of `_.shuffle` for arrays. - * - * @private - * @param {Array} array The array to shuffle. - * @returns {Array} Returns the new shuffled array. - */ - function arrayShuffle(array) { - return shuffleSelf(copyArray(array)); - } - - /** - * This function is like `assignValue` except that it doesn't assign - * `undefined` values. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignMergeValue(object, key, value) { - if ((value !== undefined && !eq(object[key], value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - baseAssignValue(object, key, value); - } - } - - /** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ - function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; - } - - /** - * Aggregates elements of `collection` on `accumulator` with keys transformed - * by `iteratee` and values set by `setter`. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform keys. - * @param {Object} accumulator The initial aggregated object. - * @returns {Function} Returns `accumulator`. - */ - function baseAggregator(collection, setter, iteratee, accumulator) { - baseEach(collection, function(value, key, collection) { - setter(accumulator, value, iteratee(value), collection); - }); - return accumulator; - } - - /** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); - } - - /** - * The base implementation of `_.assignIn` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ - function baseAssignIn(object, source) { - return object && copyObject(source, keysIn(source), object); - } - - /** - * The base implementation of `assignValue` and `assignMergeValue` without - * value checks. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function baseAssignValue(object, key, value) { - if (key == '__proto__' && defineProperty) { - defineProperty(object, key, { - 'configurable': true, - 'enumerable': true, - 'value': value, - 'writable': true - }); - } else { - object[key] = value; - } - } - - /** - * The base implementation of `_.at` without support for individual paths. - * - * @private - * @param {Object} object The object to iterate over. - * @param {string[]} paths The property paths to pick. - * @returns {Array} Returns the picked elements. - */ - function baseAt(object, paths) { - var index = -1, - length = paths.length, - result = Array(length), - skip = object == null; - - while (++index < length) { - result[index] = skip ? undefined : get(object, paths[index]); - } - return result; - } - - /** - * The base implementation of `_.clamp` which doesn't coerce arguments. - * - * @private - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. - */ - function baseClamp(number, lower, upper) { - if (number === number) { - if (upper !== undefined) { - number = number <= upper ? number : upper; - } - if (lower !== undefined) { - number = number >= lower ? number : lower; - } - } - return number; - } - - /** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} bitmask The bitmask flags. - * 1 - Deep clone - * 2 - Flatten inherited properties - * 4 - Clone symbols - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. - */ - function baseClone(value, bitmask, customizer, key, object, stack) { - var result, - isDeep = bitmask & CLONE_DEEP_FLAG, - isFlat = bitmask & CLONE_FLAT_FLAG, - isFull = bitmask & CLONE_SYMBOLS_FLAG; - - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result); - } - } else { - var tag = getTag(value), - isFunc = tag == funcTag || tag == genTag; - - if (isBuffer(value)) { - return cloneBuffer(value, isDeep); - } - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - result = (isFlat || isFunc) ? {} : initCloneObject(value); - if (!isDeep) { - return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result = initCloneByTag(value, tag, isDeep); - } - } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - - if (isSet(value)) { - value.forEach(function(subValue) { - result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); - }); - } else if (isMap(value)) { - value.forEach(function(subValue, key) { - result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - } - - var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); - - var props = isArr ? undefined : keysFunc(value); - arrayEach(props || value, function(subValue, key) { - if (props) { - key = subValue; - subValue = value[key]; - } - // Recursively populate clone (susceptible to call stack limits). - assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack)); - }); - return result; - } - - /** - * The base implementation of `_.conforms` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property predicates to conform to. - * @returns {Function} Returns the new spec function. - */ - function baseConforms(source) { - var props = keys(source); - return function(object) { - return baseConformsTo(object, source, props); - }; - } - - /** - * The base implementation of `_.conformsTo` which accepts `props` to check. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - */ - function baseConformsTo(object, source, props) { - var length = props.length; - if (object == null) { - return !length; - } - object = Object(object); - while (length--) { - var key = props[length], - predicate = source[key], - value = object[key]; - - if ((value === undefined && !(key in object)) || !predicate(value)) { - return false; - } - } - return true; - } - - /** - * The base implementation of `_.delay` and `_.defer` which accepts `args` - * to provide to `func`. - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {Array} args The arguments to provide to `func`. - * @returns {number|Object} Returns the timer id or timeout object. - */ - function baseDelay(func, wait, args) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * The base implementation of methods like `_.difference` without support - * for excluding multiple arrays or iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Array} values The values to exclude. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - */ - function baseDifference(array, values, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - isCommon = true, - length = array.length, - result = [], - valuesLength = values.length; - - if (!length) { - return result; - } - if (iteratee) { - values = arrayMap(values, baseUnary(iteratee)); - } - if (comparator) { - includes = arrayIncludesWith; - isCommon = false; - } - else if (values.length >= LARGE_ARRAY_SIZE) { - includes = cacheHas; - isCommon = false; - values = new SetCache(values); - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.forEach` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ - var baseEach = createBaseEach(baseForOwn); - - /** - * The base implementation of `_.forEachRight` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - */ - var baseEachRight = createBaseEach(baseForOwnRight, true); - - /** - * The base implementation of `_.every` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false` - */ - function baseEvery(collection, predicate) { - var result = true; - baseEach(collection, function(value, index, collection) { - result = !!predicate(value, index, collection); - return result; - }); - return result; - } - - /** - * The base implementation of methods like `_.max` and `_.min` which accepts a - * `comparator` to determine the extremum value. - * - * @private - * @param {Array} array The array to iterate over. - * @param {Function} iteratee The iteratee invoked per iteration. - * @param {Function} comparator The comparator used to compare values. - * @returns {*} Returns the extremum value. - */ - function baseExtremum(array, iteratee, comparator) { - var index = -1, - length = array.length; - - while (++index < length) { - var value = array[index], - current = iteratee(value); - - if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { - var computed = current, - result = value; - } - } - return result; - } - - /** - * The base implementation of `_.fill` without an iteratee call guard. - * - * @private - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - */ - function baseFill(array, value, start, end) { - var length = array.length; - - start = toInteger(start); - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = (end === undefined || end > length) ? length : toInteger(end); - if (end < 0) { - end += length; - } - end = start > end ? 0 : toLength(end); - while (start < end) { - array[start++] = value; - } - return array; - } - - /** - * The base implementation of `_.filter` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - */ - function baseFilter(collection, predicate) { - var result = []; - baseEach(collection, function(value, index, collection) { - if (predicate(value, index, collection)) { - result.push(value); - } - }); - return result; - } - - /** - * The base implementation of `_.flatten` with support for restricting flattening. - * - * @private - * @param {Array} array The array to flatten. - * @param {number} depth The maximum recursion depth. - * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. - * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. - * @param {Array} [result=[]] The initial result value. - * @returns {Array} Returns the new flattened array. - */ - function baseFlatten(array, depth, predicate, isStrict, result) { - var index = -1, - length = array.length; - - predicate || (predicate = isFlattenable); - result || (result = []); - - while (++index < length) { - var value = array[index]; - if (depth > 0 && predicate(value)) { - if (depth > 1) { - // Recursively flatten arrays (susceptible to call stack limits). - baseFlatten(value, depth - 1, predicate, isStrict, result); - } else { - arrayPush(result, value); - } - } else if (!isStrict) { - result[result.length] = value; - } - } - return result; - } - - /** - * The base implementation of `baseForOwn` which iterates over `object` - * properties returned by `keysFunc` and invokes `iteratee` for each property. - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ - var baseFor = createBaseFor(); - - /** - * This function is like `baseFor` except that it iterates over properties - * in the opposite order. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ - var baseForRight = createBaseFor(true); - - /** - * The base implementation of `_.forOwn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwn(object, iteratee) { - return object && baseFor(object, iteratee, keys); - } - - /** - * The base implementation of `_.forOwnRight` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ - function baseForOwnRight(object, iteratee) { - return object && baseForRight(object, iteratee, keys); - } - - /** - * The base implementation of `_.functions` which creates an array of - * `object` function property names filtered from `props`. - * - * @private - * @param {Object} object The object to inspect. - * @param {Array} props The property names to filter. - * @returns {Array} Returns the function names. - */ - function baseFunctions(object, props) { - return arrayFilter(props, function(key) { - return isFunction(object[key]); - }); - } - - /** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ - function baseGet(object, path) { - path = castPath(path, object); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[toKey(path[index++])]; - } - return (index && index == length) ? object : undefined; - } - - /** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ - function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); - } - - /** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); - } - - /** - * The base implementation of `_.gt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - */ - function baseGt(value, other) { - return value > other; - } - - /** - * The base implementation of `_.has` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ - function baseHas(object, key) { - return object != null && hasOwnProperty.call(object, key); - } - - /** - * The base implementation of `_.hasIn` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ - function baseHasIn(object, key) { - return object != null && key in Object(object); - } - - /** - * The base implementation of `_.inRange` which doesn't coerce arguments. - * - * @private - * @param {number} number The number to check. - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - */ - function baseInRange(number, start, end) { - return number >= nativeMin(start, end) && number < nativeMax(start, end); - } - - /** - * The base implementation of methods like `_.intersection`, without support - * for iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of shared values. - */ - function baseIntersection(arrays, iteratee, comparator) { - var includes = comparator ? arrayIncludesWith : arrayIncludes, - length = arrays[0].length, - othLength = arrays.length, - othIndex = othLength, - caches = Array(othLength), - maxLength = Infinity, - result = []; - - while (othIndex--) { - var array = arrays[othIndex]; - if (othIndex && iteratee) { - array = arrayMap(array, baseUnary(iteratee)); - } - maxLength = nativeMin(array.length, maxLength); - caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; - } - array = arrays[0]; - - var index = -1, - seen = caches[0]; - - outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) - )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) - ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.invert` and `_.invertBy` which inverts - * `object` with values transformed by `iteratee` and set by `setter`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} setter The function to set `accumulator` values. - * @param {Function} iteratee The iteratee to transform values. - * @param {Object} accumulator The initial inverted object. - * @returns {Function} Returns `accumulator`. - */ - function baseInverter(object, setter, iteratee, accumulator) { - baseForOwn(object, function(value, key, object) { - setter(accumulator, iteratee(value), key, object); - }); - return accumulator; - } - - /** - * The base implementation of `_.invoke` without support for individual - * method arguments. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {Array} args The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - */ - function baseInvoke(object, path, args) { - path = castPath(path, object); - object = parent(object, path); - var func = object == null ? object : object[toKey(last(path))]; - return func == null ? undefined : apply(func, object, args); - } - - /** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ - function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag; - } - - /** - * The base implementation of `_.isArrayBuffer` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - */ - function baseIsArrayBuffer(value) { - return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; - } - - /** - * The base implementation of `_.isDate` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - */ - function baseIsDate(value) { - return isObjectLike(value) && baseGetTag(value) == dateTag; - } - - /** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {boolean} bitmask The bitmask flags. - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Function} [customizer] The function to customize comparisons. - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(value, other, bitmask, customizer, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); - } - - /** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = objIsArr ? arrayTag : getTag(object), - othTag = othIsArr ? arrayTag : getTag(other); - - objTag = objTag == argsTag ? objectTag : objTag; - othTag = othTag == argsTag ? objectTag : othTag; - - var objIsObj = objTag == objectTag, - othIsObj = othTag == objectTag, - isSameTag = objTag == othTag; - - if (isSameTag && isBuffer(object)) { - if (!isBuffer(other)) { - return false; - } - objIsArr = true; - objIsObj = false; - } - if (isSameTag && !objIsObj) { - stack || (stack = new Stack); - return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); - } - if (!(bitmask & COMPARE_PARTIAL_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, - othUnwrapped = othIsWrapped ? other.value() : other; - - stack || (stack = new Stack); - return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); - } - } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack); - return equalObjects(object, other, bitmask, customizer, equalFunc, stack); - } - - /** - * The base implementation of `_.isMap` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - */ - function baseIsMap(value) { - return isObjectLike(value) && getTag(value) == mapTag; - } - - /** - * The base implementation of `_.isMatch` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Array} matchData The property names, values, and compare flags to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - */ - function baseIsMatch(object, source, matchData, customizer) { - var index = matchData.length, - length = index, - noCustomizer = !customizer; - - if (object == null) { - return !length; - } - object = Object(object); - while (index--) { - var data = matchData[index]; - if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { - return false; - } - } - while (++index < length) { - data = matchData[index]; - var key = data[0], - objValue = object[key], - srcValue = data[1]; - - if (noCustomizer && data[2]) { - if (objValue === undefined && !(key in object)) { - return false; - } - } else { - var stack = new Stack; - if (customizer) { - var result = customizer(objValue, srcValue, key, object, source, stack); - } - if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { - return false; - } - } - } - return true; - } - - /** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ - function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = isFunction(value) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); - } - - /** - * The base implementation of `_.isRegExp` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - */ - function baseIsRegExp(value) { - return isObjectLike(value) && baseGetTag(value) == regexpTag; - } - - /** - * The base implementation of `_.isSet` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - */ - function baseIsSet(value) { - return isObjectLike(value) && getTag(value) == setTag; - } - - /** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ - function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; - } - - /** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. - */ - function baseIteratee(value) { - // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. - // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. - if (typeof value == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (typeof value == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); - } - - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; - } - - /** - * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeysIn(object) { - if (!isObject(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), - result = []; - - for (var key in object) { - if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; - } - - /** - * The base implementation of `_.lt` which doesn't coerce arguments. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - */ - function baseLt(value, other) { - return value < other; - } - - /** - * The base implementation of `_.map` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ - function baseMap(collection, iteratee) { - var index = -1, - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value, key, collection) { - result[++index] = iteratee(value, key, collection); - }); - return result; - } - - /** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new spec function. - */ - function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - return matchesStrictComparable(matchData[0][0], matchData[0][1]); - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; - } - - /** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */ - function baseMatchesProperty(path, srcValue) { - if (isKey(path) && isStrictComparable(srcValue)) { - return matchesStrictComparable(toKey(path), srcValue); - } - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); - }; - } - - /** - * The base implementation of `_.merge` without support for multiple sources. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {number} srcIndex The index of `source`. - * @param {Function} [customizer] The function to customize merged values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ - function baseMerge(object, source, srcIndex, customizer, stack) { - if (object === source) { - return; - } - baseFor(source, function(srcValue, key) { - stack || (stack = new Stack); - if (isObject(srcValue)) { - baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); - } - else { - var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; - - if (newValue === undefined) { - newValue = srcValue; - } - assignMergeValue(object, key, newValue); - } - }, keysIn); - } - - /** - * A specialized version of `baseMerge` for arrays and objects which performs - * deep merges and tracks traversed objects enabling objects with circular - * references to be merged. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {string} key The key of the value to merge. - * @param {number} srcIndex The index of `source`. - * @param {Function} mergeFunc The function to merge values. - * @param {Function} [customizer] The function to customize assigned values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ - function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { - var objValue = safeGet(object, key), - srcValue = safeGet(source, key), - stacked = stack.get(srcValue); - - if (stacked) { - assignMergeValue(object, key, stacked); - return; - } - var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; - - var isCommon = newValue === undefined; - - if (isCommon) { - var isArr = isArray(srcValue), - isBuff = !isArr && isBuffer(srcValue), - isTyped = !isArr && !isBuff && isTypedArray(srcValue); - - newValue = srcValue; - if (isArr || isBuff || isTyped) { - if (isArray(objValue)) { - newValue = objValue; - } - else if (isArrayLikeObject(objValue)) { - newValue = copyArray(objValue); - } - else if (isBuff) { - isCommon = false; - newValue = cloneBuffer(srcValue, true); - } - else if (isTyped) { - isCommon = false; - newValue = cloneTypedArray(srcValue, true); - } - else { - newValue = []; - } - } - else if (isPlainObject(srcValue) || isArguments(srcValue)) { - newValue = objValue; - if (isArguments(objValue)) { - newValue = toPlainObject(objValue); - } - else if (!isObject(objValue) || isFunction(objValue)) { - newValue = initCloneObject(srcValue); - } - } - else { - isCommon = false; - } - } - if (isCommon) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, newValue); - mergeFunc(newValue, srcValue, srcIndex, customizer, stack); - stack['delete'](srcValue); - } - assignMergeValue(object, key, newValue); - } - - /** - * The base implementation of `_.nth` which doesn't coerce arguments. - * - * @private - * @param {Array} array The array to query. - * @param {number} n The index of the element to return. - * @returns {*} Returns the nth element of `array`. - */ - function baseNth(array, n) { - var length = array.length; - if (!length) { - return; - } - n += n < 0 ? length : 0; - return isIndex(n, length) ? array[n] : undefined; - } - - /** - * The base implementation of `_.orderBy` without param guards. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. - * @param {string[]} orders The sort orders of `iteratees`. - * @returns {Array} Returns the new sorted array. - */ - function baseOrderBy(collection, iteratees, orders) { - if (iteratees.length) { - iteratees = arrayMap(iteratees, function(iteratee) { - if (isArray(iteratee)) { - return function(value) { - return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); - } - } - return iteratee; - }); - } else { - iteratees = [identity]; - } - - var index = -1; - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); - - var result = baseMap(collection, function(value, key, collection) { - var criteria = arrayMap(iteratees, function(iteratee) { - return iteratee(value); - }); - return { 'criteria': criteria, 'index': ++index, 'value': value }; - }); - - return baseSortBy(result, function(object, other) { - return compareMultiple(object, other, orders); - }); - } - - /** - * The base implementation of `_.pick` without support for individual - * property identifiers. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @returns {Object} Returns the new object. - */ - function basePick(object, paths) { - return basePickBy(object, paths, function(value, path) { - return hasIn(object, path); - }); - } - - /** - * The base implementation of `_.pickBy` without support for iteratee shorthands. - * - * @private - * @param {Object} object The source object. - * @param {string[]} paths The property paths to pick. - * @param {Function} predicate The function invoked per property. - * @returns {Object} Returns the new object. - */ - function basePickBy(object, paths, predicate) { - var index = -1, - length = paths.length, - result = {}; - - while (++index < length) { - var path = paths[index], - value = baseGet(object, path); - - if (predicate(value, path)) { - baseSet(result, castPath(path, object), value); - } - } - return result; - } - - /** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new accessor function. - */ - function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; - } - - /** - * The base implementation of `_.pullAllBy` without support for iteratee - * shorthands. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. - */ - function basePullAll(array, values, iteratee, comparator) { - var indexOf = comparator ? baseIndexOfWith : baseIndexOf, - index = -1, - length = values.length, - seen = array; - - if (array === values) { - values = copyArray(values); - } - if (iteratee) { - seen = arrayMap(array, baseUnary(iteratee)); - } - while (++index < length) { - var fromIndex = 0, - value = values[index], - computed = iteratee ? iteratee(value) : value; - - while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { - if (seen !== array) { - splice.call(seen, fromIndex, 1); - } - splice.call(array, fromIndex, 1); - } - } - return array; - } - - /** - * The base implementation of `_.pullAt` without support for individual - * indexes or capturing the removed elements. - * - * @private - * @param {Array} array The array to modify. - * @param {number[]} indexes The indexes of elements to remove. - * @returns {Array} Returns `array`. - */ - function basePullAt(array, indexes) { - var length = array ? indexes.length : 0, - lastIndex = length - 1; - - while (length--) { - var index = indexes[length]; - if (length == lastIndex || index !== previous) { - var previous = index; - if (isIndex(index)) { - splice.call(array, index, 1); - } else { - baseUnset(array, index); - } - } - } - return array; - } - - /** - * The base implementation of `_.random` without support for returning - * floating-point numbers. - * - * @private - * @param {number} lower The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the random number. - */ - function baseRandom(lower, upper) { - return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); - } - - /** - * The base implementation of `_.range` and `_.rangeRight` which doesn't - * coerce arguments. - * - * @private - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @param {number} step The value to increment or decrement by. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the range of numbers. - */ - function baseRange(start, end, step, fromRight) { - var index = -1, - length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), - result = Array(length); - - while (length--) { - result[fromRight ? length : ++index] = start; - start += step; - } - return result; - } - - /** - * The base implementation of `_.repeat` which doesn't coerce arguments. - * - * @private - * @param {string} string The string to repeat. - * @param {number} n The number of times to repeat the string. - * @returns {string} Returns the repeated string. - */ - function baseRepeat(string, n) { - var result = ''; - if (!string || n < 1 || n > MAX_SAFE_INTEGER) { - return result; - } - // Leverage the exponentiation by squaring algorithm for a faster repeat. - // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details. - do { - if (n % 2) { - result += string; - } - n = nativeFloor(n / 2); - if (n) { - string += string; - } - } while (n); - - return result; - } - - /** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - */ - function baseRest(func, start) { - return setToString(overRest(func, start, identity), func + ''); - } - - /** - * The base implementation of `_.sample`. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - */ - function baseSample(collection) { - return arraySample(values(collection)); - } - - /** - * The base implementation of `_.sampleSize` without param guards. - * - * @private - * @param {Array|Object} collection The collection to sample. - * @param {number} n The number of elements to sample. - * @returns {Array} Returns the random elements. - */ - function baseSampleSize(collection, n) { - var array = values(collection); - return shuffleSelf(array, baseClamp(n, 0, array.length)); - } - - /** - * The base implementation of `_.set`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseSet(object, path, value, customizer) { - if (!isObject(object)) { - return object; - } - path = castPath(path, object); - - var index = -1, - length = path.length, - lastIndex = length - 1, - nested = object; - - while (nested != null && ++index < length) { - var key = toKey(path[index]), - newValue = value; - - if (key === '__proto__' || key === 'constructor' || key === 'prototype') { - return object; - } - - if (index != lastIndex) { - var objValue = nested[key]; - newValue = customizer ? customizer(objValue, key, nested) : undefined; - if (newValue === undefined) { - newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); - } - } - assignValue(nested, key, newValue); - nested = nested[key]; - } - return object; - } - - /** - * The base implementation of `setData` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var baseSetData = !metaMap ? identity : function(func, data) { - metaMap.set(func, data); - return func; - }; - - /** - * The base implementation of `setToString` without support for hot loop shorting. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ - var baseSetToString = !defineProperty ? identity : function(func, string) { - return defineProperty(func, 'toString', { - 'configurable': true, - 'enumerable': false, - 'value': constant(string), - 'writable': true - }); - }; - - /** - * The base implementation of `_.shuffle`. - * - * @private - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - */ - function baseShuffle(collection) { - return shuffleSelf(values(collection)); - } - - /** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = end > length ? length : end; - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; - } - - /** - * The base implementation of `_.some` without support for iteratee shorthands. - * - * @private - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ - function baseSome(collection, predicate) { - var result; - - baseEach(collection, function(value, index, collection) { - result = predicate(value, index, collection); - return !result; - }); - return !!result; - } - - /** - * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which - * performs a binary search of `array` to determine the index at which `value` - * should be inserted into `array` in order to maintain its sort order. - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseSortedIndex(array, value, retHighest) { - var low = 0, - high = array == null ? low : array.length; - - if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { - while (low < high) { - var mid = (low + high) >>> 1, - computed = array[mid]; - - if (computed !== null && !isSymbol(computed) && - (retHighest ? (computed <= value) : (computed < value))) { - low = mid + 1; - } else { - high = mid; - } - } - return high; - } - return baseSortedIndexBy(array, value, identity, retHighest); - } - - /** - * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy` - * which invokes `iteratee` for `value` and each element of `array` to compute - * their sort ranking. The iteratee is invoked with one argument; (value). - * - * @private - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} iteratee The iteratee invoked per element. - * @param {boolean} [retHighest] Specify returning the highest qualified index. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - */ - function baseSortedIndexBy(array, value, iteratee, retHighest) { - var low = 0, - high = array == null ? 0 : array.length; - if (high === 0) { - return 0; - } - - value = iteratee(value); - var valIsNaN = value !== value, - valIsNull = value === null, - valIsSymbol = isSymbol(value), - valIsUndefined = value === undefined; - - while (low < high) { - var mid = nativeFloor((low + high) / 2), - computed = iteratee(array[mid]), - othIsDefined = computed !== undefined, - othIsNull = computed === null, - othIsReflexive = computed === computed, - othIsSymbol = isSymbol(computed); - - if (valIsNaN) { - var setLow = retHighest || othIsReflexive; - } else if (valIsUndefined) { - setLow = othIsReflexive && (retHighest || othIsDefined); - } else if (valIsNull) { - setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); - } else if (valIsSymbol) { - setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); - } else if (othIsNull || othIsSymbol) { - setLow = false; - } else { - setLow = retHighest ? (computed <= value) : (computed < value); - } - if (setLow) { - low = mid + 1; - } else { - high = mid; - } - } - return nativeMin(high, MAX_ARRAY_INDEX); - } - - /** - * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseSortedUniq(array, iteratee) { - var index = -1, - length = array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - if (!index || !eq(computed, seen)) { - var seen = computed; - result[resIndex++] = value === 0 ? 0 : value; - } - } - return result; - } - - /** - * The base implementation of `_.toNumber` which doesn't ensure correct - * conversions of binary, hexadecimal, or octal string values. - * - * @private - * @param {*} value The value to process. - * @returns {number} Returns the number. - */ - function baseToNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - return +value; - } - - /** - * The base implementation of `_.toString` which doesn't convert nullish - * values to empty strings. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ - function baseToString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (isArray(value)) { - // Recursively convert values (susceptible to call stack limits). - return arrayMap(value, baseToString) + ''; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; - } - - /** - * The base implementation of `_.uniqBy` without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - */ - function baseUniq(array, iteratee, comparator) { - var index = -1, - includes = arrayIncludes, - length = array.length, - isCommon = true, - result = [], - seen = result; - - if (comparator) { - isCommon = false; - includes = arrayIncludesWith; - } - else if (length >= LARGE_ARRAY_SIZE) { - var set = iteratee ? null : createSet(array); - if (set) { - return setToArray(set); - } - isCommon = false; - includes = cacheHas; - seen = new SetCache; - } - else { - seen = iteratee ? [] : result; - } - outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.unset`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The property path to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - */ - function baseUnset(object, path) { - path = castPath(path, object); - object = parent(object, path); - return object == null || delete object[toKey(last(path))]; - } - - /** - * The base implementation of `_.update`. - * - * @private - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to update. - * @param {Function} updater The function to produce the updated value. - * @param {Function} [customizer] The function to customize path creation. - * @returns {Object} Returns `object`. - */ - function baseUpdate(object, path, updater, customizer) { - return baseSet(object, path, updater(baseGet(object, path)), customizer); - } - - /** - * The base implementation of methods like `_.dropWhile` and `_.takeWhile` - * without support for iteratee shorthands. - * - * @private - * @param {Array} array The array to query. - * @param {Function} predicate The function invoked per iteration. - * @param {boolean} [isDrop] Specify dropping elements instead of taking them. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the slice of `array`. - */ - function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, - index = fromRight ? length : -1; - - while ((fromRight ? index-- : ++index < length) && - predicate(array[index], index, array)) {} - - return isDrop - ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) - : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); - } - - /** - * The base implementation of `wrapperValue` which returns the result of - * performing a sequence of actions on the unwrapped `value`, where each - * successive action is supplied the return value of the previous. - * - * @private - * @param {*} value The unwrapped value. - * @param {Array} actions Actions to perform to resolve the unwrapped value. - * @returns {*} Returns the resolved value. - */ - function baseWrapperValue(value, actions) { - var result = value; - if (result instanceof LazyWrapper) { - result = result.value(); - } - return arrayReduce(actions, function(result, action) { - return action.func.apply(action.thisArg, arrayPush([result], action.args)); - }, result); - } - - /** - * The base implementation of methods like `_.xor`, without support for - * iteratee shorthands, that accepts an array of arrays to inspect. - * - * @private - * @param {Array} arrays The arrays to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of values. - */ - function baseXor(arrays, iteratee, comparator) { - var length = arrays.length; - if (length < 2) { - return length ? baseUniq(arrays[0]) : []; - } - var index = -1, - result = Array(length); - - while (++index < length) { - var array = arrays[index], - othIndex = -1; - - while (++othIndex < length) { - if (othIndex != index) { - result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); - } - } - } - return baseUniq(baseFlatten(result, 1), iteratee, comparator); - } - - /** - * This base implementation of `_.zipObject` which assigns values using `assignFunc`. - * - * @private - * @param {Array} props The property identifiers. - * @param {Array} values The property values. - * @param {Function} assignFunc The function to assign values. - * @returns {Object} Returns the new object. - */ - function baseZipObject(props, values, assignFunc) { - var index = -1, - length = props.length, - valsLength = values.length, - result = {}; - - while (++index < length) { - var value = index < valsLength ? values[index] : undefined; - assignFunc(result, props[index], value); - } - return result; - } - - /** - * Casts `value` to an empty array if it's not an array like object. - * - * @private - * @param {*} value The value to inspect. - * @returns {Array|Object} Returns the cast array-like object. - */ - function castArrayLikeObject(value) { - return isArrayLikeObject(value) ? value : []; - } - - /** - * Casts `value` to `identity` if it's not a function. - * - * @private - * @param {*} value The value to inspect. - * @returns {Function} Returns cast function. - */ - function castFunction(value) { - return typeof value == 'function' ? value : identity; - } - - /** - * Casts `value` to a path array if it's not one. - * - * @private - * @param {*} value The value to inspect. - * @param {Object} [object] The object to query keys on. - * @returns {Array} Returns the cast property path array. - */ - function castPath(value, object) { - if (isArray(value)) { - return value; - } - return isKey(value, object) ? [value] : stringToPath(toString(value)); - } - - /** - * A `baseRest` alias which can be replaced with `identity` by module - * replacement plugins. - * - * @private - * @type {Function} - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ - var castRest = baseRest; - - /** - * Casts `array` to a slice if it's needed. - * - * @private - * @param {Array} array The array to inspect. - * @param {number} start The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the cast slice. - */ - function castSlice(array, start, end) { - var length = array.length; - end = end === undefined ? length : end; - return (!start && end >= length) ? array : baseSlice(array, start, end); - } - - /** - * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout). - * - * @private - * @param {number|Object} id The timer id or timeout object of the timer to clear. - */ - var clearTimeout = ctxClearTimeout || function(id) { - return root.clearTimeout(id); - }; - - /** - * Creates a clone of `buffer`. - * - * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. - */ - function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var length = buffer.length, - result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); - - buffer.copy(result); - return result; - } - - /** - * Creates a clone of `arrayBuffer`. - * - * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ - function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); - return result; - } - - /** - * Creates a clone of `dataView`. - * - * @private - * @param {Object} dataView The data view to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned data view. - */ - function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); - } - - /** - * Creates a clone of `regexp`. - * - * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. - */ - function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; - } - - /** - * Creates a clone of the `symbol` object. - * - * @private - * @param {Object} symbol The symbol object to clone. - * @returns {Object} Returns the cloned symbol object. - */ - function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; - } - - /** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ - function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); - } - - /** - * Compares values to sort them in ascending order. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {number} Returns the sort order indicator for `value`. - */ - function compareAscending(value, other) { - if (value !== other) { - var valIsDefined = value !== undefined, - valIsNull = value === null, - valIsReflexive = value === value, - valIsSymbol = isSymbol(value); - - var othIsDefined = other !== undefined, - othIsNull = other === null, - othIsReflexive = other === other, - othIsSymbol = isSymbol(other); - - if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || - (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || - (valIsNull && othIsDefined && othIsReflexive) || - (!valIsDefined && othIsReflexive) || - !valIsReflexive) { - return 1; - } - if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || - (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || - (othIsNull && valIsDefined && valIsReflexive) || - (!othIsDefined && valIsReflexive) || - !othIsReflexive) { - return -1; - } - } - return 0; - } - - /** - * Used by `_.orderBy` to compare multiple properties of a value to another - * and stable sort them. - * - * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, - * specify an order of "desc" for descending or "asc" for ascending sort order - * of corresponding values. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {boolean[]|string[]} orders The order to sort by for each property. - * @returns {number} Returns the sort order indicator for `object`. - */ - function compareMultiple(object, other, orders) { - var index = -1, - objCriteria = object.criteria, - othCriteria = other.criteria, - length = objCriteria.length, - ordersLength = orders.length; - - while (++index < length) { - var result = compareAscending(objCriteria[index], othCriteria[index]); - if (result) { - if (index >= ordersLength) { - return result; - } - var order = orders[index]; - return result * (order == 'desc' ? -1 : 1); - } - } - // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications - // that causes it, under certain circumstances, to provide the same value for - // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 - // for more details. - // - // This also ensures a stable sort in V8 and other engines. - // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. - return object.index - other.index; - } - - /** - * Creates an array that is the composition of partially applied arguments, - * placeholders, and provided arguments into a single array of arguments. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to prepend to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgs(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersLength = holders.length, - leftIndex = -1, - leftLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(leftLength + rangeLength), - isUncurried = !isCurried; - - while (++leftIndex < leftLength) { - result[leftIndex] = partials[leftIndex]; - } - while (++argsIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[holders[argsIndex]] = args[argsIndex]; - } - } - while (rangeLength--) { - result[leftIndex++] = args[argsIndex++]; - } - return result; - } - - /** - * This function is like `composeArgs` except that the arguments composition - * is tailored for `_.partialRight`. - * - * @private - * @param {Array} args The provided arguments. - * @param {Array} partials The arguments to append to those provided. - * @param {Array} holders The `partials` placeholder indexes. - * @params {boolean} [isCurried] Specify composing for a curried function. - * @returns {Array} Returns the new array of composed arguments. - */ - function composeArgsRight(args, partials, holders, isCurried) { - var argsIndex = -1, - argsLength = args.length, - holdersIndex = -1, - holdersLength = holders.length, - rightIndex = -1, - rightLength = partials.length, - rangeLength = nativeMax(argsLength - holdersLength, 0), - result = Array(rangeLength + rightLength), - isUncurried = !isCurried; - - while (++argsIndex < rangeLength) { - result[argsIndex] = args[argsIndex]; - } - var offset = argsIndex; - while (++rightIndex < rightLength) { - result[offset + rightIndex] = partials[rightIndex]; - } - while (++holdersIndex < holdersLength) { - if (isUncurried || argsIndex < argsLength) { - result[offset + holders[holdersIndex]] = args[argsIndex++]; - } - } - return result; - } - - /** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ - function copyArray(source, array) { - var index = -1, - length = source.length; - - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; - } - - /** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ - function copyObject(source, props, object, customizer) { - var isNew = !object; - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; - - if (newValue === undefined) { - newValue = source[key]; - } - if (isNew) { - baseAssignValue(object, key, newValue); - } else { - assignValue(object, key, newValue); - } - } - return object; - } - - /** - * Copies own symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); - } - - /** - * Copies own and inherited symbols of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ - function copySymbolsIn(source, object) { - return copyObject(source, getSymbolsIn(source), object); - } - - /** - * Creates a function like `_.groupBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} [initializer] The accumulator object initializer. - * @returns {Function} Returns the new aggregator function. - */ - function createAggregator(setter, initializer) { - return function(collection, iteratee) { - var func = isArray(collection) ? arrayAggregator : baseAggregator, - accumulator = initializer ? initializer() : {}; - - return func(collection, setter, getIteratee(iteratee, 2), accumulator); - }; - } - - /** - * Creates a function like `_.assign`. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ - function createAssigner(assigner) { - return baseRest(function(object, sources) { - var index = -1, - length = sources.length, - customizer = length > 1 ? sources[length - 1] : undefined, - guard = length > 2 ? sources[2] : undefined; - - customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined : customizer; - length = 1; - } - object = Object(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, index, customizer); - } - } - return object; - }); - } - - /** - * Creates a `baseEach` or `baseEachRight` function. - * - * @private - * @param {Function} eachFunc The function to iterate over a collection. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseEach(eachFunc, fromRight) { - return function(collection, iteratee) { - if (collection == null) { - return collection; - } - if (!isArrayLike(collection)) { - return eachFunc(collection, iteratee); - } - var length = collection.length, - index = fromRight ? length : -1, - iterable = Object(collection); - - while ((fromRight ? index-- : ++index < length)) { - if (iteratee(iterable[index], index, iterable) === false) { - break; - } - } - return collection; - }; - } - - /** - * Creates a base function for methods like `_.forIn` and `_.forOwn`. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ - function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var index = -1, - iterable = Object(object), - props = keysFunc(object), - length = props.length; - - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; - } - - /** - * Creates a function that wraps `func` to invoke it with the optional `this` - * binding of `thisArg`. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createBind(func, bitmask, thisArg) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return fn.apply(isBind ? thisArg : this, arguments); - } - return wrapper; - } - - /** - * Creates a function like `_.lowerFirst`. - * - * @private - * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new case function. - */ - function createCaseFirst(methodName) { - return function(string) { - string = toString(string); - - var strSymbols = hasUnicode(string) - ? stringToArray(string) - : undefined; - - var chr = strSymbols - ? strSymbols[0] - : string.charAt(0); - - var trailing = strSymbols - ? castSlice(strSymbols, 1).join('') - : string.slice(1); - - return chr[methodName]() + trailing; - }; - } - - /** - * Creates a function like `_.camelCase`. - * - * @private - * @param {Function} callback The function to combine each word. - * @returns {Function} Returns the new compounder function. - */ - function createCompounder(callback) { - return function(string) { - return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); - }; - } - - /** - * Creates a function that produces an instance of `Ctor` regardless of - * whether it was invoked as part of a `new` expression or by `call` or `apply`. - * - * @private - * @param {Function} Ctor The constructor to wrap. - * @returns {Function} Returns the new wrapped function. - */ - function createCtor(Ctor) { - return function() { - // Use a `switch` statement to work with class constructors. See - // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist - // for more details. - var args = arguments; - switch (args.length) { - case 0: return new Ctor; - case 1: return new Ctor(args[0]); - case 2: return new Ctor(args[0], args[1]); - case 3: return new Ctor(args[0], args[1], args[2]); - case 4: return new Ctor(args[0], args[1], args[2], args[3]); - case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); - case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); - case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); - } - var thisBinding = baseCreate(Ctor.prototype), - result = Ctor.apply(thisBinding, args); - - // Mimic the constructor's `return` behavior. - // See https://es5.github.io/#x13.2.2 for more details. - return isObject(result) ? result : thisBinding; - }; - } - - /** - * Creates a function that wraps `func` to enable currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {number} arity The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createCurry(func, bitmask, arity) { - var Ctor = createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length, - placeholder = getHolder(wrapper); - - while (index--) { - args[index] = arguments[index]; - } - var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); - - length -= holders.length; - if (length < arity) { - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); - } - var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - return apply(fn, this, args); - } - return wrapper; - } - - /** - * Creates a `_.find` or `_.findLast` function. - * - * @private - * @param {Function} findIndexFunc The function to find the collection index. - * @returns {Function} Returns the new find function. - */ - function createFind(findIndexFunc) { - return function(collection, predicate, fromIndex) { - var iterable = Object(collection); - if (!isArrayLike(collection)) { - var iteratee = getIteratee(predicate, 3); - collection = keys(collection); - predicate = function(key) { return iteratee(iterable[key], key, iterable); }; - } - var index = findIndexFunc(collection, predicate, fromIndex); - return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; - }; - } - - /** - * Creates a `_.flow` or `_.flowRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new flow function. - */ - function createFlow(fromRight) { - return flatRest(function(funcs) { - var length = funcs.length, - index = length, - prereq = LodashWrapper.prototype.thru; - - if (fromRight) { - funcs.reverse(); - } - while (index--) { - var func = funcs[index]; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (prereq && !wrapper && getFuncName(func) == 'wrapper') { - var wrapper = new LodashWrapper([], true); - } - } - index = wrapper ? index : length; - while (++index < length) { - func = funcs[index]; - - var funcName = getFuncName(func), - data = funcName == 'wrapper' ? getData(func) : undefined; - - if (data && isLaziable(data[0]) && - data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && - !data[4].length && data[9] == 1 - ) { - wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); - } else { - wrapper = (func.length == 1 && isLaziable(func)) - ? wrapper[funcName]() - : wrapper.thru(func); - } - } - return function() { - var args = arguments, - value = args[0]; - - if (wrapper && args.length == 1 && isArray(value)) { - return wrapper.plant(value).value(); - } - var index = 0, - result = length ? funcs[index].apply(this, args) : value; - - while (++index < length) { - result = funcs[index].call(this, result); - } - return result; - }; - }); - } - - /** - * Creates a function that wraps `func` to invoke it with optional `this` - * binding of `thisArg`, partial application, and currying. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [partialsRight] The arguments to append to those provided - * to the new function. - * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { - var isAry = bitmask & WRAP_ARY_FLAG, - isBind = bitmask & WRAP_BIND_FLAG, - isBindKey = bitmask & WRAP_BIND_KEY_FLAG, - isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), - isFlip = bitmask & WRAP_FLIP_FLAG, - Ctor = isBindKey ? undefined : createCtor(func); - - function wrapper() { - var length = arguments.length, - args = Array(length), - index = length; - - while (index--) { - args[index] = arguments[index]; - } - if (isCurried) { - var placeholder = getHolder(wrapper), - holdersCount = countHolders(args, placeholder); - } - if (partials) { - args = composeArgs(args, partials, holders, isCurried); - } - if (partialsRight) { - args = composeArgsRight(args, partialsRight, holdersRight, isCurried); - } - length -= holdersCount; - if (isCurried && length < arity) { - var newHolders = replaceHolders(args, placeholder); - return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length - ); - } - var thisBinding = isBind ? thisArg : this, - fn = isBindKey ? thisBinding[func] : func; - - length = args.length; - if (argPos) { - args = reorder(args, argPos); - } else if (isFlip && length > 1) { - args.reverse(); - } - if (isAry && ary < length) { - args.length = ary; - } - if (this && this !== root && this instanceof wrapper) { - fn = Ctor || createCtor(fn); - } - return fn.apply(thisBinding, args); - } - return wrapper; - } - - /** - * Creates a function like `_.invertBy`. - * - * @private - * @param {Function} setter The function to set accumulator values. - * @param {Function} toIteratee The function to resolve iteratees. - * @returns {Function} Returns the new inverter function. - */ - function createInverter(setter, toIteratee) { - return function(object, iteratee) { - return baseInverter(object, setter, toIteratee(iteratee), {}); - }; - } - - /** - * Creates a function that performs a mathematical operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @param {number} [defaultValue] The value used for `undefined` arguments. - * @returns {Function} Returns the new mathematical operation function. - */ - function createMathOperation(operator, defaultValue) { - return function(value, other) { - var result; - if (value === undefined && other === undefined) { - return defaultValue; - } - if (value !== undefined) { - result = value; - } - if (other !== undefined) { - if (result === undefined) { - return other; - } - if (typeof value == 'string' || typeof other == 'string') { - value = baseToString(value); - other = baseToString(other); - } else { - value = baseToNumber(value); - other = baseToNumber(other); - } - result = operator(value, other); - } - return result; - }; - } - - /** - * Creates a function like `_.over`. - * - * @private - * @param {Function} arrayFunc The function to iterate over iteratees. - * @returns {Function} Returns the new over function. - */ - function createOver(arrayFunc) { - return flatRest(function(iteratees) { - iteratees = arrayMap(iteratees, baseUnary(getIteratee())); - return baseRest(function(args) { - var thisArg = this; - return arrayFunc(iteratees, function(iteratee) { - return apply(iteratee, thisArg, args); - }); - }); - }); - } - - /** - * Creates the padding for `string` based on `length`. The `chars` string - * is truncated if the number of characters exceeds `length`. - * - * @private - * @param {number} length The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padding for `string`. - */ - function createPadding(length, chars) { - chars = chars === undefined ? ' ' : baseToString(chars); - - var charsLength = chars.length; - if (charsLength < 2) { - return charsLength ? baseRepeat(chars, length) : chars; - } - var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); - return hasUnicode(chars) - ? castSlice(stringToArray(result), 0, length).join('') - : result.slice(0, length); - } - - /** - * Creates a function that wraps `func` to invoke it with the `this` binding - * of `thisArg` and `partials` prepended to the arguments it receives. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} partials The arguments to prepend to those provided to - * the new function. - * @returns {Function} Returns the new wrapped function. - */ - function createPartial(func, bitmask, thisArg, partials) { - var isBind = bitmask & WRAP_BIND_FLAG, - Ctor = createCtor(func); - - function wrapper() { - var argsIndex = -1, - argsLength = arguments.length, - leftIndex = -1, - leftLength = partials.length, - args = Array(leftLength + argsLength), - fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; - - while (++leftIndex < leftLength) { - args[leftIndex] = partials[leftIndex]; - } - while (argsLength--) { - args[leftIndex++] = arguments[++argsIndex]; - } - return apply(fn, isBind ? thisArg : this, args); - } - return wrapper; - } - - /** - * Creates a `_.range` or `_.rangeRight` function. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new range function. - */ - function createRange(fromRight) { - return function(start, end, step) { - if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { - end = step = undefined; - } - // Ensure the sign of `-0` is preserved. - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); - return baseRange(start, end, step, fromRight); - }; - } - - /** - * Creates a function that performs a relational operation on two values. - * - * @private - * @param {Function} operator The function to perform the operation. - * @returns {Function} Returns the new relational operation function. - */ - function createRelationalOperation(operator) { - return function(value, other) { - if (!(typeof value == 'string' && typeof other == 'string')) { - value = toNumber(value); - other = toNumber(other); - } - return operator(value, other); - }; - } - - /** - * Creates a function that wraps `func` to continue currying. - * - * @private - * @param {Function} func The function to wrap. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @param {Function} wrapFunc The function to create the `func` wrapper. - * @param {*} placeholder The placeholder value. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to prepend to those provided to - * the new function. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { - var isCurry = bitmask & WRAP_CURRY_FLAG, - newHolders = isCurry ? holders : undefined, - newHoldersRight = isCurry ? undefined : holders, - newPartials = isCurry ? partials : undefined, - newPartialsRight = isCurry ? undefined : partials; - - bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); - bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); - - if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { - bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); - } - var newData = [ - func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, - newHoldersRight, argPos, ary, arity - ]; - - var result = wrapFunc.apply(undefined, newData); - if (isLaziable(func)) { - setData(result, newData); - } - result.placeholder = placeholder; - return setWrapToString(result, func, bitmask); - } - - /** - * Creates a function like `_.round`. - * - * @private - * @param {string} methodName The name of the `Math` method to use when rounding. - * @returns {Function} Returns the new round function. - */ - function createRound(methodName) { - var func = Math[methodName]; - return function(number, precision) { - number = toNumber(number); - precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); - if (precision && nativeIsFinite(number)) { - // Shift with exponential notation to avoid floating-point issues. - // See [MDN](https://mdn.io/round#Examples) for more details. - var pair = (toString(number) + 'e').split('e'), - value = func(pair[0] + 'e' + (+pair[1] + precision)); - - pair = (toString(value) + 'e').split('e'); - return +(pair[0] + 'e' + (+pair[1] - precision)); - } - return func(number); - }; - } - - /** - * Creates a set object of `values`. - * - * @private - * @param {Array} values The values to add to the set. - * @returns {Object} Returns the new set. - */ - var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { - return new Set(values); - }; - - /** - * Creates a `_.toPairs` or `_.toPairsIn` function. - * - * @private - * @param {Function} keysFunc The function to get the keys of a given object. - * @returns {Function} Returns the new pairs function. - */ - function createToPairs(keysFunc) { - return function(object) { - var tag = getTag(object); - if (tag == mapTag) { - return mapToArray(object); - } - if (tag == setTag) { - return setToPairs(object); - } - return baseToPairs(object, keysFunc(object)); - }; - } - - /** - * Creates a function that either curries or invokes `func` with optional - * `this` binding and partially applied arguments. - * - * @private - * @param {Function|string} func The function or method name to wrap. - * @param {number} bitmask The bitmask flags. - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` or `_.curryRight` of a bound function - * 8 - `_.curry` - * 16 - `_.curryRight` - * 32 - `_.partial` - * 64 - `_.partialRight` - * 128 - `_.rearg` - * 256 - `_.ary` - * 512 - `_.flip` - * @param {*} [thisArg] The `this` binding of `func`. - * @param {Array} [partials] The arguments to be partially applied. - * @param {Array} [holders] The `partials` placeholder indexes. - * @param {Array} [argPos] The argument positions of the new function. - * @param {number} [ary] The arity cap of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new wrapped function. - */ - function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { - var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; - if (!isBindKey && typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - var length = partials ? partials.length : 0; - if (!length) { - bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); - partials = holders = undefined; - } - ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); - arity = arity === undefined ? arity : toInteger(arity); - length -= holders ? holders.length : 0; - - if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { - var partialsRight = partials, - holdersRight = holders; - - partials = holders = undefined; - } - var data = isBindKey ? undefined : getData(func); - - var newData = [ - func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, - argPos, ary, arity - ]; - - if (data) { - mergeData(newData, data); - } - func = newData[0]; - bitmask = newData[1]; - thisArg = newData[2]; - partials = newData[3]; - holders = newData[4]; - arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); - - if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { - bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); - } - if (!bitmask || bitmask == WRAP_BIND_FLAG) { - var result = createBind(func, bitmask, thisArg); - } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { - result = createCurry(func, bitmask, arity); - } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { - result = createPartial(func, bitmask, thisArg, partials); - } else { - result = createHybrid.apply(undefined, newData); - } - var setter = data ? baseSetData : setData; - return setWrapToString(setter(result, newData), func, bitmask); - } - - /** - * Used by `_.defaults` to customize its `_.assignIn` use to assign properties - * of source objects to the destination object for all destination properties - * that resolve to `undefined`. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to assign. - * @param {Object} object The parent object of `objValue`. - * @returns {*} Returns the value to assign. - */ - function customDefaultsAssignIn(objValue, srcValue, key, object) { - if (objValue === undefined || - (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { - return srcValue; - } - return objValue; - } - - /** - * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source - * objects into destination objects that are passed thru. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to merge. - * @param {Object} object The parent object of `objValue`. - * @param {Object} source The parent object of `srcValue`. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - * @returns {*} Returns the value to assign. - */ - function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { - if (isObject(objValue) && isObject(srcValue)) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); - stack['delete'](srcValue); - } - return objValue; - } - - /** - * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain - * objects. - * - * @private - * @param {*} value The value to inspect. - * @param {string} key The key of the property to inspect. - * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. - */ - function customOmitClone(value) { - return isPlainObject(value) ? undefined : value; - } - - /** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. - */ - function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Check that cyclic values are equal. - var arrStacked = stack.get(array); - var othStacked = stack.get(other); - if (arrStacked && othStacked) { - return arrStacked == other && othStacked == array; - } - var index = -1, - result = true, - seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; - - stack.set(array, other); - stack.set(other, array); - - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); - } - if (compared !== undefined) { - if (compared) { - continue; - } - result = false; - break; - } - // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { - result = false; - break; - } - } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { - result = false; - break; - } - } - stack['delete'](array); - stack['delete'](other); - return result; - } - - /** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { - switch (tag) { - case dataViewTag: - if ((object.byteLength != other.byteLength) || - (object.byteOffset != other.byteOffset)) { - return false; - } - object = object.buffer; - other = other.buffer; - - case arrayBufferTag: - if ((object.byteLength != other.byteLength) || - !equalFunc(new Uint8Array(object), new Uint8Array(other))) { - return false; - } - return true; - - case boolTag: - case dateTag: - case numberTag: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); - - case errorTag: - return object.name == other.name && object.message == other.message; - - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring - // for more details. - return object == (other + ''); - - case mapTag: - var convert = mapToArray; - - case setTag: - var isPartial = bitmask & COMPARE_PARTIAL_FLAG; - convert || (convert = setToArray); - - if (object.size != other.size && !isPartial) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= COMPARE_UNORDERED_FLAG; - - // Recursively compare objects (susceptible to call stack limits). - stack.set(object, other); - var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); - stack['delete'](object); - return result; - - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; - } - - /** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. - * @param {Function} customizer The function to customize comparisons. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ - function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { - var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - objProps = getAllKeys(object), - objLength = objProps.length, - othProps = getAllKeys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { - return false; - } - } - // Check that cyclic values are equal. - var objStacked = stack.get(object); - var othStacked = stack.get(other); - if (objStacked && othStacked) { - return objStacked == other && othStacked == object; - } - var result = true; - stack.set(object, other); - stack.set(other, object); - - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; - - if (customizer) { - var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); - } - // Recursively compare objects (susceptible to call stack limits). - if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { - result = false; - break; - } - skipCtor || (skipCtor = key == 'constructor'); - } - if (result && !skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - result = false; - } - } - stack['delete'](object); - stack['delete'](other); - return result; - } - - /** - * A specialized version of `baseRest` which flattens the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @returns {Function} Returns the new function. - */ - function flatRest(func) { - return setToString(overRest(func, undefined, flatten), func + ''); - } - - /** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); - } - - /** - * Creates an array of own and inherited enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ - function getAllKeysIn(object) { - return baseGetAllKeys(object, keysIn, getSymbolsIn); - } - - /** - * Gets metadata for `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {*} Returns the metadata for `func`. - */ - var getData = !metaMap ? noop : function(func) { - return metaMap.get(func); - }; - - /** - * Gets the name of `func`. - * - * @private - * @param {Function} func The function to query. - * @returns {string} Returns the function name. - */ - function getFuncName(func) { - var result = (func.name + ''), - array = realNames[result], - length = hasOwnProperty.call(realNames, result) ? array.length : 0; - - while (length--) { - var data = array[length], - otherFunc = data.func; - if (otherFunc == null || otherFunc == func) { - return data.name; - } - } - return result; - } - - /** - * Gets the argument placeholder value for `func`. - * - * @private - * @param {Function} func The function to inspect. - * @returns {*} Returns the placeholder value. - */ - function getHolder(func) { - var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func; - return object.placeholder; - } - - /** - * Gets the appropriate "iteratee" function. If `_.iteratee` is customized, - * this function returns the custom method, otherwise it returns `baseIteratee`. - * If arguments are provided, the chosen function is invoked with them and - * its result is returned. - * - * @private - * @param {*} [value] The value to convert to an iteratee. - * @param {number} [arity] The arity of the created iteratee. - * @returns {Function} Returns the chosen function or its result. - */ - function getIteratee() { - var result = lodash.iteratee || iteratee; - result = result === iteratee ? baseIteratee : result; - return arguments.length ? result(arguments[0], arguments[1]) : result; - } - - /** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ - function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; - } - - /** - * Gets the property names, values, and compare flags of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. - */ - function getMatchData(object) { - var result = keys(object), - length = result.length; - - while (length--) { - var key = result[length], - value = object[key]; - - result[length] = [key, value, isStrictComparable(value)]; - } - return result; - } - - /** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ - function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; - } - - /** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ - function getRawTag(value) { - var isOwn = hasOwnProperty.call(value, symToStringTag), - tag = value[symToStringTag]; - - try { - value[symToStringTag] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } - } - return result; - } - - /** - * Creates an array of the own enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbols = !nativeGetSymbols ? stubArray : function(object) { - if (object == null) { - return []; - } - object = Object(object); - return arrayFilter(nativeGetSymbols(object), function(symbol) { - return propertyIsEnumerable.call(object, symbol); - }); - }; - - /** - * Creates an array of the own and inherited enumerable symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ - var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { - var result = []; - while (object) { - arrayPush(result, getSymbols(object)); - object = getPrototype(object); - } - return result; - }; - - /** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ - var getTag = baseGetTag; - - // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. - if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = baseGetTag(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : ''; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; - }; - } - - /** - * Gets the view, applying any `transforms` to the `start` and `end` positions. - * - * @private - * @param {number} start The start of the view. - * @param {number} end The end of the view. - * @param {Array} transforms The transformations to apply to the view. - * @returns {Object} Returns an object containing the `start` and `end` - * positions of the view. - */ - function getView(start, end, transforms) { - var index = -1, - length = transforms.length; - - while (++index < length) { - var data = transforms[index], - size = data.size; - - switch (data.type) { - case 'drop': start += size; break; - case 'dropRight': end -= size; break; - case 'take': end = nativeMin(end, start + size); break; - case 'takeRight': start = nativeMax(start, end - size); break; - } - } - return { 'start': start, 'end': end }; - } - - /** - * Extracts wrapper details from the `source` body comment. - * - * @private - * @param {string} source The source to inspect. - * @returns {Array} Returns the wrapper details. - */ - function getWrapDetails(source) { - var match = source.match(reWrapDetails); - return match ? match[1].split(reSplitDetails) : []; - } - - /** - * Checks if `path` exists on `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @param {Function} hasFunc The function to check properties. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - */ - function hasPath(object, path, hasFunc) { - path = castPath(path, object); - - var index = -1, - length = path.length, - result = false; - - while (++index < length) { - var key = toKey(path[index]); - if (!(result = object != null && hasFunc(object, key))) { - break; - } - object = object[key]; - } - if (result || ++index != length) { - return result; - } - length = object == null ? 0 : object.length; - return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); - } - - /** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ - function initCloneArray(array) { - var length = array.length, - result = new array.constructor(length); - - // Add properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; - } - - /** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; - } - - /** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ - function initCloneByTag(object, tag, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return cloneArrayBuffer(object); - - case boolTag: - case dateTag: - return new Ctor(+object); - - case dataViewTag: - return cloneDataView(object, isDeep); - - case float32Tag: case float64Tag: - case int8Tag: case int16Tag: case int32Tag: - case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: - return cloneTypedArray(object, isDeep); - - case mapTag: - return new Ctor; - - case numberTag: - case stringTag: - return new Ctor(object); - - case regexpTag: - return cloneRegExp(object); - - case setTag: - return new Ctor; - - case symbolTag: - return cloneSymbol(object); - } - } - - /** - * Inserts wrapper `details` in a comment at the top of the `source` body. - * - * @private - * @param {string} source The source to modify. - * @returns {Array} details The details to insert. - * @returns {string} Returns the modified source. - */ - function insertWrapDetails(source, details) { - var length = details.length; - if (!length) { - return source; - } - var lastIndex = length - 1; - details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex]; - details = details.join(length > 2 ? ', ' : ' '); - return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n'); - } - - /** - * Checks if `value` is a flattenable `arguments` object or array. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. - */ - function isFlattenable(value) { - return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); - } - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER : length; - - return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); - } - - /** - * Checks if the given arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, - * else `false`. - */ - function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { - return eq(object[index], value); - } - return false; - } - - /** - * Checks if `value` is a property name and not a property path. - * - * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. - */ - function isKey(value, object) { - if (isArray(value)) { - return false; - } - var type = typeof value; - if (type == 'number' || type == 'symbol' || type == 'boolean' || - value == null || isSymbol(value)) { - return true; - } - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); - } - - /** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ - function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); - } - - /** - * Checks if `func` has a lazy counterpart. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` has a lazy counterpart, - * else `false`. - */ - function isLaziable(func) { - var funcName = getFuncName(func), - other = lodash[funcName]; - - if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { - return false; - } - if (func === other) { - return true; - } - var data = getData(other); - return !!data && func === data[0]; - } - - /** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ - function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); - } - - /** - * Checks if `func` is capable of being masked. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `func` is maskable, else `false`. - */ - var isMaskable = coreJsData ? isFunction : stubFalse; - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; - } - - /** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ - function isStrictComparable(value) { - return value === value && !isObject(value); - } - - /** - * A specialized version of `matchesProperty` for source values suitable - * for strict equality comparisons, i.e. `===`. - * - * @private - * @param {string} key The key of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */ - function matchesStrictComparable(key, srcValue) { - return function(object) { - if (object == null) { - return false; - } - return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); - }; - } - - /** - * A specialized version of `_.memoize` which clears the memoized function's - * cache when it exceeds `MAX_MEMOIZE_SIZE`. - * - * @private - * @param {Function} func The function to have its output memoized. - * @returns {Function} Returns the new memoized function. - */ - function memoizeCapped(func) { - var result = memoize(func, function(key) { - if (cache.size === MAX_MEMOIZE_SIZE) { - cache.clear(); - } - return key; - }); - - var cache = result.cache; - return result; - } - - /** - * Merges the function metadata of `source` into `data`. - * - * Merging metadata reduces the number of wrappers used to invoke a function. - * This is possible because methods like `_.bind`, `_.curry`, and `_.partial` - * may be applied regardless of execution order. Methods like `_.ary` and - * `_.rearg` modify function arguments, making the order in which they are - * executed important, preventing the merging of metadata. However, we make - * an exception for a safe combined case where curried functions have `_.ary` - * and or `_.rearg` applied. - * - * @private - * @param {Array} data The destination metadata. - * @param {Array} source The source metadata. - * @returns {Array} Returns `data`. - */ - function mergeData(data, source) { - var bitmask = data[1], - srcBitmask = source[1], - newBitmask = bitmask | srcBitmask, - isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); - - var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); - - // Exit early if metadata can't be merged. - if (!(isCommon || isCombo)) { - return data; - } - // Use source `thisArg` if available. - if (srcBitmask & WRAP_BIND_FLAG) { - data[2] = source[2]; - // Set when currying a bound function. - newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; - } - // Compose partial arguments. - var value = source[3]; - if (value) { - var partials = data[3]; - data[3] = partials ? composeArgs(partials, value, source[4]) : value; - data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; - } - // Compose partial right arguments. - value = source[5]; - if (value) { - partials = data[5]; - data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; - data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; - } - // Use source `argPos` if available. - value = source[7]; - if (value) { - data[7] = value; - } - // Use source `ary` if it's smaller. - if (srcBitmask & WRAP_ARY_FLAG) { - data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); - } - // Use source `arity` if one is not provided. - if (data[9] == null) { - data[9] = source[9]; - } - // Use source `func` and merge bitmasks. - data[0] = source[0]; - data[1] = newBitmask; - - return data; - } - - /** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function nativeKeysIn(object) { - var result = []; - if (object != null) { - for (var key in Object(object)) { - result.push(key); - } - } - return result; - } - - /** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ - function objectToString(value) { - return nativeObjectToString.call(value); - } - - /** - * A specialized version of `baseRest` which transforms the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @param {Function} transform The rest array transform. - * @returns {Function} Returns the new function. - */ - function overRest(func, start, transform) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = transform(array); - return apply(func, this, otherArgs); - }; - } - - /** - * Gets the parent value at `path` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Array} path The path to get the parent value of. - * @returns {*} Returns the parent value. - */ - function parent(object, path) { - return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); - } - - /** - * Reorder `array` according to the specified indexes where the element at - * the first index is assigned as the first element, the element at - * the second index is assigned as the second element, and so on. - * - * @private - * @param {Array} array The array to reorder. - * @param {Array} indexes The arranged array indexes. - * @returns {Array} Returns `array`. - */ - function reorder(array, indexes) { - var arrLength = array.length, - length = nativeMin(indexes.length, arrLength), - oldArray = copyArray(array); - - while (length--) { - var index = indexes[length]; - array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined; - } - return array; - } - - /** - * Gets the value at `key`, unless `key` is "__proto__" or "constructor". - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ - function safeGet(object, key) { - if (key === 'constructor' && typeof object[key] === 'function') { - return; - } - - if (key == '__proto__') { - return; - } - - return object[key]; - } - - /** - * Sets metadata for `func`. - * - * **Note:** If this function becomes hot, i.e. is invoked a lot in a short - * period of time, it will trip its breaker and transition to an identity - * function to avoid garbage collection pauses in V8. See - * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070) - * for more details. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ - var setData = shortOut(baseSetData); - - /** - * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout). - * - * @private - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @returns {number|Object} Returns the timer id or timeout object. - */ - var setTimeout = ctxSetTimeout || function(func, wait) { - return root.setTimeout(func, wait); - }; - - /** - * Sets the `toString` method of `func` to return `string`. - * - * @private - * @param {Function} func The function to modify. - * @param {Function} string The `toString` result. - * @returns {Function} Returns `func`. - */ - var setToString = shortOut(baseSetToString); - - /** - * Sets the `toString` method of `wrapper` to mimic the source of `reference` - * with wrapper details in a comment at the top of the source body. - * - * @private - * @param {Function} wrapper The function to modify. - * @param {Function} reference The reference function. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Function} Returns `wrapper`. - */ - function setWrapToString(wrapper, reference, bitmask) { - var source = (reference + ''); - return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); - } - - /** - * Creates a function that'll short out and invoke `identity` instead - * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` - * milliseconds. - * - * @private - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new shortable function. - */ - function shortOut(func) { - var count = 0, - lastCalled = 0; - - return function() { - var stamp = nativeNow(), - remaining = HOT_SPAN - (stamp - lastCalled); - - lastCalled = stamp; - if (remaining > 0) { - if (++count >= HOT_COUNT) { - return arguments[0]; - } - } else { - count = 0; - } - return func.apply(undefined, arguments); - }; - } - - /** - * A specialized version of `_.shuffle` which mutates and sets the size of `array`. - * - * @private - * @param {Array} array The array to shuffle. - * @param {number} [size=array.length] The size of `array`. - * @returns {Array} Returns `array`. - */ - function shuffleSelf(array, size) { - var index = -1, - length = array.length, - lastIndex = length - 1; - - size = size === undefined ? length : size; - while (++index < size) { - var rand = baseRandom(index, lastIndex), - value = array[rand]; - - array[rand] = array[index]; - array[index] = value; - } - array.length = size; - return array; - } - - /** - * Converts `string` to a property path array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. - */ - var stringToPath = memoizeCapped(function(string) { - var result = []; - if (string.charCodeAt(0) === 46 /* . */) { - result.push(''); - } - string.replace(rePropName, function(match, number, quote, subString) { - result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); - }); - return result; - }); - - /** - * Converts `value` to a string key if it's not a string or symbol. - * - * @private - * @param {*} value The value to inspect. - * @returns {string|symbol} Returns the key. - */ - function toKey(value) { - if (typeof value == 'string' || isSymbol(value)) { - return value; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; - } - - /** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to convert. - * @returns {string} Returns the source code. - */ - function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; - } - - /** - * Updates wrapper `details` based on `bitmask` flags. - * - * @private - * @returns {Array} details The details to modify. - * @param {number} bitmask The bitmask flags. See `createWrap` for more details. - * @returns {Array} Returns `details`. - */ - function updateWrapDetails(details, bitmask) { - arrayEach(wrapFlags, function(pair) { - var value = '_.' + pair[0]; - if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { - details.push(value); - } - }); - return details.sort(); - } - - /** - * Creates a clone of `wrapper`. - * - * @private - * @param {Object} wrapper The wrapper to clone. - * @returns {Object} Returns the cloned wrapper. - */ - function wrapperClone(wrapper) { - if (wrapper instanceof LazyWrapper) { - return wrapper.clone(); - } - var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); - result.__actions__ = copyArray(wrapper.__actions__); - result.__index__ = wrapper.__index__; - result.__values__ = wrapper.__values__; - return result; - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an array of elements split into groups the length of `size`. - * If `array` can't be split evenly, the final chunk will be the remaining - * elements. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to process. - * @param {number} [size=1] The length of each chunk - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the new array of chunks. - * @example - * - * _.chunk(['a', 'b', 'c', 'd'], 2); - * // => [['a', 'b'], ['c', 'd']] - * - * _.chunk(['a', 'b', 'c', 'd'], 3); - * // => [['a', 'b', 'c'], ['d']] - */ - function chunk(array, size, guard) { - if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) { - size = 1; - } else { - size = nativeMax(toInteger(size), 0); - } - var length = array == null ? 0 : array.length; - if (!length || size < 1) { - return []; - } - var index = 0, - resIndex = 0, - result = Array(nativeCeil(length / size)); - - while (index < length) { - result[resIndex++] = baseSlice(array, index, (index += size)); - } - return result; - } - - /** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are falsey. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to compact. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result[resIndex++] = value; - } - } - return result; - } - - /** - * Creates a new array concatenating `array` with any additional arrays - * and/or values. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to concatenate. - * @param {...*} [values] The values to concatenate. - * @returns {Array} Returns the new concatenated array. - * @example - * - * var array = [1]; - * var other = _.concat(array, 2, [3], [[4]]); - * - * console.log(other); - * // => [1, 2, 3, [4]] - * - * console.log(array); - * // => [1] - */ - function concat() { - var length = arguments.length; - if (!length) { - return []; - } - var args = Array(length - 1), - array = arguments[0], - index = length; - - while (index--) { - args[index - 1] = arguments[index]; - } - return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); - } - - /** - * Creates an array of `array` values not included in the other given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * **Note:** Unlike `_.pullAll`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @see _.without, _.xor - * @example - * - * _.difference([2, 1], [2, 3]); - * // => [1] - */ - var difference = baseRest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `iteratee` which - * is invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * **Note:** Unlike `_.pullAllBy`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2] - * - * // The `_.property` iteratee shorthand. - * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var differenceBy = baseRest(function(array, values) { - var iteratee = last(values); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)) - : []; - }); - - /** - * This method is like `_.difference` except that it accepts `comparator` - * which is invoked to compare elements of `array` to `values`. The order and - * references of result values are determined by the first array. The comparator - * is invoked with two arguments: (arrVal, othVal). - * - * **Note:** Unlike `_.pullAllWith`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * - * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); - * // => [{ 'x': 2, 'y': 1 }] - */ - var differenceWith = baseRest(function(array, values) { - var comparator = last(values); - if (isArrayLikeObject(comparator)) { - comparator = undefined; - } - return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator) - : []; - }); - - /** - * Creates a slice of `array` with `n` elements dropped from the beginning. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.drop([1, 2, 3]); - * // => [2, 3] - * - * _.drop([1, 2, 3], 2); - * // => [3] - * - * _.drop([1, 2, 3], 5); - * // => [] - * - * _.drop([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function drop(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - return baseSlice(array, n < 0 ? 0 : n, length); - } - - /** - * Creates a slice of `array` with `n` elements dropped from the end. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to drop. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.dropRight([1, 2, 3]); - * // => [1, 2] - * - * _.dropRight([1, 2, 3], 2); - * // => [1] - * - * _.dropRight([1, 2, 3], 5); - * // => [] - * - * _.dropRight([1, 2, 3], 0); - * // => [1, 2, 3] - */ - function dropRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` excluding elements dropped from the end. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.dropRightWhile(users, function(o) { return !o.active; }); - * // => objects for ['barney'] - * - * // The `_.matches` iteratee shorthand. - * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); - * // => objects for ['barney', 'fred'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropRightWhile(users, ['active', false]); - * // => objects for ['barney'] - * - * // The `_.property` iteratee shorthand. - * _.dropRightWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ - function dropRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true, true) - : []; - } - - /** - * Creates a slice of `array` excluding elements dropped from the beginning. - * Elements are dropped until `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.dropWhile(users, function(o) { return !o.active; }); - * // => objects for ['pebbles'] - * - * // The `_.matches` iteratee shorthand. - * _.dropWhile(users, { 'user': 'barney', 'active': false }); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.dropWhile(users, ['active', false]); - * // => objects for ['pebbles'] - * - * // The `_.property` iteratee shorthand. - * _.dropWhile(users, 'active'); - * // => objects for ['barney', 'fred', 'pebbles'] - */ - function dropWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), true) - : []; - } - - /** - * Fills elements of `array` with `value` from `start` up to, but not - * including, `end`. - * - * **Note:** This method mutates `array`. - * - * @static - * @memberOf _ - * @since 3.2.0 - * @category Array - * @param {Array} array The array to fill. - * @param {*} value The value to fill `array` with. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.fill(array, 'a'); - * console.log(array); - * // => ['a', 'a', 'a'] - * - * _.fill(Array(3), 2); - * // => [2, 2, 2] - * - * _.fill([4, 6, 8, 10], '*', 1, 3); - * // => [4, '*', '*', 10] - */ - function fill(array, value, start, end) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { - start = 0; - end = length; - } - return baseFill(array, value, start, end); - } - - /** - * This method is like `_.find` except that it returns the index of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.findIndex(users, function(o) { return o.user == 'barney'; }); - * // => 0 - * - * // The `_.matches` iteratee shorthand. - * _.findIndex(users, { 'user': 'fred', 'active': false }); - * // => 1 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findIndex(users, ['active', false]); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.findIndex(users, 'active'); - * // => 2 - */ - function findIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseFindIndex(array, getIteratee(predicate, 3), index); - } - - /** - * This method is like `_.findIndex` except that it iterates over elements - * of `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); - * // => 2 - * - * // The `_.matches` iteratee shorthand. - * _.findLastIndex(users, { 'user': 'barney', 'active': true }); - * // => 0 - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastIndex(users, ['active', false]); - * // => 2 - * - * // The `_.property` iteratee shorthand. - * _.findLastIndex(users, 'active'); - * // => 0 - */ - function findLastIndex(array, predicate, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length - 1; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); - } - return baseFindIndex(array, getIteratee(predicate, 3), index, true); - } - - /** - * Flattens `array` a single level deep. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flatten([1, [2, [3, [4]], 5]]); - * // => [1, 2, [3, [4]], 5] - */ - function flatten(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, 1) : []; - } - - /** - * Recursively flattens `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to flatten. - * @returns {Array} Returns the new flattened array. - * @example - * - * _.flattenDeep([1, [2, [3, [4]], 5]]); - * // => [1, 2, 3, 4, 5] - */ - function flattenDeep(array) { - var length = array == null ? 0 : array.length; - return length ? baseFlatten(array, INFINITY) : []; - } - - /** - * Recursively flatten `array` up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.4.0 - * @category Array - * @param {Array} array The array to flatten. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * var array = [1, [2, [3, [4]], 5]]; - * - * _.flattenDepth(array, 1); - * // => [1, 2, [3, [4]], 5] - * - * _.flattenDepth(array, 2); - * // => [1, 2, 3, [4], 5] - */ - function flattenDepth(array, depth) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(array, depth); - } - - /** - * The inverse of `_.toPairs`; this method returns an object composed - * from key-value `pairs`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} pairs The key-value pairs. - * @returns {Object} Returns the new object. - * @example - * - * _.fromPairs([['a', 1], ['b', 2]]); - * // => { 'a': 1, 'b': 2 } - */ - function fromPairs(pairs) { - var index = -1, - length = pairs == null ? 0 : pairs.length, - result = {}; - - while (++index < length) { - var pair = pairs[index]; - result[pair[0]] = pair[1]; - } - return result; - } - - /** - * Gets the first element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias first - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the first element of `array`. - * @example - * - * _.head([1, 2, 3]); - * // => 1 - * - * _.head([]); - * // => undefined - */ - function head(array) { - return (array && array.length) ? array[0] : undefined; - } - - /** - * Gets the index at which the first occurrence of `value` is found in `array` - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it's used as the - * offset from the end of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.indexOf([1, 2, 1, 2], 2); - * // => 1 - * - * // Search from the `fromIndex`. - * _.indexOf([1, 2, 1, 2], 2, 2); - * // => 3 - */ - function indexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = fromIndex == null ? 0 : toInteger(fromIndex); - if (index < 0) { - index = nativeMax(length + index, 0); - } - return baseIndexOf(array, value, index); - } - - /** - * Gets all but the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - */ - function initial(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 0, -1) : []; - } - - /** - * Creates an array of unique values that are included in all given arrays - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. The order and references of result values are - * determined by the first array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersection([2, 1], [2, 3]); - * // => [2] - */ - var intersection = baseRest(function(arrays) { - var mapped = arrayMap(arrays, castArrayLikeObject); - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `iteratee` - * which is invoked for each element of each `arrays` to generate the criterion - * by which they're compared. The order and references of result values are - * determined by the first array. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [2.1] - * - * // The `_.property` iteratee shorthand. - * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }] - */ - var intersectionBy = baseRest(function(arrays) { - var iteratee = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - if (iteratee === last(mapped)) { - iteratee = undefined; - } else { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, getIteratee(iteratee, 2)) - : []; - }); - - /** - * This method is like `_.intersection` except that it accepts `comparator` - * which is invoked to compare elements of `arrays`. The order and references - * of result values are determined by the first array. The comparator is - * invoked with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of intersecting values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.intersectionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }] - */ - var intersectionWith = baseRest(function(arrays) { - var comparator = last(arrays), - mapped = arrayMap(arrays, castArrayLikeObject); - - comparator = typeof comparator == 'function' ? comparator : undefined; - if (comparator) { - mapped.pop(); - } - return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped, undefined, comparator) - : []; - }); - - /** - * Converts all elements in `array` into a string separated by `separator`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to convert. - * @param {string} [separator=','] The element separator. - * @returns {string} Returns the joined string. - * @example - * - * _.join(['a', 'b', 'c'], '~'); - * // => 'a~b~c' - */ - function join(array, separator) { - return array == null ? '' : nativeJoin.call(array, separator); - } - - /** - * Gets the last element of `array`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @returns {*} Returns the last element of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - */ - function last(array) { - var length = array == null ? 0 : array.length; - return length ? array[length - 1] : undefined; - } - - /** - * This method is like `_.indexOf` except that it iterates over elements of - * `array` from right to left. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.lastIndexOf([1, 2, 1, 2], 2); - * // => 3 - * - * // Search from the `fromIndex`. - * _.lastIndexOf([1, 2, 1, 2], 2, 2); - * // => 1 - */ - function lastIndexOf(array, value, fromIndex) { - var length = array == null ? 0 : array.length; - if (!length) { - return -1; - } - var index = length; - if (fromIndex !== undefined) { - index = toInteger(fromIndex); - index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); - } - return value === value - ? strictLastIndexOf(array, value, index) - : baseFindIndex(array, baseIsNaN, index, true); - } - - /** - * Gets the element at index `n` of `array`. If `n` is negative, the nth - * element from the end is returned. - * - * @static - * @memberOf _ - * @since 4.11.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=0] The index of the element to return. - * @returns {*} Returns the nth element of `array`. - * @example - * - * var array = ['a', 'b', 'c', 'd']; - * - * _.nth(array, 1); - * // => 'b' - * - * _.nth(array, -2); - * // => 'c'; - */ - function nth(array, n) { - return (array && array.length) ? baseNth(array, toInteger(n)) : undefined; - } - - /** - * Removes all given values from `array` using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` - * to remove elements from an array by predicate. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {...*} [values] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pull(array, 'a', 'c'); - * console.log(array); - * // => ['b', 'b'] - */ - var pull = baseRest(pullAll); - - /** - * This method is like `_.pull` except that it accepts an array of values to remove. - * - * **Note:** Unlike `_.difference`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = ['a', 'b', 'c', 'a', 'b', 'c']; - * - * _.pullAll(array, ['a', 'c']); - * console.log(array); - * // => ['b', 'b'] - */ - function pullAll(array, values) { - return (array && array.length && values && values.length) - ? basePullAll(array, values) - : array; - } - - /** - * This method is like `_.pullAll` except that it accepts `iteratee` which is - * invoked for each element of `array` and `values` to generate the criterion - * by which they're compared. The iteratee is invoked with one argument: (value). - * - * **Note:** Unlike `_.differenceBy`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns `array`. - * @example - * - * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]; - * - * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x'); - * console.log(array); - * // => [{ 'x': 2 }] - */ - function pullAllBy(array, values, iteratee) { - return (array && array.length && values && values.length) - ? basePullAll(array, values, getIteratee(iteratee, 2)) - : array; - } - - /** - * This method is like `_.pullAll` except that it accepts `comparator` which - * is invoked to compare elements of `array` to `values`. The comparator is - * invoked with two arguments: (arrVal, othVal). - * - * **Note:** Unlike `_.differenceWith`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Array} values The values to remove. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns `array`. - * @example - * - * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]; - * - * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual); - * console.log(array); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }] - */ - function pullAllWith(array, values, comparator) { - return (array && array.length && values && values.length) - ? basePullAll(array, values, undefined, comparator) - : array; - } - - /** - * Removes elements from `array` corresponding to `indexes` and returns an - * array of removed elements. - * - * **Note:** Unlike `_.at`, this method mutates `array`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {...(number|number[])} [indexes] The indexes of elements to remove. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = ['a', 'b', 'c', 'd']; - * var pulled = _.pullAt(array, [1, 3]); - * - * console.log(array); - * // => ['a', 'c'] - * - * console.log(pulled); - * // => ['b', 'd'] - */ - var pullAt = flatRest(function(array, indexes) { - var length = array == null ? 0 : array.length, - result = baseAt(array, indexes); - - basePullAt(array, arrayMap(indexes, function(index) { - return isIndex(index, length) ? +index : index; - }).sort(compareAscending)); - - return result; - }); - - /** - * Removes all elements from `array` that `predicate` returns truthy for - * and returns an array of the removed elements. The predicate is invoked - * with three arguments: (value, index, array). - * - * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` - * to pull elements from an array by value. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Array - * @param {Array} array The array to modify. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4]; - * var evens = _.remove(array, function(n) { - * return n % 2 == 0; - * }); - * - * console.log(array); - * // => [1, 3] - * - * console.log(evens); - * // => [2, 4] - */ - function remove(array, predicate) { - var result = []; - if (!(array && array.length)) { - return result; - } - var index = -1, - indexes = [], - length = array.length; - - predicate = getIteratee(predicate, 3); - while (++index < length) { - var value = array[index]; - if (predicate(value, index, array)) { - result.push(value); - indexes.push(index); - } - } - basePullAt(array, indexes); - return result; - } - - /** - * Reverses `array` so that the first element becomes the last, the second - * element becomes the second to last, and so on. - * - * **Note:** This method mutates `array` and is based on - * [`Array#reverse`](https://mdn.io/Array/reverse). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to modify. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3]; - * - * _.reverse(array); - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function reverse(array) { - return array == null ? array : nativeReverse.call(array); - } - - /** - * Creates a slice of `array` from `start` up to, but not including, `end`. - * - * **Note:** This method is used instead of - * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are - * returned. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ - function slice(array, start, end) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { - start = 0; - end = length; - } - else { - start = start == null ? 0 : toInteger(start); - end = end === undefined ? length : toInteger(end); - } - return baseSlice(array, start, end); - } - - /** - * Uses a binary search to determine the lowest index at which `value` - * should be inserted into `array` in order to maintain its sort order. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedIndex([30, 50], 40); - * // => 1 - */ - function sortedIndex(array, value) { - return baseSortedIndex(array, value); - } - - /** - * This method is like `_.sortedIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; - * - * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 0 - * - * // The `_.property` iteratee shorthand. - * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); - * // => 0 - */ - function sortedIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee, 2)); - } - - /** - * This method is like `_.indexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedIndexOf([4, 5, 5, 5, 6], 5); - * // => 1 - */ - function sortedIndexOf(array, value) { - var length = array == null ? 0 : array.length; - if (length) { - var index = baseSortedIndex(array, value); - if (index < length && eq(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.sortedIndex` except that it returns the highest - * index at which `value` should be inserted into `array` in order to - * maintain its sort order. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedLastIndex([4, 5, 5, 5, 6], 5); - * // => 4 - */ - function sortedLastIndex(array, value) { - return baseSortedIndex(array, value, true); - } - - /** - * This method is like `_.sortedLastIndex` except that it accepts `iteratee` - * which is invoked for `value` and each element of `array` to compute their - * sort ranking. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The sorted array to inspect. - * @param {*} value The value to evaluate. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * var objects = [{ 'x': 4 }, { 'x': 5 }]; - * - * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); - * // => 1 - * - * // The `_.property` iteratee shorthand. - * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); - * // => 1 - */ - function sortedLastIndexBy(array, value, iteratee) { - return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true); - } - - /** - * This method is like `_.lastIndexOf` except that it performs a binary - * search on a sorted `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - * @example - * - * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); - * // => 3 - */ - function sortedLastIndexOf(array, value) { - var length = array == null ? 0 : array.length; - if (length) { - var index = baseSortedIndex(array, value, true) - 1; - if (eq(array[index], value)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.uniq` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniq([1, 1, 2]); - * // => [1, 2] - */ - function sortedUniq(array) { - return (array && array.length) - ? baseSortedUniq(array) - : []; - } - - /** - * This method is like `_.uniqBy` except that it's designed and optimized - * for sorted arrays. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [iteratee] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); - * // => [1.1, 2.3] - */ - function sortedUniqBy(array, iteratee) { - return (array && array.length) - ? baseSortedUniq(array, getIteratee(iteratee, 2)) - : []; - } - - /** - * Gets all but the first element of `array`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to query. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.tail([1, 2, 3]); - * // => [2, 3] - */ - function tail(array) { - var length = array == null ? 0 : array.length; - return length ? baseSlice(array, 1, length) : []; - } - - /** - * Creates a slice of `array` with `n` elements taken from the beginning. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.take([1, 2, 3]); - * // => [1] - * - * _.take([1, 2, 3], 2); - * // => [1, 2] - * - * _.take([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.take([1, 2, 3], 0); - * // => [] - */ - function take(array, n, guard) { - if (!(array && array.length)) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - return baseSlice(array, 0, n < 0 ? 0 : n); - } - - /** - * Creates a slice of `array` with `n` elements taken from the end. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {number} [n=1] The number of elements to take. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the slice of `array`. - * @example - * - * _.takeRight([1, 2, 3]); - * // => [3] - * - * _.takeRight([1, 2, 3], 2); - * // => [2, 3] - * - * _.takeRight([1, 2, 3], 5); - * // => [1, 2, 3] - * - * _.takeRight([1, 2, 3], 0); - * // => [] - */ - function takeRight(array, n, guard) { - var length = array == null ? 0 : array.length; - if (!length) { - return []; - } - n = (guard || n === undefined) ? 1 : toInteger(n); - n = length - n; - return baseSlice(array, n < 0 ? 0 : n, length); - } - - /** - * Creates a slice of `array` with elements taken from the end. Elements are - * taken until `predicate` returns falsey. The predicate is invoked with - * three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': false } - * ]; - * - * _.takeRightWhile(users, function(o) { return !o.active; }); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.matches` iteratee shorthand. - * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); - * // => objects for ['pebbles'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.takeRightWhile(users, ['active', false]); - * // => objects for ['fred', 'pebbles'] - * - * // The `_.property` iteratee shorthand. - * _.takeRightWhile(users, 'active'); - * // => [] - */ - function takeRightWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3), false, true) - : []; - } - - /** - * Creates a slice of `array` with elements taken from the beginning. Elements - * are taken until `predicate` returns falsey. The predicate is invoked with - * three arguments: (value, index, array). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Array - * @param {Array} array The array to query. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the slice of `array`. - * @example - * - * var users = [ - * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false }, - * { 'user': 'pebbles', 'active': true } - * ]; - * - * _.takeWhile(users, function(o) { return !o.active; }); - * // => objects for ['barney', 'fred'] - * - * // The `_.matches` iteratee shorthand. - * _.takeWhile(users, { 'user': 'barney', 'active': false }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.takeWhile(users, ['active', false]); - * // => objects for ['barney', 'fred'] - * - * // The `_.property` iteratee shorthand. - * _.takeWhile(users, 'active'); - * // => [] - */ - function takeWhile(array, predicate) { - return (array && array.length) - ? baseWhile(array, getIteratee(predicate, 3)) - : []; - } - - /** - * Creates an array of unique values, in order, from all given arrays using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.union([2], [1, 2]); - * // => [2, 1] - */ - var union = baseRest(function(arrays) { - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); - }); - - /** - * This method is like `_.union` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by - * which uniqueness is computed. Result values are chosen from the first - * array in which the value occurs. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * _.unionBy([2.1], [1.2, 2.3], Math.floor); - * // => [2.1, 1.2] - * - * // The `_.property` iteratee shorthand. - * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - var unionBy = baseRest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2)); - }); - - /** - * This method is like `_.union` except that it accepts `comparator` which - * is invoked to compare elements of `arrays`. Result values are chosen from - * the first array in which the value occurs. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of combined values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.unionWith(objects, others, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var unionWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == 'function' ? comparator : undefined; - return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator); - }); - - /** - * Creates a duplicate-free version of an array, using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons, in which only the first occurrence of each element - * is kept. The order of result values is determined by the order they occur - * in the array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniq([2, 1, 2]); - * // => [2, 1] - */ - function uniq(array) { - return (array && array.length) ? baseUniq(array) : []; - } - - /** - * This method is like `_.uniq` except that it accepts `iteratee` which is - * invoked for each element in `array` to generate the criterion by which - * uniqueness is computed. The order of result values is determined by the - * order they occur in the array. The iteratee is invoked with one argument: - * (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * _.uniqBy([2.1, 1.2, 2.3], Math.floor); - * // => [2.1, 1.2] - * - * // The `_.property` iteratee shorthand. - * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - function uniqBy(array, iteratee) { - return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : []; - } - - /** - * This method is like `_.uniq` except that it accepts `comparator` which - * is invoked to compare elements of `array`. The order of result values is - * determined by the order they occur in the array.The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new duplicate free array. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.uniqWith(objects, _.isEqual); - * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] - */ - function uniqWith(array, comparator) { - comparator = typeof comparator == 'function' ? comparator : undefined; - return (array && array.length) ? baseUniq(array, undefined, comparator) : []; - } - - /** - * This method is like `_.zip` except that it accepts an array of grouped - * elements and creates an array regrouping the elements to their pre-zip - * configuration. - * - * @static - * @memberOf _ - * @since 1.2.0 - * @category Array - * @param {Array} array The array of grouped elements to process. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]); - * // => [['a', 1, true], ['b', 2, false]] - * - * _.unzip(zipped); - * // => [['a', 'b'], [1, 2], [true, false]] - */ - function unzip(array) { - if (!(array && array.length)) { - return []; - } - var length = 0; - array = arrayFilter(array, function(group) { - if (isArrayLikeObject(group)) { - length = nativeMax(group.length, length); - return true; - } - }); - return baseTimes(length, function(index) { - return arrayMap(array, baseProperty(index)); - }); - } - - /** - * This method is like `_.unzip` except that it accepts `iteratee` to specify - * how regrouped values should be combined. The iteratee is invoked with the - * elements of each group: (...group). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Array - * @param {Array} array The array of grouped elements to process. - * @param {Function} [iteratee=_.identity] The function to combine - * regrouped values. - * @returns {Array} Returns the new array of regrouped elements. - * @example - * - * var zipped = _.zip([1, 2], [10, 20], [100, 200]); - * // => [[1, 10, 100], [2, 20, 200]] - * - * _.unzipWith(zipped, _.add); - * // => [3, 30, 300] - */ - function unzipWith(array, iteratee) { - if (!(array && array.length)) { - return []; - } - var result = unzip(array); - if (iteratee == null) { - return result; - } - return arrayMap(result, function(group) { - return apply(iteratee, undefined, group); - }); - } - - /** - * Creates an array excluding all given values using - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * **Note:** Unlike `_.pull`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {Array} array The array to inspect. - * @param {...*} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @see _.difference, _.xor - * @example - * - * _.without([2, 1, 2, 3], 1, 2); - * // => [3] - */ - var without = baseRest(function(array, values) { - return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; - }); - - /** - * Creates an array of unique values that is the - * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) - * of the given arrays. The order of result values is determined by the order - * they occur in the arrays. - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @returns {Array} Returns the new array of filtered values. - * @see _.difference, _.without - * @example - * - * _.xor([2, 1], [2, 3]); - * // => [1, 3] - */ - var xor = baseRest(function(arrays) { - return baseXor(arrayFilter(arrays, isArrayLikeObject)); - }); - - /** - * This method is like `_.xor` except that it accepts `iteratee` which is - * invoked for each element of each `arrays` to generate the criterion by - * which by which they're compared. The order of result values is determined - * by the order they occur in the arrays. The iteratee is invoked with one - * argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); - * // => [1.2, 3.4] - * - * // The `_.property` iteratee shorthand. - * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 2 }] - */ - var xorBy = baseRest(function(arrays) { - var iteratee = last(arrays); - if (isArrayLikeObject(iteratee)) { - iteratee = undefined; - } - return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2)); - }); - - /** - * This method is like `_.xor` except that it accepts `comparator` which is - * invoked to compare elements of `arrays`. The order of result values is - * determined by the order they occur in the arrays. The comparator is invoked - * with two arguments: (arrVal, othVal). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Array - * @param {...Array} [arrays] The arrays to inspect. - * @param {Function} [comparator] The comparator invoked per element. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]; - * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]; - * - * _.xorWith(objects, others, _.isEqual); - * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }] - */ - var xorWith = baseRest(function(arrays) { - var comparator = last(arrays); - comparator = typeof comparator == 'function' ? comparator : undefined; - return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator); - }); - - /** - * Creates an array of grouped elements, the first of which contains the - * first elements of the given arrays, the second of which contains the - * second elements of the given arrays, and so on. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zip(['a', 'b'], [1, 2], [true, false]); - * // => [['a', 1, true], ['b', 2, false]] - */ - var zip = baseRest(unzip); - - /** - * This method is like `_.fromPairs` except that it accepts two arrays, - * one of property identifiers and one of corresponding values. - * - * @static - * @memberOf _ - * @since 0.4.0 - * @category Array - * @param {Array} [props=[]] The property identifiers. - * @param {Array} [values=[]] The property values. - * @returns {Object} Returns the new object. - * @example - * - * _.zipObject(['a', 'b'], [1, 2]); - * // => { 'a': 1, 'b': 2 } - */ - function zipObject(props, values) { - return baseZipObject(props || [], values || [], assignValue); - } - - /** - * This method is like `_.zipObject` except that it supports property paths. - * - * @static - * @memberOf _ - * @since 4.1.0 - * @category Array - * @param {Array} [props=[]] The property identifiers. - * @param {Array} [values=[]] The property values. - * @returns {Object} Returns the new object. - * @example - * - * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); - * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } } - */ - function zipObjectDeep(props, values) { - return baseZipObject(props || [], values || [], baseSet); - } - - /** - * This method is like `_.zip` except that it accepts `iteratee` to specify - * how grouped values should be combined. The iteratee is invoked with the - * elements of each group: (...group). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Array - * @param {...Array} [arrays] The arrays to process. - * @param {Function} [iteratee=_.identity] The function to combine - * grouped values. - * @returns {Array} Returns the new array of grouped elements. - * @example - * - * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { - * return a + b + c; - * }); - * // => [111, 222] - */ - var zipWith = baseRest(function(arrays) { - var length = arrays.length, - iteratee = length > 1 ? arrays[length - 1] : undefined; - - iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; - return unzipWith(arrays, iteratee); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` wrapper instance that wraps `value` with explicit method - * chain sequences enabled. The result of such sequences must be unwrapped - * with `_#value`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Seq - * @param {*} value The value to wrap. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'pebbles', 'age': 1 } - * ]; - * - * var youngest = _ - * .chain(users) - * .sortBy('age') - * .map(function(o) { - * return o.user + ' is ' + o.age; - * }) - * .head() - * .value(); - * // => 'pebbles is 1' - */ - function chain(value) { - var result = lodash(value); - result.__chain__ = true; - return result; - } - - /** - * This method invokes `interceptor` and returns `value`. The interceptor - * is invoked with one argument; (value). The purpose of this method is to - * "tap into" a method chain sequence in order to modify intermediate results. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns `value`. - * @example - * - * _([1, 2, 3]) - * .tap(function(array) { - * // Mutate input array. - * array.pop(); - * }) - * .reverse() - * .value(); - * // => [2, 1] - */ - function tap(value, interceptor) { - interceptor(value); - return value; - } - - /** - * This method is like `_.tap` except that it returns the result of `interceptor`. - * The purpose of this method is to "pass thru" values replacing intermediate - * results in a method chain sequence. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Seq - * @param {*} value The value to provide to `interceptor`. - * @param {Function} interceptor The function to invoke. - * @returns {*} Returns the result of `interceptor`. - * @example - * - * _(' abc ') - * .chain() - * .trim() - * .thru(function(value) { - * return [value]; - * }) - * .value(); - * // => ['abc'] - */ - function thru(value, interceptor) { - return interceptor(value); - } - - /** - * This method is the wrapper version of `_.at`. - * - * @name at - * @memberOf _ - * @since 1.0.0 - * @category Seq - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _(object).at(['a[0].b.c', 'a[1]']).value(); - * // => [3, 4] - */ - var wrapperAt = flatRest(function(paths) { - var length = paths.length, - start = length ? paths[0] : 0, - value = this.__wrapped__, - interceptor = function(object) { return baseAt(object, paths); }; - - if (length > 1 || this.__actions__.length || - !(value instanceof LazyWrapper) || !isIndex(start)) { - return this.thru(interceptor); - } - value = value.slice(start, +start + (length ? 1 : 0)); - value.__actions__.push({ - 'func': thru, - 'args': [interceptor], - 'thisArg': undefined - }); - return new LodashWrapper(value, this.__chain__).thru(function(array) { - if (length && !array.length) { - array.push(undefined); - } - return array; - }); - }); - - /** - * Creates a `lodash` wrapper instance with explicit method chain sequences enabled. - * - * @name chain - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 } - * ]; - * - * // A sequence without explicit chaining. - * _(users).head(); - * // => { 'user': 'barney', 'age': 36 } - * - * // A sequence with explicit chaining. - * _(users) - * .chain() - * .head() - * .pick('user') - * .value(); - * // => { 'user': 'barney' } - */ - function wrapperChain() { - return chain(this); - } - - /** - * Executes the chain sequence and returns the wrapped result. - * - * @name commit - * @memberOf _ - * @since 3.2.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2]; - * var wrapped = _(array).push(3); - * - * console.log(array); - * // => [1, 2] - * - * wrapped = wrapped.commit(); - * console.log(array); - * // => [1, 2, 3] - * - * wrapped.last(); - * // => 3 - * - * console.log(array); - * // => [1, 2, 3] - */ - function wrapperCommit() { - return new LodashWrapper(this.value(), this.__chain__); - } - - /** - * Gets the next value on a wrapped object following the - * [iterator protocol](https://mdn.io/iteration_protocols#iterator). - * - * @name next - * @memberOf _ - * @since 4.0.0 - * @category Seq - * @returns {Object} Returns the next iterator value. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped.next(); - * // => { 'done': false, 'value': 1 } - * - * wrapped.next(); - * // => { 'done': false, 'value': 2 } - * - * wrapped.next(); - * // => { 'done': true, 'value': undefined } - */ - function wrapperNext() { - if (this.__values__ === undefined) { - this.__values__ = toArray(this.value()); - } - var done = this.__index__ >= this.__values__.length, - value = done ? undefined : this.__values__[this.__index__++]; - - return { 'done': done, 'value': value }; - } - - /** - * Enables the wrapper to be iterable. - * - * @name Symbol.iterator - * @memberOf _ - * @since 4.0.0 - * @category Seq - * @returns {Object} Returns the wrapper object. - * @example - * - * var wrapped = _([1, 2]); - * - * wrapped[Symbol.iterator]() === wrapped; - * // => true - * - * Array.from(wrapped); - * // => [1, 2] - */ - function wrapperToIterator() { - return this; - } - - /** - * Creates a clone of the chain sequence planting `value` as the wrapped value. - * - * @name plant - * @memberOf _ - * @since 3.2.0 - * @category Seq - * @param {*} value The value to plant. - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var wrapped = _([1, 2]).map(square); - * var other = wrapped.plant([3, 4]); - * - * other.value(); - * // => [9, 16] - * - * wrapped.value(); - * // => [1, 4] - */ - function wrapperPlant(value) { - var result, - parent = this; - - while (parent instanceof baseLodash) { - var clone = wrapperClone(parent); - clone.__index__ = 0; - clone.__values__ = undefined; - if (result) { - previous.__wrapped__ = clone; - } else { - result = clone; - } - var previous = clone; - parent = parent.__wrapped__; - } - previous.__wrapped__ = value; - return result; - } - - /** - * This method is the wrapper version of `_.reverse`. - * - * **Note:** This method mutates the wrapped array. - * - * @name reverse - * @memberOf _ - * @since 0.1.0 - * @category Seq - * @returns {Object} Returns the new `lodash` wrapper instance. - * @example - * - * var array = [1, 2, 3]; - * - * _(array).reverse().value() - * // => [3, 2, 1] - * - * console.log(array); - * // => [3, 2, 1] - */ - function wrapperReverse() { - var value = this.__wrapped__; - if (value instanceof LazyWrapper) { - var wrapped = value; - if (this.__actions__.length) { - wrapped = new LazyWrapper(this); - } - wrapped = wrapped.reverse(); - wrapped.__actions__.push({ - 'func': thru, - 'args': [reverse], - 'thisArg': undefined - }); - return new LodashWrapper(wrapped, this.__chain__); - } - return this.thru(reverse); - } - - /** - * Executes the chain sequence to resolve the unwrapped value. - * - * @name value - * @memberOf _ - * @since 0.1.0 - * @alias toJSON, valueOf - * @category Seq - * @returns {*} Returns the resolved unwrapped value. - * @example - * - * _([1, 2, 3]).value(); - * // => [1, 2, 3] - */ - function wrapperValue() { - return baseWrapperValue(this.__wrapped__, this.__actions__); - } - - /*------------------------------------------------------------------------*/ - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The corresponding value of - * each key is the number of times the key was returned by `iteratee`. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.countBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': 1, '6': 2 } - * - * // The `_.property` iteratee shorthand. - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ - var countBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - ++result[key]; - } else { - baseAssignValue(result, key, 1); - } - }); - - /** - * Checks if `predicate` returns truthy for **all** elements of `collection`. - * Iteration is stopped once `predicate` returns falsey. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * **Note:** This method returns `true` for - * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because - * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of - * elements of empty collections. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if all elements pass the predicate check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes'], Boolean); - * // => false - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.every(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.every(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.every(users, 'active'); - * // => false - */ - function every(collection, predicate, guard) { - var func = isArray(collection) ? arrayEvery : baseEvery; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning an array of all elements - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * **Note:** Unlike `_.remove`, this method returns a new array. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.reject - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * _.filter(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.filter(users, { 'age': 36, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.filter(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.filter(users, 'active'); - * // => objects for ['barney'] - * - * // Combining several predicates using `_.overEvery` or `_.overSome`. - * _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]])); - * // => objects for ['fred', 'barney'] - */ - function filter(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Iterates over elements of `collection`, returning the first element - * `predicate` returns truthy for. The predicate is invoked with three - * arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=0] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false }, - * { 'user': 'pebbles', 'age': 1, 'active': true } - * ]; - * - * _.find(users, function(o) { return o.age < 40; }); - * // => object for 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.find(users, { 'age': 1, 'active': true }); - * // => object for 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.find(users, ['active', false]); - * // => object for 'fred' - * - * // The `_.property` iteratee shorthand. - * _.find(users, 'active'); - * // => object for 'barney' - */ - var find = createFind(findIndex); - - /** - * This method is like `_.find` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Collection - * @param {Array|Object} collection The collection to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param {number} [fromIndex=collection.length-1] The index to search from. - * @returns {*} Returns the matched element, else `undefined`. - * @example - * - * _.findLast([1, 2, 3, 4], function(n) { - * return n % 2 == 1; - * }); - * // => 3 - */ - var findLast = createFind(findLastIndex); - - /** - * Creates a flattened array of values by running each element in `collection` - * thru `iteratee` and flattening the mapped results. The iteratee is invoked - * with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [n, n]; - * } - * - * _.flatMap([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ - function flatMap(collection, iteratee) { - return baseFlatten(map(collection, iteratee), 1); - } - - /** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [[[n, n]]]; - * } - * - * _.flatMapDeep([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ - function flatMapDeep(collection, iteratee) { - return baseFlatten(map(collection, iteratee), INFINITY); - } - - /** - * This method is like `_.flatMap` except that it recursively flattens the - * mapped results up to `depth` times. - * - * @static - * @memberOf _ - * @since 4.7.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {number} [depth=1] The maximum recursion depth. - * @returns {Array} Returns the new flattened array. - * @example - * - * function duplicate(n) { - * return [[[n, n]]]; - * } - * - * _.flatMapDepth([1, 2], duplicate, 2); - * // => [[1, 1], [2, 2]] - */ - function flatMapDepth(collection, iteratee, depth) { - depth = depth === undefined ? 1 : toInteger(depth); - return baseFlatten(map(collection, iteratee), depth); - } - - /** - * Iterates over elements of `collection` and invokes `iteratee` for each element. - * The iteratee is invoked with three arguments: (value, index|key, collection). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * **Note:** As with other "Collections" methods, objects with a "length" - * property are iterated like arrays. To avoid this behavior use `_.forIn` - * or `_.forOwn` for object iteration. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @alias each - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEachRight - * @example - * - * _.forEach([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `1` then `2`. - * - * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ - function forEach(collection, iteratee) { - var func = isArray(collection) ? arrayEach : baseEach; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.forEach` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @alias eachRight - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array|Object} Returns `collection`. - * @see _.forEach - * @example - * - * _.forEachRight([1, 2], function(value) { - * console.log(value); - * }); - * // => Logs `2` then `1`. - */ - function forEachRight(collection, iteratee) { - var func = isArray(collection) ? arrayEachRight : baseEachRight; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The order of grouped values - * is determined by the order they occur in `collection`. The corresponding - * value of each key is an array of elements responsible for generating the - * key. The iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([6.1, 4.2, 6.3], Math.floor); - * // => { '4': [4.2], '6': [6.1, 6.3] } - * - * // The `_.property` iteratee shorthand. - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ - var groupBy = createAggregator(function(result, value, key) { - if (hasOwnProperty.call(result, key)) { - result[key].push(value); - } else { - baseAssignValue(result, key, [value]); - } - }); - - /** - * Checks if `value` is in `collection`. If `collection` is a string, it's - * checked for a substring of `value`, otherwise - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * is used for equality comparisons. If `fromIndex` is negative, it's used as - * the offset from the end of `collection`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. - * @returns {boolean} Returns `true` if `value` is found, else `false`. - * @example - * - * _.includes([1, 2, 3], 1); - * // => true - * - * _.includes([1, 2, 3], 1, 2); - * // => false - * - * _.includes({ 'a': 1, 'b': 2 }, 1); - * // => true - * - * _.includes('abcd', 'bc'); - * // => true - */ - function includes(collection, value, fromIndex, guard) { - collection = isArrayLike(collection) ? collection : values(collection); - fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0; - - var length = collection.length; - if (fromIndex < 0) { - fromIndex = nativeMax(length + fromIndex, 0); - } - return isString(collection) - ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1) - : (!!length && baseIndexOf(collection, value, fromIndex) > -1); - } - - /** - * Invokes the method at `path` of each element in `collection`, returning - * an array of the results of each invoked method. Any additional arguments - * are provided to each invoked method. If `path` is a function, it's invoked - * for, and `this` bound to, each element in `collection`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array|Function|string} path The path of the method to invoke or - * the function invoked per iteration. - * @param {...*} [args] The arguments to invoke each method with. - * @returns {Array} Returns the array of results. - * @example - * - * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invokeMap([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - var invokeMap = baseRest(function(collection, path, args) { - var index = -1, - isFunc = typeof path == 'function', - result = isArrayLike(collection) ? Array(collection.length) : []; - - baseEach(collection, function(value) { - result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); - }); - return result; - }); - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` thru `iteratee`. The corresponding value of - * each key is the last element responsible for generating the key. The - * iteratee is invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The iteratee to transform keys. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * var array = [ - * { 'dir': 'left', 'code': 97 }, - * { 'dir': 'right', 'code': 100 } - * ]; - * - * _.keyBy(array, function(o) { - * return String.fromCharCode(o.code); - * }); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - * - * _.keyBy(array, 'dir'); - * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } - */ - var keyBy = createAggregator(function(result, value, key) { - baseAssignValue(result, key, value); - }); - - /** - * Creates an array of values by running each element in `collection` thru - * `iteratee`. The iteratee is invoked with three arguments: - * (value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. - * - * The guarded methods are: - * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, - * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`, - * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`, - * `template`, `trim`, `trimEnd`, `trimStart`, and `words` - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - * @example - * - * function square(n) { - * return n * n; - * } - * - * _.map([4, 8], square); - * // => [16, 64] - * - * _.map({ 'a': 4, 'b': 8 }, square); - * // => [16, 64] (iteration order is not guaranteed) - * - * var users = [ - * { 'user': 'barney' }, - * { 'user': 'fred' } - * ]; - * - * // The `_.property` iteratee shorthand. - * _.map(users, 'user'); - * // => ['barney', 'fred'] - */ - function map(collection, iteratee) { - var func = isArray(collection) ? arrayMap : baseMap; - return func(collection, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.sortBy` except that it allows specifying the sort - * orders of the iteratees to sort by. If `orders` is unspecified, all values - * are sorted in ascending order. Otherwise, specify an order of "desc" for - * descending or "asc" for ascending sort order of corresponding values. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]] - * The iteratees to sort by. - * @param {string[]} [orders] The sort orders of `iteratees`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`. - * @returns {Array} Returns the new sorted array. - * @example - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 34 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'barney', 'age': 36 } - * ]; - * - * // Sort by `user` in ascending order and by `age` in descending order. - * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]] - */ - function orderBy(collection, iteratees, orders, guard) { - if (collection == null) { - return []; - } - if (!isArray(iteratees)) { - iteratees = iteratees == null ? [] : [iteratees]; - } - orders = guard ? undefined : orders; - if (!isArray(orders)) { - orders = orders == null ? [] : [orders]; - } - return baseOrderBy(collection, iteratees, orders); - } - - /** - * Creates an array of elements split into two groups, the first of which - * contains elements `predicate` returns truthy for, the second of which - * contains elements `predicate` returns falsey for. The predicate is - * invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the array of grouped elements. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true }, - * { 'user': 'pebbles', 'age': 1, 'active': false } - * ]; - * - * _.partition(users, function(o) { return o.active; }); - * // => objects for [['fred'], ['barney', 'pebbles']] - * - * // The `_.matches` iteratee shorthand. - * _.partition(users, { 'age': 1, 'active': false }); - * // => objects for [['pebbles'], ['barney', 'fred']] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.partition(users, ['active', false]); - * // => objects for [['barney', 'pebbles'], ['fred']] - * - * // The `_.property` iteratee shorthand. - * _.partition(users, 'active'); - * // => objects for [['fred'], ['barney', 'pebbles']] - */ - var partition = createAggregator(function(result, value, key) { - result[key ? 0 : 1].push(value); - }, function() { return [[], []]; }); - - /** - * Reduces `collection` to a value which is the accumulated result of running - * each element in `collection` thru `iteratee`, where each successive - * invocation is supplied the return value of the previous. If `accumulator` - * is not given, the first element of `collection` is used as the initial - * value. The iteratee is invoked with four arguments: - * (accumulator, value, index|key, collection). - * - * Many lodash methods are guarded to work as iteratees for methods like - * `_.reduce`, `_.reduceRight`, and `_.transform`. - * - * The guarded methods are: - * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`, - * and `sortBy` - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @returns {*} Returns the accumulated value. - * @see _.reduceRight - * @example - * - * _.reduce([1, 2], function(sum, n) { - * return sum + n; - * }, 0); - * // => 3 - * - * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * return result; - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed) - */ - function reduce(collection, iteratee, accumulator) { - var func = isArray(collection) ? arrayReduce : baseReduce, - initAccum = arguments.length < 3; - - return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach); - } - - /** - * This method is like `_.reduce` except that it iterates over elements of - * `collection` from right to left. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @returns {*} Returns the accumulated value. - * @see _.reduce - * @example - * - * var array = [[0, 1], [2, 3], [4, 5]]; - * - * _.reduceRight(array, function(flattened, other) { - * return flattened.concat(other); - * }, []); - * // => [4, 5, 2, 3, 0, 1] - */ - function reduceRight(collection, iteratee, accumulator) { - var func = isArray(collection) ? arrayReduceRight : baseReduce, - initAccum = arguments.length < 3; - - return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); - } - - /** - * The opposite of `_.filter`; this method returns the elements of `collection` - * that `predicate` does **not** return truthy for. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new filtered array. - * @see _.filter - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': false }, - * { 'user': 'fred', 'age': 40, 'active': true } - * ]; - * - * _.reject(users, function(o) { return !o.active; }); - * // => objects for ['fred'] - * - * // The `_.matches` iteratee shorthand. - * _.reject(users, { 'age': 40, 'active': true }); - * // => objects for ['barney'] - * - * // The `_.matchesProperty` iteratee shorthand. - * _.reject(users, ['active', false]); - * // => objects for ['fred'] - * - * // The `_.property` iteratee shorthand. - * _.reject(users, 'active'); - * // => objects for ['barney'] - */ - function reject(collection, predicate) { - var func = isArray(collection) ? arrayFilter : baseFilter; - return func(collection, negate(getIteratee(predicate, 3))); - } - - /** - * Gets a random element from `collection`. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @returns {*} Returns the random element. - * @example - * - * _.sample([1, 2, 3, 4]); - * // => 2 - */ - function sample(collection) { - var func = isArray(collection) ? arraySample : baseSample; - return func(collection); - } - - /** - * Gets `n` random elements at unique keys from `collection` up to the - * size of `collection`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Collection - * @param {Array|Object} collection The collection to sample. - * @param {number} [n=1] The number of elements to sample. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the random elements. - * @example - * - * _.sampleSize([1, 2, 3], 2); - * // => [3, 1] - * - * _.sampleSize([1, 2, 3], 4); - * // => [2, 3, 1] - */ - function sampleSize(collection, n, guard) { - if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { - n = 1; - } else { - n = toInteger(n); - } - var func = isArray(collection) ? arraySampleSize : baseSampleSize; - return func(collection, n); - } - - /** - * Creates an array of shuffled values, using a version of the - * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to shuffle. - * @returns {Array} Returns the new shuffled array. - * @example - * - * _.shuffle([1, 2, 3, 4]); - * // => [4, 1, 3, 2] - */ - function shuffle(collection) { - var func = isArray(collection) ? arrayShuffle : baseShuffle; - return func(collection); - } - - /** - * Gets the size of `collection` by returning its length for array-like - * values or the number of own enumerable string keyed properties for objects. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns the collection size. - * @example - * - * _.size([1, 2, 3]); - * // => 3 - * - * _.size({ 'a': 1, 'b': 2 }); - * // => 2 - * - * _.size('pebbles'); - * // => 7 - */ - function size(collection) { - if (collection == null) { - return 0; - } - if (isArrayLike(collection)) { - return isString(collection) ? stringSize(collection) : collection.length; - } - var tag = getTag(collection); - if (tag == mapTag || tag == setTag) { - return collection.size; - } - return baseKeys(collection).length; - } - - /** - * Checks if `predicate` returns truthy for **any** element of `collection`. - * Iteration is stopped once `predicate` returns truthy. The predicate is - * invoked with three arguments: (value, index|key, collection). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var users = [ - * { 'user': 'barney', 'active': true }, - * { 'user': 'fred', 'active': false } - * ]; - * - * // The `_.matches` iteratee shorthand. - * _.some(users, { 'user': 'barney', 'active': false }); - * // => false - * - * // The `_.matchesProperty` iteratee shorthand. - * _.some(users, ['active', false]); - * // => true - * - * // The `_.property` iteratee shorthand. - * _.some(users, 'active'); - * // => true - */ - function some(collection, predicate, guard) { - var func = isArray(collection) ? arraySome : baseSome; - if (guard && isIterateeCall(collection, predicate, guard)) { - predicate = undefined; - } - return func(collection, getIteratee(predicate, 3)); - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection thru each iteratee. This method - * performs a stable sort, that is, it preserves the original sort order of - * equal elements. The iteratees are invoked with one argument: (value). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Collection - * @param {Array|Object} collection The collection to iterate over. - * @param {...(Function|Function[])} [iteratees=[_.identity]] - * The iteratees to sort by. - * @returns {Array} Returns the new sorted array. - * @example - * - * var users = [ - * { 'user': 'fred', 'age': 48 }, - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 30 }, - * { 'user': 'barney', 'age': 34 } - * ]; - * - * _.sortBy(users, [function(o) { return o.user; }]); - * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]] - * - * _.sortBy(users, ['user', 'age']); - * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]] - */ - var sortBy = baseRest(function(collection, iteratees) { - if (collection == null) { - return []; - } - var length = iteratees.length; - if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { - iteratees = []; - } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { - iteratees = [iteratees[0]]; - } - return baseOrderBy(collection, baseFlatten(iteratees, 1), []); - }); - - /*------------------------------------------------------------------------*/ - - /** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * _.defer(function(stamp) { - * console.log(_.now() - stamp); - * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred invocation. - */ - var now = ctxNow || function() { - return root.Date.now(); - }; - - /*------------------------------------------------------------------------*/ - - /** - * The opposite of `_.before`; this method creates a function that invokes - * `func` once it's called `n` or more times. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {number} n The number of calls before `func` is invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var saves = ['profile', 'settings']; - * - * var done = _.after(saves.length, function() { - * console.log('done saving!'); - * }); - * - * _.forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); - * // => Logs 'done saving!' after the two async saves have completed. - */ - function after(n, func) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; - } - - /** - * Creates a function that invokes `func`, with up to `n` arguments, - * ignoring any additional arguments. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to cap arguments for. - * @param {number} [n=func.length] The arity cap. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new capped function. - * @example - * - * _.map(['6', '8', '10'], _.ary(parseInt, 1)); - * // => [6, 8, 10] - */ - function ary(func, n, guard) { - n = guard ? undefined : n; - n = (func && n == null) ? func.length : n; - return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n); - } - - /** - * Creates a function that invokes `func`, with the `this` binding and arguments - * of the created function, while it's called less than `n` times. Subsequent - * calls to the created function return the result of the last `func` invocation. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {number} n The number of calls at which `func` is no longer invoked. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * jQuery(element).on('click', _.before(5, addContactToList)); - * // => Allows adding up to 4 contacts to the list. - */ - function before(n, func) { - var result; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - n = toInteger(n); - return function() { - if (--n > 0) { - result = func.apply(this, arguments); - } - if (n <= 1) { - func = undefined; - } - return result; - }; - } - - /** - * Creates a function that invokes `func` with the `this` binding of `thisArg` - * and `partials` prepended to the arguments it receives. - * - * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for partially applied arguments. - * - * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" - * property of bound functions. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to bind. - * @param {*} thisArg The `this` binding of `func`. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * function greet(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * - * var object = { 'user': 'fred' }; - * - * var bound = _.bind(greet, object, 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * // Bound with placeholders. - * var bound = _.bind(greet, object, _, '!'); - * bound('hi'); - * // => 'hi fred!' - */ - var bind = baseRest(function(func, thisArg, partials) { - var bitmask = WRAP_BIND_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bind)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(func, bitmask, thisArg, partials, holders); - }); - - /** - * Creates a function that invokes the method at `object[key]` with `partials` - * prepended to the arguments it receives. - * - * This method differs from `_.bind` by allowing bound functions to reference - * methods that may be redefined or don't yet exist. See - * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) - * for more details. - * - * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Function - * @param {Object} object The object to invoke the method on. - * @param {string} key The key of the method. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'user': 'fred', - * 'greet': function(greeting, punctuation) { - * return greeting + ' ' + this.user + punctuation; - * } - * }; - * - * var bound = _.bindKey(object, 'greet', 'hi'); - * bound('!'); - * // => 'hi fred!' - * - * object.greet = function(greeting, punctuation) { - * return greeting + 'ya ' + this.user + punctuation; - * }; - * - * bound('!'); - * // => 'hiya fred!' - * - * // Bound with placeholders. - * var bound = _.bindKey(object, 'greet', _, '!'); - * bound('hi'); - * // => 'hiya fred!' - */ - var bindKey = baseRest(function(object, key, partials) { - var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; - if (partials.length) { - var holders = replaceHolders(partials, getHolder(bindKey)); - bitmask |= WRAP_PARTIAL_FLAG; - } - return createWrap(key, bitmask, object, partials, holders); - }); - - /** - * Creates a function that accepts arguments of `func` and either invokes - * `func` returning its result, if at least `arity` number of arguments have - * been provided, or returns a function that accepts the remaining `func` - * arguments, and so on. The arity of `func` may be specified if `func.length` - * is not sufficient. - * - * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, - * may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curry(abc); - * - * curried(1)(2)(3); - * // => [1, 2, 3] - * - * curried(1, 2)(3); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(1)(_, 3)(2); - * // => [1, 2, 3] - */ - function curry(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curry.placeholder; - return result; - } - - /** - * This method is like `_.curry` except that arguments are applied to `func` - * in the manner of `_.partialRight` instead of `_.partial`. - * - * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for provided arguments. - * - * **Note:** This method doesn't set the "length" property of curried functions. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the new curried function. - * @example - * - * var abc = function(a, b, c) { - * return [a, b, c]; - * }; - * - * var curried = _.curryRight(abc); - * - * curried(3)(2)(1); - * // => [1, 2, 3] - * - * curried(2, 3)(1); - * // => [1, 2, 3] - * - * curried(1, 2, 3); - * // => [1, 2, 3] - * - * // Curried with placeholders. - * curried(3)(1, _)(2); - * // => [1, 2, 3] - */ - function curryRight(func, arity, guard) { - arity = guard ? undefined : arity; - var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); - result.placeholder = curryRight.placeholder; - return result; - } - - /** - * Creates a debounced function that delays invoking `func` until after `wait` - * milliseconds have elapsed since the last time the debounced function was - * invoked. The debounced function comes with a `cancel` method to cancel - * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide `options` to indicate whether `func` should be invoked on the - * leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent - * calls to the debounced function return the result of the last `func` - * invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the debounced function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.debounce` and `_.throttle`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to debounce. - * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=false] - * Specify invoking on the leading edge of the timeout. - * @param {number} [options.maxWait] - * The maximum time `func` is allowed to be delayed before it's invoked. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // Avoid costly calculations while the window size is in flux. - * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); - * - * // Invoke `sendMail` when clicked, debouncing subsequent calls. - * jQuery(element).on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * })); - * - * // Ensure `batchLog` is invoked once after 1 second of debounced calls. - * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); - * jQuery(source).on('message', debounced); - * - * // Cancel the trailing debounced invocation. - * jQuery(window).on('popstate', debounced.cancel); - */ - function debounce(func, wait, options) { - var lastArgs, - lastThis, - maxWait, - result, - timerId, - lastCallTime, - lastInvokeTime = 0, - leading = false, - maxing = false, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - wait = toNumber(wait) || 0; - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - - function invokeFunc(time) { - var args = lastArgs, - thisArg = lastThis; - - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; - } - - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; - // Start the timer for the trailing edge. - timerId = setTimeout(timerExpired, wait); - // Invoke the leading edge. - return leading ? invokeFunc(time) : result; - } - - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime, - timeWaiting = wait - timeSinceLastCall; - - return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; - } - - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime; - - // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. - return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); - } - - function timerExpired() { - var time = now(); - if (shouldInvoke(time)) { - return trailingEdge(time); - } - // Restart the timer. - timerId = setTimeout(timerExpired, remainingWait(time)); - } - - function trailingEdge(time) { - timerId = undefined; - - // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - if (trailing && lastArgs) { - return invokeFunc(time); - } - lastArgs = lastThis = undefined; - return result; - } - - function cancel() { - if (timerId !== undefined) { - clearTimeout(timerId); - } - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; - } - - function flush() { - return timerId === undefined ? result : trailingEdge(now()); - } - - function debounced() { - var time = now(), - isInvoking = shouldInvoke(time); - - lastArgs = arguments; - lastThis = this; - lastCallTime = time; - - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } - if (maxing) { - // Handle invocations in a tight loop. - clearTimeout(timerId); - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); - } - } - if (timerId === undefined) { - timerId = setTimeout(timerExpired, wait); - } - return result; - } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; - } - - /** - * Defers invoking the `func` until the current call stack has cleared. Any - * additional arguments are provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to defer. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function(text) { - * console.log(text); - * }, 'deferred'); - * // => Logs 'deferred' after one millisecond. - */ - var defer = baseRest(function(func, args) { - return baseDelay(func, 1, args); - }); - - /** - * Invokes `func` after `wait` milliseconds. Any additional arguments are - * provided to `func` when it's invoked. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay invocation. - * @param {...*} [args] The arguments to invoke `func` with. - * @returns {number} Returns the timer id. - * @example - * - * _.delay(function(text) { - * console.log(text); - * }, 1000, 'later'); - * // => Logs 'later' after one second. - */ - var delay = baseRest(function(func, wait, args) { - return baseDelay(func, toNumber(wait) || 0, args); - }); - - /** - * Creates a function that invokes `func` with arguments reversed. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to flip arguments for. - * @returns {Function} Returns the new flipped function. - * @example - * - * var flipped = _.flip(function() { - * return _.toArray(arguments); - * }); - * - * flipped('a', 'b', 'c', 'd'); - * // => ['d', 'c', 'b', 'a'] - */ - function flip(func) { - return createWrap(func, WRAP_FLIP_FLAG); - } - - /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it determines the cache key for storing the result based on the - * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the map cache key. The `func` - * is invoked with the `this` binding of the memoized function. - * - * **Note:** The cache is exposed as the `cache` property on the memoized - * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) - * method interface of `clear`, `delete`, `get`, `has`, and `set`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] The function to resolve the cache key. - * @returns {Function} Returns the new memoized function. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * var other = { 'c': 3, 'd': 4 }; - * - * var values = _.memoize(_.values); - * values(object); - * // => [1, 2] - * - * values(other); - * // => [3, 4] - * - * object.a = 2; - * values(object); - * // => [1, 2] - * - * // Modify the result cache. - * values.cache.set(object, ['a', 'b']); - * values(object); - * // => ['a', 'b'] - * - * // Replace `_.memoize.Cache`. - * _.memoize.Cache = WeakMap; - */ - function memoize(func, resolver) { - if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { - throw new TypeError(FUNC_ERROR_TEXT); - } - var memoized = function() { - var args = arguments, - key = resolver ? resolver.apply(this, args) : args[0], - cache = memoized.cache; - - if (cache.has(key)) { - return cache.get(key); - } - var result = func.apply(this, args); - memoized.cache = cache.set(key, result) || cache; - return result; - }; - memoized.cache = new (memoize.Cache || MapCache); - return memoized; - } - - // Expose `MapCache`. - memoize.Cache = MapCache; - - /** - * Creates a function that negates the result of the predicate `func`. The - * `func` predicate is invoked with the `this` binding and arguments of the - * created function. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} predicate The predicate to negate. - * @returns {Function} Returns the new negated function. - * @example - * - * function isEven(n) { - * return n % 2 == 0; - * } - * - * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); - * // => [1, 3, 5] - */ - function negate(predicate) { - if (typeof predicate != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - return function() { - var args = arguments; - switch (args.length) { - case 0: return !predicate.call(this); - case 1: return !predicate.call(this, args[0]); - case 2: return !predicate.call(this, args[0], args[1]); - case 3: return !predicate.call(this, args[0], args[1], args[2]); - } - return !predicate.apply(this, args); - }; - } - - /** - * Creates a function that is restricted to invoking `func` once. Repeat calls - * to the function return the value of the first invocation. The `func` is - * invoked with the `this` binding and arguments of the created function. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // => `createApplication` is invoked once - */ - function once(func) { - return before(2, func); - } - - /** - * Creates a function that invokes `func` with its arguments transformed. - * - * @static - * @since 4.0.0 - * @memberOf _ - * @category Function - * @param {Function} func The function to wrap. - * @param {...(Function|Function[])} [transforms=[_.identity]] - * The argument transforms. - * @returns {Function} Returns the new function. - * @example - * - * function doubled(n) { - * return n * 2; - * } - * - * function square(n) { - * return n * n; - * } - * - * var func = _.overArgs(function(x, y) { - * return [x, y]; - * }, [square, doubled]); - * - * func(9, 3); - * // => [81, 6] - * - * func(10, 5); - * // => [100, 10] - */ - var overArgs = castRest(function(func, transforms) { - transforms = (transforms.length == 1 && isArray(transforms[0])) - ? arrayMap(transforms[0], baseUnary(getIteratee())) - : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); - - var funcsLength = transforms.length; - return baseRest(function(args) { - var index = -1, - length = nativeMin(args.length, funcsLength); - - while (++index < length) { - args[index] = transforms[index].call(this, args[index]); - } - return apply(func, this, args); - }); - }); - - /** - * Creates a function that invokes `func` with `partials` prepended to the - * arguments it receives. This method is like `_.bind` except it does **not** - * alter the `this` binding. - * - * The `_.partial.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @since 0.2.0 - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * function greet(greeting, name) { - * return greeting + ' ' + name; - * } - * - * var sayHelloTo = _.partial(greet, 'hello'); - * sayHelloTo('fred'); - * // => 'hello fred' - * - * // Partially applied with placeholders. - * var greetFred = _.partial(greet, _, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - */ - var partial = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partial)); - return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders); - }); - - /** - * This method is like `_.partial` except that partially applied arguments - * are appended to the arguments it receives. - * - * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic - * builds, may be used as a placeholder for partially applied arguments. - * - * **Note:** This method doesn't set the "length" property of partially - * applied functions. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Function - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [partials] The arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * function greet(greeting, name) { - * return greeting + ' ' + name; - * } - * - * var greetFred = _.partialRight(greet, 'fred'); - * greetFred('hi'); - * // => 'hi fred' - * - * // Partially applied with placeholders. - * var sayHelloTo = _.partialRight(greet, 'hello', _); - * sayHelloTo('fred'); - * // => 'hello fred' - */ - var partialRight = baseRest(function(func, partials) { - var holders = replaceHolders(partials, getHolder(partialRight)); - return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders); - }); - - /** - * Creates a function that invokes `func` with arguments arranged according - * to the specified `indexes` where the argument value at the first index is - * provided as the first argument, the argument value at the second index is - * provided as the second argument, and so on. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Function - * @param {Function} func The function to rearrange arguments for. - * @param {...(number|number[])} indexes The arranged argument indexes. - * @returns {Function} Returns the new function. - * @example - * - * var rearged = _.rearg(function(a, b, c) { - * return [a, b, c]; - * }, [2, 0, 1]); - * - * rearged('b', 'c', 'a') - * // => ['a', 'b', 'c'] - */ - var rearg = flatRest(function(func, indexes) { - return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes); - }); - - /** - * Creates a function that invokes `func` with the `this` binding of the - * created function and arguments from `start` and beyond provided as - * an array. - * - * **Note:** This method is based on the - * [rest parameter](https://mdn.io/rest_parameters). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.rest(function(what, names) { - * return what + ' ' + _.initial(names).join(', ') + - * (_.size(names) > 1 ? ', & ' : '') + _.last(names); - * }); - * - * say('hello', 'fred', 'barney', 'pebbles'); - * // => 'hello fred, barney, & pebbles' - */ - function rest(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = start === undefined ? start : toInteger(start); - return baseRest(func, start); - } - - /** - * Creates a function that invokes `func` with the `this` binding of the - * create function and an array of arguments much like - * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply). - * - * **Note:** This method is based on the - * [spread operator](https://mdn.io/spread_operator). - * - * @static - * @memberOf _ - * @since 3.2.0 - * @category Function - * @param {Function} func The function to spread arguments over. - * @param {number} [start=0] The start position of the spread. - * @returns {Function} Returns the new function. - * @example - * - * var say = _.spread(function(who, what) { - * return who + ' says ' + what; - * }); - * - * say(['fred', 'hello']); - * // => 'fred says hello' - * - * var numbers = Promise.all([ - * Promise.resolve(40), - * Promise.resolve(36) - * ]); - * - * numbers.then(_.spread(function(x, y) { - * return x + y; - * })); - * // => a Promise of 76 - */ - function spread(func, start) { - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - start = start == null ? 0 : nativeMax(toInteger(start), 0); - return baseRest(function(args) { - var array = args[start], - otherArgs = castSlice(args, 0, start); - - if (array) { - arrayPush(otherArgs, array); - } - return apply(func, this, otherArgs); - }); - } - - /** - * Creates a throttled function that only invokes `func` at most once per - * every `wait` milliseconds. The throttled function comes with a `cancel` - * method to cancel delayed `func` invocations and a `flush` method to - * immediately invoke them. Provide `options` to indicate whether `func` - * should be invoked on the leading and/or trailing edge of the `wait` - * timeout. The `func` is invoked with the last arguments provided to the - * throttled function. Subsequent calls to the throttled function return the - * result of the last `func` invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the throttled function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.throttle` and `_.debounce`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to throttle. - * @param {number} [wait=0] The number of milliseconds to throttle invocations to. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=true] - * Specify invoking on the leading edge of the timeout. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new throttled function. - * @example - * - * // Avoid excessively updating the position while scrolling. - * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); - * - * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. - * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); - * jQuery(element).on('click', throttled); - * - * // Cancel the trailing throttled invocation. - * jQuery(window).on('popstate', throttled.cancel); - */ - function throttle(func, wait, options) { - var leading = true, - trailing = true; - - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - if (isObject(options)) { - leading = 'leading' in options ? !!options.leading : leading; - trailing = 'trailing' in options ? !!options.trailing : trailing; - } - return debounce(func, wait, { - 'leading': leading, - 'maxWait': wait, - 'trailing': trailing - }); - } - - /** - * Creates a function that accepts up to one argument, ignoring any - * additional arguments. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Function - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - * @example - * - * _.map(['6', '8', '10'], _.unary(parseInt)); - * // => [6, 8, 10] - */ - function unary(func) { - return ary(func, 1); - } - - /** - * Creates a function that provides `value` to `wrapper` as its first - * argument. Any additional arguments provided to the function are appended - * to those provided to the `wrapper`. The wrapper is invoked with the `this` - * binding of the created function. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {*} value The value to wrap. - * @param {Function} [wrapper=identity] The wrapper function. - * @returns {Function} Returns the new function. - * @example - * - * var p = _.wrap(_.escape, function(func, text) { - * return '

' + func(text) + '

'; - * }); - * - * p('fred, barney, & pebbles'); - * // => '

fred, barney, & pebbles

' - */ - function wrap(value, wrapper) { - return partial(castFunction(wrapper), value); - } - - /*------------------------------------------------------------------------*/ - - /** - * Casts `value` as an array if it's not one. - * - * @static - * @memberOf _ - * @since 4.4.0 - * @category Lang - * @param {*} value The value to inspect. - * @returns {Array} Returns the cast array. - * @example - * - * _.castArray(1); - * // => [1] - * - * _.castArray({ 'a': 1 }); - * // => [{ 'a': 1 }] - * - * _.castArray('abc'); - * // => ['abc'] - * - * _.castArray(null); - * // => [null] - * - * _.castArray(undefined); - * // => [undefined] - * - * _.castArray(); - * // => [] - * - * var array = [1, 2, 3]; - * console.log(_.castArray(array) === array); - * // => true - */ - function castArray() { - if (!arguments.length) { - return []; - } - var value = arguments[0]; - return isArray(value) ? value : [value]; - } - - /** - * Creates a shallow clone of `value`. - * - * **Note:** This method is loosely based on the - * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm) - * and supports cloning arrays, array buffers, booleans, date objects, maps, - * numbers, `Object` objects, regexes, sets, strings, symbols, and typed - * arrays. The own enumerable properties of `arguments` objects are cloned - * as plain objects. An empty object is returned for uncloneable values such - * as error objects, functions, DOM nodes, and WeakMaps. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to clone. - * @returns {*} Returns the cloned value. - * @see _.cloneDeep - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var shallow = _.clone(objects); - * console.log(shallow[0] === objects[0]); - * // => true - */ - function clone(value) { - return baseClone(value, CLONE_SYMBOLS_FLAG); - } - - /** - * This method is like `_.clone` except that it accepts `customizer` which - * is invoked to produce the cloned value. If `customizer` returns `undefined`, - * cloning is handled by the method instead. The `customizer` is invoked with - * up to four arguments; (value [, index|key, object, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the cloned value. - * @see _.cloneDeepWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(false); - * } - * } - * - * var el = _.cloneWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 0 - */ - function cloneWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); - } - - /** - * This method is like `_.clone` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @returns {*} Returns the deep cloned value. - * @see _.clone - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var deep = _.cloneDeep(objects); - * console.log(deep[0] === objects[0]); - * // => false - */ - function cloneDeep(value) { - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); - } - - /** - * This method is like `_.cloneWith` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @param {Function} [customizer] The function to customize cloning. - * @returns {*} Returns the deep cloned value. - * @see _.cloneWith - * @example - * - * function customizer(value) { - * if (_.isElement(value)) { - * return value.cloneNode(true); - * } - * } - * - * var el = _.cloneDeepWith(document.body, customizer); - * - * console.log(el === document.body); - * // => false - * console.log(el.nodeName); - * // => 'BODY' - * console.log(el.childNodes.length); - * // => 20 - */ - function cloneDeepWith(value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); - } - - /** - * Checks if `object` conforms to `source` by invoking the predicate - * properties of `source` with the corresponding property values of `object`. - * - * **Note:** This method is equivalent to `_.conforms` when `source` is - * partially applied. - * - * @static - * @memberOf _ - * @since 4.14.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property predicates to conform to. - * @returns {boolean} Returns `true` if `object` conforms, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.conformsTo(object, { 'b': function(n) { return n > 1; } }); - * // => true - * - * _.conformsTo(object, { 'b': function(n) { return n > 2; } }); - * // => false - */ - function conformsTo(object, source) { - return source == null || baseConformsTo(object, source, keys(source)); - } - - /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - /** - * Checks if `value` is greater than `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than `other`, - * else `false`. - * @see _.lt - * @example - * - * _.gt(3, 1); - * // => true - * - * _.gt(3, 3); - * // => false - * - * _.gt(1, 3); - * // => false - */ - var gt = createRelationalOperation(baseGt); - - /** - * Checks if `value` is greater than or equal to `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is greater than or equal to - * `other`, else `false`. - * @see _.lte - * @example - * - * _.gte(3, 1); - * // => true - * - * _.gte(3, 3); - * // => true - * - * _.gte(1, 3); - * // => false - */ - var gte = createRelationalOperation(function(value, other) { - return value >= other; - }); - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); - }; - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - /** - * Checks if `value` is classified as an `ArrayBuffer` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`. - * @example - * - * _.isArrayBuffer(new ArrayBuffer(2)); - * // => true - * - * _.isArrayBuffer(new Array(2)); - * // => false - */ - var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); - } - - /** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ - function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); - } - - /** - * Checks if `value` is classified as a boolean primitive or object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a boolean, else `false`. - * @example - * - * _.isBoolean(false); - * // => true - * - * _.isBoolean(null); - * // => false - */ - function isBoolean(value) { - return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); - } - - /** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ - var isBuffer = nativeIsBuffer || stubFalse; - - /** - * Checks if `value` is classified as a `Date` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a date object, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - * - * _.isDate('Mon April 23 2012'); - * // => false - */ - var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; - - /** - * Checks if `value` is likely a DOM element. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - * - * _.isElement(''); - * // => false - */ - function isElement(value) { - return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); - } - - /** - * Checks if `value` is an empty object, collection, map, or set. - * - * Objects are considered empty if they have no own enumerable string keyed - * properties. - * - * Array-like values such as `arguments` objects, arrays, buffers, strings, or - * jQuery-like collections are considered empty if they have a `length` of `0`. - * Similarly, maps and sets are considered empty if they have a `size` of `0`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is empty, else `false`. - * @example - * - * _.isEmpty(null); - * // => true - * - * _.isEmpty(true); - * // => true - * - * _.isEmpty(1); - * // => true - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({ 'a': 1 }); - * // => false - */ - function isEmpty(value) { - if (value == null) { - return true; - } - if (isArrayLike(value) && - (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { - return !value.length; - } - var tag = getTag(value); - if (tag == mapTag || tag == setTag) { - return !value.size; - } - if (isPrototype(value)) { - return !baseKeys(value).length; - } - for (var key in value) { - if (hasOwnProperty.call(value, key)) { - return false; - } - } - return true; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent. - * - * **Note:** This method supports comparing arrays, array buffers, booleans, - * date objects, error objects, maps, numbers, `Object` objects, regexes, - * sets, strings, symbols, and typed arrays. `Object` objects are compared - * by their own, not inherited, enumerable properties. Functions and DOM - * nodes are compared by strict equality, i.e. `===`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.isEqual(object, other); - * // => true - * - * object === other; - * // => false - */ - function isEqual(value, other) { - return baseIsEqual(value, other); - } - - /** - * This method is like `_.isEqual` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with up to - * six arguments: (objValue, othValue [, index|key, object, other, stack]). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, othValue) { - * if (isGreeting(objValue) && isGreeting(othValue)) { - * return true; - * } - * } - * - * var array = ['hello', 'goodbye']; - * var other = ['hi', 'goodbye']; - * - * _.isEqualWith(array, other, customizer); - * // => true - */ - function isEqualWith(value, other, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - var result = customizer ? customizer(value, other) : undefined; - return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result; - } - - /** - * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, - * `SyntaxError`, `TypeError`, or `URIError` object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an error object, else `false`. - * @example - * - * _.isError(new Error); - * // => true - * - * _.isError(Error); - * // => false - */ - function isError(value) { - if (!isObjectLike(value)) { - return false; - } - var tag = baseGetTag(value); - return tag == errorTag || tag == domExcTag || - (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value)); - } - - /** - * Checks if `value` is a finite primitive number. - * - * **Note:** This method is based on - * [`Number.isFinite`](https://mdn.io/Number/isFinite). - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. - * @example - * - * _.isFinite(3); - * // => true - * - * _.isFinite(Number.MIN_VALUE); - * // => true - * - * _.isFinite(Infinity); - * // => false - * - * _.isFinite('3'); - * // => false - */ - function isFinite(value) { - return typeof value == 'number' && nativeIsFinite(value); - } - - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; - } - - /** - * Checks if `value` is an integer. - * - * **Note:** This method is based on - * [`Number.isInteger`](https://mdn.io/Number/isInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an integer, else `false`. - * @example - * - * _.isInteger(3); - * // => true - * - * _.isInteger(Number.MIN_VALUE); - * // => false - * - * _.isInteger(Infinity); - * // => false - * - * _.isInteger('3'); - * // => false - */ - function isInteger(value) { - return typeof value == 'number' && value == toInteger(value); - } - - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return value != null && typeof value == 'object'; - } - - /** - * Checks if `value` is classified as a `Map` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a map, else `false`. - * @example - * - * _.isMap(new Map); - * // => true - * - * _.isMap(new WeakMap); - * // => false - */ - var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; - - /** - * Performs a partial deep comparison between `object` and `source` to - * determine if `object` contains equivalent property values. - * - * **Note:** This method is equivalent to `_.matches` when `source` is - * partially applied. - * - * Partial comparisons will match empty array and empty object `source` - * values against any array or object value, respectively. See `_.isEqual` - * for a list of supported value comparisons. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * - * _.isMatch(object, { 'b': 2 }); - * // => true - * - * _.isMatch(object, { 'b': 1 }); - * // => false - */ - function isMatch(object, source) { - return object === source || baseIsMatch(object, source, getMatchData(source)); - } - - /** - * This method is like `_.isMatch` except that it accepts `customizer` which - * is invoked to compare values. If `customizer` returns `undefined`, comparisons - * are handled by the method instead. The `customizer` is invoked with five - * arguments: (objValue, srcValue, index|key, object, source). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - * @example - * - * function isGreeting(value) { - * return /^h(?:i|ello)$/.test(value); - * } - * - * function customizer(objValue, srcValue) { - * if (isGreeting(objValue) && isGreeting(srcValue)) { - * return true; - * } - * } - * - * var object = { 'greeting': 'hello' }; - * var source = { 'greeting': 'hi' }; - * - * _.isMatchWith(object, source, customizer); - * // => true - */ - function isMatchWith(object, source, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return baseIsMatch(object, source, getMatchData(source), customizer); - } - - /** - * Checks if `value` is `NaN`. - * - * **Note:** This method is based on - * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as - * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for - * `undefined` and other non-number values. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // An `NaN` primitive is the only value that is not equal to itself. - // Perform the `toStringTag` check first to avoid errors with some - // ActiveX objects in IE. - return isNumber(value) && value != +value; - } - - /** - * Checks if `value` is a pristine native function. - * - * **Note:** This method can't reliably detect native functions in the presence - * of the core-js package because core-js circumvents this kind of detection. - * Despite multiple requests, the core-js maintainer has made it clear: any - * attempt to fix the detection will be obstructed. As a result, we're left - * with little choice but to throw an error. Unfortunately, this also affects - * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill), - * which rely on core-js. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - * @example - * - * _.isNative(Array.prototype.push); - * // => true - * - * _.isNative(_); - * // => false - */ - function isNative(value) { - if (isMaskable(value)) { - throw new Error(CORE_ERROR_TEXT); - } - return baseIsNative(value); - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(void 0); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is `null` or `undefined`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is nullish, else `false`. - * @example - * - * _.isNil(null); - * // => true - * - * _.isNil(void 0); - * // => true - * - * _.isNil(NaN); - * // => false - */ - function isNil(value) { - return value == null; - } - - /** - * Checks if `value` is classified as a `Number` primitive or object. - * - * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are - * classified as numbers, use the `_.isFinite` method. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a number, else `false`. - * @example - * - * _.isNumber(3); - * // => true - * - * _.isNumber(Number.MIN_VALUE); - * // => true - * - * _.isNumber(Infinity); - * // => true - * - * _.isNumber('3'); - * // => false - */ - function isNumber(value) { - return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); - } - - /** - * Checks if `value` is a plain object, that is, an object created by the - * `Object` constructor or one with a `[[Prototype]]` of `null`. - * - * @static - * @memberOf _ - * @since 0.8.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * _.isPlainObject(new Foo); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - * - * _.isPlainObject(Object.create(null)); - * // => true - */ - function isPlainObject(value) { - if (!isObjectLike(value) || baseGetTag(value) != objectTag) { - return false; - } - var proto = getPrototype(value); - if (proto === null) { - return true; - } - var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; - return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; - } - - /** - * Checks if `value` is classified as a `RegExp` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a regexp, else `false`. - * @example - * - * _.isRegExp(/abc/); - * // => true - * - * _.isRegExp('/abc/'); - * // => false - */ - var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; - - /** - * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 - * double precision number which isn't the result of a rounded unsafe integer. - * - * **Note:** This method is based on - * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. - * @example - * - * _.isSafeInteger(3); - * // => true - * - * _.isSafeInteger(Number.MIN_VALUE); - * // => false - * - * _.isSafeInteger(Infinity); - * // => false - * - * _.isSafeInteger('3'); - * // => false - */ - function isSafeInteger(value) { - return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is classified as a `Set` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a set, else `false`. - * @example - * - * _.isSet(new Set); - * // => true - * - * _.isSet(new WeakSet); - * // => false - */ - var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; - - /** - * Checks if `value` is classified as a `String` primitive or object. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a string, else `false`. - * @example - * - * _.isString('abc'); - * // => true - * - * _.isString(1); - * // => false - */ - function isString(value) { - return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); - } - - /** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ - function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); - } - - /** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ - var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; - - /** - * Checks if `value` is `undefined`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - * - * _.isUndefined(null); - * // => false - */ - function isUndefined(value) { - return value === undefined; - } - - /** - * Checks if `value` is classified as a `WeakMap` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak map, else `false`. - * @example - * - * _.isWeakMap(new WeakMap); - * // => true - * - * _.isWeakMap(new Map); - * // => false - */ - function isWeakMap(value) { - return isObjectLike(value) && getTag(value) == weakMapTag; - } - - /** - * Checks if `value` is classified as a `WeakSet` object. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a weak set, else `false`. - * @example - * - * _.isWeakSet(new WeakSet); - * // => true - * - * _.isWeakSet(new Set); - * // => false - */ - function isWeakSet(value) { - return isObjectLike(value) && baseGetTag(value) == weakSetTag; - } - - /** - * Checks if `value` is less than `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than `other`, - * else `false`. - * @see _.gt - * @example - * - * _.lt(1, 3); - * // => true - * - * _.lt(3, 3); - * // => false - * - * _.lt(3, 1); - * // => false - */ - var lt = createRelationalOperation(baseLt); - - /** - * Checks if `value` is less than or equal to `other`. - * - * @static - * @memberOf _ - * @since 3.9.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if `value` is less than or equal to - * `other`, else `false`. - * @see _.gte - * @example - * - * _.lte(1, 3); - * // => true - * - * _.lte(3, 3); - * // => true - * - * _.lte(3, 1); - * // => false - */ - var lte = createRelationalOperation(function(value, other) { - return value <= other; - }); - - /** - * Converts `value` to an array. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Lang - * @param {*} value The value to convert. - * @returns {Array} Returns the converted array. - * @example - * - * _.toArray({ 'a': 1, 'b': 2 }); - * // => [1, 2] - * - * _.toArray('abc'); - * // => ['a', 'b', 'c'] - * - * _.toArray(1); - * // => [] - * - * _.toArray(null); - * // => [] - */ - function toArray(value) { - if (!value) { - return []; - } - if (isArrayLike(value)) { - return isString(value) ? stringToArray(value) : copyArray(value); - } - if (symIterator && value[symIterator]) { - return iteratorToArray(value[symIterator]()); - } - var tag = getTag(value), - func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values); - - return func(value); - } - - /** - * Converts `value` to a finite number. - * - * @static - * @memberOf _ - * @since 4.12.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted number. - * @example - * - * _.toFinite(3.2); - * // => 3.2 - * - * _.toFinite(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toFinite(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toFinite('3.2'); - * // => 3.2 - */ - function toFinite(value) { - if (!value) { - return value === 0 ? value : 0; - } - value = toNumber(value); - if (value === INFINITY || value === -INFINITY) { - var sign = (value < 0 ? -1 : 1); - return sign * MAX_INTEGER; - } - return value === value ? value : 0; - } - - /** - * Converts `value` to an integer. - * - * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toInteger(3.2); - * // => 3 - * - * _.toInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toInteger(Infinity); - * // => 1.7976931348623157e+308 - * - * _.toInteger('3.2'); - * // => 3 - */ - function toInteger(value) { - var result = toFinite(value), - remainder = result % 1; - - return result === result ? (remainder ? result - remainder : result) : 0; - } - - /** - * Converts `value` to an integer suitable for use as the length of an - * array-like object. - * - * **Note:** This method is based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toLength(3.2); - * // => 3 - * - * _.toLength(Number.MIN_VALUE); - * // => 0 - * - * _.toLength(Infinity); - * // => 4294967295 - * - * _.toLength('3.2'); - * // => 3 - */ - function toLength(value) { - return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; - } - - /** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */ - function toNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - if (isObject(value)) { - var other = typeof value.valueOf == 'function' ? value.valueOf() : value; - value = isObject(other) ? (other + '') : other; - } - if (typeof value != 'string') { - return value === 0 ? value : +value; - } - value = baseTrim(value); - var isBinary = reIsBinary.test(value); - return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); - } - - /** - * Converts `value` to a plain object flattening inherited enumerable string - * keyed properties of `value` to own properties of the plain object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {Object} Returns the converted plain object. - * @example - * - * function Foo() { - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.assign({ 'a': 1 }, new Foo); - * // => { 'a': 1, 'b': 2 } - * - * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); - * // => { 'a': 1, 'b': 2, 'c': 3 } - */ - function toPlainObject(value) { - return copyObject(value, keysIn(value)); - } - - /** - * Converts `value` to a safe integer. A safe integer can be compared and - * represented correctly. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {number} Returns the converted integer. - * @example - * - * _.toSafeInteger(3.2); - * // => 3 - * - * _.toSafeInteger(Number.MIN_VALUE); - * // => 0 - * - * _.toSafeInteger(Infinity); - * // => 9007199254740991 - * - * _.toSafeInteger('3.2'); - * // => 3 - */ - function toSafeInteger(value) { - return value - ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) - : (value === 0 ? value : 0); - } - - /** - * Converts `value` to a string. An empty string is returned for `null` - * and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ - function toString(value) { - return value == null ? '' : baseToString(value); - } - - /*------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable string keyed properties of source objects to the - * destination object. Source objects are applied from left to right. - * Subsequent sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object` and is loosely based on - * [`Object.assign`](https://mdn.io/Object/assign). - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assignIn - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assign({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'c': 3 } - */ - var assign = createAssigner(function(object, source) { - if (isPrototype(source) || isArrayLike(source)) { - copyObject(source, keys(source), object); - return; - } - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - assignValue(object, key, source[key]); - } - } - }); - - /** - * This method is like `_.assign` except that it iterates over own and - * inherited source properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extend - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assign - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assignIn({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } - */ - var assignIn = createAssigner(function(object, source) { - copyObject(source, keysIn(source), object); - }); - - /** - * This method is like `_.assignIn` except that it accepts `customizer` - * which is invoked to produce the assigned values. If `customizer` returns - * `undefined`, assignment is handled by the method instead. The `customizer` - * is invoked with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias extendWith - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @see _.assignWith - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignInWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keysIn(source), object, customizer); - }); - - /** - * This method is like `_.assign` except that it accepts `customizer` - * which is invoked to produce the assigned values. If `customizer` returns - * `undefined`, assignment is handled by the method instead. The `customizer` - * is invoked with five arguments: (objValue, srcValue, key, object, source). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @see _.assignInWith - * @example - * - * function customizer(objValue, srcValue) { - * return _.isUndefined(objValue) ? srcValue : objValue; - * } - * - * var defaults = _.partialRight(_.assignWith, customizer); - * - * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var assignWith = createAssigner(function(object, source, srcIndex, customizer) { - copyObject(source, keys(source), object, customizer); - }); - - /** - * Creates an array of values corresponding to `paths` of `object`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Array} Returns the picked values. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; - * - * _.at(object, ['a[0].b.c', 'a[1]']); - * // => [3, 4] - */ - var at = flatRest(baseAt); - - /** - * Creates an object that inherits from the `prototype` object. If a - * `properties` object is given, its own enumerable string keyed properties - * are assigned to the created object. - * - * @static - * @memberOf _ - * @since 2.3.0 - * @category Object - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { - * 'constructor': Circle - * }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ - function create(prototype, properties) { - var result = baseCreate(prototype); - return properties == null ? result : baseAssign(result, properties); - } - - /** - * Assigns own and inherited enumerable string keyed properties of source - * objects to the destination object for all destination properties that - * resolve to `undefined`. Source objects are applied from left to right. - * Once a property is set, additional values of the same property are ignored. - * - * **Note:** This method mutates `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaultsDeep - * @example - * - * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); - * // => { 'a': 1, 'b': 2 } - */ - var defaults = baseRest(function(object, sources) { - object = Object(object); - - var index = -1; - var length = sources.length; - var guard = length > 2 ? sources[2] : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - length = 1; - } - - while (++index < length) { - var source = sources[index]; - var props = keysIn(source); - var propsIndex = -1; - var propsLength = props.length; - - while (++propsIndex < propsLength) { - var key = props[propsIndex]; - var value = object[key]; - - if (value === undefined || - (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) { - object[key] = source[key]; - } - } - } - - return object; - }); - - /** - * This method is like `_.defaults` except that it recursively assigns - * default properties. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.defaults - * @example - * - * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); - * // => { 'a': { 'b': 2, 'c': 3 } } - */ - var defaultsDeep = baseRest(function(args) { - args.push(undefined, customDefaultsMerge); - return apply(mergeWith, undefined, args); - }); - - /** - * This method is like `_.find` except that it returns the key of the first - * element `predicate` returns truthy for instead of the element itself. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findKey(users, function(o) { return o.age < 40; }); - * // => 'barney' (iteration order is not guaranteed) - * - * // The `_.matches` iteratee shorthand. - * _.findKey(users, { 'age': 1, 'active': true }); - * // => 'pebbles' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findKey(users, 'active'); - * // => 'barney' - */ - function findKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); - } - - /** - * This method is like `_.findKey` except that it iterates over elements of - * a collection in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @param {Function} [predicate=_.identity] The function invoked per iteration. - * @returns {string|undefined} Returns the key of the matched element, - * else `undefined`. - * @example - * - * var users = { - * 'barney': { 'age': 36, 'active': true }, - * 'fred': { 'age': 40, 'active': false }, - * 'pebbles': { 'age': 1, 'active': true } - * }; - * - * _.findLastKey(users, function(o) { return o.age < 40; }); - * // => returns 'pebbles' assuming `_.findKey` returns 'barney' - * - * // The `_.matches` iteratee shorthand. - * _.findLastKey(users, { 'age': 36, 'active': true }); - * // => 'barney' - * - * // The `_.matchesProperty` iteratee shorthand. - * _.findLastKey(users, ['active', false]); - * // => 'fred' - * - * // The `_.property` iteratee shorthand. - * _.findLastKey(users, 'active'); - * // => 'pebbles' - */ - function findLastKey(object, predicate) { - return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); - } - - /** - * Iterates over own and inherited enumerable string keyed properties of an - * object and invokes `iteratee` for each property. The iteratee is invoked - * with three arguments: (value, key, object). Iteratee functions may exit - * iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forInRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forIn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed). - */ - function forIn(object, iteratee) { - return object == null - ? object - : baseFor(object, getIteratee(iteratee, 3), keysIn); - } - - /** - * This method is like `_.forIn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forIn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forInRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'. - */ - function forInRight(object, iteratee) { - return object == null - ? object - : baseForRight(object, getIteratee(iteratee, 3), keysIn); - } - - /** - * Iterates over own enumerable string keyed properties of an object and - * invokes `iteratee` for each property. The iteratee is invoked with three - * arguments: (value, key, object). Iteratee functions may exit iteration - * early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 0.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwnRight - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwn(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'a' then 'b' (iteration order is not guaranteed). - */ - function forOwn(object, iteratee) { - return object && baseForOwn(object, getIteratee(iteratee, 3)); - } - - /** - * This method is like `_.forOwn` except that it iterates over properties of - * `object` in the opposite order. - * - * @static - * @memberOf _ - * @since 2.0.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns `object`. - * @see _.forOwn - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.forOwnRight(new Foo, function(value, key) { - * console.log(key); - * }); - * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'. - */ - function forOwnRight(object, iteratee) { - return object && baseForOwnRight(object, getIteratee(iteratee, 3)); - } - - /** - * Creates an array of function property names from own enumerable properties - * of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functionsIn - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functions(new Foo); - * // => ['a', 'b'] - */ - function functions(object) { - return object == null ? [] : baseFunctions(object, keys(object)); - } - - /** - * Creates an array of function property names from own and inherited - * enumerable properties of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to inspect. - * @returns {Array} Returns the function names. - * @see _.functions - * @example - * - * function Foo() { - * this.a = _.constant('a'); - * this.b = _.constant('b'); - * } - * - * Foo.prototype.c = _.constant('c'); - * - * _.functionsIn(new Foo); - * // => ['a', 'b', 'c'] - */ - function functionsIn(object) { - return object == null ? [] : baseFunctions(object, keysIn(object)); - } - - /** - * Gets the value at `path` of `object`. If the resolved value is - * `undefined`, the `defaultValue` is returned in its place. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.get(object, 'a[0].b.c'); - * // => 3 - * - * _.get(object, ['a', '0', 'b', 'c']); - * // => 3 - * - * _.get(object, 'a.b.c', 'default'); - * // => 'default' - */ - function get(object, path, defaultValue) { - var result = object == null ? undefined : baseGet(object, path); - return result === undefined ? defaultValue : result; - } - - /** - * Checks if `path` is a direct property of `object`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = { 'a': { 'b': 2 } }; - * var other = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.has(object, 'a'); - * // => true - * - * _.has(object, 'a.b'); - * // => true - * - * _.has(object, ['a', 'b']); - * // => true - * - * _.has(other, 'a'); - * // => false - */ - function has(object, path) { - return object != null && hasPath(object, path, baseHas); - } - - /** - * Checks if `path` is a direct or inherited property of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.hasIn(object, 'a'); - * // => true - * - * _.hasIn(object, 'a.b'); - * // => true - * - * _.hasIn(object, ['a', 'b']); - * // => true - * - * _.hasIn(object, 'b'); - * // => false - */ - function hasIn(object, path) { - return object != null && hasPath(object, path, baseHasIn); - } - - /** - * Creates an object composed of the inverted keys and values of `object`. - * If `object` contains duplicate values, subsequent values overwrite - * property assignments of previous values. - * - * @static - * @memberOf _ - * @since 0.7.0 - * @category Object - * @param {Object} object The object to invert. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invert(object); - * // => { '1': 'c', '2': 'b' } - */ - var invert = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - result[value] = key; - }, constant(identity)); - - /** - * This method is like `_.invert` except that the inverted object is generated - * from the results of running each element of `object` thru `iteratee`. The - * corresponding inverted value of each inverted key is an array of keys - * responsible for generating the inverted value. The iteratee is invoked - * with one argument: (value). - * - * @static - * @memberOf _ - * @since 4.1.0 - * @category Object - * @param {Object} object The object to invert. - * @param {Function} [iteratee=_.identity] The iteratee invoked per element. - * @returns {Object} Returns the new inverted object. - * @example - * - * var object = { 'a': 1, 'b': 2, 'c': 1 }; - * - * _.invertBy(object); - * // => { '1': ['a', 'c'], '2': ['b'] } - * - * _.invertBy(object, function(value) { - * return 'group' + value; - * }); - * // => { 'group1': ['a', 'c'], 'group2': ['b'] } - */ - var invertBy = createInverter(function(result, value, key) { - if (value != null && - typeof value.toString != 'function') { - value = nativeObjectToString.call(value); - } - - if (hasOwnProperty.call(result, value)) { - result[value].push(key); - } else { - result[value] = [key]; - } - }, getIteratee); - - /** - * Invokes the method at `path` of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the method to invoke. - * @param {...*} [args] The arguments to invoke the method with. - * @returns {*} Returns the result of the invoked method. - * @example - * - * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }; - * - * _.invoke(object, 'a[0].b.c.slice', 1, 3); - * // => [2, 3] - */ - var invoke = baseRest(baseInvoke); - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - - /** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ - function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); - } - - /** - * The opposite of `_.mapValues`; this method creates an object with the - * same values as `object` and keys generated by running each own enumerable - * string keyed property of `object` thru `iteratee`. The iteratee is invoked - * with three arguments: (value, key, object). - * - * @static - * @memberOf _ - * @since 3.8.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new mapped object. - * @see _.mapValues - * @example - * - * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { - * return key + value; - * }); - * // => { 'a1': 1, 'b2': 2 } - */ - function mapKeys(object, iteratee) { - var result = {}; - iteratee = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - baseAssignValue(result, iteratee(value, key, object), value); - }); - return result; - } - - /** - * Creates an object with the same keys as `object` and values generated - * by running each own enumerable string keyed property of `object` thru - * `iteratee`. The iteratee is invoked with three arguments: - * (value, key, object). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @returns {Object} Returns the new mapped object. - * @see _.mapKeys - * @example - * - * var users = { - * 'fred': { 'user': 'fred', 'age': 40 }, - * 'pebbles': { 'user': 'pebbles', 'age': 1 } - * }; - * - * _.mapValues(users, function(o) { return o.age; }); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) - * - * // The `_.property` iteratee shorthand. - * _.mapValues(users, 'age'); - * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) - */ - function mapValues(object, iteratee) { - var result = {}; - iteratee = getIteratee(iteratee, 3); - - baseForOwn(object, function(value, key, object) { - baseAssignValue(result, key, iteratee(value, key, object)); - }); - return result; - } - - /** - * This method is like `_.assign` except that it recursively merges own and - * inherited enumerable string keyed properties of source objects into the - * destination object. Source properties that resolve to `undefined` are - * skipped if a destination value exists. Array and plain object properties - * are merged recursively. Other objects and value types are overridden by - * assignment. Source objects are applied from left to right. Subsequent - * sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * var object = { - * 'a': [{ 'b': 2 }, { 'd': 4 }] - * }; - * - * var other = { - * 'a': [{ 'c': 3 }, { 'e': 5 }] - * }; - * - * _.merge(object, other); - * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } - */ - var merge = createAssigner(function(object, source, srcIndex) { - baseMerge(object, source, srcIndex); - }); - - /** - * This method is like `_.merge` except that it accepts `customizer` which - * is invoked to produce the merged values of the destination and source - * properties. If `customizer` returns `undefined`, merging is handled by the - * method instead. The `customizer` is invoked with six arguments: - * (objValue, srcValue, key, object, source, stack). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} sources The source objects. - * @param {Function} customizer The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * function customizer(objValue, srcValue) { - * if (_.isArray(objValue)) { - * return objValue.concat(srcValue); - * } - * } - * - * var object = { 'a': [1], 'b': [2] }; - * var other = { 'a': [3], 'b': [4] }; - * - * _.mergeWith(object, other, customizer); - * // => { 'a': [1, 3], 'b': [2, 4] } - */ - var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { - baseMerge(object, source, srcIndex, customizer); - }); - - /** - * The opposite of `_.pick`; this method creates an object composed of the - * own and inherited enumerable property paths of `object` that are not omitted. - * - * **Note:** This method is considerably slower than `_.pick`. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to omit. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.omit(object, ['a', 'c']); - * // => { 'b': '2' } - */ - var omit = flatRest(function(object, paths) { - var result = {}; - if (object == null) { - return result; - } - var isDeep = false; - paths = arrayMap(paths, function(path) { - path = castPath(path, object); - isDeep || (isDeep = path.length > 1); - return path; - }); - copyObject(object, getAllKeysIn(object), result); - if (isDeep) { - result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); - } - var length = paths.length; - while (length--) { - baseUnset(result, paths[length]); - } - return result; - }); - - /** - * The opposite of `_.pickBy`; this method creates an object composed of - * the own and inherited enumerable string keyed properties of `object` that - * `predicate` doesn't return truthy for. The predicate is invoked with two - * arguments: (value, key). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The source object. - * @param {Function} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.omitBy(object, _.isNumber); - * // => { 'b': '2' } - */ - function omitBy(object, predicate) { - return pickBy(object, negate(getIteratee(predicate))); - } - - /** - * Creates an object composed of the picked `object` properties. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The source object. - * @param {...(string|string[])} [paths] The property paths to pick. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.pick(object, ['a', 'c']); - * // => { 'a': 1, 'c': 3 } - */ - var pick = flatRest(function(object, paths) { - return object == null ? {} : basePick(object, paths); - }); - - /** - * Creates an object composed of the `object` properties `predicate` returns - * truthy for. The predicate is invoked with two arguments: (value, key). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The source object. - * @param {Function} [predicate=_.identity] The function invoked per property. - * @returns {Object} Returns the new object. - * @example - * - * var object = { 'a': 1, 'b': '2', 'c': 3 }; - * - * _.pickBy(object, _.isNumber); - * // => { 'a': 1, 'c': 3 } - */ - function pickBy(object, predicate) { - if (object == null) { - return {}; - } - var props = arrayMap(getAllKeysIn(object), function(prop) { - return [prop]; - }); - predicate = getIteratee(predicate); - return basePickBy(object, props, function(value, path) { - return predicate(value, path[0]); - }); - } - - /** - * This method is like `_.get` except that if the resolved value is a - * function it's invoked with the `this` binding of its parent object and - * its result is returned. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to resolve. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; - * - * _.result(object, 'a[0].b.c1'); - * // => 3 - * - * _.result(object, 'a[0].b.c2'); - * // => 4 - * - * _.result(object, 'a[0].b.c3', 'default'); - * // => 'default' - * - * _.result(object, 'a[0].b.c3', _.constant('default')); - * // => 'default' - */ - function result(object, path, defaultValue) { - path = castPath(path, object); - - var index = -1, - length = path.length; - - // Ensure the loop is entered when path is empty. - if (!length) { - length = 1; - object = undefined; - } - while (++index < length) { - var value = object == null ? undefined : object[toKey(path[index])]; - if (value === undefined) { - index = length; - value = defaultValue; - } - object = isFunction(value) ? value.call(object) : value; - } - return object; - } - - /** - * Sets the value at `path` of `object`. If a portion of `path` doesn't exist, - * it's created. Arrays are created for missing index properties while objects - * are created for all other missing properties. Use `_.setWith` to customize - * `path` creation. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.set(object, 'a[0].b.c', 4); - * console.log(object.a[0].b.c); - * // => 4 - * - * _.set(object, ['x', '0', 'y', 'z'], 5); - * console.log(object.x[0].y.z); - * // => 5 - */ - function set(object, path, value) { - return object == null ? object : baseSet(object, path, value); - } - - /** - * This method is like `_.set` except that it accepts `customizer` which is - * invoked to produce the objects of `path`. If `customizer` returns `undefined` - * path creation is handled by the method instead. The `customizer` is invoked - * with three arguments: (nsValue, key, nsObject). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {*} value The value to set. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * var object = {}; - * - * _.setWith(object, '[0][1]', 'a', Object); - * // => { '0': { '1': 'a' } } - */ - function setWith(object, path, value, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return object == null ? object : baseSet(object, path, value, customizer); - } - - /** - * Creates an array of own enumerable string keyed-value pairs for `object` - * which can be consumed by `_.fromPairs`. If `object` is a map or set, its - * entries are returned. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias entries - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairs(new Foo); - * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed) - */ - var toPairs = createToPairs(keys); - - /** - * Creates an array of own and inherited enumerable string keyed-value pairs - * for `object` which can be consumed by `_.fromPairs`. If `object` is a map - * or set, its entries are returned. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @alias entriesIn - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the key-value pairs. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.toPairsIn(new Foo); - * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed) - */ - var toPairsIn = createToPairs(keysIn); - - /** - * An alternative to `_.reduce`; this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own - * enumerable string keyed properties thru `iteratee`, with each invocation - * potentially mutating the `accumulator` object. If `accumulator` is not - * provided, a new object with the same `[[Prototype]]` will be used. The - * iteratee is invoked with four arguments: (accumulator, value, key, object). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The custom accumulator value. - * @returns {*} Returns the accumulated value. - * @example - * - * _.transform([2, 3, 4], function(result, n) { - * result.push(n *= n); - * return n % 2 == 0; - * }, []); - * // => [4, 9] - * - * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } - */ - function transform(object, iteratee, accumulator) { - var isArr = isArray(object), - isArrLike = isArr || isBuffer(object) || isTypedArray(object); - - iteratee = getIteratee(iteratee, 4); - if (accumulator == null) { - var Ctor = object && object.constructor; - if (isArrLike) { - accumulator = isArr ? new Ctor : []; - } - else if (isObject(object)) { - accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; - } - else { - accumulator = {}; - } - } - (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) { - return iteratee(accumulator, value, index, object); - }); - return accumulator; - } - - /** - * Removes the property at `path` of `object`. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to unset. - * @returns {boolean} Returns `true` if the property is deleted, else `false`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 7 } }] }; - * _.unset(object, 'a[0].b.c'); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - * - * _.unset(object, ['a', '0', 'b', 'c']); - * // => true - * - * console.log(object); - * // => { 'a': [{ 'b': {} }] }; - */ - function unset(object, path) { - return object == null ? true : baseUnset(object, path); - } - - /** - * This method is like `_.set` except that accepts `updater` to produce the - * value to set. Use `_.updateWith` to customize `path` creation. The `updater` - * is invoked with one argument: (value). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {Function} updater The function to produce the updated value. - * @returns {Object} Returns `object`. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.update(object, 'a[0].b.c', function(n) { return n * n; }); - * console.log(object.a[0].b.c); - * // => 9 - * - * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; }); - * console.log(object.x[0].y.z); - * // => 0 - */ - function update(object, path, updater) { - return object == null ? object : baseUpdate(object, path, castFunction(updater)); - } - - /** - * This method is like `_.update` except that it accepts `customizer` which is - * invoked to produce the objects of `path`. If `customizer` returns `undefined` - * path creation is handled by the method instead. The `customizer` is invoked - * with three arguments: (nsValue, key, nsObject). - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 4.6.0 - * @category Object - * @param {Object} object The object to modify. - * @param {Array|string} path The path of the property to set. - * @param {Function} updater The function to produce the updated value. - * @param {Function} [customizer] The function to customize assigned values. - * @returns {Object} Returns `object`. - * @example - * - * var object = {}; - * - * _.updateWith(object, '[0][1]', _.constant('a'), Object); - * // => { '0': { '1': 'a' } } - */ - function updateWith(object, path, updater, customizer) { - customizer = typeof customizer == 'function' ? customizer : undefined; - return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); - } - - /** - * Creates an array of the own enumerable string keyed property values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.values(new Foo); - * // => [1, 2] (iteration order is not guaranteed) - * - * _.values('hi'); - * // => ['h', 'i'] - */ - function values(object) { - return object == null ? [] : baseValues(object, keys(object)); - } - - /** - * Creates an array of the own and inherited enumerable string keyed property - * values of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property values. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.valuesIn(new Foo); - * // => [1, 2, 3] (iteration order is not guaranteed) - */ - function valuesIn(object) { - return object == null ? [] : baseValues(object, keysIn(object)); - } - - /*------------------------------------------------------------------------*/ - - /** - * Clamps `number` within the inclusive `lower` and `upper` bounds. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Number - * @param {number} number The number to clamp. - * @param {number} [lower] The lower bound. - * @param {number} upper The upper bound. - * @returns {number} Returns the clamped number. - * @example - * - * _.clamp(-10, -5, 5); - * // => -5 - * - * _.clamp(10, -5, 5); - * // => 5 - */ - function clamp(number, lower, upper) { - if (upper === undefined) { - upper = lower; - lower = undefined; - } - if (upper !== undefined) { - upper = toNumber(upper); - upper = upper === upper ? upper : 0; - } - if (lower !== undefined) { - lower = toNumber(lower); - lower = lower === lower ? lower : 0; - } - return baseClamp(toNumber(number), lower, upper); - } - - /** - * Checks if `n` is between `start` and up to, but not including, `end`. If - * `end` is not specified, it's set to `start` with `start` then set to `0`. - * If `start` is greater than `end` the params are swapped to support - * negative ranges. - * - * @static - * @memberOf _ - * @since 3.3.0 - * @category Number - * @param {number} number The number to check. - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @returns {boolean} Returns `true` if `number` is in the range, else `false`. - * @see _.range, _.rangeRight - * @example - * - * _.inRange(3, 2, 4); - * // => true - * - * _.inRange(4, 8); - * // => true - * - * _.inRange(4, 2); - * // => false - * - * _.inRange(2, 2); - * // => false - * - * _.inRange(1.2, 2); - * // => true - * - * _.inRange(5.2, 4); - * // => false - * - * _.inRange(-3, -2, -6); - * // => true - */ - function inRange(number, start, end) { - start = toFinite(start); - if (end === undefined) { - end = start; - start = 0; - } else { - end = toFinite(end); - } - number = toNumber(number); - return baseInRange(number, start, end); - } - - /** - * Produces a random number between the inclusive `lower` and `upper` bounds. - * If only one argument is provided a number between `0` and the given number - * is returned. If `floating` is `true`, or either `lower` or `upper` are - * floats, a floating-point number is returned instead of an integer. - * - * **Note:** JavaScript follows the IEEE-754 standard for resolving - * floating-point values which can produce unexpected results. - * - * @static - * @memberOf _ - * @since 0.7.0 - * @category Number - * @param {number} [lower=0] The lower bound. - * @param {number} [upper=1] The upper bound. - * @param {boolean} [floating] Specify returning a floating-point number. - * @returns {number} Returns the random number. - * @example - * - * _.random(0, 5); - * // => an integer between 0 and 5 - * - * _.random(5); - * // => also an integer between 0 and 5 - * - * _.random(5, true); - * // => a floating-point number between 0 and 5 - * - * _.random(1.2, 5.2); - * // => a floating-point number between 1.2 and 5.2 - */ - function random(lower, upper, floating) { - if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) { - upper = floating = undefined; - } - if (floating === undefined) { - if (typeof upper == 'boolean') { - floating = upper; - upper = undefined; - } - else if (typeof lower == 'boolean') { - floating = lower; - lower = undefined; - } - } - if (lower === undefined && upper === undefined) { - lower = 0; - upper = 1; - } - else { - lower = toFinite(lower); - if (upper === undefined) { - upper = lower; - lower = 0; - } else { - upper = toFinite(upper); - } - } - if (lower > upper) { - var temp = lower; - lower = upper; - upper = temp; - } - if (floating || lower % 1 || upper % 1) { - var rand = nativeRandom(); - return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper); - } - return baseRandom(lower, upper); - } - - /*------------------------------------------------------------------------*/ - - /** - * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the camel cased string. - * @example - * - * _.camelCase('Foo Bar'); - * // => 'fooBar' - * - * _.camelCase('--foo-bar--'); - * // => 'fooBar' - * - * _.camelCase('__FOO_BAR__'); - * // => 'fooBar' - */ - var camelCase = createCompounder(function(result, word, index) { - word = word.toLowerCase(); - return result + (index ? capitalize(word) : word); - }); - - /** - * Converts the first character of `string` to upper case and the remaining - * to lower case. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to capitalize. - * @returns {string} Returns the capitalized string. - * @example - * - * _.capitalize('FRED'); - * // => 'Fred' - */ - function capitalize(string) { - return upperFirst(toString(string).toLowerCase()); - } - - /** - * Deburrs `string` by converting - * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) - * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) - * letters to basic Latin letters and removing - * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to deburr. - * @returns {string} Returns the deburred string. - * @example - * - * _.deburr('déjà vu'); - * // => 'deja vu' - */ - function deburr(string) { - string = toString(string); - return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); - } - - /** - * Checks if `string` ends with the given target string. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to inspect. - * @param {string} [target] The string to search for. - * @param {number} [position=string.length] The position to search up to. - * @returns {boolean} Returns `true` if `string` ends with `target`, - * else `false`. - * @example - * - * _.endsWith('abc', 'c'); - * // => true - * - * _.endsWith('abc', 'b'); - * // => false - * - * _.endsWith('abc', 'b', 2); - * // => true - */ - function endsWith(string, target, position) { - string = toString(string); - target = baseToString(target); - - var length = string.length; - position = position === undefined - ? length - : baseClamp(toInteger(position), 0, length); - - var end = position; - position -= target.length; - return position >= 0 && string.slice(position, end) == target; - } - - /** - * Converts the characters "&", "<", ">", '"', and "'" in `string` to their - * corresponding HTML entities. - * - * **Note:** No other characters are escaped. To escape additional - * characters use a third-party library like [_he_](https://mths.be/he). - * - * Though the ">" character is escaped for symmetry, characters like - * ">" and "/" don't need escaping in HTML and have no special meaning - * unless they're part of a tag or unquoted attribute value. See - * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) - * (under "semi-related fun fact") for more details. - * - * When working with HTML you should always - * [quote attribute values](http://wonko.com/post/html-escaping) to reduce - * XSS vectors. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('fred, barney, & pebbles'); - * // => 'fred, barney, & pebbles' - */ - function escape(string) { - string = toString(string); - return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; - } - - /** - * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", - * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escapeRegExp('[lodash](https://lodash.com/)'); - * // => '\[lodash\]\(https://lodash\.com/\)' - */ - function escapeRegExp(string) { - string = toString(string); - return (string && reHasRegExpChar.test(string)) - ? string.replace(reRegExpChar, '\\$&') - : string; - } - - /** - * Converts `string` to - * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the kebab cased string. - * @example - * - * _.kebabCase('Foo Bar'); - * // => 'foo-bar' - * - * _.kebabCase('fooBar'); - * // => 'foo-bar' - * - * _.kebabCase('__FOO_BAR__'); - * // => 'foo-bar' - */ - var kebabCase = createCompounder(function(result, word, index) { - return result + (index ? '-' : '') + word.toLowerCase(); - }); - - /** - * Converts `string`, as space separated words, to lower case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the lower cased string. - * @example - * - * _.lowerCase('--Foo-Bar--'); - * // => 'foo bar' - * - * _.lowerCase('fooBar'); - * // => 'foo bar' - * - * _.lowerCase('__FOO_BAR__'); - * // => 'foo bar' - */ - var lowerCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + word.toLowerCase(); - }); - - /** - * Converts the first character of `string` to lower case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.lowerFirst('Fred'); - * // => 'fred' - * - * _.lowerFirst('FRED'); - * // => 'fRED' - */ - var lowerFirst = createCaseFirst('toLowerCase'); - - /** - * Pads `string` on the left and right sides if it's shorter than `length`. - * Padding characters are truncated if they can't be evenly divided by `length`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.pad('abc', 8); - * // => ' abc ' - * - * _.pad('abc', 8, '_-'); - * // => '_-abc_-_' - * - * _.pad('abc', 3); - * // => 'abc' - */ - function pad(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - if (!length || strLength >= length) { - return string; - } - var mid = (length - strLength) / 2; - return ( - createPadding(nativeFloor(mid), chars) + - string + - createPadding(nativeCeil(mid), chars) - ); - } - - /** - * Pads `string` on the right side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padEnd('abc', 6); - * // => 'abc ' - * - * _.padEnd('abc', 6, '_-'); - * // => 'abc_-_' - * - * _.padEnd('abc', 3); - * // => 'abc' - */ - function padEnd(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - return (length && strLength < length) - ? (string + createPadding(length - strLength, chars)) - : string; - } - - /** - * Pads `string` on the left side if it's shorter than `length`. Padding - * characters are truncated if they exceed `length`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to pad. - * @param {number} [length=0] The padding length. - * @param {string} [chars=' '] The string used as padding. - * @returns {string} Returns the padded string. - * @example - * - * _.padStart('abc', 6); - * // => ' abc' - * - * _.padStart('abc', 6, '_-'); - * // => '_-_abc' - * - * _.padStart('abc', 3); - * // => 'abc' - */ - function padStart(string, length, chars) { - string = toString(string); - length = toInteger(length); - - var strLength = length ? stringSize(string) : 0; - return (length && strLength < length) - ? (createPadding(length - strLength, chars) + string) - : string; - } - - /** - * Converts `string` to an integer of the specified radix. If `radix` is - * `undefined` or `0`, a `radix` of `10` is used unless `value` is a - * hexadecimal, in which case a `radix` of `16` is used. - * - * **Note:** This method aligns with the - * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`. - * - * @static - * @memberOf _ - * @since 1.1.0 - * @category String - * @param {string} string The string to convert. - * @param {number} [radix=10] The radix to interpret `value` by. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {number} Returns the converted integer. - * @example - * - * _.parseInt('08'); - * // => 8 - * - * _.map(['6', '08', '10'], _.parseInt); - * // => [6, 8, 10] - */ - function parseInt(string, radix, guard) { - if (guard || radix == null) { - radix = 0; - } else if (radix) { - radix = +radix; - } - return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0); - } - - /** - * Repeats the given string `n` times. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to repeat. - * @param {number} [n=1] The number of times to repeat the string. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {string} Returns the repeated string. - * @example - * - * _.repeat('*', 3); - * // => '***' - * - * _.repeat('abc', 2); - * // => 'abcabc' - * - * _.repeat('abc', 0); - * // => '' - */ - function repeat(string, n, guard) { - if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) { - n = 1; - } else { - n = toInteger(n); - } - return baseRepeat(toString(string), n); - } - - /** - * Replaces matches for `pattern` in `string` with `replacement`. - * - * **Note:** This method is based on - * [`String#replace`](https://mdn.io/String/replace). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to modify. - * @param {RegExp|string} pattern The pattern to replace. - * @param {Function|string} replacement The match replacement. - * @returns {string} Returns the modified string. - * @example - * - * _.replace('Hi Fred', 'Fred', 'Barney'); - * // => 'Hi Barney' - */ - function replace() { - var args = arguments, - string = toString(args[0]); - - return args.length < 3 ? string : string.replace(args[1], args[2]); - } - - /** - * Converts `string` to - * [snake case](https://en.wikipedia.org/wiki/Snake_case). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the snake cased string. - * @example - * - * _.snakeCase('Foo Bar'); - * // => 'foo_bar' - * - * _.snakeCase('fooBar'); - * // => 'foo_bar' - * - * _.snakeCase('--FOO-BAR--'); - * // => 'foo_bar' - */ - var snakeCase = createCompounder(function(result, word, index) { - return result + (index ? '_' : '') + word.toLowerCase(); - }); - - /** - * Splits `string` by `separator`. - * - * **Note:** This method is based on - * [`String#split`](https://mdn.io/String/split). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to split. - * @param {RegExp|string} separator The separator pattern to split by. - * @param {number} [limit] The length to truncate results to. - * @returns {Array} Returns the string segments. - * @example - * - * _.split('a-b-c', '-', 2); - * // => ['a', 'b'] - */ - function split(string, separator, limit) { - if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) { - separator = limit = undefined; - } - limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0; - if (!limit) { - return []; - } - string = toString(string); - if (string && ( - typeof separator == 'string' || - (separator != null && !isRegExp(separator)) - )) { - separator = baseToString(separator); - if (!separator && hasUnicode(string)) { - return castSlice(stringToArray(string), 0, limit); - } - } - return string.split(separator, limit); - } - - /** - * Converts `string` to - * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). - * - * @static - * @memberOf _ - * @since 3.1.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the start cased string. - * @example - * - * _.startCase('--foo-bar--'); - * // => 'Foo Bar' - * - * _.startCase('fooBar'); - * // => 'Foo Bar' - * - * _.startCase('__FOO_BAR__'); - * // => 'FOO BAR' - */ - var startCase = createCompounder(function(result, word, index) { - return result + (index ? ' ' : '') + upperFirst(word); - }); - - /** - * Checks if `string` starts with the given target string. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to inspect. - * @param {string} [target] The string to search for. - * @param {number} [position=0] The position to search from. - * @returns {boolean} Returns `true` if `string` starts with `target`, - * else `false`. - * @example - * - * _.startsWith('abc', 'a'); - * // => true - * - * _.startsWith('abc', 'b'); - * // => false - * - * _.startsWith('abc', 'b', 1); - * // => true - */ - function startsWith(string, target, position) { - string = toString(string); - position = position == null - ? 0 - : baseClamp(toInteger(position), 0, string.length); - - target = baseToString(target); - return string.slice(position, position + target.length) == target; - } - - /** - * Creates a compiled template function that can interpolate data properties - * in "interpolate" delimiters, HTML-escape interpolated data properties in - * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data - * properties may be accessed as free variables in the template. If a setting - * object is given, it takes precedence over `_.templateSettings` values. - * - * **Note:** In the development build `_.template` utilizes - * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) - * for easier debugging. - * - * For more information on precompiling templates see - * [lodash's custom builds documentation](https://lodash.com/custom-builds). - * - * For more information on Chrome extension sandboxes see - * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category String - * @param {string} [string=''] The template string. - * @param {Object} [options={}] The options object. - * @param {RegExp} [options.escape=_.templateSettings.escape] - * The HTML "escape" delimiter. - * @param {RegExp} [options.evaluate=_.templateSettings.evaluate] - * The "evaluate" delimiter. - * @param {Object} [options.imports=_.templateSettings.imports] - * An object to import into the template as free variables. - * @param {RegExp} [options.interpolate=_.templateSettings.interpolate] - * The "interpolate" delimiter. - * @param {string} [options.sourceURL='lodash.templateSources[n]'] - * The sourceURL of the compiled template. - * @param {string} [options.variable='obj'] - * The data object variable name. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Function} Returns the compiled template function. - * @example - * - * // Use the "interpolate" delimiter to create a compiled template. - * var compiled = _.template('hello <%= user %>!'); - * compiled({ 'user': 'fred' }); - * // => 'hello fred!' - * - * // Use the HTML "escape" delimiter to escape data property values. - * var compiled = _.template('<%- value %>'); - * compiled({ 'value': '\n\n\n\n"; - var diagramsDiv = "\n
\n"; - var serializedGrammar = "\n\n"; - var initLogic = "\n\n"; - return (header + cssHtml + scripts + diagramsDiv + serializedGrammar + initLogic); -} -//# sourceMappingURL=render_public.js.map - -/***/ }), -/* 416 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = generateParserFactory; -/* harmony export (immutable) */ __webpack_exports__["b"] = generateParserModule; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__generate__ = __webpack_require__(417); - -function generateParserFactory(options) { - var wrapperText = Object(__WEBPACK_IMPORTED_MODULE_0__generate__["b" /* genWrapperFunction */])({ - name: options.name, - rules: options.rules - }); - var constructorWrapper = new Function("tokenVocabulary", "config", "chevrotain", wrapperText); - return function (config) { - return constructorWrapper(options.tokenVocabulary, config, - // TODO: check how the require is transpiled/webpacked - __webpack_require__(253)); - }; -} -function generateParserModule(options) { - return Object(__WEBPACK_IMPORTED_MODULE_0__generate__["a" /* genUmdModule */])({ name: options.name, rules: options.rules }); -} -//# sourceMappingURL=generate_public.js.map - -/***/ }), -/* 417 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = genUmdModule; -/* harmony export (immutable) */ __webpack_exports__["b"] = genWrapperFunction; -/* unused harmony export genClass */ -/* unused harmony export genAllRules */ -/* unused harmony export genRule */ -/* unused harmony export genTerminal */ -/* unused harmony export genNonTerminal */ -/* unused harmony export genAlternation */ -/* unused harmony export genSingleAlt */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_utils__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__parse_grammar_gast_gast_public__ = __webpack_require__(7); - - -/** - * Missing features - * 1. Rule arguments - * 2. Gates - * 3. embedded actions - */ -var NL = "\n"; -function genUmdModule(options) { - return "\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['chevrotain'], factory);\n } else if (typeof module === 'object' && module.exports) {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory(require('chevrotain'));\n } else {\n // Browser globals (root is window)\n root.returnExports = factory(root.b);\n }\n}(typeof self !== 'undefined' ? self : this, function (chevrotain) {\n\n" + genClass(options) + "\n \nreturn {\n " + options.name + ": " + options.name + " \n}\n}));\n"; -} -function genWrapperFunction(options) { - return " \n" + genClass(options) + "\nreturn new " + options.name + "(tokenVocabulary, config) \n"; -} -function genClass(options) { - // TODO: how to pass the token vocabulary? Constructor? other? - var result = "\nfunction " + options.name + "(tokenVocabulary, config) {\n // invoke super constructor\n // No support for embedded actions currently, so we can 'hardcode'\n // The use of CstParser.\n chevrotain.CstParser.call(this, tokenVocabulary, config)\n\n const $ = this\n\n " + genAllRules(options.rules) + "\n\n // very important to call this after all the rules have been defined.\n // otherwise the parser may not work correctly as it will lack information\n // derived during the self analysis phase.\n this.performSelfAnalysis(this)\n}\n\n// inheritance as implemented in javascript in the previous decade... :(\n" + options.name + ".prototype = Object.create(chevrotain.CstParser.prototype)\n" + options.name + ".prototype.constructor = " + options.name + " \n "; - return result; -} -function genAllRules(rules) { - var rulesText = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["I" /* map */])(rules, function (currRule) { - return genRule(currRule, 1); - }); - return rulesText.join("\n"); -} -function genRule(prod, n) { - var result = indent(n, "$.RULE(\"" + prod.name + "\", function() {") + NL; - result += genDefinition(prod.definition, n + 1); - result += indent(n + 1, "})") + NL; - return result; -} -function genTerminal(prod, n) { - var name = prod.terminalType.name; - // TODO: potential performance optimization, avoid tokenMap Dictionary access - return indent(n, "$.CONSUME" + prod.idx + "(this.tokensMap." + name + ")" + NL); -} -function genNonTerminal(prod, n) { - return indent(n, "$.SUBRULE" + prod.idx + "($." + prod.nonTerminalName + ")" + NL); -} -function genAlternation(prod, n) { - var result = indent(n, "$.OR" + prod.idx + "([") + NL; - var alts = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["I" /* map */])(prod.definition, function (altDef) { return genSingleAlt(altDef, n + 1); }); - result += alts.join("," + NL); - result += NL + indent(n, "])" + NL); - return result; -} -function genSingleAlt(prod, n) { - var result = indent(n, "{") + NL; - if (prod.name) { - result += indent(n + 1, "NAME: \"" + prod.name + "\",") + NL; - } - result += indent(n + 1, "ALT: function() {") + NL; - result += genDefinition(prod.definition, n + 1); - result += indent(n + 1, "}") + NL; - result += indent(n, "}"); - return result; -} -function genProd(prod, n) { - /* istanbul ignore else */ - if (prod instanceof __WEBPACK_IMPORTED_MODULE_1__parse_grammar_gast_gast_public__["d" /* NonTerminal */]) { - return genNonTerminal(prod, n); - } - else if (prod instanceof __WEBPACK_IMPORTED_MODULE_1__parse_grammar_gast_gast_public__["e" /* Option */]) { - return genDSLRule("OPTION", prod, n); - } - else if (prod instanceof __WEBPACK_IMPORTED_MODULE_1__parse_grammar_gast_gast_public__["g" /* RepetitionMandatory */]) { - return genDSLRule("AT_LEAST_ONE", prod, n); - } - else if (prod instanceof __WEBPACK_IMPORTED_MODULE_1__parse_grammar_gast_gast_public__["h" /* RepetitionMandatoryWithSeparator */]) { - return genDSLRule("AT_LEAST_ONE_SEP", prod, n); - } - else if (prod instanceof __WEBPACK_IMPORTED_MODULE_1__parse_grammar_gast_gast_public__["i" /* RepetitionWithSeparator */]) { - return genDSLRule("MANY_SEP", prod, n); - } - else if (prod instanceof __WEBPACK_IMPORTED_MODULE_1__parse_grammar_gast_gast_public__["f" /* Repetition */]) { - return genDSLRule("MANY", prod, n); - } - else if (prod instanceof __WEBPACK_IMPORTED_MODULE_1__parse_grammar_gast_gast_public__["b" /* Alternation */]) { - return genAlternation(prod, n); - } - else if (prod instanceof __WEBPACK_IMPORTED_MODULE_1__parse_grammar_gast_gast_public__["k" /* Terminal */]) { - return genTerminal(prod, n); - } - else if (prod instanceof __WEBPACK_IMPORTED_MODULE_1__parse_grammar_gast_gast_public__["c" /* Flat */]) { - return genDefinition(prod.definition, n); - } - else { - throw Error("non exhaustive match"); - } -} -function genDSLRule(dslName, prod, n) { - var result = indent(n, "$." + (dslName + prod.idx) + "("); - if (prod.name || prod.separator) { - result += "{" + NL; - if (prod.name) { - result += indent(n + 1, "NAME: \"" + prod.name + "\"") + "," + NL; - } - if (prod.separator) { - result += - indent(n + 1, "SEP: this.tokensMap." + prod.separator.name) + - "," + - NL; - } - result += "DEF: " + genDefFunction(prod.definition, n + 2) + NL; - result += indent(n, "}") + NL; - } - else { - result += genDefFunction(prod.definition, n + 1); - } - result += indent(n, ")") + NL; - return result; -} -function genDefFunction(definition, n) { - var def = "function() {" + NL; - def += genDefinition(definition, n); - def += indent(n, "}") + NL; - return def; -} -function genDefinition(def, n) { - var result = ""; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils__["u" /* forEach */])(def, function (prod) { - result += genProd(prod, n + 1); - }); - return result; -} -function indent(howMuch, text) { - var spaces = Array(howMuch * 4 + 1).join(" "); - return spaces + text; -} -//# sourceMappingURL=generate.js.map - -/***/ }), -/* 418 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = rasterLayer; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cap_mixin__ = __webpack_require__(21); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__raster_layer_point_mixin__ = __webpack_require__(32); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__raster_layer_poly_mixin__ = __webpack_require__(251); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__raster_layer_heatmap_mixin__ = __webpack_require__(241); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__raster_layer_line_mixin__ = __webpack_require__(419); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__raster_layer_windbarb_mixin__ = __webpack_require__(242); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__raster_layer_mesh2d_mixin__ = __webpack_require__(250); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__raster_layer_cross_section_terrain_mixin__ = __webpack_require__(420); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_utils_vega__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_moment__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_moment___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_moment__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__constants_dc_constants__ = __webpack_require__(214); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils_utils__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__constants_file_types__ = __webpack_require__(422); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } - - - - - - - - - - - - - - -var validLayerTypes = ["points", "polys", "heat", "lines", "windbarbs", "mesh2d", "crossSectionTerrain"]; -var getImageSize = __WEBPACK_IMPORTED_MODULE_12__utils_utils__["l" /* utils */].getImageSize, - replaceAsync = __WEBPACK_IMPORTED_MODULE_12__utils_utils__["l" /* utils */].replaceAsync, - parseUrlParts = __WEBPACK_IMPORTED_MODULE_12__utils_utils__["l" /* utils */].parseUrlParts; -function rasterLayer(layerType) { - var _layerType = layerType; - var _dimension = null; - var _group = null; - var _mandatoryAttributes2 = []; - var _layer = Object(__WEBPACK_IMPORTED_MODULE_0__cap_mixin__["a" /* default */])({ - setDataAsync: function setDataAsync(callback) { - // noop. - // This is to appease mixins that require an object initialized with a baseMixin - }, - data: function data(callback) { - // noop. - // This is to appease mixins that require an object initialized with a baseMixin - }, - filter: function filter() { - // noop. - // This is to appease mixins that require an object initialized with a baseMixin - }, - _mandatoryAttributes: function _mandatoryAttributes(mandatoryAttributes) { - // needed for layer mixins to control mandatory checks. - - if (!arguments.length) { - return _mandatoryAttributes2; - } - _mandatoryAttributes2 = mandatoryAttributes; - return _layer; - } - }); - _layer.othersGrouper(false); // TODO(croot): what does othersGrouper in capMixin do exactly? - // Always set to false for now, tho user can override. - - if (layerType === "points") { - _layer = Object(__WEBPACK_IMPORTED_MODULE_1__raster_layer_point_mixin__["b" /* default */])(_layer); - } else if (layerType === "polys") { - _layer = Object(__WEBPACK_IMPORTED_MODULE_2__raster_layer_poly_mixin__["a" /* default */])(_layer); - } else if (/heat/.test(layerType)) { - _layer = Object(__WEBPACK_IMPORTED_MODULE_3__raster_layer_heatmap_mixin__["a" /* default */])(_layer); - } else if (layerType === "lines") { - _layer = Object(__WEBPACK_IMPORTED_MODULE_4__raster_layer_line_mixin__["a" /* default */])(_layer); - } else if (layerType === "windbarbs") { - _layer = Object(__WEBPACK_IMPORTED_MODULE_5__raster_layer_windbarb_mixin__["a" /* default */])(_layer); - } else if (layerType === "mesh2d") { - _layer = Object(__WEBPACK_IMPORTED_MODULE_6__raster_layer_mesh2d_mixin__["a" /* default */])(_layer); - } else if (layerType === "crossSectionTerrain") { - _layer = Object(__WEBPACK_IMPORTED_MODULE_7__raster_layer_cross_section_terrain_mixin__["a" /* default */])(_layer); - } else { - throw new Error('"' + layerType + '" is not a valid layer type. The valid layer types are: ' + validLayerTypes.join(", ")); - } - var _opacity = 1; - - // NOTE: builds _layer.defaultFillColor(), _layer.nullFillColor(), - // _layer.fillColorScale(), & _layer.fillColorAttr() - Object(__WEBPACK_IMPORTED_MODULE_8__utils_utils_vega__["d" /* createVegaAttrMixin */])(_layer, "fillColor", "#22A7F0", "#CACACA", true); - - // NOTE: builds _layer.defaultStrokeColor(), _layer.nullStrokeColor(), - // _layer.strokeColorScale(), & _layer.strokeColorAttr() - Object(__WEBPACK_IMPORTED_MODULE_8__utils_utils_vega__["d" /* createVegaAttrMixin */])(_layer, "strokeColor", "white", "white", true); - - // NOTE: builds _layer.defaultStrokeWidth(), _layer.nullStrokeWidth(), - // _layer.strokeWidthScale(), & _layer.strokeWidthAttr() - Object(__WEBPACK_IMPORTED_MODULE_8__utils_utils_vega__["d" /* createVegaAttrMixin */])(_layer, "strokeWidth", 0, 0, true); - _layer.popupColumns = Object(__WEBPACK_IMPORTED_MODULE_8__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, []); - _layer.popupColumnsMapped = Object(__WEBPACK_IMPORTED_MODULE_8__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, {}); - _layer.popupFunction = Object(__WEBPACK_IMPORTED_MODULE_8__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, null); - _layer.popupStyle = Object(__WEBPACK_IMPORTED_MODULE_8__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, {}); - _layer.densityAccumulatorEnabled = Object(__WEBPACK_IMPORTED_MODULE_8__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, false); - var _popup_wrap_class = "map-popup-wrap-new"; - var _popup_box_class = "map-popup-box-new"; - var _popup_item_copy_class = "popup-item-copy"; - var _popup_box_item_wrap_class = "map-popup-item-wrap"; - var _popup_box_image_class = "map-popup-image"; - var _popup_box_item_class = "map-popup-item"; - var _popup_item_key_class = "popup-item-key"; - var _popup_item_val_class = "popup-item-val"; - var _popup_content_attr = "data-copycontent"; - var _layerPopups = {}; - _layer.layerType = function () { - return _layerType; - }; - - /** - * **mandatory** - * - * Set or get the dimension attribute of a chart. In `dc`, a dimension can be any valid [crossfilter - * dimension](https://github.com/square/crossfilter/wiki/API-Reference#wiki-dimension). - * - * If a value is given, then it will be used as the new dimension. If no value is specified then - * the current dimension will be returned. - * @name dimension - * @memberof dc.baseMixin - * @instance - * @see {@link https://github.com/square/crossfilter/wiki/API-Reference#dimension crossfilter.dimension} - * @example - * var index = crossfilter([]); - * var dimension = index.dimension(dc.pluck('key')); - * chart.dimension(dimension); - * @param {crossfilter.dimension} [dimension] - * @return {crossfilter.dimension} - * @return {dc.baseMixin} - */ - _layer.dimension = function (dimension) { - if (!arguments.length) { - return _dimension; - } - _dimension = dimension; - return _layer; - }; - - /** - * **mandatory** - * - * Set or get the group attribute of a chart. In `dc` a group is a - * {@link https://github.com/square/crossfilter/wiki/API-Reference#group-map-reduce crossfilter group}. - * Usually the group should be created from the particular dimension associated with the same chart. If a value is - * given, then it will be used as the new group. - * - * If no value specified then the current group will be returned. - * If `name` is specified then it will be used to generate legend label. - * @name group - * @memberof dc.baseMixin - * @instance - * @see {@link https://github.com/square/crossfilter/wiki/API-Reference#group-map-reduce crossfilter.group} - * @example - * var index = crossfilter([]); - * var dimension = index.dimension(dc.pluck('key')); - * chart.dimension(dimension); - * chart.group(dimension.group(crossfilter.reduceSum())); - * @param {crossfilter.group} [group] - * @param {String} [name] - * @return {crossfilter.group} - * @return {dc.baseMixin} - */ - _layer.group = function (group, name) { - if (!arguments.length) { - return _group; - } - _group = group; - _layer._groupName = name; - return _layer; - }; - _layer.opacity = function (opacity) { - if (!arguments.length) { - return _opacity; - } - _opacity = opacity; - return _layer; - }; - function genHeatConfigFromChart(chart, layerName) { - return { - table: _layer.crossfilter().getDataSource(), - width: Math.round(chart.width() * chart._getPixelRatio()), - height: Math.round(chart.height() * chart._getPixelRatio()), - min: chart.conv4326To900913(chart._minCoord), - max: chart.conv4326To900913(chart._maxCoord), - filter: _layer.crossfilter().getFilterString(layerName), - globalFilter: _layer.crossfilter().getGlobalFilterString(), - neLat: chart._maxCoord[1], - zoom: chart.zoom() - }; - } - _layer.genVega = function (chart, layerName) { - var cap = _layer.cap(); - var group = _layer.group() || {}; - var query = ""; - if (group.type === "dimension") { - query = group.writeTopQuery(cap, undefined, true); - } else if (group.type === "group") { - query = group.writeTopQuery(cap, undefined, false, true); - } - if (!query.length) { - // throw new Error("Crossfilter group/dimension did not provide a sql query string for layer " + layerName + "." + (groupType.length ? " Group type: " + (group.type || "unknown") + "." : "")) - } - if (_layer.type === "heatmap") { - var vega = _layer._genVega(_objectSpread(_objectSpread({}, genHeatConfigFromChart(chart, layerName)), {}, { - layerName: layerName - })); - return vega; - } else { - var _vega = _layer._genVega(chart, layerName, group, query); - return _vega; - } - }; - _layer.hasPopupColumns = function () { - var popCols = _layer.popupColumns(); - return Boolean(popCols && popCols instanceof Array && popCols.length > 0); - }; - - // A Utility function to map size or color measure label for custom measure popup - // Label is the same as field most of the case but for custom measures, it could be different - _layer.getMeasureLabel = function (measureRegex) { - var measureBlock = null; - if (measureRegex[2] === "color" || measureRegex[2] === "strokeColor") { - measureBlock = _layer.getState().encoding.color; - } else if (measureRegex[2] === "size" || measureRegex[2] === "strokeWidth") { - measureBlock = _layer.getState().encoding.size; - } else if (measureRegex[2] === "x" || measureRegex[2] === "y") { - measureBlock = _layer.getState().encoding[measureRegex[2]]; - } else if (measureRegex[2] === "orientation") { - measureBlock = _layer.getState().encoding.orientation; - } - if (measureBlock && measureBlock.label) { - return measureBlock.label; - } - return measureBlock; - }; - function isMeasureCol(colAttr) { - return colAttr === "x" || colAttr === "y" || colAttr === "color" || colAttr === "size" || colAttr === "strokeColor" || colAttr === "strokeWidth" || colAttr === "orientation"; - } - function addPopupColumnToSet(colAttr, popupColSet) { - // TODO(croot): getProjectOn for groups requires the two arguments, - // dimension.getProjectOn() doesn't have any args. - // Need to come up with a better API for group.getProjectOn() - // and improve the api so that "as key0" are not automatically - // added to those projection statements. - - // TODO(croot): performance could be improved here with a better - // data structure, but probably not an issue given the amount - // of popup col attrs to iterate through is small - var dim = _layer.group() || _layer.dimension(); - if (dim || _layer.layerType() === "points" || _layer.layerType() === "lines" || _layer.layerType() === "polys") { - var projExprs = _layer.layerType() === "points" || _layer.layerType() === "lines" || _layer.layerType() === "polys" || _layer.layerType() === "" ? _layer.getProjections() : dim.getProjectOn(true); // handles the group and dimension case - var regex = /^\s*([\s\S]+)\s+as\s+(\S+)/i; - var funcRegex = /^\s*(\S+\s*\(.*\))\s+as\s+(\S+)/i; - for (var i = 0; i < projExprs.length; ++i) { - var projExpr = projExprs[i]; - var regexRtn = projExpr.match(regex); - if (regexRtn) { - if (regexRtn[2] === colAttr) { - if (isMeasureCol(colAttr)) { - // column selector label is used for layer.popupColumns(), so we need to remove it from popupColSet for color/size or x/y measures - var label = _layer.getMeasureLabel(regexRtn); - popupColSet["delete"](regexRtn[1]); - popupColSet["delete"](label); - } else { - popupColSet["delete"](colAttr); - } - colAttr = projExpr; - break; - } - } else if ((regexRtn = projExpr.match(funcRegex)) && regexRtn[2] === colAttr) { - popupColSet["delete"](colAttr); - colAttr = projExpr; - break; - } else if (projExpr && projExpr.replace(/^\s+|\s+$/g, "") === colAttr) { - break; - } - } - } - return popupColSet.add(colAttr.replace(/\n/g, " ")); - } - _layer.getPopupAndRenderColumns = function (chart) { - var popupColsSet = new Set(); - var popupCols = _layer.popupColumns(); - if (popupCols) { - popupCols.forEach(function (colAttr) { - addPopupColumnToSet(colAttr, popupColsSet); - }); - } - _layer._addRenderAttrsToPopupColumnSet(chart, popupColsSet); - var rtnArray = []; - popupColsSet.forEach(function (colName) { - rtnArray.push(colName); - }); - return rtnArray; - }; - - // this function maps hit testing response to popupColumns items - function mapDataViaColumns(data, popupColumns, chart) { - var newData = {}; - var columnSet = new Set(popupColumns); - for (var key in data) { - if (columnSet.has(key)) { - newData[key] = data[key]; - data[key] instanceof Date ? __WEBPACK_IMPORTED_MODULE_10_moment___default()(data[key]).utc() : data[key]; - if (typeof chart.useLonLat === "function" && chart.useLonLat()) { - if (key === "x") { - newData[key] = chart.conv900913To4326X(data[key]); - } else if (key === "y") { - newData[key] = chart.conv900913To4326Y(data[key]); - } - } - } else { - // check response key is size or measure column which is in popupColumns - var dim = _layer.group() || _layer.dimension(); - var projExprs = _layer.layerType() === "points" || _layer.layerType() === "lines" || _layer.layerType() === "polys" || _layer.layerType() === "" ? _layer.getProjections() : dim.getProjectOn(true); - var regex = /^\s*([\s\S]+)\s+as\s+(\S+)/i; - for (var i = 0; i < projExprs.length; ++i) { - var projExpr = projExprs[i]; - var regexRtn = projExpr.match(regex); - // for custom columns, the column label is different than the column value, - // so need to access the measure column label that is passed from immerse here - var label = _layer.getMeasureLabel(regexRtn); - if (columnSet.has(label)) { - newData[label] = data[regexRtn[2]]; - } - } - } - } - return newData; - } - _layer.areResultsValidForPopup = function (results) { - if (!results) { - return false; - } - return _layer._areResultsValidForPopup(results[0]); - }; - function filenameHasExtension() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ""; - var extensions = arguments.length > 1 ? arguments[1] : undefined; - var urlParts = parseUrlParts(url); - var hostAndPath = urlParts === null || urlParts === void 0 ? void 0 : urlParts[5]; - return extensions.some(function (ext) { - var _hostAndPath$toLowerC; - return hostAndPath === null || hostAndPath === void 0 ? void 0 : (_hostAndPath$toLowerC = hostAndPath.toLowerCase()) === null || _hostAndPath$toLowerC === void 0 ? void 0 : _hostAndPath$toLowerC.endsWith(ext); - }); - } - var LinkElement = function LinkElement(href, content) { - return "\n ").concat(content, "\n "); - }; - function renderImageOrLink(_x, _x2, _x3, _x4) { - return _renderImageOrLink.apply(this, arguments); - } - function _renderImageOrLink() { - _renderImageOrLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(chart, url, hyperlink, colVal) { - var sizeBytes, urlContent; - return _regeneratorRuntime().wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - _context2.prev = 0; - _context2.next = 3; - return getImageSize(hyperlink); - case 3: - sizeBytes = _context2.sent; - urlContent = url; - if (sizeBytes > __WEBPACK_IMPORTED_MODULE_11__constants_dc_constants__["a" /* IMAGE_SIZE_LIMIT */]) { - // eslint-disable-next-line no-console - console.info("Image too large to preview, falling back to hyperlink", hyperlink); - } else if (!chart.popupImageEnabled || !chart.popupImageEnabled()) { - // eslint-disable-next-line no-console - console.info("Images preview for popups is disabled"); - } else { - urlContent = "\"Image"); - } - return _context2.abrupt("return", Promise.resolve(LinkElement(hyperlink, urlContent), true)); - case 9: - _context2.prev = 9; - _context2.t0 = _context2["catch"](0); - // eslint-disable-next-line no-console - console.warn("Error creating image preview from column:", colVal, "Error:", _context2.t0); - return _context2.abrupt("return", Promise.resolve(LinkElement(hyperlink, colVal), true)); - case 13: - case "end": - return _context2.stop(); - } - } - }, _callee2, null, [[0, 9]]); - })); - return _renderImageOrLink.apply(this, arguments); - } - function replaceURL(chart, columnValue) { - var urlRegExpr = /(((https?:\/\/)|(www\.))[^\s^<>'"”`]+)/g; - var urlMatch = typeof columnValue === "string" && columnValue.match(urlRegExpr); - if (urlMatch) { - return replaceAsync(columnValue, urlRegExpr, /*#__PURE__*/function () { - var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) { - var hyperlink; - return _regeneratorRuntime().wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - hyperlink = url; - if (!hyperlink.match("^https?://")) { - hyperlink = "http://" + hyperlink; - } - if (!filenameHasExtension(hyperlink, Object.values(__WEBPACK_IMPORTED_MODULE_13__constants_file_types__["a" /* IMAGE_EXTENSIONS */]))) { - _context.next = 6; - break; - } - return _context.abrupt("return", renderImageOrLink(chart, hyperlink, url, columnValue)); - case 6: - return _context.abrupt("return", Promise.resolve(columnValue.replace(urlRegExpr, function (url) { - return LinkElement(hyperlink, url); - }), true)); - case 7: - case "end": - return _context.stop(); - } - } - }, _callee); - })); - return function (_x5) { - return _ref.apply(this, arguments); - }; - }()); - } else { - // Return raw column value, no transformation - return Promise.resolve(columnValue); - } - } - function renderPopupHTML(_x6, _x7, _x8, _x9, _x10) { - return _renderPopupHTML.apply(this, arguments); - } - function _renderPopupHTML() { - _renderPopupHTML = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(chart, data, columnOrder, columnMap, formatMeasureValue) { - var formattedColumnPromises; - return _regeneratorRuntime().wrap(function _callee3$(_context3) { - while (1) { - switch (_context3.prev = _context3.next) { - case 0: - formattedColumnPromises = columnOrder.map(function (key) { - if (typeof data[key] === "undefined") { - return ""; - } - var columnKey = columnMap && columnMap[key] ? columnMap[key] : key; - var columnKeyTrimmed = columnKey.replace(/.*\((.*)\).*/, "$1"); - var columnValue = formatMeasureValue(data[key], columnKeyTrimmed); - return replaceURL(chart, columnValue).then(function (formattedColumn, isLink) { - var columnHtml = "
\n \n ").concat(columnKey, ":\n \n \n ").concat(formattedColumn, "\n \n
\n "); - return columnHtml; - }); - }); - return _context3.abrupt("return", Promise.all(formattedColumnPromises).then(function (formattedColumns) { - var html = "\n
\n \n \n \n
\n
\n ").concat(formattedColumns.join("\n"), "\n
\n "); - return html; - })); - case 2: - case "end": - return _context3.stop(); - } - } - }, _callee3); - })); - return _renderPopupHTML.apply(this, arguments); - } - var getPopupContentForNode = function getPopupContentForNode(node) { - var _node$getElementsByTa; - var imageElement = node.nodeType !== 3 /* just text */ && ((_node$getElementsByTa = node.getElementsByTagName("img")) === null || _node$getElementsByTa === void 0 ? void 0 : _node$getElementsByTa[0]); - if (imageElement) { - var _node$getElementsByCl; - // Copy the key and value, but use the data-popupcontent attribute for the image - var wrapperElement = document.createElement("div"); - var valElement = document.createElement("span"); - valElement.setHTML(imageElement.getAttribute(_popup_content_attr)); - var keyElement = (_node$getElementsByCl = node.getElementsByClassName(_popup_item_key_class)) === null || _node$getElementsByCl === void 0 ? void 0 : _node$getElementsByCl[0]; - if (keyElement) { - wrapperElement.appendChild(keyElement.cloneNode(true)); - } - wrapperElement.appendChild(valElement); - return wrapperElement; - } else { - var textNode = document.createElement("span"); - textNode.appendChild(node.cloneNode(true)); - return textNode; - } - }; - // Copy from popup content - var copyPopupContent = function copyPopupContent() { - var _document$getElements; - var copyRange = document.createRange(); - var nodesToCopy = (_document$getElements = document.getElementsByClassName(_popup_box_item_wrap_class)[0]) === null || _document$getElements === void 0 ? void 0 : _document$getElements.childNodes; - if (!nodesToCopy || !nodesToCopy.length) { - return; - } - - // Copies elements from popup to a new element, where it can grab specific - // attributes or other content from the nodes - var copyDummy = document.createElement("div"); - copyDummy.style.position = "fixed"; - // Copy the things - nodesToCopy.forEach(function (node) { - copyDummy.appendChild(getPopupContentForNode(node)); - }); - document.body.appendChild(copyDummy); - copyRange.setStartBefore(copyDummy.childNodes[0]); - copyRange.setEndAfter(copyDummy.childNodes[copyDummy.childNodes.length - 1]); - window.getSelection().removeAllRanges(); - window.getSelection().addRange(copyRange); - document.execCommand("copy"); - document.body.removeChild(copyDummy); - window.getSelection().removeAllRanges(); - }; - _layer.displayPopup = function (chart, parentElem, result, minPopupArea, animate) { - // hit testing response includes color or size measure's result as "color" or "size" - var data = result.row_set[0]; - - // popupColumns have color or size measure label - var popupColumns = _layer.popupColumns(); - var mappedColumns = _layer.popupColumnsMapped(); - var filteredData = mapDataViaColumns(data, popupColumns, chart); - var width = typeof chart.effectiveWidth === "function" ? chart.effectiveWidth() : chart.width(); - var height = typeof chart.effectiveHeight === "function" ? chart.effectiveHeight() : chart.height(); - var margins = typeof chart.margins === "function" ? chart.margins() : { - left: 0, - right: 0, - top: 0, - bottom: 0 - }; - var xscale = chart.x(); - var yscale = chart.y(); - var origXRange = xscale.range(); - var origYRange = yscale.range(); - xscale.range([0, width]); - yscale.range([0, height]); - var hoverSvgProps = { - chart: chart, - parentElem: parentElem, - data: data, - width: width, - height: height, - margins: margins, - xscale: xscale, - yscale: yscale, - minPopupArea: minPopupArea, - animate: animate - }; - var bounds = _layer._displayPopup(hoverSvgProps); - - // restore the original ranges so we don't screw anything else up - xscale.range(origXRange); - yscale.range(origYRange); - var boundsCtr = __WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].getCenter(__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["Point2d"].create(), bounds); - var overlapBounds = __WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].create(0, 0, width, height); - __WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].intersection(overlapBounds, overlapBounds, bounds); - if (__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].isEmpty(overlapBounds)) { - // there is no overlap with the two bounds, we should - // never get here - throw new Error("Found a non-overlapping bounds for a pop-up shape and its parent div"); - } - var overlapSz = __WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].getSize(__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["Point2d"].create(), overlapBounds); - var overlapCtr = __WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].getCenter(__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["Point2d"].create(), overlapBounds); - var padding = 6; // in pixels TODO(croot): expose in css? - var topOffset = 0; - var popupDiv = parentElem.append("div").style({ - left: boundsCtr[0] + "px", - top: boundsCtr[1] + "px" - }); - popupDiv.classed(_popup_wrap_class, true); - - // Puts it on a bit of a delay to avoid showing - // it below a certain threshold. This flag determines if - // popup promises have completed before this timeout block runs - var alreadyLoaded = false; - setTimeout(function () { - if (!alreadyLoaded) { - // Add loader while we async determine the popup html - popupDiv.classed("popup-loading", true); - popupDiv.append("div").attr("class", _popup_box_class).style({ - "min-width": "48px", - "min-height": "48px" - }).append("div").classed("main-loading-icon", true).style({ - height: "32px", - width: "32px" - }); - } - }, 300); - _layerPopups[chart] = popupDiv; - if (animate) { - popupDiv.classed("showPopup", true); - } - var popupData = _layer.popupFunction() ? _layer.popupFunction(filteredData, popupColumns, mappedColumns) : renderPopupHTML(chart, filteredData, popupColumns, mappedColumns, chart.measureValue); - Promise.resolve(popupData).then(function (popupHtml) { - alreadyLoaded = true; - var popupContent = parentElem.select(".".concat(_popup_wrap_class)); - popupContent.classed("popup-loading", false); - popupContent.selectAll("*").remove(); - var popupBox = popupContent.append("div").attr("class", _popup_box_class).html(popupHtml).style("left", function () { - var rect = d3.select(this).node().getBoundingClientRect(); - var boxWidth = rect.width; - var halfBoxWidth = boxWidth / 2; - var boxHeight = rect.height; - var halfBoxHeight = boxHeight / 2; - - // check top first - var left = 0; - var hDiff = 0, - wDiff = 0; - if (overlapSz[0] >= boxWidth || boundsCtr[0] + halfBoxWidth < width && boundsCtr[0] - halfBoxWidth >= 0) { - left = boundsCtr[0] - overlapCtr[0]; - hDiff = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MINY] - boxHeight; - if (hDiff >= 0) { - // can fit on top of shape and in the center of the shape horizontally - topOffset = -(boundsCtr[1] - overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MINY] + Math.min(padding, hDiff) + halfBoxHeight); - return left + "px"; - } - hDiff = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MAXY] + boxHeight; - if (hDiff < height) { - // can fit on bottom and in the center of the shape horizontally - topOffset = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MAXY] - boundsCtr[1] + Math.min(padding, hDiff) + halfBoxHeight; - return left + "px"; - } - } - if (overlapSz[1] >= boxHeight || boundsCtr[1] + halfBoxHeight < height && boundsCtr[1] - halfBoxHeight >= 0) { - topOffset = overlapCtr[1] - boundsCtr[1]; - wDiff = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MINX] - boxWidth; - if (wDiff >= 0) { - // can fit on the left in the center of the shape vertically - left = -(boundsCtr[0] - overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MINX] + Math.min(padding, wDiff) + halfBoxWidth); - return left + "px"; - } - wDiff = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MAXX] + boxWidth; - if (wDiff < width) { - // can fit on right in the center of the shape vertically - left = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MAXX] - boundsCtr[0] + Math.min(padding, wDiff) + halfBoxWidth; - return left + "px"; - } - } - if (width - overlapSz[0] >= boxWidth && height - overlapSz[1] >= boxHeight) { - // we can fit the popup box in the remaining negative space. - // Let's figure out where exactly - if (Math.abs(boxHeight - overlapSz[1]) < Math.abs(boxWidth - overlapSz[0])) { - hDiff = height - overlapSz[1] - boxHeight; - if (overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MINY] < height - overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MAXY]) { - topOffset = Math.min(padding, hDiff) + halfBoxHeight - boundsCtr[1]; - } else { - topOffset = height - Math.min(padding, hDiff) - halfBoxHeight - boundsCtr[1]; - } - wDiff = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MINX] - boxWidth; - if (wDiff >= 0) { - // can fit on the left of the bounds - left = -(boundsCtr[0] - overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MINX] + Math.min(padding, wDiff) + halfBoxWidth); - } else { - wDiff = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MAXX] + boxWidth; - // can fit on right right of the bounds - left = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MAXX] - boundsCtr[0] + Math.min(padding, wDiff) + halfBoxWidth; - } - return left + "px"; - } else { - wDiff = width - overlapSz[0] - boxWidth; - if (overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MINX] < width - overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MAXX]) { - left = Math.min(padding, wDiff) + halfBoxWidth - boundsCtr[0]; - } else { - left = width - Math.min(padding, wDiff) - halfBoxWidth - boundsCtr[0]; - } - hDiff = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MINY] - boxHeight; - if (hDiff >= 0) { - // can fit on top of shape and in the center of the shape horizontally - topOffset = -(boundsCtr[1] - overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MINY] + Math.min(padding, hDiff) + halfBoxHeight); - } else { - hDiff = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MAXY] + boxHeight; - // can fit on bottom and in the center of the shape horizontally - topOffset = overlapBounds[__WEBPACK_IMPORTED_MODULE_9__heavyai_draw_dist_draw__["AABox2d"].MAXY] - boundsCtr[1] + Math.min(padding, hDiff) + halfBoxHeight; - } - return left + "px"; - } - } - if (boxWidth * boxHeight < overlapSz[0] * overlapSz[1]) { - // use the center of the overlapping bounds in the case where the box - // can't fit anwhere on the outside - topOffset = overlapCtr[1] - boundsCtr[1]; - left = overlapCtr[0] - boundsCtr[0]; - } else { - // use the center of the screen - topOffset = height / 2 - boundsCtr[1]; - left = width / 2 - boundsCtr[0]; - } - return left + "px"; - }).style("top", function () { - return topOffset + "px"; - }); - var popupCopyIcon = document.getElementsByClassName(_popup_item_copy_class).item(0); - - // eslint-disable-next-line no-unused-expressions - popupCopyIcon === null || popupCopyIcon === void 0 ? void 0 : popupCopyIcon.addEventListener("click", function () { - copyPopupContent(); - }); - _layerPopups[chart] = popupBox; - if (animate) { - popupDiv.classed("showPopup", true); - } - })["catch"](function (e) { - alreadyLoaded = true; - // eslint-disable-next-line no-console - console.warn("Error generating popup data", e); - }); - }; - _layer.isPopupDisplayed = function (chart) { - return _layerPopups[chart] !== undefined; - }; - _layer.hidePopup = function (chart, hideCallback) { - if (_layerPopups[chart]) { - var popup = chart.select(".".concat(_popup_wrap_class, ":not(.popup-loading)")); - if (popup) { - popup.classed("removePopup", true).on("animationend", function () { - delete _layerPopups[chart]; - hideCallback(chart); - }); - } - _layer._hidePopup(chart); - } - }; - _layer.destroyLayer = function (chart) { - // need to define a "_destroyLayer" method for each - // layer mixin - _layer._destroyLayer(chart); - }; - _layer._addQueryDrivenRenderPropToSet = function (setObj, markPropObj, prop) { - if (_typeof(markPropObj[prop]) !== "object") { - return; - } - if (typeof markPropObj[prop].field !== "string") { - return; - } - var queryAttr = markPropObj[prop].field; - addPopupColumnToSet(queryAttr, setObj); - return setObj; - }; - return _layer; -} - -/***/ }), -/* 419 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = rasterLayerLineMixin; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_core_async__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_utils__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_d3__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_utils_contour__ = __webpack_require__(262); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -/* eslint-disable complexity */ - - - - - -var AUTOSIZE_DOMAIN_DEFAULTS = [100000, 1000]; -var AUTOSIZE_RANGE_DEFAULTS = [1.0, 3.0]; -var AUTOSIZE_RANGE_MININUM = [1, 1]; -var SIZING_THRESHOLD_FOR_AUTOSIZE_RANGE_MININUM = 100000; -function getSizing(sizeAttr, cap) { - var lastFilteredSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : cap; - var pixelRatio = arguments.length > 3 ? arguments[3] : undefined; - var layerName = arguments.length > 4 ? arguments[4] : undefined; - if (typeof sizeAttr === "number") { - return sizeAttr; - } else if (_typeof(sizeAttr) === "object" && (sizeAttr.type === "quantitative" || sizeAttr.type === "custom")) { - return { - scale: Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["h" /* getSizeScaleName */])(layerName), - field: "strokeWidth" - }; - } else if (sizeAttr === "auto") { - var size = Math.min(lastFilteredSize, cap); - var dynamicRScale = __WEBPACK_IMPORTED_MODULE_3_d3__["scale"].sqrt().domain(AUTOSIZE_DOMAIN_DEFAULTS).range(size > SIZING_THRESHOLD_FOR_AUTOSIZE_RANGE_MININUM ? AUTOSIZE_RANGE_MININUM : AUTOSIZE_RANGE_DEFAULTS).clamp(true); - return Math.round(dynamicRScale(size) * pixelRatio); - } else { - return null; - } -} -function getColor(color, layerName) { - if (_typeof(color) === "object" && color.type === "density") { - return { - scale: Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["e" /* getColorScaleName */])(layerName), - value: 0 - }; - } else if (_typeof(color) === "object" && (color.type === "ordinal" || color.type === "quantitative")) { - return { - scale: Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["e" /* getColorScaleName */])(layerName), - field: "strokeColor" - }; - } else if (_typeof(color) === "object") { - return Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["b" /* adjustOpacity */])(color.value, color.opacity); - } else { - return color; - } -} -function rasterLayerLineMixin(_layer) { - var state = null; - _layer.colorDomain = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, null); - _layer.sizeDomain = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, null); - _layer.setState = function (setter) { - if (typeof setter === "function") { - state = setter(state); - } else { - state = setter; - } - if (!state.hasOwnProperty("transform")) { - state.transform = {}; - } - return _layer; - }; - _layer.getState = function () { - return state; - }; - function doJoin() { - return state.data.length > 1; - } - _layer.getTransforms = function (table, filter, globalFilter, state, lastFilteredSize, isDataExport) { - var transforms = []; - var transform = state.transform; - var _state$encoding = state.encoding, - size = _state$encoding.size, - color = _state$encoding.color, - geocol = _state$encoding.geocol, - geoTable = _state$encoding.geoTable; - var rowIdTable = doJoin() ? state.data[1].table : state.data[0].table; - var fields = []; - var alias = []; - var ops = []; - var isJoin = _layer.crossfilter().getTables().length > 1; - // Adds /*+ cpu_mode */ in data export query since we are limiting to some number of rows. - var groupbyDim = state.transform.groupby ? state.transform.groupby.map(function (g, i) { - return { - type: "project", - expr: "".concat(isDataExport && i === 0 ? "/*+ cpu_mode */ " : "").concat(state.data[0].table, ".").concat(g), - as: "key".concat(i) - }; - }) : []; - var groupby = doJoin() ? [{ - type: "project", - expr: "".concat(state.data[0].table, ".").concat(state.data[0].attr), - as: "key0" - }] : groupbyDim; - var colorProjection = groupby.length && color.type === "quantitative" ? __WEBPACK_IMPORTED_MODULE_2__utils_utils__["i" /* parser */].parseExpression(color.aggregate) : "SAMPLE(".concat(rowIdTable, ".").concat(color.field, ")"); - if (groupby.length > 0) { - transforms.push({ - type: "aggregate", - fields: fields, - ops: ops, - as: alias, - groupby: groupby - }); - transforms.push({ - type: "project", - expr: "LAST_SAMPLE(".concat(rowIdTable, ".rowid)"), - as: "rowid" - }); - transforms.push({ - type: "project", - expr: "SAMPLE(".concat(geoTable, ".").concat(geocol, ")"), - as: "sampled_geo" - }); - } else if (isJoin) { - // Group by geometry by assuming all rows are a unique - // geometry, and grouping by rowid - transforms.push({ - type: "aggregate", - fields: [], - ops: [null], - as: [], - groupby: "".concat(geoTable, ".rowid") - }); - - // Select any_value, as the original col name - transforms.push({ - type: "project", - expr: "ANY_VALUE(".concat(geoTable, ".").concat(geocol, ")"), - as: geocol - }); - } else { - transforms.push({ - type: "project", - expr: "".concat(isDataExport ? "/*+ cpu_mode */ " : "").concat(geoTable, ".").concat(geocol) - }); - } - if (_typeof(size) === "object" && (size.type === "quantitative" || size.type === "custom")) { - if (groupby.length > 0 && size.type === "quantitative") { - fields.push("".concat(state.data[0].table, ".").concat(size.field)); - alias.push("strokeWidth"); - ops.push(size.aggregate); - } else { - transforms.push({ - type: "project", - expr: size.field, - as: "strokeWidth" - }); - } - } - if (_typeof(color) === "object" && (color.type === "quantitative" || color.type === "ordinal")) { - if (groupby.length > 0 && color.colorMeasureAggType !== "Custom") { - fields.push(colorProjection); - alias.push("strokeColor"); - ops.push(null); - } else { - var expression = color.field || color.aggregate; - transforms.push({ - type: "project", - expr: expression, - as: "strokeColor" - }); - } - } - if (doJoin()) { - transforms.push({ - type: "filter", - expr: "".concat(state.data[0].table, ".").concat(state.data[0].attr, " = ").concat(state.data[1].table, ".").concat(state.data[1].attr) - }); - } - if (typeof transform.limit === "number") { - if (transform.sample && !doJoin()) { - // use Knuth's hash sampling on single data source chart - transforms.push({ - type: "sample", - method: "multiplicative", - size: lastFilteredSize || transform.tableSize, - limit: transform.limit, - sampleTable: geoTable - }); - } else { - // when geo join is applied, we won't use Knuth's sampling but use LIMIT - transforms.push({ - type: "limit", - row: transform.limit - }); - } - } - if (typeof filter === "string" && filter.length) { - transforms.push({ - type: "filter", - expr: filter - }); - } - if (typeof globalFilter === "string" && globalFilter.length) { - transforms.push({ - type: "filter", - expr: globalFilter - }); - } - return transforms; - }; - _layer.getProjections = function () { - return _layer.getTransforms("", "", "", state, Object(__WEBPACK_IMPORTED_MODULE_1__core_core_async__["g" /* lastFilteredSize */])(_layer.crossfilter().getId())).filter(function (transform) { - return transform.type === "project" && transform.hasOwnProperty("as"); - }).map(function (projection) { - return __WEBPACK_IMPORTED_MODULE_2__utils_utils__["i" /* parser */].parseTransform({ - select: [] - }, projection); - }).map(function (sql) { - return sql.select[0]; - }); - }; - function getAutoColorVegaTransforms(data, layerName, statsLayerName) { - var aggregateNode = { - type: "aggregate", - fields: [], - ops: [], - as: [] - }; - var transforms = [aggregateNode]; - if (state.encoding.color.type === "quantitative") { - aggregateNode.fields = aggregateNode.fields.concat(["strokeColor", "strokeColor", "strokeColor", "strokeColor"]); - aggregateNode.ops = aggregateNode.ops.concat(["min", "max", "avg", "stddev"]); - aggregateNode.as = aggregateNode.as.concat(["mincol", "maxcol", "avgcol", "stdcol"]); - transforms.push({ - type: "formula", - expr: "max(mincol, avgcol-2*stdcol)", - as: "mincolor" - }, { - type: "formula", - expr: "min(maxcol, avgcol+2*stdcol)", - as: "maxcolor" - }); - } else if (state.encoding.color.type === "ordinal") { - // will be used when we support auto for ordinal color type - aggregateNode.fields.push("color"); - aggregateNode.ops.push("distinct"); - aggregateNode.as.push("distinctcolor"); - } - data.push({ - name: statsLayerName, - source: layerName, - transform: transforms - }); - } - function usesAutoColors() { - return state.encoding.color && state.encoding.color.domain === "auto"; - } - _layer._updateFromMetadata = function (metadata) { - var layerName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; - if (usesAutoColors() && Array.isArray(metadata.scales)) { - var colorScaleName = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["e" /* getColorScaleName */])(layerName); - var _iterator = _createForOfIteratorHelper(metadata.scales), - _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var scale = _step.value; - if (scale.name === colorScaleName) { - _layer.colorDomain(scale.domain); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } - }; - _layer.__genVega = function (_ref) { - var chart = _ref.chart, - table = _ref.table, - filter = _ref.filter, - lastFilteredSize = _ref.lastFilteredSize, - globalFilter = _ref.globalFilter, - pixelRatio = _ref.pixelRatio, - layerName = _ref.layerName, - useProjection = _ref.useProjection; - var autocolors = usesAutoColors(); - var getStatsLayerName = function getStatsLayerName() { - return layerName + "_stats"; - }; - var state = _layer.getState(); - var size = getSizing(state.encoding.size, state.transform && state.transform.limit, lastFilteredSize, pixelRatio, layerName); - var sql; - if (Object(__WEBPACK_IMPORTED_MODULE_4__utils_utils_contour__["e" /* isContourType */])(state)) { - Object(__WEBPACK_IMPORTED_MODULE_4__utils_utils_contour__["f" /* validateContourState */])(state); - var filterTransforms = _layer.getTransforms(table, filter, globalFilter, state, lastFilteredSize).filter(function (f) { - return f.type === "filter"; - }); - var bboxFilter = Object(__WEBPACK_IMPORTED_MODULE_4__utils_utils_contour__["b" /* getContourBoundingBox */])(state.data[0], chart.map().getBounds()); - filterTransforms.push({ - type: "filter", - expr: bboxFilter - }); - sql = Object(__WEBPACK_IMPORTED_MODULE_4__utils_utils_contour__["a" /* buildOptimizedContourSQL */])({ - state: state, - filterTransforms: filterTransforms - }); - } else { - var source = doJoin() ? _toConsumableArray(new Set(state.data.map(function (source) { - return source.table; - }))).join(", ") : table; - sql = __WEBPACK_IMPORTED_MODULE_2__utils_utils__["i" /* parser */].writeSQL({ - type: "root", - source: source, - transform: _layer.getTransforms(table, filter, globalFilter, state, lastFilteredSize) - }); - } - var data = [{ - name: layerName, - format: "lines", - sql: sql, - enableHitTesting: state.enableHitTesting - }]; - var scaledomainfields = {}; - if (autocolors) { - getAutoColorVegaTransforms(data, layerName, getStatsLayerName()); - if (state.encoding.color.type === "quantitative") { - scaledomainfields.color = ["mincolor", "maxcolor"]; - } else if (state.encoding.color.type === "ordinal") { - // will be used when we support auto for ordinal color type - scaledomainfields.color = ["distinctcolor"]; - } - } - var scales; - if (Object(__WEBPACK_IMPORTED_MODULE_4__utils_utils_contour__["e" /* isContourType */])(state)) { - scales = Object(__WEBPACK_IMPORTED_MODULE_4__utils_utils_contour__["d" /* getContourScales */])(layerName, state.encoding); - } else { - scales = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["g" /* getScales */])(state.encoding, layerName, scaledomainfields, getStatsLayerName()); - } - var marks; - if (Object(__WEBPACK_IMPORTED_MODULE_4__utils_utils_contour__["e" /* isContourType */])(state)) { - marks = Object(__WEBPACK_IMPORTED_MODULE_4__utils_utils_contour__["c" /* getContourMarks */])(layerName, state); - } else { - marks = [{ - type: "lines", - from: { - data: layerName - }, - properties: Object.assign({}, { - x: { - field: "x" - }, - y: { - field: "y" - }, - strokeColor: getColor(state.encoding.color, layerName), - strokeWidth: size, - lineJoin: _typeof(state.mark) === "object" ? state.mark.lineJoin : "bevel" - }) - }]; - } - if (useProjection) { - marks[0].transform = { - projection: "mercator_map_projection" - }; - } else { - marks[0].properties.x.scale = "x"; - marks[0].properties.y.scale = "y"; - } - return { - data: data, - scales: scales, - marks: marks - }; - }; - _layer.viewBoxDim = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, null); - - // linemap bbox filter gets broken if these are set for its layer, but contour - // needs them to be set for its bbox filter; therefore wrap in a method that - // can be called from contour setup prior to setting vals - _layer.initializeXYDims = function () { - _layer.xDim = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, null); - _layer.yDim = Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, null); - }; - Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["d" /* createVegaAttrMixin */])(_layer, "size", 3, 1, true); - var _vega = null; - var _minMaxCache = {}; - var _cf = null; - _layer.crossfilter = function (cf) { - if (!arguments.length) { - return _cf; - } - _cf = cf; - return _layer; - }; - _layer._requiresCap = function () { - return false; - }; - _layer._genVega = function (chart, layerName, group, query) { - // needed to set LastFilteredSize when linemap map first initialized - if (_layer.viewBoxDim()) { - _layer.viewBoxDim().groupAll().valueAsync().then(function (value) { - Object(__WEBPACK_IMPORTED_MODULE_1__core_core_async__["o" /* setLastFilteredSize */])(_layer.crossfilter().getId(), value); - }); - } - _vega = _layer.__genVega({ - chart: chart, - layerName: layerName, - table: _layer.crossfilter().getDataSource(), - filter: _layer.crossfilter().getFilterString(layerName), - globalFilter: _layer.crossfilter().getGlobalFilterString(), - lastFilteredSize: Object(__WEBPACK_IMPORTED_MODULE_1__core_core_async__["g" /* lastFilteredSize */])(_layer.crossfilter().getId()), - pixelRatio: chart._getPixelRatio(), - useProjection: chart.useGeoTypes() - }); - return _vega; - }; - _layer._addRenderAttrsToPopupColumnSet = function (chart, popupColsSet) { - if (chart.useGeoTypes()) { - if (state.encoding.geocol && state.transform.groupby && state.transform.groupby.length) { - popupColsSet.add("sampled_geo"); - } else if (state.encoding.geocol) { - popupColsSet.add(state.encoding.geocol); - } - } - if (_vega && Array.isArray(_vega.marks) && _vega.marks.length > 0 && _vega.marks[0].properties) { - __WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["i" /* renderAttributes */].forEach(function (rndrProp) { - if (rndrProp !== "x" && rndrProp !== "y") { - _layer._addQueryDrivenRenderPropToSet(popupColsSet, _vega.marks[0].properties, rndrProp); - } - }); - } - }; - _layer._areResultsValidForPopup = function (results) { - return Boolean(state.encoding.geocol && (results[state.encoding.geocol] || results.sampled_geo)); - }; - _layer._displayPopup = function (svgProps) { - return Object(__WEBPACK_IMPORTED_MODULE_0__utils_utils_vega__["a" /* __displayPopup */])(_objectSpread(_objectSpread({}, svgProps), {}, { - _vega: _vega, - _layer: _layer, - state: state - })); - }; - var _scaledPopups = {}; - _layer._hidePopup = function (chart, hideCallback) { - var mapPoly = chart.select(".map-polyline"); - if (mapPoly) { - if (_scaledPopups[chart]) { - mapPoly.classed("removePoly", true); - } else { - mapPoly.classed("fadeOutPoly", true); - // mapPoly.attr('transform', 'scale(0, 0)'); - } - - if (hideCallback) { - mapPoly.on("animationend", function () { - hideCallback(chart); - }); - } - delete _scaledPopups[chart]; - } - }; - _layer._destroyLayer = function (chart) { - var viewBoxDim = _layer.viewBoxDim(); - if (viewBoxDim) { - viewBoxDim.dispose(); - } - }; - return _layer; -} - -/***/ }), -/* 420 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = rasterLayerCrossSectionTerrainMixin; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_assert__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_utils__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__core_core_async__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_utils_vega__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__raster_layer_point_mixin__ = __webpack_require__(32); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__render_vega_lite_RasterLayerContext__ = __webpack_require__(27); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__render_vega_lite_PropDescriptor_CommonChannelDescriptors__ = __webpack_require__(22); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__render_vega_lite_PropDescriptor_BaseTypes_StringPropDescriptor__ = __webpack_require__(421); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__render_vega_lite_PropDescriptor_BaseTypes_NumericPropDescriptor__ = __webpack_require__(45); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__render_vega_lite_PropDescriptor_BaseTypes_NumericPropValidators__ = __webpack_require__(46); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__render_vega_lite_Definitions_Mark_CrossSectionTerrainConfigDefinitionObject__ = __webpack_require__(248); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__render_vega_lite_RenderVegaLite__ = __webpack_require__(62); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__render_vega_lite_VegaPropertyOutputState__ = __webpack_require__(23); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } -function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - - - - - - - - - - - - - - -// only used for jsdoc -// eslint-disable-next-line no-unused-vars - -function createPostFilterTransform(post_filters) { - var post_filter = post_filters && Array.isArray(post_filters) ? post_filters[0] : null; // may change to map when we have more than one postFilter - if (post_filter && Object(__WEBPACK_IMPORTED_MODULE_5__raster_layer_point_mixin__["c" /* isValidPostFilter */])(post_filter)) { - return { - type: "postFilter", - table: post_filter.table || null, - aggType: post_filter.aggType, - custom: post_filter.custom, - fields: [post_filter.value], - ops: post_filter.operator, - min: post_filter.min, - max: post_filter.max - }; - } - return null; -} -function rasterLayerCrossSectionTerrainMixin(_layer) { - var state = null; - var yScaleName = "y"; - - /** - * @type {VegaPropertyOutputState} - */ - var _vega_property_output_state = null; - _layer.setState = function (setter) { - if (typeof setter === "function") { - state = setter(state); - } else { - state = setter; - } - return _layer; - }; - _layer.getState = function () { - return state; - }; - _layer.setYScaleName = function (setter) { - if (typeof setter === "function") { - yScaleName = setter(yScaleName); - } else { - yScaleName = setter; - } - return _layer; - }; - _layer._getYScaleName = function () { - return yScaleName; - }; - - // NOTE: as of 11/14/22 the "getTransforms" method that is found in most of the other raster layer mixin classes - // only seems to be called from immerse via the buildRasterExportSql() method in raster-sql.ts - // - // It is not currently believed that terrain layer marks need to support export, so the "getTransforms" method is not - // going to be included - - var prop_descriptors = new Map(); - prop_descriptors.set("x", new __WEBPACK_IMPORTED_MODULE_7__render_vega_lite_PropDescriptor_CommonChannelDescriptors__["d" /* PositionChannelDescriptor */]("x")); - prop_descriptors.set("y", new __WEBPACK_IMPORTED_MODULE_7__render_vega_lite_PropDescriptor_CommonChannelDescriptors__["d" /* PositionChannelDescriptor */]("y")); - prop_descriptors.set("longitude", new __WEBPACK_IMPORTED_MODULE_7__render_vega_lite_PropDescriptor_CommonChannelDescriptors__["b" /* GeographicChannelDescriptor */]("longitude", "x")); - prop_descriptors.set("latitude", new __WEBPACK_IMPORTED_MODULE_7__render_vega_lite_PropDescriptor_CommonChannelDescriptors__["b" /* GeographicChannelDescriptor */]("latitude", "y")); - prop_descriptors.set("strokeColor", new __WEBPACK_IMPORTED_MODULE_8__render_vega_lite_PropDescriptor_BaseTypes_StringPropDescriptor__["a" /* default */]("strokeColor", null, __WEBPACK_IMPORTED_MODULE_7__render_vega_lite_PropDescriptor_CommonChannelDescriptors__["f" /* PropLocation */].kMarkDefOnly, null, false)); - prop_descriptors.set("strokeWidth", new __WEBPACK_IMPORTED_MODULE_9__render_vega_lite_PropDescriptor_BaseTypes_NumericPropDescriptor__["b" /* default */]("strokeWidth", null, __WEBPACK_IMPORTED_MODULE_7__render_vega_lite_PropDescriptor_CommonChannelDescriptors__["f" /* PropLocation */].kMarkDefOnly, null, false, __WEBPACK_IMPORTED_MODULE_10__render_vega_lite_PropDescriptor_BaseTypes_NumericPropValidators__["b" /* is_zero_to_one */])); - prop_descriptors.set("fillBelowLine", new __WEBPACK_IMPORTED_MODULE_9__render_vega_lite_PropDescriptor_BaseTypes_NumericPropDescriptor__["b" /* default */]("fillBelowLine", null, __WEBPACK_IMPORTED_MODULE_7__render_vega_lite_PropDescriptor_CommonChannelDescriptors__["f" /* PropLocation */].kMarkDefOnly, null, false, __WEBPACK_IMPORTED_MODULE_10__render_vega_lite_PropDescriptor_BaseTypes_NumericPropValidators__["b" /* is_zero_to_one */])); - prop_descriptors.set("opacity", new __WEBPACK_IMPORTED_MODULE_7__render_vega_lite_PropDescriptor_CommonChannelDescriptors__["c" /* OpacityChannelDescriptor */]("opacity")); - _layer.__genVega = function (_ref) { - var _vega_data_formats$; - var chart = _ref.chart, - table = _ref.table, - filter = _ref.filter, - lastFilteredSize = _ref.lastFilteredSize, - globalFilter = _ref.globalFilter, - layerName = _ref.layerName; - var raster_layer_context = new __WEBPACK_IMPORTED_MODULE_6__render_vega_lite_RasterLayerContext__["a" /* default */](chart, table, __WEBPACK_IMPORTED_MODULE_11__render_vega_lite_Definitions_Mark_CrossSectionTerrainConfigDefinitionObject__["a" /* default */].key, this, layerName, lastFilteredSize); - _vega_property_output_state = Object(__WEBPACK_IMPORTED_MODULE_12__render_vega_lite_RenderVegaLite__["a" /* materializePropDescriptors */])(raster_layer_context, prop_descriptors, state); - var _vega_property_output = _vega_property_output_state.flatten(), - sql_parser_transforms = _vega_property_output.sql_parser_transforms, - vega_data_formats = _vega_property_output.vega_data_formats, - vega_transforms = _vega_property_output.vega_transforms, - vega_scales = _vega_property_output.vega_scales, - mark_properties = _vega_property_output.mark_properties; - __WEBPACK_IMPORTED_MODULE_0_assert___default()(vega_data_formats.length <= 1); - if (typeof filter === "string" && filter.length) { - sql_parser_transforms.push({ - type: "filter", - expr: filter - }); - } - var post_filter_transform = createPostFilterTransform(state.postFilters); - if (post_filter_transform) { - sql_parser_transforms.push(post_filter_transform); - } - if (typeof globalFilter === "string" && globalFilter.length) { - sql_parser_transforms.push({ - type: "filter", - expr: globalFilter - }); - } - var data = [_objectSpread(_objectSpread({ - name: layerName - }, (_vega_data_formats$ = vega_data_formats === null || vega_data_formats === void 0 ? void 0 : vega_data_formats[0]) !== null && _vega_data_formats$ !== void 0 ? _vega_data_formats$ : {}), {}, { - sql: __WEBPACK_IMPORTED_MODULE_1__utils_utils__["i" /* parser */].writeSQL({ - type: "root", - source: table, - transform: sql_parser_transforms - }), - enableHitTesting: state.enableHitTesting - })].concat(_toConsumableArray(vega_transforms)); - var marks = [{ - type: __WEBPACK_IMPORTED_MODULE_11__render_vega_lite_Definitions_Mark_CrossSectionTerrainConfigDefinitionObject__["a" /* default */].key, - from: { - data: layerName - }, - properties: Object.assign.apply(Object, [{}].concat(_toConsumableArray(mark_properties))) - }]; - return { - data: data, - scales: vega_scales, - marks: marks - }; - }; - function isCrossFilterObject(obj) { - if (Object.hasOwn(obj, "type") && Object.hasOwn(obj, "getCrossfilter") && Object.hasOwn(obj, "filter")) { - // is this safe to assume that if these properties exist, then the object - // is a crossfilter-related object? - return true; - } - return false; - } - function createCrossfilterDimensionProxy(range) { - var range_ = _toConsumableArray(range); - return { - type: "crossfilter_dimension_proxy", - getFilter: function getFilter() { - return [range_]; - }, - filter: function filter(new_range) { - range_ = new_range; - }, - dispose: function dispose() {} - }; - } - _layer.xDim = Object(__WEBPACK_IMPORTED_MODULE_4__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, null, function (new_val) { - if (isCrossFilterObject(new_val)) { - return new_val; - } - return createCrossfilterDimensionProxy(new_val); - }); - _layer.yDim = Object(__WEBPACK_IMPORTED_MODULE_4__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, null, function (new_val) { - if (isCrossFilterObject(new_val)) { - return new_val; - } - return createCrossfilterDimensionProxy(new_val); - }); - var _vega = null; - var _cf = null; - _layer.crossfilter = Object(__WEBPACK_IMPORTED_MODULE_4__utils_utils_vega__["c" /* createRasterLayerGetterSetter */])(_layer, _cf); - _layer._genVega = function (chart, layerName) { - var realLayerName = layerName; - _vega = _layer.__genVega({ - chart: chart, - layerName: layerName, - table: _layer.crossfilter().getDataSource(), - filter: _layer.crossfilter().getFilterString(realLayerName), - globalFilter: _layer.crossfilter().getGlobalFilterString(), - lastFilteredSize: Object(__WEBPACK_IMPORTED_MODULE_3__core_core_async__["g" /* lastFilteredSize */])(_layer.crossfilter().getId()), - pixelRatio: chart._getPixelRatio() - }); - return _vega; - }; - _layer.useProjection = function () { - var geographic_props = [prop_descriptors.get("longitude"), prop_descriptors.get("latitude")]; - geographic_props.forEach(function (geographic_prop) { - return __WEBPACK_IMPORTED_MODULE_0_assert___default()(geographic_prop); - }); - return _vega_property_output_state && (_vega_property_output_state.has(geographic_props[0].prop_name) || _vega_property_output_state.has(geographic_props[1].prop_name)); - }; - - // eslint-disable-next-line no-unused-vars - _layer._addRenderAttrsToPopupColumnSet = function (chart, popupColumnsSet) { - // currently no-op - // eslint-disable-next-line no-warning-comments - // TODO(croot): needs to be filled in to support mesh2d hit-testing - }; - - // eslint-disable-next-line no-unused-vars - _layer._areResultsValidForPopup = function (results) { - // eslint-disable-next-line no-warning-comments - // TODO(croot): needs to be filled in to support mesh2d hit-testing - return true; - }; - - // eslint-disable-next-line no-unused-vars - _layer._displayPopup = function (svgProps) { - // currently a no-op - // eslint-disable-next-line no-warning-comments - // TODO(croot): needs to be filled in to support mesh2d hit-testing - return __WEBPACK_IMPORTED_MODULE_2__heavyai_draw_dist_draw__["AABox2d"].create(); - }; - - // eslint-disable-next-line no-unused-vars - _layer._hidePopup = function (chart, hideCallback) { - // currently a no-op - // eslint-disable-next-line no-warning-comments - // TODO(croot): needs to be filled in to support mesh2d hit-testing - }; - _layer._destroyLayer = function () { - var xDim = _layer.xDim(); - if (xDim) { - xDim.dispose(); - } - var yDim = _layer.yDim(); - if (yDim) { - yDim.dispose(); - } - }; - return _layer; -} - -/***/ }), -/* 421 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return StringPropDescriptor; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__PropDescriptor__ = __webpack_require__(19); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } -function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } -function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var StringPropDescriptor = /*#__PURE__*/function (_PropDescriptor) { - _inherits(StringPropDescriptor, _PropDescriptor); - var _super = _createSuper(StringPropDescriptor); - function StringPropDescriptor() { - _classCallCheck(this, StringPropDescriptor); - return _super.apply(this, arguments); - } - _createClass(StringPropDescriptor, [{ - key: "isValidMarkDefinition", - value: - /** - * @param {boolean} prop_definition - */ - function isValidMarkDefinition(prop_definition) { - if (typeof prop_definition !== "string") { - throw new Error("Invalid value ".concat(prop_definition, ". It must be a string")); - } - return true; - } - - /** - * @returns {MeasurementType} - */ - }, { - key: "getDefaultMeasurementType", - value: function getDefaultMeasurementType() { - return __WEBPACK_IMPORTED_MODULE_0__PropDescriptor__["a" /* MeasurementType */].nominal; - } - }]); - return StringPropDescriptor; -}(__WEBPACK_IMPORTED_MODULE_0__PropDescriptor__["c" /* default */]); - - -/***/ }), -/* 422 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IMAGE_EXTENSIONS; }); -var IMAGE_EXTENSIONS = { - JP2: ".jp2", - TIF: ".tif", - TIFF: ".tiff", - APNG: ".apng", - PNG: ".png", - GIF: ".gif", - JPEG: ".jpeg", - JPG: ".jpg", - WEBP: ".webp", - AVIF: ".avif", - JFIF: ".jfif", - PJPEG: ".pjpeg", - PJP: ".pjp", - SVG: ".svg", - BMP: ".bmp" -}; - -/***/ }), -/* 423 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = rasterMixin; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_core__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_core_async__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_utils__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_d3__); - - - - -function rasterMixin(_chart) { - var _con = window.hasOwnProperty("con") ? con : null; - var _sampling = false; - var _tableName = null; - var _popupColumns = []; - var _popupColumnsMapped = {}; - var _popupSearchRadius = 2; - var _popupFunction = null; - var _colorBy = null; - var _sizeBy = null; - var _showColorByInPopup = false; - var _mouseLeave = false; // used by displayPopup to maybe return early - var _minMaxCache = {}; - var _crossfilter = null; - var _data_events = ["preData"]; - var _listeners = __WEBPACK_IMPORTED_MODULE_3_d3___default.a.dispatch.apply(__WEBPACK_IMPORTED_MODULE_3_d3___default.a, _data_events); - var _on = _chart.on.bind(_chart); - var _popupDisplayable = true; - _chart.popupDisplayable = function (displayable) { - _popupDisplayable = Boolean(displayable); - }; - _chart.on = function (event, listener) { - if (_data_events.indexOf(event) === -1) { - _on(event, listener); - } else { - _listeners.on(event, listener); - } - return _chart; - }; - _chart._invokePreDataListener = function (f) { - if (f !== "undefined") { - _listeners.preData(_chart, f); - } - }; - _chart.getMinMax = function (value) { - if (_minMaxCache[value]) { - return Promise.resolve(_minMaxCache[value]); - } - return _chart.crossfilter().groupAll().reduce([{ - expression: value, - agg_mode: "min", - name: "minimum" - }, { - expression: value, - agg_mode: "max", - name: "maximum" - }]).valuesAsync(true).then(function (bounds) { - _minMaxCache[value] = [bounds.minimum, bounds.maximum]; - return _minMaxCache[value]; - }); - }; - _chart.getTopValues = function (value) { - var NUM_TOP_VALUES = 10; - var OFFSET = 0; - if (_minMaxCache[value]) { - return Promise.resolve(_minMaxCache[value]); - } - return _chart.crossfilter().dimension(value).order("val").group().reduceCount(value).topAsync(NUM_TOP_VALUES, OFFSET, null, true).then(function (results) { - return results.map(function (result) { - return result.key0; - }); - }); - }; - _chart.crossfilter = function (_) { - if (!arguments.length) { - return _crossfilter; - } - _crossfilter = _; - return _chart; - }; - _chart.xRangeFilter = function (range) { - if (!_chart.xDim()) { - throw new Error("Must set xDim before invoking xRange"); - } - var xValue = _chart.xDim().value()[0]; - if (!arguments.length) { - return _minMaxCache[xValue]; - } - _minMaxCache[xValue] = range; - return _chart; - }; - _chart.yRangeFilter = function (range) { - if (!_chart.yDim()) { - throw new Error("Must set yDim before invoking yRange"); - } - var yValue = _chart.yDim().value()[0]; - if (!arguments.length) { - return _minMaxCache[yValue]; - } - _minMaxCache[yValue] = range; - return _chart; - }; - _chart.popupSearchRadius = function (popupSearchRadius) { - if (!arguments.length) { - return _popupSearchRadius; - } - _popupSearchRadius = popupSearchRadius; - return _chart; - }; - _chart.con = function (_) { - if (!arguments.length) { - return _con; - } - _con = _; - return _chart; - }; - _chart.popupColumns = function (popupColumns) { - if (!arguments.length) { - return _popupColumns; - } - _popupColumns = popupColumns; - return _chart; - }; - _chart.popupColumnsMapped = function (popupColumnsMapped) { - if (!arguments.length) { - return _popupColumnsMapped; - } - _popupColumnsMapped = popupColumnsMapped; - return _chart; - }; - _chart.tableName = function (tableName) { - if (!arguments.length) { - return _tableName; - } - _tableName = tableName; - return _chart; - }; - _chart.popupFunction = function (popupFunction) { - if (!arguments.length) { - return _popupFunction; - } - _popupFunction = popupFunction; - return _chart; - }; - - // _determineScaleType because there is no way to determine the scale type - // in d3 except for looking to see what member methods exist for it - _chart.sampling = function (isSetting) { - // isSetting should be true or false - if (!arguments.length) { - return _sampling; - } - if (isSetting && !_sampling) { - // if wasn't sampling - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["n" /* incrementSampledCount */])(); - } else if (!isSetting && _sampling) { - Object(__WEBPACK_IMPORTED_MODULE_0__core_core__["d" /* decrementSampledCount */])(); - } - _sampling = isSetting; - if (_sampling === false) { - _chart.dimension().samplingRatio(null); // unset sampling - } - - return _chart; - }; - _chart.setSample = function () { - if (_sampling) { - var id = _chart.dimension().getCrossfilterId(); - var filterSize = Object(__WEBPACK_IMPORTED_MODULE_1__core_core_async__["g" /* lastFilteredSize */])(id); - if (filterSize == undefined) { - _chart.dimension().samplingRatio(null); - } else { - _chart.dimension().samplingRatio(Math.min(_chart.cap() / filterSize, 1.0)); - } - } - }; - _chart._determineScaleType = function (scale) { - var scaleType = null; - if (scale.rangeBand !== undefined) { - return "ordinal"; - } - if (scale.exponent !== undefined) { - return "power"; - } - if (scale.base !== undefined) { - return "log"; - } - if (scale.quantiles !== undefined) { - return "quantiles"; - } - if (scale.interpolate !== undefined) { - return "linear"; - } - return "quantize"; - }; - _chart.vegaSpec = function (_) { - if (!arguments.length) { - return _chart._vegaSpec; - } - _chart._vegaSpec = _; - return _chart; - }; - _chart.colorBy = function (_) { - if (!arguments.length) { - return _colorBy; - } - _colorBy = _; - return _chart; - }; - _chart.sizeBy = function (_) { - if (!arguments.length) { - return _sizeBy; - } - _sizeBy = _; - return _chart; - }; - _chart.getClosestResult = function getClosestResult(point, callback) { - if (_chart.drawMode && _chart.drawMode() || !_chart.popupColumns().length) { - return; - } - var height = typeof _chart.effectiveHeight === "function" ? _chart.effectiveHeight() : _chart.height(); - var pixelRatio = _chart._getPixelRatio() || 1; - var pixel = new TPixel({ - x: Math.round(point.x * pixelRatio), - y: Math.round((height - point.y) * pixelRatio) - }); - var tableName = _chart.tableName(); - var columns = getColumnsWithPoints(); - // TODO best to fail, skip cb, or call cb wo args? - if (!point || !tableName || !columns.length || columns.length === 3 && hideColorColumnInPopup()) { - return; - } - _chart.con().getResultRowForPixelAsync(_chart.__dcFlag__, pixel, { - table: columns - }, _popupSearchRadius * pixelRatio).then(function (results) { - return callback(results[0]); - }); - }; - _chart.displayPopup = function displayPopup(result) { - if (!_popupDisplayable || _mouseLeave || !result || !result.row_set || !result.row_set.length) { - return; - } - if (_chart.select(".map-popup").empty()) { - // show only one popup at a time. - var data = result.row_set[0]; - var mappedData = mapDataViaColumns(data, _popupColumnsMapped); - if (Object.keys(mappedData).length === 2) { - return; - } // xPoint && yPoint - var offsetBridge = 0; - var width = typeof _chart.effectiveWidth === "function" ? _chart.effectiveWidth() : _chart.width(); - var height = typeof _chart.effectiveHeight === "function" ? _chart.effectiveHeight() : _chart.height(); - var margins = typeof _chart.margins === "function" ? _chart.margins() : { - left: 0, - right: 0, - top: 0, - bottom: 0 - }; - var xscale = _chart.x(); - var yscale = _chart.y(); - var origXRange = xscale.range(); - var origYRange = yscale.range(); - xscale.range([0, width]); - yscale.range([0, height]); - var xPixel = xscale(data.xPoint) + margins.left; - var yPixel = height - yscale(data.yPoint) + margins.top; - - // restore the original ranges so we don't screw anything else up - xscale.range(origXRange); - yscale.range(origYRange); - var mapPopup = _chart.root().append("div").attr("class", "map-popup"); - mapPopup.on("wheel", function () { - _chart.select(".map-popup").remove(); - }); - mapPopup.append("div").attr("class", "map-point-wrap").append("div").attr("class", "map-point").style({ - left: xPixel + "px", - top: yPixel + "px" - }).append("div").attr("class", "map-point-gfx").style("background", colorPopupBackground(result.row_set[0])); - - // Plop a loader in there (on a small delay in case its synchronous) - var popupPromise = Promise.resolve(_chart.popupFunction() ? _popupFunction(mappedData) : renderPopupHTML(mappedData)); - popupPromise.then(function (popupHtml) { - mapPopup.append("div").attr("class", "map-popup-wrap").style({ - left: xPixel + "px", - top: yPixel + "px" - }).append("div").attr("class", "map-popup-box").html(popupHtml).style("left", function () { - var boxWidth = __WEBPACK_IMPORTED_MODULE_3_d3___default.a.select(this).node().getBoundingClientRect().width; - var overflow = _chart.width() - (xPixel + boxWidth / 2) < 0 ? _chart.width() - (xPixel + boxWidth / 2) - 6 : xPixel - boxWidth / 2 < 0 ? -(xPixel - boxWidth / 2) + 6 : 0; - offsetBridge = boxWidth / 2 - overflow; - return overflow + "px"; - }).classed("pop-down", function () { - var boxHeight = __WEBPACK_IMPORTED_MODULE_3_d3___default.a.select(this).node().getBoundingClientRect().height; - return yPixel - (boxHeight + 12) < 8; - }).append("div").attr("class", "map-popup-bridge").style("left", function () { - return offsetBridge + "px"; - }); - }); - } - }; - _chart.hidePopup = function hidePopup() { - if (!_chart.select(".map-popup").empty()) { - _chart.select(".map-popup-wrap").classed("removePopup", true).on("animationend", function () { - _chart.select(".map-popup").remove(); - }); - _chart.select(".map-point").classed("removePoint", true); - } - }; - _chart._vegaSpec = {}; - return _chart; - function getColumnsWithPoints() { - var columns = _chart.popupColumns().slice(); - if (typeof _chart.useLonLat === "function" && _chart.useLonLat()) { - columns.push("conv_4326_900913_x(" + _chart._xDimName + ") AS xPoint"); - columns.push("conv_4326_900913_y(" + _chart._yDimName + ") AS yPoint"); - } else { - columns.push(_chart._xDimName + " AS xPoint"); - columns.push(_chart._yDimName + " AS yPoint"); - } - if (_chart.colorBy() && columns.indexOf(_chart.colorBy().value) === -1) { - columns.push(_chart.colorBy().value); - } - return columns; - } - function renderPopupHTML(data) { - var html = ""; - for (var key in data) { - if (key !== "xPoint" && key !== "yPoint" && !(_chart.colorBy() && key === _chart.colorBy().value && hideColorColumnInPopup())) { - html = html + ('
' + key + ': ' + __WEBPACK_IMPORTED_MODULE_2__utils_utils__["l" /* utils */].formatValue(data[key]) + "
"); - } - } - return html; - } - function colorPopupBackground(data) { - if (!_chart.colors().domain || !_chart.colorBy()) { - return _chart.defaultColor(); - } else if (isNaN(_chart.colors().domain()[0])) { - var matchIndex = _chart.colors().domain().indexOf(data[_chart.colorBy().value]); - return matchIndex !== -1 ? _chart.colors().range()[matchIndex] : _chart.defaultColor(); - } else { - return _chart.colors()(data[_chart.colorBy().value]); - } - } - function mapDataViaColumns(data, _popupColumnsMapped) { - var newData = {}; - for (var key in data) { - var newKey = _popupColumnsMapped[key] || key; - newData[newKey] = data[key]; - } - return newData; - } - function hideColorColumnInPopup() { - return _chart.colorBy() && _chart.popupColumns().indexOf(_chart.colorBy().value) === -1; - } -} - -/***/ }), -/* 424 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = legendContinuous; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3__); - -function legendContinuous() { - var LABEL_GAP = 2; - var _legend = {}, - _parent, - _x = 0, - _y = 0, - _itemHeight = 12, - _gap = 5, - _horizontal = false, - _legendWidth = 560, - _itemWidth = 70, - _autoItemWidth = false; - var _g; - - /* OVERRIDE -----------------------------------------------------------------*/ - var _wrapper; - var _lock; - var _lockable = true; - var _isLocked = false; - /* --------------------------------------------------------------------------*/ - - _legend.parent = function (p) { - if (!arguments.length) { - return _parent; - } - _parent = p; - return _legend; - }; - _legend.render = function () { - /* OVERRIDE -----------------------------------------------------------------*/ - _parent.root().select(".legend-cont").remove(); - _wrapper = _parent.root().append("div").attr("class", "legend-cont").style("display", _parent.colorByExpr() === null ? "none" : "block"); - var title = _wrapper.append("div").attr("class", "legend-title").append("span").text(_parent.colorByExpr()); - var legendGroup = _wrapper.append("div").attr("class", "legend-group"); - if (_lockable) { - generateLock(); - } - var legendables = _parent.legendablesContinuous(); - var itemEnter = legendGroup.selectAll(".legend-item").data(legendables).enter().append("div").attr("class", "legend-item"); - itemEnter.append("div").attr("class", "legend-swatch").style("background-color", function (d) { - return d ? d.color : "#e2e2e2"; - }); - itemEnter.append("div").attr("class", "legend-label").append("span").text(function (d) { - return d ? d.value : 0; - }); - legendGroup.selectAll(".legend-item:first-child , .legend-item:last-child").on("mouseenter", function () { - var item = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.select(this); - var w = item.select("span").node().getBoundingClientRect().width + 8; - item.select(".legend-input input").style("width", w + "px"); - }).selectAll(".legend-label").append("div").attr("class", "legend-input").append("input").attr("value", function (d) { - return d ? d.value : 0; - }).on("focus", function () { - this.select(); - var item = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.select(this.parentNode.parentNode); - item.classed("active", true); - var w = item.select("span").node().getBoundingClientRect().width + 8; - item.select(".legend-input input").style("width", w + "px"); - }).on("blur", function () { - __WEBPACK_IMPORTED_MODULE_0_d3___default.a.select(this.parentNode.parentNode).classed("active", false); - }).on("change", onChange); - }; - function legendItemHeight() { - return _gap + _itemHeight; - } - _legend.x = function (x) { - if (!arguments.length) { - return _x; - } - _x = x; - return _legend; - }; - _legend.y = function (y) { - if (!arguments.length) { - return _y; - } - _y = y; - return _legend; - }; - _legend.gap = function (gap) { - if (!arguments.length) { - return _gap; - } - _gap = gap; - return _legend; - }; - _legend.itemHeight = function (itemHeight) { - if (!arguments.length) { - return _itemHeight; - } - _itemHeight = itemHeight; - return _legend; - }; - _legend.horizontal = function (horizontal) { - if (!arguments.length) { - return _horizontal; - } - _horizontal = horizontal; - return _legend; - }; - _legend.legendWidth = function (legendWidth) { - if (!arguments.length) { - return _legendWidth; - } - _legendWidth = legendWidth; - return _legend; - }; - _legend.itemWidth = function (itemWidth) { - if (!arguments.length) { - return _itemWidth; - } - _itemWidth = itemWidth; - return _legend; - }; - _legend.autoItemWidth = function (autoItemWidth) { - if (!arguments.length) { - return _autoItemWidth; - } - _autoItemWidth = autoItemWidth; - return _legend; - }; - /* OVERRIDE -----------------------------------------------------------------*/ - function generateLock() { - _lock = _wrapper.append("div").attr("class", "legend-lock").classed("js-isLocked", _isLocked).on("click", toggleLock); - _lock.append("svg").attr("class", "svg-icon").classed("icon-lock", true).attr("viewBox", "0 0 48 48").append("use").attr("xlink:href", "#icon-lock"); - _lock.append("svg").attr("class", "svg-icon").classed("icon-unlock", true).attr("viewBox", "0 0 48 48").append("use").attr("xlink:href", "#icon-unlock"); - return _lock; - } - function toggleLock() { - _isLocked = !_isLocked; - _lock.classed("js-isLocked", _isLocked); - if (_isLocked) { - _parent.legendLock()(); - } else { - _parent.legendUnlock()(true); - } - } - function onChange() { - var startVal = _wrapper.select(".legend-item:first-child .legend-input input")[0][0].value; - var endVal = _wrapper.select(".legend-item:last-child .legend-input input")[0][0].value; - _parent.legendInputChange()([startVal, endVal], _parent.colors().range().length); - _isLocked = true; - _lock.classed("js-isLocked", _isLocked); - } - - /* --------------------------------------------------------------------------*/ - - return _legend; -} - -/***/ }), -/* 425 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = legend; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_utils__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__mixins_dc_legend_mixin__ = __webpack_require__(426); - - - -/** - * Legend is a attachable widget that can be added to other dc charts to render horizontal legend - * labels. - * - * @name legend - * @memberof dc - * @example - * chart.legend(dc.legend().x(400).y(10).itemHeight(13).gap(5)) - * @return {dc.legend} - */ -function legend() { - var LABEL_GAP = 2; - var _legend = {}, - _parent, - _x = 0, - _y = 0, - _itemHeight = 12, - _gap = 5, - _horizontal = false, - _legendWidth = 560, - _itemWidth = 70, - _autoItemWidth = false; - var _g; - _legend.parent = function (p) { - if (!arguments.length) { - return _parent; - } - _parent = p; - return _legend; - }; - _legend.render = function () { - _parent.svg().select("g.dc-legend").remove(); - _g = _parent.svg().append("g").attr("class", "dc-legend").attr("transform", "translate(" + _x + "," + _y + ")"); - var legendables = _parent.legendables(); - var itemEnter = _g.selectAll("g.dc-legend-item").data(legendables).enter().append("g").attr("class", "dc-legend-item").on("mouseover", function (d) { - _parent.legendHighlight(d); - }).on("mouseout", function (d) { - _parent.legendReset(d); - }).on("click", function (d) { - d.chart.legendToggle(d); - }); - _g.selectAll("g.dc-legend-item").classed("fadeout", function (d) { - return d.chart.isLegendableHidden(d); - }); - if (legendables.some(Object(__WEBPACK_IMPORTED_MODULE_1__utils_utils__["j" /* pluck */])("dashstyle"))) { - itemEnter.append("line").attr("x1", 0).attr("y1", _itemHeight / 2).attr("x2", _itemHeight).attr("y2", _itemHeight / 2).attr("stroke-width", 2).attr("stroke-dasharray", Object(__WEBPACK_IMPORTED_MODULE_1__utils_utils__["j" /* pluck */])("dashstyle")).attr("stroke", Object(__WEBPACK_IMPORTED_MODULE_1__utils_utils__["j" /* pluck */])("color")); - } else { - itemEnter.append("rect").attr("width", _itemHeight).attr("height", _itemHeight).attr("fill", function (d) { - return d ? d.color : "blue"; - }); - } - itemEnter.append("text").text(Object(__WEBPACK_IMPORTED_MODULE_1__utils_utils__["j" /* pluck */])("name")).attr("x", _itemHeight + LABEL_GAP).attr("y", function () { - return _itemHeight / 2 + (this.clientHeight ? this.clientHeight : 13) / 2 - 2; - }); - var _cumulativeLegendTextWidth = 0; - var row = 0; - itemEnter.attr("transform", function (d, i) { - if (_horizontal) { - var translateBy = "translate(" + _cumulativeLegendTextWidth + "," + row * legendItemHeight() + ")"; - var itemWidth = _autoItemWidth === true ? this.getBBox().width + _gap : _itemWidth; - if (_cumulativeLegendTextWidth + itemWidth >= _legendWidth) { - ++row; - _cumulativeLegendTextWidth = 0; - } else { - _cumulativeLegendTextWidth = _cumulativeLegendTextWidth + itemWidth; - } - return translateBy; - } else { - return "translate(0," + i * legendItemHeight() + ")"; - } - }); - }; - function legendItemHeight() { - return _gap + _itemHeight; - } - - /** - * Set or get x coordinate for legend widget. - * @name x - * @memberof dc.legend - * @instance - * @param {Number} [x=0] - * @return {Number} - * @return {dc.legend} - */ - _legend.x = function (x) { - if (!arguments.length) { - return _x; - } - _x = x; - return _legend; - }; - - /** - * Set or get y coordinate for legend widget. - * @name y - * @memberof dc.legend - * @instance - * @param {Number} [y=0] - * @return {Number} - * @return {dc.legend} - */ - _legend.y = function (y) { - if (!arguments.length) { - return _y; - } - _y = y; - return _legend; - }; - - /** - * Set or get gap between legend items. - * @name gap - * @memberof dc.legend - * @instance - * @param {Number} [gap=5] - * @return {Number} - * @return {dc.legend} - */ - _legend.gap = function (gap) { - if (!arguments.length) { - return _gap; - } - _gap = gap; - return _legend; - }; - - /** - * Set or get legend item height. - * @name itemHeight - * @memberof dc.legend - * @instance - * @param {Number} [itemHeight=12] - * @return {Number} - * @return {dc.legend} - */ - _legend.itemHeight = function (itemHeight) { - if (!arguments.length) { - return _itemHeight; - } - _itemHeight = itemHeight; - return _legend; - }; - - /** - * Position legend horizontally instead of vertically. - * @name horizontal - * @memberof dc.legend - * @instance - * @param {Boolean} [horizontal=false] - * @return {Boolean} - * @return {dc.legend} - */ - _legend.horizontal = function (horizontal) { - if (!arguments.length) { - return _horizontal; - } - _horizontal = horizontal; - return _legend; - }; - - /** - * Maximum width for horizontal legend. - * @name legendWidth - * @memberof dc.legend - * @instance - * @param {Number} [legendWidth=500] - * @return {Number} - * @return {dc.legend} - */ - _legend.legendWidth = function (legendWidth) { - if (!arguments.length) { - return _legendWidth; - } - _legendWidth = legendWidth; - return _legend; - }; - - /** - * legendItem width for horizontal legend. - * @name itemWidth - * @memberof dc.legend - * @instance - * @param {Number} [itemWidth=70] - * @return {Number} - * @return {dc.legend} - */ - _legend.itemWidth = function (itemWidth) { - if (!arguments.length) { - return _itemWidth; - } - _itemWidth = itemWidth; - return _legend; - }; - - /** - * Turn automatic width for legend items on or off. If true, {@link #dc.legend+itemWidth itemWidth} is ignored. - * This setting takes into account {@link #dc.legend+gap gap}. - * @name autoItemWidth - * @memberof dc.legend - * @instance - * @param {Boolean} [autoItemWidth=false] - * @return {Boolean} - * @return {dc.legend} - */ - _legend.autoItemWidth = function (autoItemWidth) { - if (!arguments.length) { - return _autoItemWidth; - } - _autoItemWidth = autoItemWidth; - return _legend; - }; - - /** - #### .legendText([legendTextFunction]) - Set or get the legend text function. The legend widget uses this function to render - the legend text on each item. If no function is specified the legend widget will display - the names associated with each group. - Default: pluck('name') - ```js - // create numbered legend items - chart.legend(dc.legend().legendText(function(d, i) { return i + '. ' + d.name; })) - // create legend displaying group counts - chart.legend(dc.legend().legendText(function(d) { return d.name + ': ' d.data; })) - ``` - **/ - _legend.legendText = function (_) { - if (!arguments.length) { - return _legendText; - } - _legendText = _; - return _legend; - }; - _legend = Object(__WEBPACK_IMPORTED_MODULE_2__mixins_dc_legend_mixin__["a" /* default */])(_legend); - return _legend; -} - -/***/ }), -/* 426 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = legendMixin; -function legendMixin(legend) { - legend._scrollPos = 0; - legend._expanded = true; - legend._heightRatio = 3; - legend._title = "Legend"; - legend._key = "key0"; - legend.legendType = function () { - return "custom"; - }; - legend.render = function () { - // Does not re-render if a custom cursor is on the screen - if (document.getElementById("cursor") !== null) { - return; - } - legend.parent().root().select(".dc-legend").remove(); - var wrapper = legend.parent().root().append("div").attr("class", "dc-legend").classed("collapsed", !legend._expanded); - var header = wrapper.append("div").attr("class", "dc-legend-header").text(legend._expanded ? legend._title : "Legend").on("click", function () { - legend._expanded = !legend._expanded; - legend.render(); - }); - if (legend._expanded) { - header.append("div").attr("class", "toggle-btn"); - var body = wrapper.append("div").attr("class", "dc-legend-body").style("max-height", legend.parent().height() / legend._heightRatio + "px").on("scroll", function () { - legend._scrollPos = body.node().scrollTop; - }); - var legendables = legend.legendables(); - var itemEnter = body.selectAll(".dc-legend-item").data(legendables).enter().append("div").attr("class", "dc-legend-item"); - itemEnter.append("div").attr("class", "legend-item-color").style("background", function (d) { - return d ? d.color : "#868686"; - }); - itemEnter.append("div").attr("class", "legend-item-text").text(function (d) { - return d.name; - }); - var bodyNode = body.node(); - if (bodyNode) { - // fix for #4196#issuecomment-376704328 - bodyNode.scrollTop = legend._scrollPos; - } - } - }; - legend.removeLegend = function () { - legend.parent().root().select(".dc-legend").remove(); - legend.parent().legend(null); - }; - legend.legendables = function () { - var colors = legend.parent().colors(); - return zip2(colors.domain(), colors.range()).map(function (data) { - return { - name: data[0], - color: data[1], - chart: legend.parent() - }; - }); - }; - legend.setTitle = function (title) { - legend._title = title; - return legend; - }; - legend.setKey = function (key) { - legend._key = key; - return legend; - }; - function zip2(list1, list2) { - return (list1.length < list2.length ? list1 : list2).map(function (_, i) { - return [list1[i], list2[i]]; - }); - } - return legend; -} - -/***/ }), -/* 427 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = legendCont; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_d3___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_d3__); -function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } - -var OFFSET_WIDTH = 8; -function unLockedPreRedrawRenderHandler(chart) { - var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : chart.data(); - if (!data.image) { - chart.colorDomain(__WEBPACK_IMPORTED_MODULE_0_d3___default.a.extent(data, chart.colorAccessor())); - } -} -function legendCont() { - var _legend = {}; - var _parent = null; - var _legendTitle = ""; - var _chartType = ""; - var _wrapper = null; - var _lock = null; - var _minMax = null; - var _isLocked = false; - _legend.legendType = function () { - return "quantitative"; - }; - _legend.isLocked = function (_) { - if (!arguments.length) { - return _isLocked; - } - _isLocked = _; - return _legend; - }; - _legend.parent = function (p) { - if (!arguments.length) { - return _parent; - } - _parent = p; - return _legend; - }; - _legend.minMax = function (_) { - if (!arguments.length) { - return _minMax; - } - _minMax = _; - return _legend; - }; - _legend.legendTitle = function (_) { - if (!arguments.length) { - return _legendTitle; - } - _legendTitle = _; - return _legend; - }; - _legend.chartType = function (_) { - if (!arguments.length) { - return _chartType; - } - _chartType = _; - return _legend; - }; - _legend.removeLegend = function () { - _parent.root().select(".legend-cont").remove(); - _parent._invokeClearCustomContLegendListener(); - _parent.legend(null); - }; - _legend.render = function () { - _parent.root().select(".legend-cont").remove(); - _wrapper = _parent.root().append("div").attr("class", "legend-cont"); - var legendGroup = _wrapper.append("div").attr("class", "legend-group"); - initLock(); - var legendables = _parent.legendablesContinuous(); - var itemEnter = legendGroup.selectAll(".legend-item").data(legendables).enter().append("div").attr("class", "legend-item"); - itemEnter.append("div").attr("class", "legend-swatch").style("background-color", function (d) { - return d ? d.color : "#e2e2e2"; - }); // eslint-disable-line no-confusing-arrow - - itemEnter.append("div").attr("class", "legend-label").append("span").text(function (d) { - return _typeof(d) === "object" && d.value !== "NaN" ? d.value : 0; - }); // eslint-disable-line no-confusing-arrow - - legendGroup.selectAll(".legend-item:first-child , .legend-item:last-child").on("mouseenter", function () { - var item = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.select(this); - var w = item.select("span").node().getBoundingClientRect().width + OFFSET_WIDTH; - item.select(".legend-input input").style("width", w + "px"); - }).selectAll(".legend-label").append("div").attr("class", "legend-input").append("input").attr("value", function (d) { - return _typeof(d) === "object" && d.value !== "NaN" ? d.value : 0; - }) // eslint-disable-line no-confusing-arrow - .on("click", function () { - this.select(); - var item = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.select(this.parentNode.parentNode); - item.classed("active", true); - var w = item.select("span").node().getBoundingClientRect().width + OFFSET_WIDTH; - item.select(".legend-input input").style("width", w + "px"); - }).on("blur", function () { - __WEBPACK_IMPORTED_MODULE_0_d3___default.a.select(this.parentNode.parentNode).classed("active", false); - }).on("change", onChange); - }; - function initLock() { - _lock = _wrapper.append("div").attr("class", "legend-lock").classed("js-isLocked", _isLocked).on("click", toggleLock); - var lockIcon = _lock.append("svg").attr("class", "svg-icon").classed("icon-lock", true).attr("viewBox", "0 0 48 48"); - lockIcon.append("g").style("stroke", "white").style("stroke-width", "6").append("use").attr("xlink:href", "#icon-lock"); - lockIcon.append("use").attr("xlink:href", "#icon-lock"); - var unLockIcon = _lock.append("svg").attr("class", "svg-icon").classed("icon-unlock", true).attr("viewBox", "0 0 48 48"); - unLockIcon.append("g").style("stroke", "white").style("stroke-width", "6").append("use").attr("xlink:href", "#icon-unlock"); - unLockIcon.append("use").attr("xlink:href", "#icon-unlock"); - if (_isLocked) { - _parent.on("preRender.color", null); - _parent.on("preRedraw.color", null); - } else { - _parent.on("preRender.color", unLockedPreRedrawRenderHandler); - _parent.on("preRedraw.color", unLockedPreRedrawRenderHandler); - } - } - function toggleLock() { - _isLocked = !_isLocked; - if (_isLocked) { - _parent._invokeSetCustomContLegendListener({ - detail: _parent.colors().domain() - }); - } else { - var minMax = _chartType === "pointmap" || _chartType === "backendScatter" ? _minMax : __WEBPACK_IMPORTED_MODULE_0_d3___default.a.extent(_parent.data(), _parent.colorAccessor()); - if (minMax) { - _parent.colorDomain(minMax); - } - _parent._invokeClearCustomContLegendListener(); - } - _parent.redrawAsync(); - } - function onChange() { - var parseVal = function parseVal(val) { - return parseFloat(val.replace(/,/g, "")); - }; - var currVal = __WEBPACK_IMPORTED_MODULE_0_d3___default.a.select(this).attr("value"); - var inputBox1 = parseVal(_wrapper.select(".legend-item:first-child .legend-input input").node().value); - var inputBox2 = parseVal(_wrapper.select(".legend-item:last-child .legend-input input").node().value); - var startVal = isFinite(inputBox1) ? inputBox1 : _parent.colorDomain()[0]; - var endVal = isFinite(inputBox2) ? inputBox2 : _parent.colorDomain()[1]; - if (!isNaN(startVal) && !isNaN(endVal)) { - _isLocked = true; - _parent.colorDomain([startVal, endVal]).on("preRedraw.color", null).redrawAsync(); - _parent._invokeSetCustomContLegendListener({ - detail: [startVal, endVal] - }); - } else { - __WEBPACK_IMPORTED_MODULE_0_d3___default.a.select(this).property("value", currVal); - } - } - return _legend; -} - -/***/ }) -/******/ ]); -}); \ No newline at end of file diff --git a/package.json b/package.json index 5ddec65d..daa609f4 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "type": "git", "url": "https://github.com/mapd/mapd-charting.git" }, - "main": "src/index.js", + "main": "dist/charting.js", "scripts": { "build:commonjs": "cross-env BABEL_ENV=commonjs babel index.js --out-dir lib", "build": "webpack", @@ -50,7 +50,8 @@ "selenium:start": "selenium-standalone start --version=3.0.0-beta4", "start": "webpack-dev-server --content-base ./example --config ./example/webpack.config.js", "test": "npm run format:check:silent && npm run lint && npm run test:unit", - "test:unit": "find ./src -name '*.spec.js' | BABEL_ENV=test NODE_PATH=./src xargs nyc mocha --opts ./test/mocha.unit.opts" + "test:unit": "find ./src -name '*.spec.js' | BABEL_ENV=test NODE_PATH=./src xargs nyc mocha --opts ./test/mocha.unit.opts", + "prepare": "npm run build" }, "dependencies": { "@heavyai/data-layer": "npm:mapd-data-layer-2@0.0.25",