PageSourceSearch

https://www.slagharen.com/etc.clientlibs/parques-reunidos-catalog/…-29ee73e3babc55f221793995721f6da4-lc.min.js

js slagharen.com collected 2026-09-24 23:13:56 UTC 478,203 bytes, 9,266 lines download raw bytes

vendor: 5,571 bytes, lines 1-207
1//! moment.js
2//! version : 2.30.1
3//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
4//! license : MIT
5//! momentjs.com
6
7;(function (global, factory) {
8    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
9    typeof define === 'function' && define.amd ? define(factory) :
10    global.moment = factory()
11}(this, (function () { 'use strict';
12
13    var hookCallback;
14
15    function hooks() {
16        return hookCallback.apply(null, arguments);
17    }
18
19    // This is done to register the method called with moment()
20    // without creating circular dependencies.
21    function setHookCallback(callback) {
22        hookCallback = callback;
23    }
24
25    function isArray(input) {
26        return (
27            input instanceof Array ||
28            Object.prototype.toString.call(input) === '[object Array]'
29        );
30    }
31
32    function isObject(input) {
33        // IE8 will treat undefined and null as object if it wasn't for
34        // input != null
35        return (
36            input != null &&
37            Object.prototype.toString.call(input) === '[object Object]'
38        );
39    }
40
41    function hasOwnProp(a, b) {
42        return Object.prototype.hasOwnProperty.call(a, b);
43    }
44
45    function isObjectEmpty(obj) {
46        if (Object.getOwnPropertyNames) {
47            return Object.getOwnPropertyNames(obj).length === 0;
48        } else {
49            var k;
50            for (k in obj) {
51                if (hasOwnProp(obj, k)) {
52                    return false;
53                }
54            }
55            return true;
56        }
57    }
58
59    function isUndefined(input) {
60        return input === void 0;
61    }
62
63    function isNumber(input) {
64        return (
65            typeof input === 'number' ||
66            Object.prototype.toString.call(input) === '[object Number]'
67        );
68    }
69
70    function isDate(input) {
71        return (
72            input instanceof Date ||
73            Object.prototype.toString.call(input) === '[object Date]'
74        );
75    }
76
77    function map(arr, fn) {
78        var res = [],
79            i,
80            arrLen = arr.length;
81        for (i = 0; i < arrLen; ++i) {
82            res.push(fn(arr[i], i));
83        }
84        return res;
85    }
86
87    function extend(a, b) {
88        for (var i in b) {
89            if (hasOwnProp(b, i)) {
90                a[i] = b[i];
91            }
92        }
93
94        if (hasOwnProp(b, 'toString')) {
95            a.toString = b.toString;
96        }
97
98        if (hasOwnProp(b, 'valueOf')) {
99            a.valueOf = b.valueOf;
100        }
101
102        return a;
103    }
104
105    function createUTC(input, format, locale, strict) {
106        return createLocalOrUTC(input, format, locale, strict, true).utc();
107    }
108
109    function defaultParsingFlags() {
110        // We need to deep clone this object.
111        return {
112            empty: false,
113            unusedTokens: [],
114            unusedInput: [],
115            overflow: -2,
116            charsLeftOver: 0,
117            nullInput: false,
118            invalidEra: null,
119            invalidMonth: null,
120            invalidFormat: false,
121            userInvalidated: false,
122            iso: false,
123            parsedDateParts: [],
124            era: null,
125            meridiem: null,
126            rfc2822: false,
127            weekdayMismatch: false,
128        };
129    }
130
131    function getParsingFlags(m) {
132        if (m._pf == null) {
133            m._pf = defaultParsingFlags();
134        }
135        return m._pf;
136    }
137
138    var some;
139    if (Array.prototype.some) {
140        some = Array.prototype.some;
141    } else {
142        some = function (fun) {
143            var t = Object(this),
144                len = t.length >>> 0,
145                i;
146
147            for (i = 0; i < len; i++) {
148                if (i in t && fun.call(this, t[i], i, t)) {
149                    return true;
150                }
151            }
152
153            return false;
154        };
155    }
156
157    function isValid(m) {
158        var flags = null,
159            parsedParts = false,
160            isNowValid = m._d && !isNaN(m._d.getTime());
161        if (isNowValid) {
162            flags = getParsingFlags(m);
163            parsedParts = some.call(flags.parsedDateParts, function (i) {
164                return i != null;
165            });
166            isNowValid =
167                flags.overflow < 0 &&
168                !flags.empty &&
169                !flags.invalidEra &&
170                !flags.invalidMonth &&
171                !flags.invalidWeekday &&
172                !flags.weekdayMismatch &&
173                !flags.nullInput &&
174                !flags.invalidFormat &&
175                !flags.userInvalidated &&
176                (!flags.meridiem || (flags.meridiem && parsedParts));
177            if (m._strict) {
178                isNowValid =
179                    isNowValid &&
180                    flags.charsLeftOver === 0 &&
181                    flags.unusedTokens.length === 0 &&
182                    flags.bigHour === undefined;
183            }
184        }
185        if (Object.isFrozen == null || !Object.isFrozen(m)) {
186            m._isValid = isNowValid;
187        } else {
188            return isNowValid;
189        }
190        return m._isValid;
191    }
192
193    function createInvalid(flags) {
194        var m = createUTC(NaN);
195        if (flags != null) {
196            extend(getParsingFlags(m), flags);
197        } else {
198            getParsingFlags(m).userInvalidated = true;
199        }
200
201        return m;
202    }
203
204    // Plugins that add properties should also add the key here (null value),
205    // so we can properly clone ourselves.
206    var momentProperties = (hooks.momentProperties = []),
207        updateInProgress = false;
vendor: 11,455 bytes, lines 208-590
208
209    function copyConfig(to, from) {
210        var i,
211            prop,
212            val,
213            momentPropertiesLen = momentProperties.length;
214
215        if (!isUndefined(from._isAMomentObject)) {
216            to._isAMomentObject = from._isAMomentObject;
217        }
218        if (!isUndefined(from._i)) {
219            to._i = from._i;
220        }
221        if (!isUndefined(from._f)) {
222            to._f = from._f;
223        }
224        if (!isUndefined(from._l)) {
225            to._l = from._l;
226        }
227        if (!isUndefined(from._strict)) {
228            to._strict = from._strict;
229        }
230        if (!isUndefined(from._tzm)) {
231            to._tzm = from._tzm;
232        }
233        if (!isUndefined(from._isUTC)) {
234            to._isUTC = from._isUTC;
235        }
236        if (!isUndefined(from._offset)) {
237            to._offset = from._offset;
238        }
239        if (!isUndefined(from._pf)) {
240            to._pf = getParsingFlags(from);
241        }
242        if (!isUndefined(from._locale)) {
243            to._locale = from._locale;
244        }
245
246        if (momentPropertiesLen > 0) {
247            for (i = 0; i < momentPropertiesLen; i++) {
248                prop = momentProperties[i];
249                val = from[prop];
250                if (!isUndefined(val)) {
251                    to[prop] = val;
252                }
253            }
254        }
255
256        return to;
257    }
258
259    // Moment prototype object
260    function Moment(config) {
261        copyConfig(this, config);
262        this._d = new Date(config._d != null ? config._d.getTime() : NaN);
263        if (!this.isValid()) {
264            this._d = new Date(NaN);
265        }
266        // Prevent infinite loop in case updateOffset creates new moment
267        // objects.
268        if (updateInProgress === false) {
269            updateInProgress = true;
270            hooks.updateOffset(this);
271            updateInProgress = false;
272        }
273    }
274
275    function isMoment(obj) {
276        return (
277            obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
278        );
279    }
280
281    function warn(msg) {
282        if (
283            hooks.suppressDeprecationWarnings === false &&
284            typeof console !== 'undefined' &&
285            console.warn
286        ) {
287            console.warn('Deprecation warning: ' + msg);
288        }
289    }
290
291    function deprecate(msg, fn) {
292        var firstTime = true;
293
294        return extend(function () {
295            if (hooks.deprecationHandler != null) {
296                hooks.deprecationHandler(null, msg);
297            }
298            if (firstTime) {
299                var args = [],
300                    arg,
301                    i,
302                    key,
303                    argLen = arguments.length;
304                for (i = 0; i < argLen; i++) {
305                    arg = '';
306                    if (typeof arguments[i] === 'object') {
307                        arg += '\n[' + i + '] ';
308                        for (key in arguments[0]) {
309                            if (hasOwnProp(arguments[0], key)) {
310                                arg += key + ': ' + arguments[0][key] + ', ';
311                            }
312                        }
313                        arg = arg.slice(0, -2); // Remove trailing comma and space
314                    } else {
315                        arg = arguments[i];
316                    }
317                    args.push(arg);
318                }
319                warn(
320                    msg +
321                        '\nArguments: ' +
322                        Array.prototype.slice.call(args).join('') +
323                        '\n' +
324                        new Error().stack
325                );
326                firstTime = false;
327            }
328            return fn.apply(this, arguments);
329        }, fn);
330    }
331
332    var deprecations = {};
333
334    function deprecateSimple(name, msg) {
335        if (hooks.deprecationHandler != null) {
336            hooks.deprecationHandler(name, msg);
337        }
338        if (!deprecations[name]) {
339            warn(msg);
340            deprecations[name] = true;
341        }
342    }
343
344    hooks.suppressDeprecationWarnings = false;
345    hooks.deprecationHandler = null;
346
347    function isFunction(input) {
348        return (
349            (typeof Function !== 'undefined' && input instanceof Function) ||
350            Object.prototype.toString.call(input) === '[object Function]'
351        );
352    }
353
354    function set(config) {
355        var prop, i;
356        for (i in config) {
357            if (hasOwnProp(config, i)) {
358                prop = config[i];
359                if (isFunction(prop)) {
360                    this[i] = prop;
361                } else {
362                    this['_' + i] = prop;
363                }
364            }
365        }
366        this._config = config;
367        // Lenient ordinal parsing accepts just a number in addition to
368        // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
369        // TODO: Remove "ordinalParse" fallback in next major release.
370        this._dayOfMonthOrdinalParseLenient = new RegExp(
371            (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
372                '|' +
373                /\d{1,2}/.source
374        );
375    }
376
377    function mergeConfigs(parentConfig, childConfig) {
378        var res = extend({}, parentConfig),
379            prop;
380        for (prop in childConfig) {
381            if (hasOwnProp(childConfig, prop)) {
382                if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
383                    res[prop] = {};
384                    extend(res[prop], parentConfig[prop]);
385                    extend(res[prop], childConfig[prop]);
386                } else if (childConfig[prop] != null) {
387                    res[prop] = childConfig[prop];
388                } else {
389                    delete res[prop];
390                }
391            }
392        }
393        for (prop in parentConfig) {
394            if (
395                hasOwnProp(parentConfig, prop) &&
396                !hasOwnProp(childConfig, prop) &&
397                isObject(parentConfig[prop])
398            ) {
399                // make sure changes to properties don't modify parent config
400                res[prop] = extend({}, res[prop]);
401            }
402        }
403        return res;
404    }
405
406    function Locale(config) {
407        if (config != null) {
408            this.set(config);
409        }
410    }
411
412    var keys;
413
414    if (Object.keys) {
415        keys = Object.keys;
416    } else {
417        keys = function (obj) {
418            var i,
419                res = [];
420            for (i in obj) {
421                if (hasOwnProp(obj, i)) {
422                    res.push(i);
423                }
424            }
425            return res;
426        };
427    }
428
429    var defaultCalendar = {
430        sameDay: '[Today at] LT',
431        nextDay: '[Tomorrow at] LT',
432        nextWeek: 'dddd [at] LT',
433        lastDay: '[Yesterday at] LT',
434        lastWeek: '[Last] dddd [at] LT',
435        sameElse: 'L',
436    };
437
438    function calendar(key, mom, now) {
439        var output = this._calendar[key] || this._calendar['sameElse'];
440        return isFunction(output) ? output.call(mom, now) : output;
441    }
442
443    function zeroFill(number, targetLength, forceSign) {
444        var absNumber = '' + Math.abs(number),
445            zerosToFill = targetLength - absNumber.length,
446            sign = number >= 0;
447        return (
448            (sign ? (forceSign ? '+' : '') : '-') +
449            Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
450            absNumber
451        );
452    }
453
454    var formattingTokens =
455            /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
456        localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
457        formatFunctions = {},
458        formatTokenFunctions = {};
459
460    // token:    'M'
461    // padded:   ['MM', 2]
462    // ordinal:  'Mo'
463    // callback: function () { this.month() + 1 }
464    function addFormatToken(token, padded, ordinal, callback) {
465        var func = callback;
466        if (typeof callback === 'string') {
467            func = function () {
468                return this[callback]();
469            };
470        }
471        if (token) {
472            formatTokenFunctions[token] = func;
473        }
474        if (padded) {
475            formatTokenFunctions[padded[0]] = function () {
476                return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
477            };
478        }
479        if (ordinal) {
480            formatTokenFunctions[ordinal] = function () {
481                return this.localeData().ordinal(
482                    func.apply(this, arguments),
483                    token
484                );
485            };
486        }
487    }
488
489    function removeFormattingTokens(input) {
490        if (input.match(/\[[\s\S]/)) {
491            return input.replace(/^\[|\]$/g, '');
492        }
493        return input.replace(/\\/g, '');
494    }
495
496    function makeFormatFunction(format) {
497        var array = format.match(formattingTokens),
498            i,
499            length;
500
501        for (i = 0, length = array.length; i < length; i++) {
502            if (formatTokenFunctions[array[i]]) {
503                array[i] = formatTokenFunctions[array[i]];
504            } else {
505                array[i] = removeFormattingTokens(array[i]);
506            }
507        }
508
509        return function (mom) {
510            var output = '',
511                i;
512            for (i = 0; i < length; i++) {
513                output += isFunction(array[i])
514                    ? array[i].call(mom, format)
515                    : array[i];
516            }
517            return output;
518        };
519    }
520
521    // format date using native date object
522    function formatMoment(m, format) {
523        if (!m.isValid()) {
524            return m.localeData().invalidDate();
525        }
526
527        format = expandFormat(format, m.localeData());
528        formatFunctions[format] =
529            formatFunctions[format] || makeFormatFunction(format);
530
531        return formatFunctions[format](m);
532    }
533
534    function expandFormat(format, locale) {
535        var i = 5;
536
537        function replaceLongDateFormatTokens(input) {
538            return locale.longDateFormat(input) || input;
539        }
540
541        localFormattingTokens.lastIndex = 0;
542        while (i >= 0 && localFormattingTokens.test(format)) {
543            format = format.replace(
544                localFormattingTokens,
545                replaceLongDateFormatTokens
546            );
547            localFormattingTokens.lastIndex = 0;
548            i -= 1;
549        }
550
551        return format;
552    }
553
554    var defaultLongDateFormat = {
555        LTS: 'h:mm:ss A',
556        LT: 'h:mm A',
557        L: 'MM/DD/YYYY',
558        LL: 'MMMM D, YYYY',
559        LLL: 'MMMM D, YYYY h:mm A',
560        LLLL: 'dddd, MMMM D, YYYY h:mm A',
561    };
562
563    function longDateFormat(key) {
564        var format = this._longDateFormat[key],
565            formatUpper = this._longDateFormat[key.toUpperCase()];
566
567        if (format || !formatUpper) {
568            return format;
569        }
570
571        this._longDateFormat[key] = formatUpper
572            .match(formattingTokens)
573            .map(function (tok) {
574                if (
575                    tok === 'MMMM' ||
576                    tok === 'MM' ||
577                    tok === 'DD' ||
578                    tok === 'dddd'
579                ) {
580                    return tok.slice(1);
581                }
582                return tok;
583            })
584            .join('');
585
586        return this._longDateFormat[key];
587    }
588
589    var defaultInvalidDate = 'Invalid date';
590
vendor: 19,246 bytes, lines 591-1229
591    function invalidDate() {
592        return this._invalidDate;
593    }
594
595    var defaultOrdinal = '%d',
596        defaultDayOfMonthOrdinalParse = /\d{1,2}/;
597
598    function ordinal(number) {
599        return this._ordinal.replace('%d', number);
600    }
601
602    var defaultRelativeTime = {
603        future: 'in %s',
604        past: '%s ago',
605        s: 'a few seconds',
606        ss: '%d seconds',
607        m: 'a minute',
608        mm: '%d minutes',
609        h: 'an hour',
610        hh: '%d hours',
611        d: 'a day',
612        dd: '%d days',
613        w: 'a week',
614        ww: '%d weeks',
615        M: 'a month',
616        MM: '%d months',
617        y: 'a year',
618        yy: '%d years',
619    };
620
621    function relativeTime(number, withoutSuffix, string, isFuture) {
622        var output = this._relativeTime[string];
623        return isFunction(output)
624            ? output(number, withoutSuffix, string, isFuture)
625            : output.replace(/%d/i, number);
626    }
627
628    function pastFuture(diff, output) {
629        var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
630        return isFunction(format) ? format(output) : format.replace(/%s/i, output);
631    }
632
633    var aliases = {
634        D: 'date',
635        dates: 'date',
636        date: 'date',
637        d: 'day',
638        days: 'day',
639        day: 'day',
640        e: 'weekday',
641        weekdays: 'weekday',
642        weekday: 'weekday',
643        E: 'isoWeekday',
644        isoweekdays: 'isoWeekday',
645        isoweekday: 'isoWeekday',
646        DDD: 'dayOfYear',
647        dayofyears: 'dayOfYear',
648        dayofyear: 'dayOfYear',
649        h: 'hour',
650        hours: 'hour',
651        hour: 'hour',
652        ms: 'millisecond',
653        milliseconds: 'millisecond',
654        millisecond: 'millisecond',
655        m: 'minute',
656        minutes: 'minute',
657        minute: 'minute',
658        M: 'month',
659        months: 'month',
660        month: 'month',
661        Q: 'quarter',
662        quarters: 'quarter',
663        quarter: 'quarter',
664        s: 'second',
665        seconds: 'second',
666        second: 'second',
667        gg: 'weekYear',
668        weekyears: 'weekYear',
669        weekyear: 'weekYear',
670        GG: 'isoWeekYear',
671        isoweekyears: 'isoWeekYear',
672        isoweekyear: 'isoWeekYear',
673        w: 'week',
674        weeks: 'week',
675        week: 'week',
676        W: 'isoWeek',
677        isoweeks: 'isoWeek',
678        isoweek: 'isoWeek',
679        y: 'year',
680        years: 'year',
681        year: 'year',
682    };
683
684    function normalizeUnits(units) {
685        return typeof units === 'string'
686            ? aliases[units] || aliases[units.toLowerCase()]
687            : undefined;
688    }
689
690    function normalizeObjectUnits(inputObject) {
691        var normalizedInput = {},
692            normalizedProp,
693            prop;
694
695        for (prop in inputObject) {
696            if (hasOwnProp(inputObject, prop)) {
697                normalizedProp = normalizeUnits(prop);
698                if (normalizedProp) {
699                    normalizedInput[normalizedProp] = inputObject[prop];
700                }
701            }
702        }
703
704        return normalizedInput;
705    }
706
707    var priorities = {
708        date: 9,
709        day: 11,
710        weekday: 11,
711        isoWeekday: 11,
712        dayOfYear: 4,
713        hour: 13,
714        millisecond: 16,
715        minute: 14,
716        month: 8,
717        quarter: 7,
718        second: 15,
719        weekYear: 1,
720        isoWeekYear: 1,
721        week: 5,
722        isoWeek: 5,
723        year: 1,
724    };
725
726    function getPrioritizedUnits(unitsObj) {
727        var units = [],
728            u;
729        for (u in unitsObj) {
730            if (hasOwnProp(unitsObj, u)) {
731                units.push({ unit: u, priority: priorities[u] });
732            }
733        }
734        units.sort(function (a, b) {
735            return a.priority - b.priority;
736        });
737        return units;
738    }
739
740    var match1 = /\d/, //       0 - 9
741        match2 = /\d\d/, //      00 - 99
742        match3 = /\d{3}/, //     000 - 999
743        match4 = /\d{4}/, //    0000 - 9999
744        match6 = /[+-]?\d{6}/, // -999999 - 999999
745        match1to2 = /\d\d?/, //       0 - 99
746        match3to4 = /\d\d\d\d?/, //     999 - 9999
747        match5to6 = /\d\d\d\d\d\d?/, //   99999 - 999999
748        match1to3 = /\d{1,3}/, //       0 - 999
749        match1to4 = /\d{1,4}/, //       0 - 9999
750        match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
751        matchUnsigned = /\d+/, //       0 - inf
752        matchSigned = /[+-]?\d+/, //    -inf - inf
753        matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
754        matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
755        matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
756        // any word (or two) characters or numbers including two/three word month in arabic.
757        // includes scottish gaelic two word and hyphenated months
758        matchWord =
759            /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
760        match1to2NoLeadingZero = /^[1-9]\d?/, //         1-99
761        match1to2HasZero = /^([1-9]\d|\d)/, //           0-99
762        regexes;
763
764    regexes = {};
765
766    function addRegexToken(token, regex, strictRegex) {
767        regexes[token] = isFunction(regex)
768            ? regex
769            : function (isStrict, localeData) {
770                  return isStrict && strictRegex ? strictRegex : regex;
771              };
772    }
773
774    function getParseRegexForToken(token, config) {
775        if (!hasOwnProp(regexes, token)) {
776            return new RegExp(unescapeFormat(token));
777        }
778
779        return regexes[token](config._strict, config._locale);
780    }
781
782    // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
783    function unescapeFormat(s) {
784        return regexEscape(
785            s
786                .replace('\\', '')
787                .replace(
788                    /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
789                    function (matched, p1, p2, p3, p4) {
790                        return p1 || p2 || p3 || p4;
791                    }
792                )
793        );
794    }
795
796    function regexEscape(s) {
797        return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
798    }
799
800    function absFloor(number) {
801        if (number < 0) {
802            // -0 -> 0
803            return Math.ceil(number) || 0;
804        } else {
805            return Math.floor(number);
806        }
807    }
808
809    function toInt(argumentForCoercion) {
810        var coercedNumber = +argumentForCoercion,
811            value = 0;
812
813        if (coercedNumber !== 0 && isFinite(coercedNumber)) {
814            value = absFloor(coercedNumber);
815        }
816
817        return value;
818    }
819
820    var tokens = {};
821
822    function addParseToken(token, callback) {
823        var i,
824            func = callback,
825            tokenLen;
826        if (typeof token === 'string') {
827            token = [token];
828        }
829        if (isNumber(callback)) {
830            func = function (input, array) {
831                array[callback] = toInt(input);
832            };
833        }
834        tokenLen = token.length;
835        for (i = 0; i < tokenLen; i++) {
836            tokens[token[i]] = func;
837        }
838    }
839
840    function addWeekParseToken(token, callback) {
841        addParseToken(token, function (input, array, config, token) {
842            config._w = config._w || {};
843            callback(input, config._w, config, token);
844        });
845    }
846
847    function addTimeToArrayFromToken(token, input, config) {
848        if (input != null && hasOwnProp(tokens, token)) {
849            tokens[token](input, config._a, config, token);
850        }
851    }
852
853    function isLeapYear(year) {
854        return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
855    }
856
857    var YEAR = 0,
858        MONTH = 1,
859        DATE = 2,
860        HOUR = 3,
861        MINUTE = 4,
862        SECOND = 5,
863        MILLISECOND = 6,
864        WEEK = 7,
865        WEEKDAY = 8;
866
867    // FORMATTING
868
869    addFormatToken('Y', 0, 0, function () {
870        var y = this.year();
871        return y <= 9999 ? zeroFill(y, 4) : '+' + y;
872    });
873
874    addFormatToken(0, ['YY', 2], 0, function () {
875        return this.year() % 100;
876    });
877
878    addFormatToken(0, ['YYYY', 4], 0, 'year');
879    addFormatToken(0, ['YYYYY', 5], 0, 'year');
880    addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
881
882    // PARSING
883
884    addRegexToken('Y', matchSigned);
885    addRegexToken('YY', match1to2, match2);
886    addRegexToken('YYYY', match1to4, match4);
887    addRegexToken('YYYYY', match1to6, match6);
888    addRegexToken('YYYYYY', match1to6, match6);
889
890    addParseToken(['YYYYY', 'YYYYYY'], YEAR);
891    addParseToken('YYYY', function (input, array) {
892        array[YEAR] =
893            input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
894    });
895    addParseToken('YY', function (input, array) {
896        array[YEAR] = hooks.parseTwoDigitYear(input);
897    });
898    addParseToken('Y', function (input, array) {
899        array[YEAR] = parseInt(input, 10);
900    });
901
902    // HELPERS
903
904    function daysInYear(year) {
905        return isLeapYear(year) ? 366 : 365;
906    }
907
908    // HOOKS
909
910    hooks.parseTwoDigitYear = function (input) {
911        return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
912    };
913
914    // MOMENTS
915
916    var getSetYear = makeGetSet('FullYear', true);
917
918    function getIsLeapYear() {
919        return isLeapYear(this.year());
920    }
921
922    function makeGetSet(unit, keepTime) {
923        return function (value) {
924            if (value != null) {
925                set$1(this, unit, value);
926                hooks.updateOffset(this, keepTime);
927                return this;
928            } else {
929                return get(this, unit);
930            }
931        };
932    }
933
934    function get(mom, unit) {
935        if (!mom.isValid()) {
936            return NaN;
937        }
938
939        var d = mom._d,
940            isUTC = mom._isUTC;
941
942        switch (unit) {
943            case 'Milliseconds':
944                return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds();
945            case 'Seconds':
946                return isUTC ? d.getUTCSeconds() : d.getSeconds();
947            case 'Minutes':
948                return isUTC ? d.getUTCMinutes() : d.getMinutes();
949            case 'Hours':
950                return isUTC ? d.getUTCHours() : d.getHours();
951            case 'Date':
952                return isUTC ? d.getUTCDate() : d.getDate();
953            case 'Day':
954                return isUTC ? d.getUTCDay() : d.getDay();
955            case 'Month':
956                return isUTC ? d.getUTCMonth() : d.getMonth();
957            case 'FullYear':
958                return isUTC ? d.getUTCFullYear() : d.getFullYear();
959            default:
960                return NaN; // Just in case
961        }
962    }
963
964    function set$1(mom, unit, value) {
965        var d, isUTC, year, month, date;
966
967        if (!mom.isValid() || isNaN(value)) {
968            return;
969        }
970
971        d = mom._d;
972        isUTC = mom._isUTC;
973
974        switch (unit) {
975            case 'Milliseconds':
976                return void (isUTC
977                    ? d.setUTCMilliseconds(value)
978                    : d.setMilliseconds(value));
979            case 'Seconds':
980                return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value));
981            case 'Minutes':
982                return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value));
983            case 'Hours':
984                return void (isUTC ? d.setUTCHours(value) : d.setHours(value));
985            case 'Date':
986                return void (isUTC ? d.setUTCDate(value) : d.setDate(value));
987            // case 'Day': // Not real
988            //    return void (isUTC ? d.setUTCDay(value) : d.setDay(value));
989            // case 'Month': // Not used because we need to pass two variables
990            //     return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value));
991            case 'FullYear':
992                break; // See below ...
993            default:
994                return; // Just in case
995        }
996
997        year = value;
998        month = mom.month();
999        date = mom.date();
1000        date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;
1001        void (isUTC
1002            ? d.setUTCFullYear(year, month, date)
1003            : d.setFullYear(year, month, date));
1004    }
1005
1006    // MOMENTS
1007
1008    function stringGet(units) {
1009        units = normalizeUnits(units);
1010        if (isFunction(this[units])) {
1011            return this[units]();
1012        }
1013        return this;
1014    }
1015
1016    function stringSet(units, value) {
1017        if (typeof units === 'object') {
1018            units = normalizeObjectUnits(units);
1019            var prioritized = getPrioritizedUnits(units),
1020                i,
1021                prioritizedLen = prioritized.length;
1022            for (i = 0; i < prioritizedLen; i++) {
1023                this[prioritized[i].unit](units[prioritized[i].unit]);
1024            }
1025        } else {
1026            units = normalizeUnits(units);
1027            if (isFunction(this[units])) {
1028                return this[units](value);
1029            }
1030        }
1031        return this;
1032    }
1033
1034    function mod(n, x) {
1035        return ((n % x) + x) % x;
1036    }
1037
1038    var indexOf;
1039
1040    if (Array.prototype.indexOf) {
1041        indexOf = Array.prototype.indexOf;
1042    } else {
1043        indexOf = function (o) {
1044            // I know
1045            var i;
1046            for (i = 0; i < this.length; ++i) {
1047                if (this[i] === o) {
1048                    return i;
1049                }
1050            }
1051            return -1;
1052        };
1053    }
1054
1055    function daysInMonth(year, month) {
1056        if (isNaN(year) || isNaN(month)) {
1057            return NaN;
1058        }
1059        var modMonth = mod(month, 12);
1060        year += (month - modMonth) / 12;
1061        return modMonth === 1
1062            ? isLeapYear(year)
1063                ? 29
1064                : 28
1065            : 31 - ((modMonth % 7) % 2);
1066    }
1067
1068    // FORMATTING
1069
1070    addFormatToken('M', ['MM', 2], 'Mo', function () {
1071        return this.month() + 1;
1072    });
1073
1074    addFormatToken('MMM', 0, 0, function (format) {
1075        return this.localeData().monthsShort(this, format);
1076    });
1077
1078    addFormatToken('MMMM', 0, 0, function (format) {
1079        return this.localeData().months(this, format);
1080    });
1081
1082    // PARSING
1083
1084    addRegexToken('M', match1to2, match1to2NoLeadingZero);
1085    addRegexToken('MM', match1to2, match2);
1086    addRegexToken('MMM', function (isStrict, locale) {
1087        return locale.monthsShortRegex(isStrict);
1088    });
1089    addRegexToken('MMMM', function (isStrict, locale) {
1090        return locale.monthsRegex(isStrict);
1091    });
1092
1093    addParseToken(['M', 'MM'], function (input, array) {
1094        array[MONTH] = toInt(input) - 1;
1095    });
1096
1097    addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
1098        var month = config._locale.monthsParse(input, token, config._strict);
1099        // if we didn't find a month name, mark the date as invalid.
1100        if (month != null) {
1101            array[MONTH] = month;
1102        } else {
1103            getParsingFlags(config).invalidMonth = input;
1104        }
1105    });
1106
1107    // LOCALES
1108
1109    var defaultLocaleMonths =
1110            'January_February_March_April_May_June_July_August_September_October_November_December'.split(
1111                '_'
1112            ),
1113        defaultLocaleMonthsShort =
1114            'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
1115        MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
1116        defaultMonthsShortRegex = matchWord,
1117        defaultMonthsRegex = matchWord;
1118
1119    function localeMonths(m, format) {
1120        if (!m) {
1121            return isArray(this._months)
1122                ? this._months
1123                : this._months['standalone'];
1124        }
1125        return isArray(this._months)
1126            ? this._months[m.month()]
1127            : this._months[
1128                  (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
1129                      ? 'format'
1130                      : 'standalone'
1131              ][m.month()];
1132    }
1133
1134    function localeMonthsShort(m, format) {
1135        if (!m) {
1136            return isArray(this._monthsShort)
1137                ? this._monthsShort
1138                : this._monthsShort['standalone'];
1139        }
1140        return isArray(this._monthsShort)
1141            ? this._monthsShort[m.month()]
1142            : this._monthsShort[
1143                  MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
1144              ][m.month()];
1145    }
1146
1147    function handleStrictParse(monthName, format, strict) {
1148        var i,
1149            ii,
1150            mom,
1151            llc = monthName.toLocaleLowerCase();
1152        if (!this._monthsParse) {
1153            // this is not used
1154            this._monthsParse = [];
1155            this._longMonthsParse = [];
1156            this._shortMonthsParse = [];
1157            for (i = 0; i < 12; ++i) {
1158                mom = createUTC([2000, i]);
1159                this._shortMonthsParse[i] = this.monthsShort(
1160                    mom,
1161                    ''
1162                ).toLocaleLowerCase();
1163                this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
1164            }
1165        }
1166
1167        if (strict) {
1168            if (format === 'MMM') {
1169                ii = indexOf.call(this._shortMonthsParse, llc);
1170                return ii !== -1 ? ii : null;
1171            } else {
1172                ii = indexOf.call(this._longMonthsParse, llc);
1173                return ii !== -1 ? ii : null;
1174            }
1175        } else {
1176            if (format === 'MMM') {
1177                ii = indexOf.call(this._shortMonthsParse, llc);
1178                if (ii !== -1) {
1179                    return ii;
1180                }
1181                ii = indexOf.call(this._longMonthsParse, llc);
1182                return ii !== -1 ? ii : null;
1183            } else {
1184                ii = indexOf.call(this._longMonthsParse, llc);
1185                if (ii !== -1) {
1186                    return ii;
1187                }
1188                ii = indexOf.call(this._shortMonthsParse, llc);
1189                return ii !== -1 ? ii : null;
1190            }
1191        }
1192    }
1193
1194    function localeMonthsParse(monthName, format, strict) {
1195        var i, mom, regex;
1196
1197        if (this._monthsParseExact) {
1198            return handleStrictParse.call(this, monthName, format, strict);
1199        }
1200
1201        if (!this._monthsParse) {
1202            this._monthsParse = [];
1203            this._longMonthsParse = [];
1204            this._shortMonthsParse = [];
1205        }
1206
1207        // TODO: add sorting
1208        // Sorting makes sure if one month (or abbr) is a prefix of another
1209        // see sorting in computeMonthsParse
1210        for (i = 0; i < 12; i++) {
1211            // make the regex if we don't have it already
1212            mom = createUTC([2000, i]);
1213            if (strict && !this._longMonthsParse[i]) {
1214                this._longMonthsParse[i] = new RegExp(
1215                    '^' + this.months(mom, '').replace('.', '') + '$',
1216                    'i'
1217                );
1218                this._shortMonthsParse[i] = new RegExp(
1219                    '^' + this.monthsShort(mom, '').replace('.', '') + '$',
1220                    'i'
1221                );
1222            }
1223            if (!strict && !this._monthsParse[i]) {
1224                regex =
1225                    '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
1226                this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
1227            }
1228            // test the regex
1229            if (
vendor: 5,127 bytes, lines 1230-1395
1230                strict &&
1231                format === 'MMMM' &&
1232                this._longMonthsParse[i].test(monthName)
1233            ) {
1234                return i;
1235            } else if (
1236                strict &&
1237                format === 'MMM' &&
1238                this._shortMonthsParse[i].test(monthName)
1239            ) {
1240                return i;
1241            } else if (!strict && this._monthsParse[i].test(monthName)) {
1242                return i;
1243            }
1244        }
1245    }
1246
1247    // MOMENTS
1248
1249    function setMonth(mom, value) {
1250        if (!mom.isValid()) {
1251            // No op
1252            return mom;
1253        }
1254
1255        if (typeof value === 'string') {
1256            if (/^\d+$/.test(value)) {
1257                value = toInt(value);
1258            } else {
1259                value = mom.localeData().monthsParse(value);
1260                // TODO: Another silent failure?
1261                if (!isNumber(value)) {
1262                    return mom;
1263                }
1264            }
1265        }
1266
1267        var month = value,
1268            date = mom.date();
1269
1270        date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));
1271        void (mom._isUTC
1272            ? mom._d.setUTCMonth(month, date)
1273            : mom._d.setMonth(month, date));
1274        return mom;
1275    }
1276
1277    function getSetMonth(value) {
1278        if (value != null) {
1279            setMonth(this, value);
1280            hooks.updateOffset(this, true);
1281            return this;
1282        } else {
1283            return get(this, 'Month');
1284        }
1285    }
1286
1287    function getDaysInMonth() {
1288        return daysInMonth(this.year(), this.month());
1289    }
1290
1291    function monthsShortRegex(isStrict) {
1292        if (this._monthsParseExact) {
1293            if (!hasOwnProp(this, '_monthsRegex')) {
1294                computeMonthsParse.call(this);
1295            }
1296            if (isStrict) {
1297                return this._monthsShortStrictRegex;
1298            } else {
1299                return this._monthsShortRegex;
1300            }
1301        } else {
1302            if (!hasOwnProp(this, '_monthsShortRegex')) {
1303                this._monthsShortRegex = defaultMonthsShortRegex;
1304            }
1305            return this._monthsShortStrictRegex && isStrict
1306                ? this._monthsShortStrictRegex
1307                : this._monthsShortRegex;
1308        }
1309    }
1310
1311    function monthsRegex(isStrict) {
1312        if (this._monthsParseExact) {
1313            if (!hasOwnProp(this, '_monthsRegex')) {
1314                computeMonthsParse.call(this);
1315            }
1316            if (isStrict) {
1317                return this._monthsStrictRegex;
1318            } else {
1319                return this._monthsRegex;
1320            }
1321        } else {
1322            if (!hasOwnProp(this, '_monthsRegex')) {
1323                this._monthsRegex = defaultMonthsRegex;
1324            }
1325            return this._monthsStrictRegex && isStrict
1326                ? this._monthsStrictRegex
1327                : this._monthsRegex;
1328        }
1329    }
1330
1331    function computeMonthsParse() {
1332        function cmpLenRev(a, b) {
1333            return b.length - a.length;
1334        }
1335
1336        var shortPieces = [],
1337            longPieces = [],
1338            mixedPieces = [],
1339            i,
1340            mom,
1341            shortP,
1342            longP;
1343        for (i = 0; i < 12; i++) {
1344            // make the regex if we don't have it already
1345            mom = createUTC([2000, i]);
1346            shortP = regexEscape(this.monthsShort(mom, ''));
1347            longP = regexEscape(this.months(mom, ''));
1348            shortPieces.push(shortP);
1349            longPieces.push(longP);
1350            mixedPieces.push(longP);
1351            mixedPieces.push(shortP);
1352        }
1353        // Sorting makes sure if one month (or abbr) is a prefix of another it
1354        // will match the longer piece.
1355        shortPieces.sort(cmpLenRev);
1356        longPieces.sort(cmpLenRev);
1357        mixedPieces.sort(cmpLenRev);
1358
1359        this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
1360        this._monthsShortRegex = this._monthsRegex;
1361        this._monthsStrictRegex = new RegExp(
1362            '^(' + longPieces.join('|') + ')',
1363            'i'
1364        );
1365        this._monthsShortStrictRegex = new RegExp(
1366            '^(' + shortPieces.join('|') + ')',
1367            'i'
1368        );
1369    }
1370
1371    function createDate(y, m, d, h, M, s, ms) {
1372        // can't just apply() to create a date:
1373        // https://stackoverflow.com/q/181348
1374        var date;
1375        // the date constructor remaps years 0-99 to 1900-1999
1376        if (y < 100 && y >= 0) {
1377            // preserve leap years using a full 400 year cycle, then reset
1378            date = new Date(y + 400, m, d, h, M, s, ms);
1379            if (isFinite(date.getFullYear())) {
1380                date.setFullYear(y);
1381            }
1382        } else {
1383            date = new Date(y, m, d, h, M, s, ms);
1384        }
1385
1386        return date;
1387    }
1388
1389    function createUTCDate(y) {
1390        var date, args;
1391        // the Date.UTC function remaps years 0-99 to 1900-1999
1392        if (y < 100 && y >= 0) {
1393            args = Array.prototype.slice.call(arguments);
1394            // preserve leap years using a full 400 year cycle, then reset
1395            args[0] = y + 400;
vendor: 11,578 bytes, lines 1396-1757
1396            date = new Date(Date.UTC.apply(null, args));
1397            if (isFinite(date.getUTCFullYear())) {
1398                date.setUTCFullYear(y);
1399            }
1400        } else {
1401            date = new Date(Date.UTC.apply(null, arguments));
1402        }
1403
1404        return date;
1405    }
1406
1407    // start-of-first-week - start-of-year
1408    function firstWeekOffset(year, dow, doy) {
1409        var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
1410            fwd = 7 + dow - doy,
1411            // first-week day local weekday -- which local weekday is fwd
1412            fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
1413
1414        return -fwdlw + fwd - 1;
1415    }
1416
1417    // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
1418    function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
1419        var localWeekday = (7 + weekday - dow) % 7,
1420            weekOffset = firstWeekOffset(year, dow, doy),
1421            dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
1422            resYear,
1423            resDayOfYear;
1424
1425        if (dayOfYear <= 0) {
1426            resYear = year - 1;
1427            resDayOfYear = daysInYear(resYear) + dayOfYear;
1428        } else if (dayOfYear > daysInYear(year)) {
1429            resYear = year + 1;
1430            resDayOfYear = dayOfYear - daysInYear(year);
1431        } else {
1432            resYear = year;
1433            resDayOfYear = dayOfYear;
1434        }
1435
1436        return {
1437            year: resYear,
1438            dayOfYear: resDayOfYear,
1439        };
1440    }
1441
1442    function weekOfYear(mom, dow, doy) {
1443        var weekOffset = firstWeekOffset(mom.year(), dow, doy),
1444            week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
1445            resWeek,
1446            resYear;
1447
1448        if (week < 1) {
1449            resYear = mom.year() - 1;
1450            resWeek = week + weeksInYear(resYear, dow, doy);
1451        } else if (week > weeksInYear(mom.year(), dow, doy)) {
1452            resWeek = week - weeksInYear(mom.year(), dow, doy);
1453            resYear = mom.year() + 1;
1454        } else {
1455            resYear = mom.year();
1456            resWeek = week;
1457        }
1458
1459        return {
1460            week: resWeek,
1461            year: resYear,
1462        };
1463    }
1464
1465    function weeksInYear(year, dow, doy) {
1466        var weekOffset = firstWeekOffset(year, dow, doy),
1467            weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
1468        return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
1469    }
1470
1471    // FORMATTING
1472
1473    addFormatToken('w', ['ww', 2], 'wo', 'week');
1474    addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
1475
1476    // PARSING
1477
1478    addRegexToken('w', match1to2, match1to2NoLeadingZero);
1479    addRegexToken('ww', match1to2, match2);
1480    addRegexToken('W', match1to2, match1to2NoLeadingZero);
1481    addRegexToken('WW', match1to2, match2);
1482
1483    addWeekParseToken(
1484        ['w', 'ww', 'W', 'WW'],
1485        function (input, week, config, token) {
1486            week[token.substr(0, 1)] = toInt(input);
1487        }
1488    );
1489
1490    // HELPERS
1491
1492    // LOCALES
1493
1494    function localeWeek(mom) {
1495        return weekOfYear(mom, this._week.dow, this._week.doy).week;
1496    }
1497
1498    var defaultLocaleWeek = {
1499        dow: 0, // Sunday is the first day of the week.
1500        doy: 6, // The week that contains Jan 6th is the first week of the year.
1501    };
1502
1503    function localeFirstDayOfWeek() {
1504        return this._week.dow;
1505    }
1506
1507    function localeFirstDayOfYear() {
1508        return this._week.doy;
1509    }
1510
1511    // MOMENTS
1512
1513    function getSetWeek(input) {
1514        var week = this.localeData().week(this);
1515        return input == null ? week : this.add((input - week) * 7, 'd');
1516    }
1517
1518    function getSetISOWeek(input) {
1519        var week = weekOfYear(this, 1, 4).week;
1520        return input == null ? week : this.add((input - week) * 7, 'd');
1521    }
1522
1523    // FORMATTING
1524
1525    addFormatToken('d', 0, 'do', 'day');
1526
1527    addFormatToken('dd', 0, 0, function (format) {
1528        return this.localeData().weekdaysMin(this, format);
1529    });
1530
1531    addFormatToken('ddd', 0, 0, function (format) {
1532        return this.localeData().weekdaysShort(this, format);
1533    });
1534
1535    addFormatToken('dddd', 0, 0, function (format) {
1536        return this.localeData().weekdays(this, format);
1537    });
1538
1539    addFormatToken('e', 0, 0, 'weekday');
1540    addFormatToken('E', 0, 0, 'isoWeekday');
1541
1542    // PARSING
1543
1544    addRegexToken('d', match1to2);
1545    addRegexToken('e', match1to2);
1546    addRegexToken('E', match1to2);
1547    addRegexToken('dd', function (isStrict, locale) {
1548        return locale.weekdaysMinRegex(isStrict);
1549    });
1550    addRegexToken('ddd', function (isStrict, locale) {
1551        return locale.weekdaysShortRegex(isStrict);
1552    });
1553    addRegexToken('dddd', function (isStrict, locale) {
1554        return locale.weekdaysRegex(isStrict);
1555    });
1556
1557    addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
1558        var weekday = config._locale.weekdaysParse(input, token, config._strict);
1559        // if we didn't get a weekday name, mark the date as invalid
1560        if (weekday != null) {
1561            week.d = weekday;
1562        } else {
1563            getParsingFlags(config).invalidWeekday = input;
1564        }
1565    });
1566
1567    addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
1568        week[token] = toInt(input);
1569    });
1570
1571    // HELPERS
1572
1573    function parseWeekday(input, locale) {
1574        if (typeof input !== 'string') {
1575            return input;
1576        }
1577
1578        if (!isNaN(input)) {
1579            return parseInt(input, 10);
1580        }
1581
1582        input = locale.weekdaysParse(input);
1583        if (typeof input === 'number') {
1584            return input;
1585        }
1586
1587        return null;
1588    }
1589
1590    function parseIsoWeekday(input, locale) {
1591        if (typeof input === 'string') {
1592            return locale.weekdaysParse(input) % 7 || 7;
1593        }
1594        return isNaN(input) ? null : input;
1595    }
1596
1597    // LOCALES
1598    function shiftWeekdays(ws, n) {
1599        return ws.slice(n, 7).concat(ws.slice(0, n));
1600    }
1601
1602    var defaultLocaleWeekdays =
1603            'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
1604        defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
1605        defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
1606        defaultWeekdaysRegex = matchWord,
1607        defaultWeekdaysShortRegex = matchWord,
1608        defaultWeekdaysMinRegex = matchWord;
1609
1610    function localeWeekdays(m, format) {
1611        var weekdays = isArray(this._weekdays)
1612            ? this._weekdays
1613            : this._weekdays[
1614                  m && m !== true && this._weekdays.isFormat.test(format)
1615                      ? 'format'
1616                      : 'standalone'
1617              ];
1618        return m === true
1619            ? shiftWeekdays(weekdays, this._week.dow)
1620            : m
1621              ? weekdays[m.day()]
1622              : weekdays;
1623    }
1624
1625    function localeWeekdaysShort(m) {
1626        return m === true
1627            ? shiftWeekdays(this._weekdaysShort, this._week.dow)
1628            : m
1629              ? this._weekdaysShort[m.day()]
1630              : this._weekdaysShort;
1631    }
1632
1633    function localeWeekdaysMin(m) {
1634        return m === true
1635            ? shiftWeekdays(this._weekdaysMin, this._week.dow)
1636            : m
1637              ? this._weekdaysMin[m.day()]
1638              : this._weekdaysMin;
1639    }
1640
1641    function handleStrictParse$1(weekdayName, format, strict) {
1642        var i,
1643            ii,
1644            mom,
1645            llc = weekdayName.toLocaleLowerCase();
1646        if (!this._weekdaysParse) {
1647            this._weekdaysParse = [];
1648            this._shortWeekdaysParse = [];
1649            this._minWeekdaysParse = [];
1650
1651            for (i = 0; i < 7; ++i) {
1652                mom = createUTC([2000, 1]).day(i);
1653                this._minWeekdaysParse[i] = this.weekdaysMin(
1654                    mom,
1655                    ''
1656                ).toLocaleLowerCase();
1657                this._shortWeekdaysParse[i] = this.weekdaysShort(
1658                    mom,
1659                    ''
1660                ).toLocaleLowerCase();
1661                this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
1662            }
1663        }
1664
1665        if (strict) {
1666            if (format === 'dddd') {
1667                ii = indexOf.call(this._weekdaysParse, llc);
1668                return ii !== -1 ? ii : null;
1669            } else if (format === 'ddd') {
1670                ii = indexOf.call(this._shortWeekdaysParse, llc);
1671                return ii !== -1 ? ii : null;
1672            } else {
1673                ii = indexOf.call(this._minWeekdaysParse, llc);
1674                return ii !== -1 ? ii : null;
1675            }
1676        } else {
1677            if (format === 'dddd') {
1678                ii = indexOf.call(this._weekdaysParse, llc);
1679                if (ii !== -1) {
1680                    return ii;
1681                }
1682                ii = indexOf.call(this._shortWeekdaysParse, llc);
1683                if (ii !== -1) {
1684                    return ii;
1685                }
1686                ii = indexOf.call(this._minWeekdaysParse, llc);
1687                return ii !== -1 ? ii : null;
1688            } else if (format === 'ddd') {
1689                ii = indexOf.call(this._shortWeekdaysParse, llc);
1690                if (ii !== -1) {
1691                    return ii;
1692                }
1693                ii = indexOf.call(this._weekdaysParse, llc);
1694                if (ii !== -1) {
1695                    return ii;
1696                }
1697                ii = indexOf.call(this._minWeekdaysParse, llc);
1698                return ii !== -1 ? ii : null;
1699            } else {
1700                ii = indexOf.call(this._minWeekdaysParse, llc);
1701                if (ii !== -1) {
1702                    return ii;
1703                }
1704                ii = indexOf.call(this._weekdaysParse, llc);
1705                if (ii !== -1) {
1706                    return ii;
1707                }
1708                ii = indexOf.call(this._shortWeekdaysParse, llc);
1709                return ii !== -1 ? ii : null;
1710            }
1711        }
1712    }
1713
1714    function localeWeekdaysParse(weekdayName, format, strict) {
1715        var i, mom, regex;
1716
1717        if (this._weekdaysParseExact) {
1718            return handleStrictParse$1.call(this, weekdayName, format, strict);
1719        }
1720
1721        if (!this._weekdaysParse) {
1722            this._weekdaysParse = [];
1723            this._minWeekdaysParse = [];
1724            this._shortWeekdaysParse = [];
1725            this._fullWeekdaysParse = [];
1726        }
1727
1728        for (i = 0; i < 7; i++) {
1729            // make the regex if we don't have it already
1730
1731            mom = createUTC([2000, 1]).day(i);
1732            if (strict && !this._fullWeekdaysParse[i]) {
1733                this._fullWeekdaysParse[i] = new RegExp(
1734                    '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
1735                    'i'
1736                );
1737                this._shortWeekdaysParse[i] = new RegExp(
1738                    '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
1739                    'i'
1740                );
1741                this._minWeekdaysParse[i] = new RegExp(
1742                    '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
1743                    'i'
1744                );
1745            }
1746            if (!this._weekdaysParse[i]) {
1747                regex =
1748                    '^' +
1749                    this.weekdays(mom, '') +
1750                    '|^' +
1751                    this.weekdaysShort(mom, '') +
1752                    '|^' +
1753                    this.weekdaysMin(mom, '');
1754                this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
1755            }
1756            // test the regex
1757            if (
vendor: 9,327 bytes, lines 1758-2050
1758                strict &&
1759                format === 'dddd' &&
1760                this._fullWeekdaysParse[i].test(weekdayName)
1761            ) {
1762                return i;
1763            } else if (
1764                strict &&
1765                format === 'ddd' &&
1766                this._shortWeekdaysParse[i].test(weekdayName)
1767            ) {
1768                return i;
1769            } else if (
1770                strict &&
1771                format === 'dd' &&
1772                this._minWeekdaysParse[i].test(weekdayName)
1773            ) {
1774                return i;
1775            } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
1776                return i;
1777            }
1778        }
1779    }
1780
1781    // MOMENTS
1782
1783    function getSetDayOfWeek(input) {
1784        if (!this.isValid()) {
1785            return input != null ? this : NaN;
1786        }
1787
1788        var day = get(this, 'Day');
1789        if (input != null) {
1790            input = parseWeekday(input, this.localeData());
1791            return this.add(input - day, 'd');
1792        } else {
1793            return day;
1794        }
1795    }
1796
1797    function getSetLocaleDayOfWeek(input) {
1798        if (!this.isValid()) {
1799            return input != null ? this : NaN;
1800        }
1801        var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
1802        return input == null ? weekday : this.add(input - weekday, 'd');
1803    }
1804
1805    function getSetISODayOfWeek(input) {
1806        if (!this.isValid()) {
1807            return input != null ? this : NaN;
1808        }
1809
1810        // behaves the same as moment#day except
1811        // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
1812        // as a setter, sunday should belong to the previous week.
1813
1814        if (input != null) {
1815            var weekday = parseIsoWeekday(input, this.localeData());
1816            return this.day(this.day() % 7 ? weekday : weekday - 7);
1817        } else {
1818            return this.day() || 7;
1819        }
1820    }
1821
1822    function weekdaysRegex(isStrict) {
1823        if (this._weekdaysParseExact) {
1824            if (!hasOwnProp(this, '_weekdaysRegex')) {
1825                computeWeekdaysParse.call(this);
1826            }
1827            if (isStrict) {
1828                return this._weekdaysStrictRegex;
1829            } else {
1830                return this._weekdaysRegex;
1831            }
1832        } else {
1833            if (!hasOwnProp(this, '_weekdaysRegex')) {
1834                this._weekdaysRegex = defaultWeekdaysRegex;
1835            }
1836            return this._weekdaysStrictRegex && isStrict
1837                ? this._weekdaysStrictRegex
1838                : this._weekdaysRegex;
1839        }
1840    }
1841
1842    function weekdaysShortRegex(isStrict) {
1843        if (this._weekdaysParseExact) {
1844            if (!hasOwnProp(this, '_weekdaysRegex')) {
1845                computeWeekdaysParse.call(this);
1846            }
1847            if (isStrict) {
1848                return this._weekdaysShortStrictRegex;
1849            } else {
1850                return this._weekdaysShortRegex;
1851            }
1852        } else {
1853            if (!hasOwnProp(this, '_weekdaysShortRegex')) {
1854                this._weekdaysShortRegex = defaultWeekdaysShortRegex;
1855            }
1856            return this._weekdaysShortStrictRegex && isStrict
1857                ? this._weekdaysShortStrictRegex
1858                : this._weekdaysShortRegex;
1859        }
1860    }
1861
1862    function weekdaysMinRegex(isStrict) {
1863        if (this._weekdaysParseExact) {
1864            if (!hasOwnProp(this, '_weekdaysRegex')) {
1865                computeWeekdaysParse.call(this);
1866            }
1867            if (isStrict) {
1868                return this._weekdaysMinStrictRegex;
1869            } else {
1870                return this._weekdaysMinRegex;
1871            }
1872        } else {
1873            if (!hasOwnProp(this, '_weekdaysMinRegex')) {
1874                this._weekdaysMinRegex = defaultWeekdaysMinRegex;
1875            }
1876            return this._weekdaysMinStrictRegex && isStrict
1877                ? this._weekdaysMinStrictRegex
1878                : this._weekdaysMinRegex;
1879        }
1880    }
1881
1882    function computeWeekdaysParse() {
1883        function cmpLenRev(a, b) {
1884            return b.length - a.length;
1885        }
1886
1887        var minPieces = [],
1888            shortPieces = [],
1889            longPieces = [],
1890            mixedPieces = [],
1891            i,
1892            mom,
1893            minp,
1894            shortp,
1895            longp;
1896        for (i = 0; i < 7; i++) {
1897            // make the regex if we don't have it already
1898            mom = createUTC([2000, 1]).day(i);
1899            minp = regexEscape(this.weekdaysMin(mom, ''));
1900            shortp = regexEscape(this.weekdaysShort(mom, ''));
1901            longp = regexEscape(this.weekdays(mom, ''));
1902            minPieces.push(minp);
1903            shortPieces.push(shortp);
1904            longPieces.push(longp);
1905            mixedPieces.push(minp);
1906            mixedPieces.push(shortp);
1907            mixedPieces.push(longp);
1908        }
1909        // Sorting makes sure if one weekday (or abbr) is a prefix of another it
1910        // will match the longer piece.
1911        minPieces.sort(cmpLenRev);
1912        shortPieces.sort(cmpLenRev);
1913        longPieces.sort(cmpLenRev);
1914        mixedPieces.sort(cmpLenRev);
1915
1916        this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
1917        this._weekdaysShortRegex = this._weekdaysRegex;
1918        this._weekdaysMinRegex = this._weekdaysRegex;
1919
1920        this._weekdaysStrictRegex = new RegExp(
1921            '^(' + longPieces.join('|') + ')',
1922            'i'
1923        );
1924        this._weekdaysShortStrictRegex = new RegExp(
1925            '^(' + shortPieces.join('|') + ')',
1926            'i'
1927        );
1928        this._weekdaysMinStrictRegex = new RegExp(
1929            '^(' + minPieces.join('|') + ')',
1930            'i'
1931        );
1932    }
1933
1934    // FORMATTING
1935
1936    function hFormat() {
1937        return this.hours() % 12 || 12;
1938    }
1939
1940    function kFormat() {
1941        return this.hours() || 24;
1942    }
1943
1944    addFormatToken('H', ['HH', 2], 0, 'hour');
1945    addFormatToken('h', ['hh', 2], 0, hFormat);
1946    addFormatToken('k', ['kk', 2], 0, kFormat);
1947
1948    addFormatToken('hmm', 0, 0, function () {
1949        return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
1950    });
1951
1952    addFormatToken('hmmss', 0, 0, function () {
1953        return (
1954            '' +
1955            hFormat.apply(this) +
1956            zeroFill(this.minutes(), 2) +
1957            zeroFill(this.seconds(), 2)
1958        );
1959    });
1960
1961    addFormatToken('Hmm', 0, 0, function () {
1962        return '' + this.hours() + zeroFill(this.minutes(), 2);
1963    });
1964
1965    addFormatToken('Hmmss', 0, 0, function () {
1966        return (
1967            '' +
1968            this.hours() +
1969            zeroFill(this.minutes(), 2) +
1970            zeroFill(this.seconds(), 2)
1971        );
1972    });
1973
1974    function meridiem(token, lowercase) {
1975        addFormatToken(token, 0, 0, function () {
1976            return this.localeData().meridiem(
1977                this.hours(),
1978                this.minutes(),
1979                lowercase
1980            );
1981        });
1982    }
1983
1984    meridiem('a', true);
1985    meridiem('A', false);
1986
1987    // PARSING
1988
1989    function matchMeridiem(isStrict, locale) {
1990        return locale._meridiemParse;
1991    }
1992
1993    addRegexToken('a', matchMeridiem);
1994    addRegexToken('A', matchMeridiem);
1995    addRegexToken('H', match1to2, match1to2HasZero);
1996    addRegexToken('h', match1to2, match1to2NoLeadingZero);
1997    addRegexToken('k', match1to2, match1to2NoLeadingZero);
1998    addRegexToken('HH', match1to2, match2);
1999    addRegexToken('hh', match1to2, match2);
2000    addRegexToken('kk', match1to2, match2);
2001
2002    addRegexToken('hmm', match3to4);
2003    addRegexToken('hmmss', match5to6);
2004    addRegexToken('Hmm', match3to4);
2005    addRegexToken('Hmmss', match5to6);
2006
2007    addParseToken(['H', 'HH'], HOUR);
2008    addParseToken(['k', 'kk'], function (input, array, config) {
2009        var kInput = toInt(input);
2010        array[HOUR] = kInput === 24 ? 0 : kInput;
2011    });
2012    addParseToken(['a', 'A'], function (input, array, config) {
2013        config._isPm = config._locale.isPM(input);
2014        config._meridiem = input;
2015    });
2016    addParseToken(['h', 'hh'], function (input, array, config) {
2017        array[HOUR] = toInt(input);
2018        getParsingFlags(config).bigHour = true;
2019    });
2020    addParseToken('hmm', function (input, array, config) {
2021        var pos = input.length - 2;
2022        array[HOUR] = toInt(input.substr(0, pos));
2023        array[MINUTE] = toInt(input.substr(pos));
2024        getParsingFlags(config).bigHour = true;
2025    });
2026    addParseToken('hmmss', function (input, array, config) {
2027        var pos1 = input.length - 4,
2028            pos2 = input.length - 2;
2029        array[HOUR] = toInt(input.substr(0, pos1));
2030        array[MINUTE] = toInt(input.substr(pos1, 2));
2031        array[SECOND] = toInt(input.substr(pos2));
2032        getParsingFlags(config).bigHour = true;
2033    });
2034    addParseToken('Hmm', function (input, array, config) {
2035        var pos = input.length - 2;
2036        array[HOUR] = toInt(input.substr(0, pos));
2037        array[MINUTE] = toInt(input.substr(pos));
2038    });
2039    addParseToken('Hmmss', function (input, array, config) {
2040        var pos1 = input.length - 4,
2041            pos2 = input.length - 2;
2042        array[HOUR] = toInt(input.substr(0, pos1));
2043        array[MINUTE] = toInt(input.substr(pos1, 2));
2044        array[SECOND] = toInt(input.substr(pos2));
2045    });
2046
2047    // LOCALES
2048
2049    function localeIsPM(input) {
2050        // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing str
vendor: 7,803 bytes, lines 2050-2269
2050ings like arrays
2051        // Using charAt should be more compatible.
2052        return (input + '').toLowerCase().charAt(0) === 'p';
2053    }
2054
2055    var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
2056        // Setting the hour should keep the time, because the user explicitly
2057        // specified which hour they want. So trying to maintain the same hour (in
2058        // a new timezone) makes sense. Adding/subtracting hours does not follow
2059        // this rule.
2060        getSetHour = makeGetSet('Hours', true);
2061
2062    function localeMeridiem(hours, minutes, isLower) {
2063        if (hours > 11) {
2064            return isLower ? 'pm' : 'PM';
2065        } else {
2066            return isLower ? 'am' : 'AM';
2067        }
2068    }
2069
2070    var baseConfig = {
2071        calendar: defaultCalendar,
2072        longDateFormat: defaultLongDateFormat,
2073        invalidDate: defaultInvalidDate,
2074        ordinal: defaultOrdinal,
2075        dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
2076        relativeTime: defaultRelativeTime,
2077
2078        months: defaultLocaleMonths,
2079        monthsShort: defaultLocaleMonthsShort,
2080
2081        week: defaultLocaleWeek,
2082
2083        weekdays: defaultLocaleWeekdays,
2084        weekdaysMin: defaultLocaleWeekdaysMin,
2085        weekdaysShort: defaultLocaleWeekdaysShort,
2086
2087        meridiemParse: defaultLocaleMeridiemParse,
2088    };
2089
2090    // internal storage for locale config files
2091    var locales = {},
2092        localeFamilies = {},
2093        globalLocale;
2094
2095    function commonPrefix(arr1, arr2) {
2096        var i,
2097            minl = Math.min(arr1.length, arr2.length);
2098        for (i = 0; i < minl; i += 1) {
2099            if (arr1[i] !== arr2[i]) {
2100                return i;
2101            }
2102        }
2103        return minl;
2104    }
2105
2106    function normalizeLocale(key) {
2107        return key ? key.toLowerCase().replace('_', '-') : key;
2108    }
2109
2110    // pick the locale from the array
2111    // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
2112    // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
2113    function chooseLocale(names) {
2114        var i = 0,
2115            j,
2116            next,
2117            locale,
2118            split;
2119
2120        while (i < names.length) {
2121            split = normalizeLocale(names[i]).split('-');
2122            j = split.length;
2123            next = normalizeLocale(names[i + 1]);
2124            next = next ? next.split('-') : null;
2125            while (j > 0) {
2126                locale = loadLocale(split.slice(0, j).join('-'));
2127                if (locale) {
2128                    return locale;
2129                }
2130                if (
2131                    next &&
2132                    next.length >= j &&
2133                    commonPrefix(split, next) >= j - 1
2134                ) {
2135                    //the next array item is better than a shallower substring of this one
2136                    break;
2137                }
2138                j--;
2139            }
2140            i++;
2141        }
2142        return globalLocale;
2143    }
2144
2145    function isLocaleNameSane(name) {
2146        // Prevent names that look like filesystem paths, i.e contain '/' or '\'
2147        // Ensure name is available and function returns boolean
2148        return !!(name && name.match('^[^/\\\\]*$'));
2149    }
2150
2151    function loadLocale(name) {
2152        var oldLocale = null,
2153            aliasedRequire;
2154        // TODO: Find a better way to register and load all the locales in Node
2155        if (
2156            locales[name] === undefined &&
2157            typeof module !== 'undefined' &&
2158            module &&
2159            module.exports &&
2160            isLocaleNameSane(name)
2161        ) {
2162            try {
2163                oldLocale = globalLocale._abbr;
2164                aliasedRequire = require;
2165                aliasedRequire('./locale/' + name);
2166                getSetGlobalLocale(oldLocale);
2167            } catch (e) {
2168                // mark as not found to avoid repeating expensive file require call causing high CPU
2169                // when trying to find en-US, en_US, en-us for every format call
2170                locales[name] = null; // null means not found
2171            }
2172        }
2173        return locales[name];
2174    }
2175
2176    // This function will load locale and then set the global locale.  If
2177    // no arguments are passed in, it will simply return the current global
2178    // locale key.
2179    function getSetGlobalLocale(key, values) {
2180        var data;
2181        if (key) {
2182            if (isUndefined(values)) {
2183                data = getLocale(key);
2184            } else {
2185                data = defineLocale(key, values);
2186            }
2187
2188            if (data) {
2189                // moment.duration._locale = moment._locale = data;
2190                globalLocale = data;
2191            } else {
2192                if (typeof console !== 'undefined' && console.warn) {
2193                    //warn user if arguments are passed but the locale could not be set
2194                    console.warn(
2195                        'Locale ' + key + ' not found. Did you forget to load it?'
2196                    );
2197                }
2198            }
2199        }
2200
2201        return globalLocale._abbr;
2202    }
2203
2204    function defineLocale(name, config) {
2205        if (config !== null) {
2206            var locale,
2207                parentConfig = baseConfig;
2208            config.abbr = name;
2209            if (locales[name] != null) {
2210                deprecateSimple(
2211                    'defineLocaleOverride',
2212                    'use moment.updateLocale(localeName, config) to change ' +
2213                        'an existing locale. moment.defineLocale(localeName, ' +
2214                        'config) should only be used for creating a new locale ' +
2215                        'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
2216                );
2217                parentConfig = locales[name]._config;
2218            } else if (config.parentLocale != null) {
2219                if (locales[config.parentLocale] != null) {
2220                    parentConfig = locales[config.parentLocale]._config;
2221                } else {
2222                    locale = loadLocale(config.parentLocale);
2223                    if (locale != null) {
2224                        parentConfig = locale._config;
2225                    } else {
2226                        if (!localeFamilies[config.parentLocale]) {
2227                            localeFamilies[config.parentLocale] = [];
2228                        }
2229                        localeFamilies[config.parentLocale].push({
2230                            name: name,
2231                            config: config,
2232                        });
2233                        return null;
2234                    }
2235                }
2236            }
2237            locales[name] = new Locale(mergeConfigs(parentConfig, config));
2238
2239            if (localeFamilies[name]) {
2240                localeFamilies[name].forEach(function (x) {
2241                    defineLocale(x.name, x.config);
2242                });
2243            }
2244
2245            // backwards compat for now: also set the locale
2246            // make sure we set the locale AFTER all child locales have been
2247            // created, so we won't end up with the child locale set.
2248            getSetGlobalLocale(name);
2249
2250            return locales[name];
2251        } else {
2252            // useful for testing
2253            delete locales[name];
2254            return null;
2255        }
2256    }
2257
2258    function updateLocale(name, config) {
2259        if (config != null) {
2260            var locale,
2261                tmpLocale,
2262                parentConfig = baseConfig;
2263
2264            if (locales[name] != null && locales[name].parentLocale != null) {
2265                // Update existing child locale in-place to avoid memory-leaks
2266                locales[name].set(mergeConfigs(locales[name]._config, config));
2267            } else {
2268                // MERGE
2269                tmpLocale = loadLocale(name);
vendor: 12,148 bytes, lines 2269-2637
2269
2270                if (tmpLocale != null) {
2271                    parentConfig = tmpLocale._config;
2272                }
2273                config = mergeConfigs(parentConfig, config);
2274                if (tmpLocale == null) {
2275                    // updateLocale is called for creating a new locale
2276                    // Set abbr so it will have a name (getters return
2277                    // undefined otherwise).
2278                    config.abbr = name;
2279                }
2280                locale = new Locale(config);
2281                locale.parentLocale = locales[name];
2282                locales[name] = locale;
2283            }
2284
2285            // backwards compat for now: also set the locale
2286            getSetGlobalLocale(name);
2287        } else {
2288            // pass null for config to unupdate, useful for tests
2289            if (locales[name] != null) {
2290                if (locales[name].parentLocale != null) {
2291                    locales[name] = locales[name].parentLocale;
2292                    if (name === getSetGlobalLocale()) {
2293                        getSetGlobalLocale(name);
2294                    }
2295                } else if (locales[name] != null) {
2296                    delete locales[name];
2297                }
2298            }
2299        }
2300        return locales[name];
2301    }
2302
2303    // returns locale data
2304    function getLocale(key) {
2305        var locale;
2306
2307        if (key && key._locale && key._locale._abbr) {
2308            key = key._locale._abbr;
2309        }
2310
2311        if (!key) {
2312            return globalLocale;
2313        }
2314
2315        if (!isArray(key)) {
2316            //short-circuit everything else
2317            locale = loadLocale(key);
2318            if (locale) {
2319                return locale;
2320            }
2321            key = [key];
2322        }
2323
2324        return chooseLocale(key);
2325    }
2326
2327    function listLocales() {
2328        return keys(locales);
2329    }
2330
2331    function checkOverflow(m) {
2332        var overflow,
2333            a = m._a;
2334
2335        if (a && getParsingFlags(m).overflow === -2) {
2336            overflow =
2337                a[MONTH] < 0 || a[MONTH] > 11
2338                    ? MONTH
2339                    : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
2340                      ? DATE
2341                      : a[HOUR] < 0 ||
2342                          a[HOUR] > 24 ||
2343                          (a[HOUR] === 24 &&
2344                              (a[MINUTE] !== 0 ||
2345                                  a[SECOND] !== 0 ||
2346                                  a[MILLISECOND] !== 0))
2347                        ? HOUR
2348                        : a[MINUTE] < 0 || a[MINUTE] > 59
2349                          ? MINUTE
2350                          : a[SECOND] < 0 || a[SECOND] > 59
2351                            ? SECOND
2352                            : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
2353                              ? MILLISECOND
2354                              : -1;
2355
2356            if (
2357                getParsingFlags(m)._overflowDayOfYear &&
2358                (overflow < YEAR || overflow > DATE)
2359            ) {
2360                overflow = DATE;
2361            }
2362            if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
2363                overflow = WEEK;
2364            }
2365            if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
2366                overflow = WEEKDAY;
2367            }
2368
2369            getParsingFlags(m).overflow = overflow;
2370        }
2371
2372        return m;
2373    }
2374
2375    // iso 8601 regex
2376    // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
2377    var extendedIsoRegex =
2378            /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
2379        basicIsoRegex =
2380            /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
2381        tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
2382        isoDates = [
2383            ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
2384            ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
2385            ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
2386            ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
2387            ['YYYY-DDD', /\d{4}-\d{3}/],
2388            ['YYYY-MM', /\d{4}-\d\d/, false],
2389            ['YYYYYYMMDD', /[+-]\d{10}/],
2390            ['YYYYMMDD', /\d{8}/],
2391            ['GGGG[W]WWE', /\d{4}W\d{3}/],
2392            ['GGGG[W]WW', /\d{4}W\d{2}/, false],
2393            ['YYYYDDD', /\d{7}/],
2394            ['YYYYMM', /\d{6}/, false],
2395            ['YYYY', /\d{4}/, false],
2396        ],
2397        // iso time formats and regexes
2398        isoTimes = [
2399            ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
2400            ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
2401            ['HH:mm:ss', /\d\d:\d\d:\d\d/],
2402            ['HH:mm', /\d\d:\d\d/],
2403            ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
2404            ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
2405            ['HHmmss', /\d\d\d\d\d\d/],
2406            ['HHmm', /\d\d\d\d/],
2407            ['HH', /\d\d/],
2408        ],
2409        aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
2410        // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
2411        rfc2822 =
2412            /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
2413        obsOffsets = {
2414            UT: 0,
2415            GMT: 0,
2416            EDT: -4 * 60,
2417            EST: -5 * 60,
2418            CDT: -5 * 60,
2419            CST: -6 * 60,
2420            MDT: -6 * 60,
2421            MST: -7 * 60,
2422            PDT: -7 * 60,
2423            PST: -8 * 60,
2424        };
2425
2426    // date from iso format
2427    function configFromISO(config) {
2428        var i,
2429            l,
2430            string = config._i,
2431            match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
2432            allowTime,
2433            dateFormat,
2434            timeFormat,
2435            tzFormat,
2436            isoDatesLen = isoDates.length,
2437            isoTimesLen = isoTimes.length;
2438
2439        if (match) {
2440            getParsingFlags(config).iso = true;
2441            for (i = 0, l = isoDatesLen; i < l; i++) {
2442                if (isoDates[i][1].exec(match[1])) {
2443                    dateFormat = isoDates[i][0];
2444                    allowTime = isoDates[i][2] !== false;
2445                    break;
2446                }
2447            }
2448            if (dateFormat == null) {
2449                config._isValid = false;
2450                return;
2451            }
2452            if (match[3]) {
2453                for (i = 0, l = isoTimesLen; i < l; i++) {
2454                    if (isoTimes[i][1].exec(match[3])) {
2455                        // match[2] should be 'T' or space
2456                        timeFormat = (match[2] || ' ') + isoTimes[i][0];
2457                        break;
2458                    }
2459                }
2460                if (timeFormat == null) {
2461                    config._isValid = false;
2462                    return;
2463                }
2464            }
2465            if (!allowTime && timeFormat != null) {
2466                config._isValid = false;
2467                return;
2468            }
2469            if (match[4]) {
2470                if (tzRegex.exec(match[4])) {
2471                    tzFormat = 'Z';
2472                } else {
2473                    config._isValid = false;
2474                    return;
2475                }
2476            }
2477            config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
2478            configFromStringAndFormat(config);
2479        } else {
2480            config._isValid = false;
2481        }
2482    }
2483
2484    function extractFromRFC2822Strings(
2485        yearStr,
2486        monthStr,
2487        dayStr,
2488        hourStr,
2489        minuteStr,
2490        secondStr
2491    ) {
2492        var result = [
2493            untruncateYear(yearStr),
2494            defaultLocaleMonthsShort.indexOf(monthStr),
2495            parseInt(dayStr, 10),
2496            parseInt(hourStr, 10),
2497            parseInt(minuteStr, 10),
2498        ];
2499
2500        if (secondStr) {
2501            result.push(parseInt(secondStr, 10));
2502        }
2503
2504        return result;
2505    }
2506
2507    function untruncateYear(yearStr) {
2508        var year = parseInt(yearStr, 10);
2509        if (year <= 49) {
2510            return 2000 + year;
2511        } else if (year <= 999) {
2512            return 1900 + year;
2513        }
2514        return year;
2515    }
2516
2517    function preprocessRFC2822(s) {
2518        // Remove comments and folding whitespace and replace multiple-spaces with a single space
2519        return s
2520            .replace(/\([^()]*\)|[\n\t]/g, ' ')
2521            .replace(/(\s\s+)/g, ' ')
2522            .replace(/^\s\s*/, '')
2523            .replace(/\s\s*$/, '');
2524    }
2525
2526    function checkWeekday(weekdayStr, parsedInput, config) {
2527        if (weekdayStr) {
2528            // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
2529            var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
2530                weekdayActual = new Date(
2531                    parsedInput[0],
2532                    parsedInput[1],
2533                    parsedInput[2]
2534                ).getDay();
2535            if (weekdayProvided !== weekdayActual) {
2536                getParsingFlags(config).weekdayMismatch = true;
2537                config._isValid = false;
2538                return false;
2539            }
2540        }
2541        return true;
2542    }
2543
2544    function calculateOffset(obsOffset, militaryOffset, numOffset) {
2545        if (obsOffset) {
2546            return obsOffsets[obsOffset];
2547        } else if (militaryOffset) {
2548            // the only allowed military tz is Z
2549            return 0;
2550        } else {
2551            var hm = parseInt(numOffset, 10),
2552                m = hm % 100,
2553                h = (hm - m) / 100;
2554            return h * 60 + m;
2555        }
2556    }
2557
2558    // date and time from ref 2822 format
2559    function configFromRFC2822(config) {
2560        var match = rfc2822.exec(preprocessRFC2822(config._i)),
2561            parsedArray;
2562        if (match) {
2563            parsedArray = extractFromRFC2822Strings(
2564                match[4],
2565                match[3],
2566                match[2],
2567                match[5],
2568                match[6],
2569                match[7]
2570            );
2571            if (!checkWeekday(match[1], parsedArray, config)) {
2572                return;
2573            }
2574
2575            config._a = parsedArray;
2576            config._tzm = calculateOffset(match[8], match[9], match[10]);
2577
2578            config._d = createUTCDate.apply(null, config._a);
2579            config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
2580
2581            getParsingFlags(config).rfc2822 = true;
2582        } else {
2583            config._isValid = false;
2584        }
2585    }
2586
2587    // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
2588    function configFromString(config) {
2589        var matched = aspNetJsonRegex.exec(config._i);
2590        if (matched !== null) {
2591            config._d = new Date(+matched[1]);
2592            return;
2593        }
2594
2595        configFromISO(config);
2596        if (config._isValid === false) {
2597            delete config._isValid;
2598        } else {
2599            return;
2600        }
2601
2602        configFromRFC2822(config);
2603        if (config._isValid === false) {
2604            delete config._isValid;
2605        } else {
2606            return;
2607        }
2608
2609        if (config._strict) {
2610            config._isValid = false;
2611        } else {
2612            // Final attempt, use Input Fallback
2613            hooks.createFromInputFallback(config);
2614        }
2615    }
2616
2617    hooks.createFromInputFallback = deprecate(
2618        'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
2619            'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
2620            'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
2621        function (config) {
2622            config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
2623        }
2624    );
2625
2626    // Pick the first defined of two or three arguments.
2627    function defaults(a, b, c) {
2628        if (a != null) {
2629            return a;
2630        }
2631        if (b != null) {
2632            return b;
2633        }
2634        return c;
2635    }
2636
2637    function currentDateArray(config
vendor: 59,928 bytes, lines 2637-4549
2637) {
2638        // hooks is actually the exported moment object
2639        var nowValue = new Date(hooks.now());
2640        if (config._useUTC) {
2641            return [
2642                nowValue.getUTCFullYear(),
2643                nowValue.getUTCMonth(),
2644                nowValue.getUTCDate(),
2645            ];
2646        }
2647        return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
2648    }
2649
2650    // convert an array to a date.
2651    // the array should mirror the parameters below
2652    // note: all values past the year are optional and will default to the lowest possible value.
2653    // [year, month, day , hour, minute, second, millisecond]
2654    function configFromArray(config) {
2655        var i,
2656            date,
2657            input = [],
2658            currentDate,
2659            expectedWeekday,
2660            yearToUse;
2661
2662        if (config._d) {
2663            return;
2664        }
2665
2666        currentDate = currentDateArray(config);
2667
2668        //compute day of the year from weeks and weekdays
2669        if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
2670            dayOfYearFromWeekInfo(config);
2671        }
2672
2673        //if the day of the year is set, figure out what it is
2674        if (config._dayOfYear != null) {
2675            yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
2676
2677            if (
2678                config._dayOfYear > daysInYear(yearToUse) ||
2679                config._dayOfYear === 0
2680            ) {
2681                getParsingFlags(config)._overflowDayOfYear = true;
2682            }
2683
2684            date = createUTCDate(yearToUse, 0, config._dayOfYear);
2685            config._a[MONTH] = date.getUTCMonth();
2686            config._a[DATE] = date.getUTCDate();
2687        }
2688
2689        // Default to current date.
2690        // * if no year, month, day of month are given, default to today
2691        // * if day of month is given, default month and year
2692        // * if month is given, default only year
2693        // * if year is given, don't default anything
2694        for (i = 0; i < 3 && config._a[i] == null; ++i) {
2695            config._a[i] = input[i] = currentDate[i];
2696        }
2697
2698        // Zero out whatever was not defaulted, including time
2699        for (; i < 7; i++) {
2700            config._a[i] = input[i] =
2701                config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
2702        }
2703
2704        // Check for 24:00:00.000
2705        if (
2706            config._a[HOUR] === 24 &&
2707            config._a[MINUTE] === 0 &&
2708            config._a[SECOND] === 0 &&
2709            config._a[MILLISECOND] === 0
2710        ) {
2711            config._nextDay = true;
2712            config._a[HOUR] = 0;
2713        }
2714
2715        config._d = (config._useUTC ? createUTCDate : createDate).apply(
2716            null,
2717            input
2718        );
2719        expectedWeekday = config._useUTC
2720            ? config._d.getUTCDay()
2721            : config._d.getDay();
2722
2723        // Apply timezone offset from input. The actual utcOffset can be changed
2724        // with parseZone.
2725        if (config._tzm != null) {
2726            config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
2727        }
2728
2729        if (config._nextDay) {
2730            config._a[HOUR] = 24;
2731        }
2732
2733        // check for mismatching day of week
2734        if (
2735            config._w &&
2736            typeof config._w.d !== 'undefined' &&
2737            config._w.d !== expectedWeekday
2738        ) {
2739            getParsingFlags(config).weekdayMismatch = true;
2740        }
2741    }
2742
2743    function dayOfYearFromWeekInfo(config) {
2744        var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
2745
2746        w = config._w;
2747        if (w.GG != null || w.W != null || w.E != null) {
2748            dow = 1;
2749            doy = 4;
2750
2751            // TODO: We need to take the current isoWeekYear, but that depends on
2752            // how we interpret now (local, utc, fixed offset). So create
2753            // a now version of current config (take local/utc/offset flags, and
2754            // create now).
2755            weekYear = defaults(
2756                w.GG,
2757                config._a[YEAR],
2758                weekOfYear(createLocal(), 1, 4).year
2759            );
2760            week = defaults(w.W, 1);
2761            weekday = defaults(w.E, 1);
2762            if (weekday < 1 || weekday > 7) {
2763                weekdayOverflow = true;
2764            }
2765        } else {
2766            dow = config._locale._week.dow;
2767            doy = config._locale._week.doy;
2768
2769            curWeek = weekOfYear(createLocal(), dow, doy);
2770
2771            weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
2772
2773            // Default to current week.
2774            week = defaults(w.w, curWeek.week);
2775
2776            if (w.d != null) {
2777                // weekday -- low day numbers are considered next week
2778                weekday = w.d;
2779                if (weekday < 0 || weekday > 6) {
2780                    weekdayOverflow = true;
2781                }
2782            } else if (w.e != null) {
2783                // local weekday -- counting starts from beginning of week
2784                weekday = w.e + dow;
2785                if (w.e < 0 || w.e > 6) {
2786                    weekdayOverflow = true;
2787                }
2788            } else {
2789                // default to beginning of week
2790                weekday = dow;
2791            }
2792        }
2793        if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
2794            getParsingFlags(config)._overflowWeeks = true;
2795        } else if (weekdayOverflow != null) {
2796            getParsingFlags(config)._overflowWeekday = true;
2797        } else {
2798            temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
2799            config._a[YEAR] = temp.year;
2800            config._dayOfYear = temp.dayOfYear;
2801        }
2802    }
2803
2804    // constant that refers to the ISO standard
2805    hooks.ISO_8601 = function () {};
2806
2807    // constant that refers to the RFC 2822 form
2808    hooks.RFC_2822 = function () {};
2809
2810    // date from string and format string
2811    function configFromStringAndFormat(config) {
2812        // TODO: Move this to another part of the creation flow to prevent circular deps
2813        if (config._f === hooks.ISO_8601) {
2814            configFromISO(config);
2815            return;
2816        }
2817        if (config._f === hooks.RFC_2822) {
2818            configFromRFC2822(config);
2819            return;
2820        }
2821        config._a = [];
2822        getParsingFlags(config).empty = true;
2823
2824        // This array is used to make a Date, either with `new Date` or `Date.UTC`
2825        var string = '' + config._i,
2826            i,
2827            parsedInput,
2828            tokens,
2829            token,
2830            skipped,
2831            stringLength = string.length,
2832            totalParsedInputLength = 0,
2833            era,
2834            tokenLen;
2835
2836        tokens =
2837            expandFormat(config._f, config._locale).match(formattingTokens) || [];
2838        tokenLen = tokens.length;
2839        for (i = 0; i < tokenLen; i++) {
2840            token = tokens[i];
2841            parsedInput = (string.match(getParseRegexForToken(token, config)) ||
2842                [])[0];
2843            if (parsedInput) {
2844                skipped = string.substr(0, string.indexOf(parsedInput));
2845                if (skipped.length > 0) {
2846                    getParsingFlags(config).unusedInput.push(skipped);
2847                }
2848                string = string.slice(
2849                    string.indexOf(parsedInput) + parsedInput.length
2850                );
2851                totalParsedInputLength += parsedInput.length;
2852            }
2853            // don't parse if it's not a known token
2854            if (formatTokenFunctions[token]) {
2855                if (parsedInput) {
2856                    getParsingFlags(config).empty = false;
2857                } else {
2858                    getParsingFlags(config).unusedTokens.push(token);
2859                }
2860                addTimeToArrayFromToken(token, parsedInput, config);
2861            } else if (config._strict && !parsedInput) {
2862                getParsingFlags(config).unusedTokens.push(token);
2863            }
2864        }
2865
2866        // add remaining unparsed input length to the string
2867        getParsingFlags(config).charsLeftOver =
2868            stringLength - totalParsedInputLength;
2869        if (string.length > 0) {
2870            getParsingFlags(config).unusedInput.push(string);
2871        }
2872
2873        // clear _12h flag if hour is <= 12
2874        if (
2875            config._a[HOUR] <= 12 &&
2876            getParsingFlags(config).bigHour === true &&
2877            config._a[HOUR] > 0
2878        ) {
2879            getParsingFlags(config).bigHour = undefined;
2880        }
2881
2882        getParsingFlags(config).parsedDateParts = config._a.slice(0);
2883        getParsingFlags(config).meridiem = config._meridiem;
2884        // handle meridiem
2885        config._a[HOUR] = meridiemFixWrap(
2886            config._locale,
2887            config._a[HOUR],
2888            config._meridiem
2889        );
2890
2891        // handle era
2892        era = getParsingFlags(config).era;
2893        if (era !== null) {
2894            config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
2895        }
2896
2897        configFromArray(config);
2898        checkOverflow(config);
2899    }
2900
2901    function meridiemFixWrap(locale, hour, meridiem) {
2902        var isPm;
2903
2904        if (meridiem == null) {
2905            // nothing to do
2906            return hour;
2907        }
2908        if (locale.meridiemHour != null) {
2909            return locale.meridiemHour(hour, meridiem);
2910        } else if (locale.isPM != null) {
2911            // Fallback
2912            isPm = locale.isPM(meridiem);
2913            if (isPm && hour < 12) {
2914                hour += 12;
2915            }
2916            if (!isPm && hour === 12) {
2917                hour = 0;
2918            }
2919            return hour;
2920        } else {
2921            // this is not supposed to happen
2922            return hour;
2923        }
2924    }
2925
2926    // date from string and array of format strings
2927    function configFromStringAndArray(config) {
2928        var tempConfig,
2929            bestMoment,
2930            scoreToBeat,
2931            i,
2932            currentScore,
2933            validFormatFound,
2934            bestFormatIsValid = false,
2935            configfLen = config._f.length;
2936
2937        if (configfLen === 0) {
2938            getParsingFlags(config).invalidFormat = true;
2939            config._d = new Date(NaN);
2940            return;
2941        }
2942
2943        for (i = 0; i < configfLen; i++) {
2944            currentScore = 0;
2945            validFormatFound = false;
2946            tempConfig = copyConfig({}, config);
2947            if (config._useUTC != null) {
2948                tempConfig._useUTC = config._useUTC;
2949            }
2950            tempConfig._f = config._f[i];
2951            configFromStringAndFormat(tempConfig);
2952
2953            if (isValid(tempConfig)) {
2954                validFormatFound = true;
2955            }
2956
2957            // if there is any input that was not parsed add a penalty for that format
2958            currentScore += getParsingFlags(tempConfig).charsLeftOver;
2959
2960            //or tokens
2961            currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
2962
2963            getParsingFlags(tempConfig).score = currentScore;
2964
2965            if (!bestFormatIsValid) {
2966                if (
2967                    scoreToBeat == null ||
2968                    currentScore < scoreToBeat ||
2969                    validFormatFound
2970                ) {
2971                    scoreToBeat = currentScore;
2972                    bestMoment = tempConfig;
2973                    if (validFormatFound) {
2974                        bestFormatIsValid = true;
2975                    }
2976                }
2977            } else {
2978                if (currentScore < scoreToBeat) {
2979                    scoreToBeat = currentScore;
2980                    bestMoment = tempConfig;
2981                }
2982            }
2983        }
2984
2985        extend(config, bestMoment || tempConfig);
2986    }
2987
2988    function configFromObject(config) {
2989        if (config._d) {
2990            return;
2991        }
2992
2993        var i = normalizeObjectUnits(config._i),
2994            dayOrDate = i.day === undefined ? i.date : i.day;
2995        config._a = map(
2996            [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
2997            function (obj) {
2998                return obj && parseInt(obj, 10);
2999            }
3000        );
3001
3002        configFromArray(config);
3003    }
3004
3005    function createFromConfig(config) {
3006        var res = new Moment(checkOverflow(prepareConfig(config)));
3007        if (res._nextDay) {
3008            // Adding is smart enough around DST
3009            res.add(1, 'd');
3010            res._nextDay = undefined;
3011        }
3012
3013        return res;
3014    }
3015
3016    function prepareConfig(config) {
3017        var input = config._i,
3018            format = config._f;
3019
3020        config._locale = config._locale || getLocale(config._l);
3021
3022        if (input === null || (format === undefined && input === '')) {
3023            return createInvalid({ nullInput: true });
3024        }
3025
3026        if (typeof input === 'string') {
3027            config._i = input = config._locale.preparse(input);
3028        }
3029
3030        if (isMoment(input)) {
3031            return new Moment(checkOverflow(input));
3032        } else if (isDate(input)) {
3033            config._d = input;
3034        } else if (isArray(format)) {
3035            configFromStringAndArray(config);
3036        } else if (format) {
3037            configFromStringAndFormat(config);
3038        } else {
3039            configFromInput(config);
3040        }
3041
3042        if (!isValid(config)) {
3043            config._d = null;
3044        }
3045
3046        return config;
3047    }
3048
3049    function configFromInput(config) {
3050        var input = config._i;
3051        if (isUndefined(input)) {
3052            config._d = new Date(hooks.now());
3053        } else if (isDate(input)) {
3054            config._d = new Date(input.valueOf());
3055        } else if (typeof input === 'string') {
3056            configFromString(config);
3057        } else if (isArray(input)) {
3058            config._a = map(input.slice(0), function (obj) {
3059                return parseInt(obj, 10);
3060            });
3061            configFromArray(config);
3062        } else if (isObject(input)) {
3063            configFromObject(config);
3064        } else if (isNumber(input)) {
3065            // from milliseconds
3066            config._d = new Date(input);
3067        } else {
3068            hooks.createFromInputFallback(config);
3069        }
3070    }
3071
3072    function createLocalOrUTC(input, format, locale, strict, isUTC) {
3073        var c = {};
3074
3075        if (format === true || format === false) {
3076            strict = format;
3077            format = undefined;
3078        }
3079
3080        if (locale === true || locale === false) {
3081            strict = locale;
3082            locale = undefined;
3083        }
3084
3085        if (
3086            (isObject(input) && isObjectEmpty(input)) ||
3087            (isArray(input) && input.length === 0)
3088        ) {
3089            input = undefined;
3090        }
3091        // object construction must be done this way.
3092        // https://github.com/moment/moment/issues/1423
3093        c._isAMomentObject = true;
3094        c._useUTC = c._isUTC = isUTC;
3095        c._l = locale;
3096        c._i = input;
3097        c._f = format;
3098        c._strict = strict;
3099
3100        return createFromConfig(c);
3101    }
3102
3103    function createLocal(input, format, locale, strict) {
3104        return createLocalOrUTC(input, format, locale, strict, false);
3105    }
3106
3107    var prototypeMin = deprecate(
3108            'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
3109            function () {
3110                var other = createLocal.apply(null, arguments);
3111                if (this.isValid() && other.isValid()) {
3112                    return other < this ? this : other;
3113                } else {
3114                    return createInvalid();
3115                }
3116            }
3117        ),
3118        prototypeMax = deprecate(
3119            'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
3120            function () {
3121                var other = createLocal.apply(null, arguments);
3122                if (this.isValid() && other.isValid()) {
3123                    return other > this ? this : other;
3124                } else {
3125                    return createInvalid();
3126                }
3127            }
3128        );
3129
3130    // Pick a moment m from moments so that m[fn](other) is true for all
3131    // other. This relies on the function fn to be transitive.
3132    //
3133    // moments should either be an array of moment objects or an array, whose
3134    // first element is an array of moment objects.
3135    function pickBy(fn, moments) {
3136        var res, i;
3137        if (moments.length === 1 && isArray(moments[0])) {
3138            moments = moments[0];
3139        }
3140        if (!moments.length) {
3141            return createLocal();
3142        }
3143        res = moments[0];
3144        for (i = 1; i < moments.length; ++i) {
3145            if (!moments[i].isValid() || moments[i][fn](res)) {
3146                res = moments[i];
3147            }
3148        }
3149        return res;
3150    }
3151
3152    // TODO: Use [].sort instead?
3153    function min() {
3154        var args = [].slice.call(arguments, 0);
3155
3156        return pickBy('isBefore', args);
3157    }
3158
3159    function max() {
3160        var args = [].slice.call(arguments, 0);
3161
3162        return pickBy('isAfter', args);
3163    }
3164
3165    var now = function () {
3166        return Date.now ? Date.now() : +new Date();
3167    };
3168
3169    var ordering = [
3170        'year',
3171        'quarter',
3172        'month',
3173        'week',
3174        'day',
3175        'hour',
3176        'minute',
3177        'second',
3178        'millisecond',
3179    ];
3180
3181    function isDurationValid(m) {
3182        var key,
3183            unitHasDecimal = false,
3184            i,
3185            orderLen = ordering.length;
3186        for (key in m) {
3187            if (
3188                hasOwnProp(m, key) &&
3189                !(
3190                    indexOf.call(ordering, key) !== -1 &&
3191                    (m[key] == null || !isNaN(m[key]))
3192                )
3193            ) {
3194                return false;
3195            }
3196        }
3197
3198        for (i = 0; i < orderLen; ++i) {
3199            if (m[ordering[i]]) {
3200                if (unitHasDecimal) {
3201                    return false; // only allow non-integers for smallest unit
3202                }
3203                if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
3204                    unitHasDecimal = true;
3205                }
3206            }
3207        }
3208
3209        return true;
3210    }
3211
3212    function isValid$1() {
3213        return this._isValid;
3214    }
3215
3216    function createInvalid$1() {
3217        return createDuration(NaN);
3218    }
3219
3220    function Duration(duration) {
3221        var normalizedInput = normalizeObjectUnits(duration),
3222            years = normalizedInput.year || 0,
3223            quarters = normalizedInput.quarter || 0,
3224            months = normalizedInput.month || 0,
3225            weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
3226            days = normalizedInput.day || 0,
3227            hours = normalizedInput.hour || 0,
3228            minutes = normalizedInput.minute || 0,
3229            seconds = normalizedInput.second || 0,
3230            milliseconds = normalizedInput.millisecond || 0;
3231
3232        this._isValid = isDurationValid(normalizedInput);
3233
3234        // representation for dateAddRemove
3235        this._milliseconds =
3236            +milliseconds +
3237            seconds * 1e3 + // 1000
3238            minutes * 6e4 + // 1000 * 60
3239            hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
3240        // Because of dateAddRemove treats 24 hours as different from a
3241        // day when working around DST, we need to store them separately
3242        this._days = +days + weeks * 7;
3243        // It is impossible to translate months into days without knowing
3244        // which months you are are talking about, so we have to store
3245        // it separately.
3246        this._months = +months + quarters * 3 + years * 12;
3247
3248        this._data = {};
3249
3250        this._locale = getLocale();
3251
3252        this._bubble();
3253    }
3254
3255    function isDuration(obj) {
3256        return obj instanceof Duration;
3257    }
3258
3259    function absRound(number) {
3260        if (number < 0) {
3261            return Math.round(-1 * number) * -1;
3262        } else {
3263            return Math.round(number);
3264        }
3265    }
3266
3267    // compare two arrays, return the number of differences
3268    function compareArrays(array1, array2, dontConvert) {
3269        var len = Math.min(array1.length, array2.length),
3270            lengthDiff = Math.abs(array1.length - array2.length),
3271            diffs = 0,
3272            i;
3273        for (i = 0; i < len; i++) {
3274            if (
3275                (dontConvert && array1[i] !== array2[i]) ||
3276                (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
3277            ) {
3278                diffs++;
3279            }
3280        }
3281        return diffs + lengthDiff;
3282    }
3283
3284    // FORMATTING
3285
3286    function offset(token, separator) {
3287        addFormatToken(token, 0, 0, function () {
3288            var offset = this.utcOffset(),
3289                sign = '+';
3290            if (offset < 0) {
3291                offset = -offset;
3292                sign = '-';
3293            }
3294            return (
3295                sign +
3296                zeroFill(~~(offset / 60), 2) +
3297                separator +
3298                zeroFill(~~offset % 60, 2)
3299            );
3300        });
3301    }
3302
3303    offset('Z', ':');
3304    offset('ZZ', '');
3305
3306    // PARSING
3307
3308    addRegexToken('Z', matchShortOffset);
3309    addRegexToken('ZZ', matchShortOffset);
3310    addParseToken(['Z', 'ZZ'], function (input, array, config) {
3311        config._useUTC = true;
3312        config._tzm = offsetFromString(matchShortOffset, input);
3313    });
3314
3315    // HELPERS
3316
3317    // timezone chunker
3318    // '+10:00' > ['10',  '00']
3319    // '-1530'  > ['-15', '30']
3320    var chunkOffset = /([\+\-]|\d\d)/gi;
3321
3322    function offsetFromString(matcher, string) {
3323        var matches = (string || '').match(matcher),
3324            chunk,
3325            parts,
3326            minutes;
3327
3328        if (matches === null) {
3329            return null;
3330        }
3331
3332        chunk = matches[matches.length - 1] || [];
3333        parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
3334        minutes = +(parts[1] * 60) + toInt(parts[2]);
3335
3336        return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
3337    }
3338
3339    // Return a moment from input, that is local/utc/zone equivalent to model.
3340    function cloneWithOffset(input, model) {
3341        var res, diff;
3342        if (model._isUTC) {
3343            res = model.clone();
3344            diff =
3345                (isMoment(input) || isDate(input)
3346                    ? input.valueOf()
3347                    : createLocal(input).valueOf()) - res.valueOf();
3348            // Use low-level api, because this fn is low-level api.
3349            res._d.setTime(res._d.valueOf() + diff);
3350            hooks.updateOffset(res, false);
3351            return res;
3352        } else {
3353            return createLocal(input).local();
3354        }
3355    }
3356
3357    function getDateOffset(m) {
3358        // On Firefox.24 Date#getTimezoneOffset returns a floating point.
3359        // https://github.com/moment/moment/pull/1871
3360        return -Math.round(m._d.getTimezoneOffset());
3361    }
3362
3363    // HOOKS
3364
3365    // This function will be called whenever a moment is mutated.
3366    // It is intended to keep the offset in sync with the timezone.
3367    hooks.updateOffset = function () {};
3368
3369    // MOMENTS
3370
3371    // keepLocalTime = true means only change the timezone, without
3372    // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
3373    // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
3374    // +0200, so we adjust the time as needed, to be valid.
3375    //
3376    // Keeping the time actually adds/subtracts (one hour)
3377    // from the actual represented time. That is why we call updateOffset
3378    // a second time. In case it wants us to change the offset again
3379    // _changeInProgress == true case, then we have to adjust, because
3380    // there is no such time in the given timezone.
3381    function getSetOffset(input, keepLocalTime, keepMinutes) {
3382        var offset = this._offset || 0,
3383            localAdjust;
3384        if (!this.isValid()) {
3385            return input != null ? this : NaN;
3386        }
3387        if (input != null) {
3388            if (typeof input === 'string') {
3389                input = offsetFromString(matchShortOffset, input);
3390                if (input === null) {
3391                    return this;
3392                }
3393            } else if (Math.abs(input) < 16 && !keepMinutes) {
3394                input = input * 60;
3395            }
3396            if (!this._isUTC && keepLocalTime) {
3397                localAdjust = getDateOffset(this);
3398            }
3399            this._offset = input;
3400            this._isUTC = true;
3401            if (localAdjust != null) {
3402                this.add(localAdjust, 'm');
3403            }
3404            if (offset !== input) {
3405                if (!keepLocalTime || this._changeInProgress) {
3406                    addSubtract(
3407                        this,
3408                        createDuration(input - offset, 'm'),
3409                        1,
3410                        false
3411                    );
3412                } else if (!this._changeInProgress) {
3413                    this._changeInProgress = true;
3414                    hooks.updateOffset(this, true);
3415                    this._changeInProgress = null;
3416                }
3417            }
3418            return this;
3419        } else {
3420            return this._isUTC ? offset : getDateOffset(this);
3421        }
3422    }
3423
3424    function getSetZone(input, keepLocalTime) {
3425        if (input != null) {
3426            if (typeof input !== 'string') {
3427                input = -input;
3428            }
3429
3430            this.utcOffset(input, keepLocalTime);
3431
3432            return this;
3433        } else {
3434            return -this.utcOffset();
3435        }
3436    }
3437
3438    function setOffsetToUTC(keepLocalTime) {
3439        return this.utcOffset(0, keepLocalTime);
3440    }
3441
3442    function setOffsetToLocal(keepLocalTime) {
3443        if (this._isUTC) {
3444            this.utcOffset(0, keepLocalTime);
3445            this._isUTC = false;
3446
3447            if (keepLocalTime) {
3448                this.subtract(getDateOffset(this), 'm');
3449            }
3450        }
3451        return this;
3452    }
3453
3454    function setOffsetToParsedOffset() {
3455        if (this._tzm != null) {
3456            this.utcOffset(this._tzm, false, true);
3457        } else if (typeof this._i === 'string') {
3458            var tZone = offsetFromString(matchOffset, this._i);
3459            if (tZone != null) {
3460                this.utcOffset(tZone);
3461            } else {
3462                this.utcOffset(0, true);
3463            }
3464        }
3465        return this;
3466    }
3467
3468    function hasAlignedHourOffset(input) {
3469        if (!this.isValid()) {
3470            return false;
3471        }
3472        input = input ? createLocal(input).utcOffset() : 0;
3473
3474        return (this.utcOffset() - input) % 60 === 0;
3475    }
3476
3477    function isDaylightSavingTime() {
3478        return (
3479            this.utcOffset() > this.clone().month(0).utcOffset() ||
3480            this.utcOffset() > this.clone().month(5).utcOffset()
3481        );
3482    }
3483
3484    function isDaylightSavingTimeShifted() {
3485        if (!isUndefined(this._isDSTShifted)) {
3486            return this._isDSTShifted;
3487        }
3488
3489        var c = {},
3490            other;
3491
3492        copyConfig(c, this);
3493        c = prepareConfig(c);
3494
3495        if (c._a) {
3496            other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
3497            this._isDSTShifted =
3498                this.isValid() && compareArrays(c._a, other.toArray()) > 0;
3499        } else {
3500            this._isDSTShifted = false;
3501        }
3502
3503        return this._isDSTShifted;
3504    }
3505
3506    function isLocal() {
3507        return this.isValid() ? !this._isUTC : false;
3508    }
3509
3510    function isUtcOffset() {
3511        return this.isValid() ? this._isUTC : false;
3512    }
3513
3514    function isUtc() {
3515        return this.isValid() ? this._isUTC && this._offset === 0 : false;
3516    }
3517
3518    // ASP.NET json date format regex
3519    var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
3520        // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
3521        // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
3522        // and further modified to allow for strings containing both week and day
3523        isoRegex =
3524            /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
3525
3526    function createDuration(input, key) {
3527        var duration = input,
3528            // matching against regexp is expensive, do it on demand
3529            match = null,
3530            sign,
3531            ret,
3532            diffRes;
3533
3534        if (isDuration(input)) {
3535            duration = {
3536                ms: input._milliseconds,
3537                d: input._days,
3538                M: input._months,
3539            };
3540        } else if (isNumber(input) || !isNaN(+input)) {
3541            duration = {};
3542            if (key) {
3543                duration[key] = +input;
3544            } else {
3545                duration.milliseconds = +input;
3546            }
3547        } else if ((match = aspNetRegex.exec(input))) {
3548            sign = match[1] === '-' ? -1 : 1;
3549            duration = {
3550                y: 0,
3551                d: toInt(match[DATE]) * sign,
3552                h: toInt(match[HOUR]) * sign,
3553                m: toInt(match[MINUTE]) * sign,
3554                s: toInt(match[SECOND]) * sign,
3555                ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
3556            };
3557        } else if ((match = isoRegex.exec(input))) {
3558            sign = match[1] === '-' ? -1 : 1;
3559            duration = {
3560                y: parseIso(match[2], sign),
3561                M: parseIso(match[3], sign),
3562                w: parseIso(match[4], sign),
3563                d: parseIso(match[5], sign),
3564                h: parseIso(match[6], sign),
3565                m: parseIso(match[7], sign),
3566                s: parseIso(match[8], sign),
3567            };
3568        } else if (duration == null) {
3569            // checks for null or undefined
3570            duration = {};
3571        } else if (
3572            typeof duration === 'object' &&
3573            ('from' in duration || 'to' in duration)
3574        ) {
3575            diffRes = momentsDifference(
3576                createLocal(duration.from),
3577                createLocal(duration.to)
3578            );
3579
3580            duration = {};
3581            duration.ms = diffRes.milliseconds;
3582            duration.M = diffRes.months;
3583        }
3584
3585        ret = new Duration(duration);
3586
3587        if (isDuration(input) && hasOwnProp(input, '_locale')) {
3588            ret._locale = input._locale;
3589        }
3590
3591        if (isDuration(input) && hasOwnProp(input, '_isValid')) {
3592            ret._isValid = input._isValid;
3593        }
3594
3595        return ret;
3596    }
3597
3598    createDuration.fn = Duration.prototype;
3599    createDuration.invalid = createInvalid$1;
3600
3601    function parseIso(inp, sign) {
3602        // We'd normally use ~~inp for this, but unfortunately it also
3603        // converts floats to ints.
3604        // inp may be undefined, so careful calling replace on it.
3605        var res = inp && parseFloat(inp.replace(',', '.'));
3606        // apply sign while we're at it
3607        return (isNaN(res) ? 0 : res) * sign;
3608    }
3609
3610    function positiveMomentsDifference(base, other) {
3611        var res = {};
3612
3613        res.months =
3614            other.month() - base.month() + (other.year() - base.year()) * 12;
3615        if (base.clone().add(res.months, 'M').isAfter(other)) {
3616            --res.months;
3617        }
3618
3619        res.milliseconds = +other - +base.clone().add(res.months, 'M');
3620
3621        return res;
3622    }
3623
3624    function momentsDifference(base, other) {
3625        var res;
3626        if (!(base.isValid() && other.isValid())) {
3627            return { milliseconds: 0, months: 0 };
3628        }
3629
3630        other = cloneWithOffset(other, base);
3631        if (base.isBefore(other)) {
3632            res = positiveMomentsDifference(base, other);
3633        } else {
3634            res = positiveMomentsDifference(other, base);
3635            res.milliseconds = -res.milliseconds;
3636            res.months = -res.months;
3637        }
3638
3639        return res;
3640    }
3641
3642    // TODO: remove 'name' arg after deprecation is removed
3643    function createAdder(direction, name) {
3644        return function (val, period) {
3645            var dur, tmp;
3646            //invert the arguments, but complain about it
3647            if (period !== null && !isNaN(+period)) {
3648                deprecateSimple(
3649                    name,
3650                    'moment().' +
3651                        name +
3652                        '(period, number) is deprecated. Please use moment().' +
3653                        name +
3654                        '(number, period). ' +
3655                        'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
3656                );
3657                tmp = val;
3658                val = period;
3659                period = tmp;
3660            }
3661
3662            dur = createDuration(val, period);
3663            addSubtract(this, dur, direction);
3664            return this;
3665        };
3666    }
3667
3668    function addSubtract(mom, duration, isAdding, updateOffset) {
3669        var milliseconds = duration._milliseconds,
3670            days = absRound(duration._days),
3671            months = absRound(duration._months);
3672
3673        if (!mom.isValid()) {
3674            // No op
3675            return;
3676        }
3677
3678        updateOffset = updateOffset == null ? true : updateOffset;
3679
3680        if (months) {
3681            setMonth(mom, get(mom, 'Month') + months * isAdding);
3682        }
3683        if (days) {
3684            set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
3685        }
3686        if (milliseconds) {
3687            mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
3688        }
3689        if (updateOffset) {
3690            hooks.updateOffset(mom, days || months);
3691        }
3692    }
3693
3694    var add = createAdder(1, 'add'),
3695        subtract = createAdder(-1, 'subtract');
3696
3697    function isString(input) {
3698        return typeof input === 'string' || input instanceof String;
3699    }
3700
3701    // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
3702    function isMomentInput(input) {
3703        return (
3704            isMoment(input) ||
3705            isDate(input) ||
3706            isString(input) ||
3707            isNumber(input) ||
3708            isNumberOrStringArray(input) ||
3709            isMomentInputObject(input) ||
3710            input === null ||
3711            input === undefined
3712        );
3713    }
3714
3715    function isMomentInputObject(input) {
3716        var objectTest = isObject(input) && !isObjectEmpty(input),
3717            propertyTest = false,
3718            properties = [
3719                'years',
3720                'year',
3721                'y',
3722                'months',
3723                'month',
3724                'M',
3725                'days',
3726                'day',
3727                'd',
3728                'dates',
3729                'date',
3730                'D',
3731                'hours',
3732                'hour',
3733                'h',
3734                'minutes',
3735                'minute',
3736                'm',
3737                'seconds',
3738                'second',
3739                's',
3740                'milliseconds',
3741                'millisecond',
3742                'ms',
3743            ],
3744            i,
3745            property,
3746            propertyLen = properties.length;
3747
3748        for (i = 0; i < propertyLen; i += 1) {
3749            property = properties[i];
3750            propertyTest = propertyTest || hasOwnProp(input, property);
3751        }
3752
3753        return objectTest && propertyTest;
3754    }
3755
3756    function isNumberOrStringArray(input) {
3757        var arrayTest = isArray(input),
3758            dataTypeTest = false;
3759        if (arrayTest) {
3760            dataTypeTest =
3761                input.filter(function (item) {
3762                    return !isNumber(item) && isString(input);
3763                }).length === 0;
3764        }
3765        return arrayTest && dataTypeTest;
3766    }
3767
3768    function isCalendarSpec(input) {
3769        var objectTest = isObject(input) && !isObjectEmpty(input),
3770            propertyTest = false,
3771            properties = [
3772                'sameDay',
3773                'nextDay',
3774                'lastDay',
3775                'nextWeek',
3776                'lastWeek',
3777                'sameElse',
3778            ],
3779            i,
3780            property;
3781
3782        for (i = 0; i < properties.length; i += 1) {
3783            property = properties[i];
3784            propertyTest = propertyTest || hasOwnProp(input, property);
3785        }
3786
3787        return objectTest && propertyTest;
3788    }
3789
3790    function getCalendarFormat(myMoment, now) {
3791        var diff = myMoment.diff(now, 'days', true);
3792        return diff < -6
3793            ? 'sameElse'
3794            : diff < -1
3795              ? 'lastWeek'
3796              : diff < 0
3797                ? 'lastDay'
3798                : diff < 1
3799                  ? 'sameDay'
3800                  : diff < 2
3801                    ? 'nextDay'
3802                    : diff < 7
3803                      ? 'nextWeek'
3804                      : 'sameElse';
3805    }
3806
3807    function calendar$1(time, formats) {
3808        // Support for single parameter, formats only overload to the calendar function
3809        if (arguments.length === 1) {
3810            if (!arguments[0]) {
3811                time = undefined;
3812                formats = undefined;
3813            } else if (isMomentInput(arguments[0])) {
3814                time = arguments[0];
3815                formats = undefined;
3816            } else if (isCalendarSpec(arguments[0])) {
3817                formats = arguments[0];
3818                time = undefined;
3819            }
3820        }
3821        // We want to compare the start of today, vs this.
3822        // Getting start-of-today depends on whether we're local/utc/offset or not.
3823        var now = time || createLocal(),
3824            sod = cloneWithOffset(now, this).startOf('day'),
3825            format = hooks.calendarFormat(this, sod) || 'sameElse',
3826            output =
3827                formats &&
3828                (isFunction(formats[format])
3829                    ? formats[format].call(this, now)
3830                    : formats[format]);
3831
3832        return this.format(
3833            output || this.localeData().calendar(format, this, createLocal(now))
3834        );
3835    }
3836
3837    function clone() {
3838        return new Moment(this);
3839    }
3840
3841    function isAfter(input, units) {
3842        var localInput = isMoment(input) ? input : createLocal(input);
3843        if (!(this.isValid() && localInput.isValid())) {
3844            return false;
3845        }
3846        units = normalizeUnits(units) || 'millisecond';
3847        if (units === 'millisecond') {
3848            return this.valueOf() > localInput.valueOf();
3849        } else {
3850            return localInput.valueOf() < this.clone().startOf(units).valueOf();
3851        }
3852    }
3853
3854    function isBefore(input, units) {
3855        var localInput = isMoment(input) ? input : createLocal(input);
3856        if (!(this.isValid() && localInput.isValid())) {
3857            return false;
3858        }
3859        units = normalizeUnits(units) || 'millisecond';
3860        if (units === 'millisecond') {
3861            return this.valueOf() < localInput.valueOf();
3862        } else {
3863            return this.clone().endOf(units).valueOf() < localInput.valueOf();
3864        }
3865    }
3866
3867    function isBetween(from, to, units, inclusivity) {
3868        var localFrom = isMoment(from) ? from : createLocal(from),
3869            localTo = isMoment(to) ? to : createLocal(to);
3870        if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
3871            return false;
3872        }
3873        inclusivity = inclusivity || '()';
3874        return (
3875            (inclusivity[0] === '('
3876                ? this.isAfter(localFrom, units)
3877                : !this.isBefore(localFrom, units)) &&
3878            (inclusivity[1] === ')'
3879                ? this.isBefore(localTo, units)
3880                : !this.isAfter(localTo, units))
3881        );
3882    }
3883
3884    function isSame(input, units) {
3885        var localInput = isMoment(input) ? input : createLocal(input),
3886            inputMs;
3887        if (!(this.isValid() && localInput.isValid())) {
3888            return false;
3889        }
3890        units = normalizeUnits(units) || 'millisecond';
3891        if (units === 'millisecond') {
3892            return this.valueOf() === localInput.valueOf();
3893        } else {
3894            inputMs = localInput.valueOf();
3895            return (
3896                this.clone().startOf(units).valueOf() <= inputMs &&
3897                inputMs <= this.clone().endOf(units).valueOf()
3898            );
3899        }
3900    }
3901
3902    function isSameOrAfter(input, units) {
3903        return this.isSame(input, units) || this.isAfter(input, units);
3904    }
3905
3906    function isSameOrBefore(input, units) {
3907        return this.isSame(input, units) || this.isBefore(input, units);
3908    }
3909
3910    function diff(input, units, asFloat) {
3911        var that, zoneDelta, output;
3912
3913        if (!this.isValid()) {
3914            return NaN;
3915        }
3916
3917        that = cloneWithOffset(input, this);
3918
3919        if (!that.isValid()) {
3920            return NaN;
3921        }
3922
3923        zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
3924
3925        units = normalizeUnits(units);
3926
3927        switch (units) {
3928            case 'year':
3929                output = monthDiff(this, that) / 12;
3930                break;
3931            case 'month':
3932                output = monthDiff(this, that);
3933                break;
3934            case 'quarter':
3935                output = monthDiff(this, that) / 3;
3936                break;
3937            case 'second':
3938                output = (this - that) / 1e3;
3939                break; // 1000
3940            case 'minute':
3941                output = (this - that) / 6e4;
3942                break; // 1000 * 60
3943            case 'hour':
3944                output = (this - that) / 36e5;
3945                break; // 1000 * 60 * 60
3946            case 'day':
3947                output = (this - that - zoneDelta) / 864e5;
3948                break; // 1000 * 60 * 60 * 24, negate dst
3949            case 'week':
3950                output = (this - that - zoneDelta) / 6048e5;
3951                break; // 1000 * 60 * 60 * 24 * 7, negate dst
3952            default:
3953                output = this - that;
3954        }
3955
3956        return asFloat ? output : absFloor(output);
3957    }
3958
3959    function monthDiff(a, b) {
3960        if (a.date() < b.date()) {
3961            // end-of-month calculations work correct when the start month has more
3962            // days than the end month.
3963            return -monthDiff(b, a);
3964        }
3965        // difference in months
3966        var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
3967            // b is in (anchor - 1 month, anchor + 1 month)
3968            anchor = a.clone().add(wholeMonthDiff, 'months'),
3969            anchor2,
3970            adjust;
3971
3972        if (b - anchor < 0) {
3973            anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
3974            // linear across the month
3975            adjust = (b - anchor) / (anchor - anchor2);
3976        } else {
3977            anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
3978            // linear across the month
3979            adjust = (b - anchor) / (anchor2 - anchor);
3980        }
3981
3982        //check for negative zero, return zero if negative zero
3983        return -(wholeMonthDiff + adjust) || 0;
3984    }
3985
3986    hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
3987    hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
3988
3989    function toString() {
3990        return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
3991    }
3992
3993    function toISOString(keepOffset) {
3994        if (!this.isValid()) {
3995            return null;
3996        }
3997        var utc = keepOffset !== true,
3998            m = utc ? this.clone().utc() : this;
3999        if (m.year() < 0 || m.year() > 9999) {
4000            return formatMoment(
4001                m,
4002                utc
4003                    ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
4004                    : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
4005            );
4006        }
4007        if (isFunction(Date.prototype.toISOString)) {
4008            // native implementation is ~50x faster, use it when we can
4009            if (utc) {
4010                return this.toDate().toISOString();
4011            } else {
4012                return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
4013                    .toISOString()
4014                    .replace('Z', formatMoment(m, 'Z'));
4015            }
4016        }
4017        return formatMoment(
4018            m,
4019            utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
4020        );
4021    }
4022
4023    /**
4024     * Return a human readable representation of a moment that can
4025     * also be evaluated to get a new moment which is the same
4026     *
4027     * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
4028     */
4029    function inspect() {
4030        if (!this.isValid()) {
4031            return 'moment.invalid(/* ' + this._i + ' */)';
4032        }
4033        var func = 'moment',
4034            zone = '',
4035            prefix,
4036            year,
4037            datetime,
4038            suffix;
4039        if (!this.isLocal()) {
4040            func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
4041            zone = 'Z';
4042        }
4043        prefix = '[' + func + '("]';
4044        year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
4045        datetime = '-MM-DD[T]HH:mm:ss.SSS';
4046        suffix = zone + '[")]';
4047
4048        return this.format(prefix + year + datetime + suffix);
4049    }
4050
4051    function format(inputString) {
4052        if (!inputString) {
4053            inputString = this.isUtc()
4054                ? hooks.defaultFormatUtc
4055                : hooks.defaultFormat;
4056        }
4057        var output = formatMoment(this, inputString);
4058        return this.localeData().postformat(output);
4059    }
4060
4061    function from(time, withoutSuffix) {
4062        if (
4063            this.isValid() &&
4064            ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
4065        ) {
4066            return createDuration({ to: this, from: time })
4067                .locale(this.locale())
4068                .humanize(!withoutSuffix);
4069        } else {
4070            return this.localeData().invalidDate();
4071        }
4072    }
4073
4074    function fromNow(withoutSuffix) {
4075        return this.from(createLocal(), withoutSuffix);
4076    }
4077
4078    function to(time, withoutSuffix) {
4079        if (
4080            this.isValid() &&
4081            ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
4082        ) {
4083            return createDuration({ from: this, to: time })
4084                .locale(this.locale())
4085                .humanize(!withoutSuffix);
4086        } else {
4087            return this.localeData().invalidDate();
4088        }
4089    }
4090
4091    function toNow(withoutSuffix) {
4092        return this.to(createLocal(), withoutSuffix);
4093    }
4094
4095    // If passed a locale key, it will set the locale for this
4096    // instance.  Otherwise, it will return the locale configuration
4097    // variables for this instance.
4098    function locale(key) {
4099        var newLocaleData;
4100
4101        if (key === undefined) {
4102            return this._locale._abbr;
4103        } else {
4104            newLocaleData = getLocale(key);
4105            if (newLocaleData != null) {
4106                this._locale = newLocaleData;
4107            }
4108            return this;
4109        }
4110    }
4111
4112    var lang = deprecate(
4113        'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
4114        function (key) {
4115            if (key === undefined) {
4116                return this.localeData();
4117            } else {
4118                return this.locale(key);
4119            }
4120        }
4121    );
4122
4123    function localeData() {
4124        return this._locale;
4125    }
4126
4127    var MS_PER_SECOND = 1000,
4128        MS_PER_MINUTE = 60 * MS_PER_SECOND,
4129        MS_PER_HOUR = 60 * MS_PER_MINUTE,
4130        MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
4131
4132    // actual modulo - handles negative numbers (for dates before 1970):
4133    function mod$1(dividend, divisor) {
4134        return ((dividend % divisor) + divisor) % divisor;
4135    }
4136
4137    function localStartOfDate(y, m, d) {
4138        // the date constructor remaps years 0-99 to 1900-1999
4139        if (y < 100 && y >= 0) {
4140            // preserve leap years using a full 400 year cycle, then reset
4141            return new Date(y + 400, m, d) - MS_PER_400_YEARS;
4142        } else {
4143            return new Date(y, m, d).valueOf();
4144        }
4145    }
4146
4147    function utcStartOfDate(y, m, d) {
4148        // Date.UTC remaps years 0-99 to 1900-1999
4149        if (y < 100 && y >= 0) {
4150            // preserve leap years using a full 400 year cycle, then reset
4151            return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
4152        } else {
4153            return Date.UTC(y, m, d);
4154        }
4155    }
4156
4157    function startOf(units) {
4158        var time, startOfDate;
4159        units = normalizeUnits(units);
4160        if (units === undefined || units === 'millisecond' || !this.isValid()) {
4161            return this;
4162        }
4163
4164        startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
4165
4166        switch (units) {
4167            case 'year':
4168                time = startOfDate(this.year(), 0, 1);
4169                break;
4170            case 'quarter':
4171                time = startOfDate(
4172                    this.year(),
4173                    this.month() - (this.month() % 3),
4174                    1
4175                );
4176                break;
4177            case 'month':
4178                time = startOfDate(this.year(), this.month(), 1);
4179                break;
4180            case 'week':
4181                time = startOfDate(
4182                    this.year(),
4183                    this.month(),
4184                    this.date() - this.weekday()
4185                );
4186                break;
4187            case 'isoWeek':
4188                time = startOfDate(
4189                    this.year(),
4190                    this.month(),
4191                    this.date() - (this.isoWeekday() - 1)
4192                );
4193                break;
4194            case 'day':
4195            case 'date':
4196                time = startOfDate(this.year(), this.month(), this.date());
4197                break;
4198            case 'hour':
4199                time = this._d.valueOf();
4200                time -= mod$1(
4201                    time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
4202                    MS_PER_HOUR
4203                );
4204                break;
4205            case 'minute':
4206                time = this._d.valueOf();
4207                time -= mod$1(time, MS_PER_MINUTE);
4208                break;
4209            case 'second':
4210                time = this._d.valueOf();
4211                time -= mod$1(time, MS_PER_SECOND);
4212                break;
4213        }
4214
4215        this._d.setTime(time);
4216        hooks.updateOffset(this, true);
4217        return this;
4218    }
4219
4220    function endOf(units) {
4221        var time, startOfDate;
4222        units = normalizeUnits(units);
4223        if (units === undefined || units === 'millisecond' || !this.isValid()) {
4224            return this;
4225        }
4226
4227        startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
4228
4229        switch (units) {
4230            case 'year':
4231                time = startOfDate(this.year() + 1, 0, 1) - 1;
4232                break;
4233            case 'quarter':
4234                time =
4235                    startOfDate(
4236                        this.year(),
4237                        this.month() - (this.month() % 3) + 3,
4238                        1
4239                    ) - 1;
4240                break;
4241            case 'month':
4242                time = startOfDate(this.year(), this.month() + 1, 1) - 1;
4243                break;
4244            case 'week':
4245                time =
4246                    startOfDate(
4247                        this.year(),
4248                        this.month(),
4249                        this.date() - this.weekday() + 7
4250                    ) - 1;
4251                break;
4252            case 'isoWeek':
4253                time =
4254                    startOfDate(
4255                        this.year(),
4256                        this.month(),
4257                        this.date() - (this.isoWeekday() - 1) + 7
4258                    ) - 1;
4259                break;
4260            case 'day':
4261            case 'date':
4262                time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
4263                break;
4264            case 'hour':
4265                time = this._d.valueOf();
4266                time +=
4267                    MS_PER_HOUR -
4268                    mod$1(
4269                        time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
4270                        MS_PER_HOUR
4271                    ) -
4272                    1;
4273                break;
4274            case 'minute':
4275                time = this._d.valueOf();
4276                time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
4277                break;
4278            case 'second':
4279                time = this._d.valueOf();
4280                time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
4281                break;
4282        }
4283
4284        this._d.setTime(time);
4285        hooks.updateOffset(this, true);
4286        return this;
4287    }
4288
4289    function valueOf() {
4290        return this._d.valueOf() - (this._offset || 0) * 60000;
4291    }
4292
4293    function unix() {
4294        return Math.floor(this.valueOf() / 1000);
4295    }
4296
4297    function toDate() {
4298        return new Date(this.valueOf());
4299    }
4300
4301    function toArray() {
4302        var m = this;
4303        return [
4304            m.year(),
4305            m.month(),
4306            m.date(),
4307            m.hour(),
4308            m.minute(),
4309            m.second(),
4310            m.millisecond(),
4311        ];
4312    }
4313
4314    function toObject() {
4315        var m = this;
4316        return {
4317            years: m.year(),
4318            months: m.month(),
4319            date: m.date(),
4320            hours: m.hours(),
4321            minutes: m.minutes(),
4322            seconds: m.seconds(),
4323            milliseconds: m.milliseconds(),
4324        };
4325    }
4326
4327    function toJSON() {
4328        // new Date(NaN).toJSON() === null
4329        return this.isValid() ? this.toISOString() : null;
4330    }
4331
4332    function isValid$2() {
4333        return isValid(this);
4334    }
4335
4336    function parsingFlags() {
4337        return extend({}, getParsingFlags(this));
4338    }
4339
4340    function invalidAt() {
4341        return getParsingFlags(this).overflow;
4342    }
4343
4344    function creationData() {
4345        return {
4346            input: this._i,
4347            format: this._f,
4348            locale: this._locale,
4349            isUTC: this._isUTC,
4350            strict: this._strict,
4351        };
4352    }
4353
4354    addFormatToken('N', 0, 0, 'eraAbbr');
4355    addFormatToken('NN', 0, 0, 'eraAbbr');
4356    addFormatToken('NNN', 0, 0, 'eraAbbr');
4357    addFormatToken('NNNN', 0, 0, 'eraName');
4358    addFormatToken('NNNNN', 0, 0, 'eraNarrow');
4359
4360    addFormatToken('y', ['y', 1], 'yo', 'eraYear');
4361    addFormatToken('y', ['yy', 2], 0, 'eraYear');
4362    addFormatToken('y', ['yyy', 3], 0, 'eraYear');
4363    addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
4364
4365    addRegexToken('N', matchEraAbbr);
4366    addRegexToken('NN', matchEraAbbr);
4367    addRegexToken('NNN', matchEraAbbr);
4368    addRegexToken('NNNN', matchEraName);
4369    addRegexToken('NNNNN', matchEraNarrow);
4370
4371    addParseToken(
4372        ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'],
4373        function (input, array, config, token) {
4374            var era = config._locale.erasParse(input, token, config._strict);
4375            if (era) {
4376                getParsingFlags(config).era = era;
4377            } else {
4378                getParsingFlags(config).invalidEra = input;
4379            }
4380        }
4381    );
4382
4383    addRegexToken('y', matchUnsigned);
4384    addRegexToken('yy', matchUnsigned);
4385    addRegexToken('yyy', matchUnsigned);
4386    addRegexToken('yyyy', matchUnsigned);
4387    addRegexToken('yo', matchEraYearOrdinal);
4388
4389    addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
4390    addParseToken(['yo'], function (input, array, config, token) {
4391        var match;
4392        if (config._locale._eraYearOrdinalRegex) {
4393            match = input.match(config._locale._eraYearOrdinalRegex);
4394        }
4395
4396        if (config._locale.eraYearOrdinalParse) {
4397            array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
4398        } else {
4399            array[YEAR] = parseInt(input, 10);
4400        }
4401    });
4402
4403    function localeEras(m, format) {
4404        var i,
4405            l,
4406            date,
4407            eras = this._eras || getLocale('en')._eras;
4408        for (i = 0, l = eras.length; i < l; ++i) {
4409            switch (typeof eras[i].since) {
4410                case 'string':
4411                    // truncate time
4412                    date = hooks(eras[i].since).startOf('day');
4413                    eras[i].since = date.valueOf();
4414                    break;
4415            }
4416
4417            switch (typeof eras[i].until) {
4418                case 'undefined':
4419                    eras[i].until = +Infinity;
4420                    break;
4421                case 'string':
4422                    // truncate time
4423                    date = hooks(eras[i].until).startOf('day').valueOf();
4424                    eras[i].until = date.valueOf();
4425                    break;
4426            }
4427        }
4428        return eras;
4429    }
4430
4431    function localeErasParse(eraName, format, strict) {
4432        var i,
4433            l,
4434            eras = this.eras(),
4435            name,
4436            abbr,
4437            narrow;
4438        eraName = eraName.toUpperCase();
4439
4440        for (i = 0, l = eras.length; i < l; ++i) {
4441            name = eras[i].name.toUpperCase();
4442            abbr = eras[i].abbr.toUpperCase();
4443            narrow = eras[i].narrow.toUpperCase();
4444
4445            if (strict) {
4446                switch (format) {
4447                    case 'N':
4448                    case 'NN':
4449                    case 'NNN':
4450                        if (abbr === eraName) {
4451                            return eras[i];
4452                        }
4453                        break;
4454
4455                    case 'NNNN':
4456                        if (name === eraName) {
4457                            return eras[i];
4458                        }
4459                        break;
4460
4461                    case 'NNNNN':
4462                        if (narrow === eraName) {
4463                            return eras[i];
4464                        }
4465                        break;
4466                }
4467            } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
4468                return eras[i];
4469            }
4470        }
4471    }
4472
4473    function localeErasConvertYear(era, year) {
4474        var dir = era.since <= era.until ? +1 : -1;
4475        if (year === undefined) {
4476            return hooks(era.since).year();
4477        } else {
4478            return hooks(era.since).year() + (year - era.offset) * dir;
4479        }
4480    }
4481
4482    function getEraName() {
4483        var i,
4484            l,
4485            val,
4486            eras = this.localeData().eras();
4487        for (i = 0, l = eras.length; i < l; ++i) {
4488            // truncate time
4489            val = this.clone().startOf('day').valueOf();
4490
4491            if (eras[i].since <= val && val <= eras[i].until) {
4492                return eras[i].name;
4493            }
4494            if (eras[i].until <= val && val <= eras[i].since) {
4495                return eras[i].name;
4496            }
4497        }
4498
4499        return '';
4500    }
4501
4502    function getEraNarrow() {
4503        var i,
4504            l,
4505            val,
4506            eras = this.localeData().eras();
4507        for (i = 0, l = eras.length; i < l; ++i) {
4508            // truncate time
4509            val = this.clone().startOf('day').valueOf();
4510
4511            if (eras[i].since <= val && val <= eras[i].until) {
4512                return eras[i].narrow;
4513            }
4514            if (eras[i].until <= val && val <= eras[i].since) {
4515                return eras[i].narrow;
4516            }
4517        }
4518
4519        return '';
4520    }
4521
4522    function getEraAbbr() {
4523        var i,
4524            l,
4525            val,
4526            eras = this.localeData().eras();
4527        for (i = 0, l = eras.length; i < l; ++i) {
4528            // truncate time
4529            val = this.clone().startOf('day').valueOf();
4530
4531            if (eras[i].since <= val && val <= eras[i].until) {
4532                return eras[i].abbr;
4533            }
4534            if (eras[i].until <= val && val <= eras[i].since) {
4535                return eras[i].abbr;
4536            }
4537        }
4538
4539        return '';
4540    }
4541
4542    function getEraYear() {
4543        var i,
4544            l,
4545            dir,
4546            val,
4547            eras = this.localeData().eras();
4548        for (i = 0, l = eras.length; i < l; ++i) {
4549            dir = eras[i].since <= eras[i].until ? +
vendor: 9,818 bytes, lines 4549-4908
45491 : -1;
4550
4551            // truncate time
4552            val = this.clone().startOf('day').valueOf();
4553
4554            if (
4555                (eras[i].since <= val && val <= eras[i].until) ||
4556                (eras[i].until <= val && val <= eras[i].since)
4557            ) {
4558                return (
4559                    (this.year() - hooks(eras[i].since).year()) * dir +
4560                    eras[i].offset
4561                );
4562            }
4563        }
4564
4565        return this.year();
4566    }
4567
4568    function erasNameRegex(isStrict) {
4569        if (!hasOwnProp(this, '_erasNameRegex')) {
4570            computeErasParse.call(this);
4571        }
4572        return isStrict ? this._erasNameRegex : this._erasRegex;
4573    }
4574
4575    function erasAbbrRegex(isStrict) {
4576        if (!hasOwnProp(this, '_erasAbbrRegex')) {
4577            computeErasParse.call(this);
4578        }
4579        return isStrict ? this._erasAbbrRegex : this._erasRegex;
4580    }
4581
4582    function erasNarrowRegex(isStrict) {
4583        if (!hasOwnProp(this, '_erasNarrowRegex')) {
4584            computeErasParse.call(this);
4585        }
4586        return isStrict ? this._erasNarrowRegex : this._erasRegex;
4587    }
4588
4589    function matchEraAbbr(isStrict, locale) {
4590        return locale.erasAbbrRegex(isStrict);
4591    }
4592
4593    function matchEraName(isStrict, locale) {
4594        return locale.erasNameRegex(isStrict);
4595    }
4596
4597    function matchEraNarrow(isStrict, locale) {
4598        return locale.erasNarrowRegex(isStrict);
4599    }
4600
4601    function matchEraYearOrdinal(isStrict, locale) {
4602        return locale._eraYearOrdinalRegex || matchUnsigned;
4603    }
4604
4605    function computeErasParse() {
4606        var abbrPieces = [],
4607            namePieces = [],
4608            narrowPieces = [],
4609            mixedPieces = [],
4610            i,
4611            l,
4612            erasName,
4613            erasAbbr,
4614            erasNarrow,
4615            eras = this.eras();
4616
4617        for (i = 0, l = eras.length; i < l; ++i) {
4618            erasName = regexEscape(eras[i].name);
4619            erasAbbr = regexEscape(eras[i].abbr);
4620            erasNarrow = regexEscape(eras[i].narrow);
4621
4622            namePieces.push(erasName);
4623            abbrPieces.push(erasAbbr);
4624            narrowPieces.push(erasNarrow);
4625            mixedPieces.push(erasName);
4626            mixedPieces.push(erasAbbr);
4627            mixedPieces.push(erasNarrow);
4628        }
4629
4630        this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
4631        this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
4632        this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
4633        this._erasNarrowRegex = new RegExp(
4634            '^(' + narrowPieces.join('|') + ')',
4635            'i'
4636        );
4637    }
4638
4639    // FORMATTING
4640
4641    addFormatToken(0, ['gg', 2], 0, function () {
4642        return this.weekYear() % 100;
4643    });
4644
4645    addFormatToken(0, ['GG', 2], 0, function () {
4646        return this.isoWeekYear() % 100;
4647    });
4648
4649    function addWeekYearFormatToken(token, getter) {
4650        addFormatToken(0, [token, token.length], 0, getter);
4651    }
4652
4653    addWeekYearFormatToken('gggg', 'weekYear');
4654    addWeekYearFormatToken('ggggg', 'weekYear');
4655    addWeekYearFormatToken('GGGG', 'isoWeekYear');
4656    addWeekYearFormatToken('GGGGG', 'isoWeekYear');
4657
4658    // ALIASES
4659
4660    // PARSING
4661
4662    addRegexToken('G', matchSigned);
4663    addRegexToken('g', matchSigned);
4664    addRegexToken('GG', match1to2, match2);
4665    addRegexToken('gg', match1to2, match2);
4666    addRegexToken('GGGG', match1to4, match4);
4667    addRegexToken('gggg', match1to4, match4);
4668    addRegexToken('GGGGG', match1to6, match6);
4669    addRegexToken('ggggg', match1to6, match6);
4670
4671    addWeekParseToken(
4672        ['gggg', 'ggggg', 'GGGG', 'GGGGG'],
4673        function (input, week, config, token) {
4674            week[token.substr(0, 2)] = toInt(input);
4675        }
4676    );
4677
4678    addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
4679        week[token] = hooks.parseTwoDigitYear(input);
4680    });
4681
4682    // MOMENTS
4683
4684    function getSetWeekYear(input) {
4685        return getSetWeekYearHelper.call(
4686            this,
4687            input,
4688            this.week(),
4689            this.weekday() + this.localeData()._week.dow,
4690            this.localeData()._week.dow,
4691            this.localeData()._week.doy
4692        );
4693    }
4694
4695    function getSetISOWeekYear(input) {
4696        return getSetWeekYearHelper.call(
4697            this,
4698            input,
4699            this.isoWeek(),
4700            this.isoWeekday(),
4701            1,
4702            4
4703        );
4704    }
4705
4706    function getISOWeeksInYear() {
4707        return weeksInYear(this.year(), 1, 4);
4708    }
4709
4710    function getISOWeeksInISOWeekYear() {
4711        return weeksInYear(this.isoWeekYear(), 1, 4);
4712    }
4713
4714    function getWeeksInYear() {
4715        var weekInfo = this.localeData()._week;
4716        return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
4717    }
4718
4719    function getWeeksInWeekYear() {
4720        var weekInfo = this.localeData()._week;
4721        return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
4722    }
4723
4724    function getSetWeekYearHelper(input, week, weekday, dow, doy) {
4725        var weeksTarget;
4726        if (input == null) {
4727            return weekOfYear(this, dow, doy).year;
4728        } else {
4729            weeksTarget = weeksInYear(input, dow, doy);
4730            if (week > weeksTarget) {
4731                week = weeksTarget;
4732            }
4733            return setWeekAll.call(this, input, week, weekday, dow, doy);
4734        }
4735    }
4736
4737    function setWeekAll(weekYear, week, weekday, dow, doy) {
4738        var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
4739            date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
4740
4741        this.year(date.getUTCFullYear());
4742        this.month(date.getUTCMonth());
4743        this.date(date.getUTCDate());
4744        return this;
4745    }
4746
4747    // FORMATTING
4748
4749    addFormatToken('Q', 0, 'Qo', 'quarter');
4750
4751    // PARSING
4752
4753    addRegexToken('Q', match1);
4754    addParseToken('Q', function (input, array) {
4755        array[MONTH] = (toInt(input) - 1) * 3;
4756    });
4757
4758    // MOMENTS
4759
4760    function getSetQuarter(input) {
4761        return input == null
4762            ? Math.ceil((this.month() + 1) / 3)
4763            : this.month((input - 1) * 3 + (this.month() % 3));
4764    }
4765
4766    // FORMATTING
4767
4768    addFormatToken('D', ['DD', 2], 'Do', 'date');
4769
4770    // PARSING
4771
4772    addRegexToken('D', match1to2, match1to2NoLeadingZero);
4773    addRegexToken('DD', match1to2, match2);
4774    addRegexToken('Do', function (isStrict, locale) {
4775        // TODO: Remove "ordinalParse" fallback in next major release.
4776        return isStrict
4777            ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
4778            : locale._dayOfMonthOrdinalParseLenient;
4779    });
4780
4781    addParseToken(['D', 'DD'], DATE);
4782    addParseToken('Do', function (input, array) {
4783        array[DATE] = toInt(input.match(match1to2)[0]);
4784    });
4785
4786    // MOMENTS
4787
4788    var getSetDayOfMonth = makeGetSet('Date', true);
4789
4790    // FORMATTING
4791
4792    addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
4793
4794    // PARSING
4795
4796    addRegexToken('DDD', match1to3);
4797    addRegexToken('DDDD', match3);
4798    addParseToken(['DDD', 'DDDD'], function (input, array, config) {
4799        config._dayOfYear = toInt(input);
4800    });
4801
4802    // HELPERS
4803
4804    // MOMENTS
4805
4806    function getSetDayOfYear(input) {
4807        var dayOfYear =
4808            Math.round(
4809                (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
4810            ) + 1;
4811        return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
4812    }
4813
4814    // FORMATTING
4815
4816    addFormatToken('m', ['mm', 2], 0, 'minute');
4817
4818    // PARSING
4819
4820    addRegexToken('m', match1to2, match1to2HasZero);
4821    addRegexToken('mm', match1to2, match2);
4822    addParseToken(['m', 'mm'], MINUTE);
4823
4824    // MOMENTS
4825
4826    var getSetMinute = makeGetSet('Minutes', false);
4827
4828    // FORMATTING
4829
4830    addFormatToken('s', ['ss', 2], 0, 'second');
4831
4832    // PARSING
4833
4834    addRegexToken('s', match1to2, match1to2HasZero);
4835    addRegexToken('ss', match1to2, match2);
4836    addParseToken(['s', 'ss'], SECOND);
4837
4838    // MOMENTS
4839
4840    var getSetSecond = makeGetSet('Seconds', false);
4841
4842    // FORMATTING
4843
4844    addFormatToken('S', 0, 0, function () {
4845        return ~~(this.millisecond() / 100);
4846    });
4847
4848    addFormatToken(0, ['SS', 2], 0, function () {
4849        return ~~(this.millisecond() / 10);
4850    });
4851
4852    addFormatToken(0, ['SSS', 3], 0, 'millisecond');
4853    addFormatToken(0, ['SSSS', 4], 0, function () {
4854        return this.millisecond() * 10;
4855    });
4856    addFormatToken(0, ['SSSSS', 5], 0, function () {
4857        return this.millisecond() * 100;
4858    });
4859    addFormatToken(0, ['SSSSSS', 6], 0, function () {
4860        return this.millisecond() * 1000;
4861    });
4862    addFormatToken(0, ['SSSSSSS', 7], 0, function () {
4863        return this.millisecond() * 10000;
4864    });
4865    addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
4866        return this.millisecond() * 100000;
4867    });
4868    addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
4869        return this.millisecond() * 1000000;
4870    });
4871
4872    // PARSING
4873
4874    addRegexToken('S', match1to3, match1);
4875    addRegexToken('SS', match1to3, match2);
4876    addRegexToken('SSS', match1to3, match3);
4877
4878    var token, getSetMillisecond;
4879    for (token = 'SSSS'; token.length <= 9; token += 'S') {
4880        addRegexToken(token, matchUnsigned);
4881    }
4882
4883    function parseMs(input, array) {
4884        array[MILLISECOND] = toInt(('0.' + input) * 1000);
4885    }
4886
4887    for (token = 'S'; token.length <= 9; token += 'S') {
4888        addParseToken(token, parseMs);
4889    }
4890
4891    getSetMillisecond = makeGetSet('Milliseconds', false);
4892
4893    // FORMATTING
4894
4895    addFormatToken('z', 0, 0, 'zoneAbbr');
4896    addFormatToken('zz', 0, 0, 'zoneName');
4897
4898    // MOMENTS
4899
4900    function getZoneAbbr() {
4901        return this._isUTC ? 'UTC' : '';
4902    }
4903
4904    function getZoneName() {
4905        return this._isUTC ? 'Coordinated Universal Time' : '';
4906    }
4907
4908    var proto
4908 = Moment.prototype;
4909
4910    proto.add = add;
4911    proto.calendar = calendar$1;
4912    proto.clone = clone;
4913    proto.diff = diff;
4914    proto.endOf = endOf;
4915    proto.format = format;
4916    proto.from = from;
4917    proto.fromNow = fromNow;
4918    proto.to = to;
4919    proto.toNow = toNow;
4920    proto.get = stringGet;
4921    proto.invalidAt = invalidAt;
4922    proto.isAfter = isAfter;
4923    proto.isBefore = isBefore;
4924    proto.isBetween = isBetween;
4925    proto.isSame = isSame;
4926    proto.isSameOrAfter = isSameOrAfter;
4927    proto.isSameOrBefore = isSameOrBefore;
4928    proto.isValid = isValid$2;
4929    proto.lang = lang;
4930    proto.locale = locale;
4931    proto.localeData = localeData;
4932    proto.max = prototypeMax;
4933    proto.min = prototypeMin;
4934    proto.parsingFlags = parsingFlags;
4935    proto.set = stringSet;
4936    proto.startOf = startOf;
4937    proto.subtract = subtract;
4938    proto.toArray = toArray;
4939    proto.toObject = toObject;
4940    proto.toDate = toDate;
4941    proto.toISOString = toISOString;
4942    proto.inspect = inspect;
4943    if (typeof Symbol !== 'undefined' && Symbol.for != null) {
4944        proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
4945            return 'Moment<' + this.format() + '>';
4946        };
4947    }
4948    proto.toJSON = toJSON;
4949    proto.toString = toString;
4950    proto.unix = unix;
4951    proto.valueOf = valueOf;
4952    proto.creationData = creationData;
4953    proto.eraName = getEraName;
vendor: 4,989 bytes, lines 4954-5108
4954    proto.eraNarrow = getEraNarrow;
4955    proto.eraAbbr = getEraAbbr;
4956    proto.eraYear = getEraYear;
4957    proto.year = getSetYear;
4958    proto.isLeapYear = getIsLeapYear;
4959    proto.weekYear = getSetWeekYear;
4960    proto.isoWeekYear = getSetISOWeekYear;
4961    proto.quarter = proto.quarters = getSetQuarter;
4962    proto.month = getSetMonth;
4963    proto.daysInMonth = getDaysInMonth;
4964    proto.week = proto.weeks = getSetWeek;
4965    proto.isoWeek = proto.isoWeeks = getSetISOWeek;
4966    proto.weeksInYear = getWeeksInYear;
4967    proto.weeksInWeekYear = getWeeksInWeekYear;
4968    proto.isoWeeksInYear = getISOWeeksInYear;
4969    proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
4970    proto.date = getSetDayOfMonth;
4971    proto.day = proto.days = getSetDayOfWeek;
4972    proto.weekday = getSetLocaleDayOfWeek;
4973    proto.isoWeekday = getSetISODayOfWeek;
4974    proto.dayOfYear = getSetDayOfYear;
4975    proto.hour = proto.hours = getSetHour;
4976    proto.minute = proto.minutes = getSetMinute;
4977    proto.second = proto.seconds = getSetSecond;
4978    proto.millisecond = proto.milliseconds = getSetMillisecond;
4979    proto.utcOffset = getSetOffset;
4980    proto.utc = setOffsetToUTC;
4981    proto.local = setOffsetToLocal;
4982    proto.parseZone = setOffsetToParsedOffset;
4983    proto.hasAlignedHourOffset = hasAlignedHourOffset;
4984    proto.isDST = isDaylightSavingTime;
4985    proto.isLocal = isLocal;
4986    proto.isUtcOffset = isUtcOffset;
4987    proto.isUtc = isUtc;
4988    proto.isUTC = isUtc;
4989    proto.zoneAbbr = getZoneAbbr;
4990    proto.zoneName = getZoneName;
4991    proto.dates = deprecate(
4992        'dates accessor is deprecated. Use date instead.',
4993        getSetDayOfMonth
4994    );
4995    proto.months = deprecate(
4996        'months accessor is deprecated. Use month instead',
4997        getSetMonth
4998    );
4999    proto.years = deprecate(
5000        'years accessor is deprecated. Use year instead',
5001        getSetYear
5002    );
5003    proto.zone = deprecate(
5004        'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
5005        getSetZone
5006    );
5007    proto.isDSTShifted = deprecate(
5008        'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
5009        isDaylightSavingTimeShifted
5010    );
5011
5012    function createUnix(input) {
5013        return createLocal(input * 1000);
5014    }
5015
5016    function createInZone() {
5017        return createLocal.apply(null, arguments).parseZone();
5018    }
5019
5020    function preParsePostFormat(string) {
5021        return string;
5022    }
5023
5024    var proto$1 = Locale.prototype;
5025
5026    proto$1.calendar = calendar;
5027    proto$1.longDateFormat = longDateFormat;
5028    proto$1.invalidDate = invalidDate;
5029    proto$1.ordinal = ordinal;
5030    proto$1.preparse = preParsePostFormat;
5031    proto$1.postformat = preParsePostFormat;
5032    proto$1.relativeTime = relativeTime;
5033    proto$1.pastFuture = pastFuture;
5034    proto$1.set = set;
5035    proto$1.eras = localeEras;
5036    proto$1.erasParse = localeErasParse;
5037    proto$1.erasConvertYear = localeErasConvertYear;
5038    proto$1.erasAbbrRegex = erasAbbrRegex;
5039    proto$1.erasNameRegex = erasNameRegex;
5040    proto$1.erasNarrowRegex = erasNarrowRegex;
5041
5042    proto$1.months = localeMonths;
5043    proto$1.monthsShort = localeMonthsShort;
5044    proto$1.monthsParse = localeMonthsParse;
5045    proto$1.monthsRegex = monthsRegex;
5046    proto$1.monthsShortRegex = monthsShortRegex;
5047    proto$1.week = localeWeek;
5048    proto$1.firstDayOfYear = localeFirstDayOfYear;
5049    proto$1.firstDayOfWeek = localeFirstDayOfWeek;
5050
5051    proto$1.weekdays = localeWeekdays;
5052    proto$1.weekdaysMin = localeWeekdaysMin;
5053    proto$1.weekdaysShort = localeWeekdaysShort;
5054    proto$1.weekdaysParse = localeWeekdaysParse;
5055
5056    proto$1.weekdaysRegex = weekdaysRegex;
5057    proto$1.weekdaysShortRegex = weekdaysShortRegex;
5058    proto$1.weekdaysMinRegex = weekdaysMinRegex;
5059
5060    proto$1.isPM = localeIsPM;
5061    proto$1.meridiem = localeMeridiem;
5062
5063    function get$1(format, index, field, setter) {
5064        var locale = getLocale(),
5065            utc = createUTC().set(setter, index);
5066        return locale[field](utc, format);
5067    }
5068
5069    function listMonthsImpl(format, index, field) {
5070        if (isNumber(format)) {
5071            index = format;
5072            format = undefined;
5073        }
5074
5075        format = format || '';
5076
5077        if (index != null) {
5078            return get$1(format, index, field, 'month');
5079        }
5080
5081        var i,
5082            out = [];
5083        for (i = 0; i < 12; i++) {
5084            out[i] = get$1(format, i, field, 'month');
5085        }
5086        return out;
5087    }
5088
5089    // ()
5090    // (5)
5091    // (fmt, 5)
5092    // (fmt)
5093    // (true)
5094    // (true, 5)
5095    // (true, fmt, 5)
5096    // (true, fmt)
5097    function listWeekdaysImpl(localeSorted, format, index, field) {
5098        if (typeof localeSorted === 'boolean') {
5099            if (isNumber(format)) {
5100                index = format;
5101                format = undefined;
5102            }
5103
5104            format = format || '';
5105        } else {
5106            format = localeSorted;
5107            index = format;
5108            localeSorted = false;
vendor: 10,599 bytes, lines 5109-5453
5109
5110            if (isNumber(format)) {
5111                index = format;
5112                format = undefined;
5113            }
5114
5115            format = format || '';
5116        }
5117
5118        var locale = getLocale(),
5119            shift = localeSorted ? locale._week.dow : 0,
5120            i,
5121            out = [];
5122
5123        if (index != null) {
5124            return get$1(format, (index + shift) % 7, field, 'day');
5125        }
5126
5127        for (i = 0; i < 7; i++) {
5128            out[i] = get$1(format, (i + shift) % 7, field, 'day');
5129        }
5130        return out;
5131    }
5132
5133    function listMonths(format, index) {
5134        return listMonthsImpl(format, index, 'months');
5135    }
5136
5137    function listMonthsShort(format, index) {
5138        return listMonthsImpl(format, index, 'monthsShort');
5139    }
5140
5141    function listWeekdays(localeSorted, format, index) {
5142        return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
5143    }
5144
5145    function listWeekdaysShort(localeSorted, format, index) {
5146        return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
5147    }
5148
5149    function listWeekdaysMin(localeSorted, format, index) {
5150        return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
5151    }
5152
5153    getSetGlobalLocale('en', {
5154        eras: [
5155            {
5156                since: '0001-01-01',
5157                until: +Infinity,
5158                offset: 1,
5159                name: 'Anno Domini',
5160                narrow: 'AD',
5161                abbr: 'AD',
5162            },
5163            {
5164                since: '0000-12-31',
5165                until: -Infinity,
5166                offset: 1,
5167                name: 'Before Christ',
5168                narrow: 'BC',
5169                abbr: 'BC',
5170            },
5171        ],
5172        dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
5173        ordinal: function (number) {
5174            var b = number % 10,
5175                output =
5176                    toInt((number % 100) / 10) === 1
5177                        ? 'th'
5178                        : b === 1
5179                          ? 'st'
5180                          : b === 2
5181                            ? 'nd'
5182                            : b === 3
5183                              ? 'rd'
5184                              : 'th';
5185            return number + output;
5186        },
5187    });
5188
5189    // Side effect imports
5190
5191    hooks.lang = deprecate(
5192        'moment.lang is deprecated. Use moment.locale instead.',
5193        getSetGlobalLocale
5194    );
5195    hooks.langData = deprecate(
5196        'moment.langData is deprecated. Use moment.localeData instead.',
5197        getLocale
5198    );
5199
5200    var mathAbs = Math.abs;
5201
5202    function abs() {
5203        var data = this._data;
5204
5205        this._milliseconds = mathAbs(this._milliseconds);
5206        this._days = mathAbs(this._days);
5207        this._months = mathAbs(this._months);
5208
5209        data.milliseconds = mathAbs(data.milliseconds);
5210        data.seconds = mathAbs(data.seconds);
5211        data.minutes = mathAbs(data.minutes);
5212        data.hours = mathAbs(data.hours);
5213        data.months = mathAbs(data.months);
5214        data.years = mathAbs(data.years);
5215
5216        return this;
5217    }
5218
5219    function addSubtract$1(duration, input, value, direction) {
5220        var other = createDuration(input, value);
5221
5222        duration._milliseconds += direction * other._milliseconds;
5223        duration._days += direction * other._days;
5224        duration._months += direction * other._months;
5225
5226        return duration._bubble();
5227    }
5228
5229    // supports only 2.0-style add(1, 's') or add(duration)
5230    function add$1(input, value) {
5231        return addSubtract$1(this, input, value, 1);
5232    }
5233
5234    // supports only 2.0-style subtract(1, 's') or subtract(duration)
5235    function subtract$1(input, value) {
5236        return addSubtract$1(this, input, value, -1);
5237    }
5238
5239    function absCeil(number) {
5240        if (number < 0) {
5241            return Math.floor(number);
5242        } else {
5243            return Math.ceil(number);
5244        }
5245    }
5246
5247    function bubble() {
5248        var milliseconds = this._milliseconds,
5249            days = this._days,
5250            months = this._months,
5251            data = this._data,
5252            seconds,
5253            minutes,
5254            hours,
5255            years,
5256            monthsFromDays;
5257
5258        // if we have a mix of positive and negative values, bubble down first
5259        // check: https://github.com/moment/moment/issues/2166
5260        if (
5261            !(
5262                (milliseconds >= 0 && days >= 0 && months >= 0) ||
5263                (milliseconds <= 0 && days <= 0 && months <= 0)
5264            )
5265        ) {
5266            milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
5267            days = 0;
5268            months = 0;
5269        }
5270
5271        // The following code bubbles up values, see the tests for
5272        // examples of what that means.
5273        data.milliseconds = milliseconds % 1000;
5274
5275        seconds = absFloor(milliseconds / 1000);
5276        data.seconds = seconds % 60;
5277
5278        minutes = absFloor(seconds / 60);
5279        data.minutes = minutes % 60;
5280
5281        hours = absFloor(minutes / 60);
5282        data.hours = hours % 24;
5283
5284        days += absFloor(hours / 24);
5285
5286        // convert days to months
5287        monthsFromDays = absFloor(daysToMonths(days));
5288        months += monthsFromDays;
5289        days -= absCeil(monthsToDays(monthsFromDays));
5290
5291        // 12 months -> 1 year
5292        years = absFloor(months / 12);
5293        months %= 12;
5294
5295        data.days = days;
5296        data.months = months;
5297        data.years = years;
5298
5299        return this;
5300    }
5301
5302    function daysToMonths(days) {
5303        // 400 years have 146097 days (taking into account leap year rules)
5304        // 400 years have 12 months === 4800
5305        return (days * 4800) / 146097;
5306    }
5307
5308    function monthsToDays(months) {
5309        // the reverse of daysToMonths
5310        return (months * 146097) / 4800;
5311    }
5312
5313    function as(units) {
5314        if (!this.isValid()) {
5315            return NaN;
5316        }
5317        var days,
5318            months,
5319            milliseconds = this._milliseconds;
5320
5321        units = normalizeUnits(units);
5322
5323        if (units === 'month' || units === 'quarter' || units === 'year') {
5324            days = this._days + milliseconds / 864e5;
5325            months = this._months + daysToMonths(days);
5326            switch (units) {
5327                case 'month':
5328                    return months;
5329                case 'quarter':
5330                    return months / 3;
5331                case 'year':
5332                    return months / 12;
5333            }
5334        } else {
5335            // handle milliseconds separately because of floating point math errors (issue #1867)
5336            days = this._days + Math.round(monthsToDays(this._months));
5337            switch (units) {
5338                case 'week':
5339                    return days / 7 + milliseconds / 6048e5;
5340                case 'day':
5341                    return days + milliseconds / 864e5;
5342                case 'hour':
5343                    return days * 24 + milliseconds / 36e5;
5344                case 'minute':
5345                    return days * 1440 + milliseconds / 6e4;
5346                case 'second':
5347                    return days * 86400 + milliseconds / 1000;
5348                // Math.floor prevents floating point math errors here
5349                case 'millisecond':
5350                    return Math.floor(days * 864e5) + milliseconds;
5351                default:
5352                    throw new Error('Unknown unit ' + units);
5353            }
5354        }
5355    }
5356
5357    function makeAs(alias) {
5358        return function () {
5359            return this.as(alias);
5360        };
5361    }
5362
5363    var asMilliseconds = makeAs('ms'),
5364        asSeconds = makeAs('s'),
5365        asMinutes = makeAs('m'),
5366        asHours = makeAs('h'),
5367        asDays = makeAs('d'),
5368        asWeeks = makeAs('w'),
5369        asMonths = makeAs('M'),
5370        asQuarters = makeAs('Q'),
5371        asYears = makeAs('y'),
5372        valueOf$1 = asMilliseconds;
5373
5374    function clone$1() {
5375        return createDuration(this);
5376    }
5377
5378    function get$2(units) {
5379        units = normalizeUnits(units);
5380        return this.isValid() ? this[units + 's']() : NaN;
5381    }
5382
5383    function makeGetter(name) {
5384        return function () {
5385            return this.isValid() ? this._data[name] : NaN;
5386        };
5387    }
5388
5389    var milliseconds = makeGetter('milliseconds'),
5390        seconds = makeGetter('seconds'),
5391        minutes = makeGetter('minutes'),
5392        hours = makeGetter('hours'),
5393        days = makeGetter('days'),
5394        months = makeGetter('months'),
5395        years = makeGetter('years');
5396
5397    function weeks() {
5398        return absFloor(this.days() / 7);
5399    }
5400
5401    var round = Math.round,
5402        thresholds = {
5403            ss: 44, // a few seconds to seconds
5404            s: 45, // seconds to minute
5405            m: 45, // minutes to hour
5406            h: 22, // hours to day
5407            d: 26, // days to month/week
5408            w: null, // weeks to month
5409            M: 11, // months to year
5410        };
5411
5412    // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
5413    function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
5414        return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
5415    }
5416
5417    function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
5418        var duration = createDuration(posNegDuration).abs(),
5419            seconds = round(duration.as('s')),
5420            minutes = round(duration.as('m')),
5421            hours = round(duration.as('h')),
5422            days = round(duration.as('d')),
5423            months = round(duration.as('M')),
5424            weeks = round(duration.as('w')),
5425            years = round(duration.as('y')),
5426            a =
5427                (seconds <= thresholds.ss && ['s', seconds]) ||
5428                (seconds < thresholds.s && ['ss', seconds]) ||
5429                (minutes <= 1 && ['m']) ||
5430                (minutes < thresholds.m && ['mm', minutes]) ||
5431                (hours <= 1 && ['h']) ||
5432                (hours < thresholds.h && ['hh', hours]) ||
5433                (days <= 1 && ['d']) ||
5434                (days < thresholds.d && ['dd', days]);
5435
5436        if (thresholds.w != null) {
5437            a =
5438                a ||
5439                (weeks <= 1 && ['w']) ||
5440                (weeks < thresholds.w && ['ww', weeks]);
5441        }
5442        a = a ||
5443            (months <= 1 && ['M']) ||
5444            (months < thresholds.M && ['MM', months]) ||
5445            (years <= 1 && ['y']) || ['yy', years];
5446
5447        a[2] = withoutSuffix;
5448        a[3] = +posNegDuration > 0;
5449        a[4] = locale;
5450        return substituteTimeAgo.apply(null, a);
5451    }
5452
5453    // This function allows you to set the rounding function for relative time strings
5454    function getSetRelativeTimeRounding(roundingFunction) {
5455        if (roundingFunction === undefined) {
5456            return round;
5457        }
5458        if (typeof roundingFunction === 'function') {
5459            round = roundingFunction;
5460            return true;
5461        }
5462        return false;
5463    }
5464
5465    // This function allows you to set a threshold for relative time strings
5466    function getSetRelativeTimeThreshold(threshold, limit) {
5467        if (thresholds[threshold] === undefined) {
5468            return false;
5469        }
5470        if (limit === undefined) {
5471            return thresholds[threshold];
5472        }
5473        thresholds[threshold] = limit;
5474        if (threshold === 's') {
5475            thresholds.ss = limit - 1;
5476        }
5477        return true;
5478    }
5479
5480    function humanize(argWithSuffix, argThresholds) {
5481        if (!this.isValid()) {
5482            return this.localeData().invalidDate();
5483        }
5484
5485        var withSuffix = false,
5486            th = thresholds,
5487            locale,
5488            output;
5489
5490        if (typeof argWithSuffix === 'object') {
5491            argThresholds = argWithSuffix;
5492            argWithSuffix = false;
5493        }
5494        if (typeof argWithSuffix === 'boolean') {
5495            withSuffix = argWithSuffix;
5496        }
5497        if (typeof argThresholds === 'object') {
5498            th = Object.assign({}, thresholds, argThresholds);
5499            if (argThresholds.s != null && argThresholds.ss == null) {
5500                th.ss = argThresholds.s - 1;
5501            }
5502        }
5503
5504        locale = this.localeData();
5505        output = relativeTime$1(this, !withSuffix, th, locale);
5506
5507        if (withSuffix) {
5508            output = locale.pastFuture(+this, output);
5509        }
5510
5511        return locale.postformat(output);
5512    }
5513
5514    var abs$1 = Math.abs;
5515
5516    function sign(x) {
5517        return (x > 0) - (x < 0) || +x;
5518    }
5519
5520    function toISOString$1() {
5521        // for ISO strings we do not use the normal bubbling rules:
5522        //  * milliseconds bubble up until they become hours
5523        //  * days do not bubble at all
5524        //  * months bubble up until they become years
5525        // This is because there is no context-free conversion between hours and days
5526        // (think of clock changes)
5527        // and also not between days and months (28-31 days per month)
5528        if (!this.isValid()) {
5529            return this.localeData().invalidDate();
5530        }
5531
5532        var seconds = abs$1(this._milliseconds) / 1000,
5533            days = abs$1(this._days),
5534            months = abs$1(this._months),
5535            minutes,
5536            hours,
5537            years,
5538            s,
5539            total = this.asSeconds(),
5540            totalSign,
5541            ymSign,
5542            daysSign,
5543            hmsSign;
5544
5545        if (!total) {
5546            // this is the same as C#'s (Noda) and python (isodate)...
5547            // but not other JS (goog.date)
5548            return 'P0D';
5549        }
5550
5551        // 3600 seconds -> 60 minutes -> 1 hour
5552        minutes = absFloor(seconds / 60);
5553        hours = absFloor(minutes / 60);
5554        seconds %= 60;
5555        minutes %= 60;
5556
5557        // 12 months -> 1 year
5558        years = absFloor(months / 12);
5559        months %= 12;
5560
5561        // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
5562        s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
5563
5564        totalSign = total < 0 ? '-' : '';
5565        ymSign = sign(this._months) !== sign(total) ? '-' : '';
5566        daysSign = sign(this._days) !== sign(total) ? '-' : '';
5567        hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
5568
5569        return (
5570            totalSign +
5571            'P' +
5572            (years ? ymSign + years + 'Y' : '') +
5573            (months ? ymSign + months + 'M' : '') +
5574            (days ? daysSign + days + 'D' : '') +
5575            (hours || minutes || seconds ? 'T' : '') +
5576            (hours ? hmsSign + hours + 'H' : '') +
5577            (minutes ? hmsSign + minutes + 'M' : '') +
5578            (seconds ? hmsSign + s + 'S' : '')
5579        );
5580    }
5581
5582    var proto$2 = Duration.prototype;
5583
5584    proto$2.isValid = isValid$1;
5585    proto$2.abs = abs;
5586    proto$2.add = add$1;
5587    proto$2.subtract = subtract$1;
5588    proto$2.as = as;
5589    proto$2.asMilliseconds = asMilliseconds;
5590    proto$2.asSeconds = asSeconds;
5591    proto$2.asMinutes = asMinutes;
5592    proto$2.asHours = asHours;
5593    proto$2.asDays = asDays;
5594    proto$2.asWeeks = asWeeks;
5595    proto$2.asMonths = asMonths;
5596    proto$2.asQuarters = asQuarters;
5597    proto$2.asYears = asYears;
5598    proto$2.valueOf = valueOf$1;
5599    proto$2._bubble = bubble;
5600    proto$2.clone = clone$1;
5601    proto$2.get = get$2;
5602    proto$2.milliseconds = milliseconds;
5603    proto$2.seconds = seconds;
5604    proto$2.minutes = minutes;
5605    proto$2.hours = hours;
5606    proto$2.days = days;
5607    proto$2.weeks = weeks;
5608    proto$2.months = months;
5609    proto$2.years = years;
5610    proto$2.humanize = humanize;
5611    proto$2.toISOString = toISOString$1;
5612    proto$2.toString = toISOString$1;
5613    proto$2.toJSON = toISOString$1;
5614    proto$2.locale = locale;
5615    proto$2.localeData = localeData;
5616
5617    proto$2.toIsoString = deprecate(
5618        'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
5619        toISOString$1
5620    );
5621    proto$2.lang = lang;
5622
5623    // FORMATTING
5624
5625    addFormatToken('X', 0, 0, 'unix');
5626    addFormatToken('x', 0, 0, 'valueOf');
5627
5628    // PARSING
5629
5630    addRegexToken('x', matchSigned);
5631    addRegexToken('X', matchTimestamp);
5632    addParseToken('X', function (input, array, config) {
5633        config._d = new Date(parseFloat(input) * 1000);
5634    });
5635    addParseToken('x', function (input, array, config) {
5636        config._d = new Date(toInt(input));
5637    });
5638
5639    //! moment.js
5640
5641    hooks.version = '2.30.1';
5642
5643    setHookCallback(createLocal);
5644
5645    hooks.fn = proto;
5646    hooks.min = min;
5647    hooks.max = max;
5648    hooks.now = now;
5649    hooks.utc = createUTC;
5650    hooks.unix = createUnix;
5651    hooks.months = listMonths;
5652    hooks.isDate = isDate;
5653    hooks.locale = getSetGlobalLocale;
5654    hooks.invalid = createInvalid;
5655    hooks.duration = createDuration;
5656    hooks.isMoment = isMoment;
5657    hooks.weekdays = listWeekdays;
5658    hooks.parseZone = createInZone;
5659    hooks.localeData = getLocale;
5660    hooks.isDuration = isDuration;
5661    hooks.monthsShort = listMonthsShort;
5662    hooks.weekdaysMin = listWeekdaysMin;
5663    hooks.defineLocale = defineLocale;
5664    hooks.updateLocale = updateLocale;
5665    hooks.locales = listLocales;
5666    hooks.weekdaysShort = listWeekdaysShort;
5667    hooks.normalizeUnits = normalizeUnits;
5668    hooks.relativeTimeRounding = getSetRelativeTimeRounding;
5669    hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
5670    hooks.calendarFormat = getCalendarFormat;
5671    hooks.prototype = proto;
5672
5673    // currently HTML5 input type only supports 24-hour formats
5674    hooks.HTML5_FMT = {
5675        DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
5676        DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
5677        DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
5678        DATE: 'YYYY-MM-DD', // <input type="date" />
5679        TIME: 'HH:mm', // <input type="time" />
5680        TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
5681        TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
5682        WEEK: 'GGGG-[W]WW', // <input type="week" />
5683        MONTH: 'YYYY-MM', // <input type="month" />
5684    };
5685
5686    return hooks;
5687
5688})));
5689
5690var relativeMap;
5691var mapGoogle;
5692var markersGoogleMap = [];
5693var markersGoogleMapAux = [];
5694var sumInit = 0
5695var arrayOfLatLngs = [];
5696var sumaInit = 0;
5697var imagen;
5698
5699function cc21js(dataDefault) {
5700    //Reload the information if there are selected filters previously
5701    if(location.hash != ""){
5702        reloadWithSelectedFilters();
5703    }
5704
5705    // TABS
5706    //El primer tab tiene la clase active, por defecto
5707    $('.tabs-list__tab:first-child span').addClass('active');
5708
5709    // FILTERS
5710    $('.filters-list__param .content-listTabs__list').click(function (e) {
5711        e.preventDefault();
5712        if (!$('.icon-checkbox-rectangle-Off', this).hasClass('check')) {
5713            $('.icon-checkbox-rectangle-Off', this).addClass('check');
5714        } else {
5715            $('.icon-checkbox-rectangle-Off', this).removeClass('check');
5716        }
5717
5718        $('.title span', this).addClass('check-title');
5719        var labelRadioFilter = $(this).closest('.filters-list-single').find('.title-param span').text();
5720        var url = window.location.href;
5721
5722        var view = $('input.viewSelected').val();
5723        var fqs = [];
5724        if (view == 'mapa') {
5725            $(".content-listTabs__list.fqMapa").each(function () {
5726                if ($(".icon-checkbox-rectangle-Off", this).hasClass("check")) {
5727                    var valuenametag = $("input#nametagMap", this).val();
5728                    if (valuenametag != null) {
5729                        fqs.push(valuenametag);
5730
5731                    }
5732                }
5733            })
5734            solrSearch(fqs);
5735
5736        } else {
5737            $(".content-listTabs").each(function () {
5738                $(".content-listTabs__list").each(function () {
5739                    if ($(".icon-checkbox-rectangle-Off", this).hasClass("check")) {
5740                        var category = $(this).parents(".content-listTabs").find("input.facets_filters").val();
5741                        var categoryNamecomplete = $(this).children(".title").data("name");
5742                        var finalname = category + "_ss:" + categoryNamecomplete;
5743                        fqs.push(finalname);
5744                    }
5745                })
5746            });
5747            var fqRange = []
5748            solrSearch(fqs, fqRange);
5749        }
5750
5751        //Analytics
5752        dataLayer.push({
5753            'category': 'Interaccion',
5754            'action': 'CP14-Filters',
5755            'label': labelRadioFilter,
5756            'event': 'eventga',
5757            'filtersub1': $('.title span', this).text(),
5758            'urlmodule': url,
5759            'Gate': namePark,
5760        });
5761    });
5762    //  SORT BY
5763    $('.filters-list__sort .select .icon').click(function (e) {
5764        e.preventDefault();
5765        var relevance = $('.filters-list__sort .select .icon .icon-radio-check.relevance');
5766        var alfabetic = $('.filters-list__sort .select .icon .icon-radio-check.alfabetic');
5767        $('.icon-radio-check').removeClass('check');
5768        if (!$(relevance).hasClass('check') && !$(alfabetic).hasClass('check')) {
5769            $('.icon-radio-check', this).addClass('check');
5770        }
5771        let wordCheck = $(".wordsInput input").val();
5772        if (wordCheck != null && wordCheck.length > 2){
5773            let typeS = $("input.type_primary").val().split(":")[1];
5774            wordsSearch(wordCheck, "type_s:" + typeS, true, 0);
5775        }else{
5776            if (alfabetic != undefined) {
5777                auxData = docsProduct;
5778                //const defaultD = dataDefault.docs;
5779                if ($('i.alfabetic').hasClass('check')) {
5780                    auxData.docs = sortData(docsProduct.docs);
5781                    printCardsFilters(auxData, "cards-result", false, false);
5782                    buttonMore();
5783                } else {
5784                    solrSearchInit('alfabetic');
5785                    buttonMore();
5786                }
5787
5788            }
5789        }
5790        
5791
5792    });
5793    // FILTERS MOBILE
5794    $('.filters-list-mobile__param .content-listTabs__list').click(function (e) {
5795        e.preventDefault();
5796        //$('.icon-radio-check',this).toggleClass('check');
5797        $('.title span', this).toggleClass('check-title');
5798        var labelRadioFilter = $(this).find('.title span').text();
5799        var url = window.location.href;
5800        var view = $('input.viewSelected').val();
5801        var fqs = [];
5802        var valuenametag = $("input#nametagMap-Mobile", this).val();
5803        if (view == 'mapa') {
5804            if (valuenametag != 'SeeAll') {
5805                if (valuenametag != null) {
5806                    fqs.push(valuenametag);
5807                }
5808            }
5809            solrSearch(fqs);
5810            $('.cc57-searchProduct  .filters-list-mobile').toggle('slow');
5811            $('.cc57-searchProduct  .col-cardright').toggle('slow');
5812            $('#map').css('margin-bottom', '0px');
5813            $('.experiencefragment-header').css('display', 'none');
5814            $('.experiencefragment-footer').css('display', 'none');
5815            $('.aem-GridColumn').each(function (index, element) {
5816                if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
5817                    $(element).css('display', 'none');
5818                }
5819            });
5820            $(this).parents().find('.icon-checkbox-rectangle-Off').removeClass('check');
5821            $(this).parents().find('.icon-checkbox-rectangle-Off.' + valuenametag + '').addClass('check');
5822            //console.log('.icon-radio-check.'+valuenametag+'') 
5823        } else {
5824            $(".content-listTabs").each(function () {
5825                $(".content-listTabs__list").each(function () {
5826                    if ($(".icon-checkbox-rectangle-Off", this).hasClass("check")) {
5827                        var category = $(this).parents(".content-listTabs").find("input.facets_filters").val();
5828                        var categoryNamecomplete = $("span.check-title", this).text();
5829                        var name = categoryNamecomplete.split(" -")[0];
5830                        var finalname = category + "_ss:" + name;
5831                        fqs.push(finalname);
5832                    }
5833                })
5834            });
5835            var fqRange = []
5836            solrSearch(fqs, fqRange);
5837        }
5838
5839        //Analytics
5840        dataLayer.push({
5841            'category': 'Interaccion',
5842            'action': 'CP14-Filters',
5843            'label': labelRadioFilter,
5844            'event': 'eventga',
5845            'filtersub1': $('.title span', this).text(),
5846            'urlmodule': url,
5847            'Gate': namePark,
5848        });
5849    });
5850
5851    // Oculto la ultima linea de los filtros
5852    $('.filters-list__param .content-listTabs:last-child').find('hr').css('display', 'none');
5853
5854    // Clear all
5855    $('.filters-list__title .clear').click(function (e) {
5856        e.preventDefault();
5857        $('.content-listTabs__list').each(function () {
5858            $('.icon-checkbox-rectangle-Off').removeClass('check');
5859            $('.title span').removeClass('check-title');
5860
5861        });
5862        var fqs = [];
5863        var fqRange = []
5864        if (view == 'mapa') {
5865            $(".content-listTabs__list.fqMapa").each(function () {
5866                var valuenametag = $("input#nametagMap", this).val();
5867                if (valuenametag != null) {
5868                    fqs.push(valuenametag);
5869
5870                }
5871            })
5872        }
5873        solrSearch(fqs, fqRange);
5874
5875
5876    });
5877
5878
5879
5880    //Abro y cierro los filtros (Show/Hide)
5881    if ($(window).width() <= 768) {
5882        //Filters
5883        $('.filters').click(function (e) {
5884            e.preventDefault();
5885            $('.col-cardright').css('display', 'none');
5886            $('.filters-list').toggle('slow');
5887            $('.experiencefragment-header').css('display', 'none');
5888            $('.experiencefragment-footer').css('display', 'none');
5889            $('.aem-GridColumn').each(function (index, element) {
5890                if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
5891                    $(element).css('display', 'none');
5892                }
5893            });
5894        });
5895
5896        $('.filters-list__close .icon-arrow-left, .text').click(function (e) {
5897            e.preventDefault();
5898            var view = $('input.viewSelected').val();
5899            if ($(window).width() <= 768) {
5900                if ($('.icon-map-simple').hasClass('color-iconMap')) {
5901                    var windowH = $(window).height() - 54;
5902                    $('.col-cardright').toggle('slow');
5903                    $('.filters-list').toggle('slow');
5904                    $('.experiencefragment-header').css('display', 'none');
5905                    $('.experiencefragment-footer').css('display', 'none');
5906                    $('#map').height(windowH);
5907                    $('.iconClose').css('display', 'block');
5908                    $('.aem-GridColumn').each(function (index, element) {
5909                        if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
5910                            $(element).css('display', 'none');
5911                        }
5912                    });
5913                } else {
5914                    if (view == 'mapa') {
5915                        //$('.col-cardright').toggle('slow');
5916                        $('.filters-list').toggle('slow');
5917                        //$('.cc57-searchProduct  .filters-list-mobile').toggle('slow');
5918                        $('.cc57-searchProduct  .col-cardright').toggle('slow');
5919                        //$('.experiencefragment-header').css('display','block');
5920                        //$('.experiencefragment-footer').css('display','block');
5921                        //$('.aem-GridColumn').each(function (index, element) {
5922                        if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
5923                            $(element).css('display', 'block');
5924                        }
5925                        //});
5926                    } else {
5927                        $('.col-cardright').toggle('slow');
5928                        $('.filters-list').toggle('slow');
5929                        $('.experiencefragment-header').css('display', 'block');
5930                        $('.experiencefragment-footer').css('display', 'block');
5931                        //$('.experiencefragment-header').toggle('slow');
5932                        //$('.experiencefragment-footer').toggle('slow');
5933                        $('.aem-GridColumn').each(function (index, element) {
5934                            if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
5935                                $(element).css('display', 'block');
5936                            }
5937                        });
5938                    }
5939                }
5940            };
5941        });
5942        $('.button-done .button01').click(function (e) {
5943            //e.preventDefault();
5944            var view = $('input.viewSelected').val();
5945            $('.col-cardright').toggle('slow');
5946            $('.filters-list').css('display', 'none');
5947            $('.experiencefragment-header').css('display', 'block');
5948            $('.experiencefragment-footer').css('display', 'block');
5949            $('.aem-GridColumn').each(function (index, element) {
5950                if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
5951                    $(element).css('display', 'block');
5952                }
5953            });
5954            if (view == 'filters') {
5955                if ($('.icon-map-simple').hasClass('color-iconMap')) {
5956                    $('#map').addClass('mostrar-mapa');
5957                    $('.experiencefragment-header').css('display', 'none');
5958                    $('.experiencefragment-footer').css('display', 'none');
5959                    $('.aem-GridColumn').each(function (index, element) {
5960                        if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
5961                            $(element).css('display', 'none');
5962                        }
5963                    });
5964                } else {
5965                    $('#map').addClass('ocultar-mapa');
5966                }
5967            }
5968            if (view == 'mapa') {
5969                $('.col-cardright').show();
5970                $('.filters-list').hide();
5971                $('.experiencefragment-header').css('display', 'none');
5972                $('.experiencefragment-footer').css('display', 'none');
5973                $('.aem-GridColumn').each(function (index, element) {
5974                    if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
5975                        $(element).css('display', 'none');
5976                    }
5977                });
5978            }
5979        });
5980    }
5981
5982    //Altura a los filtros
5983    alturaFiltro = $('.filters-list').height();
5984    alturaFiltroHeader = $('.experiencefragment-header').height();
5985    alturaFiltroHeaderB = $('.bottom-header').height();
5986    alturaWindow = $(window).height();
5987    alturaFiltroDone = alturaWindow - alturaFiltroHeader - 80;
5988    alturaFiltroDoneD = alturaWindow - alturaFiltroHeader;
5989    alturaFiltroDoneC = alturaWindow - alturaFiltroHeaderB;
5990    if ($(window).width() >= 768) {
5991        if (alturaFiltro > alturaFiltroDoneD) {
5992            $('.filters-list').css('height', alturaFiltroDoneD - 70);
5993        }
5994    } else {
5995        if (alturaFiltro > alturaFiltroDone) {
5996            $('.filters-list').css('height', alturaFiltro + 80);
5997        }
5998    }
5999    //Sticky filtros
6000    var view = $('input.viewSelected').val();
6001    if ($(window).width() >= 768 && (view == 'filters')) {
6002        var colderArriba = $('.col-cardright').offset().top;
6003        $(window).scroll(function () {
6004            var filtersScroll = $(window).scrollTop();
6005            if (filtersScroll > colderArriba) {
6006                $('.filters-list').addClass('stickyizq');
6007                $('.filters-list').css('height', '100%');
6008            } else {
6009                alturaFiltroDoneD = alturaWindow - alturaFiltroHeader;
6010                $('.filters-list').removeClass('stickyizq');
6011                $('.filters-list').css('height', '100%');
6012            }
6013
6014        });
6015    }
6016    //Sticky Filtros 2 y boton Done b
6017    if (view != 'mapa') {
6018        if ($(window).width() <= 768) {
6019            var showFilter = $('.show-filters').length;
6020            if (showFilter > 0) {
6021                var stickyHeaderTop = $('.show-filters').offset().top - 40;
6022                $(window).scroll(function () {
6023                    var filtersScroll = $(window).scrollTop();
6024                    if (filtersScroll > stickyHeaderTop) {
6025                        $('.show-filters').addClass('fixed');
6026
6027                    } else {
6028                        $('.show-filters').removeClass('fixed');
6029                    }
6030
6031                });
6032            }
6033        }
6034    }
6035
6036    //Recolocando divs in Mobile
6037    if ($(window).width() <= 768) {
6038        $('.sort-filters__linkmap').appendTo('.show-filters');
6039        $('.sort-filters__linkmap').addClass('col-4');
6040    }
6041    // * Acordeon FAQS *
6042    var currentUrl = window.location.href;
6043    var mode = $("#edition").text();
6044    var first = $('input.firstitem').val();
6045
6046    if (mode == "false") {
6047        //console.log("no edition"+mode);
6048        $(".cc21-faqs__container .col-cardright").each(function () {
6049            if (first == "" || first == "1") {
6050                $(this).find(".content-tab:not(:eq(0))").toggle();
6051                $(this).find(".questions-answer:eq(0)").addClass('open');
6052                $(this).find(".title-tab .btn-tab .icon").addClass("icon-down1");
6053                $(".accordion li:first-child .title-tab .btn-tab .icon").removeClass("icon-down1").addClass("icon-up");
6054            } else {
6055                $(this).find(".content-tab").toggle();
6056                $(this).find(".title-tab .btn-tab .icon").addClass("icon-down1");
6057            }
6058            accordionLength = $(".accordion .item", this).length;
6059            /*if($(this).find(".accordion .item").length > 1){
6060                $(".accordion li:first-child .title-tab .btn-tab .icon").removeClass("icon-down1").addClass("icon-up");
6061                $(".accordion li:first-child").addClass("open");
6062            }else{
6063                $(this).find(".content-tab").hide();
6064                $(this).find(".accordion .title-tab .btn-tab .icon").removeClass("icon-up").addClass("icon-down1");
6065                $(this).find(".accordion li").removeClass("open");
6066            }*/
6067
6068            $(this).find(".title-tab").click(function () {
6069
6070                if ($(this).find(".btn-tab .icon").hasClass("icon-up")) {
6071                    $(this).next().hide();
6072                    $(this).find(".btn-tab .icon").removeClass("icon-up");
6073                    $(this).find(".btn-tab .icon").addClass("icon-down1");
6074                    $(this).parents("li").removeClass("open");
6075                } else {
6076                    $(this).parents(".accordion").find(".content-tab").hide();
6077                    $(this).parents(".accordion").find(".title-tab .btn-tab .icon").removeClass("icon-up");
6078                    $(this).parents(".accordion").find(".title-tab .btn-tab .icon").addClass("icon-down1");
6079                    $(this).parents(".accordion").find("li").removeClass("open");
6080
6081                    $(this).parents("li").addClass("open");
6082                    $(this).next().show();
6083                    $(this).children().find(".icon").removeClass("icon-down1");
6084                    $(this).children().find(".icon").addClass("icon-up");
6085
6086                }
6087            })
6088
6089        })
6090    }
6091    //Ajusto el padding si el div accordion es inferior a 465px
6092    $('.accordion').each(function (index, element) {
6093        accordionW = $(element).width();
6094        if (accordionW <= 600) {
6095            $('.columns-component ', this).css('padding', '0');
6096        }
6097    });
6098
6099    modalShare();
6100    buttonMore();
6101
6102    // ANALYTICS
6103    cardAnalitycInteraction();
6104
6105
6106    // ANALITYCS FAQS
6107    $(".cc21-faqs__container .col-cardright .questions-answer").click(function (e) {
6108        //e.preventDefault();
6109        var url = window.location.href;
6110        var slidername = $('.maptitle', this).text();
6111        var labelAccordion = $('.question', this).text();
6112        dataLayer.push({
6113            'category': 'Interaccion',
6114            'action': 'CP25-Accordion',
6115            'label': labelAccordion,
6116            'event': 'eventga',
6117            'urlmodule': url,
6118            'Gate': namePark,
6119            'slidername': 'Slider on the component wher the action takes place',
6120        });
6121    });
6122}
6123
6124//RELOAD WITH SELECTED FILTERS
6125function reloadWithSelectedFilters(){
6126    var urlHash = location.hash.substring(1);
6127    var linkWithSelectedFilters = urlHash.split('&');
6128
6129    var normalizedFilters = linkWithSelectedFilters.map(function(filter){
6130        return filter.replace(/\s+/g, '').toLowerCase();
6131    });
6132
6133    var fqs = [];
6134    var fqRange = [];
6135
6136    var listTabsGroups = document.querySelectorAll('.content-listTabs');
6137
6138    listTabsGroups.forEach(function(group) {
6139        var prefixMatch = group.className.match(/([\w-]+_ss)/);
6140        var prefix = prefixMatch ? prefixMatch[0] : '';
6141
6142        var hiddenInput = group.querySelector('input.facets_filters');
6143        var groupFilterValue = hiddenInput ? hiddenInput.value.replace(/\s+/g, '').toLowerCase() : '';
6144
6145        var listTabs = group.querySelectorAll('.content-listTabs__list');
6146
6147        listTabs.forEach(function(tab) {
6148            var dataName = tab.querySelector('.title').getAttribute('data-name').replace(/\s+/g, '').toLowerCase();
6149
6150            normalizedFilters.forEach(function(filter) {
6151                var filterParts = filter.split('=');
6152                var filterGroup = filterParts.length > 1 ? filterParts[0] : '';
6153                var filterName = filterParts.length > 1 ? filterParts[1] : filterParts[0];
6154
6155                var isGroupMatch = filterGroup === '' || filterGroup === groupFilterValue;
6156
6157                if (filterName === dataName && isGroupMatch) {
6158                    var checkboxOff = tab.querySelector('.icon-checkbox-rectangle-Off');
6159                    if (checkboxOff) {
6160                        checkboxOff.classList.add('check');
6161
6162                        var originalDataName = tab.querySelector('.title').getAttribute('data-name');
6163                        fqs.push(`${prefix}:${originalDataName}`);
6164                    }
6165                }
6166            });
6167        });
6168    });
6169
6170    fqs = fqs.concat(fqs);
6171
6172    solrSearch(fqs, fqRange);
6173}
6174
6175var colorCustom = $('.cc22_breadcrumb .cmp-breadcrumb .cmp-breadcrumb__item:first-child a span').css('color');
6176
6177function cc21mapa() {
6178    //MAPA
6179    $("a.toscroll").click(function () {
6180        var latitude = parseFloat($(this).find('.lat').val());
6181        var longitude = parseFloat($(this).find('.long').val());
6182        var api = parseFloat($(this).find('.apimaps').val());
6183        if (api == '1') {
6184            relocateMapGoogle(longitude, latitude);
6185        }
6186    });
6187
6188}
6189
6190function buttonMore() {
6191    var viewbuttonMore = $('input.viewSelected').val();
6192    // Contando resultados
6193    countResultTab = $('.cc21-tabs__cards .card-col').length;
6194    $('.cc21-tabs__searched .row .number').text(countResultTab);
6195    //Show me more
6196    if (viewbuttonMore == 'tabs') {
6197        if (countResultTab >= 10) {
6198            $('.cc21-tabs__cards .card-col').hide();
6199            $('.cc21-tabs__cards .card-col:lt(5)').show();
6200            $('.cc21-tabs__cards .botonFinal').show();
6201            $('.cc21-tabs__cards .botonFinal').click(function (e) {
6202                e.preventDefault();
6203                $('.cc21-tabs__cards .card-col').show();
6204                $(this).hide();
6205
6206            });
6207        } else {
6208            $('.botonFinal').hide();
6209        }
6210        if ($(".map-google").is(":visible") || $("#map-rel€€").is(":visible"))
6211            $('.botonFinal').hide();
6212
6213    }
6214    //Show me more
6215    if (viewbuttonMore == 'filters' && !$('.icon-map-simple').hasClass('color-iconMap')) {
6216        countResultFilter = $('.cards-result .filters-cards').length;
6217        var checkCards = $('#selectAttributesSwitch').val();
6218        if (countResultFilter >= 10) {
6219            $('.cards-result .filters-cards').hide();
6220            if (checkCards == 'false') {
6221                $('.cards-result .filters-cards:lt(10)').show();
6222            } else {
6223                $('.cards-result .filters-cards:lt(6)').show();
6224            }
6225            $('.botonFinal').show();
6226            $('.botonFinal').click(function (e) {
6227                e.preventDefault();
6228                $('.cards-result .filters-cards').show();
6229                $(this).hide();
6230            });
6231        } else {
6232            $('.botonFinal').hide();
6233        }
6234    }
6235
6236
6237
6238
6239    //Show me more PROMOTIONS
6240    if (viewbuttonMore == 'simple') {
6241        countResultFilterSIMPLE = $('.cc21-simplefilter .cards-result .card-col').length;
6242        if (countResultFilterSIMPLE >= 10) {
6243            $('.cc21-simplefilter .cards-result .card-col').hide();
6244            $('.cc21-simplefilter .cards-result .card-col:lt(5)').show();
6245            $('.botonFinal').show();
6246            $('.botonFinal').click(function (e) {
6247                e.preventDefault();
6248                $('.cc21-simplefilter .cards-result .card-col').show();
6249                $(this).hide();
6250            });
6251        } else {
6252            $('.botonFinal').hide();
6253        }
6254    }
6255}
6256
6257function get_hostname(url) {
6258    var m = url.match(/^http:\/\/[^/]+/);
6259    return m ? m[0] : null;
6260}
6261
6262$(window).resize(function () {
6263    if($(window).width() <= 1024  && $(window).width() >= 768 ){
6264        $('.cc57-searchProduct .cc21-filters__container .cc21-filters__row .filters-list').css('display', 'block');
6265    }
6266});
6267
6268
6269function modalShare() {
6270    // Modal Share
6271    //click boton share product list
6272    $('.button-share').click(function (e) {
6273        titleShare = $(this).closest('.content-text').find('.maptitle').text();
6274        descriptionShare = $(this).closest('.content-text').find('.mapdescription').text();
6275        imgShare = $(this).closest('.filters-cards__top').find('.mapimage').attr('src');
6276        urlShare = $(this).closest('.buttons').find('.button-detail
6276s').attr('href');
6277        var urlModulDis = window.location.href
6278        urlM = $(location).attr('host');
6279        e.preventDefault();
6280        $('.cc35_share').show();
6281        $('.modal-share').addClass('show');
6282        $('body').addClass('modal-open');
6283        $('body').append('<div class="modal-backdrop fade show"></div>');
6284        $('.modal-content__content .img').append('<img class="img-fluid" src="' + imgShare + '"></img>');
6285        $('.modal-content__content .titleDes').append('<span class="title">' + titleShare + '</span>');
6286        $('.modal-content__content .titleDes').append('<span class="description">' + descriptionShare + '</span>');
6287        $('.modal-content__linkShare .links').prepend('<span id="copylinkShare" class="url">' + urlM + urlShare + '</span>');
6288    });
6289
6290    $('.modal-share .modal-contenido .modal-content .close').click(function (e) {
6291        e.preventDefault();
6292        var themeArea = $('.cc20-themeArea #themeArea').val();
6293        $('#modalShare').hide();
6294        $('.modal-share').removeClass('show');
6295        if (themeArea != 'themeArea') {
6296            $('body').removeClass('modal-open');
6297            $('.modal-backdrop').remove();
6298        }
6299        $('.modal-content__content .img img').remove();
6300        $('.modal-content__content .titleDes .title').remove();
6301        $('.modal-content__content .titleDes .description').remove();
6302        $('.modal-content__linkShare .links .url').remove();
6303    });
6304}
6305
6306
6307function relocateMapGoogle(latitude, longitude) {
6308    var coord = { lat: latitude, lng: longitude, };
6309    var map = new google.maps.Map(document.getElementById('map'), {
6310        zoom: 16,
6311        center: coord
6312    });
6313    var marker = new google.maps.Marker({
6314        position: coord,
6315        map: map
6316    });
6317}
6318
6319function CustomZoomInControl(controlDiv, map) {
6320
6321    // Set CSS for the control border
6322    var controlUI = document.createElement('div');
6323    controlUI.style.backgroundColor = '#fff';
6324    controlUI.style.width = '48px';
6325    controlUI.style.borderRadius = '12px 12px 0 12px';
6326    controlUI.style.height = '48px';
6327    controlUI.style.cursor = 'pointer';
6328    controlUI.style.margin = '20px 20px 10px 20px';
6329    controlUI.style.textAlign = 'center';
6330    controlDiv.appendChild(controlUI);
6331
6332    // Set CSS for the control interior
6333    var controlPlus = document.createElement('div');
6334    var controlMinus = document.createElement('div');
6335    controlPlus.style.fontSize = '24px';
6336    controlPlus.style.color = colorCustom;
6337    controlPlus.style.padding = '12px 5px 0px 5px';
6338    //controlPlus.style.paddingRight = '5px';
6339    controlPlus.innerHTML = '<span class="icon-plus"></span>';
6340    controlUI.appendChild(controlPlus);
6341
6342    // Setup the click event listeners
6343    google.maps.event.addDomListener(controlUI, 'click', function () {
6344        map.setZoom(map.getZoom() + 1);
6345    });
6346
6347}
6348function CustomZoomInControlMinus(controlDiv, map) {
6349
6350    // Set CSS for the control border
6351    var controlUI = document.createElement('div');
6352    controlUI.style.backgroundColor = '#fff';
6353    controlUI.style.width = '48px';
6354    controlUI.style.borderRadius = '12px 0px 12px 12px';
6355    controlUI.style.height = '48px';
6356    controlUI.style.cursor = 'pointer';
6357    controlUI.style.margin = '10px 20px 0px 20px';
6358    controlUI.style.textAlign = 'center';
6359    controlDiv.appendChild(controlUI);
6360
6361    // Set CSS for the control interior
6362    var controlMinus = document.createElement('div');
6363    controlMinus.style.fontSize = '24px';
6364    controlMinus.style.color = colorCustom;
6365    controlMinus.style.padding = '12px 5px 12px 5px';
6366    //controlMinus.style.paddingRight = '5px';
6367    controlMinus.innerHTML = '<span class="icon-less"></span>';
6368    controlUI.appendChild(controlMinus);
6369
6370    // Setup the click event listeners
6371    google.maps.event.addDomListener(controlUI, 'click', function () {
6372        map.setZoom(map.getZoom() - 1);
6373    });
6374
6375}
6376
6377function initMap() {
6378
6379    mapGoogle = new google.maps.Map(document.getElementById('map'), {
6380        zoom: 18,
6381        center: new google.maps.LatLng(0, 0),
6382        scaleControl: false,
6383        mapTypeId: 'roadmap',
6384        fullscreenControl: false,
6385        disableDefaultUI: true,
6386    });
6387    var customZoomInControlDiv = document.createElement('div');
6388    var customZoomInControlDivMinus = document.createElement('div');
6389    var customZoomInControl = new CustomZoomInControl(customZoomInControlDiv, mapGoogle);
6390    var customZoomInControlMinus = new CustomZoomInControlMinus(cu
6390stomZoomInControlDiv, mapGoogle);
6391
6392    customZoomInControlDiv.index = 1;
6393    customZoomInControlDivMinus.index = 1;
6394    if ($(window).width() > 768) {
6395        mapGoogle.controls[google.maps.ControlPosition.TOP_RIGHT].push(customZoomInControlDiv);
6396        mapGoogle.controls[google.maps.ControlPosition.TOP_RIGHT].push(customZoomInControlDivMinus);
6397    } else {
6398        mapGoogle.controls[google.maps.ControlPosition.TOP_LEFT].push(customZoomInControlDiv);
6399        mapGoogle.controls[google.maps.ControlPosition.TOP_LEFT].push(customZoomInControlDivMinus);
6400    }
6401
6402    //var infowindow = new google.maps.InfoWindow();
6403
6404    // Set Image 
6405    var mapImage = $(document).find("input[name='mapImage']").val();
6406    var mapNorth = $(document).find("input[name='mapNorth']").val();
6407    var mapEast = $(document).find("input[name='mapEast']").val();
6408    var mapSouth = $(document).find("input[name='mapSouth']").val();
6409    var mapWest = $(document).find("input[name='mapWest']").val();
6410    if (mapImage != undefined && mapNorth != undefined && mapEast != undefined && mapSouth != undefined && mapWest != undefined) {
6411        //creo los puntos de los límites de la imagen
6412        var x2 = new google.maps.LatLng(mapNorth, mapEast);
6413        var x1 = new google.maps.LatLng(mapSouth, mapWest);
6414        //defino los límites donde voy a colocar la imagen
6415        var limites_imagen = new google.maps.LatLngBounds(x1, x2);
6416        //Creo un ground overlay 
6417        imagen = new google.maps.GroundOverlay(mapImage, limites_imagen);
6418        //coloco la imagen o ground overlay en el mapa
6419        imagen.setMap(mapGoogle);
6420    }
6421
6422}
6423
6424function loadViewMap() {
6425    // All resources loaded
6426    var viewPreSelected = $('#viewPreSelected').val();
6427    windowH = $(window).height() - 94;
6428    if (viewPreSelected == 0) {
6429
6430        var mapCheck = $('#mapCheck').val();
6431        if (mapCheck == 'googleMap') {
6432            initMap();
6433        } else {
6434            if($('#image_droped')[0].naturalWidth > 0){
6435                initMapRelative(); 
6436                if(localStorage.getItem("mapFailed") != null){
6437                    localStorage.removeItem("mapFailed");
6438                }
6439            }else{
6440                localStorage.setItem("mapFailed", "yes");
6441            }
6442        }
6443        var listView = $('#listView').val();
6444        if (listView == 'true') {
6445            $('.map-google').addClass('mostrar-mapa');
6446            $('.cards-result').addClass('ocultar-cards');
6447            $('.botonFinal').hide();
6448            $('.col-cardright .input-group').addClass('ocultar');
6449            $('#map-rel').addClass('mostrar-mapa');
6450
6451        } else {
6452            $('#map-rel').addClass('ocultar');
6453            $('.map-google').removeClass('mostrar-mapa');
6454        }
6455
6456
6457        //$('.icon-list').addClass('color-iconList');
6458        // $('.icon-map-simple').addClass('color-iconMap');
6459        if ($(window).width() <= 768 && $(window).width() > 575) {
6460            var windowH = $(window).height() - 54;
6461            $('.sort-filters').addClass('ocultar-cards');
6462            $('.experiencefragment-header').addClass('ocultar');
6463            $('.experiencefragment-footer').addClass('ocultar');
6464            $('#map').height(windowH);
6465            $('.iconClose').css('display', 'block');
6466            $('.cc21-simplefilter').css({ 'margin': '20px auto', 'padding': '0' });
6467        }
6468        if ($(window).width() <= 575) {
6469            var windowH = $(window).height() - 54;
6470            $('#map').height(windowH);
6471            $('.cc21-simplefilter').css({ 'margin': '0', 'padding': '0' });
6472        }
6473    } else {
6474        $('.cc21-tabs__cards').removeClass('ocultar').addClass('mostrar');
6475    }
6476    //Le defino el ancho al contenedor de los tabs (DESKTOP)
6477    if ($(window).width() >= 768) {
6478        anchoTab = 0;
6479        $('.tabs-list__tab').each(function () {
6480            anchoTab += $(this).width();
6481        });
6482        //$('.cc21-tabs__filter').width(anchoTab + 200);
6483        //Le defino una altura dependiendo de la columna de la derecha
6484        altcardtab = $('.tabs-cards__colder').height();
6485        //$('.tabs-cards__colizq .img-card').height(altcardtab);
6486    }
6487    //Pintando el check de relevancia si hay destacados seleccionados
6488    var selectSortBy = $('#selectSortBy').val();
6489    //Ordenando las Card relevante en el error
6490    //Primero cambio el orden del Array
6491    if (selectSortBy == 'enabled') {
6492        var relevantProduct = $('#relevantProductList').val();
6493        if (relevantProduct) {
6494            $('.filters-list__sort .select .relevance').addClass('check');
6495        }
6496        var relevantProductList = $('#relevantProductList').val().split(",");
6497        var relevantProductList = relevantProductList.reverse();
6498        //Recorro el array y compruebo si el path es igual en ambos casos y si es así se pone en primera posicion de las cards
6499        $.each(relevantProductList, function (indexInArray, valueOfElement) {
6500            var urlSplit = valueOfElement.split('/');
6501            var urlLastEl = urlSplit[urlSplit.length - 1];
6502            $('.error-page #relevant-cards .filters-cards').each(function (index, element) {
6503                var path = $('.path', this).val().split('/');
6504                var pathLast = path[path.length - 1];
6505                if (urlLastEl == pathLast) {
6506                    $(element).prependTo('.error-page #relevant-cards');
6507                }
6508            });
6509        });
6510    }
6511}
6512//click boton share card map
6513function shareModal() {
6514    titleShare = $('.cardMapTitle').text();
6515    descriptionShare = $('.cardMapSubtitle').text();
6516    imgShare = $('.cardMapImg').attr('src');
6517    urlShare = $('.button-details').attr('href');
6518    $('.modal-share').addClass('show');
6519    $('body').addClass('modal-open');
6520    $('body').append('<div class="modal-backdrop fade show"></div>');
6521    $('.modal-content__content .img').append('<img class="img-fluid" src="' + imgShare + '"></img>');
6522    $('.modal-content__content .titleDes').append('<span class="title">' + titleShare + '</span>');
6523    $('.modal-content__content .titleDes').append('<span class="description">' + descriptionShare + '</span>');
6524    $('.modal-content__linkShare .links').prepend('<span class="url">' + urlShare + '</span>');
6525};
6526//Copiar Link JS
6527function copyTextFromElement(elementID) {
6528    let element = document.getElementById(elementID);
6529    let elementText = element.textContent;
6530    copyText(elementText);
6531}
6532function copyText(text) {
6533    navigator.clipboard.writeText(text);
6534}
6535
6536
6537//click en icono mapa
6538$('.sort-filters__linkmap .icon-map-simple').click(function (e) {
6539    e.preventDefault();
6540    var mapCheck = $('#mapCheck').val();
6541    if (!$('.sort-filters__linkmap .icon-map-simple').hasClass('color-iconMap')) {
6542        if (mapCheck == 'googleMap') {
6543
6544            var windowH = $(window).height() - 54;
6545            $('.map-google').addClass('mostrar-mapa');
6546            $('.map-google').removeClass('ocultar');
6547            printPoisInGoogleMap();
6548        } else {
6549            $('.map-relative').addClass('mostrar-mapa');
6550            $('.map-relative').removeClass('ocultar');
6551            initMapRelative();
6552            if(localStorage.getItem("mapFailed") != null){
6553                solrSearchInit()
6554                localStorage.removeItem("mapFailed")
6555            }
6556            relativeMap.invalidateSize(true);
6557        }
6558
6559        $('.cc21-tabs__cards').removeClass('mostrar');
6560        $('.cc21-tabs__cards').addClass('ocultar');
6561        $('.cards-result').removeClass('mostrar');
6562        $('.cards-result').addClass('ocultar');
6563        //$('.col-cardright .input-group').addClass('ocultar');
6564        $('.cards-result').addClass('ocultar');
6565        $('.botonFinal').hide();
6566
6567        $('.icon-list').addClass('color-iconList');
6568        $('.icon-map-simple').addClass('color-iconMap');
6569
6570        if ($(window).width() <= 768) {
6571            $('.sort-filters').addClass('ocultar-cards');
6572            $('.experiencefragment-header').toggle();
6573            $('.experiencefragment-footer').toggle();
6574            $('#map').height(windowH);
6575            $('.iconClose').css('display', 'block');
6576            $('.col-cardright .input-group').addClass('ocultar');
6577            $('.aem-GridColumn').each(function (index, element) {
6578                if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
6579                    $(element).css('display', 'none');
6580                }
6581            });
6582        };
6583    }
6584    uncheckFilters(false);
6585});
6586//click en icono lista
6587$('.sort-filters__linkmap .icon-list').click(function (e) {
6588    e.preventDefault();
6589    var mapCheck = $('#mapCheck').val();
6590    if ($('.sort-filters__linkmap .icon-list').hasClass('color-iconList')) {
6591        if (mapCheck == 'googleMap') {
6592            $('.map-google').removeClass('mostrar-mapa');
6593            $('.map-google').addClass('ocultar');
6594        } else {
6595            $('.map-relative').removeClass('mostrar-mapa');
6596            $('.map-relative').addClass('ocultar');
6597        }
6598
6599        $('.cc21-tabs__cards').addClass('mostrar');
6600        $('.icon-map-simple').removeClass('color-iconMap');
6601        $('.icon-map-simple').removeClass('color-iconMap');
6602        $('.col-cardright .input-group').removeClass('ocultar');
6603        $('.icon-list').removeClass('color-iconList');
6604        $('.cards-result').removeClass('ocultar-cards');
6605        $('.cards-result').removeClass('ocultar');
6606        buttonMore();
6607        if ($(window).width() <= 768) {
6608            $('.sort-filters').removeClass('ocultar-cards');
6609            $('.experiencefragment-header').css('display', 'block');
6610            $('.experiencefragment-footer').css('display', 'block');
6611            $('.iconClose').css('display', 'none');
6612            $('.aem-GridColumn').each(function (index, element) {
6613                if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
6614                    $(element).css('display', 'block');
6615                }
6616            });
6617        };
6618    }
6619    uncheckFilters(false);
6620});
6621//click en la X en vista mapa
6622$('.show-filters .icon-close-filter').click(function (e) {
6623    e.preventDefault();
6624    $('.map-google').removeClass('mostrar-mapa');
6625    $('.map-google').addClass('ocultar');
6626    $('.cc21-tabs__cards').addClass('mostrar');
6627    $('.icon-map-simple').removeClass('color-iconMap');
6628    $('.icon-map-simple').removeClass('color-iconMap');
6629
6630    $('.icon-list').removeClass('color-iconList');
6631    $('.cards-result').removeClass('ocultar');
6632    $('.cards-result').removeClass('ocultar-cards');
6633    buttonMore();
6634    if ($(window).width() <= 768) {
6635        $('.sort-filters').removeClass('ocultar-cards');
6636        $('.experiencefragment-header').toggle();
6637        $('.experiencefragment-footer').toggle();
6638        $('.iconClose').css('display', 'none');
6639        $('.aem-GridColumn').each(function (index, element) {
6640            if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
6641                $(element).css('display', 'block');
6642            }
6643        });
6644    };
6645});
6646$('.mapa .show-filters .icon-close').click(function (e) {
6647    e.preventDefault();
6648    //$('.map-google').toggle('slow');
6649    //$('.map-google').addClass('ocultar');
6650    $('.cc57-searchProduct  .filters-list-mobile').toggle('slow');
6651    $('.cc57-searchProduct  .col-cardright').toggle('slow');
6652    //$('.cc21-tabs__cards').addClass('mostrar');
6653    // $('.icon-map-simple').removeClass('color-iconMap');
6654    // $('.icon-map-simple').removeClass('color-iconMap');
6655
6656    // $('.icon-list').removeClass('color-iconList');
6657    // $('.cards-result').removeClass('ocultar');
6658    // $('.cards-result').removeClass('ocultar-cards');
6659    buttonMore();
6660    if ($(window).width() <= 768) {
6661        $('.sort-filters').removeClass('ocultar-cards');
6662        $('.experiencefragment-header').toggle();
6663        $('.experiencefragment-footer').toggle();
6664        $('.iconClose').css('display', 'none');
6665        $('.aem-GridColumn').each(function (index, element) {
6666            if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
6667                $(element).css('display', 'block');
6668            }
6669        });
6670    };
6671});
6672//Calendar Mostrar primero el calendario
6673if ($(window).width() <= 768) {
6674    $('.cc21-calendar .col-cardright').removeClass('mostrar').addClass('ocultar');
6675    $('.cc21-calendar .filters-list').removeClass('ocultar').addClass('mostrar');
6676
6677
6678    //click en la X de la vista calendar
6679    $('.cc21-calendar .close-listCalendar').click(function (e) {
6680        e.preventDefault();
6681        $('.col-cardright').removeClass('mostrar').addClass('ocultar');
6682        $('.filters-list').removeClass('ocultar').addClass('mostrar');
6683        $('.experiencefragment-header').show();
6684        $('.experiencefragment-footer').show();
6685        $('.cc21-calendar .title-top').removeClass('mostrar').addClass('ocultar');
6686        $('.cc21-calendar .subtitle-top').removeClass('mostrar').addClass('ocultar');
6687        $('.aem-GridColumn').each(function (index, element) {
6688            if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
6689                $(element).css('display', 'block');
6690            }
6691        });
6692    });
6693}
6694
6695//CLick en un dia de la semana calendario
6696$(window).bind('load', function (e) {
6697    if ($(window).width() <= 768) {
6698        //FAQS
6699        //Boton Done FAQS
6700        $('.button-done-faqs .button01').click(function (e) {
6701            e.preventDefault();
6702            var view = $('input.viewSelected').val();
6703            $('.col-cardright').css('display', 'block');
6704            $('.filters-list').css('display', 'none');
6705            $('.experiencefragment-header').css('display', 'block');
6706            $('.experiencefragment-footer').css('display', 'block');
6707            $('.aem-GridColumn').each(function (index, element) {
6708                if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
6709                    $(element).css('display', 'block');
6710                }
6711            });
6712        });
6713        //Boton filtros FAQS
6714        $('.filters-faqs').click(function (e) {
6715            e.preventDefault();
6716            $('.col-cardright').css('display', 'none');
6717            $('.filters-list').css('display', 'block');
6718            $('.experiencefragment-header').css('display', 'none');
6719            $('.experiencefragment-footer').css('display', 'none');
6720            $('.aem-GridColumn').each(function (index, element) {
6721                if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
6722                    $(element).css('display', 'none');
6723                }
6724            });
6725        });
6726        //boton Close FAQS
6727        $('.filters-list__close-faqs .icon-close').click(function (e) {
6728            e.preventDefault();
6729            var view = $('input.viewSelected').val();
6730            $('.col-cardright').css('display', 'block');
6731            $('.filters-list').css('display', 'none');
6732            $('.experiencefragment-header').css('display', 'block');
6733            $('.experiencefragment-footer').css('display', 'block');
6734            $('.aem-GridColumn').each(function (index, element) {
6735                if (!$(element).hasClass('cc57_productlist') && !$(element).hasClass('cc11')) {
6736                    $(element).css('display', 'block');
6737                }
6738            });
6739        });
6740
6741    }
6742    $('.input-searchFaqs').focus(function () {
6743        $(this).parents('.input-select').find('.predict').css({
6744            'border-bottom': '1px solid var(--color-primary-01)',
6745            'border-right': '1px solid var(--color-primary-01)',
6746            'border-left': '1px solid var(--color-primary-01)',
6747        })
6748    });
6749    $('.input-searchFaqs').focusout(function () {
6750        $(this).parents('.input-select').find('.predict').removeAttr('style');
6751
6752    });
6753});
6754
6755function printClass(addClass) {
6756    if ($(window).width() >= 768) {
6757        setTimeout(function () {
6758            addClass.addClass('hoverito');
6759            //console.log('hoverito');
6760
6761        }, 1)
6762    } else {
6763        setTimeout(function () {
6764            addClass.addClass('hoverito');
6765            //console.log('hoverito Mobile');
6766
6767        }, 10)
6768    }
6769
6770
6771}
6772function shareModalThemeArea() {
6773    titleShare = $('.cardMapTitle').text();
6774    descriptionShare = $('.cardMapSubtitle').text();
6775    imgShare = $('.cardMapImg').attr('src');
6776    urlShare = $('#path').val();
6777    $('.modal-share').addClass('show');
6778    $('body').addClass('modal-open');
6779    $('body').append('<div class="modal-backdrop fade show"></div>');
6780    $('.modal-content__content .img').append('<img class="img-fluid" src="' + imgShare + '"></img>');
6781    $('.modal-content__content .titleDes').append('<span class="title">' + titleShare + '</span>');
6782    $('.modal-content__content .titleDes').append('<span class="description">' + descriptionShare + '</span>');
6783    $('.modal-content__linkShare .links').prepend('<span class="url">' + urlShare + '</span>');
6784};
6785function cardAnalitycInteraction() {
6786    $('.cc21-tabs__cards .cards-result .ca21_button').click(function () {
6787        var url = window.location.href;
6788        var slidername = $(this).parents('.tabs-cards').find('.maptitle').text();
6789        var labelBotonView = $(this).find('span').text();
6790        dataLayer.push({
6791            'category': 'Interaccion',
6792            'action': 'cc57-searchProduct  Card',
6793            'label': labelBotonView,
6794            'event': 'eventga',
6795            'urlmodule': url,
6796            'Gate': namePark,
6797            'slidername': slidername,
6798        });
6799    })
6800    $('.cc21-filters__row .cards-result .ca21_button').click(function () {
6801        var url = window.location.href;
6802        var slidername = $(this).parents('.content-text').find('.maptitle').text();
6803        var labelBotonView = $(this).find('span').text();
6804        dataLayer.push({
6805            'category': 'Interaccion',
6806            'action': 'cc57-searchProduct  Card',
6807            'label': labelBotonView,
6808            'event': 'eventga',
6809            'urlmodule': url,
6810            'Gate': namePark,
6811            'slidername': slidername,
6812        });
6813    })
6814    //link = $('a',this).attr('href');
6815    //setTimeout(function() {window.location = link}, 200);
6816}
6817var layerGroup;
6818function initMapRelative() {
6819    if (!isinitMap) {
6820
6821        //firstLoad();
6822        var lat = -62.79879147673063;
6823        //var lat = latitudeMap;
6824        var long = 159.25;
6825        //var long = longitudeMap;
6826        if ($(window).width() >= 768) {
6827            relativeMap = L.map('map-rel', {
6828                crs: L.CRS.Simple,
6829                center: [0, 0],
6830                zoom: 0,
6831                minZoom: 1,
6832                maxZoom: 4,
6833                dragging: true,
6834                zoomControl: false,
6835            });
6836        } else {
6837            relativeMap = L.map('map-rel', {
6838                crs: L.CRS.Simple,
6839                center: [0, 0],
6840                zoom: 0,
6841                minZoom: 0,
6842                maxZoom: 4,
6843                dragging: true,
6844                zoomControl: false,
6845            });
6846        }
6847        layerGroup = L.layerGroup().addTo(relativeMap)
6848
6849        var ancho_actual_lienzo = 1200;
6850
6851        //El ancho de la imagen
6852        var ancho_imagen_original = $('#image_droped')[0].naturalWidth;
6853        //var ancho_imagen_original = 1400;
6854
6855        //El alto de la imagen
6856        var alto_imagen_original = $('#image_droped')[0].naturalHeight;
6857        //var alto_imagen_original = 1030;
6858
6859        var h = ((ancho_actual_lienzo * alto_imagen_original) / ancho_imagen_original) - 1;
6860        if ($(window).width() > 768) {
6861            $('#map-rel').height(h);
6862        } else {
6863            $('#map-rel').height($(window).height() - $('.show-filters')[0].clientHeight);
6864        }
6865
6866        var sP = relativeMap.unproject([0, h], 1);
6867        var nP = relativeMap.unproject([ancho_actual_lienzo - 1, 0], 1);
6868        var sd = relativeMap.getBounds();
6869        relativeMap.setMaxBounds(L.latLngBounds(sP, nP));
6870
6871        var bounds = [sP, nP];
6872        //IMAGEN
6873        //var imageOverlay = $('.edit-rel-map .image-upload #image_droped').attr('src');
6874        var imageOverlay = $("input#mapRelative").val();
6875        //var boundos = [[0, 0], [427, 581]];
6876        L.imageOverlay(imageOverlay, bounds).addTo(relativeMap);
6877        relativeMap.fitBounds(bounds);
6878        var sW = relativeMap.getBounds();
6879        //relativeMap.setMaxBounds(bounds);
6880
6881        isinitMap = true;
6882        setTimeout(function () {
6883            relativeMap.invalidateSize(true);
6884        }, 1);
6885        //Customize Zoom
6886        L.control.zoom({
6887            zoomInText: '<i class="icon-plus"></i>',
6888            zoomOutText: '<i class="icon-less"></i>',
6889            position: 'topleft',
6890        }).addTo(relativeMap)
6891    }
6892}
6893
6894function onMarkerClick(e) {
6895    L.popup()
6896        .setLatLng(e.latlng)
6897        .openOn(relativeMap);
6898    $('.popup-marker .icon').click(function (e) {
6899        e.preventDefault();
6900        mapGoogle.removeLayer(myMarker);
6901        myMarker = '';
6902        mapGoogle.closePopup();
6903
6904    });
6905}
6906
6907function setMarker(poi, icon) {
6908    var { mainImage, name, altimage, briefdescription, icon } = getInfoCards(poi);
6909    if (name != "") {
6910
6911        // var myIcon = L.icon({
6912        //     className: icon+ ' icono-location',
6913        //     iconUrl: '/content/dam/pictures/POIS.png',
6914        //     iconSize: [80, 80],
6915        //     iconAnchor: [40, 72],
6916        // });
6917        var typeProduct = '' + icon + '';
6918        var colorIcon = $('.border-solid').css('background-color');
6919        //const icono = '<?xml version="1.0" encoding="UTF-8"?><svg width="70px" height="82px" viewBox="0 0 80 92" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>POI unselected</title><g id="POI-unselected" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><path d="M40,13.5 C47.0429137,13.5 53.4195699,16.3327204 58.0351732,20.9141341 C62.6467251,25.4915263 65.5,31.814866 65.5,38.8 C65.5,50.1362956 49.1864451,67.7347703 42.1443642,74.8096169 L41.6339919,75.3202363 C41.0597717,75.8923266 40.5614334,76.3806324 40.1561169,76.7739085 L40.026,76.9 L39.8529687,76.731591 C39.5500674,76.4368051 39.1963479,76.0892759 38.7987251,75.6936293 L38.5549383,75.4505042 C37.7123114,74.6082816 36.694788,73.5718933 35.5600235,72.3798537 C33.892122,70.6277679 31.9709417,68.5394471 29.9796417,66.237072 C27.0341131,62.8314013 23.9335128,58.9562183 21.2772099,55.0089223 C17.4575924,49.3329276 14.5,43.5174398 14.5,38.8 C14.5,31.814866 17.3532749,25.4915263 21.9648268,20.9141341 C26.5804301,16.3327204 32.9570863,13.5 40,13.5 L40,13.5 Z" id="Oval-Copy" stroke="#FFFFFF" stroke-width="3" fill="'+colorIcon+'"></path></g></svg><div class="icono-Product"><i class="'+icon.toString()+'"></i></div>'
6920        const icono = '<?xml version="1.0" encoding="UTF-8"?><svg width="70px" height="82px" viewBox="0 0 80 92" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>' + name + '</title><defs><filter x="-72.9%" y="-58.3%" width="245.8%" height="216.7%" filterUnits="objectBoundingBox" id="filter-1"><feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset><feGaussianBlur stdDeviation="8" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur><feColorMatrix values="0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.672262552 0" type="matrix" in="shadowBlurOuter1" result="shadowMatrixOuter1"></feColorMatrix><feMerge><feMergeNode in="shadowMatrixOuter1"></feMergeNode><feMergeNode in="SourceGraphic"></feMergeNode></feMerge></filter></defs><g id="POI-selected" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="Group-11" transform="translate(16.000000, 16.000000)" fill="' + colorIcon + '" stroke="#FFFFFF" stroke-width="3">
6920<g id="Group-16-Copy" filter="url(#filter-1)"><g id="Group-14"><path d="M24,1.5 C30.2132034,1.5 35.8382034,4.01839828 39.9099026,8.09009742 C43.9816017,12.1617966 46.5,17.7867966 46.5,24 C46.5,35.1366922 28.9889105,53.0293835 24.1769053,57.7441793 L24.023,57.893 L23.989487,57.8601291 C23.7206095,57.5965024 23.4066225,57.2857072 23.0536633,56.9318809 L22.8372602,56.7144546 C22.0890426,55.961015 21.1855251,55.0338769 20.1779016,53.9674963 C18.6968512,52.4000821 16.9908932,50.5318747 15.2226739,48.4721721 C12.6083498,45.4268882 9.85628809,41.9618413 7.49866575,38.4322427 C4.12291332,33.3784006 1.5,28.2015854 1.5,24 C1.5,17.7867966 4.01839828,12.1617966 8.09009742,8.09009742 C12.1617966,4.01839828 17.7867966,1.5 24,1.5 Z" id="Oval"></path></g></g></g></g></svg><div class="icono-Product"><i class="' + icon.toString() + '"></i></div>'
6921        var point = L.point(0, 20);
6922        var myIcon = L.divIcon({
6923            className: 'my-div-icon',
6924            html: icono,
6925        });
6926        latArr = poi.latitude_s.split(",");
6927        lngArr = poi.longitude_s.split(",");
6928        for(var i = 0; i < latArr.length; i++){
6929
6930            myMarker = L.marker([latArr[i], lngArr[i]], {
6931                        icon: myIcon,
6932                        draggable: false,
6933
6934            });
6935            myMarker.addTo(layerGroup).on('click', onMarkerClick);
6936            myMarker.bindPopup(popUpInformationString(mainImage, poi.realpath, name, altimage, briefdescription, poi.intensity_level_s, poi.intensity_ss), {
6937                        className: "popup-rel",
6938                        direction: "center",
6939                        autoPan: true,
6940                        closeButton: false,
6941                        keepInView: true,
6942                        offset: L.point({ x: 100, y: 220 })
6943            });
6944            relativeMap.on('popupopen', function (e) {
6945                 var px = relativeMap.project(e.target._popup._latlng); // find the pixel location on the relativeMap where the popup anchor is
6946                 px.y -= e.target._popup._container.clientHeight / 2; // find the height of the popup container, divide by 2, subtract from the Y axis of marker location
6947                 relativeMap.panTo(relativeMap.unproject(px), { animate: true }); // pan to new center
6948            });
6949        }
6950    }
6951}
6952/**
6953 * 
6954 * @param {*} mainImage 
6955 * @param {*} realpath 
6956 * @param {*} name 
6957 * @param {*} altimage 
6958 * @param {*} briefdescription 
6959 * @param {*} intensity_level_s 
6960 * @param {*} intensity_ss 
6961 * @returns popup information
6962 */
6963function popUpInformationString(mainImage, realpath, name, altimage, briefdescription, intensity_level_s, intensity_ss) {
6964
6965
6966    var contentString;
6967
6968    contentString = "<div class='row no-gutters'>" +
6969        "<div class='col-5 col-lg-4 colI'>" +
6970        "<img class='img-fluid cardMapImg' src='" + mainImage + "' alt='" + altimage + "'></img>" +
6971        "</div>";
6972
6973    contentString = contentString + "<div class='col-7 col-lg-8 pl-3 colR'>" +
6974        //"<p class='title cardMapTitle'>"+locations[i][0] +"</p>";
6975        "<div><a href='" + realpath + "' class='title cardMapTitle'>" + name + "</a>";
6976
6977    if (briefdescription != undefined) {
6978        contentString = contentString + "<p class='subtitle cardMapSubtitle'>" + briefdescription + "</p></div>";
6979    }
6980
6981
6982
6983    if (intensity_ss != "" && intensity_ss != undefined) {
6984        var intensTrans = $('#filter-intensity').val();
6985        contentString = contentString + "<div class='intensidad'><span>" + intensTrans + ":&nbsp;</span>";
6986        contentString = contentString + "<span class='intensity " + intensity_level_s + "'>" + intensity_ss + "</span></div>";
6987    }
6988    "<div class='icons pt-3'><span class='icon-pin-map pr-3'></span><span onclick='shareModal()' class='icon-share'></span>" +
6989        "</div>" +
6990        "</div>";
6991    return contentString;
6992}
6993
6994function printPoisInGoogleMap() {
6995    deleteMarkers();
6996
6997    var addClass;
6998    var addClassLabel;
6999    var locations = [];
7000    var marker, i;
7001    const image = "https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png";
7002    const infowindow = new google.maps.InfoWindow({
7003        //content: contentString,
7004        minWidth: 300,
7005        maxWidth: 300,
7006        pixelOffset: new google.maps.Size(50, 270),
7007    });
7008    var colorPrimary = getComputedStyle(document.documentElement).getPropertyValue('--color-primary-01');
7009    var colorSecondary = getComputedStyle(document.documentElement).getPropertyValue('--color-secondary-02');
7010    const svgMarker = {
7011        path: "M24,1.5 C30.2132034,1.5 35.8382034,4.01839828 39.9099026,8.09009742 C43.9816017,12.1617966 46.5,17.7867966 46.5,24 C46.5,35.1366922 28.9889105,53.0293835 24.1769053,57.7441793 L24.023,57.893 L23.989487,57.8601291 C23.7206095,57.5965024 23.4066225,57.2857072 23.0536633,56.9318809 L22.8372602,56.7144546 C22.0890426,55.961015 21.1855251,55.0338769 20.1779016,53.9674963 C18.6968512,52.4000821 16.9908932,50.5318747 15.2226739,48.4721721 C12.6083498,45.4268882 9.85628809,41.9618413 7.49866575,38.4322427 C4.12291332,33.3784006 1.5,28.2015854 1.5,24 C1.5,17.7867966 4.01839828,12.1617966 8.09009742,8.09009742 C12.1617966,4.01839828 17.7867966,1.5 24,1.5 Z",
7012        fillColor: colorPrimary,
7013        fillOpacity: 1,
7014        strokeWeight: 3,
7015        strokeColor: "white",
7016        rotation: 0,
7017        scale: 1,
7018        anchor: new google.maps.Point(24, 60),
7019    }
7020    const svgMarkerY = {
7021        path: "M24,1.5 C30.2132034,1.5 35.8382034,4.01839828 39.9099026,8.09009742 C43.9816017,12.1617966 46.5,17.7867966 46.5,24 C46.5,35.1366922 28.9889105,53.0293835 24.1769053,57.7441793 L24.023,57.893 L23.989487,57.8601291 C23.7206095,57.5965024 23.4066225,57.2857072 23.0536633,56.9318809 L22.8372602,56.7144546 C22.0890426,55.961015 21.1855251,55.0338769 20.1779016,53.9674963 C18.6968512,52.4000821 16.9908932,50.5318747 15.2226739,48.4721721 C12.6083498,45.4268882 9.85628809,41.9618413 7.49866575,38.4322427 C4.12291332,33.3784006 1.5,28.2015854 1.5,24 C1.5,17.7867966 4.01839828,12.1617966 8.09009742,8.09009742 C12.1617966,4.01839828 17.7867966,1.5 24,1.5 Z",
7022        fillColor: colorSecondary,
7023        fillOpacity: 1,
7024        strokeWeight: 3,
7025        strokeColor: "white",
7026        rotation: 0,
7027        scale: 1,
7028        anchor: new google.maps.Point(24, 60),
7029    }
7030
7031    const numbermarker = {
7032        path: "M24,1.5 C30.2132034,1.5 35.8382034,4.01839828 39.9099026,8.09009742 C43.9816017,12.1617966 46.5,17.7867966 46.5,24 C46.5,35.1366922 28.9889105,53.0293835 24.1769053,57.7441793 L24.023,57.893 L23.989487,57.8601291 C23.7206095,57.5965024 23.4066225,57.2857072 23.0536633,56.9318809 L22.8372602,56.7144546 C22.0890426,55.961015 21.1855251,55.0338769 20.1779016,53.9674963 C18.6968512,52.4000821 16.9908932,50.5318747 15.2226739,48.4721721 C12.6083498,45.4268882 9.85628809,41.9618413 7.49866575,38.4322427 C4.12291332,33.3784006 1.5,28.2015854 1.5,24 C1.5,17.7867966 4.01839828,12.1617966 8.09009742,8.09009742 C12.1617966,4.01839828 17.7867966,1.5 24,1.5 Z",
7033        fillColor: colorPrimary,
7034        fillOpacity: 0,
7035        strokeWeight: 0,
7036        strokeColor: "white",
7037        rotation: 0,
7038        // scale: 1,
7039        anchor: new google.maps.Point(0, 35),
7040    }
7041
7042    $('.cards-result .filters-cards').each(function (index) {
7043        var longitude = $(this).find('.cardLongitude').val();
7044        var type = $(this).find('.typeProduct').val();
7045        var latitude = $(this).find('.cardLatitude').val();
7046        var title = $(this).find('.maptitle').text();
7047        var description = $(this).find('.mapdescription').text();
7048        var image = $(this).find('.mapimage').attr('src');
7049        var titletag = $(this).find('.titletag').text();
7050        var valuetag = $(this).find('.valuetag').text();
7051        var valuetagname = $(this).find('.valuetag').attr('data-tagname');
7052        var typeIcon = $(this).find('.icon-theme').val();
7053        var path = $(this).find('.path').val();
7054
7055        var item = [title, latitude, longitude, description, image, titletag, valuetag, valuetagname, type, typeIcon, path];
7056        if ((latitude != null && latitude != "") && (longitude != null && longitude != "")) {
7057            locations.push(item);
7058        }
7059    });
7060    if (locations.length > 0) {
7061        const centerMap = new google.maps.LatLng(locations[0][1], locations[0][2]);
7062
7063        mapGoogle.panTo(centerMap);
7064        for (i = 0; i < locations.length; i++) {
7065            marker = new google.maps.Marker({
7066                position: new google.maps.LatLng(locations[i][1], locations[i][2]),
7067                map: mapGoogle,
7068                icon: svgMarker,
7069                label: {
7070                    color: colorCustom,
7071                    fontWeight: 'bold',
7072                    fontSize: '14px',
7073                    fontFamily: 'Barlow-SemiBold',
7074                    text: locations[i][0],
7075                    className: 'label-map label-map-' + i,
7076                    zIndex: 99999,
7077                }
7078            });
7079            marker1 = new google.maps.Marker({
7080                position: new google.maps.LatLng(locations[i][1], locations[i][2]),
7081                icon: numbermarker,
7082                label: {
7083                    text: " ",
7084                    height: '32px',
7085                    width: ' 48px',
7086                    fontFamily: 'Anton',
7087                    fontSize: '20px',
7088                    textAlign: 'center',
7089                    className: 'icon-theme ' + locations[i][9] + ' icon-theme-' + i,
7090                },
7091                map: mapGoogle,
7092            });
7093
7094            google.maps.event.addListener(marker, 'click', (function (marker, i) {
7095                return function () {
7096                    var contentString;
7097
7098                    contentString = "<div class='row no-gutters'>" +
7099                        "<div class='col-5 col-lg-4 colI'>" +
7100                        "<img class='img-fluid cardMapImg' src='" + locations[i][4] + "'></img>" +
7101                        "</div>";
7102
7103                    contentString = contentString + "<div class='col-7 col-lg-8 pl-3 colR'>" +
7104                        //"<p class='title cardMapTitle'>"+locations[i][0] +"</p>";
7105                        "<a href='" + locations[i][10] + "' class='title cardMapTitle'>" + locations[i][0] + "</a>";
7106
7107                    if (locations[i][3] != undefined) {
7108                        contentString = contentString + "<p class='subtitle cardMapSubtitle'>" + locations[i][3] + "</p>";
7109                    }
7110
7111                    contentString = contentString + "<input type='hidden' value='" + locations[i][2] + "'>" +
7112                        "<input type='hidden' value='" + locations[i][1] + "'>";
7113
7114                    if (locations[i][6] != "" && locations[i][6] != undefined) {
7115                        contentString = contentString + "<div class='intensidad'><span>" + locations[i][5] + ":&nbsp;</span>";
7116                        contentString = contentString + "<span class='intensity " + locations[i][7] + "'>" + locations[i][6] + "</span></div>";
7117                        contentString = contentString + "<input type='hidden' class='valuetagname' value='" + locations[i][7] + "'></input>";
7118                    }
7119                    "<div class='icons pt-3'><span class='icon-pin-map pr-3'></span><span onclick='shareModal()' class='icon-share'></span>" +
7120                        "</div>" +
7121                        "</div>";
7122
7123
7124                    mapGoogle.setCenter(marker.getPosition());
7125                    infowindow.setContent(contentString);
7126                    infowindow.open({
7127                        mapGoogle,
7128                        anchor: marker,
7129                        shouldFocus: true,
7130                    });
7131                    infowindow.setOptions({
7132                        disableAutoPan: false,
7133                        zIndex: 99999
7134                    })
7135                    setTimeout(function () {
7136                        $('.colR').each(function () {
7137                            colorCardMap = $(this).find('.valuetagname').val();
7138                            if (colorCardMap == 'soft') {
7139                                $(this).find('.intensity').css('color', '#00AA55');
7140                            }
7141                            if (colorCardMap == 'intense') {
7142                                $(this).find('.intensity').css('color', 'red');
7143                            }
7144                            if (colorCardMap == 'moderate') {
7145                                $(this).find('.intensity').css('color', 'orange');
7146                            }
7147                        });
7148                    }, 1);
7149                    for (var j = 0; j < markersGoogleMap.length; j++) {
7150                        markersGoogleMap[j].setIcon(svgMarker);
7151                    }
7152                    //$(addClassLabel).show();
7153                    var label = this.getLabel();
7154                    var nameClass = label.className;
7155                    var number = nameClass.match(/\d+/);
7156                    addClassLabel = $('.label-map-' + number[0])
7157                    addClass = $('.icon-theme-' + number[0])
7158                    $('.icon-theme').removeClass('hoverito');
7159                    printClass(addClass);
7160                    $(addClassLabel).hide();
7161                    marker.setIcon(svgMarkerY);
7162                    //console.log('hoverito llamada click');
7163                    $('.gm-ui-hover-effect').click(function () {
7164                        for (var j = 0; j < markersGoogleMap.length; j++) {
7165                            markersGoogleMap[j].setIcon(svgMarker);
7166                            $('.icon-theme').removeClass('hoverito');
7167                            addClass = '';
7168                        }
7169                    })
7170                }
7171            })(marker, i));
7172            markersGoogleMap.push(marker);
7173            markersGoogleMapAux.push(marker1)
7174            google.maps.event.addListener(mapGoogle, 'idle', function () {
7175                if (addClass) {
7176                    printClass(addClass);
7177                    //console.log('hoverito idle');
7178                }
7179            });
7180            google.maps.event.addListener(mapGoogle, "click", function (event) {
7181                for (var j = 0; j < markersGoogleMap.length; j++) {
7182                    markersGoogleMap[j].setIcon(svgMarker);
7183                    $('.icon-theme').removeClass('hoverito');
7184                    //$(addClassLabel).show();
7185                    addClass = '';
7186                }
7187                infowindow.close();
7188            });
7189            if (imagen) {
7190                google.maps.event.addListener(imagen, "click", function (event) {
7191                    for (var j = 0; j < markersGoogleMap.length; j++) {
7192                        markersGoogleMap[j].setIcon(svgMarker);
7193                        $('.icon-theme').removeClass('hoverito');
7194                        //$(addClassLabel).show();
7195                        addClass = '';
7196                    }
7197                    infowindow.close();
7198                });
7199            }
7200        }
7201    }
7202}
7203
7204function deleteMarkers() {
7205    //Loop through all the markers and remove
7206    for (var i = 0; i < markersGoogleMap.length; i++) {
7207        markersGoogleMap[i].setMap(null);
7208        markersGoogleMapAux[i].setMap(null);
7209
7210    }
7211    markersGoogleMap = [];
7212    markersGoogleMapAux = [];
7213};
7214var isinitMap = false;
7215var docsProduct;
7216$(document).ready(function () {
7217    const mapCheck = document.querySelector("#selectMap");
7218    // Load Maps
7219    if (mapCheck != null && mapCheck.value == "enabled") {
7220        loadViewMap();
7221    }
7222
7223    //$(window).bind('load', function (e) {
7224    var view = $('input.viewSelected').val();
7225    var themeArea = $('.cc20-themeArea #themeArea').val();
7226    if (themeArea == 'themeArea') {
7227        solrSearchInit();
7228        solrSearchInitThemeArea();
7229    }
7230    else {
7231        solrSearchInit();
7232    }
7233});
7234
7235var lg = document.documentElement.lang.toLowerCase();
7236let i18Intensity = $('#filter-intensity').val();
7237let i18ageRecommendation = $('#filter-age-recommendation').val();
7238let i18maxWeight = $('#filter-max-weight').val();
7239let i18minWeight = $('#filter-min-weigth').val();
7240let i18maxHeight = $('#filter-max-height').val();
7241let i18minHeight = $('#filter-min-height').val();
7242let i18minAge = $('#filter-min-age').val();
7243let i18themeArea = $('#filter-theme-area').val();
7244let i18fastPass = $('#filter-fast-pass').val();
7245let i18schedule = $('#filter-schedule').val();
7246let i18solt = $('#filter-solt').val();
7247let i18mealPlan = $('#filter-meal-plan').val();
7248let i18foodType = $('#filter-food-type').val();
7249let i18attentionTo = $('#filter-attention-to').val();
7250let i18price = $('#filter-price').val();
7251let i18telephone = $('#filter-telephone').val();
7252let i18attractions = $('#filter-attractions').val();
7253let i18rides = $('#filter-rides').val();
7254let i18placesToEat = $('#filter-places-to-eat').val();
7255let i18places = $('#filter-places').val();
7256let i18shops = $('#filter-shops').val();
7257let i18shopss = $('#filter-shopss').val();
7258let i18years = $('#filter-years').val();
7259let i18typeattraction = $('#filter-type-attraction').val();
7260let i18typerestaurant = $('#filter-type-restaurant').val();
7261let i18maxspeed = $('#filter-max-speed').val();
7262let i18openingSeason = $('#filter-opening-season').val();
7263let i18typeShow = $('#filter-type-event').val();
7264let i18payment = $('#filter-payment').val();
7265let i18typeDinningShow = $('#filter-type-dinning-event').val();
7266let i18locationIndications = $('#filter-location-indication').val();
7267let i18babycare = $('#filter-baby-care').val();
7268let i18typeStore = $('#filter-type-store').val();
7269let i18avaibleProducts = $('#filter-avaible-products').val();
7270let i18Services = $('#filter-services').val();
7271function solrSearchInit(alfabetic) {
7272
7273    var url = $('input.current-page-solr').attr('data-page-path');
7274    var type_primary = $('input.type_primary').val();
7275    var type_secondary = $('input.type_secondary').val();
7276    var facets = [];
7277    var fqs = [];
7278    var fqRange = [];
7279
7280    var view = $('input.viewSelected').val();
7281    let isMerchandising = $('input.isMerchandising').val();
7282    let isPromotion = $('input.isPromotion').val();
7283    var checkopenning = $("input[type=hidden]#openning-hour").val();
7284    switch (view) {
7285        case 'tabs':
7286            if (isMerchandising != "merchandising") {
7287                $("input[type=hidden].facets_tabs").each(function () {
7288                    facets.push($(this).val());
7289                });
7290                var name = $("input[type=hidden].facets_tabs")[0].value;
7291                var title = $("input[type=hidden].facets_tabs_title")[0].value;
7292                var finalname = "tags_ss:" + name;
7293                var finaltitle = "tags_ss:" + title;
7294                fqs.push(finalname);
7295                fqs.push(finaltitle);
7296            } else if (isMerchandising == "merchandising") {
7297                facets.push("facetsMerchandising");
7298                var name = $("input[type=hidden].facets_tabs")[0].value;
7299                var title = $("input[type=hidden].facets_tabs_title")[0].value;
7300                var finalname = "tags_ss:" + name;
7301                var finaltitle = "tags_ss:" + title;
7302                fqs.push(finalname);
7303                fqs.push(finaltitle);
7304            }
7305            break;
7306        case 'filters':
7307            $("input[type=hidden].facets_filters").each(function () {
7308                facets.push($(this).val());
7309            });
7310            var str = $('input.type_primary').val();
7311            str = str.split(":").pop();
7312            fqs.push('type_s:' + str)
7313            break;
7314        case 'faqs':
7315            facets.push("facets");
7316            break;
7317        case 'calendarevents':
7318
7319            if (checkopenning) {
7320
7321            } else {
7322                var { dateFrom, dateTo } = initialDatesv3();
7323                var today = $(".datepicker").datepicker('getDate');
7324                fqRange.push("startDate_date:[* TO " + dateTo + "T00:00:00Z]");
7325                fqRange.push("finishDate_date:[" + dateFrom + "T00:00:00Z TO *]");
7326                fqs.push("featuredShow_b:true");
7327            }
7328            break;
7329        case 'calendarexcel':
7330            if (checkopenning) {
7331
7332            } else {
7333                var { dateFrom, dateTo } = initialDatesv3();
7334                var today = $(".datepicker").datepicker('getDate');
7335                fqRange.push("startDate_date:[* TO " + dateTo + "T00:00:00Z]");
7336                fqRange.push("finishDate_date:[" + dateFrom + "T00:00:00Z TO *]");
7337                fqs.push("featuredShow_b:true");
7338            }
7339            break;
7340        case 'mapa':
7341            $(".content-listTabs__list.fqMapa").each(function () {
7342                var valuenametag = $("input#nametagMap", this).val();
7343                if (valuenametag != null) {
7344                    fqs.push("tags_ss:" + valuenametag);
7345                }
7346            })
7347            break;
7348        default:
7349            break;
7350    }
7351    //facets.push("intensity");
7352    //facets.push("fast-pass");
7353    $(".content-listTabs").each(function () {
7354        $(".content-listTabs__list").each(function () {
7355            if ($(".icon-checkbox-rectangle-Off", this).hasClass("check")) {
7356                var category = $(this).parents(".content-listTabs").find("input.facets_filters").val();
7357                var categoryNamecomplete = $(this).children(".title").data("name");
7358                var finalname = category + "_ss:" + categoryNamecomplete;
7359                fqs.push(finalname);
7360            }
7361        })
7362    });
7363    var data = { "type_primary": type_primary, "type_secondary": type_secondary, "facets": facets, "fqs": fqs, "fqRange": fqRange, "type": view, "lang": lg };
7364
7365    $.ajax({
7366        url: url + ".searchservlet.json",
7367        type: 'GET',
7368        dataType: "json",
7369        //traditional: true,
7370        data: data,
7371        success: function (data) {
7372            var view = "filters";
7373            switch (view) {
7374
7375                case 'filters':
7376                    if (alfabetic == undefined) {
7377                        printFilters(data, facets);
7378                        printCardsFilters(data, "cards-result", false, true);
7379                        cc21js();
7380                    } else {
7381                        printCardsFilters(data, "cards-result", false, false);
7382                        buttonMore();
7383                    }
7384
7385                    cc21mapa();
7386                    break;
7387                case 'mapa':
7388                    printCardsFilters(data, "cards-result", false, true);
7389                    printFilters(data, facets);
7390                    cc21js('init');
7391                    cc21mapa();
7392                    break;
7393                default:
7394                    name = "";
7395                    //Declaraciones ejecutadas cuando ninguno de los valores coincide con el valor de la expresión
7396                    break;
7397            }
7398        },
7399        error: function (XMLHttpRequest, textStatus, errorThrown) {
7400            console.log("Error: {}", errorThrown);
7401        }
7402    });
7403}
7404
7405function solrSearch(fqs, fqRange) {
7406
7407    var fqsmap = fqs;
7408    var url = $('input.current-page-solr').attr('data-page-path');
7409    var type_primary = $('input.type_primary').val();
7410    var type_secondary = $('input.type_secondary').val();
7411    var facets = [];
7412    switch (view) {
7413        case 'tabs':
7414            if (isMerchandising != "merchandising") {
7415                $("input[type=hidden].facets_tabs").each(function () {
7416                    facets.push($(this).val());
7417                });
7418            } else if (isMerchandising == "merchandising") {
7419                facets.push("facetsMerchandising");
7420            }
7421            break;
7422        case 'filters':
7423            $("input[type=hidden].facets_filters").each(function () {
7424                facets.push($(this).val());
7425            });
7426
7427            break;
7428        case 'mapa':
7429            var fqs = [];
7430            fqsmap.forEach(function (valor, indice, array) {
7431                //console.log("En el índice " + indice + " hay este valor: " + valor);
7432                fqs.push("tags_ss:" + valor);
7433            });
7434
7435            break;
7436        default:
7437            break;
7438    }
7439    var str = $('input.type_primary').val();
7440    str = str.split(":").pop();
7441    if(fqs!=undefined){
7442        fqs.push('type_s:' + str);
7443    }
7444    var view = $('input.viewSelected').val();
7445    let isMerchandising = $('input.isMerchandising').val();
7446
7447
7448    var data = { "type_primary": type_primary, "type_secondary": type_secondary, "facets[]": facets, "fqs[]": fqs, "fqRange": fqRange, "type": view, "lang": lg };
7449    jQuery.ajax({
7450        url: url + ".searchservlet.json",
7451        type: 'GET',
7452        dataType: "json",
7453        data: data,
7454        success: function (data) {
7455            var view = $('input.viewSelected').val();
7456            switch (view) {
7457
7458                case 'filters':
7459                    printCardsFilters(data, "cards-result", false, false);
7460                    buttonMore();
7461
7462                    break;
7463                case 'mapa':
7464                    printCardsFilters(data, "cards-result", false, false);
7465                    break;
7466                default:
7467                    name = "";
7468                    break;
7469            }
7470            modalShare();
7471        },
7472        error: function (XMLHttpRequest, textStatus, errorThrown) {
7473            switch (XMLHttpRequest.status) {
7474                case 500:
7475                    console.log('ha dado un Error 500');
7476                    var data;
7477                    printCardsFilters(data, "cards-result", true, false);
7478                    break;
7479                default:
7480                    console.log("Error: {}", errorThrown + ' ' + XMLHttpRequest.status);
7481                    break;
7482            }
7483
7484        }
7485    });
7486}
7487function printFilters(data, facets) {
7488    var checkHeight;
7489    $(data.facets).each(function (j, doc) {
7490        var name = doc.name;
7491        var sortArray;
7492        if (name == 'maxHeight_ss' || name == 'minHeight_ss' || name == 'maxWeight_ss' || name == 'minWeight_ss') {
7493            doc.values.sort(function (a, b) {
7494                var a1 = a.name, b1 = b.name;
7495                var c1 = parseInt(a1.split(' ')[0]);
7496                var d1 = parseInt(b1.split(' ')[0]);
7497                if (c1 == d1) return 0;
7498                return c1 < d1 ? 1 : -1;
7499            });
7500        }
7501
7502        $(doc.values).each(function (i, doc2) {
7503            var namecount = doc2.name;
7504            var count = doc2.count;
7505            var htmlfilters = '<div class="content-listTabs__list">';
7506            htmlfilters = htmlfilters + '<div class="icon mr-3">';
7507            htmlfilters = htmlfilters + '<span class="icon-checkbox-rectangle-On"></span>';
7508            htmlfilters = htmlfilters + '<span class="icon-checkbox-rectangle-Off">';
7509            htmlfilters = htmlfilters + '<span class="path4"></span>';
7510            htmlfilters = htmlfilters + '</span>';
7511            htmlfilters = htmlfilters + '</div>';
7512            htmlfilters = htmlfilters + '<div class="title" data-name="' + namecount + '">';
7513            htmlfilters = htmlfilters + '<span>' + namecount + ' (' + count + ')</span>';
7514            htmlfilters = htmlfilters + '</div>';
7515            htmlfilters = htmlfilters + '</div>';
7516
7517            var elementfilter = $("div." + name)[0];
7518            elementfilter.innerHTML = elementfilter.innerHTML + htmlfilters;
7519        })
7520    })
7521}
7522
7523
7524function printCardsFilters(data, clase, check, initPrint) {
7525    docsProduct = data;
7526
7527    var element = $('div.' + clase + '')[0];
7528    element.innerHTML = "";
7529    var checkopenning = $("input[type=hidden]#openning-hour").val();
7530    var view = $('input.viewSelected').val();
7531    if (view == "calendarevents" || view == "calendarexcel") {
7532        var elementSpecialEvents = $('div.cards-result-hightlight');
7533        elementSpecialEvents.empty();
7534    }
7535
7536    if (check) {
7537        $("div.notfound-calendar").css("display", "block");
7538        $("div.error-page").css("display", "block");
7539        $("div.select-day-month").css("display", "none");
7540        $(".col-12.title").removeClass('mostrar').addClass('ocultar');
7541        $(".col-12.subtitle-top").removeClass('mostrar').addClass('ocultar');
7542        $('div.special-event').hide();
7543        $('.col-cardright .botonFinal').hide();
7544    } else {
7545        $("div.notfound-calendar").css("display", "none");
7546        $("div.select-day-month").css("display", "none");
7547        $(".col-12.title").removeClass('ocultar').addClass('mostrar');
7548        $(".col-12.subtitle-top").removeClass('ocultar').addClass('mostrar');
7549        $('div.special-event').show();
7550    }
7551    var view = $('input.viewSelected').val();
7552    if (data) {
7553        numFilters = docsProduct.docs ? docsProduct.docs.length : 0;
7554        if (numFilters > 0 && !$('.icon-list').hasClass('color-iconList')) {
7555            $("div.error-page").css("display", "none");
7556            $('.botonFinal').show();
7557            $('.col-cardright .sort-filters').show();
7558        } else if ($('.icon-map-simple').hasClass('color-iconMap')) {
7559            $("div.error-page").css("display", "none");
7560            $('.botonFinal').hide();
7561            $('.col-cardright .sort-filters').show();
7562        } else {
7563            $("div.error-page").css("display", "block");
7564            $('.botonFinal').hide();
7565            $('.col-cardright .sort-filters').hide();
7566        }
7567        $(".col-12.special-event").css("display", "none");
7568
7569        //Horarios
7570        var horarios = data.doc;
7571
7572        var relevantProductList = $("#relevantProductList").val().split(",")
7573        if (layerGroup != undefined)
7574            layerGroup.clearLayers();
7575
7576        //Sort alphabetic data by name product
7577
7578        if ($('i.alfabetic').hasClass('check')) {
7579            docsProduct.docs = sortData(data.docs)
7580        }
7581
7582        $(docsProduct.docs).each(function (j, doc) {
7583
7584            // Checked If is relevant product
7585            var isRelevantProduct = relevantProductList.find(e => e == doc.path) != undefined;
7586
7587            var codeHtml;
7588            var { mainImage, name, altimage, briefdescription, icon } = getInfoCards(doc);
7589
7590            if (name != "") {
7591
7592                var latitude = doc.latitude_s;
7593                var longitude = doc.longitude_s;
7594                if (view != "calendarevents" && view != "calendarexcel") {
7595                    if ((latitude == undefined || longitude == undefined) && $(".sort-filters__linkmap .icon-map-simple").length > 0) {
7596                        numFilters = numFilters - 1;
7597                    }
7598                }
7599                var typeProduct = doc.type_s;
7600                var path = doc.realpath;
7601                var description = doc.briefDescription_s;
7602                var type = doc.type_s;
7603                var serviceIcon = doc.iconService_s;
7604                if (doc.intensity_level_s) {
7605                    var intensity = doc.intensity_level_s
7606                }
7607
7608                var selectSortBy = $('#selectSortBy').val();
7609                if (isRelevantProduct && initPrint && selectSortBy == 'enabled') {
7610                    printRelevant(longitude, latitude, description, mainImage, icon, name, path, doc.schedules_s, initPrint);
7611
7612                }
7613
7614                //CHECK 2 CARDS O 1 CARD
7615                var checkCards = $('#selectAttributesSwitch').val();
7616                var colType;
7617                if (checkCards == 'false') {
7618                    colType = 'col-md-6 twoCards'
7619                } else {
7620                    colType = 'col-md-12 oneCard'
7621                }
7622                codeHtml = '<div class="' + colType + ' filters-cards" data-isRelevantProduct="' + isRelevantProduct + '">';
7623                codeHtml = codeHtml + '<input class="cardLongitude" type="hidden" value="' + longitude + '">';
7624                codeHtml = codeHtml + '<input class="cardLatitude" type="hidden" value="' + latitude + '">';
7625                codeHtml = codeHtml + '<input class="typeProduct" type="hidden" value="' + typeProduct + '">';
7626                codeHtml = codeHtml + '<input class="path" type="hidden" value="' + path + '">';
7627                codeHtml = codeHtml + '<input class="description" type="hidden" value="' + description + '">';
7628                codeHtml = codeHtml + '<input class="icon-theme" type="hidden" value="' + icon + '">';
7629                codeHtml = codeHtml + '<div class="row filters-cards__top">';
7630                codeHtml = codeHtml + '<div class="col-sm-12 col-md-4 img">';
7631                //codeHtml=codeHtml+'<span class="tag text-uppercase yellow-tag">SHOW FULL</span>';
7632
7633                codeHtml = codeHtml + '<img class="img img-fluid mapimage" alt="' + altimage + '" src="' + mainImage + '">';
7634                codeHtml = codeHtml + '</div>';
7635                codeHtml = codeHtml + '<div class="col-sm-12 col-md-8 content">';
7636                codeHtml = codeHtml + '<div class="content-text">';
7637                if (doc.waitTime_b) {
7638                    codeHtml = codeHtml + '<div class="clock">';
7639                    codeHtml = codeHtml + '<span class="icon-reloj"></span>';
7640                    codeHtml = codeHtml + '<span class="text">
7640xx MIN</span>';
7641                    codeHtml = codeHtml + '</div>';
7642                }
7643                codeHtml = codeHtml + '<div class="text">';
7644                codeHtml = codeHtml + '<h2 class="title maptitle">' + name + '</h2>';
7645                codeHtml = codeHtml + '<span class="description mapdescription">' + briefdescription + '</span>';
7646                codeHtml = codeHtml + '</div>';
7647                codeHtml = codeHtml + '<div class="row filters-cards__middle">';
7648                codeHtml = codeHtml + "<input type='hidden' id='timeSessions' value='" + doc.schedules_s + "'>";
7649                var count = 1;
7650                switch (doc.type_s) {
7651                    case 'attractions':
7652                        if (doc.checkIntensity_b && count <= 6 && doc.intensity_ss != undefined) {
7653                            codeHtml = codeHtml + printPropertyIntensityCard(i18Intensity, doc.intensity_ss, doc);
7654                            count++;
7655                        }
7656                        if (doc.checkAgeRecomendation_b && count <= 6 && doc['age-recomendation_ss'] != undefined) {
7657                            codeHtml = codeHtml + printPropertyCard(i18ageRecommendation, doc['age-recomendation_ss']);
7658                            count++;
7659                        }
7660                        if (doc.checkMinHeight_b && count <= 6 && doc.minHeight_ss != undefined) {
7661                            codeHtml = codeHtml + printPropertyCard(i18minHeight, doc.minHeight_ss);
7662                            count++;
7663                        }
7664                        if (doc.checkTypeAttracction_b && count <= 6) {
7665                            codeHtml = codeHtml + printPropertyCard(i18typeattraction, doc['typeAttracction_ss']);
7666                            count++;
7667                        }
7668                        if (doc.checkMaxWeight_b && count <= 6) {
7669                            codeHtml = codeHtml + printPropertyCard(i18maxWeight, doc.maxWeight_ss);
7670                            count++;
7671                        }
7672                        if (doc.checkMaxHeight_b && count <= 6) {
7673                            codeHtml = codeHtml + printPropertyCard(i18maxHeight, doc.maxHeight_ss);
7674                            count++;
7675                        }
7676                        if (doc.checkMinWeight_b && count <= 6) {
7677                            codeHtml = codeHtml + printPropertyCard(i18minWeight, doc.minWeight_ss);
7678                            count++;
7679                        }
7680                        if (doc.checkMinAge_b && count <= 6) {
7681                            codeHtml = codeHtml + printPropertyCard(i18minAge, doc.minAge_s + ' ' + i18years);
7682                            count++;
7683                        }
7684                        if (doc.checkMaxSpeed_b && count <= 6) {
7685                            codeHtml = codeHtml + printPropertyCard(i18maxspeed, doc.maxSpeed_s);
7686                            count++;
7687                        }
7688                        if (doc.checkThemeArea_b && count <= 6) {
7689                            if (doc['theme-areas_ss'] != undefined) {
7690                                codeHtml = codeHtml + printPropertyCard(i18themeArea, doc['theme-areas_ss']);
7691                                count++;
7692                            }
7693                        }
7694                        if (doc.checkfastPass_b && count <= 6) {
7695                            codeHtml = codeHtml + printPropertyCard(i18fastPass, doc['fast-pass_ss']);
7696                            count++;
7697                        }
7698                        if (doc.checkOpeningSeason_b && count <= 6) {
7699                            codeHtml = codeHtml + printPropertyCard(i18openingSeason, doc['openingSeason_ss'], 'openSeason');
7700                            count++;
7701                        }
7702                        break;
7703                    case 'events':
7704                        if (doc.checkTypeShow_b && count <= 6) {
7705                            codeHtml = codeHtml + printPropertyCard(i18typeShow, doc['typeShow_ss']);
7706                            count++;
7707                        }
7708                        if (doc.checkTypeDinning_b && count <= 6) {
7709                            codeHtml = codeHtml + printPropertyCard(i18typeDinningShow, doc['typeDinning_ss']);
7710                            count++;
7711                        }
7712                        if (doc.checkThemeArea_b && count <= 6) {
7713                            if (doc['theme-areas_ss'] != undefined) {
7714                                codeHtml = codeHtml + printPropertyCard(i18themeArea, doc['theme-areas_ss']);
7715                                count++;
7716                            }
7717                        }
7718                        if (doc.checkAgeRecomendation_b && count <= 6) {
7719                            codeHtml = codeHtml + printPropertyCard(i18ageRecommendation, doc['age-recomendation_ss']);
7720                            count++;
7721                        }
7722                        if (doc.checkPayment_b && count <= 6) {
7723                            codeHtml = codeHtml + printPropertyCard(i18payment, doc['payment_ss']);
7724                            count++;
7725                        }
7726                        if ((doc.checktime_b && count <= 6)) {
7727                            var concat = doc.openFrom_s + ' - ' + doc.closeTime_s;
7728                            codeHtml = codeHtml + printPropertyCard(i18schedule, concat, 'openFrom');
7729                            count++;
7730                        }
7731                        if (doc.checkslot_b && count <= 6) {
7732                            codeHtml = codeHtml + printPropertyCard(i18solt, doc.slot_s, 'checkslot');
7733                            count++;
7734
7735                        }
7736                        if (doc.checkOpeningSeason_b && count <= 6) {
7737                            codeHtml = codeHtml + printPropertyCard(i18openingSeason, doc['openingSeason_ss'], 'openSeason');
7738                            count++;
7739
7740                        }
7741                        if (doc.checkMinAge_b && count <= 6) {
7742                            codeHtml = codeHtml + printPropertyCard(i18minAge, doc.minAge_s + ' ' + i18years);
7743                            count++;
7744                        }
7745                        if (doc.checkLocationIndications_b && count <= 6) {
7746                            codeHtml = codeHtml + printPropertyCard(i18locationIndications, doc.locationIndications_s);
7747                            count++;
7748                        }
7749                        if (doc.checkServices_b && count <= 6) {
7750                            var i18services = doc.services_ss;
7751                            var i18servicesList = [];
7752                            if (i18services != null) {
7753                                for (var i = 0; i < i18services.length; i++) {
7754                                    var traduction = "#" + i18services[i];
7755                                    var traductionfinal = traduction.replaceAll(".", "-");
7756                                    i18servicesList[i] = $(traductionfinal).val();
7757                                }
7758                                codeHtml = codeHtml + printPropertyCard(i18Services, i18servicesList);
7759                                count++;
7760                            }
7761                        }
7762                        break;
7763                    case 'fests':
7764                        if (doc.checkTypeShow_b && count <= 6) {
7765                            codeHtml = codeHtml + printPropertyCard(i18typeShow, doc['typeShow_ss']);
7766                            count++;
7767                        }
7768                        if (doc.checkTypeDinning_b && count <= 6) {
7769                            codeHtml = codeHtml + printPropertyCard(i18typeDinningShow, doc['typeDinning_ss']);
7770                            count++;
7771                        }
7772                        if (doc.checkThemeArea_b && count <= 6) {
7773                            if (doc['theme-areas_ss'] != undefined) {
7774                                codeHtml = codeHtml + printPropertyCard(i18themeArea, doc['theme-areas_ss']);
7775                                count++;
7776                            }
7777                        }
7778                        if (doc.checkAgeRecomendation_b && count <= 6) {
7779                            codeHtml = codeHtml + printPropertyCard(i18ageRecommendation, doc['age-recomendation_ss']);
7780                            count++;
7781                        }
7782                        if (doc.checkPayment_b && count <= 6) {
7783                            codeHtml = codeHtml + printPropertyCard(i18payment, doc['payment_ss']);
7784                            count++;
7785                        }
7786                        if ((doc.checktime_b && count <= 6)) {
7787                            var concat = doc.openFrom_s + ' - ' + doc.closeTime_s;
7788                            codeHtml = codeHtml + printPropertyCard(i18schedule, concat, 'openFrom');
7789                            count++;
7790                        }
7791                        if (doc.checkslot_b && count <= 6) {
7792                            codeHtml = codeHtml + printPropertyCard(i18solt, doc.slot_s, 'checkslot');
7793                            count++;
7794
7795                        }
7796                        if (doc.checkOpeningSeason_b && count <= 6) {
7797                            codeHtml = codeHtml + printPropertyCard(i18openingSeason, doc['openingSeason_ss'], 'openSeason');
7798                            count++;
7799
7800                        }
7801                        if (doc.checkMinAge_b && count <= 6) {
7802                            codeHtml = codeHtml + printPropertyCard(i18minAge, doc.minAge_s + ' ' + i18years);
7803                            count++;
7804                        }
7805                        if (doc.checkLocationIndications_b && count <= 6) {
7806                            codeHtml = codeHtml + printPropertyCard(i18locationIndications, doc.locationIndications_s);
7807                            count++;
7808                        }
7809                        if (doc.checkServices_b && count <= 6) {
7810                            var i18services = doc.services_ss;
7811                            var i18servicesList = [];
7812                            if (i18services != null) {
7813                                for (var i = 0; i < i18services.length; i++) {
7814                                    var traduction = "#" + i18services[i];
7815                                    var traductionfinal = traduction.replaceAll(".", "-");
7816                                    i18servicesList[i] = $(traductionfinal).val();
7817                                }
7818                                codeHtml = codeHtml + printPropertyCard(i18Services, i18servicesList);
7819                                count++;
7820                            }
7821                        }
7822                        break;
7823                    case 'restaurants':
7824                        if (doc.checkrestaurantType_b && count <= 6) {
7825                            codeHtml = codeHtml + printPropertyCard(i18typerestaurant, doc['type-of-restaurant_ss']);
7826                            count++;
7827                        }
7828                        if (doc.checkmealPlans_b && count <= 6) {
7829                            codeHtml = codeHtml + printPropertyCard(i18mealPlan, doc['meal-plan_ss']);
7830                            count++;
7831                        }
7832                        if (doc.checkThemeArea_b && count <= 6) {
7833                            if (doc['theme-areas_ss'] != undefined) {
7834                                codeHtml = codeHtml + printPropertyCard(i18themeArea, doc['theme-areas_ss']);
7835                                count++;
7836                            }
7837                        }
7838                        if (doc.checkfoodType_b && count <= 6) {
7839                            codeHtml = codeHtml + printPropertyCard(i18foodType, doc['type-of-food_ss']);
7840                            count++;
7841                        }
7842                        if (doc.checkattentionto_b && count <= 6) {
7843                            codeHtml = codeHtml + printPropertyCard(i18attentionTo, doc['attention-to_ss']);
7844                            count++;
7845                        }
7846                        if (doc.checkprice_b && count <= 6) {
7847                            codeHtml = codeHtml + printPropertyCard(i18price, doc['price_ss']);
7848                            count++;
7849                        }
7850                        if (doc.checkBabyCare_b && count <= 6) {
7851                            codeHtml = codeHtml + printPropertyCard(i18babycare, doc['babyCare_ss']);
7852                            count++;
7853                        }
7854                        if (doc.checkOpeningSeason_b && count <= 6) {
7855                            codeHtml = codeHtml + printPropertyCard(i18openingSeason, doc['openingSeason_ss'], 'openSeason');
7856                            count++;
7857                        }
7858                        if (doc.checkemail_b && count <= 6) {
7859                            codeHtml = codeHtml + printPropertyCard("Email", doc.email_s);
7860                            count++;
7861                        }
7862                        if (doc.checktelephone_b && count <= 6) {
7863                            codeHtml = codeHtml + printPropertyCard(i18telephone, doc.telephone_s);
7864                            count++;
7865                        }
7866                        if (doc.checktime_b && doc.openFrom_s != null && doc.closeTime_s != null &&  count <= 6) {
7867                            var concat = doc.openFrom_s + ' - ' + doc.closeTime_s;
7868                            codeHtml = codeHtml + printPropertyCard(i18schedule, concat, 'openFrom');
7869                            count++;
7870                        }
7871                        if (doc.checkServices_b && count <= 6) {
7872                            var i18services = doc.services_ss;
7873                            var i18servicesList = [];
7874                            if (i18services != null) {
7875                                for (var i = 0; i < i18services.length; i++) {
7876                                    var traduction = "#" + i18services[i];
7877                                    var traductionfinal = traduction.replaceAll(".", "-");
7878                                    i18servicesList[i] = $(traductionfinal).val();
7879                                }
7880                                codeHtml = codeHtml + printPropertyCard(i18Services, i18servicesList);
7881                                count++;
7882                            }
7883                        }
7884                        break;
7885                    case 'stores':
7886                        if (doc.checkThemeArea_b && count <= 6) {
7887                            if (doc['theme-areas_ss'] != undefined) {
7888                                codeHtml = codeHtml + printPropertyCard(i18themeArea, doc['theme-areas_ss']);
7889                                count++;
7890                            }
7891                        }
7892                        if (doc.checkTypeStore_b && count <= 6) {
7893                            codeHtml = codeHtml + printPropertyCard(i18typeStore, doc['typeStore_ss']);
7894                            count++;
7895                        }
7896                        if (doc.checkemail_b && count <= 6) {
7897                            codeHtml = codeHtml + printPropertyCard("Email", doc.email_s);
7898                            count++;
7899                        }
7900                        if (doc.checktelephone_b && count <= 6) {
7901                            codeHtml = codeHtml + printPropertyCard(i18telephone, doc.telephone_s);
7902                            count++;
7903                        }
7904                        if (doc.checktime_b && count <= 6) {
7905                            var concat = doc.openFrom_s + ' - ' + doc.closeTime_s;
7906                            codeHtml = codeHtml + printPropertyCard(i18schedule, concat, 'openFrom');
7907                            count++;
7908                        }
7909                        if (doc.checkLocationIndications_b && count <= 6) {
7910                            codeHtml = codeHtml + printPropertyCard(i18locationIndications, doc.locationIndications_s);
7911                            count++;
7912                        }
7913                        if (doc.checkAvaibleProducts_b && count <= 6 && doc.avaibleProducts_ss) {
7914                            var i18nAvaibleProducts = doc.avaibleProducts_ss;
7915                            var i18avaibleProductsList = [];
7916                            for (var i = 0; i < i18nAvaibleProducts.length; i++) {
7917                              
7917  var traduction = "#" + i18nAvaibleProducts[i];
7918                                var traductionfinal = traduction.replaceAll(".", "-");
7919                                i18avaibleProductsList[i] = $(traductionfinal).val();
7920                            }
7921                            codeHtml = codeHtml + printPropertyCard(i18avaibleProducts, i18avaibleProductsList);
7922                            count++;
7923                        }
7924                        break;
7925                    case 'plants':
7926                        if (doc.checkThemeArea_b && count <= 6) {
7927                            if (doc['theme-areas_ss'] != undefined) {
7928                                codeHtml = codeHtml + printPropertyCard(i18themeArea, doc['theme-areas_ss']);
7929                                count++;
7930                            }
7931                        }
7932                        if (doc.checkTypeStore_b && count <= 6) {
7933                            codeHtml = codeHtml + printPropertyCard(i18typeStore, doc['typeStore_ss']);
7934                            count++;
7935                        }
7936                        if (doc.checkemail_b && count <= 6) {
7937                            codeHtml = codeHtml + printPropertyCard("Email", doc.email_s);
7938                            count++;
7939                        }
7940                        if (doc.checktelephone_b && count <= 6) {
7941                            codeHtml = codeHtml + printPropertyCard(i18telephone, doc.telephone_s);
7942                            count++;
7943                        }
7944                        if (doc.checktime_b && count <= 6) {
7945                            var concat = doc.openFrom_s + ' - ' + doc.closeTime_s;
7946                            codeHtml = codeHtml + printPropertyCard(i18schedule, concat, 'openFrom');
7947                            count++;
7948                        }
7949                        if (doc.checkLocationIndications_b && count <= 6) {
7950                            codeHtml = codeHtml + printPropertyCard(i18locationIndications, doc.locationIndications_s);
7951                            count++;
7952                        }
7953                        if (doc.checkAvaibleProducts_b && count <= 6) {
7954                            var i18nAvaibleProducts = doc.avaibleProducts_ss;
7955                            var i18avaibleProductsList = [];
7956                            for (var i = 0; i < i18nAvaibleProducts.length; i++) {
7957                                var traduction = "#" + i18nAvaibleProducts[i];
7958                                var traductionfinal = traduction.replaceAll(".", "-");
7959                                i18avaibleProductsList[i] = $(traductionfinal).val();
7960                            }
7961                            codeHtml = codeHtml + printPropertyCard(i18avaibleProducts, i18avaibleProductsList);
7962                            count++;
7963                        }
7964                        break;
7965                    case 'vacatures':
7966                        if (doc['tags_ss'].length > 0 && count <= 6) {
7967                            codeHtml = codeHtml + printPropertyCard("", doc['tags_ss']);
7968                            count++;
7969                        }
7970                        break;
7971                    default:
7972                        name = "";
7973                        //Declaraciones ejecutadas cuando ninguno de los valores coincide con el valor de la expresión
7974                        break;
7975                }
7976
7977                codeHtml = codeHtml + '</div>';
7978                codeHtml = codeHtml + '<div class="buttons">';
7979                codeHtml = codeHtml + '<div class="button1 ca21_button button border-solid">';
7980                codeHtml = codeHtml + '<div class="button01">';
7981                var path = doc.realpath;
7982                var viewDetaili18 = $('#view-detail').val();
7983                codeHtml = codeHtml + '<a class="cmp-button button-details" href="' + path + '" title="' + viewDetaili18 + '">';
7984                codeHtml = codeHtml + '<span class="cmp-button__text">' + viewDetaili18 + '</span>';
7985                codeHtml = codeHtml + '</a>';
7986                codeHtml = codeHtml + '</div>';
7987                codeHtml = codeHtml + '</div>';
7988                //Mostrando o no el boton de compartir
7989                var selectShareButtonSwitch = $('#selectShareButtonSwitch').val();
7990                if (selectShareButtonSwitch == 'true') {
7991                    codeHtml = codeHtml + '<div class="button2 ca21_button button border-outline mostrar">';
7992                } else {
7993                    codeHtml = codeHtml + '<div class="button2 ca21_button button border-outline ocultar">';
7994                }
7995                codeHtml = codeHtml + '<div class="button01">';
7996                var sharei18 = $('#button-share').val();
7997                codeHtml = codeHtml + '<a class="cmp-button shareB" href="#" title="' + sharei18 + '" data-toggle="modal" data-target="#modalShare">';
7998                codeHtml = codeHtml + '<span class="cmp-button__text button-share">' + sharei18 + '</span>';
7999                codeHtml = codeHtml + '</a>';
8000                codeHtml = codeHtml + '</div>';
8001                codeHtml = codeHtml + '</div>';
8002                codeHtml = codeHtml + '</div>';
8003                codeHtml = codeHtml + '</div>';
8004                codeHtml = codeHtml + '</div>';
8005                codeHtml = codeHtml + '</div>';
8006                codeHtml = codeHtml + '</div>';
8007
8008                element.innerHTML = element.innerHTML + codeHtml;
8009
8010                // Print Pois in Map
8011                try{
8012                    printPoisInMap(doc, icon);
8013                }catch(error){
8014                    console.log(error.message);
8015                }
8016
8017            }
8018        })
8019        if ($('div.map-google').hasClass('mostrar-mapa')) {
8020            $('div.cards-result').addClass('ocultar');
8021        }
8022
8023        $('.filters-list .filters-list__title .filters .results').text('(' + numFilters);
8024        $('.show-filters .filters .text-filtersNum').text('(' + numFilters + ')');
8025        $('span.number-event').text(numFilters);
8026
8027        if (numFilters <= 6) {
8028            $('.cc57-searchProduct .cc21-filters__container .cc21-filters__row .botonFinal').css('display', 'none');
8029            $('.cc57-searchProduct .cc21-filters__container .cc21-filters__row .col-cardright').css('padding-bottom', '3
80290px');
8030        }else{
8031            $('.cc57-searchProduct .cc21-filters__container .cc21-filters__row .botonFinal').css('display', 'block');
8032            $('.cc57-searchProduct .cc21-filters__container .cc21-filters__row .col-cardright').css('padding-bottom', '0');
8033        }
8034
8035
8036        // Pinto de colores las intensidades
8037        // $('.filters-cards__middle').each(function () {
8038        //     color = $(this).find('.valuetag').attr('data-tagname');
8039        //     if (color == 'soft' || color == 'mild') {
8040        //         $(this).find('.valuetag').css('color', '#00AA55');
8041        //     }
8042        //     if (color == 'intense') {
8043        //         $(this).find('.valuetag').css('color', 'red');
8044        //     }
8045        //     if (color == 'moderate') {
8046        //         $(this).find('.valuetag').css('color', 'orange');
8047        //     }
8048        // });
8049        //Si esta marcado el orden alfabetico se ignora los productos destacados
8050        if (!$('i.alfabetic').hasClass('check')) {
8051            ordeningCards($("#relevantProductList").val().split(","));
8052        }
8053        if ($(".map-google").is(":visible")) {
8054            printPoisInGoogleMap()
8055        }
8056
8057
8058
8059    }
8060
8061}
8062/**
8063 * 
8064 * @param {*} doc  product detail
8065 * @returns name, description, image, altImage and icon depends the product
8066 */
8067function getInfoCards(doc) {
8068    var name;
8069    var briefdescription;
8070    var mainImage;
8071    var altimage;
8072
8073    switch (doc.type_s) {
8074        case 'animals':
8075            name = doc.animalName_s;
8076            briefdescription = doc.briefDescription_s;
8077            mainImage = doc.mainImage_s;
8078            altimage = doc.alt_image_txt_es;
8079            icon = "icon-animal";
8080            break;
8081        case 'attractions':
8082            name = doc.attractionName_s;
8083            briefdescription = doc.briefDescription_s;
8084            mainImage = doc.mainImage_s;
8085            altimage = doc.altImage_s;
8086            icon = "icon-theme-area";
8087            break;
8088        case 'events':
8089            name = doc.eventName_s;
8090            briefdescription = doc.briefDescription_s;
8091            mainImage = doc.mainImage_s;
8092            altimage = doc.altImage_s;
8093            icon = "icon-show";
8094
8095            break;
8096        case 'fests':
8097            name = doc.fests[0];
8098            briefdescription = doc.briefDescription_s;
8099            mainImage = doc.mainImage_s;
8100            altimage = doc.altImage_s;
8101            icon = "icon-show";
8102
8103            break;
8104        case 'restaurants':
8105            name = doc.restaurantName_s;
8106            briefdescription = doc.briefDescription_s;
8107            mainImage = doc.mainImage_s;
8108            altimage = doc.altImage_s;
8109            icon = "icon-restaurant1"
8110            break;
8111        case 'stores':
8112            name = doc.storeName_s;
8113            briefdescription = doc.briefDescription_s;
8114            mainImage = doc.mainImage_s;
8115            altimage = "alt";
8116            icon = "icon-store";
8117
8118            break;
8119        case 'service':
8120            name = doc.serviceName_s;
8121            briefdescription = doc.description_s;
8122            mainImage = doc.mainImage_s;
8123            altimage = "alt";
8124            icon = doc.iconService_s;;
8125            break;
8126        case 'plants':
8127            name = doc.plantName_s;
8128            briefdescription = doc.briefDescription_s;
8129            mainImage = doc.mainImage_s;
8130            altimage = doc.altImage_s;
8131            icon = 'icon-leaf';
8132            break;
8133        case 'vacatures':
8134            name = doc.vacatureName_s;
8135            briefdescription = doc.briefDescription_s;
8136            mainImage = doc.mainImage_s;
8137            altimage = doc.altImage_s;
8138            icon = 'icon-pin-map';
8139            break;
8140        default:
8141            name = "";
8142            briefdescription = "";
8143            mainImage = "";
8144            altimage = "";
8145            icon = "";
8146
8147            //Declaraciones ejecutadas cuando ninguno de los valores coincide con el valor de la expresión
8148            break;
8149    }
8150
8151    return { mainImage, name, altimage, briefdescription, icon };
8152}
8153
8154
8155function ordeningCards(relevantProductList) {
8156    //Primero cambio el orden del Array
8157    var relevantProductList = relevantProductList.reverse();
8158
8159    //Recorro el array y compruebo si el path es igual en ambos casos y si es así se pone en primera posicion de las cards
8160    $.each(relevantProductList, function (indexInArray, valueOfElement) {
8161        var urlSplit = valueOfElement.split('/');
8162        var urlLastEl = urlSplit[urlSplit.length - 1];
8163        $('.cards-result .filters-cards').each(function (index, element) {
8164            var path = $('.path', this).val().split('/');
8165            var pathLast = path[path.length - 1];
8166            if (urlLastEl == pathLast) {
8167                $(element).prependTo('.cards-result');
8168            }
8169        });
8170    });
8171
8172}
8173
8174function printPropertyIntensityCard(variable, valor, doc) {
8175    var valorString;
8176    var html;
8177
8178    html = '<div class="col-4 col-sm-4 col-md-4 attribute">';
8179    html = html + '<div class="title ">';
8180    html = html + '<span class="titletag">' + variable + '</span>';
8181    html = html + '</div>';
8182    html = html + '<div class="subtitle">';
8183
8184    //NO ES UN ARRAY
8185    if (doc.intensity_level_s) {
8186        if (Array.isArray(valor)) {
8187            $.each(valor, function (ind, elem) {
8188                if (ind == 0) {
8189                    valorString = valor[ind];
8190                } else {
8191                    valorString = valorString + ", " + valor[ind];
8192                }
8193            });
8194        } else {
8195            valorString = valor;
8196        }
8197        var intensity = [doc.intensity_level_s];
8198        $.each(intensity, function (indexInArray, valueOfElement) {
8199
8200            if (valueOfElement == 'soft' || valueOfElement == 'mild') {
8201                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:#00AA55">' + valorString + '</span>';
8202            } else if (valueOfElement == 'intense') {
8203                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:red">' + valorString + '</span>';
8204            } else if (valueOfElement == 'moderate') {
8205                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:orange">' + valorString + '</span>';
8206            }else{
8207                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '">' + valorString + '</span>';
8208            }
8209        });
8210        //ES UN ARRAY
8211    } else if (doc.intensity_level_ss) {
8212
8213        var intensity = doc.intensity_level_ss;
8214        $.each(intensity, function (indexInArray, valueOfElement) {
8215            if (indexInArray == 0) {
8216                var valorString = valor[0];
8217            } else {
8218                var valorString = ', ' + valor[indexInArray];
8219            }
8220            if (valueOfElement == 'soft' || valueOfElement == 'mild') {
8221                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:#00AA55">' + valorString + '</span>';
8222            } else if (valueOfElement == 'intense') {
8223                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:red">' + valorString + '</span>';
8224            } else if (valueOfElement == 'moderate') {
8225                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:orange">' + valorString + '</span>';
8226            }else{
8227                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '">' + valorString + '</span>';
8228            }
8229        });
8230    }
8231
8232    html = html + '</div>';
8233    html = html + '</div>';
8234    return html;
8235}
8236
8237function printPropertyIntensitySimpleTabs(variable, valor, doc) {
8238    var html;
8239    html = '<div class="col-4 col-md-12 tabs-cards__middle theme-Area">';
8240    html = html + '<div class="title ">';
8241    html = html + '<span class="titletag">' + variable + '</span>';
8242    html = html + '</div>';
8243    html = html + '<div class="subtitle">';
8244    //NO ES UN ARRAY
8245    if (doc.intensity_level_s) {
8246        if (Array.isArray(valor)) {
8247            $.each(valor, function (ind, elem) {
8248                if (ind == 0) {
8249                    valorString = valor[ind];
8250                } else {
8251                    valorString = valorString + ", " + valor[ind];
8252                }
8253            });
8254        } else {
8255            valorString = valor;
8256        }
8257        var intensity = [doc.intensity_level_s];
8258        $.each(intensity, function (indexInArray, valueOfElement) {
8259
8260            if (valueOfElement == 'soft' || valueOfElement == 'mild') {
8261                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:#00AA55">' + valorString + '</span>';
8262            } else if (valueOfElement == 'intense') {
8263                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:red">' + valorString + '</span>';
8264            } else if (valueOfElement == 'moderate') {
8265                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:orange">' + valorString + '</span>';
8266            }
8267        });
8268        //ES UN ARRAY
8269    } else if (doc.intensity_level_ss) {
8270
8271        var intensity = doc.intensity_level_ss;
8272        $.each(intensity, function (indexInArray, valueOfElement) {
8273            if (indexInArray == 0) {
8274                var valorString = valor[0];
8275            } else {
8276                var valorString = ', ' + valor[indexInArray];
8277            }
8278            if (valueOfElement == 'soft' || valueOfElement == 'mild') {
8279                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:#00AA55">' + valorString + '</span>';
8280            } else if (valueOfElement == 'intense') {
8281                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:red">' + valorString + '</span>';
8282            } else if (valueOfElement == 'moderate') {
8283                html = html + '<span class="valuetag" data-tagname="' + valueOfElement + '" style="color:orange">' + valorString + '</span>';
8284            }
8285        });
8286    }
8287
8288    html = html + '</div>';
8289    html = html + '</div>';
8290
8291    return html;
8292}
8293
8294function printPropertyCard(variable, valor, horarios) {
8295    var valorString;
8296
8297    if (Array.isArray(valor)) {
8298        $.each(valor, function (ind, elem) {
8299            if (ind == 0) {
8300                valorString = valor[ind];
8301            } else {
8302                valorString = valorString + ", " + valor[ind];
8303            }
8304        });
8305
8306
8307
8308    } else {
8309        valorString = valor;
8310    }
8311    var html;
8312    html = '<div class="col-12 attribute tabs-cards__middle">';
8313    html = html + '<div class="title">';
8314    html = html + '<span>' + variable + '</span>';
8315    html = html + '</div>';
8316    html = html + '<div class="subtitle ' + horarios + '">';
8317    html = html + '<span class="text">' + valorString + '</span>';
8318    html = html + '</div>';
8319    html = html + '</div>';
8320    return html;
8321}
8322
8323function printPropertyCardSimpleTab(variable, valor) {
8324    var valorString;
8325    if (Array.isArray(valor)) {
8326        $.each(valor, function (ind, elem) {
8327            if (ind == 0) {
8328                valorString = valor[ind];
8329                //variable = '';
8330            } else {
8331                valorString = valorString + ", " + valor[ind];
8332            }
8333        });
8334        var html;
8335        html = '<div class="col-4 col-md-12 tabs-cards__middle theme-Area">';
8336        html = html + '<div class="title">';
8337        html = html + '<span>' + variable + '</span>';
8338        html = html + '</div>';
8339        html = html + '<div class="subtitle">';
8340        html = html + '<span class="valor">' + valorString + '</span>';
8341        html = html + '</div>';
8342        html = html + '</div>';
8343        return html;
8344    } else {
8345        variable = ' ';
8346        valorString = ' ';
8347        var html = '';
8348        // html='<div class="col-4 col-md-12 tabs-cards__middle theme-Area">';
8349        // html=html+'<div class="title">';
8350        // html=html+'<span>'+variable+'</span>';
8351        // html=html+'</div>';
8352        // html=html+'<div class="subtitle">';
8353        // html=html+'<span class="valor">'+valorString+'</span>';
8354        // html=html+'</div>';
8355        html = html + ' ';
8356        return html;
8357    }
8358}
8359
8360function printInputsHorarios(horarios, check) {
8361    var check; //true es al cambiar de mes, false es al hacer click a un dia
8362    var checkopenning = $("input[type=hidden]#openning-hour").val();
8363    if (checkopenning) {
8364        $('.filters-cards__middle').each(function (index, element) {
8365            var showDate = [];
8366            var data = $('#timeSessions', element).val();
8367            var checking = tryParseJSONObject(data);
8368            if (data != 'undefined' && checking != false) {
8369
8370                var horary = $.parseJSON(data);
8371                var createSessions = [];
8372                var createTiming;
8373                $.each(horary[0].dateRanges, function (indexdateRanges, valuedateRanges) {
8374
8375                    var createDate = [];
8376                    var startSessionDuration = [];
8377                    $.each(valuedateRanges, function (indexInArray, valueOfElement) {
8378                        if (indexInArray == 'startDate' || indexInArray == 'endDate') {
8379                            createDate.push(valueOfElement);
8380                        }
8381                        if (indexInArray == 'sessionRanges' || indexInArray == 'timeRanges') {
8382                            $.each(valueOfElement, function (index, val) {
8383
8384                                startSessionDuration.push(val);
8385                            });
8386                        }
8387                    });
8388                    if (createDate.length > 0 && startSessionDuration.length > 0) {
8389                        createTiming = $.merge(createDate, startSessionDuration);
8390                        createSessions.push(createTiming);
8391                    }
8392                });
8393                showDate.push(createSessions);
8394
8395
8396                if (showDate) {
8397                    var day = $('.ui-datepicker-selected a').text();
8398                    var month = parseInt($('.ui-datepicker-selected').attr('data-month')) + 1;
8399                    var year = $('.ui-datepicker-selected').attr('data-year');
8400
8401                    if (month && day && year) {
8402                        var selectDay = month + '-' + day + '-' + year;
8403                    } else {
8404                        var monthOne = parseInt($('.availableDay').attr('data-month')) + 1;
8405                        var yearOne = $('.availableDay').attr('data-year')
8406                        var selectDay = monthOne + '-1-' + yearOne;
8407                        //var actualDay = moment(selectDay);
8408                    }
8409                    var actualDay = moment(selectDay + ' 00:00', "MM-DD-YYYY hh:mm");
8410                    var isBet;
8411                    var startDate;
8412                    var endDate;
8413                    $.each(showDate, function (indexshowDate, valueshowDate) {
8414                        var stop = false;
8415                        $.each(valueshowDate, function (indexvalueshowDate, valvalueshowDate) {
8416                            //if(indexvalueshowDate == 0){
8417                            startDate = moment(valvalueshowDate[0] + ' 23:59', "DD-MM-YYYY hh:mm")
8418                            //}else if (indexvalueshowDate == 1){
8419                            endDate = moment(valvalueshowDate[1] + ' 23:59', "DD-MM-YYYY hh:mm")
8420                            //}
8421
8422                            if (startDate && endDate) {
8423                                var isBet = actualDay.isBetween(startDate, endDate, 'days', true);
8424                                var isBetMonth = actualDay.isBetween(startDate, endDate, 'month', true);
8425                                if (isBet && !check) {
8426                                    if (valvalueshowDate.length <= 3) {
8427                                        $.each(valvalueshowDate[2], function (indexInArray, valueOfElement) {
8428                                            if (indexInArray == 'timeStart') {
8429                                                $('.tabs-cards__middle .openFrom .text', element).remove();
8430                                                $('.tabs-cards__middle .openFrom', element).append('<span>' + valueOfElement + '</span>');
8431                                                $('.checkslot', element).parents('.tabs-cards__middle').remove();
8432                                            } else if (indexInArray == 'timeEnd') {
8433                                                //$('.tabs-cards__middle:eq(0) .subtitle span',element).text('');
8434                                                $('.tabs-cards__middle .openFrom', element).append('<span> - ' + valueOfElement + '</span>');
8435                                            } else if (indexInArray == 'startSession') {
8436                                                $('.tabs-cards__middle .openFrom .text', element).remove();
8437                                                $('.tabs-cards__middle .openFrom', element).append('<span class="time">' + valueOfElement + '</span><span class="guion"> - </span>');
8438                                            } else if (indexInArray == 'duration') {
8439                                                $('.tabs-cards__middle .checkslot .text', element).remove();
8440                                                $('.tabs-cards__middle .checkslot', element).append('<span class="duration">' + valueOfElement + '</span>')
8441                                            }
8442                                        });
8443                                    } else {
8444                                        $.each(valvalueshowDate, function (indexInArray, valueOfElement) {
8445                                            if (indexInArray >= 2 && valueOfElement.startSession || valueOfElement.duration) {
8446                                                $('.tabs-cards__middle .openFrom .text', element).remove();
8447                                                $('.tabs-cards__middle .openFrom', element).append('<span class="time">' + valueOfElement.startSession + ' </span><span class="guion"> - </span>');
8448                                                if (valvalueshowDate.length > 6 && indexInArray > 7 && $(window).width() > 768) {
8449                                                    $('.tabs-cards__middle .openFrom', element).append('<span class="puntos">
8449 ...</span>');
8450                                                } else if (valvalueshowDate.length > 6 && indexInArray > 2 && $(window).width() <= 768) {
8451                                                    $('.tabs-cards__middle .openFrom', element).append('<span class="puntos">&nbsp;...</span>');
8452                                                }
8453                                                $('.tabs-cards__middle .checkslot .text', element).remove();
8454                                                $('.tabs-cards__middle .checkslot', element).append('<span class="duration">' + valueOfElement.duration + '</span>')
8455                                            } else if (indexInArray >= 2 && valueOfElement.timeEnd || valueOfElement.timeStart) {
8456                                                $('.tabs-cards__middle .openFrom .text', element).remove();
8457                                                $('.checkslot', element).parents('.tabs-cards__middle').remove();
8458                                                $('.tabs-cards__middle .openFrom', element).append('<span style="display:flex">' + valueOfElement.timeStart + ' - ' + valueOfElement.timeEnd + '</span>');
8459                                            }
8460                                        });
8461                                    }
8462                                } else if (isBetMonth && check && !stop) {
8463                                    if (valvalueshowDate.length <= 3) {
8464                                        $.each(valvalueshowDate[2], function (indexInArray, valueOfElement) {
8465                                            if (indexInArray == 'timeStart') {
8466                                                $('.tabs-cards__middle .openFrom .text', element).remove();
8467                                                $('.tabs-cards__middle .openFrom', element).append('<span>' + valueOfElement + '</span>');
8468                                                $('.checkslot', element).parents('.tabs-cards__middle').remove();
8469                                            } else if (indexInArray == 'timeEnd') {
8470                                                //$('.tabs-cards__middle:eq(0) .subtitle span',element).text('');
8471                                                var position = $('.tabs-cards__middle .openFrom span', element).length;
8472                                                if (position < 5) {
8473                                                    $('.tabs-cards__middle .openFrom', element).append('<span> - ' + valueOfElement + ' | ' + '</span>');
8474                                                }
8475                                                if (position == 5) {
8476                                                    stop = true;
8477                                                    $('.tabs-cards__middle .openFrom', element).append('<span> - ' + valueOfElement + ' ... ' + '</span>');
8478                                                }
8479                                            } else if (indexInArray == 'startSession') {
8480                                                $('.tabs-cards__middle .openFrom .text', element).remove();
8481                                                $('.tabs-cards__middle .openFrom', element).append('<span class="time">' + valueOfElement + '</span><span class="guion"> - </span>');
8482                                            } else if (indexInArray == 'duration') {
8483                                                $('.tabs-cards__middle .checkslot .text', element).remove();
8484                                                $('.tabs-cards__middle .checkslot', element).append('<span class="duration">' + valueOfElement + '</span>');
8485                                            }
8486
8487                                        });
8488                                    } else {
8489                                        $.each(valvalueshowDate, function (indexInArray, valueOfElement) {
8490                                            if (indexInArray >= 2 && valueOfElement.startSession || valueOfElement.duration) {
8491                                                $('.tabs-cards__middle .openFrom .text', element).remove();
8492                                                $('.tabs-cards__middle .openFrom', element).append('<span class="time">' + valueOfElement.startSession + ' </span><span class="guion"> - </span>');
8493                                                if (valvalueshowDate.length > 6 && indexInArray > 7 && $(window).width() > 768) {
8494                                                    $('.tabs-cards__middle .openFrom', element).append('<span class="puntos">
8494 ...</span>');
8495                                                } else if (valvalueshowDate.length > 6 && indexInArray > 2 && $(window).width() <= 768) {
8496                                                    $('.tabs-cards__middle .openFrom', element).append('<span class="puntos">&nbsp;...</span>');
8497                                                }
8498                                                $('.tabs-cards__middle .checkslot .text', element).remove();
8499                                                $('.tabs-cards__middle .checkslot', element).append('<span class="duration">' + valueOfElement.duration + '</span>')
8500                                            } else if (indexInArray >= 2 && valueOfElement.timeEnd || valueOfElement.timeStart) {
8501                                                //if(valueOfElement.timeEnd) {
8502                                                $('.tabs-cards__middle .openFrom .text', element).remove();
8503                                                $('.checkslot', element).parents('.tabs-cards__middle').remove();
8504                                                $('.tabs-cards__middle .openFrom', element).append('<span style="display:flex">' + valueOfElement.timeStart + ' - ' + valueOfElement.timeEnd + '</span>');
8505                                                // }else if(valueOfElement.timeStart){
8506                                                //     $('.tabs-cards__middle .openFrom .text',element).remove();
8507                                                //     $('.tabs-cards__middle .openFrom',element).append('<span>'+valueOfElement.timeStart+'</span>');
8508                                                //     $('.checkslot',element).parents('.tabs-cards__middle').remove();
8509                                                // }
8510                                            }
8511                                        });
8512                                    }
8513                                }
8514                            }
8515                        });
8516
8517                    });
8518                }
8519            } else {
8520                $(element).remove();
8521                console.log('No data o Json mal formado: ' + data);
8522            }
8523        });
8524    }
8525}
8526function tryParseJSONObject(jsonString) {
8527    try {
8528        var o = JSON.parse(jsonString);
8529        if (o && typeof o === "object") {
8530            return o;
8531        }
8532    }
8533    catch (e) { }
8534
8535    return false;
8536};
8537function printRelevant(long, lat, description, img, icon, title, src, session, initPrint) {
8538    if (initPrint == true) {
8539        $("#relevant-cards").append(`
8540            <div class="col-md-6 twoCards filters-cards">
8541                <input class="cardLongitude" type="hidden" value="${long}">
8542                <input class="cardLatitude" type="hidden" value="${lat}">
8543                <input class="typeProduct" type="hidden" value="attractions">
8544                <input class="path" type="hidden" value="${src}">
8545                <input  class="description" type="hidden" value="${description}">
8546                <input  class="icon-theme" type="hidden" value="${icon}">
8547            <div class="row filters-cards__top">
8548                <div class="col-sm-12 col-md-4 img"><img class="img img-fluid mapimage"
8549                        alt="${description}"
8550                        src="${img}">
8551                </div>
8552                <div class="col-sm-12 col-md-8 content">
8553                    <div class="content-text">
8554                        <div class="text">
8555                            <h2 class="title maptitle">${title}</h2>
8556                            <span class="description mapdescription">${description}</span>
8557                        </div>
8558                        <div class="row filters-cards__middle">
8559                            <input type="hidden" id="timeSessions" value="${session}">                           
8560                        </div>
8561                        <div class="buttons">
8562                            <div class="button1 ca21_button button border-solid">
8563                                <div class="button01"><a class="cmp-button button-details"
8564                                        href="${src}" title="${$('#view-detail').val()}"><span
8565                                            class="cmp-button__text">${$('#view-detail').val()}</span></a>
8566                                </div>
8567                            </div>                   
8568                        </div>
8569                    </div>
8570                </div>
8571            </div>
8572        </div>`)
8573    }
8574}
8575
8576/**
8577 * 
8578 * @param {*} poi data of product that print in map the active products 
8579 */
8580function printPoisInMap(poi, icon) {
8581    const mapCheck = document.querySelector("#selectMap");
8582    // Load Maps
8583    if (mapCheck != null && mapCheck.value == "enabled") {
8584        var typeMap = $('#mapCheck').val();
8585        if (typeMap != "relativeMap") {
8586
8587        } else {
8588            if (poi.latitude_s != "" && poi.longitude_s)
8589                setMarker(poi, icon);
8590        }
8591    }
8592
8593}
8594
8595function sortData(docs) {
8596    var sortArr = [];
8597    const namevar = 'h1_txt_' + lg;
8598    const normalFunctionality = [
8599        "attractions",
8600        "events",
8601        "fests",
8602        "restaurants",
8603        "stores",
8604        "animals",
8605        "plants",
8606        "exhibits",
8607        "vacatures"
8608    ];
8609
8610    const noNormalFunctionality = [
8611        "service"
8612    ];
8613    
8614    if (normalFunctionality.includes(docs[0].type_s)) {
8615        sortArr = docs.sort(function (a, b) {
8616            var productA = a[namevar].normalize("NFD").replace(/\p{Diacritic}/gu, "");
8617            var productB = b[namevar].normalize("NFD").replace(/\p{Diacritic}/gu, "");
8618
8619            if (productA < productB) { return -1; }
8620            if (productA > productB) { return 1; }
8621            return 0;
8622        })
8623    } else if (noNormalFunctionality.includes(docs[0].type_s)) {
8624        sortArr = docs.sort(function (a, b) {
8625            if (a.serviceName_s < b.serviceName_s) { return -1; }
8626            if (a.serviceName_s > b.serviceName_s) { return 1; }
8627            return 0;
8628        })
8629    } else {
8630        name = "";
8631    }
8632
8633    return sortArr;
8634}
8635
8636
8637$('.cc57-searchProduct form').submit(function (e) {
8638    e.preventDefault();
8639    var word = $(".wordsInput input").val();
8640    if (word.length > 2) {
8641        $(".wordsInput input").removeClass("error");
8642        $(this).parents(".wordsInput").addClass("faqs-active-search");
8643        $(this).parents(".wordsInput").siblings(".faqs-num-result").find(".text").text(word);
8644        $(".wordsInput input.saveWord").val(word);
8645        var typeS = $("input.type_primary").val().split(":")[1];
8646        wordsSearch(word, "type_s:" + typeS, true, 0);
8647        $('.total-result').text(" - (" + numFilters + ")");
8648        $(".predict").removeClass('mostrar').addClass('ocultar');
8649        $("document").focus();
8650    } else {
8651        $(".wordsInput input").addClass("error");
8652    }
8653    uncheckFilters(true)
8654});
8655$('.cc57-searchProduct form').keyup(function (e) {
8656    e.preventDefault();
8657    var key = e.keyCode;
8658    if (e.keyCode != 13) {
8659        var word = $(".wordsInput input").val();
8660        if (word.length == 0) {
8661            $(".wordsInput input").removeClass("error");
8662        } else if (word.length > 2) {
8663            $(".wordsInput input").removeClass("error");
8664            $('.predict-result .results').remove();
8665            $('.cc57-searchProduct .input-select .icon-search').addClass('toRight');
8666            $('.cc57-searchProduct .input-select .icon-close').addClass('toLeft');
8667            $('.cc57-searchProduct .input-searchWords').addClass('left');
8668
8669            suggestSearchWords(word);
8670            $(".predict").removeClass('ocultar').addClass('mostrar');
8671        } else {
8672            //$(".wordsInput input").addClass("error");
8673            $('.shortcut').css('display', 'block');
8674            $('.predict').removeClass('mostrar').addClass('ocultar');
8675            $('.predict-result .results').remove();
8676            $('.cc57-searchProduct .input-select .icon-search').removeClass('toRight');
8677            $('.cc57-searchProduct .input-select .icon-close').removeClass('toLeft');
8678            $('.cc57-searchProduct .input-searchWords').removeClass('left');
8679        }
8680    }
8681
8682});
8683$('.cc57-searchProduct form').on('paste', 'input', function (e){
8684    setTimeout(function ()
8685    {
8686    e.preventDefault();
8687    var key = e.keyCode;
8688    if (e.keyCode != 13) {
8689        var word = $(".wordsInput input").val();
8690        if (word.length == 0) {
8691            $(".wordsInput input").removeClass("error");
8692        } else if (word.length > 2) {
8693            $(".wordsInput input").removeClass("error");
8694            $('.predict-result .results').remove();
8695            $('.cc57-searchProduct .input-select .icon-search').addClass('toRight');
8696            $('.cc57-searchProduct .input-select .icon-close').addClass('toLeft');
8697            $('.cc57-searchProduct .input-searchWords').addClass('left');
8698
8699            suggestSearchWords(word);
8700            $(".predict").removeClass('ocultar').addClass('mostrar');
8701        } else {
8702            //$(".wordsInput input").addClass("error");
8703            $('.shortcut').css('display', 'block');
8704            $('.predict').removeClass('mostrar').addClass('ocultar');
8705            $('.predict-result .results').remove();
8706            $('.cc57-searchProduct .input-select .icon-search').removeClass('toRight');
8707            $('.cc57-searchProduct .input-select .icon-close').removeClass('toLeft');
8708            $('.cc57-searchProduct .input-searchWords').removeClass('left');
8709        }
8710    }
8711        },0)
8712})
8713$('.cc57-searchProduct .icon-close').click(function (e) {
8714    var word = $(".wordsInput input").val("");
8715    $(".faqs-no-results").hide();
8716    $(this).parents(".wordsInput").removeClass("faqs-active-search");
8717    $(".wordsInput input.saveWord").val("");
8718    if ($('.predict').hasClass('mostrar')) {
8719        $('.predict').removeClass('mostrar').addClass('ocultar');
8720    }
8721    uncheckFilters(true);
8722    solrSearch();
8723});
8724$('.cc57-searchProduct .icon-search').click(function (e) {
8725    e.preventDefault();
8726    var word = $(".wordsInput input").val();
8727    if (word.length > 2) {
8728        $(".wordsInput input").removeClass("error");
8729        $(this).parents(".wordsInput").addClass("faqs-active-search");
8730        $(this).parents(".wordsInput").siblings(".faqs-num-result").find(".text").text(word);
8731        $(".wordsInput input.saveWord").val(word);
8732        var typeS = $("input.type_primary").val().split(":")[1];
8733        wordsSearch(word, "type_s:" + typeS, true, 0); $('.total-result').text(" - (" + numFilters + ")");
8734        $('.total-result').text(" - (" + numFilters + ")");
8735        $(".predict").removeClass('mostrar').addClass('ocultar');
8736        $("document").focus();
8737    } else {
8738        $(".wordsInput input").addClass("error");
8739    }
8740    uncheckFilters(true)
8741});
8742
8743var lg = document.documentElement.lang.toLowerCase();
8744function wordsSearch(word, fqs, filters, start) {
8745
8746    var url = $('input.current-page-generic-search').attr('data-page-path');
8747    var facets = [];
8748    facets.push("facets");
8749    var data = { "query": word, "type": "view", "fqs": fqs, "lang": lg, "start": start, "sort": "score" };
8750
8751    jQuery.ajax({
8752        url: url + ".searchgenericservlet.json",
8753        type: 'GET',
8754        dataType: "json",
8755        data: data,
8756        async: false,
8757        success: function (data) {
8758            var docLength;
8759            if(data.docs.length != null){
8760                docLength = data.docs.length;
8761            }
8762            var searchWord = $(".input-searchWords").val();
8763            for (var i = docLength - 1; i >= 0; i--) {
8764                if(data.docs[i].animalName_s != undefined){
8765                    if (!data.docs[i].animalName_s.toString().toLowerCase().includes(searchWord.toLowerCase())) {
8766                        // Si encontramos un nodo con el valor a eliminar, lo eliminamos del array
8767                        data.docs.splice(i, 1);
8768                    }
8769                }
8770
8771            }
8772            printCardsFilters(data, "cards-result", false, false);
8773            buttonMore();
8774            //cc21js();
8775            //cc21mapa();
8776
8777        },
8778        error: function (XMLHttpRequest, textStatus, errorThrown) {
8779            console.log("Error: {}", errorThrown);
8780
8781        }
8782    });
8783
8784
8785}
8786
8787function suggestSearchWords(word) {
8788
8789    var url = $('input.current-page-generic-search').attr('data-page-path');
8790
8791    var data = { "term": word, "lang": lg };
8792    jQuery.ajax({
8793        url: url + ".suggestservlet.json",
8794        type: 'GET',
8795        dataType: "json",
8796        data: data,
8797        success: function (data) {
8798
8799            var assarray = [];
8800            var arrayofElement = [];
8801            var assarray = $.map(data, function (value, index) {
8802                return [value];
8803            });
8804            var arrayLength = assarray[0].length;
8805            if (arrayLength == 0) {
8806                //$('.predict').css('display', 'none');
8807                if ($('.predict').hasClass('mostrar')) {
8808                    $('.predict').removeClass('mostrar').addClass('ocultar');
8809                }
8810                $('.shortcut').css('display', 'block');
8811            } else {
8812                $('.shortcut').css('display', 'none');
8813                //$('.predict').css('display', 'block');
8814                $('.predict').removeClass('ocultar').addClass('mostrar');
8815            }
8816            $.each(assarray[0], function (indexInArray, valueOfElement) {
8817                arrayofElement.push(valueOfElement);
8818                arrayofElementLength = indexInArray;
8819            });
8820
8821            printPressGsearchWords(arrayofElement, word);
8822            arrayofElement = [];
8823        },
8824        error: function (XMLHttpRequest, textStatus, errorThrown) {
8825            console.log("Error: {}", errorThrown);
8826
8827        },
8828        statusCode: function (status) {
8829            console.log("page: " + status);
8830        }
8831    });
8832
8833}
8834
8835function printPressGsearchWords(data, word) {
8836
8837    $.each(data, function (indexArray, valueArray) {
8838        var comienzo = '----------------------'
8839        var palabraBuscada = eliminarDiacriticosEsWords(word);
8840        var searchUrl = $('#searchURL').val();
8841        var removeHtml = valueArray.replace(/<\/?b>/g, '').replace(/\n/ig, '');
8842
8843        var textPos = valueArray.indexOf('<b>');
8844
8845        //let newTextPre = valueArray.replace(/(<([^>]+)>)/ig,"").replace(/<\/?b>/g, '').replace('.','').replace(',','').replace('!','').replace('¡','').replace('-','').replace(':','');
8846        let newTextPre = valueArray.toLowerCase().replace(/(<([^>]+)>)/ig, "").replace(/<\/?b>/g, '');
8847        var newTextLow = eliminarDiacriticosEsWords(newTextPre);
8848        var wordSearch = palabraBuscada.toLowerCase();
8849        var textPosB = newTextLow.indexOf(wordSearch);
8850        var introText = newTextPre.substr(textPosB, 50);
8851        var introTextB = introText.split('↵')[0];
8852        //var introTextB = introText.split(/[^a-zA-Z0-9_ ]/g)[0];
8853        var introTextB = introText.split(/[^A-Za-zÁÉÍÓÚáéíóúñÑ0-9_ ]/g)[0];
8854        var textShort = introTextB.split(/\s+/, 4);
8855        var textCut = introTextB.split(' ');
8856        var textCutOne = textCut[0];
8857        var textCutTwo = textCut[1];
8858        var textCutThree = textCut[2];
8859        var textCutFour = textCut[3];
8860        var limiteText = textShort.join(" ");
8861        var hasPoint = limiteText.indexOf('.');
8862
8863
8864        if (textCutTwo != null) {
8865            var textCutTwoLength = textCutTwo.length;
8866        } else {
8867            var textCutTwoLength = 1;
8868        }
8869
8870        if (textCutThree != null) {
8871            var textCutThreeLength = textCutThree.length;
8872        } else {
8873            var textCutThreeLength = 1;
8874        }
8875
8876        if (textCutFour != null) {
8877            var textCutFourLength = textCutFour.length;
8878        } else {
8879            var textCutFourLength = 1;
8880        }
8881
8882        if (textCutTwoLength <= 3 || textCutTwo == null) {
8883            var textCutTwo = '';
8884        }
8885        if (textCutThreeLength <= 3 || textCutThree == null) {
8886            var textCutThree = '';
8887        }
8888        if (textCutFourLength <= 3 || textCutFour == null) {
8889            var textCutFour = '';
8890        }
8891        //Los 3 son nulos
8892        if (textCutTwo == '' && textCutThree == '' && textCutFour == '') {
8893            var resultLimitUrl = textCutOne;
8894            //El 4 no es nulo y los demás si
8895        } else if (textCutTwo == '' && textCutThree == '' && textCutFour != '') {
8896            var resultLimitUrl = textCutOne + ' ' + textCutFour
8897            //El 3 no es nulo y los demás si
8898        } else if (textCutTwo == '' && textCutThree != '' && textCutFour == '') {
8899            var resultLimitUrl = textCutOne + ' ' + textCutThree
8900            //El 2 no es nulo y los demás si
8901        } else if (textCutTwo != '' && textCutThree == '' && textCutFour == '') {
8902            var resultLimitUrl = textCutOne + ' ' + textCutTwo
8903            //El 2 y el 3 no son nulos y el 4 si
8904        } else if (textCutTwo != '' && textCutThree != '' && textCutFour == '') {
8905            var resultLimitUrl = textCutOne + ' ' + textCutTwo + ' ' + textCutThree
8906            //El 2 y el 4 no son nulos y el 3 si
8907        } else if (textCutTwo != '' && textCutThree == '' && textCutFour != '') {
8908            var resultLimitUrl = textCutOne + ' ' + textCutTwo + ' ' + textCutFour
8909            //El 3 y 4 no son nulos y el 2 si
8910        } else if (textCutTwo == '' && textCutThree != '' && textCutFour != '') {
8911            var resultLimitUrl = textCutOne + ' ' + textCutThree + ' ' + textCutFour
8912        }
8913
8914        limiteTextLow = limiteText.trim().toLowerCase();
8915        var resultLimit = '<b>' + textCutOne + '</b> ' + textCutTwo + ' ' + textCutThree + ' ' + textCutFour + '...';
8916        var resultLimitLow = resultLimit.toLowerCase();
8917        var resultLimitInput = textCutOne + textCutTwo + textCutThree + textCutFour;
8918        //var resultLimitUrl = textCutOne+' '+textCutTwo+' '+textCutThree+' '+textCutFour;
8919        if (textCutOne.length > 3) {
8920            var linkHeader = searchUrl + '?word=' + resultLimitUrl;
8921            //var limiteText = limiteText.split('.').join(" ");
8922            $('.cc57-searchProduct .predict-result').append('<a href="#" class="results results-predict" onclick="uncheckFilters()"><span class="text">' + resultLimitLow + '</span><span class="icon-Right"></span><input type="hidden" id="predictUrl" value="' + resultLimitInput + '"><input type="hidden" id="predictUrlB" value="' + resultLimitUrl + '"></a>');
8923            //$('.predict').addClass('mostrar');
8924        }
8925
8926
8927        var prueba = valueArray.split(" ").splice(textPos, 3).join(" ");
8928        if (valueArray.length > 65) {
8929            var index = valueArray.indexOf(' ', 15);
8930
8931
8932
8933            var textShort = valueArray.split(/\s+/, 15);
8934            var limiteText = textShort.join(" ");
8935            limite = valueArray.substr(textPos, 80) + "...";
8936            var removeHtml = limite.replace(/<\/?b>/g, '');
8937            //$('.predict-result').append('<a href="#" class="results"><span class="text">'+valueArray+'</span><span class="icon-Right"></span><input type="hidden" id="predictUrl" value="'+removeHtml+'"></a>');
8938        }
8939    });
8940    //recorriendo resultados, eliminando repetidos y poniendolos en orden
8941    var seen = {};
8942    $('.results-predict').each(function (index, element) {
8943        var textVal = $('#predictUrl', element).val().trim();
8944        if (seen[textVal]) {
8945            $(this).remove();
8946        } else {
8947            seen[textVal] = true;
8948
8949        }
8950    });
8951    $('.predict-result .results-predict').each(function () {
8952        var textValLength = $('#predictUrl', this).val().trim().length;
8953        if (textValLength < 10) {
8954            $(this).addClass('primero');
8955        } else if (textValLength > 10 && textValLength < 20) {
8956            $(this).addClass('segundo');
8957        } else {
8958            $(this).addClass('tercero');
8959        }
8960    });
8961    $('.predict-result .results-predict').each(function () {
8962        if ($(this).hasClass('primero')) {
8963            $(this).prependTo('.predict-result');
8964        }
8965        if ($(this).hasClass('segundo')) {
8966            $(this).insertAfter('primero');
8967        }
8968        if ($(this).hasClass('tercero')) {
8969            $(this).appendTo('.predict-result');
8970        }
8971
8972
8973    });
8974    //Restringiendo resultados a 5
8975    var resultsPredict = $('.results-predict').length;
8976    // if($(window).width() >= 768){
8977    //     resultsPredict = 10;
8978    // }else {
8979    //     resultsPredict = 5;
8980    // }
8981    //var resultsPredict = (- resultsPredict) + 10;
8982    if (resultsPredict == 0) {
8983        $('.input-select .predict').removeClass('mostrar');
8984    }
8985    resultsPredict = 5;
8986    const parent = document.querySelector(".cc57-searchProduct .predict-result");
8987    [...parent.children].slice(resultsPredict).forEach(parent.removeChild.bind(parent));
8988    arrayofElement = [];
8989
8990    $('.cc57-searchProduct .predict-result .results').click(function (e) {
8991        e.preventDefault();
8992        var word = $('#predictUrlB', this).val();
8993        var typeS = $("input.type_primary").val().split(":")[1];
8994        wordsSearch(word, "type_s:" + typeS, true, 0);
8995        $(".predict").removeClass('mostrar').addClass('ocultar');
8996        $(".wordsInput input").val(word);
8997        $('.total-result').text(" - (" + numFilters + ")");
8998        $('.input-select .input-searchModal').val(word);
8999        if ($('.predict').hasClass('mostrar')) {
9000            $('.predict').removeClass('mostrar').addClass('ocultar');
9001        }
9002        $('.cc57-searchProduct .cards-generic-result').show();
9003        $('.cc57-searchProduct .pagination').show();
9004        //Analytics
9005        var urlModulDis = window.location.href;
9006        var maingate = $('#parkmnemonic').val();
9007        dataLayer.push({
9008            'category': 'Interaccion',
9009            'action': 'CP34-Search/Search',
9010            'label': word,
9011            'event': 'eventga',
9012            'urlmodule': urlModulDis,
9013            'Gate': namePark,
9014        });
9015        return false;
9016    });
9017
9018}
9019function eliminarDiacriticosEsWords(texto) {
9020    return texto
9021        .normalize('NFD')
9022        .replace(/([^n\u0300-\u036f]|n(?!\u0303(?![\u0300-\u036f])))[\u0300-\u036f]+/gi, "$1")
9023        .normalize();
9024}
9025
9026function uncheckFilters(check){
9027    if(check){
9028        $('.icon-checkbox-rectangle-Off').removeClass('check');
9029    }
9030    var iconMapSimple = $('.sort-filters__linkmap .icon').hasClass('color-iconMap');
9031    var cardsResults = $('.cards-result .filters-cards').length;
9032    if(iconMapSimple && check) {
9033        $('.col-cardright .sort-filters').show();
9034        //$('.botonFinal').show();
9035        $('.col-cardright .error-page').hide();
9036    }else if(iconMapSimple == false && check == false && cardsResults == 0){
9037        $('.col-cardright .sort-filters').hide();
9038        $('.col-cardright .error-page').show();
9039        $('.botonFinal').hide();
9040    }
9041}
9042function paginatorfaqs(data,current_page) {
9043    var totalElements = data.matches;
9044
9045    var numPages = totalElements/5;
9046    if(totalElements % 5 != 0){
9047        numPages++
9048    }
9049    var totalPages = Math.trunc(numPages);
9050
9051    var elementpages =$("div.col-12.pagination")[0];
9052    elementpages.innerHTML = "";
9053
9054    var htmlpages="";
9055
9056    var justone;
9057    if(totalPages == 1){
9058        justone = true;
9059    }
9060
9061    var nextone2;
9062    if( current_page > 1){
9063        nextone2 = false;
9064    }
9065    var backbuttonpage;
9066    var backbutton  = isBackbutton(current_page);
9067    if(backbutton){
9068        if(current_page > 1){
9069            backbuttonpage = current_page - 1;
9070        }
9071        else {
9072            backbuttonpage = current_page;
9073        }
9074    }
9075    var oneortwo = isOneortwo(current_page);
9076    var three= isThree(current_page);
9077
9078    var nextpage1 = isNextpage1(current_page);
9079    var nextpage1page;
9080    if(nextpage1){
9081        if((current_page+1) == 1) {
9082            nextpage1page = 1;
9083        } else {
9084            nextpage1page = current_page - 1;
9085        }
9086    }
9087
9088    var nextpage2   = isNextpage2(current_page, totalPages);
9089    var nextpage2page;
9090    if(nextpage2) {
9091        nextpage2page = current_page + 1;
9092    }
9093
9094    var lastpage = isLastpage(current_page,totalPages);
9095
9096    var nextpage3   = isNextpage3(current_page,totalPages);
9097    var nextpage3page;
9098    if(nextpage3) {
9099        nextpage3page = current_page + 1;
9100    }
9101    var penultimate = isPenultimate(current_page, totalPages);
9102    var total3 = isTotal3(totalPages);
9103
9104   if(backbutton){
9105        htmlpages='<a><span onclick="clickPagefaqs('+'\''+backbuttonpage+'\''+',this)" class="icon-Left"></span></a>';
9106   }
9107   if(oneortwo){
9108        htmlpages=htmlpages+'<a class="pagination-link"><span onclick="clickPagefaqs(1,this)" class="number number-pagination"> 1 </span></a>';
9109   }
9110   if(three){
9111        htmlpages=htmlpages+'<a class="pagination-link"><span onclick="clickPagefaqs(1,this)" class="number number-pagination"> 1 </span></a>';
9112        htmlpages=htmlpages+'<a class="pagination-link"><span class="number number-pagination"> ... </span></a>';
9113   }
9114   if(nextpage1){
9115        htmlpages=htmlpages+'<a class="pagination-link"><span onclick="clickPagefaqs('+'\''+nextpage1page+'\''+',this)" class="number number-pagination">'+nextpage1page+'</span></a>';
9116   }
9117   if(!justone){
9118        htmlpages=htmlpages+'<a class="pagination-link"><span  class="number number-pagination">'+current_page+'</span></a>';
9119   }
9120   if(nextpage2 && penultimate){
9121        htmlpages=htmlpages+'<a class="pagination-link"><span onclick="clickPagefaqs('+'\''+nextpage2page+'\''+',this)" class="number number-pagination">'+nextpage2page+'</span></a>';
9122   }
9123   if(nextpage2 && !penultimate){
9124        htmlpages=htmlpages+'<a class="pagination-link"><span onclick="clickPagefaqs('+'\''+nextpage2page+'\''+',this)" class="number number-pagination">'+nextpage2page+'</span></a>';
9125       htmlpages=htmlpages+'<a class="pagination-link"><span class="number number-pagination"> ... </span></a>';
9126
9127   }
9128   if(nextpage3){
9129        htmlpages=htmlpages+'<a class="pagination-link"><span  onclick="clickPagefaqs('+'\''+totalPages+'\''+',this)" class="number number-pagination">'+totalPages+'</span></a>';
9130   }
9131   if(lastpage){
9132        htmlpages=htmlpages+'<a ><span onclick="clickPagefaqs('+'\''+(current_page+1)+'\''+',this)" class="icon-arrow-right"></span></a>';
9133   }
9134   elementpages.innerHTML = elementpages.innerHTML + htmlpages;
9135
9136
9137
9138    $('.pagination-link').each(function () {
9139        var numberAct = $('.number-pagination',this).text();
9140        if(numberAct == current_page){
9141            $('.number-pagination',this).addClass('actualNumber');
9142        }
9143    });
9144
9145
9146}
9147
9148function isBackbutton(current_page) {
9149   if(current_page > 1) {
9150       return true;
9151   }
9152   return false;
9153}
9154function isOneortwo(current_page) {
9155    if(current_page!=1 && current_page<4 && current_page>1) {
9156       return true;
9157   }
9158   return false;
9159}
9160function isThree(current_page) {
9161   if(current_page >= 4){
9162       return true;
9163   }
9164   return false;
9165}
9166function isNextpage1(current_page) {
9167   if((current_page-1)>1) {
9168       return true;
9169   }
9170   return false;
9171}
9172function isNextpage2(current_page,pages) {
9173   if((current_page+1)<pages){
9174       return true;
9175   }
9176   return false;
9177}
9178function isNextpage3(current_page,pages) {
9179   if(current_page<pages){
9180       return true;
9181   }
9182   return false;
9183}
9184function isLastpage(current_page,pages) {
9185   if(current_page==pages){
9186       return false;
9187   } else {
9188       if(current_page<(pages-2)){
9189           return true;
9190       }
9191   }
9192   return false;
9193}
9194function isPenultimate(current_page,pages) {
9195   if(current_page == pages -2) {
9196
9197        return true;
9198    }
9199    return false;
9200}
9201function isTotal3(current_page,pages) {
9202   if(pages == 3) {
9203       		return true;
9204       	}
9205
9206       	return false;
9207}
9208
9209
9210function clickPagefaqs(numpage) {
9211    var start=(numpage*5)-5;
9212
9213    var fqs=[];
9214    var fqRange=[];
9215
9216    $(".content-listTabs__list").each(function() {
9217         if($(".icon-radio-check",this).hasClass("check")){
9218              var category="tipology_search_s";
9219              var name=$(".nameFilter",this).val();
9220              var finalname=category+":"+name;
9221              fqs.push(finalname);
9222         }
9223         
9224    });
9225    
9226    $('.faqs-list-single').each(function (index, element) {
9227        var checkTitle = $(".faqs-title-check",this).hasClass("check-title"); 
9228        if(checkTitle){
9229            var category="tipology_search_s";
9230            var name=$(this).find("input.name-faq-tag").val();
9231            var finalname="tags_ss:"+name;
9232            fqs.push(finalname);
9233        } 
9234    });
9235    
9236
9237    var word = $(".faqsInput input").val();
9238    var url=$('input.current-page-generic-search').attr('data-page-path');
9239
9240    if(word!=undefined && word!=""){
9241        faqsSearch(word,fqs,false,start);
9242    }else{
9243        solrSearchFaqs(fqs,fqRange,start);
9244    }
9245
9246
9247    //Cambio el class en la actual pagina
9248    $('.pagination-link').each(function () {
9249        var actualNumber = numpage;
9250        var actualNumberB = parseInt($('.number-pagination',this).text());
9251        if(actualNumber == actualNumberB){
9252            $('.number-pagination').removeClass('actualNumber');
9253            $('.number-pagination',this).addClass('actualNumber');
9254        }
9255    });
9256    $('html, body').animate({
9257        scrollTop: $('#faqsID').offset().top - 100
9258    }, 'slow');
9259}
9260
9261/* @preserve
9262 * Leaflet a JS library for interactive maps. http://leafletjs.com
9263 * (c) 2010-2019 Vladimir Agafonkin, (c) 2010-2011 CloudMade
9264 */
9265!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i(t.L={})}(this,function(t){"use strict";function h(t){for(var i,e,n=1,o=arguments.length;n<o;n++)for(i in e=arguments[n])t[i]=e[i];return t}var s=Object.create||function(t){return i.prototype=t,new i};function i(){}function p(t,i){var e=Array.prototype.slice;if(t.bind)return t.bind.apply(t,e.call(arguments,1));var n=e.call(arguments,2);return function(){return t.apply(i,n.length?n.concat(e.call(arguments)):arguments)}}var e=0;function m(t){return t._leaflet_id=t._leaflet_id||++e,t._leaflet_id}function n(t,i,e){var n,o,s=function(){n=!1,o&&(r.apply(e,o),o=!1)},r=function(){n?o=arguments:(t.apply(e,arguments),setTimeout(s,i),n=!0)};return r}function o(t,i,e){var n=i[1],o=i[0],s=n-o;return t===n&&e?t:((t-o)%s+s)%s+o}function a(){return!1}function r(t,i){var e=Math.pow(10,void 0===i?6:i);return Math.round(t*e)/e}function u(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function l(t){return u(t).split(/\s+/)}function c(t,i){for(var e in Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?s(t.options):{}),i)t.options[e]=i[e];return t.options}function _(t,i,e){var n=[];for(var o in t)n.push(encodeURIComponent(e?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(i&&-1!==i.indexOf("?")?"&":"?")+n.join("&")}var d=/\{ *([\w_-]+) *\}/g;function f(t,n){return t.replace(d,function(t,i){var e=n[i];if(void 0===e)throw new Error("No value provided for variable "+t);return"function"==typeof e&&(e=e(n)),e})}var g=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function v(t,i){for(var e=0;e<t.length;e++)if(t[e]===i)return e;return-1}var y="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function x(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var w=0;function P(t){var i=+new Date,e=Math.max(0,16-(i-w));return w=i+e,window.setTimeout(t,e)}var b=window.requestAnimationFrame||x("RequestAnimationFrame")||P,T=window.cancelAnimationFrame||x("CancelAnimationFrame")||x("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function M(t,i,e){if(!e||b!==P)return b.call(window,p(t,i));t.call(i)}function z(t){t&&T.call(window,t)}var C={extend:h,create:s,bind:p,lastId:e,stamp:m,throttle:n,wrapNum:o,falseFn:a,formatNum:r,trim:u,splitWords:l,setOptions:c,getParamString:_,template:f,isArray:g,indexOf:v,emptyImageUrl:y,requestFn:b,cancelFn:T,requestAnimFrame:M,cancelAnimFrame:z};function S(){}S.extend=function(t){function i(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()}var e=i.__super__=this.prototype,n=s(e);for(var o in(n.constructor=i).prototype=n,this)Object.prototype.hasOwnProperty.call(this,o)&&"prototype"!==o&&"__super__"!==o&&(i[o]=this[o]);return t.statics&&(h(i,t.statics),delete t.statics),t.includes&&(function(t){if("undefined"==typeof L||!L||!L.Mixin)return;t=g(t)?t:[t];for(var i=0;i<t.length;
vendor: 7,487 bytes, line 9265
9265i++)t[i]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}(t.includes),h.apply(null,[n].concat(t.includes)),delete t.includes),n.options&&(t.options=h(s(n.options),t.options)),h(n,t),n._initHooks=[],n.callInitHooks=function(){if(!this._initHooksCalled){e.callInitHooks&&e.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,i=n._initHooks.length;t<i;t++)n._initHooks[t].call(this)}},i},S.include=function(t){return h(this.prototype,t),this},S.mergeOptions=function(t){return h(this.prototype.options,t),this},S.addInitHook=function(t){var i=Array.prototype.slice.call(arguments,1),e="function"==typeof t?t:function(){this[t].apply(this,i)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(e),this};var Z={on:function(t,i,e){if("object"==typeof t)for(var n in t)this._on(n,t[n],i);else for(var o=0,s=(t=l(t)).length;o<s;o++)this._on(t[o],i,e);return this},off:function(t,i,e){if(t)if("object"==typeof t)for(var n in t)this._off(n,t[n],i);else for(var o=0,s=(t=l(t)).length;o<s;o++)this._off(t[o],i,e);else delete this._events;return this},_on:function(t,i,e){this._events=this._events||{};var n=this._events[t];n||(n=[],this._events[t]=n),e===this&&(e=void 0);for(var o={fn:i,ctx:e},s=n,r=0,a=s.length;r<a;r++)if(s[r].fn===i&&s[r].ctx===e)return;s.push(o)},_off:function(t,i,e){var n,o,s;if(this._events&&(n=this._events[t]))if(i){if(e===this&&(e=void 0),n)for(o=0,s=n.length;o<s;o++){var r=n[o];if(r.ctx===e&&r.fn===i)return r.fn=a,this._firingCount&&(this._events[t]=n=n.slice()),void n.splice(o,1)}}else{for(o=0,s=n.length;o<s;o++)n[o].fn=a;delete this._events[t]}},fire:function(t,i,e){if(!this.listens(t,e))return this;var n=h({},i,{type:t,target:this,sourceTarget:i&&i.sourceTarget||this});if(this._events){var o=this._events[t];if(o){this._firingCount=this._firingCount+1||1;for(var s=0,r=o.length;s<r;s++){var a=o[s];a.fn.call(a.ctx||this,n)}this._firingCount--}}return e&&this._propagateEvent(n),this},listens:function(t,i){var e=this._events&&this._events[t];if(e&&e.length)return!0;if(i)for(var n in this._eventParents)if(this._eventParents[n].listens(t,i))return!0;return!1},once:function(t,i,e){if("object"==typeof t){for(var n in t)this.once(n,t[n],i);return this}var o=p(function(){this.off(t,i,e).off(t,o,e)},this);return this.on(t,i,e).on(t,o,e)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[m(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[m(t)],this},_propagateEvent:function(t){for(var i in this._eventParents)this._eventParents[i].fire(t.type,h({layer:t.target,propagatedFrom:t.target},t),!0)}};Z.addEventListener=Z.on,Z.removeEventListener=Z.clearAllEventListeners=Z.off,Z.addOneTimeEventListener=Z.once,Z.fireEvent=Z.fire,Z.hasEventListeners=Z.listens;var E=S.extend(Z);function k(t,i,e){this.x=e?Math.round(t):t,this.y=e?Math.round(i):i}var B=Math.trunc||function(t){return 0<t?Math.floor(t):Math.ceil(t)};function A(t,i,e){return t instanceof k?t:g(t)?new k(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new k(t.x,t.y):new k(t,i,e)}function I(t,i){if(t)for(var e=i?[t,i]:t,n=0,o=e.length;n<o;n++)this.extend(e[n])}function O(t,i){return!t||t instanceof I?t:new I(t,i)}function R(t,i){if(t)for(var e=i?[t,i]:t,n=0,o=e.length;n<o;n++)this.extend(e[n])}function N(t,i){return t instanceof R?t:new R(t,i)}function D(t,i,e){if(isNaN(t)||isNaN(i))throw new Error("Invalid LatLng object: ("+t+", "+i+")");this.lat=+t,this.lng=+i,void 0!==e&&(this.alt=+e)}function j(t,i,e){return t instanceof D?t:g(t)&&"object"!=typeof t[0]?3===t.length?new D(t[0],t[1],t[2]):2===t.length?new D(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new D(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===i?null:new D(t,i,e)}k.prototype={clone:function(){return new k(this.x,this.y)},add:function(t){return this.clone()._add(A(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(A(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new k(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new k(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=B(this.x),this.y=B(this.y),this},distanceTo:function(t){var i=(t=A(t)).x-this.x,e=t.y-this.y;return Math.sqrt(i*i+e*e)},equals:function(t){return(t=A(t)).x===this.x&&t.y===this.y},contains:function(t){return t=A(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+r(this.x)+", "+r(this.y)+")"}},I.prototype={extend:function(t){return t=A(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new k((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new k(this.min.x,this.max.y)},getTopRight:function(){return new k(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var i,e;return(t=("number"==typeof t[0]||t instanceof k?A:O)(t))instanceof I?(i=t.min,e=t.max):i=e=t,i.x>=this.min.x&&e.x<=this.max.x&&i.y>=this.min.y&&e.y<=this.max.y},intersects:function(t){t=O(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>=i.x&&n.x<=e.x,r=o.y>=i.y&&n.y<=e.y;return s&&r},overlaps:function(t){t=O(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>i.x&&n.x<e.x,r=o.y>i.y&&n.y<e.y;return s&&r},isValid:function(){return!(!this.min||!this.max)}},R.prototype={extend:function(t){var i,e,n=this._southWest,o=this._northEast;if(t instanceof D)e=i=t;else{if(!(t instanceof R))return t?this.extend(j(t)||N(t)):this;if(i=t._southWest,e=t._northEast,!i||!e)return this}return n||o?(n.lat=Math.min(i.lat,n.lat),n.lng=Math.min(i.lng,n.lng),o.lat=Math.max(e.lat,o.lat),o.lng=Math.max(e.lng,o.lng)):(this._southWest=new D(i.lat,i.lng),this._northEast=new D(e.lat,e.lng)),this},pad:function(t){var i=this._southWest,e=this._northEast,n=Math.abs(i.lat-e.lat)*t,o=Math.abs(i.lng-e.lng)*t;return new R(new D(i.lat-n,i.lng-o),new D(e.lat+n,e.lng+o))},getCenter:function(){return new D((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new D(this.getNorth(),this.getWest())},getSouthEast:function(){return new D(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat}
vendor: 2,432 bytes, line 9265
9265,getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t=("number"==typeof t[0]||t instanceof D||"lat"in t?j:N)(t);var i,e,n=this._southWest,o=this._northEast;return t instanceof R?(i=t.getSouthWest(),e=t.getNorthEast()):i=e=t,i.lat>=n.lat&&e.lat<=o.lat&&i.lng>=n.lng&&e.lng<=o.lng},intersects:function(t){t=N(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=i.lat&&n.lat<=e.lat,r=o.lng>=i.lng&&n.lng<=e.lng;return s&&r},overlaps:function(t){t=N(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>i.lat&&n.lat<e.lat,r=o.lng>i.lng&&n.lng<e.lng;return s&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,i){return!!t&&(t=N(t),this._southWest.equals(t.getSouthWest(),i)&&this._northEast.equals(t.getNorthEast(),i))},isValid:function(){return!(!this._southWest||!this._northEast)}};var W,H={latLngToPoint:function(t,i){var e=this.projection.project(t),n=this.scale(i);return this.transformation._transform(e,n)},pointToLatLng:function(t,i){var e=this.scale(i),n=this.transformation.untransform(t,e);return this.projection.unproject(n)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var i=this.projection.bounds,e=this.scale(t);return new I(this.transformation.transform(i.min,e),this.transformation.transform(i.max,e))},infinite:!(D.prototype={equals:function(t,i){return!!t&&(t=j(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===i?1e-9:i))},toString:function(t){return"LatLng("+r(this.lat,t)+", "+r(this.lng,t)+")"},distanceTo:function(t){return F.distance(this,j(t))},wrap:function(){return F.wrapLatLng(this)},toBounds:function(t){var i=180*t/40075017,e=i/Math.cos(Math.PI/180*this.lat);return N([this.lat-i,this.lng-e],[this.lat+i,this.lng+e])},clone:function(){return new D(this.lat,this.lng,this.alt)}}),wrapLatLng:function(t){var i=this.wrapLng?o(t.lng,this.wrapLng,!0):t.lng;return new D(this.wrapLat?o(t.lat,this.wrapLat,!0):t.lat,i,t.alt)},wrapLatLngBounds:function(t){var i=t.getCenter(),e=this.wrapLatLng(i),n=i.lat-e.lat,o=i.lng-e.lng;if(0==n&&0==o)return t;
9265var s=t.getSouthWest(),r=t.getNorthEast();return new R(new D(s.lat-n,s.lng-o),new D(r.lat-n,r.lng-o))}},F=h({},H,{wrapLng:[-180,180],R:6371e3,distance:function(t,i){var e=Math.PI/180,n=t.lat*e,o=i.lat*e,s=Math.sin((i.lat-t.lat)*e/2),r=Math.sin((i.lng-t.lng)*e/2),a=s*s+Math.cos(n)*Math.cos(o)*r*r,h=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*h}}),U=6378137,V={R:U,MAX_LATITUDE:85.0511287798,project:function(t){var i=Math.PI/180,e=this.MAX_LATITUDE,n=Math.max(Math.min(e,t.lat),-e),o=Math.sin(n*i);return new k(this.R*t.lng*i,this.R*Math.log((1+o)/(1-o))/2)},unproject:function(t){var i=180/Math.PI;return new D((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*i,t.x*i/this.R)},bounds:new I([-(W=U*Math.PI),-W],[W,W])};function q(t,i,e,n){if(g(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=i,this._c=e,this._d=n}function G(t,i,e,n){return new q(t,i,e,n)}q.prototype={transform:function(t,i){return this._transform(t.clone(),i)},_transform:function(t,i){return i=i||1,t.x=i*(this._a*t.x+this._b),t.y=i*(this._c*t.y+this._d),t},untransform:function(t,i){return i=i||1,new k((t.x/i-this._b)/this._a,(t.y/i-this._d)/this._c)}};var K,Y=h({},F,{code:"EPSG:3857",projection:V,transformation:G(K=.5/(Math.PI*V.R),.5,-K,.5)}),X=h({},Y,{code:"EPSG:900913"});function J(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function $(t,i){for(var e,n,o,s,r="",a=0,h=t.length;a<h;a++){for(e=0,n=(o=t[a]).length;e<n;e++)r+=(e?"L":"M")+(s=o[e]).x+" "+s.y;r+=i?Zt?"z":"x":""}return r||"M0 0"}var Q=document.documentElement.style,tt="ActiveXObject"in window,it=tt&&!document.addEventListener,et="msLaunchUri"in navigator&&!("documentMode"in document),nt=kt("webkit"),ot=kt("android"),st=kt("android 2")||kt("android 3"),rt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),at=ot&&kt("Google")&&rt<537&&!("AudioNode"in window),ht=!!window.opera,ut=!et&&kt("chrome"),lt=kt("gecko")&&!nt&&!ht&&!tt,ct=!ut&&kt("safari"),_t=kt("phantom"),dt="OTransition"in Q,pt=0===navigator.platform.indexOf("Win"),mt=tt&&"transition"in Q,ft="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!st,gt="MozPerspective"in Q,vt=!window.L_DISABLE_3D&&(mt||ft||gt)&&!dt&&!_t,yt="undefined"!=typeof orientation||kt("mobile"),xt=yt&&nt,wt=yt&&ft,Pt=!window.PointerEvent&&window.MSPointerEvent,Lt=!(!window.PointerEvent&&!Pt),bt=!window.L_NO_TOUCH&&(Lt||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),Tt=yt&&ht,Mt=yt&&lt,zt=1<(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI),Ct=function(){var t=!1;try{var i=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",a,i),window.removeEventListener("testPassiveEventSupport",a,i)}catch(t){}return t}(),St=!!document.createElement("canvas").getContext,Zt=!(!document.createElementNS||!J("svg").createSVGRect),Et=!Zt&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var i=t.firstChild;return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(t){return!1}}();function kt(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var Bt={ie:tt,ielt9:it,edge:et,webkit:nt,android:ot,android23:st,androidStock:at,opera:ht,chrome:ut,gecko:lt,safari:ct,phantom:_t,opera12:dt,win:pt,ie3d:mt,webkit3d:ft,gecko3d:gt,any3d:vt,mobile:yt,mobileWebkit:xt,mobileWebkit3d:wt,msPointer:Pt,pointer:Lt,touch:bt,mobileOpera:Tt,mobileGecko:Mt,retina:zt,passiveEvents:Ct,canvas:St,svg:Zt,vml:Et},At=Pt?"MSPointerDown":"pointerdown",It=Pt?"MSPointerMove":"pointermove",Ot=Pt?"MSPointerUp":"pointerup",Rt=Pt?"MSPointerCancel":"pointercancel",Nt={},Dt=!1;function jt(t,i,e,n){function o(t){Ut(t,r)}var s,r,a,h,u,l,c,_;function d(t){t.pointerType===(t.MSPOINTER_TYPE_MOUSE||"mouse")&&0===t.buttons||Ut(t,h)}return"touchstart"===i?(u=t,l=e,c=n,_=p(function(t){t.MSPOINTER_TYPE_TOUCH&&t.pointerType===t.MSPOINTER_TYPE_TOUCH&&Ri(t),Ut(t,l)}),u["_leaflet_touchstart"+c]=_,u.addEventListener(At,_,!1),Dt||(document.addEventListener(At,Wt,!0),document.addEventListener(It,Ht,!0),document.addEventListener(Ot,Ft,!0),document.addEventListener(Rt,Ft,!0),Dt=!0)):"touchmove"===i?(h=e,(a=t)["_leaflet_touchmove"+n]=d,a.addEventListener(It,d,!1)):"touchend"===i&&(r=e,(s=t)["_leaflet_touchend"+n]=o,s.addEventListener(Ot,o,!1),s.addEventListener(Rt,o,!1)),this}function Wt(t){Nt[t.pointerId]=t}function Ht(t){Nt[t.pointerId]&&(Nt[t.pointerId]=t)}function Ft(t){delete Nt[t.pointerId]}function Ut(t,i){for(var e in t.touches=[],Nt)t.touches.push(Nt[e]);t.changedTouches=[t],i(t)}var Vt=Pt?"MSPointerDown":Lt?"pointerdown":"touchstart",qt=Pt?"MSPointerUp":Lt?"pointerup":"touchend",Gt="_leaflet_";var Kt,Yt,Xt,Jt,$t,Qt,ti=fi(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ii=fi(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),ei="webkitTransition"===ii||"OTransition"===ii?ii+"End":"transitionend";function ni(t){return"string"==typeof t?document.getElementById(t):t}function oi(t,i){var e,n=t.style[i]||t.currentStyle&&t.currentStyle[i];return n&&"auto"!==n||!document.defaultView||(n=(e=document.defaultView.getComputedStyle(t,null))?e[i]:null),"auto"===n?null:n}function si(t,i,e){var n=document.createElement(t);return n.className=i||"",e&&e.appendChild(n),n}function ri(t){var i=t.parentNode;i&&i.removeChild(t)}function ai(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function hi(t){var i=t.parentNode;i&&i.lastChild!==t&&i.appendChild(t)}function ui(t){var i=t.parentNode;i&&i.firstChild!==t&&i.insertBefore(t,i.firstChild)}function li(t,i){if(void 0!==t.classList)return t.classList.contains(i);var e=pi(t);return 0<e.length&&new RegExp("(^|\\s)"+i+"(\\s|$)").test(e)}function ci(t,i){var e;if(void 0!==t.classList)for(var n=l(i),o=0,s=n.length;o<s;o++)t.classList.add(n[o]);else li(t,i)||di(t,((e=pi(t))?e+" ":"")+i)}function _i(t,i){void 0!==t.classList?t.classList.remove(i):di(t,u((" "+pi(t)+" ").replace(" "+i+" "," ")))}function di(t,i){void 0===t.className.baseVal?t.className=i:t.className.baseVal=i}function pi(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function mi(t,i){"opacity"in t.style?t.style.opacity=i:"filter"in t.style&&function(t,i){var e=!1,n="DXImageTransform.Microsoft.Alpha";try{e=t.filters.item(n)}catch(t){if(1===i)return}i=Math.round(100*i),e?(e.Enabled=100!==i,e.Opacity=i):t.style.filter+=" progid:"+n+"(opacity="+i+")"}(t,i)}function fi(t){for(var i=document.documentElement.style,e=0;e<t.length;e++)if(t[e]in i)return t[e];return!1}function gi(t,i,e){var n=i||new k(0,0);t.style[ti]=(mt?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(e?" scale("+e+")":"")}function vi(t,i){t._leaflet_pos=i,vt?gi(t,i):(t.style.left=i.x+"px",t.style.top=i.y+"px")}function yi(t){return t._leaflet_pos||new k(0,0)}function xi(){zi(window,"dragstart",Ri)}function wi(){Si(window,"dragstart",Ri)}function Pi(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(Li(),Qt=($t=t).style.outline,t.style.outline="none",zi(window,"keydown",Li))}function Li(){$t&&($t.style.outline=Qt,Qt=$t=void 0,Si(window,"keydown",Li))}function bi(t){for(;!((t=t.parentNode).offsetWidth&&t.offsetHeight||t===document.body););return t}function Ti(t){var i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}Jt="onselectstart"in document?(Xt=function(){zi(window,"selectstart",Ri)},function(){Si(window,"selectstart",Ri)}
9265):(Yt=fi(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]),Xt=function(){var t;Yt&&(t=document.documentElement.style,Kt=t[Yt],t[Yt]="none")},function(){Yt&&(document.documentElement.style[Yt]=Kt,Kt=void 0)});var Mi={TRANSFORM:ti,TRANSITION:ii,TRANSITION_END:ei,get:ni,getStyle:oi,create:si,remove:ri,empty:ai,toFront:hi,toBack:ui,hasClass:li,addClass:ci,removeClass:_i,setClass:di,getClass:pi,setOpacity:mi,testProp:fi,setTransform:gi,setPosition:vi,getPosition:yi,disableTextSelection:Xt,enableTextSelection:Jt,disableImageDrag:xi,enableImageDrag:wi,preventOutline:Pi,restoreOutline:Li,getSizedParentNode:bi,getScale:Ti};function zi(t,i,e,n){if("object"==typeof i)for(var o in i)ki(t,o,i[o],e);else for(var s=0,r=(i=l(i)).length;s<r;s++)ki(t,i[s],e,n);return this}var Ci="_leaflet_events";function Si(t,i,e,n){if("object"==typeof i)for(var o in i)Bi(t,o,i[o],e);else if(i)for(var s=0,r=(i=l(i)).length;s<r;s++)Bi(t,i[s],e,n);else{for(var a in t[Ci])Bi(t,a,t[Ci][a]);delete t[Ci]}return this}function Zi(){return Lt&&(!et&&!ct)}
9265var Ei={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function ki(i,t,e,n){var o=t+m(e)+(n?"_"+m(n):"");if(i[Ci]&&i[Ci][o])return this;var s,r,a,h,u,l,c=function(t){return e.call(n||i,t||window.event)},_=c;function d(t){if(Lt){if(!t.isPrimary)return;if("mouse"===t.pointerType)return}else if(1<t.touches.length)return;var i=Date.now(),e=i-(h||i);u=t.touches?t.touches[0]:t,l=0<e&&e<=250,h=i}function p(t){if(l&&!u.cancelBubble){if(Lt){if("mouse"===t.pointerType)return;var i,e,n={};for(e in u)i=u[e],n[e]=i&&i.bind?i.bind(u):i;u=n}u.type="dblclick",u.button=0,r(u),h=null}}Lt&&0===t.indexOf("touch")?jt(i,t,c,o):bt&&"dblclick"===t&&!Zi()?(r=c,l=!1,(s=i)[Gt+Vt+(a=o)]=d,s[Gt+qt+a]=p,s[Gt+"dblclick"+a]=r,s.addEventListener(Vt,d,!!Ct&&{passive:!1}),s.addEventListener(qt,p,!!Ct&&{passive:!1}),s.addEventListener("dblclick",r,!1)):"addEventListener"in i?"touchstart"===t||"touchmove"===t||"wheel"===t||"mousewheel"===t?i.addEventListener(Ei[t]||t,c,!!Ct&&{passive:!1}):"mouseenter"===t||"mouseleave"===t?(c=function(t){t=t||window.event,Vi(i,t)&&_(t)},i.addEventListener(Ei[t],c,!1)):i.addEventListener(t,_,!1):"attachEvent"in i&&i.attachEvent("on"+t,c),i[Ci]=i[Ci]||{},i[Ci][o]=c}function Bi(t,i,e,n){var o,s,r,a,h,u,l,c,_=i+m(e)+(n?"_"+m(n):""),d=t[Ci]&&t[Ci][_];if(!d)return this;Lt&&0===i.indexOf("touch")?(c=(u=t)["_leaflet_"+(l=i)+_],"touchstart"===l?u.removeEventListener(At,c,!1):"touchmove"===l?u.removeEventListener(It,c,!1):"touchend"===l&&(u.removeEventListener(Ot,c,!1),u.removeEventListener(Rt,c,!1))):bt&&"dblclick"===i&&!Zi()?(r=(o=t)[Gt+Vt+(s=_)],a=o[Gt+qt+s],h=o[Gt+"dblclick"+s],o.removeEventListener(Vt,r,!!Ct&&{passive:!1}),o.removeEventListener(qt,a,!!Ct&&{passive:!1}),o.removeEventListener("dblclick",h,!1)):"removeEventListener"in t?t.removeEventListener(Ei[i]||i,d,!1):"detachEvent"in t&&t.detachEvent("on"+i,d),t[Ci][_]=null}function Ai(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Ui(t),this}function Ii(t){return ki(t,"wheel",Ai),this}function Oi(t){return zi(t,"mousedown touchstart dblclick",Ai),ki(t,"click",Fi),this}function Ri(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Ni(t){return Ri(t),Ai(t),this}function Di(t,i){if(!i)return new k(t.clientX,t.clientY);var e=Ti(i),n=e.boundingClientRect;return new k((t.clientX-n.left)/e.x-i.clientLeft,(t.clientY-n.top)/e.y-i.clientTop)}var ji=pt&&ut?2*window.devicePixelRatio:lt?window.devicePixelRatio:1;function Wi(t){return et?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/ji:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var Hi={};function Fi(t){Hi[t.type]=!0}function Ui(t){var i=Hi[t.type];return Hi[t.type]=!1,i}function Vi(t,i){var e=i.relatedTarget;if(!e)return!0;try{for(;e&&e!==t;)e=e.parentNode}catch(t){return!1}return e!==t}var qi={on:zi,off:Si,stopPropagation:Ai,disableScrollPropagation:Ii,disableClickPropagation:Oi,preventDefault:Ri,stop:Ni,getMousePosition:Di,getWheelDelta:Wi,fakeStop:Fi,skipped:Ui,isExternalTarget:Vi,addListener:zi,removeListener:Si},Gi=E.extend({run:function(t,i,e,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=e||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=yi(t),this._offset=i.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=M(this._animate,this),this._step()},_step:function(t){var i=new Date-this._startTime,e=1e3*this._duration;i<e?this._runFrame(this._easeOut(i/e),t):(this._runFrame(1),this._complete())},_runFrame:function(t,i){var e=this._startPos.add(this._offset.multiplyBy(t));i&&e._round(),vi(this._el,e),this.fire("step")},_complete:function(){z(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),Ki=E.extend({options:{crs:Y,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,i){i=c(this,i),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=p(this._onResize,this),this._initEvents(),i.maxBounds&&this.setMaxBounds(i.maxBounds),void 0!==i.zoom&&(this._zoom=this._limitZoom(i.zoom)),i.center&&void 0!==i.zoom&&this.setView(j(i.center),i.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ii&&vt&&!Tt&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),zi(this._proxy,ei,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)}
vendor: 27,168 bytes, line 9265
9265,setView:function(t,i,e){if((i=void 0===i?this._zoom:this._limitZoom(i),t=this._limitCenter(j(t),i,this.options.maxBounds),e=e||{},this._stop(),this._loaded&&!e.reset&&!0!==e)&&(void 0!==e.animate&&(e.zoom=h({animate:e.animate},e.zoom),e.pan=h({animate:e.animate,duration:e.duration},e.pan)),this._zoom!==i?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,i,e.zoom):this._tryAnimatedPan(t,e.pan)))return clearTimeout(this._sizeTimer),this;return this._resetView(t,i),this},setZoom:function(t,i){return this._loaded?this.setView(this.getCenter(),t,{zoom:i}):(this._zoom=t,this)},zoomIn:function(t,i){return t=t||(vt?this.options.zoomDelta:1),this.setZoom(this._zoom+t,i)},zoomOut:function(t,i){return t=t||(vt?this.options.zoomDelta:1),this.setZoom(this._zoom-t,i)},setZoomAround:function(t,i,e){var n=this.getZoomScale(i),o=this.getSize().divideBy(2),s=(t instanceof k?t:this.latLngToContainerPoint(t)).subtract(o).multiplyBy(1-1/n),r=this.containerPointToLatLng(o.add(s));return this.setView(r,i,{zoom:e})},_getBoundsCenterZoom:function(t,i){i=i||{},t=t.getBounds?t.getBounds():N(t);var e=A(i.paddingTopLeft||i.padding||[0,0]),n=A(i.paddingBottomRight||i.padding||[0,0]),o=this.getBoundsZoom(t,!1,e.add(n));if((o="number"==typeof i.maxZoom?Math.min(i.maxZoom,o):o)===1/0)return{center:t.getCenter(),zoom:o};var s=n.subtract(e).divideBy(2),r=this.project(t.getSouthWest(),o),a=this.project(t.getNorthEast(),o);return{center:this.unproject(r.add(a).divideBy(2).add(s),o),zoom:o}},fitBounds:function(t,i){if(!(t=N(t)).isValid())throw new Error("Bounds are not valid.");var e=this._getBoundsCenterZoom(t,i);return this.setView(e.center,e.zoom,i)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,i){return this.setView(t,this._zoom,{pan:i})},panBy:function(t,i){return i=i||{},(t=A(t).round()).x||t.y?(!0===i.animate||this.getSize().contains(t)?(this._panAnim||(this._panAnim=new Gi,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),i.noMoveStart||this.fire("movestart"),!1!==i.animate?(ci(this._mapPane,"leaflet-pan-anim"),e=this._getMapPanePos().subtract(t).round(),this._panAnim.run(this._mapPane,e,i.duration||.25,i.easeLinearity)):(this._rawPanBy(t),this.fire("move").fire("moveend"))):this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this):this.fire("moveend");var e},flyTo:function(s,r,t){if(!1===(t=t||{}).animate||!vt)return this.setView(s,r,t);this._stop();var a=this.project(this.getCenter()),h=this.project(s),i=this.getSize(),u=this._zoom;s=j(s),r=void 0===r?u:r;var l=Math.max(i.x,i.y),n=l*this.getZoomScale(u,r),c=h.distanceTo(a)||1,_=1.42,o=_*_;function e(t){var i=(n*n-l*l+(t?-1:1)*o*o*c*c)/(2*(t?n:l)*o*c),e=Math.sqrt(i*i+1)-i;return e<1e-9?-18:Math.log(e)}function d(t){return(Math.exp(t)-Math.exp(-t))/2}function p(t){return(Math.exp(t)+Math.exp(-t))/2}var m=e(0);function f(t){return l*(p(m)*(d(i=m+_*t)/p(i))-d(m))/o;var i}var g=Date.now(),v=(e(1)-m)/_,y=t.duration?1e3*t.duration:1e3*v*.8;return this._moveStart(!0,t.noMoveStart),function t(){var i,e,n=(Date.now()-g)/y,o=(i=n,(1-Math.pow(1-i,1.5))*v);n<=1?(this._flyToFrame=M(t,this),this._move(this.unproject(a.add(h.subtract(a).multiplyBy(f(o)/c)),u),this.getScaleZoom(l/(e=o,l*(p(m)/p(m+_*e))),u),{flyTo:!0})):this._move(s,r)._moveEnd(!0)}.call(this),this},flyToBounds:function(t,i){var e=this._getBoundsCenterZoom(t,i);return this.flyTo(e.center,e.zoom,i)},setMaxBounds:function(t){return(t=N(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(t){var i=this.options.minZoom;return this.options.minZoom=t,this._loaded&&i!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var i=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&i!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,i){this._enforcingBounds=!0;var e=this.getCenter(),n=this._limitCenter(e,this._zoom,N(t));return e.equals(n)||this.panTo(n,i),this._enforcingBounds=!1,this},panInside:function(t,i){var e,n,o=A((i=i||{}).paddingTopLeft||i.padding||[0,0]),s=A(i.paddingBottomRight||i.padding||[0,0]),r=this.getCenter(),a=this.project(r),h=this.project(t),u=this.getPixelBounds(),l=u.getSize().divideBy(2),c=O([u.min.add(o),u.max.subtract(s)]);return c.contains(h)||(this._enforcingBounds=!0,e=a.subtract(h),n=A(h.x+e.x,h.y+e.y),(h.x<c.min.x||h.x>c.max.x)&&(n.x=a.x-e.x,0<e.x?n.x+=l.x-o.x:n.x-=l.x-s.x),(h.y<c.min.y||h.y>c.max.y)&&(n.y=a.y-e.y,0<e.y?n.y+=l.y-o.y:n.y-=l.y-s.y),this.panTo(this.unproject(n),i),this._enforcingBounds=!1),this},invalidateSize:function(t){if(!this._loaded)return this;t=h({animate:!1,pan:!0},!0===t?{animate:!0}:t);var i=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var e=this.getSize(),n=i.divideBy(2).round(),o=e.divideBy(2).round(),s=n.subtract(o);return s.x||s.y?(t.animate&&t.pan?this.panBy(s):(t.pan&&this._rawPanBy(s),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(p(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:i,newSize:e})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=h({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var i=p(this._handleGeolocationResponse,this),e=p(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(i,e,t):navigator.geolocation.getCurrentPosition(i,e,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var i=t.code,e=t.message||(1===i?"permission denied":2===i?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:i,message:"Geolocation error: "+e+"."})},_handleGeolocationResponse:function(t){var i,e=new D(t.coords.latitude,t.coords.longitude),n=e.toBounds(2*t.coords.accuracy),o=this._locateOptions;o.setView&&(i=this.getBoundsZoom(n),this.setView(e,o.maxZoom?Math.min(i,o.maxZoom):i));var s={latlng:e,bounds:n,timestamp:t.timestamp};for(var r in t.coords)"number"==typeof t.coords[r]&&(s[r]=t.coords[r]);this.fire("locationfound",s)},addHandler:function(t,i){if(!i)return this;var e=this[t]=new i(this);return this._handlers.push(e),this.options[t]&&e.enable(),this},remove:function(){if(this._initEvents(!0),this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ri(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(z(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ri(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,i){var e=si("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),i||this._mapPane);return t&&(this._panes[t]=e),e},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new R(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,i,e){t=N(t),e=A(e||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),h=this.getSize().subtract(e),u=O(this.project(a,n),this.project(r,n)).getSize(),l=vt?this.options.zoomSnap:1,c=h.x/u.x,_=h.y/u.y,d=i?Math.max(c,_):Math.min(c,_),n=this.getScaleZoom(d,n);return l&&(n=Math.round(n/(l/100))*(l/100),n=i?Math.ceil(n/l)*l:Math.floor(n/l)*l),Math.max(o,Math.min(s,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new k(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,i){var e=this._getTopLeftPoint(t,i);return new I(e,e.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,i){var e=this.options.crs;return i=void 0===i?this._zoom:i,e.scale(t)/e.scale(i)},getScaleZoom:function(t,i){var e=this.options.crs;i=void 0===i?this._zoom:i;var n=e.zoom(t*e.scale(i));return isNaN(n)?1/0:n},project:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.latLngToPoint(j(t),i)},unproject:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.pointToLatLng(A(t),i)},layerPointToLatLng:function(t){var i=A(t).add(this.getPixelOrigin());return this.unproject(i)},latLngToLayerPoint:function(t){return this.project(j(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(j(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(N(t))},distance:function(t,i){return this.options.crs.distance(j(t),j(i))},containerPointToLayerPoint:function(t){return A(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return A(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var i=this.containerPointToLayerPoint(A(t));return this.layerPointToLatLng(i)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(j(t)))},mouseEventToContainerPoint:function(t){return Di(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var i=this._container=ni(t);if(!i)throw new Error("Map container not found.");if(i._leaflet_id)throw new Error("Map container is already initialized.");zi(i,"scroll",this._onScroll,this),this._containerId=m(i)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&vt,ci(t,"leaflet-container"+(bt?" leaflet-touch":"")+(zt?" leaflet-retina":"")+(it?" leaflet-oldie":"")+(ct?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var i=oi(t,"position");"absolute"!==i&&"relative"!==i&&"fixed"!==i&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),vi(this._mapPane,new k(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ci(t.markerPane,"leaflet-zoom-hide"),ci(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,i){vi(this._mapPane,new k(0,0));var e=!this._loaded;this._loaded=!0,i=this._limitZoom(i),this.fire("viewprereset");var n=this._zoom!==i;this._moveStart(n,!1)._move(t,i)._moveEnd(n),this.fire("viewreset"),e&&this.fire("load")},_moveStart:function(t,i){return t&&this.fire("zoomstart"),i||this.fire("movestart"),this},_move:function(t,i,e){void 0===i&&(i=this._zoom);var n=this._zoom!==i;return this._zoom=i,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(n||e&&e.pinch)&&this.fire("zoom",e),this.fire("move",e)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return z(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){vi(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={};var i=t?Si:zi;i((this._targets[m(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&i(window,"resize",this._onResize,this),vt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){z(this._resizeRequest),this._resizeRequest=M(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,i){for(var e,n=[],o="mouseout"===i||"mouseover"===i,s=t.target||t.srcElement,r=!1;s;){if((e=this._targets[m(s)])&&("click"===i||"preclick"===i)&&!t._simulated&&this._draggableMoved(e)){r=!0;break}if(e&&e.listens(i,!0)){if(o&&!Vi(s,t))break;if(n.push(e),o)break}if(s===this._container)break;s=s.parentNode}return n.length||r||o||!Vi(s,t)||(n=[this]),n},_handleDOMEvent:function(t){var i;this._loaded&&!Ui(t)&&("mousedown"!==(i=t.type)&&"keypress"!==i&&"keyup"!==i&&"keydown"!==i||Pi(t.target||t.srcElement),this._fireDOMEvent(t,i))},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,i,e){var n;if("click"===t.type&&((n=h({},t)).type="preclick",this._fireDOMEvent(n,n.type,e)),!t._stopped&&(e=(e||[]).concat(this._findEventTargets(t,i))).length){var o=e[0];"contextmenu"===i&&o.listens(i,!0)&&Ri(t);var s,r={originalEvent:t};"keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type&&(s=o.getLatLng&&(!o._radius||o._radius<=10),r.containerPoint=s?this.latLngToContainerPoint(o.getLatLng()):this.mouseEventToContainerPoint(t),r.layerPoint=this.containerPointToLayerPoint(r.containerPoint),r.latlng=s?o.getLatLng():this.layerPointToLatLng(r.layerPoint));for(var a=0;a<e.length;a++)if(e[a].fire(i,r,!0),r.originalEvent._stopped||!1===e[a].options.bubblingMouseEvents&&-1!==v(this._mouseEvents,i))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,i=this._handlers.length;t<i;t++)this._handlers[t].disable()},whenReady:function(t,i){return this._loaded?t.call(i||this,{target:this}):this.on("load",t,i),this},_getMapPanePos:function(){return yi(this._mapPane)||new k(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,i){return(t&&void 0!==i?this._getNewPixelOrigin(t,i):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,i){var e=this.getSize()._divideBy(2);return this.project(t,i)._subtract(e)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,i,e){var n=this._getNewPixelOrigin(e,i);return this.project(t,i)._subtract(n)},_latLngBoundsToNewLayerBounds:function(t,i,e){var n=this._getNewPixelOrigin(e,i);return O([this.project(t.getSouthWest(),i)._subtract(n),this.project(t.getNorthWest(),i)._subtract(n),this.project(t.getSouthEast(),i)._subtract(n),this.project(t.getNorthEast(),i)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,i,e){if(!e)return t;var n=this.project(t,i),o=this.getSize().divideBy(2),s=new I(n.subtract(o),n.add(o)),r=this._getBoundsOffset(s,e,i);return r.round().equals([0,0])?t:this.unproject(n.add(r),i)},_limitOffset:function(t,i){if(!i)return t;var e=this.getPixelBounds(),n=new I(e.min.add(t),e.max.add(t));return t.add(this._getBoundsOffset(n,i))},_getBoundsOffset:function(t,i,e){var n=O(this.project(i.getNorthEast(),e),this.project(i.getSouthWest(),e)),o=n.min.subtract(t.min),s=n.max.subtract(t.max);return new k(this._rebound(o.x,-s.x),this._rebound(o.y,-s.y))},_rebound:function(t,i){return 0<t+i?Math.round(t-i)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(i))},_limitZoom:function(t){var i=this.getMinZoom(),e=this.getMaxZoom(),n=vt?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(i,Math.min(e,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){_i(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,i){var e=this._getCenterOffset(t)._trunc();return!(!0!==(i&&i.animate)&&!this.getSize().contains(e))&&(this.panBy(e,i),!0)},_createAnimProxy:function(){var t=this._proxy=si("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(t){var i=ti,e=this._proxy.style[i];gi(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),e===this._proxy.style[i]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ri(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),i=this.getZoom();gi(this._proxy,this.project(t,i),this.getZoomScale(i,1))},_catchTransitionEnd:function(t){this._animatingZoom&&0<=t.propertyName.indexOf("transform")&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,i,e){if(this._animatingZoom)return!0;if(e=e||{},!this._zoomAnimated||!1===e.animate||this._nothingToAnimate()||Math.abs(i-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(i),o=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==e.animate&&!this.getSize().contains(o))&&(M(function(){this._moveStart(!0,!1)._animateZoom(t,i,!0)},this),!0)},_animateZoom:function(t,i,e,n){this._mapPane&&(e&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=i,ci(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:i,noUpdate:n}),setTimeout(p(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&_i(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),M(function(){this._moveEnd(!0)},this))}});function Yi(t){return new Xi(t)}var Xi=S.extend({options:{position:"topright"},initialize:function(t){c(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var i=this._map;return i&&i.removeControl(this),this.options.position=t,i&&i.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var i=this._container=this.onAdd(t),e=this.getPosition(),n=t._controlCorners[e];return ci(i,"leaflet-control"),-1!==e.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(ri(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0<t.screenX&&0<t.screenY&&this._map.getContainer().focus()}});Ki.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var n=this._controlCorners={},o="leaflet-",s=this._controlContainer=si("div",o+"control-container",this._container);function t(t,i){var e=o+t+" "+o+i;n[t+i]=si("div",e,s)}t("top","left"),t("top","right"),t("bottom","left"),t("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ri(this._controlCorners[t]);ri(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Ji=Xi.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,i,e,n){return e<n?-1:n<e?1:0}},initialize:function(t,i,e){for(var n in c(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[n],n);for(n in i)this._addLayer(i[n],n,!0)},onAdd:function(t){this._initLayout(),this._update(),(this._map=t).on("zoomend",this._checkDisabledLayers,this);for(var i=0;i<this._layers.length;i++)this._layers[i].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return Xi.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,i){return this._addLayer(t,i),this._map?this._update():this},addOverlay:function(t,i){return this._addLayer(t,i,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var i=this._getLayer(m(t));return i&&this._layers.splice(this._layers.indexOf(i),1),this._map?this._update():this},expand:function(){ci(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(ci(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):_i(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return _i(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",i=this._container=si("div",t),e=this.options.collapsed;i.setAttribute("aria-haspopup",!0),Oi(i),Ii(i);var n=this._section=si("section",t+"-list");e&&(this._map.on("click",this.collapse,this),ot||zi(i,{mouseenter:this.expand,mouseleave:this.collapse},this));var o=this._layersLink=si("a",t+"-toggle",i);o.href="#",o.title="Layers",bt?(zi(o,"click",Ni),zi(o,"click",this.expand,this)):zi(o,"focus",this.expand,this),e||this.expand(),this._baseLayersList=si("div",t+"-base",n),this._separator=si("div",t+"-separator",n),this._overlaysList=si("div",t+"-overlays",n),i.appendChild(n)},_getLayer:function(t){for(var i=0;i<this._layers.length;i++)if(this._layers[i]&&m(this._layers[i].layer)===t)return this._layers[i]},_addLayer:function(t,i,e){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:i,overlay:e}),this.options.sortLayers&&this._layers.sort(p(function(t,i){return this.options.sortFunction(t.layer,i.layer,t.name,i.name)},this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;ai(this._baseLayersList),ai(this._overlaysList),this._layerControlInputs=[];for(var t,i,e,n=0,o=0;o<this._layers.length;o++)e=this._layers[o],this._addItem(e),i=i||e.overlay,t=t||!e.overlay,n+=e.overlay?0:1;return this.options.hideSingleBase&&(t=t&&1<n,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=i&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var i=this._getLayer(m(t.target)),e=i.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;e&&this._map.fire(e,i)},_createRadioElement:function(t,i){var e='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(i?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=e,n.firstChild},_addItem:function(t){var i,e=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((i=document.createElement("input")).type="checkbox",i.className="leaflet-control-layers-selector",i.defaultChecked=n):i=this._createRadioElement("leaflet-base-layers_"+m(this),n),this._layerControlInputs.push(i),i.layerId=m(t.layer),zi(i,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("div");return e.appendChild(s),s.appendChild(i),s.appendChild(o),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){var t,i,e=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=e.length-1;0<=s;s--)t=e[s],i=this._getLayer(t.layerId).layer,t.checked?n.push(i):t.checked||o.push(i);for(s=0;s<o.length;s++)this._map.hasLayer(o[s])&&this._map.removeLayer(o[s]);for(s=0;s<n.length;s++)this._map.hasLayer(n[s])||this._map.addLayer(n[s]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,i,e=this._layerControlInputs,n=this._map.getZoom(),o=e.length-1;0<=o;o--)t=e[o],i=this._getLayer(t.layerId).layer,t.disabled=void 0!==i.options.minZoom&&n<i.options.minZoom||void 0!==i.options.maxZoom&&n>i.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),$i=Xi.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"&#x2212;",zoomOutTitle:"Zoom out"},onAdd:function(t){var i="leaflet-control-zoom",e=si("div",i+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,i+"-in",e,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,i+"-out",e,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),e},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,i,e,n,o){var s=si("a",e,n);
9265return s.innerHTML=t,s.href="#",s.title=i,s.setAttribute("role","button"),s.setAttribute("aria-label",i),Oi(s),zi(s,"click",Ni),zi(s,"click",o,this),zi(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,i="leaflet-disabled";_i(this._zoomInButton,i),_i(this._zoomOutButton,i),!this._disabled&&t._zoom!==t.getMinZoom()||ci(this._zoomOutButton,i),!this._disabled&&t._zoom!==t.getMaxZoom()||ci(this._zoomInButton,i)}});Ki.mergeOptions({zoomControl:!0}),Ki.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new $i,this.addControl(this.zoomControl))});var Qi=Xi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var i="leaflet-control-scale",e=si("div",i),n=this.options;return this._addScales(n,i+"-line",e),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),e},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,i,e){t.metric&&(this._mScale=si("div",i,e)),t.imperial&&(this._iScale=si("div",i,e))},_update:function(){var t=this._map,i=t.getSize().y/2,e=t.distance(t.containerPointToLatLng([0,i]),t.containerPointToLatLng([this.options.maxWidth,i]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var i=this._getRoundNum(t),e=i<1e3?i+" m":i/1e3+" km";this._updateScale(this._mScale,e,i/t)},_updateImperial:function(t){var i,e,n,o=3.2808399*t;5280<o?(i=o/5280,e=this._getRoundNum(i),this._updateScale(this._iScale,e+" mi",e/i)):(n=this._getRoundNum(o),this._updateScale(this._iScale,n+" ft",n/o))},_updateScale:function(t,i,e){t.style.width=Math.round(this.options.maxWidth*e)+"px",t.innerHTML=i},_getRoundNum:function(t){var i=Math.pow(10,(Math.floor(t)+"").length-1),e=t/i;return i*(e=10<=e?10:5<=e?5:3<=e?3:2<=e?2:1)}}),te=Xi.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JS library for interactive maps"></a>'},initialize:function(t){c(this,t),this._attributions={}},onAdd:function(t){for(var i in(t.attributionControl=this)._container=si("div","leaflet-control-attribution"),Oi(this._container),t._layers)t._layers[i].getAttribution&&this.addAttribution(t._layers[i].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t=[];for(var i in this._attributions)this._attributions[i]&&t.push(i);var e=[];this.options.prefix&&e.push(this.options.prefix),t.length&&e.push(t.join(", ")),this._container.innerHTML=e.join(" | ")}}});Ki.mergeOptions({attributionControl:!0}),Ki.addInitHook(function(){this.options.attributionControl&&(new te).addTo(this)});Xi.Layers=Ji,Xi.Zoom=$i,Xi.Scale=Qi,Xi.Attribution=te,Yi.layers=function(t,i,e){return new Ji(t,i,e)},Yi.zoom=function(t){return new $i(t)},Yi.scale=function(t){return new Qi(t)},Yi.attribution=function(t){return new te(t)};var ie=S.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}});ie.addTo=function(t,i){return t.addHandler(i,this),this};var ee,ne={Events:Z},oe=bt?"touchstart mousedown":"mousedown",se={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},re={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},ae=E.extend({options:{clickTolerance:3},initialize:function(t,i,e,n){c(this,n),this._element=t,this._dragStartTarget=i||t,this._preventOutline=e},enable:function(){this._enabled||(zi(this._dragStartTarget,oe,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(ae._dragging===this&&this.finishDrag(),Si(this._dragStartTarget,oe,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){var i,e;!t._simulated&&this._enabled&&(this._moved=!1,li(this._element,"leaflet-zoom-anim")||ae._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((ae._dragging=this)._preventOutline&&Pi(this._element),xi(),Xt(),this._moving||(this.fire("down"),i=t.touches?t.touches[0]:t,e=bi(this._element),this._startPoint=new k(i.clientX,i.clientY),this._parentScale=Ti(e),zi(document,re[t.type],this._onMove,this),zi(document,se[t.type],this._onUp,this))))},_onMove:function(t){var i,e;!t._simulated&&this._enabled&&(t.touches&&1<t.touches.length?this._moved=!0:((e=new k((i=t.touches&&1===t.touches.length?t.touches[0]:t).clientX,i.clientY)._subtract(this._startPoint)).x||e.y)&&(Math.abs(e.x)+Math.abs(e.y)<this.options.clickTolerance||(e.x/=this._parentScale.x,e.y/=this._parentScale.y,Ri(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=yi(this._element).subtract(e),ci(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),ci(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(e),this._moving=!0,z(this._animRequest),this._lastEvent=t,this._animRequest=M(this._updatePosition,this,!0))))},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),vi(this._element,this._newPos),this.fire("drag",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){for(var t in _i(document.body,"leaflet-dragging"),this._lastTarget&&(_i(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),re)Si(document,re[t],this._onMove,this),Si(document,se[t],this._onUp,this);wi(),Jt(),this._moved&&this._moving&&(z(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,ae._dragging=!1}});function he(t,i){if(!i||!t.length)return t.slice();var e=i*i;return t=function(t,i){var e=t.length,n=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(e);n[0]=n[e-1]=1,function t(i,e,n,o,s){var r,a,h,u=0;for(a=o+1;a<=s-1;a++)h=de(i[a],i[o],i[s],!0),u<h&&(r=a,u=h);n<u&&(e[r]=1,t(i,e,n,o,r),t(i,e,n,r,s))}(t,n,i,0,e-1);var o,s=[];for(o=0;o<e;o++)n[o]&&s.push(t[o]);return s}(t=function(t,i){for(var e=[t[0]],n=1,o=0,s=t.length;n<s;n++)(function(t,i){var e=i.x-t.x,n=i.y-t.y;return e*e+n*n})(t[n],t[o])>i&&(e.push(t[n]),o=n);o<s-1&&e.push(t[s-1]);return e}(t,e),e)}function ue(t,i,e){return Math.sqrt(de(t,i,e,!0))}function le(t,i,e,n,o){var s,r,a,h=n?ee:_e(t,e),u=_e(i,e);for(ee=u;;){if(!(h|u))return[t,i];if(h&u)return!1;a=_e(r=ce(t,i,s=h||u,e,o),e),s===h?(t=r,h=a):(i=r,u=a)}}function ce(t,i,e,n,o){var s,r,a=i.x-t.x,h=i.y-t.y,u=n.min,l=n.max;return 8&e?(s=t.x+a*(l.y-t.y)/h,r=l.y):4&e?(s=t.x+a*(u.y-t.y)/h,r=u.y):2&e?(s=l.x,r=t.y+h*(l.x-t.x)/a):1&e&&(s=u.x,r=t.y+h*(u.x-t.x)/a),new k(s,r,o)}function _e(t,i){var e=0;return t.x<i.min.x?e|=1:t.x>i.max.x&&(e|=2),t.y<i.min.y?e|=4:t.y>i.max.y&&(e|=8),e}function de(t,i,e,n){var o,s=i.x,r=i.y,a=e.x-s,h=e.y-r,u=a*a+h*h;return 0<u&&(1<(o=((t.x-s)*a+(t.y-r)*h)/u)?(s=e.x,r=e.y):0<o&&(s+=a*o,r+=h*o)),a=t.x-s,h=t.y-r,n?a*a+h*h:new k(s,r)}function pe(t){return!g(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function me(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),pe(t)}var fe={simplify:he,pointToSegmentDistance:ue,closestPointOnSegment:function(t,i,e){return de(t,i,e)},clipSegment:le,_getEdgeIntersection:ce,_getBitCode:_e,_sqClosestPointOnSegment:de,isFlat:pe,_flat:me};function ge(t,i,e){for(var n,o,s,r,a,h,u,l=[1,4,2,8],c=0,_=t.length;c<_;c++)t[c]._code=_e(t[c],i);for(s=0;s<4;s++){for(h=l[s],n=[],c=0,o=(_=t.length)-1;c<_;
vendor: 4,715 bytes, line 9265
9265o=c++)r=t[c],a=t[o],r._code&h?a._code&h||((u=ce(a,r,h,i,e))._code=_e(u,i),n.push(u)):(a._code&h&&((u=ce(a,r,h,i,e))._code=_e(u,i),n.push(u)),n.push(r));t=n}return t}var ve,ye={clipPolygon:ge},xe={project:function(t){return new k(t.lng,t.lat)},unproject:function(t){return new D(t.y,t.x)},bounds:new I([-180,-90],[180,90])},we={R:6378137,R_MINOR:6356752.314245179,bounds:new I([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var i=Math.PI/180,e=this.R,n=t.lat*i,o=this.R_MINOR/e,s=Math.sqrt(1-o*o),r=s*Math.sin(n),a=Math.tan(Math.PI/4-n/2)/Math.pow((1-r)/(1+r),s/2),n=-e*Math.log(Math.max(a,1e-10));return new k(t.lng*i*e,n)},unproject:function(t){for(var i,e=180/Math.PI,n=this.R,o=this.R_MINOR/n,s=Math.sqrt(1-o*o),r=Math.exp(-t.y/n),a=Math.PI/2-2*Math.atan(r),h=0,u=.1;h<15&&1e-7<Math.abs(u);h++)i=s*Math.sin(a),i=Math.pow((1-i)/(1+i),s/2),a+=u=Math.PI/2-2*Math.atan(r*i)-a;return new D(a*e,t.x*e/n)}},Pe={LonLat:xe,Mercator:we,SphericalMercator:V},Le=h({},F,{code:"EPSG:3395",projection:we,transformation:G(ve=.5/(Math.PI*we.R),.5,-ve,.5)}),be=h({},F,{code:"EPSG:4326",projection:xe,transformation:G(1/180,1,-1/180,.5)}),Te=h({},H,{projection:xe,transformation:G(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,i){var e=i.lng-t.lng,n=i.lat-t.lat;return Math.sqrt(e*e+n*n)},infinite:!0});H.Earth=F,H.EPSG3395=Le,H.EPSG3857=Y,H.EPSG900913=X,H.EPSG4326=be,H.Simple=Te;var Me=E.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[m(t)]=this},removeInteractiveTarget:function(t){return delete this._map._targets[m(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var i,e=t.target;e.hasLayer(this)&&(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents&&(i=this.getEvents(),e.on(i,this),this.once("remove",function(){e.off(i,this)},this)),this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),e.fire("layeradd",{layer:this}))}});Ki.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var i=m(t);return this._layers[i]||((this._layers[i]=t)._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var i=m(t);return this._layers[i]&&(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[i],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null),this},hasLayer:function(t){return!!t&&m(t)in this._layers},eachLayer:function(t,i){for(var e in this._layers)t.call(i,this._layers[e]);return this},_addLayers:function(t){for(var i=0,e=(t=t?g(t)?t:[t]:[]).length;i<e;i++)this.addLayer(t[i])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[m(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var i=m(t);this._zoomBoundLayers[i]&&(delete this._zoomBoundLayers[i],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,i=-1/0,e=this._getZoomSpan();for(var n in this._zoomBoundLayers)var o=this._zoomBoundLayers[n].options,t=void 0===o.minZoom?t:Math.min(t,o.minZoom),i=void 0===o.maxZoom?i:Math.max(i,o.maxZoom);this._layersMaxZoom=i===-1/0?void 0:i,this._layersMinZoom=t===1/0?void 0:t,e!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var ze=Me.extend({initialize:function(t,i){var e,n;if(c(this,i),this._layers={},t)for(e=0,n=t.length;e<n;e++)this.addLayer(t[e])},addLayer:function(t){var i=this.getLayerId(t);return this._layers[i]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var i=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[i]&&this._map.removeLayer(this._layers[i]),delete this._layers[i],this},hasLayer:function(t){return!!t&&("number"==typeof t?t:this.getLayerId(t))in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var i,e,n=Array.prototype.slice.call(arguments,1
vendor: 4,400 bytes, line 9265
9265);for(i in this._layers)(e=this._layers[i])[t]&&e[t].apply(e,n);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,i){for(var e in this._layers)t.call(i,this._layers[e]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:m}),Ce=ze.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),ze.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),ze.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new R;for(var i in this._layers){var e=this._layers[i];t.extend(e.getBounds?e.getBounds():e.getLatLng())}return t}}),Se=S.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){c(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,i){var e=this._getIconUrl(t);if(!e){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(e,i&&"IMG"===i.tagName?i:null);return this._setIconStyles(n,t),n},_setIconStyles:function(t,i){var e=this.options,n=e[i+"Size"];"number"==typeof n&&(n=[n,n]);var o=A(n),s=A("shadow"===i&&e.shadowAnchor||e.iconAnchor||o&&o.divideBy(2,!0));t.className="leaflet-marker-"+i+" "+(e.className||""),s&&(t.style.marginLeft=-s.x+"px",t.style.marginTop=-s.y+"px"),o&&(t.style.width=o.x+"px",t.style.height=o.y+"px")},_createImg:function(t,i){return(i=i||document.createElement("img")).src=t,i},_getIconUrl:function(t){return zt&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});var Ze=Se.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return Ze.imagePath||(Ze.imagePath=this._detectIconPath()),(this.options.imagePath||Ze.imagePath)+Se.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=si("div","leaflet-default-icon-path",document.body),i=oi(t,"background-image")||oi(t,"backgroundImage");return document.body.removeChild(t),i=null===i||0!==i.indexOf("url")?"":i.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}}),Ee=ie.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new ae(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),ci(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&_i(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var i,e=this._marker,n=e._map,o=this._marker.options.autoPanSpeed,s=this._marker.options.autoPanPadding,r=yi(e._icon),a=n.getPixelBounds(),h=n.getPixelOrigin(),u=O(a.min._subtract(h).add(s),a.max._subtract(h).subtract(s));u.contains(r)||(i=A((Math.max(u.max.x,r.x)-u.max.x)/(a.max.x-u.max.x)-(Math.min(u.min.x,r.x)-u.min.x)/(a.min.x-u.min.x),(Math.max(u.max.y,r.y)-u.max.y)/(a.max.y-u.max.y)-(Math.min(u.min.y,r.y)-u.min.y)/(a.min.y-u.min.y)).multiplyBy(o),n.panBy(i,{animate:!1}),this._draggable._newPos._add(i),this._draggable._startPos._add(i),vi(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=M(this._adjustPan.bind(this,t)))},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(z(this._panRequest),this._panRequest=M(this._adjustPan.bind(this,t)))},_onDrag:function(t){var i=this._marker,e=i._shadow,n=yi(i._icon),o=i._map.layerPointToLatLng(n);
vendor: 7,628 bytes, line 9265
9265e&&vi(e,n),i._latlng=o,t.latlng=o,t.oldLatLng=this._oldLatLng,i.fire("move",t).fire("drag",t)},_onDragEnd:function(t){z(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),ke=Me.extend({options:{icon:new Ze,interactive:!0,keyboard:!0,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,i){c(this,i),this._latlng=j(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var i=this._latlng;return this._latlng=j(t),this.update(),this.fire("move",{oldLatLng:i,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){var t;return this._icon&&this._map&&(t=this._map.latLngToLayerPoint(this._latlng).round(),this._setPos(t)),this},_initIcon:function(){var t=this.options,i="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),e=t.icon.createIcon(this._icon),n=!1;e!==this._icon&&(this._icon&&this._removeIcon(),n=!0,t.title&&(e.title=t.title),"IMG"===e.tagName&&(e.alt=t.alt||"")),ci(e,i),t.keyboard&&(e.tabIndex="0"),this._icon=e,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var o=t.icon.createShadow(this._shadow),s=!1;o!==this._shadow&&(this._removeShadow(),s=!0),o&&(ci(o,i),o.alt=""),this._shadow=o,t.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),o&&s&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),ri(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ri(this._shadow),this._shadow=null},_setPos:function(t){this._icon&&vi(this._icon,t),this._shadow&&vi(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon&&(this._icon.style.zIndex=this._zIndex+t)},_animateZoom:function(t){var i=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(i)},_initInteraction:function(){var t;this.options.interactive&&(ci(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Ee&&(t=this.options.draggable,this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Ee(this),t&&this.dragging.enable()))},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&mi(this._icon,t),this._shadow&&mi(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});var Be=Me.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return c(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t&&Object.prototype.hasOwnProperty.call(t,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),Ae=Be.extend({options:{fill:!0,radius:10},initialize:function(t,i){c(this,i),this._latlng=j(t),this._radius=this.options.radius},setLatLng:function(t){var i=this._latlng;return this._latlng=j(t),this.redraw(),this.fire("move",{oldLatLng:i,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var i=t&&t.radius||this._radius;return Be.prototype.setStyle.call(this,t),this.setRadius(i),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,i=this._radiusY||t,e=this._clickTolerance(),n=[t+e,i+e];this._pxBounds=new I(this._point.subtract(n),this._point.add(n))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});var Ie=Ae.extend({initialize:function(t,i,e){if("number"==typeof i&&(i=h({},e,{radius:i})),c(this,i),this._latlng=j(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new R(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:Be.prototype.setStyle,_project:function(){var t,i,e,n,o,s,r,a,h=this._latlng.lng,u=this._latlng.lat,l=this._map,c=l.options.crs;c.distance===F.distance?(t=Math.PI/180,i=this._mRadius/F.R/t,e=l.project([u+i,h]),n=l.project([u-i,h]),o=e.add(n).divideBy(2),s=l.unproject(o).lat,r=Math.acos((Math.cos(i*t)-Math.sin(u*t)*Math.sin(s*t))/(Math.cos(u*t)*Math.cos(s*t)))/t,!isNaN(r)&&0!==r||(r=i/Math.cos(Math.PI/180*u)),this._point=o.subtract(l.getPixelOrigin()),this._radius=isNaN(r)?0:o.x-l.project([s,h-r]).x,this._radiusY=o.y-e.y):(a=c.unproject(c.project(this._latlng).subtract([this._mRadius,0])),this._point=l.latLngToLayerPoint(this._latlng),this._radius=this._point.x-l.latLngToLayerPoint(a).x),this._updateBounds()}});var Oe=Be.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,i){c(this,i),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var i,e,n=1/0,o=null,s=de,r=0,a=this._parts.length;r<a;r++)for(var h=this._parts[r],u=1,l=h.length;u<l;u++){var c=s(t,i=h[u-1],e=h[u],!0);c<n&&(n=c,o=s(t,i,e))}return o&&(o.distance=Math.sqrt(n)),o}
vendor: 5,544 bytes, line 9265
9265,getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,i,e,n,o,s,r,a=this._rings[0],h=a.length;if(!h)return null;for(i=t=0;t<h-1;t++)i+=a[t].distanceTo(a[t+1])/2;if(0===i)return this._map.layerPointToLatLng(a[0]);for(n=t=0;t<h-1;t++)if(o=a[t],s=a[t+1],i<(n+=e=o.distanceTo(s)))return r=(n-i)/e,this._map.layerPointToLatLng([s.x-r*(s.x-o.x),s.y-r*(s.y-o.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,i){return i=i||this._defaultShape(),t=j(t),i.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new R,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return pe(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var i=[],e=pe(t),n=0,o=t.length;n<o;n++)e?(i[n]=j(t[n]),this._bounds.extend(i[n])):i[n]=this._convertLatLngs(t[n]);return i},_project:function(){var t=new I;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),i=new k(t,t);this._pxBounds=new I([this._rawPxBounds.min.subtract(i),this._rawPxBounds.max.add(i)])},_projectLatlngs:function(t,i,e){var n,o,s=t[0]instanceof D,r=t.length;if(s){for(o=[],n=0;n<r;n++)o[n]=this._map.latLngToLayerPoint(t[n]),e.extend(o[n]);i.push(o)}else for(n=0;n<r;n++)this._projectLatlngs(t[n],i,e)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var i,e,n,o,s=this._parts,r=0,a=0,h=this._rings.length;r<h;r++)for(i=0,e=(o=this._rings[r]).length;i<e-1;i++)(n=le(o[i],o[i+1],t,i,!0))&&(s[a]=s[a]||[],s[a].push(n[0]),n[1]===o[i+1]&&i!==e-2||(s[a].push(n[1]),a++))},_simplifyPoints:function(){for(var t=this._parts,i=this.options.smoothFactor,e=0,n=t.length;e<n;e++)t[e]=he(t[e],i)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,i){var e,n,o,s,r,a,h=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(e=0,s=this._parts.length;e<s;e++)for(n=0,o=(r=(a=this._parts[e]).length)-1;n<r;o=n++)if((i||0!==n)&&ue(t,a[o],a[n])<=h)return!0;return!1}});Oe._flat=me;var Re=Oe.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,i,e,n,o,s,r,a,h,u=this._rings[0],l=u.length;if(!l)return null;for(t=s=r=a=0,i=l-1;t<l;i=t++)e=u[t],n=u[i],o=e.y*n.x-n.y*e.x,r+=(e.x+n.x)*o,a+=(e.y+n.y)*o,s+=3*o;return h=0===s?u[0]:[r/s,a/s],this._map.layerPointToLatLng(h)},_convertLatLngs:function(t){var i=Oe.prototype._convertLatLngs.call(this,t),e=i.length;return 2<=e&&i[0]instanceof D&&i[0].equals(i[e-1])&&i.pop(),i},_setLatLngs:function(t){Oe.prototype._setLatLngs.call(this,t),pe(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return pe(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,i=this.options.weight,e=new k(i,i),t=new I(t.min.subtract(e),t.max.add(e));if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var n,o=0,s=this._rings.length;o<s;o++)(n=ge(this._rings[o],t,!0)).length&&this._parts.push(n)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var i,e,n,o,s,r,a,h,u=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(o=0,a=this._parts.length;o<a;o++)for(s=0,r=(h=(i=this._parts[o]).length)-1;s<h;r=s++)e=i[s],n=i[r],e.y>t.y!=n.y>t.y&&t.x<(n.x-e.x)*(t.y-e.y)/(n.y-e.y)+e.x&&(u=!u);return u||Oe.prototype._containsPoint.call(this,t,!0)}});var Ne=Ce.extend({initialize:function(t,i){c(this,i),this._layers={},t&&this.addData(t)},addData:function(t){var i,e,n,o=g(t)?t:t.features;if(o){for(i=0,e=o.length;i<e;i++)((n=o[i]).geometries||n.geometry||n.features||n.coordinates)&&this.addData(n);return this}var s=this.options;if(s.filter&&!s.filter(t))return this;var r=De(t,s);return r?(r.feature=qe(t),r.defaultOptions=r.options,this.resetStyle(r),s.onEachFeature&&s.onEachFeature(t,r),this.addLayer(r)):this},resetStyle:function(t){return void 0===t?this.eachLayer(this.resetStyle,this):(t.options=h({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this)},setStyle:function(i){return this.eachLayer(function(t){this._setLayerStyle(t,i)},this)},_setLayerStyle:function(t,i){t.setStyle&&("function"==typeof i&&(i=i(t.feature)),t.setStyle(i))}});function De(t,i){var e,n,o,s,r="Feature"===t.type?t.geometry:t,a=r?r.coordinates:null,h=[],u=i&&i.pointToLayer,l=i&&i.coordsToLatLng||We;if(!a&&!r)return null;switch(r.type){case"Point":return je(u,t,e=l(a),i);case"MultiPoint":for(o=0,s=a.length;o<s;o++)e=l(a[o]),h.push(je(u,t,e,i));return new Ce(h);case"LineString":case"MultiLineString":return n=He(a,"LineString"===r.type?0:1,l),new Oe(n,i);case"Polygon":case"MultiPolygon":return n=He(a,"Polygon"===r.type?1:2,l),new Re(n,i);case"GeometryCollection":for(o=0,s=r.geometries.length;o<s;o++){var c=De({geometry:r.geometries[o],type:"Feature",properties:t.properties},i);c&&h.push(c)}return new Ce(h);default:throw new Error("Invalid GeoJSON object.")}}function je(t,i,e,n){return t?t(i,e):new ke(e,n&&n.markersInheritOptions&&n)}function We(t){return new D(t[1],t[0],t[2])}
vendor: 8,645 bytes, line 9265
9265function He(t,i,e){for(var n,o=[],s=0,r=t.length;s<r;s++)n=i?He(t[s],i-1,e):(e||We)(t[s]),o.push(n);return o}function Fe(t,i){return i="number"==typeof i?i:6,void 0!==t.alt?[r(t.lng,i),r(t.lat,i),r(t.alt,i)]:[r(t.lng,i),r(t.lat,i)]}function Ue(t,i,e,n){for(var o=[],s=0,r=t.length;s<r;s++)o.push(i?Ue(t[s],i-1,e,n):Fe(t[s],n));return!i&&e&&o.push(o[0]),o}function Ve(t,i){return t.feature?h({},t.feature,{geometry:i}):qe(i)}function qe(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var Ge={toGeoJSON:function(t){return Ve(this,{type:"Point",coordinates:Fe(this.getLatLng(),t)})}};function Ke(t,i){return new Ne(t,i)}ke.include(Ge),Ie.include(Ge),Ae.include(Ge),Oe.include({toGeoJSON:function(t){var i=!pe(this._latlngs);return Ve(this,{type:(i?"Multi":"")+"LineString",coordinates:Ue(this._latlngs,i?1:0,!1,t)})}}),Re.include({toGeoJSON:function(t){var i=!pe(this._latlngs),e=i&&!pe(this._latlngs[0]),n=Ue(this._latlngs,e?2:i?1:0,!0,t);return i||(n=[n]),Ve(this,{type:(e?"Multi":"")+"Polygon",coordinates:n})}}),ze.include({toMultiPoint:function(i){var e=[];return this.eachLayer(function(t){e.push(t.toGeoJSON(i).geometry.coordinates)}),Ve(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(n){var t=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===t)return this.toMultiPoint(n);var o="GeometryCollection"===t,s=[];return this.eachLayer(function(t){var i,e;t.toGeoJSON&&(i=t.toGeoJSON(n),o?s.push(i.geometry):"FeatureCollection"===(e=qe(i)).type?s.push.apply(s,e.features):s.push(e))}),o?Ve(this,{geometries:s,type:"GeometryCollection"}):{type:"FeatureCollection",features:s}}});var Ye=Ke,Xe=Me.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,i,e){this._url=t,this._bounds=N(i),c(this,e)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ci(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ri(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&hi(this._image),this},bringToBack:function(){return this._map&&ui(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=N(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,i=this._image=t?this._url:si("img");ci(i,"leaflet-image-layer"),this._zoomAnimated&&ci(i,"leaflet-zoom-animated"),this.options.className&&ci(i,this.options.className),i.onselectstart=a,i.onmousemove=a,i.onload=p(this.fire,this,"load"),i.onerror=p(this._overlayOnError,this,"error"),!this.options.crossOrigin&&""!==this.options.crossOrigin||(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=i.src:(i.src=this._url,i.alt=this.options.alt)},_animateZoom:function(t){var i=this._map.getZoomScale(t.zoom),e=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;gi(this._image,e,i)},_reset:function(){var t=this._image,i=new I(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),e=i.getSize();vi(t,i.min),t.style.width=e.x+"px",t.style.height=e.y+"px"},_updateOpacity:function(){mi(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),Je=Xe.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1},_initImage:function(){var t="VIDEO"===this._url.tagName,i=this._image=t?this._url:si("video");if(ci(i,"leaflet-image-layer"),this._zoomAnimated&&ci(i,"leaflet-zoom-animated"),this.options.className&&ci(i,this.options.className),i.onselectstart=a,i.onmousemove=a,i.onloadeddata=p(this.fire,this,"load"),t){for(var e=i.getElementsByTagName("source"),n=[],o=0;o<e.length;o++)n.push(e[o].src);this._url=0<e.length?n:[i.src]}else{g(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(i.style,"objectFit")&&(i.style.objectFit="fill"),i.autoplay=!!this.options.autoplay,i.loop=!!this.options.loop,i.muted=!!this.options.muted;for(var s=0;s<this._url.length;s++){var r=si("source");r.src=this._url[s],i.appendChild(r)}}}});var $e=Xe.extend({_initImage:function(){var t=this._image=this._url;ci(t,"leaflet-image-layer"),this._zoomAnimated&&ci(t,"leaflet-zoom-animated"),this.options.className&&ci(t,this.options.className),t.onselectstart=a,t.onmousemove=a}});var Qe=Me.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(t,i){c(this,t),this._source=i},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&mi(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&mi(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(mi(this._container,0),this._removeTimeout=setTimeout(p(ri,void 0,this._container),200)):ri(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=j(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&hi(this._container),this},bringToBack:function(){return this._map&&ui(this._container),this},_prepareOpen:function(t,i,e){if(i instanceof Me||(e=i,i=t),i instanceof Ce)for(var n in t._layers){i=t._layers[n];break}if(!e)if(i.getCenter)e=i.getCenter();else{if(!i.getLatLng)throw new Error("Unable to get source layer LatLng.");e=i.getLatLng()}return this._source=i,this.update(),e},_updateContent:function(){if(this._content){var t=this._contentNode,i="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof i)t.innerHTML=i;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(i)}this.fire("contentupdate")}},_updatePosition:function(){var t,i,e,n,o;this._map&&(t=this._map.latLngToLayerPoint(this._latlng),i=A(this.options.offset),e=this._getAnchor(),this._zoomAnimated?vi(this._container,t.add(e)):i=i.add(t).add(e),n=this._containerBottom=-i.y,o=this._containerLeft=-Math.round(this._containerWidth/2)+i.x,this._container.style.bottom=n+"px",this._container.style.left=o+"px")},_getAnchor:function(){return[0,0]}}),tn=Qe.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){Qe.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Be||this._source.on("preclick",Ai))},onRemove:function(t){Qe.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Be||this._source.off("preclick",Ai))},getEvents:function(){var t=Qe.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&
9265(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t,i="leaflet-popup",e=this._container=si("div",i+" "+(this.options.className||"")+" leaflet-zoom-animated"),n=this._wrapper=si("div",i+"-content-wrapper",e);this._contentNode=si("div",i+"-content",n),Oi(e),Ii(this._contentNode),zi(e,"contextmenu",Ai),this._tipContainer=si("div",i+"-tip-container",e),this._tip=si("div",i+"-tip",this._tipContainer),this.options.closeButton&&((t=this._closeButton=si("a",i+"-close-button",e)).href="#close",t.innerHTML="&#215;",zi(t,"click",this._onCloseButtonClick,this))},_updateLayout:function(){var t=this._contentNode,i=t.style;i.width="",i.whiteSpace="nowrap";var e=t.offsetWidth,e=Math.min(e,this.options.maxWidth);e=Math.max(e,this.options.minWidth),i.width=e+1+"px",i.whiteSpace="",i.height="";var n=t.offsetHeight,o=this.options.maxHeight,s="leaflet-popup-scrolled";o&&o<n?(i.height=o+"px",ci(t,s)):_i(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var i=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),e=this._getAnchor();vi(this._container,i.add(e))},_adjustPan:function(){var t,i,e,n,o,s,r,a,h,u,l,c;this.options.autoPan&&(this._map._panAnim&&this._map._panAnim.stop(),t=this._map,i=parseInt(oi(this._container,"marginBottom"),10)||0,e=this._container.offsetHeight+i,n=this._containerWidth,(o=new k(this._containerLeft,-e-this._containerBottom))._add(yi(this._container)),s=t.layerPointToContainerPoint(o),r=A(this.options.autoPanPadding),a=A(this.options.autoPanPaddingTopLeft||r),h=A(this.options.autoPanPaddingBottomRight||r),u=t.getSize(),c=l=0,s.x+n+h.x>u.x&&(l=s.x+n-u.x+h.x),s.x-l-a.x<0&&(l=s.x-a.x),s.y+e+h.y>u.y&&(c=s.y+e-u.y+h.y),s.y-c-a.y<0&&(c=s.y-a.y),(l||c)&&t.fire("autopanstart").panBy([l,c]))},_onCloseButtonClick:function(t){this._close(),Ni(t)},_getAnchor:function(){return A(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});Ki.mergeOptions({closePopupOnClick:!0}),Ki.include({openPopup:function(t,i,e){return t instanceof tn||(t=new tn(e).setContent(t)),i&&t.setLatLng(i),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Me.include({bindPopup:function(t,i){return t instanceof tn?(c(t,i),(this._popup=t)._source=this):(this._popup&&!i||(this._popup=new tn(i,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,i){return this._popup&&this._map&&(i=this._popup._prepareOpen(this,t,i),this._map.openPopup(this._popup,i)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var i=t.layer||t.target;this._popup&&this._map&&(Ni(t),i instanceof Be?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===i?this.closePopup():this.openPopup(i,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var en=Qe.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){Qe.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){Qe.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=Qe.prototype.getEvents.call(this);return bt&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=si("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var i,e=this._map,n=this._container,o=e.latLngToContainerPoint(e.getCenter()),s=e.layerPointToContainerPoint(t),r=this.options.direction,a=n.offsetWidth,h=n.offsetHeight,u=A(this.options.offset),l=this._getAnchor(),c="top"===r?(i=a/2,h):"bottom"===r?(i=a/2,0):(i="center"===r?a/2:"right"===r?0:"left"===r?a:s.x<o.x?(r="right",0):(r="left",a+2*(u.x+l.x)),h/2);t=t.subtract(A(i,c,!0)).add(u).add(l),_i(n,"leaflet-tooltip-right"),_i(n,"leaflet-tooltip-left"),_i(n,"leaflet-tooltip-top"),_i(n,"leaflet-tooltip-bottom"),ci(n,"leaflet-tooltip-"+r),vi(n,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&mi(this._container,t)},_animateZoom:function(t){var i=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(i)},_getAnchor:function(){return A(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}});Ki.include({openTooltip:function(t,i,e){return t instanceof en||(t=new en(e).setContent(t)),i&&t.setLatLng(i),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),Me.include({bindTooltip:function(t,i){return t instanceof en?(c(t,i),(this._tooltip=t)._source=this):(this._tooltip&&!i||(this._tooltip=new en(i,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){var i,e;!t&&this._tooltipHandlersAdded||(i=t?"off":"on",e={remove:this.closeTooltip,move:this._moveTooltip},this._tooltip.options.permanent?e.add=this._openTooltip:(e.mouseover=this._openTooltip,e.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(e.mousemove=this._moveTooltip),bt&&(e.click=this._openTooltip)),this[i](e),this._tooltipHandlersAdded=!t)},openTooltip:function(t,i){return this._tooltip&&this._map&&(i=this._tooltip._prepareOpen(this,t,i),this._map.openTooltip(this._tooltip,i),this._tooltip.options.interactive&&this._tooltip._container&&(ci(this._tooltip._container,"leaflet-clickable"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(_i(this._tooltip._container,"leaflet-clickable"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var i=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(i,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var i,e,n=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(i=this._map.mouseEventToContainerPoint(t.originalEvent),e=this._map.containerPointToLayerPoint(i),n=this._map.layerPointToLatLng(e)),this._tooltip.setLatLng(n)}});var nn=Se.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var i,e=t&&"DIV"===t.tagName?t:document.createElement("div"),n=this.options;return n.html instanceof Element?(ai(e),e.appendChild(n.html)):e.innerHTML=!1!==n.html?n.html:"",n.bgPos&&(i=A(n.bgPos),e.style.backgroundPosition=-i.x+"px "+-i.y+"px"),this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});Se.Default=Ze;var on=Me.extend({options:{tileSize:256,opacity:1,updateWhenIdle:yt,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){c(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),ri(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(hi(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(ui(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=n(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof k?t:new k(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var i,e=this.getPane().children,n=-t(-1/0,1/0),o=0,s=e.length;o<s;o++)i=e[o].style.zIndex,e[o]!==this._container&&i&&(n=t(n,+i));isFinite(n)&&(this.options.zIndex=n+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!it){mi(this._container,this.options.opacity);var t=+new Date,i=!1,e=!1;for(var n in this._tiles){var o,s=this._tiles[n];s.current&&s.loaded&&(o=Math.min(1,(t-s.loaded)/200),mi(s.el,o),o<1?i=!0:(s.active?e=!0:this._onOpaqueTile(s),s.active=!0))}e&&!this._noPrune&&this._pruneTiles(),i&&(z(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this))}}
vendor: 29,351 bytes, line 9265
9265,_onOpaqueTile:a,_initContainer:function(){this._container||(this._container=si("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,i=this.options.maxZoom;if(void 0!==t){for(var e in this._levels)e=Number(e),this._levels[e].el.children.length||e===t?(this._levels[e].el.style.zIndex=i-Math.abs(t-e),this._onUpdateLevel(e)):(ri(this._levels[e].el),this._removeTilesAtZoom(e),this._onRemoveLevel(e),delete this._levels[e]);var n=this._levels[t],o=this._map;return n||((n=this._levels[t]={}).el=si("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=i,n.origin=o.project(o.unproject(o.getPixelOrigin()),t).round(),n.zoom=t,this._setZoomTransform(n,o.getCenter(),o.getZoom()),a(n.el.offsetWidth),this._onCreateLevel(n)),this._level=n}},_onUpdateLevel:a,_onRemoveLevel:a,_onCreateLevel:a,_pruneTiles:function(){if(this._map){var t,i,e,n=this._map.getZoom();if(n>this.options.maxZoom||n<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles){(e=this._tiles[t]).current&&!e.active&&(i=e.coords,this._retainParent(i.x,i.y,i.z,i.z-5)||this._retainChildren(i.x,i.y,i.z,i.z+2))}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var i in this._tiles)this._tiles[i].coords.z===t&&this._removeTile(i)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)ri(this._levels[t].el),this._onRemoveLevel(Number(t)),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,i,e,n){var o=Math.floor(t/2),s=Math.floor(i/2),r=e-1,a=new k(+o,+s);a.z=+r;var h=this._tileCoordsToKey(a),u=this._tiles[h];return u&&u.active?u.retain=!0:(u&&u.loaded&&(u.retain=!0),n<r&&this._retainParent(o,s,r,n))},_retainChildren:function(t,i,e,n){for(var o=2*t;o<2*t+2;o++)for(var s=2*i;s<2*i+2;s++){var r=new k(o,s);r.z=e+1;var a=this._tileCoordsToKey(r),h=this._tiles[a];h&&h.active?h.retain=!0:(h&&h.loaded&&(h.retain=!0),e+1<n&&this._retainChildren(o,s,e+1,n))}},_resetView:function(t){var i=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),i,i)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var i=this.options;return void 0!==i.minNativeZoom&&t<i.minNativeZoom?i.minNativeZoom:void 0!==i.maxNativeZoom&&i.maxNativeZoom<t?i.maxNativeZoom:t},_setView:function(t,i,e,n){var o=Math.round(i),o=void 0!==this.options.maxZoom&&o>this.options.maxZoom||void 0!==this.options.minZoom&&o<this.options.minZoom?void 0:this._clampZoom(o),s=this.options.updateWhenZooming&&o!==this._tileZoom;n&&!s||(this._tileZoom=o,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==o&&this._update(t),e||this._pruneTiles(),this._noPrune=!!e),this._setZoomTransforms(t,i)},_setZoomTransforms:function(t,i){for(var e in this._levels)this._setZoomTransform(this._levels[e],t,i)},_setZoomTransform:function(t,i,e){var n=this._map.getZoomScale(e,t.zoom),o=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(i,e)).round();vt?gi(t.el,o,n):vi(t.el,o)},_resetGrid:function(){var t=this._map,i=t.options.crs,e=this._tileSize=this.getTileSize(),n=this._tileZoom,o=this._map.getPixelWorldBounds(this._tileZoom);o&&(this._globalTileRange=this._pxBoundsToTileRange(o)),this._wrapX=i.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,i.wrapLng[0]],n).x/e.x),Math.ceil(t.project([0,i.wrapLng[1]],n).x/e.y)],this._wrapY=i.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([i.wrapLat[0],0],n).y/e.x),Math.ceil(t.project([i.wrapLat[1],0],n).y/e.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var i=this._map,e=i._animatingZoom?Math.max(i._animateToZoom,i.getZoom()):i.getZoom(),n=i.getZoomScale(e,this._tileZoom),o=i.project(t,this._tileZoom).floor(),s=i.getSize().divideBy(2*n);return new I(o.subtract(s),o.add(s))},_update:function(t){var i=this._map;if(i){var e=this._clampZoom(i.getZoom());if(void 0===t&&(t=i.getCenter()),void 0!==this._tileZoom){var n=this._getTiledPixelBounds(t),o=this._pxBoundsToTileRange(n),s=o.getCenter(),r=[],a=this.options.keepBuffer,h=new I(o.getBottomLeft().subtract([a,-a]),o.getTopRight().add([a,-a]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var u in this._tiles){var l=this._tiles[u].coords;l.z===this._tileZoom&&h.contains(new k(l.x,l.y))||(this._tiles[u].current=!1)}if(1<Math.abs(e-this._tileZoom))this._setView(t,e);else{for(var c=o.min.y;c<=o.max.y;c++)for(var _=o.min.x;_<=o.max.x;_++){var d,p=new k(_,c);p.z=this._tileZoom,this._isValidTile(p)&&((d=this._tiles[this._tileCoordsToKey(p)])?d.current=!0:r.push(p))}if(r.sort(function(t,i){return t.distanceTo(s)-i.distanceTo(s)}),0!==r.length){this._loading||(this._loading=!0,this.fire("loading"));for(var m=document.createDocumentFragment(),_=0;_<r.length;_++)this._addTile(r[_],m);this._level.el.appendChild(m)}}}}},_isValidTile:function(t){var i=this._map.options.crs;if(!i.infinite){var e=this._globalTileRange;if(!i.wrapLng&&(t.x<e.min.x||t.x>e.max.x)||!i.wrapLat&&(t.y<e.min.y||t.y>e.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return N(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var i=this._map,e=this.getTileSize(),n=t.scaleBy(e),o=n.add(e);return[i.unproject(n,t.z),i.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var i=this._tileCoordsToNwSe(t),e=new R(i[0],i[1]);return this.options.noWrap||(e=this._map.wrapLatLngBounds(e)),e},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var i=t.split(":"),e=new k(+i[0],+i[1]);return e.z=+i[2],e},_removeTile:function(t){var i=this._tiles[t];i&&(ri(i.el),delete this._tiles[t],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){ci(t,"leaflet-tile");var i=this.getTileSize();t.style.width=i.x+"px",t.style.height=i.y+"px",t.onselectstart=a,t.onmousemove=a,it&&this.options.opacity<1&&mi(t,this.options.opacity),ot&&!st&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,i){var e=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),p(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&M(p(this._tileReady,this,t,null,o)),vi(o,e),this._tiles[n]={el:o,coords:t,current:!0},i.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,i,e){i&&this.fire("tileerror",{error:i,tile:e,coords:t});var n=this._tileCoordsToKey(t);(e=this._tiles[n])&&(e.loaded=+new Date,this._map._fadeAnimated?(mi(e.el,0),z(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this)):(e.active=!0,this._pruneTiles()),i||(ci(e.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:e.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),it||!this._map._fadeAnimated?M(this._pruneTiles,this):setTimeout(p(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var i=new k(this._wrapX?o(t.x,this._wrapX):t.x,this._wrapY?o(t.y,this._wrapY):t.y);return i.z=t.z,i},_pxBoundsToTileRange:function(t){var i=this.getTileSize();return new I(t.min.unscaleBy(i).floor(),t.max.unscaleBy(i).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});var sn=on.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,i){this._url=t,(i=c(this,i)).detectRetina&&zt&&0<i.maxZoom&&(i.tileSize=Math.floor(i.tileSize/2),i.zoomReverse?(i.zoomOffset--,i.minZoom++):(i.zoomOffset++,i.maxZoom--),i.minZoom=Math.max(0,i.minZoom)),"string"==typeof i.subdomains&&(i.subdomains=i.subdomains.split("")),ot||this.on("tileunload",this._onTileRemove)},setUrl:function(t,i){return this._url===t&&void 0===i&&(i=!0),this._url=t,i||this.redraw(),this},createTile:function(t,i){var e=document.createElement("img");return zi(e,"load",p(this._tileOnLoad,this,i,e)),zi(e,"error",p(this._tileOnError,this,i,e)),!this.options.crossOrigin&&""!==this.options.crossOrigin||(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),e.alt="",e.setAttribute("role","presentation"),e.src=this.getTileUrl(t),e},getTileUrl:function(t){var i,e={r:zt?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};return this._map&&!this._map.options.crs.infinite&&(i=this._globalTileRange.max.y-t.y,this.options.tms&&(e.y=i),e["-y"]=i),f(this._url,h(e,this.options))},_tileOnLoad:function(t,i){it?setTimeout(p(t,this,null,i),0):t(null,i)},_tileOnError:function(t,i,e){var n=this.options.errorTileUrl;n&&i.getAttribute("src")!==n&&(i.src=n),t(e,i)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,i=this.options.maxZoom;return this.options.zoomReverse&&(t=i-t),t+this.options.zoomOffset},_getSubdomain:function(t){var i=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[i]},_abortLoading:function(){var t,i;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((i=this._tiles[t].el).onload=a,i.onerror=a,i.complete||(i.src=y,ri(i),delete this._tiles[t]))},_removeTile:function(t){var i=this._tiles[t];if(i)return at||i.el.setAttribute("src",y),on.prototype._removeTile.call(this,t)},_tileReady:function(t,i,e){if(this._map&&(!e||e.getAttribute("src")!==y))return on.prototype._tileReady.call(this,t,i,e)}});function rn(t,i){return new sn(t,i)}var an=sn.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,i){this._url=t;var e=h({},this.defaultWmsParams);for(var n in i)n in this.options||(e[n]=i[n]);var o=(i=c(this,i)).detectRetina&&zt?2:1,s=this.getTileSize();e.width=s.x*o,e.height=s.y*o,this.wmsParams=e},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var i=1.3<=this._wmsVersion?"crs":"srs";this.wmsParams[i]=this._crs.code,sn.prototype.onAdd.call(this,t)},getTileUrl:function(t){var i=this._tileCoordsToNwSe(t),e=this._crs,n=O(e.project(i[0]),e.project(i[1])),o=n.min,s=n.max,r=(1.3<=this._wmsVersion&&this._crs===be?[o.y,o.x,s.y,s.x]:[o.x,o.y,s.x,s.y]).join(","),a=sn.prototype.getTileUrl.call(this,t);return a+_(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,i){return h(this.wmsParams,t),i||this.redraw(),this}});sn.WMS=an,rn.wms=function(t,i){return new an(t,i)};var hn=Me.extend({options:{padding:.1,tolerance:0},initialize:function(t){c(this,t),m(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&ci(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,i){var e=this._map.getZoomScale(i,this._zoom),n=yi(this._container),o=this._map.getSize().multiplyBy(.5+this.options.padding),s=this._map.project(this._center,i),r=this._map.project(t,i).subtract(s),a=o.multiplyBy(-e).add(n).add(o).subtract(r);vt?gi(this._container,a,e):vi(this._container,a)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,i=this._map.getSize(),e=this._map.containerPointToLayerPoint(i.multiplyBy(-t)).round();this._bounds=new I(e,e.add(i.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),un=hn.extend({getEvents:function(){var t=hn.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){hn.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");zi(t,"mousemove",this._onMouseMove,this),zi(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),zi(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){z(this._redrawRequest),delete this._ctx,ri(this._container),Si(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){var t,i,e,n;this._map._animatingZoom&&this._bounds||(hn.prototype._update.call(this),t=this._bounds,i=this._container,e=t.getSize(),n=zt?2:1,vi(i,t.min),i.width=n*e.x,i.height=n*e.y,i.style.width=e.x+"px",i.style.height=e.y+"px",zt&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update"))},_reset:function(){hn.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t);var i=(this._layers[m(t)]=t)._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=i),this._drawLast=i,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var i=t._order,e=i.next,n=i.prev;e?e.prev=n:this._drawLast=n,n?n.next=e:this._drawFirst=e,delete t._order,delete this._layers[m(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){for(var i,e=t.options.dashArray.split(/[, ]+/),n=[],o=0;o<e.length;o++){if(i=Number(e[o]),isNaN(i))return;n.push(i)}t.options._dashArray=n}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||M(this._redraw,this))},_extendRedrawBounds:function(t){var i;t._pxBounds&&(i=(t.options.weight||0)+1,this._redrawBounds=this._redrawBounds||new I,this._redrawBounds.extend(t._pxBounds.min.subtract([i,i])),this._redrawBounds.extend(t._pxBounds.max.add([i,i])))},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t,i=this._redrawBounds;i?(t=i.getSize(),this._ctx.clearRect(i.min.x,i.min.y,t.x,t.y)):(this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore())},_draw:function(){var t,i,e=this._redrawBounds;this._ctx.save(),e&&(i=e.getSize(),this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,i.x,i.y),this._ctx.clip()),this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)t=n.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,i){if(this._drawing){var e,n,o,s,r=t._parts,a=r.length,h=this._ctx;if(a){for(h.beginPath(),e=0;e<a;e++){for(n=0,o=r[e].length;n<o;n++)s=r[e][n],h[n?"lineTo":"moveTo"](s.x,s.y);i&&h.closePath()}this._fillStroke(h,t)}}},_updateCircle:function(t){var i,e,n,o;this._drawing&&!t._empty()&&(i=t._point,e=this._ctx,n=Math.max(Math.round(t._radius),1),1!=(o=(Math.max(Math.round(t._radiusY),1)||n)/n)&&(e.save(),e.scale(1,o)),e.beginPath(),e.arc(i.x,i.y/o,n,0,2*Math.PI,!1),1!=o&&e.restore(),this._fillStroke(e,t))},_fillStroke:function(t,i){var e=i.options;e.fill&&(t.globalAlpha=e.fillOpacity,t.fillStyle=e.fillColor||e.color,t.fill(e.fillRule||"evenodd")),e.stroke&&0!==e.weight&&(t.setLineDash&&t.setLineDash(i.options&&i.options._dashArray||[]),t.globalAlpha=e.opacity,t.lineWidth=e.weight,t.strokeStyle=e.color,t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.stroke())},_onClick:function(t){for(var i,e,n=this._map.mouseEventToLayerPoint(t),o=this._drawFirst;o;o=o.next)(i=o.layer).options.interactive&&i._containsPoint(n)&&(("click"===t.type||"preclick"!==t.type)&&this._map._draggableMoved(i)||(e=i));e&&(Fi(t),this._fireEvent([e],t))},_onMouseMove:function(t){var i;!this._map||this._map.dragging.moving()||this._map._animatingZoom||(i=this._map.mouseEventToLayerPoint(t),this._handleMouseHover(t,i))},_handleMouseOut:function(t){var i=this._hoveredLayer;i&&(_i(this._container,"leaflet-interactive"),this._fireEvent([i],t,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(t,i){if(!this._mouseHoverThrottled){for(var e,n,o=this._drawFirst;o;o=o.next)(e=o.layer).options.interactive&&e._containsPoint(i)&&(n=e);n!==this._hoveredLayer&&(this._handleMouseOut(t),n&&(ci(this._container,"leaflet-interactive"),this._fireEvent([n],t,"mouseover"),this._hoveredLayer=n)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t),this._mouseHoverThrottled=!0,setTimeout(p(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(t,i,e){this._map._fireDOMEvent(i,e||i.type,t)},_bringToFront:function(t){var i,e,n=t._order;n&&(i=n.next,e=n.prev,i&&((i.prev=e)?e.next=i:i&&(this._drawFirst=i),n.prev=this._drawLast,(this._drawLast.next=n).next=null,this._drawLast=n,this._requestRedraw(t)))},_bringToBack:function(t){var i,e,n=t._order;n&&(i=n.next,(e=n.prev)&&((e.next=i)?i.prev=e:e&&(this._drawLast=e),n.prev=null,n.next=this._drawFirst,this._drawFirst.prev=n,this._drawFirst=n,this._requestRedraw(t)))}});function ln(t){return St?new un(t):null}var cn=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),_n={_initContainer:function(){this._container=si("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(hn.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var i=t._container=cn("shape");ci(i,"leaflet-vml-shape "+(this.options.className||"")),i.coordsize="1 1",t._path=cn("path"),i.appendChild(t._path),this._updateStyle(t),this._layers[m(t)]=t},_addPath:function(t){var i=t._container;this._container.appendChild(i),t.options.interactive&&t.addInteractiveTarget(i)},_removePath:function(t){var i=t._container;ri(i),t.removeInteractiveTarget(i),delete this._layers[m(t)]},_updateStyle:function(t){var i=t._stroke,e=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(i=i||(t._stroke=cn("stroke")),o.appendChild(i),i.weight=n.weight+"px",i.color=n.color,i.opacity=n.opacity,n.dashArray?i.dashStyle=g(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):i.dashStyle="",i.endcap=n.lineCap.replace("butt","flat"),i.joinstyle=n.lineJoin):i&&(o.removeChild(i),t._stroke=null),n.fill?(e=e||(t._fill=cn("fill")),o.appendChild(e),e.color=n.fillColor||n.color,e.opacity=n.fillOpacity):e&&(o.removeChild(e),t._fill=null)},_updateCircle:function(t){var i=t._point.round(),e=Math.round(t._radius),n=Math.round(t._radiusY||e);this._setPath(t,t._empty()?"M0 0":"AL "+i.x+","+i.y+" "+e+","+n+" 0,23592600")},_setPath:function(t,i){t._path.v=i},_bringToFront:function(t){hi(t._container)},_bringToBack:function(t){ui(t._container)}},dn=Et?cn:J,pn=hn.extend({getEvents:function(){var t=hn.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=dn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=dn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ri(this._container),Si(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){var t,i,e;this._map._animatingZoom&&this._bounds||(hn.prototype._update.call(this),i=(t=this._bounds).getSize(),e=this._container,this._svgSize&&this._svgSize.equals(i)||(this._svgSize=i,e.setAttribute("width",i.x),e.setAttribute("height",i.y)),vi(e,t.min),e.setAttribute("viewBox",[t.min.x,t.min.y,i.x,i.y].join(" ")),this.fire("update"))},_initPath:function(t){var i=t._path=dn("path");t.options.className&&ci(i,t.options.className),t.options.interactive&&ci(i,"leaflet-interactive"),this._updateStyle(t),this._layers[m(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ri(t._path),t.removeInteractiveTarget(t._path),delete this._layers[m(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var i=t._path,e=t.options;i&&(e.stroke?(i.setAttribute("stroke",e.color),i.setAttribute("stroke-opacity",e.opacity),i.setAttribute("stroke-width",e.weight),i.setAttribute("stroke-linecap",e.lineCap),i.setAttribute("stroke-linejoin",e.lineJoin),e.dashArray?i.setAttribute("stroke-dasharray",e.dashArray):i.removeAttribute("stroke-dasharray"),e.dashOffset?i.setAttribute("stroke-dashoffset",e.dashOffset):i.removeAttribute("stroke-dashoffset")):i.setAttribute("stroke","none"),e.fill?(i.setAttribute("fill",e.fillColor||e.color),i.setAttribute("fill-opacity",e.fillOpacity),i.setAttribute("fill-rule",e.fillRule||"evenodd")):i.setAttribute("fill","none"))},_updatePoly:function(t,i){this._setPath(t,$(t._parts,i))},_updateCircle:function(t){var i=t._point,e=Math.max(Math.round(t._radius),1),n="a"+e+","+(Math.max(Math.round(t._radiusY),1)||e)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(i.x-e)+","+i.y+n+2*e+",0 "+n+2*-e+",0 ";this._setPath(t,o)},_setPath:function(t,i){t._path.setAttribute("d",i)},_bringToFront:function(t){hi(t._path)},_bringToBack:function(t){ui(t._path)}});function mn(t){return Zt||Et?new pn(t):null}Et&&pn.include(_n),Ki.include({getRenderer:function(t){var i=(i=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer)||(this._renderer=this._createRenderer());return this.hasLayer(i)||this.addLayer(i),i},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var i=this._paneRenderers[t];return void 0===i&&(i=this._createRenderer({pane:t}),this._paneRenderers[t]=i),i},_createRenderer:function(t){return this.options.preferCanvas&&ln(t)||mn(t)}});var fn=Re.extend({initialize:function(t,i){Re.prototype.initialize.call(this,this._boundsToLatLngs(t),i)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=N(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});pn.create=dn,pn.pointsToPath=$,Ne.geometryToLayer=De,Ne.coordsToLatLng=We,Ne.coordsToLatLngs=He,Ne.latLngToCoords=Fe,Ne.latLngsToCoords=Ue,Ne.getFeature=Ve,Ne.asFeature=qe,Ki.mergeOptions({boxZoom:!0});var gn=ie.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){zi(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Si(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ri(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),Xt(),xi(),this._startPoint=this._map.mouseEventToContainerPoint(t),zi(document,{contextmenu:Ni,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=si("div","leaflet-zoom-box",this._container),ci(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var i=new I(this._point,this._startPoint),e=i.getSize();vi(this._box,i.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(ri(this._box),_i(this._container,"leaflet-crosshair")),Jt(),wi(),Si(document,{contextmenu:Ni,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){var i;1!==t.which&&1!==t.button||(this._finish(),this._moved&&(this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(p(this._resetState,this),0),i=new R(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point)),this._map.fitBounds(i).fire("boxzoomend",{boxZoomBounds:i})))},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});Ki.addInitHook("addHandler","boxZoom",gn),Ki.mergeOptions({doubleClickZoom:!0});var vn=ie.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var i=this._map,e=i.getZoom(),n=i.options.zoomDelta,o=t.originalEvent.shiftKey?e-n:e+n;"center"===i.options.doubleClickZoom?i.setZoom(o):i.setZoomAround(t.containerPoint,o)}});Ki.addInitHook("addHandler","doubleClickZoom",vn),Ki.mergeOptions({dragging:!0,inertia:!st,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var yn=ie.extend({addHooks:function(){var t;this._draggable||(t=this._map,this._draggable=new ae(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))),ci(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){_i(this._map._container,"leaflet-grab"),_i(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t,i=this._map;i._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity?(t=N(this._map.options.maxBounds),this._offsetLimit=O(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))):this._offsetLimit=null,i.fire("movestart").fire("dragstart"),i.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){var i,e;this._map.options.inertia&&(i=this._lastTime=+new Date,e=this._lastPos=this._draggable._absPos||this._draggable._newPos,this._positions.push(e),this._times.push(i),this._prunePositions(i)),this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1<this._positions.length&&50<t-this._times[0];)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),i=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=i.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,i){return t-(t-i)*this._viscosity},_onPreDragLimit:function(){var t,i;this._viscosity&&this._offsetLimit&&(t=this._draggable._newPos.subtract(this._draggable._startPos),i=this._offsetLimit,t.x<i.min.x&&(t.x=this._viscousLimit(t.x,i.min.x)),t.y<i.min.y&&(t.y=this._viscousLimit(t.y,i.min.y)),t.x>i.max.x&&(t.x=this._viscousLimit(t.x,i.max.x)),t.y>i.max.y&&(t.y=this._viscousLimit(t.y,i.max.y)),this._draggable._newPos=this._draggable._startPos.add(t))},_onPreDragWrap:function(){var t=this._worldWidth,i=Math.round(t/2),e=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-i+e)%t+i-e,s=(n+i+e)%t-i-e,r=Math.abs(o+e)<Math.abs(s+e)?o:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=r},_onDragEnd:function(t){var i,e,n,o,s,r,a,h,u,l=this._map,c=l.options,_=!c.inertia||this._times.length<2;l.fire("dragend",t),_?l.fire("moveend"):(this._prunePositions(+new Date),i=this._lastPos.subtract(this._positions[0]),e=(this._lastTime-this._times[0])/1e3,n=c.easeLinearity,s=(o=i.multiplyBy(n/e)).distanceTo([0,0]),r=Math.min(c.inertiaMaxSpeed,s),a=o.multiplyBy(r/s),h=r/(c.inertiaDeceleration*n),(u=a.multiplyBy(-h
9265/2).round()).x||u.y?(u=l._limitOffset(u,l.options.maxBounds),M(function(){l.panBy(u,{duration:h,easeLinearity:n,noMoveStart:!0,animate:!0})})):l.fire("moveend"))}});Ki.addInitHook("addHandler","dragging",yn),Ki.mergeOptions({keyboard:!0,keyboardPanDelta:80});var xn=ie.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),zi(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Si(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){var t,i,e,n;this._focused||(t=document.body,i=document.documentElement,e=t.scrollTop||i.scrollTop,n=t.scrollLeft||i.scrollLeft,this._map._container.focus(),window.scrollTo(n,e))},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){for(var i=this._panKeys={},e=this.keyCodes,n=0,o=e.left.length;n<o;n++)i[e.left[n]]=[-1*t,0];for(n=0,o=e.right.length;n<o;n++)i[e.right[n]]=[t,0];for(n=0,o=e.down.length;n<o;n++)i[e.down[n]]=[0,t];for(n=0,o=e.up.length;n<o;n++)i[e.up[n]]=[0,-1*t]},_setZoomDelta:function(t){for(var i=this._zoomKeys={},e=this.keyCodes,n=0,o=e.zoomIn.length;n<o;n++)i[e.zoomIn[n]]=t;for(n=0,o=e.zoomOut.length;n<o;n++)i[e.zoomOut[n]]=-t},_addHooks:function(){zi(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Si(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var i,e=t.keyCode,n=this._map;if(e in this._panKeys)n._panAnim&&n._panAnim._inProgress||(i=this._panKeys[e],t.shiftKey&&(i=A(i).multiplyBy(3)),n.panBy(i),n.options.maxBounds&&n.panInsideBounds(n.options.maxBounds));else if(e in this._zoomKeys)n.setZoom(n.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[e]);else{if(27!==e||!n._popup||!n._popup.options.closeOnEscapeKey)return;n.closePopup()}Ni(t)}}});Ki.addInitHook("addHandler","keyboard",xn),Ki.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var wn=ie.extend({addHooks:function(){zi(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Si(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var i=Wi(t),e=this._map.options.wheelDebounceTime;this._delta+=i,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var n=Math.max(e-(new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(p(this._performZoom,this),n),Ni(t)},_performZoom:function(){var t=this._map,i=t.getZoom(),e=this._map.options.zoomSnap||0;t._stop();var n=this._delta/(4*this._map.options.wheelPxPerZoomLevel),o=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,s=e?Math.ceil(o/e)*e:o,r=t._limitZoom(i+(0<this._delta?s:-s))-i;this._delta=0,this._startTime=null,r&&("center"===t.options.scrollWheelZoom?t.setZoom(i+r):t.setZoomAround(this._lastMousePos,i+r))}});Ki.addInitHook("addHandler","scrollWheelZoom",wn),Ki.mergeOptions({tap:!0,tapTolerance:15});var Pn=ie.extend({addHooks:function(){zi(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Si(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(Ri(t),this._fireClick=!0,1<t.touches.length)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var i=t.touches[0],e=i.target;this._startPos=this._newPos=new k(i.clientX,i.clientY),e.tagName&&"a"===e.tagName.toLowerCase()&&ci(e,"leaflet-active"),this._holdTimeout=setTimeout(p(function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",i))},this),1e3),this._simulateEvent("mousedown",i),zi(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){var i,e;clearTimeout(this._holdTimeout),Si(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches&&((e=(i=t.changedTouches[0]).target)&&e.tagName&&"a"===e.tagName.toLowerCase()&&_i(e,"leaflet-active"),this._simulateEvent("mouseup",i),this._isTapValid()&&this._simulateEvent("click",i))},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var i=t.touches[0];this._newPos=new k(i.clientX,i.clientY),this._simulateEvent("mousemove",i)},_simulateEvent:function(t,i){var e=document.createEvent("MouseEvents");e._simulated=!0,i.target._simulatedClick=!0,e.initMouseEvent(t,!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),i.target.dispatchEvent(e)}});!bt||Lt&&!ct||Ki.addInitHook("addHandler","tap",Pn),Ki.mergeOptions({touchZoom:bt&&!st,bounceAtZoomLimits:!0});var Ln=ie.extend({addHooks:function(){ci(this._map._container,"leaflet-touch-zoom"),zi(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){_i(this._map._container,"leaflet-touch-zoom"),Si(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var i,e,n=this._map;!t.touches||2!==t.touches.length||n._animatingZoom||this._zooming||(i=n.mouseEventToContainerPoint(t.touches[0]),e=n.mouseEventToContainerPoint(t.touches[1]),this._centerPoint=n.getSize()._divideBy(2),this._startLatLng=n.containerPointToLatLng(this._centerPoint),"center"!==n.options.touchZoom&&(this._pinchStartLatLng=n.containerPointToLatLng(i.add(e)._divideBy(2))),this._startDist=i.distanceTo(e),this._startZoom=n.getZoom(),this._moved=!1,this._zooming=!0,n._stop(),zi(document,"touchmove",this._onTouchMove,this),zi(document,"touchend",this._onTouchEnd,this),Ri(t))},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var i=this._map,e=i.mouseEventToContainerPoint(t.touches[0]),n=i.mouseEventToContainerPoint(t.touches[1]),o=e.distanceTo(n)/this._startDist;if(this._zoom=i.getScaleZoom(o,this._startZoom),!i.options.bounceAtZoomLimits&&(this._zoom<i.getMinZoom()&&o<1||this._zoom>i.getMaxZoom()&&1<o)&&(this._zoom=i._limitZoom(this._zoom)),"center"===i.options.touchZoom){if(this._center=this._startLatLng,1==o)return}else{var s=e._add(n)._divideBy(2)._subtract(this._centerPoint);if(1==o&&0===s.x&&0===s.y)return;this._center=i.unproject(i.project(this._pinchStartLatLng,this._zoom).subtract(s),this._zoom)}this._moved||(i._moveStart(!0,!1),this._moved=!0),z(this._animRequest);var r=p(i._move,i,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=M(r,this,!0),Ri(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,z(this._animRequest),Si(document,"touchmove",this._onTouchMove,this),Si(document,"touchend",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});Ki.addInitHook("addHandler","touchZoom",Ln),Ki.BoxZoom=gn,Ki.DoubleClickZoom=vn,Ki.Drag=yn,Ki.Keyboard=xn,Ki.ScrollWheelZoom=wn,Ki.Tap=Pn,Ki.TouchZoom=Ln,t.version="1.7.1",t.Control=Xi,t.control=Yi,t.Browser=Bt,t.Evented=E,t.Mixin=ne,t.Util=C,t.Class=S,t.Handler=ie,t.extend=h,t.bind=p,t.stamp=m,t.setOptions=c,t.DomEvent=qi,t.DomUtil=Mi,t.PosAnimation=Gi,t.Draggable=ae,t.LineUtil=fe,t.PolyUtil=ye,t.Point=k,t.point=A,t.Bounds=I,t.bounds=O,t.Transformation=q,t.transformation=G,t.Projection=Pe,t.LatLng=D,t.latLng=j,t.LatLngBounds=R,t.latLngBounds=N,t.CRS=H,t.GeoJSON=Ne,t.geoJSON=Ke,t.geoJson=Ye,t.Layer=Me,t.LayerGroup=ze,t.layerGroup=function(t,i){return new ze(t,i)},t.FeatureGroup=Ce,t.featureGroup=function(t,i){return new Ce(t,i)},t.ImageOverlay=Xe,t.imageOverlay=function(t,i,e){return new Xe(t,i,e)},t.VideoOverlay=Je,t.videoOverlay=function(t,i,e){return new Je(t,i,e)},t.SVGOverlay=$e,t.svgOverlay=function(t,i,e){return new $e(t,i,e)},t.DivOverlay=Qe,t.Popup=tn,t.popup=function(t,i){return new tn(t,i)},t.Tooltip=en,t.tooltip=function(t,i){return new en(t,i)},t.Icon=Se,t.icon=function(t){return new Se(t)},t.DivIcon=nn,t.divIcon=function(t){return new nn(t)},t.Marker=ke,t.marker=function(t,i){return new ke(t,i)},t.TileLayer=sn,t.tileLayer=rn,t.GridLayer=on,t.gridLayer=function(t){return new on(t)},t.SVG=pn,t.svg=mn,t.Renderer=hn,t.Canvas=un,t.canvas=ln,t.Path=Be,t.CircleMarker=Ae,t.circleMarker=function(t,i){return new Ae(t,i)},t.Circle=Ie,t.circle=function(t,i,e){return new Ie(t,i,e)},t.Polyline=Oe,t.polyline=function(t,i){return new Oe(t,i)},t.Polygon=Re,t.polygon=function(t,i){return new Re(t,i)},t.Rectangle=fn,t.rectangle=function(t,i){return new fn(t,i)},t.Map=Ki,t.map=function(t,i){return new Ki(t,i)};var bn=window.L;t.noConflict=function(){return window.L=bn,this},window.L=t});
9266//# sourceMappingURL=leaflet.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.