diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2021-12-03 15:38:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 15:38:12 +0300 |
commit | 061f578955758584ab79b79a5b6246a599061161 (patch) | |
tree | 4214cd412b406635900bf90223ef7201ba27df5e | |
parent | ad6f19a072a575a629fb90c4a7f5f25edcbd283c (diff) |
[Vue] migrate piwik-period-selector angularjs component (#18382)
* rangeChange event must be triggered once on mount
* initialize startDateText/endDateText correctly
* use jquery $destroy event instead of angularjs one
* built vue files
* fix menudropdown.directive.js reference
* load vue in installation/updater & correctly make focusanywherebuthere stateful
* correctly implement stateful directives for ExpandOnClick/ExpandOnHover
* less tweak (angularjs comment removal)
* fix submenu check
* quick type fix
* load vue in installation workflow
* add broadcast.js to Installation workflow + do not fail in pk_translate if no translations are loaded
* update expected screenshots (spacing of arrow changed because of angularjs comment no longer being there)
* start moving Notification class code to notifications store
* fix prop type
* fix html escaping
* built vue files
* get toast and other transitions to work + fix broken toast
* move all of notification.js to NotificationStore
* wait for angular to be initialized to post events to avoid loading race condition
* get scroll to notification to work + get initialization of notification groups to work
* correct unmount + remove notifications service file
* fix some test failures
* re add accidentally removed (?) file
* remove no longer needed file
* Add CoreHome UMD in CoreUpdater/Installation.
* self review
* fix type + add default value
* remove file from JS list
* fix test
* fix UI tests
* set correct type in users manager notification and allow scope values to be transformed in createAngularAdapter
* start converting form field directives
* start migrating siteselector
* small addition
* migrate rest of site selector code + make some breaking changes to function signatures in createAngularJsAdapter
* disable webpack asset size hints/warnings + get siteselector code to build
* fixing some bugs
* fix some more issues (allow specifing require in createAngularJsAdapter and make AjaxHelper promises abortable)
* get npm test to pass
* a couple more fixes
* remove existing files
* convert quick-access directive and use shared code/state with site selector
* remove site selector model
* fix more issues and get UI tests to pass for quickaccess
* remove debugging code / todo
* fix initial value
* add back a $timeout()
* fixing tests, the post blur scope.$apply()s are apparently required for angularjs to function properly
* migrate field-array
* fixing more UI test failures
* rebuild
* start converting multipairfield
* fix vue build
* why were these deleted?
* remove debug code
* first pass migrate multipairfield.vue
* move form-field code relevant to selects to FieldSelect.vue
* fix css class issue + update expected screenshots
* rebuild CoreHome
* move more of form-field.directive.js to new vue classes
* revert styling change
* finish converting last of form-field.directive.js code (completely untested)
* built vue files
* get focus-if to work and remove debugging return;
* rebuilt vue
* should not need to specify type there
* built CoreHome
* built vue files
* Fix for misaligned evolution trend icons (#18323)
* Aligned evolution trend icons, text tweak
* Update plugins/MultiSites/angularjs/dashboard/dashboard.directive.less
Co-authored-by: Stefan Giehl <stefan@matomo.org>
* apply review feedback
* Hide feedback banner in zen mode (#18329)
* [Vue] 4.6.0 fixes (#18334)
* feedback plugin may not be loaded
* fix copy paste
* async/await not supported
* built UMDs
* get local files to build
* built files
* get auto clearing behavior to work in site selector
* fix a couple more bugs
* use jQuery click for expand on click
* undo submodule change
* rebuild vue
* get vue files to run
* missing element
* more fixes
* get more fields working properly
* rebuild
* fix even more issues
* [Vue] use jQuery click for expand on click (#18341)
* use jQuery click for expand on click
* undo submodule change
* migrate piwik-field directive and fix some issues
* forgot to add migrated directive files and get demo.twig to work
* use event target
* make sure angularjs and vue do not share data
* fix ng model mapping
* fix a couple more issues
* fix a couple more bugs
* more fixes
* mimic existing behavior where an empty value will result in an extra field appearing in a select option list, but only at first
* another fix
* built vue files
* more fixes
* do not use UMD if vue/src is not present
* use non-minified angularjs if in development mode
* deprecate custom template file property
* remove angularjs properties in scope properties (ie, $$hashKey) otherwise vue will fail when it tries to process them
* fixing some more issues from ui tests
* more fixes
* fix form field issue + patch jquery so .trigger() will also trigger events added via addEventHandler()
* true bc fix
* get the jquery patch to work
* ignore polyfill map
* fix ng-model issue in report limit in report export directive
* full width property was not handled properly before in angularjs
* do not try and parseInt null values
* fix several more issues for tests
* fix some tests
* fix data binding
* fix css class
* fixing more ui test issues
* do not decode model value of site name in site selector, so it is always the same as what is in the DB
* 4.6.0-rc2
* more ng-model fixes
* rebuild
* html tweaks
* add timeout to test
* rebuild
* fix another UI test
* rebuild vue files
* update some expected screenshots
* fix more issues
* Revert "[Vue] do not decode model value of site name in site selector, so it is always matches the DB value (#18356)"
This reverts commit 8c7539f073e7a49311cbe6dc2474eb1bbfb8718d.
* update screenshots
* more fixes
* another fix + screenshot update
* more screenshot updates
* more fixes
* even more fixes
* another ui test fix
* more type fixes
* rebuilt vue JS
* couple more fixes
* undo debugging
* do not convert undefined to bool
* update screenshot
* another bool checking fix
* rebuild vue files
* more fixes
* initial site value in field is assumed to be encoded
* file headers and custom field component support
* get custom component field code to work
* rebuild vue
* allow using angularjs templateFile for custom field (for BC)
* get angularjs template embedding to work for rollupreporting at least
* deal with some in source TODO items
* fix a couple more issues
* Use separate div in modals to display notifications otherwise Vue will erase modal content when initializing NotificationGroup component.
* build again
* refactor some code and fix an issue with checkbox array field handling in angularjs
* more fixes
* another fix
* even more fixes
* remove more todo
* hopefully the last changes
* update vue files
* update submodule
* revert debugging change + fix issue
* built vue files
* fix another select issue
* rebuild vue files
* fix broken refactor
* update two screenshots
* add some more timeouts and update screenshots
* initial conversion, loading w/o error
* tweaks
* get period selector work in UI
* fix site selector model binding
* rebuild vue
* fix viewDate not being kept in sync
* rebuild CoreHome
* two fixes
* couple UI test fixes
* rebuild vue
* update files
* make getRef a utility method
* add return type
* fix a UI test
* another html fix
* Use themed font family for input forms to override materialize.css styling
* rebuild vue
* add a missing div
* ui test fixes
* update styling
* update expected screenshot
* fix field array title
* apply some pr feedback
* apply more pr feedback
* another fix
* tweak
* fix ng-change not executed before ng-model
* fix another set of issues
* fix another issue
* rebuild vue
* better ng-change/ng-model fix
* initiate initial ng-change ONLY for site selectors where this behavior applies
* built vue files
* update screenshots
* fix date range picker input editing behavior & undo changes to matomo.js/piwik.js
* Update plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.vue
Co-authored-by: Stefan Giehl <stefan@matomo.org>
* built vue files
* undo CustomAlerts submodule
Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: Ben Burgess <88810029+bx80@users.noreply.github.com>
Co-authored-by: Matthieu Aubry <mattab@users.noreply.github.com>
20 files changed, 1396 insertions, 768 deletions
diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php index 92970dc0b5..1ec8bbfb5c 100644 --- a/plugins/CoreHome/CoreHome.php +++ b/plugins/CoreHome/CoreHome.php @@ -146,7 +146,7 @@ class CoreHome extends \Piwik\Plugin $stylesheets[] = "plugins/CoreHome/angularjs/widget-bydimension-container/widget-bydimension-container.directive.less"; $stylesheets[] = "plugins/CoreHome/angularjs/progressbar/progressbar.directive.less"; $stylesheets[] = "plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.less"; - $stylesheets[] = "plugins/CoreHome/angularjs/period-selector/period-selector.directive.less"; + $stylesheets[] = "plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.less"; $stylesheets[] = "plugins/CoreHome/vue/src/MultiPairField/MultiPairField.less"; $stylesheets[] = "plugins/CoreHome/vue/src/DropdownMenu/DropdownMenu.less"; $stylesheets[] = "plugins/CoreHome/angularjs/sparkline/sparkline.component.less"; @@ -261,9 +261,6 @@ class CoreHome extends \Piwik\Plugin $jsFiles[] = "plugins/CoreHome/angularjs/content-table/content-table.directive.js"; - $jsFiles[] = "plugins/CoreHome/angularjs/period-selector/period-selector.directive.js"; - $jsFiles[] = "plugins/CoreHome/angularjs/period-selector/period-selector.controller.js"; - // TODO: [Vue] used by RollUpReporting, has to be kept for now. $jsFiles[] = "plugins/CoreHome/angularjs/siteselector/siteselector-model.service.js"; @@ -467,5 +464,7 @@ class CoreHome extends \Piwik\Plugin $translationKeys[] = 'General_PreviousYear'; $translationKeys[] = 'CoreHome_ReportingCategoryHelpPrefix'; $translationKeys[] = 'CoreHome_TechDeprecationWarning'; + $translationKeys[] = 'CoreHome_StartDate'; + $translationKeys[] = 'CoreHome_EndDate'; } } diff --git a/plugins/CoreHome/angularjs/period-selector/period-selector.controller.js b/plugins/CoreHome/angularjs/period-selector/period-selector.controller.js deleted file mode 100644 index 37ad3542aa..0000000000 --- a/plugins/CoreHome/angularjs/period-selector/period-selector.controller.js +++ /dev/null @@ -1,363 +0,0 @@ -/*! - * Matomo - free/libre analytics platform - * - * @link https://matomo.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -(function () { - angular.module('piwikApp').controller('PeriodSelectorController', PeriodSelectorController); - - PeriodSelectorController.$inject = ['piwik', '$location', 'piwikPeriods', 'piwikComparisonsService', '$rootScope', 'piwikUrl', '$element', '$timeout']; - - function PeriodSelectorController(piwik, $location, piwikPeriods, piwikComparisonsService, $rootScope, piwikUrl, $element, $timeout) { - var piwikMinDate = new Date(piwik.minDateYear, piwik.minDateMonth - 1, piwik.minDateDay), - piwikMaxDate = new Date(piwik.maxDateYear, piwik.maxDateMonth - 1, piwik.maxDateDay); - - var vm = this; - - vm.comparePeriodDropdownOptions = [ - {key: 'custom', value: _pk_translate('General_Custom')}, - {key: 'previousPeriod', value: _pk_translate('General_PreviousPeriod').replace(/\s+/, piwikHelper.htmlDecode(' '))}, - {key: 'previousYear', value: _pk_translate('General_PreviousYear').replace(/\s+/, piwikHelper.htmlDecode(' '))}, - ]; - - // the period & date currently being viewed - vm.periodValue = null; - vm.dateValue = null; - - vm.selectedPeriod = null; - - vm.startRangeDate = null; - vm.endRangeDate = null; - vm.isRangeValid = null; - - vm.isLoadingNewPage = false; - - vm.isComparing = false; - vm.comparePeriodType = 'previousPeriod'; - vm.compareStartDate = ''; - vm.compareEndDate = ''; - - vm.getCurrentlyViewingText = getCurrentlyViewingText; - vm.changeViewedPeriod = changeViewedPeriod; - vm.setPiwikPeriodAndDate = setPiwikPeriodAndDate; - vm.onApplyClicked = onApplyClicked; - vm.updateSelectedValuesFromHash = updateSelectedValuesFromHash; - vm.getPeriodDisplayText = getPeriodDisplayText; - vm.$onChanges = $onChanges; - vm.onRangeChange = onRangeChange; - vm.isApplyEnabled = isApplyEnabled; - vm.$onInit = init; - vm.isComparisonEnabled = isComparisonEnabled; - - $rootScope.$on('$locationChangeSuccess', setIsComparing); - - function init() { - vm.updateSelectedValuesFromHash(); - setIsComparing(); - initTopControls(); // must be called when a top control changes width - - handleZIndexPositionRelativeCompareDropdownIssue(); - } - - function handleZIndexPositionRelativeCompareDropdownIssue() { - $element.on('focus', '#comparePeriodToDropdown .select-dropdown', function () { - $element.addClass('compare-dropdown-open'); - }).on('blur', '#comparePeriodToDropdown .select-dropdown', function () { - $element.removeClass('compare-dropdown-open'); - }); - } - - function setIsComparing() { - vm.isComparing = piwikComparisonsService.isComparingPeriods(); - } - - function $onChanges(changesObj) { - if (changesObj.periods) { - removeUnrecognizedPeriods(); - } - } - - function onRangeChange(start, end) { - if (!start || !end) { - vm.isRangeValid = false; - return; - } - - vm.isRangeValid = true; - vm.startRangeDate = start; - vm.endRangeDate = end; - } - - function isApplyEnabled() { - if (vm.selectedPeriod === 'range' - && !vm.isRangeValid - ) { - return false; - } - - if (vm.isComparing - && vm.comparePeriodType === 'custom' - && !isCompareRangeValid() - ) { - return false; - } - - return true; - } - - function isCompareRangeValid() { - try { - piwikPeriods.parseDate(vm.compareStartDate); - } catch (e) { - return false; - } - - try { - piwikPeriods.parseDate(vm.compareEndDate); - } catch (e) { - return false; - } - - return true; - } - - function removeUnrecognizedPeriods() { - vm.periods = vm.periods.filter(function (periodLabel) { - return piwikPeriods.isRecognizedPeriod(periodLabel); - }); - } - - function updateSelectedValuesFromHash() { - var strDate = piwikUrl.getSearchParam('date'); - var strPeriod = piwikUrl.getSearchParam('period'); - - vm.periodValue = strPeriod; - vm.selectedPeriod = strPeriod; - - vm.dateValue = vm.startRangeDate = vm.endRangeDate = null; - - try { - piwikPeriods.parse(strPeriod, strDate); - } catch (e) { - return; - } - - if (strPeriod === 'range') { - var period = piwikPeriods.get(strPeriod).parse(strDate); - vm.dateValue = period.startDate; - vm.startRangeDate = formatDate(period.startDate); - vm.endRangeDate = formatDate(period.endDate); - } else { - vm.dateValue = piwikPeriods.parseDate(strDate); - setRangeStartEndFromPeriod(strPeriod, strDate); - } - } - - function getPeriodDisplayText(periodLabel) { - return piwikPeriods.get(periodLabel).getDisplayText(); - } - - function getCurrentlyViewingText() { - var date; - if (vm.periodValue === 'range') { - if (!vm.startRangeDate || ! vm.endRangeDate) { - return _pk_translate('General_Error'); - } - - date = vm.startRangeDate + ',' + vm.endRangeDate; - } else { - if (!vm.dateValue) { - return _pk_translate('General_Error'); - } - - date = formatDate(vm.dateValue); - } - - try { - return piwikPeriods.parse(vm.periodValue, date).getPrettyString(); - } catch (e) { - return _pk_translate('General_Error'); - } - } - - function changeViewedPeriod(period) { - // only change period if it's different from what's being shown currently - if (period === vm.periodValue) { - return; - } - - // can't just change to a range period, w/o setting two new dates - if (period === 'range') { - return; - } - - setPiwikPeriodAndDate(period, vm.dateValue); - } - - function onApplyClicked() { - if (vm.selectedPeriod === 'range') { - var dateString = getSelectedDateString(); - if (!dateString) { - return; - } - - vm.periodValue = 'range'; - - propagateNewUrlParams(dateString, 'range'); - return; - } - - setPiwikPeriodAndDate(vm.selectedPeriod, vm.dateValue); - } - - function getSelectedDateString() { - if (vm.selectedPeriod === 'range') { - var dateFrom = vm.startRangeDate, - dateTo = vm.endRangeDate, - oDateFrom = piwikPeriods.parseDate(dateFrom), - oDateTo = piwikPeriods.parseDate(dateTo); - - if (!isValidDate(oDateFrom) - || !isValidDate(oDateTo) - || oDateFrom > oDateTo - ) { - // TODO: use a notification instead? - $('#alert').find('h2').text(_pk_translate('General_InvalidDateRange')); - piwik.helper.modalConfirm('#alert', {}); - return null; - } - - return dateFrom + ',' + dateTo; - } else { - return formatDate(vm.dateValue); - } - } - - function setPiwikPeriodAndDate(period, date) { - vm.periodValue = period; - vm.selectedPeriod = period; - vm.dateValue = date; - - var currentDateString = formatDate(date); - setRangeStartEndFromPeriod(period, currentDateString); - - propagateNewUrlParams(currentDateString, vm.selectedPeriod); - initTopControls(); - } - - function setRangeStartEndFromPeriod(period, dateStr) { - var dateRange = piwikPeriods.parse(period, dateStr).getDateRange(); - vm.startRangeDate = formatDate(dateRange[0] < piwikMinDate ? piwikMinDate : dateRange[0]); - vm.endRangeDate = formatDate(dateRange[1] > piwikMaxDate ? piwikMaxDate : dateRange[1]); - } - - function getSelectedComparisonParams() { - var previousDate; - - if (!vm.isComparing) { - return {}; - } - - if (vm.comparePeriodType === 'custom') { - return { - comparePeriods: ['range'], - compareDates: [vm.compareStartDate + ',' + vm.compareEndDate], - }; - } else if (vm.comparePeriodType === 'previousPeriod') { - previousDate = getPreviousPeriodDateToSelectedPeriod(); - return { - comparePeriods: [vm.selectedPeriod], - compareDates: [previousDate], - }; - } else if (vm.comparePeriodType === 'previousYear') { - var dateStr = vm.selectedPeriod === 'range' ? (vm.startRangeDate + ',' + vm.endRangeDate) : vm.dateValue; - var currentDateRange = piwikPeriods.parse(vm.selectedPeriod, dateStr).getDateRange(); - currentDateRange[0].setFullYear(currentDateRange[0].getFullYear() - 1); - currentDateRange[1].setFullYear(currentDateRange[1].getFullYear() - 1); - - if (vm.selectedPeriod === 'range') { - return { - comparePeriods: ['range'], - compareDates: [piwikPeriods.format(currentDateRange[0]) + ',' + piwikPeriods.format(currentDateRange[1])], - }; - } - - return { - comparePeriods: [vm.selectedPeriod], - compareDates: [piwikPeriods.format(currentDateRange[0])], - }; - } else { - console.warn("Unknown compare period type: " + vm.comparePeriodType); - return {}; - } - } - - function getPreviousPeriodDateToSelectedPeriod() { - if (vm.selectedPeriod === 'range') { - var currentStartRange = piwikPeriods.parseDate(vm.startRangeDate); - var currentEndRange = piwikPeriods.parseDate(vm.endRangeDate); - var newEndDate = piwikPeriods.RangePeriod.getLastNRange('day', 2, currentStartRange).startDate; - - var rangeSize = Math.floor((currentEndRange - currentStartRange) / 86400000); - var newRange = piwikPeriods.RangePeriod.getLastNRange('day', 1 + rangeSize, newEndDate); - - return piwikPeriods.format(newRange.startDate) + ',' + piwikPeriods.format(newRange.endDate); - } - - var newStartDate = piwikPeriods.RangePeriod.getLastNRange(vm.selectedPeriod, 2, vm.dateValue).startDate; - return piwikPeriods.format(newStartDate); - } - - function propagateNewUrlParams(date, period) { - var compareParams = getSelectedComparisonParams(); - - if (piwik.helper.isAngularRenderingThePage()) { - vm.closePeriodSelector(); // defined in directive - - var $search = $location.search(); - var isCurrentlyComparing = piwikUrl.getSearchParam('compareSegments') || piwikUrl.getSearchParam('comparePeriods'); - if (date !== $search.date || period !== $search.period || vm.isComparing || isCurrentlyComparing) { - // eg when using back button the date might be actually already changed in the URL and we do not - // want to change the URL again - $search.date = date; - $search.period = period; - $search.compareSegments = piwikUrl.getSearchParam('compareSegments') || []; - $.extend($search, compareParams); - - delete $search['compareSegments[]']; - delete $search['comparePeriods[]']; - delete $search['compareDates[]']; - - $location.search($.param($search)); - } - - return; - } - - vm.isLoadingNewPage = true; - - // not in an angular context (eg, embedded dashboard), so must actually - // change the URL - var url = $.param($.extend({ date: date, period: period }, compareParams)); - broadcast.propagateNewPage(url); - } - - function isValidDate(d) { - if (Object.prototype.toString.call(d) !== "[object Date]") { - return false; - } - - return !isNaN(d.getTime()); - } - - function formatDate(date) { - return piwikPeriods.format(date); - } - - function isComparisonEnabled() { - return piwikComparisonsService.isComparisonEnabled(); - } - } -})(); diff --git a/plugins/CoreHome/angularjs/period-selector/period-selector.directive.html b/plugins/CoreHome/angularjs/period-selector/period-selector.directive.html deleted file mode 100644 index a93c638b5a..0000000000 --- a/plugins/CoreHome/angularjs/period-selector/period-selector.directive.html +++ /dev/null @@ -1,134 +0,0 @@ -<div - piwik-expand-on-click - class="periodSelector piwikSelector" -> - <a - id="date" - class="title" - title="{{ 'General_ChooseDate'|translate:periodSelector.getCurrentlyViewingText() }}" - tabindex="-1" - > - <span class="icon icon-calendar"></span> - {{ periodSelector.getCurrentlyViewingText() }} - </a> - <div id="periodMore" class="dropdown"> - <div class="flex"> - <div> - <piwik-date-range-picker - ng-show="periodSelector.selectedPeriod === 'range'" - class="period-range" - start-date="periodSelector.startRangeDate" - end-date="periodSelector.endRangeDate" - range-change="periodSelector.onRangeChange(start, end)" - submit="periodSelector.onApplyClicked()" - > - </piwik-date-range-picker> - <div - class="period-date" - ng-if="periodSelector.selectedPeriod !== 'range'" - > - <piwik-period-date-picker - id="datepicker" - period="periodSelector.selectedPeriod" - date="periodSelector.periodValue === periodSelector.selectedPeriod ? periodSelector.dateValue : null" - select="periodSelector.setPiwikPeriodAndDate(periodSelector.selectedPeriod, date)" - > - </piwik-period-date-picker> - </div> - </div> - - <div class="period-type"> - <h6>{{ 'General_Period'|translate }}</h6> - <div id="otherPeriods"> - <p ng-repeat="period in periodSelector.periods"> - <label - ng-attr-title="{{ period === periodSelector.periodValue ? '' : ('General_DoubleClickToChangePeriod'|translate) }}" - ng-class="{'selected-period-label': period === periodSelector.selectedPeriod}" - ng-dblclick="periodSelector.changeViewedPeriod(period)" - > - <input - type="radio" - name="period" - ng-attr-id="period_id_{{ period }}" - ng-model="periodSelector.selectedPeriod" - ng-checked="periodSelector.selectedPeriod == period" - ng-change="periodSelector.selectedPeriod = period" - ng-dblclick="periodSelector.changeViewedPeriod(period)" - /> - <span>{{ periodSelector.getPeriodDisplayText(period) }}</span> - </label> - </p> - </div> - </div> - </div> - - <div class="compare-checkbox" ng-if="periodSelector.isComparisonEnabled()"> - <label> - <input - id="comparePeriodTo" - type="checkbox" - ng-model="periodSelector.isComparing" - /> - <span>{{ 'General_CompareTo'|translate }}</span> - </label> - - <div - id="comparePeriodToDropdown" - piwik-field - name="comparePeriodToDropdown" - uicontrol="select" - options="periodSelector.comparePeriodDropdownOptions" - ng-model="periodSelector.comparePeriodType" - full-width="true" - disabled="!periodSelector.isComparing" - ng-style="{'visibility' : periodSelector.isComparing ? 'visible' : 'hidden'}" - ></div> - </div> - - <div class="compare-date-range" ng-if="periodSelector.isComparing && periodSelector.comparePeriodType == 'custom'"> - <div> - <div - id="comparePeriodStartDate" - piwik-field - name="comparePeriodStartDate" - uicontrol="text" - ng-model="periodSelector.compareStartDate" - full-width="true" - title="Start Date" - placeholder="YYYY-MM-DD" - ></div> - - <span class="compare-dates-separator"></span> - - <div - id="comparePeriodEndDate" - piwik-field - name="comparePeriodEndDate" - uicontrol="text" - ng-model="periodSelector.compareEndDate" - full-width="true" - title="End Date" - placeholder="YYYY-MM-DD" - ></div> - </div> - </div> - - <div class="apply-button-container"> - <input - type="submit" - value="{{ 'General_Apply'|translate }}" - id="calendarApply" - class="btn" - ng-click="periodSelector.onApplyClicked()" - ng-disabled="!periodSelector.isApplyEnabled()" - /> - </div> - - <div id="ajaxLoadingCalendar" ng-if="periodSelector.isLoadingNewPage"> - <div piwik-activity-indicator loading="true"></div> - <div class="loadingSegment"> - {{ 'SegmentEditor_LoadingSegmentedDataMayTakeSomeTime'|translate }} - </div> - </div> - </div> -</div> diff --git a/plugins/CoreHome/angularjs/period-selector/period-selector.directive.js b/plugins/CoreHome/angularjs/period-selector/period-selector.directive.js deleted file mode 100644 index ab0ab4bbc9..0000000000 --- a/plugins/CoreHome/angularjs/period-selector/period-selector.directive.js +++ /dev/null @@ -1,47 +0,0 @@ -/*! - * Matomo - free/libre analytics platform - * - * @link https://matomo.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -/** - * Usage: - * <div piwik-period-selector> - */ -(function () { - angular.module('piwikApp').directive('piwikPeriodSelector', piwikPeriodSelector); - - piwikPeriodSelector.$inject = ['piwik', '$rootScope']; - - function piwikPeriodSelector(piwik, $rootScope) { - return { - restrict: 'A', - scope: { - periods: '<' - }, - templateUrl: 'plugins/CoreHome/angularjs/period-selector/period-selector.directive.html?cb=' + piwik.cacheBuster, - controller: 'PeriodSelectorController', - controllerAs: 'periodSelector', - bindToController: true, - link: function (scope, element) { - scope.periodSelector.closePeriodSelector = closePeriodSelector; - - scope.$on('$locationChangeSuccess', scope.periodSelector.updateSelectedValuesFromHash); - - $rootScope.$on('hidePeriodSelector', function () { - element.hide(); - }); - - // some widgets might hide the period selector using the event above, so ensure it's shown again when switching the page - $rootScope.$on('piwikPageChange', function () { - element.show(); - }); - - function closePeriodSelector() { - element.find('.periodSelector').removeClass('expanded'); - } - } - }; - } -})();
\ No newline at end of file diff --git a/plugins/CoreHome/javascripts/corehome.js b/plugins/CoreHome/javascripts/corehome.js index 8ff2e36a85..251ee24d4c 100644 --- a/plugins/CoreHome/javascripts/corehome.js +++ b/plugins/CoreHome/javascripts/corehome.js @@ -92,7 +92,7 @@ $( document ).ready(function() { $('.navbar.collapsible').collapsible(); - $('select').material_select(); + $('select').not('.ui-datepicker select').material_select(); piwikHelper.registerShortcut('?', _pk_translate('CoreHome_ShortcutHelp') , function (event) { // don't open if an modal is already shown diff --git a/plugins/CoreHome/lang/en.json b/plugins/CoreHome/lang/en.json index ee3c5be7ee..44416ef59f 100644 --- a/plugins/CoreHome/lang/en.json +++ b/plugins/CoreHome/lang/en.json @@ -124,6 +124,8 @@ "SoftwareSubcategoryHelp": "The Software section shows the operating systems, browsers and plugins that your visitors are using to access the site so that you can optimise your site to ensure it is fully compatible with the most popular configurations.", "EngagementSubcategoryHelp1": "The Engagement section provides reports that help to quantify how many new and returning visitors you get. You can also review reports that break down the average time and number of pages per visit, as well as the number of times a visitor has been to your site and the most common number of days between visits.", "EngagementSubcategoryHelp2": "This can help you to optimise for frequency and high-interaction visits in addition to maximising your reach.", - "PeriodHasOnlyRawData": "It looks like reports for this period have not been processed yet. Do you want to see what's happening now? Check out the %1$sVisits log%2$s or choose a different date period until the reports are generated." + "PeriodHasOnlyRawData": "It looks like reports for this period have not been processed yet. Do you want to see what's happening now? Check out the %1$sVisits log%2$s or choose a different date period until the reports are generated.", + "StartDate": "Start Date", + "EndDate": "End Date" } } diff --git a/plugins/CoreHome/vue/dist/CoreHome.umd.js b/plugins/CoreHome/vue/dist/CoreHome.umd.js index 6284561570..1bdea706c5 100644 --- a/plugins/CoreHome/vue/dist/CoreHome.umd.js +++ b/plugins/CoreHome/vue/dist/CoreHome.umd.js @@ -128,6 +128,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__8bbf__; __webpack_require__.r(__webpack_exports__); // EXPORTS +__webpack_require__.d(__webpack_exports__, "DirectiveUtilities", function() { return /* reexport */ directiveUtilities; }); __webpack_require__.d(__webpack_exports__, "debounce", function() { return /* reexport */ debounce; }); __webpack_require__.d(__webpack_exports__, "createAngularJsAdapter", function() { return /* reexport */ createAngularJsAdapter; }); __webpack_require__.d(__webpack_exports__, "transformAngularJsBoolAttr", function() { return /* reexport */ transformAngularJsBoolAttr; }); @@ -173,6 +174,7 @@ __webpack_require__.d(__webpack_exports__, "SiteSelector", function() { return / __webpack_require__.d(__webpack_exports__, "QuickAccess", function() { return /* reexport */ QuickAccess; }); __webpack_require__.d(__webpack_exports__, "FieldArray", function() { return /* reexport */ FieldArray; }); __webpack_require__.d(__webpack_exports__, "MultiPairField", function() { return /* reexport */ MultiPairField; }); +__webpack_require__.d(__webpack_exports__, "PeriodSelector", function() { return /* reexport */ PeriodSelector; }); // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js // This file is imported into lib/wc client bundles. @@ -1127,6 +1129,17 @@ var MatomoUrl_MatomoUrl = /*#__PURE__*/function () { } window.broadcast.propagateNewPage('', undefined, undefined, undefined, url); + } // if we're in an embedded context, loads an entire new URL, otherwise updates the hash + + }, { + key: "updateLocation", + value: function updateLocation(params) { + if (Matomo_Matomo.helper.isAngularRenderingThePage()) { + this.updateHash(params); + return; + } + + this.updateUrl(params); } }, { key: "getSearchParam", @@ -2165,6 +2178,20 @@ function piwikFocusIf() { } angular.module('piwikApp.directive').directive('piwikFocusIf', piwikFocusIf); +// CONCATENATED MODULE: ./plugins/CoreHome/vue/src/directiveUtilities.ts +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +function getRef(expander, binding) { + return expander instanceof HTMLElement ? expander : binding.instance.$refs[expander]; +} + +/* harmony default export */ var directiveUtilities = ({ + getRef: getRef +}); // CONCATENATED MODULE: ./plugins/CoreHome/vue/src/ExpandOnClick/ExpandOnClick.ts /*! * Matomo - free/libre analytics platform @@ -2174,6 +2201,7 @@ angular.module('piwikApp.directive').directive('piwikFocusIf', piwikFocusIf); */ + function onExpand(element) { element.classList.toggle('expanded'); var positionElement = element.querySelector('.dropdown.positionInViewport'); @@ -2232,17 +2260,19 @@ var ExpandOnClick_doc = document.documentElement; binding.value.onEscapeHandler = ExpandOnClick_onEscapeHandler.bind(null, el, binding); binding.value.onMouseDown = ExpandOnClick_onMouseDown.bind(null, binding); binding.value.onClickOutsideElement = ExpandOnClick_onClickOutsideElement.bind(null, el, binding); - binding.value.onScroll = ExpandOnClick_onScroll.bind(null, binding); // have to use jquery here since existing code will do $(...).click(). which apparently - // doesn't work when using addEventListener. - - window.$(binding.value.expander).click(binding.value.onExpand); + binding.value.onScroll = ExpandOnClick_onScroll.bind(null, binding); + setTimeout(function () { + var expander = directiveUtilities.getRef(binding.value.expander, binding); + expander.addEventListener('click', binding.value.onExpand); + }); ExpandOnClick_doc.addEventListener('keyup', binding.value.onEscapeHandler); ExpandOnClick_doc.addEventListener('mousedown', binding.value.onMouseDown); ExpandOnClick_doc.addEventListener('mouseup', binding.value.onClickOutsideElement); ExpandOnClick_doc.addEventListener('scroll', binding.value.onScroll); }, unmounted: function unmounted(el, binding) { - binding.value.expander.removeEventListener('click', binding.value.onExpand); + var expander = directiveUtilities.getRef(binding.value.expander, binding); + expander.removeEventListener('click', binding.value.onExpand); ExpandOnClick_doc.removeEventListener('keyup', binding.value.onEscapeHandler); ExpandOnClick_doc.removeEventListener('mousedown', binding.value.onMouseDown); ExpandOnClick_doc.removeEventListener('mouseup', binding.value.onClickOutsideElement); @@ -2288,6 +2318,7 @@ angular.module('piwikApp').directive('piwikExpandOnClick', piwikExpandOnClick); */ + function onMouseEnter(element) { element.classList.add('expanded'); var positionElement = element.querySelector('.dropdown.positionInViewport'); @@ -2329,13 +2360,17 @@ var ExpandOnHover_doc = document.documentElement; binding.value.onMouseLeave = onMouseLeave.bind(null, el); binding.value.onClickOutsideElement = ExpandOnHover_onClickOutsideElement.bind(null, el); binding.value.onEscapeHandler = ExpandOnHover_onEscapeHandler.bind(null, el); - binding.value.expander.addEventListener('mouseenter', binding.value.onMouseEnter); + setTimeout(function () { + var expander = directiveUtilities.getRef(binding.value.expander, binding); + expander.addEventListener('mouseenter', binding.value.onMouseEnter); + }); el.addEventListener('mouseleave', binding.value.onMouseLeave); ExpandOnHover_doc.addEventListener('keyup', binding.value.onEscapeHandler); ExpandOnHover_doc.addEventListener('mouseup', binding.value.onClickOutsideElement); }, unmounted: function unmounted(el, binding) { - binding.value.expander.removeEventListener('mouseenter', binding.value.onMouseEnter); + var expander = directiveUtilities.getRef(binding.value.expander, binding); + expander.removeEventListener('mouseenter', binding.value.onMouseEnter); el.removeEventListener('mouseleave', binding.value.onMouseLeave); document.removeEventListener('keyup', binding.value.onEscapeHandler); document.removeEventListener('mouseup', binding.value.onClickOutsideElement); @@ -3518,33 +3553,7 @@ var Comparisons_store_ComparisonsStore = /*#__PURE__*/function () { compareDates: compareDates }; // change the page w/ these new param values - if (Matomo_Matomo.helper.isAngularRenderingThePage()) { - var search = src_MatomoUrl_MatomoUrl.hashParsed.value; - - var newSearch = Comparisons_store_objectSpread(Comparisons_store_objectSpread(Comparisons_store_objectSpread({}, search), compareParams), extraParams); - - delete newSearch['compareSegments[]']; - delete newSearch['comparePeriods[]']; - delete newSearch['compareDates[]']; - - if (JSON.stringify(newSearch) !== JSON.stringify(search)) { - src_MatomoUrl_MatomoUrl.updateHash(newSearch); - } - - return; - } - - var paramsToRemove = []; - ['compareSegments', 'comparePeriods', 'compareDates'].forEach(function (name) { - if (!compareParams[name].length) { - paramsToRemove.push(name); - } - }); // angular is not rendering the page (ie, we are in the embedded dashboard) or we need to change - // the segment - - var url = src_MatomoUrl_MatomoUrl.stringify(extraParams); - var strHash = src_MatomoUrl_MatomoUrl.stringify(compareParams); - window.broadcast.propagateNewPage(url, undefined, strHash, paramsToRemove); + src_MatomoUrl_MatomoUrl.updateLocation(Comparisons_store_objectSpread(Comparisons_store_objectSpread(Comparisons_store_objectSpread({}, src_MatomoUrl_MatomoUrl.parsed.value), compareParams), extraParams)); } }, { key: "getAllSeriesColors", @@ -4514,18 +4523,18 @@ DatePickervue_type_script_lang_ts.render = DatePickervue_type_template_id_c8c462 }, $inject: ['$timeout'] })); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.vue?vue&type=template&id=d9f4b538 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.vue?vue&type=template&id=7540af5c -var DateRangePickervue_type_template_id_d9f4b538_hoisted_1 = { +var DateRangePickervue_type_template_id_7540af5c_hoisted_1 = { id: "calendarRangeFrom" }; -var DateRangePickervue_type_template_id_d9f4b538_hoisted_2 = { +var DateRangePickervue_type_template_id_7540af5c_hoisted_2 = { id: "calendarRangeTo" }; -function DateRangePickervue_type_template_id_d9f4b538_render(_ctx, _cache, $props, $setup, $data, $options) { +function DateRangePickervue_type_template_id_7540af5c_render(_ctx, _cache, $props, $setup, $data, $options) { var _component_DatePicker = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("DatePicker"); - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", DateRangePickervue_type_template_id_d9f4b538_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h6", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_DateRangeFrom')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", DateRangePickervue_type_template_id_7540af5c_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h6", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_DateRangeFrom')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { type: "text", id: "inputCalendarFrom", name: "inputCalendarFrom", @@ -4533,7 +4542,7 @@ function DateRangePickervue_type_template_id_d9f4b538_render(_ctx, _cache, $prop "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { return _ctx.startDateText = $event; }), - onChange: _cache[1] || (_cache[1] = function ($event) { + onKeydown: _cache[1] || (_cache[1] = function ($event) { return _ctx.onRangeInputChanged('from', $event); }), onKeyup: _cache[2] || (_cache[2] = function ($event) { @@ -4555,7 +4564,7 @@ function DateRangePickervue_type_template_id_d9f4b538_render(_ctx, _cache, $prop onCellHoverLeave: _cache[5] || (_cache[5] = function ($event) { return _ctx.fromPickerHighlightedDates = [null, null]; }) - }, null, 8, ["view-date", "selected-date-start", "selected-date-end", "highlighted-date-start", "highlighted-date-end"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", DateRangePickervue_type_template_id_d9f4b538_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h6", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_DateRangeTo')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, null, 8, ["view-date", "selected-date-start", "selected-date-end", "highlighted-date-start", "highlighted-date-end"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", DateRangePickervue_type_template_id_7540af5c_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h6", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_DateRangeTo')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { type: "text", id: "inputCalendarTo", name: "inputCalendarTo", @@ -4563,7 +4572,7 @@ function DateRangePickervue_type_template_id_d9f4b538_render(_ctx, _cache, $prop "onUpdate:modelValue": _cache[6] || (_cache[6] = function ($event) { return _ctx.endDateText = $event; }), - onChange: _cache[7] || (_cache[7] = function ($event) { + onKeydown: _cache[7] || (_cache[7] = function ($event) { return _ctx.onRangeInputChanged('to', $event); }), onKeyup: _cache[8] || (_cache[8] = function ($event) { @@ -4585,14 +4594,15 @@ function DateRangePickervue_type_template_id_d9f4b538_render(_ctx, _cache, $prop onCellHoverLeave: _cache[11] || (_cache[11] = function ($event) { return _ctx.toPickerHighlightedDates = [null, null]; }) - }, null, 8, ["view-date", "selected-date-start", "selected-date-end", "highlighted-date-start", "highlighted-date-end"])])], 64); + }, null, 8, ["view-date", "selected-date-start", "selected-date-end", "highlighted-date-start", "highlighted-date-end"])])]); } -// CONCATENATED MODULE: ./plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.vue?vue&type=template&id=d9f4b538 +// CONCATENATED MODULE: ./plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.vue?vue&type=template&id=7540af5c // CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/@vue/cli-plugin-typescript/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-3!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.vue?vue&type=script&lang=ts +var DATE_FORMAT = 'YYYY-MM-DD'; /* harmony default export */ var DateRangePickervue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ props: { startDate: String, @@ -4622,7 +4632,9 @@ function DateRangePickervue_type_template_id_d9f4b538_render(_ctx, _cache, $prop fromPickerHighlightedDates: [null, null], toPickerHighlightedDates: [null, null], startDateText: this.startDate, - endDateText: this.endDate + endDateText: this.endDate, + startDateInvalid: false, + endDateInvalid: false }; }, emits: ['rangeChange', 'submit'], @@ -4649,11 +4661,15 @@ function DateRangePickervue_type_template_id_d9f4b538_render(_ctx, _cache, $prop this.rangeChanged(); }, onRangeInputChanged: function onRangeInputChanged(source, event) { - if (source === 'from') { - this.setStartRangeDateFromStr(event.target.value); - } else { - this.setEndRangeDateFromStr(event.target.value); - } + var _this = this; + + setTimeout(function () { + if (source === 'from') { + _this.setStartRangeDateFromStr(event.target.value); + } else { + _this.setEndRangeDateFromStr(event.target.value); + } + }); }, getNewHighlightedDates: function getNewHighlightedDates(date, $cell) { if ($cell.hasClass('ui-datepicker-unselectable')) { @@ -4673,34 +4689,38 @@ function DateRangePickervue_type_template_id_d9f4b538_render(_ctx, _cache, $prop }); }, setStartRangeDateFromStr: function setStartRangeDateFromStr(dateStr) { + this.startDateInvalid = true; var startDateParsed; try { - startDateParsed = parseDate(dateStr); - } catch (e) { - this.startDateText = this.startDate; + if (dateStr.length === DATE_FORMAT.length) { + startDateParsed = parseDate(dateStr); + } + } catch (e) {// ignore } if (startDateParsed) { this.fromPickerSelectedDates = [startDateParsed, startDateParsed]; + this.startDateInvalid = false; + this.rangeChanged(); } - - this.rangeChanged(); }, setEndRangeDateFromStr: function setEndRangeDateFromStr(dateStr) { + this.endDateInvalid = true; var endDateParsed; try { - endDateParsed = parseDate(dateStr); - } catch (e) { - this.endDateText = this.endDate; + if (dateStr.length === DATE_FORMAT.length) { + endDateParsed = parseDate(dateStr); + } + } catch (e) {// ignore } if (endDateParsed) { this.toPickerSelectedDates = [endDateParsed, endDateParsed]; + this.endDateInvalid = false; + this.rangeChanged(); } - - this.rangeChanged(); }, rangeChanged: function rangeChanged() { this.$emit('rangeChange', { @@ -4716,7 +4736,7 @@ function DateRangePickervue_type_template_id_d9f4b538_render(_ctx, _cache, $prop -DateRangePickervue_type_script_lang_ts.render = DateRangePickervue_type_template_id_d9f4b538_render +DateRangePickervue_type_script_lang_ts.render = DateRangePickervue_type_template_id_7540af5c_render /* harmony default export */ var DateRangePicker = (DateRangePickervue_type_script_lang_ts); // CONCATENATED MODULE: ./plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.adapter.ts @@ -6561,6 +6581,186 @@ MultiPairFieldvue_type_script_lang_ts.render = MultiPairFieldvue_type_template_i } } })); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.vue?vue&type=template&id=ab9e247e + +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_1 = { + ref: "root", + class: "periodSelector piwikSelector" +}; +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_2 = ["title"]; + +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_3 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon icon-calendar" +}, null, -1); + +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_4 = { + id: "periodMore", + class: "dropdown" +}; +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_5 = { + class: "flex" +}; +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_6 = { + key: 0, + class: "period-date" +}; +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_7 = { + class: "period-type" +}; +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_8 = { + id: "otherPeriods" +}; +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_9 = ["onDblclick", "title"]; +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_10 = ["id", "checked", "onChange", "onDblclick"]; +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_11 = { + key: 0, + class: "compare-checkbox" +}; +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_12 = { + id: "comparePeriodToDropdown" +}; +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_13 = { + key: 1, + class: "compare-date-range" +}; +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_14 = { + id: "comparePeriodStartDate" +}; + +var PeriodSelectorvue_type_template_id_ab9e247e_hoisted_15 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "compare-dates-separator" +}, null, -1); + +var _hoisted_16 = { + id: "comparePeriodEndDate" +}; +var _hoisted_17 = { + class: "apply-button-container" +}; +var _hoisted_18 = ["disabled", "value"]; +var _hoisted_19 = { + key: 2, + id: "ajaxLoadingCalendar" +}; +var _hoisted_20 = { + class: "loadingSegment" +}; +function PeriodSelectorvue_type_template_id_ab9e247e_render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_DateRangePicker = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("DateRangePicker"); + + var _component_PeriodDatePicker = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("PeriodDatePicker"); + + var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + + var _component_ActivityIndicator = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ActivityIndicator"); + + var _directive_expand_on_click = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("expand-on-click"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", PeriodSelectorvue_type_template_id_ab9e247e_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + ref: "title", + id: "date", + class: "title", + tabindex: "-1", + title: _ctx.translate('General_ChooseDate', _ctx.currentlyViewingText) + }, [PeriodSelectorvue_type_template_id_ab9e247e_hoisted_3, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.currentlyViewingText), 1)], 8, PeriodSelectorvue_type_template_id_ab9e247e_hoisted_2), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", PeriodSelectorvue_type_template_id_ab9e247e_hoisted_4, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", PeriodSelectorvue_type_template_id_ab9e247e_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_DateRangePicker, { + class: "period-range", + "start-date": _ctx.startRangeDate, + "end-date": _ctx.endRangeDate, + onRangeChange: _cache[0] || (_cache[0] = function ($event) { + return _ctx.onRangeChange($event.start, $event.end); + }), + onSubmit: _cache[1] || (_cache[1] = function ($event) { + return _ctx.onApplyClicked(); + }) + }, null, 8, ["start-date", "end-date"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.selectedPeriod === 'range']]), _ctx.selectedPeriod !== 'range' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", PeriodSelectorvue_type_template_id_ab9e247e_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_PeriodDatePicker, { + id: "datepicker", + period: _ctx.selectedPeriod, + date: _ctx.periodValue === _ctx.selectedPeriod ? _ctx.dateValue : null, + onSelect: _cache[2] || (_cache[2] = function ($event) { + return _ctx.setPiwikPeriodAndDate(_ctx.selectedPeriod, $event.date); + }) + }, null, 8, ["period", "date"])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", PeriodSelectorvue_type_template_id_ab9e247e_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h6", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Period')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", PeriodSelectorvue_type_template_id_ab9e247e_hoisted_8, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.periodsFiltered, function (period) { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", { + key: period + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("label", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])({ + 'selected-period-label': period === _ctx.selectedPeriod + }), + onDblclick: function onDblclick($event) { + return _ctx.changeViewedPeriod(period); + }, + title: period === _ctx.periodValue ? '' : _ctx.translate('General_DoubleClickToChangePeriod') + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "radio", + name: "period", + id: "period_id_".concat(period), + "onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) { + return _ctx.selectedPeriod = $event; + }), + checked: _ctx.selectedPeriod === period, + onChange: function onChange($event) { + return _ctx.selectedPeriod = period; + }, + onDblclick: function onDblclick($event) { + return _ctx.changeViewedPeriod(period); + } + }, null, 40, PeriodSelectorvue_type_template_id_ab9e247e_hoisted_10), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vModelRadio"], _ctx.selectedPeriod]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.getPeriodDisplayText(period)), 1)], 42, PeriodSelectorvue_type_template_id_ab9e247e_hoisted_9)]); + }), 128))])])]), _ctx.isComparisonEnabled ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", PeriodSelectorvue_type_template_id_ab9e247e_hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("label", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + id: "comparePeriodTo", + type: "checkbox", + "onUpdate:modelValue": _cache[4] || (_cache[4] = function ($event) { + return _ctx.isComparing = $event; + }) + }, null, 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vModelCheckbox"], _ctx.isComparing]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_CompareTo')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", PeriodSelectorvue_type_template_id_ab9e247e_hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + modelValue: _ctx.comparePeriodType, + "onUpdate:modelValue": _cache[5] || (_cache[5] = function ($event) { + return _ctx.comparePeriodType = $event; + }), + style: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeStyle"])({ + 'visibility': _ctx.isComparing ? 'visible' : 'hidden' + }), + name: 'comparePeriodToDropdown', + uicontrol: 'select', + options: _ctx.comparePeriodDropdownOptions, + "full-width": true, + disabled: !_ctx.isComparing + }, null, 8, ["modelValue", "style", "options", "disabled"])])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.isComparing && _ctx.comparePeriodType === 'custom' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", PeriodSelectorvue_type_template_id_ab9e247e_hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", PeriodSelectorvue_type_template_id_ab9e247e_hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + modelValue: _ctx.compareStartDate, + "onUpdate:modelValue": _cache[6] || (_cache[6] = function ($event) { + return _ctx.compareStartDate = $event; + }), + name: 'comparePeriodStartDate', + uicontrol: 'text', + "full-width": true, + title: _ctx.translate('CoreHome_StartDate'), + placeholder: 'YYYY-MM-DD' + }, null, 8, ["modelValue", "title"])])]), PeriodSelectorvue_type_template_id_ab9e247e_hoisted_15, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + modelValue: _ctx.compareEndDate, + "onUpdate:modelValue": _cache[7] || (_cache[7] = function ($event) { + return _ctx.compareEndDate = $event; + }), + name: 'comparePeriodEndDate', + uicontrol: 'text', + "full-width": true, + title: _ctx.translate('CoreHome_EndDate'), + placeholder: 'YYYY-MM-DD' + }, null, 8, ["modelValue", "title"])])])])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_17, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "submit", + id: "calendarApply", + class: "btn", + onClick: _cache[8] || (_cache[8] = function ($event) { + return _ctx.onApplyClicked(); + }), + disabled: !_ctx.isApplyEnabled(), + value: _ctx.translate('General_Apply') + }, null, 8, _hoisted_18)]), _ctx.isLoadingNewPage ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ActivityIndicator, { + loading: true + }), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_20, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SegmentEditor_LoadingSegmentedDataMayTakeSomeTime')), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])], 512)), [[_directive_expand_on_click, { + expander: 'title' + }]]); +} +// CONCATENATED MODULE: ./plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.vue?vue&type=template&id=ab9e247e + // CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreHome/vue/src/ActivityIndicator/ActivityIndicator.vue?vue&type=template&id=6af4d064 var ActivityIndicatorvue_type_template_id_6af4d064_hoisted_1 = { @@ -6603,6 +6803,393 @@ function ActivityIndicatorvue_type_template_id_6af4d064_render(_ctx, _cache, $pr ActivityIndicatorvue_type_script_lang_ts.render = ActivityIndicatorvue_type_template_id_6af4d064_render /* harmony default export */ var ActivityIndicator = (ActivityIndicatorvue_type_script_lang_ts); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/@vue/cli-plugin-typescript/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-3!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.vue?vue&type=script&lang=ts +function PeriodSelectorvue_type_script_lang_ts_slicedToArray(arr, i) { return PeriodSelectorvue_type_script_lang_ts_arrayWithHoles(arr) || PeriodSelectorvue_type_script_lang_ts_iterableToArrayLimit(arr, i) || PeriodSelectorvue_type_script_lang_ts_unsupportedIterableToArray(arr, i) || PeriodSelectorvue_type_script_lang_ts_nonIterableRest(); } + +function PeriodSelectorvue_type_script_lang_ts_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 PeriodSelectorvue_type_script_lang_ts_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return PeriodSelectorvue_type_script_lang_ts_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 PeriodSelectorvue_type_script_lang_ts_arrayLikeToArray(o, minLen); } + +function PeriodSelectorvue_type_script_lang_ts_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 PeriodSelectorvue_type_script_lang_ts_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function PeriodSelectorvue_type_script_lang_ts_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function PeriodSelectorvue_type_script_lang_ts_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } + +function PeriodSelectorvue_type_script_lang_ts_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { PeriodSelectorvue_type_script_lang_ts_ownKeys(Object(source), true).forEach(function (key) { PeriodSelectorvue_type_script_lang_ts_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { PeriodSelectorvue_type_script_lang_ts_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function PeriodSelectorvue_type_script_lang_ts_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + + + + + + + + + + + + +var PeriodSelectorvue_type_script_lang_ts_Field = useExternalPluginComponent('CorePluginsAdmin', 'Field'); +var NBSP = Matomo_Matomo.helper.htmlDecode(' '); +var COMPARE_PERIOD_OPTIONS = [{ + key: 'custom', + value: translate('General_Custom') +}, { + key: 'previousPeriod', + value: translate('General_PreviousPeriod').replace(/\s+/, NBSP) +}, { + key: 'previousYear', + value: translate('General_PreviousYear').replace(/\s+/, NBSP) +}]; +var PeriodSelectorvue_type_script_lang_ts_piwikMinDate = new Date(Matomo_Matomo.minDateYear, Matomo_Matomo.minDateMonth - 1, Matomo_Matomo.minDateDay); +var PeriodSelectorvue_type_script_lang_ts_piwikMaxDate = new Date(Matomo_Matomo.maxDateYear, Matomo_Matomo.maxDateMonth - 1, Matomo_Matomo.maxDateDay); + +function isValidDate(d) { + if (Object.prototype.toString.call(d) !== '[object Date]') { + return false; + } + + return !Number.isNaN(d.getTime()); +} + +/* harmony default export */ var PeriodSelectorvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + periods: Array + }, + components: { + DateRangePicker: DateRangePicker, + PeriodDatePicker: PeriodDatePicker, + Field: PeriodSelectorvue_type_script_lang_ts_Field, + ActivityIndicator: ActivityIndicator + }, + directives: { + ExpandOnClick: ExpandOnClick + }, + data: function data() { + return { + comparePeriodDropdownOptions: COMPARE_PERIOD_OPTIONS, + periodValue: null, + dateValue: null, + selectedPeriod: null, + startRangeDate: null, + endRangeDate: null, + isRangeValid: null, + isLoadingNewPage: false, + isComparing: null, + comparePeriodType: 'previousPeriod', + compareStartDate: '', + compareEndDate: '' + }; + }, + mounted: function mounted() { + var _this = this; + + Matomo_Matomo.on('hidePeriodSelector', function () { + window.$(_this.$refs.root).hide(); + }); // some widgets might hide the period selector using the event above, so ensure it's + // shown again when switching the page + + Matomo_Matomo.on('piwikPageChange', function () { + window.$(_this.$refs.root).show(); + }); + this.updateSelectedValuesFromHash(); + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(function () { + return src_MatomoUrl_MatomoUrl.parsed.value; + }, this.updateSelectedValuesFromHash); + this.isComparing = Comparisons_store_instance.isComparing(); + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(function () { + return Comparisons_store_instance.isComparing(); + }, function (newVal) { + _this.isComparing = newVal; + }); + window.initTopControls(); // must be called when a top control changes width + + this.handleZIndexPositionRelativeCompareDropdownIssue(); + }, + computed: { + currentlyViewingText: function currentlyViewingText() { + var date; + + if (this.periodValue === 'range') { + if (!this.startRangeDate || !this.endRangeDate) { + return translate('General_Error'); + } + + date = "".concat(this.startRangeDate, ",").concat(this.endRangeDate); + } else { + if (!this.dateValue) { + return translate('General_Error'); + } + + date = format(this.dateValue); + } + + try { + return Periods_Periods.parse(this.periodValue, date).getPrettyString(); + } catch (e) { + return translate('General_Error'); + } + }, + isComparisonEnabled: function isComparisonEnabled() { + return Comparisons_store_instance.isComparisonEnabled(); + }, + periodsFiltered: function periodsFiltered() { + return (this.periods || []).filter(function (periodLabel) { + return Periods_Periods.isRecognizedPeriod(periodLabel); + }); + }, + selectedComparisonParams: function selectedComparisonParams() { + if (!this.isComparing) { + return {}; + } + + if (this.comparePeriodType === 'custom') { + return { + comparePeriods: ['range'], + compareDates: ["".concat(this.compareStartDate, ",").concat(this.compareEndDate)] + }; + } + + if (this.comparePeriodType === 'previousPeriod') { + return { + comparePeriods: [this.selectedPeriod], + compareDates: [this.previousPeriodDateToSelectedPeriod] + }; + } + + if (this.comparePeriodType === 'previousYear') { + var dateStr = this.selectedPeriod === 'range' ? "".concat(this.startRangeDate, ",").concat(this.endRangeDate) : this.dateValue; + var currentDateRange = Periods_Periods.parse(this.selectedPeriod, dateStr).getDateRange(); + currentDateRange[0].setFullYear(currentDateRange[0].getFullYear() - 1); + currentDateRange[1].setFullYear(currentDateRange[1].getFullYear() - 1); + + if (this.selectedPeriod === 'range') { + return { + comparePeriods: ['range'], + compareDates: ["".concat(format(currentDateRange[0]), ",").concat(format(currentDateRange[1]))] + }; + } + + return { + comparePeriods: [this.selectedPeriod], + compareDates: [format(currentDateRange[0])] + }; + } + + console.warn("Unknown compare period type: ".concat(this.comparePeriodType)); + return {}; + }, + previousPeriodDateToSelectedPeriod: function previousPeriodDateToSelectedPeriod() { + if (this.selectedPeriod === 'range') { + var currentStartRange = parseDate(this.startRangeDate); + var currentEndRange = parseDate(this.endRangeDate); + var newEndDate = Range_RangePeriod.getLastNRange('day', 2, currentStartRange).startDate; + var rangeSize = Math.floor((currentEndRange - currentStartRange) / 86400000); + var newRange = Range_RangePeriod.getLastNRange('day', 1 + rangeSize, newEndDate); + return "".concat(format(newRange.startDate), ",").concat(format(newRange.endDate)); + } + + var newStartDate = Range_RangePeriod.getLastNRange(this.selectedPeriod, 2, this.dateValue).startDate; + return format(newStartDate); + }, + selectedDateString: function selectedDateString() { + if (this.selectedPeriod === 'range') { + var dateFrom = this.startRangeDate; + var dateTo = this.endRangeDate; + var oDateFrom = parseDate(dateFrom); + var oDateTo = parseDate(dateTo); + + if (!isValidDate(oDateFrom) || !isValidDate(oDateTo) || oDateFrom > oDateTo) { + // TODO: use a notification instead? + window.$('#alert').find('h2').text(translate('General_InvalidDateRange')); + Matomo_Matomo.helper.modalConfirm('#alert', {}); + return null; + } + + return "".concat(dateFrom, ",").concat(dateTo); + } + + return format(this.dateValue); + } + }, + methods: { + handleZIndexPositionRelativeCompareDropdownIssue: function handleZIndexPositionRelativeCompareDropdownIssue() { + var $element = window.$(this.$refs.root); + $element.on('focus', '#comparePeriodToDropdown .select-dropdown', function () { + $element.addClass('compare-dropdown-open'); + }).on('blur', '#comparePeriodToDropdown .select-dropdown', function () { + $element.removeClass('compare-dropdown-open'); + }); + }, + changeViewedPeriod: function changeViewedPeriod() { + // only change period if it's different from what's being shown currently + if (this.period === this.periodValue) { + return; + } // can't just change to a range period, w/o setting two new dates + + + if (this.period === 'range') { + return; + } + + this.setPiwikPeriodAndDate(this.period, this.dateValue); + }, + setPiwikPeriodAndDate: function setPiwikPeriodAndDate(period, date) { + this.periodValue = period; + this.selectedPeriod = period; + this.dateValue = date; + var currentDateString = format(date); + this.setRangeStartEndFromPeriod(period, currentDateString); + this.propagateNewUrlParams(currentDateString, this.selectedPeriod); + window.initTopControls(); + }, + propagateNewUrlParams: function propagateNewUrlParams(date, period) { + var compareParams = this.selectedComparisonParams; + + if (Matomo_Matomo.helper.isAngularRenderingThePage()) { + this.closePeriodSelector(); + } else { + this.isLoadingNewPage = true; + } // get params without comparePeriods/compareSegments/compareDates + + + var paramsWithoutCompare = PeriodSelectorvue_type_script_lang_ts_objectSpread({}, src_MatomoUrl_MatomoUrl.parsed.value); + + delete paramsWithoutCompare.comparePeriods; + delete paramsWithoutCompare.compareSegments; + delete paramsWithoutCompare.compareDates; + src_MatomoUrl_MatomoUrl.updateLocation(PeriodSelectorvue_type_script_lang_ts_objectSpread(PeriodSelectorvue_type_script_lang_ts_objectSpread({}, paramsWithoutCompare), {}, { + date: date, + period: period + }, compareParams)); + }, + onApplyClicked: function onApplyClicked() { + if (this.selectedPeriod === 'range') { + var dateString = this.selectedDateString; + + if (!dateString) { + return; + } + + this.periodValue = 'range'; + this.propagateNewUrlParams(dateString, 'range'); + return; + } + + this.setPiwikPeriodAndDate(this.selectedPeriod, this.dateValue); + }, + updateSelectedValuesFromHash: function updateSelectedValuesFromHash() { + var _MatomoUrl$parsed$val = src_MatomoUrl_MatomoUrl.parsed.value, + date = _MatomoUrl$parsed$val.date, + period = _MatomoUrl$parsed$val.period; + this.periodValue = period; + this.selectedPeriod = period; + this.dateValue = null; + this.startRangeDate = null; + this.endRangeDate = null; + + try { + Periods_Periods.parse(period, date); + } catch (e) { + return; + } + + if (period === 'range') { + var periodObj = Periods_Periods.get(period).parse(date); + + var _periodObj$getDateRan = periodObj.getDateRange(), + _periodObj$getDateRan2 = PeriodSelectorvue_type_script_lang_ts_slicedToArray(_periodObj$getDateRan, 2), + startDate = _periodObj$getDateRan2[0], + endDate = _periodObj$getDateRan2[1]; + + this.dateValue = startDate; + this.startRangeDate = format(startDate); + this.endRangeDate = format(endDate); + } else { + this.dateValue = parseDate(date); + this.setRangeStartEndFromPeriod(period, date); + } + }, + setRangeStartEndFromPeriod: function setRangeStartEndFromPeriod(period, dateStr) { + var dateRange = Periods_Periods.parse(period, dateStr).getDateRange(); + this.startRangeDate = format(dateRange[0] < PeriodSelectorvue_type_script_lang_ts_piwikMinDate ? PeriodSelectorvue_type_script_lang_ts_piwikMinDate : dateRange[0]); + this.endRangeDate = format(dateRange[1] > PeriodSelectorvue_type_script_lang_ts_piwikMaxDate ? PeriodSelectorvue_type_script_lang_ts_piwikMaxDate : dateRange[1]); + }, + getPeriodDisplayText: function getPeriodDisplayText(periodLabel) { + return Periods_Periods.get(periodLabel).getDisplayText(); + }, + onRangeChange: function onRangeChange(start, end) { + if (!start || !end) { + this.isRangeValid = false; + return; + } + + this.isRangeValid = true; + this.startRangeDate = start; + this.endRangeDate = end; + }, + isApplyEnabled: function isApplyEnabled() { + if (this.selectedPeriod === 'range' && !this.isRangeValid) { + return false; + } + + if (this.isComparing && this.comparePeriodType === 'custom' && !this.isCompareRangeValid()) { + return false; + } + + return true; + }, + closePeriodSelector: function closePeriodSelector() { + this.$refs.root.classList.remove('expanded'); + }, + isCompareRangeValid: function isCompareRangeValid() { + try { + parseDate(this.compareStartDate); + } catch (e) { + return false; + } + + try { + parseDate(this.compareEndDate); + } catch (e) { + return false; + } + + return true; + } + } +})); +// CONCATENATED MODULE: ./plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.vue + + + +PeriodSelectorvue_type_script_lang_ts.render = PeriodSelectorvue_type_template_id_ab9e247e_render + +/* harmony default export */ var PeriodSelector = (PeriodSelectorvue_type_script_lang_ts); +// CONCATENATED MODULE: ./plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.adapter.ts +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + + +/* harmony default export */ var PeriodSelector_adapter = (createAngularJsAdapter({ + component: PeriodSelector, + scope: { + periods: { + angularJsBind: '<' + } + }, + directiveName: 'piwikPeriodSelector' +})); // CONCATENATED MODULE: ./plugins/CoreHome/vue/src/ActivityIndicator/ActivityIndicator.adapter.ts /*! * Matomo - free/libre analytics platform @@ -7337,6 +7924,9 @@ NotificationGroupvue_type_script_lang_ts.render = NotificationGroupvue_type_temp + + + // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib-no-default.js diff --git a/plugins/CoreHome/vue/dist/CoreHome.umd.min.js b/plugins/CoreHome/vue/dist/CoreHome.umd.min.js index da1a395c26..909fa37323 100644 --- a/plugins/CoreHome/vue/dist/CoreHome.umd.min.js +++ b/plugins/CoreHome/vue/dist/CoreHome.umd.min.js @@ -4,102 +4,102 @@ * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */window.hasBlockedContent=!1},"8bbf":function(t,n){t.exports=e},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"debounce",(function(){return Qr})),n.d(t,"createAngularJsAdapter",(function(){return jt})),n.d(t,"transformAngularJsBoolAttr",(function(){return kt})),n.d(t,"transformAngularJsIntAttr",(function(){return St})),n.d(t,"removeAngularJsSpecificProperties",(function(){return Ot})),n.d(t,"activityIndicatorAdapter",(function(){return ao})),n.d(t,"ActivityIndicator",(function(){return oo})),n.d(t,"translate",(function(){return C})),n.d(t,"alertAdapter",(function(){return fo})),n.d(t,"AjaxHelper",(function(){return xe})),n.d(t,"setCookie",(function(){return mo})),n.d(t,"getCookie",(function(){return po})),n.d(t,"deleteCookie",(function(){return ho})),n.d(t,"MatomoUrl",(function(){return Oe})),n.d(t,"Matomo",(function(){return S})),n.d(t,"Periods",(function(){return f})),n.d(t,"Day",(function(){return G})),n.d(t,"Week",(function(){return X})),n.d(t,"Month",(function(){return re})),n.d(t,"Year",(function(){return le})),n.d(t,"Range",(function(){return _})),n.d(t,"format",(function(){return D})),n.d(t,"getToday",(function(){return E})),n.d(t,"parseDate",(function(){return P})),n.d(t,"todayIsInRange",(function(){return T})),n.d(t,"Dropdown",(function(){return Be})),n.d(t,"FocusAnywhereButHere",(function(){return _e})),n.d(t,"FocusIf",(function(){return qe})),n.d(t,"MatomoDialog",(function(){return ut})),n.d(t,"ExpandOnClick",(function(){return Xe})),n.d(t,"ExpandOnHover",(function(){return ot})),n.d(t,"EnrichedHeadline",(function(){return Ut})),n.d(t,"ContentBlock",(function(){return Kt})),n.d(t,"Comparisons",(function(){return $n})),n.d(t,"MenuDropdown",(function(){return Xn})),n.d(t,"DatePicker",(function(){return lr})),n.d(t,"DateRangePicker",(function(){return mr})),n.d(t,"PeriodDatePicker",(function(){return br})),n.d(t,"Notification",(function(){return Do})),n.d(t,"NotificationGroup",(function(){return Fo})),n.d(t,"NotificationsStore",(function(){return Ao})),n.d(t,"SiteSelector",(function(){return Zr})),n.d(t,"QuickAccess",(function(){return Oi})),n.d(t,"FieldArray",(function(){return Ai})),n.d(t,"MultiPairField",(function(){return eo})),"undefined"!==typeof window){var r=window.document.currentScript,i=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}n("2342");var o=n("8bbf");function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} + */window.hasBlockedContent=!1},"8bbf":function(t,n){t.exports=e},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"DirectiveUtilities",(function(){return ze})),n.d(t,"debounce",(function(){return Kr})),n.d(t,"createAngularJsAdapter",(function(){return St})),n.d(t,"transformAngularJsBoolAttr",(function(){return Dt})),n.d(t,"transformAngularJsIntAttr",(function(){return Ct})),n.d(t,"removeAngularJsSpecificProperties",(function(){return kt})),n.d(t,"activityIndicatorAdapter",(function(){return za})),n.d(t,"ActivityIndicator",(function(){return Va})),n.d(t,"translate",(function(){return D})),n.d(t,"alertAdapter",(function(){return Za})),n.d(t,"AjaxHelper",(function(){return xe})),n.d(t,"setCookie",(function(){return Xa})),n.d(t,"getCookie",(function(){return eo})),n.d(t,"deleteCookie",(function(){return to})),n.d(t,"MatomoUrl",(function(){return we})),n.d(t,"Matomo",(function(){return S})),n.d(t,"Periods",(function(){return p})),n.d(t,"Day",(function(){return z})),n.d(t,"Week",(function(){return Z})),n.d(t,"Month",(function(){return re})),n.d(t,"Year",(function(){return ce})),n.d(t,"Range",(function(){return F})),n.d(t,"format",(function(){return C})),n.d(t,"getToday",(function(){return P})),n.d(t,"parseDate",(function(){return E})),n.d(t,"todayIsInRange",(function(){return V})),n.d(t,"Dropdown",(function(){return Be})),n.d(t,"FocusAnywhereButHere",(function(){return Fe})),n.d(t,"FocusIf",(function(){return qe})),n.d(t,"MatomoDialog",(function(){return pt})),n.d(t,"ExpandOnClick",(function(){return et})),n.d(t,"ExpandOnHover",(function(){return lt})),n.d(t,"EnrichedHeadline",(function(){return qt})),n.d(t,"ContentBlock",(function(){return Xt})),n.d(t,"Comparisons",(function(){return Rn})),n.d(t,"MenuDropdown",(function(){return er})),n.d(t,"DatePicker",(function(){return ur})),n.d(t,"DateRangePicker",(function(){return vr})),n.d(t,"PeriodDatePicker",(function(){return wr})),n.d(t,"Notification",(function(){return fo})),n.d(t,"NotificationGroup",(function(){return Po})),n.d(t,"NotificationsStore",(function(){return jo})),n.d(t,"SiteSelector",(function(){return ni})),n.d(t,"QuickAccess",(function(){return Si})),n.d(t,"FieldArray",(function(){return Li})),n.d(t,"MultiPairField",(function(){return ra})),n.d(t,"PeriodSelector",(function(){return Ga})),"undefined"!==typeof window){var r=window.document.currentScript,i=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}n("2342");var a=n("8bbf");function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */var u,d=function(){function e(){a(this,e),s(this,"periods",{}),s(this,"periodOrder",[])}return l(e,[{key:"addCustomPeriod",value:function(e,t){if(this.periods[e])throw new Error('The "'.concat(e,'" period already exists! It cannot be overridden.'));this.periods[e]=t,this.periodOrder.push(e)}},{key:"getAllLabels",value:function(){return Array().concat(this.periodOrder)}},{key:"get",value:function(e){var t=this.periods[e];if(!t)throw new Error("Invalid period label: ".concat(e));return t}},{key:"parse",value:function(e,t){return this.get(e).parse(t)}},{key:"isRecognizedPeriod",value:function(e){return!!this.periods[e]}}]),e}(),f=new d;function m(e){return g(e)||v(e)||h(e)||p()}function p(){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 h(e,t){if(e){if("string"===typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}function v(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function g(e){if(Array.isArray(e))return b(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r} + */var u,d=function(){function e(){o(this,e),s(this,"periods",{}),s(this,"periodOrder",[])}return c(e,[{key:"addCustomPeriod",value:function(e,t){if(this.periods[e])throw new Error('The "'.concat(e,'" period already exists! It cannot be overridden.'));this.periods[e]=t,this.periodOrder.push(e)}},{key:"getAllLabels",value:function(){return Array().concat(this.periodOrder)}},{key:"get",value:function(e){var t=this.periods[e];if(!t)throw new Error("Invalid period label: ".concat(e));return t}},{key:"parse",value:function(e,t){return this.get(e).parse(t)}},{key:"isRecognizedPeriod",value:function(e){return!!this.periods[e]}}]),e}(),p=new d;function f(e){return g(e)||v(e)||h(e)||m()}function m(){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 h(e,t){if(e){if("string"===typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}function v(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function g(e){if(Array.isArray(e))return b(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */var y=window,w=y.piwik,O=y.broadcast,j=y.piwikHelper;w.helper=j,w.broadcast=O,w.updateDateInTitle=function(e,t){if($(".top_controls #periodString").length&&(u=u||document.title,0===u.indexOf(w.siteName))){var n=" - ".concat(f.parse(t,e).getPrettyString()," ");document.title="".concat(w.siteName).concat(n).concat(u.substr(w.siteName.length))}},w.hasUserCapability=function(e){return window.angular.isArray(w.userCapabilities)&&-1!==w.userCapabilities.indexOf(e)},w.on=function(e,t){function n(e){t.apply(void 0,m(e.detail))}t.wrapper=n,window.addEventListener(e,n)},w.off=function(e,t){t.wrapper&&window.removeEventListener(e,t.wrapper)},w.postEventNoEmit=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=new CustomEvent(e,{detail:n});window.dispatchEvent(i)},w.postEvent=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];w.postEventNoEmit.apply(w,[e].concat(n)),window.angular.element((function(){var t=w.helper.getAngularDependency("$rootScope");t.$oldEmit.apply(t,[e].concat(n))}))};var k=w,S=k; + */var y=window,O=y.piwik,w=y.broadcast,j=y.piwikHelper;O.helper=j,O.broadcast=w,O.updateDateInTitle=function(e,t){if($(".top_controls #periodString").length&&(u=u||document.title,0===u.indexOf(O.siteName))){var n=" - ".concat(p.parse(t,e).getPrettyString()," ");document.title="".concat(O.siteName).concat(n).concat(u.substr(O.siteName.length))}},O.hasUserCapability=function(e){return window.angular.isArray(O.userCapabilities)&&-1!==O.userCapabilities.indexOf(e)},O.on=function(e,t){function n(e){t.apply(void 0,f(e.detail))}t.wrapper=n,window.addEventListener(e,n)},O.off=function(e,t){t.wrapper&&window.removeEventListener(e,t.wrapper)},O.postEventNoEmit=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=new CustomEvent(e,{detail:n});window.dispatchEvent(i)},O.postEvent=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];O.postEventNoEmit.apply(O,[e].concat(n)),window.angular.element((function(){var t=O.helper.getAngularDependency("$rootScope");t.$oldEmit.apply(t,[e].concat(n))}))};var k=O,S=k; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function C(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n;return 1===n.length&&n[0]&&Array.isArray(n[0])&&(i=n[0]),window._pk_translate(e,i)} +function D(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n;return 1===n.length&&n[0]&&Array.isArray(n[0])&&(i=n[0]),window._pk_translate(e,i)} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function D(e){return $.datepicker.formatDate("yy-mm-dd",e)}function E(){var e=new Date(Date.now());return e.setTime(e.getTime()+60*e.getTimezoneOffset()*1e3),e.setHours(e.getHours()+(window.piwik.timezoneOffset||0)/3600),e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e}function P(e){if(e instanceof Date)return e;var t=decodeURIComponent(e).trim();if(""===t)throw new Error("Invalid date, empty string.");if("today"===t||"now"===t)return E();if("yesterday"===t||"yesterdaySameTime"===t){var n=E();return n.setDate(n.getDate()-1),n}if(t.match(/last[ -]?week/i)){var r=E();return r.setDate(r.getDate()-7),r}if(t.match(/last[ -]?month/i)){var i=E();return i.setDate(1),i.setMonth(i.getMonth()-1),i}if(t.match(/last[ -]?year/i)){var o=E();return o.setFullYear(o.getFullYear()-1),o}return $.datepicker.parseDate("yy-mm-dd",t)}function T(e){return 2===e.length&&(E()>=e[0]&&E()<=e[1])}function I(e,t){return A(e)||B(e,t)||x(e,t)||V()}function V(){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 x(e,t){if(e){if("string"===typeof e)return N(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?N(e,t):void 0}}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function B(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(o.push(r.value),t&&o.length===t)break}catch(l){c=!0,i=l}finally{try{a||null==n["return"]||n["return"]()}finally{if(c)throw i}}return o}}function A(e){if(Array.isArray(e))return e}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function H(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),e}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} + */function C(e){return $.datepicker.formatDate("yy-mm-dd",e)}function P(){var e=new Date(Date.now());return e.setTime(e.getTime()+60*e.getTimezoneOffset()*1e3),e.setHours(e.getHours()+(window.piwik.timezoneOffset||0)/3600),e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e}function E(e){if(e instanceof Date)return e;var t=decodeURIComponent(e).trim();if(""===t)throw new Error("Invalid date, empty string.");if("today"===t||"now"===t)return P();if("yesterday"===t||"yesterdaySameTime"===t){var n=P();return n.setDate(n.getDate()-1),n}if(t.match(/last[ -]?week/i)){var r=P();return r.setDate(r.getDate()-7),r}if(t.match(/last[ -]?month/i)){var i=P();return i.setDate(1),i.setMonth(i.getMonth()-1),i}if(t.match(/last[ -]?year/i)){var a=P();return a.setFullYear(a.getFullYear()-1),a}return $.datepicker.parseDate("yy-mm-dd",t)}function V(e){return 2===e.length&&(P()>=e[0]&&P()<=e[1])}function T(e,t){return A(e)||B(e,t)||x(e,t)||I()}function I(){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 x(e,t){if(e){if("string"===typeof e)return N(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?N(e,t):void 0}}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function B(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done);o=!0)if(a.push(r.value),t&&a.length===t)break}catch(c){l=!0,i=c}finally{try{o||null==n["return"]||n["return"]()}finally{if(l)throw i}}return a}}function A(e){if(Array.isArray(e))return e}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function R(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),e}function H(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */var _=function(){function e(t,n,r){M(this,e),F(this,"startDate",void 0),F(this,"endDate",void 0),F(this,"childPeriodType",void 0),this.startDate=t,this.endDate=n,this.childPeriodType=r}return H(e,[{key:"getPrettyString",value:function(){var e=D(this.startDate),t=D(this.endDate);return C("General_DateRangeFromTo",[e,t])}},{key:"getDateRange",value:function(){return[this.startDate,this.endDate]}},{key:"containsToday",value:function(){return T(this.getDateRange())}},{key:"getDayCount",value:function(){return Math.ceil((this.endDate.getTime()-this.startDate.getTime())/864e5)+1}}],[{key:"getLastNRange",value:function(t,n,r){var i=Math.max(parseInt(n.toString(),10)-1,0);if(Number.isNaN(i))throw new Error("Invalid range strAmount");var o=r?P(r):E(),a=new Date(o.getTime());if("day"===t)a.setDate(a.getDate()-i);else if("week"===t)a.setDate(a.getDate()-7*i);else if("month"===t)a.setDate(1),a.setMonth(a.getMonth()-i);else{if("year"!==t)throw new Error("Unknown period type '".concat(t,"'."));a.setFullYear(a.getFullYear()-i)}if("day"!==t){var c=f.periods[t].parse(a),l=f.periods[t].parse(o),s=c.getDateRange(),u=I(s,1);a=u[0];var d=l.getDateRange(),m=I(d,2);o=m[1]}var p=new Date(1991,7,6);if(a.getTime()-p.getTime()<0)switch(t){case"year":a=new Date(1992,0,1);break;case"month":a=new Date(1991,8,1);break;case"week":a=new Date(1991,8,12);break;case"day":default:a=p;break}return new e(a,o,t)}},{key:"getLastNRangeChild",value:function(t,n,r){var i=n?P(n):E(),o=new Date(i.getTime()),a=new Date(i.getTime());if("day"===t)o.setDate(o.getDate()-r),a.setDate(a.getDate()-r);else if("week"===t)o.setDate(o.getDate()-7*r),a.setDate(a.getDate()-7*r);else if("month"===t)o.setDate(1),o.setMonth(o.getMonth()-r),a.setDate(1),a.setMonth(a.getMonth()-r);else{if("year"!==t)throw new Error("Unknown period type '".concat(t,"'."));o.setFullYear(o.getFullYear()-r),a.setFullYear(a.getFullYear()-r)}if("day"!==t){var c=f.periods[t].parse(o),l=f.periods[t].parse(a),s=c.getDateRange(),u=I(s,1);o=u[0];var d=l.getDateRange(),m=I(d,2);a=m[1]}var p=new Date(1991,7,6);if(o.getTime()-p.getTime()<0)switch(t){case"year":o=new Date(1992,0,1);break;case"month":o=new Date(1991,8,1);break;case"week":o=new Date(1991,8,12);break;case"day":default:o=p;break}return new e(o,a,t)}},{key:"parse",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"day";if(/^previous/.test(t)){var r=e.getLastNRange(n,"2").startDate;return e.getLastNRange(n,t.substring(8),r)}if(/^last/.test(t))return e.getLastNRange(n,t.substring(4));var i=decodeURIComponent(t).split(",");return new e(P(i[0]),P(i[1]),n)}},{key:"getDisplayText",value:function(){return C("General_DateRangeInPeriodList")}}]),e}();function U(){return{getAllLabels:f.getAllLabels.bind(f),isRecognizedPeriod:f.isRecognizedPeriod.bind(f),get:f.get.bind(f),parse:f.parse.bind(f),parseDate:P,format:D,RangePeriod:_,todayIsInRange:T}}function R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function q(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function J(e,t,n){return t&&q(e.prototype,t),n&&q(e,n),e}function z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} + */var F=function(){function e(t,n,r){M(this,e),H(this,"startDate",void 0),H(this,"endDate",void 0),H(this,"childPeriodType",void 0),this.startDate=t,this.endDate=n,this.childPeriodType=r}return R(e,[{key:"getPrettyString",value:function(){var e=C(this.startDate),t=C(this.endDate);return D("General_DateRangeFromTo",[e,t])}},{key:"getDateRange",value:function(){return[this.startDate,this.endDate]}},{key:"containsToday",value:function(){return V(this.getDateRange())}},{key:"getDayCount",value:function(){return Math.ceil((this.endDate.getTime()-this.startDate.getTime())/864e5)+1}}],[{key:"getLastNRange",value:function(t,n,r){var i=Math.max(parseInt(n.toString(),10)-1,0);if(Number.isNaN(i))throw new Error("Invalid range strAmount");var a=r?E(r):P(),o=new Date(a.getTime());if("day"===t)o.setDate(o.getDate()-i);else if("week"===t)o.setDate(o.getDate()-7*i);else if("month"===t)o.setDate(1),o.setMonth(o.getMonth()-i);else{if("year"!==t)throw new Error("Unknown period type '".concat(t,"'."));o.setFullYear(o.getFullYear()-i)}if("day"!==t){var l=p.periods[t].parse(o),c=p.periods[t].parse(a),s=l.getDateRange(),u=T(s,1);o=u[0];var d=c.getDateRange(),f=T(d,2);a=f[1]}var m=new Date(1991,7,6);if(o.getTime()-m.getTime()<0)switch(t){case"year":o=new Date(1992,0,1);break;case"month":o=new Date(1991,8,1);break;case"week":o=new Date(1991,8,12);break;case"day":default:o=m;break}return new e(o,a,t)}},{key:"getLastNRangeChild",value:function(t,n,r){var i=n?E(n):P(),a=new Date(i.getTime()),o=new Date(i.getTime());if("day"===t)a.setDate(a.getDate()-r),o.setDate(o.getDate()-r);else if("week"===t)a.setDate(a.getDate()-7*r),o.setDate(o.getDate()-7*r);else if("month"===t)a.setDate(1),a.setMonth(a.getMonth()-r),o.setDate(1),o.setMonth(o.getMonth()-r);else{if("year"!==t)throw new Error("Unknown period type '".concat(t,"'."));a.setFullYear(a.getFullYear()-r),o.setFullYear(o.getFullYear()-r)}if("day"!==t){var l=p.periods[t].parse(a),c=p.periods[t].parse(o),s=l.getDateRange(),u=T(s,1);a=u[0];var d=c.getDateRange(),f=T(d,2);o=f[1]}var m=new Date(1991,7,6);if(a.getTime()-m.getTime()<0)switch(t){case"year":a=new Date(1992,0,1);break;case"month":a=new Date(1991,8,1);break;case"week":a=new Date(1991,8,12);break;case"day":default:a=m;break}return new e(a,o,t)}},{key:"parse",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"day";if(/^previous/.test(t)){var r=e.getLastNRange(n,"2").startDate;return e.getLastNRange(n,t.substring(8),r)}if(/^last/.test(t))return e.getLastNRange(n,t.substring(4));var i=decodeURIComponent(t).split(",");return new e(E(i[0]),E(i[1]),n)}},{key:"getDisplayText",value:function(){return D("General_DateRangeInPeriodList")}}]),e}();function _(){return{getAllLabels:p.getAllLabels.bind(p),isRecognizedPeriod:p.isRecognizedPeriod.bind(p),get:p.get.bind(p),parse:p.parse.bind(p),parseDate:E,format:C,RangePeriod:F,todayIsInRange:V}}function U(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function q(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function J(e,t,n){return t&&q(e.prototype,t),n&&q(e,n),e}function G(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */f.addCustomPeriod("range",_), + */p.addCustomPeriod("range",F), /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -window.piwik.addCustomPeriod=f.addCustomPeriod.bind(f),window.angular.module("piwikApp.service").factory("piwikPeriods",U);var G=function(){function e(t){R(this,e),z(this,"dateInPeriod",void 0),this.dateInPeriod=t}return J(e,[{key:"getPrettyString",value:function(){return D(this.dateInPeriod)}},{key:"getDateRange",value:function(){return[new Date(this.dateInPeriod.getTime()),new Date(this.dateInPeriod.getTime())]}},{key:"containsToday",value:function(){return T(this.getDateRange())}}],[{key:"parse",value:function(t){return new e(P(t))}},{key:"getDisplayText",value:function(){return C("Intl_PeriodDay")}}]),e}();function Q(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function W(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Y(e,t,n){return t&&W(e.prototype,t),n&&W(e,n),e}function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} +window.piwik.addCustomPeriod=p.addCustomPeriod.bind(p),window.angular.module("piwikApp.service").factory("piwikPeriods",_);var z=function(){function e(t){U(this,e),G(this,"dateInPeriod",void 0),this.dateInPeriod=t}return J(e,[{key:"getPrettyString",value:function(){return C(this.dateInPeriod)}},{key:"getDateRange",value:function(){return[new Date(this.dateInPeriod.getTime()),new Date(this.dateInPeriod.getTime())]}},{key:"containsToday",value:function(){return V(this.getDateRange())}}],[{key:"parse",value:function(t){return new e(E(t))}},{key:"getDisplayText",value:function(){return D("Intl_PeriodDay")}}]),e}();function Y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Q(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function W(e,t,n){return t&&Q(e.prototype,t),n&&Q(e,n),e}function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */f.addCustomPeriod("day",G);var X=function(){function e(t){Q(this,e),K(this,"dateInPeriod",void 0),this.dateInPeriod=t}return Y(e,[{key:"getPrettyString",value:function(){var e=this.getDateRange(),t=D(e[0]),n=D(e[1]);return C("General_DateRangeFromTo",[t,n])}},{key:"getDateRange",value:function(){var e=(this.dateInPeriod.getDay()+6)%7,t=new Date(this.dateInPeriod.getTime());t.setDate(this.dateInPeriod.getDate()-e);var n=new Date(t.getTime());return n.setDate(t.getDate()+6),[t,n]}},{key:"containsToday",value:function(){return T(this.getDateRange())}}],[{key:"parse",value:function(t){return new e(P(t))}},{key:"getDisplayText",value:function(){return C("Intl_PeriodWeek")}}]),e}();function Z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function te(e,t,n){return t&&ee(e.prototype,t),n&&ee(e,n),e}function ne(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} + */p.addCustomPeriod("day",z);var Z=function(){function e(t){Y(this,e),K(this,"dateInPeriod",void 0),this.dateInPeriod=t}return W(e,[{key:"getPrettyString",value:function(){var e=this.getDateRange(),t=C(e[0]),n=C(e[1]);return D("General_DateRangeFromTo",[t,n])}},{key:"getDateRange",value:function(){var e=(this.dateInPeriod.getDay()+6)%7,t=new Date(this.dateInPeriod.getTime());t.setDate(this.dateInPeriod.getDate()-e);var n=new Date(t.getTime());return n.setDate(t.getDate()+6),[t,n]}},{key:"containsToday",value:function(){return V(this.getDateRange())}}],[{key:"parse",value:function(t){return new e(E(t))}},{key:"getDisplayText",value:function(){return D("Intl_PeriodWeek")}}]),e}();function X(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function te(e,t,n){return t&&ee(e.prototype,t),n&&ee(e,n),e}function ne(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */f.addCustomPeriod("week",X);var re=function(){function e(t){Z(this,e),ne(this,"dateInPeriod",void 0),this.dateInPeriod=t}return te(e,[{key:"getPrettyString",value:function(){var e=C("Intl_Month_Long_StandAlone_".concat(this.dateInPeriod.getMonth()+1));return"".concat(e," ").concat(this.dateInPeriod.getFullYear())}},{key:"getDateRange",value:function(){var e=new Date(this.dateInPeriod.getTime());e.setDate(1);var t=new Date(this.dateInPeriod.getTime());return t.setDate(1),t.setMonth(t.getMonth()+1),t.setDate(0),[e,t]}},{key:"containsToday",value:function(){return T(this.getDateRange())}}],[{key:"parse",value:function(t){return new e(P(t))}},{key:"getDisplayText",value:function(){return C("Intl_PeriodMonth")}}]),e}();function ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ae(e,t,n){return t&&oe(e.prototype,t),n&&oe(e,n),e}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} + */p.addCustomPeriod("week",Z);var re=function(){function e(t){X(this,e),ne(this,"dateInPeriod",void 0),this.dateInPeriod=t}return te(e,[{key:"getPrettyString",value:function(){var e=D("Intl_Month_Long_StandAlone_".concat(this.dateInPeriod.getMonth()+1));return"".concat(e," ").concat(this.dateInPeriod.getFullYear())}},{key:"getDateRange",value:function(){var e=new Date(this.dateInPeriod.getTime());e.setDate(1);var t=new Date(this.dateInPeriod.getTime());return t.setDate(1),t.setMonth(t.getMonth()+1),t.setDate(0),[e,t]}},{key:"containsToday",value:function(){return V(this.getDateRange())}}],[{key:"parse",value:function(t){return new e(E(t))}},{key:"getDisplayText",value:function(){return D("Intl_PeriodMonth")}}]),e}();function ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ae(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t,n){return t&&ae(e.prototype,t),n&&ae(e,n),e}function le(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */f.addCustomPeriod("month",re);var le=function(){function e(t){ie(this,e),ce(this,"dateInPeriod",void 0),this.dateInPeriod=t}return ae(e,[{key:"getPrettyString",value:function(){return this.dateInPeriod.getFullYear().toString()}},{key:"getDateRange",value:function(){var e=new Date(this.dateInPeriod.getTime());e.setMonth(0),e.setDate(1);var t=new Date(this.dateInPeriod.getTime());return t.setMonth(12),t.setDate(0),[e,t]}},{key:"containsToday",value:function(){return T(this.getDateRange())}}],[{key:"parse",value:function(t){return new e(P(t))}},{key:"getDisplayText",value:function(){return C("Intl_PeriodYear")}}]),e}(); + */p.addCustomPeriod("month",re);var ce=function(){function e(t){ie(this,e),le(this,"dateInPeriod",void 0),this.dateInPeriod=t}return oe(e,[{key:"getPrettyString",value:function(){return this.dateInPeriod.getFullYear().toString()}},{key:"getDateRange",value:function(){var e=new Date(this.dateInPeriod.getTime());e.setMonth(0),e.setDate(1);var t=new Date(this.dateInPeriod.getTime());return t.setMonth(12),t.setDate(0),[e,t]}},{key:"containsToday",value:function(){return V(this.getDateRange())}}],[{key:"parse",value:function(t){return new e(E(t))}},{key:"getDisplayText",value:function(){return D("Intl_PeriodYear")}}]),e}(); /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?se(Object(n),!0).forEach((function(t){pe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function de(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function me(e,t,n){return t&&fe(e.prototype,t),n&&fe(e,n),e}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} +function se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?se(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function de(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function fe(e,t,n){return t&&pe(e.prototype,t),n&&pe(e,n),e}function me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */f.addCustomPeriod("year",le);var he=window,ve=he.piwik,ge=he.broadcast;function be(e,t){try{return f.parse(e,t),!0}catch(n){return!1}}var ye=function(){function e(){var t=this;de(this,e),pe(this,"urlQuery",Object(o["ref"])("")),pe(this,"hashQuery",Object(o["ref"])("")),pe(this,"urlParsed",Object(o["computed"])((function(){return Object(o["readonly"])(ge.getValuesFromUrl("?".concat(t.urlQuery.value),!0))}))),pe(this,"hashParsed",Object(o["computed"])((function(){return Object(o["readonly"])(ge.getValuesFromUrl("?".concat(t.hashQuery.value),!0))}))),pe(this,"parsed",Object(o["computed"])((function(){return Object(o["readonly"])(ue(ue({},t.urlParsed.value),t.hashParsed.value))}))),this.setUrlQuery(window.location.search),this.setHashQuery(window.location.hash),S.on("$locationChangeSuccess",(function(e){var n=new URL(e);t.setUrlQuery(n.search.replace(/^\?/,"")),t.setHashQuery(n.hash.replace(/^#/,""))})),this.updatePeriodParamsFromUrl()}return me(e,[{key:"updateHash",value:function(e){var t="string"!==typeof e?this.stringify(e):e,n=S.helper.getAngularDependency("$location");n.search(t)}},{key:"updateUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n="string"!==typeof e?this.stringify(e):e,r="string"!==typeof t?this.stringify(t):t,i="?".concat(n);r.length&&(i="".concat(i,"#?").concat(r)),window.broadcast.propagateNewPage("",void 0,void 0,void 0,i)}},{key:"getSearchParam",value:function(e){var t=window.location.href.split("#"),n=new RegExp("".concat(e,"(\\[]|=)"));if(t&&t[1]&&n.test(decodeURIComponent(t[1]))){var r=window.broadcast.getValueFromHash(e,window.location.href);if(r||"date"!==e&&"period"!==e&&"idSite"!==e)return r}return window.broadcast.getValueFromUrl(e,window.location.search)}},{key:"stringify",value:function(e){return $.param(e).replace(/%5B%5D/g,"[]")}},{key:"updatePeriodParamsFromUrl",value:function(){var e=this.getSearchParam("date"),t=this.getSearchParam("period");if(be(t,e)&&(ve.period!==t||ve.currentDateString!==e)){ve.period=t;var n=f.parse(t,e).getDateRange();ve.startDateString=D(n[0]),ve.endDateString=D(n[1]),ve.updateDateInTitle(e,t),"range"===ve.period&&(e="".concat(ve.startDateString,",").concat(ve.endDateString)),ve.currentDateString=e}}},{key:"setUrlQuery",value:function(e){this.urlQuery.value=e.replace(/^\?/,"")}},{key:"setHashQuery",value:function(e){this.hashQuery.value=e.replace(/^[#/?]+/,"")}}]),e}(),we=new ye,Oe=we; + */p.addCustomPeriod("year",ce);var he=window,ve=he.piwik,ge=he.broadcast;function be(e,t){try{return p.parse(e,t),!0}catch(n){return!1}}var ye=function(){function e(){var t=this;de(this,e),me(this,"urlQuery",Object(a["ref"])("")),me(this,"hashQuery",Object(a["ref"])("")),me(this,"urlParsed",Object(a["computed"])((function(){return Object(a["readonly"])(ge.getValuesFromUrl("?".concat(t.urlQuery.value),!0))}))),me(this,"hashParsed",Object(a["computed"])((function(){return Object(a["readonly"])(ge.getValuesFromUrl("?".concat(t.hashQuery.value),!0))}))),me(this,"parsed",Object(a["computed"])((function(){return Object(a["readonly"])(ue(ue({},t.urlParsed.value),t.hashParsed.value))}))),this.setUrlQuery(window.location.search),this.setHashQuery(window.location.hash),S.on("$locationChangeSuccess",(function(e){var n=new URL(e);t.setUrlQuery(n.search.replace(/^\?/,"")),t.setHashQuery(n.hash.replace(/^#/,""))})),this.updatePeriodParamsFromUrl()}return fe(e,[{key:"updateHash",value:function(e){var t="string"!==typeof e?this.stringify(e):e,n=S.helper.getAngularDependency("$location");n.search(t)}},{key:"updateUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n="string"!==typeof e?this.stringify(e):e,r="string"!==typeof t?this.stringify(t):t,i="?".concat(n);r.length&&(i="".concat(i,"#?").concat(r)),window.broadcast.propagateNewPage("",void 0,void 0,void 0,i)}},{key:"updateLocation",value:function(e){S.helper.isAngularRenderingThePage()?this.updateHash(e):this.updateUrl(e)}},{key:"getSearchParam",value:function(e){var t=window.location.href.split("#"),n=new RegExp("".concat(e,"(\\[]|=)"));if(t&&t[1]&&n.test(decodeURIComponent(t[1]))){var r=window.broadcast.getValueFromHash(e,window.location.href);if(r||"date"!==e&&"period"!==e&&"idSite"!==e)return r}return window.broadcast.getValueFromUrl(e,window.location.search)}},{key:"stringify",value:function(e){return $.param(e).replace(/%5B%5D/g,"[]")}},{key:"updatePeriodParamsFromUrl",value:function(){var e=this.getSearchParam("date"),t=this.getSearchParam("period");if(be(t,e)&&(ve.period!==t||ve.currentDateString!==e)){ve.period=t;var n=p.parse(t,e).getDateRange();ve.startDateString=C(n[0]),ve.endDateString=C(n[1]),ve.updateDateInTitle(e,t),"range"===ve.period&&(e="".concat(ve.startDateString,",").concat(ve.endDateString)),ve.currentDateString=e}}},{key:"setUrlQuery",value:function(e){this.urlQuery.value=e.replace(/^\?/,"")}},{key:"setHashQuery",value:function(e){this.hashQuery.value=e.replace(/^[#/?]+/,"")}}]),e}(),Oe=new ye,we=Oe; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function je(){var e={getSearchParam:Oe.getSearchParam.bind(Oe)};return e} +function je(){var e={getSearchParam:we.getSearchParam.bind(we)};return e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function ke(){return S}function Se(e,t){t.$oldEmit=t.$emit,t.$emit=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return S.postEvent.apply(S,[e].concat(n)),null},t.$oldBroadcast=t.$broadcast,t.$broadcast=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return S.postEventNoEmit.apply(S,[e].concat(r)),t.$oldBroadcast.apply(t,[e].concat(r))},t.$on("$locationChangeSuccess",e.updatePeriodParamsFromUrl)}function Ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function De(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach((function(t){Ie(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ee(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Te(e,t,n){return t&&Pe(e.prototype,t),n&&Pe(e,n),e}function Ie(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} +function ke(){return S}function Se(e,t){t.$oldEmit=t.$emit,t.$emit=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return S.postEvent.apply(S,[e].concat(n)),null},t.$oldBroadcast=t.$broadcast,t.$broadcast=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return S.postEventNoEmit.apply(S,[e].concat(r)),t.$oldBroadcast.apply(t,[e].concat(r))},t.$on("$locationChangeSuccess",e.updatePeriodParamsFromUrl)}function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){Te(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Pe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ee(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ve(e,t,n){return t&&Ee(e.prototype,t),n&&Ee(e,n),e}function Te(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function Ve(e,t){if("abort"!==t)if("undefined"!==typeof Piwik_Popover){var n=$("#loadingError");Piwik_Popover.isOpen()&&e&&500===e.status?e&&500===e.status&&$(document.body).html(piwikHelper.escape(e.responseText)):n.show()}else console.log("Request failed: ".concat(e.responseText))}ve.updatePeriodParamsFromUrl=we.updatePeriodParamsFromUrl.bind(we),je.$inject=[],angular.module("piwikApp.service").service("piwikUrl",je),window.angular.module("piwikApp.service").service("piwik",ke),Se.$inject=["piwik","$rootScope"],window.angular.module("piwikApp.service").run(Se),window.globalAjaxQueue=[],window.globalAjaxQueue.active=0,window.globalAjaxQueue.clean=function(){for(var e=this.length;e>=0;e-=1)this[e]&&4!==this[e].readyState||this.splice(e,1)},window.globalAjaxQueue.push=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.active+=n.length,this.clean(),(e=Array.prototype.push).call.apply(e,[this].concat(n))},window.globalAjaxQueue.abort=function(){this.forEach((function(e){return e&&e.abort&&e.abort()})),this.splice(0,this.length),this.active=0};var xe=function(){function e(){Ee(this,e),Ie(this,"format","json"),Ie(this,"timeout",null),Ie(this,"callback",null),Ie(this,"useRegularCallbackInCaseOfError",!1),Ie(this,"errorCallback",void 0),Ie(this,"withToken",!1),Ie(this,"completeCallback",void 0),Ie(this,"getParams",{}),Ie(this,"getUrl","?"),Ie(this,"postParams",{}),Ie(this,"loadingElement",null),Ie(this,"errorElement","#ajaxError"),Ie(this,"requestHandle",null),Ie(this,"defaultParams",["idSite","period","date","segment"]),this.errorCallback=Ve}return Te(e,[{key:"addParams",value:function(e,t){var n=this,r="string"===typeof e?window.broadcast.getValuesFromUrl(e):e,i=["compareSegments","comparePeriods","compareDates"];Object.keys(r).forEach((function(e){var o=r[e];(-1===i.indexOf(e)||o)&&("get"===t.toLowerCase()?n.getParams[e]=o:"post"===t.toLowerCase()&&(n.postParams[e]=o))}))}},{key:"withTokenInUrl",value:function(){this.withToken=!0}},{key:"setUrl",value:function(e){this.addParams(broadcast.getValuesFromUrl(e),"GET")}},{key:"setBulkRequests",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.map((function(e){return"string"===typeof e?e:$.param(e)}));this.addParams({module:"API",method:"API.getBulkRequest",urls:r,format:"json"},"post")}},{key:"setTimeout",value:function(e){this.timeout=e}},{key:"setCallback",value:function(e){this.callback=e}},{key:"useCallbackInCaseOfError",value:function(){this.useRegularCallbackInCaseOfError=!0}},{key:"redirectOnSuccess",value:function(e){this.setCallback((function(){piwikHelper.redirect(e)}))}},{key:"setErrorCallback",value:function(e){this.errorCallback=e}},{key:"setCompleteCallback",value:function(e){this.completeCallback=e}},{key:"setFormat",value:function(e){this.format=e}},{key:"setLoadingElement",value:function(e){this.loadingElement=e||"#ajaxLoadingDiv"}},{key:"setErrorElement",value:function(e){e&&(this.errorElement=e)}},{key:"useGETDefaultParameter",value:function(e){if(e&&this.defaultParams)for(var t=0;t<this.defaultParams.length;t+=1)if(this.defaultParams[t]===e)return!0;return!1}},{key:"removeDefaultParameter",value:function(e){if(e&&this.defaultParams)for(var t=0;t<this.defaultParams.length;t+=1)this.defaultParams[t]===e&&this.defaultParams.splice(t,1)}},{key:"send",value:function(){var e=this;$(this.errorElement).length&&$(this.errorElement).hide(),this.loadingElement&&$(this.loadingElement).fadeIn(),this.requestHandle=this.buildAjaxCall(),window.globalAjaxQueue.push(this.requestHandle);var t=new Promise((function(t,n){e.requestHandle.then(t).fail((function(t){"abort"!==t.statusText&&(console.log("Warning: the ".concat($.param(e.getParams)," request failed!")),n(t))}))}));return t.abort=function(){e.requestHandle&&e.requestHandle.abort()},t}},{key:"abort",value:function(){this.requestHandle&&"function"===typeof this.requestHandle.abort&&(this.requestHandle.abort(),this.requestHandle=null)}},{key:"buildAjaxCall",value:function(){var e=this,t=this,n=this.mixinDefaultGetParams(this.getParams),r=this.getUrl;"?"!==r[r.length-1]&&(r+="&"),n.segment&&(r="".concat(r,"segment=").concat(n.segment,"&"),delete n.segment),n.date&&(r="".concat(r,"date=").concat(decodeURIComponent(n.date.toString()),"&"),delete n.date),r+=$.param(n);var i={type:"POST",async:!0,url:r,dataType:this.format||"json",complete:this.completeCallback,error:function(){if(window.globalAjaxQueue.active-=1,t.errorCallback){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.errorCallback.apply(this,n)}},success:function(t,n,r){if(e.loadingElement&&$(e.loadingElement).hide(),t&&"error"===t.result&&!e.useRegularCallbackInCaseOfError){var i=null,o="toast";if($(e.errorElement).length&&t.message&&($(e.errorElement).show(),i=e.errorElement,o=null),t.message){var a=window["require"]("piwik/UI"),c=new a.Notification;c.show(t.message,{placeat:i,context:"error",type:o,id:"ajaxHelper"}),c.scrollToNotification()}}else e.callback&&e.callback(t,n,r);window.globalAjaxQueue.active-=1,S.ajaxRequestFinished&&S.ajaxRequestFinished()},data:this.mixinDefaultPostParams(this.postParams),timeout:null!==this.timeout?this.timeout:void 0};return $.ajax(i)}},{key:"isRequestToApiMethod",value:function(){return this.getParams&&"API"===this.getParams.module&&this.getParams.method||this.postParams&&"API"===this.postParams.module&&this.postParams.method}},{key:"isWidgetizedRequest",value:function(){return"Widgetize"===broadcast.getValueFromUrl("module")}},{key:"getDefaultPostParams",value:function(){return this.withToken||this.isRequestToApiMethod()||S.shouldPropagateTokenAuth?{token_auth:S.token_auth,force_api_session:broadcast.isWidgetizeRequestWithoutSession()?0:1}:{}}},{key:"mixinDefaultPostParams",value:function(e){var t=this.getDefaultPostParams(),n=De(De({},t),e);return n}},{key:"mixinDefaultGetParams",value:function(e){var t=this,n=Oe.getSearchParam("segment"),r={idSite:S.idSite?S.idSite.toString():broadcast.getValueFromUrl("idSite"),period:S.period||broadcast.getValueFromUrl("period"),segment:n},i=e;return i.token_auth&&(i.token_auth=null,delete i.token_auth),Object.keys(r).forEach((function(e){t.useGETDefaultParameter(e)&&!i[e]&&!t.postParams[e]&&r[e]&&(i[e]=r[e])})),!this.useGETDefaultParameter("date")||i.date||this.postParams.date||(i.date=S.currentDateString),i}}],[{key:"fetch",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new e;return n.withTokenInUrl&&r.withTokenInUrl(),r.setFormat("json"),r.addParams(De({module:"API",format:"json"},t),"get"),n.postParams&&r.addParams(n.postParams,"post"),r.send()}}]),e}();function Ne(){return globalAjaxQueue}window.ajaxHelper=xe,angular.module("piwikApp.service").service("globalAjaxQueue",Ne); + */function Ie(e,t){if("abort"!==t)if("undefined"!==typeof Piwik_Popover){var n=$("#loadingError");Piwik_Popover.isOpen()&&e&&500===e.status?e&&500===e.status&&$(document.body).html(piwikHelper.escape(e.responseText)):n.show()}else console.log("Request failed: ".concat(e.responseText))}ve.updatePeriodParamsFromUrl=Oe.updatePeriodParamsFromUrl.bind(Oe),je.$inject=[],angular.module("piwikApp.service").service("piwikUrl",je),window.angular.module("piwikApp.service").service("piwik",ke),Se.$inject=["piwik","$rootScope"],window.angular.module("piwikApp.service").run(Se),window.globalAjaxQueue=[],window.globalAjaxQueue.active=0,window.globalAjaxQueue.clean=function(){for(var e=this.length;e>=0;e-=1)this[e]&&4!==this[e].readyState||this.splice(e,1)},window.globalAjaxQueue.push=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.active+=n.length,this.clean(),(e=Array.prototype.push).call.apply(e,[this].concat(n))},window.globalAjaxQueue.abort=function(){this.forEach((function(e){return e&&e.abort&&e.abort()})),this.splice(0,this.length),this.active=0};var xe=function(){function e(){Pe(this,e),Te(this,"format","json"),Te(this,"timeout",null),Te(this,"callback",null),Te(this,"useRegularCallbackInCaseOfError",!1),Te(this,"errorCallback",void 0),Te(this,"withToken",!1),Te(this,"completeCallback",void 0),Te(this,"getParams",{}),Te(this,"getUrl","?"),Te(this,"postParams",{}),Te(this,"loadingElement",null),Te(this,"errorElement","#ajaxError"),Te(this,"requestHandle",null),Te(this,"defaultParams",["idSite","period","date","segment"]),this.errorCallback=Ie}return Ve(e,[{key:"addParams",value:function(e,t){var n=this,r="string"===typeof e?window.broadcast.getValuesFromUrl(e):e,i=["compareSegments","comparePeriods","compareDates"];Object.keys(r).forEach((function(e){var a=r[e];(-1===i.indexOf(e)||a)&&("get"===t.toLowerCase()?n.getParams[e]=a:"post"===t.toLowerCase()&&(n.postParams[e]=a))}))}},{key:"withTokenInUrl",value:function(){this.withToken=!0}},{key:"setUrl",value:function(e){this.addParams(broadcast.getValuesFromUrl(e),"GET")}},{key:"setBulkRequests",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.map((function(e){return"string"===typeof e?e:$.param(e)}));this.addParams({module:"API",method:"API.getBulkRequest",urls:r,format:"json"},"post")}},{key:"setTimeout",value:function(e){this.timeout=e}},{key:"setCallback",value:function(e){this.callback=e}},{key:"useCallbackInCaseOfError",value:function(){this.useRegularCallbackInCaseOfError=!0}},{key:"redirectOnSuccess",value:function(e){this.setCallback((function(){piwikHelper.redirect(e)}))}},{key:"setErrorCallback",value:function(e){this.errorCallback=e}},{key:"setCompleteCallback",value:function(e){this.completeCallback=e}},{key:"setFormat",value:function(e){this.format=e}},{key:"setLoadingElement",value:function(e){this.loadingElement=e||"#ajaxLoadingDiv"}},{key:"setErrorElement",value:function(e){e&&(this.errorElement=e)}},{key:"useGETDefaultParameter",value:function(e){if(e&&this.defaultParams)for(var t=0;t<this.defaultParams.length;t+=1)if(this.defaultParams[t]===e)return!0;return!1}},{key:"removeDefaultParameter",value:function(e){if(e&&this.defaultParams)for(var t=0;t<this.defaultParams.length;t+=1)this.defaultParams[t]===e&&this.defaultParams.splice(t,1)}},{key:"send",value:function(){var e=this;$(this.errorElement).length&&$(this.errorElement).hide(),this.loadingElement&&$(this.loadingElement).fadeIn(),this.requestHandle=this.buildAjaxCall(),window.globalAjaxQueue.push(this.requestHandle);var t=new Promise((function(t,n){e.requestHandle.then(t).fail((function(t){"abort"!==t.statusText&&(console.log("Warning: the ".concat($.param(e.getParams)," request failed!")),n(t))}))}));return t.abort=function(){e.requestHandle&&e.requestHandle.abort()},t}},{key:"abort",value:function(){this.requestHandle&&"function"===typeof this.requestHandle.abort&&(this.requestHandle.abort(),this.requestHandle=null)}},{key:"buildAjaxCall",value:function(){var e=this,t=this,n=this.mixinDefaultGetParams(this.getParams),r=this.getUrl;"?"!==r[r.length-1]&&(r+="&"),n.segment&&(r="".concat(r,"segment=").concat(n.segment,"&"),delete n.segment),n.date&&(r="".concat(r,"date=").concat(decodeURIComponent(n.date.toString()),"&"),delete n.date),r+=$.param(n);var i={type:"POST",async:!0,url:r,dataType:this.format||"json",complete:this.completeCallback,error:function(){if(window.globalAjaxQueue.active-=1,t.errorCallback){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.errorCallback.apply(this,n)}},success:function(t,n,r){if(e.loadingElement&&$(e.loadingElement).hide(),t&&"error"===t.result&&!e.useRegularCallbackInCaseOfError){var i=null,a="toast";if($(e.errorElement).length&&t.message&&($(e.errorElement).show(),i=e.errorElement,a=null),t.message){var o=window["require"]("piwik/UI"),l=new o.Notification;l.show(t.message,{placeat:i,context:"error",type:a,id:"ajaxHelper"}),l.scrollToNotification()}}else e.callback&&e.callback(t,n,r);window.globalAjaxQueue.active-=1,S.ajaxRequestFinished&&S.ajaxRequestFinished()},data:this.mixinDefaultPostParams(this.postParams),timeout:null!==this.timeout?this.timeout:void 0};return $.ajax(i)}},{key:"isRequestToApiMethod",value:function(){return this.getParams&&"API"===this.getParams.module&&this.getParams.method||this.postParams&&"API"===this.postParams.module&&this.postParams.method}},{key:"isWidgetizedRequest",value:function(){return"Widgetize"===broadcast.getValueFromUrl("module")}},{key:"getDefaultPostParams",value:function(){return this.withToken||this.isRequestToApiMethod()||S.shouldPropagateTokenAuth?{token_auth:S.token_auth,force_api_session:broadcast.isWidgetizeRequestWithoutSession()?0:1}:{}}},{key:"mixinDefaultPostParams",value:function(e){var t=this.getDefaultPostParams(),n=Ce(Ce({},t),e);return n}},{key:"mixinDefaultGetParams",value:function(e){var t=this,n=we.getSearchParam("segment"),r={idSite:S.idSite?S.idSite.toString():broadcast.getValueFromUrl("idSite"),period:S.period||broadcast.getValueFromUrl("period"),segment:n},i=e;return i.token_auth&&(i.token_auth=null,delete i.token_auth),Object.keys(r).forEach((function(e){t.useGETDefaultParameter(e)&&!i[e]&&!t.postParams[e]&&r[e]&&(i[e]=r[e])})),!this.useGETDefaultParameter("date")||i.date||this.postParams.date||(i.date=S.currentDateString),i}}],[{key:"fetch",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new e;return n.withTokenInUrl&&r.withTokenInUrl(),r.setFormat("json"),r.addParams(Ce({module:"API",format:"json"},t),"get"),n.postParams&&r.addParams(n.postParams,"post"),r.send()}}]),e}();function Ne(){return globalAjaxQueue}window.ajaxHelper=xe,angular.module("piwikApp.service").service("globalAjaxQueue",Ne); /*! * Matomo - free/libre analytics platform * @@ -118,21 +118,21 @@ function ke(){return S}function Se(e,t){t.$oldEmit=t.$emit,t.$emit=function(e){f * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function Me(e,t,n){var r=t.value.isMouseDown&&t.value.hasScrolled;t.value.isMouseDown=!1,t.value.hasScrolled=!1,r||e.contains(n.target)||t.value&&t.value.blur()}function $e(e,t){t.value.hasScrolled=!0}function Le(e,t){t.value.isMouseDown=!0,t.value.hasScrolled=!1}function He(e,t,n){27===n.which&&setTimeout((function(){t.value.isMouseDown=!1,t.value.hasScrolled=!1,t.value.blur&&t.value.blur()}),0)}Ae.$inject=["$timeout"],angular.module("piwikApp").directive("piwikDropdownMenu",Ae);var Fe=document.documentElement,_e={mounted:function(e,t){t.value.isMouseDown=!1,t.value.hasScrolled=!1,t.value.onEscapeHandler=He.bind(null,e,t),t.value.onMouseDown=Le.bind(null,e,t),t.value.onClickOutsideElement=Me.bind(null,e,t),t.value.onScroll=$e.bind(null,e,t),Fe.addEventListener("keyup",t.value.onEscapeHandler),Fe.addEventListener("mousedown",t.value.onMouseDown),Fe.addEventListener("mouseup",t.value.onClickOutsideElement),Fe.addEventListener("scroll",t.value.onScroll)},unmounted:function(e,t){Fe.removeEventListener("keyup",t.value.onEscapeHandler),Fe.removeEventListener("mousedown",t.value.onMouseDown),Fe.removeEventListener("mouseup",t.value.onClickOutsideElement),Fe.removeEventListener("scroll",t.value.onScroll)}}; +function Me(e,t,n){var r=t.value.isMouseDown&&t.value.hasScrolled;t.value.isMouseDown=!1,t.value.hasScrolled=!1,r||e.contains(n.target)||t.value&&t.value.blur()}function $e(e,t){t.value.hasScrolled=!0}function Le(e,t){t.value.isMouseDown=!0,t.value.hasScrolled=!1}function Re(e,t,n){27===n.which&&setTimeout((function(){t.value.isMouseDown=!1,t.value.hasScrolled=!1,t.value.blur&&t.value.blur()}),0)}Ae.$inject=["$timeout"],angular.module("piwikApp").directive("piwikDropdownMenu",Ae);var He=document.documentElement,Fe={mounted:function(e,t){t.value.isMouseDown=!1,t.value.hasScrolled=!1,t.value.onEscapeHandler=Re.bind(null,e,t),t.value.onMouseDown=Le.bind(null,e,t),t.value.onClickOutsideElement=Me.bind(null,e,t),t.value.onScroll=$e.bind(null,e,t),He.addEventListener("keyup",t.value.onEscapeHandler),He.addEventListener("mousedown",t.value.onMouseDown),He.addEventListener("mouseup",t.value.onClickOutsideElement),He.addEventListener("scroll",t.value.onScroll)},unmounted:function(e,t){He.removeEventListener("keyup",t.value.onEscapeHandler),He.removeEventListener("mousedown",t.value.onMouseDown),He.removeEventListener("mouseup",t.value.onClickOutsideElement),He.removeEventListener("scroll",t.value.onScroll)}}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function Ue(){return{restrict:"A",link:function(e,t,n){var r={instance:null,value:{blur:function(){setTimeout((function(){e.$apply(n.piwikFocusAnywhereButHere)}),0)}},oldValue:null,modifiers:{},dir:{}};_e.mounted(t[0],r),t.on("$destroy",(function(){return _e.unmounted(t[0],r)}))}}} +function _e(){return{restrict:"A",link:function(e,t,n){var r={instance:null,value:{blur:function(){setTimeout((function(){e.$apply(n.piwikFocusAnywhereButHere)}),0)}},oldValue:null,modifiers:{},dir:{}};Fe.mounted(t[0],r),t.on("$destroy",(function(){return Fe.unmounted(t[0],r)}))}}} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function Re(e,t){t.arg&&setTimeout((function(){e.focus(),t.value.afterFocus&&t.value.afterFocus()}),5)}Ue.$inject=[],angular.module("piwikApp.directive").directive("piwikFocusAnywhereButHere",Ue);var qe={mounted:function(e,t){Re(e,t)},updated:function(e,t){Re(e,t)}}; +function Ue(e,t){t.arg&&setTimeout((function(){e.focus(),t.value.afterFocus&&t.value.afterFocus()}),5)}_e.$inject=[],angular.module("piwikApp.directive").directive("piwikFocusAnywhereButHere",_e);var qe={mounted:function(e,t){Ue(e,t)},updated:function(e,t){Ue(e,t)}}; /*! * Matomo - free/libre analytics platform * @@ -145,161 +145,167 @@ function Re(e,t){t.arg&&setTimeout((function(){e.focus(),t.value.afterFocus&&t.v * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function ze(e){e.classList.toggle("expanded");var t=e.querySelector(".dropdown.positionInViewport");t&&S.helper.setMarginLeftToBeInViewport(t)}function Ge(e,t,n){var r=t.value.isMouseDown&&t.value.hasScrolled;t.value.isMouseDown=!1,t.value.hasScrolled=!1,r||e.contains(n.target)||e.classList.remove("expanded")}function Qe(e){e.value.hasScrolled=!0}function We(e){e.value.isMouseDown=!0,e.value.hasScrolled=!1}function Ye(e,t,n){27===n.which&&(t.value.isMouseDown=!1,t.value.hasScrolled=!1,e.classList.remove("expanded"))}angular.module("piwikApp.directive").directive("piwikFocusIf",Je);var Ke=document.documentElement,Xe={mounted:function(e,t){t.value.isMouseDown=!1,t.value.hasScrolled=!1,t.value.onExpand=ze.bind(null,e),t.value.onEscapeHandler=Ye.bind(null,e,t),t.value.onMouseDown=We.bind(null,t),t.value.onClickOutsideElement=Ge.bind(null,e,t),t.value.onScroll=Qe.bind(null,t),window.$(t.value.expander).click(t.value.onExpand),Ke.addEventListener("keyup",t.value.onEscapeHandler),Ke.addEventListener("mousedown",t.value.onMouseDown),Ke.addEventListener("mouseup",t.value.onClickOutsideElement),Ke.addEventListener("scroll",t.value.onScroll)},unmounted:function(e,t){t.value.expander.removeEventListener("click",t.value.onExpand),Ke.removeEventListener("keyup",t.value.onEscapeHandler),Ke.removeEventListener("mousedown",t.value.onMouseDown),Ke.removeEventListener("mouseup",t.value.onClickOutsideElement),Ke.removeEventListener("scroll",t.value.onScroll)}}; +function Ge(e,t){return e instanceof HTMLElement?e:t.instance.$refs[e]}angular.module("piwikApp.directive").directive("piwikFocusIf",Je);var ze={getRef:Ge}; +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */function Ye(e){e.classList.toggle("expanded");var t=e.querySelector(".dropdown.positionInViewport");t&&S.helper.setMarginLeftToBeInViewport(t)}function Qe(e,t,n){var r=t.value.isMouseDown&&t.value.hasScrolled;t.value.isMouseDown=!1,t.value.hasScrolled=!1,r||e.contains(n.target)||e.classList.remove("expanded")}function We(e){e.value.hasScrolled=!0}function Ke(e){e.value.isMouseDown=!0,e.value.hasScrolled=!1}function Ze(e,t,n){27===n.which&&(t.value.isMouseDown=!1,t.value.hasScrolled=!1,e.classList.remove("expanded"))}var Xe=document.documentElement,et={mounted:function(e,t){t.value.isMouseDown=!1,t.value.hasScrolled=!1,t.value.onExpand=Ye.bind(null,e),t.value.onEscapeHandler=Ze.bind(null,e,t),t.value.onMouseDown=Ke.bind(null,t),t.value.onClickOutsideElement=Qe.bind(null,e,t),t.value.onScroll=We.bind(null,t),setTimeout((function(){var e=ze.getRef(t.value.expander,t);e.addEventListener("click",t.value.onExpand)})),Xe.addEventListener("keyup",t.value.onEscapeHandler),Xe.addEventListener("mousedown",t.value.onMouseDown),Xe.addEventListener("mouseup",t.value.onClickOutsideElement),Xe.addEventListener("scroll",t.value.onScroll)},unmounted:function(e,t){var n=ze.getRef(t.value.expander,t);n.removeEventListener("click",t.value.onExpand),Xe.removeEventListener("keyup",t.value.onEscapeHandler),Xe.removeEventListener("mousedown",t.value.onMouseDown),Xe.removeEventListener("mouseup",t.value.onClickOutsideElement),Xe.removeEventListener("scroll",t.value.onScroll)}}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function Ze(){return{restrict:"A",link:function(e,t){var n={instance:null,value:{expander:t.find(".title").first()[0]},oldValue:null,modifiers:{},dir:{}};Xe.mounted(t[0],n),t.on("$destroy",(function(){return Xe.unmounted(t[0],n)}))}}} +function tt(){return{restrict:"A",link:function(e,t){var n={instance:null,value:{expander:t.find(".title").first()[0]},oldValue:null,modifiers:{},dir:{}};et.mounted(t[0],n),t.on("$destroy",(function(){return et.unmounted(t[0],n)}))}}} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function et(e){e.classList.add("expanded");var t=e.querySelector(".dropdown.positionInViewport");t&&S.helper.setMarginLeftToBeInViewport(t)}function tt(e){e.classList.remove("expanded")}function nt(e,t){e.contains(t.target)||e.classList.remove("expanded")}function rt(e,t){27===t.which&&e.classList.remove("expanded")}Ze.$inject=[],angular.module("piwikApp").directive("piwikExpandOnClick",Ze);var it=document.documentElement,ot={mounted:function(e,t){t.value.onMouseEnter=et.bind(null,e),t.value.onMouseLeave=tt.bind(null,e),t.value.onClickOutsideElement=nt.bind(null,e),t.value.onEscapeHandler=rt.bind(null,e),t.value.expander.addEventListener("mouseenter",t.value.onMouseEnter),e.addEventListener("mouseleave",t.value.onMouseLeave),it.addEventListener("keyup",t.value.onEscapeHandler),it.addEventListener("mouseup",t.value.onClickOutsideElement)},unmounted:function(e,t){t.value.expander.removeEventListener("mouseenter",t.value.onMouseEnter),e.removeEventListener("mouseleave",t.value.onMouseLeave),document.removeEventListener("keyup",t.value.onEscapeHandler),document.removeEventListener("mouseup",t.value.onClickOutsideElement)}}; +function nt(e){e.classList.add("expanded");var t=e.querySelector(".dropdown.positionInViewport");t&&S.helper.setMarginLeftToBeInViewport(t)}function rt(e){e.classList.remove("expanded")}function it(e,t){e.contains(t.target)||e.classList.remove("expanded")}function at(e,t){27===t.which&&e.classList.remove("expanded")}tt.$inject=[],angular.module("piwikApp").directive("piwikExpandOnClick",tt);var ot=document.documentElement,lt={mounted:function(e,t){t.value.onMouseEnter=nt.bind(null,e),t.value.onMouseLeave=rt.bind(null,e),t.value.onClickOutsideElement=it.bind(null,e),t.value.onEscapeHandler=at.bind(null,e),setTimeout((function(){var e=ze.getRef(t.value.expander,t);e.addEventListener("mouseenter",t.value.onMouseEnter)})),e.addEventListener("mouseleave",t.value.onMouseLeave),ot.addEventListener("keyup",t.value.onEscapeHandler),ot.addEventListener("mouseup",t.value.onClickOutsideElement)},unmounted:function(e,t){var n=ze.getRef(t.value.expander,t);n.removeEventListener("mouseenter",t.value.onMouseEnter),e.removeEventListener("mouseleave",t.value.onMouseLeave),document.removeEventListener("keyup",t.value.onEscapeHandler),document.removeEventListener("mouseup",t.value.onClickOutsideElement)}}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -function at(){return{restrict:"A",link:function(e,t){var n={instance:null,value:{expander:t.find(".title").first()[0]},oldValue:null,modifiers:{},dir:{}};ot.mounted(t[0],n),t.on("$destroy",(function(){return ot.unmounted(t[0],n)}))}}}at.$inject=[],angular.module("piwikApp").directive("piwikExpandOnHover",at);var ct={ref:"root"};function lt(e,t,n,r,i,a){return Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["createElementBlock"])("div",ct,[Object(o["renderSlot"])(e.$slots,"default")],512)),[[o["vShow"],e.modelValue]])}var st=Object(o["defineComponent"])({props:{modelValue:{type:Boolean,required:!0},element:{type:HTMLElement,required:!1}},emits:["yes","no","closeEnd","close","validation","update:modelValue"],activated:function(){this.$emit("update:modelValue",!1)},watch:{modelValue:function(e,t){var n=this;if(e){var r=this.element||this.$refs.root.firstElementChild;S.helper.modalConfirm(r,{yes:function(){n.$emit("yes")},no:function(){n.$emit("no")},validation:function(){n.$emit("validation")}},{onCloseEnd:function(){n.element||n.$refs.root.appendChild(r),n.$emit("update:modelValue",!1),n.$emit("closeEnd")}})}else!1===e&&!0===t&&this.$emit("close")}}});st.render=lt;var ut=st;function dt(e,t){return vt(e)||ht(e,t)||mt(e,t)||ft()}function ft(){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 mt(e,t){if(e){if("string"===typeof e)return pt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pt(e,t):void 0}}function pt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ht(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(r=n.next()).done);a=!0)if(o.push(r.value),t&&o.length===t)break}catch(l){c=!0,i=l}finally{try{a||null==n["return"]||n["return"]()}finally{if(c)throw i}}return o}}function vt(e){if(Array.isArray(e))return e}function gt(e){return gt="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gt(e)} +function ct(){return{restrict:"A",link:function(e,t){var n={instance:null,value:{expander:t.find(".title").first()[0]},oldValue:null,modifiers:{},dir:{}};lt.mounted(t[0],n),t.on("$destroy",(function(){return lt.unmounted(t[0],n)}))}}}ct.$inject=[],angular.module("piwikApp").directive("piwikExpandOnHover",ct);var st={ref:"root"};function ut(e,t,n,r,i,o){return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",st,[Object(a["renderSlot"])(e.$slots,"default")],512)),[[a["vShow"],e.modelValue]])}var dt=Object(a["defineComponent"])({props:{modelValue:{type:Boolean,required:!0},element:{type:HTMLElement,required:!1}},emits:["yes","no","closeEnd","close","validation","update:modelValue"],activated:function(){this.$emit("update:modelValue",!1)},watch:{modelValue:function(e,t){var n=this;if(e){var r=this.element||this.$refs.root.firstElementChild;S.helper.modalConfirm(r,{yes:function(){n.$emit("yes")},no:function(){n.$emit("no")},validation:function(){n.$emit("validation")}},{onCloseEnd:function(){n.element||n.$refs.root.appendChild(r),n.$emit("update:modelValue",!1),n.$emit("closeEnd")}})}else!1===e&&!0===t&&this.$emit("close")}}});dt.render=ut;var pt=dt;function ft(e,t){return bt(e)||gt(e,t)||ht(e,t)||mt()}function mt(){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 ht(e,t){if(e){if("string"===typeof e)return vt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vt(e,t):void 0}}function vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function gt(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done);o=!0)if(a.push(r.value),t&&a.length===t)break}catch(c){l=!0,i=c}finally{try{o||null==n["return"]||n["return"]()}finally{if(l)throw i}}return a}}function bt(e){if(Array.isArray(e))return e}function yt(e){return yt="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yt(e)} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */var bt=0;function yt(e){return e.substring(0,1).toLowerCase()+e.substring(1).replace(/[A-Z]/g,(function(e){return"-".concat(e.toLowerCase())}))}function wt(e){return e.substring(0,1).toLowerCase()+e.substring(1).replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))}function Ot(e){return"object"===gt(e)&&null!==e&&Object.getPrototypeOf(e)===Object.prototype?Object.fromEntries(Object.entries(e).filter((function(e){return!/^\$/.test(e[0])}))):e}function jt(e){var t=e.component,n=e.require,r=e.scope,i=void 0===r?{}:r,a=e.events,c=void 0===a?{}:a,l=e.$inject,s=e.directiveName,u=e.transclude,d=e.mountPointFactory,f=e.postCreate,m=e.noScope,p=e.restrict,h=void 0===p?"A":p,v=e.priority,g=bt;u&&(bt+=1);var b={};function y(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];var l={restrict:h,require:n,priority:v,scope:m?void 0:b,compile:function(){return{post:function(e,n,a,l){var s=u?n.find("[ng-transclude][counter=".concat(g,"]")):null,m="<root-component";Object.entries(c).forEach((function(e){var t=dt(e,1),n=t[0];m+=" @".concat(yt(n),"=\"onEventHandler('").concat(n,"', $event)\"")})),Object.entries(i).forEach((function(e){var t=dt(e,2),n=t[0],r=t[1];if("&"===r.angularJsBind){var i=yt(n);c[i]||(m+=" @".concat(i,"=\"onEventHandler('").concat(i,"', $event)\""))}else m+=" :".concat(yt(r.vue),'="').concat(r.vue,'"')})),m+=">",u&&(m+='<div ref="transcludeTarget"/>'),m+="</root-component>";var p=Object(o["createApp"])({template:m,data:function(){var t=this,o={};return Object.entries(i).forEach((function(i){var c=dt(i,2),s=c[0],u=c[1],d=Ot(e[s]);"undefined"===typeof d&&"undefined"!==typeof u.default&&(d=u.default instanceof Function?u.default.apply(u,[e,n,a].concat(r)):u.default),u.transform&&(d=u.transform.apply(u,[d,t,e,n,a,l].concat(r))),o[u.vue]=d})),o},setup:function(){if(u){var e=Object(o["ref"])(null);return{transcludeTarget:e}}},methods:{onEventHandler:function(t,i){var o=wt(t);e[o]&&e[o](i),c[t]&&c[t].apply(c,[i,this,e,n,a,l].concat(r))}}});p.config.globalProperties.$sanitize=window.vueSanitize,p.config.globalProperties.translate=C,p.component("root-component",t);var h=d?d.apply(void 0,[e,n,a].concat(r)):n[0],v=p.mount(h);Object.entries(i).forEach((function(t){var i=dt(t,2),o=i[0],c=i[1];c.angularJsBind&&"&"!==c.angularJsBind&&e.$watch(o,(function(t){var i=Ot(t);"undefined"!==typeof c.default&&"undefined"===typeof t&&(i=c.default instanceof Function?c.default.apply(c,[e,n,a].concat(r)):c.default),c.transform&&(i=c.transform.apply(c,[i,v,e,n,a,l].concat(r))),v[c.vue]=i}))})),u&&$(v.transcludeTarget).append(s),f&&f.apply(void 0,[v,e,n,a,l].concat(r)),n.on("$destroy",(function(){p.unmount()}))}}}};return u&&(l.transclude=!0,l.template='<div ng-transclude counter="'.concat(g,'"/>')),l}return Object.entries(i).forEach((function(e){var t=dt(e,2),n=t[0],r=t[1];r.vue||(r.vue=n),r.angularJsBind&&(b[n]=r.angularJsBind)})),y.$inject=l||[],angular.module("piwikApp").directive(s,y),y}function kt(e){if("undefined"!==typeof e)return"true"===e||!!e&&e>0&&"0"!==e}function St(e){if("undefined"!==typeof e)return null===e?null:parseInt(e,10)} + */var Ot=0;function wt(e){return e.substring(0,1).toLowerCase()+e.substring(1).replace(/[A-Z]/g,(function(e){return"-".concat(e.toLowerCase())}))}function jt(e){return e.substring(0,1).toLowerCase()+e.substring(1).replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))}function kt(e){return"object"===yt(e)&&null!==e&&Object.getPrototypeOf(e)===Object.prototype?Object.fromEntries(Object.entries(e).filter((function(e){return!/^\$/.test(e[0])}))):e}function St(e){var t=e.component,n=e.require,r=e.scope,i=void 0===r?{}:r,o=e.events,l=void 0===o?{}:o,c=e.$inject,s=e.directiveName,u=e.transclude,d=e.mountPointFactory,p=e.postCreate,f=e.noScope,m=e.restrict,h=void 0===m?"A":m,v=e.priority,g=Ot;u&&(Ot+=1);var b={};function y(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];var c={restrict:h,require:n,priority:v,scope:f?void 0:b,compile:function(){return{post:function(e,n,o,c){var s=u?n.find("[ng-transclude][counter=".concat(g,"]")):null,f="<root-component";Object.entries(l).forEach((function(e){var t=ft(e,1),n=t[0];f+=" @".concat(wt(n),"=\"onEventHandler('").concat(n,"', $event)\"")})),Object.entries(i).forEach((function(e){var t=ft(e,2),n=t[0],r=t[1];if("&"===r.angularJsBind){var i=wt(n);l[i]||(f+=" @".concat(i,"=\"onEventHandler('").concat(i,"', $event)\""))}else f+=" :".concat(wt(r.vue),'="').concat(r.vue,'"')})),f+=">",u&&(f+='<div ref="transcludeTarget"/>'),f+="</root-component>";var m=Object(a["createApp"])({template:f,data:function(){var t=this,a={};return Object.entries(i).forEach((function(i){var l=ft(i,2),s=l[0],u=l[1],d=kt(e[s]);"undefined"===typeof d&&"undefined"!==typeof u.default&&(d=u.default instanceof Function?u.default.apply(u,[e,n,o].concat(r)):u.default),u.transform&&(d=u.transform.apply(u,[d,t,e,n,o,c].concat(r))),a[u.vue]=d})),a},setup:function(){if(u){var e=Object(a["ref"])(null);return{transcludeTarget:e}}},methods:{onEventHandler:function(t,i){var a=jt(t);e[a]&&e[a](i),l[t]&&l[t].apply(l,[i,this,e,n,o,c].concat(r))}}});m.config.globalProperties.$sanitize=window.vueSanitize,m.config.globalProperties.translate=D,m.component("root-component",t);var h=d?d.apply(void 0,[e,n,o].concat(r)):n[0],v=m.mount(h);Object.entries(i).forEach((function(t){var i=ft(t,2),a=i[0],l=i[1];l.angularJsBind&&"&"!==l.angularJsBind&&e.$watch(a,(function(t){var i=kt(t);"undefined"!==typeof l.default&&"undefined"===typeof t&&(i=l.default instanceof Function?l.default.apply(l,[e,n,o].concat(r)):l.default),l.transform&&(i=l.transform.apply(l,[i,v,e,n,o,c].concat(r))),v[l.vue]=i}))})),u&&$(v.transcludeTarget).append(s),p&&p.apply(void 0,[v,e,n,o,c].concat(r)),n.on("$destroy",(function(){m.unmount()}))}}}};return u&&(c.transclude=!0,c.template='<div ng-transclude counter="'.concat(g,'"/>')),c}return Object.entries(i).forEach((function(e){var t=ft(e,2),n=t[0],r=t[1];r.vue||(r.vue=n),r.angularJsBind&&(b[n]=r.angularJsBind)})),y.$inject=c||[],angular.module("piwikApp").directive(s,y),y}function Dt(e){if("undefined"!==typeof e)return"true"===e||!!e&&e>0&&"0"!==e}function Ct(e){if("undefined"!==typeof e)return null===e?null:parseInt(e,10)} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */jt({component:ut,scope:{show:{vue:"modelValue",default:!1},element:{default:function(e,t){return t[0]}}},events:{yes:function(e,t,n,r,i){i.yes&&(n.$eval(i.yes),setTimeout((function(){n.$apply()}),0))},no:function(e,t,n,r,i){i.no&&(n.$eval(i.no),setTimeout((function(){n.$apply()}),0))},validation:function(e,t,n,r,i){i.no&&(n.$eval(i.no),setTimeout((function(){n.$apply()}),0))},close:function(e,t,n,r,i){i.close&&(n.$eval(i.close),setTimeout((function(){n.$apply()}),0))},"update:modelValue":function(e,t,n,r,i,o,a){setTimeout((function(){n.$apply(a(i.piwikDialog).assign(n,e))}),0)}},$inject:["$parse"],directiveName:"piwikDialog",transclude:!0,mountPointFactory:function(e,t){var n=$('<div class="vue-placeholder"/>');return n.appendTo(t),n[0]},postCreate:function(e,t,n,r){t.$watch(r.piwikDialog,(function(t,n){n!==t&&(e.modelValue=t||!1)}))},noScope:!0});var Ct={key:0,class:"title",tabindex:"6"},Dt=["href","title"],Et={class:"iconsBar"},Pt=["href","title"],Tt=Object(o["createElementVNode"])("span",{class:"icon-help"},null,-1),It=[Tt],Vt=["title"],xt=Object(o["createElementVNode"])("span",{class:"icon-info"},null,-1),Nt=[xt],Bt={class:"ratingIcons"},At={class:"inlineHelp"},Mt=["innerHTML"],$t=["href"];function Lt(e,t,n,r,i,a){var c=Object(o["resolveComponent"])("RateFeature");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:"enrichedHeadline",onMouseenter:t[1]||(t[1]=function(t){return e.showIcons=!0}),onMouseleave:t[2]||(t[2]=function(t){return e.showIcons=!1}),ref:"root"},[e.editUrl?Object(o["createCommentVNode"])("",!0):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Ct,[Object(o["renderSlot"])(e.$slots,"default")])),e.editUrl?(Object(o["openBlock"])(),Object(o["createElementBlock"])("a",{key:1,class:"title",href:e.editUrl,title:e.translate("CoreHome_ClickToEditX",e.$sanitize(e.actualFeatureName))},[Object(o["renderSlot"])(e.$slots,"default")],8,Dt)):Object(o["createCommentVNode"])("",!0),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",Et,[e.helpUrl&&!e.actualInlineHelp?(Object(o["openBlock"])(),Object(o["createElementBlock"])("a",{key:0,rel:"noreferrer noopener",target:"_blank",class:"helpIcon",href:e.helpUrl,title:e.translate("CoreHome_ExternalHelp")},It,8,Pt)):Object(o["createCommentVNode"])("",!0),e.actualInlineHelp?(Object(o["openBlock"])(),Object(o["createElementBlock"])("a",{key:1,onClick:t[0]||(t[0]=function(t){return e.showInlineHelp=!e.showInlineHelp}),class:Object(o["normalizeClass"])(["helpIcon",{active:e.showInlineHelp}]),title:e.translate(e.reportGenerated?"General_HelpReport":"General_Help")},Nt,10,Vt)):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("div",Bt,[Object(o["createVNode"])(c,{title:e.actualFeatureName},null,8,["title"])])],512),[[o["vShow"],e.showIcons||e.showInlineHelp]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",At,[Object(o["createElementVNode"])("div",{innerHTML:e.$sanitize(e.actualInlineHelp)},null,8,Mt),e.helpUrl?(Object(o["openBlock"])(),Object(o["createElementBlock"])("a",{key:0,rel:"noreferrer noopener",target:"_blank",class:"readMore",href:e.helpUrl},Object(o["toDisplayString"])(e.translate("General_MoreDetails")),9,$t)):Object(o["createCommentVNode"])("",!0)],512),[[o["vShow"],e.showInlineHelp]])],544)} + */St({component:pt,scope:{show:{vue:"modelValue",default:!1},element:{default:function(e,t){return t[0]}}},events:{yes:function(e,t,n,r,i){i.yes&&(n.$eval(i.yes),setTimeout((function(){n.$apply()}),0))},no:function(e,t,n,r,i){i.no&&(n.$eval(i.no),setTimeout((function(){n.$apply()}),0))},validation:function(e,t,n,r,i){i.no&&(n.$eval(i.no),setTimeout((function(){n.$apply()}),0))},close:function(e,t,n,r,i){i.close&&(n.$eval(i.close),setTimeout((function(){n.$apply()}),0))},"update:modelValue":function(e,t,n,r,i,a,o){setTimeout((function(){n.$apply(o(i.piwikDialog).assign(n,e))}),0)}},$inject:["$parse"],directiveName:"piwikDialog",transclude:!0,mountPointFactory:function(e,t){var n=$('<div class="vue-placeholder"/>');return n.appendTo(t),n[0]},postCreate:function(e,t,n,r){t.$watch(r.piwikDialog,(function(t,n){n!==t&&(e.modelValue=t||!1)}))},noScope:!0});var Pt={key:0,class:"title",tabindex:"6"},Et=["href","title"],Vt={class:"iconsBar"},Tt=["href","title"],It=Object(a["createElementVNode"])("span",{class:"icon-help"},null,-1),xt=[It],Nt=["title"],Bt=Object(a["createElementVNode"])("span",{class:"icon-info"},null,-1),At=[Bt],Mt={class:"ratingIcons"},$t={class:"inlineHelp"},Lt=["innerHTML"],Rt=["href"];function Ht(e,t,n,r,i,o){var l=Object(a["resolveComponent"])("RateFeature");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:"enrichedHeadline",onMouseenter:t[1]||(t[1]=function(t){return e.showIcons=!0}),onMouseleave:t[2]||(t[2]=function(t){return e.showIcons=!1}),ref:"root"},[e.editUrl?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Pt,[Object(a["renderSlot"])(e.$slots,"default")])),e.editUrl?(Object(a["openBlock"])(),Object(a["createElementBlock"])("a",{key:1,class:"title",href:e.editUrl,title:e.translate("CoreHome_ClickToEditX",e.$sanitize(e.actualFeatureName))},[Object(a["renderSlot"])(e.$slots,"default")],8,Et)):Object(a["createCommentVNode"])("",!0),Object(a["withDirectives"])(Object(a["createElementVNode"])("span",Vt,[e.helpUrl&&!e.actualInlineHelp?(Object(a["openBlock"])(),Object(a["createElementBlock"])("a",{key:0,rel:"noreferrer noopener",target:"_blank",class:"helpIcon",href:e.helpUrl,title:e.translate("CoreHome_ExternalHelp")},xt,8,Tt)):Object(a["createCommentVNode"])("",!0),e.actualInlineHelp?(Object(a["openBlock"])(),Object(a["createElementBlock"])("a",{key:1,onClick:t[0]||(t[0]=function(t){return e.showInlineHelp=!e.showInlineHelp}),class:Object(a["normalizeClass"])(["helpIcon",{active:e.showInlineHelp}]),title:e.translate(e.reportGenerated?"General_HelpReport":"General_Help")},At,10,Nt)):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("div",Mt,[Object(a["createVNode"])(l,{title:e.actualFeatureName},null,8,["title"])])],512),[[a["vShow"],e.showIcons||e.showInlineHelp]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",$t,[Object(a["createElementVNode"])("div",{innerHTML:e.$sanitize(e.actualInlineHelp)},null,8,Lt),e.helpUrl?(Object(a["openBlock"])(),Object(a["createElementBlock"])("a",{key:0,rel:"noreferrer noopener",target:"_blank",class:"readMore",href:e.helpUrl},Object(a["toDisplayString"])(e.translate("General_MoreDetails")),9,Rt)):Object(a["createCommentVNode"])("",!0)],512),[[a["vShow"],e.showInlineHelp]])],544)} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function Ht(e,t){return Object(o["defineAsyncComponent"])((function(){return new Promise((function(n){window.$(document).ready((function(){window[e]?n(window[e][t]):n(null)}))}))}))}var Ft=Ht("Feedback","RateFeature"),_t=Object(o["defineComponent"])({props:{helpUrl:{type:String,default:""},editUrl:{type:String,default:""},reportGenerated:String,featureName:String,inlineHelp:String},components:{RateFeature:Ft},data:function(){return{showIcons:!1,showInlineHelp:!1,actualFeatureName:this.featureName,actualInlineHelp:this.inlineHelp}},watch:{inlineHelp:function(e){this.actualInlineHelp=e},featureName:function(e){this.actualFeatureName=e}},mounted:function(){var e=this,t=this.$refs.root;setTimeout((function(){if(!e.actualInlineHelp){var n=t.querySelector(".title .inlineHelp");if(!n&&t.parentElement.nextElementSibling&&(n=t.parentElement.nextElementSibling.querySelector(".reportDocumentation")),n){var r=n.getAttribute("data-content").trim();r.length&&(e.actualInlineHelp="<p>".concat(r,"</p>"),setTimeout((function(){return n.remove()}),0))}}e.actualFeatureName||(e.actualFeatureName=t.querySelector(".title").textContent),e.reportGenerated&&f.parse(S.period,S.currentDateString).containsToday()&&window.$(t.querySelector(".report-generated")).tooltip({track:!0,content:e.reportGenerated,items:"div",show:!1,hide:!1})}))}});_t.render=Lt;var Ut=_t,Rt=(jt({component:Ut,scope:{helpUrl:{angularJsBind:"@"},editUrl:{angularJsBind:"@"},reportGenerated:{angularJsBind:"@?"},featureName:{angularJsBind:"@"},inlineHelp:{angularJsBind:"@?"}},directiveName:"piwikEnrichedHeadline",transclude:!0}),{class:"card",ref:"root"}),qt={class:"card-content"},Jt={key:0,class:"card-title"},zt={key:1,class:"card-title"},Gt={ref:"content"}; + */function Ft(e,t){return Object(a["defineAsyncComponent"])((function(){return new Promise((function(n){window.$(document).ready((function(){window[e]?n(window[e][t]):n(null)}))}))}))}var _t=Ft("Feedback","RateFeature"),Ut=Object(a["defineComponent"])({props:{helpUrl:{type:String,default:""},editUrl:{type:String,default:""},reportGenerated:String,featureName:String,inlineHelp:String},components:{RateFeature:_t},data:function(){return{showIcons:!1,showInlineHelp:!1,actualFeatureName:this.featureName,actualInlineHelp:this.inlineHelp}},watch:{inlineHelp:function(e){this.actualInlineHelp=e},featureName:function(e){this.actualFeatureName=e}},mounted:function(){var e=this,t=this.$refs.root;setTimeout((function(){if(!e.actualInlineHelp){var n=t.querySelector(".title .inlineHelp");if(!n&&t.parentElement.nextElementSibling&&(n=t.parentElement.nextElementSibling.querySelector(".reportDocumentation")),n){var r=n.getAttribute("data-content").trim();r.length&&(e.actualInlineHelp="<p>".concat(r,"</p>"),setTimeout((function(){return n.remove()}),0))}}e.actualFeatureName||(e.actualFeatureName=t.querySelector(".title").textContent),e.reportGenerated&&p.parse(S.period,S.currentDateString).containsToday()&&window.$(t.querySelector(".report-generated")).tooltip({track:!0,content:e.reportGenerated,items:"div",show:!1,hide:!1})}))}});Ut.render=Ht;var qt=Ut,Jt=(St({component:qt,scope:{helpUrl:{angularJsBind:"@"},editUrl:{angularJsBind:"@"},reportGenerated:{angularJsBind:"@?"},featureName:{angularJsBind:"@"},inlineHelp:{angularJsBind:"@?"}},directiveName:"piwikEnrichedHeadline",transclude:!0}),{class:"card",ref:"root"}),Gt={class:"card-content"},zt={key:0,class:"card-title"},Yt={key:1,class:"card-title"},Qt={ref:"content"}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function Qt(e,t,n,r,i,a){var c=Object(o["resolveComponent"])("EnrichedHeadline");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Rt,[Object(o["createElementVNode"])("div",qt,[!e.contentTitle||e.actualFeature||e.helpUrl||e.actualHelpText?Object(o["createCommentVNode"])("",!0):(Object(o["openBlock"])(),Object(o["createElementBlock"])("h2",Jt,Object(o["toDisplayString"])(e.contentTitle),1)),e.contentTitle&&(e.actualFeature||e.helpUrl||e.actualHelpText)?(Object(o["openBlock"])(),Object(o["createElementBlock"])("h2",zt,[Object(o["createVNode"])(c,{"feature-name":e.actualFeature,"help-url":e.helpUrl,"inline-help":e.actualHelpText},{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.contentTitle),1)]})),_:1},8,["feature-name","help-url","inline-help"])])):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("div",Gt,[Object(o["renderSlot"])(e.$slots,"default")],512)])],512)}var Wt=null,Yt=Object(o["defineComponent"])({props:{contentTitle:String,feature:String,helpUrl:String,helpText:String,anchor:String},components:{EnrichedHeadline:Ut},data:function(){return{actualFeature:this.feature,actualHelpText:this.helpText}},watch:{feature:function(e){this.actualFeature=e},helpText:function(e){this.actualHelpText=e}},mounted:function(){var e,t=this,n=this.$refs,r=n.root,i=n.content;if(this.anchor){var o=document.createElement("a");o.id=this.anchor,r.parentElement.prepend(o)}if(setTimeout((function(){var e=i.querySelector(".contentHelp");e&&(t.actualHelpText=e.innerHTML,e.remove())}),0),!this.actualFeature||!0!==this.actualFeature&&"true"!==this.actualFeature||(this.actualFeature=this.contentTitle),null===Wt&&(Wt=document.querySelector("#content.admin")),Wt&&(e=Wt.offsetTop),e||0===e){var a=r.closest("[piwik-widget-loader]"),c=a?a.offsetTop:r.offsetTop;c-e<17&&(r.style.marginTop=0)}}});Yt.render=Qt;var Kt=Yt; + */function Wt(e,t,n,r,i,o){var l=Object(a["resolveComponent"])("EnrichedHeadline");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Jt,[Object(a["createElementVNode"])("div",Gt,[!e.contentTitle||e.actualFeature||e.helpUrl||e.actualHelpText?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("h2",zt,Object(a["toDisplayString"])(e.contentTitle),1)),e.contentTitle&&(e.actualFeature||e.helpUrl||e.actualHelpText)?(Object(a["openBlock"])(),Object(a["createElementBlock"])("h2",Yt,[Object(a["createVNode"])(l,{"feature-name":e.actualFeature,"help-url":e.helpUrl,"inline-help":e.actualHelpText},{default:Object(a["withCtx"])((function(){return[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.contentTitle),1)]})),_:1},8,["feature-name","help-url","inline-help"])])):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("div",Qt,[Object(a["renderSlot"])(e.$slots,"default")],512)])],512)}var Kt=null,Zt=Object(a["defineComponent"])({props:{contentTitle:String,feature:String,helpUrl:String,helpText:String,anchor:String},components:{EnrichedHeadline:qt},data:function(){return{actualFeature:this.feature,actualHelpText:this.helpText}},watch:{feature:function(e){this.actualFeature=e},helpText:function(e){this.actualHelpText=e}},mounted:function(){var e,t=this,n=this.$refs,r=n.root,i=n.content;if(this.anchor){var a=document.createElement("a");a.id=this.anchor,r.parentElement.prepend(a)}if(setTimeout((function(){var e=i.querySelector(".contentHelp");e&&(t.actualHelpText=e.innerHTML,e.remove())}),0),!this.actualFeature||!0!==this.actualFeature&&"true"!==this.actualFeature||(this.actualFeature=this.contentTitle),null===Kt&&(Kt=document.querySelector("#content.admin")),Kt&&(e=Kt.offsetTop),e||0===e){var o=r.closest("[piwik-widget-loader]"),l=o?o.offsetTop:r.offsetTop;l-e<17&&(r.style.marginTop=0)}}});Zt.render=Wt;var Xt=Zt; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */jt({component:Kt,scope:{contentTitle:{angularJsBind:"@"},feature:{angularJsBind:"@"},helpUrl:{angularJsBind:"@"},helpText:{angularJsBind:"@"},anchor:{angularJsBind:"@?"}},directiveName:"piwikContentBlock",transclude:!0});function Xt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function en(e,t,n){return t&&Zt(e.prototype,t),n&&Zt(e,n),e}function tn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} + */St({component:Xt,scope:{contentTitle:{angularJsBind:"@"},feature:{angularJsBind:"@"},helpUrl:{angularJsBind:"@"},helpText:{angularJsBind:"@"},anchor:{angularJsBind:"@?"}},directiveName:"piwikContentBlock",transclude:!0});function en(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function nn(e,t,n){return t&&tn(e.prototype,t),n&&tn(e,n),e}function rn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */var nn=function(){function e(){var t=this;Xt(this,e),tn(this,"segmentState",Object(o["reactive"])({availableSegments:[]})),S.on("piwikSegmentationInited",(function(){return t.setSegmentState()}))}return en(e,[{key:"state",get:function(){return Object(o["readonly"])(this.segmentState)}},{key:"setSegmentState",value:function(){try{var e=$(".segmentEditorPanel").data("uiControlObject");this.segmentState.availableSegments=e.impl.availableSegments||[]}catch(t){}}}]),e}(),rn=new nn;function on(e){return sn(e)||ln(e)||cn(e)||an()}function an(){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 cn(e,t){if(e){if("string"===typeof e)return un(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?un(e,t):void 0}}function ln(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function sn(e){if(Array.isArray(e))return un(e)}function un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function fn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dn(Object(n),!0).forEach((function(t){vn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function hn(e,t,n){return t&&pn(e.prototype,t),n&&pn(e,n),e}function vn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} + */var an=function(){function e(){var t=this;en(this,e),rn(this,"segmentState",Object(a["reactive"])({availableSegments:[]})),S.on("piwikSegmentationInited",(function(){return t.setSegmentState()}))}return nn(e,[{key:"state",get:function(){return Object(a["readonly"])(this.segmentState)}},{key:"setSegmentState",value:function(){try{var e=$(".segmentEditorPanel").data("uiControlObject");this.segmentState.availableSegments=e.impl.availableSegments||[]}catch(t){}}}]),e}(),on=new an;function ln(e){return dn(e)||un(e)||sn(e)||cn()}function cn(){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 sn(e,t){if(e){if("string"===typeof e)return pn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pn(e,t):void 0}}function un(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function dn(e){if(Array.isArray(e))return pn(e)}function pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function mn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(n),!0).forEach((function(t){bn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function hn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function gn(e,t,n){return t&&vn(e.prototype,t),n&&vn(e,n),e}function bn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */var gn=8,bn=3;function yn(e){return e?Array.isArray(e)?e:[e]:[]}var wn=function(){function e(){var t=this;mn(this,e),vn(this,"privateState",Object(o["reactive"])({comparisonsDisabledFor:[]})),vn(this,"state",Object(o["readonly"])(this.privateState)),vn(this,"colors",{}),vn(this,"segmentComparisons",Object(o["computed"])((function(){return t.parseSegmentComparisons()}))),vn(this,"periodComparisons",Object(o["computed"])((function(){return t.parsePeriodComparisons()}))),vn(this,"isEnabled",Object(o["computed"])((function(){return t.checkEnabledForCurrentPage()}))),this.loadComparisonsDisabledFor(),$((function(){t.colors=t.getAllSeriesColors()})),Object(o["watch"])((function(){return t.getComparisons()}),(function(){return S.postEvent("piwikComparisonsChanged")}),{deep:!0})}return hn(e,[{key:"getComparisons",value:function(){return this.getSegmentComparisons().concat(this.getPeriodComparisons())}},{key:"isComparing",value:function(){return this.isComparisonEnabled()&&(this.segmentComparisons.value.length>1||this.periodComparisons.value.length>1)}},{key:"isComparingPeriods",value:function(){return this.getPeriodComparisons().length>1}},{key:"getSegmentComparisons",value:function(){return this.isComparisonEnabled()?this.segmentComparisons.value:[]}},{key:"getPeriodComparisons",value:function(){return this.isComparisonEnabled()?this.periodComparisons.value:[]}},{key:"getSeriesColor",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.getComparisonSeriesIndex(t.index,e.index)%gn;if(0===n)return this.colors["series".concat(r)];var i=n%bn;return this.colors["series".concat(r,"-shade").concat(i)]}},{key:"getSeriesColorName",value:function(e,t){var n="series".concat(e%gn);return t>0&&(n+="-shade".concat(t%bn)),n}},{key:"isComparisonEnabled",value:function(){return this.isEnabled.value}},{key:"getIndividualComparisonRowIndices",value:function(e){var t=this.getSegmentComparisons().length,n=e%t,r=Math.floor(e/t);return{segmentIndex:n,periodIndex:r}}},{key:"getComparisonSeriesIndex",value:function(e,t){var n=this.getSegmentComparisons().length;return e*n+t}},{key:"getAllComparisonSeries",value:function(){var e=this,t=[],n=0;return this.getPeriodComparisons().forEach((function(r){e.getSegmentComparisons().forEach((function(i){t.push({index:n,params:fn(fn({},i.params),r.params),color:e.colors["series".concat(n)]}),n+=1}))})),t}},{key:"removeSegmentComparison",value:function(e){if(!this.isComparisonEnabled())throw new Error("Comparison disabled.");var t=on(this.segmentComparisons.value);t.splice(e,1);var n={};0===e&&(n.segment=t[0].params.segment),this.updateQueryParamsFromComparisons(t,this.periodComparisons.value,n)}},{key:"addSegmentComparison",value:function(e){if(!this.isComparisonEnabled())throw new Error("Comparison disabled.");var t=this.segmentComparisons.value.concat([{params:e,index:-1,title:""}]);this.updateQueryParamsFromComparisons(t,this.periodComparisons.value)}},{key:"updateQueryParamsFromComparisons",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={},i={},o=!1,a=!1;e.forEach((function(e){o?r[e.params.segment]=!0:o=!0})),t.forEach((function(e){a?i["".concat(e.params.period,"|").concat(e.params.date)]=!0:a=!0}));var c=[],l=[];Object.keys(i).forEach((function(e){var t=e.split("|");c.push(t[0]),l.push(t[1])}));var s={compareSegments:Object.keys(r),comparePeriods:c,compareDates:l};if(S.helper.isAngularRenderingThePage()){var u=Oe.hashParsed.value,d=fn(fn(fn({},u),s),n);return delete d["compareSegments[]"],delete d["comparePeriods[]"],delete d["compareDates[]"],void(JSON.stringify(d)!==JSON.stringify(u)&&Oe.updateHash(d))}var f=[];["compareSegments","comparePeriods","compareDates"].forEach((function(e){s[e].length||f.push(e)}));var m=Oe.stringify(n),p=Oe.stringify(s);window.broadcast.propagateNewPage(m,void 0,p,f)}},{key:"getAllSeriesColors",value:function(){var e=S.ColorManager;if(!e)return[];for(var t=[],n=0;n<gn;n+=1){t.push("series".concat(n));for(var r=0;r<bn;r+=1)t.push("series".concat(n,"-shade").concat(r))}return e.getColors("comparison-series-color",t)}},{key:"loadComparisonsDisabledFor",value:function(){var e=this,t=Oe.parsed.value.module;"CoreUpdater"!==t&&"Installation"!==t?xe.fetch({module:"API",method:"API.getPagesComparisonsDisabledFor"}).then((function(t){e.privateState.comparisonsDisabledFor=t})):this.privateState.comparisonsDisabledFor=[]}},{key:"parseSegmentComparisons",value:function(){var e=rn.state.availableSegments,t=on(yn(Oe.parsed.value.compareSegments));t.unshift(Oe.parsed.value.segment||"");var n=[];return t.forEach((function(t,r){var i;e.forEach((function(e){e.definition!==t&&e.definition!==decodeURIComponent(t)&&decodeURIComponent(e.definition)!==t||(i=e)}));var o=i?i.name:C("General_Unknown");""===t.trim()&&(o=C("SegmentEditor_DefaultAllVisits")),n.push({params:{segment:t},title:S.helper.htmlDecode(o),index:r})})),n}},{key:"parsePeriodComparisons",value:function(){var e=on(yn(Oe.parsed.value.comparePeriods)),t=on(yn(Oe.parsed.value.compareDates));e.unshift(Oe.parsed.value.period),t.unshift(Oe.parsed.value.date);for(var n=[],r=0;r<Math.min(t.length,e.length);r+=1){var i=void 0;try{i=f.parse(e[r],t[r]).getPrettyString()}catch(o){i=C("General_Error")}n.push({params:{date:t[r],period:e[r]},title:i,index:r})}return n}},{key:"checkEnabledForCurrentPage",value:function(){var e=Oe.parsed.value.category||Oe.parsed.value.module,t=Oe.parsed.value.subcategory||Oe.parsed.value.action,n="".concat(e,".").concat(t),r=-1===this.privateState.comparisonsDisabledFor.indexOf(n)&&-1===this.privateState.comparisonsDisabledFor.indexOf("".concat(e,".*"));return document.documentElement.classList.toggle("comparisonsDisabled",!r),r}}]),e}(),On=new wn,jn={key:0,ref:"root",class:"matomo-comparisons"},kn={class:"comparison-type"},Sn=["title"],Cn=["href"],Dn=["title"],En={class:"comparison-period-label"},Pn=["onClick"],Tn=["title"],In={class:"loadingPiwik",style:{display:"none"}},Vn=["alt"];function xn(e,t,n,r,i,a){return e.isComparing?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",jn,[Object(o["createElementVNode"])("h3",null,Object(o["toDisplayString"])(e.translate("General_Comparisons")),1),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.segmentComparisons,(function(t,n){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:"comparison card",key:t.index},[Object(o["createElementVNode"])("div",kn,Object(o["toDisplayString"])(e.translate("General_Segment")),1),Object(o["createElementVNode"])("div",{class:"title",title:t.title+"<br/>"+decodeURIComponent(t.params.segment)},[Object(o["createElementVNode"])("a",{target:"_blank",href:e.getUrlToSegment(t.params.segment)},Object(o["toDisplayString"])(t.title),9,Cn)],8,Sn),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.periodComparisons,(function(n){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:"comparison-period",key:n.index,title:e.getComparisonTooltip(t,n)},[Object(o["createElementVNode"])("span",{class:"comparison-dot",style:Object(o["normalizeStyle"])({"background-color":e.getSeriesColor(t,n)})},null,4),Object(o["createElementVNode"])("span",En,Object(o["toDisplayString"])(n.title)+" ("+Object(o["toDisplayString"])(e.getComparisonPeriodType(n))+") ",1)],8,Dn)})),128)),e.segmentComparisons.length>1?(Object(o["openBlock"])(),Object(o["createElementBlock"])("a",{key:0,class:"remove-button",onClick:function(t){return e.removeSegmentComparison(n)}},[Object(o["createElementVNode"])("span",{class:"icon icon-close",title:e.translate("General_ClickToRemoveComp")},null,8,Tn)],8,Pn)):Object(o["createCommentVNode"])("",!0)])})),128)),Object(o["createElementVNode"])("div",In,[Object(o["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif",alt:e.translate("General_LoadingData")},null,8,Vn),Object(o["createTextVNode"])(" "+Object(o["toDisplayString"])(e.translate("General_LoadingData")),1)])],512)):Object(o["createCommentVNode"])("",!0)}function Nn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Bn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Nn(Object(n),!0).forEach((function(t){An(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function An(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mn=Object(o["defineComponent"])({props:{},data:function(){return{comparisonTooltips:null}},setup:function(){var e=Object(o["computed"])((function(){return On.isComparing()})),t=Object(o["computed"])((function(){return On.getSegmentComparisons()})),n=Object(o["computed"])((function(){return On.getPeriodComparisons()})),r=On.getSeriesColor.bind(On);return{isComparing:e,segmentComparisons:t,periodComparisons:n,getSeriesColor:r}},methods:{comparisonHasSegment:function(e){return"undefined"!==typeof e.params.segment},removeSegmentComparison:function(e){window.$(this.$refs.root).tooltip("destroy"),On.removeSegmentComparison(e)},getComparisonPeriodType:function(e){var t=e.params.period;if("range"===t)return C("CoreHome_PeriodRange");var n=C("Intl_Period".concat(t.substring(0,1).toUpperCase()).concat(t.substring(1)));return n.substring(0,1).toUpperCase()+n.substring(1)},getComparisonTooltip:function(e,t){if(this.comparisonTooltips&&Object.keys(this.comparisonTooltips).length)return(this.comparisonTooltips[t.index]||{})[e.index]},getUrlToSegment:function(e){var t=Bn({},Oe.hashParsed.value);return delete t.comparePeriods,delete t.compareDates,delete t.compareSegments,t.segment=e,"".concat(window.location.search,"#?").concat(Oe.stringify(t))},setUpTooltips:function(){var e=window,t=e.$;t(this.$refs.root).tooltip({track:!0,content:function(){var e=t(this).attr("title");return window.vueSanitize(e.replace(/\n/g,"<br />"))},show:{delay:200,duration:200},hide:!1})},onComparisonsChanged:function(){var e=this;if(this.comparisonTooltips=null,On.isComparing()){var t=On.getPeriodComparisons(),n=On.getSegmentComparisons();xe.fetch({method:"API.getProcessedReport",apiModule:"VisitsSummary",apiAction:"get",compare:"1",compareSegments:Oe.getSearchParam("compareSegments"),comparePeriods:Oe.getSearchParam("comparePeriods"),compareDates:Oe.getSearchParam("compareDates"),format_metrics:"1"}).then((function(r){e.comparisonTooltips={},t.forEach((function(t){e.comparisonTooltips[t.index]={},n.forEach((function(n){var i=e.generateComparisonTooltip(r,t,n);e.comparisonTooltips[t.index][n.index]=i}))}))}))}},generateComparisonTooltip:function(e,t,n){if(!e.reportData.comparisons)return"";var r=On.getComparisonSeriesIndex(t.index,0),i=e.reportData.comparisons[r],o=On.getComparisonSeriesIndex(t.index,n.index),a=e.reportData.comparisons[o],c=e.reportData.comparisons[n.index],l='<div class="comparison-card-tooltip">',s=(a.nb_visits/i.nb_visits*100).toFixed(2);return s="".concat(s,"%"),l+=C("General_ComparisonCardTooltip1",["'".concat(a.compareSegmentPretty,"'"),a.comparePeriodPretty,s,a.nb_visits.toString(),i.nb_visits.toString()]),t.index>0&&(l+="<br/><br/>",l+=C("General_ComparisonCardTooltip2",[a.nb_visits_change.toString(),c.compareSegmentPretty,c.comparePeriodPretty])),l+="</div>",l}},updated:function(){var e=this;setTimeout((function(){return e.setUpTooltips()}))},mounted:function(){var e=this;S.on("piwikComparisonsChanged",(function(){e.onComparisonsChanged()})),this.onComparisonsChanged(),setTimeout((function(){return e.setUpTooltips()}))},beforeUnmount:function(){try{window.$(this.refs.root).tooltip("destroy")}catch(e){}}});Mn.render=xn;var $n=Mn; + */var yn=8,On=3;function wn(e){return e?Array.isArray(e)?e:[e]:[]}var jn=function(){function e(){var t=this;hn(this,e),bn(this,"privateState",Object(a["reactive"])({comparisonsDisabledFor:[]})),bn(this,"state",Object(a["readonly"])(this.privateState)),bn(this,"colors",{}),bn(this,"segmentComparisons",Object(a["computed"])((function(){return t.parseSegmentComparisons()}))),bn(this,"periodComparisons",Object(a["computed"])((function(){return t.parsePeriodComparisons()}))),bn(this,"isEnabled",Object(a["computed"])((function(){return t.checkEnabledForCurrentPage()}))),this.loadComparisonsDisabledFor(),$((function(){t.colors=t.getAllSeriesColors()})),Object(a["watch"])((function(){return t.getComparisons()}),(function(){return S.postEvent("piwikComparisonsChanged")}),{deep:!0})}return gn(e,[{key:"getComparisons",value:function(){return this.getSegmentComparisons().concat(this.getPeriodComparisons())}},{key:"isComparing",value:function(){return this.isComparisonEnabled()&&(this.segmentComparisons.value.length>1||this.periodComparisons.value.length>1)}},{key:"isComparingPeriods",value:function(){return this.getPeriodComparisons().length>1}},{key:"getSegmentComparisons",value:function(){return this.isComparisonEnabled()?this.segmentComparisons.value:[]}},{key:"getPeriodComparisons",value:function(){return this.isComparisonEnabled()?this.periodComparisons.value:[]}},{key:"getSeriesColor",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.getComparisonSeriesIndex(t.index,e.index)%yn;if(0===n)return this.colors["series".concat(r)];var i=n%On;return this.colors["series".concat(r,"-shade").concat(i)]}},{key:"getSeriesColorName",value:function(e,t){var n="series".concat(e%yn);return t>0&&(n+="-shade".concat(t%On)),n}},{key:"isComparisonEnabled",value:function(){return this.isEnabled.value}},{key:"getIndividualComparisonRowIndices",value:function(e){var t=this.getSegmentComparisons().length,n=e%t,r=Math.floor(e/t);return{segmentIndex:n,periodIndex:r}}},{key:"getComparisonSeriesIndex",value:function(e,t){var n=this.getSegmentComparisons().length;return e*n+t}},{key:"getAllComparisonSeries",value:function(){var e=this,t=[],n=0;return this.getPeriodComparisons().forEach((function(r){e.getSegmentComparisons().forEach((function(i){t.push({index:n,params:mn(mn({},i.params),r.params),color:e.colors["series".concat(n)]}),n+=1}))})),t}},{key:"removeSegmentComparison",value:function(e){if(!this.isComparisonEnabled())throw new Error("Comparison disabled.");var t=ln(this.segmentComparisons.value);t.splice(e,1);var n={};0===e&&(n.segment=t[0].params.segment),this.updateQueryParamsFromComparisons(t,this.periodComparisons.value,n)}},{key:"addSegmentComparison",value:function(e){if(!this.isComparisonEnabled())throw new Error("Comparison disabled.");var t=this.segmentComparisons.value.concat([{params:e,index:-1,title:""}]);this.updateQueryParamsFromComparisons(t,this.periodComparisons.value)}},{key:"updateQueryParamsFromComparisons",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={},i={},a=!1,o=!1;e.forEach((function(e){a?r[e.params.segment]=!0:a=!0})),t.forEach((function(e){o?i["".concat(e.params.period,"|").concat(e.params.date)]=!0:o=!0}));var l=[],c=[];Object.keys(i).forEach((function(e){var t=e.split("|");l.push(t[0]),c.push(t[1])}));var s={compareSegments:Object.keys(r),comparePeriods:l,compareDates:c};we.updateLocation(mn(mn(mn({},we.parsed.value),s),n))}},{key:"getAllSeriesColors",value:function(){var e=S.ColorManager;if(!e)return[];for(var t=[],n=0;n<yn;n+=1){t.push("series".concat(n));for(var r=0;r<On;r+=1)t.push("series".concat(n,"-shade").concat(r))}return e.getColors("comparison-series-color",t)}},{key:"loadComparisonsDisabledFor",value:function(){var e=this,t=we.parsed.value.module;"CoreUpdater"!==t&&"Installation"!==t?xe.fetch({module:"API",method:"API.getPagesComparisonsDisabledFor"}).then((function(t){e.privateState.comparisonsDisabledFor=t})):this.privateState.comparisonsDisabledFor=[]}},{key:"parseSegmentComparisons",value:function(){var e=on.state.availableSegments,t=ln(wn(we.parsed.value.compareSegments));t.unshift(we.parsed.value.segment||"");var n=[];return t.forEach((function(t,r){var i;e.forEach((function(e){e.definition!==t&&e.definition!==decodeURIComponent(t)&&decodeURIComponent(e.definition)!==t||(i=e)}));var a=i?i.name:D("General_Unknown");""===t.trim()&&(a=D("SegmentEditor_DefaultAllVisits")),n.push({params:{segment:t},title:S.helper.htmlDecode(a),index:r})})),n}},{key:"parsePeriodComparisons",value:function(){var e=ln(wn(we.parsed.value.comparePeriods)),t=ln(wn(we.parsed.value.compareDates));e.unshift(we.parsed.value.period),t.unshift(we.parsed.value.date);for(var n=[],r=0;r<Math.min(t.length,e.length);r+=1){var i=void 0;try{i=p.parse(e[r],t[r]).getPrettyString()}catch(a){i=D("General_Error")}n.push({params:{date:t[r],period:e[r]},title:i,index:r})}return n}},{key:"checkEnabledForCurrentPage",value:function(){var e=we.parsed.value.category||we.parsed.value.module,t=we.parsed.value.subcategory||we.parsed.value.action,n="".concat(e,".").concat(t),r=-1===this.privateState.comparisonsDisabledFor.indexOf(n)&&-1===this.privateState.comparisonsDisabledFor.indexOf("".concat(e,".*"));return document.documentElement.classList.toggle("comparisonsDisabled",!r),r}}]),e}(),kn=new jn,Sn={key:0,ref:"root",class:"matomo-comparisons"},Dn={class:"comparison-type"},Cn=["title"],Pn=["href"],En=["title"],Vn={class:"comparison-period-label"},Tn=["onClick"],In=["title"],xn={class:"loadingPiwik",style:{display:"none"}},Nn=["alt"];function Bn(e,t,n,r,i,o){return e.isComparing?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Sn,[Object(a["createElementVNode"])("h3",null,Object(a["toDisplayString"])(e.translate("General_Comparisons")),1),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.segmentComparisons,(function(t,n){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:"comparison card",key:t.index},[Object(a["createElementVNode"])("div",Dn,Object(a["toDisplayString"])(e.translate("General_Segment")),1),Object(a["createElementVNode"])("div",{class:"title",title:t.title+"<br/>"+decodeURIComponent(t.params.segment)},[Object(a["createElementVNode"])("a",{target:"_blank",href:e.getUrlToSegment(t.params.segment)},Object(a["toDisplayString"])(t.title),9,Pn)],8,Cn),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.periodComparisons,(function(n){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:"comparison-period",key:n.index,title:e.getComparisonTooltip(t,n)},[Object(a["createElementVNode"])("span",{class:"comparison-dot",style:Object(a["normalizeStyle"])({"background-color":e.getSeriesColor(t,n)})},null,4),Object(a["createElementVNode"])("span",Vn,Object(a["toDisplayString"])(n.title)+" ("+Object(a["toDisplayString"])(e.getComparisonPeriodType(n))+") ",1)],8,En)})),128)),e.segmentComparisons.length>1?(Object(a["openBlock"])(),Object(a["createElementBlock"])("a",{key:0,class:"remove-button",onClick:function(t){return e.removeSegmentComparison(n)}},[Object(a["createElementVNode"])("span",{class:"icon icon-close",title:e.translate("General_ClickToRemoveComp")},null,8,In)],8,Tn)):Object(a["createCommentVNode"])("",!0)])})),128)),Object(a["createElementVNode"])("div",xn,[Object(a["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif",alt:e.translate("General_LoadingData")},null,8,Nn),Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.translate("General_LoadingData")),1)])],512)):Object(a["createCommentVNode"])("",!0)}function An(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Mn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?An(Object(n),!0).forEach((function(t){$n(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):An(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ln=Object(a["defineComponent"])({props:{},data:function(){return{comparisonTooltips:null}},setup:function(){var e=Object(a["computed"])((function(){return kn.isComparing()})),t=Object(a["computed"])((function(){return kn.getSegmentComparisons()})),n=Object(a["computed"])((function(){return kn.getPeriodComparisons()})),r=kn.getSeriesColor.bind(kn);return{isComparing:e,segmentComparisons:t,periodComparisons:n,getSeriesColor:r}},methods:{comparisonHasSegment:function(e){return"undefined"!==typeof e.params.segment},removeSegmentComparison:function(e){window.$(this.$refs.root).tooltip("destroy"),kn.removeSegmentComparison(e)},getComparisonPeriodType:function(e){var t=e.params.period;if("range"===t)return D("CoreHome_PeriodRange");var n=D("Intl_Period".concat(t.substring(0,1).toUpperCase()).concat(t.substring(1)));return n.substring(0,1).toUpperCase()+n.substring(1)},getComparisonTooltip:function(e,t){if(this.comparisonTooltips&&Object.keys(this.comparisonTooltips).length)return(this.comparisonTooltips[t.index]||{})[e.index]},getUrlToSegment:function(e){var t=Mn({},we.hashParsed.value);return delete t.comparePeriods,delete t.compareDates,delete t.compareSegments,t.segment=e,"".concat(window.location.search,"#?").concat(we.stringify(t))},setUpTooltips:function(){var e=window,t=e.$;t(this.$refs.root).tooltip({track:!0,content:function(){var e=t(this).attr("title");return window.vueSanitize(e.replace(/\n/g,"<br />"))},show:{delay:200,duration:200},hide:!1})},onComparisonsChanged:function(){var e=this;if(this.comparisonTooltips=null,kn.isComparing()){var t=kn.getPeriodComparisons(),n=kn.getSegmentComparisons();xe.fetch({method:"API.getProcessedReport",apiModule:"VisitsSummary",apiAction:"get",compare:"1",compareSegments:we.getSearchParam("compareSegments"),comparePeriods:we.getSearchParam("comparePeriods"),compareDates:we.getSearchParam("compareDates"),format_metrics:"1"}).then((function(r){e.comparisonTooltips={},t.forEach((function(t){e.comparisonTooltips[t.index]={},n.forEach((function(n){var i=e.generateComparisonTooltip(r,t,n);e.comparisonTooltips[t.index][n.index]=i}))}))}))}},generateComparisonTooltip:function(e,t,n){if(!e.reportData.comparisons)return"";var r=kn.getComparisonSeriesIndex(t.index,0),i=e.reportData.comparisons[r],a=kn.getComparisonSeriesIndex(t.index,n.index),o=e.reportData.comparisons[a],l=e.reportData.comparisons[n.index],c='<div class="comparison-card-tooltip">',s=(o.nb_visits/i.nb_visits*100).toFixed(2);return s="".concat(s,"%"),c+=D("General_ComparisonCardTooltip1",["'".concat(o.compareSegmentPretty,"'"),o.comparePeriodPretty,s,o.nb_visits.toString(),i.nb_visits.toString()]),t.index>0&&(c+="<br/><br/>",c+=D("General_ComparisonCardTooltip2",[o.nb_visits_change.toString(),l.compareSegmentPretty,l.comparePeriodPretty])),c+="</div>",c}},updated:function(){var e=this;setTimeout((function(){return e.setUpTooltips()}))},mounted:function(){var e=this;S.on("piwikComparisonsChanged",(function(){e.onComparisonsChanged()})),this.onComparisonsChanged(),setTimeout((function(){return e.setUpTooltips()}))},beforeUnmount:function(){try{window.$(this.refs.root).tooltip("destroy")}catch(e){}}});Ln.render=Bn;var Rn=Ln; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function Ln(){return On}Ln.$inject=[],angular.module("piwikApp.service").factory("piwikComparisonsService",Ln);jt({component:$n,directiveName:"piwikComparisons",restrict:"E"});var Hn={ref:"root",class:"menuDropdown"},Fn=["title"],_n=["innerHTML"],Un=Object(o["createElementVNode"])("span",{class:"icon-arrow-bottom"},null,-1),Rn={class:"items"},qn={key:0,class:"search"},Jn=["placeholder"],zn=["title"],Gn=["title"];function Qn(e,t,n,r,i,a){var c=Object(o["resolveDirective"])("focus-if"),l=Object(o["resolveDirective"])("focus-anywhere-but-here");return Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Hn,[Object(o["createElementVNode"])("span",{class:"title",onClick:t[0]||(t[0]=function(t){return e.showItems=!e.showItems}),title:e.tooltip},[Object(o["createElementVNode"])("span",{innerHTML:e.$sanitize(this.actualMenuTitle)},null,8,_n),Un],8,Fn),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",Rn,[e.showSearch&&e.showItems?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",qn,[Object(o["withDirectives"])(Object(o["createElementVNode"])("input",{type:"text","onUpdate:modelValue":t[1]||(t[1]=function(t){return e.searchTerm=t}),onKeydown:t[2]||(t[2]=function(t){return e.onSearchTermKeydown(t)}),placeholder:e.translate("General_Search")},null,40,Jn),[[o["vModelText"],e.searchTerm],[c,{},e.showItems]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("img",{class:"search_ico",src:"plugins/Morpheus/images/search_ico.png",title:e.translate("General_Search")},null,8,zn),[[o["vShow"],!e.searchTerm]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("img",{onClick:t[3]||(t[3]=function(t){e.searchTerm="",e.searchItems("")}),class:"reset",src:"plugins/CoreHome/images/reset_search.png",title:e.translate("General_Clear")},null,8,Gn),[[o["vShow"],e.searchTerm]])])):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("div",{onClick:t[4]||(t[4]=function(t){return e.selectItem(t)})},[Object(o["renderSlot"])(e.$slots,"default")])],512),[[o["vShow"],e.showItems]])],512)),[[l,{blur:e.lostFocus}]])}var Wn=window,Yn=Wn.$,Kn=Object(o["defineComponent"])({props:{menuTitle:String,tooltip:String,showSearch:Boolean,menuTitleChangeOnClick:String},directives:{FocusAnywhereButHere:_e,FocusIf:qe},emits:["afterSelect"],watch:{menuTitle:function(){this.actualMenuTitle=this.menuTitle}},data:function(){return{showItems:!1,searchTerm:"",actualMenuTitle:this.menuTitle}},methods:{lostFocus:function(){this.showItems=!1},selectItem:function(e){var t=e.target.classList;!t.contains("item")||t.contains("disabled")||t.contains("separator")||(!1!==this.menuTitleChangeOnClick&&(this.actualMenuTitle=e.target.textContent.replace(/[\u0000-\u2666]/g,(function(e){return"&#".concat(e.charCodeAt(0),";")}))),this.showItems=!1,Yn(this.$slots.default()).find(".item").removeClass("active"),t.add("active"),this.$emit("afterSelect"))},onSearchTermKeydown:function(){var e=this;setTimeout((function(){e.searchItems(e.searchTerm)}))},searchItems:function(e){var t=e.toLowerCase();Yn(this.$refs.root).find(".item").each((function(e,n){var r=Yn(n);-1===r.text().toLowerCase().indexOf(t)?r.hide():r.show()}))}}});Kn.render=Qn;var Xn=Kn,Zn=(jt({component:Xn,scope:{menuTitle:{angularJsBind:"@"},tooltip:{angularJsBind:"@"},showSearch:{angularJsBind:"="},menuTitleChangeOnClick:{angularJsBind:"="}},directiveName:"piwikMenudropdown",transclude:!0,events:{"after-select":function(e,t){setTimeout((function(){t.$apply()}),0)}}}),{ref:"root"}); + */function Hn(){return kn}Hn.$inject=[],angular.module("piwikApp.service").factory("piwikComparisonsService",Hn);St({component:Rn,directiveName:"piwikComparisons",restrict:"E"});var Fn={ref:"root",class:"menuDropdown"},_n=["title"],Un=["innerHTML"],qn=Object(a["createElementVNode"])("span",{class:"icon-arrow-bottom"},null,-1),Jn={class:"items"},Gn={key:0,class:"search"},zn=["placeholder"],Yn=["title"],Qn=["title"];function Wn(e,t,n,r,i,o){var l=Object(a["resolveDirective"])("focus-if"),c=Object(a["resolveDirective"])("focus-anywhere-but-here");return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Fn,[Object(a["createElementVNode"])("span",{class:"title",onClick:t[0]||(t[0]=function(t){return e.showItems=!e.showItems}),title:e.tooltip},[Object(a["createElementVNode"])("span",{innerHTML:e.$sanitize(this.actualMenuTitle)},null,8,Un),qn],8,_n),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",Jn,[e.showSearch&&e.showItems?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Gn,[Object(a["withDirectives"])(Object(a["createElementVNode"])("input",{type:"text","onUpdate:modelValue":t[1]||(t[1]=function(t){return e.searchTerm=t}),onKeydown:t[2]||(t[2]=function(t){return e.onSearchTermKeydown(t)}),placeholder:e.translate("General_Search")},null,40,zn),[[a["vModelText"],e.searchTerm],[l,{},e.showItems]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("img",{class:"search_ico",src:"plugins/Morpheus/images/search_ico.png",title:e.translate("General_Search")},null,8,Yn),[[a["vShow"],!e.searchTerm]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("img",{onClick:t[3]||(t[3]=function(t){e.searchTerm="",e.searchItems("")}),class:"reset",src:"plugins/CoreHome/images/reset_search.png",title:e.translate("General_Clear")},null,8,Qn),[[a["vShow"],e.searchTerm]])])):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("div",{onClick:t[4]||(t[4]=function(t){return e.selectItem(t)})},[Object(a["renderSlot"])(e.$slots,"default")])],512),[[a["vShow"],e.showItems]])],512)),[[c,{blur:e.lostFocus}]])}var Kn=window,Zn=Kn.$,Xn=Object(a["defineComponent"])({props:{menuTitle:String,tooltip:String,showSearch:Boolean,menuTitleChangeOnClick:String},directives:{FocusAnywhereButHere:Fe,FocusIf:qe},emits:["afterSelect"],watch:{menuTitle:function(){this.actualMenuTitle=this.menuTitle}},data:function(){return{showItems:!1,searchTerm:"",actualMenuTitle:this.menuTitle}},methods:{lostFocus:function(){this.showItems=!1},selectItem:function(e){var t=e.target.classList;!t.contains("item")||t.contains("disabled")||t.contains("separator")||(!1!==this.menuTitleChangeOnClick&&(this.actualMenuTitle=e.target.textContent.replace(/[\u0000-\u2666]/g,(function(e){return"&#".concat(e.charCodeAt(0),";")}))),this.showItems=!1,Zn(this.$slots.default()).find(".item").removeClass("active"),t.add("active"),this.$emit("afterSelect"))},onSearchTermKeydown:function(){var e=this;setTimeout((function(){e.searchItems(e.searchTerm)}))},searchItems:function(e){var t=e.toLowerCase();Zn(this.$refs.root).find(".item").each((function(e,n){var r=Zn(n);-1===r.text().toLowerCase().indexOf(t)?r.hide():r.show()}))}}});Xn.render=Wn;var er=Xn,tr=(St({component:er,scope:{menuTitle:{angularJsBind:"@"},tooltip:{angularJsBind:"@"},showSearch:{angularJsBind:"="},menuTitleChangeOnClick:{angularJsBind:"="}},directiveName:"piwikMenudropdown",transclude:!0,events:{"after-select":function(e,t){setTimeout((function(){t.$apply()}),0)}}}),{ref:"root"}); /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function er(e,t,n,r,i,a){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Zn,null,512)}function tr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tr(Object(n),!0).forEach((function(t){rr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ir=1,or=window,ar=or.$,cr=Object(o["defineComponent"])({props:{selectedDateStart:Date,selectedDateEnd:Date,highlightedDateStart:Date,highlightedDateEnd:Date,viewDate:[String,Date],stepMonths:Number,disableMonthDropdown:Boolean,options:Object},emits:["cellHover","cellHoverLeave","dateSelect"],setup:function(e,t){var n=Object(o["ref"])(null);function r(t,n){var r=t.children("a");if(e.selectedDateStart&&e.selectedDateEnd&&n>=e.selectedDateStart&&n<=e.selectedDateEnd?t.addClass("ui-datepicker-current-period"):t.removeClass("ui-datepicker-current-period"),e.highlightedDateStart&&e.highlightedDateEnd&&n>=e.highlightedDateStart&&n<=e.highlightedDateEnd){var i=r.length?r:t;i.addClass("ui-state-hover")}else t.removeClass("ui-state-hover"),r.removeClass("ui-state-hover")}function i(e,t,n){if(e.hasClass("ui-datepicker-other-month"))return a(e,t,n);var r=parseInt(e.children("a,span").text(),10);return new Date(n,t,r)}function a(e,t,n){var r,o=e.parent(),a=o.children("td");if(o.is(":first-child")){var c=o.children("td:not(.ui-datepicker-other-month)").first();return r=i(c,t,n),r.setDate(a.index(e)-a.index(c)+1),r}var l=o.children("td:not(.ui-datepicker-other-month)").last();return r=i(l,t,n),r.setDate(r.getDate()+a.index(e)-a.index(l)),r}function c(){var e=ar(n.value),t=e.find("td[data-month]"),r=parseInt(t.attr("data-month"),10),i=parseInt(t.attr("data-year"),10);return[r,i]}function l(){var e=ar(n.value),t=e.find(".ui-datepicker-calendar"),o=c(),a=t.find("td"),l=a.first(),s=i(l,o[0],o[1]);a.each((function(){r(ar(this),s),s.setDate(s.getDate()+1)}))}function s(){var t=e.viewDate;if(!t)return!1;if(!(t instanceof Date))try{t=P(t)}catch(o){return!1}var r=ar(n.value),i=c();return(i[0]!==t.getMonth()||i[1]!==t.getFullYear())&&(r.datepicker("setDate",t),!0)}function u(){var e=ar(n.value);e.find("td[data-event]").off("click"),e.find(".ui-state-active").removeClass("ui-state-active"),e.find(".ui-datepicker-current-day").removeClass("ui-datepicker-current-day"),e.find(".ui-datepicker-prev,.ui-datepicker-next").attr("href","")}function d(){var t=ar(n.value),r=e.stepMonths||ir;if(t.datepicker("option","stepMonths")===r)return!1;var i=ar(".ui-datepicker-month",t).val(),o=ar(".ui-datepicker-year",t).val();return t.datepicker("option","stepMonths",r).datepicker("setDate",new Date(o,i)),u(),!0}function f(){var t=ar(n.value);t.find(".ui-datepicker-month").attr("disabled",e.disableMonthDropdown)}function m(){if(ar(this).hasClass("ui-state-hover")){var e=ar(this).parent(),t=e.parent();e.is(":first-child")?t.find("a").first().click():t.find("a").last().click()}}function p(){f(),l()}return Object(o["watch"])((function(){return nr({},e)}),(function(e,t){var n=!1;["selectedDateStart","selectedDateEnd","highlightedDateStart","highlightedDateEnd"].forEach((function(r){n||(!e[r]&&t[r]&&(n=!0),e[r]&&!t[r]&&(n=!0),e[r]&&t[r]&&e[r].getTime()!==t[r].getTime()&&(n=!0))})),e.viewDate!==t.viewDate&&s()&&(n=!0),e.stepMonths!==t.stepMonths&&d(),e.enableDisableMonthDropdown!==t.enableDisableMonthDropdown&&f(),n&&l()})),Object(o["onMounted"])((function(){var r=ar(n.value),o=e.options||{},a=nr(nr(nr({},S.getBaseDatePickerOptions()),o),{},{onChangeMonthYear:function(){setTimeout((function(){u()}))}});r.datepicker(a),r.on("mouseover","tbody td a",(function(e){e.originalEvent&&l()})),r.on("mouseenter","tbody td",(function(){var e=c(),n=ar(this),r=i(n,e[0],e[1]);t.emit("cellHover",{date:r,$cell:n})})),r.on("mouseout","tbody td a",(function(){l()})),r.on("mouseleave","table",(function(){return t.emit("cellHoverLeave")})).on("mouseenter","thead",(function(){return t.emit("cellHoverLeave")})),r.on("click","tbody td.ui-datepicker-other-month",(function(){return m()})),r.on("click",(function(e){e.preventDefault();var t=ar(e.target).closest("a");(t.is(".ui-datepicker-next")||t.is(".ui-datepicker-prev"))&&p()})),r.on("click","td[data-month]",(function(e){var n=ar(e.target).closest("td"),r=parseInt(n.attr("data-month"),10),i=parseInt(n.attr("data-year"),10),o=parseInt(n.children("a,span").text(),10);t.emit("dateSelect",{date:new Date(i,r,o)})}));var h=d();s(),f(),h||u(),l()})),{root:n}}});cr.render=er;var lr=cr,sr=(jt({component:lr,scope:{selectedDateStart:{angularJsBind:"<"},selectedDateEnd:{angularJsBind:"<"},highlightedDateStart:{angularJsBind:"<"},highlightedDateEnd:{angularJsBind:"<"},viewDate:{angularJsBind:"<"},stepMonths:{angularJsBind:"<"},disableMonthDropdown:{angularJsBind:"<"},options:{angularJsBind:"<"},cellHover:{angularJsBind:"&"},cellHoverLeave:{angularJsBind:"&"},dateSelect:{angularJsBind:"&"}},directiveName:"piwikDatePicker",events:{"cell-hover":function(e,t,n,r,i){i()},"cell-hover-leave":function(e,t,n,r,i){i()},"date-select":function(e,t,n,r,i){i()}},$inject:["$timeout"]}),{id:"calendarRangeFrom"}),ur={id:"calendarRangeTo"}; + */function nr(e,t,n,r,i,o){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",tr,null,512)}function rr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ir(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rr(Object(n),!0).forEach((function(t){ar(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ar(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var or=1,lr=window,cr=lr.$,sr=Object(a["defineComponent"])({props:{selectedDateStart:Date,selectedDateEnd:Date,highlightedDateStart:Date,highlightedDateEnd:Date,viewDate:[String,Date],stepMonths:Number,disableMonthDropdown:Boolean,options:Object},emits:["cellHover","cellHoverLeave","dateSelect"],setup:function(e,t){var n=Object(a["ref"])(null);function r(t,n){var r=t.children("a");if(e.selectedDateStart&&e.selectedDateEnd&&n>=e.selectedDateStart&&n<=e.selectedDateEnd?t.addClass("ui-datepicker-current-period"):t.removeClass("ui-datepicker-current-period"),e.highlightedDateStart&&e.highlightedDateEnd&&n>=e.highlightedDateStart&&n<=e.highlightedDateEnd){var i=r.length?r:t;i.addClass("ui-state-hover")}else t.removeClass("ui-state-hover"),r.removeClass("ui-state-hover")}function i(e,t,n){if(e.hasClass("ui-datepicker-other-month"))return o(e,t,n);var r=parseInt(e.children("a,span").text(),10);return new Date(n,t,r)}function o(e,t,n){var r,a=e.parent(),o=a.children("td");if(a.is(":first-child")){var l=a.children("td:not(.ui-datepicker-other-month)").first();return r=i(l,t,n),r.setDate(o.index(e)-o.index(l)+1),r}var c=a.children("td:not(.ui-datepicker-other-month)").last();return r=i(c,t,n),r.setDate(r.getDate()+o.index(e)-o.index(c)),r}function l(){var e=cr(n.value),t=e.find("td[data-month]"),r=parseInt(t.attr("data-month"),10),i=parseInt(t.attr("data-year"),10);return[r,i]}function c(){var e=cr(n.value),t=e.find(".ui-datepicker-calendar"),a=l(),o=t.find("td"),c=o.first(),s=i(c,a[0],a[1]);o.each((function(){r(cr(this),s),s.setDate(s.getDate()+1)}))}function s(){var t=e.viewDate;if(!t)return!1;if(!(t instanceof Date))try{t=E(t)}catch(a){return!1}var r=cr(n.value),i=l();return(i[0]!==t.getMonth()||i[1]!==t.getFullYear())&&(r.datepicker("setDate",t),!0)}function u(){var e=cr(n.value);e.find("td[data-event]").off("click"),e.find(".ui-state-active").removeClass("ui-state-active"),e.find(".ui-datepicker-current-day").removeClass("ui-datepicker-current-day"),e.find(".ui-datepicker-prev,.ui-datepicker-next").attr("href","")}function d(){var t=cr(n.value),r=e.stepMonths||or;if(t.datepicker("option","stepMonths")===r)return!1;var i=cr(".ui-datepicker-month",t).val(),a=cr(".ui-datepicker-year",t).val();return t.datepicker("option","stepMonths",r).datepicker("setDate",new Date(a,i)),u(),!0}function p(){var t=cr(n.value);t.find(".ui-datepicker-month").attr("disabled",e.disableMonthDropdown)}function f(){if(cr(this).hasClass("ui-state-hover")){var e=cr(this).parent(),t=e.parent();e.is(":first-child")?t.find("a").first().click():t.find("a").last().click()}}function m(){p(),c()}return Object(a["watch"])((function(){return ir({},e)}),(function(e,t){var n=!1;["selectedDateStart","selectedDateEnd","highlightedDateStart","highlightedDateEnd"].forEach((function(r){n||(!e[r]&&t[r]&&(n=!0),e[r]&&!t[r]&&(n=!0),e[r]&&t[r]&&e[r].getTime()!==t[r].getTime()&&(n=!0))})),e.viewDate!==t.viewDate&&s()&&(n=!0),e.stepMonths!==t.stepMonths&&d(),e.enableDisableMonthDropdown!==t.enableDisableMonthDropdown&&p(),n&&c()})),Object(a["onMounted"])((function(){var r=cr(n.value),a=e.options||{},o=ir(ir(ir({},S.getBaseDatePickerOptions()),a),{},{onChangeMonthYear:function(){setTimeout((function(){u()}))}});r.datepicker(o),r.on("mouseover","tbody td a",(function(e){e.originalEvent&&c()})),r.on("mouseenter","tbody td",(function(){var e=l(),n=cr(this),r=i(n,e[0],e[1]);t.emit("cellHover",{date:r,$cell:n})})),r.on("mouseout","tbody td a",(function(){c()})),r.on("mouseleave","table",(function(){return t.emit("cellHoverLeave")})).on("mouseenter","thead",(function(){return t.emit("cellHoverLeave")})),r.on("click","tbody td.ui-datepicker-other-month",(function(){return f()})),r.on("click",(function(e){e.preventDefault();var t=cr(e.target).closest("a");(t.is(".ui-datepicker-next")||t.is(".ui-datepicker-prev"))&&m()})),r.on("click","td[data-month]",(function(e){var n=cr(e.target).closest("td"),r=parseInt(n.attr("data-month"),10),i=parseInt(n.attr("data-year"),10),a=parseInt(n.children("a,span").text(),10);t.emit("dateSelect",{date:new Date(i,r,a)})}));var h=d();s(),p(),h||u(),c()})),{root:n}}});sr.render=nr;var ur=sr,dr=(St({component:ur,scope:{selectedDateStart:{angularJsBind:"<"},selectedDateEnd:{angularJsBind:"<"},highlightedDateStart:{angularJsBind:"<"},highlightedDateEnd:{angularJsBind:"<"},viewDate:{angularJsBind:"<"},stepMonths:{angularJsBind:"<"},disableMonthDropdown:{angularJsBind:"<"},options:{angularJsBind:"<"},cellHover:{angularJsBind:"&"},cellHoverLeave:{angularJsBind:"&"},dateSelect:{angularJsBind:"&"}},directiveName:"piwikDatePicker",events:{"cell-hover":function(e,t,n,r,i){i()},"cell-hover-leave":function(e,t,n,r,i){i()},"date-select":function(e,t,n,r,i){i()}},$inject:["$timeout"]}),{id:"calendarRangeFrom"}),pr={id:"calendarRangeTo"}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function dr(e,t,n,r,i,a){var c=Object(o["resolveComponent"])("DatePicker");return Object(o["openBlock"])(),Object(o["createElementBlock"])(o["Fragment"],null,[Object(o["createElementVNode"])("div",sr,[Object(o["createElementVNode"])("h6",null,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("General_DateRangeFrom"))+" ",1),Object(o["withDirectives"])(Object(o["createElementVNode"])("input",{type:"text",id:"inputCalendarFrom",name:"inputCalendarFrom",class:"browser-default","onUpdate:modelValue":t[0]||(t[0]=function(t){return e.startDateText=t}),onChange:t[1]||(t[1]=function(t){return e.onRangeInputChanged("from",t)}),onKeyup:t[2]||(t[2]=function(t){return e.handleEnterPress(t)})},null,544),[[o["vModelText"],e.startDateText]])]),Object(o["createVNode"])(c,{id:"calendarFrom","view-date":e.startDate,"selected-date-start":e.fromPickerSelectedDates[0],"selected-date-end":e.fromPickerSelectedDates[1],"highlighted-date-start":e.fromPickerHighlightedDates[0],"highlighted-date-end":e.fromPickerHighlightedDates[1],onDateSelect:t[3]||(t[3]=function(t){return e.setStartRangeDate(t.date)}),onCellHover:t[4]||(t[4]=function(t){return e.fromPickerHighlightedDates=e.getNewHighlightedDates(t.date,t.$cell)}),onCellHoverLeave:t[5]||(t[5]=function(t){return e.fromPickerHighlightedDates=[null,null]})},null,8,["view-date","selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end"])]),Object(o["createElementVNode"])("div",ur,[Object(o["createElementVNode"])("h6",null,[Object(o["createTextVNode"])(Object(o["toDisplayString"])(e.translate("General_DateRangeTo"))+" ",1),Object(o["withDirectives"])(Object(o["createElementVNode"])("input",{type:"text",id:"inputCalendarTo",name:"inputCalendarTo",class:"browser-default","onUpdate:modelValue":t[6]||(t[6]=function(t){return e.endDateText=t}),onChange:t[7]||(t[7]=function(t){return e.onRangeInputChanged("to",t)}),onKeyup:t[8]||(t[8]=function(t){return e.handleEnterPress(t)})},null,544),[[o["vModelText"],e.endDateText]])]),Object(o["createVNode"])(c,{id:"calendarTo","view-date":e.endDate,"selected-date-start":e.toPickerSelectedDates[0],"selected-date-end":e.toPickerSelectedDates[1],"highlighted-date-start":e.toPickerHighlightedDates[0],"highlighted-date-end":e.toPickerHighlightedDates[1],onDateSelect:t[9]||(t[9]=function(t){return e.setEndRangeDate(t.date)}),onCellHover:t[10]||(t[10]=function(t){return e.toPickerHighlightedDates=e.getNewHighlightedDates(t.date,t.$cell)}),onCellHoverLeave:t[11]||(t[11]=function(t){return e.toPickerHighlightedDates=[null,null]})},null,8,["view-date","selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end"])])],64)}var fr=Object(o["defineComponent"])({props:{startDate:String,endDate:String},components:{DatePicker:lr},data:function(){var e=null;try{e=P(this.startDate)}catch(n){}var t=null;try{t=P(this.endDate)}catch(n){}return{fromPickerSelectedDates:[e,e],toPickerSelectedDates:[t,t],fromPickerHighlightedDates:[null,null],toPickerHighlightedDates:[null,null],startDateText:this.startDate,endDateText:this.endDate}},emits:["rangeChange","submit"],watch:{startDate:function(){this.startDateText=this.startDate,this.setStartRangeDateFromStr(this.startDate)},endDate:function(){this.endDateText=this.endDate,this.setEndRangeDateFromStr(this.endDate)}},mounted:function(){this.rangeChanged()},methods:{setStartRangeDate:function(e){this.fromPickerSelectedDates=[e,e],this.rangeChanged()},setEndRangeDate:function(e){this.toPickerSelectedDates=[e,e],this.rangeChanged()},onRangeInputChanged:function(e,t){"from"===e?this.setStartRangeDateFromStr(t.target.value):this.setEndRangeDateFromStr(t.target.value)},getNewHighlightedDates:function(e,t){return t.hasClass("ui-datepicker-unselectable")?null:[e,e]},handleEnterPress:function(e){13===e.keyCode&&this.$emit("submit",{start:this.startDate,end:this.endDate})},setStartRangeDateFromStr:function(e){var t;try{t=P(e)}catch(n){this.startDateText=this.startDate}t&&(this.fromPickerSelectedDates=[t,t]),this.rangeChanged()},setEndRangeDateFromStr:function(e){var t;try{t=P(e)}catch(n){this.endDateText=this.endDate}t&&(this.toPickerSelectedDates=[t,t]),this.rangeChanged()},rangeChanged:function(){this.$emit("rangeChange",{start:D(this.fromPickerSelectedDates[0]),end:D(this.toPickerSelectedDates[0])})}}});fr.render=dr;var mr=fr; + */function fr(e,t,n,r,i,o){var l=Object(a["resolveComponent"])("DatePicker");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",null,[Object(a["createElementVNode"])("div",dr,[Object(a["createElementVNode"])("h6",null,[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("General_DateRangeFrom"))+" ",1),Object(a["withDirectives"])(Object(a["createElementVNode"])("input",{type:"text",id:"inputCalendarFrom",name:"inputCalendarFrom",class:"browser-default","onUpdate:modelValue":t[0]||(t[0]=function(t){return e.startDateText=t}),onKeydown:t[1]||(t[1]=function(t){return e.onRangeInputChanged("from",t)}),onKeyup:t[2]||(t[2]=function(t){return e.handleEnterPress(t)})},null,544),[[a["vModelText"],e.startDateText]])]),Object(a["createVNode"])(l,{id:"calendarFrom","view-date":e.startDate,"selected-date-start":e.fromPickerSelectedDates[0],"selected-date-end":e.fromPickerSelectedDates[1],"highlighted-date-start":e.fromPickerHighlightedDates[0],"highlighted-date-end":e.fromPickerHighlightedDates[1],onDateSelect:t[3]||(t[3]=function(t){return e.setStartRangeDate(t.date)}),onCellHover:t[4]||(t[4]=function(t){return e.fromPickerHighlightedDates=e.getNewHighlightedDates(t.date,t.$cell)}),onCellHoverLeave:t[5]||(t[5]=function(t){return e.fromPickerHighlightedDates=[null,null]})},null,8,["view-date","selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end"])]),Object(a["createElementVNode"])("div",pr,[Object(a["createElementVNode"])("h6",null,[Object(a["createTextVNode"])(Object(a["toDisplayString"])(e.translate("General_DateRangeTo"))+" ",1),Object(a["withDirectives"])(Object(a["createElementVNode"])("input",{type:"text",id:"inputCalendarTo",name:"inputCalendarTo",class:"browser-default","onUpdate:modelValue":t[6]||(t[6]=function(t){return e.endDateText=t}),onKeydown:t[7]||(t[7]=function(t){return e.onRangeInputChanged("to",t)}),onKeyup:t[8]||(t[8]=function(t){return e.handleEnterPress(t)})},null,544),[[a["vModelText"],e.endDateText]])]),Object(a["createVNode"])(l,{id:"calendarTo","view-date":e.endDate,"selected-date-start":e.toPickerSelectedDates[0],"selected-date-end":e.toPickerSelectedDates[1],"highlighted-date-start":e.toPickerHighlightedDates[0],"highlighted-date-end":e.toPickerHighlightedDates[1],onDateSelect:t[9]||(t[9]=function(t){return e.setEndRangeDate(t.date)}),onCellHover:t[10]||(t[10]=function(t){return e.toPickerHighlightedDates=e.getNewHighlightedDates(t.date,t.$cell)}),onCellHoverLeave:t[11]||(t[11]=function(t){return e.toPickerHighlightedDates=[null,null]})},null,8,["view-date","selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end"])])])}var mr="YYYY-MM-DD",hr=Object(a["defineComponent"])({props:{startDate:String,endDate:String},components:{DatePicker:ur},data:function(){var e=null;try{e=E(this.startDate)}catch(n){}var t=null;try{t=E(this.endDate)}catch(n){}return{fromPickerSelectedDates:[e,e],toPickerSelectedDates:[t,t],fromPickerHighlightedDates:[null,null],toPickerHighlightedDates:[null,null],startDateText:this.startDate,endDateText:this.endDate,startDateInvalid:!1,endDateInvalid:!1}},emits:["rangeChange","submit"],watch:{startDate:function(){this.startDateText=this.startDate,this.setStartRangeDateFromStr(this.startDate)},endDate:function(){this.endDateText=this.endDate,this.setEndRangeDateFromStr(this.endDate)}},mounted:function(){this.rangeChanged()},methods:{setStartRangeDate:function(e){this.fromPickerSelectedDates=[e,e],this.rangeChanged()},setEndRangeDate:function(e){this.toPickerSelectedDates=[e,e],this.rangeChanged()},onRangeInputChanged:function(e,t){var n=this;setTimeout((function(){"from"===e?n.setStartRangeDateFromStr(t.target.value):n.setEndRangeDateFromStr(t.target.value)}))},getNewHighlightedDates:function(e,t){return t.hasClass("ui-datepicker-unselectable")?null:[e,e]},handleEnterPress:function(e){13===e.keyCode&&this.$emit("submit",{start:this.startDate,end:this.endDate})},setStartRangeDateFromStr:function(e){var t;this.startDateInvalid=!0;try{e.length===mr.length&&(t=E(e))}catch(n){}t&&(this.fromPickerSelectedDates=[t,t],this.startDateInvalid=!1,this.rangeChanged())},setEndRangeDateFromStr:function(e){var t;this.endDateInvalid=!0;try{e.length===mr.length&&(t=E(e))}catch(n){}t&&(this.toPickerSelectedDates=[t,t],this.endDateInvalid=!1,this.rangeChanged())},rangeChanged:function(){this.$emit("rangeChange",{start:C(this.fromPickerSelectedDates[0]),end:C(this.toPickerSelectedDates[0])})}}});hr.render=fr;var vr=hr; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */jt({component:mr,scope:{startDate:{angularJsBind:"<"},endDate:{angularJsBind:"<"},rangeChange:{angularJsBind:"&"},submit:{angularJsBind:"&"}},directiveName:"piwikDateRangePicker",restrict:"E"});function pr(e,t,n,r,i,a){var c=Object(o["resolveComponent"])("DatePicker");return Object(o["openBlock"])(),Object(o["createBlock"])(c,{"selected-date-start":e.selectedDates[0],"selected-date-end":e.selectedDates[1],"highlighted-date-start":e.highlightedDates[0],"highlighted-date-end":e.highlightedDates[1],"view-date":e.viewDate,"step-months":"year"===e.period?12:1,"disable-month-dropdown":"year"===e.period,onCellHover:t[0]||(t[0]=function(t){return e.onHoverNormalCell(t.date,t.$cell)}),onCellHoverLeave:t[1]||(t[1]=function(t){return e.onHoverLeaveNormalCells()}),onDateSelect:t[2]||(t[2]=function(t){return e.onDateSelected(t.date)})},null,8,["selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end","view-date","step-months","disable-month-dropdown"])}var hr=new Date(S.minDateYear,S.minDateMonth-1,S.minDateDay),vr=new Date(S.maxDateYear,S.maxDateMonth-1,S.maxDateDay),gr=Object(o["defineComponent"])({props:{period:String,date:[String,Date]},components:{DatePicker:lr},emits:["select"],setup:function(e,t){var n=Object(o["ref"])(e.date),r=Object(o["ref"])([null,null]),i=Object(o["ref"])([null,null]);function a(t){var n=f.get(e.period).parse(t).getDateRange();return n[0]=hr<n[0]?n[0]:hr,n[1]=vr>n[1]?n[1]:vr,n}function c(t,n){var r=t<hr||t>vr,o=n.hasClass("ui-datepicker-other-month")&&("month"===e.period||"day"===e.period);i.value=r||o?[null,null]:a(t)}function l(){i.value=[null,null]}function s(e){t.emit("select",{date:e})}function u(){if(!e.period||!e.date)return r.value=[null,null],void(n.value=null);r.value=a(e.date),n.value=P(e.date)}return Object(o["watch"])(e,u),u(),{selectedDates:r,highlightedDates:i,viewDate:n,onHoverNormalCell:c,onHoverLeaveNormalCells:l,onDateSelected:s}}});gr.render=pr;var br=gr,yr=(jt({component:br,scope:{period:{angularJsBind:"<"},date:{angularJsBind:"<"},select:{angularJsBind:"&"}},directiveName:"piwikPeriodDatePicker",restrict:"E"}),["value","name"]),wr=["title"],Or=["textContent"],jr={key:1,class:"placeholder"},kr={class:"dropdown"},Sr={class:"custom_select_search"},Cr=["placeholder"],Dr={key:0},Er={class:"custom_select_container"},Pr=["onClick"],Tr=["innerHTML","href","title"],Ir={class:"ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all\n siteSelect"},Vr={class:"ui-menu-item"},xr={class:"ui-corner-all",tabindex:"-1"},Nr={key:1}; + */St({component:vr,scope:{startDate:{angularJsBind:"<"},endDate:{angularJsBind:"<"},rangeChange:{angularJsBind:"&"},submit:{angularJsBind:"&"}},directiveName:"piwikDateRangePicker",restrict:"E"});function gr(e,t,n,r,i,o){var l=Object(a["resolveComponent"])("DatePicker");return Object(a["openBlock"])(),Object(a["createBlock"])(l,{"selected-date-start":e.selectedDates[0],"selected-date-end":e.selectedDates[1],"highlighted-date-start":e.highlightedDates[0],"highlighted-date-end":e.highlightedDates[1],"view-date":e.viewDate,"step-months":"year"===e.period?12:1,"disable-month-dropdown":"year"===e.period,onCellHover:t[0]||(t[0]=function(t){return e.onHoverNormalCell(t.date,t.$cell)}),onCellHoverLeave:t[1]||(t[1]=function(t){return e.onHoverLeaveNormalCells()}),onDateSelect:t[2]||(t[2]=function(t){return e.onDateSelected(t.date)})},null,8,["selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end","view-date","step-months","disable-month-dropdown"])}var br=new Date(S.minDateYear,S.minDateMonth-1,S.minDateDay),yr=new Date(S.maxDateYear,S.maxDateMonth-1,S.maxDateDay),Or=Object(a["defineComponent"])({props:{period:String,date:[String,Date]},components:{DatePicker:ur},emits:["select"],setup:function(e,t){var n=Object(a["ref"])(e.date),r=Object(a["ref"])([null,null]),i=Object(a["ref"])([null,null]);function o(t){var n=p.get(e.period).parse(t).getDateRange();return n[0]=br<n[0]?n[0]:br,n[1]=yr>n[1]?n[1]:yr,n}function l(t,n){var r=t<br||t>yr,a=n.hasClass("ui-datepicker-other-month")&&("month"===e.period||"day"===e.period);i.value=r||a?[null,null]:o(t)}function c(){i.value=[null,null]}function s(e){t.emit("select",{date:e})}function u(){if(!e.period||!e.date)return r.value=[null,null],void(n.value=null);r.value=o(e.date),n.value=E(e.date)}return Object(a["watch"])(e,u),u(),{selectedDates:r,highlightedDates:i,viewDate:n,onHoverNormalCell:l,onHoverLeaveNormalCells:c,onDateSelected:s}}});Or.render=gr;var wr=Or,jr=(St({component:wr,scope:{period:{angularJsBind:"<"},date:{angularJsBind:"<"},select:{angularJsBind:"&"}},directiveName:"piwikPeriodDatePicker",restrict:"E"}),["value","name"]),kr=["title"],Sr=["textContent"],Dr={key:1,class:"placeholder"},Cr={class:"dropdown"},Pr={class:"custom_select_search"},Er=["placeholder"],Vr={key:0},Tr={class:"custom_select_container"},Ir=["onClick"],xr=["innerHTML","href","title"],Nr={class:"ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all\n siteSelect"},Br={class:"ui-menu-item"},Ar={class:"ui-corner-all",tabindex:"-1"},Mr={key:1}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function Br(e,t,n,r,i,a){var c,l,s,u,d=Object(o["resolveComponent"])("AllSitesLink"),f=Object(o["resolveDirective"])("focus-if"),m=Object(o["resolveDirective"])("focus-anywhere-but-here");return Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:Object(o["normalizeClass"])(["siteSelector piwikSelector borderedControl",{expanded:e.showSitesList,disabled:!e.hasMultipleSites}])},[e.name?(Object(o["openBlock"])(),Object(o["createElementBlock"])("input",{key:0,type:"hidden",value:null===(c=e.modelValue)||void 0===c?void 0:c.id,name:e.name},null,8,yr)):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("a",{ref:"selectorLink",onClick:t[0]||(t[0]=function(){return e.onClickSelector&&e.onClickSelector.apply(e,arguments)}),onKeydown:t[1]||(t[1]=function(t){return e.onPressEnter(t)}),href:"javascript:void(0)",class:Object(o["normalizeClass"])([{loading:e.isLoading},"title"]),tabindex:"4",title:e.selectorLinkTitle},[Object(o["createElementVNode"])("span",{class:Object(o["normalizeClass"])(["icon icon-arrow-bottom",{iconHidden:e.isLoading,collapsed:!e.showSitesList}])},null,2),Object(o["createElementVNode"])("span",null,[null!==(l=e.modelValue)&&void 0!==l&&l.name||!e.placeholder?(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",{key:0,textContent:Object(o["toDisplayString"])((null===(s=e.modelValue)||void 0===s?void 0:s.name)||e.firstSiteName)},null,8,Or)):Object(o["createCommentVNode"])("",!0),null!==(u=e.modelValue)&&void 0!==u&&u.name||!e.placeholder?Object(o["createCommentVNode"])("",!0):(Object(o["openBlock"])(),Object(o["createElementBlock"])("span",jr,Object(o["toDisplayString"])(e.placeholder),1))])],42,wr),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",kr,[Object(o["withDirectives"])(Object(o["createElementVNode"])("div",Sr,[Object(o["withDirectives"])(Object(o["createElementVNode"])("input",{type:"text",onClick:t[2]||(t[2]=function(t){e.searchTerm="",e.loadInitialSites()}),"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.searchTerm=t}),tabindex:"4",class:"websiteSearch inp browser-default",placeholder:e.translate("General_Search")},null,8,Cr),[[o["vModelText"],e.searchTerm],[f,{},e.shouldFocusOnSearch]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("img",{title:"Clear",onClick:t[4]||(t[4]=function(t){e.searchTerm="",e.loadInitialSites()}),class:"reset",src:"plugins/CoreHome/images/reset_search.png"},null,512),[[o["vShow"],e.searchTerm]])],512),[[o["vShow"],e.autocompleteMinSites<=e.sites.length||e.searchTerm]]),"top"===e.allSitesLocation&&e.showAllSitesItem?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Dr,[Object(o["createVNode"])(d,{href:e.urlAllSites,"all-sites-text":e.allSitesText,onClick:t[5]||(t[5]=function(t){return e.onAllSitesClick(t)})},null,8,["href","all-sites-text"])])):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("div",Er,[Object(o["createElementVNode"])("ul",{class:"custom_select_ul_list",onClick:t[7]||(t[7]=function(t){return e.showSitesList=!1})},[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.sites,(function(n,r){return Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["createElementBlock"])("li",{onClick:function(t){return e.switchSite(n,t)},key:r},[Object(o["createElementVNode"])("a",{onClick:t[6]||(t[6]=function(e){return e.preventDefault()}),innerHTML:e.$sanitize(e.getMatchedSiteName(n.name)),tabindex:"4",href:e.getUrlForSiteId(n.idsite),title:n.name},null,8,Tr)],8,Pr)),[[o["vShow"],!(!e.showSelectedSite&&e.activeSiteId===n.idsite)]])})),128))]),Object(o["withDirectives"])(Object(o["createElementVNode"])("ul",Ir,[Object(o["createElementVNode"])("li",Vr,[Object(o["createElementVNode"])("a",xr,Object(o["toDisplayString"])(e.translate("SitesManager_NotFound")+" "+e.searchTerm),1)])],512),[[o["vShow"],!e.sites.length&&e.searchTerm]])]),"bottom"===e.allSitesLocation&&e.showAllSitesItem?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Nr,[Object(o["createVNode"])(d,{href:e.urlAllSites,"all-sites-text":e.allSitesText,onClick:t[8]||(t[8]=function(t){return e.onAllSitesClick(t)})},null,8,["href","all-sites-text"])])):Object(o["createCommentVNode"])("",!0)],512),[[o["vShow"],e.showSitesList]])],2)),[[m,{blur:e.onBlur}]])}var Ar=["innerHTML","href"];function Mr(e,t,n,r,i,a){var c=this;return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{onClick:t[1]||(t[1]=function(e){return c.onClick(e)}),class:"custom_select_all"},[Object(o["createElementVNode"])("a",{onClick:t[0]||(t[0]=function(e){return e.preventDefault()}),innerHTML:e.$sanitize(e.allSitesText),tabindex:"4",href:e.href},null,8,Ar)])}var $r=Object(o["defineComponent"])({props:{href:String,allSitesText:String},emits:["click"],methods:{onClick:function(e){this.$emit("click",e)}}});$r.render=Mr;var Lr=$r;function Hr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Fr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hr(Object(n),!0).forEach((function(t){qr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ur(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Rr(e,t,n){return t&&Ur(e.prototype,t),n&&Ur(e,n),e}function qr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} + */function $r(e,t,n,r,i,o){var l,c,s,u,d=Object(a["resolveComponent"])("AllSitesLink"),p=Object(a["resolveDirective"])("focus-if"),f=Object(a["resolveDirective"])("focus-anywhere-but-here");return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:Object(a["normalizeClass"])(["siteSelector piwikSelector borderedControl",{expanded:e.showSitesList,disabled:!e.hasMultipleSites}])},[e.name?(Object(a["openBlock"])(),Object(a["createElementBlock"])("input",{key:0,type:"hidden",value:null===(l=e.modelValue)||void 0===l?void 0:l.id,name:e.name},null,8,jr)):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("a",{ref:"selectorLink",onClick:t[0]||(t[0]=function(){return e.onClickSelector&&e.onClickSelector.apply(e,arguments)}),onKeydown:t[1]||(t[1]=function(t){return e.onPressEnter(t)}),href:"javascript:void(0)",class:Object(a["normalizeClass"])([{loading:e.isLoading},"title"]),tabindex:"4",title:e.selectorLinkTitle},[Object(a["createElementVNode"])("span",{class:Object(a["normalizeClass"])(["icon icon-arrow-bottom",{iconHidden:e.isLoading,collapsed:!e.showSitesList}])},null,2),Object(a["createElementVNode"])("span",null,[null!==(c=e.modelValue)&&void 0!==c&&c.name||!e.placeholder?(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",{key:0,textContent:Object(a["toDisplayString"])((null===(s=e.modelValue)||void 0===s?void 0:s.name)||e.firstSiteName)},null,8,Sr)):Object(a["createCommentVNode"])("",!0),null!==(u=e.modelValue)&&void 0!==u&&u.name||!e.placeholder?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("span",Dr,Object(a["toDisplayString"])(e.placeholder),1))])],42,kr),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",Cr,[Object(a["withDirectives"])(Object(a["createElementVNode"])("div",Pr,[Object(a["withDirectives"])(Object(a["createElementVNode"])("input",{type:"text",onClick:t[2]||(t[2]=function(t){e.searchTerm="",e.loadInitialSites()}),"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.searchTerm=t}),tabindex:"4",class:"websiteSearch inp browser-default",placeholder:e.translate("General_Search")},null,8,Er),[[a["vModelText"],e.searchTerm],[p,{},e.shouldFocusOnSearch]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("img",{title:"Clear",onClick:t[4]||(t[4]=function(t){e.searchTerm="",e.loadInitialSites()}),class:"reset",src:"plugins/CoreHome/images/reset_search.png"},null,512),[[a["vShow"],e.searchTerm]])],512),[[a["vShow"],e.autocompleteMinSites<=e.sites.length||e.searchTerm]]),"top"===e.allSitesLocation&&e.showAllSitesItem?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Vr,[Object(a["createVNode"])(d,{href:e.urlAllSites,"all-sites-text":e.allSitesText,onClick:t[5]||(t[5]=function(t){return e.onAllSitesClick(t)})},null,8,["href","all-sites-text"])])):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("div",Tr,[Object(a["createElementVNode"])("ul",{class:"custom_select_ul_list",onClick:t[7]||(t[7]=function(t){return e.showSitesList=!1})},[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.sites,(function(n,r){return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("li",{onClick:function(t){return e.switchSite(n,t)},key:r},[Object(a["createElementVNode"])("a",{onClick:t[6]||(t[6]=function(e){return e.preventDefault()}),innerHTML:e.$sanitize(e.getMatchedSiteName(n.name)),tabindex:"4",href:e.getUrlForSiteId(n.idsite),title:n.name},null,8,xr)],8,Ir)),[[a["vShow"],!(!e.showSelectedSite&&e.activeSiteId===n.idsite)]])})),128))]),Object(a["withDirectives"])(Object(a["createElementVNode"])("ul",Nr,[Object(a["createElementVNode"])("li",Br,[Object(a["createElementVNode"])("a",Ar,Object(a["toDisplayString"])(e.translate("SitesManager_NotFound")+" "+e.searchTerm),1)])],512),[[a["vShow"],!e.sites.length&&e.searchTerm]])]),"bottom"===e.allSitesLocation&&e.showAllSitesItem?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Mr,[Object(a["createVNode"])(d,{href:e.urlAllSites,"all-sites-text":e.allSitesText,onClick:t[8]||(t[8]=function(t){return e.onAllSitesClick(t)})},null,8,["href","all-sites-text"])])):Object(a["createCommentVNode"])("",!0)],512),[[a["vShow"],e.showSitesList]])],2)),[[f,{blur:e.onBlur}]])}var Lr=["innerHTML","href"];function Rr(e,t,n,r,i,o){var l=this;return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{onClick:t[1]||(t[1]=function(e){return l.onClick(e)}),class:"custom_select_all"},[Object(a["createElementVNode"])("a",{onClick:t[0]||(t[0]=function(e){return e.preventDefault()}),innerHTML:e.$sanitize(e.allSitesText),tabindex:"4",href:e.href},null,8,Lr)])}var Hr=Object(a["defineComponent"])({props:{href:String,allSitesText:String},emits:["click"],methods:{onClick:function(e){this.$emit("click",e)}}});Hr.render=Rr;var Fr=Hr;function _r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ur(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_r(Object(n),!0).forEach((function(t){zr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function qr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Gr(e,t,n){return t&&Jr(e.prototype,t),n&&Jr(e,n),e}function zr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */var Jr=function(){function e(){var t=this;_r(this,e),qr(this,"state",Object(o["reactive"])({initialSites:[],isInitialized:!1})),qr(this,"currentRequest",void 0),qr(this,"limitRequest",void 0),qr(this,"initialSites",Object(o["computed"])((function(){return Object(o["readonly"])(t.state.initialSites)})))}return Rr(e,[{key:"loadInitialSites",value:function(){var e=this;return this.state.isInitialized?Promise.resolve(Object(o["readonly"])(this.state.initialSites)):this.searchSite("%").then((function(t){return e.state.isInitialized=!0,e.state.initialSites=t,Object(o["readonly"])(t)}))}},{key:"loadSite",value:function(e){"all"===e?Oe.updateUrl(Fr(Fr({},Oe.urlParsed.value),{},{module:"MultiSites",action:"index",date:Oe.parsed.value.date,period:Oe.parsed.value.period})):Oe.updateUrl(Fr(Fr({},Oe.parsed.value),{},{segment:"",idSite:e}))}},{key:"searchSite",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?(this.currentRequest&&this.currentRequest.abort(),this.limitRequest||(this.limitRequest=xe.fetch({method:"SitesManager.getNumWebsitesToDisplayPerPage"})),this.limitRequest.then((function(r){var i=r.value,o="SitesManager.getPatternMatchSites";return n&&(o="SitesManager.getSitesWithAdminAccess"),t.currentRequest=xe.fetch({method:o,limit:i,pattern:e}),t.currentRequest})).then((function(e){return e?t.processWebsitesList(e):null})).finally((function(){t.currentRequest=null}))):this.loadInitialSites()}},{key:"processWebsitesList",value:function(e){var t=e;return t&&t.length?(t=t.map((function(e){return Fr(Fr({},e),{},{name:e.group?"[".concat(e.group,"] ").concat(e.name):e.name})})),t.sort((function(e,t){return e.name.toLowerCase()<t.name.toLowerCase()?-1:e.name.toLowerCase()>t.name.toLowerCase()?1:0})),t):[]}}]),e}(),zr=new Jr,Gr=300;function Qr(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gr;return function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];t&&clearTimeout(t),t=setTimeout((function(){e.apply(void 0,i)}),n)}}function Wr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Yr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wr(Object(n),!0).forEach((function(t){Kr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Kr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xr=Object(o["defineComponent"])({props:{modelValue:{Object:Object,default:{id:S.idSite,name:S.helper.htmlDecode(S.siteName)}},showSelectedSite:{type:Boolean,default:!1},showAllSitesItem:{type:Boolean,default:!0},switchSiteOnSelect:{type:Boolean,default:!0},onlySitesWithAdminAccess:{type:Boolean,default:!1},name:{type:String,default:""},allSitesText:{type:String,default:C("General_MultiSitesSummary")},allSitesLocation:{type:String,default:"bottom"},placeholder:String},emits:["update:modelValue","blur"],components:{AllSitesLink:Lr},directives:{FocusAnywhereButHere:_e,FocusIf:qe},watch:{searchTerm:function(){this.onSearchTermChanged()}},data:function(){return{searchTerm:"",activeSiteId:S.idSite,showSitesList:!1,isLoading:!1,sites:[],selectedSite:this.modelValue||{id:S.idSite,name:S.helper.htmlDecode(S.siteName)},autocompleteMinSites:parseInt(S.config.autocomplete_min_sites,10)}},mounted:function(){var e=this;window.initTopControls(),this.loadInitialSites().then((function(){e.modelValue&&e.modelValue.id||!e.sites[0]||e.$emit("update:modelValue",{id:e.sites[0].idsite,name:e.sites[0].name})}));var t=C("CoreHome_ShortcutWebsiteSelector");S.helper.registerShortcut("w",t,(function(t){t.altKey||(t.preventDefault?t.preventDefault():t.returnValue=!1,e.$refs.selectorLink.click(),e.$refs.selectorLink.focus())}))},computed:{shouldFocusOnSearch:function(){return this.showSitesList&&this.autocompleteMinSites<=this.sites.length||this.searchTerm},selectorLinkTitle:function(){var e;return this.hasMultipleSites?C("CoreHome_ChangeCurrentWebsite",(null===(e=this.modelValue)||void 0===e?void 0:e.name)||this.firstSiteName):""},hasMultipleSites:function(){return zr.initialSites.value&&zr.initialSites.value.length>1},firstSiteName:function(){return this.sites&&this.sites.length>0?this.sites[0].name:""},urlAllSites:function(){var e=Oe.stringify(Yr(Yr({},Oe.urlParsed.value),{},{module:"MultiSites",action:"index",date:Oe.parsed.value.date,period:Oe.parsed.value.period}));return"?".concat(e)}},created:function(){this.searchSite=Qr(this.searchSite.bind(this))},methods:{onSearchTermChanged:function(){this.searchTerm?(this.isLoading=!0,this.searchSite(this.searchTerm)):(this.isLoading=!1,this.loadInitialSites())},onAllSitesClick:function(e){this.switchSite({idsite:"all",name:this.allSitesText},e),this.showSitesList=!1},switchSite:function(e,t){var n=-1!==navigator.userAgent.indexOf("Mac OS X")?t.metaKey:t.ctrlKey;t&&n&&t.target&&t.target.href?window.open(t.target.href,"_blank"):(this.$emit("update:modelValue",{id:e.idsite,name:e.name}),this.switchSiteOnSelect&&this.activeSiteId!==e.idsite&&zr.loadSite(e.idsite))},onBlur:function(){this.showSitesList=!1,this.$emit("blur")},onClickSelector:function(){this.hasMultipleSites&&(this.showSitesList=!this.showSitesList,this.isLoading||this.searchTerm||this.loadInitialSites())},onPressEnter:function(e){"Enter"===e.key&&(e.preventDefault(),this.showSitesList=!this.showSitesList,this.showSitesList&&!this.isLoading&&this.loadInitialSites())},getMatchedSiteName:function(e){var t=e.toUpperCase().indexOf(this.searchTerm.toUpperCase());if(-1===t||this.isLoading)return S.helper.htmlEntities(e);var n=S.helper.htmlEntities(e.substring(0,t)),r=S.helper.htmlEntities(e.substring(t+this.searchTerm.length));return"".concat(n,'<span class="autocompleteMatched">').concat(this.searchTerm,"</span>").concat(r)},loadInitialSites:function(){var e=this;return zr.loadInitialSites().then((function(t){e.sites=t||[]}))},searchSite:function(e){var t=this;this.isLoading=!0,zr.searchSite(e,this.onlySitesWithAdminAccess).then((function(n){e===t.searchTerm&&n&&(t.sites=n)})).finally((function(){t.isLoading=!1}))},getUrlForSiteId:function(e){var t=Oe.stringify(Yr(Yr({},Oe.urlParsed.value),{},{segment:"",idSite:e})),n=Oe.stringify(Yr(Yr({},Oe.hashParsed.value),{},{segment:"",idSite:e}));return"?".concat(t,"#?").concat(n)}}});Xr.render=Br;var Zr=Xr;function ei(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ti(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ei(Object(n),!0).forEach((function(t){ni(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ei(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ni(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} + */var Yr=function(){function e(){var t=this;qr(this,e),zr(this,"state",Object(a["reactive"])({initialSites:[],isInitialized:!1})),zr(this,"currentRequest",void 0),zr(this,"limitRequest",void 0),zr(this,"initialSites",Object(a["computed"])((function(){return Object(a["readonly"])(t.state.initialSites)})))}return Gr(e,[{key:"loadInitialSites",value:function(){var e=this;return this.state.isInitialized?Promise.resolve(Object(a["readonly"])(this.state.initialSites)):this.searchSite("%").then((function(t){return e.state.isInitialized=!0,e.state.initialSites=t,Object(a["readonly"])(t)}))}},{key:"loadSite",value:function(e){"all"===e?we.updateUrl(Ur(Ur({},we.urlParsed.value),{},{module:"MultiSites",action:"index",date:we.parsed.value.date,period:we.parsed.value.period})):we.updateUrl(Ur(Ur({},we.parsed.value),{},{segment:"",idSite:e}))}},{key:"searchSite",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?(this.currentRequest&&this.currentRequest.abort(),this.limitRequest||(this.limitRequest=xe.fetch({method:"SitesManager.getNumWebsitesToDisplayPerPage"})),this.limitRequest.then((function(r){var i=r.value,a="SitesManager.getPatternMatchSites";return n&&(a="SitesManager.getSitesWithAdminAccess"),t.currentRequest=xe.fetch({method:a,limit:i,pattern:e}),t.currentRequest})).then((function(e){return e?t.processWebsitesList(e):null})).finally((function(){t.currentRequest=null}))):this.loadInitialSites()}},{key:"processWebsitesList",value:function(e){var t=e;return t&&t.length?(t=t.map((function(e){return Ur(Ur({},e),{},{name:e.group?"[".concat(e.group,"] ").concat(e.name):e.name})})),t.sort((function(e,t){return e.name.toLowerCase()<t.name.toLowerCase()?-1:e.name.toLowerCase()>t.name.toLowerCase()?1:0})),t):[]}}]),e}(),Qr=new Yr,Wr=300;function Kr(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wr;return function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];t&&clearTimeout(t),t=setTimeout((function(){e.apply(void 0,i)}),n)}}function Zr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zr(Object(n),!0).forEach((function(t){ei(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ei(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ti=Object(a["defineComponent"])({props:{modelValue:{Object:Object,default:{id:S.idSite,name:S.helper.htmlDecode(S.siteName)}},showSelectedSite:{type:Boolean,default:!1},showAllSitesItem:{type:Boolean,default:!0},switchSiteOnSelect:{type:Boolean,default:!0},onlySitesWithAdminAccess:{type:Boolean,default:!1},name:{type:String,default:""},allSitesText:{type:String,default:D("General_MultiSitesSummary")},allSitesLocation:{type:String,default:"bottom"},placeholder:String},emits:["update:modelValue","blur"],components:{AllSitesLink:Fr},directives:{FocusAnywhereButHere:Fe,FocusIf:qe},watch:{searchTerm:function(){this.onSearchTermChanged()}},data:function(){return{searchTerm:"",activeSiteId:S.idSite,showSitesList:!1,isLoading:!1,sites:[],selectedSite:this.modelValue||{id:S.idSite,name:S.helper.htmlDecode(S.siteName)},autocompleteMinSites:parseInt(S.config.autocomplete_min_sites,10)}},mounted:function(){var e=this;window.initTopControls(),this.loadInitialSites().then((function(){e.modelValue&&e.modelValue.id||!e.sites[0]||e.$emit("update:modelValue",{id:e.sites[0].idsite,name:e.sites[0].name})}));var t=D("CoreHome_ShortcutWebsiteSelector");S.helper.registerShortcut("w",t,(function(t){t.altKey||(t.preventDefault?t.preventDefault():t.returnValue=!1,e.$refs.selectorLink.click(),e.$refs.selectorLink.focus())}))},computed:{shouldFocusOnSearch:function(){return this.showSitesList&&this.autocompleteMinSites<=this.sites.length||this.searchTerm},selectorLinkTitle:function(){var e;return this.hasMultipleSites?D("CoreHome_ChangeCurrentWebsite",(null===(e=this.modelValue)||void 0===e?void 0:e.name)||this.firstSiteName):""},hasMultipleSites:function(){return Qr.initialSites.value&&Qr.initialSites.value.length>1},firstSiteName:function(){return this.sites&&this.sites.length>0?this.sites[0].name:""},urlAllSites:function(){var e=we.stringify(Xr(Xr({},we.urlParsed.value),{},{module:"MultiSites",action:"index",date:we.parsed.value.date,period:we.parsed.value.period}));return"?".concat(e)}},created:function(){this.searchSite=Kr(this.searchSite.bind(this))},methods:{onSearchTermChanged:function(){this.searchTerm?(this.isLoading=!0,this.searchSite(this.searchTerm)):(this.isLoading=!1,this.loadInitialSites())},onAllSitesClick:function(e){this.switchSite({idsite:"all",name:this.allSitesText},e),this.showSitesList=!1},switchSite:function(e,t){var n=-1!==navigator.userAgent.indexOf("Mac OS X")?t.metaKey:t.ctrlKey;t&&n&&t.target&&t.target.href?window.open(t.target.href,"_blank"):(this.$emit("update:modelValue",{id:e.idsite,name:e.name}),this.switchSiteOnSelect&&this.activeSiteId!==e.idsite&&Qr.loadSite(e.idsite))},onBlur:function(){this.showSitesList=!1,this.$emit("blur")},onClickSelector:function(){this.hasMultipleSites&&(this.showSitesList=!this.showSitesList,this.isLoading||this.searchTerm||this.loadInitialSites())},onPressEnter:function(e){"Enter"===e.key&&(e.preventDefault(),this.showSitesList=!this.showSitesList,this.showSitesList&&!this.isLoading&&this.loadInitialSites())},getMatchedSiteName:function(e){var t=e.toUpperCase().indexOf(this.searchTerm.toUpperCase());if(-1===t||this.isLoading)return S.helper.htmlEntities(e);var n=S.helper.htmlEntities(e.substring(0,t)),r=S.helper.htmlEntities(e.substring(t+this.searchTerm.length));return"".concat(n,'<span class="autocompleteMatched">').concat(this.searchTerm,"</span>").concat(r)},loadInitialSites:function(){var e=this;return Qr.loadInitialSites().then((function(t){e.sites=t||[]}))},searchSite:function(e){var t=this;this.isLoading=!0,Qr.searchSite(e,this.onlySitesWithAdminAccess).then((function(n){e===t.searchTerm&&n&&(t.sites=n)})).finally((function(){t.isLoading=!1}))},getUrlForSiteId:function(e){var t=we.stringify(Xr(Xr({},we.urlParsed.value),{},{segment:"",idSite:e})),n=we.stringify(Xr(Xr({},we.hashParsed.value),{},{segment:"",idSite:e}));return"?".concat(t,"#?").concat(n)}}});ti.render=$r;var ni=ti;function ri(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ii(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ri(Object(n),!0).forEach((function(t){ai(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ri(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ai(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */jt({component:Zr,require:"?ngModel",scope:{showSelectedSite:{angularJsBind:"="},showAllSitesItem:{angularJsBind:"="},switchSiteOnSelect:{angularJsBind:"="},onlySitesWithAdminAccess:{angularJsBind:"="},name:{angularJsBind:"@"},allSitesText:{angularJsBind:"@"},allSitesLocation:{angularJsBind:"@"},placeholder:{angularJsBind:"@"},modelValue:{}},$inject:["$timeout"],directiveName:"piwikSiteselector",events:{"update:modelValue":function(e,t,n,r,i,o,a){(e&&!t.modelValue||!e&&t.modelValue||e.id!==t.modelValue.id)&&a((function(){n.value=e,r.attr("siteid",e.id),r.trigger("change",e),o&&(n.isNotFirstModelChange||t.modelValue)&&(o.$setViewValue(e),o.$render()),n.isNotFirstModelChange=!0}))},blur:function(e,t,n){setTimeout((function(){return n.$apply()}))}},postCreate:function(e,t,n,r,i,a){var c=i;t.$watch("value",(function(t){t!==e.modelValue&&(e.modelValue=t)})),c&&(e.modelValue&&c.$setViewValue(e.modelValue),c.$render=function(){Object(o["nextTick"])((function(){angular.isString(c.$viewValue)?e.modelValue=JSON.parse(c.$viewValue):e.modelValue=c.$viewValue}))}),a((function(){r.siteid&&r.sitename&&(e.modelValue={id:r.siteid,name:S.helper.htmlDecode(r.sitename)},c.$setViewValue(ti({},e.modelValue)))}))}});var ri={ref:"root",class:"quickAccessInside"},ii=["title"],oi={class:"dropdown"},ai={class:"no-result"},ci=["onClick"],li=["onMouseenter","onClick"],si={class:"quickAccessMatomoSearch"},ui=["onMouseenter","onClick"],di=["textContent"],fi={class:"quick-access-category helpCategory"},mi=["href"];function pi(e,t,n,r,i,a){var c=Object(o["resolveDirective"])("focus-if"),l=Object(o["resolveDirective"])("focus-anywhere-but-here");return Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["createElementBlock"])("div",ri,[Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{class:"icon-search",onMouseenter:t[0]||(t[0]=function(t){return e.searchActive=!0})},null,544),[[o["vShow"],!(e.searchTerm||e.searchActive)]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("input",{class:"s",onKeydown:t[1]||(t[1]=function(t){return e.onKeypress(t)}),onFocus:t[2]||(t[2]=function(t){return e.searchActive=!0}),"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.searchTerm=t}),type:"text",tabindex:"2",title:e.quickAccessTitle},null,40,ii),[[o["vModelText"],e.searchTerm],[c,{},e.searchActive]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("div",oi,[Object(o["withDirectives"])(Object(o["createElementVNode"])("ul",null,[Object(o["createElementVNode"])("li",ai,Object(o["toDisplayString"])(e.translate("General_SearchNoResults")),1)],512),[[o["vShow"],!(e.numMenuItems>0||e.sites.length)]]),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.menuItems,(function(t){return Object(o["openBlock"])(),Object(o["createElementBlock"])("ul",{key:t.title},[Object(o["createElementVNode"])("li",{class:"quick-access-category",onClick:function(n){e.searchTerm=t.title,e.searchMenu(e.searchTerm)}},Object(o["toDisplayString"])(t.title),9,ci),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(t.items,(function(t){return Object(o["openBlock"])(),Object(o["createElementBlock"])("li",{class:Object(o["normalizeClass"])(["result",{selected:t.menuIndex===e.searchIndex}]),onMouseenter:function(n){return e.searchIndex=t.menuIndex},onClick:function(n){return e.selectMenuItem(t.index)},key:t.index},[Object(o["createElementVNode"])("a",null,Object(o["toDisplayString"])(t.name.trim()),1)],42,li)})),128))])})),128)),Object(o["createElementVNode"])("ul",si,[Object(o["withDirectives"])(Object(o["createElementVNode"])("li",{class:"quick-access-category websiteCategory"},Object(o["toDisplayString"])(e.translate("SitesManager_Sites")),513),[[o["vShow"],e.hasSitesSelector&&e.sites.length||e.isLoading]]),Object(o["withDirectives"])(Object(o["createElementVNode"])("li",{class:"no-result"},Object(o["toDisplayString"])(e.translate("MultiSites_LoadingWebsites")),513),[[o["vShow"],e.hasSitesSelector&&e.isLoading]]),(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.sites,(function(t,n){return Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["createElementBlock"])("li",{class:Object(o["normalizeClass"])(["result",{selected:e.numMenuItems+n===e.searchIndex}]),onMouseenter:function(t){return e.searchIndex=e.numMenuItems+n},onClick:function(n){return e.selectSite(t.idsite)},key:t.idsite},[Object(o["createElementVNode"])("a",{textContent:Object(o["toDisplayString"])(t.name)},null,8,di)],42,ui)),[[o["vShow"],e.hasSitesSelector&&!e.isLoading]])})),128))]),Object(o["createElementVNode"])("ul",null,[Object(o["createElementVNode"])("li",fi,Object(o["toDisplayString"])(e.translate("General_HelpResources")),1),Object(o["createElementVNode"])("li",{class:Object(o["normalizeClass"])([{selected:"help"===e.searchIndex},"quick-access-help"]),onMouseenter:t[4]||(t[4]=function(t){return e.searchIndex="help"})},[Object(o["createElementVNode"])("a",{href:"https://matomo.org?s=".concat(encodeURIComponent(e.searchTerm)),target:"_blank"},Object(o["toDisplayString"])(e.translate("CoreHome_SearchOnMatomo",e.searchTerm)),9,mi)],34)])],512),[[o["vShow"],e.searchTerm&&e.searchActive]])],512)),[[l,{blur:e.onBlur}]])}function hi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function vi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hi(Object(n),!0).forEach((function(t){gi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function gi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bi(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.$(window).height()&&t.right<=window.$(window).width()}function yi(e){e&&e.scrollIntoView&&e.scrollIntoView()}var wi=Object(o["defineComponent"])({props:{},directives:{FocusAnywhereButHere:_e,FocusIf:qe},watch:{searchActive:function(e){var t=this.$refs.root.parentElement.classList;t.toggle("active",e),t.toggle("expanded",e)}},mounted:function(){var e=this;this.$refs.root.parentElement.classList.add("quick-access","piwikSelector"),"undefined"!==typeof window.initTopControls&&window.initTopControls&&window.initTopControls(),S.helper.registerShortcut("f",C("CoreHome_ShortcutSearch"),(function(t){t.altKey||(t.preventDefault(),yi(e.$refs.root),e.activateSearch())}))},data:function(){var e=!!document.querySelector(".segmentEditorPanel");return{menuItems:[],numMenuItems:0,searchActive:!1,searchTerm:"",searchIndex:0,menuIndexCounter:-1,topMenuItems:null,leftMenuItems:null,segmentItems:null,hasSegmentSelector:e,sites:[],isLoading:!1}},created:function(){this.searchMenu=Qr(this.searchMenu.bind(this))},computed:{hasSitesSelector:function(){return!!document.querySelector(".top_controls [piwik-siteselector]")},quickAccessTitle:function(){var e="",t=[C("CoreHome_MenuEntries")];this.hasSegmentSelector&&t.push(C("CoreHome_Segments")),this.hasSitesSelector&&t.push(C("SitesManager_Sites"));while(t.length)e+=t.shift(),t.length>=2?e+=", ":1===t.length&&(e+=" ".concat(C("General_And")," "));return C("CoreHome_QuickAccessTitle",e)}},emits:["itemSelected","blur"],methods:{onKeypress:function(e){var t=this,n=this.searchTerm&&this.searchActive,r=9===e.which,i=27===e.which;38===e.which?(this.highlightPreviousItem(),e.preventDefault()):40===e.which?(this.highlightNextItem(),e.preventDefault()):13===e.which?this.clickQuickAccessMenuItem():r&&n||i&&n?this.deactivateSearch():setTimeout((function(){t.searchActive=!0,t.searchMenu(t.searchTerm)}))},highlightPreviousItem:function(){this.searchIndex-1<0?this.searchIndex=0:this.searchIndex-=1,this.makeSureSelectedItemIsInViewport()},highlightNextItem:function(){var e=this.$refs.root.querySelectorAll("li.result").length;e<=this.searchIndex+1?this.searchIndex=e-1:this.searchIndex+=1,this.makeSureSelectedItemIsInViewport()},clickQuickAccessMenuItem:function(){var e=this,t=this.getCurrentlySelectedElement();t&&setTimeout((function(){t.click(),e.$emit("itemSelected",t)}),20)},deactivateSearch:function(){this.searchTerm="",this.searchActive=!1,this.$refs.root.querySelector("input").blur()},makeSureSelectedItemIsInViewport:function(){var e=this.getCurrentlySelectedElement();e&&!bi(e)&&yi(e)},getCurrentlySelectedElement:function(){var e=this.$refs.root.querySelectorAll("li.result");return e&&e.length&&e.item(this.searchIndex)?e.item(this.searchIndex):null},searchMenu:function(e){var t=this,n=e.toLowerCase(),r=-1,i={},o=[],a=function(e){var t=vi({},e);r+=1,t.menuIndex=r;var n=t.category;n in i||(o.push({title:n,items:[]}),i[n]=o.length-1);var a=i[n];o[a].items.push(t)};this.resetSearchIndex(),this.hasSitesSelector&&(this.isLoading=!0,zr.searchSite(n).then((function(e){t.sites=e})).finally((function(){t.isLoading=!1})));var c=function(e){return-1!==e.name.toLowerCase().indexOf(n)||-1!==e.category.toLowerCase().indexOf(n)};null===this.topMenuItems&&(this.topMenuItems=this.getTopMenuItems()),null===this.leftMenuItems&&(this.leftMenuItems=this.getLeftMenuItems()),null===this.segmentItems&&(this.segmentItems=this.getSegmentItems());var l=this.topMenuItems.filter(c),s=this.leftMenuItems.filter(c),u=this.segmentItems.filter(c);l.forEach(a),s.forEach(a),u.forEach(a),this.numMenuItems=l.length+s.length+u.length,this.menuItems=o},resetSearchIndex:function(){this.searchIndex=0,this.makeSureSelectedItemIsInViewport()},selectSite:function(e){zr.loadSite(e)},selectMenuItem:function(e){var t=document.querySelector("[quick_access='".concat(e,"']"));if(t){this.deactivateSearch();var n=t.getAttribute("href");if(n&&n.length>10&&t&&t.click)try{t.click()}catch(r){window.$(t).click()}else window.$(t).click()}},onBlur:function(){this.searchActive=!1,this.$emit("blur")},activateSearch:function(){this.searchActive=!0},getTopMenuItems:function(){var e=this,t=C("CoreHome_Menu"),n=[];return document.querySelectorAll("nav .sidenav li > a").forEach((function(r){var i=r.textContent.trim();i||(i=r.getAttribute("title").trim()),i&&(n.push({name:i,index:e.menuIndexCounter+=1,category:t}),r.setAttribute("quick_access","".concat(e.menuIndexCounter)))})),n},getLeftMenuItems:function(){var e=this,t=[];return document.querySelectorAll("#secondNavBar .menuTab").forEach((function(n){var r=window.$(n).find("> .item").text().trim();r&&-1!==r.lastIndexOf("\n")&&(r=r.substr(0,r.lastIndexOf("\n")).trim()),window.$(n).find("li .item").each((function(n,i){var o=i.textContent.trim();o&&(t.push({name:o,category:r,index:e.menuIndexCounter+=1}),i.setAttribute("quick_access","".concat(e.menuIndexCounter)))}))})),t},getSegmentItems:function(){var e=this;if(!this.hasSegmentSelector)return[];var t=C("CoreHome_Segments"),n=[];return document.querySelectorAll(".segmentList [data-idsegment]").forEach((function(r){var i=r.querySelector(".segname").textContent.trim();i&&(n.push({name:i,category:t,index:e.menuIndexCounter+=1}),r.setAttribute("quick_access","".concat(e.menuIndexCounter)))})),n}}});wi.render=pi;var Oi=wi; + */St({component:ni,require:"?ngModel",scope:{showSelectedSite:{angularJsBind:"="},showAllSitesItem:{angularJsBind:"="},switchSiteOnSelect:{angularJsBind:"="},onlySitesWithAdminAccess:{angularJsBind:"="},name:{angularJsBind:"@"},allSitesText:{angularJsBind:"@"},allSitesLocation:{angularJsBind:"@"},placeholder:{angularJsBind:"@"},modelValue:{}},$inject:["$timeout"],directiveName:"piwikSiteselector",events:{"update:modelValue":function(e,t,n,r,i,a,o){(e&&!t.modelValue||!e&&t.modelValue||e.id!==t.modelValue.id)&&o((function(){n.value=e,r.attr("siteid",e.id),r.trigger("change",e),a&&(n.isNotFirstModelChange||t.modelValue)&&(a.$setViewValue(e),a.$render()),n.isNotFirstModelChange=!0}))},blur:function(e,t,n){setTimeout((function(){return n.$apply()}))}},postCreate:function(e,t,n,r,i,o){var l=i;t.$watch("value",(function(t){t!==e.modelValue&&(e.modelValue=t)})),l&&(e.modelValue&&l.$setViewValue(e.modelValue),l.$render=function(){Object(a["nextTick"])((function(){angular.isString(l.$viewValue)?e.modelValue=JSON.parse(l.$viewValue):e.modelValue=l.$viewValue}))}),o((function(){r.siteid&&r.sitename&&(e.modelValue={id:r.siteid,name:S.helper.htmlDecode(r.sitename)},l.$setViewValue(ii({},e.modelValue)))}))}});var oi={ref:"root",class:"quickAccessInside"},li=["title"],ci={class:"dropdown"},si={class:"no-result"},ui=["onClick"],di=["onMouseenter","onClick"],pi={class:"quickAccessMatomoSearch"},fi=["onMouseenter","onClick"],mi=["textContent"],hi={class:"quick-access-category helpCategory"},vi=["href"];function gi(e,t,n,r,i,o){var l=Object(a["resolveDirective"])("focus-if"),c=Object(a["resolveDirective"])("focus-anywhere-but-here");return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",oi,[Object(a["withDirectives"])(Object(a["createElementVNode"])("span",{class:"icon-search",onMouseenter:t[0]||(t[0]=function(t){return e.searchActive=!0})},null,544),[[a["vShow"],!(e.searchTerm||e.searchActive)]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("input",{class:"s",onKeydown:t[1]||(t[1]=function(t){return e.onKeypress(t)}),onFocus:t[2]||(t[2]=function(t){return e.searchActive=!0}),"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.searchTerm=t}),type:"text",tabindex:"2",title:e.quickAccessTitle},null,40,li),[[a["vModelText"],e.searchTerm],[l,{},e.searchActive]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("div",ci,[Object(a["withDirectives"])(Object(a["createElementVNode"])("ul",null,[Object(a["createElementVNode"])("li",si,Object(a["toDisplayString"])(e.translate("General_SearchNoResults")),1)],512),[[a["vShow"],!(e.numMenuItems>0||e.sites.length)]]),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.menuItems,(function(t){return Object(a["openBlock"])(),Object(a["createElementBlock"])("ul",{key:t.title},[Object(a["createElementVNode"])("li",{class:"quick-access-category",onClick:function(n){e.searchTerm=t.title,e.searchMenu(e.searchTerm)}},Object(a["toDisplayString"])(t.title),9,ui),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(t.items,(function(t){return Object(a["openBlock"])(),Object(a["createElementBlock"])("li",{class:Object(a["normalizeClass"])(["result",{selected:t.menuIndex===e.searchIndex}]),onMouseenter:function(n){return e.searchIndex=t.menuIndex},onClick:function(n){return e.selectMenuItem(t.index)},key:t.index},[Object(a["createElementVNode"])("a",null,Object(a["toDisplayString"])(t.name.trim()),1)],42,di)})),128))])})),128)),Object(a["createElementVNode"])("ul",pi,[Object(a["withDirectives"])(Object(a["createElementVNode"])("li",{class:"quick-access-category websiteCategory"},Object(a["toDisplayString"])(e.translate("SitesManager_Sites")),513),[[a["vShow"],e.hasSitesSelector&&e.sites.length||e.isLoading]]),Object(a["withDirectives"])(Object(a["createElementVNode"])("li",{class:"no-result"},Object(a["toDisplayString"])(e.translate("MultiSites_LoadingWebsites")),513),[[a["vShow"],e.hasSitesSelector&&e.isLoading]]),(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.sites,(function(t,n){return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("li",{class:Object(a["normalizeClass"])(["result",{selected:e.numMenuItems+n===e.searchIndex}]),onMouseenter:function(t){return e.searchIndex=e.numMenuItems+n},onClick:function(n){return e.selectSite(t.idsite)},key:t.idsite},[Object(a["createElementVNode"])("a",{textContent:Object(a["toDisplayString"])(t.name)},null,8,mi)],42,fi)),[[a["vShow"],e.hasSitesSelector&&!e.isLoading]])})),128))]),Object(a["createElementVNode"])("ul",null,[Object(a["createElementVNode"])("li",hi,Object(a["toDisplayString"])(e.translate("General_HelpResources")),1),Object(a["createElementVNode"])("li",{class:Object(a["normalizeClass"])([{selected:"help"===e.searchIndex},"quick-access-help"]),onMouseenter:t[4]||(t[4]=function(t){return e.searchIndex="help"})},[Object(a["createElementVNode"])("a",{href:"https://matomo.org?s=".concat(encodeURIComponent(e.searchTerm)),target:"_blank"},Object(a["toDisplayString"])(e.translate("CoreHome_SearchOnMatomo",e.searchTerm)),9,vi)],34)])],512),[[a["vShow"],e.searchTerm&&e.searchActive]])],512)),[[c,{blur:e.onBlur}]])}function bi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function yi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bi(Object(n),!0).forEach((function(t){Oi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Oi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wi(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.$(window).height()&&t.right<=window.$(window).width()}function ji(e){e&&e.scrollIntoView&&e.scrollIntoView()}var ki=Object(a["defineComponent"])({props:{},directives:{FocusAnywhereButHere:Fe,FocusIf:qe},watch:{searchActive:function(e){var t=this.$refs.root.parentElement.classList;t.toggle("active",e),t.toggle("expanded",e)}},mounted:function(){var e=this;this.$refs.root.parentElement.classList.add("quick-access","piwikSelector"),"undefined"!==typeof window.initTopControls&&window.initTopControls&&window.initTopControls(),S.helper.registerShortcut("f",D("CoreHome_ShortcutSearch"),(function(t){t.altKey||(t.preventDefault(),ji(e.$refs.root),e.activateSearch())}))},data:function(){var e=!!document.querySelector(".segmentEditorPanel");return{menuItems:[],numMenuItems:0,searchActive:!1,searchTerm:"",searchIndex:0,menuIndexCounter:-1,topMenuItems:null,leftMenuItems:null,segmentItems:null,hasSegmentSelector:e,sites:[],isLoading:!1}},created:function(){this.searchMenu=Kr(this.searchMenu.bind(this))},computed:{hasSitesSelector:function(){return!!document.querySelector(".top_controls [piwik-siteselector]")},quickAccessTitle:function(){var e="",t=[D("CoreHome_MenuEntries")];this.hasSegmentSelector&&t.push(D("CoreHome_Segments")),this.hasSitesSelector&&t.push(D("SitesManager_Sites"));while(t.length)e+=t.shift(),t.length>=2?e+=", ":1===t.length&&(e+=" ".concat(D("General_And")," "));return D("CoreHome_QuickAccessTitle",e)}},emits:["itemSelected","blur"],methods:{onKeypress:function(e){var t=this,n=this.searchTerm&&this.searchActive,r=9===e.which,i=27===e.which;38===e.which?(this.highlightPreviousItem(),e.preventDefault()):40===e.which?(this.highlightNextItem(),e.preventDefault()):13===e.which?this.clickQuickAccessMenuItem():r&&n||i&&n?this.deactivateSearch():setTimeout((function(){t.searchActive=!0,t.searchMenu(t.searchTerm)}))},highlightPreviousItem:function(){this.searchIndex-1<0?this.searchIndex=0:this.searchIndex-=1,this.makeSureSelectedItemIsInViewport()},highlightNextItem:function(){var e=this.$refs.root.querySelectorAll("li.result").length;e<=this.searchIndex+1?this.searchIndex=e-1:this.searchIndex+=1,this.makeSureSelectedItemIsInViewport()},clickQuickAccessMenuItem:function(){var e=this,t=this.getCurrentlySelectedElement();t&&setTimeout((function(){t.click(),e.$emit("itemSelected",t)}),20)},deactivateSearch:function(){this.searchTerm="",this.searchActive=!1,this.$refs.root.querySelector("input").blur()},makeSureSelectedItemIsInViewport:function(){var e=this.getCurrentlySelectedElement();e&&!wi(e)&&ji(e)},getCurrentlySelectedElement:function(){var e=this.$refs.root.querySelectorAll("li.result");return e&&e.length&&e.item(this.searchIndex)?e.item(this.searchIndex):null},searchMenu:function(e){var t=this,n=e.toLowerCase(),r=-1,i={},a=[],o=function(e){var t=yi({},e);r+=1,t.menuIndex=r;var n=t.category;n in i||(a.push({title:n,items:[]}),i[n]=a.length-1);var o=i[n];a[o].items.push(t)};this.resetSearchIndex(),this.hasSitesSelector&&(this.isLoading=!0,Qr.searchSite(n).then((function(e){t.sites=e})).finally((function(){t.isLoading=!1})));var l=function(e){return-1!==e.name.toLowerCase().indexOf(n)||-1!==e.category.toLowerCase().indexOf(n)};null===this.topMenuItems&&(this.topMenuItems=this.getTopMenuItems()),null===this.leftMenuItems&&(this.leftMenuItems=this.getLeftMenuItems()),null===this.segmentItems&&(this.segmentItems=this.getSegmentItems());var c=this.topMenuItems.filter(l),s=this.leftMenuItems.filter(l),u=this.segmentItems.filter(l);c.forEach(o),s.forEach(o),u.forEach(o),this.numMenuItems=c.length+s.length+u.length,this.menuItems=a},resetSearchIndex:function(){this.searchIndex=0,this.makeSureSelectedItemIsInViewport()},selectSite:function(e){Qr.loadSite(e)},selectMenuItem:function(e){var t=document.querySelector("[quick_access='".concat(e,"']"));if(t){this.deactivateSearch();var n=t.getAttribute("href");if(n&&n.length>10&&t&&t.click)try{t.click()}catch(r){window.$(t).click()}else window.$(t).click()}},onBlur:function(){this.searchActive=!1,this.$emit("blur")},activateSearch:function(){this.searchActive=!0},getTopMenuItems:function(){var e=this,t=D("CoreHome_Menu"),n=[];return document.querySelectorAll("nav .sidenav li > a").forEach((function(r){var i=r.textContent.trim();i||(i=r.getAttribute("title").trim()),i&&(n.push({name:i,index:e.menuIndexCounter+=1,category:t}),r.setAttribute("quick_access","".concat(e.menuIndexCounter)))})),n},getLeftMenuItems:function(){var e=this,t=[];return document.querySelectorAll("#secondNavBar .menuTab").forEach((function(n){var r=window.$(n).find("> .item").text().trim();r&&-1!==r.lastIndexOf("\n")&&(r=r.substr(0,r.lastIndexOf("\n")).trim()),window.$(n).find("li .item").each((function(n,i){var a=i.textContent.trim();a&&(t.push({name:a,category:r,index:e.menuIndexCounter+=1}),i.setAttribute("quick_access","".concat(e.menuIndexCounter)))}))})),t},getSegmentItems:function(){var e=this;if(!this.hasSegmentSelector)return[];var t=D("CoreHome_Segments"),n=[];return document.querySelectorAll(".segmentList [data-idsegment]").forEach((function(r){var i=r.querySelector(".segname").textContent.trim();i&&(n.push({name:i,category:t,index:e.menuIndexCounter+=1}),r.setAttribute("quick_access","".concat(e.menuIndexCounter)))})),n}}});ki.render=gi;var Si=ki; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */jt({component:Oi,directiveName:"piwikQuickAccess",events:{itemSelected:function(e,t,n,r,i,o,a){a()},blur:function(e,t,n){setTimeout((function(){return n.$apply()}))}}});function ji(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ki={class:"fieldArray form-group"},Si={key:0,class:"fieldUiControl"},Ci=["onClick","title"];function Di(e,t,n,r,i,a){var c=Object(o["resolveComponent"])("Field");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",ki,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.modelValue,(function(t,n){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:Object(o["normalizeClass"])(["fieldArrayTable multiple valign-wrapper",ji({},"fieldArrayTable".concat(n),!0)]),key:n},[e.field.uiControl?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Si,[Object(o["createVNode"])(c,{"full-width":!0,"model-value":t,options:e.field.availableValues,"onUpdate:modelValue":function(t){return e.onEntryChange(t,n)},placeholder:" ",uicontrol:e.field.uiControl,title:e.field.title,name:"".concat(e.name,"-").concat(n)},null,8,["model-value","options","onUpdate:modelValue","uicontrol","title","name"])])):Object(o["createCommentVNode"])("",!0),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{onClick:function(t){return e.removeEntry(n)},class:"icon-minus valign",title:e.translate("General_Remove")},null,8,Ci),[[o["vShow"],n+1!==e.modelValue.length]])],2)})),128))])}function Ei(e){return Vi(e)||Ii(e)||Ti(e)||Pi()}function Pi(){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 Ti(e,t){if(e){if("string"===typeof e)return xi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xi(e,t):void 0}}function Ii(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Vi(e){if(Array.isArray(e))return xi(e)}function xi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ni=Ht("CorePluginsAdmin","Field"),Bi=Object(o["defineComponent"])({props:{modelValue:Array,name:String,field:Object},components:{Field:Ni},emits:["update:modelValue"],watch:{modelValue:function(e){this.checkEmptyModelValue(e)}},mounted:function(){this.checkEmptyModelValue(this.modelValue)},methods:{checkEmptyModelValue:function(e){e&&e.length&&""===e.slice(-1)[0]||this.$emit("update:modelValue",[].concat(Ei(e||[]),[""]))},onEntryChange:function(e,t){var n=Ei(this.modelValue);n[t]=e,this.$emit("update:modelValue",n)},removeEntry:function(e){if(e>-1){var t=this.modelValue.filter((function(t,n){return n!==e}));this.$emit("update:modelValue",t)}}}});Bi.render=Di;var Ai=Bi; + */St({component:Si,directiveName:"piwikQuickAccess",events:{itemSelected:function(e,t,n,r,i,a,o){o()},blur:function(e,t,n){setTimeout((function(){return n.$apply()}))}}});function Di(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ci={class:"fieldArray form-group"},Pi={key:0,class:"fieldUiControl"},Ei=["onClick","title"];function Vi(e,t,n,r,i,o){var l=Object(a["resolveComponent"])("Field");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Ci,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.modelValue,(function(t,n){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:Object(a["normalizeClass"])(["fieldArrayTable multiple valign-wrapper",Di({},"fieldArrayTable".concat(n),!0)]),key:n},[e.field.uiControl?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Pi,[Object(a["createVNode"])(l,{"full-width":!0,"model-value":t,options:e.field.availableValues,"onUpdate:modelValue":function(t){return e.onEntryChange(t,n)},placeholder:" ",uicontrol:e.field.uiControl,title:e.field.title,name:"".concat(e.name,"-").concat(n)},null,8,["model-value","options","onUpdate:modelValue","uicontrol","title","name"])])):Object(a["createCommentVNode"])("",!0),Object(a["withDirectives"])(Object(a["createElementVNode"])("span",{onClick:function(t){return e.removeEntry(n)},class:"icon-minus valign",title:e.translate("General_Remove")},null,8,Ei),[[a["vShow"],n+1!==e.modelValue.length]])],2)})),128))])}function Ti(e){return Bi(e)||Ni(e)||xi(e)||Ii()}function Ii(){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 xi(e,t){if(e){if("string"===typeof e)return Ai(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ai(e,t):void 0}}function Ni(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Bi(e){if(Array.isArray(e))return Ai(e)}function Ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Mi=Ft("CorePluginsAdmin","Field"),$i=Object(a["defineComponent"])({props:{modelValue:Array,name:String,field:Object},components:{Field:Mi},emits:["update:modelValue"],watch:{modelValue:function(e){this.checkEmptyModelValue(e)}},mounted:function(){this.checkEmptyModelValue(this.modelValue)},methods:{checkEmptyModelValue:function(e){e&&e.length&&""===e.slice(-1)[0]||this.$emit("update:modelValue",[].concat(Ti(e||[]),[""]))},onEntryChange:function(e,t){var n=Ti(this.modelValue);n[t]=e,this.$emit("update:modelValue",n)},removeEntry:function(e){if(e>-1){var t=this.modelValue.filter((function(t,n){return n!==e}));this.$emit("update:modelValue",t)}}}});$i.render=Vi;var Li=$i; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */jt({component:Ai,require:"?ngModel",scope:{name:{angularJsBind:"="},field:{angularJsBind:"="}},directiveName:"matomoFieldArray",events:{"update:modelValue":function(e,t,n,r,i,o){e!==t.modelValue&&(r.trigger("change",e),o&&o.$setViewValue(e))}},postCreate:function(e,t,n,r,i){var o=i;o&&(o.$setViewValue(e.modelValue),o.$render=function(){angular.isString(o.$viewValue)?e.modelValue=JSON.parse(o.$viewValue):e.modelValue=o.$viewValue})}});function Mi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $i={class:"multiPairField form-group"},Li={key:1,class:"fieldUiControl fieldUiControl2"},Hi={key:2,class:"fieldUiControl fieldUiControl3"},Fi={key:3,class:"fieldUiControl fieldUiControl4"},_i=["onClick","title"];function Ui(e,t,n,r,i,a){var c=Object(o["resolveComponent"])("Field");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",$i,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.modelValue,(function(t,n){var r;return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:Object(o["normalizeClass"])(["multiPairFieldTable multiple valign-wrapper",(r={},Mi(r,"multiPairFieldTable".concat(n),!0),Mi(r,"has".concat(e.fieldCount,"Fields"),!0),r)]),key:n},[e.field1?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{key:0,class:Object(o["normalizeClass"])(["fieldUiControl fieldUiControl1",{hasMultiFields:e.field1.type&&e.field2.type}])},[Object(o["createVNode"])(c,{"full-width":!0,modelValue:t[e.field1.key],"onUpdate:modelValue":[function(n){return t[e.field1.key]=n},function(t){return e.onEntryChange(n,e.field1.key,t)}],options:e.field1.availableValues,placeholder:" ",uicontrol:e.field1.uiControl,name:"".concat(e.name,"-p1-").concat(n),title:e.field1.title},null,8,["modelValue","onUpdate:modelValue","options","uicontrol","name","title"])],2)):Object(o["createCommentVNode"])("",!0),e.field2?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Li,[Object(o["createVNode"])(c,{"full-width":!0,options:e.field2.availableValues,"onUpdate:modelValue":[function(t){return e.onEntryChange(n,e.field2.key,t)},function(n){return t[e.field2.key]=n}],modelValue:t[e.field2.key],placeholder:" ",uicontrol:e.field2.uiControl,name:"".concat(e.name,"-p2-").concat(n),title:e.field2.title},null,8,["options","onUpdate:modelValue","modelValue","uicontrol","name","title"])])):Object(o["createCommentVNode"])("",!0),e.field3?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Hi,[Object(o["createVNode"])(c,{"full-width":!0,options:e.field3.availableValues,"onUpdate:modelValue":[function(t){return e.onEntryChange(n,e.field3.key,t)},function(n){return t[e.field3.key]=n}],modelValue:t[e.field3.key],placeholder:" ",uicontrol:e.field3.uiControl,title:e.field3.title},null,8,["options","onUpdate:modelValue","modelValue","uicontrol","title"])])):Object(o["createCommentVNode"])("",!0),e.field4?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Fi,[Object(o["createVNode"])(c,{"full-width":!0,options:e.field4.availableValues,"onUpdate:modelValue":[function(t){return e.onEntryChange(n,e.field4.key,t)},function(n){return t[e.field4.key]=n}],modelValue:t[e.field4.key],placeholder:" ",uicontrol:e.field4.uiControl,title:e.field4.title},null,8,["options","onUpdate:modelValue","modelValue","uicontrol","title"])])):Object(o["createCommentVNode"])("",!0),Object(o["withDirectives"])(Object(o["createElementVNode"])("span",{onClick:function(t){return e.removeEntry(n)},class:"icon-minus valign",title:e.translate("General_Remove")},null,8,_i),[[o["vShow"],n+1!==e.modelValue.length]])],2)})),128))])}function Ri(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ri(Object(n),!0).forEach((function(t){Ji(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ri(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ji(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zi(e){return Yi(e)||Wi(e)||Qi(e)||Gi()}function Gi(){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 Qi(e,t){if(e){if("string"===typeof e)return Ki(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ki(e,t):void 0}}function Wi(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Yi(e){if(Array.isArray(e))return Ki(e)}function Ki(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Xi=Ht("CorePluginsAdmin","Field"),Zi=Object(o["defineComponent"])({props:{modelValue:Array,name:String,field1:Object,field2:Object,field3:Object,field4:Object},components:{Field:Xi},computed:{fieldCount:function(){return this.field1&&this.field2&&this.field3&&this.field4?4:this.field1&&this.field2&&this.field3?3:this.field1&&this.field2?2:this.field1?1:0}},emits:["update:modelValue"],watch:{modelValue:function(e){this.checkEmptyModelValue(e)}},mounted:function(){this.checkEmptyModelValue(this.modelValue)},methods:{checkEmptyModelValue:function(e){e&&e.length&&!this.isEmptyValue(e.slice(-1)[0])||this.$emit("update:modelValue",[].concat(zi(e||[]),[this.makeEmptyValue()]))},onEntryChange:function(e,t,n){var r=zi(this.modelValue);r[e]=qi(qi({},r[e]),{},Ji({},t,n)),this.$emit("update:modelValue",r)},removeEntry:function(e){if(e>-1){var t=this.modelValue.filter((function(t,n){return n!==e}));this.$emit("update:modelValue",t)}},isEmptyValue:function(e){var t=this.fieldCount;if(4===t){if(!e[this.field1.key]&&!e[this.field2.key]&&!e[this.field3.key]&&!e[this.field4.key])return!1}else if(3===t){if(!e[this.field1.key]&&!e[this.field2.key]&&!e[this.field3.key])return!1}else if(2===t){if(!e[this.field1.key]&&!e[this.field2.key])return!1}else if(1===t&&!e[this.field1.key])return!1;return!0},makeEmptyValue:function(){var e={};return this.field1&&this.field1.key&&(e[this.field1.key]=""),this.field2&&this.field2.key&&(e[this.field2.key]=""),this.field3&&this.field3.key&&(e[this.field3.key]=""),this.field4&&this.field4.key&&(e[this.field4.key]=""),e}}});Zi.render=Ui;var eo=Zi,to=(jt({component:eo,require:"?ngModel",scope:{name:{angularJsBind:"="},field1:{angularJsBind:"="},field2:{angularJsBind:"="},field3:{angularJsBind:"="},field4:{angularJsBind:"="}},directiveName:"matomoMultiPairField",events:{"update:modelValue":function(e,t,n,r,i,o){e!==t.modelValue&&(r.trigger("change",e),o&&o.$setViewValue(e))}},postCreate:function(e,t,n,r,i){var o=i;o&&(o.$setViewValue(e.modelValue),o.$render=function(){angular.isString(o.$viewValue)?e.modelValue=JSON.parse(o.$viewValue):e.modelValue=o.$viewValue})}}),{class:"loadingPiwik"}),no=Object(o["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif",alt:""},null,-1); + */St({component:Li,require:"?ngModel",scope:{name:{angularJsBind:"="},field:{angularJsBind:"="}},directiveName:"matomoFieldArray",events:{"update:modelValue":function(e,t,n,r,i,a){e!==t.modelValue&&(r.trigger("change",e),a&&a.$setViewValue(e))}},postCreate:function(e,t,n,r,i){var a=i;a&&(a.$setViewValue(e.modelValue),a.$render=function(){angular.isString(a.$viewValue)?e.modelValue=JSON.parse(a.$viewValue):e.modelValue=a.$viewValue})}});function Ri(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Hi={class:"multiPairField form-group"},Fi={key:1,class:"fieldUiControl fieldUiControl2"},_i={key:2,class:"fieldUiControl fieldUiControl3"},Ui={key:3,class:"fieldUiControl fieldUiControl4"},qi=["onClick","title"];function Ji(e,t,n,r,i,o){var l=Object(a["resolveComponent"])("Field");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Hi,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.modelValue,(function(t,n){var r;return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:Object(a["normalizeClass"])(["multiPairFieldTable multiple valign-wrapper",(r={},Ri(r,"multiPairFieldTable".concat(n),!0),Ri(r,"has".concat(e.fieldCount,"Fields"),!0),r)]),key:n},[e.field1?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{key:0,class:Object(a["normalizeClass"])(["fieldUiControl fieldUiControl1",{hasMultiFields:e.field1.type&&e.field2.type}])},[Object(a["createVNode"])(l,{"full-width":!0,modelValue:t[e.field1.key],"onUpdate:modelValue":[function(n){return t[e.field1.key]=n},function(t){return e.onEntryChange(n,e.field1.key,t)}],options:e.field1.availableValues,placeholder:" ",uicontrol:e.field1.uiControl,name:"".concat(e.name,"-p1-").concat(n),title:e.field1.title},null,8,["modelValue","onUpdate:modelValue","options","uicontrol","name","title"])],2)):Object(a["createCommentVNode"])("",!0),e.field2?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Fi,[Object(a["createVNode"])(l,{"full-width":!0,options:e.field2.availableValues,"onUpdate:modelValue":[function(t){return e.onEntryChange(n,e.field2.key,t)},function(n){return t[e.field2.key]=n}],modelValue:t[e.field2.key],placeholder:" ",uicontrol:e.field2.uiControl,name:"".concat(e.name,"-p2-").concat(n),title:e.field2.title},null,8,["options","onUpdate:modelValue","modelValue","uicontrol","name","title"])])):Object(a["createCommentVNode"])("",!0),e.field3?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",_i,[Object(a["createVNode"])(l,{"full-width":!0,options:e.field3.availableValues,"onUpdate:modelValue":[function(t){return e.onEntryChange(n,e.field3.key,t)},function(n){return t[e.field3.key]=n}],modelValue:t[e.field3.key],placeholder:" ",uicontrol:e.field3.uiControl,title:e.field3.title},null,8,["options","onUpdate:modelValue","modelValue","uicontrol","title"])])):Object(a["createCommentVNode"])("",!0),e.field4?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Ui,[Object(a["createVNode"])(l,{"full-width":!0,options:e.field4.availableValues,"onUpdate:modelValue":[function(t){return e.onEntryChange(n,e.field4.key,t)},function(n){return t[e.field4.key]=n}],modelValue:t[e.field4.key],placeholder:" ",uicontrol:e.field4.uiControl,title:e.field4.title},null,8,["options","onUpdate:modelValue","modelValue","uicontrol","title"])])):Object(a["createCommentVNode"])("",!0),Object(a["withDirectives"])(Object(a["createElementVNode"])("span",{onClick:function(t){return e.removeEntry(n)},class:"icon-minus valign",title:e.translate("General_Remove")},null,8,qi),[[a["vShow"],n+1!==e.modelValue.length]])],2)})),128))])}function Gi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function zi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gi(Object(n),!0).forEach((function(t){Yi(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Yi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qi(e){return Xi(e)||Zi(e)||Ki(e)||Wi()}function Wi(){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 Ki(e,t){if(e){if("string"===typeof e)return ea(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ea(e,t):void 0}}function Zi(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Xi(e){if(Array.isArray(e))return ea(e)}function ea(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ta=Ft("CorePluginsAdmin","Field"),na=Object(a["defineComponent"])({props:{modelValue:Array,name:String,field1:Object,field2:Object,field3:Object,field4:Object},components:{Field:ta},computed:{fieldCount:function(){return this.field1&&this.field2&&this.field3&&this.field4?4:this.field1&&this.field2&&this.field3?3:this.field1&&this.field2?2:this.field1?1:0}},emits:["update:modelValue"],watch:{modelValue:function(e){this.checkEmptyModelValue(e)}},mounted:function(){this.checkEmptyModelValue(this.modelValue)},methods:{checkEmptyModelValue:function(e){e&&e.length&&!this.isEmptyValue(e.slice(-1)[0])||this.$emit("update:modelValue",[].concat(Qi(e||[]),[this.makeEmptyValue()]))},onEntryChange:function(e,t,n){var r=Qi(this.modelValue);r[e]=zi(zi({},r[e]),{},Yi({},t,n)),this.$emit("update:modelValue",r)},removeEntry:function(e){if(e>-1){var t=this.modelValue.filter((function(t,n){return n!==e}));this.$emit("update:modelValue",t)}},isEmptyValue:function(e){var t=this.fieldCount;if(4===t){if(!e[this.field1.key]&&!e[this.field2.key]&&!e[this.field3.key]&&!e[this.field4.key])return!1}else if(3===t){if(!e[this.field1.key]&&!e[this.field2.key]&&!e[this.field3.key])return!1}else if(2===t){if(!e[this.field1.key]&&!e[this.field2.key])return!1}else if(1===t&&!e[this.field1.key])return!1;return!0},makeEmptyValue:function(){var e={};return this.field1&&this.field1.key&&(e[this.field1.key]=""),this.field2&&this.field2.key&&(e[this.field2.key]=""),this.field3&&this.field3.key&&(e[this.field3.key]=""),this.field4&&this.field4.key&&(e[this.field4.key]=""),e}}});na.render=Ji;var ra=na,ia=(St({component:ra,require:"?ngModel",scope:{name:{angularJsBind:"="},field1:{angularJsBind:"="},field2:{angularJsBind:"="},field3:{angularJsBind:"="},field4:{angularJsBind:"="}},directiveName:"matomoMultiPairField",events:{"update:modelValue":function(e,t,n,r,i,a){e!==t.modelValue&&(r.trigger("change",e),a&&a.$setViewValue(e))}},postCreate:function(e,t,n,r,i){var a=i;a&&(a.$setViewValue(e.modelValue),a.$render=function(){angular.isString(a.$viewValue)?e.modelValue=JSON.parse(a.$viewValue):e.modelValue=a.$viewValue})}}),{ref:"root",class:"periodSelector piwikSelector"}),aa=["title"],oa=Object(a["createElementVNode"])("span",{class:"icon icon-calendar"},null,-1),la={id:"periodMore",class:"dropdown"},ca={class:"flex"},sa={key:0,class:"period-date"},ua={class:"period-type"},da={id:"otherPeriods"},pa=["onDblclick","title"],fa=["id","checked","onChange","onDblclick"],ma={key:0,class:"compare-checkbox"},ha={id:"comparePeriodToDropdown"},va={key:1,class:"compare-date-range"},ga={id:"comparePeriodStartDate"},ba=Object(a["createElementVNode"])("span",{class:"compare-dates-separator"},null,-1),ya={id:"comparePeriodEndDate"},Oa={class:"apply-button-container"},wa=["disabled","value"],ja={key:2,id:"ajaxLoadingCalendar"},ka={class:"loadingSegment"}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function ro(e,t,n,r,i,a){return Object(o["withDirectives"])((Object(o["openBlock"])(),Object(o["createElementBlock"])("div",to,[no,Object(o["createElementVNode"])("span",null,Object(o["toDisplayString"])(e.loadingMessage),1)],512)),[[o["vShow"],e.loading]])}var io=Object(o["defineComponent"])({props:{loading:{type:Boolean,required:!0,default:!1},loadingMessage:{type:String,required:!1,default:C("General_LoadingData")}}});io.render=ro;var oo=io,ao=jt({component:oo,scope:{loading:{vue:"loading",angularJsBind:"<"},loadingMessage:{vue:"loadingMessage",angularJsBind:"<",default:function(){return C("General_LoadingData")}}},$inject:[],directiveName:"piwikActivityIndicator"}); + */function Sa(e,t,n,r,i,o){var l=Object(a["resolveComponent"])("DateRangePicker"),c=Object(a["resolveComponent"])("PeriodDatePicker"),s=Object(a["resolveComponent"])("Field"),u=Object(a["resolveComponent"])("ActivityIndicator"),d=Object(a["resolveDirective"])("expand-on-click");return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",ia,[Object(a["createElementVNode"])("a",{ref:"title",id:"date",class:"title",tabindex:"-1",title:e.translate("General_ChooseDate",e.currentlyViewingText)},[oa,Object(a["createTextVNode"])(" "+Object(a["toDisplayString"])(e.currentlyViewingText),1)],8,aa),Object(a["createElementVNode"])("div",la,[Object(a["createElementVNode"])("div",ca,[Object(a["createElementVNode"])("div",null,[Object(a["withDirectives"])(Object(a["createVNode"])(l,{class:"period-range","start-date":e.startRangeDate,"end-date":e.endRangeDate,onRangeChange:t[0]||(t[0]=function(t){return e.onRangeChange(t.start,t.end)}),onSubmit:t[1]||(t[1]=function(t){return e.onApplyClicked()})},null,8,["start-date","end-date"]),[[a["vShow"],"range"===e.selectedPeriod]]),"range"!==e.selectedPeriod?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",sa,[Object(a["createVNode"])(c,{id:"datepicker",period:e.selectedPeriod,date:e.periodValue===e.selectedPeriod?e.dateValue:null,onSelect:t[2]||(t[2]=function(t){return e.setPiwikPeriodAndDate(e.selectedPeriod,t.date)})},null,8,["period","date"])])):Object(a["createCommentVNode"])("",!0)]),Object(a["createElementVNode"])("div",ua,[Object(a["createElementVNode"])("h6",null,Object(a["toDisplayString"])(e.translate("General_Period")),1),Object(a["createElementVNode"])("div",da,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.periodsFiltered,(function(n){return Object(a["openBlock"])(),Object(a["createElementBlock"])("p",{key:n},[Object(a["createElementVNode"])("label",{class:Object(a["normalizeClass"])({"selected-period-label":n===e.selectedPeriod}),onDblclick:function(t){return e.changeViewedPeriod(n)},title:n===e.periodValue?"":e.translate("General_DoubleClickToChangePeriod")},[Object(a["withDirectives"])(Object(a["createElementVNode"])("input",{type:"radio",name:"period",id:"period_id_".concat(n),"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.selectedPeriod=t}),checked:e.selectedPeriod===n,onChange:function(t){return e.selectedPeriod=n},onDblclick:function(t){return e.changeViewedPeriod(n)}},null,40,fa),[[a["vModelRadio"],e.selectedPeriod]]),Object(a["createElementVNode"])("span",null,Object(a["toDisplayString"])(e.getPeriodDisplayText(n)),1)],42,pa)])})),128))])])]),e.isComparisonEnabled?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",ma,[Object(a["createElementVNode"])("label",null,[Object(a["withDirectives"])(Object(a["createElementVNode"])("input",{id:"comparePeriodTo",type:"checkbox","onUpdate:modelValue":t[4]||(t[4]=function(t){return e.isComparing=t})},null,512),[[a["vModelCheckbox"],e.isComparing]]),Object(a["createElementVNode"])("span",null,Object(a["toDisplayString"])(e.translate("General_CompareTo")),1)]),Object(a["createElementVNode"])("div",ha,[Object(a["createVNode"])(s,{modelValue:e.comparePeriodType,"onUpdate:modelValue":t[5]||(t[5]=function(t){return e.comparePeriodType=t}),style:Object(a["normalizeStyle"])({visibility:e.isComparing?"visible":"hidden"}),name:"comparePeriodToDropdown",uicontrol:"select",options:e.comparePeriodDropdownOptions,"full-width":!0,disabled:!e.isComparing},null,8,["modelValue","style","options","disabled"])])])):Object(a["createCommentVNode"])("",!0),e.isComparing&&"custom"===e.comparePeriodType?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",va,[Object(a["createElementVNode"])("div",null,[Object(a["createElementVNode"])("div",ga,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(s,{modelValue:e.compareStartDate,"onUpdate:modelValue":t[6]||(t[6]=function(t){return e.compareStartDate=t}),name:"comparePeriodStartDate",uicontrol:"text","full-width":!0,title:e.translate("CoreHome_StartDate"),placeholder:"YYYY-MM-DD"},null,8,["modelValue","title"])])]),ba,Object(a["createElementVNode"])("div",ya,[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(s,{modelValue:e.compareEndDate,"onUpdate:modelValue":t[7]||(t[7]=function(t){return e.compareEndDate=t}),name:"comparePeriodEndDate",uicontrol:"text","full-width":!0,title:e.translate("CoreHome_EndDate"),placeholder:"YYYY-MM-DD"},null,8,["modelValue","title"])])])])])):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("div",Oa,[Object(a["createElementVNode"])("input",{type:"submit",id:"calendarApply",class:"btn",onClick:t[8]||(t[8]=function(t){return e.onApplyClicked()}),disabled:!e.isApplyEnabled(),value:e.translate("General_Apply")},null,8,wa)]),e.isLoadingNewPage?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",ja,[Object(a["createVNode"])(u,{loading:!0}),Object(a["createElementVNode"])("div",ka,Object(a["toDisplayString"])(e.translate("SegmentEditor_LoadingSegmentedDataMayTakeSomeTime")),1)])):Object(a["createCommentVNode"])("",!0)])],512)),[[d,{expander:"title"}]])}var Da={class:"loadingPiwik"},Ca=Object(a["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif",alt:""},null,-1);function Pa(e,t,n,r,i,o){return Object(a["withDirectives"])((Object(a["openBlock"])(),Object(a["createElementBlock"])("div",Da,[Ca,Object(a["createElementVNode"])("span",null,Object(a["toDisplayString"])(e.loadingMessage),1)],512)),[[a["vShow"],e.loading]])}var Ea=Object(a["defineComponent"])({props:{loading:{type:Boolean,required:!0,default:!1},loadingMessage:{type:String,required:!1,default:D("General_LoadingData")}}});Ea.render=Pa;var Va=Ea;function Ta(e,t){return Aa(e)||Ba(e,t)||xa(e,t)||Ia()}function Ia(){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 xa(e,t){if(e){if("string"===typeof e)return Na(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Na(e,t):void 0}}function Na(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ba(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done);o=!0)if(a.push(r.value),t&&a.length===t)break}catch(c){l=!0,i=c}finally{try{o||null==n["return"]||n["return"]()}finally{if(l)throw i}}return a}}function Aa(e){if(Array.isArray(e))return e}function Ma(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ma(Object(n),!0).forEach((function(t){La(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ma(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function La(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ra=Ft("CorePluginsAdmin","Field"),Ha=S.helper.htmlDecode(" "),Fa=[{key:"custom",value:D("General_Custom")},{key:"previousPeriod",value:D("General_PreviousPeriod").replace(/\s+/,Ha)},{key:"previousYear",value:D("General_PreviousYear").replace(/\s+/,Ha)}],_a=new Date(S.minDateYear,S.minDateMonth-1,S.minDateDay),Ua=new Date(S.maxDateYear,S.maxDateMonth-1,S.maxDateDay);function qa(e){return"[object Date]"===Object.prototype.toString.call(e)&&!Number.isNaN(e.getTime())}var Ja=Object(a["defineComponent"])({props:{periods:Array},components:{DateRangePicker:vr,PeriodDatePicker:wr,Field:Ra,ActivityIndicator:Va},directives:{ExpandOnClick:et},data:function(){return{comparePeriodDropdownOptions:Fa,periodValue:null,dateValue:null,selectedPeriod:null,startRangeDate:null,endRangeDate:null,isRangeValid:null,isLoadingNewPage:!1,isComparing:null,comparePeriodType:"previousPeriod",compareStartDate:"",compareEndDate:""}},mounted:function(){var e=this;S.on("hidePeriodSelector",(function(){window.$(e.$refs.root).hide()})),S.on("piwikPageChange",(function(){window.$(e.$refs.root).show()})),this.updateSelectedValuesFromHash(),Object(a["watch"])((function(){return we.parsed.value}),this.updateSelectedValuesFromHash),this.isComparing=kn.isComparing(),Object(a["watch"])((function(){return kn.isComparing()}),(function(t){e.isComparing=t})),window.initTopControls(),this.handleZIndexPositionRelativeCompareDropdownIssue()},computed:{currentlyViewingText:function(){var e;if("range"===this.periodValue){if(!this.startRangeDate||!this.endRangeDate)return D("General_Error");e="".concat(this.startRangeDate,",").concat(this.endRangeDate)}else{if(!this.dateValue)return D("General_Error");e=C(this.dateValue)}try{return p.parse(this.periodValue,e).getPrettyString()}catch(t){return D("General_Error")}},isComparisonEnabled:function(){return kn.isComparisonEnabled()},periodsFiltered:function(){return(this.periods||[]).filter((function(e){return p.isRecognizedPeriod(e)}))},selectedComparisonParams:function(){if(!this.isComparing)return{};if("custom"===this.comparePeriodType)return{comparePeriods:["range"],compareDates:["".concat(this.compareStartDate,",").concat(this.compareEndDate)]};if("previousPeriod"===this.comparePeriodType)return{comparePeriods:[this.selectedPeriod],compareDates:[this.previousPeriodDateToSelectedPeriod]};if("previousYear"===this.comparePeriodType){var e="range"===this.selectedPeriod?"".concat(this.startRangeDate,",").concat(this.endRangeDate):this.dateValue,t=p.parse(this.selectedPeriod,e).getDateRange();return t[0].setFullYear(t[0].getFullYear()-1),t[1].setFullYear(t[1].getFullYear()-1),"range"===this.selectedPeriod?{comparePeriods:["range"],compareDates:["".concat(C(t[0]),",").concat(C(t[1]))]}:{comparePeriods:[this.selectedPeriod],compareDates:[C(t[0])]}}return console.warn("Unknown compare period type: ".concat(this.comparePeriodType)),{}},previousPeriodDateToSelectedPeriod:function(){if("range"===this.selectedPeriod){var e=E(this.startRangeDate),t=E(this.endRangeDate),n=F.getLastNRange("day",2,e).startDate,r=Math.floor((t-e)/864e5),i=F.getLastNRange("day",1+r,n);return"".concat(C(i.startDate),",").concat(C(i.endDate))}var a=F.getLastNRange(this.selectedPeriod,2,this.dateValue).startDate;return C(a)},selectedDateString:function(){if("range"===this.selectedPeriod){var e=this.startRangeDate,t=this.endRangeDate,n=E(e),r=E(t);return!qa(n)||!qa(r)||n>r?(window.$("#alert").find("h2").text(D("General_InvalidDateRange")),S.helper.modalConfirm("#alert",{}),null):"".concat(e,",").concat(t)}return C(this.dateValue)}},methods:{handleZIndexPositionRelativeCompareDropdownIssue:function(){var e=window.$(this.$refs.root);e.on("focus","#comparePeriodToDropdown .select-dropdown",(function(){e.addClass("compare-dropdown-open")})).on("blur","#comparePeriodToDropdown .select-dropdown",(function(){e.removeClass("compare-dropdown-open")}))},changeViewedPeriod:function(){this.period!==this.periodValue&&"range"!==this.period&&this.setPiwikPeriodAndDate(this.period,this.dateValue)},setPiwikPeriodAndDate:function(e,t){this.periodValue=e,this.selectedPeriod=e,this.dateValue=t;var n=C(t);this.setRangeStartEndFromPeriod(e,n),this.propagateNewUrlParams(n,this.selectedPeriod),window.initTopControls()},propagateNewUrlParams:function(e,t){var n=this.selectedComparisonParams;S.helper.isAngularRenderingThePage()?this.closePeriodSelector():this.isLoadingNewPage=!0;var r=$a({},we.parsed.value);delete r.comparePeriods,delete r.compareSegments,delete r.compareDates,we.updateLocation($a($a({},r),{},{date:e,period:t},n))},onApplyClicked:function(){if("range"===this.selectedPeriod){var e=this.selectedDateString;if(!e)return;return this.periodValue="range",void this.propagateNewUrlParams(e,"range")}this.setPiwikPeriodAndDate(this.selectedPeriod,this.dateValue)},updateSelectedValuesFromHash:function(){var e=we.parsed.value,t=e.date,n=e.period;this.periodValue=n,this.selectedPeriod=n,this.dateValue=null,this.startRangeDate=null,this.endRangeDate=null;try{p.parse(n,t)}catch(c){return}if("range"===n){var r=p.get(n).parse(t),i=r.getDateRange(),a=Ta(i,2),o=a[0],l=a[1];this.dateValue=o,this.startRangeDate=C(o),this.endRangeDate=C(l)}else this.dateValue=E(t),this.setRangeStartEndFromPeriod(n,t)},setRangeStartEndFromPeriod:function(e,t){var n=p.parse(e,t).getDateRange();this.startRangeDate=C(n[0]<_a?_a:n[0]),this.endRangeDate=C(n[1]>Ua?Ua:n[1])},getPeriodDisplayText:function(e){return p.get(e).getDisplayText()},onRangeChange:function(e,t){e&&t?(this.isRangeValid=!0,this.startRangeDate=e,this.endRangeDate=t):this.isRangeValid=!1},isApplyEnabled:function(){return!("range"===this.selectedPeriod&&!this.isRangeValid)&&!(this.isComparing&&"custom"===this.comparePeriodType&&!this.isCompareRangeValid())},closePeriodSelector:function(){this.$refs.root.classList.remove("expanded")},isCompareRangeValid:function(){try{E(this.compareStartDate)}catch(e){return!1}try{E(this.compareEndDate)}catch(e){return!1}return!0}}});Ja.render=Sa;var Ga=Ja,za=(St({component:Ga,scope:{periods:{angularJsBind:"<"}},directiveName:"piwikPeriodSelector"}),St({component:Va,scope:{loading:{vue:"loading",angularJsBind:"<"},loadingMessage:{vue:"loadingMessage",angularJsBind:"<",default:function(){return D("General_LoadingData")}}},$inject:[],directiveName:"piwikActivityIndicator"})); /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function co(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lo(e,t,n,r,i,a){return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{class:Object(o["normalizeClass"])(["alert",co({},"alert-".concat(e.severity),!0)])},[Object(o["renderSlot"])(e.$slots,"default")],2)}var so=Object(o["defineComponent"])({props:{severity:{type:String,required:!0}}});so.render=lo;var uo=so,fo=jt({component:uo,scope:{severity:{vue:"severity",angularJsBind:"@piwikAlert"}},directiveName:"piwikAlert",transclude:!0}); + */function Ya(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qa(e,t,n,r,i,o){return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{class:Object(a["normalizeClass"])(["alert",Ya({},"alert-".concat(e.severity),!0)])},[Object(a["renderSlot"])(e.$slots,"default")],2)}var Wa=Object(a["defineComponent"])({props:{severity:{type:String,required:!0}}});Wa.render=Qa;var Ka=Wa,Za=St({component:Ka,scope:{severity:{vue:"severity",angularJsBind:"@piwikAlert"}},directiveName:"piwikAlert",transclude:!0}); /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function mo(e,t,n){var r=new Date;n||(n=432e4),r.setTime(r.getTime()+n),document.cookie="".concat(e,"=").concat(t,"; expires=").concat(r.toUTCString(),"; path=/")}function po(e){var t="; ".concat(document.cookie),n=t.split("; ".concat(e,"="));if(2==n.length){var r=n.pop().split(";").shift();if("undefined"!==typeof r)return r}return null}function ho(e){var t=new Date;t.setTime(t.getTime()+-864e5),document.cookie="".concat(e,"=; expires=").concat(t.toUTCString(),"; path=/")}var vo={key:0},go=["data-notification-instance-id"],bo={key:1},yo={class:"notification-body"},wo=["innerHTML"],Oo={key:1};function jo(e,t,n,r,i,a){return Object(o["openBlock"])(),Object(o["createBlock"])(o["Transition"],{name:"toast"===e.type?"slow-fade-out":void 0,onAfterLeave:t[1]||(t[1]=function(t){return e.toastClosed()})},{default:Object(o["withCtx"])((function(){return[e.deleted?Object(o["createCommentVNode"])("",!0):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",vo,[Object(o["createVNode"])(o["Transition"],{name:"toast"===e.type?"toast-slide-up":void 0,appear:""},{default:Object(o["withCtx"])((function(){return[Object(o["createElementVNode"])("div",null,[Object(o["createVNode"])(o["Transition"],{name:e.animate?"fade-in":void 0,appear:""},{default:Object(o["withCtx"])((function(){return[Object(o["createElementVNode"])("div",{class:Object(o["normalizeClass"])(["notification system",e.cssClasses]),style:Object(o["normalizeStyle"])(e.style),ref:"root","data-notification-instance-id":e.notificationInstanceId},[e.canClose?(Object(o["openBlock"])(),Object(o["createElementBlock"])("button",{key:0,type:"button",class:"close","data-dismiss":"alert",onClick:t[0]||(t[0]=function(t){return e.closeNotification(t)})}," × ")):Object(o["createCommentVNode"])("",!0),e.title?(Object(o["openBlock"])(),Object(o["createElementBlock"])("strong",bo,Object(o["toDisplayString"])(e.title),1)):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("div",yo,[e.message?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",{key:0,innerHTML:e.$sanitize(e.message)},null,8,wo)):Object(o["createCommentVNode"])("",!0),e.message?Object(o["createCommentVNode"])("",!0):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Oo,[Object(o["renderSlot"])(e.$slots,"default")]))])],14,go)]})),_:3},8,["name"])])]})),_:3},8,["name"])]))]})),_:3},8,["name"])}var ko=window,So=ko.$,Co=Object(o["defineComponent"])({props:{notificationId:String,notificationInstanceId:String,title:String,context:String,type:String,noclear:Boolean,toastLength:{type:Number,default:12e3},style:[String,Object],animate:Boolean,message:String,cssClass:String},computed:{cssClasses:function(){var e={};return this.context&&(e["notification-".concat(this.context)]=!0),this.cssClass&&(e[this.cssClass]=!0),e},canClose:function(){return"persistent"===this.type||!this.noclear}},emits:["closed"],data:function(){return{deleted:!1}},mounted:function(){var e=this,t=function(){setTimeout((function(){e.deleted=!0}),e.toastLength)};"toast"===this.type&&t(),this.style&&So(this.$refs.root).css(this.style)},methods:{toastClosed:function(){var e=this;Object(o["nextTick"])((function(){e.$emit("closed")}))},closeNotification:function(e){var t=this;this.canClose&&e&&e.target&&(this.deleted=!0,Object(o["nextTick"])((function(){t.$emit("closed")}))),this.markNotificationAsRead()},markNotificationAsRead:function(){this.notificationId&&xe.fetch({module:"CoreHome",action:"markNotificationAsRead"},{postParams:{notificationId:this.notificationId}})}}});Co.render=jo;var Do=Co; + */function Xa(e,t,n){var r=new Date;n||(n=432e4),r.setTime(r.getTime()+n),document.cookie="".concat(e,"=").concat(t,"; expires=").concat(r.toUTCString(),"; path=/")}function eo(e){var t="; ".concat(document.cookie),n=t.split("; ".concat(e,"="));if(2==n.length){var r=n.pop().split(";").shift();if("undefined"!==typeof r)return r}return null}function to(e){var t=new Date;t.setTime(t.getTime()+-864e5),document.cookie="".concat(e,"=; expires=").concat(t.toUTCString(),"; path=/")}var no={key:0},ro=["data-notification-instance-id"],io={key:1},ao={class:"notification-body"},oo=["innerHTML"],lo={key:1};function co(e,t,n,r,i,o){return Object(a["openBlock"])(),Object(a["createBlock"])(a["Transition"],{name:"toast"===e.type?"slow-fade-out":void 0,onAfterLeave:t[1]||(t[1]=function(t){return e.toastClosed()})},{default:Object(a["withCtx"])((function(){return[e.deleted?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",no,[Object(a["createVNode"])(a["Transition"],{name:"toast"===e.type?"toast-slide-up":void 0,appear:""},{default:Object(a["withCtx"])((function(){return[Object(a["createElementVNode"])("div",null,[Object(a["createVNode"])(a["Transition"],{name:e.animate?"fade-in":void 0,appear:""},{default:Object(a["withCtx"])((function(){return[Object(a["createElementVNode"])("div",{class:Object(a["normalizeClass"])(["notification system",e.cssClasses]),style:Object(a["normalizeStyle"])(e.style),ref:"root","data-notification-instance-id":e.notificationInstanceId},[e.canClose?(Object(a["openBlock"])(),Object(a["createElementBlock"])("button",{key:0,type:"button",class:"close","data-dismiss":"alert",onClick:t[0]||(t[0]=function(t){return e.closeNotification(t)})}," × ")):Object(a["createCommentVNode"])("",!0),e.title?(Object(a["openBlock"])(),Object(a["createElementBlock"])("strong",io,Object(a["toDisplayString"])(e.title),1)):Object(a["createCommentVNode"])("",!0),Object(a["createElementVNode"])("div",ao,[e.message?(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",{key:0,innerHTML:e.$sanitize(e.message)},null,8,oo)):Object(a["createCommentVNode"])("",!0),e.message?Object(a["createCommentVNode"])("",!0):(Object(a["openBlock"])(),Object(a["createElementBlock"])("div",lo,[Object(a["renderSlot"])(e.$slots,"default")]))])],14,ro)]})),_:3},8,["name"])])]})),_:3},8,["name"])]))]})),_:3},8,["name"])}var so=window,uo=so.$,po=Object(a["defineComponent"])({props:{notificationId:String,notificationInstanceId:String,title:String,context:String,type:String,noclear:Boolean,toastLength:{type:Number,default:12e3},style:[String,Object],animate:Boolean,message:String,cssClass:String},computed:{cssClasses:function(){var e={};return this.context&&(e["notification-".concat(this.context)]=!0),this.cssClass&&(e[this.cssClass]=!0),e},canClose:function(){return"persistent"===this.type||!this.noclear}},emits:["closed"],data:function(){return{deleted:!1}},mounted:function(){var e=this,t=function(){setTimeout((function(){e.deleted=!0}),e.toastLength)};"toast"===this.type&&t(),this.style&&uo(this.$refs.root).css(this.style)},methods:{toastClosed:function(){var e=this;Object(a["nextTick"])((function(){e.$emit("closed")}))},closeNotification:function(e){var t=this;this.canClose&&e&&e.target&&(this.deleted=!0,Object(a["nextTick"])((function(){t.$emit("closed")}))),this.markNotificationAsRead()},markNotificationAsRead:function(){this.notificationId&&xe.fetch({module:"CoreHome",action:"markNotificationAsRead"},{postParams:{notificationId:this.notificationId}})}}});po.render=co;var fo=po; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */jt({component:Do,scope:{notificationId:{angularJsBind:"@?"},title:{angularJsBind:"@?notificationTitle"},context:{angularJsBind:"@?"},type:{angularJsBind:"@?"},noclear:{angularJsBind:"@?",transform:kt},toastLength:{angularJsBind:"@?"}},directiveName:"piwikNotification",transclude:!0});function Eo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Po(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Eo(Object(n),!0).forEach((function(t){xo(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function To(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Io(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Vo(e,t,n){return t&&Io(e.prototype,t),n&&Io(e,n),e}function xo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} + */St({component:fo,scope:{notificationId:{angularJsBind:"@?"},title:{angularJsBind:"@?notificationTitle"},context:{angularJsBind:"@?"},type:{angularJsBind:"@?"},noclear:{angularJsBind:"@?",transform:Dt},toastLength:{angularJsBind:"@?"}},directiveName:"piwikNotification",transclude:!0});function mo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ho(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mo(Object(n),!0).forEach((function(t){yo(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function go(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function bo(e,t,n){return t&&go(e.prototype,t),n&&go(e,n),e}function yo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */var No=function(){function e(){To(this,e),xo(this,"privateState",Object(o["reactive"])({notifications:[]})),xo(this,"nextNotificationId",0)}return Vo(e,[{key:"state",get:function(){return this.privateState}},{key:"appendNotification",value:function(e){this.checkMessage(e.message),e.id&&this.remove(e.id),this.privateState.notifications.push(e)}},{key:"prependNotification",value:function(e){this.checkMessage(e.message),e.id&&this.remove(e.id),this.privateState.notifications.unshift(e)}},{key:"remove",value:function(e){this.privateState.notifications=this.privateState.notifications.filter((function(t){return t.id!==e}))}},{key:"parseNotificationDivs",value:function(){var e=this,t=$('[data-role="notification"]'),n=[];t.each((function(e,r){var i=$(r),o=i.data(),a=i.html();a&&n.push(Po(Po({},o),{},{message:a,animate:!1})),t.remove()})),n.forEach((function(t){return e.show(t)}))}},{key:"clearTransientNotifications",value:function(){this.privateState.notifications=this.privateState.notifications.filter((function(e){return"transient"!==e.type}))}},{key:"show",value:function(e){this.checkMessage(e.message);var t=this.appendNotification,n="#notificationContainer";if(e.placeat)n=e.placeat;else{var r=".modal.open .modal-content",i=document.querySelector(r);i&&(i.querySelector("#modalNotificationContainer")||window.$(i).prepend('<div id="modalNotificationContainer"/>'),n="".concat(r," #modalNotificationContainer"),t=this.prependNotification)}var o=e.group||(n?n.toString():"");this.initializeNotificationContainer(n,o);var a=(this.nextNotificationId+=1).toString();return t.call(this,Po(Po({},e),{},{noclear:!!e.noclear,group:o,notificationId:e.id,notificationInstanceId:a,type:e.type||"transient"})),a}},{key:"scrollToNotification",value:function(e){setTimeout((function(){var t=document.querySelector("[data-notification-instance-id='".concat(e,"']"));t&&S.helper.lazyScrollTo(t,250)}))}},{key:"toast",value:function(e){this.checkMessage(e.message);var t=$(e.placeat);if(!t.length)throw new Error("A valid selector is required for the placeat option when using Notification.toast().");var n=document.createElement("div");n.style.position="absolute",n.style.top="".concat(t.offset().top,"px"),n.style.left="".concat(t.offset().left,"px"),n.style.zIndex="1000",document.body.appendChild(n);var r=Object(o["createApp"])({render:function(){return Object(o["createVNode"])(Do,Po(Po({},e),{},{notificationId:e.id,type:"toast",onClosed:function(){r.unmount()}}))}});r.config.globalProperties.$sanitize=window.vueSanitize,r.config.globalProperties.translate=C,r.mount(n)}},{key:"initializeNotificationContainer",value:function(e,t){var n=window.$(e);if(!n.children(".notification-group").length){var r=window.CoreHome.NotificationGroup,i=Object(o["createApp"])({template:'<NotificationGroup :group="group"></NotificationGroup>',data:function(){return{group:t}}});i.config.globalProperties.$sanitize=window.vueSanitize,i.config.globalProperties.translate=C,i.component("NotificationGroup",r),i.mount(n[0])}}},{key:"checkMessage",value:function(e){if(!e)throw new Error("No message given, cannot display notification")}}]),e}(),Bo=new No,Ao=Bo;$((function(){return Bo.parseNotificationDivs()})), + */var Oo=function(){function e(){vo(this,e),yo(this,"privateState",Object(a["reactive"])({notifications:[]})),yo(this,"nextNotificationId",0)}return bo(e,[{key:"state",get:function(){return this.privateState}},{key:"appendNotification",value:function(e){this.checkMessage(e.message),e.id&&this.remove(e.id),this.privateState.notifications.push(e)}},{key:"prependNotification",value:function(e){this.checkMessage(e.message),e.id&&this.remove(e.id),this.privateState.notifications.unshift(e)}},{key:"remove",value:function(e){this.privateState.notifications=this.privateState.notifications.filter((function(t){return t.id!==e}))}},{key:"parseNotificationDivs",value:function(){var e=this,t=$('[data-role="notification"]'),n=[];t.each((function(e,r){var i=$(r),a=i.data(),o=i.html();o&&n.push(ho(ho({},a),{},{message:o,animate:!1})),t.remove()})),n.forEach((function(t){return e.show(t)}))}},{key:"clearTransientNotifications",value:function(){this.privateState.notifications=this.privateState.notifications.filter((function(e){return"transient"!==e.type}))}},{key:"show",value:function(e){this.checkMessage(e.message);var t=this.appendNotification,n="#notificationContainer";if(e.placeat)n=e.placeat;else{var r=".modal.open .modal-content",i=document.querySelector(r);i&&(i.querySelector("#modalNotificationContainer")||window.$(i).prepend('<div id="modalNotificationContainer"/>'),n="".concat(r," #modalNotificationContainer"),t=this.prependNotification)}var a=e.group||(n?n.toString():"");this.initializeNotificationContainer(n,a);var o=(this.nextNotificationId+=1).toString();return t.call(this,ho(ho({},e),{},{noclear:!!e.noclear,group:a,notificationId:e.id,notificationInstanceId:o,type:e.type||"transient"})),o}},{key:"scrollToNotification",value:function(e){setTimeout((function(){var t=document.querySelector("[data-notification-instance-id='".concat(e,"']"));t&&S.helper.lazyScrollTo(t,250)}))}},{key:"toast",value:function(e){this.checkMessage(e.message);var t=$(e.placeat);if(!t.length)throw new Error("A valid selector is required for the placeat option when using Notification.toast().");var n=document.createElement("div");n.style.position="absolute",n.style.top="".concat(t.offset().top,"px"),n.style.left="".concat(t.offset().left,"px"),n.style.zIndex="1000",document.body.appendChild(n);var r=Object(a["createApp"])({render:function(){return Object(a["createVNode"])(fo,ho(ho({},e),{},{notificationId:e.id,type:"toast",onClosed:function(){r.unmount()}}))}});r.config.globalProperties.$sanitize=window.vueSanitize,r.config.globalProperties.translate=D,r.mount(n)}},{key:"initializeNotificationContainer",value:function(e,t){var n=window.$(e);if(!n.children(".notification-group").length){var r=window.CoreHome.NotificationGroup,i=Object(a["createApp"])({template:'<NotificationGroup :group="group"></NotificationGroup>',data:function(){return{group:t}}});i.config.globalProperties.$sanitize=window.vueSanitize,i.config.globalProperties.translate=D,i.component("NotificationGroup",r),i.mount(n[0])}}},{key:"checkMessage",value:function(e){if(!e)throw new Error("No message given, cannot display notification")}}]),e}(),wo=new Oo,jo=wo;$((function(){return wo.parseNotificationDivs()})), /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -angular.module("piwikApp").factory("notifications",(function(){return Ao}));var Mo={class:"notification-group"},$o=["innerHTML"];function Lo(e,t,n,r,i,a){var c=Object(o["resolveComponent"])("Notification");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",Mo,[(Object(o["openBlock"])(!0),Object(o["createElementBlock"])(o["Fragment"],null,Object(o["renderList"])(e.notifications,(function(t,n){return Object(o["openBlock"])(),Object(o["createBlock"])(c,{key:t.id||"no-id-".concat(n),"notification-id":t.id,title:t.title,context:t.context,type:t.type,noclear:t.noclear,"toast-length":t.toastLength,style:Object(o["normalizeStyle"])(t.style),animate:t.animate,message:t.message,"notification-instance-id":t.notificationInstanceId,"css-class":t.class,onClosed:function(n){return e.removeNotification(t.id)}},{default:Object(o["withCtx"])((function(){return[Object(o["createElementVNode"])("div",{innerHTML:e.$sanitize(t.message)},null,8,$o)]})),_:2},1032,["notification-id","title","context","type","noclear","toast-length","style","animate","message","notification-instance-id","css-class","onClosed"])})),128))])}var Ho=Object(o["defineComponent"])({props:{group:String},components:{Notification:Do},computed:{notifications:function(){var e=this;return Ao.state.notifications.filter((function(t){return e.group?e.group===t.group:!t.group}))}},methods:{removeNotification:function(e){Ao.remove(e)}}});Ho.render=Lo;var Fo=Ho; +angular.module("piwikApp").factory("notifications",(function(){return jo}));var ko={class:"notification-group"},So=["innerHTML"];function Do(e,t,n,r,i,o){var l=Object(a["resolveComponent"])("Notification");return Object(a["openBlock"])(),Object(a["createElementBlock"])("div",ko,[(Object(a["openBlock"])(!0),Object(a["createElementBlock"])(a["Fragment"],null,Object(a["renderList"])(e.notifications,(function(t,n){return Object(a["openBlock"])(),Object(a["createBlock"])(l,{key:t.id||"no-id-".concat(n),"notification-id":t.id,title:t.title,context:t.context,type:t.type,noclear:t.noclear,"toast-length":t.toastLength,style:Object(a["normalizeStyle"])(t.style),animate:t.animate,message:t.message,"notification-instance-id":t.notificationInstanceId,"css-class":t.class,onClosed:function(n){return e.removeNotification(t.id)}},{default:Object(a["withCtx"])((function(){return[Object(a["createElementVNode"])("div",{innerHTML:e.$sanitize(t.message)},null,8,So)]})),_:2},1032,["notification-id","title","context","type","noclear","toast-length","style","animate","message","notification-instance-id","css-class","onClosed"])})),128))])}var Co=Object(a["defineComponent"])({props:{group:String},components:{Notification:fo},computed:{notifications:function(){var e=this;return jo.state.notifications.filter((function(t){return e.group?e.group===t.group:!t.group}))}},methods:{removeNotification:function(e){jo.remove(e)}}});Co.render=Do;var Po=Co; /*! * Matomo - free/libre analytics platform * diff --git a/plugins/CoreHome/vue/src/Comparisons/Comparisons.store.ts b/plugins/CoreHome/vue/src/Comparisons/Comparisons.store.ts index e7cc8e7bd2..faccdebcf9 100644 --- a/plugins/CoreHome/vue/src/Comparisons/Comparisons.store.ts +++ b/plugins/CoreHome/vue/src/Comparisons/Comparisons.store.ts @@ -262,39 +262,11 @@ export default class ComparisonsStore { }; // change the page w/ these new param values - if (Matomo.helper.isAngularRenderingThePage()) { - const search = MatomoUrl.hashParsed.value; - - const newSearch: {[key: string]: string|string[]} = { - ...search, - ...compareParams, - ...extraParams, - }; - - delete newSearch['compareSegments[]']; - delete newSearch['comparePeriods[]']; - delete newSearch['compareDates[]']; - - if (JSON.stringify(newSearch) !== JSON.stringify(search)) { - MatomoUrl.updateHash(newSearch); - } - - return; - } - - const paramsToRemove: string[] = []; - ['compareSegments', 'comparePeriods', 'compareDates'].forEach((name) => { - if (!compareParams[name].length) { - paramsToRemove.push(name); - } + MatomoUrl.updateLocation({ + ...MatomoUrl.parsed.value, + ...compareParams, + ...extraParams, }); - - // angular is not rendering the page (ie, we are in the embedded dashboard) or we need to change - // the segment - const url = MatomoUrl.stringify(extraParams); - const strHash = MatomoUrl.stringify(compareParams); - - window.broadcast.propagateNewPage(url, undefined, strHash, paramsToRemove); } private getAllSeriesColors() { diff --git a/plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.vue b/plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.vue index c2af7ecb1c..a3f68387b0 100644 --- a/plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.vue +++ b/plugins/CoreHome/vue/src/DateRangePicker/DateRangePicker.vue @@ -5,57 +5,59 @@ --> <template> - <div id="calendarRangeFrom"> - <h6> - {{ translate('General_DateRangeFrom') }} - <input - type="text" - id="inputCalendarFrom" - name="inputCalendarFrom" - class="browser-default" - v-model="startDateText" - v-on:change="onRangeInputChanged('from', $event)" - v-on:keyup="handleEnterPress($event)" - /> - </h6> - <DatePicker - id="calendarFrom" - :view-date="startDate" - :selected-date-start="fromPickerSelectedDates[0]" - :selected-date-end="fromPickerSelectedDates[1]" - :highlighted-date-start="fromPickerHighlightedDates[0]" - :highlighted-date-end="fromPickerHighlightedDates[1]" - @date-select="setStartRangeDate($event.date)" - @cell-hover="fromPickerHighlightedDates = getNewHighlightedDates($event.date, $event.$cell)" - @cell-hover-leave="fromPickerHighlightedDates = [null, null]" - > - </DatePicker> - </div> - <div id="calendarRangeTo"> - <h6> - {{ translate('General_DateRangeTo') }} - <input - type="text" - id="inputCalendarTo" - name="inputCalendarTo" - class="browser-default" - v-model="endDateText" - v-on:change="onRangeInputChanged('to', $event)" - v-on:keyup="handleEnterPress($event)" - /> - </h6> - <DatePicker - id="calendarTo" - :view-date="endDate" - :selected-date-start="toPickerSelectedDates[0]" - :selected-date-end="toPickerSelectedDates[1]" - :highlighted-date-start="toPickerHighlightedDates[0]" - :highlighted-date-end="toPickerHighlightedDates[1]" - @date-select="setEndRangeDate($event.date)" - @cell-hover="toPickerHighlightedDates = getNewHighlightedDates($event.date, $event.$cell)" - @cell-hover-leave="toPickerHighlightedDates = [null, null]" - > - </DatePicker> + <div> + <div id="calendarRangeFrom"> + <h6> + {{ translate('General_DateRangeFrom') }} + <input + type="text" + id="inputCalendarFrom" + name="inputCalendarFrom" + class="browser-default" + v-model="startDateText" + @keydown="onRangeInputChanged('from', $event)" + @keyup="handleEnterPress($event)" + /> + </h6> + <DatePicker + id="calendarFrom" + :view-date="startDate" + :selected-date-start="fromPickerSelectedDates[0]" + :selected-date-end="fromPickerSelectedDates[1]" + :highlighted-date-start="fromPickerHighlightedDates[0]" + :highlighted-date-end="fromPickerHighlightedDates[1]" + @date-select="setStartRangeDate($event.date)" + @cell-hover="fromPickerHighlightedDates = getNewHighlightedDates($event.date, $event.$cell)" + @cell-hover-leave="fromPickerHighlightedDates = [null, null]" + > + </DatePicker> + </div> + <div id="calendarRangeTo"> + <h6> + {{ translate('General_DateRangeTo') }} + <input + type="text" + id="inputCalendarTo" + name="inputCalendarTo" + class="browser-default" + v-model="endDateText" + @keydown="onRangeInputChanged('to', $event)" + @keyup="handleEnterPress($event)" + /> + </h6> + <DatePicker + id="calendarTo" + :view-date="endDate" + :selected-date-start="toPickerSelectedDates[0]" + :selected-date-end="toPickerSelectedDates[1]" + :highlighted-date-start="toPickerHighlightedDates[0]" + :highlighted-date-end="toPickerHighlightedDates[1]" + @date-select="setEndRangeDate($event.date)" + @cell-hover="toPickerHighlightedDates = getNewHighlightedDates($event.date, $event.$cell)" + @cell-hover-leave="toPickerHighlightedDates = [null, null]" + > + </DatePicker> + </div> </div> </template> @@ -66,6 +68,8 @@ import DatePicker from '../DatePicker/DatePicker.vue'; import { parseDate, format } from '../Periods/utilities'; import ChangeEvent = JQuery.ChangeEvent; +const DATE_FORMAT = 'YYYY-MM-DD'; + export default defineComponent({ props: { startDate: String, @@ -96,6 +100,8 @@ export default defineComponent({ toPickerHighlightedDates: [null, null], startDateText: this.startDate, endDateText: this.endDate, + startDateInvalid: false, + endDateInvalid: false, }; }, emits: ['rangeChange', 'submit'], @@ -124,11 +130,13 @@ export default defineComponent({ this.rangeChanged(); }, onRangeInputChanged(source: string, event: ChangeEvent) { - if (source === 'from') { - this.setStartRangeDateFromStr(event.target.value); - } else { - this.setEndRangeDateFromStr(event.target.value); - } + setTimeout(() => { + if (source === 'from') { + this.setStartRangeDateFromStr(event.target.value); + } else { + this.setEndRangeDateFromStr(event.target.value); + } + }); }, getNewHighlightedDates(date: Date, $cell: JQuery) { if ($cell.hasClass('ui-datepicker-unselectable')) { @@ -148,32 +156,42 @@ export default defineComponent({ }); }, setStartRangeDateFromStr(dateStr: string) { + this.startDateInvalid = true; + let startDateParsed: Date; try { - startDateParsed = parseDate(dateStr); + if (dateStr.length === DATE_FORMAT.length) { + startDateParsed = parseDate(dateStr); + } } catch (e) { - this.startDateText = this.startDate; + // ignore } if (startDateParsed) { this.fromPickerSelectedDates = [startDateParsed, startDateParsed]; - } + this.startDateInvalid = false; - this.rangeChanged(); + this.rangeChanged(); + } }, setEndRangeDateFromStr(dateStr: string) { + this.endDateInvalid = true; + let endDateParsed: Date; try { - endDateParsed = parseDate(dateStr); + if (dateStr.length === DATE_FORMAT.length) { + endDateParsed = parseDate(dateStr); + } } catch (e) { - this.endDateText = this.endDate; + // ignore } if (endDateParsed) { this.toPickerSelectedDates = [endDateParsed, endDateParsed]; - } + this.endDateInvalid = false; - this.rangeChanged(); + this.rangeChanged(); + } }, rangeChanged() { this.$emit('rangeChange', { diff --git a/plugins/CoreHome/vue/src/ExpandOnClick/ExpandOnClick.ts b/plugins/CoreHome/vue/src/ExpandOnClick/ExpandOnClick.ts index c4fa295845..ba00aa529e 100644 --- a/plugins/CoreHome/vue/src/ExpandOnClick/ExpandOnClick.ts +++ b/plugins/CoreHome/vue/src/ExpandOnClick/ExpandOnClick.ts @@ -7,9 +7,10 @@ import { DirectiveBinding } from 'vue'; import Matomo from '../Matomo/Matomo'; +import DirectiveUtilities from '../directiveUtilities'; interface ExpandOnClickArgs { - expander: HTMLElement, + expander: string | HTMLElement, isMouseDown?: boolean; hasScrolled?: boolean; @@ -89,16 +90,19 @@ export default { binding.value.onClickOutsideElement = onClickOutsideElement.bind(null, el, binding); binding.value.onScroll = onScroll.bind(null, binding); - // have to use jquery here since existing code will do $(...).click(). which apparently - // doesn't work when using addEventListener. - window.$(binding.value.expander).click(binding.value.onExpand); + setTimeout(() => { + const expander = DirectiveUtilities.getRef(binding.value.expander, binding); + expander.addEventListener('click', binding.value.onExpand); + }); + doc.addEventListener('keyup', binding.value.onEscapeHandler); doc.addEventListener('mousedown', binding.value.onMouseDown); doc.addEventListener('mouseup', binding.value.onClickOutsideElement); doc.addEventListener('scroll', binding.value.onScroll); }, unmounted(el: HTMLElement, binding: DirectiveBinding<ExpandOnClickArgs>): void { - binding.value.expander.removeEventListener('click', binding.value.onExpand); + const expander = DirectiveUtilities.getRef(binding.value.expander, binding); + expander.removeEventListener('click', binding.value.onExpand); doc.removeEventListener('keyup', binding.value.onEscapeHandler); doc.removeEventListener('mousedown', binding.value.onMouseDown); doc.removeEventListener('mouseup', binding.value.onClickOutsideElement); diff --git a/plugins/CoreHome/vue/src/ExpandOnHover/ExpandOnHover.ts b/plugins/CoreHome/vue/src/ExpandOnHover/ExpandOnHover.ts index 6d86d0b212..98afe493f0 100644 --- a/plugins/CoreHome/vue/src/ExpandOnHover/ExpandOnHover.ts +++ b/plugins/CoreHome/vue/src/ExpandOnHover/ExpandOnHover.ts @@ -7,9 +7,10 @@ import { DirectiveBinding } from 'vue'; import Matomo from '../Matomo/Matomo'; +import DirectiveUtilities from '../directiveUtilities'; interface ExpandOnHoverArgs { - expander: HTMLElement, + expander: string | HTMLElement, onMouseEnter?: () => void; onMouseLeave?: () => void; @@ -59,13 +60,18 @@ export default { binding.value.onClickOutsideElement = onClickOutsideElement.bind(null, el); binding.value.onEscapeHandler = onEscapeHandler.bind(null, el); - binding.value.expander.addEventListener('mouseenter', binding.value.onMouseEnter); + setTimeout(() => { + const expander = DirectiveUtilities.getRef(binding.value.expander, binding); + expander.addEventListener('mouseenter', binding.value.onMouseEnter); + }); + el.addEventListener('mouseleave', binding.value.onMouseLeave); doc.addEventListener('keyup', binding.value.onEscapeHandler); doc.addEventListener('mouseup', binding.value.onClickOutsideElement); }, unmounted(el: HTMLElement, binding: DirectiveBinding<ExpandOnHoverArgs>): void { - binding.value.expander.removeEventListener('mouseenter', binding.value.onMouseEnter); + const expander = DirectiveUtilities.getRef(binding.value.expander, binding); + expander.removeEventListener('mouseenter', binding.value.onMouseEnter); el.removeEventListener('mouseleave', binding.value.onMouseLeave); document.removeEventListener('keyup', binding.value.onEscapeHandler); document.removeEventListener('mouseup', binding.value.onClickOutsideElement); diff --git a/plugins/CoreHome/vue/src/MatomoUrl/MatomoUrl.ts b/plugins/CoreHome/vue/src/MatomoUrl/MatomoUrl.ts index 02580be10a..971acfa299 100644 --- a/plugins/CoreHome/vue/src/MatomoUrl/MatomoUrl.ts +++ b/plugins/CoreHome/vue/src/MatomoUrl/MatomoUrl.ts @@ -80,6 +80,16 @@ class MatomoUrl { window.broadcast.propagateNewPage('', undefined, undefined, undefined, url); } + // if we're in an embedded context, loads an entire new URL, otherwise updates the hash + updateLocation(params: QueryParameters|string) { + if (Matomo.helper.isAngularRenderingThePage()) { + this.updateHash(params); + return; + } + + this.updateUrl(params); + } + getSearchParam(paramName: string): string { const hash = window.location.href.split('#'); diff --git a/plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.adapter.ts b/plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.adapter.ts new file mode 100644 index 0000000000..6fa84325a2 --- /dev/null +++ b/plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.adapter.ts @@ -0,0 +1,19 @@ +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +import createAngularJsAdapter from '../createAngularJsAdapter'; +import PeriodSelector from './PeriodSelector.vue'; + +export default createAngularJsAdapter({ + component: PeriodSelector, + scope: { + periods: { + angularJsBind: '<', + }, + }, + directiveName: 'piwikPeriodSelector', +}); diff --git a/plugins/CoreHome/angularjs/period-selector/period-selector.directive.less b/plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.less index a4a3d74897..257c8753d5 100644 --- a/plugins/CoreHome/angularjs/period-selector/period-selector.directive.less +++ b/plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.less @@ -1,4 +1,4 @@ -[piwik-period-selector] { +[piwik-period-selector],.periodSelector { display: inline-block; &.compare-dropdown-open { @@ -24,6 +24,7 @@ span { padding-left:25px; font-size: 14px; + margin-right: 3px; } } } @@ -83,9 +84,9 @@ } .compare-dates-separator { - height: 1px; - margin-left: 8px; - margin-right: 8px; + height: 0.5px; + margin-left: 11px; + margin-right: 11px; background-color: @color-silver-l14; width: 16px; display: inline-block; diff --git a/plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.vue b/plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.vue new file mode 100644 index 0000000000..70bc57dd60 --- /dev/null +++ b/plugins/CoreHome/vue/src/PeriodSelector/PeriodSelector.vue @@ -0,0 +1,524 @@ +<!-- + Matomo - free/libre analytics platform + @link https://matomo.org + @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later +--> + +<template> + <div + ref="root" + class="periodSelector piwikSelector" + v-expand-on-click="{ expander: 'title' }" + > + <a + ref="title" + id="date" + class="title" + tabindex="-1" + :title="translate('General_ChooseDate', currentlyViewingText)" + > + <span class="icon icon-calendar" /> + {{ currentlyViewingText }} + </a> + <div + id="periodMore" + class="dropdown" + > + <div class="flex"> + <div> + <DateRangePicker + v-show="selectedPeriod === 'range'" + class="period-range" + :start-date="startRangeDate" + :end-date="endRangeDate" + @range-change="onRangeChange($event.start, $event.end)" + @submit="onApplyClicked()" + > + </DateRangePicker> + <div + class="period-date" + v-if="selectedPeriod !== 'range'" + > + <PeriodDatePicker + id="datepicker" + :period="selectedPeriod" + :date="periodValue === selectedPeriod ? dateValue : null" + @select="setPiwikPeriodAndDate(selectedPeriod, $event.date)" + > + </PeriodDatePicker> + </div> + </div> + <div class="period-type"> + <h6>{{ translate('General_Period') }}</h6> + <div id="otherPeriods"> + <p + v-for="period in periodsFiltered" + :key="period" + > + <label + :class="{ 'selected-period-label': period === selectedPeriod }" + @dblclick="changeViewedPeriod(period)" + :title="period === periodValue + ? '' + : translate('General_DoubleClickToChangePeriod')" + > + <input + type="radio" + name="period" + :id="`period_id_${ period }`" + v-model="selectedPeriod" + :checked="selectedPeriod === period" + @change="selectedPeriod = period" + @dblclick="changeViewedPeriod(period)" + /> + <span>{{ getPeriodDisplayText(period) }}</span> + </label> + </p> + </div> + </div> + </div> + <div + class="compare-checkbox" + v-if="isComparisonEnabled" + > + <label> + <input + id="comparePeriodTo" + type="checkbox" + v-model="isComparing" + /> + <span>{{ translate('General_CompareTo') }}</span> + </label> + <div id="comparePeriodToDropdown"> + <Field + v-model="comparePeriodType" + :style="{'visibility': isComparing ? 'visible' : 'hidden'}" + :name="'comparePeriodToDropdown'" + :uicontrol="'select'" + :options="comparePeriodDropdownOptions" + :full-width="true" + :disabled="!isComparing" + /> + </div> + </div> + <div + class="compare-date-range" + v-if="isComparing && comparePeriodType === 'custom'" + > + <div> + <div id="comparePeriodStartDate"> + <div> + <Field + v-model="compareStartDate" + :name="'comparePeriodStartDate'" + :uicontrol="'text'" + :full-width="true" + :title="translate('CoreHome_StartDate')" + :placeholder="'YYYY-MM-DD'" + /> + </div> + </div> + <span class="compare-dates-separator" /> + <div id="comparePeriodEndDate"> + <div> + <Field + v-model="compareEndDate" + :name="'comparePeriodEndDate'" + :uicontrol="'text'" + :full-width="true" + :title="translate('CoreHome_EndDate')" + :placeholder="'YYYY-MM-DD'" + /> + </div> + </div> + </div> + </div> + <div class="apply-button-container"> + <input + type="submit" + id="calendarApply" + class="btn" + @click="onApplyClicked()" + :disabled="!isApplyEnabled()" + :value="translate('General_Apply')" + /> + </div> + <div + id="ajaxLoadingCalendar" + v-if="isLoadingNewPage" + > + <ActivityIndicator + :loading="true" + /> + <div class="loadingSegment"> + {{ translate('SegmentEditor_LoadingSegmentedDataMayTakeSomeTime') }} + </div> + </div> + </div> + </div> +</template> + +<script lang="ts"> +import { defineComponent, watch } from 'vue'; +import ExpandOnClick from '../ExpandOnClick/ExpandOnClick'; +import DateRangePicker from '../DateRangePicker/DateRangePicker.vue'; +import PeriodDatePicker from '../PeriodDatePicker/PeriodDatePicker.vue'; +import ActivityIndicator from '../ActivityIndicator/ActivityIndicator.vue'; +import Matomo from '../Matomo/Matomo'; +import translate from '../translate'; +import ComparisonsStore from '../Comparisons/Comparisons.store.instance'; +import useExternalPluginComponent from '../useExternalPluginComponent'; +import { + Periods, + parseDate, + Range, + format, +} from '../Periods'; +import MatomoUrl from '../MatomoUrl/MatomoUrl'; + +const Field = useExternalPluginComponent('CorePluginsAdmin', 'Field'); + +const NBSP = Matomo.helper.htmlDecode(' '); + +const COMPARE_PERIOD_OPTIONS = [ + { key: 'custom', value: translate('General_Custom') }, + { + key: 'previousPeriod', + value: translate('General_PreviousPeriod').replace(/\s+/, NBSP), + }, + { + key: 'previousYear', + value: translate('General_PreviousYear').replace(/\s+/, NBSP), + }, +]; + +const piwikMinDate = new Date(Matomo.minDateYear, Matomo.minDateMonth - 1, Matomo.minDateDay); +const piwikMaxDate = new Date(Matomo.maxDateYear, Matomo.maxDateMonth - 1, Matomo.maxDateDay); + +function isValidDate(d) { + if (Object.prototype.toString.call(d) !== '[object Date]') { + return false; + } + + return !Number.isNaN(d.getTime()); +} + +export default defineComponent({ + props: { + periods: Array, + }, + components: { + DateRangePicker, + PeriodDatePicker, + Field, + ActivityIndicator, + }, + directives: { + ExpandOnClick, + }, + data() { + return { + comparePeriodDropdownOptions: COMPARE_PERIOD_OPTIONS, + periodValue: null, + dateValue: null, + selectedPeriod: null, + startRangeDate: null, + endRangeDate: null, + isRangeValid: null, + isLoadingNewPage: false, + isComparing: null, + comparePeriodType: 'previousPeriod', + compareStartDate: '', + compareEndDate: '', + }; + }, + mounted() { + Matomo.on('hidePeriodSelector', () => { + window.$(this.$refs.root).hide(); + }); + + // some widgets might hide the period selector using the event above, so ensure it's + // shown again when switching the page + Matomo.on('piwikPageChange', () => { + window.$(this.$refs.root).show(); + }); + + this.updateSelectedValuesFromHash(); + watch(() => MatomoUrl.parsed.value, this.updateSelectedValuesFromHash); + + this.isComparing = ComparisonsStore.isComparing(); + watch(() => ComparisonsStore.isComparing(), (newVal) => { + this.isComparing = newVal; + }); + + window.initTopControls(); // must be called when a top control changes width + + this.handleZIndexPositionRelativeCompareDropdownIssue(); + }, + computed: { + currentlyViewingText() { + let date; + if (this.periodValue === 'range') { + if (!this.startRangeDate || !this.endRangeDate) { + return translate('General_Error'); + } + + date = `${this.startRangeDate},${this.endRangeDate}`; + } else { + if (!this.dateValue) { + return translate('General_Error'); + } + + date = format(this.dateValue); + } + + try { + return Periods.parse(this.periodValue, date).getPrettyString(); + } catch (e) { + return translate('General_Error'); + } + }, + isComparisonEnabled() { + return ComparisonsStore.isComparisonEnabled(); + }, + periodsFiltered() { + return (this.periods || []).filter((periodLabel) => Periods.isRecognizedPeriod(periodLabel)); + }, + selectedComparisonParams() { + if (!this.isComparing) { + return {}; + } + + if (this.comparePeriodType === 'custom') { + return { + comparePeriods: ['range'], + compareDates: [`${this.compareStartDate},${this.compareEndDate}`], + }; + } + + if (this.comparePeriodType === 'previousPeriod') { + return { + comparePeriods: [this.selectedPeriod], + compareDates: [this.previousPeriodDateToSelectedPeriod], + }; + } + + if (this.comparePeriodType === 'previousYear') { + const dateStr = this.selectedPeriod === 'range' + ? `${this.startRangeDate},${this.endRangeDate}` + : this.dateValue; + + const currentDateRange = Periods.parse(this.selectedPeriod, dateStr).getDateRange(); + currentDateRange[0].setFullYear(currentDateRange[0].getFullYear() - 1); + currentDateRange[1].setFullYear(currentDateRange[1].getFullYear() - 1); + + if (this.selectedPeriod === 'range') { + return { + comparePeriods: ['range'], + compareDates: [`${format(currentDateRange[0])},${format(currentDateRange[1])}`], + }; + } + + return { + comparePeriods: [this.selectedPeriod], + compareDates: [format(currentDateRange[0])], + }; + } + + console.warn(`Unknown compare period type: ${this.comparePeriodType}`); + return {}; + }, + previousPeriodDateToSelectedPeriod() { + if (this.selectedPeriod === 'range') { + const currentStartRange = parseDate(this.startRangeDate); + const currentEndRange = parseDate(this.endRangeDate); + const newEndDate = Range.getLastNRange('day', 2, currentStartRange).startDate; + + const rangeSize = Math.floor((currentEndRange - currentStartRange) / 86400000); + const newRange = Range.getLastNRange('day', 1 + rangeSize, newEndDate); + + return `${format(newRange.startDate)},${format(newRange.endDate)}`; + } + + const newStartDate = Range.getLastNRange(this.selectedPeriod, 2, this.dateValue).startDate; + return format(newStartDate); + }, + selectedDateString() { + if (this.selectedPeriod === 'range') { + const dateFrom = this.startRangeDate; + const dateTo = this.endRangeDate; + const oDateFrom = parseDate(dateFrom); + const oDateTo = parseDate(dateTo); + + if (!isValidDate(oDateFrom) + || !isValidDate(oDateTo) + || oDateFrom > oDateTo + ) { + // TODO: use a notification instead? + window.$('#alert') + .find('h2') + .text(translate('General_InvalidDateRange')); + Matomo.helper.modalConfirm('#alert', {}); + return null; + } + + return `${dateFrom},${dateTo}`; + } + + return format(this.dateValue); + }, + }, + methods: { + handleZIndexPositionRelativeCompareDropdownIssue() { + const $element = window.$(this.$refs.root); + $element.on('focus', '#comparePeriodToDropdown .select-dropdown', () => { + $element.addClass('compare-dropdown-open'); + }).on('blur', '#comparePeriodToDropdown .select-dropdown', () => { + $element.removeClass('compare-dropdown-open'); + }); + }, + changeViewedPeriod() { + // only change period if it's different from what's being shown currently + if (this.period === this.periodValue) { + return; + } + + // can't just change to a range period, w/o setting two new dates + if (this.period === 'range') { + return; + } + + this.setPiwikPeriodAndDate(this.period, this.dateValue); + }, + setPiwikPeriodAndDate(period: string, date: Date) { + this.periodValue = period; + this.selectedPeriod = period; + this.dateValue = date; + + const currentDateString = format(date); + this.setRangeStartEndFromPeriod(period, currentDateString); + + this.propagateNewUrlParams(currentDateString, this.selectedPeriod); + + window.initTopControls(); + }, + propagateNewUrlParams(date: string, period: string) { + const compareParams = this.selectedComparisonParams; + + if (Matomo.helper.isAngularRenderingThePage()) { + this.closePeriodSelector(); + } else { + this.isLoadingNewPage = true; + } + + // get params without comparePeriods/compareSegments/compareDates + const paramsWithoutCompare = { ...MatomoUrl.parsed.value }; + delete paramsWithoutCompare.comparePeriods; + delete paramsWithoutCompare.compareSegments; + delete paramsWithoutCompare.compareDates; + + MatomoUrl.updateLocation({ + ...paramsWithoutCompare, + date, + period, + ...compareParams, + }); + }, + onApplyClicked() { + if (this.selectedPeriod === 'range') { + const dateString = this.selectedDateString; + if (!dateString) { + return; + } + + this.periodValue = 'range'; + + this.propagateNewUrlParams(dateString, 'range'); + return; + } + + this.setPiwikPeriodAndDate(this.selectedPeriod, this.dateValue); + }, + updateSelectedValuesFromHash() { + const { date, period } = MatomoUrl.parsed.value; + + this.periodValue = period; + this.selectedPeriod = period; + + this.dateValue = null; + this.startRangeDate = null; + this.endRangeDate = null; + + try { + Periods.parse(period, date); + } catch (e) { + return; + } + + if (period === 'range') { + const periodObj = Periods.get(period).parse(date) as Range; + + const [startDate, endDate] = periodObj.getDateRange(); + this.dateValue = startDate; + this.startRangeDate = format(startDate); + this.endRangeDate = format(endDate); + } else { + this.dateValue = parseDate(date); + this.setRangeStartEndFromPeriod(period, date); + } + }, + setRangeStartEndFromPeriod(period: string, dateStr: string) { + const dateRange = Periods.parse(period, dateStr).getDateRange(); + this.startRangeDate = format(dateRange[0] < piwikMinDate ? piwikMinDate : dateRange[0]); + this.endRangeDate = format(dateRange[1] > piwikMaxDate ? piwikMaxDate : dateRange[1]); + }, + getPeriodDisplayText(periodLabel: string) { + return Periods.get(periodLabel).getDisplayText(); + }, + onRangeChange(start: Date, end: Date) { + if (!start || !end) { + this.isRangeValid = false; + return; + } + + this.isRangeValid = true; + this.startRangeDate = start; + this.endRangeDate = end; + }, + isApplyEnabled() { + if (this.selectedPeriod === 'range' + && !this.isRangeValid + ) { + return false; + } + + if (this.isComparing + && this.comparePeriodType === 'custom' + && !this.isCompareRangeValid() + ) { + return false; + } + + return true; + }, + closePeriodSelector() { + this.$refs.root.classList.remove('expanded'); + }, + isCompareRangeValid() { + try { + parseDate(this.compareStartDate); + } catch (e) { + return false; + } + + try { + parseDate(this.compareEndDate); + } catch (e) { + return false; + } + + return true; + }, + }, +}); +</script> diff --git a/plugins/CoreHome/vue/src/directiveUtilities.ts b/plugins/CoreHome/vue/src/directiveUtilities.ts new file mode 100644 index 0000000000..129a27ceba --- /dev/null +++ b/plugins/CoreHome/vue/src/directiveUtilities.ts @@ -0,0 +1,18 @@ +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +import { DirectiveBinding } from 'vue'; + +function getRef<T>(expander: string | HTMLElement, binding: DirectiveBinding<T>): HTMLElement|null { + return expander instanceof HTMLElement + ? expander + : binding.instance.$refs[expander] as HTMLElement; +} + +export default { + getRef, +}; diff --git a/plugins/CoreHome/vue/src/index.ts b/plugins/CoreHome/vue/src/index.ts index dd3867949c..bec841afb1 100644 --- a/plugins/CoreHome/vue/src/index.ts +++ b/plugins/CoreHome/vue/src/index.ts @@ -32,7 +32,9 @@ import './SiteSelector/SiteSelector.adapter'; import './QuickAccess/QuickAccess.adapter'; import './FieldArray/FieldArray.adapter'; import './MultiPairField/MultiPairField.adapter'; +import './PeriodSelector/PeriodSelector.adapter'; +export { default as DirectiveUtilities } from './directiveUtilities'; export { default as debounce } from './debounce'; export { default as createAngularJsAdapter, @@ -67,3 +69,4 @@ export { default as SiteSelector } from './SiteSelector/SiteSelector.vue'; export { default as QuickAccess } from './QuickAccess/QuickAccess.vue'; export { default as FieldArray } from './FieldArray/FieldArray.vue'; export { default as MultiPairField } from './MultiPairField/MultiPairField.vue'; +export { default as PeriodSelector } from './PeriodSelector/PeriodSelector.vue'; diff --git a/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_admin_view_admin_edit_permissions.png b/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_admin_view_admin_edit_permissions.png index e10bcc9b81..2bea700701 100644 --- a/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_admin_view_admin_edit_permissions.png +++ b/plugins/UsersManager/tests/UI/expected-screenshots/UsersManager_admin_view_admin_edit_permissions.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:583d72dfcebee5cb574f39db8cf179241958419247bd83ac26efcbf2a2c3c5e1 -size 81601 +oid sha256:8355571b0804e59efbe22334c97e798510f6791314630ad591446204f2e0cea5 +size 81574 diff --git a/tests/UI/expected-screenshots/PeriodSelector_custom_comparison.png b/tests/UI/expected-screenshots/PeriodSelector_custom_comparison.png index 0343b3f6ec..8d4279ee29 100644 --- a/tests/UI/expected-screenshots/PeriodSelector_custom_comparison.png +++ b/tests/UI/expected-screenshots/PeriodSelector_custom_comparison.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e5f050040b0beae33b876b07d3887dafd2a1a981fc77ccb144f23c6853d9296b -size 37126 +oid sha256:6fcb8c86e3639b8cceeea3bcc176775a4a32162a83b8ee1401382d2d5b4197f9 +size 36949 |